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