@ohbug/vue 1.0.14 → 2.0.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.
- package/README.md +6 -4
- package/dist/index.js +75 -0
- package/dist/index.mjs +51 -0
- package/package.json +23 -25
- package/src/index.ts +13 -0
- package/src/install.ts +58 -0
- package/dist/extension.d.ts +0 -2
- package/dist/extension.d.ts.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/install.d.ts +0 -12
- package/dist/install.d.ts.map +0 -1
- package/dist/ohbug-vue.es.js +0 -15
- package/dist/ohbug-vue.umd.js +0 -15
package/README.md
CHANGED
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@ohbug/vue)
|
|
4
4
|
[](https://bundlephobia.com/result?p=@ohbug/vue)
|
|
5
|
-
[](https://github.com/prettier/prettier)
|
|
6
5
|
|
|
7
6
|
English | [简体中文](./README-zh_CN.md)
|
|
8
7
|
|
|
9
8
|
## Installation
|
|
10
9
|
|
|
11
10
|
```
|
|
12
|
-
|
|
11
|
+
pnpm instal @ohbug/browser @ohbug/vue
|
|
13
12
|
```
|
|
14
13
|
|
|
15
14
|
## Usage
|
|
@@ -19,6 +18,9 @@ import Vue from 'vue'
|
|
|
19
18
|
import Ohbug from '@ohbug/browser'
|
|
20
19
|
import OhbugVue from '@ohbug/vue'
|
|
21
20
|
|
|
22
|
-
const client = Ohbug.
|
|
23
|
-
|
|
21
|
+
const client = Ohbug.setup({ apiKey: 'YOUR_API_KEY' })
|
|
22
|
+
|
|
23
|
+
Vue.createApp(App)
|
|
24
|
+
.use(OhbugVue(client))
|
|
25
|
+
.mount('#app')
|
|
24
26
|
```
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/index.ts
|
|
20
|
+
var src_exports = {};
|
|
21
|
+
__export(src_exports, {
|
|
22
|
+
default: () => createVueClient
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(src_exports);
|
|
25
|
+
|
|
26
|
+
// src/install.ts
|
|
27
|
+
var import_core = require("@ohbug/core");
|
|
28
|
+
var getComponent = (instance) => {
|
|
29
|
+
if ((instance == null ? void 0 : instance.$root) === instance)
|
|
30
|
+
return { component: "Root" };
|
|
31
|
+
const options = instance == null ? void 0 : instance.$options;
|
|
32
|
+
const component = options == null ? void 0 : options.name;
|
|
33
|
+
const file = options == null ? void 0 : options.__file;
|
|
34
|
+
return {
|
|
35
|
+
component,
|
|
36
|
+
file
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
function install(client, Vue) {
|
|
40
|
+
const prev = Vue.config.errorHandler;
|
|
41
|
+
const handler = (error, instance, info) => {
|
|
42
|
+
const { component, file } = getComponent(instance);
|
|
43
|
+
const detail = {
|
|
44
|
+
name: error.name,
|
|
45
|
+
message: error.message,
|
|
46
|
+
stack: error.stack,
|
|
47
|
+
errorInfo: info,
|
|
48
|
+
component,
|
|
49
|
+
file,
|
|
50
|
+
props: instance ? instance.$options.propsData : void 0
|
|
51
|
+
};
|
|
52
|
+
const event = client.createEvent({
|
|
53
|
+
category: "error",
|
|
54
|
+
type: import_core.EventTypes.VUE,
|
|
55
|
+
detail
|
|
56
|
+
});
|
|
57
|
+
client.notify(event);
|
|
58
|
+
if (typeof console !== "undefined" && typeof console.error === "function")
|
|
59
|
+
console.error(error);
|
|
60
|
+
if (typeof prev === "function")
|
|
61
|
+
prev(error, instance, info);
|
|
62
|
+
};
|
|
63
|
+
Vue.config.errorHandler = handler;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// src/index.ts
|
|
67
|
+
function createVueClient(client) {
|
|
68
|
+
return {
|
|
69
|
+
install: (app) => {
|
|
70
|
+
install(client, app);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
75
|
+
0 && (module.exports = {});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// src/install.ts
|
|
2
|
+
import { EventTypes } from "@ohbug/core";
|
|
3
|
+
var getComponent = (instance) => {
|
|
4
|
+
if ((instance == null ? void 0 : instance.$root) === instance)
|
|
5
|
+
return { component: "Root" };
|
|
6
|
+
const options = instance == null ? void 0 : instance.$options;
|
|
7
|
+
const component = options == null ? void 0 : options.name;
|
|
8
|
+
const file = options == null ? void 0 : options.__file;
|
|
9
|
+
return {
|
|
10
|
+
component,
|
|
11
|
+
file
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
function install(client, Vue) {
|
|
15
|
+
const prev = Vue.config.errorHandler;
|
|
16
|
+
const handler = (error, instance, info) => {
|
|
17
|
+
const { component, file } = getComponent(instance);
|
|
18
|
+
const detail = {
|
|
19
|
+
name: error.name,
|
|
20
|
+
message: error.message,
|
|
21
|
+
stack: error.stack,
|
|
22
|
+
errorInfo: info,
|
|
23
|
+
component,
|
|
24
|
+
file,
|
|
25
|
+
props: instance ? instance.$options.propsData : void 0
|
|
26
|
+
};
|
|
27
|
+
const event = client.createEvent({
|
|
28
|
+
category: "error",
|
|
29
|
+
type: EventTypes.VUE,
|
|
30
|
+
detail
|
|
31
|
+
});
|
|
32
|
+
client.notify(event);
|
|
33
|
+
if (typeof console !== "undefined" && typeof console.error === "function")
|
|
34
|
+
console.error(error);
|
|
35
|
+
if (typeof prev === "function")
|
|
36
|
+
prev(error, instance, info);
|
|
37
|
+
};
|
|
38
|
+
Vue.config.errorHandler = handler;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// src/index.ts
|
|
42
|
+
function createVueClient(client) {
|
|
43
|
+
return {
|
|
44
|
+
install: (app) => {
|
|
45
|
+
install(client, app);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
createVueClient as default
|
|
51
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ohbug/vue",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Ohbug SDK for Vue",
|
|
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
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"unpkg": "./dist/ohbug-vue.umd.js",
|
|
18
|
-
"jsdelivr": "./dist/ohbug-vue.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
|
-
"
|
|
23
|
-
"
|
|
20
|
+
"require": "./dist/index.js",
|
|
21
|
+
"import": "./dist/index.mjs",
|
|
22
|
+
"types": "./dist/index.d.ts"
|
|
24
23
|
}
|
|
25
24
|
},
|
|
26
25
|
"files": [
|
|
27
|
-
"dist"
|
|
26
|
+
"dist",
|
|
27
|
+
"src"
|
|
28
28
|
],
|
|
29
|
+
"sideEffects": false,
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"vue": "^3.0.0"
|
|
32
|
+
},
|
|
29
33
|
"dependencies": {
|
|
30
|
-
"@ohbug/core": "
|
|
34
|
+
"@ohbug/core": "2.0.0",
|
|
35
|
+
"@ohbug/types": "2.0.0"
|
|
31
36
|
},
|
|
32
37
|
"devDependencies": {
|
|
33
|
-
"vue": "^2.
|
|
34
|
-
},
|
|
35
|
-
"peerDependencies": {
|
|
36
|
-
"vue": "^2.6.0"
|
|
37
|
-
},
|
|
38
|
-
"buildOptions": {
|
|
39
|
-
"name": "OhbugVue",
|
|
40
|
-
"formats": [
|
|
41
|
-
"es",
|
|
42
|
-
"umd"
|
|
43
|
-
],
|
|
44
|
-
"order": 4
|
|
38
|
+
"vue": "^3.2.33"
|
|
45
39
|
},
|
|
46
40
|
"publishConfig": {
|
|
47
41
|
"access": "public"
|
|
48
42
|
},
|
|
49
|
-
"
|
|
50
|
-
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "tsup",
|
|
45
|
+
"dev": "tsup --watch"
|
|
46
|
+
},
|
|
47
|
+
"readme": "# `@ohbug/vue`\n\n[](https://www.npmjs.com/package/@ohbug/vue)\n[](https://bundlephobia.com/result?p=@ohbug/vue)\n\nEnglish | [简体中文](./README-zh_CN.md)\n\n## Installation\n\n```\npnpm instal @ohbug/browser @ohbug/vue\n```\n\n## Usage\n\n```javascript\nimport Vue from 'vue'\nimport Ohbug from '@ohbug/browser'\nimport OhbugVue from '@ohbug/vue'\n\nconst client = Ohbug.setup({ apiKey: 'YOUR_API_KEY' })\n\nVue.createApp(App)\n .use(OhbugVue(client))\n .mount('#app')\n```\n"
|
|
48
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { OhbugClient } from '@ohbug/types'
|
|
2
|
+
import type { Plugin } from 'vue'
|
|
3
|
+
import { install } from './install'
|
|
4
|
+
|
|
5
|
+
export type { VueErrorDetail } from './install'
|
|
6
|
+
|
|
7
|
+
export default function createVueClient(client: OhbugClient): Plugin {
|
|
8
|
+
return {
|
|
9
|
+
install: (app) => {
|
|
10
|
+
install(client, app)
|
|
11
|
+
},
|
|
12
|
+
}
|
|
13
|
+
}
|
package/src/install.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { EventTypes } from '@ohbug/core'
|
|
2
|
+
import type { OhbugBaseDetail, OhbugClient } from '@ohbug/types'
|
|
3
|
+
import type { App, ComponentPublicInstance } from 'vue'
|
|
4
|
+
|
|
5
|
+
export interface VueErrorDetail extends OhbugBaseDetail {
|
|
6
|
+
name: string
|
|
7
|
+
stack?: string
|
|
8
|
+
errorInfo: string
|
|
9
|
+
component?: string
|
|
10
|
+
file?: string
|
|
11
|
+
props?: Record<string, any>
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const getComponent = (instance: ComponentPublicInstance | null) => {
|
|
15
|
+
if (instance?.$root === instance)
|
|
16
|
+
return { component: 'Root' }
|
|
17
|
+
|
|
18
|
+
const options = instance?.$options
|
|
19
|
+
const component = options?.name
|
|
20
|
+
const file = options?.__file
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
component,
|
|
24
|
+
file,
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function install(client: OhbugClient, Vue: App) {
|
|
29
|
+
const prev = Vue.config.errorHandler
|
|
30
|
+
|
|
31
|
+
const handler = (error: Error, instance: ComponentPublicInstance | null, info: string) => {
|
|
32
|
+
const { component, file } = getComponent(instance)
|
|
33
|
+
|
|
34
|
+
const detail: VueErrorDetail = {
|
|
35
|
+
name: error.name,
|
|
36
|
+
message: error.message,
|
|
37
|
+
stack: error.stack,
|
|
38
|
+
errorInfo: info,
|
|
39
|
+
component,
|
|
40
|
+
file,
|
|
41
|
+
props: instance ? instance.$options.propsData : undefined,
|
|
42
|
+
}
|
|
43
|
+
const event = client.createEvent<VueErrorDetail>({
|
|
44
|
+
category: 'error',
|
|
45
|
+
type: EventTypes.VUE,
|
|
46
|
+
detail,
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
client.notify(event)
|
|
50
|
+
|
|
51
|
+
if (typeof console !== 'undefined' && typeof console.error === 'function')
|
|
52
|
+
console.error(error)
|
|
53
|
+
if (typeof prev === 'function') prev(error, instance, info)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// @ts-expect-error type is not assignable
|
|
57
|
+
Vue.config.errorHandler = handler
|
|
58
|
+
}
|
package/dist/extension.d.ts
DELETED
package/dist/extension.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../src/extension.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,SAAS,4CAQpB,CAAA"}
|
package/dist/index.d.ts
DELETED
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAC/C,OAAO,EAAE,SAAS,IAAI,OAAO,EAAE,MAAM,aAAa,CAAA"}
|
package/dist/install.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { OhbugBaseDetail, OhbugClient } from '@ohbug/types';
|
|
2
|
-
import type { VueConstructor } from 'vue';
|
|
3
|
-
export interface VueErrorDetail extends OhbugBaseDetail {
|
|
4
|
-
name: string;
|
|
5
|
-
stack?: string;
|
|
6
|
-
errorInfo: string;
|
|
7
|
-
component: string;
|
|
8
|
-
file: string;
|
|
9
|
-
props?: Record<string, any>;
|
|
10
|
-
}
|
|
11
|
-
export declare function install(client: OhbugClient, Vue: VueConstructor): void;
|
|
12
|
-
//# sourceMappingURL=install.d.ts.map
|
package/dist/install.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,KAAK,CAAA;AAGzC,MAAM,WAAW,cAAe,SAAQ,eAAe;IACrD,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC5B;AAkBD,wBAAgB,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,cAAc,QA6B/D"}
|
package/dist/ohbug-vue.es.js
DELETED
|
@@ -1,15 +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 e=function(){return(e=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function t(e){return"string"==typeof e}var r=function(e,t,r,n){this.type=r,this.timestamp=n||(new Date).toISOString(),this.message=e,this.data=t};!function(){function n(e,t){var r=e.apiKey,n=e.appVersion,o=e.appType,a=e.releaseStage,i=e.timestamp,s=e.category,p=e.type,c=e.sdk,u=e.detail,f=e.device,l=e.user,h=e.actions,E=e.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=E,this._client=t}Object.defineProperty(n.prototype,"_isOhbugEvent",{get:function(){return!0},enumerable:!1,configurable:!0}),n.prototype.addAction=function(e,n,o,a){var i,s,p=this.actions,c=t(e)?e:"",u=n||{},f=t(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(t){var r;if(function(e){return"[object Object]"===Object.prototype.toString.call(e)}(t)&&Object.keys(t).length<=6)return this.user=e(e({},this.user),t),this.getUser();null===(r=this._client)||void 0===r||r._logger.warn(function(e,t){return new Error("Invalid data\n- "+e+", got "+JSON.stringify(t))}("setUser should be an object and have up to 6 attributes",t))},n.prototype.addMetaData=function(e,t){return function(e,t,r){t&&(e[t]=r)}(this.metaData,e,t)},n.prototype.getMetaData=function(e){return function(e,t){if(e[t])return e[t]}(this.metaData,e)},n.prototype.deleteMetaData=function(e){return function(e,t){if(e[t])return delete e[t]}(this.metaData,e)},n.prototype.toJSON=function(){var e=this;return{apiKey:e.apiKey,appVersion:e.appVersion,appType:e.appType,timestamp:e.timestamp,category:e.category,type:e.type,sdk:e.sdk,device:e.device,detail:e.detail,user:e.user,actions:e.actions,metaData:e.metaData,releaseStage:e.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"});var n={name:"OhbugVue",init:function(e,t){if(!t)throw new Error("Ohbug @ohbug/vue reference to `Vue` was undefined");return function(e,t){var r=t.config.errorHandler;t.config.errorHandler=function(t,n,o){var a=function(e){if(e.$root===e)return{component:"Root"};var t=e.$options;return{component:t.name,file:t.__file}}(n),i=a.component,s=a.file,p={name:t.name,message:t.message,stack:t.stack,errorInfo:o,component:i,file:s,props:n?n.$options.propsData:void 0},c=e.createEvent({category:"error",type:"vue",detail:p});e.notify(c),"undefined"!=typeof console&&"function"==typeof console.error&&console.error(t),"function"==typeof r&&r(t,n,o)}}(e,t)}};export{n as default};
|
package/dist/ohbug-vue.umd.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).OhbugVue=t()}(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 e=function(){return(e=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function t(e){return"string"==typeof e}var r=function(e,t,r,n){this.type=r,this.timestamp=n||(new Date).toISOString(),this.message=e,this.data=t};!function(){function n(e,t){var r=e.apiKey,n=e.appVersion,o=e.appType,i=e.releaseStage,a=e.timestamp,s=e.category,p=e.type,u=e.sdk,c=e.detail,f=e.device,l=e.user,d=e.actions,h=e.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=d,this.metaData=h,this._client=t}Object.defineProperty(n.prototype,"_isOhbugEvent",{get:function(){return!0},enumerable:!1,configurable:!0}),n.prototype.addAction=function(e,n,o,i){var a,s,p=this.actions,u=t(e)?e:"",c=n||{},f=t(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(t){var r;if(function(e){return"[object Object]"===Object.prototype.toString.call(e)}(t)&&Object.keys(t).length<=6)return this.user=e(e({},this.user),t),this.getUser();null===(r=this._client)||void 0===r||r._logger.warn(function(e,t){return new Error("Invalid data\n- "+e+", got "+JSON.stringify(t))}("setUser should be an object and have up to 6 attributes",t))},n.prototype.addMetaData=function(e,t){return function(e,t,r){t&&(e[t]=r)}(this.metaData,e,t)},n.prototype.getMetaData=function(e){return function(e,t){if(e[t])return e[t]}(this.metaData,e)},n.prototype.deleteMetaData=function(e){return function(e,t){if(e[t])return delete e[t]}(this.metaData,e)},n.prototype.toJSON=function(){var e=this;return{apiKey:e.apiKey,appVersion:e.appVersion,appType:e.appType,timestamp:e.timestamp,category:e.category,type:e.type,sdk:e.sdk,device:e.device,detail:e.detail,user:e.user,actions:e.actions,metaData:e.metaData,releaseStage:e.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"});return{name:"OhbugVue",init:function(e,t){if(!t)throw new Error("Ohbug @ohbug/vue reference to `Vue` was undefined");return function(e,t){var r=t.config.errorHandler;t.config.errorHandler=function(t,n,o){var i=function(e){if(e.$root===e)return{component:"Root"};var t=e.$options;return{component:t.name,file:t.__file}}(n),a=i.component,s=i.file,p={name:t.name,message:t.message,stack:t.stack,errorInfo:o,component:a,file:s,props:n?n.$options.propsData:void 0},u=e.createEvent({category:"error",type:"vue",detail:p});e.notify(u),"undefined"!=typeof console&&"function"==typeof console.error&&console.error(t),"function"==typeof r&&r(t,n,o)}}(e,t)}}}));
|