@rh-support/components 2.6.25 → 2.6.27

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,7 +1,7 @@
1
- import React, { Component } from 'react';
1
+ import React, { Component, ErrorInfo, ReactNode } from 'react';
2
2
  import { IErrorMsgInfo } from './ErrorBoundaryFallbackComponent';
3
3
  interface IProps {
4
- children: React.PropsWithChildren | React.ReactNode;
4
+ children: React.PropsWithChildren | ReactNode;
5
5
  sentryAppName?: string;
6
6
  FallbackComponent?: React.ElementType;
7
7
  errorMsgInfo?: IErrorMsgInfo;
@@ -11,27 +11,11 @@ interface IProps {
11
11
  interface IState {
12
12
  hasError: boolean;
13
13
  }
14
- declare global {
15
- interface Window {
16
- app: string;
17
- sessionjs: any;
18
- supportVersionInfo: {
19
- packageVersion: string;
20
- hydrajs: string;
21
- };
22
- seVersionInfo: {
23
- packageVersion: string;
24
- hydrajs: string;
25
- };
26
- }
27
- }
28
14
  export declare class ErrorBoundary extends Component<IProps, IState> {
29
- constructor(props: any);
30
- static getDerivedStateFromError(): {
31
- hasError: boolean;
32
- };
33
- componentDidCatch(error: Error, errorInfo: any): void;
34
- render(): React.JSX.Element;
15
+ constructor(props: IProps);
16
+ static getDerivedStateFromError(): IState;
17
+ componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
18
+ render(): ReactNode;
35
19
  }
36
20
  export {};
37
21
  //# sourceMappingURL=ErrorBoundary.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorBoundary.d.ts","sourceRoot":"","sources":["../../../src/ErrorBoundary/ErrorBoundary.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAkC,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEjG,UAAU,MAAM;IACZ,QAAQ,EAAE,KAAK,CAAC,iBAAiB,GAAG,KAAK,CAAC,SAAS,CAAC;IACpD,aA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C7B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5D;AAED,UAAU,MAAM;IACZ,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED,qBAAa,aAAc,SAAQ,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;gBAC5C,KAAK,EAAE,MAAM;IAKzB,MAAM,CAAC,wBAAwB,IAAI,MAAM;IAIzC,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI;IAc3D,MAAM,IAAI,SAAS;CAetB"}
@@ -1,5 +1,4 @@
1
- import { Env } from '@cee-eng/hydrajs';
2
- import { getAppVersion } from '@rh-support/utils';
1
+ import { sendToSentry } from '@rh-support/utils';
3
2
  import React, { Component } from 'react';
4
3
  import { ErrorBoundaryFallbackComponent } from './ErrorBoundaryFallbackComponent';
5
4
  export class ErrorBoundary extends Component {
@@ -8,33 +7,27 @@ export class ErrorBoundary extends Component {
8
7
  this.state = { hasError: false };
9
8
  }
10
9
  static getDerivedStateFromError() {
11
- // Update state so the next render will show the fallback UI.
12
10
  return { hasError: true };
13
11
  }
14
12
  componentDidCatch(error, errorInfo) {
15
- if (Env.isLocalEnv())
16
- return;
13
+ var _a;
17
14
  const { onError } = this.props;
18
15
  if (typeof onError === 'function') {
19
16
  try {
20
- onError.call(this, error, errorInfo || '');
17
+ onError.call(this, error, (_a = errorInfo.componentStack) !== null && _a !== void 0 ? _a : '');
18
+ }
19
+ catch (ignoredError) {
20
+ const errorObj = ignoredError instanceof Error ? ignoredError : new Error(String(ignoredError));
21
+ sendToSentry(errorObj, { error: `Error boundary function component: ${errorObj.message}` });
21
22
  }
22
- catch (ignoredError) { }
23
23
  }
24
- // log error to sentry
25
- window.sessionjs.reportProblem(error, {
26
- tags: {
27
- portal_app: window.app || this.props.sentryAppName || 'Portal Case Management',
28
- package_version: getAppVersion(),
29
- },
30
- });
24
+ sendToSentry(error, { error: `Error boundary component: ${error.message}` });
31
25
  }
32
26
  render() {
33
27
  const { children, FallbackComponent } = this.props;
34
28
  if (this.state.hasError) {
35
- return this.props.FallbackComponent ? (React.createElement(FallbackComponent, null)) : (React.createElement(ErrorBoundaryFallbackComponent, Object.assign({ isPageLevelError: this.props.isPageLevelError }, this.props.errorMsgInfo)));
29
+ return FallbackComponent ? (React.createElement(FallbackComponent, null)) : (React.createElement(ErrorBoundaryFallbackComponent, Object.assign({ isPageLevelError: this.props.isPageLevelError }, this.props.errorMsgInfo)));
36
30
  }
37
- // @ts-ignore
38
- return React.createElement(React.Fragment, null, children || null);
31
+ return (children || null);
39
32
  }
40
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/components",
3
- "version": "2.6.25",
3
+ "version": "2.6.27",
4
4
  "description": "Contains all reusabel components for support app",
5
5
  "author": "Vikas Rathee <vrathee@redhat.com>",
6
6
  "license": "ISC",
@@ -62,8 +62,8 @@
62
62
  "@patternfly/react-icons": "6.2.1",
63
63
  "@patternfly/react-table": "6.2.1",
64
64
  "@rh-support/types": "2.0.31",
65
- "@rh-support/user-permissions": "2.6.23",
66
- "@rh-support/utils": "2.6.22",
65
+ "@rh-support/user-permissions": "2.6.25",
66
+ "@rh-support/utils": "2.6.24",
67
67
  "dompurify": "^2.2.6",
68
68
  "js-worker-search": "^1.4.1",
69
69
  "lazysizes": "^5.3.2",
@@ -103,5 +103,5 @@
103
103
  "defaults and supports es6-module",
104
104
  "maintained node versions"
105
105
  ],
106
- "gitHead": "261e4abdf99d53426e11de96fc157763484410c5"
106
+ "gitHead": "bbf0ab279db5aa64c1732b97c81a27c70754a0c3"
107
107
  }