@sentry/replay 7.56.0 → 7.57.0-beta.0

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 (33) hide show
  1. package/cjs/index.js +10 -32
  2. package/cjs/index.js.map +1 -1
  3. package/esm/index.js +10 -32
  4. package/esm/index.js.map +1 -1
  5. package/package.json +13 -6
  6. package/types/coreHandlers/handleAfterSendEvent.d.ts +1 -1
  7. package/types/coreHandlers/handleAfterSendEvent.d.ts.map +1 -1
  8. package/types/coreHandlers/handleScope.d.ts +1 -1
  9. package/types/coreHandlers/handleScope.d.ts.map +1 -1
  10. package/types/coreHandlers/util/onWindowOpen.d.ts +1 -1
  11. package/types/coreHandlers/util/onWindowOpen.d.ts.map +1 -1
  12. package/types/replay.d.ts +4 -0
  13. package/types/replay.d.ts.map +1 -1
  14. package/types/types/performance.d.ts +9 -9
  15. package/types/types/performance.d.ts.map +1 -1
  16. package/types/types/replay.d.ts +12 -12
  17. package/types/types/replay.d.ts.map +1 -1
  18. package/types/types/replayFrame.d.ts +5 -5
  19. package/types/types/replayFrame.d.ts.map +1 -1
  20. package/types/types/request.d.ts +4 -4
  21. package/types/types/request.d.ts.map +1 -1
  22. package/types/types/rrweb.d.ts +4 -4
  23. package/types/types/rrweb.d.ts.map +1 -1
  24. package/types/util/createPerformanceEntries.d.ts.map +1 -1
  25. package/types/util/debounce.d.ts +3 -3
  26. package/types/util/debounce.d.ts.map +1 -1
  27. package/types/util/dedupePerformanceEntries.d.ts.map +1 -1
  28. package/types/util/getPrivacyOptions.d.ts +1 -1
  29. package/types/util/getPrivacyOptions.d.ts.map +1 -1
  30. package/types/util/handleRecordingEmit.d.ts +1 -1
  31. package/types/util/handleRecordingEmit.d.ts.map +1 -1
  32. package/types/util/truncateJson/constants.d.ts +1 -1
  33. package/types/util/truncateJson/constants.d.ts.map +1 -1
package/esm/index.js CHANGED
@@ -5005,7 +5005,7 @@ function handleFetch(handlerData) {
5005
5005
  name: url,
5006
5006
  data: {
5007
5007
  method,
5008
- statusCode: response && (response ).status,
5008
+ statusCode: response ? (response ).status : undefined,
5009
5009
  },
5010
5010
  };
5011
5011
  }
@@ -6607,41 +6607,12 @@ function getHandleRecordingEmit(replay) {
6607
6607
  }
6608
6608
  }
6609
6609
 
6610
- const options = replay.getOptions();
6611
-
6612
- // TODO: We want this as an experiment so that we can test
6613
- // internally and create metrics before making this the default
6614
- if (options._experiments.delayFlushOnCheckout) {
6610
+ if (replay.recordingMode === 'session') {
6615
6611
  // If the full snapshot is due to an initial load, we will not have
6616
6612
  // a previous session ID. In this case, we want to buffer events
6617
6613
  // for a set amount of time before flushing. This can help avoid
6618
6614
  // capturing replays of users that immediately close the window.
6619
- // TODO: We should check `recordingMode` here and do nothing if it's
6620
- // buffer, instead of checking inside of timeout, this will make our
6621
- // tests a bit cleaner as we will need to wait on the delay in order to
6622
- // do nothing.
6623
- setTimeout(() => replay.conditionalFlush(), options._experiments.delayFlushOnCheckout);
6624
-
6625
- // Cancel any previously debounced flushes to ensure there are no [near]
6626
- // simultaneous flushes happening. The latter request should be
6627
- // insignificant in this case, so wait for additional user interaction to
6628
- // trigger a new flush.
6629
- //
6630
- // This can happen because there's no guarantee that a recording event
6631
- // happens first. e.g. a mouse click can happen and trigger a debounced
6632
- // flush before the checkout.
6633
- replay.cancelFlush();
6634
-
6635
- return true;
6636
- }
6637
-
6638
- // Flush immediately so that we do not miss the first segment, otherwise
6639
- // it can prevent loading on the UI. This will cause an increase in short
6640
- // replays (e.g. opening and closing a tab quickly), but these can be
6641
- // filtered on the UI.
6642
- if (replay.recordingMode === 'session') {
6643
- // We want to ensure the worker is ready, as otherwise we'd always send the first event uncompressed
6644
- void replay.flushImmediate();
6615
+ void replay.flush();
6645
6616
  }
6646
6617
 
6647
6618
  return true;
@@ -7523,6 +7494,13 @@ class ReplayContainer {
7523
7494
  return this.flushImmediate();
7524
7495
  }
7525
7496
 
7497
+ /**
7498
+ * Flush using debounce flush
7499
+ */
7500
+ flush() {
7501
+ return this._debouncedFlush() ;
7502
+ }
7503
+
7526
7504
  /**
7527
7505
  * Always flush via `_debouncedFlush` so that we do not have flushes triggered
7528
7506
  * from calling both `flush` and `_debouncedFlush`. Otherwise, there could be