@sentry/replay 0.2.0-6 → 0.2.0-9
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/dist/index.es.js +110 -28
- package/dist/index.js +110 -28
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -157,6 +157,25 @@ function createLargestContentfulPaint(entry) {
|
|
|
157
157
|
},
|
|
158
158
|
};
|
|
159
159
|
}
|
|
160
|
+
function createMemoryEntry(memoryEntry) {
|
|
161
|
+
var jsHeapSizeLimit = memoryEntry.jsHeapSizeLimit, totalJSHeapSize = memoryEntry.totalJSHeapSize, usedJSHeapSize = memoryEntry.usedJSHeapSize;
|
|
162
|
+
// we can't use getAbsoluteTime because it adds the event time to
|
|
163
|
+
// window.performance.timeOrigin, so we get right now instead.
|
|
164
|
+
var time = new Date().getTime() / 1000;
|
|
165
|
+
return {
|
|
166
|
+
type: 'memory',
|
|
167
|
+
name: 'memory',
|
|
168
|
+
start: time,
|
|
169
|
+
end: time,
|
|
170
|
+
data: {
|
|
171
|
+
memory: {
|
|
172
|
+
jsHeapSizeLimit: jsHeapSizeLimit,
|
|
173
|
+
totalJSHeapSize: totalJSHeapSize,
|
|
174
|
+
usedJSHeapSize: usedJSHeapSize,
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
};
|
|
178
|
+
}
|
|
160
179
|
|
|
161
180
|
var REPLAY_SESSION_KEY = 'sentryReplaySession';
|
|
162
181
|
var ROOT_REPLAY_NAME = 'sentry-replay';
|
|
@@ -345,6 +364,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
345
364
|
// ms, we will re-use the existing session, otherwise create a new
|
|
346
365
|
// session
|
|
347
366
|
logger.log('Document has become active, but session has expired');
|
|
367
|
+
_this.loadSession({ expiry: VISIBILITY_CHANGE_TIMEOUT });
|
|
348
368
|
_this.triggerFullSnapshot();
|
|
349
369
|
}
|
|
350
370
|
// We definitely want to return if visibilityState is "visible", and I
|
|
@@ -374,8 +394,10 @@ var SentryReplay = /** @class */ (function () {
|
|
|
374
394
|
this.events = [];
|
|
375
395
|
}
|
|
376
396
|
SentryReplay.attachmentUrlFromDsn = function (dsn, eventId) {
|
|
377
|
-
var host = dsn.host,
|
|
378
|
-
|
|
397
|
+
var host = dsn.host, projectId = dsn.projectId, protocol = dsn.protocol, user = dsn.user;
|
|
398
|
+
var port = dsn.port !== '' ? ":".concat(dsn.port) : '';
|
|
399
|
+
var path = dsn.path !== '' ? "/".concat(dsn.path) : '';
|
|
400
|
+
return "".concat(protocol, "://").concat(host).concat(port).concat(path, "/api/").concat(projectId, "/events/").concat(eventId, "/attachments/?sentry_key=").concat(user, "&sentry_version=7&sentry_client=replay");
|
|
379
401
|
};
|
|
380
402
|
SentryReplay.prototype.setupOnce = function () {
|
|
381
403
|
var _this = this;
|
|
@@ -406,6 +428,8 @@ var SentryReplay = /** @class */ (function () {
|
|
|
406
428
|
event.tags = __assign(__assign({}, event.tags), { replayId: _this.session.id });
|
|
407
429
|
return event;
|
|
408
430
|
});
|
|
431
|
+
// not fully initialized and the event will not get properly sent to Sentry
|
|
432
|
+
this.createReplayEvent();
|
|
409
433
|
record(__assign(__assign({}, this.rrwebRecordOptions), { emit: function (event, isCheckout) {
|
|
410
434
|
// We want to batch uploads of replay events. Save events only if
|
|
411
435
|
// `<uploadMinDelay>` milliseconds have elapsed since the last event
|
|
@@ -416,13 +440,15 @@ var SentryReplay = /** @class */ (function () {
|
|
|
416
440
|
if (!_this.initialEventTimestampSinceFlush) {
|
|
417
441
|
_this.initialEventTimestampSinceFlush = now;
|
|
418
442
|
}
|
|
419
|
-
var uploadMaxDelayExceeded = isExpired(_this.initialEventTimestampSinceFlush, _this.options.uploadMaxDelay, now);
|
|
420
443
|
// Do not finish the replay event if we receive a new replay event
|
|
421
|
-
|
|
422
|
-
// finished the replay
|
|
423
|
-
if (_this.timeout && !uploadMaxDelayExceeded) {
|
|
444
|
+
if (_this.timeout) {
|
|
424
445
|
window.clearTimeout(_this.timeout);
|
|
425
446
|
}
|
|
447
|
+
// If this is false, it means session is expired, create and a new session and wait for checkout
|
|
448
|
+
if (!_this.checkAndHandleExpiredSession()) {
|
|
449
|
+
logger.error(new Error('Received replay event after session expired.'));
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
426
452
|
// We need to clear existing events on a checkout, otherwise they are
|
|
427
453
|
// incremental event updates and should be appended
|
|
428
454
|
if (isCheckout) {
|
|
@@ -435,9 +461,16 @@ var SentryReplay = /** @class */ (function () {
|
|
|
435
461
|
// See https://github.com/rrweb-io/rrweb/blob/d8f9290ca496712aa1e7d472549480c4e7876594/packages/rrweb/src/types.ts#L16
|
|
436
462
|
if (event.type === 2) {
|
|
437
463
|
// A fullsnapshot happens on initial load and if we need to start a
|
|
438
|
-
// new replay due to idle timeout. In the
|
|
439
|
-
//
|
|
440
|
-
_this.
|
|
464
|
+
// new replay due to idle timeout. In the latter case, a new session *should* have been started
|
|
465
|
+
// before triggering a new checkout
|
|
466
|
+
_this.finishReplayEvent();
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
var uploadMaxDelayExceeded = isExpired(_this.initialEventTimestampSinceFlush, _this.options.uploadMaxDelay, now);
|
|
470
|
+
// If `uploadMaxDelayExceeded` is true, then we should finish the replay event immediately,
|
|
471
|
+
// Otherwise schedule it to be finished in `this.options.uploadMinDelay`
|
|
472
|
+
if (uploadMaxDelayExceeded) {
|
|
473
|
+
logger.log('replay max delay exceeded, finishing replay event');
|
|
441
474
|
_this.finishReplayEvent();
|
|
442
475
|
return;
|
|
443
476
|
}
|
|
@@ -445,14 +478,17 @@ var SentryReplay = /** @class */ (function () {
|
|
|
445
478
|
// Sentry. Will be cancelled if an event happens before `uploadMinDelay`
|
|
446
479
|
// elapses.
|
|
447
480
|
_this.timeout = window.setTimeout(function () {
|
|
448
|
-
logger.log('
|
|
481
|
+
logger.log('replay timeout exceeded, finishing replay event');
|
|
449
482
|
_this.finishReplayEvent();
|
|
450
483
|
}, _this.options.uploadMinDelay);
|
|
451
484
|
} }));
|
|
452
485
|
this.addListeners();
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
486
|
+
};
|
|
487
|
+
/**
|
|
488
|
+
* Currently, this needs to be manually called (e.g. for tests). Sentry SDK does not support a teardown
|
|
489
|
+
*/
|
|
490
|
+
SentryReplay.prototype.teardown = function () {
|
|
491
|
+
this.removeListeners();
|
|
456
492
|
};
|
|
457
493
|
/**
|
|
458
494
|
* Loads a session from storage, or creates a new one
|
|
@@ -465,13 +501,35 @@ var SentryReplay = /** @class */ (function () {
|
|
|
465
501
|
});
|
|
466
502
|
};
|
|
467
503
|
SentryReplay.prototype.addListeners = function () {
|
|
504
|
+
var _this = this;
|
|
468
505
|
document.addEventListener('visibilitychange', this.handleVisibilityChange);
|
|
469
|
-
if ('PerformanceObserver' in window) {
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
506
|
+
if (!('PerformanceObserver' in window)) {
|
|
507
|
+
return;
|
|
508
|
+
}
|
|
509
|
+
this.performanceObserver = new PerformanceObserver(this.handlePerformanceObserver);
|
|
510
|
+
// Observe almost everything for now (no mark/measure)
|
|
511
|
+
[
|
|
512
|
+
'element',
|
|
513
|
+
'event',
|
|
514
|
+
'first-input',
|
|
515
|
+
'largest-contentful-paint',
|
|
516
|
+
'layout-shift',
|
|
517
|
+
'longtask',
|
|
518
|
+
'navigation',
|
|
519
|
+
'paint',
|
|
520
|
+
'resource',
|
|
521
|
+
].forEach(function (type) {
|
|
522
|
+
return _this.performanceObserver.observe({
|
|
523
|
+
type: type,
|
|
524
|
+
buffered: true,
|
|
474
525
|
});
|
|
526
|
+
});
|
|
527
|
+
};
|
|
528
|
+
SentryReplay.prototype.removeListeners = function () {
|
|
529
|
+
document.removeEventListener('visibilitychange', this.handleVisibilityChange);
|
|
530
|
+
if (this.performanceObserver) {
|
|
531
|
+
this.performanceObserver.disconnect();
|
|
532
|
+
this.performanceObserver = null;
|
|
475
533
|
}
|
|
476
534
|
};
|
|
477
535
|
/**
|
|
@@ -490,7 +548,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
490
548
|
SentryReplay.prototype.createReplayEvent = function () {
|
|
491
549
|
var _this = this;
|
|
492
550
|
logger.log('CreateReplayEvent rootReplayId', this.session.id);
|
|
493
|
-
this.replayEvent = Sentry.startTransaction({
|
|
551
|
+
this.replayEvent = Sentry.getCurrentHub().startTransaction({
|
|
494
552
|
name: REPLAY_EVENT_NAME,
|
|
495
553
|
parentSpanId: this.session.spanId,
|
|
496
554
|
traceId: this.session.traceId,
|
|
@@ -528,18 +586,42 @@ var SentryReplay = /** @class */ (function () {
|
|
|
528
586
|
this.performanceEvents = [];
|
|
529
587
|
// Parse the entries
|
|
530
588
|
var entryEvents = createPerformanceEntries(entries);
|
|
589
|
+
// window.performance.memory is a non-standard API and doesn't work on all browsers
|
|
590
|
+
// so we check before creating the event.
|
|
591
|
+
if ('memory' in window.performance) {
|
|
592
|
+
// @ts-expect-error memory doesn't exist on type Performance as the API is non-standard
|
|
593
|
+
entryEvents.push(createMemoryEntry(window.performance.memory));
|
|
594
|
+
}
|
|
531
595
|
// This current implementation is to create spans on the transaction referenced in `this.replayEvent`
|
|
532
596
|
this.createPerformanceSpans(entryEvents);
|
|
533
597
|
};
|
|
598
|
+
/**
|
|
599
|
+
*
|
|
600
|
+
*
|
|
601
|
+
* Returns true if session is not expired, false otherwise.
|
|
602
|
+
*/
|
|
603
|
+
SentryReplay.prototype.checkAndHandleExpiredSession = function (expiry) {
|
|
604
|
+
if (expiry === void 0) { expiry = SESSION_IDLE_DURATION; }
|
|
605
|
+
var oldSessionId = this.session.id;
|
|
606
|
+
// This will create a new session if expired, based on expiry length
|
|
607
|
+
this.loadSession({ expiry: expiry });
|
|
608
|
+
// Session was expired if session ids do not match
|
|
609
|
+
var isExpired = oldSessionId !== this.session.id;
|
|
610
|
+
if (!isExpired) {
|
|
611
|
+
return true;
|
|
612
|
+
}
|
|
613
|
+
// TODO: We could potentially figure out a way to save the last session,
|
|
614
|
+
// and produce a checkout based on a previous checkout + updates, and then
|
|
615
|
+
// replay the event on top. Or maybe replay the event on top of a refresh
|
|
616
|
+
// snapshot.
|
|
617
|
+
// For now create a new snapshot
|
|
618
|
+
this.triggerFullSnapshot();
|
|
619
|
+
return false;
|
|
620
|
+
};
|
|
534
621
|
SentryReplay.prototype.finishReplayEvent = function () {
|
|
535
622
|
var _a;
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
if (isExpired) {
|
|
539
|
-
// TBD: If it is expired, we do not send any events...we could send to
|
|
540
|
-
// the expired session, but not sure if that's great
|
|
541
|
-
console.error(new Error('Attempting to finish replay event after session expired.'));
|
|
542
|
-
return;
|
|
623
|
+
if (!this.checkAndHandleExpiredSession()) {
|
|
624
|
+
logger.error(new Error('Attempting to finish replay event after session expired.'));
|
|
543
625
|
}
|
|
544
626
|
if (!this.session.id) {
|
|
545
627
|
console.error(new Error('[Sentry]: No transaction, no replay'));
|
|
@@ -608,11 +690,11 @@ var SentryReplay = /** @class */ (function () {
|
|
|
608
690
|
return [2 /*return*/];
|
|
609
691
|
events = this.events;
|
|
610
692
|
this.events = [];
|
|
693
|
+
client = Sentry.getCurrentHub().getClient();
|
|
694
|
+
endpoint = SentryReplay.attachmentUrlFromDsn(client.getDsn(), eventId);
|
|
611
695
|
_a.label = 1;
|
|
612
696
|
case 1:
|
|
613
697
|
_a.trys.push([1, 3, , 4]);
|
|
614
|
-
client = Sentry.getCurrentHub().getClient();
|
|
615
|
-
endpoint = SentryReplay.attachmentUrlFromDsn(client.getDsn(), eventId);
|
|
616
698
|
return [4 /*yield*/, this.sendReplayRequest(endpoint, events)];
|
|
617
699
|
case 2:
|
|
618
700
|
_a.sent();
|
package/dist/index.js
CHANGED
|
@@ -181,6 +181,25 @@ function createLargestContentfulPaint(entry) {
|
|
|
181
181
|
},
|
|
182
182
|
};
|
|
183
183
|
}
|
|
184
|
+
function createMemoryEntry(memoryEntry) {
|
|
185
|
+
var jsHeapSizeLimit = memoryEntry.jsHeapSizeLimit, totalJSHeapSize = memoryEntry.totalJSHeapSize, usedJSHeapSize = memoryEntry.usedJSHeapSize;
|
|
186
|
+
// we can't use getAbsoluteTime because it adds the event time to
|
|
187
|
+
// window.performance.timeOrigin, so we get right now instead.
|
|
188
|
+
var time = new Date().getTime() / 1000;
|
|
189
|
+
return {
|
|
190
|
+
type: 'memory',
|
|
191
|
+
name: 'memory',
|
|
192
|
+
start: time,
|
|
193
|
+
end: time,
|
|
194
|
+
data: {
|
|
195
|
+
memory: {
|
|
196
|
+
jsHeapSizeLimit: jsHeapSizeLimit,
|
|
197
|
+
totalJSHeapSize: totalJSHeapSize,
|
|
198
|
+
usedJSHeapSize: usedJSHeapSize,
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
};
|
|
202
|
+
}
|
|
184
203
|
|
|
185
204
|
var REPLAY_SESSION_KEY = 'sentryReplaySession';
|
|
186
205
|
var ROOT_REPLAY_NAME = 'sentry-replay';
|
|
@@ -369,6 +388,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
369
388
|
// ms, we will re-use the existing session, otherwise create a new
|
|
370
389
|
// session
|
|
371
390
|
logger.log('Document has become active, but session has expired');
|
|
391
|
+
_this.loadSession({ expiry: VISIBILITY_CHANGE_TIMEOUT });
|
|
372
392
|
_this.triggerFullSnapshot();
|
|
373
393
|
}
|
|
374
394
|
// We definitely want to return if visibilityState is "visible", and I
|
|
@@ -398,8 +418,10 @@ var SentryReplay = /** @class */ (function () {
|
|
|
398
418
|
this.events = [];
|
|
399
419
|
}
|
|
400
420
|
SentryReplay.attachmentUrlFromDsn = function (dsn, eventId) {
|
|
401
|
-
var host = dsn.host,
|
|
402
|
-
|
|
421
|
+
var host = dsn.host, projectId = dsn.projectId, protocol = dsn.protocol, user = dsn.user;
|
|
422
|
+
var port = dsn.port !== '' ? ":".concat(dsn.port) : '';
|
|
423
|
+
var path = dsn.path !== '' ? "/".concat(dsn.path) : '';
|
|
424
|
+
return "".concat(protocol, "://").concat(host).concat(port).concat(path, "/api/").concat(projectId, "/events/").concat(eventId, "/attachments/?sentry_key=").concat(user, "&sentry_version=7&sentry_client=replay");
|
|
403
425
|
};
|
|
404
426
|
SentryReplay.prototype.setupOnce = function () {
|
|
405
427
|
var _this = this;
|
|
@@ -430,6 +452,8 @@ var SentryReplay = /** @class */ (function () {
|
|
|
430
452
|
event.tags = __assign(__assign({}, event.tags), { replayId: _this.session.id });
|
|
431
453
|
return event;
|
|
432
454
|
});
|
|
455
|
+
// not fully initialized and the event will not get properly sent to Sentry
|
|
456
|
+
this.createReplayEvent();
|
|
433
457
|
rrweb.record(__assign(__assign({}, this.rrwebRecordOptions), { emit: function (event, isCheckout) {
|
|
434
458
|
// We want to batch uploads of replay events. Save events only if
|
|
435
459
|
// `<uploadMinDelay>` milliseconds have elapsed since the last event
|
|
@@ -440,13 +464,15 @@ var SentryReplay = /** @class */ (function () {
|
|
|
440
464
|
if (!_this.initialEventTimestampSinceFlush) {
|
|
441
465
|
_this.initialEventTimestampSinceFlush = now;
|
|
442
466
|
}
|
|
443
|
-
var uploadMaxDelayExceeded = isExpired(_this.initialEventTimestampSinceFlush, _this.options.uploadMaxDelay, now);
|
|
444
467
|
// Do not finish the replay event if we receive a new replay event
|
|
445
|
-
|
|
446
|
-
// finished the replay
|
|
447
|
-
if (_this.timeout && !uploadMaxDelayExceeded) {
|
|
468
|
+
if (_this.timeout) {
|
|
448
469
|
window.clearTimeout(_this.timeout);
|
|
449
470
|
}
|
|
471
|
+
// If this is false, it means session is expired, create and a new session and wait for checkout
|
|
472
|
+
if (!_this.checkAndHandleExpiredSession()) {
|
|
473
|
+
logger.error(new Error('Received replay event after session expired.'));
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
450
476
|
// We need to clear existing events on a checkout, otherwise they are
|
|
451
477
|
// incremental event updates and should be appended
|
|
452
478
|
if (isCheckout) {
|
|
@@ -459,9 +485,16 @@ var SentryReplay = /** @class */ (function () {
|
|
|
459
485
|
// See https://github.com/rrweb-io/rrweb/blob/d8f9290ca496712aa1e7d472549480c4e7876594/packages/rrweb/src/types.ts#L16
|
|
460
486
|
if (event.type === 2) {
|
|
461
487
|
// A fullsnapshot happens on initial load and if we need to start a
|
|
462
|
-
// new replay due to idle timeout. In the
|
|
463
|
-
//
|
|
464
|
-
_this.
|
|
488
|
+
// new replay due to idle timeout. In the latter case, a new session *should* have been started
|
|
489
|
+
// before triggering a new checkout
|
|
490
|
+
_this.finishReplayEvent();
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
var uploadMaxDelayExceeded = isExpired(_this.initialEventTimestampSinceFlush, _this.options.uploadMaxDelay, now);
|
|
494
|
+
// If `uploadMaxDelayExceeded` is true, then we should finish the replay event immediately,
|
|
495
|
+
// Otherwise schedule it to be finished in `this.options.uploadMinDelay`
|
|
496
|
+
if (uploadMaxDelayExceeded) {
|
|
497
|
+
logger.log('replay max delay exceeded, finishing replay event');
|
|
465
498
|
_this.finishReplayEvent();
|
|
466
499
|
return;
|
|
467
500
|
}
|
|
@@ -469,14 +502,17 @@ var SentryReplay = /** @class */ (function () {
|
|
|
469
502
|
// Sentry. Will be cancelled if an event happens before `uploadMinDelay`
|
|
470
503
|
// elapses.
|
|
471
504
|
_this.timeout = window.setTimeout(function () {
|
|
472
|
-
logger.log('
|
|
505
|
+
logger.log('replay timeout exceeded, finishing replay event');
|
|
473
506
|
_this.finishReplayEvent();
|
|
474
507
|
}, _this.options.uploadMinDelay);
|
|
475
508
|
} }));
|
|
476
509
|
this.addListeners();
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
510
|
+
};
|
|
511
|
+
/**
|
|
512
|
+
* Currently, this needs to be manually called (e.g. for tests). Sentry SDK does not support a teardown
|
|
513
|
+
*/
|
|
514
|
+
SentryReplay.prototype.teardown = function () {
|
|
515
|
+
this.removeListeners();
|
|
480
516
|
};
|
|
481
517
|
/**
|
|
482
518
|
* Loads a session from storage, or creates a new one
|
|
@@ -489,13 +525,35 @@ var SentryReplay = /** @class */ (function () {
|
|
|
489
525
|
});
|
|
490
526
|
};
|
|
491
527
|
SentryReplay.prototype.addListeners = function () {
|
|
528
|
+
var _this = this;
|
|
492
529
|
document.addEventListener('visibilitychange', this.handleVisibilityChange);
|
|
493
|
-
if ('PerformanceObserver' in window) {
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
530
|
+
if (!('PerformanceObserver' in window)) {
|
|
531
|
+
return;
|
|
532
|
+
}
|
|
533
|
+
this.performanceObserver = new PerformanceObserver(this.handlePerformanceObserver);
|
|
534
|
+
// Observe almost everything for now (no mark/measure)
|
|
535
|
+
[
|
|
536
|
+
'element',
|
|
537
|
+
'event',
|
|
538
|
+
'first-input',
|
|
539
|
+
'largest-contentful-paint',
|
|
540
|
+
'layout-shift',
|
|
541
|
+
'longtask',
|
|
542
|
+
'navigation',
|
|
543
|
+
'paint',
|
|
544
|
+
'resource',
|
|
545
|
+
].forEach(function (type) {
|
|
546
|
+
return _this.performanceObserver.observe({
|
|
547
|
+
type: type,
|
|
548
|
+
buffered: true,
|
|
498
549
|
});
|
|
550
|
+
});
|
|
551
|
+
};
|
|
552
|
+
SentryReplay.prototype.removeListeners = function () {
|
|
553
|
+
document.removeEventListener('visibilitychange', this.handleVisibilityChange);
|
|
554
|
+
if (this.performanceObserver) {
|
|
555
|
+
this.performanceObserver.disconnect();
|
|
556
|
+
this.performanceObserver = null;
|
|
499
557
|
}
|
|
500
558
|
};
|
|
501
559
|
/**
|
|
@@ -514,7 +572,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
514
572
|
SentryReplay.prototype.createReplayEvent = function () {
|
|
515
573
|
var _this = this;
|
|
516
574
|
logger.log('CreateReplayEvent rootReplayId', this.session.id);
|
|
517
|
-
this.replayEvent = Sentry__namespace.startTransaction({
|
|
575
|
+
this.replayEvent = Sentry__namespace.getCurrentHub().startTransaction({
|
|
518
576
|
name: REPLAY_EVENT_NAME,
|
|
519
577
|
parentSpanId: this.session.spanId,
|
|
520
578
|
traceId: this.session.traceId,
|
|
@@ -552,18 +610,42 @@ var SentryReplay = /** @class */ (function () {
|
|
|
552
610
|
this.performanceEvents = [];
|
|
553
611
|
// Parse the entries
|
|
554
612
|
var entryEvents = createPerformanceEntries(entries);
|
|
613
|
+
// window.performance.memory is a non-standard API and doesn't work on all browsers
|
|
614
|
+
// so we check before creating the event.
|
|
615
|
+
if ('memory' in window.performance) {
|
|
616
|
+
// @ts-expect-error memory doesn't exist on type Performance as the API is non-standard
|
|
617
|
+
entryEvents.push(createMemoryEntry(window.performance.memory));
|
|
618
|
+
}
|
|
555
619
|
// This current implementation is to create spans on the transaction referenced in `this.replayEvent`
|
|
556
620
|
this.createPerformanceSpans(entryEvents);
|
|
557
621
|
};
|
|
622
|
+
/**
|
|
623
|
+
*
|
|
624
|
+
*
|
|
625
|
+
* Returns true if session is not expired, false otherwise.
|
|
626
|
+
*/
|
|
627
|
+
SentryReplay.prototype.checkAndHandleExpiredSession = function (expiry) {
|
|
628
|
+
if (expiry === void 0) { expiry = SESSION_IDLE_DURATION; }
|
|
629
|
+
var oldSessionId = this.session.id;
|
|
630
|
+
// This will create a new session if expired, based on expiry length
|
|
631
|
+
this.loadSession({ expiry: expiry });
|
|
632
|
+
// Session was expired if session ids do not match
|
|
633
|
+
var isExpired = oldSessionId !== this.session.id;
|
|
634
|
+
if (!isExpired) {
|
|
635
|
+
return true;
|
|
636
|
+
}
|
|
637
|
+
// TODO: We could potentially figure out a way to save the last session,
|
|
638
|
+
// and produce a checkout based on a previous checkout + updates, and then
|
|
639
|
+
// replay the event on top. Or maybe replay the event on top of a refresh
|
|
640
|
+
// snapshot.
|
|
641
|
+
// For now create a new snapshot
|
|
642
|
+
this.triggerFullSnapshot();
|
|
643
|
+
return false;
|
|
644
|
+
};
|
|
558
645
|
SentryReplay.prototype.finishReplayEvent = function () {
|
|
559
646
|
var _a;
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
if (isExpired) {
|
|
563
|
-
// TBD: If it is expired, we do not send any events...we could send to
|
|
564
|
-
// the expired session, but not sure if that's great
|
|
565
|
-
console.error(new Error('Attempting to finish replay event after session expired.'));
|
|
566
|
-
return;
|
|
647
|
+
if (!this.checkAndHandleExpiredSession()) {
|
|
648
|
+
logger.error(new Error('Attempting to finish replay event after session expired.'));
|
|
567
649
|
}
|
|
568
650
|
if (!this.session.id) {
|
|
569
651
|
console.error(new Error('[Sentry]: No transaction, no replay'));
|
|
@@ -632,11 +714,11 @@ var SentryReplay = /** @class */ (function () {
|
|
|
632
714
|
return [2 /*return*/];
|
|
633
715
|
events = this.events;
|
|
634
716
|
this.events = [];
|
|
717
|
+
client = Sentry__namespace.getCurrentHub().getClient();
|
|
718
|
+
endpoint = SentryReplay.attachmentUrlFromDsn(client.getDsn(), eventId);
|
|
635
719
|
_a.label = 1;
|
|
636
720
|
case 1:
|
|
637
721
|
_a.trys.push([1, 3, , 4]);
|
|
638
|
-
client = Sentry__namespace.getCurrentHub().getClient();
|
|
639
|
-
endpoint = SentryReplay.attachmentUrlFromDsn(client.getDsn(), eventId);
|
|
640
722
|
return [4 /*yield*/, this.sendReplayRequest(endpoint, events)];
|
|
641
723
|
case 2:
|
|
642
724
|
_a.sent();
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../node_modules/tslib/tslib.es6.js","../../src/createPerformanceEntry.ts","../../src/session/constants.ts","../../src/util/isExpired.ts","../../src/util/isSessionExpired.ts","../../src/util/logger.ts","../../src/session/saveSession.ts","../../src/session/createSession.ts","../../src/session/fetchSession.ts","../../src/session/getSession.ts","../../src/session/updateSessionActivity.ts","../../src/index.ts"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n","type EntryType =\n | 'element'\n | 'navigation'\n | 'resource'\n | 'mark'\n | 'measure'\n | 'paint'\n | 'longtask';\n\nexport interface ReplayPerformanceEntry {\n /**\n * One of these types https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry/entryType\n */\n type: string;\n\n /**\n * A more specific description of the performance entry\n */\n name: string;\n\n /**\n * The start timestamp in seconds\n */\n start: number;\n\n /**\n * The end timestamp in seconds\n */\n end: number;\n\n /**\n * Additional unstructured data to be included\n */\n data?: Record<string, any>;\n}\n\n// Map entryType -> function to normalize data for event\nconst ENTRY_TYPES: Record<\n string,\n (entry: PerformanceEntry) => ReplayPerformanceEntry\n> = {\n resource: createResourceEntry,\n paint: createPaintEntry,\n navigation: createNavigationEntry,\n ['largest-contentful-paint']: createLargestContentfulPaint,\n};\n\nexport function createPerformanceEntries(entries: PerformanceEntry[]) {\n return entries.map(createPerformanceEntry).filter(Boolean);\n}\n\nfunction createPerformanceEntry(entry: PerformanceEntry) {\n if (ENTRY_TYPES[entry.entryType] === undefined) {\n return null;\n }\n\n return ENTRY_TYPES[entry.entryType](entry);\n}\n\nfunction getAbsoluteTime(time: number) {\n return (window.performance.timeOrigin + time) / 1000;\n}\n\nfunction createPaintEntry(entry: PerformancePaintTiming) {\n const { duration, entryType, name, startTime } = entry;\n\n const start = getAbsoluteTime(startTime);\n return {\n type: entryType,\n name,\n start,\n end: start + duration,\n };\n}\n\nfunction createNavigationEntry(entry: PerformanceNavigationTiming) {\n // TODO: There looks to be some more interesting bits in here (domComplete, domContentLoaded)\n\n const { entryType, name, domComplete, startTime, transferSize, type } = entry;\n\n return {\n type: `${entryType}.${type}`,\n start: getAbsoluteTime(startTime),\n end: getAbsoluteTime(domComplete),\n name,\n data: {\n size: transferSize,\n },\n };\n}\nfunction createResourceEntry(entry: PerformanceResourceTiming) {\n const {\n entryType,\n initiatorType,\n name,\n responseEnd,\n startTime,\n transferSize,\n } = entry;\n\n return {\n type: `${entryType}.${initiatorType}`,\n start: getAbsoluteTime(startTime),\n end: getAbsoluteTime(responseEnd),\n name,\n data: {\n size: transferSize,\n },\n };\n}\n\nfunction createLargestContentfulPaint(\n entry: PerformanceEntry & { size: number }\n) {\n const { duration, entryType, startTime, size } = entry;\n\n const start = getAbsoluteTime(startTime);\n return {\n type: entryType,\n name: entryType,\n start,\n end: start + duration,\n data: {\n size,\n },\n };\n}\n","export const REPLAY_SESSION_KEY = 'sentryReplaySession';\nexport const ROOT_REPLAY_NAME = 'sentry-replay';\nexport const REPLAY_EVENT_NAME = 'sentry-replay-event';\n\n// Grace period to keep a session when a user changes tabs or hides window\nexport const VISIBILITY_CHANGE_TIMEOUT = 60000; // 1 minute\n// The idle limit for a session\nexport const SESSION_IDLE_DURATION = 900000; // 15 minutes\n","/**\n * Given an initial timestamp and an expiry duration, checks to see if current\n * time should be considered as expired.\n */\nexport function isExpired(\n initialTime: number,\n expiry: number,\n targetTime: number = +new Date()\n) {\n // Always expired if < 0\n if (expiry < 0) {\n return true;\n }\n\n // Never expires if == 0\n if (expiry === 0) {\n return false;\n }\n\n return initialTime + expiry <= targetTime;\n}\n","import { ReplaySession } from '@/session';\nimport { isExpired } from './isExpired';\n\n/**\n * Checks to see if session is expired\n */\nexport function isSessionExpired(\n session: ReplaySession,\n expiry: number,\n targetTime = +new Date()\n) {\n return isExpired(session.lastActivity, expiry, targetTime);\n}\n","import { logger as sentryLogger } from '@sentry/utils';\n\nimport { IS_DEBUG_BUILD } from '../flags';\n\nfunction wrapLogger(logFn: typeof sentryLogger[keyof typeof sentryLogger]) {\n return function wrappedLog(...args: any[]) {\n if (!IS_DEBUG_BUILD) {\n return;\n }\n return logFn.call(sentryLogger, '[Replay]', ...args);\n };\n}\n\nconst logger = {\n ...sentryLogger,\n error: wrapLogger(sentryLogger.error),\n warn: wrapLogger(sentryLogger.warn),\n log: wrapLogger(sentryLogger.log),\n};\n\nexport { logger };\n","import { REPLAY_SESSION_KEY } from './constants';\nimport { ReplaySession } from './types';\n\nexport function saveSession(session: ReplaySession) {\n const hasSessionStorage = 'sessionStorage' in window;\n if (!hasSessionStorage) {\n return;\n }\n\n try {\n window.sessionStorage.setItem(REPLAY_SESSION_KEY, JSON.stringify(session));\n } catch {\n // this shouldn't happen\n }\n}\n","import * as Sentry from '@sentry/browser';\n\nimport { logger } from '@/util/logger';\nimport { saveSession } from './saveSession';\nimport type { ReplaySession } from './types';\nimport { ROOT_REPLAY_NAME } from './constants';\n\ninterface CreateSessionParams {\n /**\n * Should save to sessionStorage?\n */\n stickySession: boolean;\n}\n\n/**\n * Create a new session, which in its current implementation is a Sentry event\n * that all replays will be saved to as attachments. Currently, we only expect\n * one of these Sentry events per \"replay session\".\n */\nexport function createSession({\n stickySession = false,\n}: CreateSessionParams): ReplaySession {\n const currentDate = new Date().getTime();\n\n // Create root replay event, this is where attachments will be saved\n const transaction = Sentry.getCurrentHub().startTransaction({\n name: ROOT_REPLAY_NAME,\n tags: {\n isReplayRoot: 'yes',\n },\n });\n\n // We have to finish the transaction to get an event ID to be able to\n // upload an attachment for that event\n // @ts-expect-error This returns an eventId (string), but is not typed as such\n const id: string = transaction.finish();\n\n logger.log(`Creating new session: ${id}`);\n\n const session = {\n id,\n spanId: transaction.spanId,\n traceId: transaction.traceId,\n started: currentDate,\n lastActivity: currentDate,\n };\n\n if (stickySession) {\n saveSession(session);\n }\n\n return session;\n}\n","import { REPLAY_SESSION_KEY } from './constants';\nimport { ReplaySession } from './types';\n\nexport function fetchSession(): ReplaySession | null {\n const hasSessionStorage = 'sessionStorage' in window;\n\n if (!hasSessionStorage) {\n return null;\n }\n\n try {\n return JSON.parse(window.sessionStorage.getItem(REPLAY_SESSION_KEY));\n } catch {\n return null;\n }\n}\n","import { isSessionExpired } from '@/util/isSessionExpired';\nimport { logger } from '@/util/logger';\nimport { createSession } from './createSession';\nimport { fetchSession } from './fetchSession';\n\ninterface GetSessionParams {\n /**\n * The length of time (in ms) which we will consider the session to be expired.\n */\n expiry: number;\n /**\n * Should save session to sessionStorage?\n */\n stickySession: boolean;\n}\n\n/**\n * Get or create a session\n */\nexport function getSession({ expiry, stickySession }: GetSessionParams) {\n const session = stickySession && fetchSession();\n\n if (session) {\n // If there is a session, check if it is valid (e.g. \"last activity\" time should be within the \"session idle time\")\n // TODO: We should probably set a max age on this as well\n const isExpired = isSessionExpired(session, expiry);\n\n if (!isExpired) {\n logger.log(`Using existing session: ${session.id}`);\n return session;\n } else {\n logger.log(`Session has expired`);\n }\n // Otherwise continue to create a new session\n }\n\n const newSession = createSession({ stickySession });\n\n return newSession;\n}\n","import { createSession } from './createSession';\nimport { fetchSession } from './fetchSession';\nimport { saveSession } from './saveSession';\n\nexport function updateSessionActivity({\n stickySession,\n}: {\n stickySession: boolean;\n}) {\n // Nothing to do if there are no sticky sessions\n if (!stickySession) {\n return;\n }\n\n const existingSession = fetchSession();\n\n // If user manually deleted from session storage, create a new session\n if (!existingSession) {\n // TBD: There was an issue here where sessions weren't saving and this\n // caused lots of transactions to be created\n return createSession({ stickySession });\n }\n\n const newSession = {\n ...existingSession,\n lastActivity: new Date().getTime(),\n };\n\n saveSession(newSession);\n\n return newSession;\n}\n","import * as Sentry from '@sentry/browser';\nimport { DsnComponents, Event, Scope, Transaction } from '@sentry/types';\n\nimport { record } from 'rrweb';\nimport type { eventWithTime } from 'rrweb/typings/types';\nimport {\n createPerformanceEntries,\n ReplayPerformanceEntry,\n} from './createPerformanceEntry';\nimport { ReplaySession } from './session';\nimport {\n REPLAY_EVENT_NAME,\n ROOT_REPLAY_NAME,\n SESSION_IDLE_DURATION,\n VISIBILITY_CHANGE_TIMEOUT,\n} from './session/constants';\nimport { getSession } from './session/getSession';\nimport { updateSessionActivity } from './session/updateSessionActivity';\nimport { isExpired } from './util/isExpired';\nimport { isSessionExpired } from './util/isSessionExpired';\nimport { logger } from './util/logger';\n\ntype RRWebEvent = eventWithTime;\ntype RRWebOptions = Parameters<typeof record>[0];\n\ninterface PluginOptions {\n /**\n * The amount of time to wait before sending a replay\n */\n uploadMinDelay?: number;\n\n /**\n * The max amount of time to wait before sending a replay\n */\n uploadMaxDelay?: number;\n\n /**\n * If false, will create a new session per pageload\n */\n stickySession?: boolean;\n}\n\ninterface SentryReplayConfiguration extends PluginOptions {\n /**\n * Options for `rrweb.record`\n */\n rrwebConfig?: RRWebOptions;\n}\n\nexport class SentryReplay {\n /**\n * @inheritDoc\n */\n public static id = 'Replay';\n\n /**\n * @inheritDoc\n */\n public name: string = SentryReplay.id;\n\n /**\n * Buffer of rrweb events that will be serialized as JSON and saved as an attachment to a Sentry event\n */\n public events: RRWebEvent[] = [];\n\n public performanceEvents: PerformanceEntry[] = [];\n\n /**\n * A Sentry Transaction that should capture every incremental rrweb update,\n * but *not* the attachments themselves. This is currently used to capture\n * breadcrumbs and maybe other spans (e.g. network requests)\n */\n private replayEvent: Transaction | undefined;\n\n /**\n * Options to pass to `rrweb.record()`\n */\n private readonly rrwebRecordOptions: RRWebOptions;\n\n private readonly options: PluginOptions;\n\n /**\n * setTimeout id used for debouncing sending rrweb attachments\n */\n private timeout: number;\n\n /**\n * The timestamp of the first event since the last flush.\n * This is used to determine if the maximum allowed time has passed before we should flush events again.\n */\n private initialEventTimestampSinceFlush: number | null = null;\n\n private performanceObserver: PerformanceObserver | null = null;\n\n private session: ReplaySession | undefined;\n\n private static attachmentUrlFromDsn(dsn: DsnComponents, eventId: string) {\n const { host, path, projectId, port, protocol, user } = dsn;\n return `${protocol}://${host}${port !== '' ? `:${port}` : ''}${\n path !== '' ? `/${path}` : ''\n }/api/${projectId}/events/${eventId}/attachments/?sentry_key=${user}&sentry_version=7&sentry_client=replay`;\n }\n\n public constructor({\n uploadMinDelay = 5000,\n uploadMaxDelay = 15000,\n stickySession = false, // TBD: Making this opt-in for now\n rrwebConfig: {\n maskAllInputs = true,\n blockClass = 'sr-block',\n ignoreClass = 'sr-ignore',\n maskTextClass = 'sr-mask',\n ...rrwebRecordOptions\n } = {},\n }: SentryReplayConfiguration = {}) {\n this.rrwebRecordOptions = {\n maskAllInputs,\n blockClass,\n ignoreClass,\n maskTextClass,\n ...rrwebRecordOptions,\n };\n\n this.options = { uploadMinDelay, uploadMaxDelay, stickySession };\n this.events = [];\n }\n\n setupOnce() {\n /**\n * Because we create a transaction in `setupOnce`, we can potentially create a\n * transaction before some native SDK integrations have run and applied their\n * own global event processor. An example is:\n * https://github.com/getsentry/sentry-javascript/blob/b47ceafbdac7f8b99093ce6023726ad4687edc48/packages/browser/src/integrations/useragent.ts\n *\n * So we do this as a workaround to wait for other global event processors to finish\n */\n window.setTimeout(() => this.setup());\n }\n\n setup() {\n this.loadSession({ expiry: SESSION_IDLE_DURATION });\n\n // If there is no session, then something bad has happened - can't continue\n if (!this.session) {\n throw new Error('Invalid session');\n }\n\n // Tag all (non replay) events that get sent to Sentry with the current\n // replay ID so that we can reference them later in the UI\n Sentry.addGlobalEventProcessor((event: Event) => {\n // Do not apply replayId to the root transaction\n if (event.transaction === ROOT_REPLAY_NAME) {\n return event;\n }\n\n event.tags = { ...event.tags, replayId: this.session.id };\n return event;\n });\n\n record({\n ...this.rrwebRecordOptions,\n emit: (event: RRWebEvent, isCheckout?: boolean) => {\n // We want to batch uploads of replay events. Save events only if\n // `<uploadMinDelay>` milliseconds have elapsed since the last event\n // *OR* if `<uploadMaxDelay>` milliseconds have elapsed.\n\n const now = new Date().getTime();\n\n // Timestamp of the first replay event since the last flush, this gets\n // reset when we finish the replay event\n if (!this.initialEventTimestampSinceFlush) {\n this.initialEventTimestampSinceFlush = now;\n }\n\n const uploadMaxDelayExceeded = isExpired(\n this.initialEventTimestampSinceFlush,\n this.options.uploadMaxDelay,\n now\n );\n\n // Do not finish the replay event if we receive a new replay event\n // unless `<uploadMaxDelay>` ms have elapsed since the last time we\n // finished the replay\n if (this.timeout && !uploadMaxDelayExceeded) {\n window.clearTimeout(this.timeout);\n }\n\n // We need to clear existing events on a checkout, otherwise they are\n // incremental event updates and should be appended\n if (isCheckout) {\n this.events = [event];\n } else {\n this.events.push(event);\n }\n\n // This event type is a fullsnapshot, we should save immediately when this occurs\n // See https://github.com/rrweb-io/rrweb/blob/d8f9290ca496712aa1e7d472549480c4e7876594/packages/rrweb/src/types.ts#L16\n if (event.type === 2) {\n // A fullsnapshot happens on initial load and if we need to start a\n // new replay due to idle timeout. In the later case we will need to\n // create a new session before finishing the replay.\n this.loadSession({ expiry: SESSION_IDLE_DURATION });\n this.finishReplayEvent();\n return;\n }\n\n // Set timer to finish replay event and send replay attachment to\n // Sentry. Will be cancelled if an event happens before `uploadMinDelay`\n // elapses.\n this.timeout = window.setTimeout(() => {\n logger.log('rrweb timeout hit, finishing replay event');\n this.finishReplayEvent();\n }, this.options.uploadMinDelay);\n },\n });\n\n this.addListeners();\n\n // XXX: this needs to be in `setupOnce` vs `constructor`, otherwise SDK is\n // not fully initialized and the event will not get properly sent to Sentry\n this.createReplayEvent();\n }\n\n /**\n * Loads a session from storage, or creates a new one\n */\n loadSession({ expiry }: { expiry: number }): void {\n this.session = getSession({\n expiry,\n stickySession: this.options.stickySession,\n });\n }\n\n addListeners() {\n document.addEventListener('visibilitychange', this.handleVisibilityChange);\n\n if ('PerformanceObserver' in window) {\n this.performanceObserver = new PerformanceObserver(\n this.handlePerformanceObserver\n );\n\n // Observe everything for now\n this.performanceObserver.observe({\n entryTypes: [...PerformanceObserver.supportedEntryTypes],\n });\n }\n }\n\n /**\n * Keep a list of performance entries that will be sent with a replay\n */\n handlePerformanceObserver = (\n list: PerformanceObserverEntryList\n // observer: PerformanceObserver\n ) => {\n this.performanceEvents = [...this.performanceEvents, ...list.getEntries()];\n };\n\n /**\n * Handle when visibility of the page changes. (e.g. new tab is opened)\n */\n handleVisibilityChange = () => {\n const isExpired = isSessionExpired(this.session, VISIBILITY_CHANGE_TIMEOUT);\n\n if (isExpired) {\n if (document.visibilityState === 'visible') {\n // If the user has come back to the page within VISIBILITY_CHANGE_TIMEOUT\n // ms, we will re-use the existing session, otherwise create a new\n // session\n logger.log('Document has become active, but session has expired');\n this.triggerFullSnapshot();\n }\n // We definitely want to return if visibilityState is \"visible\", and I\n // think we also want to do the same when \"hidden\", as there shouldn't be\n // any action to take if user has gone idle for a long period and then\n // comes back to hide the tab. We don't trigger a full snapshot because\n // we don't want to start a new session as they immediately have hidden\n // the tab.\n return;\n }\n\n // Otherwise if session is not expired...\n\n // Update with current timestamp as the last session activity\n // Only updating session on visibility change to be conservative about\n // writing to session storage. This could be changed in the future.\n updateSessionActivity({\n stickySession: this.options.stickySession,\n });\n\n // Send replay when the page/tab becomes hidden. There is no reason to send\n // replay if it becomes visible, since no actions we care about were done\n // while it was hidden\n if (document.visibilityState !== 'visible') {\n this.finishReplayEvent();\n }\n };\n\n /**\n * Trigger rrweb to take a full snapshot which will cause this plugin to\n * create a new Replay event.\n */\n triggerFullSnapshot() {\n logger.log('Taking full rrweb snapshot');\n record.takeFullSnapshot(true);\n }\n\n /**\n * This is our pseudo replay event disguised as a transaction. It will be\n * used to store performance entries and breadcrumbs for every incremental\n * replay event.\n **/\n createReplayEvent() {\n logger.log('CreateReplayEvent rootReplayId', this.session.id);\n this.replayEvent = Sentry.startTransaction({\n name: REPLAY_EVENT_NAME,\n parentSpanId: this.session.spanId,\n traceId: this.session.traceId,\n tags: {\n replayId: this.session.id,\n },\n });\n Sentry.configureScope((scope: Scope) => scope.setSpan(this.replayEvent));\n return this.replayEvent;\n }\n\n /**\n * Create a span for each performance entry. The parent transaction is `this.replayEvent`.\n */\n createPerformanceSpans(entries: ReplayPerformanceEntry[]) {\n entries.forEach(({ type, start, end, name, data }) => {\n const span = this.replayEvent?.startChild({\n op: type,\n description: name,\n startTimestamp: start,\n data,\n });\n span.finish(end);\n });\n }\n\n /**\n * Observed performance events are added to `this.performanceEvents`. These\n * are included in the replay event before it is finished and sent to Sentry.\n */\n addPerformanceEntries() {\n // Copy and reset entries before processing\n const entries = [...this.performanceEvents];\n this.performanceEvents = [];\n\n // Parse the entries\n const entryEvents = createPerformanceEntries(entries);\n\n // This current implementation is to create spans on the transaction referenced in `this.replayEvent`\n this.createPerformanceSpans(entryEvents);\n }\n\n finishReplayEvent() {\n // Ensure that our existing session has not expired\n const isExpired = isSessionExpired(this.session, SESSION_IDLE_DURATION);\n\n if (isExpired) {\n // TBD: If it is expired, we do not send any events...we could send to\n // the expired session, but not sure if that's great\n console.error(\n new Error('Attempting to finish replay event after session expired.')\n );\n return;\n }\n\n if (!this.session.id) {\n console.error(new Error('[Sentry]: No transaction, no replay'));\n return;\n }\n\n this.sendReplay(this.session.id);\n this.initialEventTimestampSinceFlush = null;\n // TBD: Alternatively we could update this after every rrweb event\n this.session.lastActivity = new Date().getTime();\n\n // include performance entries\n this.addPerformanceEntries();\n\n // Close out existing replay event and create a new one\n this.replayEvent?.setStatus('ok').finish();\n this.createReplayEvent();\n }\n\n /**\n * Determine if there is browser support for `navigator.sendBeacon`\n */\n hasSendBeacon() {\n return 'navigator' in window && 'sendBeacon' in window.navigator;\n }\n\n /**\n * Send replay attachment using either `sendBeacon()` or `fetch()`\n */\n async sendReplayRequest(endpoint: string, events: RRWebEvent[]) {\n const stringifiedPayload = JSON.stringify({ events });\n const formData = new FormData();\n formData.append(\n 'rrweb',\n new Blob([stringifiedPayload], {\n type: 'application/json',\n }),\n `rrweb-${new Date().getTime()}.json`\n );\n\n // If sendBeacon is supported and payload is smol enough...\n if (this.hasSendBeacon() && stringifiedPayload.length <= 65536) {\n logger.log(`uploading attachment via sendBeacon()`);\n window.navigator.sendBeacon(endpoint, formData);\n return;\n }\n\n // Otherwise use `fetch`, which *WILL* get cancelled on page reloads/unloads\n logger.log(`uploading attachment via fetch()`);\n await fetch(endpoint, {\n method: 'POST',\n body: formData,\n });\n }\n\n /**\n * Finalize and send the current replay event to Sentry\n */\n async sendReplay(eventId: string) {\n // short circuit if theres no events to replay\n if (!this.events.length) return;\n\n // Make a copy of the events array reference and immediately clear the\n // events member so that we do not lose new events while uploading\n // attachment.\n const events = this.events;\n this.events = [];\n\n try {\n const client = Sentry.getCurrentHub().getClient();\n const endpoint = SentryReplay.attachmentUrlFromDsn(\n client.getDsn(),\n eventId\n );\n\n await this.sendReplayRequest(endpoint, events);\n return true;\n } catch (ex) {\n // we have to catch this otherwise it throws an infinite loop in Sentry\n console.error(ex);\n\n // If an error happened here, it's likely that uploading the attachment failed, we'll want to restore the events that failed to upload\n this.events = [...events, ...this.events];\n return false;\n }\n }\n}\n"],"names":["sentryLogger","Sentry","record"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAiBA;AACO,IAAI,QAAQ,GAAG,WAAW;AACjC,IAAI,QAAQ,GAAG,MAAM,CAAC,MAAM,IAAI,SAAS,QAAQ,CAAC,CAAC,EAAE;AACrD,QAAQ,KAAK,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;AAC7D,YAAY,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAC7B,YAAY,KAA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AC;;;;wBAGT,MAAM,GAAGA,iBAAM,CAAC,aAAa,EAAE,CAAC,SAAS,EAAE,CAAC;AAC5C,wBAAA,QAAQ,GAAG,YAAY,CAAC,oBAAoB,CAChD,MAAM,CAAC,MAAM,EAAE,EACf,OAAO,CACR,CAAC;wBAEF,OAAM,CAAA,CAAA,YAAA,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA,CAAA;;AAA9C,wBAAA,EAAA,CAAA,IAAA,EAA8C,CAAC;AAC/C,wBAAA,OAAA,CAAA,CAAA,aAAO,IAAI,CAAC,CAAA;;;;AAGZ,wBAAA,OAAO,CAAC,KAAK,CAAC,IAAE,CAAC,CAAC;;wBAGlB,IAAI,CAAC,MAAM,GAAO,aAAA,CAAA,aAAA,CAAA,EAAA,EAAA,MAAM,SAAK,IAAI,CAAC,MAAM,EAAA,IAAA,CAAC,CAAC;AAC1C,wBAAA,OAAA,CAAA,CAAA,aAAO,KAAK,CAAC,CAAA;;;;;AAEhB,KAAA,CAAA;AApZD;;AAEG;IACW,YAAE,CAAA,EAAA,GAAG,QAAQ,CAAC;IAkZ9B,OAAC,YAAA,CAAA;AAAA,CAtZD,EAsZC;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../node_modules/tslib/tslib.es6.js","../../src/createPerformanceEntry.ts","../../src/session/constants.ts","../../src/util/isExpired.ts","../../src/util/isSessionExpired.ts","../../src/util/logger.ts","../../src/session/saveSession.ts","../../src/session/createSession.ts","../../src/session/fetchSession.ts","../../src/session/getSession.ts","../../src/session/updateSessionActivity.ts","../../src/index.ts"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n","type EntryType =\n | 'element'\n | 'navigation'\n | 'resource'\n | 'mark'\n | 'measure'\n | 'paint'\n | 'longtask';\n\nexport interface ReplayPerformanceEntry {\n /**\n * One of these types https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry/entryType\n */\n type: string;\n\n /**\n * A more specific description of the performance entry\n */\n name: string;\n\n /**\n * The start timestamp in seconds\n */\n start: number;\n\n /**\n * The end timestamp in seconds\n */\n end: number;\n\n /**\n * Additional unstructured data to be included\n */\n data?: Record<string, any>;\n}\n\ninterface MemoryInfo {\n jsHeapSizeLimit: number;\n totalJSHeapSize: number;\n usedJSHeapSize: number;\n}\n\n// Map entryType -> function to normalize data for event\nconst ENTRY_TYPES: Record<\n string,\n (entry: PerformanceEntry) => ReplayPerformanceEntry\n> = {\n resource: createResourceEntry,\n paint: createPaintEntry,\n navigation: createNavigationEntry,\n ['largest-contentful-paint']: createLargestContentfulPaint,\n};\n\nexport function createPerformanceEntries(entries: PerformanceEntry[]) {\n return entries.map(createPerformanceEntry).filter(Boolean);\n}\n\nfunction createPerformanceEntry(entry: PerformanceEntry) {\n if (ENTRY_TYPES[entry.entryType] === undefined) {\n return null;\n }\n\n return ENTRY_TYPES[entry.entryType](entry);\n}\n\nfunction getAbsoluteTime(time: number) {\n return (window.performance.timeOrigin + time) / 1000;\n}\n\nfunction createPaintEntry(entry: PerformancePaintTiming) {\n const { duration, entryType, name, startTime } = entry;\n\n const start = getAbsoluteTime(startTime);\n return {\n type: entryType,\n name,\n start,\n end: start + duration,\n };\n}\n\nfunction createNavigationEntry(entry: PerformanceNavigationTiming) {\n // TODO: There looks to be some more interesting bits in here (domComplete, domContentLoaded)\n\n const { entryType, name, domComplete, startTime, transferSize, type } = entry;\n\n return {\n type: `${entryType}.${type}`,\n start: getAbsoluteTime(startTime),\n end: getAbsoluteTime(domComplete),\n name,\n data: {\n size: transferSize,\n },\n };\n}\nfunction createResourceEntry(entry: PerformanceResourceTiming) {\n const {\n entryType,\n initiatorType,\n name,\n responseEnd,\n startTime,\n transferSize,\n } = entry;\n\n return {\n type: `${entryType}.${initiatorType}`,\n start: getAbsoluteTime(startTime),\n end: getAbsoluteTime(responseEnd),\n name,\n data: {\n size: transferSize,\n },\n };\n}\n\nfunction createLargestContentfulPaint(\n entry: PerformanceEntry & { size: number }\n) {\n const { duration, entryType, startTime, size } = entry;\n\n const start = getAbsoluteTime(startTime);\n return {\n type: entryType,\n name: entryType,\n start,\n end: start + duration,\n data: {\n size,\n },\n };\n}\n\nexport function createMemoryEntry(memoryEntry: MemoryInfo) {\n const { jsHeapSizeLimit, totalJSHeapSize, usedJSHeapSize } = memoryEntry;\n // we can't use getAbsoluteTime because it adds the event time to\n // window.performance.timeOrigin, so we get right now instead.\n const time = new Date().getTime() / 1000;\n return {\n type: 'memory',\n name: 'memory',\n start: time,\n end: time,\n data: {\n memory: {\n jsHeapSizeLimit,\n totalJSHeapSize,\n usedJSHeapSize,\n },\n },\n };\n}\n","export const REPLAY_SESSION_KEY = 'sentryReplaySession';\nexport const ROOT_REPLAY_NAME = 'sentry-replay';\nexport const REPLAY_EVENT_NAME = 'sentry-replay-event';\n\n// Grace period to keep a session when a user changes tabs or hides window\nexport const VISIBILITY_CHANGE_TIMEOUT = 60000; // 1 minute\n// The idle limit for a session\nexport const SESSION_IDLE_DURATION = 900000; // 15 minutes\n","/**\n * Given an initial timestamp and an expiry duration, checks to see if current\n * time should be considered as expired.\n */\nexport function isExpired(\n initialTime: number,\n expiry: number,\n targetTime: number = +new Date()\n) {\n // Always expired if < 0\n if (expiry < 0) {\n return true;\n }\n\n // Never expires if == 0\n if (expiry === 0) {\n return false;\n }\n\n return initialTime + expiry <= targetTime;\n}\n","import { ReplaySession } from '@/session';\nimport { isExpired } from './isExpired';\n\n/**\n * Checks to see if session is expired\n */\nexport function isSessionExpired(\n session: ReplaySession,\n expiry: number,\n targetTime = +new Date()\n) {\n return isExpired(session.lastActivity, expiry, targetTime);\n}\n","import { logger as sentryLogger } from '@sentry/utils';\n\nimport { IS_DEBUG_BUILD } from '../flags';\n\nfunction wrapLogger(logFn: typeof sentryLogger[keyof typeof sentryLogger]) {\n return function wrappedLog(...args: any[]) {\n if (!IS_DEBUG_BUILD) {\n return;\n }\n return logFn.call(sentryLogger, '[Replay]', ...args);\n };\n}\n\nconst logger = {\n ...sentryLogger,\n error: wrapLogger(sentryLogger.error),\n warn: wrapLogger(sentryLogger.warn),\n log: wrapLogger(sentryLogger.log),\n};\n\nexport { logger };\n","import { REPLAY_SESSION_KEY } from './constants';\nimport { ReplaySession } from './types';\n\nexport function saveSession(session: ReplaySession) {\n const hasSessionStorage = 'sessionStorage' in window;\n if (!hasSessionStorage) {\n return;\n }\n\n try {\n window.sessionStorage.setItem(REPLAY_SESSION_KEY, JSON.stringify(session));\n } catch {\n // this shouldn't happen\n }\n}\n","import * as Sentry from '@sentry/browser';\n\nimport { logger } from '@/util/logger';\nimport { saveSession } from './saveSession';\nimport type { ReplaySession } from './types';\nimport { ROOT_REPLAY_NAME } from './constants';\n\ninterface CreateSessionParams {\n /**\n * Should save to sessionStorage?\n */\n stickySession: boolean;\n}\n\n/**\n * Create a new session, which in its current implementation is a Sentry event\n * that all replays will be saved to as attachments. Currently, we only expect\n * one of these Sentry events per \"replay session\".\n */\nexport function createSession({\n stickySession = false,\n}: CreateSessionParams): ReplaySession {\n const currentDate = new Date().getTime();\n\n // Create root replay event, this is where attachments will be saved\n const transaction = Sentry.getCurrentHub().startTransaction({\n name: ROOT_REPLAY_NAME,\n tags: {\n isReplayRoot: 'yes',\n },\n });\n\n // We have to finish the transaction to get an event ID to be able to\n // upload an attachment for that event\n // @ts-expect-error This returns an eventId (string), but is not typed as such\n const id: string = transaction.finish();\n\n logger.log(`Creating new session: ${id}`);\n\n const session = {\n id,\n spanId: transaction.spanId,\n traceId: transaction.traceId,\n started: currentDate,\n lastActivity: currentDate,\n };\n\n if (stickySession) {\n saveSession(session);\n }\n\n return session;\n}\n","import { REPLAY_SESSION_KEY } from './constants';\nimport { ReplaySession } from './types';\n\nexport function fetchSession(): ReplaySession | null {\n const hasSessionStorage = 'sessionStorage' in window;\n\n if (!hasSessionStorage) {\n return null;\n }\n\n try {\n return JSON.parse(window.sessionStorage.getItem(REPLAY_SESSION_KEY));\n } catch {\n return null;\n }\n}\n","import { isSessionExpired } from '@/util/isSessionExpired';\nimport { logger } from '@/util/logger';\nimport { createSession } from './createSession';\nimport { fetchSession } from './fetchSession';\n\ninterface GetSessionParams {\n /**\n * The length of time (in ms) which we will consider the session to be expired.\n */\n expiry: number;\n /**\n * Should save session to sessionStorage?\n */\n stickySession: boolean;\n}\n\n/**\n * Get or create a session\n */\nexport function getSession({ expiry, stickySession }: GetSessionParams) {\n const session = stickySession && fetchSession();\n\n if (session) {\n // If there is a session, check if it is valid (e.g. \"last activity\" time should be within the \"session idle time\")\n // TODO: We should probably set a max age on this as well\n const isExpired = isSessionExpired(session, expiry);\n\n if (!isExpired) {\n logger.log(`Using existing session: ${session.id}`);\n return session;\n } else {\n logger.log(`Session has expired`);\n }\n // Otherwise continue to create a new session\n }\n\n const newSession = createSession({ stickySession });\n\n return newSession;\n}\n","import { createSession } from './createSession';\nimport { fetchSession } from './fetchSession';\nimport { saveSession } from './saveSession';\n\nexport function updateSessionActivity({\n stickySession,\n}: {\n stickySession: boolean;\n}) {\n // Nothing to do if there are no sticky sessions\n if (!stickySession) {\n return;\n }\n\n const existingSession = fetchSession();\n\n // If user manually deleted from session storage, create a new session\n if (!existingSession) {\n // TBD: There was an issue here where sessions weren't saving and this\n // caused lots of transactions to be created\n return createSession({ stickySession });\n }\n\n const newSession = {\n ...existingSession,\n lastActivity: new Date().getTime(),\n };\n\n saveSession(newSession);\n\n return newSession;\n}\n","import * as Sentry from '@sentry/browser';\nimport { DsnComponents, Event, Scope, Transaction } from '@sentry/types';\n\nimport { record } from 'rrweb';\nimport type { eventWithTime } from 'rrweb/typings/types';\nimport {\n createPerformanceEntries,\n createMemoryEntry,\n ReplayPerformanceEntry,\n} from './createPerformanceEntry';\nimport { ReplaySession } from './session';\nimport {\n REPLAY_EVENT_NAME,\n ROOT_REPLAY_NAME,\n SESSION_IDLE_DURATION,\n VISIBILITY_CHANGE_TIMEOUT,\n} from './session/constants';\nimport { getSession } from './session/getSession';\nimport { updateSessionActivity } from './session/updateSessionActivity';\nimport { isExpired } from './util/isExpired';\nimport { isSessionExpired } from './util/isSessionExpired';\nimport { logger } from './util/logger';\n\ntype RRWebEvent = eventWithTime;\ntype RRWebOptions = Parameters<typeof record>[0];\n\ninterface PluginOptions {\n /**\n * The amount of time to wait before sending a replay\n */\n uploadMinDelay?: number;\n\n /**\n * The max amount of time to wait before sending a replay\n */\n uploadMaxDelay?: number;\n\n /**\n * If false, will create a new session per pageload\n */\n stickySession?: boolean;\n}\n\ninterface SentryReplayConfiguration extends PluginOptions {\n /**\n * Options for `rrweb.recordsetup\n */\n rrwebConfig?: RRWebOptions;\n}\n\nexport class SentryReplay {\n /**\n * @inheritDoc\n */\n public static id = 'Replay';\n\n /**\n * @inheritDoc\n */\n public name: string = SentryReplay.id;\n\n /**\n * Buffer of rrweb events that will be serialized as JSON and saved as an attachment to a Sentry event\n */\n public events: RRWebEvent[] = [];\n\n public performanceEvents: PerformanceEntry[] = [];\n\n /**\n * A Sentry Transaction that should capture every incremental rrweb update,\n * but *not* the attachments themselves. This is currently used to capture\n * breadcrumbs and maybe other spans (e.g. network requests)\n */\n replayEvent: Transaction | undefined;\n\n /**\n * Options to pass to `rrweb.record()`\n */\n readonly rrwebRecordOptions: RRWebOptions;\n\n readonly options: PluginOptions;\n\n /**\n * setTimeout id used for debouncing sending rrweb attachments\n */\n private timeout: number;\n\n /**\n * The timestamp of the first event since the last flush.\n * This is used to determine if the maximum allowed time has passed before we should flush events again.\n */\n private initialEventTimestampSinceFlush: number | null = null;\n\n private performanceObserver: PerformanceObserver | null = null;\n\n session: ReplaySession | undefined;\n\n static attachmentUrlFromDsn(dsn: DsnComponents, eventId: string) {\n const { host, projectId, protocol, user } = dsn;\n\n const port = dsn.port !== '' ? `:${dsn.port}` : '';\n const path = dsn.path !== '' ? `/${dsn.path}` : '';\n\n return `${protocol}://${host}${port}${path}/api/${projectId}/events/${eventId}/attachments/?sentry_key=${user}&sentry_version=7&sentry_client=replay`;\n }\n\n constructor({\n uploadMinDelay = 5000,\n uploadMaxDelay = 15000,\n stickySession = false, // TBD: Making this opt-in for now\n rrwebConfig: {\n maskAllInputs = true,\n blockClass = 'sr-block',\n ignoreClass = 'sr-ignore',\n maskTextClass = 'sr-mask',\n ...rrwebRecordOptions\n } = {},\n }: SentryReplayConfiguration = {}) {\n this.rrwebRecordOptions = {\n maskAllInputs,\n blockClass,\n ignoreClass,\n maskTextClass,\n ...rrwebRecordOptions,\n };\n\n this.options = { uploadMinDelay, uploadMaxDelay, stickySession };\n this.events = [];\n }\n\n setupOnce() {\n /**\n * Because we create a transaction in `setupOnce`, we can potentially create a\n * transaction before some native SDK integrations have run and applied their\n * own global event processor. An example is:\n * https://github.com/getsentry/sentry-javascript/blob/b47ceafbdac7f8b99093ce6023726ad4687edc48/packages/browser/src/integrations/useragent.ts\n *\n * So we do this as a workaround to wait for other global event processors to finish\n */\n window.setTimeout(() => this.setup());\n }\n\n setup() {\n this.loadSession({ expiry: SESSION_IDLE_DURATION });\n\n // If there is no session, then something bad has happened - can't continue\n if (!this.session) {\n throw new Error('Invalid session');\n }\n\n // Tag all (non replay) events that get sent to Sentry with the current\n // replay ID so that we can reference them later in the UI\n Sentry.addGlobalEventProcessor((event: Event) => {\n // Do not apply replayId to the root transaction\n if (event.transaction === ROOT_REPLAY_NAME) {\n return event;\n }\n\n event.tags = { ...event.tags, replayId: this.session.id };\n return event;\n });\n\n // not fully initialized and the event will not get properly sent to Sentry\n this.createReplayEvent();\n\n record({\n ...this.rrwebRecordOptions,\n emit: (event: RRWebEvent, isCheckout?: boolean) => {\n // We want to batch uploads of replay events. Save events only if\n // `<uploadMinDelay>` milliseconds have elapsed since the last event\n // *OR* if `<uploadMaxDelay>` milliseconds have elapsed.\n\n const now = new Date().getTime();\n\n // Timestamp of the first replay event since the last flush, this gets\n // reset when we finish the replay event\n if (!this.initialEventTimestampSinceFlush) {\n this.initialEventTimestampSinceFlush = now;\n }\n\n // Do not finish the replay event if we receive a new replay event\n if (this.timeout) {\n window.clearTimeout(this.timeout);\n }\n\n // If this is false, it means session is expired, create and a new session and wait for checkout\n if (!this.checkAndHandleExpiredSession()) {\n logger.error(\n new Error('Received replay event after session expired.')\n );\n\n return;\n }\n\n // We need to clear existing events on a checkout, otherwise they are\n // incremental event updates and should be appended\n if (isCheckout) {\n this.events = [event];\n } else {\n this.events.push(event);\n }\n\n // This event type is a fullsnapshot, we should save immediately when this occurs\n // See https://github.com/rrweb-io/rrweb/blob/d8f9290ca496712aa1e7d472549480c4e7876594/packages/rrweb/src/types.ts#L16\n if (event.type === 2) {\n // A fullsnapshot happens on initial load and if we need to start a\n // new replay due to idle timeout. In the latter case, a new session *should* have been started\n // before triggering a new checkout\n this.finishReplayEvent();\n return;\n }\n\n const uploadMaxDelayExceeded = isExpired(\n this.initialEventTimestampSinceFlush,\n this.options.uploadMaxDelay,\n now\n );\n\n // If `uploadMaxDelayExceeded` is true, then we should finish the replay event immediately,\n // Otherwise schedule it to be finished in `this.options.uploadMinDelay`\n if (uploadMaxDelayExceeded) {\n logger.log('replay max delay exceeded, finishing replay event');\n this.finishReplayEvent();\n return;\n }\n\n // Set timer to finish replay event and send replay attachment to\n // Sentry. Will be cancelled if an event happens before `uploadMinDelay`\n // elapses.\n this.timeout = window.setTimeout(() => {\n logger.log('replay timeout exceeded, finishing replay event');\n this.finishReplayEvent();\n }, this.options.uploadMinDelay);\n },\n });\n\n this.addListeners();\n }\n\n /**\n * Currently, this needs to be manually called (e.g. for tests). Sentry SDK does not support a teardown\n */\n teardown() {\n this.removeListeners();\n }\n\n /**\n * Loads a session from storage, or creates a new one\n */\n loadSession({ expiry }: { expiry: number }): void {\n this.session = getSession({\n expiry,\n stickySession: this.options.stickySession,\n });\n }\n\n addListeners() {\n document.addEventListener('visibilitychange', this.handleVisibilityChange);\n\n if (!('PerformanceObserver' in window)) {\n return;\n }\n\n this.performanceObserver = new PerformanceObserver(\n this.handlePerformanceObserver\n );\n\n // Observe almost everything for now (no mark/measure)\n [\n 'element',\n 'event',\n 'first-input',\n 'largest-contentful-paint',\n 'layout-shift',\n 'longtask',\n 'navigation',\n 'paint',\n 'resource',\n ].forEach((type) =>\n this.performanceObserver.observe({\n type,\n buffered: true,\n })\n );\n }\n\n removeListeners() {\n document.removeEventListener(\n 'visibilitychange',\n this.handleVisibilityChange\n );\n\n if (this.performanceObserver) {\n this.performanceObserver.disconnect();\n this.performanceObserver = null;\n }\n }\n\n /**\n * Keep a list of performance entries that will be sent with a replay\n */\n handlePerformanceObserver = (\n list: PerformanceObserverEntryList\n // observer: PerformanceObserver\n ) => {\n this.performanceEvents = [...this.performanceEvents, ...list.getEntries()];\n };\n\n /**\n * Handle when visibility of the page changes. (e.g. new tab is opened)\n */\n handleVisibilityChange = () => {\n const isExpired = isSessionExpired(this.session, VISIBILITY_CHANGE_TIMEOUT);\n\n if (isExpired) {\n if (document.visibilityState === 'visible') {\n // If the user has come back to the page within VISIBILITY_CHANGE_TIMEOUT\n // ms, we will re-use the existing session, otherwise create a new\n // session\n logger.log('Document has become active, but session has expired');\n this.loadSession({ expiry: VISIBILITY_CHANGE_TIMEOUT });\n this.triggerFullSnapshot();\n }\n // We definitely want to return if visibilityState is \"visible\", and I\n // think we also want to do the same when \"hidden\", as there shouldn't be\n // any action to take if user has gone idle for a long period and then\n // comes back to hide the tab. We don't trigger a full snapshot because\n // we don't want to start a new session as they immediately have hidden\n // the tab.\n return;\n }\n\n // Otherwise if session is not expired...\n\n // Update with current timestamp as the last session activity\n // Only updating session on visibility change to be conservative about\n // writing to session storage. This could be changed in the future.\n updateSessionActivity({\n stickySession: this.options.stickySession,\n });\n\n // Send replay when the page/tab becomes hidden. There is no reason to send\n // replay if it becomes visible, since no actions we care about were done\n // while it was hidden\n if (document.visibilityState !== 'visible') {\n this.finishReplayEvent();\n }\n };\n\n /**\n * Trigger rrweb to take a full snapshot which will cause this plugin to\n * create a new Replay event.\n */\n triggerFullSnapshot() {\n logger.log('Taking full rrweb snapshot');\n record.takeFullSnapshot(true);\n }\n\n /**\n * This is our pseudo replay event disguised as a transaction. It will be\n * used to store performance entries and breadcrumbs for every incremental\n * replay event.\n **/\n createReplayEvent() {\n logger.log('CreateReplayEvent rootReplayId', this.session.id);\n this.replayEvent = Sentry.getCurrentHub().startTransaction({\n name: REPLAY_EVENT_NAME,\n parentSpanId: this.session.spanId,\n traceId: this.session.traceId,\n tags: {\n replayId: this.session.id,\n },\n });\n Sentry.configureScope((scope: Scope) => scope.setSpan(this.replayEvent));\n return this.replayEvent;\n }\n\n /**\n * Create a span for each performance entry. The parent transaction is `this.replayEvent`.\n */\n createPerformanceSpans(entries: ReplayPerformanceEntry[]) {\n entries.forEach(({ type, start, end, name, data }) => {\n const span = this.replayEvent?.startChild({\n op: type,\n description: name,\n startTimestamp: start,\n data,\n });\n span.finish(end);\n });\n }\n\n /**\n * Observed performance events are added to `this.performanceEvents`. These\n * are included in the replay event before it is finished and sent to Sentry.\n */\n addPerformanceEntries() {\n // Copy and reset entries before processing\n const entries = [...this.performanceEvents];\n this.performanceEvents = [];\n\n // Parse the entries\n const entryEvents = createPerformanceEntries(entries);\n\n // window.performance.memory is a non-standard API and doesn't work on all browsers\n // so we check before creating the event.\n if ('memory' in window.performance) {\n // @ts-expect-error memory doesn't exist on type Performance as the API is non-standard\n entryEvents.push(createMemoryEntry(window.performance.memory));\n }\n // This current implementation is to create spans on the transaction referenced in `this.replayEvent`\n this.createPerformanceSpans(entryEvents);\n }\n\n /**\n *\n *\n * Returns true if session is not expired, false otherwise.\n */\n checkAndHandleExpiredSession(expiry: number = SESSION_IDLE_DURATION) {\n const oldSessionId = this.session.id;\n\n // This will create a new session if expired, based on expiry length\n this.loadSession({ expiry });\n\n // Session was expired if session ids do not match\n const isExpired = oldSessionId !== this.session.id;\n\n if (!isExpired) {\n return true;\n }\n\n // TODO: We could potentially figure out a way to save the last session,\n // and produce a checkout based on a previous checkout + updates, and then\n // replay the event on top. Or maybe replay the event on top of a refresh\n // snapshot.\n\n // For now create a new snapshot\n this.triggerFullSnapshot();\n\n return false;\n }\n\n finishReplayEvent() {\n if (!this.checkAndHandleExpiredSession()) {\n logger.error(\n new Error('Attempting to finish replay event after session expired.')\n );\n }\n\n if (!this.session.id) {\n console.error(new Error('[Sentry]: No transaction, no replay'));\n return;\n }\n\n this.sendReplay(this.session.id);\n this.initialEventTimestampSinceFlush = null;\n // TBD: Alternatively we could update this after every rrweb event\n this.session.lastActivity = new Date().getTime();\n\n // include performance entries\n this.addPerformanceEntries();\n\n // Close out existing replay event and create a new one\n this.replayEvent?.setStatus('ok').finish();\n this.createReplayEvent();\n }\n\n /**\n * Determine if there is browser support for `navigator.sendBeacon`\n */\n hasSendBeacon() {\n return 'navigator' in window && 'sendBeacon' in window.navigator;\n }\n\n /**\n * Send replay attachment using either `sendBeacon()` or `fetch()`\n */\n async sendReplayRequest(endpoint: string, events: RRWebEvent[]) {\n const stringifiedPayload = JSON.stringify({ events });\n const formData = new FormData();\n formData.append(\n 'rrweb',\n new Blob([stringifiedPayload], {\n type: 'application/json',\n }),\n `rrweb-${new Date().getTime()}.json`\n );\n\n // If sendBeacon is supported and payload is smol enough...\n if (this.hasSendBeacon() && stringifiedPayload.length <= 65536) {\n logger.log(`uploading attachment via sendBeacon()`);\n window.navigator.sendBeacon(endpoint, formData);\n return;\n }\n\n // Otherwise use `fetch`, which *WILL* get cancelled on page reloads/unloads\n logger.log(`uploading attachment via fetch()`);\n await fetch(endpoint, {\n method: 'POST',\n body: formData,\n });\n }\n\n /**\n * Finalize and send the current replay event to Sentry\n */\n async sendReplay(eventId: string) {\n // short circuit if theres no events to replay\n if (!this.events.length) return;\n\n // Make a copy of the events array reference and immediately clear the\n // events member so that we do not lose new events while uploading\n // attachment.\n const events = this.events;\n this.events = [];\n\n const client = Sentry.getCurrentHub().getClient();\n const endpoint = SentryReplay.attachmentUrlFromDsn(\n client.getDsn(),\n eventId\n );\n\n try {\n await this.sendReplayRequest(endpoint, events);\n return true;\n } catch (ex) {\n // we have to catch this otherwise it throws an infinite loop in Sentry\n console.error(ex);\n\n // If an error happened here, it's likely that uploading the attachment failed, we'll want to restore the events that failed to upload\n this.events = [...events, ...this.events];\n return false;\n }\n }\n}\n"],"names":["sentryLogger","Sentry","record"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAiBA;AACO,IAAI,QAAQ,GAAG,WAAW;AACjC,IAAI,QAAQ,GAAG,MAAM,CAAC,MAAM,IAAI,SAAS,QAAQ,CAAC,CAAC,EAAE;AACrD,QAAQ,KAAK,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;AAC7D,YAAY,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAC7B,YAAY,KAAK,IAAI,CAAC,IAAI,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