@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/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;
@@ -8828,7 +8828,7 @@ var platform$1 = {exports: {}};
8828
8828
  var freeModule = module && !module.nodeType && module;
8829
8829
 
8830
8830
  /** 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;
8831
+ var freeGlobal = freeExports && freeModule && typeof commonjsGlobal == 'object' && commonjsGlobal;
8832
8832
  if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) {
8833
8833
  root = freeGlobal;
8834
8834
  }
@@ -10041,7 +10041,7 @@ var platform$1 = {exports: {}};
10041
10041
  // Export to the global object.
10042
10042
  root.platform = platform;
10043
10043
  }
10044
- }.call(commonjsGlobal$1));
10044
+ }.call(commonjsGlobal));
10045
10045
  } (platform$1, platform$1.exports));
10046
10046
 
10047
10047
  var platform = platform$1.exports;
@@ -14970,7 +14970,7 @@ const Explanation = ({ isVideoQuestion, thinkingTime }) => {
14970
14970
  };
14971
14971
 
14972
14972
  // eslint-disable-next-line @typescript-eslint/unbound-method
14973
- const objectToString$1 = Object.prototype.toString;
14973
+ const objectToString = Object.prototype.toString;
14974
14974
 
14975
14975
  /**
14976
14976
  * Checks whether given value's type is one of a few Error or Error-like
@@ -14980,7 +14980,7 @@ const objectToString$1 = Object.prototype.toString;
14980
14980
  * @returns A boolean representing the result.
14981
14981
  */
14982
14982
  function isError(wat) {
14983
- switch (objectToString$1.call(wat)) {
14983
+ switch (objectToString.call(wat)) {
14984
14984
  case '[object Error]':
14985
14985
  case '[object Exception]':
14986
14986
  case '[object DOMException]':
@@ -14997,7 +14997,7 @@ function isError(wat) {
14997
14997
  * @returns A boolean representing the result.
14998
14998
  */
14999
14999
  function isBuiltin(wat, className) {
15000
- return objectToString$1.call(wat) === `[object ${className}]`;
15000
+ return objectToString.call(wat) === `[object ${className}]`;
15001
15001
  }
15002
15002
 
15003
15003
  /**
@@ -17723,6 +17723,8 @@ const ITEM_TYPE_TO_DATA_CATEGORY_MAP = {
17723
17723
  client_report: 'internal',
17724
17724
  user_report: 'default',
17725
17725
  profile: 'profile',
17726
+ replay_event: 'replay_event',
17727
+ replay_recording: 'replay_recording',
17726
17728
  };
17727
17729
 
17728
17730
  /**
@@ -19300,6 +19302,194 @@ function setupIntegrations(integrations) {
19300
19302
  return integrationIndex;
19301
19303
  }
19302
19304
 
19305
+ /**
19306
+ * Adds common information to events.
19307
+ *
19308
+ * The information includes release and environment from `options`,
19309
+ * breadcrumbs and context (extra, tags and user) from the scope.
19310
+ *
19311
+ * Information that is already present in the event is never overwritten. For
19312
+ * nested objects, such as the context, keys are merged.
19313
+ *
19314
+ * Note: This also triggers callbacks for `addGlobalEventProcessor`, but not `beforeSend`.
19315
+ *
19316
+ * @param event The original event.
19317
+ * @param hint May contain additional information about the original exception.
19318
+ * @param scope A scope containing event metadata.
19319
+ * @returns A new event with more information.
19320
+ * @hidden
19321
+ */
19322
+ function prepareEvent(
19323
+ options,
19324
+ event,
19325
+ hint,
19326
+ scope,
19327
+ ) {
19328
+ const { normalizeDepth = 3, normalizeMaxBreadth = 1000 } = options;
19329
+ const prepared = {
19330
+ ...event,
19331
+ event_id: event.event_id || hint.event_id || uuid4(),
19332
+ timestamp: event.timestamp || dateTimestampInSeconds(),
19333
+ };
19334
+
19335
+ applyClientOptions(prepared, options);
19336
+ applyIntegrationsMetadata(
19337
+ prepared,
19338
+ options.integrations.map(i => i.name),
19339
+ );
19340
+
19341
+ // If we have scope given to us, use it as the base for further modifications.
19342
+ // This allows us to prevent unnecessary copying of data if `captureContext` is not provided.
19343
+ let finalScope = scope;
19344
+ if (hint.captureContext) {
19345
+ finalScope = Scope.clone(finalScope).update(hint.captureContext);
19346
+ }
19347
+
19348
+ // We prepare the result here with a resolved Event.
19349
+ let result = resolvedSyncPromise(prepared);
19350
+
19351
+ // This should be the last thing called, since we want that
19352
+ // {@link Hub.addEventProcessor} gets the finished prepared event.
19353
+ //
19354
+ // We need to check for the existence of `finalScope.getAttachments`
19355
+ // because `getAttachments` can be undefined if users are using an older version
19356
+ // of `@sentry/core` that does not have the `getAttachments` method.
19357
+ // See: https://github.com/getsentry/sentry-javascript/issues/5229
19358
+ if (finalScope) {
19359
+ // Collect attachments from the hint and scope
19360
+ if (finalScope.getAttachments) {
19361
+ const attachments = [...(hint.attachments || []), ...finalScope.getAttachments()];
19362
+
19363
+ if (attachments.length) {
19364
+ hint.attachments = attachments;
19365
+ }
19366
+ }
19367
+
19368
+ // In case we have a hub we reassign it.
19369
+ result = finalScope.applyToEvent(prepared, hint);
19370
+ }
19371
+
19372
+ return result.then(evt => {
19373
+ if (typeof normalizeDepth === 'number' && normalizeDepth > 0) {
19374
+ return normalizeEvent(evt, normalizeDepth, normalizeMaxBreadth);
19375
+ }
19376
+ return evt;
19377
+ });
19378
+ }
19379
+
19380
+ /**
19381
+ * Enhances event using the client configuration.
19382
+ * It takes care of all "static" values like environment, release and `dist`,
19383
+ * as well as truncating overly long values.
19384
+ * @param event event instance to be enhanced
19385
+ */
19386
+ function applyClientOptions(event, options) {
19387
+ const { environment, release, dist, maxValueLength = 250 } = options;
19388
+
19389
+ if (!('environment' in event)) {
19390
+ event.environment = 'environment' in options ? environment : 'production';
19391
+ }
19392
+
19393
+ if (event.release === undefined && release !== undefined) {
19394
+ event.release = release;
19395
+ }
19396
+
19397
+ if (event.dist === undefined && dist !== undefined) {
19398
+ event.dist = dist;
19399
+ }
19400
+
19401
+ if (event.message) {
19402
+ event.message = truncate(event.message, maxValueLength);
19403
+ }
19404
+
19405
+ const exception = event.exception && event.exception.values && event.exception.values[0];
19406
+ if (exception && exception.value) {
19407
+ exception.value = truncate(exception.value, maxValueLength);
19408
+ }
19409
+
19410
+ const request = event.request;
19411
+ if (request && request.url) {
19412
+ request.url = truncate(request.url, maxValueLength);
19413
+ }
19414
+ }
19415
+
19416
+ /**
19417
+ * This function adds all used integrations to the SDK info in the event.
19418
+ * @param event The event that will be filled with all integrations.
19419
+ */
19420
+ function applyIntegrationsMetadata(event, integrationNames) {
19421
+ if (integrationNames.length > 0) {
19422
+ event.sdk = event.sdk || {};
19423
+ event.sdk.integrations = [...(event.sdk.integrations || []), ...integrationNames];
19424
+ }
19425
+ }
19426
+
19427
+ /**
19428
+ * Applies `normalize` function on necessary `Event` attributes to make them safe for serialization.
19429
+ * Normalized keys:
19430
+ * - `breadcrumbs.data`
19431
+ * - `user`
19432
+ * - `contexts`
19433
+ * - `extra`
19434
+ * @param event Event
19435
+ * @returns Normalized event
19436
+ */
19437
+ function normalizeEvent(event, depth, maxBreadth) {
19438
+ if (!event) {
19439
+ return null;
19440
+ }
19441
+
19442
+ const normalized = {
19443
+ ...event,
19444
+ ...(event.breadcrumbs && {
19445
+ breadcrumbs: event.breadcrumbs.map(b => ({
19446
+ ...b,
19447
+ ...(b.data && {
19448
+ data: normalize(b.data, depth, maxBreadth),
19449
+ }),
19450
+ })),
19451
+ }),
19452
+ ...(event.user && {
19453
+ user: normalize(event.user, depth, maxBreadth),
19454
+ }),
19455
+ ...(event.contexts && {
19456
+ contexts: normalize(event.contexts, depth, maxBreadth),
19457
+ }),
19458
+ ...(event.extra && {
19459
+ extra: normalize(event.extra, depth, maxBreadth),
19460
+ }),
19461
+ };
19462
+
19463
+ // event.contexts.trace stores information about a Transaction. Similarly,
19464
+ // event.spans[] stores information about child Spans. Given that a
19465
+ // Transaction is conceptually a Span, normalization should apply to both
19466
+ // Transactions and Spans consistently.
19467
+ // For now the decision is to skip normalization of Transactions and Spans,
19468
+ // so this block overwrites the normalized event to add back the original
19469
+ // Transaction information prior to normalization.
19470
+ if (event.contexts && event.contexts.trace && normalized.contexts) {
19471
+ normalized.contexts.trace = event.contexts.trace;
19472
+
19473
+ // event.contexts.trace.data may contain circular/dangerous data so we need to normalize it
19474
+ if (event.contexts.trace.data) {
19475
+ normalized.contexts.trace.data = normalize(event.contexts.trace.data, depth, maxBreadth);
19476
+ }
19477
+ }
19478
+
19479
+ // event.spans[].data may contain circular/dangerous data so we need to normalize it
19480
+ if (event.spans) {
19481
+ normalized.spans = event.spans.map(span => {
19482
+ // We cannot use the spread operator here because `toJSON` on `span` is non-enumerable
19483
+ if (span.data) {
19484
+ span.data = normalize(span.data, depth, maxBreadth);
19485
+ }
19486
+ return span;
19487
+ });
19488
+ }
19489
+
19490
+ return normalized;
19491
+ }
19492
+
19303
19493
  const ALREADY_SEEN_ERROR = "Not capturing exception because it's already been captured.";
19304
19494
 
19305
19495
  /**
@@ -19474,6 +19664,15 @@ class BaseClient {
19474
19664
  return this._options;
19475
19665
  }
19476
19666
 
19667
+ /**
19668
+ * @see SdkMetadata in @sentry/types
19669
+ *
19670
+ * @return The metadata of the SDK
19671
+ */
19672
+ getSdkMetadata() {
19673
+ return this._options._metadata;
19674
+ }
19675
+
19477
19676
  /**
19478
19677
  * @inheritDoc
19479
19678
  */
@@ -19574,7 +19773,7 @@ class BaseClient {
19574
19773
  // Note: we use `event` in replay, where we overwrite this hook.
19575
19774
 
19576
19775
  if (this._options.sendClientReports) {
19577
- // We want to track each category (error, transaction, session) separately
19776
+ // We want to track each category (error, transaction, session, replay_event) separately
19578
19777
  // but still keep the distinction between different type of outcomes.
19579
19778
  // We could use nested maps, but it's much easier to read and type this way.
19580
19779
  // A correct type for map-based implementation if we want to go that route
@@ -19671,166 +19870,8 @@ class BaseClient {
19671
19870
  * @returns A new event with more information.
19672
19871
  */
19673
19872
  _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
19873
  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
- }
19874
+ return prepareEvent(options, event, hint, scope);
19834
19875
  }
19835
19876
 
19836
19877
  /**
@@ -20165,7 +20206,7 @@ function getEventForEnvelopeItem(item, type) {
20165
20206
  return Array.isArray(item) ? (item )[1] : undefined;
20166
20207
  }
20167
20208
 
20168
- const SDK_VERSION = '7.28.1';
20209
+ const SDK_VERSION = '7.29.0';
20169
20210
 
20170
20211
  let originalFunctionToString;
20171
20212
 
@@ -22374,387 +22415,12 @@ const DEFAULT_SESSION_SAMPLE_RATE = 0.1;
22374
22415
  const DEFAULT_ERROR_SAMPLE_RATE = 1.0;
22375
22416
 
22376
22417
  /** 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;
22418
+ const MASK_ALL_TEXT_SELECTOR = 'body *:not(style), body *:not(script)';
22395
22419
 
22396
- /** `Object#toString` result references. */
22397
- var symbolTag = '[object Symbol]';
22398
-
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;
22420
+ /** Default flush delays */
22421
+ const DEFAULT_FLUSH_MIN_DELAY = 5000;
22422
+ const DEFAULT_FLUSH_MAX_DELAY = 15000;
22423
+ const INITIAL_FLUSH_DELAY = 5000;
22758
22424
 
22759
22425
  /*! *****************************************************************************
22760
22426
  Copyright (c) Microsoft Corporation.
@@ -30841,28 +30507,88 @@ function createPayload({
30841
30507
 
30842
30508
  function createReplayEnvelope(
30843
30509
  replayEvent,
30844
- payloadWithSequence,
30510
+ recordingData,
30845
30511
  dsn,
30846
30512
  tunnel,
30847
30513
  ) {
30848
30514
  return createEnvelope(
30849
30515
  createEventEnvelopeHeaders(replayEvent, getSdkMetadataForEnvelopeHeader(replayEvent), tunnel, dsn),
30850
30516
  [
30851
- // @ts-ignore New types
30852
30517
  [{ type: 'replay_event' }, replayEvent],
30853
30518
  [
30854
30519
  {
30855
- // @ts-ignore setting envelope
30856
30520
  type: 'replay_recording',
30857
- length: payloadWithSequence.length,
30521
+ length: recordingData.length,
30858
30522
  },
30859
- // @ts-ignore: Type 'string' is not assignable to type 'ClientReport'.ts(2322)
30860
- payloadWithSequence,
30523
+ recordingData,
30861
30524
  ],
30862
30525
  ],
30863
30526
  );
30864
30527
  }
30865
30528
 
30529
+ /**
30530
+ * Heavily simplified debounce function based on lodash.debounce.
30531
+ *
30532
+ * This function takes a callback function (@param fun) and delays its invocation
30533
+ * by @param wait milliseconds. Optionally, a maxWait can be specified in @param options,
30534
+ * which ensures that the callback is invoked at least once after the specified max. wait time.
30535
+ *
30536
+ * @param func the function whose invocation is to be debounced
30537
+ * @param wait the minimum time until the function is invoked after it was called once
30538
+ * @param options the options object, which can contain the `maxWait` property
30539
+ *
30540
+ * @returns the debounced version of the function, which needs to be called at least once to start the
30541
+ * debouncing process. Subsequent calls will reset the debouncing timer and, in case @paramfunc
30542
+ * was already invoked in the meantime, return @param func's return value.
30543
+ * The debounced function has two additional properties:
30544
+ * - `flush`: Invokes the debounced function immediately and returns its return value
30545
+ * - `cancel`: Cancels the debouncing process and resets the debouncing timer
30546
+ */
30547
+ function debounce(func, wait, options) {
30548
+ let callbackReturnValue;
30549
+
30550
+ let timerId;
30551
+ let maxTimerId;
30552
+
30553
+ const maxWait = options && options.maxWait ? Math.max(options.maxWait, wait) : 0;
30554
+
30555
+ function invokeFunc() {
30556
+ cancelTimers();
30557
+ callbackReturnValue = func();
30558
+ return callbackReturnValue;
30559
+ }
30560
+
30561
+ function cancelTimers() {
30562
+ timerId !== undefined && clearTimeout(timerId);
30563
+ maxTimerId !== undefined && clearTimeout(maxTimerId);
30564
+ timerId = maxTimerId = undefined;
30565
+ }
30566
+
30567
+ function flush() {
30568
+ if (timerId !== undefined || maxTimerId !== undefined) {
30569
+ return invokeFunc();
30570
+ }
30571
+ return callbackReturnValue;
30572
+ }
30573
+
30574
+ function debounced() {
30575
+ if (timerId) {
30576
+ clearTimeout(timerId);
30577
+ }
30578
+ timerId = setTimeout(invokeFunc, wait);
30579
+
30580
+ if (maxWait && maxTimerId === undefined) {
30581
+ maxTimerId = setTimeout(invokeFunc, maxWait);
30582
+ }
30583
+
30584
+ return callbackReturnValue;
30585
+ }
30586
+
30587
+ debounced.cancel = cancelTimers;
30588
+ debounced.flush = flush;
30589
+ return debounced;
30590
+ }
30591
+
30866
30592
  async function getReplayEvent({
30867
30593
  client,
30868
30594
  scope,
@@ -30871,22 +30597,28 @@ async function getReplayEvent({
30871
30597
  }
30872
30598
 
30873
30599
  ) {
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);
30877
-
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) || {};
30600
+ const preparedEvent = (await prepareEvent(client.getOptions(), event, { event_id }, scope)) ;
30882
30601
 
30883
- preparedEvent.sdk = {
30884
- ...preparedEvent.sdk,
30885
- version: "7.28.1",
30886
- name,
30887
- };
30602
+ // If e.g. a global event processor returned null
30603
+ if (!preparedEvent) {
30604
+ return null;
30888
30605
  }
30889
30606
 
30607
+ // This normally happens in browser client "_prepareEvent"
30608
+ // but since we do not use this private method from the client, but rather the plain import
30609
+ // we need to do this manually.
30610
+ preparedEvent.platform = preparedEvent.platform || 'javascript';
30611
+
30612
+ // extract the SDK name because `client._prepareEvent` doesn't add it to the event
30613
+ const metadata = client.getSdkMetadata && client.getSdkMetadata();
30614
+ const name = (metadata && metadata.sdk && metadata.sdk.name) || 'sentry.javascript.unknown';
30615
+
30616
+ preparedEvent.sdk = {
30617
+ ...preparedEvent.sdk,
30618
+ version: "7.29.0",
30619
+ name,
30620
+ };
30621
+
30890
30622
  return preparedEvent;
30891
30623
  }
30892
30624
 
@@ -30906,7 +30638,7 @@ function overwriteRecordDroppedEvent(errorIds) {
30906
30638
  category,
30907
30639
  event,
30908
30640
  ) => {
30909
- if (event && event.event_id) {
30641
+ if (event && !event.type && event.event_id) {
30910
30642
  errorIds.delete(event.event_id);
30911
30643
  }
30912
30644
 
@@ -31003,7 +30735,7 @@ class ReplayContainer {
31003
30735
  this._recordingOptions = recordingOptions;
31004
30736
  this._options = options;
31005
30737
 
31006
- this._debouncedFlush = lodash_debounce(() => this.flush(), this._options.flushMinDelay, {
30738
+ this._debouncedFlush = debounce(() => this.flush(), this._options.flushMinDelay, {
31007
30739
  maxWait: this._options.flushMaxDelay,
31008
30740
  });
31009
30741
  }
@@ -31732,7 +31464,6 @@ class ReplayContainer {
31732
31464
  // A flush is about to happen, cancel any queued flushes
31733
31465
  _optionalChain([this, 'access', _30 => _30._debouncedFlush, 'optionalAccess', _31 => _31.cancel, 'call', _32 => _32()]);
31734
31466
 
31735
- // No existing flush in progress, proceed with flushing.
31736
31467
  // this._flushLock acts as a lock so that future calls to `flush()`
31737
31468
  // will be blocked until this promise resolves
31738
31469
  if (!this._flushLock) {
@@ -31765,8 +31496,8 @@ class ReplayContainer {
31765
31496
  */
31766
31497
  flushImmediate() {
31767
31498
  this._debouncedFlush();
31768
- // `.flush` is provided by lodash.debounce
31769
- return this._debouncedFlush.flush();
31499
+ // `.flush` is provided by the debounced function, analogously to lodash.debounce
31500
+ return this._debouncedFlush.flush() ;
31770
31501
  }
31771
31502
 
31772
31503
  /**
@@ -31815,7 +31546,9 @@ class ReplayContainer {
31815
31546
  const replayEvent = await getReplayEvent({ scope, client, replayId, event: baseEvent });
31816
31547
 
31817
31548
  if (!replayEvent) {
31818
- (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger.error('[Replay] An event processor returned null, will not send replay.');
31549
+ // Taken from baseclient's `_processEvent` method, where this is handled for errors/transactions
31550
+ client.recordDroppedEvent('event_processor', 'replay_event', baseEvent);
31551
+ (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && logger.log('An event processor returned `null`, will not send event.');
31819
31552
  return;
31820
31553
  }
31821
31554
 
@@ -31865,7 +31598,7 @@ class ReplayContainer {
31865
31598
  const envelope = createReplayEnvelope(replayEvent, payloadWithSequence, dsn, client.getOptions().tunnel);
31866
31599
 
31867
31600
  try {
31868
- return transport.send(envelope);
31601
+ return await transport.send(envelope);
31869
31602
  } catch (e) {
31870
31603
  throw new Error(UNABLE_TO_SEND_REPLAY);
31871
31604
  }
@@ -31978,14 +31711,15 @@ class Replay {
31978
31711
  }
31979
31712
 
31980
31713
  constructor({
31981
- flushMinDelay = 5000,
31982
- flushMaxDelay = 15000,
31983
- initialFlushDelay = 5000,
31714
+ flushMinDelay = DEFAULT_FLUSH_MIN_DELAY,
31715
+ flushMaxDelay = DEFAULT_FLUSH_MAX_DELAY,
31716
+ initialFlushDelay = INITIAL_FLUSH_DELAY,
31984
31717
  stickySession = true,
31985
31718
  useCompression = true,
31986
31719
  sessionSampleRate,
31987
31720
  errorSampleRate,
31988
- maskAllText = true,
31721
+ maskAllText,
31722
+ maskTextSelector,
31989
31723
  maskAllInputs = true,
31990
31724
  blockAllMedia = true,
31991
31725
  _experiments = {},
@@ -32000,6 +31734,7 @@ class Replay {
32000
31734
  blockClass,
32001
31735
  ignoreClass,
32002
31736
  maskTextClass,
31737
+ maskTextSelector,
32003
31738
  blockSelector,
32004
31739
  ...recordingOptions,
32005
31740
  };
@@ -32012,7 +31747,7 @@ class Replay {
32012
31747
  sessionSampleRate: DEFAULT_SESSION_SAMPLE_RATE,
32013
31748
  errorSampleRate: DEFAULT_ERROR_SAMPLE_RATE,
32014
31749
  useCompression,
32015
- maskAllText,
31750
+ maskAllText: typeof maskAllText === 'boolean' ? maskAllText : !maskTextSelector,
32016
31751
  blockAllMedia,
32017
31752
  _experiments,
32018
31753
  };
@@ -37981,7 +37716,7 @@ var Preview = /*#__PURE__*/(0, _react.lazy)(function () {
37981
37716
  });
37982
37717
  });
37983
37718
  var IS_BROWSER = typeof window !== 'undefined' && window.document;
37984
- var IS_GLOBAL = typeof commonjsGlobal$1 !== 'undefined' && commonjsGlobal$1.window && commonjsGlobal$1.window.document;
37719
+ var IS_GLOBAL = typeof commonjsGlobal !== 'undefined' && commonjsGlobal.window && commonjsGlobal.window.document;
37985
37720
  var SUPPORTED_PROPS = Object.keys(_props.propTypes); // Return null when rendering on the server
37986
37721
  // as Suspense is not supported yet
37987
37722