@commercetools-frontend/application-shell-connectors 23.3.0 → 23.4.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.
@@ -79,7 +79,7 @@ var _Reflect$construct__default = /*#__PURE__*/_interopDefault(_Reflect$construc
79
79
  var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
80
80
 
81
81
  // NOTE: This string will be replaced on build time with the package version.
82
- var version = "23.3.0";
82
+ var version = "23.4.0";
83
83
 
84
84
  // From https://github.com/acdlite/recompose/blob/master/src/packages/recompose/getDisplayName.js
85
85
  const getDisplayName = Component => {
@@ -462,7 +462,6 @@ const useProjectExtensionImageRegex = () => {
462
462
  const ProjectExtensionProviderForImageRegex = props => {
463
463
  const _useQuery = react$1.useQuery(FetchProjectExtensionImageRegex, {
464
464
  skip: props.skip,
465
- onError: sentry.reportErrorToSentry,
466
465
  context: {
467
466
  target: constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
468
467
  }
@@ -551,8 +550,8 @@ const errorLink = error.onError(_ref => {
551
550
  // https://www.apollographql.com/docs/link/links/error/#retrying-failed-requests
552
551
  // We need to do this as the `token-retry-link` only works for network errors.
553
552
  // https://www.apollographql.com/docs/link/links/retry/
553
+ const context = operation.getContext();
554
554
  if (graphQLErrors && isGraphQLError(graphQLErrors)) {
555
- const context = operation.getContext();
556
555
  for (const err of graphQLErrors) {
557
556
  const isNonAuthenticatedViaExtensionCode = err?.extensions?.code === 'UNAUTHENTICATED';
558
557
  /**
@@ -575,6 +574,24 @@ const errorLink = error.onError(_ref => {
575
574
  }
576
575
  }
577
576
  }
577
+
578
+ // Report unhandled errors to Sentry
579
+ if (context.enableSentryErrorReporting && networkError) {
580
+ sentry.reportErrorToSentry(networkError, {
581
+ extra: {
582
+ operationName: operation.operationName
583
+ }
584
+ });
585
+ }
586
+ if (context.enableSentryErrorReporting && graphQLErrors) {
587
+ for (const err of graphQLErrors) {
588
+ sentry.reportErrorToSentry(err, {
589
+ extra: {
590
+ operationName: operation.operationName
591
+ }
592
+ });
593
+ }
594
+ }
578
595
  return;
579
596
  });
580
597
 
@@ -77,7 +77,7 @@ var _Reflect$construct__default = /*#__PURE__*/_interopDefault(_Reflect$construc
77
77
  var _JSON$stringify__default = /*#__PURE__*/_interopDefault(_JSON$stringify);
78
78
 
79
79
  // NOTE: This string will be replaced on build time with the package version.
80
- var version = "23.3.0";
80
+ var version = "23.4.0";
81
81
 
82
82
  // From https://github.com/acdlite/recompose/blob/master/src/packages/recompose/getDisplayName.js
83
83
  const getDisplayName = Component => {
@@ -450,7 +450,6 @@ const useProjectExtensionImageRegex = () => {
450
450
  const ProjectExtensionProviderForImageRegex = props => {
451
451
  const _useQuery = react$1.useQuery(FetchProjectExtensionImageRegex, {
452
452
  skip: props.skip,
453
- onError: sentry.reportErrorToSentry,
454
453
  context: {
455
454
  target: constants.GRAPHQL_TARGETS.SETTINGS_SERVICE
456
455
  }
@@ -534,8 +533,8 @@ const errorLink = error.onError(_ref => {
534
533
  // https://www.apollographql.com/docs/link/links/error/#retrying-failed-requests
535
534
  // We need to do this as the `token-retry-link` only works for network errors.
536
535
  // https://www.apollographql.com/docs/link/links/retry/
536
+ const context = operation.getContext();
537
537
  if (graphQLErrors && isGraphQLError(graphQLErrors)) {
538
- const context = operation.getContext();
539
538
  for (const err of graphQLErrors) {
540
539
  const isNonAuthenticatedViaExtensionCode = err?.extensions?.code === 'UNAUTHENTICATED';
541
540
  /**
@@ -558,6 +557,24 @@ const errorLink = error.onError(_ref => {
558
557
  }
559
558
  }
560
559
  }
560
+
561
+ // Report unhandled errors to Sentry
562
+ if (context.enableSentryErrorReporting && networkError) {
563
+ sentry.reportErrorToSentry(networkError, {
564
+ extra: {
565
+ operationName: operation.operationName
566
+ }
567
+ });
568
+ }
569
+ if (context.enableSentryErrorReporting && graphQLErrors) {
570
+ for (const err of graphQLErrors) {
571
+ sentry.reportErrorToSentry(err, {
572
+ extra: {
573
+ operationName: operation.operationName
574
+ }
575
+ });
576
+ }
577
+ }
561
578
  return;
562
579
  });
563
580
 
@@ -45,7 +45,7 @@ import _JSON$stringify from '@babel/runtime-corejs3/core-js-stable/json/stringif
45
45
  import { RetryLink } from '@apollo/client/link/retry';
46
46
 
47
47
  // NOTE: This string will be replaced on build time with the package version.
48
- var version = "23.3.0";
48
+ var version = "23.4.0";
49
49
 
50
50
  // From https://github.com/acdlite/recompose/blob/master/src/packages/recompose/getDisplayName.js
51
51
  const getDisplayName = Component => {
@@ -428,7 +428,6 @@ const useProjectExtensionImageRegex = () => {
428
428
  const ProjectExtensionProviderForImageRegex = props => {
429
429
  const _useQuery = useQuery(FetchProjectExtensionImageRegex, {
430
430
  skip: props.skip,
431
- onError: reportErrorToSentry,
432
431
  context: {
433
432
  target: GRAPHQL_TARGETS.SETTINGS_SERVICE
434
433
  }
@@ -517,8 +516,8 @@ const errorLink = onError(_ref => {
517
516
  // https://www.apollographql.com/docs/link/links/error/#retrying-failed-requests
518
517
  // We need to do this as the `token-retry-link` only works for network errors.
519
518
  // https://www.apollographql.com/docs/link/links/retry/
519
+ const context = operation.getContext();
520
520
  if (graphQLErrors && isGraphQLError(graphQLErrors)) {
521
- const context = operation.getContext();
522
521
  for (const err of graphQLErrors) {
523
522
  const isNonAuthenticatedViaExtensionCode = err?.extensions?.code === 'UNAUTHENTICATED';
524
523
  /**
@@ -541,6 +540,24 @@ const errorLink = onError(_ref => {
541
540
  }
542
541
  }
543
542
  }
543
+
544
+ // Report unhandled errors to Sentry
545
+ if (context.enableSentryErrorReporting && networkError) {
546
+ reportErrorToSentry(networkError, {
547
+ extra: {
548
+ operationName: operation.operationName
549
+ }
550
+ });
551
+ }
552
+ if (context.enableSentryErrorReporting && graphQLErrors) {
553
+ for (const err of graphQLErrors) {
554
+ reportErrorToSentry(err, {
555
+ extra: {
556
+ operationName: operation.operationName
557
+ }
558
+ });
559
+ }
560
+ }
544
561
  return;
545
562
  });
546
563
 
@@ -10,6 +10,7 @@ export type TApolloContext = {
10
10
  projectKey?: string;
11
11
  teamId?: string;
12
12
  featureFlag?: string;
13
+ enableSentryErrorReporting?: boolean;
13
14
  };
14
15
  declare const createApolloContextForProxyForwardTo: (proxyForwardTocontext: TForwardToConfig) => TApolloContext;
15
16
  export { createApolloContextForProxyForwardTo };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools-frontend/application-shell-connectors",
3
- "version": "23.3.0",
3
+ "version": "23.4.0",
4
4
  "description": "Contains complementary tools for @commercetools-frontend/application-shell",
5
5
  "bugs": "https://github.com/commercetools/merchant-center-application-kit/issues",
6
6
  "repository": {
@@ -37,10 +37,10 @@
37
37
  "dependencies": {
38
38
  "@babel/runtime": "^7.22.15",
39
39
  "@babel/runtime-corejs3": "^7.22.15",
40
- "@commercetools-frontend/application-config": "23.3.0",
41
- "@commercetools-frontend/browser-history": "23.3.0",
42
- "@commercetools-frontend/constants": "23.3.0",
43
- "@commercetools-frontend/sentry": "23.3.0",
40
+ "@commercetools-frontend/application-config": "23.4.0",
41
+ "@commercetools-frontend/browser-history": "23.4.0",
42
+ "@commercetools-frontend/constants": "23.4.0",
43
+ "@commercetools-frontend/sentry": "23.4.0",
44
44
  "@commercetools/http-user-agent": "3.0.0",
45
45
  "@emotion/react": "^11.14.0",
46
46
  "@types/lodash": "^4.14.198",