@commercetools-frontend/sentry 24.13.0 → 25.1.0

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.
@@ -5,7 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
6
6
  var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
7
7
  var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
8
- var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
9
8
  var Sentry = require('@sentry/react');
10
9
  var browser = require('@sentry/browser');
11
10
  var history = require('@commercetools-frontend/browser-history');
@@ -40,13 +39,12 @@ function _interopNamespace(e) {
40
39
  var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
41
40
  var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
42
41
  var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
43
- var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
44
42
  var Sentry__namespace = /*#__PURE__*/_interopNamespace(Sentry);
45
43
  var history__default = /*#__PURE__*/_interopDefault(history);
46
44
  var _Reflect$construct__default = /*#__PURE__*/_interopDefault(_Reflect$construct);
47
45
 
48
46
  // NOTE: This string will be replaced on build time with the package version.
49
- var version = "24.13.0";
47
+ var version = "25.1.0";
50
48
 
51
49
  const makeErrorToCapture = error => {
52
50
  if (error instanceof Error) return error;
@@ -93,11 +91,10 @@ const redactUnsafeEventFields = event => {
93
91
  };
94
92
  const boot = () => {
95
93
  if (window.app.trackingSentry && window.app.trackingSentry !== 'null') {
96
- var _context2;
97
94
  Sentry__namespace.init({
98
95
  dsn: window.app.trackingSentry,
99
96
  release: window.app.revision,
100
- environment: _concatInstanceProperty__default["default"](_context2 = "".concat(window.app.env, "-")).call(_context2, window.app.location),
97
+ environment: `${window.app.env}-${window.app.location}`,
101
98
  // In order to reduce the noise in sentry we only track errors that come
102
99
  // from our code and ignore errors that come from other services
103
100
  // https://blog.sentry.io/2017/03/27/tips-for-reducing-javascript-error-noise.html
@@ -117,14 +114,16 @@ const boot = () => {
117
114
  // we can implement the `tracesSampler` function.
118
115
  // https://docs.sentry.io/platforms/javascript/guides/react/configuration/sampling/#sampling-transaction-events
119
116
  tracesSampleRate: 0.05,
120
- beforeSend(event) {
117
+ // v8 requires the hint parameter which provides additional error context.
118
+ // We only redact PII from event fields, so hint is unused for now.
119
+ beforeSend(event, _hint) {
121
120
  return redactUnsafeEventFields(event);
122
121
  }
123
122
  });
124
123
  const sentryScope = Sentry__namespace.getCurrentScope();
125
124
  sentryScope.setTag('role', 'frontend');
126
125
  sentryScope.setTag('applicationName', window.app.applicationName);
127
- sentryScope.setTag('service', "merchant-center-frontend-".concat(window.app.applicationName));
126
+ sentryScope.setTag('service', `merchant-center-frontend-${window.app.applicationName}`);
128
127
  }
129
128
  };
130
129
  const isExtraAsObject = extrasOrExtra => typeof extrasOrExtra === 'object';
@@ -134,7 +133,7 @@ const reportErrorToSentry = (error, extraInfo, getIsEnabled) => {
134
133
  console.warn('[SENTRY]: You called "reportErrorToSentry" with a string argument. ' + '"Error" objects should be preferred so that a stack-trace can be made available in Sentry. ' + 'See: https://docs.sentry.io/clients/javascript/usage/#try-catch');
135
134
  }
136
135
  if (isEnabled) {
137
- if (extraInfo !== null && extraInfo !== void 0 && extraInfo.extra) {
136
+ if (extraInfo?.extra) {
138
137
  if (isExtraAsObject(extraInfo.extra)) {
139
138
  // See https://docs.sentry.io/platforms/javascript/react/
140
139
  Sentry__namespace.setExtras(extraInfo.extra);
@@ -155,7 +154,7 @@ const reportErrorToSentry = (error, extraInfo, getIsEnabled) => {
155
154
  // The error stack should be available in Sentry, so there is no
156
155
  // need to print it in the console as well.
157
156
  // We just notify that an error occurred and provide the error ID.
158
- console.error("[SENTRY]: An error occured (ID: ".concat(errorId, ")."));
157
+ console.error(`[SENTRY]: An error occurred (ID: ${errorId}).`);
159
158
  return errorId;
160
159
  }
161
160
  console.error('[SENTRY]:', error);
@@ -182,7 +181,7 @@ let SentryUserTracker = /*#__PURE__*/function (_PureComponent) {
182
181
  // by only sending the domain part or the email
183
182
  const emailTld = _this.props.user.email.split('@')[1];
184
183
  Sentry__namespace.setUser({
185
- email: "xxx@".concat(emailTld),
184
+ email: `xxx@${emailTld}`,
186
185
  id: _this.props.user.id
187
186
  });
188
187
  }
@@ -225,9 +224,7 @@ let SentryUserLogoutTracker = /*#__PURE__*/function (_Component) {
225
224
  // When the user is not logged in anymore (e.g. on logout) we still track
226
225
  // errors but without the user data in context.
227
226
  if (window.app.trackingSentry) {
228
- Sentry__namespace.configureScope(scope => {
229
- scope.clear();
230
- });
227
+ Sentry__namespace.getCurrentScope().clear();
231
228
  }
232
229
  }
233
230
  }, {
@@ -5,7 +5,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var _JSON$stringify = require('@babel/runtime-corejs3/core-js-stable/json/stringify');
6
6
  var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
7
7
  var _Object$keys = require('@babel/runtime-corejs3/core-js-stable/object/keys');
8
- var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
9
8
  var Sentry = require('@sentry/react');
10
9
  var browser = require('@sentry/browser');
11
10
  var history = require('@commercetools-frontend/browser-history');
@@ -40,13 +39,12 @@ function _interopNamespace(e) {
40
39
  var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
41
40
  var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
42
41
  var _Object$keys__default = /*#__PURE__*/_interopDefault(_Object$keys);
43
- var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
44
42
  var Sentry__namespace = /*#__PURE__*/_interopNamespace(Sentry);
45
43
  var history__default = /*#__PURE__*/_interopDefault(history);
46
44
  var _Reflect$construct__default = /*#__PURE__*/_interopDefault(_Reflect$construct);
47
45
 
48
46
  // NOTE: This string will be replaced on build time with the package version.
49
- var version = "24.13.0";
47
+ var version = "25.1.0";
50
48
 
51
49
  const makeErrorToCapture = error => {
52
50
  if (error instanceof Error) return error;
@@ -93,11 +91,10 @@ const redactUnsafeEventFields = event => {
93
91
  };
94
92
  const boot = () => {
95
93
  if (window.app.trackingSentry && window.app.trackingSentry !== 'null') {
96
- var _context2;
97
94
  Sentry__namespace.init({
98
95
  dsn: window.app.trackingSentry,
99
96
  release: window.app.revision,
100
- environment: _concatInstanceProperty__default["default"](_context2 = "".concat(window.app.env, "-")).call(_context2, window.app.location),
97
+ environment: `${window.app.env}-${window.app.location}`,
101
98
  // In order to reduce the noise in sentry we only track errors that come
102
99
  // from our code and ignore errors that come from other services
103
100
  // https://blog.sentry.io/2017/03/27/tips-for-reducing-javascript-error-noise.html
@@ -117,14 +114,16 @@ const boot = () => {
117
114
  // we can implement the `tracesSampler` function.
118
115
  // https://docs.sentry.io/platforms/javascript/guides/react/configuration/sampling/#sampling-transaction-events
119
116
  tracesSampleRate: 0.05,
120
- beforeSend(event) {
117
+ // v8 requires the hint parameter which provides additional error context.
118
+ // We only redact PII from event fields, so hint is unused for now.
119
+ beforeSend(event, _hint) {
121
120
  return redactUnsafeEventFields(event);
122
121
  }
123
122
  });
124
123
  const sentryScope = Sentry__namespace.getCurrentScope();
125
124
  sentryScope.setTag('role', 'frontend');
126
125
  sentryScope.setTag('applicationName', window.app.applicationName);
127
- sentryScope.setTag('service', "merchant-center-frontend-".concat(window.app.applicationName));
126
+ sentryScope.setTag('service', `merchant-center-frontend-${window.app.applicationName}`);
128
127
  }
129
128
  };
130
129
  const isExtraAsObject = extrasOrExtra => typeof extrasOrExtra === 'object';
@@ -134,7 +133,7 @@ const reportErrorToSentry = (error, extraInfo, getIsEnabled) => {
134
133
  console.warn('[SENTRY]: You called "reportErrorToSentry" with a string argument. ' + '"Error" objects should be preferred so that a stack-trace can be made available in Sentry. ' + 'See: https://docs.sentry.io/clients/javascript/usage/#try-catch');
135
134
  }
136
135
  if (isEnabled) {
137
- if (extraInfo !== null && extraInfo !== void 0 && extraInfo.extra) {
136
+ if (extraInfo?.extra) {
138
137
  if (isExtraAsObject(extraInfo.extra)) {
139
138
  // See https://docs.sentry.io/platforms/javascript/react/
140
139
  Sentry__namespace.setExtras(extraInfo.extra);
@@ -155,7 +154,7 @@ const reportErrorToSentry = (error, extraInfo, getIsEnabled) => {
155
154
  // The error stack should be available in Sentry, so there is no
156
155
  // need to print it in the console as well.
157
156
  // We just notify that an error occurred and provide the error ID.
158
- console.error("[SENTRY]: An error occured (ID: ".concat(errorId, ")."));
157
+ console.error(`[SENTRY]: An error occurred (ID: ${errorId}).`);
159
158
  return errorId;
160
159
  }
161
160
  console.error('[SENTRY]:', error);
@@ -182,7 +181,7 @@ let SentryUserTracker = /*#__PURE__*/function (_PureComponent) {
182
181
  // by only sending the domain part or the email
183
182
  const emailTld = _this.props.user.email.split('@')[1];
184
183
  Sentry__namespace.setUser({
185
- email: "xxx@".concat(emailTld),
184
+ email: `xxx@${emailTld}`,
186
185
  id: _this.props.user.id
187
186
  });
188
187
  }
@@ -225,9 +224,7 @@ let SentryUserLogoutTracker = /*#__PURE__*/function (_Component) {
225
224
  // When the user is not logged in anymore (e.g. on logout) we still track
226
225
  // errors but without the user data in context.
227
226
  if (window.app.trackingSentry) {
228
- Sentry__namespace.configureScope(scope => {
229
- scope.clear();
230
- });
227
+ Sentry__namespace.getCurrentScope().clear();
231
228
  }
232
229
  }
233
230
  }, {
@@ -1,7 +1,6 @@
1
1
  import _JSON$stringify from '@babel/runtime-corejs3/core-js-stable/json/stringify';
2
2
  import _includesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/includes';
3
3
  import _Object$keys from '@babel/runtime-corejs3/core-js-stable/object/keys';
4
- import _concatInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/concat';
5
4
  import * as Sentry from '@sentry/react';
6
5
  import { globalHandlersIntegration } from '@sentry/browser';
7
6
  import history from '@commercetools-frontend/browser-history';
@@ -14,7 +13,7 @@ import _inherits from '@babel/runtime-corejs3/helpers/esm/inherits';
14
13
  import { PureComponent, Component } from 'react';
15
14
 
16
15
  // NOTE: This string will be replaced on build time with the package version.
17
- var version = "24.13.0";
16
+ var version = "25.1.0";
18
17
 
19
18
  const makeErrorToCapture = error => {
20
19
  if (error instanceof Error) return error;
@@ -61,11 +60,10 @@ const redactUnsafeEventFields = event => {
61
60
  };
62
61
  const boot = () => {
63
62
  if (window.app.trackingSentry && window.app.trackingSentry !== 'null') {
64
- var _context2;
65
63
  Sentry.init({
66
64
  dsn: window.app.trackingSentry,
67
65
  release: window.app.revision,
68
- environment: _concatInstanceProperty(_context2 = "".concat(window.app.env, "-")).call(_context2, window.app.location),
66
+ environment: `${window.app.env}-${window.app.location}`,
69
67
  // In order to reduce the noise in sentry we only track errors that come
70
68
  // from our code and ignore errors that come from other services
71
69
  // https://blog.sentry.io/2017/03/27/tips-for-reducing-javascript-error-noise.html
@@ -85,14 +83,16 @@ const boot = () => {
85
83
  // we can implement the `tracesSampler` function.
86
84
  // https://docs.sentry.io/platforms/javascript/guides/react/configuration/sampling/#sampling-transaction-events
87
85
  tracesSampleRate: 0.05,
88
- beforeSend(event) {
86
+ // v8 requires the hint parameter which provides additional error context.
87
+ // We only redact PII from event fields, so hint is unused for now.
88
+ beforeSend(event, _hint) {
89
89
  return redactUnsafeEventFields(event);
90
90
  }
91
91
  });
92
92
  const sentryScope = Sentry.getCurrentScope();
93
93
  sentryScope.setTag('role', 'frontend');
94
94
  sentryScope.setTag('applicationName', window.app.applicationName);
95
- sentryScope.setTag('service', "merchant-center-frontend-".concat(window.app.applicationName));
95
+ sentryScope.setTag('service', `merchant-center-frontend-${window.app.applicationName}`);
96
96
  }
97
97
  };
98
98
  const isExtraAsObject = extrasOrExtra => typeof extrasOrExtra === 'object';
@@ -102,7 +102,7 @@ const reportErrorToSentry = (error, extraInfo, getIsEnabled) => {
102
102
  console.warn('[SENTRY]: You called "reportErrorToSentry" with a string argument. ' + '"Error" objects should be preferred so that a stack-trace can be made available in Sentry. ' + 'See: https://docs.sentry.io/clients/javascript/usage/#try-catch');
103
103
  }
104
104
  if (isEnabled) {
105
- if (extraInfo !== null && extraInfo !== void 0 && extraInfo.extra) {
105
+ if (extraInfo?.extra) {
106
106
  if (isExtraAsObject(extraInfo.extra)) {
107
107
  // See https://docs.sentry.io/platforms/javascript/react/
108
108
  Sentry.setExtras(extraInfo.extra);
@@ -123,7 +123,7 @@ const reportErrorToSentry = (error, extraInfo, getIsEnabled) => {
123
123
  // The error stack should be available in Sentry, so there is no
124
124
  // need to print it in the console as well.
125
125
  // We just notify that an error occurred and provide the error ID.
126
- console.error("[SENTRY]: An error occured (ID: ".concat(errorId, ")."));
126
+ console.error(`[SENTRY]: An error occurred (ID: ${errorId}).`);
127
127
  return errorId;
128
128
  }
129
129
  console.error('[SENTRY]:', error);
@@ -150,7 +150,7 @@ let SentryUserTracker = /*#__PURE__*/function (_PureComponent) {
150
150
  // by only sending the domain part or the email
151
151
  const emailTld = _this.props.user.email.split('@')[1];
152
152
  Sentry.setUser({
153
- email: "xxx@".concat(emailTld),
153
+ email: `xxx@${emailTld}`,
154
154
  id: _this.props.user.id
155
155
  });
156
156
  }
@@ -193,9 +193,7 @@ let SentryUserLogoutTracker = /*#__PURE__*/function (_Component) {
193
193
  // When the user is not logged in anymore (e.g. on logout) we still track
194
194
  // errors but without the user data in context.
195
195
  if (window.app.trackingSentry) {
196
- Sentry.configureScope(scope => {
197
- scope.clear();
198
- });
196
+ Sentry.getCurrentScope().clear();
199
197
  }
200
198
  }
201
199
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools-frontend/sentry",
3
- "version": "24.13.0",
3
+ "version": "25.1.0",
4
4
  "description": "Components to set up Sentry for a MC application",
5
5
  "bugs": "https://github.com/commercetools/merchant-center-application-kit/issues",
6
6
  "repository": {
@@ -30,11 +30,11 @@
30
30
  "dependencies": {
31
31
  "@babel/runtime": "^7.22.15",
32
32
  "@babel/runtime-corejs3": "^7.22.15",
33
- "@commercetools-frontend/browser-history": "24.13.0",
34
- "@commercetools-frontend/constants": "24.13.0",
35
- "@sentry/browser": "7.120.4",
36
- "@sentry/react": "7.120.4",
37
- "@sentry/types": "7.120.4",
33
+ "@commercetools-frontend/browser-history": "25.1.0",
34
+ "@commercetools-frontend/constants": "25.1.0",
35
+ "@sentry/browser": "8.55.0",
36
+ "@sentry/react": "8.55.0",
37
+ "@sentry/types": "8.55.0",
38
38
  "@types/prop-types": "^15.7.5",
39
39
  "@types/react": "^19.0.3",
40
40
  "prop-types": "15.8.1"
@@ -42,9 +42,9 @@
42
42
  "devDependencies": {
43
43
  "@emotion/react": "^11.14.0",
44
44
  "@types/jest": "^29.5.14",
45
- "jest": "29.7.0",
45
+ "jest": "30.2.0",
46
46
  "react": "19.0.0",
47
- "sentry-testkit": "5.0.10",
47
+ "sentry-testkit": "6.2.2",
48
48
  "wait-for-expect": "3.0.2"
49
49
  },
50
50
  "peerDependencies": {