@yysports/tools 1.1.0 → 2.0.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/dist/Track/core/auth.d.ts +16 -0
- package/dist/Track/core/auth.js +83 -0
- package/dist/Track/core/constants.d.ts +14 -0
- package/dist/Track/core/constants.js +25 -0
- package/dist/Track/core/envelope.d.ts +9 -0
- package/dist/Track/core/envelope.js +54 -0
- package/dist/Track/core/instance.d.ts +108 -0
- package/dist/Track/core/instance.js +365 -0
- package/dist/Track/core/lifecycle.d.ts +18 -0
- package/dist/Track/core/lifecycle.js +59 -0
- package/dist/Track/core/profile.d.ts +5 -0
- package/dist/Track/core/profile.js +30 -0
- package/dist/Track/core/queue.d.ts +13 -0
- package/dist/Track/core/queue.js +36 -0
- package/dist/Track/core/replay.d.ts +17 -0
- package/dist/Track/core/replay.js +117 -0
- package/dist/Track/core/router.d.ts +6 -0
- package/dist/Track/core/router.js +15 -0
- package/dist/Track/core/system.d.ts +14 -0
- package/dist/Track/core/system.js +36 -0
- package/dist/Track/core/transport.d.ts +18 -0
- package/dist/Track/core/transport.js +151 -0
- package/dist/Track/index.d.ts +19 -28
- package/dist/Track/index.js +144 -396
- package/dist/Utils/common.js +5 -6
- package/dist/Utils/route.js +1 -6
- package/dist/Utils/url.js +1 -3
- package/dist/Utils/wx.js +2 -7
- package/dist/interfaces/track.interface.d.ts +14 -4
- package/lib/Track/core/auth.d.ts +16 -0
- package/lib/Track/core/auth.js +67 -0
- package/lib/Track/core/constants.d.ts +14 -0
- package/lib/Track/core/constants.js +56 -0
- package/lib/Track/core/envelope.d.ts +9 -0
- package/lib/Track/core/envelope.js +61 -0
- package/lib/Track/core/instance.d.ts +108 -0
- package/lib/Track/core/instance.js +257 -0
- package/lib/Track/core/lifecycle.d.ts +18 -0
- package/lib/Track/core/lifecycle.js +74 -0
- package/lib/Track/core/profile.d.ts +5 -0
- package/lib/Track/core/profile.js +47 -0
- package/lib/Track/core/queue.d.ts +13 -0
- package/lib/Track/core/queue.js +49 -0
- package/lib/Track/core/replay.d.ts +17 -0
- package/lib/Track/core/replay.js +131 -0
- package/lib/Track/core/router.d.ts +6 -0
- package/lib/Track/core/router.js +39 -0
- package/lib/Track/core/system.d.ts +14 -0
- package/lib/Track/core/system.js +53 -0
- package/lib/Track/core/transport.d.ts +18 -0
- package/lib/Track/core/transport.js +115 -0
- package/lib/Track/index.d.ts +19 -28
- package/lib/Track/index.js +93 -317
- package/lib/Utils/common.js +4 -6
- package/lib/interfaces/track.interface.d.ts +14 -4
- package/package.json +11 -10
package/lib/Track/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __export = (target, all) => {
|
|
8
6
|
for (var name in all)
|
|
@@ -16,14 +14,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
14
|
}
|
|
17
15
|
return to;
|
|
18
16
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
18
|
|
|
29
19
|
// src/Track/index.ts
|
|
@@ -32,314 +22,100 @@ __export(Track_exports, {
|
|
|
32
22
|
default: () => Track_default
|
|
33
23
|
});
|
|
34
24
|
module.exports = __toCommonJS(Track_exports);
|
|
35
|
-
var
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (!
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
this.
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
static
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
// 获取当前用户信息,返回格式化后的用户信息
|
|
100
|
-
static getUserProfile() {
|
|
101
|
-
let userProfile = this.userProfile;
|
|
102
|
-
if (!(userProfile == null ? void 0 : userProfile.userId)) {
|
|
103
|
-
userProfile.userId = "";
|
|
104
|
-
}
|
|
105
|
-
if (!(userProfile == null ? void 0 : userProfile.userName)) {
|
|
106
|
-
userProfile.userName = "";
|
|
107
|
-
}
|
|
108
|
-
return userProfile;
|
|
109
|
-
}
|
|
110
|
-
// 设置当前用户信息
|
|
111
|
-
static setUserProfile(userProfile) {
|
|
112
|
-
this.userProfile = userProfile;
|
|
113
|
-
}
|
|
114
|
-
// 初始化权限中心数据
|
|
115
|
-
static async initAuthCenterData({
|
|
116
|
-
getAuth,
|
|
117
|
-
menuBuild,
|
|
118
|
-
getDataScopeZonePermissions,
|
|
119
|
-
menuNameMap,
|
|
120
|
-
routes
|
|
121
|
-
}) {
|
|
122
|
-
const authCenterApi = [];
|
|
123
|
-
if (getAuth) {
|
|
124
|
-
authCenterApi.push(getAuth);
|
|
125
|
-
}
|
|
126
|
-
if (menuBuild) {
|
|
127
|
-
authCenterApi.push(menuBuild);
|
|
128
|
-
}
|
|
129
|
-
if (getDataScopeZonePermissions) {
|
|
130
|
-
authCenterApi.push(getDataScopeZonePermissions);
|
|
131
|
-
}
|
|
132
|
-
const [authInfo = {}, menuData = [], dataScopeZonePermissions] = await Promise.all(
|
|
133
|
-
authCenterApi.map((v) => {
|
|
134
|
-
if (v) {
|
|
135
|
-
return v();
|
|
136
|
-
} else {
|
|
137
|
-
return Promise.resolve();
|
|
138
|
-
}
|
|
139
|
-
})
|
|
140
|
-
);
|
|
141
|
-
const { user = {}, roles = [] } = authInfo || {};
|
|
142
|
-
const { roles: dataScopeRoles, ...restUser } = user;
|
|
143
|
-
const isAdmin = roles.includes("admin");
|
|
144
|
-
const accessPage = [];
|
|
145
|
-
if (routes) {
|
|
146
|
-
const routesMap = (0, import_Utils.getRoutesMap)(routes, menuNameMap);
|
|
147
|
-
routesMap.forEach((value) => {
|
|
148
|
-
const { access } = value;
|
|
149
|
-
if (access.length === 0) {
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
if (isAdmin) {
|
|
153
|
-
accessPage.push(...access);
|
|
154
|
-
return;
|
|
155
|
-
}
|
|
156
|
-
access.forEach((key) => {
|
|
157
|
-
if (roles.includes(key)) {
|
|
158
|
-
accessPage.push(key);
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
this.routesMap = routesMap;
|
|
163
|
-
}
|
|
164
|
-
this.authMap = (0, import_Utils.getAuthMapByAuthCenter)(menuData);
|
|
165
|
-
const authCenterUserProfile = {
|
|
166
|
-
...restUser,
|
|
167
|
-
dataScopeRoles,
|
|
168
|
-
roles,
|
|
169
|
-
accessPage
|
|
170
|
-
};
|
|
171
|
-
if (dataScopeZonePermissions) {
|
|
172
|
-
Object.assign(authCenterUserProfile, { dataScopeZonePermissions });
|
|
173
|
-
}
|
|
174
|
-
this.authCenterUserProfile = authCenterUserProfile;
|
|
175
|
-
return authCenterUserProfile;
|
|
176
|
-
}
|
|
177
|
-
// 挂载初始配置
|
|
178
|
-
static async init({
|
|
179
|
-
userProfile,
|
|
180
|
-
menuNameMap,
|
|
181
|
-
routes,
|
|
182
|
-
getAuth,
|
|
183
|
-
menuBuild,
|
|
184
|
-
getDataScopeZonePermissions,
|
|
185
|
-
...restConfig
|
|
186
|
-
}) {
|
|
187
|
-
var _a, _b, _c;
|
|
188
|
-
this.checkConfig(restConfig);
|
|
189
|
-
this.config = restConfig;
|
|
190
|
-
await this.initAuthCenterData({
|
|
191
|
-
getAuth,
|
|
192
|
-
menuBuild,
|
|
193
|
-
getDataScopeZonePermissions,
|
|
194
|
-
menuNameMap,
|
|
195
|
-
routes
|
|
196
|
-
});
|
|
197
|
-
const currentUserProfile = {};
|
|
198
|
-
if (this.authCenterUserProfile.userName) {
|
|
199
|
-
Object.assign(currentUserProfile, {
|
|
200
|
-
userId: this.authCenterUserProfile.userName,
|
|
201
|
-
userName: this.authCenterUserProfile.nickName,
|
|
202
|
-
orgCode: this.authCenterUserProfile.orgCode,
|
|
203
|
-
orgTitle: this.authCenterUserProfile.orgTitle,
|
|
204
|
-
dataScopeRoles: (_a = this.authCenterUserProfile.dataScopeRoles) == null ? void 0 : _a.map((role) => role.name).join(",")
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
if (this.authCenterUserProfile.dataScopeZonePermissions && ((_c = (_b = this.authCenterUserProfile.dataScopeZonePermissions) == null ? void 0 : _b.list) == null ? void 0 : _c.length) > 0) {
|
|
208
|
-
Object.assign(currentUserProfile, {
|
|
209
|
-
dataScopeZonePermissions: this.authCenterUserProfile.dataScopeZonePermissions.list.map((item) => item.list.map((zone) => zone.zoneId).join(",")).join(",")
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
if (userProfile) {
|
|
213
|
-
Object.assign(currentUserProfile, userProfile);
|
|
214
|
-
}
|
|
215
|
-
this.setUserProfile(currentUserProfile);
|
|
216
|
-
this.mountAutoTask();
|
|
217
|
-
this.registerAppInfo();
|
|
218
|
-
return this.authCenterUserProfile;
|
|
219
|
-
}
|
|
220
|
-
// 注册更新应用信息
|
|
221
|
-
static registerAppInfo() {
|
|
222
|
-
const { appId } = this.config;
|
|
223
|
-
navigator.sendBeacon(
|
|
224
|
-
`${this.config.domain}/pousheng-guard/api/apps/version/update`,
|
|
225
|
-
import_pako.default.deflate(
|
|
226
|
-
JSON.stringify({
|
|
227
|
-
appId,
|
|
228
|
-
version: import_package.version
|
|
229
|
-
})
|
|
230
|
-
)
|
|
231
|
-
);
|
|
232
|
-
}
|
|
233
|
-
// 推送埋点信息进入队列
|
|
234
|
-
static pushQueue({
|
|
235
|
-
type,
|
|
236
|
-
log
|
|
237
|
-
}) {
|
|
238
|
-
const config = this.config;
|
|
239
|
-
this.checkConfig(config);
|
|
240
|
-
const reqData = {
|
|
241
|
-
...this.getSystemProfile(),
|
|
242
|
-
...this.getUserProfile(),
|
|
243
|
-
type,
|
|
244
|
-
appId: config.appId,
|
|
245
|
-
log: JSON.stringify(log)
|
|
246
|
-
};
|
|
247
|
-
this.trackQueue.push(reqData);
|
|
248
|
-
if (this.trackQueue.length > 4) {
|
|
249
|
-
this.send();
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
// 获取格式化base后的路径
|
|
253
|
-
static getFormatBasePath() {
|
|
254
|
-
const { base = "/" } = this.config;
|
|
255
|
-
const { pathname } = location;
|
|
256
|
-
return pathname.replace(base, "/");
|
|
257
|
-
}
|
|
258
|
-
// 获取模块名称
|
|
259
|
-
static getPageModuleName() {
|
|
260
|
-
const routeInfo = this.routesMap.get(this.getFormatBasePath());
|
|
261
|
-
return (routeInfo == null ? void 0 : routeInfo.module) || [];
|
|
262
|
-
}
|
|
263
|
-
// 推送错误日志
|
|
264
|
-
static errorLog(errorLog) {
|
|
265
|
-
this.pushQueue({
|
|
266
|
-
log: errorLog,
|
|
267
|
-
type: "error"
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
// 推送用户触发日志
|
|
271
|
-
static eventLog(eventLog) {
|
|
272
|
-
const copyEventLog = {
|
|
273
|
-
module: "",
|
|
274
|
-
content: ""
|
|
275
|
-
};
|
|
276
|
-
if (typeof eventLog === "string") {
|
|
277
|
-
const actionLog = this.authMap.get(eventLog);
|
|
278
|
-
if (actionLog) {
|
|
279
|
-
copyEventLog.content = "触发: " + actionLog;
|
|
280
|
-
} else {
|
|
281
|
-
copyEventLog.content = eventLog;
|
|
282
|
-
}
|
|
283
|
-
} else {
|
|
284
|
-
Object.assign(copyEventLog, eventLog);
|
|
285
|
-
}
|
|
286
|
-
if (!copyEventLog.module) {
|
|
287
|
-
const routeNames = this.getPageModuleName();
|
|
288
|
-
copyEventLog.module = (routeNames == null ? void 0 : routeNames.join("-")) || "-";
|
|
289
|
-
}
|
|
290
|
-
this.pushQueue({
|
|
291
|
-
log: copyEventLog,
|
|
292
|
-
type: "event"
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
// 推送页面访问日志
|
|
296
|
-
static visitLog(visitLog) {
|
|
297
|
-
const routeInfo = this.routesMap.get(this.getFormatBasePath());
|
|
298
|
-
if (routeInfo == null ? void 0 : routeInfo.isRedirect) {
|
|
25
|
+
var import_instance = require("./core/instance");
|
|
26
|
+
var TrackFacade = class {
|
|
27
|
+
/** 初始化(必须先调用一次)。重复调用直接返回已存在实例 */
|
|
28
|
+
static async init(config) {
|
|
29
|
+
if (this._instance)
|
|
30
|
+
return Promise.resolve(this._profile);
|
|
31
|
+
if (!this._initPromise) {
|
|
32
|
+
this._initPromise = (async () => {
|
|
33
|
+
const ins = new import_instance.TrackerInstance(config);
|
|
34
|
+
const profile = await ins.init();
|
|
35
|
+
this._instance = ins;
|
|
36
|
+
this._profile = profile;
|
|
37
|
+
return profile;
|
|
38
|
+
})();
|
|
39
|
+
}
|
|
40
|
+
return this._initPromise;
|
|
41
|
+
}
|
|
42
|
+
/** 工具:确保已初始化,否则抛错 */
|
|
43
|
+
static ensure() {
|
|
44
|
+
if (!this._instance)
|
|
45
|
+
throw new Error("Track 未初始化,请先调用 Track.init(config)");
|
|
46
|
+
return this._instance;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* 发送事件日志(通用事件)
|
|
50
|
+
* - 若未初始化:自动排队等待 init 完成后回放
|
|
51
|
+
*/
|
|
52
|
+
static eventLog(...args) {
|
|
53
|
+
this.ensure().eventLog(...args);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* 发送访问/页面曝光日志
|
|
57
|
+
* - 用于记录页面 / 场景进入等行为
|
|
58
|
+
*/
|
|
59
|
+
static visitLog(...args) {
|
|
60
|
+
this.ensure().visitLog(...args);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* 发送错误日志
|
|
64
|
+
* - 适用于运行时异常、资源加载失败、接口异常包装等
|
|
65
|
+
*/
|
|
66
|
+
static async errorLog(...args) {
|
|
67
|
+
return this.ensure().errorLog(...args);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* 发送接口调用相关日志
|
|
71
|
+
* - 记录接口耗时 / 结果状态
|
|
72
|
+
*/
|
|
73
|
+
static apiLog(...args) {
|
|
74
|
+
this.ensure().apiLog(...args);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* 强制立即 flush 已缓冲的日志(若实例策略存在缓冲)
|
|
78
|
+
*/
|
|
79
|
+
static flush() {
|
|
80
|
+
this.ensure().flush();
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* 销毁当前单例实例
|
|
84
|
+
* - 停止上报 / 释放资源
|
|
85
|
+
* - 再次使用需重新 init
|
|
86
|
+
*/
|
|
87
|
+
static destroy() {
|
|
88
|
+
if (!this._instance)
|
|
299
89
|
return;
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
static apiLog(apiLog) {
|
|
316
|
-
const config = this.config;
|
|
317
|
-
navigator.sendBeacon(
|
|
318
|
-
`${this.config.domain}/pousheng-guard/api/track`,
|
|
319
|
-
import_pako.default.deflate(
|
|
320
|
-
JSON.stringify([
|
|
321
|
-
{
|
|
322
|
-
appId: config.appId,
|
|
323
|
-
log: apiLog,
|
|
324
|
-
type: "api",
|
|
325
|
-
...this.getSystemProfile(),
|
|
326
|
-
...this.getUserProfile()
|
|
327
|
-
}
|
|
328
|
-
])
|
|
329
|
-
)
|
|
330
|
-
);
|
|
90
|
+
this._instance.destroy();
|
|
91
|
+
this._instance = null;
|
|
92
|
+
this._initPromise = null;
|
|
93
|
+
this._profile = null;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* 设置用户画像 / 用户基础属性
|
|
97
|
+
* - 若在 init 前调用:会延迟到实例 ready 后再真正执行
|
|
98
|
+
*/
|
|
99
|
+
static setUserProfile(profile) {
|
|
100
|
+
this.ensure().setUserProfile(profile);
|
|
101
|
+
}
|
|
102
|
+
/** 获取当前配置(未初始化时返回 undefined) */
|
|
103
|
+
static getConfig() {
|
|
104
|
+
return this.ensure().getConfig();
|
|
331
105
|
}
|
|
332
106
|
};
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
Track
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
107
|
+
TrackFacade._instance = null;
|
|
108
|
+
TrackFacade._initPromise = null;
|
|
109
|
+
TrackFacade._profile = null;
|
|
110
|
+
var Track = {
|
|
111
|
+
init: TrackFacade.init.bind(TrackFacade),
|
|
112
|
+
eventLog: TrackFacade.eventLog.bind(TrackFacade),
|
|
113
|
+
visitLog: TrackFacade.visitLog.bind(TrackFacade),
|
|
114
|
+
errorLog: TrackFacade.errorLog.bind(TrackFacade),
|
|
115
|
+
apiLog: TrackFacade.apiLog.bind(TrackFacade),
|
|
116
|
+
flush: TrackFacade.flush.bind(TrackFacade),
|
|
117
|
+
destroy: TrackFacade.destroy.bind(TrackFacade),
|
|
118
|
+
setUserProfile: TrackFacade.setUserProfile.bind(TrackFacade),
|
|
119
|
+
getConfig: TrackFacade.getConfig.bind(TrackFacade)
|
|
120
|
+
};
|
|
345
121
|
var Track_default = Track;
|
package/lib/Utils/common.js
CHANGED
|
@@ -49,13 +49,11 @@ function checkChromeVersion(minVersion) {
|
|
|
49
49
|
return false;
|
|
50
50
|
}
|
|
51
51
|
function generateRandomString(length) {
|
|
52
|
-
let result = "";
|
|
53
52
|
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return result;
|
|
53
|
+
return Array.from(
|
|
54
|
+
{ length },
|
|
55
|
+
() => characters.charAt(Math.floor(Math.random() * characters.length))
|
|
56
|
+
).join("");
|
|
59
57
|
}
|
|
60
58
|
// Annotate the CommonJS export names for ESM import in node:
|
|
61
59
|
0 && (module.exports = {
|
|
@@ -21,8 +21,6 @@ export type MenuNameMapType = {
|
|
|
21
21
|
};
|
|
22
22
|
export interface TrackConfig {
|
|
23
23
|
appId: string;
|
|
24
|
-
debug?: boolean;
|
|
25
|
-
autoReportError?: boolean;
|
|
26
24
|
userProfile?: UserProfile;
|
|
27
25
|
base?: string;
|
|
28
26
|
getAuth?: () => Promise<any>;
|
|
@@ -34,6 +32,7 @@ export interface TrackConfig {
|
|
|
34
32
|
zoneName: string;
|
|
35
33
|
}[]>;
|
|
36
34
|
domain: string;
|
|
35
|
+
enableReplay?: boolean;
|
|
37
36
|
}
|
|
38
37
|
export declare enum TrackTypeEnum {
|
|
39
38
|
error = "\u9519\u8BEF\u4FE1\u606F",
|
|
@@ -86,8 +85,7 @@ export interface SystemProfile {
|
|
|
86
85
|
}
|
|
87
86
|
export interface CustomizeProfile {
|
|
88
87
|
content: string;
|
|
89
|
-
module
|
|
90
|
-
[key: string]: any;
|
|
88
|
+
module: string;
|
|
91
89
|
}
|
|
92
90
|
export interface ErrorProfile {
|
|
93
91
|
fileName: string;
|
|
@@ -116,3 +114,15 @@ export type AuthDataType = {
|
|
|
116
114
|
title: string;
|
|
117
115
|
};
|
|
118
116
|
};
|
|
117
|
+
export interface TrackEventEnvelope extends SystemProfile, UserProfile, CustomizeProfile {
|
|
118
|
+
appId: string;
|
|
119
|
+
type: TrackType;
|
|
120
|
+
/**
|
|
121
|
+
* V2.0.0 版本后为非必填字段,如需传入请使用JSON.stringify格式化为字符串
|
|
122
|
+
*/
|
|
123
|
+
log?: string;
|
|
124
|
+
/**
|
|
125
|
+
* V2.0.0 版本后为非必填字段,错误类型时携带回放片段
|
|
126
|
+
*/
|
|
127
|
+
replay?: string;
|
|
128
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yysports/tools",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "常用工具函数库",
|
|
5
5
|
"homepage": "https://git.pousheng.com/sport-service-department/pousheng-guard/yysports_tools#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -60,29 +60,30 @@
|
|
|
60
60
|
]
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"
|
|
64
|
-
"
|
|
63
|
+
"@babel/runtime": "^7.28.3",
|
|
64
|
+
"@rrweb/record": "2.0.0-alpha.18",
|
|
65
|
+
"@rrweb/rrweb-plugin-console-record": "2.0.0-alpha.18",
|
|
66
|
+
"image-conversion": "^2.1.1"
|
|
65
67
|
},
|
|
66
68
|
"devDependencies": {
|
|
67
69
|
"@ant-design/pro-components": "^2.8.10",
|
|
68
70
|
"@commitlint/cli": "^19.8.1",
|
|
69
71
|
"@commitlint/config-conventional": "^19.8.1",
|
|
70
|
-
"@types/pako": "^2.0.3",
|
|
71
72
|
"@types/react": "^18.3.23",
|
|
72
73
|
"@types/react-dom": "^18.3.7",
|
|
73
|
-
"@umijs/lint": "^4.4.
|
|
74
|
-
"antd": "^5.
|
|
74
|
+
"@umijs/lint": "^4.4.12",
|
|
75
|
+
"antd": "^5.27.0",
|
|
75
76
|
"dumi": "^2.4.21",
|
|
76
|
-
"eslint": "^9.
|
|
77
|
-
"father": "^4.6.
|
|
77
|
+
"eslint": "^9.33.0",
|
|
78
|
+
"father": "^4.6.2",
|
|
78
79
|
"husky": "^9.1.7",
|
|
79
|
-
"lint-staged": "^16.1.
|
|
80
|
+
"lint-staged": "^16.1.5",
|
|
80
81
|
"prettier": "^3.6.2",
|
|
81
82
|
"prettier-plugin-organize-imports": "^4.2.0",
|
|
82
83
|
"prettier-plugin-packagejson": "^2.5.19",
|
|
83
84
|
"react": "^18.3.1",
|
|
84
85
|
"react-dom": "^18.3.1",
|
|
85
|
-
"stylelint": "^16.
|
|
86
|
+
"stylelint": "^16.23.1"
|
|
86
87
|
},
|
|
87
88
|
"publishConfig": {
|
|
88
89
|
"access": "public"
|