@sentry/replay 0.5.0 → 0.5.3

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 (86) hide show
  1. package/dist/config/{dist → types}/jest.config.d.ts +0 -0
  2. package/dist/config/{dist → types}/jest.setup.d.ts +0 -0
  3. package/dist/config/{dist → types}/src/api/captureReplay.d.ts +0 -0
  4. package/dist/config/{dist → types}/src/api/captureReplayUpdate.d.ts +0 -0
  5. package/dist/config/{dist → types}/src/coreHandlers/getBreadcrumbHandler.d.ts +0 -0
  6. package/dist/config/{dist → types}/src/coreHandlers/getSpanHandler.d.ts +0 -0
  7. package/dist/config/{dist → types}/src/coreHandlers/handleDom.d.ts +0 -0
  8. package/dist/config/{dist → types}/src/coreHandlers/handleFetch.d.ts +0 -0
  9. package/dist/config/{dist → types}/src/coreHandlers/handleFetch.test.d.ts +0 -0
  10. package/dist/config/{dist → types}/src/coreHandlers/handleHistory.d.ts +0 -0
  11. package/dist/config/{dist → types}/src/coreHandlers/handleScope-unit.test.d.ts +0 -0
  12. package/dist/config/{dist → types}/src/coreHandlers/handleScope.d.ts +0 -0
  13. package/dist/config/{dist → types}/src/coreHandlers/handleScope.test.d.ts +0 -0
  14. package/dist/config/{dist → types}/src/coreHandlers/handleXhr.d.ts +0 -0
  15. package/dist/config/{dist → types}/src/createPerformanceEntry.d.ts +0 -0
  16. package/dist/config/{dist → types}/src/createPerformanceEntry.test.d.ts +0 -0
  17. package/dist/config/{dist → types}/src/eventBuffer.d.ts +0 -0
  18. package/dist/config/{dist → types}/src/eventBuffer.test.d.ts +0 -0
  19. package/dist/config/{dist → types}/src/flags.d.ts +0 -0
  20. package/dist/config/{dist → types}/src/index-captureOnlyOnError.test.d.ts +0 -0
  21. package/dist/config/{dist → types}/src/index-noSticky.test.d.ts +0 -0
  22. package/dist/config/{dist → types}/src/index-sampling.test.d.ts +0 -0
  23. package/dist/{dist → config/types/src}/index.d.ts +8 -2
  24. package/dist/config/{dist → types}/src/index.test.d.ts +0 -0
  25. package/dist/config/{dist → types}/src/session/Session.d.ts +0 -0
  26. package/dist/config/{dist → types}/src/session/Session.test.d.ts +0 -0
  27. package/dist/config/{dist → types}/src/session/constants.d.ts +0 -0
  28. package/dist/config/{dist → types}/src/session/createSession.d.ts +0 -0
  29. package/dist/config/{dist → types}/src/session/createSession.test.d.ts +0 -0
  30. package/dist/config/{dist → types}/src/session/fetchSession.d.ts +0 -0
  31. package/dist/config/{dist → types}/src/session/fetchSession.test.d.ts +0 -0
  32. package/dist/config/{dist → types}/src/session/getSession.d.ts +0 -0
  33. package/dist/config/{dist → types}/src/session/getSession.test.d.ts +0 -0
  34. package/dist/config/{dist → types}/src/session/index.d.ts +0 -0
  35. package/dist/config/{dist → types}/src/session/saveSession.d.ts +0 -0
  36. package/dist/config/{dist → types}/src/session/saveSession.test.d.ts +0 -0
  37. package/dist/config/{dist → types}/src/types.d.ts +0 -0
  38. package/dist/config/{dist → types}/src/util/createBreadcrumb.d.ts +0 -0
  39. package/dist/config/{dist → types}/src/util/createPayload.d.ts +0 -0
  40. package/dist/config/types/src/util/getAdditionalRequestData.d.ts +2 -0
  41. package/dist/config/{dist → types}/src/util/isExpired.d.ts +0 -0
  42. package/dist/config/{dist → types}/src/util/isExpired.test.d.ts +0 -0
  43. package/dist/config/{dist → types}/src/util/isIngestHost.d.ts +0 -0
  44. package/dist/config/{dist → types}/src/util/isSampled.d.ts +0 -0
  45. package/dist/config/{dist → types}/src/util/isSampled.test.d.ts +0 -0
  46. package/dist/config/{dist → types}/src/util/isSessionExpired.d.ts +0 -0
  47. package/dist/config/{dist → types}/src/util/isSessionExpired.test.d.ts +0 -0
  48. package/dist/config/{dist → types}/src/util/logger.d.ts +0 -0
  49. package/dist/config/{dist → types}/src/util/supportsSendBeacon.d.ts +0 -0
  50. package/dist/config/{dist → types}/test/index.d.ts +0 -0
  51. package/dist/config/{dist → types}/test/mocks/mockRrweb.d.ts +0 -0
  52. package/dist/config/{dist → types}/test/mocks/mockSdk.d.ts +0 -0
  53. package/dist/index.es.js +18 -10
  54. package/dist/index.js +18 -10
  55. package/dist/index.js.map +1 -1
  56. package/dist/{dist → types/src}/api/captureReplay.d.ts +0 -0
  57. package/dist/{dist → types/src}/api/captureReplayUpdate.d.ts +0 -0
  58. package/dist/{dist → types/src}/coreHandlers/getBreadcrumbHandler.d.ts +0 -0
  59. package/dist/{dist → types/src}/coreHandlers/getSpanHandler.d.ts +0 -0
  60. package/dist/{dist → types/src}/coreHandlers/handleDom.d.ts +0 -0
  61. package/dist/{dist → types/src}/coreHandlers/handleFetch.d.ts +0 -0
  62. package/dist/{dist → types/src}/coreHandlers/handleHistory.d.ts +0 -0
  63. package/dist/{dist → types/src}/coreHandlers/handleScope.d.ts +0 -0
  64. package/dist/{dist → types/src}/coreHandlers/handleXhr.d.ts +0 -0
  65. package/dist/{dist → types/src}/createPerformanceEntry.d.ts +0 -0
  66. package/dist/{dist → types/src}/eventBuffer.d.ts +0 -0
  67. package/dist/{dist → types/src}/flags.d.ts +0 -0
  68. package/dist/{config/dist → types}/src/index.d.ts +8 -2
  69. package/dist/{dist → types/src}/session/Session.d.ts +0 -0
  70. package/dist/{dist → types/src}/session/constants.d.ts +0 -0
  71. package/dist/{dist → types/src}/session/createSession.d.ts +0 -0
  72. package/dist/{dist → types/src}/session/fetchSession.d.ts +0 -0
  73. package/dist/{dist → types/src}/session/getSession.d.ts +0 -0
  74. package/dist/{dist → types/src}/session/index.d.ts +0 -0
  75. package/dist/{dist → types/src}/session/saveSession.d.ts +0 -0
  76. package/dist/{dist → types/src}/types.d.ts +0 -0
  77. package/dist/{dist → types/src}/util/createBreadcrumb.d.ts +0 -0
  78. package/dist/{dist → types/src}/util/createPayload.d.ts +0 -0
  79. package/dist/{dist → types/src}/util/isExpired.d.ts +0 -0
  80. package/dist/{dist → types/src}/util/isIngestHost.d.ts +0 -0
  81. package/dist/{dist → types/src}/util/isSampled.d.ts +0 -0
  82. package/dist/{dist → types/src}/util/isSessionExpired.d.ts +0 -0
  83. package/dist/{dist → types/src}/util/logger.d.ts +0 -0
  84. package/dist/{dist → types/src}/util/supportsSendBeacon.d.ts +0 -0
  85. package/package.json +2 -1
  86. package/dist/config/dist/src/coreHandlers/index.d.ts +0 -4
File without changes
File without changes
File without changes
File without changes
@@ -97,6 +97,12 @@ export declare class SentryReplay implements Integration {
97
97
  loadSession({ expiry }: {
98
98
  expiry: number;
99
99
  }): void;
100
+ /**
101
+ * Capture some initial state that can change throughout the lifespan of the
102
+ * replay. This is required because otherwise they would be captured at the
103
+ * first flush.
104
+ */
105
+ setInitialState(): void;
100
106
  /**
101
107
  * Adds listeners to record events for the replay
102
108
  */
@@ -201,8 +207,8 @@ export declare class SentryReplay implements Integration {
201
207
  /**
202
208
  * Return and clear context
203
209
  */
204
- popEventContext({ timestamp, }: {
205
- timestamp: number;
210
+ popEventContext({ timestamp, }?: {
211
+ timestamp?: number;
206
212
  }): CaptureReplayParams & CaptureReplayUpdateParams;
207
213
  /**
208
214
  * Flushes replay event buffer to Sentry.
File without changes
File without changes
@@ -0,0 +1,2 @@
1
+ import { ReplayPerformanceEntry } from '@/createPerformanceEntry';
2
+ export declare function getAdditionalRequestData(entries: ReplayPerformanceEntry[], coreRequests: ReplayPerformanceEntry[]): ReplayPerformanceEntry[];
File without changes
File without changes
package/dist/index.es.js CHANGED
@@ -1030,15 +1030,6 @@ var SentryReplay = /** @class */ (function () {
1030
1030
  // replay ID so that we can reference them later in the UI
1031
1031
  addGlobalEventProcessor(this.handleGlobalEvent);
1032
1032
  record(__assign(__assign({}, this.recordingOptions), { emit: this.handleRecordingEmit }));
1033
- var urlPath = "".concat(window.location.pathname).concat(window.location.hash).concat(window.location.search);
1034
- var url = "".concat(window.location.origin).concat(urlPath);
1035
- // Otherwise, these will be captured after the first flush, which means the
1036
- // URL and timestamps could be incorrect
1037
- this.initialState = {
1038
- timestamp: new Date().getTime(),
1039
- url: url,
1040
- };
1041
- this.context.urls.push(url);
1042
1033
  };
1043
1034
  /**
1044
1035
  * We want to batch uploads of replay events. Save events only if
@@ -1116,12 +1107,29 @@ var SentryReplay = /** @class */ (function () {
1116
1107
  // enable flag to create the root replay
1117
1108
  if (type === 'new') {
1118
1109
  this.needsCaptureReplay = true;
1110
+ this.setInitialState();
1119
1111
  }
1120
1112
  if (session.id !== ((_b = this.session) === null || _b === void 0 ? void 0 : _b.id)) {
1121
1113
  session.previousSessionId = (_c = this.session) === null || _c === void 0 ? void 0 : _c.id;
1122
1114
  }
1123
1115
  this.session = session;
1124
1116
  };
1117
+ /**
1118
+ * Capture some initial state that can change throughout the lifespan of the
1119
+ * replay. This is required because otherwise they would be captured at the
1120
+ * first flush.
1121
+ */
1122
+ SentryReplay.prototype.setInitialState = function () {
1123
+ var urlPath = "".concat(window.location.pathname).concat(window.location.hash).concat(window.location.search);
1124
+ var url = "".concat(window.location.origin).concat(urlPath);
1125
+ // Reset context as well
1126
+ this.popEventContext();
1127
+ this.initialState = {
1128
+ timestamp: new Date().getTime(),
1129
+ url: url,
1130
+ };
1131
+ this.context.urls.push(url);
1132
+ };
1125
1133
  /**
1126
1134
  * Adds listeners to record events for the replay
1127
1135
  */
@@ -1331,7 +1339,7 @@ var SentryReplay = /** @class */ (function () {
1331
1339
  * Return and clear context
1332
1340
  */
1333
1341
  SentryReplay.prototype.popEventContext = function (_a) {
1334
- var timestamp = _a.timestamp;
1342
+ var _b = _a === void 0 ? {} : _a, timestamp = _b.timestamp;
1335
1343
  var context = {
1336
1344
  session: this.session,
1337
1345
  initialState: this.initialState,
package/dist/index.js CHANGED
@@ -1034,15 +1034,6 @@ var SentryReplay = /** @class */ (function () {
1034
1034
  // replay ID so that we can reference them later in the UI
1035
1035
  core.addGlobalEventProcessor(this.handleGlobalEvent);
1036
1036
  rrweb.record(__assign(__assign({}, this.recordingOptions), { emit: this.handleRecordingEmit }));
1037
- var urlPath = "".concat(window.location.pathname).concat(window.location.hash).concat(window.location.search);
1038
- var url = "".concat(window.location.origin).concat(urlPath);
1039
- // Otherwise, these will be captured after the first flush, which means the
1040
- // URL and timestamps could be incorrect
1041
- this.initialState = {
1042
- timestamp: new Date().getTime(),
1043
- url: url,
1044
- };
1045
- this.context.urls.push(url);
1046
1037
  };
1047
1038
  /**
1048
1039
  * We want to batch uploads of replay events. Save events only if
@@ -1120,12 +1111,29 @@ var SentryReplay = /** @class */ (function () {
1120
1111
  // enable flag to create the root replay
1121
1112
  if (type === 'new') {
1122
1113
  this.needsCaptureReplay = true;
1114
+ this.setInitialState();
1123
1115
  }
1124
1116
  if (session.id !== ((_b = this.session) === null || _b === void 0 ? void 0 : _b.id)) {
1125
1117
  session.previousSessionId = (_c = this.session) === null || _c === void 0 ? void 0 : _c.id;
1126
1118
  }
1127
1119
  this.session = session;
1128
1120
  };
1121
+ /**
1122
+ * Capture some initial state that can change throughout the lifespan of the
1123
+ * replay. This is required because otherwise they would be captured at the
1124
+ * first flush.
1125
+ */
1126
+ SentryReplay.prototype.setInitialState = function () {
1127
+ var urlPath = "".concat(window.location.pathname).concat(window.location.hash).concat(window.location.search);
1128
+ var url = "".concat(window.location.origin).concat(urlPath);
1129
+ // Reset context as well
1130
+ this.popEventContext();
1131
+ this.initialState = {
1132
+ timestamp: new Date().getTime(),
1133
+ url: url,
1134
+ };
1135
+ this.context.urls.push(url);
1136
+ };
1129
1137
  /**
1130
1138
  * Adds listeners to record events for the replay
1131
1139
  */
@@ -1335,7 +1343,7 @@ var SentryReplay = /** @class */ (function () {
1335
1343
  * Return and clear context
1336
1344
  */
1337
1345
  SentryReplay.prototype.popEventContext = function (_a) {
1338
- var timestamp = _a.timestamp;
1346
+ var _b = _a === void 0 ? {} : _a, timestamp = _b.timestamp;
1339
1347
  var context = {
1340
1348
  session: this.session,
1341
1349
  initialState: this.initialState,