@sentry/replay 7.39.0 → 7.41.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
@@ -16,9 +16,6 @@ const UNABLE_TO_SEND_REPLAY = 'Unable to send Replay';
16
16
  // The idle limit for a session
17
17
  const SESSION_IDLE_DURATION = 300000; // 5 minutes in ms
18
18
 
19
- // Grace period to keep a session when a user changes tabs or hides window
20
- const VISIBILITY_CHANGE_TIMEOUT = SESSION_IDLE_DURATION;
21
-
22
19
  // The maximum length of a session
23
20
  const MAX_SESSION_LIFE = 3600000; // 60 minutes
24
21
 
@@ -5253,7 +5250,7 @@ class ReplayContainer {
5253
5250
  * Returns true if session is not expired, false otherwise.
5254
5251
  * @hidden
5255
5252
  */
5256
- checkAndHandleExpiredSession(expiry) {
5253
+ checkAndHandleExpiredSession() {
5257
5254
  const oldSessionId = this.getSessionId();
5258
5255
 
5259
5256
  // Prevent starting a new session if the last user activity is older than
@@ -5268,7 +5265,7 @@ class ReplayContainer {
5268
5265
 
5269
5266
  // --- There is recent user activity --- //
5270
5267
  // This will create a new session if expired, based on expiry length
5271
- if (!this._loadAndCheckSession(expiry)) {
5268
+ if (!this._loadAndCheckSession()) {
5272
5269
  return;
5273
5270
  }
5274
5271
 
@@ -5298,9 +5295,9 @@ class ReplayContainer {
5298
5295
  * Loads (or refreshes) the current session.
5299
5296
  * Returns false if session is not recorded.
5300
5297
  */
5301
- _loadAndCheckSession(expiry = SESSION_IDLE_DURATION) {
5298
+ _loadAndCheckSession() {
5302
5299
  const { type, session } = getSession({
5303
- expiry,
5300
+ expiry: SESSION_IDLE_DURATION,
5304
5301
  stickySession: Boolean(this._options.stickySession),
5305
5302
  currentSession: this.session,
5306
5303
  sessionSampleRate: this._options.sessionSampleRate,
@@ -5512,7 +5509,7 @@ class ReplayContainer {
5512
5509
  return;
5513
5510
  }
5514
5511
 
5515
- const expired = isSessionExpired(this.session, VISIBILITY_CHANGE_TIMEOUT);
5512
+ const expired = isSessionExpired(this.session, SESSION_IDLE_DURATION);
5516
5513
 
5517
5514
  if (breadcrumb && !expired) {
5518
5515
  this._createCustomBreadcrumb(breadcrumb);
@@ -5532,10 +5529,10 @@ class ReplayContainer {
5532
5529
  return;
5533
5530
  }
5534
5531
 
5535
- const isSessionActive = this.checkAndHandleExpiredSession(VISIBILITY_CHANGE_TIMEOUT);
5532
+ const isSessionActive = this.checkAndHandleExpiredSession();
5536
5533
 
5537
5534
  if (!isSessionActive) {
5538
- // If the user has come back to the page within VISIBILITY_CHANGE_TIMEOUT
5535
+ // If the user has come back to the page within SESSION_IDLE_DURATION
5539
5536
  // ms, we will re-use the existing session, otherwise create a new
5540
5537
  // session
5541
5538
  (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && utils.logger.log('[Replay] Document has become active, but session has expired');