@sentry/replay 0.4.0 → 0.4.5

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.
@@ -4,7 +4,7 @@ import { IEventBuffer } from './eventBuffer';
4
4
  import type { RRWebOptions, ReplaySpan, ReplayRequest, InstrumentationType, SentryReplayPluginOptions, SentryReplayConfiguration } from './types';
5
5
  import { Session } from './session/Session';
6
6
  /**
7
- * Returns true if we want to flush immediately, otherwise continue with normal batching
7
+ * Returns true to return control to calling function, otherwise continue with normal batching
8
8
  */
9
9
  declare type AddUpdateCallback = () => boolean | void;
10
10
  export declare class SentryReplay implements Integration {
@@ -39,8 +39,9 @@ export declare class SentryReplay implements Integration {
39
39
  */
40
40
  private timeout;
41
41
  /**
42
- * The timestamp of the first event since the last flush.
43
- * This is used to determine if the maximum allowed time has passed before we should flush events again.
42
+ * The timestamp of the first event since the last flush. This is used to
43
+ * determine if the maximum allowed time has passed before events should be
44
+ * flushed again.
44
45
  */
45
46
  private initialEventTimestampSinceFlush;
46
47
  private performanceObserver;
@@ -55,17 +56,17 @@ export declare class SentryReplay implements Integration {
55
56
  private needsCaptureReplay;
56
57
  session: Session | undefined;
57
58
  static attachmentUrlFromDsn(dsn: DsnComponents, eventId: string): string;
58
- constructor({ uploadMinDelay, uploadMaxDelay, stickySession, // TBD: Making this opt-in for now
59
+ constructor({ flushMinDelay, flushMaxDelay, initialFlushDelay, stickySession, // TBD: Making this opt-in for now
59
60
  useCompression, rrwebConfig: { maskAllInputs, blockClass, ignoreClass, maskTextClass, ...rrwebRecordOptions }, }?: SentryReplayConfiguration);
60
61
  setupOnce(): void;
61
62
  setup(): void;
62
63
  /**
63
64
  * We want to batch uploads of replay events. Save events only if
64
- * `<uploadMinDelay>` milliseconds have elapsed since the last event
65
- * *OR* if `<uploadMaxDelay>` milliseconds have elapsed.
65
+ * `<flushMinDelay>` milliseconds have elapsed since the last event
66
+ * *OR* if `<flushMaxDelay>` milliseconds have elapsed.
66
67
  *
67
- * Accepts a callback to perform side-effects and returns a boolean value if we
68
- * should flush events immediately
68
+ * Accepts a callback to perform side-effects and returns true to stop batch
69
+ * processing and hand back control to caller.
69
70
  */
70
71
  addUpdate(cb?: AddUpdateCallback): void;
71
72
  /**
@@ -33,6 +33,10 @@ export declare class Session {
33
33
  * Sequence ID specific to replay updates
34
34
  */
35
35
  private _sequenceId;
36
+ /**
37
+ * Previous session ID
38
+ */
39
+ private _previousSessionId;
36
40
  readonly options: Required<SessionOptions>;
37
41
  constructor(session?: Partial<SessionObject>, { stickySession }?: SessionOptions);
38
42
  get id(): string;
@@ -41,6 +45,8 @@ export declare class Session {
41
45
  set lastActivity(newDate: number);
42
46
  get sequenceId(): number;
43
47
  set sequenceId(id: number);
48
+ get previousSessionId(): string;
49
+ set previousSessionId(id: string);
44
50
  toJSON(): SessionObject;
45
51
  }
46
52
  export {};
@@ -33,11 +33,15 @@ export interface SentryReplayPluginOptions {
33
33
  /**
34
34
  * The amount of time to wait before sending a replay
35
35
  */
36
- uploadMinDelay?: number;
36
+ flushMinDelay?: number;
37
37
  /**
38
38
  * The max amount of time to wait before sending a replay
39
39
  */
40
- uploadMaxDelay?: number;
40
+ flushMaxDelay?: number;
41
+ /**
42
+ * The amount of time to buffer the initial snapshot
43
+ */
44
+ initialFlushDelay?: number;
41
45
  /**
42
46
  * If false, will create a new session per pageload
43
47
  */
@@ -4,7 +4,7 @@ import { IEventBuffer } from './eventBuffer';
4
4
  import type { RRWebOptions, ReplaySpan, ReplayRequest, InstrumentationType, SentryReplayPluginOptions, SentryReplayConfiguration } from './types';
5
5
  import { Session } from './session/Session';
6
6
  /**
7
- * Returns true if we want to flush immediately, otherwise continue with normal batching
7
+ * Returns true to return control to calling function, otherwise continue with normal batching
8
8
  */
9
9
  declare type AddUpdateCallback = () => boolean | void;
10
10
  export declare class SentryReplay implements Integration {
@@ -39,8 +39,9 @@ export declare class SentryReplay implements Integration {
39
39
  */
40
40
  private timeout;
41
41
  /**
42
- * The timestamp of the first event since the last flush.
43
- * This is used to determine if the maximum allowed time has passed before we should flush events again.
42
+ * The timestamp of the first event since the last flush. This is used to
43
+ * determine if the maximum allowed time has passed before events should be
44
+ * flushed again.
44
45
  */
45
46
  private initialEventTimestampSinceFlush;
46
47
  private performanceObserver;
@@ -55,17 +56,17 @@ export declare class SentryReplay implements Integration {
55
56
  private needsCaptureReplay;
56
57
  session: Session | undefined;
57
58
  static attachmentUrlFromDsn(dsn: DsnComponents, eventId: string): string;
58
- constructor({ uploadMinDelay, uploadMaxDelay, stickySession, // TBD: Making this opt-in for now
59
+ constructor({ flushMinDelay, flushMaxDelay, initialFlushDelay, stickySession, // TBD: Making this opt-in for now
59
60
  useCompression, rrwebConfig: { maskAllInputs, blockClass, ignoreClass, maskTextClass, ...rrwebRecordOptions }, }?: SentryReplayConfiguration);
60
61
  setupOnce(): void;
61
62
  setup(): void;
62
63
  /**
63
64
  * We want to batch uploads of replay events. Save events only if
64
- * `<uploadMinDelay>` milliseconds have elapsed since the last event
65
- * *OR* if `<uploadMaxDelay>` milliseconds have elapsed.
65
+ * `<flushMinDelay>` milliseconds have elapsed since the last event
66
+ * *OR* if `<flushMaxDelay>` milliseconds have elapsed.
66
67
  *
67
- * Accepts a callback to perform side-effects and returns a boolean value if we
68
- * should flush events immediately
68
+ * Accepts a callback to perform side-effects and returns true to stop batch
69
+ * processing and hand back control to caller.
69
70
  */
70
71
  addUpdate(cb?: AddUpdateCallback): void;
71
72
  /**
@@ -33,6 +33,10 @@ export declare class Session {
33
33
  * Sequence ID specific to replay updates
34
34
  */
35
35
  private _sequenceId;
36
+ /**
37
+ * Previous session ID
38
+ */
39
+ private _previousSessionId;
36
40
  readonly options: Required<SessionOptions>;
37
41
  constructor(session?: Partial<SessionObject>, { stickySession }?: SessionOptions);
38
42
  get id(): string;
@@ -41,6 +45,8 @@ export declare class Session {
41
45
  set lastActivity(newDate: number);
42
46
  get sequenceId(): number;
43
47
  set sequenceId(id: number);
48
+ get previousSessionId(): string;
49
+ set previousSessionId(id: string);
44
50
  toJSON(): SessionObject;
45
51
  }
46
52
  export {};
@@ -33,11 +33,15 @@ export interface SentryReplayPluginOptions {
33
33
  /**
34
34
  * The amount of time to wait before sending a replay
35
35
  */
36
- uploadMinDelay?: number;
36
+ flushMinDelay?: number;
37
37
  /**
38
38
  * The max amount of time to wait before sending a replay
39
39
  */
40
- uploadMaxDelay?: number;
40
+ flushMaxDelay?: number;
41
+ /**
42
+ * The amount of time to buffer the initial snapshot
43
+ */
44
+ initialFlushDelay?: number;
41
45
  /**
42
46
  * If false, will create a new session per pageload
43
47
  */
package/dist/index.es.js CHANGED
@@ -432,6 +432,16 @@ var Session = /** @class */ (function () {
432
432
  enumerable: false,
433
433
  configurable: true
434
434
  });
435
+ Object.defineProperty(Session.prototype, "previousSessionId", {
436
+ get: function () {
437
+ return this._previousSessionId;
438
+ },
439
+ set: function (id) {
440
+ this._previousSessionId = id;
441
+ },
442
+ enumerable: false,
443
+ configurable: true
444
+ });
435
445
  Session.prototype.toJSON = function () {
436
446
  return {
437
447
  id: this.id,
@@ -551,7 +561,7 @@ function handleScope(scope) {
551
561
  var newBreadcrumb = scope._breadcrumbs[scope._breadcrumbs.length - 1];
552
562
  // Listener can be called when breadcrumbs have not changed, so we store the
553
563
  // reference to the last crumb and only return a crumb if it has changed
554
- if (_LAST_BREADCRUMB === newBreadcrumb) {
564
+ if (_LAST_BREADCRUMB === newBreadcrumb || !newBreadcrumb) {
555
565
  return null;
556
566
  }
557
567
  _LAST_BREADCRUMB = newBreadcrumb;
@@ -596,9 +606,9 @@ var SentryReplay = /** @class */ (function () {
596
606
  function SentryReplay(_a) {
597
607
  if (_a === void 0) { _a = {}; }
598
608
  var _this = this;
599
- 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
600
- _e = _a.useCompression, // TBD: Making this opt-in for now
601
- useCompression = _e === void 0 ? true : _e, _f = _a.rrwebConfig, _g = _f === void 0 ? {} : _f, _h = _g.maskAllInputs, maskAllInputs = _h === void 0 ? true : _h, _j = _g.blockClass, blockClass = _j === void 0 ? 'sr-block' : _j, _k = _g.ignoreClass, ignoreClass = _k === void 0 ? 'sr-ignore' : _k, _l = _g.maskTextClass, maskTextClass = _l === void 0 ? 'sr-mask' : _l, rrwebRecordOptions = __rest(_g, ["maskAllInputs", "blockClass", "ignoreClass", "maskTextClass"]);
609
+ var _b = _a.flushMinDelay, flushMinDelay = _b === void 0 ? 5000 : _b, _c = _a.flushMaxDelay, flushMaxDelay = _c === void 0 ? 15000 : _c, _d = _a.initialFlushDelay, initialFlushDelay = _d === void 0 ? 5000 : _d, _e = _a.stickySession, stickySession = _e === void 0 ? false : _e, // TBD: Making this opt-in for now
610
+ _f = _a.useCompression, // TBD: Making this opt-in for now
611
+ useCompression = _f === void 0 ? true : _f, _g = _a.rrwebConfig, _h = _g === void 0 ? {} : _g, _j = _h.maskAllInputs, maskAllInputs = _j === void 0 ? true : _j, _k = _h.blockClass, blockClass = _k === void 0 ? 'sr-block' : _k, _l = _h.ignoreClass, ignoreClass = _l === void 0 ? 'sr-ignore' : _l, _m = _h.maskTextClass, maskTextClass = _m === void 0 ? 'sr-mask' : _m, rrwebRecordOptions = __rest(_h, ["maskAllInputs", "blockClass", "ignoreClass", "maskTextClass"]);
602
612
  /**
603
613
  * @inheritDoc
604
614
  */
@@ -616,8 +626,9 @@ var SentryReplay = /** @class */ (function () {
616
626
  */
617
627
  this.performanceEvents = [];
618
628
  /**
619
- * The timestamp of the first event since the last flush.
620
- * This is used to determine if the maximum allowed time has passed before we should flush events again.
629
+ * The timestamp of the first event since the last flush. This is used to
630
+ * determine if the maximum allowed time has passed before events should be
631
+ * flushed again.
621
632
  */
622
633
  this.initialEventTimestampSinceFlush = null;
623
634
  this.performanceObserver = null;
@@ -708,7 +719,12 @@ var SentryReplay = /** @class */ (function () {
708
719
  _this.performanceEvents = __spreadArray(__spreadArray([], _this.performanceEvents, true), list.getEntries(), true);
709
720
  };
710
721
  this.rrwebRecordOptions = __assign({ maskAllInputs: maskAllInputs, blockClass: blockClass, ignoreClass: ignoreClass, maskTextClass: maskTextClass }, rrwebRecordOptions);
711
- this.options = { uploadMinDelay: uploadMinDelay, uploadMaxDelay: uploadMaxDelay, stickySession: stickySession };
722
+ this.options = {
723
+ flushMinDelay: flushMinDelay,
724
+ flushMaxDelay: flushMaxDelay,
725
+ stickySession: stickySession,
726
+ initialFlushDelay: initialFlushDelay,
727
+ };
712
728
  this.eventBuffer = createEventBuffer({ useCompression: useCompression });
713
729
  }
714
730
  SentryReplay.attachmentUrlFromDsn = function (dsn, eventId) {
@@ -757,25 +773,36 @@ var SentryReplay = /** @class */ (function () {
757
773
  // We need to clear existing events on a checkout, otherwise they are
758
774
  // incremental event updates and should be appended
759
775
  _this.eventBuffer.addEvent(event, isCheckout);
760
- // This event type is a fullsnapshot, we should save immediately when this occurs
776
+ // This event type is a fullsnapshot
761
777
  // See https://github.com/rrweb-io/rrweb/blob/d8f9290ca496712aa1e7d472549480c4e7876594/packages/rrweb/src/types.ts#L16
762
778
  if (event.type === 2) {
763
- // A fullsnapshot happens on initial load and if we need to start a
764
- // new replay due to idle timeout. In the latter case, a new session *should* have been started
765
- // before triggering a new checkout
779
+ // If the full snapshot is due to an initial load, we will not have
780
+ // a previous session ID. In this case, we want to buffer events
781
+ // for a set amount of time before flushing. This can help avoid
782
+ // capturing replays of users that immediately close the window.
783
+ if (!_this.session.previousSessionId) {
784
+ var now_1 = new Date().getTime();
785
+ setTimeout(function () { return _this.flushUpdate(now_1); }, _this.options.initialFlushDelay);
786
+ return true;
787
+ }
788
+ // The other case where a full snapshot occurs is when a new replay
789
+ // needs to be started due to session expiration. The new session
790
+ // is started before triggering a new checkout and contains the id
791
+ // of the previous session. Do not immediately flush in this case
792
+ // to avoid capturing only the checkout and instead the replay will
793
+ // be captured if they perform any follow-up actions.
766
794
  return true;
767
795
  }
768
- return false;
769
796
  });
770
797
  } }));
771
798
  };
772
799
  /**
773
800
  * We want to batch uploads of replay events. Save events only if
774
- * `<uploadMinDelay>` milliseconds have elapsed since the last event
775
- * *OR* if `<uploadMaxDelay>` milliseconds have elapsed.
801
+ * `<flushMinDelay>` milliseconds have elapsed since the last event
802
+ * *OR* if `<flushMaxDelay>` milliseconds have elapsed.
776
803
  *
777
- * Accepts a callback to perform side-effects and returns a boolean value if we
778
- * should flush events immediately
804
+ * Accepts a callback to perform side-effects and returns true to stop batch
805
+ * processing and hand back control to caller.
779
806
  */
780
807
  SentryReplay.prototype.addUpdate = function (cb) {
781
808
  var _this = this;
@@ -789,25 +816,26 @@ var SentryReplay = /** @class */ (function () {
789
816
  if (this.timeout) {
790
817
  window.clearTimeout(this.timeout);
791
818
  }
819
+ // If callback is true, we do not want to continue with flushing -- the
820
+ // caller will need to handle it.
792
821
  if ((cb === null || cb === void 0 ? void 0 : cb()) === true) {
793
- this.flushUpdate();
794
822
  return;
795
823
  }
796
- var uploadMaxDelayExceeded = isExpired(this.initialEventTimestampSinceFlush, this.options.uploadMaxDelay, now);
797
- // If `uploadMaxDelayExceeded` is true, then we should finish the replay event immediately,
798
- // Otherwise schedule it to be finished in `this.options.uploadMinDelay`
799
- if (uploadMaxDelayExceeded) {
824
+ var flushMaxDelayExceeded = isExpired(this.initialEventTimestampSinceFlush, this.options.flushMaxDelay, now);
825
+ // If `flushMaxDelayExceeded` is true, then we should finish the replay event immediately,
826
+ // Otherwise schedule it to be finished in `this.options.flushMinDelay`
827
+ if (flushMaxDelayExceeded) {
800
828
  logger.log('replay max delay exceeded, finishing replay event');
801
829
  this.flushUpdate();
802
830
  return;
803
831
  }
804
832
  // Set timer to finish replay event and send replay attachment to
805
- // Sentry. Will be cancelled if an event happens before `uploadMinDelay`
833
+ // Sentry. Will be cancelled if an event happens before `flushMinDelay`
806
834
  // elapses.
807
835
  this.timeout = window.setTimeout(function () {
808
836
  logger.log('replay timeout exceeded, finishing replay event');
809
837
  _this.flushUpdate(now);
810
- }, this.options.uploadMinDelay);
838
+ }, this.options.flushMinDelay);
811
839
  };
812
840
  /**
813
841
  * Currently, this needs to be manually called (e.g. for tests). Sentry SDK does not support a teardown
@@ -824,17 +852,21 @@ var SentryReplay = /** @class */ (function () {
824
852
  * is expired.
825
853
  */
826
854
  SentryReplay.prototype.loadSession = function (_a) {
855
+ var _b, _c;
827
856
  var expiry = _a.expiry;
828
- var _b = getSession({
857
+ var _d = getSession({
829
858
  expiry: expiry,
830
859
  stickySession: this.options.stickySession,
831
860
  currentSession: this.session,
832
- }), type = _b.type, session = _b.session;
861
+ }), type = _d.type, session = _d.session;
833
862
  // If session was newly created (i.e. was not loaded from storage), then
834
863
  // enable flag to create the root replay
835
864
  if (type === 'new') {
836
865
  this.needsCaptureReplay = true;
837
866
  }
867
+ if (session.id !== ((_b = this.session) === null || _b === void 0 ? void 0 : _b.id)) {
868
+ session.previousSessionId = (_c = this.session) === null || _c === void 0 ? void 0 : _c.id;
869
+ }
838
870
  this.session = session;
839
871
  };
840
872
  SentryReplay.prototype.addListeners = function () {
@@ -1011,12 +1043,13 @@ var SentryReplay = /** @class */ (function () {
1011
1043
  };
1012
1044
  SentryReplay.prototype.flushUpdate = function (lastActivity) {
1013
1045
  return __awaiter(this, void 0, void 0, function () {
1014
- var recordingData;
1046
+ var recordingData, err_1;
1015
1047
  return __generator(this, function (_a) {
1016
1048
  switch (_a.label) {
1017
1049
  case 0:
1018
1050
  if (!this.checkAndHandleExpiredSession()) {
1019
1051
  logger.error(new Error('Attempting to finish replay event after session expired.'));
1052
+ return [2 /*return*/];
1020
1053
  }
1021
1054
  if (!this.session.id) {
1022
1055
  console.error(new Error('[Sentry]: No transaction, no replay'));
@@ -1026,18 +1059,27 @@ var SentryReplay = /** @class */ (function () {
1026
1059
  if (!this.eventBuffer.length) {
1027
1060
  return [2 /*return*/];
1028
1061
  }
1029
- return [4 /*yield*/, this.eventBuffer.finish()];
1030
- case 1:
1031
- recordingData = _a.sent();
1032
- this.sendReplay(this.session.id, recordingData);
1033
- this.initialEventTimestampSinceFlush = null;
1034
- // TBD: Alternatively we could update this after every rrweb event
1035
- this.updateLastActivity(lastActivity);
1036
1062
  // Only want to create replay event if session is new
1037
1063
  if (this.needsCaptureReplay) {
1064
+ // This event needs to exist before calling `sendReplay`
1038
1065
  captureReplay(this.session);
1039
1066
  this.needsCaptureReplay = false;
1040
1067
  }
1068
+ // Reset this to null regardless of `sendReplay` result so that future
1069
+ // events will get flushed properly
1070
+ this.initialEventTimestampSinceFlush = null;
1071
+ _a.label = 1;
1072
+ case 1:
1073
+ _a.trys.push([1, 4, , 5]);
1074
+ return [4 /*yield*/, this.eventBuffer.finish()];
1075
+ case 2:
1076
+ recordingData = _a.sent();
1077
+ return [4 /*yield*/, this.sendReplay(this.session.id, recordingData)];
1078
+ case 3:
1079
+ _a.sent();
1080
+ // The below will only happen after successfully sending replay //
1081
+ // TBD: Alternatively we could update this after every rrweb event
1082
+ this.updateLastActivity(lastActivity);
1041
1083
  captureEvent({
1042
1084
  message: "".concat(REPLAY_EVENT_NAME, "-").concat(uuid4().substring(16)),
1043
1085
  tags: {
@@ -1045,7 +1087,12 @@ var SentryReplay = /** @class */ (function () {
1045
1087
  sequenceId: this.session.sequenceId++,
1046
1088
  },
1047
1089
  });
1048
- return [2 /*return*/];
1090
+ return [3 /*break*/, 5];
1091
+ case 4:
1092
+ err_1 = _a.sent();
1093
+ console.error(err_1);
1094
+ return [3 /*break*/, 5];
1095
+ case 5: return [2 /*return*/];
1049
1096
  }
1050
1097
  });
1051
1098
  });
@@ -1102,8 +1149,8 @@ var SentryReplay = /** @class */ (function () {
1102
1149
  return __awaiter(this, void 0, void 0, function () {
1103
1150
  var client, endpoint, ex_1;
1104
1151
  var _this = this;
1105
- return __generator(this, function (_a) {
1106
- switch (_a.label) {
1152
+ return __generator(this, function (_b) {
1153
+ switch (_b.label) {
1107
1154
  case 0:
1108
1155
  // short circuit if there's no events to upload
1109
1156
  if (!events.length) {
@@ -1111,34 +1158,60 @@ var SentryReplay = /** @class */ (function () {
1111
1158
  }
1112
1159
  client = getCurrentHub().getClient();
1113
1160
  endpoint = SentryReplay.attachmentUrlFromDsn(client.getDsn(), eventId);
1114
- _a.label = 1;
1161
+ _b.label = 1;
1115
1162
  case 1:
1116
- _a.trys.push([1, 3, , 4]);
1163
+ _b.trys.push([1, 3, , 8]);
1117
1164
  return [4 /*yield*/, this.sendReplayRequest({
1118
1165
  endpoint: endpoint,
1119
1166
  events: events,
1120
1167
  })];
1121
1168
  case 2:
1122
- _a.sent();
1169
+ _b.sent();
1123
1170
  this.resetRetries();
1124
1171
  return [2 /*return*/, true];
1125
1172
  case 3:
1126
- ex_1 = _a.sent();
1173
+ ex_1 = _b.sent();
1127
1174
  // we have to catch this otherwise it throws an infinite loop in Sentry
1128
1175
  console.error(ex_1);
1129
1176
  // If an error happened here, it's likely that uploading the attachment
1130
1177
  // failed, we'll can retry with the same events payload
1131
1178
  if (this.retryCount >= MAX_RETRY_COUNT) {
1132
1179
  this.resetRetries();
1180
+ return [2 /*return*/, false];
1133
1181
  }
1134
- else {
1135
- this.retryCount = this.retryCount + 1;
1136
- // will retry in intervals of 5, 10, 15, 20, 25 seconds
1137
- this.retryInterval = this.retryCount * this.retryInterval;
1138
- setTimeout(function () { return _this.sendReplay(eventId, events); }, this.retryInterval);
1139
- }
1182
+ this.retryCount = this.retryCount + 1;
1183
+ // will retry in intervals of 5, 10, 15, 20, 25 seconds
1184
+ this.retryInterval = this.retryCount * this.retryInterval;
1185
+ _b.label = 4;
1186
+ case 4:
1187
+ _b.trys.push([4, 6, , 7]);
1188
+ return [4 /*yield*/, new Promise(function (resolve, reject) {
1189
+ setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
1190
+ var result;
1191
+ return __generator(this, function (_a) {
1192
+ switch (_a.label) {
1193
+ case 0: return [4 /*yield*/, this.sendReplay(eventId, events)];
1194
+ case 1:
1195
+ result = _a.sent();
1196
+ if (result) {
1197
+ resolve(true);
1198
+ }
1199
+ else {
1200
+ reject(new Error('Could not send replay'));
1201
+ }
1202
+ return [2 /*return*/];
1203
+ }
1204
+ });
1205
+ }); }, _this.retryInterval);
1206
+ })];
1207
+ case 5:
1208
+ _b.sent();
1209
+ return [2 /*return*/, true];
1210
+ case 6:
1211
+ _b.sent();
1140
1212
  return [2 /*return*/, false];
1141
- case 4: return [2 /*return*/];
1213
+ case 7: return [3 /*break*/, 8];
1214
+ case 8: return [2 /*return*/];
1142
1215
  }
1143
1216
  });
1144
1217
  });