@sentry/replay 7.35.0 → 7.36.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.
package/cjs/index.js CHANGED
@@ -4860,7 +4860,16 @@ async function prepareReplayEvent({
4860
4860
  }
4861
4861
 
4862
4862
  ) {
4863
- const preparedEvent = (await core.prepareEvent(client.getOptions(), event, { event_id }, scope)) ;
4863
+ const integrations =
4864
+ typeof client._integrations === 'object' && client._integrations !== null && !Array.isArray(client._integrations)
4865
+ ? Object.keys(client._integrations)
4866
+ : undefined;
4867
+ const preparedEvent = (await core.prepareEvent(
4868
+ client.getOptions(),
4869
+ event,
4870
+ { event_id, integrations },
4871
+ scope,
4872
+ )) ;
4864
4873
 
4865
4874
  // If e.g. a global event processor returned null
4866
4875
  if (!preparedEvent) {
@@ -5001,11 +5010,6 @@ async function sendReplayRequest({
5001
5010
  return response;
5002
5011
  }
5003
5012
 
5004
- const rateLimits = utils.updateRateLimits({}, response);
5005
- if (utils.isRateLimited(rateLimits, 'replay')) {
5006
- throw new RateLimitError(rateLimits);
5007
- }
5008
-
5009
5013
  // If the status code is invalid, we want to immediately stop & not retry
5010
5014
  if (typeof response.statusCode === 'number' && (response.statusCode < 200 || response.statusCode >= 300)) {
5011
5015
  throw new TransportStatusCodeError(response.statusCode);
@@ -5014,17 +5018,6 @@ async function sendReplayRequest({
5014
5018
  return response;
5015
5019
  }
5016
5020
 
5017
- /**
5018
- * This error indicates that we hit a rate limit API error.
5019
- */
5020
- class RateLimitError extends Error {
5021
-
5022
- constructor(rateLimits) {
5023
- super('Rate limit hit');
5024
- this.rateLimits = rateLimits;
5025
- }
5026
- }
5027
-
5028
5021
  /**
5029
5022
  * This error indicates that the transport returned an invalid status code.
5030
5023
  */
@@ -5055,7 +5048,7 @@ async function sendReplay(
5055
5048
  await sendReplayRequest(replayData);
5056
5049
  return true;
5057
5050
  } catch (err) {
5058
- if (err instanceof RateLimitError || err instanceof TransportStatusCodeError) {
5051
+ if (err instanceof TransportStatusCodeError) {
5059
5052
  throw err;
5060
5053
  }
5061
5054
 
@@ -5519,8 +5512,8 @@ class ReplayContainer {
5519
5512
  this._handleException(err);
5520
5513
  }
5521
5514
 
5522
- // _performanceObserver //
5523
- if (!('_performanceObserver' in WINDOW)) {
5515
+ // PerformanceObserver //
5516
+ if (!('PerformanceObserver' in WINDOW)) {
5524
5517
  return;
5525
5518
  }
5526
5519
 
@@ -5852,11 +5845,6 @@ class ReplayContainer {
5852
5845
  } catch (err) {
5853
5846
  this._handleException(err);
5854
5847
 
5855
- if (err instanceof RateLimitError) {
5856
- this._handleRateLimit(err.rateLimits);
5857
- return;
5858
- }
5859
-
5860
5848
  // This means we retried 3 times, and all of them failed
5861
5849
  // In this case, we want to completely stop the replay - otherwise, we may get inconsistent segments
5862
5850
  this.stop();
@@ -5916,31 +5904,6 @@ class ReplayContainer {
5916
5904
  saveSession(this.session);
5917
5905
  }
5918
5906
  }
5919
-
5920
- /**
5921
- * Pauses the replay and resumes it after the rate-limit duration is over.
5922
- */
5923
- _handleRateLimit(rateLimits) {
5924
- // in case recording is already paused, we don't need to do anything, as we might have already paused because of a
5925
- // rate limit
5926
- if (this.isPaused()) {
5927
- return;
5928
- }
5929
-
5930
- const rateLimitEnd = utils.disabledUntil(rateLimits, 'replay');
5931
- const rateLimitDuration = rateLimitEnd - Date.now();
5932
-
5933
- if (rateLimitDuration > 0) {
5934
- (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && utils.logger.warn('[Replay]', `Rate limit hit, pausing replay for ${rateLimitDuration}ms`);
5935
- this.pause();
5936
- this._debouncedFlush.cancel();
5937
-
5938
- setTimeout(() => {
5939
- (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && utils.logger.info('[Replay]', 'Resuming replay after rate limit');
5940
- this.resume();
5941
- }, rateLimitDuration);
5942
- }
5943
- }
5944
5907
  }
5945
5908
 
5946
5909
  function getOption(
@@ -6090,6 +6053,8 @@ class Replay {
6090
6053
  // eslint-disable-next-line deprecation/deprecation
6091
6054
  blockSelector,
6092
6055
  // eslint-disable-next-line deprecation/deprecation
6056
+ maskInputOptions,
6057
+ // eslint-disable-next-line deprecation/deprecation
6093
6058
  maskTextClass,
6094
6059
  // eslint-disable-next-line deprecation/deprecation
6095
6060
  maskTextSelector,
@@ -6098,6 +6063,7 @@ class Replay {
6098
6063
  } = {}) {Replay.prototype.__init.call(this);
6099
6064
  this._recordingOptions = {
6100
6065
  maskAllInputs,
6066
+ maskInputOptions: { ...(maskInputOptions || {}), password: true },
6101
6067
  maskTextFn: maskFn,
6102
6068
  maskInputFn: maskFn,
6103
6069