{"version":3,"file":"ErrorBoundary-CsWrV5dj.js","sources":["../../payment-page/src/components/Shared/ErrorBoundary.tsx"],"sourcesContent":["import { Component, ReactNode } from \"react\";\r\n\r\ninterface ErrorInformation {\r\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n  error: any;\r\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n  errorInfo: any;\r\n}\r\n\r\ninterface ErrorBoundaryProps {\r\n  children?: ReactNode;\r\n}\r\n\r\nconst isDevEnv = process.env.NODE_ENV === \"development\";\r\n\r\nexport class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorInformation> {\r\n  constructor(props) {\r\n    super(props);\r\n    this.state = { error: null, errorInfo: null } as ErrorInformation;\r\n  }\r\n\r\n  // eslint-disable-next-line @typescript-eslint/no-explicit-any\r\n  componentDidCatch(error: any, errorInfo: any) {\r\n    // Catch errors in any components below and re-render with error message\r\n    this.setState({\r\n      error: error,\r\n      errorInfo: errorInfo,\r\n    } as ErrorInformation);\r\n    console.error(\"ErrorBoundary caught an error: \", error, errorInfo);\r\n  }\r\n\r\n  render() {\r\n    if (this.state.errorInfo) {\r\n      return (\r\n        <div>\r\n          <h2 style={{ margin: \"40px\", color: \"var(--primary-color)\" }}>Something went wrong.</h2>\r\n          {isDevEnv && (\r\n            <details style={{ whiteSpace: \"pre-wrap\", marginLeft: \"60px\" }}>\r\n              {this.state.error && this.state.error.toString()}\r\n              <br />\r\n              {this.state.errorInfo.componentStack}\r\n            </details>\r\n          )}\r\n        </div>\r\n      );\r\n    }\r\n    // Normally, just render children\r\n    return this.props.children;\r\n  }\r\n}\r\n"],"names":["isDevEnv","ErrorBoundary","Component","props","error","errorInfo","jsx"],"mappings":"iDAaA,MAAMA,EAAW,GAEV,MAAMC,UAAsBC,EAAAA,SAAgD,CACjF,YAAYC,EAAO,CACjB,MAAMA,CAAK,EACX,KAAK,MAAQ,CAAE,MAAO,KAAM,UAAW,KACzC,CAGA,kBAAkBC,EAAYC,EAAgB,CAE5C,KAAK,SAAS,CACZ,MAAAD,EACA,UAAAC,CAAA,CACmB,EACb,QAAA,MAAM,kCAAmCD,EAAOC,CAAS,CACnE,CAEA,QAAS,CACH,OAAA,KAAK,MAAM,iBAEV,MACC,CAAA,SAAA,CAACC,EAAAA,IAAA,KAAA,CAAG,MAAO,CAAE,OAAQ,OAAQ,MAAO,sBAAuB,EAAG,SAAqB,uBAAA,CAAA,EAClFN,GAOH,EAIG,KAAK,MAAM,QACpB,CACF"}