@cloudcare/rum-uniapp 2.2.3 → 2.2.4
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/cjs/boot/buildEnv.js +1 -1
- package/cjs/core/baseInfo.js +68 -16
- package/cjs/core/dataMap.js +14 -5
- package/cjs/core/xhrProxy.js +17 -13
- package/cjs/rumEventsCollection/action/trackActions.js +6 -2
- package/esm/boot/buildEnv.js +1 -1
- package/esm/core/baseInfo.js +68 -16
- package/esm/core/dataMap.js +14 -5
- package/esm/core/xhrProxy.js +17 -13
- package/esm/rumEventsCollection/action/trackActions.js +6 -2
- package/package.json +1 -1
package/cjs/boot/buildEnv.js
CHANGED
package/cjs/core/baseInfo.js
CHANGED
|
@@ -8,6 +8,7 @@ var _sdk = require("../core/sdk");
|
|
|
8
8
|
var _utils = require("../helper/utils");
|
|
9
9
|
var _enums = require("../helper/enums");
|
|
10
10
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
11
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
12
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
12
13
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
13
14
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -23,28 +24,79 @@ var BaseInfo = /*#__PURE__*/function () {
|
|
|
23
24
|
key: "getDeviceInfo",
|
|
24
25
|
value: function getDeviceInfo() {
|
|
25
26
|
try {
|
|
26
|
-
|
|
27
|
-
var
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
// 设备信息
|
|
28
|
+
var deviceInfo = {};
|
|
29
|
+
if (_sdk.sdk.getDeviceInfo) {
|
|
30
|
+
deviceInfo = _sdk.sdk.getDeviceInfo();
|
|
31
|
+
} else {
|
|
32
|
+
var systemInfo = _sdk.sdk.getSystemInfoSync();
|
|
33
|
+
deviceInfo = _defineProperty({
|
|
34
|
+
deviceBrand: systemInfo.deviceBrand,
|
|
35
|
+
deviceId: systemInfo.deviceId,
|
|
36
|
+
deviceModel: systemInfo.deviceModel,
|
|
37
|
+
deviceType: systemInfo.deviceType,
|
|
38
|
+
deviceOrientation: systemInfo.deviceOrientation,
|
|
39
|
+
devicePixelRatio: systemInfo.devicePixelRatio,
|
|
40
|
+
system: systemInfo.system
|
|
41
|
+
}, "devicePixelRatio", systemInfo.devicePixelRatio);
|
|
42
|
+
}
|
|
43
|
+
var appBaseInfo = {};
|
|
44
|
+
if (_sdk.sdk.getAppBaseInfo) {
|
|
45
|
+
appBaseInfo = _sdk.sdk.getAppBaseInfo();
|
|
31
46
|
} else {
|
|
32
|
-
|
|
47
|
+
var _systemInfo = _sdk.sdk.getSystemInfoSync();
|
|
48
|
+
appBaseInfo = {
|
|
49
|
+
appId: _systemInfo.appId,
|
|
50
|
+
appName: _systemInfo.appName,
|
|
51
|
+
appVersion: _systemInfo.appVersion,
|
|
52
|
+
appVersionCode: _systemInfo.appVersionCode,
|
|
53
|
+
appLanguage: _systemInfo.appLanguage,
|
|
54
|
+
appWgtVersion: _systemInfo.appWgtVersion,
|
|
55
|
+
hostName: _systemInfo.hostName,
|
|
56
|
+
hostVersion: _systemInfo.hostVersion,
|
|
57
|
+
hostLanguage: _systemInfo.hostLanguage
|
|
58
|
+
};
|
|
33
59
|
}
|
|
60
|
+
var windowInfo = {};
|
|
61
|
+
if (_sdk.sdk.getWindowInfo) {
|
|
62
|
+
windowInfo = _sdk.sdk.getWindowInfo();
|
|
63
|
+
} else {
|
|
64
|
+
var _systemInfo2 = _sdk.sdk.getSystemInfoSync();
|
|
65
|
+
windowInfo = {
|
|
66
|
+
screenWidth: _systemInfo2.screenWidth,
|
|
67
|
+
screenHeight: _systemInfo2.screenHeight,
|
|
68
|
+
statusBarHeight: _systemInfo2.statusBarHeight,
|
|
69
|
+
windowWidth: _systemInfo2.windowWidth,
|
|
70
|
+
windowHeight: _systemInfo2.windowHeight,
|
|
71
|
+
windowTop: _systemInfo2.windowTop,
|
|
72
|
+
windowBottom: _systemInfo2.windowBottom,
|
|
73
|
+
screenTop: _systemInfo2.screenTop
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
var osInfo = deviceInfo.system.split(' ');
|
|
77
|
+
var osVersion = osInfo.length > 1 && osInfo[1];
|
|
34
78
|
var osVersionMajor = osVersion && osVersion.split('.').length && osVersion.split('.')[0];
|
|
35
79
|
this.deviceInfo = {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
80
|
+
deviceUuid: deviceInfo.deviceId,
|
|
81
|
+
deviceId: deviceInfo.deviceId,
|
|
82
|
+
brand: deviceInfo.deviceBrand,
|
|
83
|
+
model: deviceInfo.deviceModel,
|
|
84
|
+
type: deviceInfo.deviceType,
|
|
85
|
+
pixelRatio: deviceInfo.devicePixelRatio,
|
|
86
|
+
orientation: deviceInfo.deviceOrientation,
|
|
87
|
+
os: osInfo.length > 0 && osInfo[0],
|
|
39
88
|
osVersion: osVersion,
|
|
40
89
|
osVersionMajor: osVersionMajor,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
90
|
+
appVersion: appBaseInfo.appVersion,
|
|
91
|
+
appId: appBaseInfo.appId,
|
|
92
|
+
appName: appBaseInfo.appName,
|
|
93
|
+
appVersionCode: appBaseInfo.appVersionCode,
|
|
94
|
+
appLanguage: appBaseInfo.appLanguage,
|
|
95
|
+
appWgtVersion: appBaseInfo.appWgtVersion,
|
|
96
|
+
platform: appBaseInfo.hostName,
|
|
97
|
+
platformVersion: appBaseInfo.hostVersion,
|
|
98
|
+
platformLanguage: appBaseInfo.hostLanguage,
|
|
99
|
+
screenSize: "".concat(windowInfo.screenWidth, "*").concat(windowInfo.screenHeight, " ")
|
|
48
100
|
};
|
|
49
101
|
} catch (e) {
|
|
50
102
|
this.deviceInfo = {};
|
package/cjs/core/dataMap.js
CHANGED
|
@@ -19,18 +19,27 @@ var commonTags = exports.commonTags = {
|
|
|
19
19
|
session_id: 'session.id',
|
|
20
20
|
session_type: 'session.type',
|
|
21
21
|
is_signin: 'user.is_signin',
|
|
22
|
+
platform: 'device.platform',
|
|
23
|
+
platform_version: 'device.platform_version',
|
|
24
|
+
platform_language: 'device.platform_language',
|
|
25
|
+
device_uuid: 'device.device_uuid',
|
|
26
|
+
device_id: 'device.device_id',
|
|
22
27
|
device: 'device.brand',
|
|
28
|
+
brand: 'device.brand',
|
|
23
29
|
model: 'device.model',
|
|
24
|
-
|
|
30
|
+
device_type: 'device.type',
|
|
31
|
+
pixel_ratio: 'device.pixel_ratio',
|
|
32
|
+
orientation: 'device.orientation',
|
|
25
33
|
os: 'device.os',
|
|
26
|
-
app: 'device.app',
|
|
27
34
|
os_version: 'device.os_version',
|
|
28
35
|
os_version_major: 'device.os_version_major',
|
|
36
|
+
device_app_version: 'device.app_version',
|
|
37
|
+
device_app_id: 'device.app_id',
|
|
38
|
+
device_app_version_code: 'device.app_version_code',
|
|
39
|
+
device_app_language: 'device.app_language',
|
|
40
|
+
device_app_wgt_version: 'device.app_wgt_version',
|
|
29
41
|
screen_size: 'device.screen_size',
|
|
30
42
|
network_type: 'device.network_type',
|
|
31
|
-
platform: 'device.platform',
|
|
32
|
-
platform_version: 'device.platform_version',
|
|
33
|
-
app_framework_version: 'device.framework_version',
|
|
34
43
|
view_id: 'page.id',
|
|
35
44
|
view_name: 'page.route',
|
|
36
45
|
view_referer: 'page.referer'
|
package/cjs/core/xhrProxy.js
CHANGED
|
@@ -49,19 +49,23 @@ function proxyXhr(userConfiguration) {
|
|
|
49
49
|
};
|
|
50
50
|
dataflux_xhr.startTime = (0, _utils.now)();
|
|
51
51
|
var originalSuccess = arguments[0].success;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
if (originalSuccess) {
|
|
53
|
+
arguments[0].success = function () {
|
|
54
|
+
reportXhr(arguments[0]);
|
|
55
|
+
if (typeof originalSuccess === 'function') {
|
|
56
|
+
originalSuccess.apply(_this, arguments);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
58
60
|
var originalFail = arguments[0].fail;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
if (originalFail) {
|
|
62
|
+
arguments[0].fail = function () {
|
|
63
|
+
reportXhr(arguments[0]);
|
|
64
|
+
if (typeof originalFail === 'function') {
|
|
65
|
+
originalFail.apply(_this, arguments);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
65
69
|
var hasBeenReported = false;
|
|
66
70
|
var reportXhr = function reportXhr(res) {
|
|
67
71
|
if (hasBeenReported) {
|
|
@@ -69,7 +73,7 @@ function proxyXhr(userConfiguration) {
|
|
|
69
73
|
}
|
|
70
74
|
hasBeenReported = true;
|
|
71
75
|
dataflux_xhr.duration = (0, _utils.now)() - dataflux_xhr.startTime;
|
|
72
|
-
dataflux_xhr.response = JSON.stringify(res.data);
|
|
76
|
+
dataflux_xhr.response = res.data && JSON.stringify(res.data) || {};
|
|
73
77
|
dataflux_xhr.header = res.header || {};
|
|
74
78
|
dataflux_xhr.profile = res.profile;
|
|
75
79
|
dataflux_xhr.status = res.statusCode || res.status || 0;
|
|
@@ -28,7 +28,9 @@ function trackActions(lifeCycle, Vue) {
|
|
|
28
28
|
Page = function Page(page) {
|
|
29
29
|
try {
|
|
30
30
|
hookClick(page);
|
|
31
|
-
} catch (error) {
|
|
31
|
+
} catch (error) {
|
|
32
|
+
console.error('error===', error);
|
|
33
|
+
}
|
|
32
34
|
return originPage(page);
|
|
33
35
|
};
|
|
34
36
|
var originComponent = Component;
|
|
@@ -38,7 +40,9 @@ function trackActions(lifeCycle, Vue) {
|
|
|
38
40
|
component.methods.onLoad = function () {
|
|
39
41
|
try {
|
|
40
42
|
hookClick(this);
|
|
41
|
-
} catch (error) {
|
|
43
|
+
} catch (error) {
|
|
44
|
+
console.error('error===', error);
|
|
45
|
+
}
|
|
42
46
|
return originOnLoad.apply(this, arguments);
|
|
43
47
|
};
|
|
44
48
|
}
|
package/esm/boot/buildEnv.js
CHANGED
package/esm/core/baseInfo.js
CHANGED
|
@@ -8,28 +8,80 @@ class BaseInfo {
|
|
|
8
8
|
}
|
|
9
9
|
getDeviceInfo() {
|
|
10
10
|
try {
|
|
11
|
-
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
// 设备信息
|
|
12
|
+
var deviceInfo = {};
|
|
13
|
+
if (sdk.getDeviceInfo) {
|
|
14
|
+
deviceInfo = sdk.getDeviceInfo();
|
|
15
|
+
} else {
|
|
16
|
+
var systemInfo = sdk.getSystemInfoSync();
|
|
17
|
+
deviceInfo = {
|
|
18
|
+
deviceBrand: systemInfo.deviceBrand,
|
|
19
|
+
deviceId: systemInfo.deviceId,
|
|
20
|
+
deviceModel: systemInfo.deviceModel,
|
|
21
|
+
deviceType: systemInfo.deviceType,
|
|
22
|
+
deviceOrientation: systemInfo.deviceOrientation,
|
|
23
|
+
devicePixelRatio: systemInfo.devicePixelRatio,
|
|
24
|
+
system: systemInfo.system,
|
|
25
|
+
devicePixelRatio: systemInfo.devicePixelRatio
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
var appBaseInfo = {};
|
|
29
|
+
if (sdk.getAppBaseInfo) {
|
|
30
|
+
appBaseInfo = sdk.getAppBaseInfo();
|
|
16
31
|
} else {
|
|
17
|
-
|
|
32
|
+
var _systemInfo = sdk.getSystemInfoSync();
|
|
33
|
+
appBaseInfo = {
|
|
34
|
+
appId: _systemInfo.appId,
|
|
35
|
+
appName: _systemInfo.appName,
|
|
36
|
+
appVersion: _systemInfo.appVersion,
|
|
37
|
+
appVersionCode: _systemInfo.appVersionCode,
|
|
38
|
+
appLanguage: _systemInfo.appLanguage,
|
|
39
|
+
appWgtVersion: _systemInfo.appWgtVersion,
|
|
40
|
+
hostName: _systemInfo.hostName,
|
|
41
|
+
hostVersion: _systemInfo.hostVersion,
|
|
42
|
+
hostLanguage: _systemInfo.hostLanguage
|
|
43
|
+
};
|
|
18
44
|
}
|
|
45
|
+
var windowInfo = {};
|
|
46
|
+
if (sdk.getWindowInfo) {
|
|
47
|
+
windowInfo = sdk.getWindowInfo();
|
|
48
|
+
} else {
|
|
49
|
+
var _systemInfo2 = sdk.getSystemInfoSync();
|
|
50
|
+
windowInfo = {
|
|
51
|
+
screenWidth: _systemInfo2.screenWidth,
|
|
52
|
+
screenHeight: _systemInfo2.screenHeight,
|
|
53
|
+
statusBarHeight: _systemInfo2.statusBarHeight,
|
|
54
|
+
windowWidth: _systemInfo2.windowWidth,
|
|
55
|
+
windowHeight: _systemInfo2.windowHeight,
|
|
56
|
+
windowTop: _systemInfo2.windowTop,
|
|
57
|
+
windowBottom: _systemInfo2.windowBottom,
|
|
58
|
+
screenTop: _systemInfo2.screenTop
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
var osInfo = deviceInfo.system.split(' ');
|
|
62
|
+
var osVersion = osInfo.length > 1 && osInfo[1];
|
|
19
63
|
var osVersionMajor = osVersion && osVersion.split('.').length && osVersion.split('.')[0];
|
|
20
64
|
this.deviceInfo = {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
65
|
+
deviceUuid: deviceInfo.deviceId,
|
|
66
|
+
deviceId: deviceInfo.deviceId,
|
|
67
|
+
brand: deviceInfo.deviceBrand,
|
|
68
|
+
model: deviceInfo.deviceModel,
|
|
69
|
+
type: deviceInfo.deviceType,
|
|
70
|
+
pixelRatio: deviceInfo.devicePixelRatio,
|
|
71
|
+
orientation: deviceInfo.deviceOrientation,
|
|
72
|
+
os: osInfo.length > 0 && osInfo[0],
|
|
24
73
|
osVersion: osVersion,
|
|
25
74
|
osVersionMajor: osVersionMajor,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
75
|
+
appVersion: appBaseInfo.appVersion,
|
|
76
|
+
appId: appBaseInfo.appId,
|
|
77
|
+
appName: appBaseInfo.appName,
|
|
78
|
+
appVersionCode: appBaseInfo.appVersionCode,
|
|
79
|
+
appLanguage: appBaseInfo.appLanguage,
|
|
80
|
+
appWgtVersion: appBaseInfo.appWgtVersion,
|
|
81
|
+
platform: appBaseInfo.hostName,
|
|
82
|
+
platformVersion: appBaseInfo.hostVersion,
|
|
83
|
+
platformLanguage: appBaseInfo.hostLanguage,
|
|
84
|
+
screenSize: "".concat(windowInfo.screenWidth, "*").concat(windowInfo.screenHeight, " ")
|
|
33
85
|
};
|
|
34
86
|
} catch (e) {
|
|
35
87
|
this.deviceInfo = {};
|
package/esm/core/dataMap.js
CHANGED
|
@@ -13,18 +13,27 @@ export var commonTags = {
|
|
|
13
13
|
session_id: 'session.id',
|
|
14
14
|
session_type: 'session.type',
|
|
15
15
|
is_signin: 'user.is_signin',
|
|
16
|
+
platform: 'device.platform',
|
|
17
|
+
platform_version: 'device.platform_version',
|
|
18
|
+
platform_language: 'device.platform_language',
|
|
19
|
+
device_uuid: 'device.device_uuid',
|
|
20
|
+
device_id: 'device.device_id',
|
|
16
21
|
device: 'device.brand',
|
|
22
|
+
brand: 'device.brand',
|
|
17
23
|
model: 'device.model',
|
|
18
|
-
|
|
24
|
+
device_type: 'device.type',
|
|
25
|
+
pixel_ratio: 'device.pixel_ratio',
|
|
26
|
+
orientation: 'device.orientation',
|
|
19
27
|
os: 'device.os',
|
|
20
|
-
app: 'device.app',
|
|
21
28
|
os_version: 'device.os_version',
|
|
22
29
|
os_version_major: 'device.os_version_major',
|
|
30
|
+
device_app_version: 'device.app_version',
|
|
31
|
+
device_app_id: 'device.app_id',
|
|
32
|
+
device_app_version_code: 'device.app_version_code',
|
|
33
|
+
device_app_language: 'device.app_language',
|
|
34
|
+
device_app_wgt_version: 'device.app_wgt_version',
|
|
23
35
|
screen_size: 'device.screen_size',
|
|
24
36
|
network_type: 'device.network_type',
|
|
25
|
-
platform: 'device.platform',
|
|
26
|
-
platform_version: 'device.platform_version',
|
|
27
|
-
app_framework_version: 'device.framework_version',
|
|
28
37
|
view_id: 'page.id',
|
|
29
38
|
view_name: 'page.route',
|
|
30
39
|
view_referer: 'page.referer'
|
package/esm/core/xhrProxy.js
CHANGED
|
@@ -41,19 +41,23 @@ function proxyXhr(userConfiguration) {
|
|
|
41
41
|
};
|
|
42
42
|
dataflux_xhr.startTime = now();
|
|
43
43
|
var originalSuccess = arguments[0].success;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
if (originalSuccess) {
|
|
45
|
+
arguments[0].success = function () {
|
|
46
|
+
reportXhr(arguments[0]);
|
|
47
|
+
if (typeof originalSuccess === 'function') {
|
|
48
|
+
originalSuccess.apply(_this, arguments);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
50
52
|
var originalFail = arguments[0].fail;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
if (originalFail) {
|
|
54
|
+
arguments[0].fail = function () {
|
|
55
|
+
reportXhr(arguments[0]);
|
|
56
|
+
if (typeof originalFail === 'function') {
|
|
57
|
+
originalFail.apply(_this, arguments);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
57
61
|
var hasBeenReported = false;
|
|
58
62
|
var reportXhr = function reportXhr(res) {
|
|
59
63
|
if (hasBeenReported) {
|
|
@@ -61,7 +65,7 @@ function proxyXhr(userConfiguration) {
|
|
|
61
65
|
}
|
|
62
66
|
hasBeenReported = true;
|
|
63
67
|
dataflux_xhr.duration = now() - dataflux_xhr.startTime;
|
|
64
|
-
dataflux_xhr.response = JSON.stringify(res.data);
|
|
68
|
+
dataflux_xhr.response = res.data && JSON.stringify(res.data) || {};
|
|
65
69
|
dataflux_xhr.header = res.header || {};
|
|
66
70
|
dataflux_xhr.profile = res.profile;
|
|
67
71
|
dataflux_xhr.status = res.statusCode || res.status || 0;
|
|
@@ -22,7 +22,9 @@ export function trackActions(lifeCycle, Vue) {
|
|
|
22
22
|
Page = function Page(page) {
|
|
23
23
|
try {
|
|
24
24
|
hookClick(page);
|
|
25
|
-
} catch (error) {
|
|
25
|
+
} catch (error) {
|
|
26
|
+
console.error('error===', error);
|
|
27
|
+
}
|
|
26
28
|
return originPage(page);
|
|
27
29
|
};
|
|
28
30
|
var originComponent = Component;
|
|
@@ -32,7 +34,9 @@ export function trackActions(lifeCycle, Vue) {
|
|
|
32
34
|
component.methods.onLoad = function () {
|
|
33
35
|
try {
|
|
34
36
|
hookClick(this);
|
|
35
|
-
} catch (error) {
|
|
37
|
+
} catch (error) {
|
|
38
|
+
console.error('error===', error);
|
|
39
|
+
}
|
|
36
40
|
return originOnLoad.apply(this, arguments);
|
|
37
41
|
};
|
|
38
42
|
}
|