@ohbug/extension-rrweb 1.7.0 → 1.8.1
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/LICENSE +6 -6
- 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 +20 -55
- package/CHANGELOG.md +0 -34
- package/dist/extension.cjs.js +0 -213
- package/dist/extension.cjs.min.js +0 -15
- package/dist/extension.es.js +0 -211
- package/dist/extension.es.min.js +0 -15
- package/dist/src/extension.d.ts +0 -3
- package/dist/src/index.d.ts +0 -2
- package/dist/ui/index.d.ts +0 -4
- package/dist/ui.es.js +0 -264
- package/dist/ui.es.min.js +0 -44
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
MIT License
|
|
1
|
+
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2022 chenyueban
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
9
9
|
copies of the Software, and to permit persons to whom the Software is
|
|
10
10
|
furnished to do so, subject to the following conditions:
|
|
11
11
|
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
|
13
|
-
copies or substantial portions of the Software.
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
14
|
|
|
15
15
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
16
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
17
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
SOFTWARE.
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
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,81 +1,46 @@
|
|
|
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.1",
|
|
12
4
|
"description": "Ohbug extension to 'screen recording'",
|
|
5
|
+
"license": "MIT",
|
|
13
6
|
"author": "chenyueban <jasonchan0527@gmail.com>",
|
|
14
|
-
"homepage": "https://github.com/ohbug-org/
|
|
7
|
+
"homepage": "https://github.com/ohbug-org/extensions",
|
|
15
8
|
"bugs": {
|
|
16
|
-
"url": "https://github.com/ohbug-org/
|
|
9
|
+
"url": "https://github.com/ohbug-org/extensions/issues"
|
|
17
10
|
},
|
|
18
11
|
"repository": {
|
|
19
12
|
"type": "git",
|
|
20
|
-
"url": "https://github.com/ohbug-org/
|
|
13
|
+
"url": "https://github.com/ohbug-org/extensions"
|
|
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
|
+
"peerDependencies": {
|
|
29
|
+
"rrweb": "^2.0.0"
|
|
30
|
+
},
|
|
37
31
|
"dependencies": {
|
|
38
|
-
"@ohbug/core": "^
|
|
32
|
+
"@ohbug/core": "^2.1.0",
|
|
33
|
+
"@ohbug/types": "^2.1.0"
|
|
39
34
|
},
|
|
40
35
|
"devDependencies": {
|
|
41
|
-
"
|
|
42
|
-
"@chenyueban/tsconfig": "^0.2.0",
|
|
43
|
-
"@commitlint/cli": "^13.1.0",
|
|
44
|
-
"@release-it/conventional-changelog": "^3.3.0",
|
|
45
|
-
"@rollup/plugin-commonjs": "^20.0.0",
|
|
46
|
-
"@rollup/plugin-node-resolve": "^13.0.2",
|
|
47
|
-
"@rollup/plugin-replace": "^3.0.0",
|
|
48
|
-
"@rollup/plugin-typescript": "^8.2.3",
|
|
49
|
-
"commitizen": "^4.2.4",
|
|
50
|
-
"cz-conventional-changelog": "3.3.0",
|
|
51
|
-
"postcss": "^8.3.6",
|
|
52
|
-
"release-it": "^14.11.5",
|
|
53
|
-
"rimraf": "^3.0.2",
|
|
54
|
-
"rollup": "^2.56.3",
|
|
55
|
-
"rollup-plugin-postcss": "^4.0.1",
|
|
56
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
57
|
-
"rrweb": "^1.0.4",
|
|
58
|
-
"typescript": "^4.4.2"
|
|
59
|
-
},
|
|
60
|
-
"peerDependencies": {
|
|
61
|
-
"rrweb": "^1.0.4"
|
|
36
|
+
"rrweb": "^2.0.0-alpha.1"
|
|
62
37
|
},
|
|
63
38
|
"publishConfig": {
|
|
64
39
|
"access": "public"
|
|
65
40
|
},
|
|
66
41
|
"scripts": {
|
|
67
42
|
"prebuild": "rimraf dist",
|
|
68
|
-
"build": "
|
|
69
|
-
"dev": "
|
|
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
|
-
}
|
|
43
|
+
"build": "tsup",
|
|
44
|
+
"dev": "tsup --watch"
|
|
80
45
|
}
|
|
81
|
-
}
|
|
46
|
+
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
# [1.7.0](https://github.com/ohbug-org/ohbug-extension-rrweb/compare/v1.5.0...v1.7.0) (2021-09-08)
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
### Features
|
|
5
|
-
|
|
6
|
-
* 重构 rollup 打包配置 ([d605433](https://github.com/ohbug-org/ohbug-extension-rrweb/commit/d60543392213df77e8f3067f46c1e67863c34c2d))
|
|
7
|
-
|
|
8
|
-
# Changelog
|
|
9
|
-
|
|
10
|
-
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.
|
|
11
|
-
|
|
12
|
-
## [1.5.0](https://github.com/ohbug-org/ohbug-extension-rrweb/compare/v1.4.1...v1.5.0) (2021-07-23)
|
|
13
|
-
|
|
14
|
-
### Features
|
|
15
|
-
|
|
16
|
-
- 启用新的 ui 构建方式 ([c0eea12](https://github.com/ohbug-org/ohbug-extension-rrweb/commit/c0eea12f6cb04422d17f5764feaa0d0458271966))
|
|
17
|
-
|
|
18
|
-
### [1.4.1](https://github.com/ohbug-org/ohbug-extension-rrweb/compare/v1.4.0...v1.4.1) (2021-04-21)
|
|
19
|
-
|
|
20
|
-
### Features
|
|
21
|
-
|
|
22
|
-
- **ui:** 恢复 react 依赖 ([4c22e8c](https://github.com/ohbug-org/ohbug-extension-rrweb/commit/4c22e8cd2469e5efe348f70bb4ec5f0d48701b20))
|
|
23
|
-
|
|
24
|
-
## [1.4.0](https://github.com/ohbug-org/ohbug-extension-rrweb/compare/v1.3.0...v1.4.0) (2021-04-20)
|
|
25
|
-
|
|
26
|
-
### Features
|
|
27
|
-
|
|
28
|
-
- **ui:** 使用新版扩展的创建方式 ([afe9803](https://github.com/ohbug-org/ohbug-extension-rrweb/commit/afe98035203c36f87b878ea70069a38b542543d3))
|
|
29
|
-
|
|
30
|
-
## [1.3.0](https://github.com/ohbug-org/ohbug-extension-rrweb/compare/v1.2.5...v1.3.0) (2021-04-20)
|
|
31
|
-
|
|
32
|
-
### Features
|
|
33
|
-
|
|
34
|
-
- adapt to react17 ([0ebf4d0](https://github.com/ohbug-org/ohbug-extension-rrweb/commit/0ebf4d0d9385fdaef1665e314f67df27d661ced2))
|
package/dist/extension.cjs.js
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var rrweb = require('rrweb');
|
|
4
|
-
|
|
5
|
-
/*! *****************************************************************************
|
|
6
|
-
Copyright (c) Microsoft Corporation.
|
|
7
|
-
|
|
8
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
9
|
-
purpose with or without fee is hereby granted.
|
|
10
|
-
|
|
11
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
12
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
13
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
14
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
15
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
16
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
17
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
18
|
-
***************************************************************************** */
|
|
19
|
-
|
|
20
|
-
var __assign = function() {
|
|
21
|
-
__assign = Object.assign || function __assign(t) {
|
|
22
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
23
|
-
s = arguments[i];
|
|
24
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
25
|
-
}
|
|
26
|
-
return t;
|
|
27
|
-
};
|
|
28
|
-
return __assign.apply(this, arguments);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
function isString(value) {
|
|
32
|
-
return typeof value === 'string';
|
|
33
|
-
}
|
|
34
|
-
function isObject(value) {
|
|
35
|
-
return Object.prototype.toString.call(value) === '[object Object]';
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function createExtension(extension) {
|
|
39
|
-
return extension;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
var Action = /** @class */ (function () {
|
|
43
|
-
function Action(message, data, type, timestamp) {
|
|
44
|
-
this.type = type;
|
|
45
|
-
this.timestamp = timestamp || new Date().toISOString();
|
|
46
|
-
this.message = message;
|
|
47
|
-
this.data = data;
|
|
48
|
-
}
|
|
49
|
-
return Action;
|
|
50
|
-
}());
|
|
51
|
-
function getErrorMessage(message, data) {
|
|
52
|
-
return new Error("Invalid data\n- " + message + ", got " + JSON.stringify(data));
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function addMetaData(map, section, data) {
|
|
56
|
-
if (!section)
|
|
57
|
-
return;
|
|
58
|
-
map[section] = data;
|
|
59
|
-
}
|
|
60
|
-
function getMetaData(map, section) {
|
|
61
|
-
if (map[section]) {
|
|
62
|
-
return map[section];
|
|
63
|
-
}
|
|
64
|
-
return undefined;
|
|
65
|
-
}
|
|
66
|
-
function deleteMetaData(map, section) {
|
|
67
|
-
if (map[section]) {
|
|
68
|
-
return delete map[section];
|
|
69
|
-
}
|
|
70
|
-
return undefined;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/** @class */ ((function () {
|
|
74
|
-
function Event(values, client) {
|
|
75
|
-
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;
|
|
76
|
-
this.apiKey = apiKey;
|
|
77
|
-
this.appVersion = appVersion;
|
|
78
|
-
this.appType = appType;
|
|
79
|
-
this.releaseStage = releaseStage;
|
|
80
|
-
this.timestamp = timestamp;
|
|
81
|
-
this.category = category;
|
|
82
|
-
this.type = type;
|
|
83
|
-
this.sdk = sdk;
|
|
84
|
-
this.detail = detail;
|
|
85
|
-
this.device = device;
|
|
86
|
-
this.user = user;
|
|
87
|
-
this.actions = actions;
|
|
88
|
-
this.metaData = metaData;
|
|
89
|
-
this._client = client;
|
|
90
|
-
}
|
|
91
|
-
Object.defineProperty(Event.prototype, "_isOhbugEvent", {
|
|
92
|
-
get: function () {
|
|
93
|
-
return true;
|
|
94
|
-
},
|
|
95
|
-
enumerable: false,
|
|
96
|
-
configurable: true
|
|
97
|
-
});
|
|
98
|
-
/**
|
|
99
|
-
* Add an action.
|
|
100
|
-
* Once the threshold is reached, the oldest breadcrumbs will be deleted.
|
|
101
|
-
* 新增一个动作。
|
|
102
|
-
* 一旦达到阈值,最老的 Action 将被删除。
|
|
103
|
-
*
|
|
104
|
-
* @param message
|
|
105
|
-
* @param data
|
|
106
|
-
* @param type
|
|
107
|
-
* @param timestamp
|
|
108
|
-
*/
|
|
109
|
-
Event.prototype.addAction = function (message, data, type, timestamp) {
|
|
110
|
-
var _a, _b;
|
|
111
|
-
var actions = this.actions;
|
|
112
|
-
var targetMessage = isString(message) ? message : '';
|
|
113
|
-
var targetData = data || {};
|
|
114
|
-
var targetType = isString(type) ? type : '';
|
|
115
|
-
var action = new Action(targetMessage, targetData, targetType, timestamp);
|
|
116
|
-
if (actions.length >= ((_b = (_a = this._client) === null || _a === void 0 ? void 0 : _a._config.maxActions) !== null && _b !== void 0 ? _b : 30)) {
|
|
117
|
-
actions.shift();
|
|
118
|
-
}
|
|
119
|
-
actions.push(action);
|
|
120
|
-
};
|
|
121
|
-
/**
|
|
122
|
-
* Get current user information
|
|
123
|
-
* 获取当前的用户信息
|
|
124
|
-
*/
|
|
125
|
-
Event.prototype.getUser = function () {
|
|
126
|
-
return this.user;
|
|
127
|
-
};
|
|
128
|
-
/**
|
|
129
|
-
* Set current user information
|
|
130
|
-
* 设置当前的用户信息
|
|
131
|
-
*/
|
|
132
|
-
Event.prototype.setUser = function (user) {
|
|
133
|
-
var _a;
|
|
134
|
-
if (isObject(user) && Object.keys(user).length <= 6) {
|
|
135
|
-
this.user = __assign(__assign({}, this.user), user);
|
|
136
|
-
return this.getUser();
|
|
137
|
-
}
|
|
138
|
-
(_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));
|
|
139
|
-
return undefined;
|
|
140
|
-
};
|
|
141
|
-
/**
|
|
142
|
-
* Add metaData
|
|
143
|
-
* 新增 metaData
|
|
144
|
-
*
|
|
145
|
-
* @param section
|
|
146
|
-
* @param data
|
|
147
|
-
*/
|
|
148
|
-
Event.prototype.addMetaData = function (section, data) {
|
|
149
|
-
return addMetaData(this.metaData, section, data);
|
|
150
|
-
};
|
|
151
|
-
/**
|
|
152
|
-
* Get metaData
|
|
153
|
-
* 获取 metaData
|
|
154
|
-
*
|
|
155
|
-
* @param section
|
|
156
|
-
*/
|
|
157
|
-
Event.prototype.getMetaData = function (section) {
|
|
158
|
-
return getMetaData(this.metaData, section);
|
|
159
|
-
};
|
|
160
|
-
/**
|
|
161
|
-
* Delete metaData
|
|
162
|
-
* 删除 metaData
|
|
163
|
-
*
|
|
164
|
-
* @param section
|
|
165
|
-
*/
|
|
166
|
-
Event.prototype.deleteMetaData = function (section) {
|
|
167
|
-
return deleteMetaData(this.metaData, section);
|
|
168
|
-
};
|
|
169
|
-
Event.prototype.toJSON = function () {
|
|
170
|
-
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;
|
|
171
|
-
return {
|
|
172
|
-
apiKey: apiKey,
|
|
173
|
-
appVersion: appVersion,
|
|
174
|
-
appType: appType,
|
|
175
|
-
timestamp: timestamp,
|
|
176
|
-
category: category,
|
|
177
|
-
type: type,
|
|
178
|
-
sdk: sdk,
|
|
179
|
-
device: device,
|
|
180
|
-
detail: detail,
|
|
181
|
-
user: user,
|
|
182
|
-
actions: actions,
|
|
183
|
-
metaData: metaData,
|
|
184
|
-
releaseStage: releaseStage,
|
|
185
|
-
};
|
|
186
|
-
};
|
|
187
|
-
return Event;
|
|
188
|
-
})());
|
|
189
|
-
|
|
190
|
-
const eventsMatrix = [[]];
|
|
191
|
-
const extension = createExtension({
|
|
192
|
-
name: 'OhbugExtensionRrweb',
|
|
193
|
-
init: () => {
|
|
194
|
-
rrweb.record({
|
|
195
|
-
emit(event, isCheckout) {
|
|
196
|
-
if (isCheckout) {
|
|
197
|
-
eventsMatrix.push([]);
|
|
198
|
-
}
|
|
199
|
-
const lastEvents = eventsMatrix[eventsMatrix.length - 1];
|
|
200
|
-
lastEvents.push(event);
|
|
201
|
-
},
|
|
202
|
-
checkoutEveryNms: 3 * 60 * 1000,
|
|
203
|
-
});
|
|
204
|
-
},
|
|
205
|
-
created: (event) => {
|
|
206
|
-
const len = eventsMatrix.length;
|
|
207
|
-
const events = (eventsMatrix[len - 2] || []).concat(eventsMatrix[len - 1]);
|
|
208
|
-
event.addMetaData('rrweb', events);
|
|
209
|
-
return event;
|
|
210
|
-
},
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
module.exports = extension;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";var t=require("rrweb"),e=function(){return(e=Object.assign||function(t){for(var e,a=1,i=arguments.length;a<i;a++)for(var r in e=arguments[a])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}).apply(this,arguments)};
|
|
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
|
-
***************************************************************************** */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,r=t.appType,n=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=r,this.releaseStage=n,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,r,n){var s,o,p=this.actions,c=a(t)?t:"",u=e||{},h=a(r)?r:"",l=new i(c,u,h,n);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,r;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((r=t,new Error("Invalid data\n- "+"setUser should be an object and have up to 6 attributes"+", got "+JSON.stringify(r))))},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 r=[[]],n={name:"OhbugExtensionRrweb",init:()=>{t.record({emit(t,e){e&&r.push([]);r[r.length-1].push(t)},checkoutEveryNms:18e4})},created:t=>{const e=r.length,a=(r[e-2]||[]).concat(r[e-1]);return t.addMetaData("rrweb",a),t}};module.exports=n;
|
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/src/extension.d.ts
DELETED
package/dist/src/index.d.ts
DELETED