@sentry/replay 0.2.0-5 → 0.2.0-8

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