@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.
@@ -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
  /** Console logging verbosity for the SDK. */
4
4
  var LogLevel;
@@ -4280,7 +4280,7 @@ var Sentry = (function (exports) {
4280
4280
  hub.bindClient(client);
4281
4281
  }
4282
4282
 
4283
- const SDK_VERSION = '6.13.0-beta.1';
4283
+ const SDK_VERSION = '6.13.1';
4284
4284
 
4285
4285
  let originalFunctionToString;
4286
4286
  /** Patch toString calls to return proper name for wrapped functions */
@@ -4971,7 +4971,7 @@ var Sentry = (function (exports) {
4971
4971
  this._api = new API(options.dsn, options._metadata, options.tunnel);
4972
4972
  // eslint-disable-next-line deprecation/deprecation
4973
4973
  this.url = this._api.getStoreEndpointWithUrlEncodedAuth();
4974
- if (this.options.sendClientReports) {
4974
+ if (this.options.sendClientReports && document) {
4975
4975
  document.addEventListener('visibilitychange', () => {
4976
4976
  if (document.visibilityState === 'hidden') {
4977
4977
  this._flushOutcomes();
@@ -5028,11 +5028,13 @@ var Sentry = (function (exports) {
5028
5028
  }
5029
5029
  logger.log(`Flushing outcomes:\n${JSON.stringify(outcomes, null, 2)}`);
5030
5030
  const url = this._api.getEnvelopeEndpointWithUrlEncodedAuth();
5031
+ // Envelope header is required to be at least an empty object
5032
+ const envelopeHeader = JSON.stringify({});
5031
5033
  const itemHeaders = JSON.stringify({
5032
5034
  type: 'client_report',
5033
5035
  });
5034
5036
  const item = JSON.stringify({
5035
- timestamp: Date.now(),
5037
+ timestamp: dateTimestampInSeconds(),
5036
5038
  discarded_events: Object.keys(outcomes).map(key => {
5037
5039
  const [category, reason] = key.split(':');
5038
5040
  return {
@@ -5042,7 +5044,7 @@ var Sentry = (function (exports) {
5042
5044
  };
5043
5045
  }),
5044
5046
  });
5045
- const envelope = `${itemHeaders}\n${item}`;
5047
+ const envelope = `${envelopeHeader}\n${itemHeaders}\n${item}`;
5046
5048
  navigator.sendBeacon(url, envelope);
5047
5049
  }
5048
5050
  /**