@cloudcare/browser-core 3.2.48 → 3.3.0
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/asyncClocks.js +2 -2
- package/cjs/browser/asyncClocks.js.map +1 -1
- package/cjs/configuration/remoteConfiguration.js +1 -0
- package/cjs/configuration/remoteConfiguration.js.map +1 -1
- package/cjs/console/consoleObservable.js +17 -11
- package/cjs/console/consoleObservable.js.map +1 -1
- package/cjs/helper/deviceInfo.js +91 -44
- package/cjs/helper/deviceInfo.js.map +1 -1
- package/cjs/helper/errorTools.js +12 -7
- package/cjs/helper/errorTools.js.map +1 -1
- package/cjs/helper/monitor.js +11 -7
- package/cjs/helper/monitor.js.map +1 -1
- package/cjs/helper/polyfills.js +1 -1
- package/cjs/helper/polyfills.js.map +1 -1
- package/cjs/helper/tools.js +4 -4
- package/cjs/helper/tools.js.map +1 -1
- package/cjs/helper/valueHistory.js +1 -1
- package/cjs/helper/valueHistory.js.map +1 -1
- package/cjs/report/reportObservable.js +2 -2
- package/cjs/report/reportObservable.js.map +1 -1
- package/cjs/session/sessionManagement.js +1 -0
- package/cjs/session/sessionManagement.js.map +1 -1
- package/cjs/session/sessionStore.js +1 -1
- package/cjs/session/sessionStore.js.map +1 -1
- package/cjs/synthetics/syntheticsWorkerValues.js +2 -2
- package/cjs/synthetics/syntheticsWorkerValues.js.map +1 -1
- package/esm/browser/asyncClocks.js +2 -2
- package/esm/browser/asyncClocks.js.map +1 -1
- package/esm/configuration/remoteConfiguration.js +1 -0
- package/esm/configuration/remoteConfiguration.js.map +1 -1
- package/esm/console/consoleObservable.js +19 -13
- package/esm/console/consoleObservable.js.map +1 -1
- package/esm/helper/deviceInfo.js +90 -44
- package/esm/helper/deviceInfo.js.map +1 -1
- package/esm/helper/errorTools.js +11 -7
- package/esm/helper/errorTools.js.map +1 -1
- package/esm/helper/monitor.js +10 -7
- package/esm/helper/monitor.js.map +1 -1
- package/esm/helper/polyfills.js +1 -1
- package/esm/helper/polyfills.js.map +1 -1
- package/esm/helper/tools.js +4 -4
- package/esm/helper/tools.js.map +1 -1
- package/esm/helper/valueHistory.js +1 -1
- package/esm/helper/valueHistory.js.map +1 -1
- package/esm/report/reportObservable.js +2 -0
- package/esm/report/reportObservable.js.map +1 -1
- package/esm/session/sessionManagement.js +1 -0
- package/esm/session/sessionManagement.js.map +1 -1
- package/esm/session/sessionStore.js +1 -1
- package/esm/session/sessionStore.js.map +1 -1
- package/esm/synthetics/syntheticsWorkerValues.js +2 -2
- package/esm/synthetics/syntheticsWorkerValues.js.map +1 -1
- package/package.json +2 -2
- package/src/browser/asyncClocks.js +2 -2
- package/src/configuration/remoteConfiguration.js +1 -0
- package/src/console/consoleObservable.js +20 -18
- package/src/helper/deviceInfo.js +105 -53
- package/src/helper/errorTools.js +22 -12
- package/src/helper/monitor.js +10 -8
- package/src/helper/polyfills.js +1 -1
- package/src/helper/tools.js +4 -4
- package/src/helper/valueHistory.js +1 -1
- package/src/report/reportObservable.js +2 -0
- package/src/session/sessionManagement.js +1 -0
- package/src/session/sessionStore.js +4 -1
- package/src/synthetics/syntheticsWorkerValues.js +6 -4
- package/types/index.d.ts +74 -0
package/src/helper/errorTools.js
CHANGED
|
@@ -23,31 +23,34 @@ export function computeRawError(data) {
|
|
|
23
23
|
var nonErrorPrefix = data.nonErrorPrefix
|
|
24
24
|
var source = data.source
|
|
25
25
|
var handling = data.handling
|
|
26
|
-
var
|
|
26
|
+
var useFallbackStack =
|
|
27
|
+
data.useFallbackStack === undefined ? true : data.useFallbackStack
|
|
28
|
+
var isErrorInstance = isError(originalError)
|
|
29
|
+
if (!stackTrace && isErrorInstance) {
|
|
30
|
+
stackTrace = computeStackTrace(originalError)
|
|
31
|
+
}
|
|
27
32
|
var message = computeMessage(
|
|
28
33
|
stackTrace,
|
|
29
34
|
isErrorInstance,
|
|
30
35
|
nonErrorPrefix,
|
|
31
36
|
originalError
|
|
32
37
|
)
|
|
33
|
-
var stack = hasUsableStack(isErrorInstance, stackTrace)
|
|
34
|
-
? toStackTraceString(stackTrace)
|
|
35
|
-
: NO_ERROR_STACK_PRESENT_MESSAGE
|
|
36
|
-
var causes = isErrorInstance
|
|
37
|
-
? flattenErrorCauses(originalError, source)
|
|
38
|
-
: undefined
|
|
39
|
-
var type = stackTrace && stackTrace.name
|
|
40
|
-
|
|
41
38
|
return {
|
|
42
39
|
startClocks: startClocks,
|
|
43
40
|
source: source,
|
|
44
41
|
handling: handling,
|
|
45
42
|
originalError: originalError,
|
|
46
43
|
message: message,
|
|
47
|
-
stack:
|
|
44
|
+
stack: stackTrace
|
|
45
|
+
? toStackTraceString(stackTrace)
|
|
46
|
+
: useFallbackStack
|
|
47
|
+
? NO_ERROR_STACK_PRESENT_MESSAGE
|
|
48
|
+
: undefined,
|
|
48
49
|
handlingStack: handlingStack,
|
|
49
|
-
type:
|
|
50
|
-
causes:
|
|
50
|
+
type: stackTrace ? stackTrace.name : undefined,
|
|
51
|
+
causes: isErrorInstance
|
|
52
|
+
? flattenErrorCauses(originalError, source)
|
|
53
|
+
: undefined
|
|
51
54
|
}
|
|
52
55
|
}
|
|
53
56
|
function computeMessage(
|
|
@@ -177,3 +180,10 @@ export function flattenErrorCauses(error, parentSource) {
|
|
|
177
180
|
}
|
|
178
181
|
return causes.length ? causes : undefined
|
|
179
182
|
}
|
|
183
|
+
|
|
184
|
+
export function isError(error) {
|
|
185
|
+
return (
|
|
186
|
+
error instanceof Error ||
|
|
187
|
+
Object.prototype.toString.call(error) === '[object Error]'
|
|
188
|
+
)
|
|
189
|
+
}
|
package/src/helper/monitor.js
CHANGED
|
@@ -25,17 +25,19 @@ export function callMonitored(fn, context, args) {
|
|
|
25
25
|
try {
|
|
26
26
|
return fn.apply(context, args)
|
|
27
27
|
} catch (e) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
monitorError(e)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export function monitorError(e) {
|
|
32
|
+
displayIfDebugEnabled(e)
|
|
33
|
+
if (onMonitorErrorCollected) {
|
|
34
|
+
try {
|
|
35
|
+
onMonitorErrorCollected(e)
|
|
36
|
+
} catch (e) {
|
|
37
|
+
displayIfDebugEnabled(e)
|
|
35
38
|
}
|
|
36
39
|
}
|
|
37
40
|
}
|
|
38
|
-
|
|
39
41
|
export function displayIfDebugEnabled() {
|
|
40
42
|
var args = [].slice.call(arguments)
|
|
41
43
|
// display.error.apply(null, ['[MONITOR]'].concat(args))
|
package/src/helper/polyfills.js
CHANGED
package/src/helper/tools.js
CHANGED
|
@@ -764,9 +764,9 @@ export var sessionStorage = {
|
|
|
764
764
|
var key = '__sensorsdatasupport__'
|
|
765
765
|
var val = 'testIsSupportStorage'
|
|
766
766
|
try {
|
|
767
|
-
if (sessionStorage && sessionStorage.setItem) {
|
|
768
|
-
sessionStorage.setItem(key, val)
|
|
769
|
-
sessionStorage.removeItem(key, val)
|
|
767
|
+
if (window.sessionStorage && window.sessionStorage.setItem) {
|
|
768
|
+
window.sessionStorage.setItem(key, val)
|
|
769
|
+
window.sessionStorage.removeItem(key, val)
|
|
770
770
|
supported = true
|
|
771
771
|
} else {
|
|
772
772
|
supported = false
|
|
@@ -958,7 +958,7 @@ export var getHostname = function (url, defaultValue) {
|
|
|
958
958
|
}
|
|
959
959
|
var hostname = null
|
|
960
960
|
try {
|
|
961
|
-
hostname = URL(url).hostname
|
|
961
|
+
hostname = new URL(url).hostname
|
|
962
962
|
} catch (e) {}
|
|
963
963
|
return hostname || defaultValue
|
|
964
964
|
}
|
|
@@ -20,7 +20,7 @@ export function createValueHistory(params) {
|
|
|
20
20
|
var maxEntries = params.maxEntries
|
|
21
21
|
|
|
22
22
|
var entries = []
|
|
23
|
-
if (cleanupHistoriesInterval) {
|
|
23
|
+
if (cleanupHistoriesInterval === null) {
|
|
24
24
|
cleanupHistoriesInterval = setInterval(function () {
|
|
25
25
|
return clearExpiredValues()
|
|
26
26
|
}, CLEAR_OLD_VALUES_INTERVAL)
|
|
@@ -11,6 +11,8 @@ import {
|
|
|
11
11
|
import { addEventListener } from '../browser/addEventListener'
|
|
12
12
|
import { DOM_EVENT } from '../helper/enums'
|
|
13
13
|
import { monitor } from '../helper/monitor'
|
|
14
|
+
import { ErrorSource } from '../helper/errorTools'
|
|
15
|
+
import { ErrorHandling } from '../helper/enums'
|
|
14
16
|
export var RawReportType = {
|
|
15
17
|
intervention: 'intervention',
|
|
16
18
|
deprecation: 'deprecation',
|
|
@@ -83,6 +83,7 @@ export function startSessionManager(
|
|
|
83
83
|
findSession: function (startTime, options) {
|
|
84
84
|
return sessionContextHistory.find(startTime, options)
|
|
85
85
|
},
|
|
86
|
+
expandOrRenewSession: sessionStore.expandOrRenewSession,
|
|
86
87
|
renewObservable,
|
|
87
88
|
expireObservable,
|
|
88
89
|
sessionStateUpdateObservable: sessionStore.sessionStateUpdateObservable,
|
|
@@ -160,7 +160,10 @@ export function startSessionStore(
|
|
|
160
160
|
processSessionStoreOperations(
|
|
161
161
|
{
|
|
162
162
|
process: function (sessionState) {
|
|
163
|
-
if (
|
|
163
|
+
if (
|
|
164
|
+
isSessionInNotStartedState(sessionState) ||
|
|
165
|
+
isSessionInExpiredState(sessionState)
|
|
166
|
+
) {
|
|
164
167
|
return getExpiredSessionState()
|
|
165
168
|
}
|
|
166
169
|
},
|
|
@@ -13,14 +13,16 @@ export function willSyntheticsInjectRum() {
|
|
|
13
13
|
|
|
14
14
|
export function getSyntheticsTestId() {
|
|
15
15
|
var value =
|
|
16
|
-
window._GUANCE_SYNTHETICS_PUBLIC_ID
|
|
17
|
-
|
|
16
|
+
typeof window._GUANCE_SYNTHETICS_PUBLIC_ID === 'string'
|
|
17
|
+
? window._GUANCE_SYNTHETICS_PUBLIC_ID
|
|
18
|
+
: getCookie(SYNTHETICS_TEST_ID_COOKIE_NAME)
|
|
18
19
|
return typeof value === 'string' ? value : undefined
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
export function getSyntheticsResultId() {
|
|
22
23
|
var value =
|
|
23
|
-
window._GUANCE_SYNTHETICS_RESULT_ID
|
|
24
|
-
|
|
24
|
+
typeof window._GUANCE_SYNTHETICS_RESULT_ID === 'string'
|
|
25
|
+
? window._GUANCE_SYNTHETICS_RESULT_ID
|
|
26
|
+
: getCookie(SYNTHETICS_RESULT_ID_COOKIE_NAME)
|
|
25
27
|
return typeof value === 'string' ? value : undefined
|
|
26
28
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -199,6 +199,12 @@ export interface RumBaseInitConfiguration extends InitConfiguration {
|
|
|
199
199
|
* sessionReplay and compressIntakeRequests data compression are both done in the web worker thread, so by default, you need to allow worker-src blob: under CSP security access, or use workerUrl to host the worker address yourself
|
|
200
200
|
*/
|
|
201
201
|
workerUrl?: string
|
|
202
|
+
/**
|
|
203
|
+
* Canvas snapshot encoding is done in a dedicated canvas worker thread. By
|
|
204
|
+
* default it uses an inlined blob worker, or you can host a separate
|
|
205
|
+
* canvas-worker bundle yourself for stricter CSP/security environments.
|
|
206
|
+
*/
|
|
207
|
+
replayCanvasWorkerUrl?: string
|
|
202
208
|
/**
|
|
203
209
|
* Compress RUM data request content to reduce bandwidth usage when sending large amounts of data. Compression is done in the Worker thread.
|
|
204
210
|
*/
|
|
@@ -241,6 +247,74 @@ export interface RumBaseInitConfiguration extends InitConfiguration {
|
|
|
241
247
|
* @returns true means mask the node, false means do not mask and continue privacyLevel logic
|
|
242
248
|
*/
|
|
243
249
|
shouldMaskNode?: (node: Node, privacyLevel: NodePrivacyLevel) => boolean
|
|
250
|
+
/**
|
|
251
|
+
* Whether to enable canvas recording for session replay.
|
|
252
|
+
*/
|
|
253
|
+
replayCanvasEnabled?: boolean | undefined
|
|
254
|
+
/**
|
|
255
|
+
* Canvas replay recording mode. Defaults to `auto`.
|
|
256
|
+
* `manual` records only when `snapshotCanvas()` is called.
|
|
257
|
+
* `auto` performs automatic canvas recording.
|
|
258
|
+
*/
|
|
259
|
+
replayCanvasMode?: 'manual' | 'auto' | undefined
|
|
260
|
+
/**
|
|
261
|
+
* Canvas replay sampling strategy. A number means snapshot sampling at the configured rate.
|
|
262
|
+
* `'all'` enables 2D command capture, with automatic snapshot fallback for
|
|
263
|
+
* unsupported replay-fidelity cases. Defaults to a numeric sampling mode.
|
|
264
|
+
*/
|
|
265
|
+
replayCanvasSampling?: 'all' | number | undefined
|
|
266
|
+
/**
|
|
267
|
+
* Encoded image mime type used for canvas snapshots.
|
|
268
|
+
*/
|
|
269
|
+
replayCanvasMimeType?: string | undefined
|
|
270
|
+
/**
|
|
271
|
+
* Encoded image quality for canvas snapshots. Supports `low`, `medium`, `high`,
|
|
272
|
+
* or a number from 0 to 1 for advanced overrides.
|
|
273
|
+
*/
|
|
274
|
+
replayCanvasQuality?: 'low' | 'medium' | 'high' | number | undefined
|
|
275
|
+
/**
|
|
276
|
+
* Maximum canvas edge size before downscaling for encoding.
|
|
277
|
+
*/
|
|
278
|
+
replayCanvasMaxCanvasSize?: number | undefined
|
|
279
|
+
/**
|
|
280
|
+
* Maximum encoded bytes allowed for a single canvas snapshot.
|
|
281
|
+
*/
|
|
282
|
+
replayCanvasMaxEncodedBytes?: number | undefined
|
|
283
|
+
/**
|
|
284
|
+
* Maximum number of concurrent canvas encoding tasks.
|
|
285
|
+
*/
|
|
286
|
+
replayCanvasMaxConcurrentEncodes?: number | undefined
|
|
287
|
+
/**
|
|
288
|
+
* Whether canvas mutations should be flushed into a replay segment immediately.
|
|
289
|
+
*/
|
|
290
|
+
replayCanvasFlushImmediately?: boolean | undefined
|
|
291
|
+
/**
|
|
292
|
+
* Auto snapshot interval in milliseconds when `replayCanvasMode` is `auto`.
|
|
293
|
+
*/
|
|
294
|
+
replayCanvasAutoInterval?: number | undefined
|
|
295
|
+
/**
|
|
296
|
+
* Minimum cooldown in milliseconds after a successful auto snapshot.
|
|
297
|
+
*/
|
|
298
|
+
replayCanvasAutoCooldown?: number | undefined
|
|
299
|
+
/**
|
|
300
|
+
* Backoff in milliseconds after an auto snapshot is skipped as unchanged.
|
|
301
|
+
*/
|
|
302
|
+
replayCanvasAutoUnchangedBackoff?: number | undefined
|
|
303
|
+
/**
|
|
304
|
+
* Backoff in milliseconds after an auto snapshot fails.
|
|
305
|
+
*/
|
|
306
|
+
replayCanvasAutoFailureBackoff?: number | undefined
|
|
307
|
+
/**
|
|
308
|
+
* Maximum number of canvases processed in a single auto snapshot run.
|
|
309
|
+
*/
|
|
310
|
+
replayCanvasAutoMaxPerRun?: number | undefined
|
|
311
|
+
/**
|
|
312
|
+
* Controls whether a canvas should be recorded. Returning `false` skips the canvas.
|
|
313
|
+
* Returning a number assigns auto mode priority, where higher values are processed first.
|
|
314
|
+
*/
|
|
315
|
+
shouldRecordCanvas?:
|
|
316
|
+
| ((canvas: HTMLCanvasElement) => boolean | number | undefined)
|
|
317
|
+
| undefined
|
|
244
318
|
}
|
|
245
319
|
export type RumInitConfiguration = RumBaseInitConfiguration &
|
|
246
320
|
DatakitInitConfiguration
|