@sentry/replay
Advanced tools
Comparing version 0.2.0-1 to 0.2.0-2
import * as Sentry from '@sentry/browser'; | ||
import { record } from 'rrweb'; | ||
import { logger as logger$1, isDebugBuild } from '@sentry/utils'; | ||
import { logger as logger$1 } from '@sentry/utils'; | ||
@@ -161,2 +161,10 @@ /*! ***************************************************************************** | ||
var REPLAY_SESSION_KEY = 'sentryReplaySession'; | ||
var ROOT_REPLAY_NAME = 'sentry-replay'; | ||
var REPLAY_EVENT_NAME = 'sentry-replay-event'; | ||
// Grace period to keep a session when a user changes tabs or hides window | ||
var VISIBILITY_CHANGE_TIMEOUT = 60000; // 1 minute | ||
// The idle limit for a session | ||
var SESSION_IDLE_DURATION = 900000; // 15 minutes | ||
/** | ||
@@ -193,6 +201,5 @@ * Given an initial timestamp and an expiry duration, checks to see if current | ||
} | ||
if (!isDebugBuild()) { | ||
{ | ||
return; | ||
} | ||
return logFn.call.apply(logFn, __spreadArray([logger$1, '[Replay]'], args, false)); | ||
}; | ||
@@ -202,4 +209,2 @@ } | ||
var REPLAY_SESSION_KEY = 'sentryReplaySession'; | ||
function saveSession(session) { | ||
@@ -228,3 +233,3 @@ var hasSessionStorage = 'sessionStorage' in window; | ||
var transaction = Sentry.getCurrentHub().startTransaction({ | ||
name: 'sentry-replay', | ||
name: ROOT_REPLAY_NAME, | ||
tags: { | ||
@@ -306,4 +311,2 @@ isReplayRoot: 'yes', | ||
var VISIBILITY_CHANGE_TIMEOUT = 60000; // 1 minute | ||
var SESSION_IDLE_DURATION = 900000; // 15 minutes | ||
var SentryReplay = /** @class */ (function () { | ||
@@ -394,2 +397,14 @@ function SentryReplay(_a) { | ||
var _this = this; | ||
/** | ||
* Because we create a transaction in `setupOnce`, we can potentially create a | ||
* transaction before some native SDK integrations have run and applied their | ||
* own global event processor. An example is: | ||
* https://github.com/getsentry/sentry-javascript/blob/b47ceafbdac7f8b99093ce6023726ad4687edc48/packages/browser/src/integrations/useragent.ts | ||
* | ||
* So we do this as a workaround to wait for other global event processors to finish | ||
*/ | ||
setImmediate(function () { return _this.setup(); }); | ||
}; | ||
SentryReplay.prototype.setup = function () { | ||
var _this = this; | ||
this.loadSession({ expiry: SESSION_IDLE_DURATION }); | ||
@@ -403,2 +418,6 @@ // If there is no session, then something bad has happened - can't continue | ||
Sentry.addGlobalEventProcessor(function (event) { | ||
// Do not apply replayId to the root transaction | ||
if (event.transaction === ROOT_REPLAY_NAME) { | ||
return event; | ||
} | ||
event.tags = __assign(__assign({}, event.tags), { replayId: _this.session.id }); | ||
@@ -492,3 +511,3 @@ return event; | ||
this.replayEvent = Sentry.startTransaction({ | ||
name: 'sentry-replay-event', | ||
name: REPLAY_EVENT_NAME, | ||
parentSpanId: this.session.spanId, | ||
@@ -495,0 +514,0 @@ traceId: this.session.traceId, |
@@ -185,2 +185,10 @@ 'use strict'; | ||
var REPLAY_SESSION_KEY = 'sentryReplaySession'; | ||
var ROOT_REPLAY_NAME = 'sentry-replay'; | ||
var REPLAY_EVENT_NAME = 'sentry-replay-event'; | ||
// Grace period to keep a session when a user changes tabs or hides window | ||
var VISIBILITY_CHANGE_TIMEOUT = 60000; // 1 minute | ||
// The idle limit for a session | ||
var SESSION_IDLE_DURATION = 900000; // 15 minutes | ||
/** | ||
@@ -217,6 +225,5 @@ * Given an initial timestamp and an expiry duration, checks to see if current | ||
} | ||
if (!utils.isDebugBuild()) { | ||
{ | ||
return; | ||
} | ||
return logFn.call.apply(logFn, __spreadArray([utils.logger, '[Replay]'], args, false)); | ||
}; | ||
@@ -226,4 +233,2 @@ } | ||
var REPLAY_SESSION_KEY = 'sentryReplaySession'; | ||
function saveSession(session) { | ||
@@ -252,3 +257,3 @@ var hasSessionStorage = 'sessionStorage' in window; | ||
var transaction = Sentry__namespace.getCurrentHub().startTransaction({ | ||
name: 'sentry-replay', | ||
name: ROOT_REPLAY_NAME, | ||
tags: { | ||
@@ -330,4 +335,2 @@ isReplayRoot: 'yes', | ||
var VISIBILITY_CHANGE_TIMEOUT = 60000; // 1 minute | ||
var SESSION_IDLE_DURATION = 900000; // 15 minutes | ||
var SentryReplay = /** @class */ (function () { | ||
@@ -418,2 +421,14 @@ function SentryReplay(_a) { | ||
var _this = this; | ||
/** | ||
* Because we create a transaction in `setupOnce`, we can potentially create a | ||
* transaction before some native SDK integrations have run and applied their | ||
* own global event processor. An example is: | ||
* https://github.com/getsentry/sentry-javascript/blob/b47ceafbdac7f8b99093ce6023726ad4687edc48/packages/browser/src/integrations/useragent.ts | ||
* | ||
* So we do this as a workaround to wait for other global event processors to finish | ||
*/ | ||
setImmediate(function () { return _this.setup(); }); | ||
}; | ||
SentryReplay.prototype.setup = function () { | ||
var _this = this; | ||
this.loadSession({ expiry: SESSION_IDLE_DURATION }); | ||
@@ -427,2 +442,6 @@ // If there is no session, then something bad has happened - can't continue | ||
Sentry__namespace.addGlobalEventProcessor(function (event) { | ||
// Do not apply replayId to the root transaction | ||
if (event.transaction === ROOT_REPLAY_NAME) { | ||
return event; | ||
} | ||
event.tags = __assign(__assign({}, event.tags), { replayId: _this.session.id }); | ||
@@ -516,3 +535,3 @@ return event; | ||
this.replayEvent = Sentry__namespace.startTransaction({ | ||
name: 'sentry-replay-event', | ||
name: REPLAY_EVENT_NAME, | ||
parentSpanId: this.session.spanId, | ||
@@ -519,0 +538,0 @@ traceId: this.session.traceId, |
{ | ||
"name": "@sentry/replay", | ||
"version": "0.2.0-1", | ||
"version": "0.2.0-2", | ||
"description": "User replays for Sentry", | ||
@@ -9,3 +9,3 @@ "main": "dist/index.js", | ||
"bootstrap": "yarn && cd demo && yarn", | ||
"build": "yarn rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript", | ||
"build": "NODE_ENV=production yarn rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript", | ||
"clean": "yarn rimraf dist", | ||
@@ -16,3 +16,3 @@ "lint": "yarn eslint . --ext .js,.jsx,.ts,.tsx", | ||
"test": "yarn jest", | ||
"watch": "yarn build --watch" | ||
"watch": "NODE_ENV=development yarn build --watch" | ||
}, | ||
@@ -40,2 +40,3 @@ "files": [ | ||
"@babel/core": "^7.17.5", | ||
"@rollup/plugin-replace": "^4.0.0", | ||
"@rollup/plugin-typescript": "^8.3.1", | ||
@@ -42,0 +43,0 @@ "@sentry/browser": "^6.19.1", |
@@ -41,3 +41,3 @@ # sentry-replay | ||
stickySession: true, // Default is false | ||
rrwebOptions: { | ||
rrwebConfig: { | ||
maskAllInputs: false, // Default is true | ||
@@ -44,0 +44,0 @@ }, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
138034
30
1510
25