@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/cjs/index.js CHANGED
@@ -5007,7 +5007,7 @@ function handleFetch(handlerData) {
5007
5007
  name: url,
5008
5008
  data: {
5009
5009
  method,
5010
- statusCode: response && (response ).status,
5010
+ statusCode: response ? (response ).status : undefined,
5011
5011
  },
5012
5012
  };
5013
5013
  }
@@ -6609,41 +6609,12 @@ function getHandleRecordingEmit(replay) {
6609
6609
  }
6610
6610
  }
6611
6611
 
6612
- const options = replay.getOptions();
6613
-
6614
- // TODO: We want this as an experiment so that we can test
6615
- // internally and create metrics before making this the default
6616
- if (options._experiments.delayFlushOnCheckout) {
6612
+ if (replay.recordingMode === 'session') {
6617
6613
  // If the full snapshot is due to an initial load, we will not have
6618
6614
  // a previous session ID. In this case, we want to buffer events
6619
6615
  // for a set amount of time before flushing. This can help avoid
6620
6616
  // capturing replays of users that immediately close the window.
6621
- // TODO: We should check `recordingMode` here and do nothing if it's
6622
- // buffer, instead of checking inside of timeout, this will make our
6623
- // tests a bit cleaner as we will need to wait on the delay in order to
6624
- // do nothing.
6625
- setTimeout(() => replay.conditionalFlush(), options._experiments.delayFlushOnCheckout);
6626
-
6627
- // Cancel any previously debounced flushes to ensure there are no [near]
6628
- // simultaneous flushes happening. The latter request should be
6629
- // insignificant in this case, so wait for additional user interaction to
6630
- // trigger a new flush.
6631
- //
6632
- // This can happen because there's no guarantee that a recording event
6633
- // happens first. e.g. a mouse click can happen and trigger a debounced
6634
- // flush before the checkout.
6635
- replay.cancelFlush();
6636
-
6637
- return true;
6638
- }
6639
-
6640
- // Flush immediately so that we do not miss the first segment, otherwise
6641
- // it can prevent loading on the UI. This will cause an increase in short
6642
- // replays (e.g. opening and closing a tab quickly), but these can be
6643
- // filtered on the UI.
6644
- if (replay.recordingMode === 'session') {
6645
- // We want to ensure the worker is ready, as otherwise we'd always send the first event uncompressed
6646
- void replay.flushImmediate();
6617
+ void replay.flush();
6647
6618
  }
6648
6619
 
6649
6620
  return true;
@@ -7525,6 +7496,13 @@ class ReplayContainer {
7525
7496
  return this.flushImmediate();
7526
7497
  }
7527
7498
 
7499
+ /**
7500
+ * Flush using debounce flush
7501
+ */
7502
+ flush() {
7503
+ return this._debouncedFlush() ;
7504
+ }
7505
+
7528
7506
  /**
7529
7507
  * Always flush via `_debouncedFlush` so that we do not have flushes triggered
7530
7508
  * from calling both `flush` and `_debouncedFlush`. Otherwise, there could be