@ohbug/react 1.0.15 → 2.0.2

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.
package/README.md CHANGED
@@ -2,14 +2,13 @@
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/@ohbug/react.svg?style=flat-square)](https://www.npmjs.com/package/@ohbug/react)
4
4
  [![npm bundle size](https://img.shields.io/bundlephobia/min/@ohbug/react?style=flat-square)](https://bundlephobia.com/result?p=@ohbug/react)
5
- [![Code style](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
6
5
 
7
6
  English | [简体中文](./README-zh_CN.md)
8
7
 
9
8
  ## Installation
10
9
 
11
10
  ```
12
- yarn add @ohbug/browser @ohbug/react
11
+ pnpm instal @ohbug/browser @ohbug/react
13
12
  ```
14
13
 
15
14
  ## Usage
@@ -17,15 +16,14 @@ yarn add @ohbug/browser @ohbug/react
17
16
  ```jsx
18
17
  import React from 'react'
19
18
  import Ohbug from '@ohbug/browser'
20
- import OhbugReact from '@ohbug/react'
19
+ import { OhbugErrorBoundary } from '@ohbug/react'
21
20
 
22
- const client = Ohbug.init({ apiKey: 'YOUR_API_KEY' })
23
- const OhbugErrorBoundary = client.use(OhbugReact, React)
21
+ const client = Ohbug.setup({ apiKey: 'YOUR_API_KEY' })
24
22
 
25
23
  function App() {
26
24
  return (
27
25
  <div className="App">
28
- <OhbugErrorBoundary>
26
+ <OhbugErrorBoundary client={client}>
29
27
  <HelloWorld />
30
28
  </OhbugErrorBoundary>
31
29
  </div>
package/dist/index.d.ts CHANGED
@@ -1,3 +1,23 @@
1
- export type { ReactErrorDetail } from './OhbugErrorBoundary';
2
- export { extension as default } from './extension';
3
- //# sourceMappingURL=index.d.ts.map
1
+ import { OhbugBaseDetail, OhbugClient } from '@ohbug/types';
2
+ import React from 'react';
3
+
4
+ interface ReactErrorDetail extends OhbugBaseDetail {
5
+ name: string;
6
+ stack?: string;
7
+ errorInfo: any;
8
+ }
9
+ interface ErrorBoundaryProp {
10
+ client: OhbugClient;
11
+ FallbackComponent?: React.ReactElement;
12
+ children?: React.ReactNode;
13
+ }
14
+ interface ErrorBoundaryState {
15
+ error: any;
16
+ }
17
+ declare class OhbugErrorBoundary extends React.Component<ErrorBoundaryProp, ErrorBoundaryState> {
18
+ constructor(props: ErrorBoundaryProp);
19
+ componentDidCatch(error: Error, info: any): void;
20
+ render(): string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactFragment | null | undefined;
21
+ }
22
+
23
+ export { OhbugErrorBoundary, ReactErrorDetail };
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ var m=Object.create;var a=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var d=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty;var h=(t,e)=>{for(var r in e)a(t,r,{get:e[r],enumerable:!0})},c=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of y(e))!f.call(t,n)&&n!==r&&a(t,n,{get:()=>e[n],enumerable:!(o=u(e,n))||o.enumerable});return t};var E=(t,e,r)=>(r=t!=null?m(d(t)):{},c(e||!t||!t.__esModule?a(r,"default",{value:t,enumerable:!0}):r,t)),g=t=>c(a({},"__esModule",{value:!0}),t);var C={};h(C,{OhbugErrorBoundary:()=>s});module.exports=g(C);var i=E(require("react")),l=require("@ohbug/core"),s=class extends i.default.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e,r){let{client:o}=this.props,n={name:e.name,message:e.message,stack:e.stack,errorInfo:r},p=o.createEvent({category:"error",type:l.EventTypes.REACT,detail:n});o.notify(p),this.setState({error:e})}render(){let{error:e}=this.state,{FallbackComponent:r,children:o}=this.props;return e?r||null:o}};0&&(module.exports={OhbugErrorBoundary});
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ import i from"react";import{EventTypes as l}from"@ohbug/core";var o=class extends i.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e,t){let{client:r}=this.props,n={name:e.name,message:e.message,stack:e.stack,errorInfo:t},a=r.createEvent({category:"error",type:l.REACT,detail:n});r.notify(a),this.setState({error:e})}render(){let{error:e}=this.state,{FallbackComponent:t,children:r}=this.props;return e?t||null:r}};export{o as OhbugErrorBoundary};
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@ohbug/react",
3
- "version": "1.0.15",
3
+ "version": "2.0.2",
4
4
  "description": "Ohbug SDK for React",
5
+ "license": "Apache-2.0",
5
6
  "author": "chenyueban <jasonchan0527@gmail.com>",
6
7
  "homepage": "https://github.com/ohbug-org/ohbug",
7
8
  "bugs": {
@@ -11,40 +12,37 @@
11
12
  "type": "git",
12
13
  "url": "https://github.com/ohbug-org/ohbug"
13
14
  },
14
- "license": "Apache-2.0",
15
- "main": "./dist/ohbug-react.umd.js",
16
- "module": "./dist/ohbug-react.es.js",
17
- "unpkg": "./dist/ohbug-react.umd.js",
18
- "jsdelivr": "./dist/ohbug-react.umd.js",
19
- "types": "./dist/index.d.ts",
15
+ "main": "dist/index.js",
16
+ "module": "dist/index.mjs",
17
+ "types": "dist/index.d.ts",
20
18
  "exports": {
21
19
  ".": {
22
- "import": "./dist/ohbug-react.es.js",
23
- "require": "./dist/ohbug-react.umd.js"
20
+ "require": "./dist/index.js",
21
+ "import": "./dist/index.mjs",
22
+ "types": "./dist/index.d.ts"
24
23
  }
25
24
  },
26
25
  "files": [
27
26
  "dist"
28
27
  ],
29
- "dependencies": {
30
- "@ohbug/core": "^1.1.7"
31
- },
32
- "devDependencies": {
33
- "@types/react": "^17.0.20"
34
- },
28
+ "sideEffects": false,
35
29
  "peerDependencies": {
36
30
  "react": "^16.8.6"
37
31
  },
38
- "buildOptions": {
39
- "name": "OhbugReact",
40
- "formats": [
41
- "es",
42
- "umd"
43
- ],
44
- "order": 4
32
+ "dependencies": {
33
+ "@ohbug/core": "2.0.2",
34
+ "@ohbug/types": "2.0.2"
35
+ },
36
+ "devDependencies": {
37
+ "@ohbug/browser": "2.0.2",
38
+ "@types/react": "^18.0.9"
45
39
  },
46
40
  "publishConfig": {
47
41
  "access": "public"
48
42
  },
49
- "gitHead": "323e4755a0da5893748c19901f3f709e903b6dd2"
50
- }
43
+ "scripts": {
44
+ "build": "tsup",
45
+ "dev": "tsup --watch"
46
+ },
47
+ "readme": "# `@ohbug/react`\n\n[![npm](https://img.shields.io/npm/v/@ohbug/react.svg?style=flat-square)](https://www.npmjs.com/package/@ohbug/react)\n[![npm bundle size](https://img.shields.io/bundlephobia/min/@ohbug/react?style=flat-square)](https://bundlephobia.com/result?p=@ohbug/react)\n\nEnglish | [简体中文](./README-zh_CN.md)\n\n## Installation\n\n```\npnpm instal @ohbug/browser @ohbug/react\n```\n\n## Usage\n\n```jsx\nimport React from 'react'\nimport Ohbug from '@ohbug/browser'\nimport { OhbugErrorBoundary } from '@ohbug/react'\n\nconst client = Ohbug.setup({ apiKey: 'YOUR_API_KEY' })\n\nfunction App() {\n return (\n <div className=\"App\">\n <OhbugErrorBoundary client={client}>\n <HelloWorld />\n </OhbugErrorBoundary>\n </div>\n )\n}\n```\n"
48
+ }
@@ -1,44 +0,0 @@
1
- import type { OhbugBaseDetail, OhbugClient } from '@ohbug/types';
2
- import React from 'react';
3
- export interface ReactErrorDetail extends OhbugBaseDetail {
4
- name: string;
5
- stack?: string;
6
- errorInfo: any;
7
- }
8
- interface ErrorBoundaryProp {
9
- FallbackComponent: React.ReactElement;
10
- }
11
- interface ErrorBoundaryState {
12
- error: any;
13
- info: any;
14
- }
15
- export declare function createOhbugErrorBoundary(client: OhbugClient, react: typeof React): {
16
- new (props: ErrorBoundaryProp): {
17
- componentDidCatch(error: Error, info: any): void;
18
- render(): React.ReactNode;
19
- context: any;
20
- setState<K extends keyof ErrorBoundaryState>(state: ErrorBoundaryState | ((prevState: Readonly<ErrorBoundaryState>, props: Readonly<ErrorBoundaryProp>) => ErrorBoundaryState | Pick<ErrorBoundaryState, K> | null) | Pick<ErrorBoundaryState, K> | null, callback?: (() => void) | undefined): void;
21
- forceUpdate(callback?: (() => void) | undefined): void;
22
- readonly props: Readonly<ErrorBoundaryProp> & Readonly<{
23
- children?: React.ReactNode;
24
- }>;
25
- state: Readonly<ErrorBoundaryState>;
26
- refs: {
27
- [key: string]: React.ReactInstance;
28
- };
29
- componentDidMount?(): void;
30
- shouldComponentUpdate?(nextProps: Readonly<ErrorBoundaryProp>, nextState: Readonly<ErrorBoundaryState>, nextContext: any): boolean;
31
- componentWillUnmount?(): void;
32
- getSnapshotBeforeUpdate?(prevProps: Readonly<ErrorBoundaryProp>, prevState: Readonly<ErrorBoundaryState>): any;
33
- componentDidUpdate?(prevProps: Readonly<ErrorBoundaryProp>, prevState: Readonly<ErrorBoundaryState>, snapshot?: any): void;
34
- componentWillMount?(): void;
35
- UNSAFE_componentWillMount?(): void;
36
- componentWillReceiveProps?(nextProps: Readonly<ErrorBoundaryProp>, nextContext: any): void;
37
- UNSAFE_componentWillReceiveProps?(nextProps: Readonly<ErrorBoundaryProp>, nextContext: any): void;
38
- componentWillUpdate?(nextProps: Readonly<ErrorBoundaryProp>, nextState: Readonly<ErrorBoundaryState>, nextContext: any): void;
39
- UNSAFE_componentWillUpdate?(nextProps: Readonly<ErrorBoundaryProp>, nextState: Readonly<ErrorBoundaryState>, nextContext: any): void;
40
- };
41
- contextType?: React.Context<any> | undefined;
42
- };
43
- export {};
44
- //# sourceMappingURL=OhbugErrorBoundary.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"OhbugErrorBoundary.d.ts","sourceRoot":"","sources":["../src/OhbugErrorBoundary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAChE,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,MAAM,WAAW,gBAAiB,SAAQ,eAAe;IACvD,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,GAAG,CAAA;CACf;AAED,UAAU,iBAAiB;IACzB,iBAAiB,EAAE,KAAK,CAAC,YAAY,CAAA;CACtC;AACD,UAAU,kBAAkB;IAC1B,KAAK,EAAE,GAAG,CAAA;IACV,IAAI,EAAE,GAAG,CAAA;CACV;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,OAAO,KAAK;gBAME,iBAAiB;iCAQX,KAAK,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;EA8B5C"}
@@ -1,2 +0,0 @@
1
- export declare const extension: import("@ohbug/types").OhbugExtension<any>;
2
- //# sourceMappingURL=extension.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,SAAS,4CAQpB,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAC5D,OAAO,EAAE,SAAS,IAAI,OAAO,EAAE,MAAM,aAAa,CAAA"}
@@ -1,30 +0,0 @@
1
- /*! *****************************************************************************
2
- Copyright (c) Microsoft Corporation.
3
-
4
- Permission to use, copy, modify, and/or distribute this software for any
5
- purpose with or without fee is hereby granted.
6
-
7
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
- PERFORMANCE OF THIS SOFTWARE.
14
- ***************************************************************************** */
15
- var t=function(){return(t=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function e(t){return"string"==typeof t}var r=function(t,e,r,n){this.type=r,this.timestamp=n||(new Date).toISOString(),this.message=t,this.data=e};!function(){function n(t,e){var r=t.apiKey,n=t.appVersion,o=t.appType,a=t.releaseStage,i=t.timestamp,s=t.category,p=t.type,c=t.sdk,u=t.detail,f=t.device,l=t.user,h=t.actions,y=t.metaData;this.apiKey=r,this.appVersion=n,this.appType=o,this.releaseStage=a,this.timestamp=i,this.category=s,this.type=p,this.sdk=c,this.detail=u,this.device=f,this.user=l,this.actions=h,this.metaData=y,this._client=e}Object.defineProperty(n.prototype,"_isOhbugEvent",{get:function(){return!0},enumerable:!1,configurable:!0}),n.prototype.addAction=function(t,n,o,a){var i,s,p=this.actions,c=e(t)?t:"",u=n||{},f=e(o)?o:"",l=new r(c,u,f,a);p.length>=(null!==(s=null===(i=this._client)||void 0===i?void 0:i._config.maxActions)&&void 0!==s?s:30)&&p.shift(),p.push(l)},n.prototype.getUser=function(){return this.user},n.prototype.setUser=function(e){var r;if(function(t){return"[object Object]"===Object.prototype.toString.call(t)}(e)&&Object.keys(e).length<=6)return this.user=t(t({},this.user),e),this.getUser();null===(r=this._client)||void 0===r||r._logger.warn(function(t,e){return new Error("Invalid data\n- "+t+", got "+JSON.stringify(e))}("setUser should be an object and have up to 6 attributes",e))},n.prototype.addMetaData=function(t,e){return function(t,e,r){e&&(t[e]=r)}(this.metaData,t,e)},n.prototype.getMetaData=function(t){return function(t,e){if(t[e])return t[e]}(this.metaData,t)},n.prototype.deleteMetaData=function(t){return function(t,e){if(t[e])return delete t[e]}(this.metaData,t)},n.prototype.toJSON=function(){var t=this;return{apiKey:t.apiKey,appVersion:t.appVersion,appType:t.appType,timestamp:t.timestamp,category:t.category,type:t.type,sdk:t.sdk,device:t.device,detail:t.detail,user:t.user,actions:t.actions,metaData:t.metaData,releaseStage:t.releaseStage}}}();Object.freeze({__proto__:null,UNCAUGHT_ERROR:"uncaughtError",RESOURCE_ERROR:"resourceError",UNHANDLEDREJECTION_ERROR:"unhandledrejectionError",AJAX_ERROR:"ajaxError",FETCH_ERROR:"fetchError",WEBSOCKET_ERROR:"websocketError",UNKNOWN_ERROR:"unknownError",MESSAGE:"message",FEEDBACK:"feedback",VIEW:"view",REACT:"react",VUE:"vue",ANGULAR:"angular",MINIAPP_ERROR:"miniappError",MINIAPP_UNHANDLEDREJECTION_ERROR:"miniappUnhandledrejectionError",MINIAPP_PAGENOTFOUND_ERROR:"miniappPagenotfoundError",MINIAPP_MEMORYWARNING_ERROR:"miniappMemorywarningError"});
16
- /*! *****************************************************************************
17
- Copyright (c) Microsoft Corporation.
18
-
19
- Permission to use, copy, modify, and/or distribute this software for any
20
- purpose with or without fee is hereby granted.
21
-
22
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
23
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
24
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
25
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
26
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
27
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
28
- PERFORMANCE OF THIS SOFTWARE.
29
- ***************************************************************************** */
30
- var n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)};function o(t,e){return function(e){function r(t){var r=e.call(this,t)||this;return r.state={error:null,info:null},r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(r,e),r.prototype.componentDidCatch=function(e,r){var n={name:e.name,message:e.message,stack:e.stack,errorInfo:r},o=t.createEvent({category:"error",type:"react",detail:n});t.notify(o),this.setState({error:e,info:r})},r.prototype.render=function(){if(this.state.error){var t=this.props.FallbackComponent;return t||null}return this.props.children},r}(e.Component)}var a={name:"OhbugReact",init:function(t,e){if(!e)throw new Error("Ohbug @ohbug/react reference to `React` was undefined");return o(t,e)}};export{a as default};
@@ -1,30 +0,0 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).OhbugReact=e()}(this,(function(){"use strict";
2
- /*! *****************************************************************************
3
- Copyright (c) Microsoft Corporation.
4
-
5
- Permission to use, copy, modify, and/or distribute this software for any
6
- purpose with or without fee is hereby granted.
7
-
8
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
- PERFORMANCE OF THIS SOFTWARE.
15
- ***************************************************************************** */var t=function(){return(t=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function e(t){return"string"==typeof t}var r=function(t,e,r,n){this.type=r,this.timestamp=n||(new Date).toISOString(),this.message=t,this.data=e};!function(){function n(t,e){var r=t.apiKey,n=t.appVersion,o=t.appType,i=t.releaseStage,a=t.timestamp,s=t.category,p=t.type,u=t.sdk,c=t.detail,f=t.device,l=t.user,h=t.actions,y=t.metaData;this.apiKey=r,this.appVersion=n,this.appType=o,this.releaseStage=i,this.timestamp=a,this.category=s,this.type=p,this.sdk=u,this.detail=c,this.device=f,this.user=l,this.actions=h,this.metaData=y,this._client=e}Object.defineProperty(n.prototype,"_isOhbugEvent",{get:function(){return!0},enumerable:!1,configurable:!0}),n.prototype.addAction=function(t,n,o,i){var a,s,p=this.actions,u=e(t)?t:"",c=n||{},f=e(o)?o:"",l=new r(u,c,f,i);p.length>=(null!==(s=null===(a=this._client)||void 0===a?void 0:a._config.maxActions)&&void 0!==s?s:30)&&p.shift(),p.push(l)},n.prototype.getUser=function(){return this.user},n.prototype.setUser=function(e){var r;if(function(t){return"[object Object]"===Object.prototype.toString.call(t)}(e)&&Object.keys(e).length<=6)return this.user=t(t({},this.user),e),this.getUser();null===(r=this._client)||void 0===r||r._logger.warn(function(t,e){return new Error("Invalid data\n- "+t+", got "+JSON.stringify(e))}("setUser should be an object and have up to 6 attributes",e))},n.prototype.addMetaData=function(t,e){return function(t,e,r){e&&(t[e]=r)}(this.metaData,t,e)},n.prototype.getMetaData=function(t){return function(t,e){if(t[e])return t[e]}(this.metaData,t)},n.prototype.deleteMetaData=function(t){return function(t,e){if(t[e])return delete t[e]}(this.metaData,t)},n.prototype.toJSON=function(){var t=this;return{apiKey:t.apiKey,appVersion:t.appVersion,appType:t.appType,timestamp:t.timestamp,category:t.category,type:t.type,sdk:t.sdk,device:t.device,detail:t.detail,user:t.user,actions:t.actions,metaData:t.metaData,releaseStage:t.releaseStage}}}();Object.freeze({__proto__:null,UNCAUGHT_ERROR:"uncaughtError",RESOURCE_ERROR:"resourceError",UNHANDLEDREJECTION_ERROR:"unhandledrejectionError",AJAX_ERROR:"ajaxError",FETCH_ERROR:"fetchError",WEBSOCKET_ERROR:"websocketError",UNKNOWN_ERROR:"unknownError",MESSAGE:"message",FEEDBACK:"feedback",VIEW:"view",REACT:"react",VUE:"vue",ANGULAR:"angular",MINIAPP_ERROR:"miniappError",MINIAPP_UNHANDLEDREJECTION_ERROR:"miniappUnhandledrejectionError",MINIAPP_PAGENOTFOUND_ERROR:"miniappPagenotfoundError",MINIAPP_MEMORYWARNING_ERROR:"miniappMemorywarningError"});
16
- /*! *****************************************************************************
17
- Copyright (c) Microsoft Corporation.
18
-
19
- Permission to use, copy, modify, and/or distribute this software for any
20
- purpose with or without fee is hereby granted.
21
-
22
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
23
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
24
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
25
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
26
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
27
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
28
- PERFORMANCE OF THIS SOFTWARE.
29
- ***************************************************************************** */
30
- var n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)};function o(t,e){return function(e){function r(t){var r=e.call(this,t)||this;return r.state={error:null,info:null},r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(r,e),r.prototype.componentDidCatch=function(e,r){var n={name:e.name,message:e.message,stack:e.stack,errorInfo:r},o=t.createEvent({category:"error",type:"react",detail:n});t.notify(o),this.setState({error:e,info:r})},r.prototype.render=function(){if(this.state.error){var t=this.props.FallbackComponent;return t||null}return this.props.children},r}(e.Component)}return{name:"OhbugReact",init:function(t,e){if(!e)throw new Error("Ohbug @ohbug/react reference to `React` was undefined");return o(t,e)}}}));