@sentry/replay 0.5.6 → 0.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/index.es.js +5 -22
  2. package/dist/index.js +5 -22
  3. package/dist/index.js.map +1 -1
  4. package/dist/{src → types/src}/api/captureReplay.d.ts +0 -0
  5. package/dist/{src → types/src}/api/captureReplayUpdate.d.ts +0 -0
  6. package/dist/{src → types/src}/coreHandlers/getBreadcrumbHandler.d.ts +0 -0
  7. package/dist/{src → types/src}/coreHandlers/getSpanHandler.d.ts +0 -0
  8. package/dist/{src → types/src}/coreHandlers/handleDom.d.ts +0 -0
  9. package/dist/{src → types/src}/coreHandlers/handleFetch.d.ts +0 -0
  10. package/dist/{src → types/src}/coreHandlers/handleHistory.d.ts +0 -0
  11. package/dist/{src → types/src}/coreHandlers/handleScope.d.ts +0 -0
  12. package/dist/{src → types/src}/coreHandlers/handleXhr.d.ts +0 -0
  13. package/dist/{src → types/src}/createPerformanceEntry.d.ts +0 -0
  14. package/dist/{src → types/src}/eventBuffer.d.ts +0 -0
  15. package/dist/{src → types/src}/flags.d.ts +0 -0
  16. package/dist/{src → types/src}/index.d.ts +0 -4
  17. package/dist/{src → types/src}/session/Session.d.ts +0 -0
  18. package/dist/{src → types/src}/session/constants.d.ts +0 -0
  19. package/dist/{src → types/src}/session/createSession.d.ts +0 -0
  20. package/dist/{src → types/src}/session/fetchSession.d.ts +0 -0
  21. package/dist/{src → types/src}/session/getSession.d.ts +0 -0
  22. package/dist/{src → types/src}/session/index.d.ts +0 -0
  23. package/dist/{src → types/src}/session/saveSession.d.ts +0 -0
  24. package/dist/{src → types/src}/types.d.ts +0 -0
  25. package/dist/{src → types/src}/util/createBreadcrumb.d.ts +0 -0
  26. package/dist/{src → types/src}/util/createPayload.d.ts +0 -0
  27. package/dist/{src → types/src}/util/isExpired.d.ts +0 -0
  28. package/dist/{src → types/src}/util/isIngestHost.d.ts +0 -0
  29. package/dist/{src → types/src}/util/isSampled.d.ts +0 -0
  30. package/dist/{src → types/src}/util/isSessionExpired.d.ts +0 -0
  31. package/dist/{src → types/src}/util/logger.d.ts +0 -0
  32. package/package.json +1 -1
  33. package/dist/jest.config.d.ts +0 -3
  34. package/dist/jest.setup.d.ts +0 -10
  35. package/dist/src/coreHandlers/handleFetch.test.d.ts +0 -1
  36. package/dist/src/coreHandlers/handleScope-unit.test.d.ts +0 -1
  37. package/dist/src/coreHandlers/handleScope.test.d.ts +0 -1
  38. package/dist/src/createPerformanceEntry.test.d.ts +0 -1
  39. package/dist/src/eventBuffer.test.d.ts +0 -1
  40. package/dist/src/index-captureOnlyOnError.test.d.ts +0 -1
  41. package/dist/src/index-noSticky.test.d.ts +0 -1
  42. package/dist/src/index-sampling.test.d.ts +0 -1
  43. package/dist/src/index.test.d.ts +0 -1
  44. package/dist/src/session/Session.test.d.ts +0 -1
  45. package/dist/src/session/createSession.test.d.ts +0 -1
  46. package/dist/src/session/fetchSession.test.d.ts +0 -1
  47. package/dist/src/session/getSession.test.d.ts +0 -1
  48. package/dist/src/session/saveSession.test.d.ts +0 -1
  49. package/dist/src/util/isExpired.test.d.ts +0 -1
  50. package/dist/src/util/isSampled.test.d.ts +0 -1
  51. package/dist/src/util/isSessionExpired.test.d.ts +0 -1
  52. package/dist/test/index.d.ts +0 -3
  53. package/dist/test/mocks/mockRrweb.d.ts +0 -15
  54. package/dist/test/mocks/mockSdk.d.ts +0 -11
package/dist/index.es.js CHANGED
@@ -922,15 +922,6 @@ var SentryReplay = /** @class */ (function () {
922
922
  });
923
923
  _this.doChangeToForegroundTasks(breadcrumb);
924
924
  };
925
- /**
926
- * Handle when page is closed
927
- */
928
- this.handleWindowUnload = function () {
929
- _this.createCustomBreadcrumb(createBreadcrumb({
930
- category: 'ui.exit',
931
- }));
932
- _this.destroy();
933
- };
934
925
  /**
935
926
  * Handler for Sentry Core SDK events.
936
927
  *
@@ -1152,7 +1143,6 @@ var SentryReplay = /** @class */ (function () {
1152
1143
  document.addEventListener('visibilitychange', this.handleVisibilityChange);
1153
1144
  window.addEventListener('blur', this.handleWindowBlur);
1154
1145
  window.addEventListener('focus', this.handleWindowFocus);
1155
- window.addEventListener('beforeunload', this.handleWindowUnload);
1156
1146
  // Listeners from core SDK //
1157
1147
  var scope = getCurrentHub().getScope();
1158
1148
  scope === null || scope === void 0 ? void 0 : scope.addScopeListener(this.handleCoreBreadcrumbListener('scope'));
@@ -1191,7 +1181,6 @@ var SentryReplay = /** @class */ (function () {
1191
1181
  document.removeEventListener('visibilitychange', this.handleVisibilityChange);
1192
1182
  window.removeEventListener('blur', this.handleWindowBlur);
1193
1183
  window.removeEventListener('focus', this.handleWindowFocus);
1194
- window.removeEventListener('beforeunload', this.handleWindowUnload);
1195
1184
  if (this.performanceObserver) {
1196
1185
  this.performanceObserver.disconnect();
1197
1186
  this.performanceObserver = null;
@@ -1205,12 +1194,8 @@ var SentryReplay = /** @class */ (function () {
1205
1194
  return;
1206
1195
  }
1207
1196
  var isExpired = isSessionExpired(this.session, VISIBILITY_CHANGE_TIMEOUT);
1208
- if (breadcrumb) {
1209
- this.createCustomBreadcrumb(__assign(__assign({}, breadcrumb), {
1210
- // if somehow the page went hidden while session is expired, attach to previous session
1211
- timestamp: isExpired
1212
- ? this.session.lastActivity / 1000
1213
- : breadcrumb.timestamp }));
1197
+ if (breadcrumb && !isExpired) {
1198
+ this.createCustomBreadcrumb(breadcrumb);
1214
1199
  }
1215
1200
  // Send replay when the page/tab becomes hidden. There is no reason to send
1216
1201
  // replay if it becomes visible, since no actions we care about were done
@@ -1225,11 +1210,6 @@ var SentryReplay = /** @class */ (function () {
1225
1210
  return;
1226
1211
  }
1227
1212
  var isExpired = isSessionExpired(this.session, VISIBILITY_CHANGE_TIMEOUT);
1228
- if (breadcrumb) {
1229
- this.createCustomBreadcrumb(__assign(__assign({}, breadcrumb), { timestamp: isExpired
1230
- ? new Date().getTime() / 1000
1231
- : breadcrumb.timestamp }));
1232
- }
1233
1213
  if (isExpired) {
1234
1214
  // If the user has come back to the page within VISIBILITY_CHANGE_TIMEOUT
1235
1215
  // ms, we will re-use the existing session, otherwise create a new
@@ -1239,6 +1219,9 @@ var SentryReplay = /** @class */ (function () {
1239
1219
  this.triggerFullSnapshot();
1240
1220
  return;
1241
1221
  }
1222
+ if (breadcrumb) {
1223
+ this.createCustomBreadcrumb(breadcrumb);
1224
+ }
1242
1225
  // Otherwise if session is not expired...
1243
1226
  // Update with current timestamp as the last session activity
1244
1227
  // Only updating session on visibility change to be conservative about
package/dist/index.js CHANGED
@@ -926,15 +926,6 @@ var SentryReplay = /** @class */ (function () {
926
926
  });
927
927
  _this.doChangeToForegroundTasks(breadcrumb);
928
928
  };
929
- /**
930
- * Handle when page is closed
931
- */
932
- this.handleWindowUnload = function () {
933
- _this.createCustomBreadcrumb(createBreadcrumb({
934
- category: 'ui.exit',
935
- }));
936
- _this.destroy();
937
- };
938
929
  /**
939
930
  * Handler for Sentry Core SDK events.
940
931
  *
@@ -1156,7 +1147,6 @@ var SentryReplay = /** @class */ (function () {
1156
1147
  document.addEventListener('visibilitychange', this.handleVisibilityChange);
1157
1148
  window.addEventListener('blur', this.handleWindowBlur);
1158
1149
  window.addEventListener('focus', this.handleWindowFocus);
1159
- window.addEventListener('beforeunload', this.handleWindowUnload);
1160
1150
  // Listeners from core SDK //
1161
1151
  var scope = core.getCurrentHub().getScope();
1162
1152
  scope === null || scope === void 0 ? void 0 : scope.addScopeListener(this.handleCoreBreadcrumbListener('scope'));
@@ -1195,7 +1185,6 @@ var SentryReplay = /** @class */ (function () {
1195
1185
  document.removeEventListener('visibilitychange', this.handleVisibilityChange);
1196
1186
  window.removeEventListener('blur', this.handleWindowBlur);
1197
1187
  window.removeEventListener('focus', this.handleWindowFocus);
1198
- window.removeEventListener('beforeunload', this.handleWindowUnload);
1199
1188
  if (this.performanceObserver) {
1200
1189
  this.performanceObserver.disconnect();
1201
1190
  this.performanceObserver = null;
@@ -1209,12 +1198,8 @@ var SentryReplay = /** @class */ (function () {
1209
1198
  return;
1210
1199
  }
1211
1200
  var isExpired = isSessionExpired(this.session, VISIBILITY_CHANGE_TIMEOUT);
1212
- if (breadcrumb) {
1213
- this.createCustomBreadcrumb(__assign(__assign({}, breadcrumb), {
1214
- // if somehow the page went hidden while session is expired, attach to previous session
1215
- timestamp: isExpired
1216
- ? this.session.lastActivity / 1000
1217
- : breadcrumb.timestamp }));
1201
+ if (breadcrumb && !isExpired) {
1202
+ this.createCustomBreadcrumb(breadcrumb);
1218
1203
  }
1219
1204
  // Send replay when the page/tab becomes hidden. There is no reason to send
1220
1205
  // replay if it becomes visible, since no actions we care about were done
@@ -1229,11 +1214,6 @@ var SentryReplay = /** @class */ (function () {
1229
1214
  return;
1230
1215
  }
1231
1216
  var isExpired = isSessionExpired(this.session, VISIBILITY_CHANGE_TIMEOUT);
1232
- if (breadcrumb) {
1233
- this.createCustomBreadcrumb(__assign(__assign({}, breadcrumb), { timestamp: isExpired
1234
- ? new Date().getTime() / 1000
1235
- : breadcrumb.timestamp }));
1236
- }
1237
1217
  if (isExpired) {
1238
1218
  // If the user has come back to the page within VISIBILITY_CHANGE_TIMEOUT
1239
1219
  // ms, we will re-use the existing session, otherwise create a new
@@ -1243,6 +1223,9 @@ var SentryReplay = /** @class */ (function () {
1243
1223
  this.triggerFullSnapshot();
1244
1224
  return;
1245
1225
  }
1226
+ if (breadcrumb) {
1227
+ this.createCustomBreadcrumb(breadcrumb);
1228
+ }
1246
1229
  // Otherwise if session is not expired...
1247
1230
  // Update with current timestamp as the last session activity
1248
1231
  // Only updating session on visibility change to be conservative about