@cloudcare/browser-core 2.0.1 → 2.0.3
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.
|
@@ -31,10 +31,17 @@ function validateAndBuildConfiguration(initConfiguration) {
|
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
if (initConfiguration.sessionSampleRate !== undefined && !(0, _tools.isPercentage)(initConfiguration.sessionSampleRate)) {
|
|
35
|
+
_display.display.error('Sample Rate should be a number between 0 and 100');
|
|
36
|
+
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
var sessionSampleRate = initConfiguration.sessionSampleRate || initConfiguration.sampleRate;
|
|
34
41
|
return (0, _tools.assign)({
|
|
35
42
|
beforeSend: initConfiguration.beforeSend && (0, _catchUserErrors.catchUserErrors)(initConfiguration.beforeSend, 'beforeSend threw an error:'),
|
|
36
43
|
cookieOptions: buildCookieOptions(initConfiguration),
|
|
37
|
-
|
|
44
|
+
sessionSampleRate: (0, _tools.isNullUndefinedDefaultValue)(sessionSampleRate, 100),
|
|
38
45
|
service: initConfiguration.service,
|
|
39
46
|
version: initConfiguration.version,
|
|
40
47
|
env: initConfiguration.env,
|
package/cjs/helper/deviceInfo.js
CHANGED
|
@@ -31,7 +31,7 @@ var MethodLibrary = {
|
|
|
31
31
|
Safari: u.indexOf('Safari') > -1,
|
|
32
32
|
Chrome: u.indexOf('Chrome') > -1 || u.indexOf('CriOS') > -1,
|
|
33
33
|
IE: u.indexOf('MSIE') > -1 || u.indexOf('Trident') > -1,
|
|
34
|
-
Edge: u.indexOf('Edge') > -1,
|
|
34
|
+
Edge: u.indexOf('Edge') > -1 || u.indexOf('Edg') > -1,
|
|
35
35
|
Firefox: u.indexOf('Firefox') > -1 || u.indexOf('FxiOS') > -1,
|
|
36
36
|
'Firefox Focus': u.indexOf('Focus') > -1,
|
|
37
37
|
Chromium: u.indexOf('Chromium') > -1,
|
|
@@ -362,7 +362,7 @@ var MethodLibrary = {
|
|
|
362
362
|
return u.replace(/^.*MSIE ([\d.]+).*$/, '$1').replace(/^.*rv:([\d.]+).*$/, '$1');
|
|
363
363
|
},
|
|
364
364
|
Edge: function Edge() {
|
|
365
|
-
return u.replace(/^.*Edge
|
|
365
|
+
return u.replace(/^.*Edge?\/([\d.]+).*$/, '$1');
|
|
366
366
|
},
|
|
367
367
|
Firefox: function Firefox() {
|
|
368
368
|
return u.replace(/^.*Firefox\/([\d.]+).*$/, '$1').replace(/^.*FxiOS\/([\d.]+).*$/, '$1');
|
|
@@ -14,10 +14,16 @@ export function validateAndBuildConfiguration(initConfiguration) {
|
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
if (initConfiguration.sessionSampleRate !== undefined && !isPercentage(initConfiguration.sessionSampleRate)) {
|
|
18
|
+
display.error('Sample Rate should be a number between 0 and 100');
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
var sessionSampleRate = initConfiguration.sessionSampleRate || initConfiguration.sampleRate;
|
|
17
23
|
return assign({
|
|
18
24
|
beforeSend: initConfiguration.beforeSend && catchUserErrors(initConfiguration.beforeSend, 'beforeSend threw an error:'),
|
|
19
25
|
cookieOptions: buildCookieOptions(initConfiguration),
|
|
20
|
-
|
|
26
|
+
sessionSampleRate: isNullUndefinedDefaultValue(sessionSampleRate, 100),
|
|
21
27
|
service: initConfiguration.service,
|
|
22
28
|
version: initConfiguration.version,
|
|
23
29
|
env: initConfiguration.env,
|
package/esm/helper/deviceInfo.js
CHANGED
|
@@ -23,7 +23,7 @@ var MethodLibrary = {
|
|
|
23
23
|
Safari: u.indexOf('Safari') > -1,
|
|
24
24
|
Chrome: u.indexOf('Chrome') > -1 || u.indexOf('CriOS') > -1,
|
|
25
25
|
IE: u.indexOf('MSIE') > -1 || u.indexOf('Trident') > -1,
|
|
26
|
-
Edge: u.indexOf('Edge') > -1,
|
|
26
|
+
Edge: u.indexOf('Edge') > -1 || u.indexOf('Edg') > -1,
|
|
27
27
|
Firefox: u.indexOf('Firefox') > -1 || u.indexOf('FxiOS') > -1,
|
|
28
28
|
'Firefox Focus': u.indexOf('Focus') > -1,
|
|
29
29
|
Chromium: u.indexOf('Chromium') > -1,
|
|
@@ -354,7 +354,7 @@ var MethodLibrary = {
|
|
|
354
354
|
return u.replace(/^.*MSIE ([\d.]+).*$/, '$1').replace(/^.*rv:([\d.]+).*$/, '$1');
|
|
355
355
|
},
|
|
356
356
|
Edge: function Edge() {
|
|
357
|
-
return u.replace(/^.*Edge
|
|
357
|
+
return u.replace(/^.*Edge?\/([\d.]+).*$/, '$1');
|
|
358
358
|
},
|
|
359
359
|
Firefox: function Firefox() {
|
|
360
360
|
return u.replace(/^.*Firefox\/([\d.]+).*$/, '$1').replace(/^.*FxiOS\/([\d.]+).*$/, '$1');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcare/browser-core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
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": "b82105ba8e15d80ecd65492d071988f4b20ef78a"
|
|
24
24
|
}
|
|
@@ -23,6 +23,15 @@ export function validateAndBuildConfiguration(initConfiguration) {
|
|
|
23
23
|
display.error('Sample Rate should be a number between 0 and 100')
|
|
24
24
|
return
|
|
25
25
|
}
|
|
26
|
+
if (
|
|
27
|
+
initConfiguration.sessionSampleRate !== undefined &&
|
|
28
|
+
!isPercentage(initConfiguration.sessionSampleRate)
|
|
29
|
+
) {
|
|
30
|
+
display.error('Sample Rate should be a number between 0 and 100')
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
var sessionSampleRate =
|
|
34
|
+
initConfiguration.sessionSampleRate || initConfiguration.sampleRate
|
|
26
35
|
return assign(
|
|
27
36
|
{
|
|
28
37
|
beforeSend:
|
|
@@ -32,10 +41,7 @@ export function validateAndBuildConfiguration(initConfiguration) {
|
|
|
32
41
|
'beforeSend threw an error:'
|
|
33
42
|
),
|
|
34
43
|
cookieOptions: buildCookieOptions(initConfiguration),
|
|
35
|
-
|
|
36
|
-
initConfiguration.sampleRate,
|
|
37
|
-
100
|
|
38
|
-
),
|
|
44
|
+
sessionSampleRate: isNullUndefinedDefaultValue(sessionSampleRate, 100),
|
|
39
45
|
service: initConfiguration.service,
|
|
40
46
|
version: initConfiguration.version,
|
|
41
47
|
env: initConfiguration.env,
|
package/src/helper/deviceInfo.js
CHANGED
|
@@ -88,7 +88,7 @@ var MethodLibrary = {
|
|
|
88
88
|
Safari: u.indexOf('Safari') > -1,
|
|
89
89
|
Chrome: u.indexOf('Chrome') > -1 || u.indexOf('CriOS') > -1,
|
|
90
90
|
IE: u.indexOf('MSIE') > -1 || u.indexOf('Trident') > -1,
|
|
91
|
-
Edge: u.indexOf('Edge') > -1,
|
|
91
|
+
Edge: u.indexOf('Edge') > -1 || u.indexOf('Edg') > -1,
|
|
92
92
|
Firefox: u.indexOf('Firefox') > -1 || u.indexOf('FxiOS') > -1,
|
|
93
93
|
'Firefox Focus': u.indexOf('Focus') > -1,
|
|
94
94
|
Chromium: u.indexOf('Chromium') > -1,
|
|
@@ -390,7 +390,7 @@ var MethodLibrary = {
|
|
|
390
390
|
.replace(/^.*rv:([\d.]+).*$/, '$1')
|
|
391
391
|
},
|
|
392
392
|
Edge: function () {
|
|
393
|
-
return u.replace(/^.*Edge
|
|
393
|
+
return u.replace(/^.*Edge?\/([\d.]+).*$/, '$1')
|
|
394
394
|
},
|
|
395
395
|
Firefox: function () {
|
|
396
396
|
return u
|