@cloudcare/browser-core 2.0.12 → 2.0.14
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/browser/fetchObservable.js +6 -1
- package/cjs/configuration/transportConfiguration.js +0 -1
- package/cjs/dataMap.js +3 -1
- package/cjs/helper/serialisation/rowData.js +1 -1
- package/cjs/helper/tools.js +1 -1
- package/cjs/helper/urlPolyfill.js +3 -5
- package/esm/browser/fetchObservable.js +6 -1
- package/esm/configuration/transportConfiguration.js +0 -1
- package/esm/dataMap.js +3 -1
- package/esm/helper/serialisation/rowData.js +1 -1
- package/esm/helper/tools.js +1 -1
- package/esm/helper/urlPolyfill.js +4 -4
- package/package.json +2 -2
- package/src/browser/fetchObservable.js +7 -2
- package/src/configuration/transportConfiguration.js +0 -1
- package/src/dataMap.js +3 -1
- package/src/helper/serialisation/rowData.js +1 -8
- package/src/helper/tools.js +1 -1
- package/src/helper/urlPolyfill.js +3 -3
|
@@ -76,7 +76,12 @@ function afterSend(observable, responsePromise, startContext) {
|
|
|
76
76
|
context.error = response;
|
|
77
77
|
} else if ('status' in response) {
|
|
78
78
|
context.response = response;
|
|
79
|
-
|
|
79
|
+
|
|
80
|
+
try {
|
|
81
|
+
context.responseType = response.constructor === Response && response.type || ''; // issue The Response type getter can only be used on instances of Response
|
|
82
|
+
} catch (err) {
|
|
83
|
+
context.responseType = '';
|
|
84
|
+
}
|
|
80
85
|
|
|
81
86
|
context.status = response.status;
|
|
82
87
|
context.isAborted = false;
|
|
@@ -60,7 +60,6 @@ function computeTransportConfiguration(initConfiguration) {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
function isIntakeRequest(url, configuration) {
|
|
63
|
-
// return haveSameOrigin(url, configuration.datakitUrl)
|
|
64
63
|
var notTakeRequest = [configuration.datakitUrl];
|
|
65
64
|
|
|
66
65
|
if (configuration.logsEndpoint) {
|
package/cjs/dataMap.js
CHANGED
|
@@ -159,7 +159,9 @@ var dataMap = {
|
|
|
159
159
|
action_error_count: 'action.error.count',
|
|
160
160
|
action_resource_count: 'action.resource.count',
|
|
161
161
|
action_frustration_types: 'action.frustration.type',
|
|
162
|
-
action_long_task_count: 'action.long_task.count'
|
|
162
|
+
action_long_task_count: 'action.long_task.count',
|
|
163
|
+
action_target: '_dd.action.target',
|
|
164
|
+
action_position: '_dd.action.position'
|
|
163
165
|
}
|
|
164
166
|
},
|
|
165
167
|
browser_log: {
|
|
@@ -36,7 +36,7 @@ function escapeJsonValue(value) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
function escapeFieldValueStr(str) {
|
|
39
|
-
return '"' + str.replace(/\\/g, '\\\\').replace(/
|
|
39
|
+
return '"' + str.replace(/\\/g, '\\\\').replace(/"/g, '\\"') + '"';
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
function escapeRowField(value) {
|
package/cjs/helper/tools.js
CHANGED
|
@@ -8,7 +8,6 @@ exports.getHash = getHash;
|
|
|
8
8
|
exports.getOrigin = getOrigin;
|
|
9
9
|
exports.getPathName = getPathName;
|
|
10
10
|
exports.getSearch = getSearch;
|
|
11
|
-
exports.haveSameOrigin = haveSameOrigin;
|
|
12
11
|
exports.isValidUrl = isValidUrl;
|
|
13
12
|
exports.normalizeUrl = normalizeUrl;
|
|
14
13
|
|
|
@@ -24,11 +23,10 @@ function isValidUrl(url) {
|
|
|
24
23
|
} catch (e) {
|
|
25
24
|
return false;
|
|
26
25
|
}
|
|
27
|
-
}
|
|
26
|
+
} // export function haveSameOrigin(url1, url2) {
|
|
27
|
+
// return getOrigin(url1) === getOrigin(url2)
|
|
28
|
+
// }
|
|
28
29
|
|
|
29
|
-
function haveSameOrigin(url1, url2) {
|
|
30
|
-
return getOrigin(url1) === getOrigin(url2);
|
|
31
|
-
}
|
|
32
30
|
|
|
33
31
|
function getOrigin(url) {
|
|
34
32
|
return (0, _tools.getLinkElementOrigin)(buildUrl(url));
|
|
@@ -64,7 +64,12 @@ function afterSend(observable, responsePromise, startContext) {
|
|
|
64
64
|
context.error = response;
|
|
65
65
|
} else if ('status' in response) {
|
|
66
66
|
context.response = response;
|
|
67
|
-
|
|
67
|
+
|
|
68
|
+
try {
|
|
69
|
+
context.responseType = response.constructor === Response && response.type || ''; // issue The Response type getter can only be used on instances of Response
|
|
70
|
+
} catch (err) {
|
|
71
|
+
context.responseType = '';
|
|
72
|
+
}
|
|
68
73
|
|
|
69
74
|
context.status = response.status;
|
|
70
75
|
context.isAborted = false;
|
|
@@ -50,7 +50,6 @@ export function computeTransportConfiguration(initConfiguration) {
|
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
export function isIntakeRequest(url, configuration) {
|
|
53
|
-
// return haveSameOrigin(url, configuration.datakitUrl)
|
|
54
53
|
var notTakeRequest = [configuration.datakitUrl];
|
|
55
54
|
|
|
56
55
|
if (configuration.logsEndpoint) {
|
package/esm/dataMap.js
CHANGED
|
@@ -149,7 +149,9 @@ export var dataMap = {
|
|
|
149
149
|
action_error_count: 'action.error.count',
|
|
150
150
|
action_resource_count: 'action.resource.count',
|
|
151
151
|
action_frustration_types: 'action.frustration.type',
|
|
152
|
-
action_long_task_count: 'action.long_task.count'
|
|
152
|
+
action_long_task_count: 'action.long_task.count',
|
|
153
|
+
action_target: '_dd.action.target',
|
|
154
|
+
action_position: '_dd.action.position'
|
|
153
155
|
}
|
|
154
156
|
},
|
|
155
157
|
browser_log: {
|
|
@@ -20,7 +20,7 @@ export function escapeJsonValue(value) {
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
export function escapeFieldValueStr(str) {
|
|
23
|
-
return '"' + str.replace(/\\/g, '\\\\').replace(/
|
|
23
|
+
return '"' + str.replace(/\\/g, '\\\\').replace(/"/g, '\\"') + '"';
|
|
24
24
|
}
|
|
25
25
|
export function escapeRowField(value) {
|
|
26
26
|
if (typeof value === 'object' && value) {
|
package/esm/helper/tools.js
CHANGED
|
@@ -8,10 +8,10 @@ export function isValidUrl(url) {
|
|
|
8
8
|
} catch (e) {
|
|
9
9
|
return false;
|
|
10
10
|
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
} // export function haveSameOrigin(url1, url2) {
|
|
12
|
+
// return getOrigin(url1) === getOrigin(url2)
|
|
13
|
+
// }
|
|
14
|
+
|
|
15
15
|
export function getOrigin(url) {
|
|
16
16
|
return getLinkElementOrigin(buildUrl(url));
|
|
17
17
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcare/browser-core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.14",
|
|
4
4
|
"main": "cjs/index.js",
|
|
5
5
|
"module": "esm/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -20,5 +20,5 @@
|
|
|
20
20
|
"author": "dataflux",
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"description": "DataFlux RUM Web 端数据指标监控",
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "1aee6e645bb9cfe3f31fe88008e83c74087ce41c"
|
|
24
24
|
}
|
|
@@ -79,8 +79,13 @@ function afterSend(observable, responsePromise, startContext) {
|
|
|
79
79
|
context.error = response
|
|
80
80
|
} else if ('status' in response) {
|
|
81
81
|
context.response = response
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
try {
|
|
83
|
+
context.responseType =
|
|
84
|
+
(response.constructor === Response && response.type) || '' // issue The Response type getter can only be used on instances of Response
|
|
85
|
+
} catch (err) {
|
|
86
|
+
context.responseType = ''
|
|
87
|
+
}
|
|
88
|
+
|
|
84
89
|
context.status = response.status
|
|
85
90
|
context.isAborted = false
|
|
86
91
|
}
|
|
@@ -58,7 +58,6 @@ export function computeTransportConfiguration(initConfiguration) {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
export function isIntakeRequest(url, configuration) {
|
|
61
|
-
// return haveSameOrigin(url, configuration.datakitUrl)
|
|
62
61
|
var notTakeRequest = [configuration.datakitUrl]
|
|
63
62
|
if (configuration.logsEndpoint) {
|
|
64
63
|
notTakeRequest.push(configuration.logsEndpoint)
|
package/src/dataMap.js
CHANGED
|
@@ -148,7 +148,9 @@ export var dataMap = {
|
|
|
148
148
|
action_error_count: 'action.error.count',
|
|
149
149
|
action_resource_count: 'action.resource.count',
|
|
150
150
|
action_frustration_types: 'action.frustration.type',
|
|
151
|
-
action_long_task_count: 'action.long_task.count'
|
|
151
|
+
action_long_task_count: 'action.long_task.count',
|
|
152
|
+
action_target: '_dd.action.target',
|
|
153
|
+
action_position: '_dd.action.position'
|
|
152
154
|
}
|
|
153
155
|
},
|
|
154
156
|
browser_log: {
|
|
@@ -21,14 +21,7 @@ export function escapeJsonValue(value) {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
export function escapeFieldValueStr(str) {
|
|
24
|
-
return (
|
|
25
|
-
'"' +
|
|
26
|
-
str
|
|
27
|
-
.replace(/\\/g, '\\\\')
|
|
28
|
-
.replace(/[\\]*"/g, '"')
|
|
29
|
-
.replace(/"/g, '\\"') +
|
|
30
|
-
'"'
|
|
31
|
-
)
|
|
24
|
+
return '"' + str.replace(/\\/g, '\\\\').replace(/"/g, '\\"') + '"'
|
|
32
25
|
}
|
|
33
26
|
export function escapeRowField(value) {
|
|
34
27
|
if (typeof value === 'object' && value) {
|
package/src/helper/tools.js
CHANGED
|
@@ -1603,7 +1603,7 @@ export function isChromium() {
|
|
|
1603
1603
|
* https://developer.mozilla.org/en-US/docs/Web/API/HTMLHyperlinkElementUtils/origin
|
|
1604
1604
|
*/
|
|
1605
1605
|
export function getLinkElementOrigin(element) {
|
|
1606
|
-
if (element.origin) {
|
|
1606
|
+
if (element.origin && element.origin !== 'null') {
|
|
1607
1607
|
return element.origin
|
|
1608
1608
|
}
|
|
1609
1609
|
var sanitizedHost = element.host.replace(/(:80|:443)$/, '')
|
|
@@ -12,9 +12,9 @@ export function isValidUrl(url) {
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export function haveSameOrigin(url1, url2) {
|
|
16
|
-
|
|
17
|
-
}
|
|
15
|
+
// export function haveSameOrigin(url1, url2) {
|
|
16
|
+
// return getOrigin(url1) === getOrigin(url2)
|
|
17
|
+
// }
|
|
18
18
|
|
|
19
19
|
export function getOrigin(url) {
|
|
20
20
|
return getLinkElementOrigin(buildUrl(url))
|