@ohbug/extension-rrweb 1.7.1 → 1.8.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 +2 -3
- package/dist/index.d.ts +5 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -0
- package/package.json +36 -52
- package/CHANGELOG.md +0 -35
- package/dist/extension.es.js +0 -211
- package/dist/extension.es.min.js +0 -15
- package/dist/extension.umd.js +0 -217
- package/dist/extension.umd.min.js +0 -15
- package/dist/src/extension.d.ts +0 -3
- package/dist/src/extension.d.ts.map +0 -1
- package/dist/src/index.d.ts +0 -2
- package/dist/src/index.d.ts.map +0 -1
- package/dist/ui/index.d.ts +0 -4
- package/dist/ui/index.d.ts.map +0 -1
- package/dist/ui.es.js +0 -264
- package/dist/ui.es.min.js +0 -44
package/README.md
CHANGED
|
@@ -10,14 +10,13 @@
|
|
|
10
10
|
|
|
11
11
|
[](https://www.npmjs.com/package/@ohbug/extension-rrweb)
|
|
12
12
|
[](https://bundlephobia.com/result?p=@ohbug/extension-rrweb)
|
|
13
|
-
[](https://github.com/prettier/prettier)
|
|
14
13
|
|
|
15
14
|
Package [rrweb](https://github.com/rrweb-io/rrweb), to "screen recording".
|
|
16
15
|
|
|
17
16
|
## Installation
|
|
18
17
|
|
|
19
18
|
```
|
|
20
|
-
|
|
19
|
+
pnpm i rrweb @ohbug/extension-rrweb
|
|
21
20
|
```
|
|
22
21
|
|
|
23
22
|
## Usage
|
|
@@ -26,6 +25,6 @@ yarn add rrweb @ohbug/extension-rrweb
|
|
|
26
25
|
import Ohbug from '@ohbug/browser'
|
|
27
26
|
import OhbugExtensionRrweb from '@ohbug/extension-rrweb'
|
|
28
27
|
|
|
29
|
-
const client = Ohbug.
|
|
28
|
+
const client = Ohbug.setup({ apiKey: 'YOUR_API_KEY' })
|
|
30
29
|
client.use(OhbugExtensionRrweb)
|
|
31
30
|
```
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var r=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var c=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},b=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of h(t))!u.call(e,s)&&s!==n&&r(e,s,{get:()=>t[s],enumerable:!(i=a(t,s))||i.enumerable});return e};var f=e=>b(r({},"__esModule",{value:!0}),e);var l={};c(l,{default:()=>m});module.exports=f(l);var p=require("rrweb"),o=[[]],g={name:"OhbugExtensionRrweb",onSetup:()=>{(0,p.record)({emit(e,t){t&&o.push([]),o[o.length-1].push(e)},checkoutEveryNms:3*60*1e3})},onEvent:e=>{let t=o.length,n=(o[t-2]||[]).concat(o[t-1]);return e.addMetadata("rrweb",n),e}},m=g;0&&(module.exports={});
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{record as s}from"rrweb";var t=[[]],r={name:"OhbugExtensionRrweb",onSetup:()=>{s({emit(e,n){n&&t.push([]),t[t.length-1].push(e)},checkoutEveryNms:3*60*1e3})},onEvent:e=>{let n=t.length,o=(t[n-2]||[]).concat(t[n-1]);return e.addMetadata("rrweb",o),e}},i=r;export{i as default};
|
package/package.json
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"ohbug": {
|
|
3
|
-
"name": "OhbugExtensionRrweb",
|
|
4
|
-
"key": "rrweb",
|
|
5
|
-
"ui": {
|
|
6
|
-
"name": "OhbugExtensionUIRrweb",
|
|
7
|
-
"cdn": "https://cdn.jsdelivr.net/npm/@ohbug/extension-rrweb@latest/dist/ui.es.min.js"
|
|
8
|
-
}
|
|
9
|
-
},
|
|
10
2
|
"name": "@ohbug/extension-rrweb",
|
|
11
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
12
4
|
"description": "Ohbug extension to 'screen recording'",
|
|
5
|
+
"license": "MIT",
|
|
13
6
|
"author": "chenyueban <jasonchan0527@gmail.com>",
|
|
14
7
|
"homepage": "https://github.com/ohbug-org/ohbug-extension-rrweb",
|
|
15
8
|
"bugs": {
|
|
@@ -19,63 +12,54 @@
|
|
|
19
12
|
"type": "git",
|
|
20
13
|
"url": "https://github.com/ohbug-org/ohbug-extension-rrweb"
|
|
21
14
|
},
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"unpkg": "./dist/extension.es.min.js",
|
|
26
|
-
"jsdelivr": "./dist/extension.es.min.js",
|
|
27
|
-
"types": "./dist/src/index.d.ts",
|
|
15
|
+
"main": "dist/index.js",
|
|
16
|
+
"module": "dist/index.mjs",
|
|
17
|
+
"types": "dist/index.d.ts",
|
|
28
18
|
"exports": {
|
|
29
19
|
".": {
|
|
30
|
-
"
|
|
31
|
-
"
|
|
20
|
+
"require": "./dist/index.js",
|
|
21
|
+
"import": "./dist/index.mjs",
|
|
22
|
+
"types": "./dist/index.d.ts"
|
|
32
23
|
}
|
|
33
24
|
},
|
|
34
25
|
"files": [
|
|
35
26
|
"dist"
|
|
36
27
|
],
|
|
28
|
+
"scripts": {
|
|
29
|
+
"prebuild": "rimraf dist",
|
|
30
|
+
"build": "tsup",
|
|
31
|
+
"dev": "tsup --watch",
|
|
32
|
+
"update:deps": "pnpm update -i -r --latest",
|
|
33
|
+
"release": "release-it",
|
|
34
|
+
"preinstall": "npx only-allow pnpm",
|
|
35
|
+
"lint": "eslint . --fix",
|
|
36
|
+
"prepare": "husky install"
|
|
37
|
+
},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"rrweb": "^2.0.0"
|
|
40
|
+
},
|
|
37
41
|
"dependencies": {
|
|
38
|
-
"@ohbug/core": "^
|
|
42
|
+
"@ohbug/core": "^2.1.0",
|
|
43
|
+
"@ohbug/types": "^2.1.0"
|
|
39
44
|
},
|
|
40
45
|
"devDependencies": {
|
|
41
|
-
"@chenyueban/
|
|
42
|
-
"@chenyueban/tsconfig": "^
|
|
43
|
-
"@commitlint/cli": "^
|
|
44
|
-
"@
|
|
45
|
-
"@
|
|
46
|
-
"
|
|
47
|
-
"@rollup/plugin-replace": "^3.0.0",
|
|
48
|
-
"commitizen": "^4.2.4",
|
|
46
|
+
"@chenyueban/eslint-config": "^1.0.12",
|
|
47
|
+
"@chenyueban/tsconfig": "^2.1.0",
|
|
48
|
+
"@commitlint/cli": "^17.0.3",
|
|
49
|
+
"@commitlint/config-conventional": "^17.0.3",
|
|
50
|
+
"@release-it/conventional-changelog": "^5.0.0",
|
|
51
|
+
"commitizen": "^4.2.5",
|
|
49
52
|
"cz-conventional-changelog": "3.3.0",
|
|
50
|
-
"
|
|
51
|
-
"
|
|
53
|
+
"eslint": "^8.20.0",
|
|
54
|
+
"husky": "^8.0.1",
|
|
55
|
+
"lint-staged": "^13.0.3",
|
|
56
|
+
"release-it": "^15.1.2",
|
|
52
57
|
"rimraf": "^3.0.2",
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"rollup-plugin-typescript2": "^0.30.0",
|
|
57
|
-
"rrweb": "^1.0.4",
|
|
58
|
-
"typescript": "^4.4.2"
|
|
59
|
-
},
|
|
60
|
-
"peerDependencies": {
|
|
61
|
-
"rrweb": "^1.0.4"
|
|
58
|
+
"rrweb": "^2.0.0-alpha.0",
|
|
59
|
+
"tsup": "^6.1.3",
|
|
60
|
+
"typescript": "^4.7.4"
|
|
62
61
|
},
|
|
63
62
|
"publishConfig": {
|
|
64
63
|
"access": "public"
|
|
65
|
-
},
|
|
66
|
-
"scripts": {
|
|
67
|
-
"prebuild": "rimraf dist",
|
|
68
|
-
"build": "npm run build:extension && npm run build:ui",
|
|
69
|
-
"dev": "rollup -cw",
|
|
70
|
-
"build:ui": "rollup -c rollup.config.ui.js --environment NODE_ENV:production",
|
|
71
|
-
"build:extension": "rollup -c --environment NODE_ENV:production",
|
|
72
|
-
"update:deps": "yarn upgrade-interactive --latest",
|
|
73
|
-
"release": "release-it",
|
|
74
|
-
"commit": "cz"
|
|
75
|
-
},
|
|
76
|
-
"config": {
|
|
77
|
-
"commitizen": {
|
|
78
|
-
"path": "./node_modules/cz-conventional-changelog"
|
|
79
|
-
}
|
|
80
64
|
}
|
|
81
65
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
## [1.7.1](https://github.com/ohbug-org/ohbug-extension-rrweb/compare/v1.7.0...v1.7.1) (2021-09-08)
|
|
2
|
-
|
|
3
|
-
# [1.7.0](https://github.com/ohbug-org/ohbug-extension-rrweb/compare/v1.5.0...v1.7.0) (2021-09-08)
|
|
4
|
-
|
|
5
|
-
### Features
|
|
6
|
-
|
|
7
|
-
- 重构 rollup 打包配置 ([d605433](https://github.com/ohbug-org/ohbug-extension-rrweb/commit/d60543392213df77e8f3067f46c1e67863c34c2d))
|
|
8
|
-
|
|
9
|
-
# Changelog
|
|
10
|
-
|
|
11
|
-
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
12
|
-
|
|
13
|
-
## [1.5.0](https://github.com/ohbug-org/ohbug-extension-rrweb/compare/v1.4.1...v1.5.0) (2021-07-23)
|
|
14
|
-
|
|
15
|
-
### Features
|
|
16
|
-
|
|
17
|
-
- 启用新的 ui 构建方式 ([c0eea12](https://github.com/ohbug-org/ohbug-extension-rrweb/commit/c0eea12f6cb04422d17f5764feaa0d0458271966))
|
|
18
|
-
|
|
19
|
-
### [1.4.1](https://github.com/ohbug-org/ohbug-extension-rrweb/compare/v1.4.0...v1.4.1) (2021-04-21)
|
|
20
|
-
|
|
21
|
-
### Features
|
|
22
|
-
|
|
23
|
-
- **ui:** 恢复 react 依赖 ([4c22e8c](https://github.com/ohbug-org/ohbug-extension-rrweb/commit/4c22e8cd2469e5efe348f70bb4ec5f0d48701b20))
|
|
24
|
-
|
|
25
|
-
## [1.4.0](https://github.com/ohbug-org/ohbug-extension-rrweb/compare/v1.3.0...v1.4.0) (2021-04-20)
|
|
26
|
-
|
|
27
|
-
### Features
|
|
28
|
-
|
|
29
|
-
- **ui:** 使用新版扩展的创建方式 ([afe9803](https://github.com/ohbug-org/ohbug-extension-rrweb/commit/afe98035203c36f87b878ea70069a38b542543d3))
|
|
30
|
-
|
|
31
|
-
## [1.3.0](https://github.com/ohbug-org/ohbug-extension-rrweb/compare/v1.2.5...v1.3.0) (2021-04-20)
|
|
32
|
-
|
|
33
|
-
### Features
|
|
34
|
-
|
|
35
|
-
- adapt to react17 ([0ebf4d0](https://github.com/ohbug-org/ohbug-extension-rrweb/commit/0ebf4d0d9385fdaef1665e314f67df27d661ced2))
|
package/dist/extension.es.js
DELETED
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import { record } from 'rrweb';
|
|
2
|
-
|
|
3
|
-
/*! *****************************************************************************
|
|
4
|
-
Copyright (c) Microsoft Corporation.
|
|
5
|
-
|
|
6
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
7
|
-
purpose with or without fee is hereby granted.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
-
***************************************************************************** */
|
|
17
|
-
|
|
18
|
-
var __assign = function() {
|
|
19
|
-
__assign = Object.assign || function __assign(t) {
|
|
20
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
21
|
-
s = arguments[i];
|
|
22
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
23
|
-
}
|
|
24
|
-
return t;
|
|
25
|
-
};
|
|
26
|
-
return __assign.apply(this, arguments);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
function isString(value) {
|
|
30
|
-
return typeof value === 'string';
|
|
31
|
-
}
|
|
32
|
-
function isObject(value) {
|
|
33
|
-
return Object.prototype.toString.call(value) === '[object Object]';
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function createExtension(extension) {
|
|
37
|
-
return extension;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
var Action = /** @class */ (function () {
|
|
41
|
-
function Action(message, data, type, timestamp) {
|
|
42
|
-
this.type = type;
|
|
43
|
-
this.timestamp = timestamp || new Date().toISOString();
|
|
44
|
-
this.message = message;
|
|
45
|
-
this.data = data;
|
|
46
|
-
}
|
|
47
|
-
return Action;
|
|
48
|
-
}());
|
|
49
|
-
function getErrorMessage(message, data) {
|
|
50
|
-
return new Error("Invalid data\n- " + message + ", got " + JSON.stringify(data));
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function addMetaData(map, section, data) {
|
|
54
|
-
if (!section)
|
|
55
|
-
return;
|
|
56
|
-
map[section] = data;
|
|
57
|
-
}
|
|
58
|
-
function getMetaData(map, section) {
|
|
59
|
-
if (map[section]) {
|
|
60
|
-
return map[section];
|
|
61
|
-
}
|
|
62
|
-
return undefined;
|
|
63
|
-
}
|
|
64
|
-
function deleteMetaData(map, section) {
|
|
65
|
-
if (map[section]) {
|
|
66
|
-
return delete map[section];
|
|
67
|
-
}
|
|
68
|
-
return undefined;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/** @class */ ((function () {
|
|
72
|
-
function Event(values, client) {
|
|
73
|
-
var apiKey = values.apiKey, appVersion = values.appVersion, appType = values.appType, releaseStage = values.releaseStage, timestamp = values.timestamp, category = values.category, type = values.type, sdk = values.sdk, detail = values.detail, device = values.device, user = values.user, actions = values.actions, metaData = values.metaData;
|
|
74
|
-
this.apiKey = apiKey;
|
|
75
|
-
this.appVersion = appVersion;
|
|
76
|
-
this.appType = appType;
|
|
77
|
-
this.releaseStage = releaseStage;
|
|
78
|
-
this.timestamp = timestamp;
|
|
79
|
-
this.category = category;
|
|
80
|
-
this.type = type;
|
|
81
|
-
this.sdk = sdk;
|
|
82
|
-
this.detail = detail;
|
|
83
|
-
this.device = device;
|
|
84
|
-
this.user = user;
|
|
85
|
-
this.actions = actions;
|
|
86
|
-
this.metaData = metaData;
|
|
87
|
-
this._client = client;
|
|
88
|
-
}
|
|
89
|
-
Object.defineProperty(Event.prototype, "_isOhbugEvent", {
|
|
90
|
-
get: function () {
|
|
91
|
-
return true;
|
|
92
|
-
},
|
|
93
|
-
enumerable: false,
|
|
94
|
-
configurable: true
|
|
95
|
-
});
|
|
96
|
-
/**
|
|
97
|
-
* Add an action.
|
|
98
|
-
* Once the threshold is reached, the oldest breadcrumbs will be deleted.
|
|
99
|
-
* 新增一个动作。
|
|
100
|
-
* 一旦达到阈值,最老的 Action 将被删除。
|
|
101
|
-
*
|
|
102
|
-
* @param message
|
|
103
|
-
* @param data
|
|
104
|
-
* @param type
|
|
105
|
-
* @param timestamp
|
|
106
|
-
*/
|
|
107
|
-
Event.prototype.addAction = function (message, data, type, timestamp) {
|
|
108
|
-
var _a, _b;
|
|
109
|
-
var actions = this.actions;
|
|
110
|
-
var targetMessage = isString(message) ? message : '';
|
|
111
|
-
var targetData = data || {};
|
|
112
|
-
var targetType = isString(type) ? type : '';
|
|
113
|
-
var action = new Action(targetMessage, targetData, targetType, timestamp);
|
|
114
|
-
if (actions.length >= ((_b = (_a = this._client) === null || _a === void 0 ? void 0 : _a._config.maxActions) !== null && _b !== void 0 ? _b : 30)) {
|
|
115
|
-
actions.shift();
|
|
116
|
-
}
|
|
117
|
-
actions.push(action);
|
|
118
|
-
};
|
|
119
|
-
/**
|
|
120
|
-
* Get current user information
|
|
121
|
-
* 获取当前的用户信息
|
|
122
|
-
*/
|
|
123
|
-
Event.prototype.getUser = function () {
|
|
124
|
-
return this.user;
|
|
125
|
-
};
|
|
126
|
-
/**
|
|
127
|
-
* Set current user information
|
|
128
|
-
* 设置当前的用户信息
|
|
129
|
-
*/
|
|
130
|
-
Event.prototype.setUser = function (user) {
|
|
131
|
-
var _a;
|
|
132
|
-
if (isObject(user) && Object.keys(user).length <= 6) {
|
|
133
|
-
this.user = __assign(__assign({}, this.user), user);
|
|
134
|
-
return this.getUser();
|
|
135
|
-
}
|
|
136
|
-
(_a = this._client) === null || _a === void 0 ? void 0 : _a._logger.warn(getErrorMessage('setUser should be an object and have up to 6 attributes', user));
|
|
137
|
-
return undefined;
|
|
138
|
-
};
|
|
139
|
-
/**
|
|
140
|
-
* Add metaData
|
|
141
|
-
* 新增 metaData
|
|
142
|
-
*
|
|
143
|
-
* @param section
|
|
144
|
-
* @param data
|
|
145
|
-
*/
|
|
146
|
-
Event.prototype.addMetaData = function (section, data) {
|
|
147
|
-
return addMetaData(this.metaData, section, data);
|
|
148
|
-
};
|
|
149
|
-
/**
|
|
150
|
-
* Get metaData
|
|
151
|
-
* 获取 metaData
|
|
152
|
-
*
|
|
153
|
-
* @param section
|
|
154
|
-
*/
|
|
155
|
-
Event.prototype.getMetaData = function (section) {
|
|
156
|
-
return getMetaData(this.metaData, section);
|
|
157
|
-
};
|
|
158
|
-
/**
|
|
159
|
-
* Delete metaData
|
|
160
|
-
* 删除 metaData
|
|
161
|
-
*
|
|
162
|
-
* @param section
|
|
163
|
-
*/
|
|
164
|
-
Event.prototype.deleteMetaData = function (section) {
|
|
165
|
-
return deleteMetaData(this.metaData, section);
|
|
166
|
-
};
|
|
167
|
-
Event.prototype.toJSON = function () {
|
|
168
|
-
var _a = this, apiKey = _a.apiKey, appVersion = _a.appVersion, appType = _a.appType, timestamp = _a.timestamp, category = _a.category, type = _a.type, sdk = _a.sdk, device = _a.device, detail = _a.detail, user = _a.user, actions = _a.actions, metaData = _a.metaData, releaseStage = _a.releaseStage;
|
|
169
|
-
return {
|
|
170
|
-
apiKey: apiKey,
|
|
171
|
-
appVersion: appVersion,
|
|
172
|
-
appType: appType,
|
|
173
|
-
timestamp: timestamp,
|
|
174
|
-
category: category,
|
|
175
|
-
type: type,
|
|
176
|
-
sdk: sdk,
|
|
177
|
-
device: device,
|
|
178
|
-
detail: detail,
|
|
179
|
-
user: user,
|
|
180
|
-
actions: actions,
|
|
181
|
-
metaData: metaData,
|
|
182
|
-
releaseStage: releaseStage,
|
|
183
|
-
};
|
|
184
|
-
};
|
|
185
|
-
return Event;
|
|
186
|
-
})());
|
|
187
|
-
|
|
188
|
-
const eventsMatrix = [[]];
|
|
189
|
-
const extension = createExtension({
|
|
190
|
-
name: 'OhbugExtensionRrweb',
|
|
191
|
-
init: () => {
|
|
192
|
-
record({
|
|
193
|
-
emit(event, isCheckout) {
|
|
194
|
-
if (isCheckout) {
|
|
195
|
-
eventsMatrix.push([]);
|
|
196
|
-
}
|
|
197
|
-
const lastEvents = eventsMatrix[eventsMatrix.length - 1];
|
|
198
|
-
lastEvents.push(event);
|
|
199
|
-
},
|
|
200
|
-
checkoutEveryNms: 3 * 60 * 1000,
|
|
201
|
-
});
|
|
202
|
-
},
|
|
203
|
-
created: (event) => {
|
|
204
|
-
const len = eventsMatrix.length;
|
|
205
|
-
const events = (eventsMatrix[len - 2] || []).concat(eventsMatrix[len - 1]);
|
|
206
|
-
event.addMetaData('rrweb', events);
|
|
207
|
-
return event;
|
|
208
|
-
},
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
export { extension as default };
|
package/dist/extension.es.min.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import{record as t}from"rrweb";
|
|
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(t){for(var e,a=1,i=arguments.length;a<i;a++)for(var n in e=arguments[a])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}).apply(this,arguments)};function a(t){return"string"==typeof t}var i=function(t,e,a,i){this.type=a,this.timestamp=i||(new Date).toISOString(),this.message=t,this.data=e};!function(){function t(t,e){var a=t.apiKey,i=t.appVersion,n=t.appType,r=t.releaseStage,s=t.timestamp,o=t.category,p=t.type,c=t.sdk,u=t.detail,h=t.device,l=t.user,y=t.actions,d=t.metaData;this.apiKey=a,this.appVersion=i,this.appType=n,this.releaseStage=r,this.timestamp=s,this.category=o,this.type=p,this.sdk=c,this.detail=u,this.device=h,this.user=l,this.actions=y,this.metaData=d,this._client=e}Object.defineProperty(t.prototype,"_isOhbugEvent",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.addAction=function(t,e,n,r){var s,o,p=this.actions,c=a(t)?t:"",u=e||{},h=a(n)?n:"",l=new i(c,u,h,r);p.length>=(null!==(o=null===(s=this._client)||void 0===s?void 0:s._config.maxActions)&&void 0!==o?o:30)&&p.shift(),p.push(l)},t.prototype.getUser=function(){return this.user},t.prototype.setUser=function(t){var a,i,n;if(i=t,"[object Object]"===Object.prototype.toString.call(i)&&Object.keys(t).length<=6)return this.user=e(e({},this.user),t),this.getUser();null===(a=this._client)||void 0===a||a._logger.warn((n=t,new Error("Invalid data\n- "+"setUser should be an object and have up to 6 attributes"+", got "+JSON.stringify(n))))},t.prototype.addMetaData=function(t,e){return function(t,e,a){e&&(t[e]=a)}(this.metaData,t,e)},t.prototype.getMetaData=function(t){return function(t,e){if(t[e])return t[e]}(this.metaData,t)},t.prototype.deleteMetaData=function(t){return function(t,e){if(t[e])return delete t[e]}(this.metaData,t)},t.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}}}();const n=[[]],r={name:"OhbugExtensionRrweb",init:()=>{t({emit(t,e){e&&n.push([]);n[n.length-1].push(t)},checkoutEveryNms:18e4})},created:t=>{const e=n.length,a=(n[e-2]||[]).concat(n[e-1]);return t.addMetaData("rrweb",a),t}};export{r as default};
|
package/dist/extension.umd.js
DELETED
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('rrweb')) :
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['rrweb'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.OhbugExtensionRrweb = factory(global.rrweb));
|
|
5
|
-
}(this, (function (rrweb) { 'use strict';
|
|
6
|
-
|
|
7
|
-
/*! *****************************************************************************
|
|
8
|
-
Copyright (c) Microsoft Corporation.
|
|
9
|
-
|
|
10
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
11
|
-
purpose with or without fee is hereby granted.
|
|
12
|
-
|
|
13
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
14
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
15
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
16
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
17
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
18
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
19
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
20
|
-
***************************************************************************** */
|
|
21
|
-
|
|
22
|
-
var __assign = function() {
|
|
23
|
-
__assign = Object.assign || function __assign(t) {
|
|
24
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
25
|
-
s = arguments[i];
|
|
26
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
27
|
-
}
|
|
28
|
-
return t;
|
|
29
|
-
};
|
|
30
|
-
return __assign.apply(this, arguments);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
function isString(value) {
|
|
34
|
-
return typeof value === 'string';
|
|
35
|
-
}
|
|
36
|
-
function isObject(value) {
|
|
37
|
-
return Object.prototype.toString.call(value) === '[object Object]';
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function createExtension(extension) {
|
|
41
|
-
return extension;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
var Action = /** @class */ (function () {
|
|
45
|
-
function Action(message, data, type, timestamp) {
|
|
46
|
-
this.type = type;
|
|
47
|
-
this.timestamp = timestamp || new Date().toISOString();
|
|
48
|
-
this.message = message;
|
|
49
|
-
this.data = data;
|
|
50
|
-
}
|
|
51
|
-
return Action;
|
|
52
|
-
}());
|
|
53
|
-
function getErrorMessage(message, data) {
|
|
54
|
-
return new Error("Invalid data\n- " + message + ", got " + JSON.stringify(data));
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function addMetaData(map, section, data) {
|
|
58
|
-
if (!section)
|
|
59
|
-
return;
|
|
60
|
-
map[section] = data;
|
|
61
|
-
}
|
|
62
|
-
function getMetaData(map, section) {
|
|
63
|
-
if (map[section]) {
|
|
64
|
-
return map[section];
|
|
65
|
-
}
|
|
66
|
-
return undefined;
|
|
67
|
-
}
|
|
68
|
-
function deleteMetaData(map, section) {
|
|
69
|
-
if (map[section]) {
|
|
70
|
-
return delete map[section];
|
|
71
|
-
}
|
|
72
|
-
return undefined;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/** @class */ ((function () {
|
|
76
|
-
function Event(values, client) {
|
|
77
|
-
var apiKey = values.apiKey, appVersion = values.appVersion, appType = values.appType, releaseStage = values.releaseStage, timestamp = values.timestamp, category = values.category, type = values.type, sdk = values.sdk, detail = values.detail, device = values.device, user = values.user, actions = values.actions, metaData = values.metaData;
|
|
78
|
-
this.apiKey = apiKey;
|
|
79
|
-
this.appVersion = appVersion;
|
|
80
|
-
this.appType = appType;
|
|
81
|
-
this.releaseStage = releaseStage;
|
|
82
|
-
this.timestamp = timestamp;
|
|
83
|
-
this.category = category;
|
|
84
|
-
this.type = type;
|
|
85
|
-
this.sdk = sdk;
|
|
86
|
-
this.detail = detail;
|
|
87
|
-
this.device = device;
|
|
88
|
-
this.user = user;
|
|
89
|
-
this.actions = actions;
|
|
90
|
-
this.metaData = metaData;
|
|
91
|
-
this._client = client;
|
|
92
|
-
}
|
|
93
|
-
Object.defineProperty(Event.prototype, "_isOhbugEvent", {
|
|
94
|
-
get: function () {
|
|
95
|
-
return true;
|
|
96
|
-
},
|
|
97
|
-
enumerable: false,
|
|
98
|
-
configurable: true
|
|
99
|
-
});
|
|
100
|
-
/**
|
|
101
|
-
* Add an action.
|
|
102
|
-
* Once the threshold is reached, the oldest breadcrumbs will be deleted.
|
|
103
|
-
* 新增一个动作。
|
|
104
|
-
* 一旦达到阈值,最老的 Action 将被删除。
|
|
105
|
-
*
|
|
106
|
-
* @param message
|
|
107
|
-
* @param data
|
|
108
|
-
* @param type
|
|
109
|
-
* @param timestamp
|
|
110
|
-
*/
|
|
111
|
-
Event.prototype.addAction = function (message, data, type, timestamp) {
|
|
112
|
-
var _a, _b;
|
|
113
|
-
var actions = this.actions;
|
|
114
|
-
var targetMessage = isString(message) ? message : '';
|
|
115
|
-
var targetData = data || {};
|
|
116
|
-
var targetType = isString(type) ? type : '';
|
|
117
|
-
var action = new Action(targetMessage, targetData, targetType, timestamp);
|
|
118
|
-
if (actions.length >= ((_b = (_a = this._client) === null || _a === void 0 ? void 0 : _a._config.maxActions) !== null && _b !== void 0 ? _b : 30)) {
|
|
119
|
-
actions.shift();
|
|
120
|
-
}
|
|
121
|
-
actions.push(action);
|
|
122
|
-
};
|
|
123
|
-
/**
|
|
124
|
-
* Get current user information
|
|
125
|
-
* 获取当前的用户信息
|
|
126
|
-
*/
|
|
127
|
-
Event.prototype.getUser = function () {
|
|
128
|
-
return this.user;
|
|
129
|
-
};
|
|
130
|
-
/**
|
|
131
|
-
* Set current user information
|
|
132
|
-
* 设置当前的用户信息
|
|
133
|
-
*/
|
|
134
|
-
Event.prototype.setUser = function (user) {
|
|
135
|
-
var _a;
|
|
136
|
-
if (isObject(user) && Object.keys(user).length <= 6) {
|
|
137
|
-
this.user = __assign(__assign({}, this.user), user);
|
|
138
|
-
return this.getUser();
|
|
139
|
-
}
|
|
140
|
-
(_a = this._client) === null || _a === void 0 ? void 0 : _a._logger.warn(getErrorMessage('setUser should be an object and have up to 6 attributes', user));
|
|
141
|
-
return undefined;
|
|
142
|
-
};
|
|
143
|
-
/**
|
|
144
|
-
* Add metaData
|
|
145
|
-
* 新增 metaData
|
|
146
|
-
*
|
|
147
|
-
* @param section
|
|
148
|
-
* @param data
|
|
149
|
-
*/
|
|
150
|
-
Event.prototype.addMetaData = function (section, data) {
|
|
151
|
-
return addMetaData(this.metaData, section, data);
|
|
152
|
-
};
|
|
153
|
-
/**
|
|
154
|
-
* Get metaData
|
|
155
|
-
* 获取 metaData
|
|
156
|
-
*
|
|
157
|
-
* @param section
|
|
158
|
-
*/
|
|
159
|
-
Event.prototype.getMetaData = function (section) {
|
|
160
|
-
return getMetaData(this.metaData, section);
|
|
161
|
-
};
|
|
162
|
-
/**
|
|
163
|
-
* Delete metaData
|
|
164
|
-
* 删除 metaData
|
|
165
|
-
*
|
|
166
|
-
* @param section
|
|
167
|
-
*/
|
|
168
|
-
Event.prototype.deleteMetaData = function (section) {
|
|
169
|
-
return deleteMetaData(this.metaData, section);
|
|
170
|
-
};
|
|
171
|
-
Event.prototype.toJSON = function () {
|
|
172
|
-
var _a = this, apiKey = _a.apiKey, appVersion = _a.appVersion, appType = _a.appType, timestamp = _a.timestamp, category = _a.category, type = _a.type, sdk = _a.sdk, device = _a.device, detail = _a.detail, user = _a.user, actions = _a.actions, metaData = _a.metaData, releaseStage = _a.releaseStage;
|
|
173
|
-
return {
|
|
174
|
-
apiKey: apiKey,
|
|
175
|
-
appVersion: appVersion,
|
|
176
|
-
appType: appType,
|
|
177
|
-
timestamp: timestamp,
|
|
178
|
-
category: category,
|
|
179
|
-
type: type,
|
|
180
|
-
sdk: sdk,
|
|
181
|
-
device: device,
|
|
182
|
-
detail: detail,
|
|
183
|
-
user: user,
|
|
184
|
-
actions: actions,
|
|
185
|
-
metaData: metaData,
|
|
186
|
-
releaseStage: releaseStage,
|
|
187
|
-
};
|
|
188
|
-
};
|
|
189
|
-
return Event;
|
|
190
|
-
})());
|
|
191
|
-
|
|
192
|
-
const eventsMatrix = [[]];
|
|
193
|
-
const extension = createExtension({
|
|
194
|
-
name: 'OhbugExtensionRrweb',
|
|
195
|
-
init: () => {
|
|
196
|
-
rrweb.record({
|
|
197
|
-
emit(event, isCheckout) {
|
|
198
|
-
if (isCheckout) {
|
|
199
|
-
eventsMatrix.push([]);
|
|
200
|
-
}
|
|
201
|
-
const lastEvents = eventsMatrix[eventsMatrix.length - 1];
|
|
202
|
-
lastEvents.push(event);
|
|
203
|
-
},
|
|
204
|
-
checkoutEveryNms: 3 * 60 * 1000,
|
|
205
|
-
});
|
|
206
|
-
},
|
|
207
|
-
created: (event) => {
|
|
208
|
-
const len = eventsMatrix.length;
|
|
209
|
-
const events = (eventsMatrix[len - 2] || []).concat(eventsMatrix[len - 1]);
|
|
210
|
-
event.addMetaData('rrweb', events);
|
|
211
|
-
return event;
|
|
212
|
-
},
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
return extension;
|
|
216
|
-
|
|
217
|
-
})));
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("rrweb")):"function"==typeof define&&define.amd?define(["rrweb"],e):(t="undefined"!=typeof globalThis?globalThis:t||self).OhbugExtensionRrweb=e(t.rrweb)}(this,(function(t){"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(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var a in e=arguments[i])Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t}).apply(this,arguments)};function i(t){return"string"==typeof t}var n=function(t,e,i,n){this.type=i,this.timestamp=n||(new Date).toISOString(),this.message=t,this.data=e};!function(){function t(t,e){var i=t.apiKey,n=t.appVersion,a=t.appType,r=t.releaseStage,o=t.timestamp,s=t.category,p=t.type,u=t.sdk,c=t.detail,h=t.device,d=t.user,f=t.actions,l=t.metaData;this.apiKey=i,this.appVersion=n,this.appType=a,this.releaseStage=r,this.timestamp=o,this.category=s,this.type=p,this.sdk=u,this.detail=c,this.device=h,this.user=d,this.actions=f,this.metaData=l,this._client=e}Object.defineProperty(t.prototype,"_isOhbugEvent",{get:function(){return!0},enumerable:!1,configurable:!0}),t.prototype.addAction=function(t,e,a,r){var o,s,p=this.actions,u=i(t)?t:"",c=e||{},h=i(a)?a:"",d=new n(u,c,h,r);p.length>=(null!==(s=null===(o=this._client)||void 0===o?void 0:o._config.maxActions)&&void 0!==s?s:30)&&p.shift(),p.push(d)},t.prototype.getUser=function(){return this.user},t.prototype.setUser=function(t){var i,n,a;if(n=t,"[object Object]"===Object.prototype.toString.call(n)&&Object.keys(t).length<=6)return this.user=e(e({},this.user),t),this.getUser();null===(i=this._client)||void 0===i||i._logger.warn((a=t,new Error("Invalid data\n- "+"setUser should be an object and have up to 6 attributes"+", got "+JSON.stringify(a))))},t.prototype.addMetaData=function(t,e){return function(t,e,i){e&&(t[e]=i)}(this.metaData,t,e)},t.prototype.getMetaData=function(t){return function(t,e){if(t[e])return t[e]}(this.metaData,t)},t.prototype.deleteMetaData=function(t){return function(t,e){if(t[e])return delete t[e]}(this.metaData,t)},t.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}}}();const a=[[]];return{name:"OhbugExtensionRrweb",init:()=>{t.record({emit(t,e){e&&a.push([]);a[a.length-1].push(t)},checkoutEveryNms:18e4})},created:t=>{const e=a.length,i=(a[e-2]||[]).concat(a[e-1]);return t.addMetaData("rrweb",i),t}}}));
|
package/dist/src/extension.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../src/extension.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,SAAS,4CAoBb,CAAA;AAEF,eAAe,SAAS,CAAA"}
|
package/dist/src/index.d.ts
DELETED