@myinterview/widget-react 1.0.56 → 1.0.57

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/cjs/index.js CHANGED
@@ -28,7 +28,7 @@ function _interopNamespace(e) {
28
28
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
29
29
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
30
30
 
31
- var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
31
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
32
32
 
33
33
  function getDefaultExportFromCjs (x) {
34
34
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -7656,7 +7656,7 @@ function useMachine(getMachine) {
7656
7656
  ? State.create(options.state)
7657
7657
  : service.machine.initialState);
7658
7658
  }
7659
- return service.state;
7659
+ return service.getSnapshot();
7660
7660
  }, [service]);
7661
7661
  var isEqual = React.useCallback(function (prevState, nextState) {
7662
7662
  if (service.status === InterpreterStatus.NotStarted) {
@@ -7688,6 +7688,42 @@ function useMachine(getMachine) {
7688
7688
  return [storeSnapshot, service.send, service];
7689
7689
  }
7690
7690
 
7691
+ (undefined && undefined.__read) || function (o, n) {
7692
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
7693
+ if (!m) return o;
7694
+ var i = m.call(o), r, ar = [], e;
7695
+ try {
7696
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
7697
+ }
7698
+ catch (error) { e = { error: error }; }
7699
+ finally {
7700
+ try {
7701
+ if (r && !r.done && (m = i["return"])) m.call(i);
7702
+ }
7703
+ finally { if (e) throw e.error; }
7704
+ }
7705
+ return ar;
7706
+ };
7707
+ (undefined && undefined.__values) || function(o) {
7708
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
7709
+ if (m) return m.call(o);
7710
+ if (o && typeof o.length === "number") return {
7711
+ next: function () {
7712
+ if (o && i >= o.length) o = void 0;
7713
+ return { value: o && o[i++], done: !o };
7714
+ }
7715
+ };
7716
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
7717
+ };
7718
+ function getServiceSnapshot(service) {
7719
+ return service.status !== 0
7720
+ ? service.getSnapshot()
7721
+ : service.machine.initialState;
7722
+ }
7723
+ function isService(actor) {
7724
+ return 'state' in actor && 'machine' in actor;
7725
+ }
7726
+
7691
7727
  function isActorWithState(actorRef) {
7692
7728
  return 'state' in actorRef;
7693
7729
  }
@@ -7696,7 +7732,9 @@ function isDeferredActor(actorRef) {
7696
7732
  }
7697
7733
  function defaultGetSnapshot(actorRef) {
7698
7734
  return 'getSnapshot' in actorRef
7699
- ? actorRef.getSnapshot()
7735
+ ? isService(actorRef)
7736
+ ? getServiceSnapshot(actorRef)
7737
+ : actorRef.getSnapshot()
7700
7738
  : isActorWithState(actorRef)
7701
7739
  ? actorRef.state
7702
7740
  : undefined;
@@ -7745,34 +7783,6 @@ function useActor(actorRef, getSnapshot) {
7745
7783
  return [storeSnapshot, send];
7746
7784
  }
7747
7785
 
7748
- (undefined && undefined.__read) || function (o, n) {
7749
- var m = typeof Symbol === "function" && o[Symbol.iterator];
7750
- if (!m) return o;
7751
- var i = m.call(o), r, ar = [], e;
7752
- try {
7753
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
7754
- }
7755
- catch (error) { e = { error: error }; }
7756
- finally {
7757
- try {
7758
- if (r && !r.done && (m = i["return"])) m.call(i);
7759
- }
7760
- finally { if (e) throw e.error; }
7761
- }
7762
- return ar;
7763
- };
7764
- (undefined && undefined.__values) || function(o) {
7765
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
7766
- if (m) return m.call(o);
7767
- if (o && typeof o.length === "number") return {
7768
- next: function () {
7769
- if (o && i >= o.length) o = void 0;
7770
- return { value: o && o[i++], done: !o };
7771
- }
7772
- };
7773
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
7774
- };
7775
-
7776
7786
  var SPEED_TEST_LEVEL;
7777
7787
  (function (SPEED_TEST_LEVEL) {
7778
7788
  SPEED_TEST_LEVEL[SPEED_TEST_LEVEL["LOW"] = 0] = "LOW";
@@ -8828,7 +8838,7 @@ var platform$1 = {exports: {}};
8828
8838
  var freeModule = module && !module.nodeType && module;
8829
8839
 
8830
8840
  /** Detect free variable `global` from Node.js or Browserified code and use it as `root`. */
8831
- var freeGlobal = freeExports && freeModule && typeof commonjsGlobal$1 == 'object' && commonjsGlobal$1;
8841
+ var freeGlobal = freeExports && freeModule && typeof commonjsGlobal == 'object' && commonjsGlobal;
8832
8842
  if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) {
8833
8843
  root = freeGlobal;
8834
8844
  }
@@ -10041,7 +10051,7 @@ var platform$1 = {exports: {}};
10041
10051
  // Export to the global object.
10042
10052
  root.platform = platform;
10043
10053
  }
10044
- }.call(commonjsGlobal$1));
10054
+ }.call(commonjsGlobal));
10045
10055
  } (platform$1, platform$1.exports));
10046
10056
 
10047
10057
  var platform = platform$1.exports;
@@ -14970,7 +14980,7 @@ const Explanation = ({ isVideoQuestion, thinkingTime }) => {
14970
14980
  };
14971
14981
 
14972
14982
  // eslint-disable-next-line @typescript-eslint/unbound-method
14973
- const objectToString$1 = Object.prototype.toString;
14983
+ const objectToString = Object.prototype.toString;
14974
14984
 
14975
14985
  /**
14976
14986
  * Checks whether given value's type is one of a few Error or Error-like
@@ -14980,7 +14990,7 @@ const objectToString$1 = Object.prototype.toString;
14980
14990
  * @returns A boolean representing the result.
14981
14991
  */
14982
14992
  function isError(wat) {
14983
- switch (objectToString$1.call(wat)) {
14993
+ switch (objectToString.call(wat)) {
14984
14994
  case '[object Error]':
14985
14995
  case '[object Exception]':
14986
14996
  case '[object DOMException]':
@@ -14997,7 +15007,7 @@ function isError(wat) {
14997
15007
  * @returns A boolean representing the result.
14998
15008
  */
14999
15009
  function isBuiltin(wat, className) {
15000
- return objectToString$1.call(wat) === `[object ${className}]`;
15010
+ return objectToString.call(wat) === `[object ${className}]`;
15001
15011
  }
15002
15012
 
15003
15013
  /**
@@ -15714,9 +15724,7 @@ function urlEncode(object) {
15714
15724
  * @returns An Event or Error turned into an object - or the value argurment itself, when value is neither an Event nor
15715
15725
  * an Error.
15716
15726
  */
15717
- function convertToPlainObject(
15718
- value,
15719
- )
15727
+ function convertToPlainObject(value)
15720
15728
 
15721
15729
  {
15722
15730
  if (isError(value)) {
@@ -15909,6 +15917,14 @@ function createStackParser(...parsers) {
15909
15917
  const frames = [];
15910
15918
 
15911
15919
  for (const line of stack.split('\n').slice(skipFirst)) {
15920
+ // Ignore lines over 1kb as they are unlikely to be stack frames.
15921
+ // Many of the regular expressions use backtracking which results in run time that increases exponentially with
15922
+ // input size. Huge strings can result in hangs/Denial of Service:
15923
+ // https://github.com/getsentry/sentry-javascript/issues/2286
15924
+ if (line.length > 1024) {
15925
+ continue;
15926
+ }
15927
+
15912
15928
  // https://github.com/getsentry/sentry-javascript/issues/5459
15913
15929
  // Remove webpack (error: *) wrappers
15914
15930
  const cleanedLine = line.replace(/\(error: (.*)\)/, '$1');
@@ -17723,6 +17739,8 @@ const ITEM_TYPE_TO_DATA_CATEGORY_MAP = {
17723
17739
  client_report: 'internal',
17724
17740
  user_report: 'default',
17725
17741
  profile: 'profile',
17742
+ replay_event: 'replay_event',
17743
+ replay_recording: 'replay_recording',
17726
17744
  };
17727
17745
 
17728
17746
  /**
@@ -18741,7 +18759,7 @@ class Hub {
18741
18759
  */
18742
18760
  captureEvent(event, hint) {
18743
18761
  const eventId = hint && hint.event_id ? hint.event_id : uuid4();
18744
- if (event.type !== 'transaction') {
18762
+ if (!event.type) {
18745
18763
  this._lastEventId = eventId;
18746
18764
  }
18747
18765
 
@@ -18766,7 +18784,6 @@ class Hub {
18766
18784
 
18767
18785
  if (!scope || !client) return;
18768
18786
 
18769
- // eslint-disable-next-line @typescript-eslint/unbound-method
18770
18787
  const { beforeBreadcrumb = null, maxBreadcrumbs = DEFAULT_BREADCRUMBS } =
18771
18788
  (client.getOptions && client.getOptions()) || {};
18772
18789
 
@@ -19260,7 +19277,15 @@ function createEventEnvelope(
19260
19277
  tunnel,
19261
19278
  ) {
19262
19279
  const sdkInfo = getSdkMetadataForEnvelopeHeader(metadata);
19263
- const eventType = event.type || 'event';
19280
+
19281
+ /*
19282
+ Note: Due to TS, event.type may be `replay_event`, theoretically.
19283
+ In practice, we never call `createEventEnvelope` with `replay_event` type,
19284
+ and we'd have to adjut a looot of types to make this work properly.
19285
+ We want to avoid casting this around, as that could lead to bugs (e.g. when we add another type)
19286
+ So the safe choice is to really guard against the replay_event type here.
19287
+ */
19288
+ const eventType = event.type && event.type !== 'replay_event' ? event.type : 'event';
19264
19289
 
19265
19290
  enhanceEventWithSdkInfo(event, metadata && metadata.sdk);
19266
19291
 
@@ -19288,16 +19313,209 @@ function setupIntegrations(integrations) {
19288
19313
  const integrationIndex = {};
19289
19314
 
19290
19315
  integrations.forEach(integration => {
19291
- integrationIndex[integration.name] = integration;
19316
+ setupIntegration(integration, integrationIndex);
19317
+ });
19318
+
19319
+ return integrationIndex;
19320
+ }
19321
+
19322
+ /** Setup a single integration. */
19323
+ function setupIntegration(integration, integrationIndex) {
19324
+ integrationIndex[integration.name] = integration;
19325
+
19326
+ if (installedIntegrations.indexOf(integration.name) === -1) {
19327
+ integration.setupOnce(addGlobalEventProcessor, getCurrentHub);
19328
+ installedIntegrations.push(integration.name);
19329
+ (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger.log(`Integration installed: ${integration.name}`);
19330
+ }
19331
+ }
19332
+
19333
+ /**
19334
+ * Adds common information to events.
19335
+ *
19336
+ * The information includes release and environment from `options`,
19337
+ * breadcrumbs and context (extra, tags and user) from the scope.
19338
+ *
19339
+ * Information that is already present in the event is never overwritten. For
19340
+ * nested objects, such as the context, keys are merged.
19341
+ *
19342
+ * Note: This also triggers callbacks for `addGlobalEventProcessor`, but not `beforeSend`.
19343
+ *
19344
+ * @param event The original event.
19345
+ * @param hint May contain additional information about the original exception.
19346
+ * @param scope A scope containing event metadata.
19347
+ * @returns A new event with more information.
19348
+ * @hidden
19349
+ */
19350
+ function prepareEvent(
19351
+ options,
19352
+ event,
19353
+ hint,
19354
+ scope,
19355
+ ) {
19356
+ const { normalizeDepth = 3, normalizeMaxBreadth = 1000 } = options;
19357
+ const prepared = {
19358
+ ...event,
19359
+ event_id: event.event_id || hint.event_id || uuid4(),
19360
+ timestamp: event.timestamp || dateTimestampInSeconds(),
19361
+ };
19362
+
19363
+ applyClientOptions(prepared, options);
19364
+ applyIntegrationsMetadata(
19365
+ prepared,
19366
+ options.integrations.map(i => i.name),
19367
+ );
19368
+
19369
+ // If we have scope given to us, use it as the base for further modifications.
19370
+ // This allows us to prevent unnecessary copying of data if `captureContext` is not provided.
19371
+ let finalScope = scope;
19372
+ if (hint.captureContext) {
19373
+ finalScope = Scope.clone(finalScope).update(hint.captureContext);
19374
+ }
19375
+
19376
+ // We prepare the result here with a resolved Event.
19377
+ let result = resolvedSyncPromise(prepared);
19292
19378
 
19293
- if (installedIntegrations.indexOf(integration.name) === -1) {
19294
- integration.setupOnce(addGlobalEventProcessor, getCurrentHub);
19295
- installedIntegrations.push(integration.name);
19296
- (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger.log(`Integration installed: ${integration.name}`);
19379
+ // This should be the last thing called, since we want that
19380
+ // {@link Hub.addEventProcessor} gets the finished prepared event.
19381
+ //
19382
+ // We need to check for the existence of `finalScope.getAttachments`
19383
+ // because `getAttachments` can be undefined if users are using an older version
19384
+ // of `@sentry/core` that does not have the `getAttachments` method.
19385
+ // See: https://github.com/getsentry/sentry-javascript/issues/5229
19386
+ if (finalScope) {
19387
+ // Collect attachments from the hint and scope
19388
+ if (finalScope.getAttachments) {
19389
+ const attachments = [...(hint.attachments || []), ...finalScope.getAttachments()];
19390
+
19391
+ if (attachments.length) {
19392
+ hint.attachments = attachments;
19393
+ }
19297
19394
  }
19395
+
19396
+ // In case we have a hub we reassign it.
19397
+ result = finalScope.applyToEvent(prepared, hint);
19398
+ }
19399
+
19400
+ return result.then(evt => {
19401
+ if (typeof normalizeDepth === 'number' && normalizeDepth > 0) {
19402
+ return normalizeEvent(evt, normalizeDepth, normalizeMaxBreadth);
19403
+ }
19404
+ return evt;
19298
19405
  });
19406
+ }
19299
19407
 
19300
- return integrationIndex;
19408
+ /**
19409
+ * Enhances event using the client configuration.
19410
+ * It takes care of all "static" values like environment, release and `dist`,
19411
+ * as well as truncating overly long values.
19412
+ * @param event event instance to be enhanced
19413
+ */
19414
+ function applyClientOptions(event, options) {
19415
+ const { environment, release, dist, maxValueLength = 250 } = options;
19416
+
19417
+ if (!('environment' in event)) {
19418
+ event.environment = 'environment' in options ? environment : 'production';
19419
+ }
19420
+
19421
+ if (event.release === undefined && release !== undefined) {
19422
+ event.release = release;
19423
+ }
19424
+
19425
+ if (event.dist === undefined && dist !== undefined) {
19426
+ event.dist = dist;
19427
+ }
19428
+
19429
+ if (event.message) {
19430
+ event.message = truncate(event.message, maxValueLength);
19431
+ }
19432
+
19433
+ const exception = event.exception && event.exception.values && event.exception.values[0];
19434
+ if (exception && exception.value) {
19435
+ exception.value = truncate(exception.value, maxValueLength);
19436
+ }
19437
+
19438
+ const request = event.request;
19439
+ if (request && request.url) {
19440
+ request.url = truncate(request.url, maxValueLength);
19441
+ }
19442
+ }
19443
+
19444
+ /**
19445
+ * This function adds all used integrations to the SDK info in the event.
19446
+ * @param event The event that will be filled with all integrations.
19447
+ */
19448
+ function applyIntegrationsMetadata(event, integrationNames) {
19449
+ if (integrationNames.length > 0) {
19450
+ event.sdk = event.sdk || {};
19451
+ event.sdk.integrations = [...(event.sdk.integrations || []), ...integrationNames];
19452
+ }
19453
+ }
19454
+
19455
+ /**
19456
+ * Applies `normalize` function on necessary `Event` attributes to make them safe for serialization.
19457
+ * Normalized keys:
19458
+ * - `breadcrumbs.data`
19459
+ * - `user`
19460
+ * - `contexts`
19461
+ * - `extra`
19462
+ * @param event Event
19463
+ * @returns Normalized event
19464
+ */
19465
+ function normalizeEvent(event, depth, maxBreadth) {
19466
+ if (!event) {
19467
+ return null;
19468
+ }
19469
+
19470
+ const normalized = {
19471
+ ...event,
19472
+ ...(event.breadcrumbs && {
19473
+ breadcrumbs: event.breadcrumbs.map(b => ({
19474
+ ...b,
19475
+ ...(b.data && {
19476
+ data: normalize(b.data, depth, maxBreadth),
19477
+ }),
19478
+ })),
19479
+ }),
19480
+ ...(event.user && {
19481
+ user: normalize(event.user, depth, maxBreadth),
19482
+ }),
19483
+ ...(event.contexts && {
19484
+ contexts: normalize(event.contexts, depth, maxBreadth),
19485
+ }),
19486
+ ...(event.extra && {
19487
+ extra: normalize(event.extra, depth, maxBreadth),
19488
+ }),
19489
+ };
19490
+
19491
+ // event.contexts.trace stores information about a Transaction. Similarly,
19492
+ // event.spans[] stores information about child Spans. Given that a
19493
+ // Transaction is conceptually a Span, normalization should apply to both
19494
+ // Transactions and Spans consistently.
19495
+ // For now the decision is to skip normalization of Transactions and Spans,
19496
+ // so this block overwrites the normalized event to add back the original
19497
+ // Transaction information prior to normalization.
19498
+ if (event.contexts && event.contexts.trace && normalized.contexts) {
19499
+ normalized.contexts.trace = event.contexts.trace;
19500
+
19501
+ // event.contexts.trace.data may contain circular/dangerous data so we need to normalize it
19502
+ if (event.contexts.trace.data) {
19503
+ normalized.contexts.trace.data = normalize(event.contexts.trace.data, depth, maxBreadth);
19504
+ }
19505
+ }
19506
+
19507
+ // event.spans[].data may contain circular/dangerous data so we need to normalize it
19508
+ if (event.spans) {
19509
+ normalized.spans = event.spans.map(span => {
19510
+ // We cannot use the spread operator here because `toJSON` on `span` is non-enumerable
19511
+ if (span.data) {
19512
+ span.data = normalize(span.data, depth, maxBreadth);
19513
+ }
19514
+ return span;
19515
+ });
19516
+ }
19517
+
19518
+ return normalized;
19301
19519
  }
19302
19520
 
19303
19521
  const ALREADY_SEEN_ERROR = "Not capturing exception because it's already been captured.";
@@ -19474,6 +19692,15 @@ class BaseClient {
19474
19692
  return this._options;
19475
19693
  }
19476
19694
 
19695
+ /**
19696
+ * @see SdkMetadata in @sentry/types
19697
+ *
19698
+ * @return The metadata of the SDK
19699
+ */
19700
+ getSdkMetadata() {
19701
+ return this._options._metadata;
19702
+ }
19703
+
19477
19704
  /**
19478
19705
  * @inheritDoc
19479
19706
  */
@@ -19536,6 +19763,13 @@ class BaseClient {
19536
19763
  }
19537
19764
  }
19538
19765
 
19766
+ /**
19767
+ * @inheritDoc
19768
+ */
19769
+ addIntegration(integration) {
19770
+ setupIntegration(integration, this._integrations);
19771
+ }
19772
+
19539
19773
  /**
19540
19774
  * @inheritDoc
19541
19775
  */
@@ -19574,7 +19808,7 @@ class BaseClient {
19574
19808
  // Note: we use `event` in replay, where we overwrite this hook.
19575
19809
 
19576
19810
  if (this._options.sendClientReports) {
19577
- // We want to track each category (error, transaction, session) separately
19811
+ // We want to track each category (error, transaction, session, replay_event) separately
19578
19812
  // but still keep the distinction between different type of outcomes.
19579
19813
  // We could use nested maps, but it's much easier to read and type this way.
19580
19814
  // A correct type for map-based implementation if we want to go that route
@@ -19671,166 +19905,8 @@ class BaseClient {
19671
19905
  * @returns A new event with more information.
19672
19906
  */
19673
19907
  _prepareEvent(event, hint, scope) {
19674
- const { normalizeDepth = 3, normalizeMaxBreadth = 1000 } = this.getOptions();
19675
- const prepared = {
19676
- ...event,
19677
- event_id: event.event_id || hint.event_id || uuid4(),
19678
- timestamp: event.timestamp || dateTimestampInSeconds(),
19679
- };
19680
-
19681
- this._applyClientOptions(prepared);
19682
- this._applyIntegrationsMetadata(prepared);
19683
-
19684
- // If we have scope given to us, use it as the base for further modifications.
19685
- // This allows us to prevent unnecessary copying of data if `captureContext` is not provided.
19686
- let finalScope = scope;
19687
- if (hint.captureContext) {
19688
- finalScope = Scope.clone(finalScope).update(hint.captureContext);
19689
- }
19690
-
19691
- // We prepare the result here with a resolved Event.
19692
- let result = resolvedSyncPromise(prepared);
19693
-
19694
- // This should be the last thing called, since we want that
19695
- // {@link Hub.addEventProcessor} gets the finished prepared event.
19696
- //
19697
- // We need to check for the existence of `finalScope.getAttachments`
19698
- // because `getAttachments` can be undefined if users are using an older version
19699
- // of `@sentry/core` that does not have the `getAttachments` method.
19700
- // See: https://github.com/getsentry/sentry-javascript/issues/5229
19701
- if (finalScope && finalScope.getAttachments) {
19702
- // Collect attachments from the hint and scope
19703
- const attachments = [...(hint.attachments || []), ...finalScope.getAttachments()];
19704
-
19705
- if (attachments.length) {
19706
- hint.attachments = attachments;
19707
- }
19708
-
19709
- // In case we have a hub we reassign it.
19710
- result = finalScope.applyToEvent(prepared, hint);
19711
- }
19712
-
19713
- return result.then(evt => {
19714
- if (typeof normalizeDepth === 'number' && normalizeDepth > 0) {
19715
- return this._normalizeEvent(evt, normalizeDepth, normalizeMaxBreadth);
19716
- }
19717
- return evt;
19718
- });
19719
- }
19720
-
19721
- /**
19722
- * Applies `normalize` function on necessary `Event` attributes to make them safe for serialization.
19723
- * Normalized keys:
19724
- * - `breadcrumbs.data`
19725
- * - `user`
19726
- * - `contexts`
19727
- * - `extra`
19728
- * @param event Event
19729
- * @returns Normalized event
19730
- */
19731
- _normalizeEvent(event, depth, maxBreadth) {
19732
- if (!event) {
19733
- return null;
19734
- }
19735
-
19736
- const normalized = {
19737
- ...event,
19738
- ...(event.breadcrumbs && {
19739
- breadcrumbs: event.breadcrumbs.map(b => ({
19740
- ...b,
19741
- ...(b.data && {
19742
- data: normalize(b.data, depth, maxBreadth),
19743
- }),
19744
- })),
19745
- }),
19746
- ...(event.user && {
19747
- user: normalize(event.user, depth, maxBreadth),
19748
- }),
19749
- ...(event.contexts && {
19750
- contexts: normalize(event.contexts, depth, maxBreadth),
19751
- }),
19752
- ...(event.extra && {
19753
- extra: normalize(event.extra, depth, maxBreadth),
19754
- }),
19755
- };
19756
-
19757
- // event.contexts.trace stores information about a Transaction. Similarly,
19758
- // event.spans[] stores information about child Spans. Given that a
19759
- // Transaction is conceptually a Span, normalization should apply to both
19760
- // Transactions and Spans consistently.
19761
- // For now the decision is to skip normalization of Transactions and Spans,
19762
- // so this block overwrites the normalized event to add back the original
19763
- // Transaction information prior to normalization.
19764
- if (event.contexts && event.contexts.trace && normalized.contexts) {
19765
- normalized.contexts.trace = event.contexts.trace;
19766
-
19767
- // event.contexts.trace.data may contain circular/dangerous data so we need to normalize it
19768
- if (event.contexts.trace.data) {
19769
- normalized.contexts.trace.data = normalize(event.contexts.trace.data, depth, maxBreadth);
19770
- }
19771
- }
19772
-
19773
- // event.spans[].data may contain circular/dangerous data so we need to normalize it
19774
- if (event.spans) {
19775
- normalized.spans = event.spans.map(span => {
19776
- // We cannot use the spread operator here because `toJSON` on `span` is non-enumerable
19777
- if (span.data) {
19778
- span.data = normalize(span.data, depth, maxBreadth);
19779
- }
19780
- return span;
19781
- });
19782
- }
19783
-
19784
- return normalized;
19785
- }
19786
-
19787
- /**
19788
- * Enhances event using the client configuration.
19789
- * It takes care of all "static" values like environment, release and `dist`,
19790
- * as well as truncating overly long values.
19791
- * @param event event instance to be enhanced
19792
- */
19793
- _applyClientOptions(event) {
19794
19908
  const options = this.getOptions();
19795
- const { environment, release, dist, maxValueLength = 250 } = options;
19796
-
19797
- if (!('environment' in event)) {
19798
- event.environment = 'environment' in options ? environment : 'production';
19799
- }
19800
-
19801
- if (event.release === undefined && release !== undefined) {
19802
- event.release = release;
19803
- }
19804
-
19805
- if (event.dist === undefined && dist !== undefined) {
19806
- event.dist = dist;
19807
- }
19808
-
19809
- if (event.message) {
19810
- event.message = truncate(event.message, maxValueLength);
19811
- }
19812
-
19813
- const exception = event.exception && event.exception.values && event.exception.values[0];
19814
- if (exception && exception.value) {
19815
- exception.value = truncate(exception.value, maxValueLength);
19816
- }
19817
-
19818
- const request = event.request;
19819
- if (request && request.url) {
19820
- request.url = truncate(request.url, maxValueLength);
19821
- }
19822
- }
19823
-
19824
- /**
19825
- * This function adds all used integrations to the SDK info in the event.
19826
- * @param event The event that will be filled with all integrations.
19827
- */
19828
- _applyIntegrationsMetadata(event) {
19829
- const integrationsArray = Object.keys(this._integrations);
19830
- if (integrationsArray.length > 0) {
19831
- event.sdk = event.sdk || {};
19832
- event.sdk.integrations = [...(event.sdk.integrations || []), ...integrationsArray];
19833
- }
19909
+ return prepareEvent(options, event, hint, scope);
19834
19910
  }
19835
19911
 
19836
19912
  /**
@@ -20085,7 +20161,9 @@ const DEFAULT_TRANSPORT_BUFFER_SIZE = 30;
20085
20161
  function createTransport(
20086
20162
  options,
20087
20163
  makeRequest,
20088
- buffer = makePromiseBuffer(options.bufferSize || DEFAULT_TRANSPORT_BUFFER_SIZE),
20164
+ buffer = makePromiseBuffer(
20165
+ options.bufferSize || DEFAULT_TRANSPORT_BUFFER_SIZE,
20166
+ ),
20089
20167
  ) {
20090
20168
  let rateLimits = {};
20091
20169
 
@@ -20130,10 +20208,11 @@ function createTransport(
20130
20208
  }
20131
20209
 
20132
20210
  rateLimits = updateRateLimits(rateLimits, response);
20211
+ return response;
20133
20212
  },
20134
20213
  error => {
20135
- (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger.error('Failed while sending event:', error);
20136
20214
  recordEnvelopeLoss('network_error');
20215
+ throw error;
20137
20216
  },
20138
20217
  );
20139
20218
 
@@ -20165,7 +20244,7 @@ function getEventForEnvelopeItem(item, type) {
20165
20244
  return Array.isArray(item) ? (item )[1] : undefined;
20166
20245
  }
20167
20246
 
20168
- const SDK_VERSION = '7.28.1';
20247
+ const SDK_VERSION = '7.30.0';
20169
20248
 
20170
20249
  let originalFunctionToString;
20171
20250
 
@@ -22117,7 +22196,7 @@ class HttpContext {constructor() { HttpContext.prototype.__init.call(this); }
22117
22196
  ...(referrer && { Referer: referrer }),
22118
22197
  ...(userAgent && { 'User-Agent': userAgent }),
22119
22198
  };
22120
- const request = { ...(url && { url }), headers };
22199
+ const request = { ...event.request, ...(url && { url }), headers };
22121
22200
 
22122
22201
  return { ...event, request };
22123
22202
  }
@@ -22374,387 +22453,12 @@ const DEFAULT_SESSION_SAMPLE_RATE = 0.1;
22374
22453
  const DEFAULT_ERROR_SAMPLE_RATE = 1.0;
22375
22454
 
22376
22455
  /** The select to use for the `maskAllText` option */
22377
- const MASK_ALL_TEXT_SELECTOR = 'body *:not(style,script)';
22378
-
22379
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
22380
-
22381
- /**
22382
- * lodash (Custom Build) <https://lodash.com/>
22383
- * Build: `lodash modularize exports="npm" -o ./`
22384
- * Copyright jQuery Foundation and other contributors <https://jquery.org/>
22385
- * Released under MIT license <https://lodash.com/license>
22386
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
22387
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
22388
- */
22389
-
22390
- /** Used as the `TypeError` message for "Functions" methods. */
22391
- var FUNC_ERROR_TEXT = 'Expected a function';
22392
-
22393
- /** Used as references for various `Number` constants. */
22394
- var NAN = 0 / 0;
22395
-
22396
- /** `Object#toString` result references. */
22397
- var symbolTag = '[object Symbol]';
22456
+ const MASK_ALL_TEXT_SELECTOR = 'body *:not(style), body *:not(script)';
22398
22457
 
22399
- /** Used to match leading and trailing whitespace. */
22400
- var reTrim = /^\s+|\s+$/g;
22401
-
22402
- /** Used to detect bad signed hexadecimal string values. */
22403
- var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
22404
-
22405
- /** Used to detect binary string values. */
22406
- var reIsBinary = /^0b[01]+$/i;
22407
-
22408
- /** Used to detect octal string values. */
22409
- var reIsOctal = /^0o[0-7]+$/i;
22410
-
22411
- /** Built-in method references without a dependency on `root`. */
22412
- var freeParseInt = parseInt;
22413
-
22414
- /** Detect free variable `global` from Node.js. */
22415
- var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
22416
-
22417
- /** Detect free variable `self`. */
22418
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
22419
-
22420
- /** Used as a reference to the global object. */
22421
- var root = freeGlobal || freeSelf;
22422
-
22423
- /** Used for built-in method references. */
22424
- var objectProto = Object.prototype;
22425
-
22426
- /**
22427
- * Used to resolve the
22428
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
22429
- * of values.
22430
- */
22431
- var objectToString = objectProto.toString;
22432
-
22433
- /* Built-in method references for those with the same name as other `lodash` methods. */
22434
- var nativeMax = Math.max,
22435
- nativeMin = Math.min;
22436
-
22437
- /**
22438
- * Gets the timestamp of the number of milliseconds that have elapsed since
22439
- * the Unix epoch (1 January 1970 00:00:00 UTC).
22440
- *
22441
- * @static
22442
- * @memberOf _
22443
- * @since 2.4.0
22444
- * @category Date
22445
- * @returns {number} Returns the timestamp.
22446
- * @example
22447
- *
22448
- * _.defer(function(stamp) {
22449
- * console.log(_.now() - stamp);
22450
- * }, _.now());
22451
- * // => Logs the number of milliseconds it took for the deferred invocation.
22452
- */
22453
- var now = function() {
22454
- return root.Date.now();
22455
- };
22456
-
22457
- /**
22458
- * Creates a debounced function that delays invoking `func` until after `wait`
22459
- * milliseconds have elapsed since the last time the debounced function was
22460
- * invoked. The debounced function comes with a `cancel` method to cancel
22461
- * delayed `func` invocations and a `flush` method to immediately invoke them.
22462
- * Provide `options` to indicate whether `func` should be invoked on the
22463
- * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
22464
- * with the last arguments provided to the debounced function. Subsequent
22465
- * calls to the debounced function return the result of the last `func`
22466
- * invocation.
22467
- *
22468
- * **Note:** If `leading` and `trailing` options are `true`, `func` is
22469
- * invoked on the trailing edge of the timeout only if the debounced function
22470
- * is invoked more than once during the `wait` timeout.
22471
- *
22472
- * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
22473
- * until to the next tick, similar to `setTimeout` with a timeout of `0`.
22474
- *
22475
- * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
22476
- * for details over the differences between `_.debounce` and `_.throttle`.
22477
- *
22478
- * @static
22479
- * @memberOf _
22480
- * @since 0.1.0
22481
- * @category Function
22482
- * @param {Function} func The function to debounce.
22483
- * @param {number} [wait=0] The number of milliseconds to delay.
22484
- * @param {Object} [options={}] The options object.
22485
- * @param {boolean} [options.leading=false]
22486
- * Specify invoking on the leading edge of the timeout.
22487
- * @param {number} [options.maxWait]
22488
- * The maximum time `func` is allowed to be delayed before it's invoked.
22489
- * @param {boolean} [options.trailing=true]
22490
- * Specify invoking on the trailing edge of the timeout.
22491
- * @returns {Function} Returns the new debounced function.
22492
- * @example
22493
- *
22494
- * // Avoid costly calculations while the window size is in flux.
22495
- * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
22496
- *
22497
- * // Invoke `sendMail` when clicked, debouncing subsequent calls.
22498
- * jQuery(element).on('click', _.debounce(sendMail, 300, {
22499
- * 'leading': true,
22500
- * 'trailing': false
22501
- * }));
22502
- *
22503
- * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
22504
- * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
22505
- * var source = new EventSource('/stream');
22506
- * jQuery(source).on('message', debounced);
22507
- *
22508
- * // Cancel the trailing debounced invocation.
22509
- * jQuery(window).on('popstate', debounced.cancel);
22510
- */
22511
- function debounce(func, wait, options) {
22512
- var lastArgs,
22513
- lastThis,
22514
- maxWait,
22515
- result,
22516
- timerId,
22517
- lastCallTime,
22518
- lastInvokeTime = 0,
22519
- leading = false,
22520
- maxing = false,
22521
- trailing = true;
22522
-
22523
- if (typeof func != 'function') {
22524
- throw new TypeError(FUNC_ERROR_TEXT);
22525
- }
22526
- wait = toNumber(wait) || 0;
22527
- if (isObject$1(options)) {
22528
- leading = !!options.leading;
22529
- maxing = 'maxWait' in options;
22530
- maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
22531
- trailing = 'trailing' in options ? !!options.trailing : trailing;
22532
- }
22533
-
22534
- function invokeFunc(time) {
22535
- var args = lastArgs,
22536
- thisArg = lastThis;
22537
-
22538
- lastArgs = lastThis = undefined;
22539
- lastInvokeTime = time;
22540
- result = func.apply(thisArg, args);
22541
- return result;
22542
- }
22543
-
22544
- function leadingEdge(time) {
22545
- // Reset any `maxWait` timer.
22546
- lastInvokeTime = time;
22547
- // Start the timer for the trailing edge.
22548
- timerId = setTimeout(timerExpired, wait);
22549
- // Invoke the leading edge.
22550
- return leading ? invokeFunc(time) : result;
22551
- }
22552
-
22553
- function remainingWait(time) {
22554
- var timeSinceLastCall = time - lastCallTime,
22555
- timeSinceLastInvoke = time - lastInvokeTime,
22556
- result = wait - timeSinceLastCall;
22557
-
22558
- return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
22559
- }
22560
-
22561
- function shouldInvoke(time) {
22562
- var timeSinceLastCall = time - lastCallTime,
22563
- timeSinceLastInvoke = time - lastInvokeTime;
22564
-
22565
- // Either this is the first call, activity has stopped and we're at the
22566
- // trailing edge, the system time has gone backwards and we're treating
22567
- // it as the trailing edge, or we've hit the `maxWait` limit.
22568
- return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
22569
- (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
22570
- }
22571
-
22572
- function timerExpired() {
22573
- var time = now();
22574
- if (shouldInvoke(time)) {
22575
- return trailingEdge(time);
22576
- }
22577
- // Restart the timer.
22578
- timerId = setTimeout(timerExpired, remainingWait(time));
22579
- }
22580
-
22581
- function trailingEdge(time) {
22582
- timerId = undefined;
22583
-
22584
- // Only invoke if we have `lastArgs` which means `func` has been
22585
- // debounced at least once.
22586
- if (trailing && lastArgs) {
22587
- return invokeFunc(time);
22588
- }
22589
- lastArgs = lastThis = undefined;
22590
- return result;
22591
- }
22592
-
22593
- function cancel() {
22594
- if (timerId !== undefined) {
22595
- clearTimeout(timerId);
22596
- }
22597
- lastInvokeTime = 0;
22598
- lastArgs = lastCallTime = lastThis = timerId = undefined;
22599
- }
22600
-
22601
- function flush() {
22602
- return timerId === undefined ? result : trailingEdge(now());
22603
- }
22604
-
22605
- function debounced() {
22606
- var time = now(),
22607
- isInvoking = shouldInvoke(time);
22608
-
22609
- lastArgs = arguments;
22610
- lastThis = this;
22611
- lastCallTime = time;
22612
-
22613
- if (isInvoking) {
22614
- if (timerId === undefined) {
22615
- return leadingEdge(lastCallTime);
22616
- }
22617
- if (maxing) {
22618
- // Handle invocations in a tight loop.
22619
- timerId = setTimeout(timerExpired, wait);
22620
- return invokeFunc(lastCallTime);
22621
- }
22622
- }
22623
- if (timerId === undefined) {
22624
- timerId = setTimeout(timerExpired, wait);
22625
- }
22626
- return result;
22627
- }
22628
- debounced.cancel = cancel;
22629
- debounced.flush = flush;
22630
- return debounced;
22631
- }
22632
-
22633
- /**
22634
- * Checks if `value` is the
22635
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
22636
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
22637
- *
22638
- * @static
22639
- * @memberOf _
22640
- * @since 0.1.0
22641
- * @category Lang
22642
- * @param {*} value The value to check.
22643
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
22644
- * @example
22645
- *
22646
- * _.isObject({});
22647
- * // => true
22648
- *
22649
- * _.isObject([1, 2, 3]);
22650
- * // => true
22651
- *
22652
- * _.isObject(_.noop);
22653
- * // => true
22654
- *
22655
- * _.isObject(null);
22656
- * // => false
22657
- */
22658
- function isObject$1(value) {
22659
- var type = typeof value;
22660
- return !!value && (type == 'object' || type == 'function');
22661
- }
22662
-
22663
- /**
22664
- * Checks if `value` is object-like. A value is object-like if it's not `null`
22665
- * and has a `typeof` result of "object".
22666
- *
22667
- * @static
22668
- * @memberOf _
22669
- * @since 4.0.0
22670
- * @category Lang
22671
- * @param {*} value The value to check.
22672
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
22673
- * @example
22674
- *
22675
- * _.isObjectLike({});
22676
- * // => true
22677
- *
22678
- * _.isObjectLike([1, 2, 3]);
22679
- * // => true
22680
- *
22681
- * _.isObjectLike(_.noop);
22682
- * // => false
22683
- *
22684
- * _.isObjectLike(null);
22685
- * // => false
22686
- */
22687
- function isObjectLike(value) {
22688
- return !!value && typeof value == 'object';
22689
- }
22690
-
22691
- /**
22692
- * Checks if `value` is classified as a `Symbol` primitive or object.
22693
- *
22694
- * @static
22695
- * @memberOf _
22696
- * @since 4.0.0
22697
- * @category Lang
22698
- * @param {*} value The value to check.
22699
- * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
22700
- * @example
22701
- *
22702
- * _.isSymbol(Symbol.iterator);
22703
- * // => true
22704
- *
22705
- * _.isSymbol('abc');
22706
- * // => false
22707
- */
22708
- function isSymbol(value) {
22709
- return typeof value == 'symbol' ||
22710
- (isObjectLike(value) && objectToString.call(value) == symbolTag);
22711
- }
22712
-
22713
- /**
22714
- * Converts `value` to a number.
22715
- *
22716
- * @static
22717
- * @memberOf _
22718
- * @since 4.0.0
22719
- * @category Lang
22720
- * @param {*} value The value to process.
22721
- * @returns {number} Returns the number.
22722
- * @example
22723
- *
22724
- * _.toNumber(3.2);
22725
- * // => 3.2
22726
- *
22727
- * _.toNumber(Number.MIN_VALUE);
22728
- * // => 5e-324
22729
- *
22730
- * _.toNumber(Infinity);
22731
- * // => Infinity
22732
- *
22733
- * _.toNumber('3.2');
22734
- * // => 3.2
22735
- */
22736
- function toNumber(value) {
22737
- if (typeof value == 'number') {
22738
- return value;
22739
- }
22740
- if (isSymbol(value)) {
22741
- return NAN;
22742
- }
22743
- if (isObject$1(value)) {
22744
- var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
22745
- value = isObject$1(other) ? (other + '') : other;
22746
- }
22747
- if (typeof value != 'string') {
22748
- return value === 0 ? value : +value;
22749
- }
22750
- value = value.replace(reTrim, '');
22751
- var isBinary = reIsBinary.test(value);
22752
- return (isBinary || reIsOctal.test(value))
22753
- ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
22754
- : (reIsBadHex.test(value) ? NAN : +value);
22755
- }
22756
-
22757
- var lodash_debounce = debounce;
22458
+ /** Default flush delays */
22459
+ const DEFAULT_FLUSH_MIN_DELAY = 5000;
22460
+ const DEFAULT_FLUSH_MAX_DELAY = 15000;
22461
+ const INITIAL_FLUSH_DELAY = 5000;
22758
22462
 
22759
22463
  /*! *****************************************************************************
22760
22464
  Copyright (c) Microsoft Corporation.
@@ -29762,6 +29466,9 @@ var fdt = new u8(32);
29762
29466
  for (var i = 0; i < 32; ++i)
29763
29467
  fdt[i] = 5;
29764
29468
 
29469
+ /**
29470
+ * Create a breadcrumb for a replay.
29471
+ */
29765
29472
  function createBreadcrumb(
29766
29473
  breadcrumb,
29767
29474
  ) {
@@ -29772,6 +29479,9 @@ function createBreadcrumb(
29772
29479
  };
29773
29480
  }
29774
29481
 
29482
+ /**
29483
+ * An event handler to react to DOM events.
29484
+ */
29775
29485
  function handleDom(handlerData) {
29776
29486
  // Taken from https://github.com/getsentry/sentry-javascript/blob/master/packages/browser/src/integrations/breadcrumbs.ts#L112
29777
29487
  let target;
@@ -29814,6 +29524,9 @@ function isEventWithTarget(event) {
29814
29524
 
29815
29525
  let _LAST_BREADCRUMB = null;
29816
29526
 
29527
+ /**
29528
+ * An event handler to handle scope changes.
29529
+ */
29817
29530
  function handleScope(scope) {
29818
29531
  const newBreadcrumb = scope.getLastBreadcrumb();
29819
29532
 
@@ -29836,6 +29549,9 @@ function handleScope(scope) {
29836
29549
  return createBreadcrumb(newBreadcrumb);
29837
29550
  }
29838
29551
 
29552
+ /**
29553
+ * An event handler to react to breadcrumbs.
29554
+ */
29839
29555
  function breadcrumbHandler(type, handlerData) {
29840
29556
  if (type === 'scope') {
29841
29557
  return handleScope(handlerData );
@@ -29972,6 +29688,9 @@ function handleFetchSpanListener(replay) {
29972
29688
  };
29973
29689
  }
29974
29690
 
29691
+ /**
29692
+ * Returns true if we think the given event is an error originating inside of rrweb.
29693
+ */
29975
29694
  function isRrwebError(event) {
29976
29695
  if (event.type || !_optionalChain([event, 'access', _ => _.exception, 'optionalAccess', _2 => _2.values, 'optionalAccess', _3 => _3.length])) {
29977
29696
  return false;
@@ -29993,10 +29712,7 @@ function isRrwebError(event) {
29993
29712
  function handleGlobalEventListener(replay) {
29994
29713
  return (event) => {
29995
29714
  // Do not apply replayId to the root event
29996
- if (
29997
- // @ts-ignore new event type
29998
- event.type === REPLAY_EVENT_NAME
29999
- ) {
29715
+ if (event.type === REPLAY_EVENT_NAME) {
30000
29716
  // Replays have separate set of breadcrumbs, do not include breadcrumbs
30001
29717
  // from core SDK
30002
29718
  delete event.breadcrumbs;
@@ -30012,7 +29728,7 @@ function handleGlobalEventListener(replay) {
30012
29728
 
30013
29729
  // Only tag transactions with replayId if not waiting for an error
30014
29730
  // @ts-ignore private
30015
- if (event.type !== 'transaction' || replay.recordingMode === 'session') {
29731
+ if (!event.type || replay.recordingMode === 'session') {
30016
29732
  event.tags = { ...event.tags, replayId: _optionalChain([replay, 'access', _5 => _5.session, 'optionalAccess', _6 => _6.id]) };
30017
29733
  }
30018
29734
 
@@ -30325,9 +30041,12 @@ const ENTRY_TYPES = {
30325
30041
  // @ts-ignore TODO: entry type does not fit the create* functions entry type
30326
30042
  navigation: createNavigationEntry,
30327
30043
  // @ts-ignore TODO: entry type does not fit the create* functions entry type
30328
- ['largest-contentful-paint']: createLargestContentfulPaint,
30044
+ 'largest-contentful-paint': createLargestContentfulPaint,
30329
30045
  };
30330
30046
 
30047
+ /**
30048
+ * Create replay performance entries from the browser performance entries.
30049
+ */
30331
30050
  function createPerformanceEntries(entries) {
30332
30051
  return entries.map(createPerformanceEntry).filter(Boolean) ;
30333
30052
  }
@@ -30346,8 +30065,6 @@ function getAbsoluteTime(time) {
30346
30065
  return ((browserPerformanceTimeOrigin || WINDOW.performance.timeOrigin) + time) / 1000;
30347
30066
  }
30348
30067
 
30349
- // TODO: type definition!
30350
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
30351
30068
  function createPaintEntry(entry) {
30352
30069
  const { duration, entryType, name, startTime } = entry;
30353
30070
 
@@ -30360,8 +30077,6 @@ function createPaintEntry(entry) {
30360
30077
  };
30361
30078
  }
30362
30079
 
30363
- // TODO: type definition!
30364
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
30365
30080
  function createNavigationEntry(entry) {
30366
30081
  // TODO: There looks to be some more interesting bits in here (domComplete, domContentLoaded)
30367
30082
  const { entryType, name, duration, domComplete, startTime, transferSize, type } = entry;
@@ -30383,8 +30098,6 @@ function createNavigationEntry(entry) {
30383
30098
  };
30384
30099
  }
30385
30100
 
30386
- // TODO: type definition!
30387
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
30388
30101
  function createResourceEntry(entry) {
30389
30102
  const { entryType, initiatorType, name, responseEnd, startTime, encodedBodySize, transferSize } = entry;
30390
30103
 
@@ -30405,9 +30118,9 @@ function createResourceEntry(entry) {
30405
30118
  };
30406
30119
  }
30407
30120
 
30408
- // TODO: type definition!
30409
- // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
30410
- function createLargestContentfulPaint(entry) {
30121
+ function createLargestContentfulPaint(
30122
+ entry,
30123
+ ) {
30411
30124
  const { duration, entryType, startTime, size } = entry;
30412
30125
 
30413
30126
  const start = getAbsoluteTime(startTime);
@@ -30432,6 +30145,9 @@ function t(t){let e=t.length;for(;--e>=0;)t[e]=0}const e=new Uint8Array([0,0,0,0
30432
30145
 
30433
30146
  /* eslint-disable @typescript-eslint/no-unsafe-member-access */
30434
30147
 
30148
+ /**
30149
+ * Create an event buffer for replays.
30150
+ */
30435
30151
  function createEventBuffer({ useCompression }) {
30436
30152
  // eslint-disable-next-line no-restricted-globals
30437
30153
  if (useCompression && window.Worker) {
@@ -30462,14 +30178,14 @@ class EventBufferArray {
30462
30178
  this._events = [];
30463
30179
  }
30464
30180
 
30465
- destroy() {
30466
- this._events = [];
30467
- }
30468
-
30469
30181
  get length() {
30470
30182
  return this._events.length;
30471
30183
  }
30472
30184
 
30185
+ destroy() {
30186
+ this._events = [];
30187
+ }
30188
+
30473
30189
  addEvent(event, isCheckout) {
30474
30190
  if (isCheckout) {
30475
30191
  this._events = [event];
@@ -30491,7 +30207,10 @@ class EventBufferArray {
30491
30207
  }
30492
30208
  }
30493
30209
 
30494
- // exporting for testing
30210
+ /**
30211
+ * Event buffer that uses a web worker to compress events.
30212
+ * Exported only for testing.
30213
+ */
30495
30214
  class EventBufferCompressionWorker {
30496
30215
 
30497
30216
  __init() {this._eventBufferItemLength = 0;}
@@ -30501,12 +30220,6 @@ class EventBufferCompressionWorker {
30501
30220
  this._worker = worker;
30502
30221
  }
30503
30222
 
30504
- destroy() {
30505
- (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger.log('[Replay] Destroying compression worker');
30506
- _optionalChain([this, 'access', _ => _._worker, 'optionalAccess', _2 => _2.terminate, 'call', _3 => _3()]);
30507
- this._worker = null;
30508
- }
30509
-
30510
30223
  /**
30511
30224
  * Note that this may not reflect what is actually in the event buffer. This
30512
30225
  * is only a local count of the buffer size since `addEvent` is async.
@@ -30515,6 +30228,18 @@ class EventBufferCompressionWorker {
30515
30228
  return this._eventBufferItemLength;
30516
30229
  }
30517
30230
 
30231
+ /**
30232
+ * Destroy the event buffer.
30233
+ */
30234
+ destroy() {
30235
+ (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger.log('[Replay] Destroying compression worker');
30236
+ _optionalChain([this, 'access', _ => _._worker, 'optionalAccess', _2 => _2.terminate, 'call', _3 => _3()]);
30237
+ this._worker = null;
30238
+ }
30239
+
30240
+ /**
30241
+ * Add an event to the event buffer.
30242
+ */
30518
30243
  async addEvent(event, isCheckout) {
30519
30244
  if (isCheckout) {
30520
30245
  // This event is a checkout, make sure worker buffer is cleared before
@@ -30529,6 +30254,9 @@ class EventBufferCompressionWorker {
30529
30254
  return this._sendEventToWorker(event);
30530
30255
  }
30531
30256
 
30257
+ /**
30258
+ * Finish the event buffer and return the compressed data.
30259
+ */
30532
30260
  finish() {
30533
30261
  return this._finishRequest(this._getAndIncrementId());
30534
30262
  }
@@ -30579,6 +30307,9 @@ class EventBufferCompressionWorker {
30579
30307
  });
30580
30308
  }
30581
30309
 
30310
+ /**
30311
+ * Send the event to the worker.
30312
+ */
30582
30313
  _sendEventToWorker(event) {
30583
30314
  const promise = this._postMessage({
30584
30315
  id: this._getAndIncrementId(),
@@ -30592,6 +30323,9 @@ class EventBufferCompressionWorker {
30592
30323
  return promise;
30593
30324
  }
30594
30325
 
30326
+ /**
30327
+ * Finish the request and return the compressed data from the worker.
30328
+ */
30595
30329
  async _finishRequest(id) {
30596
30330
  const promise = this._postMessage({ id, method: 'finish', args: [] });
30597
30331
 
@@ -30601,6 +30335,7 @@ class EventBufferCompressionWorker {
30601
30335
  return promise ;
30602
30336
  }
30603
30337
 
30338
+ /** Get the current ID and increment it for the next call. */
30604
30339
  _getAndIncrementId() {
30605
30340
  return this._id++;
30606
30341
  }
@@ -30658,6 +30393,9 @@ function isSessionExpired(session, idleTimeout, targetTime = +new Date()) {
30658
30393
  );
30659
30394
  }
30660
30395
 
30396
+ /**
30397
+ * Save a session to session storage.
30398
+ */
30661
30399
  function saveSession(session) {
30662
30400
  const hasSessionStorage = 'sessionStorage' in WINDOW;
30663
30401
  if (!hasSessionStorage) {
@@ -30812,7 +30550,30 @@ function addMemoryEntry(replay) {
30812
30550
  }
30813
30551
  }
30814
30552
 
30815
- function createPayload({
30553
+ function createMemoryEntry(memoryEntry) {
30554
+ const { jsHeapSizeLimit, totalJSHeapSize, usedJSHeapSize } = memoryEntry;
30555
+ // we don't want to use `getAbsoluteTime` because it adds the event time to the
30556
+ // time origin, so we get the current timestamp instead
30557
+ const time = new Date().getTime() / 1000;
30558
+ return {
30559
+ type: 'memory',
30560
+ name: 'memory',
30561
+ start: time,
30562
+ end: time,
30563
+ data: {
30564
+ memory: {
30565
+ jsHeapSizeLimit,
30566
+ totalJSHeapSize,
30567
+ usedJSHeapSize,
30568
+ },
30569
+ },
30570
+ };
30571
+ }
30572
+
30573
+ /**
30574
+ * Create the recording data ready to be sent.
30575
+ */
30576
+ function createRecordingData({
30816
30577
  events,
30817
30578
  headers,
30818
30579
  }
@@ -30839,59 +30600,99 @@ function createPayload({
30839
30600
  return payloadWithSequence;
30840
30601
  }
30841
30602
 
30603
+ /**
30604
+ * Create a replay envelope ready to be sent.
30605
+ * This includes both the replay event, as well as the recording data.
30606
+ */
30842
30607
  function createReplayEnvelope(
30843
30608
  replayEvent,
30844
- payloadWithSequence,
30609
+ recordingData,
30845
30610
  dsn,
30846
30611
  tunnel,
30847
30612
  ) {
30848
30613
  return createEnvelope(
30849
30614
  createEventEnvelopeHeaders(replayEvent, getSdkMetadataForEnvelopeHeader(replayEvent), tunnel, dsn),
30850
30615
  [
30851
- // @ts-ignore New types
30852
30616
  [{ type: 'replay_event' }, replayEvent],
30853
30617
  [
30854
30618
  {
30855
- // @ts-ignore setting envelope
30856
30619
  type: 'replay_recording',
30857
- length: payloadWithSequence.length,
30620
+ length: recordingData.length,
30858
30621
  },
30859
- // @ts-ignore: Type 'string' is not assignable to type 'ClientReport'.ts(2322)
30860
- payloadWithSequence,
30622
+ recordingData,
30861
30623
  ],
30862
30624
  ],
30863
30625
  );
30864
30626
  }
30865
30627
 
30866
- async function getReplayEvent({
30867
- client,
30868
- scope,
30869
- replayId: event_id,
30870
- event,
30871
- }
30628
+ /**
30629
+ * Heavily simplified debounce function based on lodash.debounce.
30630
+ *
30631
+ * This function takes a callback function (@param fun) and delays its invocation
30632
+ * by @param wait milliseconds. Optionally, a maxWait can be specified in @param options,
30633
+ * which ensures that the callback is invoked at least once after the specified max. wait time.
30634
+ *
30635
+ * @param func the function whose invocation is to be debounced
30636
+ * @param wait the minimum time until the function is invoked after it was called once
30637
+ * @param options the options object, which can contain the `maxWait` property
30638
+ *
30639
+ * @returns the debounced version of the function, which needs to be called at least once to start the
30640
+ * debouncing process. Subsequent calls will reset the debouncing timer and, in case @paramfunc
30641
+ * was already invoked in the meantime, return @param func's return value.
30642
+ * The debounced function has two additional properties:
30643
+ * - `flush`: Invokes the debounced function immediately and returns its return value
30644
+ * - `cancel`: Cancels the debouncing process and resets the debouncing timer
30645
+ */
30646
+ function debounce(func, wait, options) {
30647
+ let callbackReturnValue;
30872
30648
 
30873
- ) {
30874
- // XXX: This event does not trigger `beforeSend` in SDK
30875
- // @ts-ignore private api
30876
- const preparedEvent = await client._prepareEvent(event, { event_id }, scope);
30649
+ let timerId;
30650
+ let maxTimerId;
30877
30651
 
30878
- if (preparedEvent) {
30879
- // extract the SDK name because `client._prepareEvent` doesn't add it to the event
30880
- const metadata = client.getOptions() && client.getOptions()._metadata;
30881
- const { name } = (metadata && metadata.sdk) || {};
30652
+ const maxWait = options && options.maxWait ? Math.max(options.maxWait, wait) : 0;
30882
30653
 
30883
- preparedEvent.sdk = {
30884
- ...preparedEvent.sdk,
30885
- version: "7.28.1",
30886
- name,
30887
- };
30654
+ function invokeFunc() {
30655
+ cancelTimers();
30656
+ callbackReturnValue = func();
30657
+ return callbackReturnValue;
30888
30658
  }
30889
30659
 
30890
- return preparedEvent;
30660
+ function cancelTimers() {
30661
+ timerId !== undefined && clearTimeout(timerId);
30662
+ maxTimerId !== undefined && clearTimeout(maxTimerId);
30663
+ timerId = maxTimerId = undefined;
30664
+ }
30665
+
30666
+ function flush() {
30667
+ if (timerId !== undefined || maxTimerId !== undefined) {
30668
+ return invokeFunc();
30669
+ }
30670
+ return callbackReturnValue;
30671
+ }
30672
+
30673
+ function debounced() {
30674
+ if (timerId) {
30675
+ clearTimeout(timerId);
30676
+ }
30677
+ timerId = setTimeout(invokeFunc, wait);
30678
+
30679
+ if (maxWait && maxTimerId === undefined) {
30680
+ maxTimerId = setTimeout(invokeFunc, maxWait);
30681
+ }
30682
+
30683
+ return callbackReturnValue;
30684
+ }
30685
+
30686
+ debounced.cancel = cancelTimers;
30687
+ debounced.flush = flush;
30688
+ return debounced;
30891
30689
  }
30892
30690
 
30893
30691
  let _originalRecordDroppedEvent;
30894
30692
 
30693
+ /**
30694
+ * Overwrite the `recordDroppedEvent` method on the client, so we can find out which events were dropped.
30695
+ * */
30895
30696
  function overwriteRecordDroppedEvent(errorIds) {
30896
30697
  const client = getCurrentHub().getClient();
30897
30698
 
@@ -30906,7 +30707,7 @@ function overwriteRecordDroppedEvent(errorIds) {
30906
30707
  category,
30907
30708
  event,
30908
30709
  ) => {
30909
- if (event && event.event_id) {
30710
+ if (event && !event.type && event.event_id) {
30910
30711
  errorIds.delete(event.event_id);
30911
30712
  }
30912
30713
 
@@ -30917,6 +30718,9 @@ function overwriteRecordDroppedEvent(errorIds) {
30917
30718
  _originalRecordDroppedEvent = _originalCallback;
30918
30719
  }
30919
30720
 
30721
+ /**
30722
+ * Restore the original method.
30723
+ * */
30920
30724
  function restoreRecordDroppedEvent() {
30921
30725
  const client = getCurrentHub().getClient();
30922
30726
 
@@ -30927,6 +30731,42 @@ function restoreRecordDroppedEvent() {
30927
30731
  client.recordDroppedEvent = _originalRecordDroppedEvent;
30928
30732
  }
30929
30733
 
30734
+ /**
30735
+ * Prepare a replay event & enrich it with the SDK metadata.
30736
+ */
30737
+ async function prepareReplayEvent({
30738
+ client,
30739
+ scope,
30740
+ replayId: event_id,
30741
+ event,
30742
+ }
30743
+
30744
+ ) {
30745
+ const preparedEvent = (await prepareEvent(client.getOptions(), event, { event_id }, scope)) ;
30746
+
30747
+ // If e.g. a global event processor returned null
30748
+ if (!preparedEvent) {
30749
+ return null;
30750
+ }
30751
+
30752
+ // This normally happens in browser client "_prepareEvent"
30753
+ // but since we do not use this private method from the client, but rather the plain import
30754
+ // we need to do this manually.
30755
+ preparedEvent.platform = preparedEvent.platform || 'javascript';
30756
+
30757
+ // extract the SDK name because `client._prepareEvent` doesn't add it to the event
30758
+ const metadata = client.getSdkMetadata && client.getSdkMetadata();
30759
+ const name = (metadata && metadata.sdk && metadata.sdk.name) || 'sentry.javascript.unknown';
30760
+
30761
+ preparedEvent.sdk = {
30762
+ ...preparedEvent.sdk,
30763
+ version: "7.30.0",
30764
+ name,
30765
+ };
30766
+
30767
+ return preparedEvent;
30768
+ }
30769
+
30930
30770
  /* eslint-disable max-lines */ // TODO: We might want to split this file up
30931
30771
 
30932
30772
  /**
@@ -30936,6 +30776,9 @@ function restoreRecordDroppedEvent() {
30936
30776
  const BASE_RETRY_INTERVAL = 5000;
30937
30777
  const MAX_RETRY_COUNT = 3;
30938
30778
 
30779
+ /**
30780
+ * The main replay container class, which holds all the state and methods for recording and sending replays.
30781
+ */
30939
30782
  class ReplayContainer {
30940
30783
  __init() {this.eventBuffer = null;}
30941
30784
 
@@ -31003,7 +30846,7 @@ class ReplayContainer {
31003
30846
  this._recordingOptions = recordingOptions;
31004
30847
  this._options = options;
31005
30848
 
31006
- this._debouncedFlush = lodash_debounce(() => this.flush(), this._options.flushMinDelay, {
30849
+ this._debouncedFlush = debounce(() => this.flush(), this._options.flushMinDelay, {
31007
30850
  maxWait: this._options.flushMaxDelay,
31008
30851
  });
31009
30852
  }
@@ -31732,7 +31575,6 @@ class ReplayContainer {
31732
31575
  // A flush is about to happen, cancel any queued flushes
31733
31576
  _optionalChain([this, 'access', _30 => _30._debouncedFlush, 'optionalAccess', _31 => _31.cancel, 'call', _32 => _32()]);
31734
31577
 
31735
- // No existing flush in progress, proceed with flushing.
31736
31578
  // this._flushLock acts as a lock so that future calls to `flush()`
31737
31579
  // will be blocked until this promise resolves
31738
31580
  if (!this._flushLock) {
@@ -31765,8 +31607,8 @@ class ReplayContainer {
31765
31607
  */
31766
31608
  flushImmediate() {
31767
31609
  this._debouncedFlush();
31768
- // `.flush` is provided by lodash.debounce
31769
- return this._debouncedFlush.flush();
31610
+ // `.flush` is provided by the debounced function, analogously to lodash.debounce
31611
+ return this._debouncedFlush.flush() ;
31770
31612
  }
31771
31613
 
31772
31614
  /**
@@ -31779,7 +31621,7 @@ class ReplayContainer {
31779
31621
  includeReplayStartTimestamp,
31780
31622
  eventContext,
31781
31623
  }) {
31782
- const payloadWithSequence = createPayload({
31624
+ const recordingData = createRecordingData({
31783
31625
  events,
31784
31626
  headers: {
31785
31627
  segment_id,
@@ -31796,7 +31638,7 @@ class ReplayContainer {
31796
31638
  const transport = client && client.getTransport();
31797
31639
  const dsn = _optionalChain([client, 'optionalAccess', _33 => _33.getDsn, 'call', _34 => _34()]);
31798
31640
 
31799
- if (!client || !scope || !transport || !dsn) {
31641
+ if (!client || !scope || !transport || !dsn || !this.session || !this.session.sampled) {
31800
31642
  return;
31801
31643
  }
31802
31644
 
@@ -31810,12 +31652,15 @@ class ReplayContainer {
31810
31652
  urls,
31811
31653
  replay_id: replayId,
31812
31654
  segment_id,
31655
+ replay_type: this.session.sampled,
31813
31656
  };
31814
31657
 
31815
- const replayEvent = await getReplayEvent({ scope, client, replayId, event: baseEvent });
31658
+ const replayEvent = await prepareReplayEvent({ scope, client, replayId, event: baseEvent });
31816
31659
 
31817
31660
  if (!replayEvent) {
31818
- (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger.error('[Replay] An event processor returned null, will not send replay.');
31661
+ // Taken from baseclient's `_processEvent` method, where this is handled for errors/transactions
31662
+ client.recordDroppedEvent('event_processor', 'replay_event', baseEvent);
31663
+ (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger.log('An event processor returned `null`, will not send event.');
31819
31664
  return;
31820
31665
  }
31821
31666
 
@@ -31823,7 +31668,6 @@ class ReplayContainer {
31823
31668
  ...replayEvent.tags,
31824
31669
  sessionSampleRate: this._options.sessionSampleRate,
31825
31670
  errorSampleRate: this._options.errorSampleRate,
31826
- replayType: _optionalChain([this, 'access', _35 => _35.session, 'optionalAccess', _36 => _36.sampled]),
31827
31671
  };
31828
31672
 
31829
31673
  /*
@@ -31842,6 +31686,7 @@ class ReplayContainer {
31842
31686
  ],
31843
31687
  "replay_id": "eventId",
31844
31688
  "segment_id": 3,
31689
+ "replay_type": "error",
31845
31690
  "platform": "javascript",
31846
31691
  "event_id": "eventId",
31847
31692
  "environment": "production",
@@ -31857,20 +31702,22 @@ class ReplayContainer {
31857
31702
  "tags": {
31858
31703
  "sessionSampleRate": 1,
31859
31704
  "errorSampleRate": 0,
31860
- "replayType": "error"
31861
31705
  }
31862
31706
  }
31863
31707
  */
31864
31708
 
31865
- const envelope = createReplayEnvelope(replayEvent, payloadWithSequence, dsn, client.getOptions().tunnel);
31709
+ const envelope = createReplayEnvelope(replayEvent, recordingData, dsn, client.getOptions().tunnel);
31866
31710
 
31867
31711
  try {
31868
- return transport.send(envelope);
31712
+ return await transport.send(envelope);
31869
31713
  } catch (e) {
31870
31714
  throw new Error(UNABLE_TO_SEND_REPLAY);
31871
31715
  }
31872
31716
  }
31873
31717
 
31718
+ /**
31719
+ * Reset the counter of retries for sending replays.
31720
+ */
31874
31721
  resetRetries() {
31875
31722
  this._retryCount = 0;
31876
31723
  this._retryInterval = BASE_RETRY_INTERVAL;
@@ -31945,15 +31792,26 @@ class ReplayContainer {
31945
31792
  }
31946
31793
  }
31947
31794
 
31795
+ /**
31796
+ * Returns true if we are in the browser.
31797
+ */
31948
31798
  function isBrowser() {
31949
31799
  // eslint-disable-next-line no-restricted-globals
31950
- return typeof window !== 'undefined' && !isNodeEnv();
31800
+ return typeof window !== 'undefined' && (!isNodeEnv() || isElectronNodeRenderer());
31801
+ }
31802
+
31803
+ // Electron renderers with nodeIntegration enabled are detected as Node.js so we specifically test for them
31804
+ function isElectronNodeRenderer() {
31805
+ return typeof process !== 'undefined' && (process ).type === 'renderer';
31951
31806
  }
31952
31807
 
31953
31808
  const MEDIA_SELECTORS = 'img,image,svg,path,rect,area,video,object,picture,embed,map,audio';
31954
31809
 
31955
31810
  let _initialized = false;
31956
31811
 
31812
+ /**
31813
+ * The main replay integration class, to be passed to `init({ integrations: [] })`.
31814
+ */
31957
31815
  class Replay {
31958
31816
  /**
31959
31817
  * @inheritDoc
@@ -31969,23 +31827,16 @@ class Replay {
31969
31827
  * Options to pass to `rrweb.record()`
31970
31828
  */
31971
31829
 
31972
- get _isInitialized() {
31973
- return _initialized;
31974
- }
31975
-
31976
- set _isInitialized(value) {
31977
- _initialized = value;
31978
- }
31979
-
31980
31830
  constructor({
31981
- flushMinDelay = 5000,
31982
- flushMaxDelay = 15000,
31983
- initialFlushDelay = 5000,
31831
+ flushMinDelay = DEFAULT_FLUSH_MIN_DELAY,
31832
+ flushMaxDelay = DEFAULT_FLUSH_MAX_DELAY,
31833
+ initialFlushDelay = INITIAL_FLUSH_DELAY,
31984
31834
  stickySession = true,
31985
31835
  useCompression = true,
31986
31836
  sessionSampleRate,
31987
31837
  errorSampleRate,
31988
- maskAllText = true,
31838
+ maskAllText,
31839
+ maskTextSelector,
31989
31840
  maskAllInputs = true,
31990
31841
  blockAllMedia = true,
31991
31842
  _experiments = {},
@@ -32000,6 +31851,7 @@ class Replay {
32000
31851
  blockClass,
32001
31852
  ignoreClass,
32002
31853
  maskTextClass,
31854
+ maskTextSelector,
32003
31855
  blockSelector,
32004
31856
  ...recordingOptions,
32005
31857
  };
@@ -32012,7 +31864,7 @@ class Replay {
32012
31864
  sessionSampleRate: DEFAULT_SESSION_SAMPLE_RATE,
32013
31865
  errorSampleRate: DEFAULT_ERROR_SAMPLE_RATE,
32014
31866
  useCompression,
32015
- maskAllText,
31867
+ maskAllText: typeof maskAllText === 'boolean' ? maskAllText : !maskTextSelector,
32016
31868
  blockAllMedia,
32017
31869
  _experiments,
32018
31870
  };
@@ -32056,13 +31908,23 @@ Sentry.init({ replaysOnErrorSampleRate: ${errorSampleRate} })`,
32056
31908
  : `${this.recordingOptions.blockSelector},${MEDIA_SELECTORS}`;
32057
31909
  }
32058
31910
 
32059
- if (isBrowser() && this._isInitialized) {
31911
+ if (this._isInitialized && isBrowser()) {
32060
31912
  throw new Error('Multiple Sentry Session Replay instances are not supported');
32061
31913
  }
32062
31914
 
32063
31915
  this._isInitialized = true;
32064
31916
  }
32065
31917
 
31918
+ /** If replay has already been initialized */
31919
+ get _isInitialized() {
31920
+ return _initialized;
31921
+ }
31922
+
31923
+ /** Update _isInitialized */
31924
+ set _isInitialized(value) {
31925
+ _initialized = value;
31926
+ }
31927
+
32066
31928
  /**
32067
31929
  * We previously used to create a transaction in `setupOnce` and it would
32068
31930
  * potentially create a transaction before some native SDK integrations have run
@@ -32110,6 +31972,7 @@ Sentry.init({ replaysOnErrorSampleRate: ${errorSampleRate} })`,
32110
31972
  this._replay.stop();
32111
31973
  }
32112
31974
 
31975
+ /** Setup the integration. */
32113
31976
  _setup() {
32114
31977
  // Client is not available in constructor, so we need to wait until setupOnce
32115
31978
  this._loadReplayOptionsFromClient();
@@ -37981,7 +37844,7 @@ var Preview = /*#__PURE__*/(0, _react.lazy)(function () {
37981
37844
  });
37982
37845
  });
37983
37846
  var IS_BROWSER = typeof window !== 'undefined' && window.document;
37984
- var IS_GLOBAL = typeof commonjsGlobal$1 !== 'undefined' && commonjsGlobal$1.window && commonjsGlobal$1.window.document;
37847
+ var IS_GLOBAL = typeof commonjsGlobal !== 'undefined' && commonjsGlobal.window && commonjsGlobal.window.document;
37985
37848
  var SUPPORTED_PROPS = Object.keys(_props.propTypes); // Return null when rendering on the server
37986
37849
  // as Suspense is not supported yet
37987
37850