@sentry/browser 6.13.0-beta.1 → 6.13.1

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/build/bundle.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @sentry/browser 6.13.0-beta.1 (3db47b0) | https://github.com/getsentry/sentry-javascript */
1
+ /*! @sentry/browser 6.13.1 (fdf519b) | https://github.com/getsentry/sentry-javascript */
2
2
  var Sentry = (function (exports) {
3
3
  /*! *****************************************************************************
4
4
  Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4478,7 +4478,7 @@ var Sentry = (function (exports) {
4478
4478
  hub.bindClient(client);
4479
4479
  }
4480
4480
 
4481
- var SDK_VERSION = '6.13.0-beta.1';
4481
+ var SDK_VERSION = '6.13.1';
4482
4482
 
4483
4483
  var originalFunctionToString;
4484
4484
  /** Patch toString calls to return proper name for wrapped functions */
@@ -5166,7 +5166,7 @@ var Sentry = (function (exports) {
5166
5166
  this._api = new API(options.dsn, options._metadata, options.tunnel);
5167
5167
  // eslint-disable-next-line deprecation/deprecation
5168
5168
  this.url = this._api.getStoreEndpointWithUrlEncodedAuth();
5169
- if (this.options.sendClientReports) {
5169
+ if (this.options.sendClientReports && document) {
5170
5170
  document.addEventListener('visibilitychange', function () {
5171
5171
  if (document.visibilityState === 'hidden') {
5172
5172
  _this._flushOutcomes();
@@ -5223,11 +5223,13 @@ var Sentry = (function (exports) {
5223
5223
  }
5224
5224
  logger.log("Flushing outcomes:\n" + JSON.stringify(outcomes, null, 2));
5225
5225
  var url = this._api.getEnvelopeEndpointWithUrlEncodedAuth();
5226
+ // Envelope header is required to be at least an empty object
5227
+ var envelopeHeader = JSON.stringify({});
5226
5228
  var itemHeaders = JSON.stringify({
5227
5229
  type: 'client_report',
5228
5230
  });
5229
5231
  var item = JSON.stringify({
5230
- timestamp: Date.now(),
5232
+ timestamp: dateTimestampInSeconds(),
5231
5233
  discarded_events: Object.keys(outcomes).map(function (key) {
5232
5234
  var _a = __read(key.split(':'), 2), category = _a[0], reason = _a[1];
5233
5235
  return {
@@ -5237,7 +5239,7 @@ var Sentry = (function (exports) {
5237
5239
  };
5238
5240
  }),
5239
5241
  });
5240
- var envelope = itemHeaders + "\n" + item;
5242
+ var envelope = envelopeHeader + "\n" + itemHeaders + "\n" + item;
5241
5243
  navigator.sendBeacon(url, envelope);
5242
5244
  };
5243
5245
  /**