@sentry/replay 0.2.0-4 → 0.2.0-7
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 +101 -60
- package/dist/index.js +101 -60
- package/dist/index.js.map +1 -1
- package/package.json +6 -5
package/dist/index.es.js
CHANGED
|
@@ -310,7 +310,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
310
310
|
var _this = this;
|
|
311
311
|
var _b = _a.uploadMinDelay, uploadMinDelay = _b === void 0 ? 5000 : _b, _c = _a.uploadMaxDelay, uploadMaxDelay = _c === void 0 ? 15000 : _c, _d = _a.stickySession, stickySession = _d === void 0 ? false : _d, // TBD: Making this opt-in for now
|
|
312
312
|
_e = _a.rrwebConfig, // TBD: Making this opt-in for now
|
|
313
|
-
_f = _e === void 0 ? {} : _e, _g = _f.maskAllInputs, maskAllInputs = _g === void 0 ? true : _g, rrwebRecordOptions = __rest(_f, ["maskAllInputs"]);
|
|
313
|
+
_f = _e === void 0 ? {} : _e, _g = _f.maskAllInputs, maskAllInputs = _g === void 0 ? true : _g, _h = _f.blockClass, blockClass = _h === void 0 ? 'sr-block' : _h, _j = _f.ignoreClass, ignoreClass = _j === void 0 ? 'sr-ignore' : _j, _k = _f.maskTextClass, maskTextClass = _k === void 0 ? 'sr-mask' : _k, rrwebRecordOptions = __rest(_f, ["maskAllInputs", "blockClass", "ignoreClass", "maskTextClass"]);
|
|
314
314
|
/**
|
|
315
315
|
* @inheritDoc
|
|
316
316
|
*/
|
|
@@ -345,6 +345,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
345
345
|
// ms, we will re-use the existing session, otherwise create a new
|
|
346
346
|
// session
|
|
347
347
|
logger.log('Document has become active, but session has expired');
|
|
348
|
+
_this.loadSession({ expiry: VISIBILITY_CHANGE_TIMEOUT });
|
|
348
349
|
_this.triggerFullSnapshot();
|
|
349
350
|
}
|
|
350
351
|
// We definitely want to return if visibilityState is "visible", and I
|
|
@@ -369,24 +370,16 @@ var SentryReplay = /** @class */ (function () {
|
|
|
369
370
|
_this.finishReplayEvent();
|
|
370
371
|
}
|
|
371
372
|
};
|
|
372
|
-
this.rrwebRecordOptions = __assign({ maskAllInputs: maskAllInputs }, rrwebRecordOptions);
|
|
373
|
+
this.rrwebRecordOptions = __assign({ maskAllInputs: maskAllInputs, blockClass: blockClass, ignoreClass: ignoreClass, maskTextClass: maskTextClass }, rrwebRecordOptions);
|
|
373
374
|
this.options = { uploadMinDelay: uploadMinDelay, uploadMaxDelay: uploadMaxDelay, stickySession: stickySession };
|
|
374
375
|
this.events = [];
|
|
375
376
|
}
|
|
376
377
|
SentryReplay.attachmentUrlFromDsn = function (dsn, eventId) {
|
|
377
|
-
var host = dsn.host,
|
|
378
|
-
|
|
378
|
+
var host = dsn.host, projectId = dsn.projectId, protocol = dsn.protocol, user = dsn.user;
|
|
379
|
+
var port = dsn.port !== '' ? ":".concat(dsn.port) : '';
|
|
380
|
+
var path = dsn.path !== '' ? "/".concat(dsn.path) : '';
|
|
381
|
+
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
382
|
};
|
|
380
|
-
Object.defineProperty(SentryReplay.prototype, "instance", {
|
|
381
|
-
/**
|
|
382
|
-
* Get integration's instance on the current hub
|
|
383
|
-
*/
|
|
384
|
-
get: function () {
|
|
385
|
-
return Sentry.getCurrentHub().getIntegration(SentryReplay);
|
|
386
|
-
},
|
|
387
|
-
enumerable: false,
|
|
388
|
-
configurable: true
|
|
389
|
-
});
|
|
390
383
|
SentryReplay.prototype.setupOnce = function () {
|
|
391
384
|
var _this = this;
|
|
392
385
|
/**
|
|
@@ -426,13 +419,15 @@ var SentryReplay = /** @class */ (function () {
|
|
|
426
419
|
if (!_this.initialEventTimestampSinceFlush) {
|
|
427
420
|
_this.initialEventTimestampSinceFlush = now;
|
|
428
421
|
}
|
|
429
|
-
var uploadMaxDelayExceeded = isExpired(_this.initialEventTimestampSinceFlush, _this.options.uploadMaxDelay, now);
|
|
430
422
|
// Do not finish the replay event if we receive a new replay event
|
|
431
|
-
|
|
432
|
-
// finished the replay
|
|
433
|
-
if (_this.timeout && !uploadMaxDelayExceeded) {
|
|
423
|
+
if (_this.timeout) {
|
|
434
424
|
window.clearTimeout(_this.timeout);
|
|
435
425
|
}
|
|
426
|
+
// If this is false, it means session is expired, create and a new session and wait for checkout
|
|
427
|
+
if (!_this.checkAndHandleExpiredSession()) {
|
|
428
|
+
logger.error(new Error('Received replay event after session expired.'));
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
436
431
|
// We need to clear existing events on a checkout, otherwise they are
|
|
437
432
|
// incremental event updates and should be appended
|
|
438
433
|
if (isCheckout) {
|
|
@@ -445,9 +440,16 @@ var SentryReplay = /** @class */ (function () {
|
|
|
445
440
|
// See https://github.com/rrweb-io/rrweb/blob/d8f9290ca496712aa1e7d472549480c4e7876594/packages/rrweb/src/types.ts#L16
|
|
446
441
|
if (event.type === 2) {
|
|
447
442
|
// A fullsnapshot happens on initial load and if we need to start a
|
|
448
|
-
// new replay due to idle timeout. In the
|
|
449
|
-
//
|
|
450
|
-
_this.
|
|
443
|
+
// new replay due to idle timeout. In the latter case, a new session *should* have been started
|
|
444
|
+
// before triggering a new checkout
|
|
445
|
+
_this.finishReplayEvent();
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
var uploadMaxDelayExceeded = isExpired(_this.initialEventTimestampSinceFlush, _this.options.uploadMaxDelay, now);
|
|
449
|
+
// If `uploadMaxDelayExceeded` is true, then we should finish the replay event immediately,
|
|
450
|
+
// Otherwise schedule it to be finished in `this.options.uploadMinDelay`
|
|
451
|
+
if (uploadMaxDelayExceeded) {
|
|
452
|
+
logger.log('replay max delay exceeded, finishing replay event');
|
|
451
453
|
_this.finishReplayEvent();
|
|
452
454
|
return;
|
|
453
455
|
}
|
|
@@ -455,15 +457,20 @@ var SentryReplay = /** @class */ (function () {
|
|
|
455
457
|
// Sentry. Will be cancelled if an event happens before `uploadMinDelay`
|
|
456
458
|
// elapses.
|
|
457
459
|
_this.timeout = window.setTimeout(function () {
|
|
458
|
-
logger.log('
|
|
460
|
+
logger.log('replay timeout exceeded, finishing replay event');
|
|
459
461
|
_this.finishReplayEvent();
|
|
460
462
|
}, _this.options.uploadMinDelay);
|
|
461
463
|
} }));
|
|
462
464
|
this.addListeners();
|
|
463
|
-
// XXX: this needs to be in `setupOnce` vs `constructor`, otherwise SDK is
|
|
464
465
|
// not fully initialized and the event will not get properly sent to Sentry
|
|
465
466
|
this.createReplayEvent();
|
|
466
467
|
};
|
|
468
|
+
/**
|
|
469
|
+
* Currently, this needs to be manually called (e.g. for tests). Sentry SDK does not support a teardown
|
|
470
|
+
*/
|
|
471
|
+
SentryReplay.prototype.teardown = function () {
|
|
472
|
+
this.removeListeners();
|
|
473
|
+
};
|
|
467
474
|
/**
|
|
468
475
|
* Loads a session from storage, or creates a new one
|
|
469
476
|
*/
|
|
@@ -475,13 +482,35 @@ var SentryReplay = /** @class */ (function () {
|
|
|
475
482
|
});
|
|
476
483
|
};
|
|
477
484
|
SentryReplay.prototype.addListeners = function () {
|
|
485
|
+
var _this = this;
|
|
478
486
|
document.addEventListener('visibilitychange', this.handleVisibilityChange);
|
|
479
|
-
if ('PerformanceObserver' in window) {
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
487
|
+
if (!('PerformanceObserver' in window)) {
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
this.performanceObserver = new PerformanceObserver(this.handlePerformanceObserver);
|
|
491
|
+
// Observe almost everything for now (no mark/measure)
|
|
492
|
+
[
|
|
493
|
+
'element',
|
|
494
|
+
'event',
|
|
495
|
+
'first-input',
|
|
496
|
+
'largest-contentful-paint',
|
|
497
|
+
'layout-shift',
|
|
498
|
+
'longtask',
|
|
499
|
+
'navigation',
|
|
500
|
+
'paint',
|
|
501
|
+
'resource',
|
|
502
|
+
].forEach(function (type) {
|
|
503
|
+
return _this.performanceObserver.observe({
|
|
504
|
+
type: type,
|
|
505
|
+
buffered: true,
|
|
484
506
|
});
|
|
507
|
+
});
|
|
508
|
+
};
|
|
509
|
+
SentryReplay.prototype.removeListeners = function () {
|
|
510
|
+
document.removeEventListener('visibilitychange', this.handleVisibilityChange);
|
|
511
|
+
if (this.performanceObserver) {
|
|
512
|
+
this.performanceObserver.disconnect();
|
|
513
|
+
this.performanceObserver = null;
|
|
485
514
|
}
|
|
486
515
|
};
|
|
487
516
|
/**
|
|
@@ -500,7 +529,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
500
529
|
SentryReplay.prototype.createReplayEvent = function () {
|
|
501
530
|
var _this = this;
|
|
502
531
|
logger.log('CreateReplayEvent rootReplayId', this.session.id);
|
|
503
|
-
this.replayEvent = Sentry.startTransaction({
|
|
532
|
+
this.replayEvent = Sentry.getCurrentHub().startTransaction({
|
|
504
533
|
name: REPLAY_EVENT_NAME,
|
|
505
534
|
parentSpanId: this.session.spanId,
|
|
506
535
|
traceId: this.session.traceId,
|
|
@@ -541,16 +570,33 @@ var SentryReplay = /** @class */ (function () {
|
|
|
541
570
|
// This current implementation is to create spans on the transaction referenced in `this.replayEvent`
|
|
542
571
|
this.createPerformanceSpans(entryEvents);
|
|
543
572
|
};
|
|
573
|
+
/**
|
|
574
|
+
*
|
|
575
|
+
*
|
|
576
|
+
* Returns true if session is not expired, false otherwise.
|
|
577
|
+
*/
|
|
578
|
+
SentryReplay.prototype.checkAndHandleExpiredSession = function (expiry) {
|
|
579
|
+
if (expiry === void 0) { expiry = SESSION_IDLE_DURATION; }
|
|
580
|
+
var oldSessionId = this.session.id;
|
|
581
|
+
// This will create a new session if expired, based on expiry length
|
|
582
|
+
this.loadSession({ expiry: expiry });
|
|
583
|
+
// Session was expired if session ids do not match
|
|
584
|
+
var isExpired = oldSessionId !== this.session.id;
|
|
585
|
+
if (!isExpired) {
|
|
586
|
+
return true;
|
|
587
|
+
}
|
|
588
|
+
// TODO: We could potentially figure out a way to save the last session,
|
|
589
|
+
// and produce a checkout based on a previous checkout + updates, and then
|
|
590
|
+
// replay the event on top. Or maybe replay the event on top of a refresh
|
|
591
|
+
// snapshot.
|
|
592
|
+
// For now create a new snapshot
|
|
593
|
+
this.triggerFullSnapshot();
|
|
594
|
+
return false;
|
|
595
|
+
};
|
|
544
596
|
SentryReplay.prototype.finishReplayEvent = function () {
|
|
545
|
-
// if (!this.instance) return;
|
|
546
597
|
var _a;
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
if (isExpired) {
|
|
550
|
-
// TBD: If it is expired, we do not send any events...we could send to
|
|
551
|
-
// the expired session, but not sure if that's great
|
|
552
|
-
console.error(new Error('Attempting to finish replay event after session expired.'));
|
|
553
|
-
return;
|
|
598
|
+
if (!this.checkAndHandleExpiredSession()) {
|
|
599
|
+
logger.error(new Error('Attempting to finish replay event after session expired.'));
|
|
554
600
|
}
|
|
555
601
|
if (!this.session.id) {
|
|
556
602
|
console.error(new Error('[Sentry]: No transaction, no replay'));
|
|
@@ -577,7 +623,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
577
623
|
*/
|
|
578
624
|
SentryReplay.prototype.sendReplayRequest = function (endpoint, events) {
|
|
579
625
|
return __awaiter(this, void 0, void 0, function () {
|
|
580
|
-
var stringifiedPayload, formData
|
|
626
|
+
var stringifiedPayload, formData;
|
|
581
627
|
return __generator(this, function (_a) {
|
|
582
628
|
switch (_a.label) {
|
|
583
629
|
case 0:
|
|
@@ -586,32 +632,21 @@ var SentryReplay = /** @class */ (function () {
|
|
|
586
632
|
formData.append('rrweb', new Blob([stringifiedPayload], {
|
|
587
633
|
type: 'application/json',
|
|
588
634
|
}), "rrweb-".concat(new Date().getTime(), ".json"));
|
|
589
|
-
console.log('sendReplayRequest: ', endpoint);
|
|
590
635
|
// If sendBeacon is supported and payload is smol enough...
|
|
591
636
|
if (this.hasSendBeacon() && stringifiedPayload.length <= 65536) {
|
|
592
637
|
logger.log("uploading attachment via sendBeacon()");
|
|
593
638
|
window.navigator.sendBeacon(endpoint, formData);
|
|
594
639
|
return [2 /*return*/];
|
|
595
640
|
}
|
|
596
|
-
_a.label = 1;
|
|
597
|
-
case 1:
|
|
598
|
-
_a.trys.push([1, 3, , 4]);
|
|
599
|
-
logger.log("uploading attachment via fetch()");
|
|
600
641
|
// Otherwise use `fetch`, which *WILL* get cancelled on page reloads/unloads
|
|
642
|
+
logger.log("uploading attachment via fetch()");
|
|
601
643
|
return [4 /*yield*/, fetch(endpoint, {
|
|
602
644
|
method: 'POST',
|
|
603
645
|
body: formData,
|
|
604
646
|
})];
|
|
605
|
-
case
|
|
606
|
-
// Otherwise use `fetch`, which *WILL* get cancelled on page reloads/unloads
|
|
647
|
+
case 1:
|
|
607
648
|
_a.sent();
|
|
608
|
-
return [
|
|
609
|
-
case 3:
|
|
610
|
-
ex_1 = _a.sent();
|
|
611
|
-
// we have to catch this otherwise it throws an infinite loop in Sentry
|
|
612
|
-
console.error(ex_1);
|
|
613
|
-
return [3 /*break*/, 4];
|
|
614
|
-
case 4: return [2 /*return*/];
|
|
649
|
+
return [2 /*return*/];
|
|
615
650
|
}
|
|
616
651
|
});
|
|
617
652
|
});
|
|
@@ -621,26 +656,32 @@ var SentryReplay = /** @class */ (function () {
|
|
|
621
656
|
*/
|
|
622
657
|
SentryReplay.prototype.sendReplay = function (eventId) {
|
|
623
658
|
return __awaiter(this, void 0, void 0, function () {
|
|
624
|
-
var client, endpoint,
|
|
659
|
+
var events, client, endpoint, ex_1;
|
|
625
660
|
return __generator(this, function (_a) {
|
|
626
661
|
switch (_a.label) {
|
|
627
662
|
case 0:
|
|
628
|
-
_a.trys.push([0, 2, , 3]);
|
|
629
663
|
// short circuit if theres no events to replay
|
|
630
664
|
if (!this.events.length)
|
|
631
665
|
return [2 /*return*/];
|
|
666
|
+
events = this.events;
|
|
667
|
+
this.events = [];
|
|
632
668
|
client = Sentry.getCurrentHub().getClient();
|
|
633
669
|
endpoint = SentryReplay.attachmentUrlFromDsn(client.getDsn(), eventId);
|
|
634
|
-
|
|
670
|
+
_a.label = 1;
|
|
635
671
|
case 1:
|
|
672
|
+
_a.trys.push([1, 3, , 4]);
|
|
673
|
+
return [4 /*yield*/, this.sendReplayRequest(endpoint, events)];
|
|
674
|
+
case 2:
|
|
636
675
|
_a.sent();
|
|
637
|
-
this.events = [];
|
|
638
676
|
return [2 /*return*/, true];
|
|
639
|
-
case
|
|
640
|
-
|
|
641
|
-
|
|
677
|
+
case 3:
|
|
678
|
+
ex_1 = _a.sent();
|
|
679
|
+
// we have to catch this otherwise it throws an infinite loop in Sentry
|
|
680
|
+
console.error(ex_1);
|
|
681
|
+
// If an error happened here, it's likely that uploading the attachment failed, we'll want to restore the events that failed to upload
|
|
682
|
+
this.events = __spreadArray(__spreadArray([], events, true), this.events, true);
|
|
642
683
|
return [2 /*return*/, false];
|
|
643
|
-
case
|
|
684
|
+
case 4: return [2 /*return*/];
|
|
644
685
|
}
|
|
645
686
|
});
|
|
646
687
|
});
|
package/dist/index.js
CHANGED
|
@@ -334,7 +334,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
334
334
|
var _this = this;
|
|
335
335
|
var _b = _a.uploadMinDelay, uploadMinDelay = _b === void 0 ? 5000 : _b, _c = _a.uploadMaxDelay, uploadMaxDelay = _c === void 0 ? 15000 : _c, _d = _a.stickySession, stickySession = _d === void 0 ? false : _d, // TBD: Making this opt-in for now
|
|
336
336
|
_e = _a.rrwebConfig, // TBD: Making this opt-in for now
|
|
337
|
-
_f = _e === void 0 ? {} : _e, _g = _f.maskAllInputs, maskAllInputs = _g === void 0 ? true : _g, rrwebRecordOptions = __rest(_f, ["maskAllInputs"]);
|
|
337
|
+
_f = _e === void 0 ? {} : _e, _g = _f.maskAllInputs, maskAllInputs = _g === void 0 ? true : _g, _h = _f.blockClass, blockClass = _h === void 0 ? 'sr-block' : _h, _j = _f.ignoreClass, ignoreClass = _j === void 0 ? 'sr-ignore' : _j, _k = _f.maskTextClass, maskTextClass = _k === void 0 ? 'sr-mask' : _k, rrwebRecordOptions = __rest(_f, ["maskAllInputs", "blockClass", "ignoreClass", "maskTextClass"]);
|
|
338
338
|
/**
|
|
339
339
|
* @inheritDoc
|
|
340
340
|
*/
|
|
@@ -369,6 +369,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
369
369
|
// ms, we will re-use the existing session, otherwise create a new
|
|
370
370
|
// session
|
|
371
371
|
logger.log('Document has become active, but session has expired');
|
|
372
|
+
_this.loadSession({ expiry: VISIBILITY_CHANGE_TIMEOUT });
|
|
372
373
|
_this.triggerFullSnapshot();
|
|
373
374
|
}
|
|
374
375
|
// We definitely want to return if visibilityState is "visible", and I
|
|
@@ -393,24 +394,16 @@ var SentryReplay = /** @class */ (function () {
|
|
|
393
394
|
_this.finishReplayEvent();
|
|
394
395
|
}
|
|
395
396
|
};
|
|
396
|
-
this.rrwebRecordOptions = __assign({ maskAllInputs: maskAllInputs }, rrwebRecordOptions);
|
|
397
|
+
this.rrwebRecordOptions = __assign({ maskAllInputs: maskAllInputs, blockClass: blockClass, ignoreClass: ignoreClass, maskTextClass: maskTextClass }, rrwebRecordOptions);
|
|
397
398
|
this.options = { uploadMinDelay: uploadMinDelay, uploadMaxDelay: uploadMaxDelay, stickySession: stickySession };
|
|
398
399
|
this.events = [];
|
|
399
400
|
}
|
|
400
401
|
SentryReplay.attachmentUrlFromDsn = function (dsn, eventId) {
|
|
401
|
-
var host = dsn.host,
|
|
402
|
-
|
|
402
|
+
var host = dsn.host, projectId = dsn.projectId, protocol = dsn.protocol, user = dsn.user;
|
|
403
|
+
var port = dsn.port !== '' ? ":".concat(dsn.port) : '';
|
|
404
|
+
var path = dsn.path !== '' ? "/".concat(dsn.path) : '';
|
|
405
|
+
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
406
|
};
|
|
404
|
-
Object.defineProperty(SentryReplay.prototype, "instance", {
|
|
405
|
-
/**
|
|
406
|
-
* Get integration's instance on the current hub
|
|
407
|
-
*/
|
|
408
|
-
get: function () {
|
|
409
|
-
return Sentry__namespace.getCurrentHub().getIntegration(SentryReplay);
|
|
410
|
-
},
|
|
411
|
-
enumerable: false,
|
|
412
|
-
configurable: true
|
|
413
|
-
});
|
|
414
407
|
SentryReplay.prototype.setupOnce = function () {
|
|
415
408
|
var _this = this;
|
|
416
409
|
/**
|
|
@@ -450,13 +443,15 @@ var SentryReplay = /** @class */ (function () {
|
|
|
450
443
|
if (!_this.initialEventTimestampSinceFlush) {
|
|
451
444
|
_this.initialEventTimestampSinceFlush = now;
|
|
452
445
|
}
|
|
453
|
-
var uploadMaxDelayExceeded = isExpired(_this.initialEventTimestampSinceFlush, _this.options.uploadMaxDelay, now);
|
|
454
446
|
// Do not finish the replay event if we receive a new replay event
|
|
455
|
-
|
|
456
|
-
// finished the replay
|
|
457
|
-
if (_this.timeout && !uploadMaxDelayExceeded) {
|
|
447
|
+
if (_this.timeout) {
|
|
458
448
|
window.clearTimeout(_this.timeout);
|
|
459
449
|
}
|
|
450
|
+
// If this is false, it means session is expired, create and a new session and wait for checkout
|
|
451
|
+
if (!_this.checkAndHandleExpiredSession()) {
|
|
452
|
+
logger.error(new Error('Received replay event after session expired.'));
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
460
455
|
// We need to clear existing events on a checkout, otherwise they are
|
|
461
456
|
// incremental event updates and should be appended
|
|
462
457
|
if (isCheckout) {
|
|
@@ -469,9 +464,16 @@ var SentryReplay = /** @class */ (function () {
|
|
|
469
464
|
// See https://github.com/rrweb-io/rrweb/blob/d8f9290ca496712aa1e7d472549480c4e7876594/packages/rrweb/src/types.ts#L16
|
|
470
465
|
if (event.type === 2) {
|
|
471
466
|
// A fullsnapshot happens on initial load and if we need to start a
|
|
472
|
-
// new replay due to idle timeout. In the
|
|
473
|
-
//
|
|
474
|
-
_this.
|
|
467
|
+
// new replay due to idle timeout. In the latter case, a new session *should* have been started
|
|
468
|
+
// before triggering a new checkout
|
|
469
|
+
_this.finishReplayEvent();
|
|
470
|
+
return;
|
|
471
|
+
}
|
|
472
|
+
var uploadMaxDelayExceeded = isExpired(_this.initialEventTimestampSinceFlush, _this.options.uploadMaxDelay, now);
|
|
473
|
+
// If `uploadMaxDelayExceeded` is true, then we should finish the replay event immediately,
|
|
474
|
+
// Otherwise schedule it to be finished in `this.options.uploadMinDelay`
|
|
475
|
+
if (uploadMaxDelayExceeded) {
|
|
476
|
+
logger.log('replay max delay exceeded, finishing replay event');
|
|
475
477
|
_this.finishReplayEvent();
|
|
476
478
|
return;
|
|
477
479
|
}
|
|
@@ -479,15 +481,20 @@ var SentryReplay = /** @class */ (function () {
|
|
|
479
481
|
// Sentry. Will be cancelled if an event happens before `uploadMinDelay`
|
|
480
482
|
// elapses.
|
|
481
483
|
_this.timeout = window.setTimeout(function () {
|
|
482
|
-
logger.log('
|
|
484
|
+
logger.log('replay timeout exceeded, finishing replay event');
|
|
483
485
|
_this.finishReplayEvent();
|
|
484
486
|
}, _this.options.uploadMinDelay);
|
|
485
487
|
} }));
|
|
486
488
|
this.addListeners();
|
|
487
|
-
// XXX: this needs to be in `setupOnce` vs `constructor`, otherwise SDK is
|
|
488
489
|
// not fully initialized and the event will not get properly sent to Sentry
|
|
489
490
|
this.createReplayEvent();
|
|
490
491
|
};
|
|
492
|
+
/**
|
|
493
|
+
* Currently, this needs to be manually called (e.g. for tests). Sentry SDK does not support a teardown
|
|
494
|
+
*/
|
|
495
|
+
SentryReplay.prototype.teardown = function () {
|
|
496
|
+
this.removeListeners();
|
|
497
|
+
};
|
|
491
498
|
/**
|
|
492
499
|
* Loads a session from storage, or creates a new one
|
|
493
500
|
*/
|
|
@@ -499,13 +506,35 @@ var SentryReplay = /** @class */ (function () {
|
|
|
499
506
|
});
|
|
500
507
|
};
|
|
501
508
|
SentryReplay.prototype.addListeners = function () {
|
|
509
|
+
var _this = this;
|
|
502
510
|
document.addEventListener('visibilitychange', this.handleVisibilityChange);
|
|
503
|
-
if ('PerformanceObserver' in window) {
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
511
|
+
if (!('PerformanceObserver' in window)) {
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
this.performanceObserver = new PerformanceObserver(this.handlePerformanceObserver);
|
|
515
|
+
// Observe almost everything for now (no mark/measure)
|
|
516
|
+
[
|
|
517
|
+
'element',
|
|
518
|
+
'event',
|
|
519
|
+
'first-input',
|
|
520
|
+
'largest-contentful-paint',
|
|
521
|
+
'layout-shift',
|
|
522
|
+
'longtask',
|
|
523
|
+
'navigation',
|
|
524
|
+
'paint',
|
|
525
|
+
'resource',
|
|
526
|
+
].forEach(function (type) {
|
|
527
|
+
return _this.performanceObserver.observe({
|
|
528
|
+
type: type,
|
|
529
|
+
buffered: true,
|
|
508
530
|
});
|
|
531
|
+
});
|
|
532
|
+
};
|
|
533
|
+
SentryReplay.prototype.removeListeners = function () {
|
|
534
|
+
document.removeEventListener('visibilitychange', this.handleVisibilityChange);
|
|
535
|
+
if (this.performanceObserver) {
|
|
536
|
+
this.performanceObserver.disconnect();
|
|
537
|
+
this.performanceObserver = null;
|
|
509
538
|
}
|
|
510
539
|
};
|
|
511
540
|
/**
|
|
@@ -524,7 +553,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
524
553
|
SentryReplay.prototype.createReplayEvent = function () {
|
|
525
554
|
var _this = this;
|
|
526
555
|
logger.log('CreateReplayEvent rootReplayId', this.session.id);
|
|
527
|
-
this.replayEvent = Sentry__namespace.startTransaction({
|
|
556
|
+
this.replayEvent = Sentry__namespace.getCurrentHub().startTransaction({
|
|
528
557
|
name: REPLAY_EVENT_NAME,
|
|
529
558
|
parentSpanId: this.session.spanId,
|
|
530
559
|
traceId: this.session.traceId,
|
|
@@ -565,16 +594,33 @@ var SentryReplay = /** @class */ (function () {
|
|
|
565
594
|
// This current implementation is to create spans on the transaction referenced in `this.replayEvent`
|
|
566
595
|
this.createPerformanceSpans(entryEvents);
|
|
567
596
|
};
|
|
597
|
+
/**
|
|
598
|
+
*
|
|
599
|
+
*
|
|
600
|
+
* Returns true if session is not expired, false otherwise.
|
|
601
|
+
*/
|
|
602
|
+
SentryReplay.prototype.checkAndHandleExpiredSession = function (expiry) {
|
|
603
|
+
if (expiry === void 0) { expiry = SESSION_IDLE_DURATION; }
|
|
604
|
+
var oldSessionId = this.session.id;
|
|
605
|
+
// This will create a new session if expired, based on expiry length
|
|
606
|
+
this.loadSession({ expiry: expiry });
|
|
607
|
+
// Session was expired if session ids do not match
|
|
608
|
+
var isExpired = oldSessionId !== this.session.id;
|
|
609
|
+
if (!isExpired) {
|
|
610
|
+
return true;
|
|
611
|
+
}
|
|
612
|
+
// TODO: We could potentially figure out a way to save the last session,
|
|
613
|
+
// and produce a checkout based on a previous checkout + updates, and then
|
|
614
|
+
// replay the event on top. Or maybe replay the event on top of a refresh
|
|
615
|
+
// snapshot.
|
|
616
|
+
// For now create a new snapshot
|
|
617
|
+
this.triggerFullSnapshot();
|
|
618
|
+
return false;
|
|
619
|
+
};
|
|
568
620
|
SentryReplay.prototype.finishReplayEvent = function () {
|
|
569
|
-
// if (!this.instance) return;
|
|
570
621
|
var _a;
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
if (isExpired) {
|
|
574
|
-
// TBD: If it is expired, we do not send any events...we could send to
|
|
575
|
-
// the expired session, but not sure if that's great
|
|
576
|
-
console.error(new Error('Attempting to finish replay event after session expired.'));
|
|
577
|
-
return;
|
|
622
|
+
if (!this.checkAndHandleExpiredSession()) {
|
|
623
|
+
logger.error(new Error('Attempting to finish replay event after session expired.'));
|
|
578
624
|
}
|
|
579
625
|
if (!this.session.id) {
|
|
580
626
|
console.error(new Error('[Sentry]: No transaction, no replay'));
|
|
@@ -601,7 +647,7 @@ var SentryReplay = /** @class */ (function () {
|
|
|
601
647
|
*/
|
|
602
648
|
SentryReplay.prototype.sendReplayRequest = function (endpoint, events) {
|
|
603
649
|
return __awaiter(this, void 0, void 0, function () {
|
|
604
|
-
var stringifiedPayload, formData
|
|
650
|
+
var stringifiedPayload, formData;
|
|
605
651
|
return __generator(this, function (_a) {
|
|
606
652
|
switch (_a.label) {
|
|
607
653
|
case 0:
|
|
@@ -610,32 +656,21 @@ var SentryReplay = /** @class */ (function () {
|
|
|
610
656
|
formData.append('rrweb', new Blob([stringifiedPayload], {
|
|
611
657
|
type: 'application/json',
|
|
612
658
|
}), "rrweb-".concat(new Date().getTime(), ".json"));
|
|
613
|
-
console.log('sendReplayRequest: ', endpoint);
|
|
614
659
|
// If sendBeacon is supported and payload is smol enough...
|
|
615
660
|
if (this.hasSendBeacon() && stringifiedPayload.length <= 65536) {
|
|
616
661
|
logger.log("uploading attachment via sendBeacon()");
|
|
617
662
|
window.navigator.sendBeacon(endpoint, formData);
|
|
618
663
|
return [2 /*return*/];
|
|
619
664
|
}
|
|
620
|
-
_a.label = 1;
|
|
621
|
-
case 1:
|
|
622
|
-
_a.trys.push([1, 3, , 4]);
|
|
623
|
-
logger.log("uploading attachment via fetch()");
|
|
624
665
|
// Otherwise use `fetch`, which *WILL* get cancelled on page reloads/unloads
|
|
666
|
+
logger.log("uploading attachment via fetch()");
|
|
625
667
|
return [4 /*yield*/, fetch(endpoint, {
|
|
626
668
|
method: 'POST',
|
|
627
669
|
body: formData,
|
|
628
670
|
})];
|
|
629
|
-
case
|
|
630
|
-
// Otherwise use `fetch`, which *WILL* get cancelled on page reloads/unloads
|
|
671
|
+
case 1:
|
|
631
672
|
_a.sent();
|
|
632
|
-
return [
|
|
633
|
-
case 3:
|
|
634
|
-
ex_1 = _a.sent();
|
|
635
|
-
// we have to catch this otherwise it throws an infinite loop in Sentry
|
|
636
|
-
console.error(ex_1);
|
|
637
|
-
return [3 /*break*/, 4];
|
|
638
|
-
case 4: return [2 /*return*/];
|
|
673
|
+
return [2 /*return*/];
|
|
639
674
|
}
|
|
640
675
|
});
|
|
641
676
|
});
|
|
@@ -645,26 +680,32 @@ var SentryReplay = /** @class */ (function () {
|
|
|
645
680
|
*/
|
|
646
681
|
SentryReplay.prototype.sendReplay = function (eventId) {
|
|
647
682
|
return __awaiter(this, void 0, void 0, function () {
|
|
648
|
-
var client, endpoint,
|
|
683
|
+
var events, client, endpoint, ex_1;
|
|
649
684
|
return __generator(this, function (_a) {
|
|
650
685
|
switch (_a.label) {
|
|
651
686
|
case 0:
|
|
652
|
-
_a.trys.push([0, 2, , 3]);
|
|
653
687
|
// short circuit if theres no events to replay
|
|
654
688
|
if (!this.events.length)
|
|
655
689
|
return [2 /*return*/];
|
|
690
|
+
events = this.events;
|
|
691
|
+
this.events = [];
|
|
656
692
|
client = Sentry__namespace.getCurrentHub().getClient();
|
|
657
693
|
endpoint = SentryReplay.attachmentUrlFromDsn(client.getDsn(), eventId);
|
|
658
|
-
|
|
694
|
+
_a.label = 1;
|
|
659
695
|
case 1:
|
|
696
|
+
_a.trys.push([1, 3, , 4]);
|
|
697
|
+
return [4 /*yield*/, this.sendReplayRequest(endpoint, events)];
|
|
698
|
+
case 2:
|
|
660
699
|
_a.sent();
|
|
661
|
-
this.events = [];
|
|
662
700
|
return [2 /*return*/, true];
|
|
663
|
-
case
|
|
664
|
-
|
|
665
|
-
|
|
701
|
+
case 3:
|
|
702
|
+
ex_1 = _a.sent();
|
|
703
|
+
// we have to catch this otherwise it throws an infinite loop in Sentry
|
|
704
|
+
console.error(ex_1);
|
|
705
|
+
// If an error happened here, it's likely that uploading the attachment failed, we'll want to restore the events that failed to upload
|
|
706
|
+
this.events = __spreadArray(__spreadArray([], events, true), this.events, true);
|
|
666
707
|
return [2 /*return*/, false];
|
|
667
|
-
case
|
|
708
|
+
case 4: return [2 /*return*/];
|
|
668
709
|
}
|
|
669
710
|
});
|
|
670
711
|
});
|
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 /**\n * Get integration's instance on the current hub\n */\n private get instance() {\n return Sentry.getCurrentHub().getIntegration(SentryReplay);\n }\n\n public constructor({\n uploadMinDelay = 5000,\n uploadMaxDelay = 15000,\n stickySession = false, // TBD: Making this opt-in for now\n rrwebConfig: { maskAllInputs = true, ...rrwebRecordOptions } = {},\n }: SentryReplayConfiguration = {}) {\n this.rrwebRecordOptions = {\n maskAllInputs,\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 // if (!this.instance) return;\n\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 console.log('sendReplayRequest: ', endpoint);\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 try {\n logger.log(`uploading attachment via fetch()`);\n // Otherwise use `fetch`, which *WILL* get cancelled on page reloads/unloads\n await fetch(endpoint, {\n method: 'POST',\n body: formData,\n });\n } catch (ex) {\n // we have to catch this otherwise it throws an infinite loop in Sentry\n console.error(ex);\n }\n }\n\n /**\n * Finalize and send the current replay event to Sentry\n */\n async sendReplay(eventId: string) {\n // if (!this.instance) return;\n\n try {\n // short circuit if theres no events to replay\n if (!this.events.length) return;\n\n const client = Sentry.getCurrentHub().getClient();\n const endpoint = SentryReplay.attachmentUrlFromDsn(\n client.getDsn(),\n eventId\n );\n\n await this.sendReplayRequest(endpoint, this.events);\n this.events = [];\n return true;\n } catch (ex) {\n console.error(ex);\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,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A;AAED;;AAEG;IACG,YAAU,CAAA,SAAA,CAAA,UAAA,GAAhB,UAAiB,OAAe,EAAA;;;;;;;;AAK5B,wBAAA,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM;4BAAE,OAAO,CAAA,CAAA,YAAA,CAAA;wBAE1B,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,IAAI,CAAC,MAAM,CAAC,CAAA,CAAA;;AAAnD,wBAAA,EAAA,CAAA,IAAA,EAAmD,CAAC;AACpD,wBAAA,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;AACjB,wBAAA,OAAA,CAAA,CAAA,aAAO,IAAI,CAAC,CAAA;;;AAEZ,wBAAA,OAAO,CAAC,KAAK,CAAC,IAAE,CAAC,CAAC;AAClB,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\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.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 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 // not fully initialized and the event will not get properly sent to Sentry\n this.createReplayEvent();\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 // 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,CAAC,EAAE,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACzF,SAAS;AACT,QAAQ,OAAO,CAAC,CAAC;AACjB,MAAK;AACL,IAAI,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AAC3C,EAAC;AACD;AACO,SAAS,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE;AAC7B,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;AACf,IAAI,KAAK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;;wBAGA,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;AA7dD;;AAEG;IACW,YAAE,CAAA,EAAA,GAAG,QAAQ,CAAC;IA2d9B,OAAC,YAAA,CAAA;AAAA,CA/dD,EA+dC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/replay",
|
|
3
|
-
"version": "0.2.0-
|
|
3
|
+
"version": "0.2.0-7",
|
|
4
4
|
"description": "User replays for Sentry",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.es.js",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"clean": "yarn rimraf dist",
|
|
11
11
|
"lint": "yarn eslint . --ext .js,.jsx,.ts,.tsx",
|
|
12
12
|
"prepare": "husky install",
|
|
13
|
+
"prepublishOnly": "yarn build",
|
|
13
14
|
"start:demo": "yarn build && cd demo && yarn start",
|
|
14
15
|
"test": "yarn jest",
|
|
15
16
|
"watch": "NODE_ENV=development yarn build --watch"
|
|
@@ -30,8 +31,7 @@
|
|
|
30
31
|
"peerDependencies": {
|
|
31
32
|
"@sentry/browser": ">=6.0.0",
|
|
32
33
|
"@sentry/tracing": ">=6.0.0",
|
|
33
|
-
"@sentry/utils": ">=6.0.0"
|
|
34
|
-
"rrweb": ">=0.7.0"
|
|
34
|
+
"@sentry/utils": ">=6.0.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@babel/core": "^7.17.5",
|
|
@@ -54,13 +54,14 @@
|
|
|
54
54
|
"prettier": "^2.5.1",
|
|
55
55
|
"rimraf": "^3.0.2",
|
|
56
56
|
"rollup": "^2.70.0",
|
|
57
|
-
"rrweb": "^1.1.2",
|
|
58
57
|
"ts-jest": "^27.1.3",
|
|
59
58
|
"ts-node": "^10.7.0",
|
|
60
59
|
"tslib": "^2.3.1",
|
|
61
60
|
"typescript": "^4.6.2"
|
|
62
61
|
},
|
|
63
|
-
"dependencies": {
|
|
62
|
+
"dependencies": {
|
|
63
|
+
"rrweb": "^1.1.3"
|
|
64
|
+
},
|
|
64
65
|
"prettier": {
|
|
65
66
|
"singleQuote": true
|
|
66
67
|
},
|