@sentry/replay 0.2.0-0 → 0.2.0-11

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/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../node_modules/.pnpm/@rollup+plugin-typescript@8.3.1_859e05ab655ea3c900a5f26a0311c0b5/node_modules/tslib/tslib.es6.js","../../src/createPerformanceEntry.ts","../../src/index.ts"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n","type EntryType =\n | 'element'\n | 'navigation'\n | 'resource'\n | 'mark'\n | 'measure'\n | 'paint'\n | 'longtask';\n\nexport interface ReplayPerformanceEntry {\n /**\n * One of these types https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry/entryType\n */\n type: string;\n\n /**\n * A more specific description of the performance entry\n */\n name: string;\n\n /**\n * The start timestamp in seconds\n */\n start: number;\n\n /**\n * The end timestamp in seconds\n */\n end: number;\n\n /**\n * Additional unstructured data to be included\n */\n data?: Record<string, any>;\n}\n\n// Map entryType -> function to normalize data for event\nconst ENTRY_TYPES: Record<\n string,\n (entry: PerformanceEntry) => ReplayPerformanceEntry\n> = {\n resource: createResourceEntry,\n paint: createPaintEntry,\n navigation: createNavigationEntry,\n ['largest-contentful-paint']: createLargestContentfulPaint,\n};\n\nexport function createPerformanceEntries(entries: PerformanceEntry[]) {\n return entries.map(createPerformanceEntry).filter(Boolean);\n}\n\nfunction createPerformanceEntry(entry: PerformanceEntry) {\n if (ENTRY_TYPES[entry.entryType] === undefined) {\n return null;\n }\n\n return ENTRY_TYPES[entry.entryType](entry);\n}\n\nfunction getAbsoluteTime(time: number) {\n return (window.performance.timeOrigin + time) / 1000;\n}\n\nfunction createPaintEntry(entry: PerformancePaintTiming) {\n const { duration, entryType, name, startTime } = entry;\n\n const start = getAbsoluteTime(startTime);\n return {\n type: entryType,\n name,\n start,\n end: start + duration,\n };\n}\n\nfunction createNavigationEntry(entry: PerformanceNavigationTiming) {\n // TODO: There looks to be some more interesting bits in here (domComplete, domContentLoaded)\n\n const { entryType, name, domComplete, startTime, transferSize, type } = entry;\n\n return {\n type: `${entryType}.${type}`,\n start: getAbsoluteTime(startTime),\n end: getAbsoluteTime(domComplete),\n name,\n data: {\n size: transferSize,\n },\n };\n}\nfunction createResourceEntry(entry: PerformanceResourceTiming) {\n const {\n entryType,\n initiatorType,\n name,\n responseEnd,\n startTime,\n transferSize,\n } = entry;\n\n return {\n type: `${entryType}.${initiatorType}`,\n start: getAbsoluteTime(startTime),\n end: getAbsoluteTime(responseEnd),\n name,\n data: {\n size: transferSize,\n },\n };\n}\n\nfunction createLargestContentfulPaint(\n entry: PerformanceEntry & { size: number }\n) {\n const { duration, entryType, startTime, size } = entry;\n\n const start = getAbsoluteTime(startTime);\n return {\n type: entryType,\n name: entryType,\n start,\n end: start + duration,\n data: {\n size,\n },\n };\n}\n","import * as Sentry from '@sentry/browser';\nimport { DsnComponents, Hub, Transaction } from '@sentry/types';\nimport { isDebugBuild, logger, uuid4 } from '@sentry/utils';\n\nimport { record } from 'rrweb';\nimport type { eventWithTime } from 'rrweb/typings/types';\nimport {\n createPerformanceEntries,\n ReplayPerformanceEntry,\n} from './createPerformanceEntry';\n\ntype RRWebEvent = eventWithTime;\ntype RRWebOptions = Parameters<typeof record>[0];\n\ninterface SentryReplayConfiguration {\n idleTimeout?: number;\n rrwebConfig?: RRWebOptions;\n}\n\nconst VISIBILITY_CHANGE_TIMEOUT = 5000;\n\nexport class SentryReplay {\n /**\n * @inheritDoc\n */\n public static id = 'Replay';\n\n /**\n * @inheritDoc\n */\n public name: string = SentryReplay.id;\n\n /**\n * Buffer of rrweb events that will be serialized as JSON and saved as an attachment to a Sentry event\n */\n public events: RRWebEvent[] = [];\n\n public performanceEvents: PerformanceEntry[] = [];\n\n /**\n * The id of the root Sentry event that all attachments will be saved to\n */\n private eventId: string | undefined;\n\n /**\n * A unique id per \"replay session\" (the term is currently not defined yet)\n */\n private replayId: string | undefined;\n\n /**\n * A Sentry Transaction that should capture every incremental rrweb update,\n * but *not* the attachments themselves. This is currently used to capture\n * breadcrumbs and maybe other spans (e.g. network requests)\n */\n private replayEvent: Transaction | undefined;\n\n /**\n * Options to pass to rrweb.record\n */\n private readonly rrwebRecordOptions: RRWebOptions;\n\n /**\n * setTimeout id used for debouncing sending rrweb attachments\n */\n private timeout: number;\n\n /**\n * timer id used to consider when the page has become inactive (e.g. from switching tags)\n */\n private visibilityChangeTimer: number | null;\n\n private performanceObserver: PerformanceObserver | null = null;\n\n private static attachmentUrlFromDsn(dsn: DsnComponents, eventId: string) {\n const { host, path, projectId, port, protocol, user } = dsn;\n return `${protocol}://${host}${port !== '' ? `:${port}` : ''}${\n path !== '' ? `/${path}` : ''\n }/api/${projectId}/events/${eventId}/attachments/?sentry_key=${user}&sentry_version=7&sentry_client=replay`;\n }\n\n private get isDebug(): boolean {\n return isDebugBuild();\n }\n\n /**\n * Get integration's instance on the current hub\n */\n private get instance() {\n return Sentry.getCurrentHub().getIntegration(SentryReplay);\n }\n\n public constructor({\n idleTimeout = 15000,\n rrwebConfig: { maskAllInputs = true, ...rrwebRecordOptions } = {},\n }: SentryReplayConfiguration = {}) {\n this.rrwebRecordOptions = {\n maskAllInputs,\n ...rrwebRecordOptions,\n };\n\n // Creates a new replay ID everytime we initialize the plugin (e.g. on every pageload).\n // TBD on behavior here (e.g. should this be saved to localStorage/cookies)\n this.replayId = uuid4();\n this.events = [];\n\n record({\n ...this.rrwebRecordOptions,\n emit: (event: RRWebEvent, isCheckout?: boolean) => {\n // \"debounce\" by `idleTimeout`, how often we save replay events i.e. we\n // will save events only if 15 seconds have elapsed since the last\n // event\n //\n // TODO: We probably want to have a hard timeout where we save\n // so that it does not grow infinitely and we never have a replay\n // saved\n if (this.timeout) {\n window.clearTimeout(this.timeout);\n }\n\n // Always create a new Sentry event on checkouts and clear existing rrweb events\n if (isCheckout) {\n console.log('$$$$$ IS CHECKOUT');\n this.events = [event];\n } else {\n this.events.push(event);\n }\n\n // Set timer to send attachment to Sentry, will be cancelled if an\n // event happens before `idleTimeout` elapses\n this.timeout = window.setTimeout(() => {\n this.isDebug &&\n logger.log('[Replay] rrweb timeout hit, finishing replay event');\n this.finishReplayEvent();\n }, idleTimeout);\n },\n });\n\n this.addListeners();\n }\n\n setupOnce() {\n // Tag all (non replay) events that get sent to Sentry with the current\n // replay ID so that we can reference them later in the UI\n Sentry.addGlobalEventProcessor((event) => {\n event.tags = { ...event.tags, replayId: this.replayId };\n return event;\n });\n\n // XXX: this needs to be in `setupOnce` vs `constructor`, otherwise SDK is\n // not fully initialized and the event will not get properly sent to Sentry\n this.createRootEvent();\n this.createReplayEvent();\n }\n\n private addListeners() {\n document.addEventListener('visibilitychange', this.handleVisibilityChange);\n\n if ('PerformanceObserver' in window) {\n this.performanceObserver = new PerformanceObserver(\n this.handlePerformanceObserver\n );\n\n // Observe everything for now\n this.performanceObserver.observe({\n entryTypes: [...PerformanceObserver.supportedEntryTypes],\n });\n }\n }\n\n /**\n * Keep a list of performance entries that will be sent with a replay\n */\n handlePerformanceObserver = (\n list: PerformanceObserverEntryList\n // observer: PerformanceObserver\n ) => {\n this.performanceEvents = [...this.performanceEvents, ...list.getEntries()];\n };\n\n /**\n * Handle when visibility of the page changes. (e.g. new tab is opened)\n */\n handleVisibilityChange = () => {\n if (\n document.visibilityState === 'visible' &&\n this.visibilityChangeTimer === null\n ) {\n // Page has become active/visible again after `VISIBILITY_CHANGE_TIMEOUT`\n // ms have elapsed, which means we will consider this a new session\n //\n // TBD if this is the behavior we want\n this.isDebug &&\n logger.log(\n '[Replay] document has become active, creating new \"session\"'\n );\n this.triggerNewSession();\n return;\n }\n\n // Send replay when the page/tab becomes hidden\n this.finishReplayEvent();\n\n // VISIBILITY_CHANGE_TIMEOUT gives the user buffer room to come back to the\n // page before we create a new session.\n this.visibilityChangeTimer = window.setTimeout(() => {\n this.visibilityChangeTimer = null;\n }, VISIBILITY_CHANGE_TIMEOUT);\n };\n\n /**\n * Creates a new replay \"session\". This will create a new Sentry event and\n * then trigger rrweb to take a full snapshot.\n */\n triggerNewSession() {\n this.isDebug && logger.log('[Replay] taking full rrweb snapshot');\n record.takeFullSnapshot(true);\n }\n\n /**\n * Creates the Sentry event that all replays will be saved to as attachments.\n * Currently, we only expect one of these per \"replay session\" (which is not\n * explicitly defined yet).\n */\n createRootEvent() {\n // TODO: Figure out if we need to do this, when this gets called from `setupOnce`, `this.instance` is still undefined.\n // if (!this.instance) return;\n\n this.isDebug && logger.log(`[Replay] creating root replay event`);\n\n // Create a transaction to attach event to\n const transaction = Sentry.getCurrentHub().startTransaction({\n name: 'sentry-replay',\n tags: {\n hasReplay: 'yes',\n replayId: this.replayId,\n },\n });\n\n // We have to finish the transaction to get an event ID to be able to\n // upload an attachment for that event\n // @ts-expect-error This returns an eventId (string), but is not typed as such\n this.eventId = transaction.finish();\n\n return this.eventId;\n }\n\n /**\n * This is our pseudo replay event disguised as a transaction. It will be\n * used to store performance entries and breadcrumbs for every incremental\n * replay event.\n **/\n createReplayEvent() {\n console.log('createReplayEvent rootReplayId', this.eventId);\n this.replayEvent = Sentry.startTransaction({\n name: 'sentry-replay-event',\n tags: {\n rootReplayId: this.eventId,\n replayId: this.replayId,\n },\n });\n Sentry.configureScope((scope) => scope.setSpan(this.replayEvent));\n return this.replayEvent;\n }\n\n /**\n * Create a span for each performance entry. The parent transaction is `this.replayEvent`.\n */\n createPerformanceSpans(entries: ReplayPerformanceEntry[]) {\n entries.forEach(({ type, start, end, name, data }) => {\n const span = this.replayEvent?.startChild({\n op: type,\n description: name,\n startTimestamp: start,\n data,\n });\n span.finish(end);\n });\n }\n\n /**\n * Observed performance events are added to `this.performanceEvents`. These\n * are included in the replay event before it is finished and sent to Sentry.\n */\n addPerformanceEntries() {\n // Copy and reset entries before processing\n const entries = [...this.performanceEvents];\n this.performanceEvents = [];\n\n // Parse the entries\n const entryEvents = createPerformanceEntries(entries);\n\n // This current implementation is to create spans on the transaction referenced in `this.replayEvent`\n this.createPerformanceSpans(entryEvents);\n }\n\n finishReplayEvent() {\n // if (!this.instance) return;\n\n const eventId = this.eventId || this.createRootEvent();\n\n if (!eventId) {\n console.error('[Sentry]: No transaction, no replay');\n return;\n }\n\n this.sendReplay(eventId);\n\n // include performance entries\n this.addPerformanceEntries();\n\n // Close out existing replay event and create a new one\n this.replayEvent?.setStatus('ok').finish();\n this.createReplayEvent();\n }\n\n /**\n * Determine if there is browser support for `navigator.sendBeacon`\n */\n hasSendBeacon() {\n return 'navigator' in window && 'sendBeacon' in window.navigator;\n }\n\n /**\n * Send replay attachment using either `sendBeacon()` or `fetch()`\n */\n async sendReplayRequest(endpoint: string, events: RRWebEvent[]) {\n const stringifiedPayload = JSON.stringify({ events });\n const formData = new FormData();\n formData.append(\n 'rrweb',\n new Blob([stringifiedPayload], {\n type: 'application/json',\n }),\n `rrweb-${new Date().getTime()}.json`\n );\n\n // If sendBeacon is supported and payload is smol enough...\n if (this.hasSendBeacon() && stringifiedPayload.length <= 65536) {\n this.isDebug &&\n logger.log(`[Replay] uploading attachment via sendBeacon()`);\n window.navigator.sendBeacon(endpoint, formData);\n return;\n }\n\n try {\n this.isDebug && logger.log(`[Replay] uploading attachment via fetch()`);\n // Otherwise use `fetch`, which *WILL* get cancelled on page reloads/unloads\n await fetch(endpoint, {\n method: 'POST',\n body: formData,\n });\n } catch (ex) {\n // we have to catch this otherwise it throws an infinite loop in Sentry\n console.error(ex);\n }\n }\n\n /**\n * Finalize and send the current replay event to Sentry\n */\n async sendReplay(eventId: string) {\n // if (!this.instance) return;\n\n try {\n // short circuit if theres no events to replay\n if (!this.events.length) return;\n\n const client = Sentry.getCurrentHub().getClient();\n const endpoint = SentryReplay.attachmentUrlFromDsn(\n client.getDsn(),\n eventId\n );\n\n await this.sendReplayRequest(endpoint, this.events);\n this.events = [];\n return true;\n } catch (ex) {\n console.error(ex);\n return false;\n }\n }\n}\n"],"names":["logger","uuid4","record","isDebugBuild","Sentry"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAiBA;AACO,IAAI,QAAQ,GAAG,WAAW;AACjC,IAAI,QAAQ,GAAG,MAAM,CAAC,MAAM,IAAI,SAAS,QAAQ,CAAC,CAAC,EAAE;AACrD,QAAQ,KAAK,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;AAC7D,YAAY,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAC7B,YAAY,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CA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;AACf,6BAAA,CAAC,CAAA,CAAA;;;AAHF,wBAAA,EAAA,CAAA,IAAA,EAGE,CAAC;;;;;AAGH,wBAAA,OAAO,CAAC,KAAK,CAAC,IAAE,CAAC,CAAC;;;;;;AAErB,KAAA,CAAA;AAED;;AAEG;IACG,YAAU,CAAA,SAAA,CAAA,UAAA,GAAhB,UAAiB,OAAe,EAAA;;;;;;;;AAK5B,wBAAA,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM;4BAAE,OAAO,CAAA,CAAA,YAAA,CAAA;wBAE1B,MAAM,GAAGI,iBAAM,CAAC,aAAa,EAAE,CAAC,SAAS,EAAE,CAAC;AAC5C,wBAAA,QAAQ,GAAG,YAAY,CAAC,oBAAoB,CAChD,MAAM,CAAC,MAAM,EAAE,EACf,OAAO,CACR,CAAC;wBAEF,OAAM,CAAA,CAAA,YAAA,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA,CAAA;;AAAnD,wBAAA,EAAA,CAAA,IAAA,EAAmD,CAAC;AACpD,wBAAA,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;AACjB,wBAAA,OAAA,CAAA,CAAA,aAAO,IAAI,CAAC,CAAA;;;AAEZ,wBAAA,OAAO,CAAC,KAAK,CAAC,IAAE,CAAC,CAAC;AAClB,wBAAA,OAAA,CAAA,CAAA,aAAO,KAAK,CAAC,CAAA;;;;;AAEhB,KAAA,CAAA;AAtWD;;AAEG;IACW,YAAE,CAAA,EAAA,GAAG,QAAQ,CAAC;IAoW9B,OAAC,YAAA,CAAA;AAAA,CAxWD,EAwWC;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../node_modules/.pnpm/@rollup+plugin-typescript@8.3.1_859e05ab655ea3c900a5f26a0311c0b5/node_modules/tslib/tslib.es6.js","../../src/createPerformanceEntry.ts","../../src/session/constants.ts","../../src/util/isExpired.ts","../../src/util/isSessionExpired.ts","../../src/util/logger.ts","../../src/session/saveSession.ts","../../src/session/createSession.ts","../../src/session/fetchSession.ts","../../src/session/getSession.ts","../../src/session/updateSessionActivity.ts","../../src/addInstrumentationListeners.ts","../../src/index.ts"],"sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n","import { record } from 'rrweb';\n\nexport interface ReplayPerformanceEntry {\n /**\n * One of these types https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry/entryType\n */\n type: string;\n\n /**\n * A more specific description of the performance entry\n */\n name: string;\n\n /**\n * The start timestamp in seconds\n */\n start: number;\n\n /**\n * The end timestamp in seconds\n */\n end: number;\n\n /**\n * Additional unstructured data to be included\n */\n data?: Record<string, unknown>;\n}\n\ninterface MemoryInfo {\n jsHeapSizeLimit: number;\n totalJSHeapSize: number;\n usedJSHeapSize: number;\n}\n\n// Map entryType -> function to normalize data for event\nconst ENTRY_TYPES: Record<\n string,\n (entry: PerformanceEntry) => ReplayPerformanceEntry\n> = {\n resource: createResourceEntry,\n paint: createPaintEntry,\n navigation: createNavigationEntry,\n ['largest-contentful-paint']: createLargestContentfulPaint,\n};\n\nexport function createPerformanceEntries(entries: PerformanceEntry[]) {\n return entries.map(createPerformanceEntry).filter(Boolean);\n}\n\nfunction createPerformanceEntry(entry: PerformanceEntry) {\n if (ENTRY_TYPES[entry.entryType] === undefined) {\n return null;\n }\n\n return ENTRY_TYPES[entry.entryType](entry);\n}\n\nfunction getAbsoluteTime(time: number) {\n return (window.performance.timeOrigin + time) / 1000;\n}\n\nfunction createPaintEntry(entry: PerformancePaintTiming) {\n const { duration, entryType, name, startTime } = entry;\n\n const start = getAbsoluteTime(startTime);\n return {\n type: entryType,\n name,\n start,\n end: start + duration,\n };\n}\n\nfunction createNavigationEntry(entry: PerformanceNavigationTiming) {\n // TODO: There looks to be some more interesting bits in here (domComplete, domContentLoaded)\n\n const { entryType, name, domComplete, startTime, transferSize, type } = entry;\n\n return {\n type: `${entryType}.${type}`,\n start: getAbsoluteTime(startTime),\n end: getAbsoluteTime(domComplete),\n name,\n data: {\n size: transferSize,\n },\n };\n}\nfunction createResourceEntry(entry: PerformanceResourceTiming) {\n const {\n entryType,\n initiatorType,\n name,\n responseEnd,\n startTime,\n transferSize,\n } = entry;\n\n return {\n type: `${entryType}.${initiatorType}`,\n start: getAbsoluteTime(startTime),\n end: getAbsoluteTime(responseEnd),\n name,\n data: {\n size: transferSize,\n },\n };\n}\n\nfunction createLargestContentfulPaint(\n entry: PerformanceEntry & { size: number; element: Node }\n) {\n const { duration, entryType, startTime, size } = entry;\n\n const start = getAbsoluteTime(startTime);\n\n return {\n type: entryType,\n name: entryType,\n start,\n end: start + duration,\n data: {\n size,\n // @ts-expect-error Not sure why this errors, Node should be correct (Argument of type 'Node' is not assignable to parameter of type 'INode')\n nodeId: record.mirror.getId(entry.element),\n },\n };\n}\n\nexport function createMemoryEntry(memoryEntry: MemoryInfo) {\n const { jsHeapSizeLimit, totalJSHeapSize, usedJSHeapSize } = memoryEntry;\n // we can't use getAbsoluteTime because it adds the event time to\n // window.performance.timeOrigin, so we get right now instead.\n const time = new Date().getTime() / 1000;\n return {\n type: 'memory',\n name: 'memory',\n start: time,\n end: time,\n data: {\n memory: {\n jsHeapSizeLimit,\n totalJSHeapSize,\n usedJSHeapSize,\n },\n },\n };\n}\n","export const REPLAY_SESSION_KEY = 'sentryReplaySession';\nexport const ROOT_REPLAY_NAME = 'sentry-replay';\nexport const REPLAY_EVENT_NAME = 'sentry-replay-event';\n\n// Grace period to keep a session when a user changes tabs or hides window\nexport const VISIBILITY_CHANGE_TIMEOUT = 60000; // 1 minute\n// The idle limit for a session\nexport const SESSION_IDLE_DURATION = 900000; // 15 minutes\n","/**\n * Given an initial timestamp and an expiry duration, checks to see if current\n * time should be considered as expired.\n */\nexport function isExpired(\n initialTime: number,\n expiry: number,\n targetTime: number = +new Date()\n) {\n // Always expired if < 0\n if (expiry < 0) {\n return true;\n }\n\n // Never expires if == 0\n if (expiry === 0) {\n return false;\n }\n\n return initialTime + expiry <= targetTime;\n}\n","import { ReplaySession } from '@/session';\nimport { isExpired } from './isExpired';\n\n/**\n * Checks to see if session is expired\n */\nexport function isSessionExpired(\n session: ReplaySession,\n expiry: number,\n targetTime = +new Date()\n) {\n return isExpired(session.lastActivity, expiry, targetTime);\n}\n","import { logger as sentryLogger } from '@sentry/utils';\n\nimport { IS_DEBUG_BUILD } from '../flags';\n\nfunction wrapLogger(logFn: typeof sentryLogger[keyof typeof sentryLogger]) {\n return function wrappedLog(...args: any[]) {\n if (!IS_DEBUG_BUILD) {\n return;\n }\n return logFn.call(sentryLogger, '[Replay]', ...args);\n };\n}\n\nconst logger = {\n ...sentryLogger,\n error: wrapLogger(sentryLogger.error),\n warn: wrapLogger(sentryLogger.warn),\n log: wrapLogger(sentryLogger.log),\n};\n\nexport { logger };\n","import { REPLAY_SESSION_KEY } from './constants';\nimport { ReplaySession } from './types';\n\nexport function saveSession(session: ReplaySession) {\n const hasSessionStorage = 'sessionStorage' in window;\n if (!hasSessionStorage) {\n return;\n }\n\n try {\n window.sessionStorage.setItem(REPLAY_SESSION_KEY, JSON.stringify(session));\n } catch {\n // this shouldn't happen\n }\n}\n","import { logger } from '@/util/logger';\nimport { saveSession } from './saveSession';\nimport type { ReplaySession } from './types';\nimport { ROOT_REPLAY_NAME } from './constants';\nimport { getCurrentHub } from '@sentry/browser';\nimport { uuid4 } from '@sentry/utils';\n\ninterface CreateSessionParams {\n /**\n * Should save to sessionStorage?\n */\n stickySession: boolean;\n}\n\n/**\n * Create a new session, which in its current implementation is a Sentry event\n * that all replays will be saved to as attachments. Currently, we only expect\n * one of these Sentry events per \"replay session\".\n */\nexport function createSession({\n stickySession = false,\n}: CreateSessionParams): ReplaySession {\n const currentDate = new Date().getTime();\n const hub = getCurrentHub();\n\n const session = {\n id: uuid4(),\n started: currentDate,\n lastActivity: currentDate,\n sequenceId: 0,\n };\n hub.captureEvent(\n {\n message: ROOT_REPLAY_NAME,\n tags: { sequenceId: session.sequenceId },\n },\n { event_id: session.id }\n );\n\n logger.log(`Creating new session: ${session.id}`);\n\n if (stickySession) {\n saveSession(session);\n }\n\n return session;\n}\n","import { REPLAY_SESSION_KEY } from './constants';\nimport { ReplaySession } from './types';\n\nexport function fetchSession(): ReplaySession | null {\n const hasSessionStorage = 'sessionStorage' in window;\n\n if (!hasSessionStorage) {\n return null;\n }\n\n try {\n return JSON.parse(window.sessionStorage.getItem(REPLAY_SESSION_KEY));\n } catch {\n return null;\n }\n}\n","import { isSessionExpired } from '@/util/isSessionExpired';\nimport { logger } from '@/util/logger';\nimport { createSession } from './createSession';\nimport { fetchSession } from './fetchSession';\n\ninterface GetSessionParams {\n /**\n * The length of time (in ms) which we will consider the session to be expired.\n */\n expiry: number;\n /**\n * Should save session to sessionStorage?\n */\n stickySession: boolean;\n}\n\n/**\n * Get or create a session\n */\nexport function getSession({ expiry, stickySession }: GetSessionParams) {\n const session = stickySession && fetchSession();\n\n if (session) {\n // If there is a session, check if it is valid (e.g. \"last activity\" time should be within the \"session idle time\")\n // TODO: We should probably set a max age on this as well\n const isExpired = isSessionExpired(session, expiry);\n\n if (!isExpired) {\n logger.log(`Using existing session: ${session.id}`);\n return session;\n } else {\n logger.log(`Session has expired`);\n }\n // Otherwise continue to create a new session\n }\n\n const newSession = createSession({ stickySession });\n\n return newSession;\n}\n","import { createSession } from './createSession';\nimport { fetchSession } from './fetchSession';\nimport { saveSession } from './saveSession';\n\nexport function updateSessionActivity({\n stickySession,\n}: {\n stickySession: boolean;\n}) {\n // Nothing to do if there are no sticky sessions\n if (!stickySession) {\n return;\n }\n\n const existingSession = fetchSession();\n\n // If user manually deleted from session storage, create a new session\n if (!existingSession) {\n // TBD: There was an issue here where sessions weren't saving and this\n // caused lots of transactions to be created\n return createSession({ stickySession });\n }\n\n const newSession = {\n ...existingSession,\n lastActivity: new Date().getTime(),\n };\n\n saveSession(newSession);\n\n return newSession;\n}\n","import { SentryReplay } from '@';\nimport { Scope } from '@sentry/hub';\nimport { addInstrumentationHandler, htmlTreeAsString } from '@sentry/utils';\n\nexport default function addInstrumentationListeners(\n scope: Scope,\n replay: SentryReplay\n) {\n scope.addScopeListener(scopeListenerCallback.bind(replay));\n addInstrumentationHandler('dom', domCallback.bind(replay));\n addInstrumentationHandler('xhr', xhrCallback.bind(replay));\n addInstrumentationHandler('fetch', fetchCallback.bind(replay));\n}\n\nfunction scopeListenerCallback(scope: Scope) {\n //@ts-expect-error using private val\n const newBreadcrumb = scope._breadcrumbs[scope._breadcrumbs.length - 1];\n\n if (\n ['fetch', 'xhr', 'sentry.event'].includes(newBreadcrumb.category) ||\n newBreadcrumb.category.startsWith('ui.')\n ) {\n return;\n }\n\n this.breadcrumbs.push({ type: 'default', ...newBreadcrumb });\n}\n\nfunction domCallback(handlerData: any) {\n // Taken from https://github.com/getsentry/sentry-javascript/blob/master/packages/browser/src/integrations/breadcrumbs.ts#L112\n let target;\n let targetNode;\n\n // Accessing event.target can throw (see getsentry/raven-js#838, #768)\n try {\n targetNode =\n (handlerData.event.target as Node) ||\n (handlerData.event as unknown as Node);\n target = htmlTreeAsString(targetNode);\n } catch (e) {\n target = '<unknown>';\n }\n\n if (target.length === 0) {\n return;\n }\n\n this.breadcrumbs.push({\n timestamp: new Date().getTime() / 1000,\n type: 'default',\n category: `ui.${handlerData.name}`,\n message: target,\n data: {\n // @ts-expect-error Not sure why this errors, Node should be correct (Argument of type 'Node' is not assignable to parameter of type 'INode')\n nodeId: targetNode ? record.mirror.getId(targetNode) : undefined,\n },\n });\n}\n\nfunction xhrCallback(handlerData: any) {\n // TODO: add status code into data, etc.\n\n if (handlerData.startTimestamp) {\n handlerData.xhr.__sentry_xhr__.startTimestamp = handlerData.startTimestamp;\n }\n if (handlerData.endTimestamp) {\n this.spans.push({\n description: handlerData.args[1],\n op: handlerData.args[0],\n startTimestamp:\n handlerData.xhr.__sentry_xhr__.startTimestamp / 1000 ||\n handlerData.endTimestamp / 1000.0,\n endTimestamp: handlerData.endTimestamp / 1000.0,\n });\n }\n}\n\nfunction fetchCallback(handlerData: any) {\n // TODO: add status code into data, etc.\n\n if (handlerData.endTimestamp) {\n this.spans.push({\n description: handlerData.args[1],\n op: handlerData.args[0],\n startTimestamp: handlerData.startTimestamp / 1000,\n endTimestamp: handlerData.endTimestamp / 1000,\n });\n }\n}\n","import * as Sentry from '@sentry/browser';\nimport { uuid4 } from '@sentry/utils';\nimport { DsnComponents, Event, Integration, Breadcrumb } from '@sentry/types';\n\nimport { record } from 'rrweb';\nimport type { eventWithTime } from 'rrweb/typings/types';\nimport {\n createPerformanceEntries,\n createMemoryEntry,\n ReplayPerformanceEntry,\n} from './createPerformanceEntry';\nimport { ReplaySession } from './session';\nimport {\n REPLAY_EVENT_NAME,\n ROOT_REPLAY_NAME,\n SESSION_IDLE_DURATION,\n VISIBILITY_CHANGE_TIMEOUT,\n} from './session/constants';\nimport { getSession } from './session/getSession';\nimport { updateSessionActivity } from './session/updateSessionActivity';\nimport { ReplaySpan } from './types';\nimport { isExpired } from './util/isExpired';\nimport { isSessionExpired } from './util/isSessionExpired';\nimport { logger } from './util/logger';\nimport { saveSession } from './session/saveSession';\nimport { captureEvent } from '@sentry/browser';\nimport addInstrumentationListeners from './addInstrumentationListeners';\n\ntype RRWebEvent = eventWithTime;\ntype RRWebOptions = Parameters<typeof record>[0];\ninterface PluginOptions {\n /**\n * The amount of time to wait before sending a replay\n */\n uploadMinDelay?: number;\n\n /**\n * The max amount of time to wait before sending a replay\n */\n uploadMaxDelay?: number;\n\n /**\n * If false, will create a new session per pageload\n */\n stickySession?: boolean;\n}\n\ninterface SentryReplayConfiguration extends PluginOptions {\n /**\n * Options for `rrweb.recordsetup\n */\n rrwebConfig?: RRWebOptions;\n}\n\ninterface ReplayRequest {\n endpoint: string;\n events: RRWebEvent[];\n replaySpans: ReplaySpan[];\n breadcrumbs: Breadcrumb[];\n}\n\nexport class SentryReplay implements Integration {\n /**\n * @inheritDoc\n */\n public static id = 'Replay';\n\n /**\n * @inheritDoc\n */\n public name: string = SentryReplay.id;\n\n /**\n * Buffer of rrweb events that will be serialized as JSON and saved as an attachment to a Sentry event\n */\n public events: RRWebEvent[] = [];\n\n public performanceEvents: PerformanceEntry[] = [];\n\n /**\n * Options to pass to `rrweb.record()`\n */\n readonly rrwebRecordOptions: RRWebOptions;\n\n readonly options: PluginOptions;\n\n /**\n * setTimeout id used for debouncing sending rrweb attachments\n */\n private timeout: number;\n\n private breadcrumbs: Breadcrumb[] = [];\n\n /**\n * The timestamp of the first event since the last flush.\n * This is used to determine if the maximum allowed time has passed before we should flush events again.\n */\n private initialEventTimestampSinceFlush: number | null = null;\n public replaySpans: ReplaySpan[] = [];\n\n private performanceObserver: PerformanceObserver | null = null;\n\n session: ReplaySession | undefined;\n\n static attachmentUrlFromDsn(dsn: DsnComponents, eventId: string) {\n const { host, projectId, protocol, publicKey } = dsn;\n\n const port = dsn.port !== '' ? `:${dsn.port}` : '';\n const path = dsn.path !== '' ? `/${dsn.path}` : '';\n\n return `${protocol}://${host}${port}${path}/api/${projectId}/events/${eventId}/attachments/?sentry_key=${publicKey}&sentry_version=7&sentry_client=replay`;\n }\n\n constructor({\n uploadMinDelay = 5000,\n uploadMaxDelay = 15000,\n stickySession = false, // TBD: Making this opt-in for now\n rrwebConfig: {\n maskAllInputs = true,\n blockClass = 'sr-block',\n ignoreClass = 'sr-ignore',\n maskTextClass = 'sr-mask',\n ...rrwebRecordOptions\n } = {},\n }: SentryReplayConfiguration = {}) {\n this.rrwebRecordOptions = {\n maskAllInputs,\n blockClass,\n ignoreClass,\n maskTextClass,\n ...rrwebRecordOptions,\n };\n\n this.options = { uploadMinDelay, uploadMaxDelay, stickySession };\n this.events = [];\n }\n\n setupOnce() {\n /**\n * Because we create a transaction in `setupOnce`, we can potentially create a\n * transaction before some native SDK integrations have run and applied their\n * own global event processor. An example is:\n * https://github.com/getsentry/sentry-javascript/blob/b47ceafbdac7f8b99093ce6023726ad4687edc48/packages/browser/src/integrations/useragent.ts\n *\n * So we do this as a workaround to wait for other global event processors to finish\n */\n window.setTimeout(() => this.setup());\n }\n\n setup() {\n const hub = Sentry.getCurrentHub();\n const { scope } = hub.getStackTop();\n\n addInstrumentationListeners(scope, this);\n\n this.loadSession({ expiry: SESSION_IDLE_DURATION });\n\n // If there is no session, then something bad has happened - can't continue\n if (!this.session) {\n throw new Error('Invalid session');\n }\n\n // Tag all (non replay) events that get sent to Sentry with the current\n // replay ID so that we can reference them later in the UI\n Sentry.addGlobalEventProcessor((event: Event) => {\n // Do not apply replayId to the root transaction\n if (event.transaction === ROOT_REPLAY_NAME) {\n return event;\n }\n\n event.tags = { ...event.tags, replayId: this.session.id };\n return event;\n });\n\n record({\n ...this.rrwebRecordOptions,\n emit: (event: RRWebEvent, isCheckout?: boolean) => {\n // We want to batch uploads of replay events. Save events only if\n // `<uploadMinDelay>` milliseconds have elapsed since the last event\n // *OR* if `<uploadMaxDelay>` milliseconds have elapsed.\n\n const now = new Date().getTime();\n\n // Timestamp of the first replay event since the last flush, this gets\n // reset when we finish the replay event\n if (!this.initialEventTimestampSinceFlush) {\n this.initialEventTimestampSinceFlush = now;\n }\n\n // Do not finish the replay event if we receive a new replay event\n if (this.timeout) {\n window.clearTimeout(this.timeout);\n }\n\n // If this is false, it means session is expired, create and a new session and wait for checkout\n if (!this.checkAndHandleExpiredSession()) {\n logger.error(\n new Error('Received replay event after session expired.')\n );\n\n return;\n }\n\n // We need to clear existing events on a checkout, otherwise they are\n // incremental event updates and should be appended\n if (isCheckout) {\n this.events = [event];\n } else {\n this.events.push(event);\n }\n\n // This event type is a fullsnapshot, we should save immediately when this occurs\n // See https://github.com/rrweb-io/rrweb/blob/d8f9290ca496712aa1e7d472549480c4e7876594/packages/rrweb/src/types.ts#L16\n if (event.type === 2) {\n // A fullsnapshot happens on initial load and if we need to start a\n // new replay due to idle timeout. In the latter case, a new session *should* have been started\n // before triggering a new checkout\n this.finishReplayEvent();\n return;\n }\n\n const uploadMaxDelayExceeded = isExpired(\n this.initialEventTimestampSinceFlush,\n this.options.uploadMaxDelay,\n now\n );\n\n // If `uploadMaxDelayExceeded` is true, then we should finish the replay event immediately,\n // Otherwise schedule it to be finished in `this.options.uploadMinDelay`\n if (uploadMaxDelayExceeded) {\n logger.log('replay max delay exceeded, finishing replay event');\n this.finishReplayEvent();\n return;\n }\n\n // Set timer to finish replay event and send replay attachment to\n // Sentry. Will be cancelled if an event happens before `uploadMinDelay`\n // elapses.\n this.timeout = window.setTimeout(() => {\n logger.log('replay timeout exceeded, finishing replay event');\n this.finishReplayEvent();\n }, this.options.uploadMinDelay);\n },\n });\n\n this.addListeners();\n }\n\n /**\n * Currently, this needs to be manually called (e.g. for tests). Sentry SDK does not support a teardown\n */\n teardown() {\n this.removeListeners();\n }\n\n /**\n * Loads a session from storage, or creates a new one\n */\n loadSession({ expiry }: { expiry: number }): void {\n this.session = getSession({\n expiry,\n stickySession: this.options.stickySession,\n });\n }\n\n addListeners() {\n document.addEventListener('visibilitychange', this.handleVisibilityChange);\n\n if (!('PerformanceObserver' in window)) {\n return;\n }\n\n this.performanceObserver = new PerformanceObserver(\n this.handlePerformanceObserver\n );\n\n // Observe almost everything for now (no mark/measure)\n [\n 'element',\n 'event',\n 'first-input',\n 'largest-contentful-paint',\n 'layout-shift',\n 'longtask',\n 'navigation',\n 'paint',\n 'resource',\n ].forEach((type) =>\n this.performanceObserver.observe({\n type,\n buffered: true,\n })\n );\n }\n\n removeListeners() {\n document.removeEventListener(\n 'visibilitychange',\n this.handleVisibilityChange\n );\n\n if (this.performanceObserver) {\n this.performanceObserver.disconnect();\n this.performanceObserver = null;\n }\n }\n\n /**\n * Keep a list of performance entries that will be sent with a replay\n */\n handlePerformanceObserver = (\n list: PerformanceObserverEntryList\n // observer: PerformanceObserver\n ) => {\n this.performanceEvents = [...this.performanceEvents, ...list.getEntries()];\n };\n\n /**\n * Handle when visibility of the page changes. (e.g. new tab is opened)\n */\n handleVisibilityChange = () => {\n const isExpired = isSessionExpired(this.session, VISIBILITY_CHANGE_TIMEOUT);\n\n if (isExpired) {\n if (document.visibilityState === 'visible') {\n // If the user has come back to the page within VISIBILITY_CHANGE_TIMEOUT\n // ms, we will re-use the existing session, otherwise create a new\n // session\n logger.log('Document has become active, but session has expired');\n this.loadSession({ expiry: VISIBILITY_CHANGE_TIMEOUT });\n this.triggerFullSnapshot();\n }\n // We definitely want to return if visibilityState is \"visible\", and I\n // think we also want to do the same when \"hidden\", as there shouldn't be\n // any action to take if user has gone idle for a long period and then\n // comes back to hide the tab. We don't trigger a full snapshot because\n // we don't want to start a new session as they immediately have hidden\n // the tab.\n return;\n }\n\n // Otherwise if session is not expired...\n\n // Update with current timestamp as the last session activity\n // Only updating session on visibility change to be conservative about\n // writing to session storage. This could be changed in the future.\n updateSessionActivity({\n stickySession: this.options.stickySession,\n });\n\n // Send replay when the page/tab becomes hidden. There is no reason to send\n // replay if it becomes visible, since no actions we care about were done\n // while it was hidden\n if (document.visibilityState !== 'visible') {\n this.finishReplayEvent();\n }\n };\n\n /**\n * Trigger rrweb to take a full snapshot which will cause this plugin to\n * create a new Replay event.\n */\n triggerFullSnapshot() {\n logger.log('Taking full rrweb snapshot');\n record.takeFullSnapshot(true);\n }\n\n /**\n * Create a span for each performance entry. The parent transaction is `this.replayEvent`.\n */\n createPerformanceSpans(entries: ReplayPerformanceEntry[]) {\n entries.forEach(({ type, start, end, name, data }) => {\n this.replaySpans.push({\n op: type,\n description: name,\n startTimestamp: start,\n endTimestamp: end,\n data,\n });\n });\n }\n\n /**\n * Observed performance events are added to `this.performanceEvents`. These\n * are included in the replay event before it is finished and sent to Sentry.\n */\n addPerformanceEntries() {\n // Copy and reset entries before processing\n const entries = [...this.performanceEvents];\n this.performanceEvents = [];\n\n // Parse the entries\n const entryEvents = createPerformanceEntries(entries);\n\n // window.performance.memory is a non-standard API and doesn't work on all browsers\n // so we check before creating the event.\n if ('memory' in window.performance) {\n // @ts-expect-error memory doesn't exist on type Performance as the API is non-standard\n entryEvents.push(createMemoryEntry(window.performance.memory));\n }\n this.createPerformanceSpans(entryEvents);\n }\n\n /**\n *\n *\n * Returns true if session is not expired, false otherwise.\n */\n checkAndHandleExpiredSession(expiry: number = SESSION_IDLE_DURATION) {\n const oldSessionId = this.session.id;\n\n // This will create a new session if expired, based on expiry length\n this.loadSession({ expiry });\n\n // Session was expired if session ids do not match\n const isExpired = oldSessionId !== this.session.id;\n\n if (!isExpired) {\n return true;\n }\n\n // TODO: We could potentially figure out a way to save the last session,\n // and produce a checkout based on a previous checkout + updates, and then\n // replay the event on top. Or maybe replay the event on top of a refresh\n // snapshot.\n\n // For now create a new snapshot\n this.triggerFullSnapshot();\n\n return false;\n }\n\n finishReplayEvent() {\n if (!this.checkAndHandleExpiredSession()) {\n logger.error(\n new Error('Attempting to finish replay event after session expired.')\n );\n }\n\n if (!this.session.id) {\n console.error(new Error('[Sentry]: No transaction, no replay'));\n return;\n }\n // TEMP: keep sending a replay event just for the duration\n captureEvent({\n message: `${REPLAY_EVENT_NAME}-${uuid4().substring(16)}`,\n tags: {\n replayId: this.session.id,\n sequenceId: this.session.sequenceId++,\n },\n });\n\n this.addPerformanceEntries();\n this.sendReplay(this.session.id);\n\n this.initialEventTimestampSinceFlush = null;\n // TBD: Alternatively we could update this after every rrweb event\n this.session.lastActivity = new Date().getTime();\n }\n\n /**\n * Determine if there is browser support for `navigator.sendBeacon`\n */\n hasSendBeacon() {\n return 'navigator' in window && 'sendBeacon' in window.navigator;\n }\n\n /**\n * Send replay attachment using either `sendBeacon()` or `fetch()`\n */\n async sendReplayRequest({\n endpoint,\n events,\n replaySpans,\n breadcrumbs,\n }: ReplayRequest) {\n const stringifiedPayload = JSON.stringify({\n recording: events,\n replaySpans: replaySpans,\n breadcrumbs: breadcrumbs,\n });\n const formData = new FormData();\n formData.append(\n 'rrweb',\n new Blob([stringifiedPayload], {\n type: 'application/json',\n }),\n `rrweb-${new Date().getTime()}.json`\n );\n\n // If sendBeacon is supported and payload is smol enough...\n if (this.hasSendBeacon() && stringifiedPayload.length <= 65536) {\n logger.log(`uploading attachment via sendBeacon()`);\n window.navigator.sendBeacon(endpoint, formData);\n return;\n }\n\n // Otherwise use `fetch`, which *WILL* get cancelled on page reloads/unloads\n logger.log(`uploading attachment via fetch()`);\n await fetch(endpoint, {\n method: 'POST',\n body: formData,\n });\n }\n\n /**\n * Finalize and send the current replay event to Sentry\n */\n async sendReplay(eventId: string) {\n // short circuit if theres no events to replay\n if (!this.events.length) return;\n\n // Make a copy of the events array reference and immediately clear the\n // events member so that we do not lose new events while uploading\n // attachment.\n const events = this.events;\n const replaySpans = this.replaySpans;\n const breadcrumbs = this.breadcrumbs;\n this.replaySpans = [];\n this.breadcrumbs = [];\n this.events = [];\n\n const client = Sentry.getCurrentHub().getClient();\n const endpoint = SentryReplay.attachmentUrlFromDsn(\n client.getDsn(),\n eventId\n );\n\n try {\n await this.sendReplayRequest({\n endpoint,\n events,\n replaySpans,\n breadcrumbs,\n });\n return true;\n } catch (ex) {\n // we have to catch this otherwise it throws an infinite loop in Sentry\n console.error(ex);\n\n // If an error happened here, it's likely that uploading the attachment failed, we'll want to restore the events that failed to upload\n this.events = [...events, ...this.events];\n return false;\n }\n }\n}\n"],"names":["record","sentryLogger","getCurrentHub","uuid4","addInstrumentationHandler","htmlTreeAsString","Sentry","captureEvent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAiBA;AACO,IAAI,QAAQ,GAAG,WAAW;AACjC,IAAI,QAAQ,GAAG,MAAM,CAAC,MAAM,IAAI,SAAS,QAAQ,CAAC,CAAC,EAAE;AACrD,QAAQ,KAAK,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;AAC7D,YAAY,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAC7B,YAAY,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACzF,SAAS;AACT,QAAQ,OAAO,CAAC,CAAC;AACjB,MAAK;AACL,IAAI,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AAC3C,EAAC;AACD;AACO,SAAS,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE;AAC7B,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;AACf,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;AACvF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wBAAA,OAAA,CAAA,CAAA,aAAO,KAAK,CAAC,CAAA;;;;;AAEhB,KAAA,CAAA;AAleD;;AAEG;IACW,YAAE,CAAA,EAAA,GAAG,QAAQ,CAAC;IAge9B,OAAC,YAAA,CAAA;AAAA,CApeD,EAoeC;;;;"}
@@ -0,0 +1,3 @@
1
+ import type { Config } from '@jest/types';
2
+ declare const _default: () => Promise<Config.InitialOptions>;
3
+ export default _default;
@@ -0,0 +1,3 @@
1
+ import { RollupOptions } from 'rollup';
2
+ declare const config: RollupOptions[];
3
+ export default config;
@@ -0,0 +1,23 @@
1
+ export interface ReplayPerformanceEntry {
2
+ /**
3
+ * One of these types https://developer.mozilla.org/en-US/docs/Web/API/PerformanceEntry/entryType
4
+ */
5
+ type: string;
6
+ /**
7
+ * A more specific description of the performance entry
8
+ */
9
+ name: string;
10
+ /**
11
+ * The start timestamp in seconds
12
+ */
13
+ start: number;
14
+ /**
15
+ * The end timestamp in seconds
16
+ */
17
+ end: number;
18
+ /**
19
+ * Additional unstructured data to be included
20
+ */
21
+ data?: Record<string, any>;
22
+ }
23
+ export declare function createPerformanceEntries(entries: PerformanceEntry[]): ReplayPerformanceEntry[];
@@ -0,0 +1,2 @@
1
+ /** Flag that is true for debug builds, false otherwise. */
2
+ export declare const IS_DEBUG_BUILD: boolean;
@@ -0,0 +1,120 @@
1
+ import { Transaction } from '@sentry/types';
2
+ import { record } from 'rrweb';
3
+ import type { eventWithTime } from 'rrweb/typings/types';
4
+ import { ReplayPerformanceEntry } from './createPerformanceEntry';
5
+ declare type RRWebEvent = eventWithTime;
6
+ declare type RRWebOptions = Parameters<typeof record>[0];
7
+ interface PluginOptions {
8
+ /**
9
+ * The amount of time to wait before sending a replay
10
+ */
11
+ uploadMinDelay?: number;
12
+ /**
13
+ * The max amount of time to wait before sending a replay
14
+ */
15
+ uploadMaxDelay?: number;
16
+ /**
17
+ * If false, will create a new session per pageload
18
+ */
19
+ stickySession?: boolean;
20
+ }
21
+ interface SentryReplayConfiguration extends PluginOptions {
22
+ /**
23
+ * Options for `rrweb.record`
24
+ */
25
+ rrwebConfig?: RRWebOptions;
26
+ }
27
+ export declare class SentryReplay {
28
+ /**
29
+ * @inheritDoc
30
+ */
31
+ static id: string;
32
+ /**
33
+ * @inheritDoc
34
+ */
35
+ name: string;
36
+ /**
37
+ * Buffer of rrweb events that will be serialized as JSON and saved as an attachment to a Sentry event
38
+ */
39
+ events: RRWebEvent[];
40
+ performanceEvents: PerformanceEntry[];
41
+ /**
42
+ * A Sentry Transaction that should capture every incremental rrweb update,
43
+ * but *not* the attachments themselves. This is currently used to capture
44
+ * breadcrumbs and maybe other spans (e.g. network requests)
45
+ */
46
+ private replayEvent;
47
+ /**
48
+ * Options to pass to `rrweb.record()`
49
+ */
50
+ private readonly rrwebRecordOptions;
51
+ private readonly options;
52
+ /**
53
+ * setTimeout id used for debouncing sending rrweb attachments
54
+ */
55
+ private timeout;
56
+ /**
57
+ * The timestamp of the first event since the last flush.
58
+ * This is used to determine if the maximum allowed time has passed before we should flush events again.
59
+ */
60
+ private initialEventTimestampSinceFlush;
61
+ private performanceObserver;
62
+ private session;
63
+ private static attachmentUrlFromDsn;
64
+ /**
65
+ * Get integration's instance on the current hub
66
+ */
67
+ private get instance();
68
+ constructor({ uploadMinDelay, uploadMaxDelay, stickySession, // TBD: Making this opt-in for now
69
+ rrwebConfig: { maskAllInputs, ...rrwebRecordOptions }, }?: SentryReplayConfiguration);
70
+ setupOnce(): void;
71
+ /**
72
+ * Loads a session from storage, or creates a new one
73
+ */
74
+ loadSession({ expiry }: {
75
+ expiry: number;
76
+ }): void;
77
+ addListeners(): void;
78
+ /**
79
+ * Keep a list of performance entries that will be sent with a replay
80
+ */
81
+ handlePerformanceObserver: (list: PerformanceObserverEntryList) => void;
82
+ /**
83
+ * Handle when visibility of the page changes. (e.g. new tab is opened)
84
+ */
85
+ handleVisibilityChange: () => void;
86
+ /**
87
+ * Trigger rrweb to take a full snapshot which will cause this plugin to
88
+ * create a new Replay event.
89
+ */
90
+ triggerFullSnapshot(): void;
91
+ /**
92
+ * This is our pseudo replay event disguised as a transaction. It will be
93
+ * used to store performance entries and breadcrumbs for every incremental
94
+ * replay event.
95
+ **/
96
+ createReplayEvent(): Transaction;
97
+ /**
98
+ * Create a span for each performance entry. The parent transaction is `this.replayEvent`.
99
+ */
100
+ createPerformanceSpans(entries: ReplayPerformanceEntry[]): void;
101
+ /**
102
+ * Observed performance events are added to `this.performanceEvents`. These
103
+ * are included in the replay event before it is finished and sent to Sentry.
104
+ */
105
+ addPerformanceEntries(): void;
106
+ finishReplayEvent(): void;
107
+ /**
108
+ * Determine if there is browser support for `navigator.sendBeacon`
109
+ */
110
+ hasSendBeacon(): boolean;
111
+ /**
112
+ * Send replay attachment using either `sendBeacon()` or `fetch()`
113
+ */
114
+ sendReplayRequest(endpoint: string, events: RRWebEvent[]): Promise<void>;
115
+ /**
116
+ * Finalize and send the current replay event to Sentry
117
+ */
118
+ sendReplay(eventId: string): Promise<boolean>;
119
+ }
120
+ export {};
@@ -0,0 +1 @@
1
+ export declare const REPLAY_SESSION_KEY = "sentryReplaySession";
@@ -0,0 +1,14 @@
1
+ import type { ReplaySession } from './types';
2
+ interface CreateSessionParams {
3
+ /**
4
+ * Should save to sessionStorage?
5
+ */
6
+ stickySession: boolean;
7
+ }
8
+ /**
9
+ * Create a new session, which in its current implementation is a Sentry event
10
+ * that all replays will be saved to as attachments. Currently, we only expect
11
+ * one of these Sentry events per "replay session".
12
+ */
13
+ export declare function createSession({ stickySession, }: CreateSessionParams): ReplaySession;
14
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { ReplaySession } from './types';
2
+ export declare function fetchSession(): ReplaySession | null;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,15 @@
1
+ interface GetSessionParams {
2
+ /**
3
+ * The length of time (in ms) which we will consider the session to be expired.
4
+ */
5
+ expiry: number;
6
+ /**
7
+ * Should save session to sessionStorage?
8
+ */
9
+ stickySession: boolean;
10
+ }
11
+ /**
12
+ * Get or create a session
13
+ */
14
+ export declare function getSession({ expiry, stickySession }: GetSessionParams): import("./types").ReplaySession;
15
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './types';
2
+ export * from './createSession';
@@ -0,0 +1,2 @@
1
+ import { ReplaySession } from './types';
2
+ export declare function saveSession(session: ReplaySession): void;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ export interface ReplaySession {
2
+ id: string;
3
+ traceId: string;
4
+ spanId: string;
5
+ started: number;
6
+ lastActivity: number;
7
+ }
@@ -0,0 +1,3 @@
1
+ export declare function updateSessionActivity({ stickySession, }: {
2
+ stickySession: boolean;
3
+ }): import("./types").ReplaySession;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Given an initial timestamp and an expiry duration, checks to see if current
3
+ * time should be considered as expired.
4
+ */
5
+ export declare function isExpired(initialTime: number, expiry: number, targetTime?: number): boolean;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import { ReplaySession } from '@/session';
2
+ /**
3
+ * Checks to see if session is expired
4
+ */
5
+ export declare function isSessionExpired(session: ReplaySession, expiry: number, targetTime?: number): boolean;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ declare const logger: {
2
+ error: (...args: any[]) => any;
3
+ warn: (...args: any[]) => any;
4
+ log: (...args: any[]) => any;
5
+ };
6
+ export { logger };
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,18 +1,19 @@
1
1
  {
2
2
  "name": "@sentry/replay",
3
- "version": "0.2.0-0",
3
+ "version": "0.2.0-11",
4
4
  "description": "User replays for Sentry",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
7
7
  "scripts": {
8
8
  "bootstrap": "yarn && cd demo && yarn",
9
- "build": "yarn rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript",
9
+ "build": "NODE_ENV=production yarn rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript",
10
10
  "clean": "yarn rimraf dist",
11
11
  "lint": "yarn eslint . --ext .js,.jsx,.ts,.tsx",
12
12
  "prepare": "husky install",
13
+ "prepublishOnly": "yarn build",
13
14
  "start:demo": "yarn build && cd demo && yarn start",
14
15
  "test": "yarn jest",
15
- "watch": "yarn build --watch"
16
+ "watch": "NODE_ENV=development yarn build --watch"
16
17
  },
17
18
  "files": [
18
19
  "dist"
@@ -30,11 +31,11 @@
30
31
  "peerDependencies": {
31
32
  "@sentry/browser": ">=6.0.0",
32
33
  "@sentry/tracing": ">=6.0.0",
33
- "@sentry/utils": ">=6.0.0",
34
- "rrweb": ">=0.7.0"
34
+ "@sentry/utils": ">=6.0.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@babel/core": "^7.17.5",
38
+ "@rollup/plugin-replace": "^4.0.0",
38
39
  "@rollup/plugin-typescript": "^8.3.1",
39
40
  "@sentry/browser": "^6.19.1",
40
41
  "@sentry/tracing": "^6.19.1",
@@ -53,13 +54,14 @@
53
54
  "prettier": "^2.5.1",
54
55
  "rimraf": "^3.0.2",
55
56
  "rollup": "^2.70.0",
56
- "rrweb": "^1.1.2",
57
57
  "ts-jest": "^27.1.3",
58
58
  "ts-node": "^10.7.0",
59
59
  "tslib": "^2.3.1",
60
60
  "typescript": "^4.6.2"
61
61
  },
62
- "dependencies": {},
62
+ "dependencies": {
63
+ "rrweb": "^1.1.3"
64
+ },
63
65
  "prettier": {
64
66
  "singleQuote": true
65
67
  },