@sentry/replay 0.2.0-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/dist/index.js ADDED
@@ -0,0 +1,491 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var Sentry = require('@sentry/browser');
6
+ var utils = require('@sentry/utils');
7
+ var rrweb = require('rrweb');
8
+
9
+ function _interopNamespace(e) {
10
+ if (e && e.__esModule) return e;
11
+ var n = Object.create(null);
12
+ if (e) {
13
+ Object.keys(e).forEach(function (k) {
14
+ if (k !== 'default') {
15
+ var d = Object.getOwnPropertyDescriptor(e, k);
16
+ Object.defineProperty(n, k, d.get ? d : {
17
+ enumerable: true,
18
+ get: function () { return e[k]; }
19
+ });
20
+ }
21
+ });
22
+ }
23
+ n["default"] = e;
24
+ return Object.freeze(n);
25
+ }
26
+
27
+ var Sentry__namespace = /*#__PURE__*/_interopNamespace(Sentry);
28
+
29
+ /*! *****************************************************************************
30
+ Copyright (c) Microsoft Corporation.
31
+
32
+ Permission to use, copy, modify, and/or distribute this software for any
33
+ purpose with or without fee is hereby granted.
34
+
35
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
36
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
37
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
38
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
39
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
40
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
41
+ PERFORMANCE OF THIS SOFTWARE.
42
+ ***************************************************************************** */
43
+
44
+ var __assign = function() {
45
+ __assign = Object.assign || function __assign(t) {
46
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
47
+ s = arguments[i];
48
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
49
+ }
50
+ return t;
51
+ };
52
+ return __assign.apply(this, arguments);
53
+ };
54
+
55
+ function __rest(s, e) {
56
+ var t = {};
57
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
58
+ t[p] = s[p];
59
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
60
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
61
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
62
+ t[p[i]] = s[p[i]];
63
+ }
64
+ return t;
65
+ }
66
+
67
+ function __awaiter(thisArg, _arguments, P, generator) {
68
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
69
+ return new (P || (P = Promise))(function (resolve, reject) {
70
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
71
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
72
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
73
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
74
+ });
75
+ }
76
+
77
+ function __generator(thisArg, body) {
78
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
79
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
80
+ function verb(n) { return function (v) { return step([n, v]); }; }
81
+ function step(op) {
82
+ if (f) throw new TypeError("Generator is already executing.");
83
+ while (_) try {
84
+ 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;
85
+ if (y = 0, t) op = [op[0] & 2, t.value];
86
+ switch (op[0]) {
87
+ case 0: case 1: t = op; break;
88
+ case 4: _.label++; return { value: op[1], done: false };
89
+ case 5: _.label++; y = op[1]; op = [0]; continue;
90
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
91
+ default:
92
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
93
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
94
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
95
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
96
+ if (t[2]) _.ops.pop();
97
+ _.trys.pop(); continue;
98
+ }
99
+ op = body.call(thisArg, _);
100
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
101
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
102
+ }
103
+ }
104
+
105
+ function __spreadArray(to, from, pack) {
106
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
107
+ if (ar || !(i in from)) {
108
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
109
+ ar[i] = from[i];
110
+ }
111
+ }
112
+ return to.concat(ar || Array.prototype.slice.call(from));
113
+ }
114
+
115
+ var _a;
116
+ // Map entryType -> function to normalize data for event
117
+ var ENTRY_TYPES = (_a = {
118
+ resource: createResourceEntry,
119
+ paint: createPaintEntry,
120
+ navigation: createNavigationEntry
121
+ },
122
+ _a['largest-contentful-paint'] = createLargestContentfulPaint,
123
+ _a);
124
+ function createPerformanceEntries(entries) {
125
+ return entries.map(createPerformanceEntry).filter(Boolean);
126
+ }
127
+ function createPerformanceEntry(entry) {
128
+ if (ENTRY_TYPES[entry.entryType] === undefined) {
129
+ return null;
130
+ }
131
+ return ENTRY_TYPES[entry.entryType](entry);
132
+ }
133
+ function getAbsoluteTime(time) {
134
+ return (window.performance.timeOrigin + time) / 1000;
135
+ }
136
+ function createPaintEntry(entry) {
137
+ var duration = entry.duration, entryType = entry.entryType, name = entry.name, startTime = entry.startTime;
138
+ var start = getAbsoluteTime(startTime);
139
+ return {
140
+ type: entryType,
141
+ name: name,
142
+ start: start,
143
+ end: start + duration,
144
+ };
145
+ }
146
+ function createNavigationEntry(entry) {
147
+ // TODO: There looks to be some more interesting bits in here (domComplete, domContentLoaded)
148
+ var entryType = entry.entryType, name = entry.name, domComplete = entry.domComplete, startTime = entry.startTime, transferSize = entry.transferSize, type = entry.type;
149
+ return {
150
+ type: "".concat(entryType, ".").concat(type),
151
+ start: getAbsoluteTime(startTime),
152
+ end: getAbsoluteTime(domComplete),
153
+ name: name,
154
+ data: {
155
+ size: transferSize,
156
+ },
157
+ };
158
+ }
159
+ function createResourceEntry(entry) {
160
+ var entryType = entry.entryType, initiatorType = entry.initiatorType, name = entry.name, responseEnd = entry.responseEnd, startTime = entry.startTime, transferSize = entry.transferSize;
161
+ return {
162
+ type: "".concat(entryType, ".").concat(initiatorType),
163
+ start: getAbsoluteTime(startTime),
164
+ end: getAbsoluteTime(responseEnd),
165
+ name: name,
166
+ data: {
167
+ size: transferSize,
168
+ },
169
+ };
170
+ }
171
+ function createLargestContentfulPaint(entry) {
172
+ var duration = entry.duration, entryType = entry.entryType, startTime = entry.startTime, size = entry.size;
173
+ var start = getAbsoluteTime(startTime);
174
+ return {
175
+ type: entryType,
176
+ name: entryType,
177
+ start: start,
178
+ end: start + duration,
179
+ data: {
180
+ size: size,
181
+ },
182
+ };
183
+ }
184
+
185
+ var VISIBILITY_CHANGE_TIMEOUT = 5000;
186
+ var SentryReplay = /** @class */ (function () {
187
+ function SentryReplay(_a) {
188
+ if (_a === void 0) { _a = {}; }
189
+ var _this = this;
190
+ var _b = _a.idleTimeout, idleTimeout = _b === void 0 ? 15000 : _b, _c = _a.rrwebConfig, _d = _c === void 0 ? {} : _c, _e = _d.maskAllInputs, maskAllInputs = _e === void 0 ? true : _e, rrwebRecordOptions = __rest(_d, ["maskAllInputs"]);
191
+ /**
192
+ * @inheritDoc
193
+ */
194
+ this.name = SentryReplay.id;
195
+ /**
196
+ * Buffer of rrweb events that will be serialized as JSON and saved as an attachment to a Sentry event
197
+ */
198
+ this.events = [];
199
+ this.performanceEvents = [];
200
+ this.performanceObserver = null;
201
+ /**
202
+ * Keep a list of performance entries that will be sent with a replay
203
+ */
204
+ this.handlePerformanceObserver = function (list
205
+ // observer: PerformanceObserver
206
+ ) {
207
+ _this.performanceEvents = __spreadArray(__spreadArray([], _this.performanceEvents, true), list.getEntries(), true);
208
+ };
209
+ /**
210
+ * Handle when visibility of the page changes. (e.g. new tab is opened)
211
+ */
212
+ this.handleVisibilityChange = function () {
213
+ if (document.visibilityState === 'visible' &&
214
+ _this.visibilityChangeTimer === null) {
215
+ // Page has become active/visible again after `VISIBILITY_CHANGE_TIMEOUT`
216
+ // ms have elapsed, which means we will consider this a new session
217
+ //
218
+ // TBD if this is the behavior we want
219
+ _this.isDebug &&
220
+ utils.logger.log('[Replay] document has become active, creating new "session"');
221
+ _this.triggerNewSession();
222
+ return;
223
+ }
224
+ // Send replay when the page/tab becomes hidden
225
+ _this.finishReplayEvent();
226
+ // VISIBILITY_CHANGE_TIMEOUT gives the user buffer room to come back to the
227
+ // page before we create a new session.
228
+ _this.visibilityChangeTimer = window.setTimeout(function () {
229
+ _this.visibilityChangeTimer = null;
230
+ }, VISIBILITY_CHANGE_TIMEOUT);
231
+ };
232
+ this.rrwebRecordOptions = __assign({ maskAllInputs: maskAllInputs }, rrwebRecordOptions);
233
+ // Creates a new replay ID everytime we initialize the plugin (e.g. on every pageload).
234
+ // TBD on behavior here (e.g. should this be saved to localStorage/cookies)
235
+ this.replayId = utils.uuid4();
236
+ this.events = [];
237
+ rrweb.record(__assign(__assign({}, this.rrwebRecordOptions), { emit: function (event, isCheckout) {
238
+ // "debounce" by `idleTimeout`, how often we save replay events i.e. we
239
+ // will save events only if 15 seconds have elapsed since the last
240
+ // event
241
+ //
242
+ // TODO: We probably want to have a hard timeout where we save
243
+ // so that it does not grow infinitely and we never have a replay
244
+ // saved
245
+ if (_this.timeout) {
246
+ window.clearTimeout(_this.timeout);
247
+ }
248
+ // Always create a new Sentry event on checkouts and clear existing rrweb events
249
+ if (isCheckout) {
250
+ console.log('$$$$$ IS CHECKOUT');
251
+ _this.events = [event];
252
+ }
253
+ else {
254
+ _this.events.push(event);
255
+ }
256
+ // Set timer to send attachment to Sentry, will be cancelled if an
257
+ // event happens before `idleTimeout` elapses
258
+ _this.timeout = window.setTimeout(function () {
259
+ _this.isDebug &&
260
+ utils.logger.log('[Replay] rrweb timeout hit, finishing replay event');
261
+ _this.finishReplayEvent();
262
+ }, idleTimeout);
263
+ } }));
264
+ this.addListeners();
265
+ }
266
+ SentryReplay.attachmentUrlFromDsn = function (dsn, eventId) {
267
+ var host = dsn.host, path = dsn.path, projectId = dsn.projectId, port = dsn.port, protocol = dsn.protocol, user = dsn.user;
268
+ return "".concat(protocol, "://").concat(host).concat(port !== '' ? ":".concat(port) : '').concat(path !== '' ? "/".concat(path) : '', "/api/").concat(projectId, "/events/").concat(eventId, "/attachments/?sentry_key=").concat(user, "&sentry_version=7&sentry_client=replay");
269
+ };
270
+ Object.defineProperty(SentryReplay.prototype, "isDebug", {
271
+ get: function () {
272
+ return utils.isDebugBuild();
273
+ },
274
+ enumerable: false,
275
+ configurable: true
276
+ });
277
+ Object.defineProperty(SentryReplay.prototype, "instance", {
278
+ /**
279
+ * Get integration's instance on the current hub
280
+ */
281
+ get: function () {
282
+ return Sentry__namespace.getCurrentHub().getIntegration(SentryReplay);
283
+ },
284
+ enumerable: false,
285
+ configurable: true
286
+ });
287
+ SentryReplay.prototype.setupOnce = function () {
288
+ var _this = this;
289
+ // Tag all (non replay) events that get sent to Sentry with the current
290
+ // replay ID so that we can reference them later in the UI
291
+ Sentry__namespace.addGlobalEventProcessor(function (event) {
292
+ event.tags = __assign(__assign({}, event.tags), { replayId: _this.replayId });
293
+ return event;
294
+ });
295
+ // XXX: this needs to be in `setupOnce` vs `constructor`, otherwise SDK is
296
+ // not fully initialized and the event will not get properly sent to Sentry
297
+ this.createRootEvent();
298
+ this.createReplayEvent();
299
+ };
300
+ SentryReplay.prototype.addListeners = function () {
301
+ document.addEventListener('visibilitychange', this.handleVisibilityChange);
302
+ if ('PerformanceObserver' in window) {
303
+ this.performanceObserver = new PerformanceObserver(this.handlePerformanceObserver);
304
+ // Observe everything for now
305
+ this.performanceObserver.observe({
306
+ entryTypes: __spreadArray([], PerformanceObserver.supportedEntryTypes, true),
307
+ });
308
+ }
309
+ };
310
+ /**
311
+ * Creates a new replay "session". This will create a new Sentry event and
312
+ * then trigger rrweb to take a full snapshot.
313
+ */
314
+ SentryReplay.prototype.triggerNewSession = function () {
315
+ this.isDebug && utils.logger.log('[Replay] taking full rrweb snapshot');
316
+ rrweb.record.takeFullSnapshot(true);
317
+ };
318
+ /**
319
+ * Creates the Sentry event that all replays will be saved to as attachments.
320
+ * Currently, we only expect one of these per "replay session" (which is not
321
+ * explicitly defined yet).
322
+ */
323
+ SentryReplay.prototype.createRootEvent = function () {
324
+ // TODO: Figure out if we need to do this, when this gets called from `setupOnce`, `this.instance` is still undefined.
325
+ // if (!this.instance) return;
326
+ this.isDebug && utils.logger.log("[Replay] creating root replay event");
327
+ // Create a transaction to attach event to
328
+ var transaction = Sentry__namespace.getCurrentHub().startTransaction({
329
+ name: 'sentry-replay',
330
+ tags: {
331
+ hasReplay: 'yes',
332
+ replayId: this.replayId,
333
+ },
334
+ });
335
+ // We have to finish the transaction to get an event ID to be able to
336
+ // upload an attachment for that event
337
+ // @ts-expect-error This returns an eventId (string), but is not typed as such
338
+ this.eventId = transaction.finish();
339
+ return this.eventId;
340
+ };
341
+ /**
342
+ * This is our pseudo replay event disguised as a transaction. It will be
343
+ * used to store performance entries and breadcrumbs for every incremental
344
+ * replay event.
345
+ **/
346
+ SentryReplay.prototype.createReplayEvent = function () {
347
+ var _this = this;
348
+ console.log('createReplayEvent rootReplayId', this.eventId);
349
+ this.replayEvent = Sentry__namespace.startTransaction({
350
+ name: 'sentry-replay-event',
351
+ tags: {
352
+ rootReplayId: this.eventId,
353
+ replayId: this.replayId,
354
+ },
355
+ });
356
+ Sentry__namespace.configureScope(function (scope) { return scope.setSpan(_this.replayEvent); });
357
+ return this.replayEvent;
358
+ };
359
+ /**
360
+ * Create a span for each performance entry. The parent transaction is `this.replayEvent`.
361
+ */
362
+ SentryReplay.prototype.createPerformanceSpans = function (entries) {
363
+ var _this = this;
364
+ entries.forEach(function (_a) {
365
+ var _b;
366
+ var type = _a.type, start = _a.start, end = _a.end, name = _a.name, data = _a.data;
367
+ var span = (_b = _this.replayEvent) === null || _b === void 0 ? void 0 : _b.startChild({
368
+ op: type,
369
+ description: name,
370
+ startTimestamp: start,
371
+ data: data,
372
+ });
373
+ span.finish(end);
374
+ });
375
+ };
376
+ /**
377
+ * Observed performance events are added to `this.performanceEvents`. These
378
+ * are included in the replay event before it is finished and sent to Sentry.
379
+ */
380
+ SentryReplay.prototype.addPerformanceEntries = function () {
381
+ // Copy and reset entries before processing
382
+ var entries = __spreadArray([], this.performanceEvents, true);
383
+ this.performanceEvents = [];
384
+ // Parse the entries
385
+ var entryEvents = createPerformanceEntries(entries);
386
+ // This current implementation is to create spans on the transaction referenced in `this.replayEvent`
387
+ this.createPerformanceSpans(entryEvents);
388
+ };
389
+ SentryReplay.prototype.finishReplayEvent = function () {
390
+ // if (!this.instance) return;
391
+ var _a;
392
+ var eventId = this.eventId || this.createRootEvent();
393
+ if (!eventId) {
394
+ console.error('[Sentry]: No transaction, no replay');
395
+ return;
396
+ }
397
+ this.sendReplay(eventId);
398
+ // include performance entries
399
+ this.addPerformanceEntries();
400
+ // Close out existing replay event and create a new one
401
+ (_a = this.replayEvent) === null || _a === void 0 ? void 0 : _a.setStatus('ok').finish();
402
+ this.createReplayEvent();
403
+ };
404
+ /**
405
+ * Determine if there is browser support for `navigator.sendBeacon`
406
+ */
407
+ SentryReplay.prototype.hasSendBeacon = function () {
408
+ return 'navigator' in window && 'sendBeacon' in window.navigator;
409
+ };
410
+ /**
411
+ * Send replay attachment using either `sendBeacon()` or `fetch()`
412
+ */
413
+ SentryReplay.prototype.sendReplayRequest = function (endpoint, events) {
414
+ return __awaiter(this, void 0, void 0, function () {
415
+ var stringifiedPayload, formData, ex_1;
416
+ return __generator(this, function (_a) {
417
+ switch (_a.label) {
418
+ case 0:
419
+ stringifiedPayload = JSON.stringify({ events: events });
420
+ formData = new FormData();
421
+ formData.append('rrweb', new Blob([stringifiedPayload], {
422
+ type: 'application/json',
423
+ }), "rrweb-".concat(new Date().getTime(), ".json"));
424
+ // If sendBeacon is supported and payload is smol enough...
425
+ if (this.hasSendBeacon() && stringifiedPayload.length <= 65536) {
426
+ this.isDebug &&
427
+ utils.logger.log("[Replay] uploading attachment via sendBeacon()");
428
+ window.navigator.sendBeacon(endpoint, formData);
429
+ return [2 /*return*/];
430
+ }
431
+ _a.label = 1;
432
+ case 1:
433
+ _a.trys.push([1, 3, , 4]);
434
+ this.isDebug && utils.logger.log("[Replay] uploading attachment via fetch()");
435
+ // Otherwise use `fetch`, which *WILL* get cancelled on page reloads/unloads
436
+ return [4 /*yield*/, fetch(endpoint, {
437
+ method: 'POST',
438
+ body: formData,
439
+ })];
440
+ case 2:
441
+ // Otherwise use `fetch`, which *WILL* get cancelled on page reloads/unloads
442
+ _a.sent();
443
+ return [3 /*break*/, 4];
444
+ case 3:
445
+ ex_1 = _a.sent();
446
+ // we have to catch this otherwise it throws an infinite loop in Sentry
447
+ console.error(ex_1);
448
+ return [3 /*break*/, 4];
449
+ case 4: return [2 /*return*/];
450
+ }
451
+ });
452
+ });
453
+ };
454
+ /**
455
+ * Finalize and send the current replay event to Sentry
456
+ */
457
+ SentryReplay.prototype.sendReplay = function (eventId) {
458
+ return __awaiter(this, void 0, void 0, function () {
459
+ var client, endpoint, ex_2;
460
+ return __generator(this, function (_a) {
461
+ switch (_a.label) {
462
+ case 0:
463
+ _a.trys.push([0, 2, , 3]);
464
+ // short circuit if theres no events to replay
465
+ if (!this.events.length)
466
+ return [2 /*return*/];
467
+ client = Sentry__namespace.getCurrentHub().getClient();
468
+ endpoint = SentryReplay.attachmentUrlFromDsn(client.getDsn(), eventId);
469
+ return [4 /*yield*/, this.sendReplayRequest(endpoint, this.events)];
470
+ case 1:
471
+ _a.sent();
472
+ this.events = [];
473
+ return [2 /*return*/, true];
474
+ case 2:
475
+ ex_2 = _a.sent();
476
+ console.error(ex_2);
477
+ return [2 /*return*/, false];
478
+ case 3: return [2 /*return*/];
479
+ }
480
+ });
481
+ });
482
+ };
483
+ /**
484
+ * @inheritDoc
485
+ */
486
+ SentryReplay.id = 'Replay';
487
+ return SentryReplay;
488
+ }());
489
+
490
+ exports.SentryReplay = SentryReplay;
491
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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,S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AAO,KAAK,CAAC,CAAA;;;;;AAEhB,KAAA,CAAA;AAtWD;;AAEG;IACW,YAAE,CAAA,EAAA,GAAG,QAAQ,CAAC;IAoW9B,OAAC,YAAA,CAAA;AAAA,CAxWD,EAwWC;;;;"}
package/package.json ADDED
@@ -0,0 +1,73 @@
1
+ {
2
+ "name": "@sentry/replay",
3
+ "version": "0.2.0-0",
4
+ "description": "User replays for Sentry",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.es.js",
7
+ "scripts": {
8
+ "bootstrap": "yarn && cd demo && yarn",
9
+ "build": "yarn rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript",
10
+ "clean": "yarn rimraf dist",
11
+ "lint": "yarn eslint . --ext .js,.jsx,.ts,.tsx",
12
+ "prepare": "husky install",
13
+ "start:demo": "yarn build && cd demo && yarn start",
14
+ "test": "yarn jest",
15
+ "watch": "yarn build --watch"
16
+ },
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/getsentry/sentry-replay.git"
23
+ },
24
+ "author": "Sentry",
25
+ "license": "Apache-2.0",
26
+ "bugs": {
27
+ "url": "https://github.com/getsentry/sentry-replay/issues"
28
+ },
29
+ "homepage": "https://github.com/getsentry/sentry-replay#readme",
30
+ "peerDependencies": {
31
+ "@sentry/browser": ">=6.0.0",
32
+ "@sentry/tracing": ">=6.0.0",
33
+ "@sentry/utils": ">=6.0.0",
34
+ "rrweb": ">=0.7.0"
35
+ },
36
+ "devDependencies": {
37
+ "@babel/core": "^7.17.5",
38
+ "@rollup/plugin-typescript": "^8.3.1",
39
+ "@sentry/browser": "^6.19.1",
40
+ "@sentry/tracing": "^6.19.1",
41
+ "@sentry/types": "^6.19.1",
42
+ "@sentry/utils": "^6.19.1",
43
+ "@types/jest": "^27.4.1",
44
+ "@types/node": "^16.0.0",
45
+ "@typescript-eslint/eslint-plugin": "^5.14.0",
46
+ "@typescript-eslint/parser": "^5.14.0",
47
+ "eslint": "^8.10.0",
48
+ "eslint-config-prettier": "^8.5.0",
49
+ "eslint-plugin-prettier": "^4.0.0",
50
+ "husky": ">=6",
51
+ "jest": "^27.5.1",
52
+ "lint-staged": ">=10",
53
+ "prettier": "^2.5.1",
54
+ "rimraf": "^3.0.2",
55
+ "rollup": "^2.70.0",
56
+ "rrweb": "^1.1.2",
57
+ "ts-jest": "^27.1.3",
58
+ "ts-node": "^10.7.0",
59
+ "tslib": "^2.3.1",
60
+ "typescript": "^4.6.2"
61
+ },
62
+ "dependencies": {},
63
+ "prettier": {
64
+ "singleQuote": true
65
+ },
66
+ "volta": {
67
+ "node": "14.19.0",
68
+ "yarn": "1.22.17"
69
+ },
70
+ "lint-staged": {
71
+ "*.{js,jsx,ts,tsx}": "yarn eslint --cache --fix"
72
+ }
73
+ }