@myinterview/widget-react 1.0.56 → 1.0.57-ada6b21

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/esm/index.js CHANGED
@@ -2,7 +2,7 @@ import * as React from 'react';
2
2
  import React__default, { createContext, forwardRef, useRef, useEffect, useState, useLayoutEffect, useImperativeHandle, useDebugValue, useContext, createElement, useCallback, useMemo, isValidElement, cloneElement } from 'react';
3
3
  import { createPortal } from 'react-dom';
4
4
 
5
- var commonjsGlobal$1 = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
5
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
6
6
 
7
7
  function getDefaultExportFromCjs (x) {
8
8
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
@@ -8802,7 +8802,7 @@ var platform$1 = {exports: {}};
8802
8802
  var freeModule = module && !module.nodeType && module;
8803
8803
 
8804
8804
  /** Detect free variable `global` from Node.js or Browserified code and use it as `root`. */
8805
- var freeGlobal = freeExports && freeModule && typeof commonjsGlobal$1 == 'object' && commonjsGlobal$1;
8805
+ var freeGlobal = freeExports && freeModule && typeof commonjsGlobal == 'object' && commonjsGlobal;
8806
8806
  if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) {
8807
8807
  root = freeGlobal;
8808
8808
  }
@@ -10015,7 +10015,7 @@ var platform$1 = {exports: {}};
10015
10015
  // Export to the global object.
10016
10016
  root.platform = platform;
10017
10017
  }
10018
- }.call(commonjsGlobal$1));
10018
+ }.call(commonjsGlobal));
10019
10019
  } (platform$1, platform$1.exports));
10020
10020
 
10021
10021
  var platform = platform$1.exports;
@@ -14944,7 +14944,7 @@ const Explanation = ({ isVideoQuestion, thinkingTime }) => {
14944
14944
  };
14945
14945
 
14946
14946
  // eslint-disable-next-line @typescript-eslint/unbound-method
14947
- const objectToString$1 = Object.prototype.toString;
14947
+ const objectToString = Object.prototype.toString;
14948
14948
 
14949
14949
  /**
14950
14950
  * Checks whether given value's type is one of a few Error or Error-like
@@ -14954,7 +14954,7 @@ const objectToString$1 = Object.prototype.toString;
14954
14954
  * @returns A boolean representing the result.
14955
14955
  */
14956
14956
  function isError(wat) {
14957
- switch (objectToString$1.call(wat)) {
14957
+ switch (objectToString.call(wat)) {
14958
14958
  case '[object Error]':
14959
14959
  case '[object Exception]':
14960
14960
  case '[object DOMException]':
@@ -14971,7 +14971,7 @@ function isError(wat) {
14971
14971
  * @returns A boolean representing the result.
14972
14972
  */
14973
14973
  function isBuiltin(wat, className) {
14974
- return objectToString$1.call(wat) === `[object ${className}]`;
14974
+ return objectToString.call(wat) === `[object ${className}]`;
14975
14975
  }
14976
14976
 
14977
14977
  /**
@@ -17697,6 +17697,8 @@ const ITEM_TYPE_TO_DATA_CATEGORY_MAP = {
17697
17697
  client_report: 'internal',
17698
17698
  user_report: 'default',
17699
17699
  profile: 'profile',
17700
+ replay_event: 'replay_event',
17701
+ replay_recording: 'replay_recording',
17700
17702
  };
17701
17703
 
17702
17704
  /**
@@ -19274,6 +19276,194 @@ function setupIntegrations(integrations) {
19274
19276
  return integrationIndex;
19275
19277
  }
19276
19278
 
19279
+ /**
19280
+ * Adds common information to events.
19281
+ *
19282
+ * The information includes release and environment from `options`,
19283
+ * breadcrumbs and context (extra, tags and user) from the scope.
19284
+ *
19285
+ * Information that is already present in the event is never overwritten. For
19286
+ * nested objects, such as the context, keys are merged.
19287
+ *
19288
+ * Note: This also triggers callbacks for `addGlobalEventProcessor`, but not `beforeSend`.
19289
+ *
19290
+ * @param event The original event.
19291
+ * @param hint May contain additional information about the original exception.
19292
+ * @param scope A scope containing event metadata.
19293
+ * @returns A new event with more information.
19294
+ * @hidden
19295
+ */
19296
+ function prepareEvent(
19297
+ options,
19298
+ event,
19299
+ hint,
19300
+ scope,
19301
+ ) {
19302
+ const { normalizeDepth = 3, normalizeMaxBreadth = 1000 } = options;
19303
+ const prepared = {
19304
+ ...event,
19305
+ event_id: event.event_id || hint.event_id || uuid4(),
19306
+ timestamp: event.timestamp || dateTimestampInSeconds(),
19307
+ };
19308
+
19309
+ applyClientOptions(prepared, options);
19310
+ applyIntegrationsMetadata(
19311
+ prepared,
19312
+ options.integrations.map(i => i.name),
19313
+ );
19314
+
19315
+ // If we have scope given to us, use it as the base for further modifications.
19316
+ // This allows us to prevent unnecessary copying of data if `captureContext` is not provided.
19317
+ let finalScope = scope;
19318
+ if (hint.captureContext) {
19319
+ finalScope = Scope.clone(finalScope).update(hint.captureContext);
19320
+ }
19321
+
19322
+ // We prepare the result here with a resolved Event.
19323
+ let result = resolvedSyncPromise(prepared);
19324
+
19325
+ // This should be the last thing called, since we want that
19326
+ // {@link Hub.addEventProcessor} gets the finished prepared event.
19327
+ //
19328
+ // We need to check for the existence of `finalScope.getAttachments`
19329
+ // because `getAttachments` can be undefined if users are using an older version
19330
+ // of `@sentry/core` that does not have the `getAttachments` method.
19331
+ // See: https://github.com/getsentry/sentry-javascript/issues/5229
19332
+ if (finalScope) {
19333
+ // Collect attachments from the hint and scope
19334
+ if (finalScope.getAttachments) {
19335
+ const attachments = [...(hint.attachments || []), ...finalScope.getAttachments()];
19336
+
19337
+ if (attachments.length) {
19338
+ hint.attachments = attachments;
19339
+ }
19340
+ }
19341
+
19342
+ // In case we have a hub we reassign it.
19343
+ result = finalScope.applyToEvent(prepared, hint);
19344
+ }
19345
+
19346
+ return result.then(evt => {
19347
+ if (typeof normalizeDepth === 'number' && normalizeDepth > 0) {
19348
+ return normalizeEvent(evt, normalizeDepth, normalizeMaxBreadth);
19349
+ }
19350
+ return evt;
19351
+ });
19352
+ }
19353
+
19354
+ /**
19355
+ * Enhances event using the client configuration.
19356
+ * It takes care of all "static" values like environment, release and `dist`,
19357
+ * as well as truncating overly long values.
19358
+ * @param event event instance to be enhanced
19359
+ */
19360
+ function applyClientOptions(event, options) {
19361
+ const { environment, release, dist, maxValueLength = 250 } = options;
19362
+
19363
+ if (!('environment' in event)) {
19364
+ event.environment = 'environment' in options ? environment : 'production';
19365
+ }
19366
+
19367
+ if (event.release === undefined && release !== undefined) {
19368
+ event.release = release;
19369
+ }
19370
+
19371
+ if (event.dist === undefined && dist !== undefined) {
19372
+ event.dist = dist;
19373
+ }
19374
+
19375
+ if (event.message) {
19376
+ event.message = truncate(event.message, maxValueLength);
19377
+ }
19378
+
19379
+ const exception = event.exception && event.exception.values && event.exception.values[0];
19380
+ if (exception && exception.value) {
19381
+ exception.value = truncate(exception.value, maxValueLength);
19382
+ }
19383
+
19384
+ const request = event.request;
19385
+ if (request && request.url) {
19386
+ request.url = truncate(request.url, maxValueLength);
19387
+ }
19388
+ }
19389
+
19390
+ /**
19391
+ * This function adds all used integrations to the SDK info in the event.
19392
+ * @param event The event that will be filled with all integrations.
19393
+ */
19394
+ function applyIntegrationsMetadata(event, integrationNames) {
19395
+ if (integrationNames.length > 0) {
19396
+ event.sdk = event.sdk || {};
19397
+ event.sdk.integrations = [...(event.sdk.integrations || []), ...integrationNames];
19398
+ }
19399
+ }
19400
+
19401
+ /**
19402
+ * Applies `normalize` function on necessary `Event` attributes to make them safe for serialization.
19403
+ * Normalized keys:
19404
+ * - `breadcrumbs.data`
19405
+ * - `user`
19406
+ * - `contexts`
19407
+ * - `extra`
19408
+ * @param event Event
19409
+ * @returns Normalized event
19410
+ */
19411
+ function normalizeEvent(event, depth, maxBreadth) {
19412
+ if (!event) {
19413
+ return null;
19414
+ }
19415
+
19416
+ const normalized = {
19417
+ ...event,
19418
+ ...(event.breadcrumbs && {
19419
+ breadcrumbs: event.breadcrumbs.map(b => ({
19420
+ ...b,
19421
+ ...(b.data && {
19422
+ data: normalize(b.data, depth, maxBreadth),
19423
+ }),
19424
+ })),
19425
+ }),
19426
+ ...(event.user && {
19427
+ user: normalize(event.user, depth, maxBreadth),
19428
+ }),
19429
+ ...(event.contexts && {
19430
+ contexts: normalize(event.contexts, depth, maxBreadth),
19431
+ }),
19432
+ ...(event.extra && {
19433
+ extra: normalize(event.extra, depth, maxBreadth),
19434
+ }),
19435
+ };
19436
+
19437
+ // event.contexts.trace stores information about a Transaction. Similarly,
19438
+ // event.spans[] stores information about child Spans. Given that a
19439
+ // Transaction is conceptually a Span, normalization should apply to both
19440
+ // Transactions and Spans consistently.
19441
+ // For now the decision is to skip normalization of Transactions and Spans,
19442
+ // so this block overwrites the normalized event to add back the original
19443
+ // Transaction information prior to normalization.
19444
+ if (event.contexts && event.contexts.trace && normalized.contexts) {
19445
+ normalized.contexts.trace = event.contexts.trace;
19446
+
19447
+ // event.contexts.trace.data may contain circular/dangerous data so we need to normalize it
19448
+ if (event.contexts.trace.data) {
19449
+ normalized.contexts.trace.data = normalize(event.contexts.trace.data, depth, maxBreadth);
19450
+ }
19451
+ }
19452
+
19453
+ // event.spans[].data may contain circular/dangerous data so we need to normalize it
19454
+ if (event.spans) {
19455
+ normalized.spans = event.spans.map(span => {
19456
+ // We cannot use the spread operator here because `toJSON` on `span` is non-enumerable
19457
+ if (span.data) {
19458
+ span.data = normalize(span.data, depth, maxBreadth);
19459
+ }
19460
+ return span;
19461
+ });
19462
+ }
19463
+
19464
+ return normalized;
19465
+ }
19466
+
19277
19467
  const ALREADY_SEEN_ERROR = "Not capturing exception because it's already been captured.";
19278
19468
 
19279
19469
  /**
@@ -19448,6 +19638,15 @@ class BaseClient {
19448
19638
  return this._options;
19449
19639
  }
19450
19640
 
19641
+ /**
19642
+ * @see SdkMetadata in @sentry/types
19643
+ *
19644
+ * @return The metadata of the SDK
19645
+ */
19646
+ getSdkMetadata() {
19647
+ return this._options._metadata;
19648
+ }
19649
+
19451
19650
  /**
19452
19651
  * @inheritDoc
19453
19652
  */
@@ -19548,7 +19747,7 @@ class BaseClient {
19548
19747
  // Note: we use `event` in replay, where we overwrite this hook.
19549
19748
 
19550
19749
  if (this._options.sendClientReports) {
19551
- // We want to track each category (error, transaction, session) separately
19750
+ // We want to track each category (error, transaction, session, replay_event) separately
19552
19751
  // but still keep the distinction between different type of outcomes.
19553
19752
  // We could use nested maps, but it's much easier to read and type this way.
19554
19753
  // A correct type for map-based implementation if we want to go that route
@@ -19645,166 +19844,8 @@ class BaseClient {
19645
19844
  * @returns A new event with more information.
19646
19845
  */
19647
19846
  _prepareEvent(event, hint, scope) {
19648
- const { normalizeDepth = 3, normalizeMaxBreadth = 1000 } = this.getOptions();
19649
- const prepared = {
19650
- ...event,
19651
- event_id: event.event_id || hint.event_id || uuid4(),
19652
- timestamp: event.timestamp || dateTimestampInSeconds(),
19653
- };
19654
-
19655
- this._applyClientOptions(prepared);
19656
- this._applyIntegrationsMetadata(prepared);
19657
-
19658
- // If we have scope given to us, use it as the base for further modifications.
19659
- // This allows us to prevent unnecessary copying of data if `captureContext` is not provided.
19660
- let finalScope = scope;
19661
- if (hint.captureContext) {
19662
- finalScope = Scope.clone(finalScope).update(hint.captureContext);
19663
- }
19664
-
19665
- // We prepare the result here with a resolved Event.
19666
- let result = resolvedSyncPromise(prepared);
19667
-
19668
- // This should be the last thing called, since we want that
19669
- // {@link Hub.addEventProcessor} gets the finished prepared event.
19670
- //
19671
- // We need to check for the existence of `finalScope.getAttachments`
19672
- // because `getAttachments` can be undefined if users are using an older version
19673
- // of `@sentry/core` that does not have the `getAttachments` method.
19674
- // See: https://github.com/getsentry/sentry-javascript/issues/5229
19675
- if (finalScope && finalScope.getAttachments) {
19676
- // Collect attachments from the hint and scope
19677
- const attachments = [...(hint.attachments || []), ...finalScope.getAttachments()];
19678
-
19679
- if (attachments.length) {
19680
- hint.attachments = attachments;
19681
- }
19682
-
19683
- // In case we have a hub we reassign it.
19684
- result = finalScope.applyToEvent(prepared, hint);
19685
- }
19686
-
19687
- return result.then(evt => {
19688
- if (typeof normalizeDepth === 'number' && normalizeDepth > 0) {
19689
- return this._normalizeEvent(evt, normalizeDepth, normalizeMaxBreadth);
19690
- }
19691
- return evt;
19692
- });
19693
- }
19694
-
19695
- /**
19696
- * Applies `normalize` function on necessary `Event` attributes to make them safe for serialization.
19697
- * Normalized keys:
19698
- * - `breadcrumbs.data`
19699
- * - `user`
19700
- * - `contexts`
19701
- * - `extra`
19702
- * @param event Event
19703
- * @returns Normalized event
19704
- */
19705
- _normalizeEvent(event, depth, maxBreadth) {
19706
- if (!event) {
19707
- return null;
19708
- }
19709
-
19710
- const normalized = {
19711
- ...event,
19712
- ...(event.breadcrumbs && {
19713
- breadcrumbs: event.breadcrumbs.map(b => ({
19714
- ...b,
19715
- ...(b.data && {
19716
- data: normalize(b.data, depth, maxBreadth),
19717
- }),
19718
- })),
19719
- }),
19720
- ...(event.user && {
19721
- user: normalize(event.user, depth, maxBreadth),
19722
- }),
19723
- ...(event.contexts && {
19724
- contexts: normalize(event.contexts, depth, maxBreadth),
19725
- }),
19726
- ...(event.extra && {
19727
- extra: normalize(event.extra, depth, maxBreadth),
19728
- }),
19729
- };
19730
-
19731
- // event.contexts.trace stores information about a Transaction. Similarly,
19732
- // event.spans[] stores information about child Spans. Given that a
19733
- // Transaction is conceptually a Span, normalization should apply to both
19734
- // Transactions and Spans consistently.
19735
- // For now the decision is to skip normalization of Transactions and Spans,
19736
- // so this block overwrites the normalized event to add back the original
19737
- // Transaction information prior to normalization.
19738
- if (event.contexts && event.contexts.trace && normalized.contexts) {
19739
- normalized.contexts.trace = event.contexts.trace;
19740
-
19741
- // event.contexts.trace.data may contain circular/dangerous data so we need to normalize it
19742
- if (event.contexts.trace.data) {
19743
- normalized.contexts.trace.data = normalize(event.contexts.trace.data, depth, maxBreadth);
19744
- }
19745
- }
19746
-
19747
- // event.spans[].data may contain circular/dangerous data so we need to normalize it
19748
- if (event.spans) {
19749
- normalized.spans = event.spans.map(span => {
19750
- // We cannot use the spread operator here because `toJSON` on `span` is non-enumerable
19751
- if (span.data) {
19752
- span.data = normalize(span.data, depth, maxBreadth);
19753
- }
19754
- return span;
19755
- });
19756
- }
19757
-
19758
- return normalized;
19759
- }
19760
-
19761
- /**
19762
- * Enhances event using the client configuration.
19763
- * It takes care of all "static" values like environment, release and `dist`,
19764
- * as well as truncating overly long values.
19765
- * @param event event instance to be enhanced
19766
- */
19767
- _applyClientOptions(event) {
19768
19847
  const options = this.getOptions();
19769
- const { environment, release, dist, maxValueLength = 250 } = options;
19770
-
19771
- if (!('environment' in event)) {
19772
- event.environment = 'environment' in options ? environment : 'production';
19773
- }
19774
-
19775
- if (event.release === undefined && release !== undefined) {
19776
- event.release = release;
19777
- }
19778
-
19779
- if (event.dist === undefined && dist !== undefined) {
19780
- event.dist = dist;
19781
- }
19782
-
19783
- if (event.message) {
19784
- event.message = truncate(event.message, maxValueLength);
19785
- }
19786
-
19787
- const exception = event.exception && event.exception.values && event.exception.values[0];
19788
- if (exception && exception.value) {
19789
- exception.value = truncate(exception.value, maxValueLength);
19790
- }
19791
-
19792
- const request = event.request;
19793
- if (request && request.url) {
19794
- request.url = truncate(request.url, maxValueLength);
19795
- }
19796
- }
19797
-
19798
- /**
19799
- * This function adds all used integrations to the SDK info in the event.
19800
- * @param event The event that will be filled with all integrations.
19801
- */
19802
- _applyIntegrationsMetadata(event) {
19803
- const integrationsArray = Object.keys(this._integrations);
19804
- if (integrationsArray.length > 0) {
19805
- event.sdk = event.sdk || {};
19806
- event.sdk.integrations = [...(event.sdk.integrations || []), ...integrationsArray];
19807
- }
19848
+ return prepareEvent(options, event, hint, scope);
19808
19849
  }
19809
19850
 
19810
19851
  /**
@@ -20139,7 +20180,7 @@ function getEventForEnvelopeItem(item, type) {
20139
20180
  return Array.isArray(item) ? (item )[1] : undefined;
20140
20181
  }
20141
20182
 
20142
- const SDK_VERSION = '7.28.1';
20183
+ const SDK_VERSION = '7.29.0';
20143
20184
 
20144
20185
  let originalFunctionToString;
20145
20186
 
@@ -22348,387 +22389,12 @@ const DEFAULT_SESSION_SAMPLE_RATE = 0.1;
22348
22389
  const DEFAULT_ERROR_SAMPLE_RATE = 1.0;
22349
22390
 
22350
22391
  /** The select to use for the `maskAllText` option */
22351
- const MASK_ALL_TEXT_SELECTOR = 'body *:not(style,script)';
22352
-
22353
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
22354
-
22355
- /**
22356
- * lodash (Custom Build) <https://lodash.com/>
22357
- * Build: `lodash modularize exports="npm" -o ./`
22358
- * Copyright jQuery Foundation and other contributors <https://jquery.org/>
22359
- * Released under MIT license <https://lodash.com/license>
22360
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
22361
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
22362
- */
22363
-
22364
- /** Used as the `TypeError` message for "Functions" methods. */
22365
- var FUNC_ERROR_TEXT = 'Expected a function';
22366
-
22367
- /** Used as references for various `Number` constants. */
22368
- var NAN = 0 / 0;
22392
+ const MASK_ALL_TEXT_SELECTOR = 'body *:not(style), body *:not(script)';
22369
22393
 
22370
- /** `Object#toString` result references. */
22371
- var symbolTag = '[object Symbol]';
22372
-
22373
- /** Used to match leading and trailing whitespace. */
22374
- var reTrim = /^\s+|\s+$/g;
22375
-
22376
- /** Used to detect bad signed hexadecimal string values. */
22377
- var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
22378
-
22379
- /** Used to detect binary string values. */
22380
- var reIsBinary = /^0b[01]+$/i;
22381
-
22382
- /** Used to detect octal string values. */
22383
- var reIsOctal = /^0o[0-7]+$/i;
22384
-
22385
- /** Built-in method references without a dependency on `root`. */
22386
- var freeParseInt = parseInt;
22387
-
22388
- /** Detect free variable `global` from Node.js. */
22389
- var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
22390
-
22391
- /** Detect free variable `self`. */
22392
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
22393
-
22394
- /** Used as a reference to the global object. */
22395
- var root = freeGlobal || freeSelf;
22396
-
22397
- /** Used for built-in method references. */
22398
- var objectProto = Object.prototype;
22399
-
22400
- /**
22401
- * Used to resolve the
22402
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
22403
- * of values.
22404
- */
22405
- var objectToString = objectProto.toString;
22406
-
22407
- /* Built-in method references for those with the same name as other `lodash` methods. */
22408
- var nativeMax = Math.max,
22409
- nativeMin = Math.min;
22410
-
22411
- /**
22412
- * Gets the timestamp of the number of milliseconds that have elapsed since
22413
- * the Unix epoch (1 January 1970 00:00:00 UTC).
22414
- *
22415
- * @static
22416
- * @memberOf _
22417
- * @since 2.4.0
22418
- * @category Date
22419
- * @returns {number} Returns the timestamp.
22420
- * @example
22421
- *
22422
- * _.defer(function(stamp) {
22423
- * console.log(_.now() - stamp);
22424
- * }, _.now());
22425
- * // => Logs the number of milliseconds it took for the deferred invocation.
22426
- */
22427
- var now = function() {
22428
- return root.Date.now();
22429
- };
22430
-
22431
- /**
22432
- * Creates a debounced function that delays invoking `func` until after `wait`
22433
- * milliseconds have elapsed since the last time the debounced function was
22434
- * invoked. The debounced function comes with a `cancel` method to cancel
22435
- * delayed `func` invocations and a `flush` method to immediately invoke them.
22436
- * Provide `options` to indicate whether `func` should be invoked on the
22437
- * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
22438
- * with the last arguments provided to the debounced function. Subsequent
22439
- * calls to the debounced function return the result of the last `func`
22440
- * invocation.
22441
- *
22442
- * **Note:** If `leading` and `trailing` options are `true`, `func` is
22443
- * invoked on the trailing edge of the timeout only if the debounced function
22444
- * is invoked more than once during the `wait` timeout.
22445
- *
22446
- * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
22447
- * until to the next tick, similar to `setTimeout` with a timeout of `0`.
22448
- *
22449
- * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
22450
- * for details over the differences between `_.debounce` and `_.throttle`.
22451
- *
22452
- * @static
22453
- * @memberOf _
22454
- * @since 0.1.0
22455
- * @category Function
22456
- * @param {Function} func The function to debounce.
22457
- * @param {number} [wait=0] The number of milliseconds to delay.
22458
- * @param {Object} [options={}] The options object.
22459
- * @param {boolean} [options.leading=false]
22460
- * Specify invoking on the leading edge of the timeout.
22461
- * @param {number} [options.maxWait]
22462
- * The maximum time `func` is allowed to be delayed before it's invoked.
22463
- * @param {boolean} [options.trailing=true]
22464
- * Specify invoking on the trailing edge of the timeout.
22465
- * @returns {Function} Returns the new debounced function.
22466
- * @example
22467
- *
22468
- * // Avoid costly calculations while the window size is in flux.
22469
- * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
22470
- *
22471
- * // Invoke `sendMail` when clicked, debouncing subsequent calls.
22472
- * jQuery(element).on('click', _.debounce(sendMail, 300, {
22473
- * 'leading': true,
22474
- * 'trailing': false
22475
- * }));
22476
- *
22477
- * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
22478
- * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
22479
- * var source = new EventSource('/stream');
22480
- * jQuery(source).on('message', debounced);
22481
- *
22482
- * // Cancel the trailing debounced invocation.
22483
- * jQuery(window).on('popstate', debounced.cancel);
22484
- */
22485
- function debounce(func, wait, options) {
22486
- var lastArgs,
22487
- lastThis,
22488
- maxWait,
22489
- result,
22490
- timerId,
22491
- lastCallTime,
22492
- lastInvokeTime = 0,
22493
- leading = false,
22494
- maxing = false,
22495
- trailing = true;
22496
-
22497
- if (typeof func != 'function') {
22498
- throw new TypeError(FUNC_ERROR_TEXT);
22499
- }
22500
- wait = toNumber(wait) || 0;
22501
- if (isObject$1(options)) {
22502
- leading = !!options.leading;
22503
- maxing = 'maxWait' in options;
22504
- maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
22505
- trailing = 'trailing' in options ? !!options.trailing : trailing;
22506
- }
22507
-
22508
- function invokeFunc(time) {
22509
- var args = lastArgs,
22510
- thisArg = lastThis;
22511
-
22512
- lastArgs = lastThis = undefined;
22513
- lastInvokeTime = time;
22514
- result = func.apply(thisArg, args);
22515
- return result;
22516
- }
22517
-
22518
- function leadingEdge(time) {
22519
- // Reset any `maxWait` timer.
22520
- lastInvokeTime = time;
22521
- // Start the timer for the trailing edge.
22522
- timerId = setTimeout(timerExpired, wait);
22523
- // Invoke the leading edge.
22524
- return leading ? invokeFunc(time) : result;
22525
- }
22526
-
22527
- function remainingWait(time) {
22528
- var timeSinceLastCall = time - lastCallTime,
22529
- timeSinceLastInvoke = time - lastInvokeTime,
22530
- result = wait - timeSinceLastCall;
22531
-
22532
- return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
22533
- }
22534
-
22535
- function shouldInvoke(time) {
22536
- var timeSinceLastCall = time - lastCallTime,
22537
- timeSinceLastInvoke = time - lastInvokeTime;
22538
-
22539
- // Either this is the first call, activity has stopped and we're at the
22540
- // trailing edge, the system time has gone backwards and we're treating
22541
- // it as the trailing edge, or we've hit the `maxWait` limit.
22542
- return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
22543
- (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
22544
- }
22545
-
22546
- function timerExpired() {
22547
- var time = now();
22548
- if (shouldInvoke(time)) {
22549
- return trailingEdge(time);
22550
- }
22551
- // Restart the timer.
22552
- timerId = setTimeout(timerExpired, remainingWait(time));
22553
- }
22554
-
22555
- function trailingEdge(time) {
22556
- timerId = undefined;
22557
-
22558
- // Only invoke if we have `lastArgs` which means `func` has been
22559
- // debounced at least once.
22560
- if (trailing && lastArgs) {
22561
- return invokeFunc(time);
22562
- }
22563
- lastArgs = lastThis = undefined;
22564
- return result;
22565
- }
22566
-
22567
- function cancel() {
22568
- if (timerId !== undefined) {
22569
- clearTimeout(timerId);
22570
- }
22571
- lastInvokeTime = 0;
22572
- lastArgs = lastCallTime = lastThis = timerId = undefined;
22573
- }
22574
-
22575
- function flush() {
22576
- return timerId === undefined ? result : trailingEdge(now());
22577
- }
22578
-
22579
- function debounced() {
22580
- var time = now(),
22581
- isInvoking = shouldInvoke(time);
22582
-
22583
- lastArgs = arguments;
22584
- lastThis = this;
22585
- lastCallTime = time;
22586
-
22587
- if (isInvoking) {
22588
- if (timerId === undefined) {
22589
- return leadingEdge(lastCallTime);
22590
- }
22591
- if (maxing) {
22592
- // Handle invocations in a tight loop.
22593
- timerId = setTimeout(timerExpired, wait);
22594
- return invokeFunc(lastCallTime);
22595
- }
22596
- }
22597
- if (timerId === undefined) {
22598
- timerId = setTimeout(timerExpired, wait);
22599
- }
22600
- return result;
22601
- }
22602
- debounced.cancel = cancel;
22603
- debounced.flush = flush;
22604
- return debounced;
22605
- }
22606
-
22607
- /**
22608
- * Checks if `value` is the
22609
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
22610
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
22611
- *
22612
- * @static
22613
- * @memberOf _
22614
- * @since 0.1.0
22615
- * @category Lang
22616
- * @param {*} value The value to check.
22617
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
22618
- * @example
22619
- *
22620
- * _.isObject({});
22621
- * // => true
22622
- *
22623
- * _.isObject([1, 2, 3]);
22624
- * // => true
22625
- *
22626
- * _.isObject(_.noop);
22627
- * // => true
22628
- *
22629
- * _.isObject(null);
22630
- * // => false
22631
- */
22632
- function isObject$1(value) {
22633
- var type = typeof value;
22634
- return !!value && (type == 'object' || type == 'function');
22635
- }
22636
-
22637
- /**
22638
- * Checks if `value` is object-like. A value is object-like if it's not `null`
22639
- * and has a `typeof` result of "object".
22640
- *
22641
- * @static
22642
- * @memberOf _
22643
- * @since 4.0.0
22644
- * @category Lang
22645
- * @param {*} value The value to check.
22646
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
22647
- * @example
22648
- *
22649
- * _.isObjectLike({});
22650
- * // => true
22651
- *
22652
- * _.isObjectLike([1, 2, 3]);
22653
- * // => true
22654
- *
22655
- * _.isObjectLike(_.noop);
22656
- * // => false
22657
- *
22658
- * _.isObjectLike(null);
22659
- * // => false
22660
- */
22661
- function isObjectLike(value) {
22662
- return !!value && typeof value == 'object';
22663
- }
22664
-
22665
- /**
22666
- * Checks if `value` is classified as a `Symbol` primitive or object.
22667
- *
22668
- * @static
22669
- * @memberOf _
22670
- * @since 4.0.0
22671
- * @category Lang
22672
- * @param {*} value The value to check.
22673
- * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
22674
- * @example
22675
- *
22676
- * _.isSymbol(Symbol.iterator);
22677
- * // => true
22678
- *
22679
- * _.isSymbol('abc');
22680
- * // => false
22681
- */
22682
- function isSymbol(value) {
22683
- return typeof value == 'symbol' ||
22684
- (isObjectLike(value) && objectToString.call(value) == symbolTag);
22685
- }
22686
-
22687
- /**
22688
- * Converts `value` to a number.
22689
- *
22690
- * @static
22691
- * @memberOf _
22692
- * @since 4.0.0
22693
- * @category Lang
22694
- * @param {*} value The value to process.
22695
- * @returns {number} Returns the number.
22696
- * @example
22697
- *
22698
- * _.toNumber(3.2);
22699
- * // => 3.2
22700
- *
22701
- * _.toNumber(Number.MIN_VALUE);
22702
- * // => 5e-324
22703
- *
22704
- * _.toNumber(Infinity);
22705
- * // => Infinity
22706
- *
22707
- * _.toNumber('3.2');
22708
- * // => 3.2
22709
- */
22710
- function toNumber(value) {
22711
- if (typeof value == 'number') {
22712
- return value;
22713
- }
22714
- if (isSymbol(value)) {
22715
- return NAN;
22716
- }
22717
- if (isObject$1(value)) {
22718
- var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
22719
- value = isObject$1(other) ? (other + '') : other;
22720
- }
22721
- if (typeof value != 'string') {
22722
- return value === 0 ? value : +value;
22723
- }
22724
- value = value.replace(reTrim, '');
22725
- var isBinary = reIsBinary.test(value);
22726
- return (isBinary || reIsOctal.test(value))
22727
- ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
22728
- : (reIsBadHex.test(value) ? NAN : +value);
22729
- }
22730
-
22731
- var lodash_debounce = debounce;
22394
+ /** Default flush delays */
22395
+ const DEFAULT_FLUSH_MIN_DELAY = 5000;
22396
+ const DEFAULT_FLUSH_MAX_DELAY = 15000;
22397
+ const INITIAL_FLUSH_DELAY = 5000;
22732
22398
 
22733
22399
  /*! *****************************************************************************
22734
22400
  Copyright (c) Microsoft Corporation.
@@ -30815,28 +30481,88 @@ function createPayload({
30815
30481
 
30816
30482
  function createReplayEnvelope(
30817
30483
  replayEvent,
30818
- payloadWithSequence,
30484
+ recordingData,
30819
30485
  dsn,
30820
30486
  tunnel,
30821
30487
  ) {
30822
30488
  return createEnvelope(
30823
30489
  createEventEnvelopeHeaders(replayEvent, getSdkMetadataForEnvelopeHeader(replayEvent), tunnel, dsn),
30824
30490
  [
30825
- // @ts-ignore New types
30826
30491
  [{ type: 'replay_event' }, replayEvent],
30827
30492
  [
30828
30493
  {
30829
- // @ts-ignore setting envelope
30830
30494
  type: 'replay_recording',
30831
- length: payloadWithSequence.length,
30495
+ length: recordingData.length,
30832
30496
  },
30833
- // @ts-ignore: Type 'string' is not assignable to type 'ClientReport'.ts(2322)
30834
- payloadWithSequence,
30497
+ recordingData,
30835
30498
  ],
30836
30499
  ],
30837
30500
  );
30838
30501
  }
30839
30502
 
30503
+ /**
30504
+ * Heavily simplified debounce function based on lodash.debounce.
30505
+ *
30506
+ * This function takes a callback function (@param fun) and delays its invocation
30507
+ * by @param wait milliseconds. Optionally, a maxWait can be specified in @param options,
30508
+ * which ensures that the callback is invoked at least once after the specified max. wait time.
30509
+ *
30510
+ * @param func the function whose invocation is to be debounced
30511
+ * @param wait the minimum time until the function is invoked after it was called once
30512
+ * @param options the options object, which can contain the `maxWait` property
30513
+ *
30514
+ * @returns the debounced version of the function, which needs to be called at least once to start the
30515
+ * debouncing process. Subsequent calls will reset the debouncing timer and, in case @paramfunc
30516
+ * was already invoked in the meantime, return @param func's return value.
30517
+ * The debounced function has two additional properties:
30518
+ * - `flush`: Invokes the debounced function immediately and returns its return value
30519
+ * - `cancel`: Cancels the debouncing process and resets the debouncing timer
30520
+ */
30521
+ function debounce(func, wait, options) {
30522
+ let callbackReturnValue;
30523
+
30524
+ let timerId;
30525
+ let maxTimerId;
30526
+
30527
+ const maxWait = options && options.maxWait ? Math.max(options.maxWait, wait) : 0;
30528
+
30529
+ function invokeFunc() {
30530
+ cancelTimers();
30531
+ callbackReturnValue = func();
30532
+ return callbackReturnValue;
30533
+ }
30534
+
30535
+ function cancelTimers() {
30536
+ timerId !== undefined && clearTimeout(timerId);
30537
+ maxTimerId !== undefined && clearTimeout(maxTimerId);
30538
+ timerId = maxTimerId = undefined;
30539
+ }
30540
+
30541
+ function flush() {
30542
+ if (timerId !== undefined || maxTimerId !== undefined) {
30543
+ return invokeFunc();
30544
+ }
30545
+ return callbackReturnValue;
30546
+ }
30547
+
30548
+ function debounced() {
30549
+ if (timerId) {
30550
+ clearTimeout(timerId);
30551
+ }
30552
+ timerId = setTimeout(invokeFunc, wait);
30553
+
30554
+ if (maxWait && maxTimerId === undefined) {
30555
+ maxTimerId = setTimeout(invokeFunc, maxWait);
30556
+ }
30557
+
30558
+ return callbackReturnValue;
30559
+ }
30560
+
30561
+ debounced.cancel = cancelTimers;
30562
+ debounced.flush = flush;
30563
+ return debounced;
30564
+ }
30565
+
30840
30566
  async function getReplayEvent({
30841
30567
  client,
30842
30568
  scope,
@@ -30845,22 +30571,28 @@ async function getReplayEvent({
30845
30571
  }
30846
30572
 
30847
30573
  ) {
30848
- // XXX: This event does not trigger `beforeSend` in SDK
30849
- // @ts-ignore private api
30850
- const preparedEvent = await client._prepareEvent(event, { event_id }, scope);
30851
-
30852
- if (preparedEvent) {
30853
- // extract the SDK name because `client._prepareEvent` doesn't add it to the event
30854
- const metadata = client.getOptions() && client.getOptions()._metadata;
30855
- const { name } = (metadata && metadata.sdk) || {};
30574
+ const preparedEvent = (await prepareEvent(client.getOptions(), event, { event_id }, scope)) ;
30856
30575
 
30857
- preparedEvent.sdk = {
30858
- ...preparedEvent.sdk,
30859
- version: "7.28.1",
30860
- name,
30861
- };
30576
+ // If e.g. a global event processor returned null
30577
+ if (!preparedEvent) {
30578
+ return null;
30862
30579
  }
30863
30580
 
30581
+ // This normally happens in browser client "_prepareEvent"
30582
+ // but since we do not use this private method from the client, but rather the plain import
30583
+ // we need to do this manually.
30584
+ preparedEvent.platform = preparedEvent.platform || 'javascript';
30585
+
30586
+ // extract the SDK name because `client._prepareEvent` doesn't add it to the event
30587
+ const metadata = client.getSdkMetadata && client.getSdkMetadata();
30588
+ const name = (metadata && metadata.sdk && metadata.sdk.name) || 'sentry.javascript.unknown';
30589
+
30590
+ preparedEvent.sdk = {
30591
+ ...preparedEvent.sdk,
30592
+ version: "7.29.0",
30593
+ name,
30594
+ };
30595
+
30864
30596
  return preparedEvent;
30865
30597
  }
30866
30598
 
@@ -30880,7 +30612,7 @@ function overwriteRecordDroppedEvent(errorIds) {
30880
30612
  category,
30881
30613
  event,
30882
30614
  ) => {
30883
- if (event && event.event_id) {
30615
+ if (event && !event.type && event.event_id) {
30884
30616
  errorIds.delete(event.event_id);
30885
30617
  }
30886
30618
 
@@ -30977,7 +30709,7 @@ class ReplayContainer {
30977
30709
  this._recordingOptions = recordingOptions;
30978
30710
  this._options = options;
30979
30711
 
30980
- this._debouncedFlush = lodash_debounce(() => this.flush(), this._options.flushMinDelay, {
30712
+ this._debouncedFlush = debounce(() => this.flush(), this._options.flushMinDelay, {
30981
30713
  maxWait: this._options.flushMaxDelay,
30982
30714
  });
30983
30715
  }
@@ -31706,7 +31438,6 @@ class ReplayContainer {
31706
31438
  // A flush is about to happen, cancel any queued flushes
31707
31439
  _optionalChain([this, 'access', _30 => _30._debouncedFlush, 'optionalAccess', _31 => _31.cancel, 'call', _32 => _32()]);
31708
31440
 
31709
- // No existing flush in progress, proceed with flushing.
31710
31441
  // this._flushLock acts as a lock so that future calls to `flush()`
31711
31442
  // will be blocked until this promise resolves
31712
31443
  if (!this._flushLock) {
@@ -31739,8 +31470,8 @@ class ReplayContainer {
31739
31470
  */
31740
31471
  flushImmediate() {
31741
31472
  this._debouncedFlush();
31742
- // `.flush` is provided by lodash.debounce
31743
- return this._debouncedFlush.flush();
31473
+ // `.flush` is provided by the debounced function, analogously to lodash.debounce
31474
+ return this._debouncedFlush.flush() ;
31744
31475
  }
31745
31476
 
31746
31477
  /**
@@ -31789,7 +31520,9 @@ class ReplayContainer {
31789
31520
  const replayEvent = await getReplayEvent({ scope, client, replayId, event: baseEvent });
31790
31521
 
31791
31522
  if (!replayEvent) {
31792
- (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger.error('[Replay] An event processor returned null, will not send replay.');
31523
+ // Taken from baseclient's `_processEvent` method, where this is handled for errors/transactions
31524
+ client.recordDroppedEvent('event_processor', 'replay_event', baseEvent);
31525
+ (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger.log('An event processor returned `null`, will not send event.');
31793
31526
  return;
31794
31527
  }
31795
31528
 
@@ -31839,7 +31572,7 @@ class ReplayContainer {
31839
31572
  const envelope = createReplayEnvelope(replayEvent, payloadWithSequence, dsn, client.getOptions().tunnel);
31840
31573
 
31841
31574
  try {
31842
- return transport.send(envelope);
31575
+ return await transport.send(envelope);
31843
31576
  } catch (e) {
31844
31577
  throw new Error(UNABLE_TO_SEND_REPLAY);
31845
31578
  }
@@ -31952,14 +31685,15 @@ class Replay {
31952
31685
  }
31953
31686
 
31954
31687
  constructor({
31955
- flushMinDelay = 5000,
31956
- flushMaxDelay = 15000,
31957
- initialFlushDelay = 5000,
31688
+ flushMinDelay = DEFAULT_FLUSH_MIN_DELAY,
31689
+ flushMaxDelay = DEFAULT_FLUSH_MAX_DELAY,
31690
+ initialFlushDelay = INITIAL_FLUSH_DELAY,
31958
31691
  stickySession = true,
31959
31692
  useCompression = true,
31960
31693
  sessionSampleRate,
31961
31694
  errorSampleRate,
31962
- maskAllText = true,
31695
+ maskAllText,
31696
+ maskTextSelector,
31963
31697
  maskAllInputs = true,
31964
31698
  blockAllMedia = true,
31965
31699
  _experiments = {},
@@ -31974,6 +31708,7 @@ class Replay {
31974
31708
  blockClass,
31975
31709
  ignoreClass,
31976
31710
  maskTextClass,
31711
+ maskTextSelector,
31977
31712
  blockSelector,
31978
31713
  ...recordingOptions,
31979
31714
  };
@@ -31986,7 +31721,7 @@ class Replay {
31986
31721
  sessionSampleRate: DEFAULT_SESSION_SAMPLE_RATE,
31987
31722
  errorSampleRate: DEFAULT_ERROR_SAMPLE_RATE,
31988
31723
  useCompression,
31989
- maskAllText,
31724
+ maskAllText: typeof maskAllText === 'boolean' ? maskAllText : !maskTextSelector,
31990
31725
  blockAllMedia,
31991
31726
  _experiments,
31992
31727
  };
@@ -37955,7 +37690,7 @@ var Preview = /*#__PURE__*/(0, _react.lazy)(function () {
37955
37690
  });
37956
37691
  });
37957
37692
  var IS_BROWSER = typeof window !== 'undefined' && window.document;
37958
- var IS_GLOBAL = typeof commonjsGlobal$1 !== 'undefined' && commonjsGlobal$1.window && commonjsGlobal$1.window.document;
37693
+ var IS_GLOBAL = typeof commonjsGlobal !== 'undefined' && commonjsGlobal.window && commonjsGlobal.window.document;
37959
37694
  var SUPPORTED_PROPS = Object.keys(_props.propTypes); // Return null when rendering on the server
37960
37695
  // as Suspense is not supported yet
37961
37696