@cloudcare/browser-rum 3.3.23 → 3.3.24
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/bundle/dataflux-rum.js +1 -1
- package/cjs/boot/buildEnv.js +1 -1
- package/cjs/domain/deflate/deflateWorker.js +1 -1
- package/cjs/domain/replay/record/canvasEncodeWorker.js +1 -1
- package/esm/boot/buildEnv.js +2 -5
- package/esm/boot/buildEnv.js.map +1 -1
- package/esm/boot/disabledRumPublicApi.js +2 -35
- package/esm/boot/disabledRumPublicApi.js.map +1 -1
- package/esm/boot/perStartRum.js +2 -260
- package/esm/boot/perStartRum.js.map +1 -1
- package/esm/boot/recorderApi.js +2 -338
- package/esm/boot/recorderApi.js.map +1 -1
- package/esm/boot/recorderApiStub.js +2 -21
- package/esm/boot/recorderApiStub.js.map +1 -1
- package/esm/boot/rum.entry.js +2 -13
- package/esm/boot/rum.entry.js.map +1 -1
- package/esm/boot/rum.js +2 -184
- package/esm/boot/rum.js.map +1 -1
- package/esm/boot/rum.slim.entry.js +2 -7
- package/esm/boot/rum.slim.entry.js.map +1 -1
- package/esm/boot/rumEntryFactory.js +2 -18
- package/esm/boot/rumEntryFactory.js.map +1 -1
- package/esm/boot/rumPublicApi.js +2 -344
- package/esm/boot/rumPublicApi.js.map +1 -1
- package/esm/boot/rumRecorderApiStub.js +2 -13
- package/esm/boot/rumRecorderApiStub.js.map +1 -1
- package/esm/boot/rumSlimConfiguration.js +2 -10
- package/esm/boot/rumSlimConfiguration.js.map +1 -1
- package/esm/boot/sessionReplayPublicApi.js +2 -43
- package/esm/boot/sessionReplayPublicApi.js.map +1 -1
- package/esm/boot/startRecording.js +2 -444
- package/esm/boot/startRecording.js.map +1 -1
- package/esm/constants.js +2 -28
- package/esm/constants.js.map +1 -1
- package/esm/domain/assembly.js +2 -213
- package/esm/domain/assembly.js.map +1 -1
- package/esm/domain/configuration.js +2 -323
- package/esm/domain/configuration.js.map +1 -1
- package/esm/domain/contexts/commonContext.js +2 -8
- package/esm/domain/contexts/commonContext.js.map +1 -1
- package/esm/domain/contexts/displayContext.js +2 -16
- package/esm/domain/contexts/displayContext.js.map +1 -1
- package/esm/domain/contexts/foregroundContexts.js +2 -103
- package/esm/domain/contexts/foregroundContexts.js.map +1 -1
- package/esm/domain/contexts/internalContext.js +2 -41
- package/esm/domain/contexts/internalContext.js.map +1 -1
- package/esm/domain/contexts/pageStateHistory.js +2 -104
- package/esm/domain/contexts/pageStateHistory.js.map +1 -1
- package/esm/domain/contexts/urlContexts.js +2 -85
- package/esm/domain/contexts/urlContexts.js.map +1 -1
- package/esm/domain/contexts/viewContexts.js +2 -45
- package/esm/domain/contexts/viewContexts.js.map +1 -1
- package/esm/domain/deflate/deflateEncoder.js +2 -592
- package/esm/domain/deflate/deflateEncoder.js.map +1 -1
- package/esm/domain/deflate/deflateWorker.js +2 -225
- package/esm/domain/deflate/deflateWorker.js.map +1 -1
- package/esm/domain/deflate/index.js +2 -3
- package/esm/domain/deflate/index.js.map +1 -1
- package/esm/domain/domMutationObservable.js +2 -62
- package/esm/domain/domMutationObservable.js.map +1 -1
- package/esm/domain/encoderStreamId.js +2 -6
- package/esm/domain/encoderStreamId.js.map +1 -1
- package/esm/domain/firstInputPolyfill.js +2 -77
- package/esm/domain/firstInputPolyfill.js.map +1 -1
- package/esm/domain/initViewportObservable.js +2 -36
- package/esm/domain/initViewportObservable.js.map +1 -1
- package/esm/domain/locationChangeObservable.js +2 -65
- package/esm/domain/locationChangeObservable.js.map +1 -1
- package/esm/domain/performanceObservable.js +2 -116
- package/esm/domain/performanceObservable.js.map +1 -1
- package/esm/domain/performanceUtils.js +2 -45
- package/esm/domain/performanceUtils.js.map +1 -1
- package/esm/domain/plugins.js +2 -59
- package/esm/domain/plugins.js.map +1 -1
- package/esm/domain/privacy.js +2 -266
- package/esm/domain/privacy.js.map +1 -1
- package/esm/domain/replay/record/canvasAutoSnapshot.js +2 -9
- package/esm/domain/replay/record/canvasAutoSnapshot.js.map +1 -1
- package/esm/domain/replay/record/canvasCommandCapture.js +2 -1275
- package/esm/domain/replay/record/canvasCommandCapture.js.map +1 -1
- package/esm/domain/replay/record/canvasCommandObserver.js +2 -1207
- package/esm/domain/replay/record/canvasCommandObserver.js.map +1 -1
- package/esm/domain/replay/record/canvasCommandSerializeArgs.js +2 -111
- package/esm/domain/replay/record/canvasCommandSerializeArgs.js.map +1 -1
- package/esm/domain/replay/record/canvasContext.js +2 -50
- package/esm/domain/replay/record/canvasContext.js.map +1 -1
- package/esm/domain/replay/record/canvasContinuousScheduler.js +2 -378
- package/esm/domain/replay/record/canvasContinuousScheduler.js.map +1 -1
- package/esm/domain/replay/record/canvasEncodeBridge.js +2 -692
- package/esm/domain/replay/record/canvasEncodeBridge.js.map +1 -1
- package/esm/domain/replay/record/canvasEncodeWorker.js +2 -164
- package/esm/domain/replay/record/canvasEncodeWorker.js.map +1 -1
- package/esm/domain/replay/record/canvasFrameSignature.js +2 -75
- package/esm/domain/replay/record/canvasFrameSignature.js.map +1 -1
- package/esm/domain/replay/record/canvasMutationRecord.js +2 -26
- package/esm/domain/replay/record/canvasMutationRecord.js.map +1 -1
- package/esm/domain/replay/record/canvasObserver.js +2 -420
- package/esm/domain/replay/record/canvasObserver.js.map +1 -1
- package/esm/domain/replay/record/canvasSerializeArgs.js +2 -101
- package/esm/domain/replay/record/canvasSerializeArgs.js.map +1 -1
- package/esm/domain/replay/record/canvasWebGLPluginHost.js +2 -26
- package/esm/domain/replay/record/canvasWebGLPluginHost.js.map +1 -1
- package/esm/domain/replay/record/elementsScrollPositions.js +2 -23
- package/esm/domain/replay/record/elementsScrollPositions.js.map +1 -1
- package/esm/domain/replay/record/index.js +2 -4
- package/esm/domain/replay/record/index.js.map +1 -1
- package/esm/domain/replay/record/mutationBatch.js +2 -562
- package/esm/domain/replay/record/mutationBatch.js.map +1 -1
- package/esm/domain/replay/record/mutationObserver.js +2 -2332
- package/esm/domain/replay/record/mutationObserver.js.map +1 -1
- package/esm/domain/replay/record/mutationResourceBudget.js +2 -137
- package/esm/domain/replay/record/mutationResourceBudget.js.map +1 -1
- package/esm/domain/replay/record/observers.js +2 -624
- package/esm/domain/replay/record/observers.js.map +1 -1
- package/esm/domain/replay/record/privacy.js +2 -1
- package/esm/domain/replay/record/privacy.js.map +1 -1
- package/esm/domain/replay/record/record.js +2 -3511
- package/esm/domain/replay/record/record.js.map +1 -1
- package/esm/domain/replay/record/serializationUtils.js +2 -677
- package/esm/domain/replay/record/serializationUtils.js.map +1 -1
- package/esm/domain/replay/record/serialize.js +2 -735
- package/esm/domain/replay/record/serialize.js.map +1 -1
- package/esm/domain/replay/record/shadowRootsController.js +2 -902
- package/esm/domain/replay/record/shadowRootsController.js.map +1 -1
- package/esm/domain/replay/record/utils.js +2 -36
- package/esm/domain/replay/record/utils.js.map +1 -1
- package/esm/domain/replay/record/viewports.js +2 -58
- package/esm/domain/replay/record/viewports.js.map +1 -1
- package/esm/domain/replay/replayStats.js +2 -59
- package/esm/domain/replay/replayStats.js.map +1 -1
- package/esm/domain/replay/segmentCollection/buildReplayPayload.js +2 -31
- package/esm/domain/replay/segmentCollection/buildReplayPayload.js.map +1 -1
- package/esm/domain/replay/segmentCollection/index.js +2 -3
- package/esm/domain/replay/segmentCollection/index.js.map +1 -1
- package/esm/domain/replay/segmentCollection/segment.js +2 -415
- package/esm/domain/replay/segmentCollection/segment.js.map +1 -1
- package/esm/domain/replay/segmentCollection/segmentCollection.js +2 -1114
- package/esm/domain/replay/segmentCollection/segmentCollection.js.map +1 -1
- package/esm/domain/replay/startRecordBridge.js +2 -13
- package/esm/domain/replay/startRecordBridge.js.map +1 -1
- package/esm/domain/replay/timeAnchor.js +2 -20
- package/esm/domain/replay/timeAnchor.js.map +1 -1
- package/esm/domain/requestCollection.js +2 -121
- package/esm/domain/requestCollection.js.map +1 -1
- package/esm/domain/rumEventsCollection/actions/actionCollection.js +2 -83
- package/esm/domain/rumEventsCollection/actions/actionCollection.js.map +1 -1
- package/esm/domain/rumEventsCollection/actions/clickChain.js +2 -62
- package/esm/domain/rumEventsCollection/actions/clickChain.js.map +1 -1
- package/esm/domain/rumEventsCollection/actions/computeFrustration.js +2 -67
- package/esm/domain/rumEventsCollection/actions/computeFrustration.js.map +1 -1
- package/esm/domain/rumEventsCollection/actions/getActionNameFromElement.js +2 -279
- package/esm/domain/rumEventsCollection/actions/getActionNameFromElement.js.map +1 -1
- package/esm/domain/rumEventsCollection/actions/getSelectorsFromElement.js +2 -233
- package/esm/domain/rumEventsCollection/actions/getSelectorsFromElement.js.map +1 -1
- package/esm/domain/rumEventsCollection/actions/interactionSelectorCache.js +2 -21
- package/esm/domain/rumEventsCollection/actions/interactionSelectorCache.js.map +1 -1
- package/esm/domain/rumEventsCollection/actions/listenActionEvents.js +2 -67
- package/esm/domain/rumEventsCollection/actions/listenActionEvents.js.map +1 -1
- package/esm/domain/rumEventsCollection/actions/trackClickActions.js +2 -263
- package/esm/domain/rumEventsCollection/actions/trackClickActions.js.map +1 -1
- package/esm/domain/rumEventsCollection/error/errorCollection.js +2 -93
- package/esm/domain/rumEventsCollection/error/errorCollection.js.map +1 -1
- package/esm/domain/rumEventsCollection/error/trackConsoleError.js +2 -12
- package/esm/domain/rumEventsCollection/error/trackConsoleError.js.map +1 -1
- package/esm/domain/rumEventsCollection/error/trackReportError.js +2 -19
- package/esm/domain/rumEventsCollection/error/trackReportError.js.map +1 -1
- package/esm/domain/rumEventsCollection/longTask/longAnimationFrameCollection.js +2 -55
- package/esm/domain/rumEventsCollection/longTask/longAnimationFrameCollection.js.map +1 -1
- package/esm/domain/rumEventsCollection/longTask/longTaskCollection.js +2 -38
- package/esm/domain/rumEventsCollection/longTask/longTaskCollection.js.map +1 -1
- package/esm/domain/rumEventsCollection/resource/matchRequestResourceEntry.js +2 -69
- package/esm/domain/rumEventsCollection/resource/matchRequestResourceEntry.js.map +1 -1
- package/esm/domain/rumEventsCollection/resource/resourceCollection.js +2 -294
- package/esm/domain/rumEventsCollection/resource/resourceCollection.js.map +1 -1
- package/esm/domain/rumEventsCollection/resource/resourceTrackerManager.js +2 -232
- package/esm/domain/rumEventsCollection/resource/resourceTrackerManager.js.map +1 -1
- package/esm/domain/rumEventsCollection/resource/resourceUtils.js +2 -218
- package/esm/domain/rumEventsCollection/resource/resourceUtils.js.map +1 -1
- package/esm/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js +2 -19
- package/esm/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js.map +1 -1
- package/esm/domain/rumEventsCollection/resource/webSocketCollection.js +2 -191
- package/esm/domain/rumEventsCollection/resource/webSocketCollection.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/interactionCountPolyfill.js +2 -47
- package/esm/domain/rumEventsCollection/view/interactionCountPolyfill.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackCommonViewMetrics.js +2 -42
- package/esm/domain/rumEventsCollection/view/trackCommonViewMetrics.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js +2 -117
- package/esm/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackFirstContentfulPaint.js +2 -20
- package/esm/domain/rumEventsCollection/view/trackFirstContentfulPaint.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackFirstHidden.js +2 -49
- package/esm/domain/rumEventsCollection/view/trackFirstHidden.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackFirstInput.js +2 -41
- package/esm/domain/rumEventsCollection/view/trackFirstInput.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackInitialViewTimings.js +2 -44
- package/esm/domain/rumEventsCollection/view/trackInitialViewTimings.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackInteractionToNextPaint.js +2 -153
- package/esm/domain/rumEventsCollection/view/trackInteractionToNextPaint.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackLargestContentfulPaint.js +2 -54
- package/esm/domain/rumEventsCollection/view/trackLargestContentfulPaint.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackLoadingTime.js +2 -50
- package/esm/domain/rumEventsCollection/view/trackLoadingTime.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackNavigationTimings.js +2 -73
- package/esm/domain/rumEventsCollection/view/trackNavigationTimings.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackScrollMetrics.js +2 -84
- package/esm/domain/rumEventsCollection/view/trackScrollMetrics.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackSoftNavigationMetrics.js +2 -38
- package/esm/domain/rumEventsCollection/view/trackSoftNavigationMetrics.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackViewEventCounts.js +2 -15
- package/esm/domain/rumEventsCollection/view/trackViewEventCounts.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackViews.js +2 -418
- package/esm/domain/rumEventsCollection/view/trackViews.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/viewCollection.js +2 -127
- package/esm/domain/rumEventsCollection/view/viewCollection.js.map +1 -1
- package/esm/domain/rumSessionManager.js +2 -208
- package/esm/domain/rumSessionManager.js.map +1 -1
- package/esm/domain/tracing/ddtraceTracer.js +2 -40
- package/esm/domain/tracing/ddtraceTracer.js.map +1 -1
- package/esm/domain/tracing/getDocumentTraceId.js +2 -69
- package/esm/domain/tracing/getDocumentTraceId.js.map +1 -1
- package/esm/domain/tracing/jaegerTracer.js +2 -42
- package/esm/domain/tracing/jaegerTracer.js.map +1 -1
- package/esm/domain/tracing/sampler.js +2 -61
- package/esm/domain/tracing/sampler.js.map +1 -1
- package/esm/domain/tracing/skywalkingTracer.js +2 -90
- package/esm/domain/tracing/skywalkingTracer.js.map +1 -1
- package/esm/domain/tracing/traceIdentifier.js +2 -57
- package/esm/domain/tracing/traceIdentifier.js.map +1 -1
- package/esm/domain/tracing/tracer.js +2 -128
- package/esm/domain/tracing/tracer.js.map +1 -1
- package/esm/domain/tracing/w3cTraceParentTracer.js +2 -69
- package/esm/domain/tracing/w3cTraceParentTracer.js.map +1 -1
- package/esm/domain/tracing/zipkinMultiTracer.js +2 -42
- package/esm/domain/tracing/zipkinMultiTracer.js.map +1 -1
- package/esm/domain/tracing/zipkinSingleTracer.js +2 -41
- package/esm/domain/tracing/zipkinSingleTracer.js.map +1 -1
- package/esm/domain/trackEventCounts.js +2 -49
- package/esm/domain/trackEventCounts.js.map +1 -1
- package/esm/domain/usr/index.js +2 -38
- package/esm/domain/usr/index.js.map +1 -1
- package/esm/domain/visitorId/index.js +2 -406
- package/esm/domain/visitorId/index.js.map +1 -1
- package/esm/domain/waitPageActivityEnd.js +2 -142
- package/esm/domain/waitPageActivityEnd.js.map +1 -1
- package/esm/index.js +2 -4
- package/esm/index.js.map +1 -1
- package/esm/transport/startRumBatch.js +2 -74
- package/esm/transport/startRumBatch.js.map +1 -1
- package/esm/transport/startRumEventBridge.js +2 -9
- package/esm/transport/startRumEventBridge.js.map +1 -1
- package/esm/types/index.js +2 -1
- package/esm/types/index.js.map +1 -1
- package/esm/types/sessionReplayConstants.js +2 -46
- package/esm/types/sessionReplayConstants.js.map +1 -1
- package/package.json +5 -5
|
@@ -1,191 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export function startWebSocketCollection(lifeCycle, viewContexts, webSocketContextObservable) {
|
|
4
|
-
var tracker = trackWebSocket(lifeCycle, webSocketContextObservable || initWebSocketObservable(), viewContexts);
|
|
5
|
-
var sessionExpiredSubscription = lifeCycle.subscribe(LifeCycleEventType.SESSION_EXPIRED, function () {
|
|
6
|
-
tracker.flushOpenConnections('session_end', true);
|
|
7
|
-
});
|
|
8
|
-
var sessionRenewedSubscription = lifeCycle.subscribe(LifeCycleEventType.SESSION_RENEWED, function () {
|
|
9
|
-
tracker.resumeOpenConnections();
|
|
10
|
-
});
|
|
11
|
-
var pageExitSubscription = lifeCycle.subscribe(LifeCycleEventType.PAGE_EXITED, function (event) {
|
|
12
|
-
if (event.reason === PageExitReason.UNLOADING) {
|
|
13
|
-
tracker.flushOpenConnections('page_exit');
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
return {
|
|
17
|
-
stop: function stop() {
|
|
18
|
-
sessionExpiredSubscription.unsubscribe();
|
|
19
|
-
sessionRenewedSubscription.unsubscribe();
|
|
20
|
-
pageExitSubscription.unsubscribe();
|
|
21
|
-
tracker.flushOpenConnections('session_end');
|
|
22
|
-
tracker.stop();
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
export function trackWebSocket(lifeCycle, webSocketContextObservable, viewContexts) {
|
|
27
|
-
var registry = new SDKMap();
|
|
28
|
-
var isWaitingForSessionRenewal = false;
|
|
29
|
-
var subscription = webSocketContextObservable.subscribe(function (context) {
|
|
30
|
-
var connection = registry.get(context.instance);
|
|
31
|
-
if (context.state === 'connecting') {
|
|
32
|
-
connection = createConnection(context.instance, context.url, context.startClocks, viewContexts);
|
|
33
|
-
connection.pendingSessionRenewal = isWaitingForSessionRenewal;
|
|
34
|
-
registry.set(context.instance, connection);
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
if (!connection) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (connection.pendingSessionRenewal) {
|
|
41
|
-
if (context.state === 'open') {
|
|
42
|
-
connection.openClocks = context.openClocks;
|
|
43
|
-
connection.protocol = context.protocol;
|
|
44
|
-
} else if (context.state === 'closed') {
|
|
45
|
-
registry["delete"](context.instance);
|
|
46
|
-
}
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
if (context.state === 'open') {
|
|
50
|
-
connection.openClocks = context.openClocks;
|
|
51
|
-
connection.protocol = context.protocol;
|
|
52
|
-
connection.setupDuration = elapsed(connection.startClocks.timeStamp, context.openClocks.timeStamp);
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if (context.state === 'message-in') {
|
|
56
|
-
connection.messagesIn.count += 1;
|
|
57
|
-
connection.messagesIn.size += context.size;
|
|
58
|
-
recordMessageTiming(connection, context.at, 'in');
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
if (context.state === 'message-out') {
|
|
62
|
-
connection.messagesOut.count += 1;
|
|
63
|
-
connection.messagesOut.size += context.size;
|
|
64
|
-
connection.bufferedAmountMax = Math.max(connection.bufferedAmountMax, context.bufferedAmountPreSend);
|
|
65
|
-
recordMessageTiming(connection, context.at, 'out');
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
if (context.state === 'closed') {
|
|
69
|
-
registry["delete"](context.instance);
|
|
70
|
-
lifeCycle.notify(LifeCycleEventType.WEBSOCKET_COMPLETED, buildCompletedEvent(connection, context, 'close_event', viewContexts));
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
return {
|
|
74
|
-
flushOpenConnections: function flushOpenConnections(reason, preserveConnections) {
|
|
75
|
-
var at = clocksNow();
|
|
76
|
-
isWaitingForSessionRenewal = !!preserveConnections;
|
|
77
|
-
registry.forEach(function (connection) {
|
|
78
|
-
if (connection.pendingSessionRenewal) {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
lifeCycle.notify(LifeCycleEventType.WEBSOCKET_COMPLETED, buildCompletedEvent(connection, {
|
|
82
|
-
at: at
|
|
83
|
-
}, reason, viewContexts));
|
|
84
|
-
if (preserveConnections) {
|
|
85
|
-
connection.pendingSessionRenewal = true;
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
if (!preserveConnections) {
|
|
89
|
-
registry.clear();
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
resumeOpenConnections: function resumeOpenConnections() {
|
|
93
|
-
var at = clocksNow();
|
|
94
|
-
isWaitingForSessionRenewal = false;
|
|
95
|
-
registry.forEach(function (connection) {
|
|
96
|
-
if (connection.pendingSessionRenewal) {
|
|
97
|
-
resetConnectionSegment(connection, at, viewContexts);
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
},
|
|
101
|
-
stop: function stop() {
|
|
102
|
-
subscription.unsubscribe();
|
|
103
|
-
registry.clear();
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
function createConnection(webSocket, url, startClocks, viewContexts) {
|
|
108
|
-
var connection = {
|
|
109
|
-
webSocket: webSocket,
|
|
110
|
-
connectionId: UUID(),
|
|
111
|
-
url: url
|
|
112
|
-
};
|
|
113
|
-
resetConnectionSegment(connection, startClocks, viewContexts);
|
|
114
|
-
return connection;
|
|
115
|
-
}
|
|
116
|
-
function resetConnectionSegment(connection, startClocks, viewContexts) {
|
|
117
|
-
var wasOpen = connection.openClocks !== undefined;
|
|
118
|
-
var startView = viewContexts.findView(startClocks.relative);
|
|
119
|
-
connection.startClocks = startClocks;
|
|
120
|
-
connection.startViewId = startView && startView.id;
|
|
121
|
-
connection.messagesIn = {
|
|
122
|
-
count: 0,
|
|
123
|
-
size: 0
|
|
124
|
-
};
|
|
125
|
-
connection.messagesOut = {
|
|
126
|
-
count: 0,
|
|
127
|
-
size: 0
|
|
128
|
-
};
|
|
129
|
-
connection.longestInboundSilence = 0;
|
|
130
|
-
connection.bufferedAmountMax = 0;
|
|
131
|
-
connection.pendingSessionRenewal = false;
|
|
132
|
-
delete connection.firstMessageInOffset;
|
|
133
|
-
delete connection.firstMessageOutOffset;
|
|
134
|
-
delete connection.lastMessageInAt;
|
|
135
|
-
if (wasOpen) {
|
|
136
|
-
connection.openClocks = startClocks;
|
|
137
|
-
connection.setupDuration = 0;
|
|
138
|
-
} else {
|
|
139
|
-
delete connection.openClocks;
|
|
140
|
-
delete connection.setupDuration;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
function recordMessageTiming(connection, at, direction) {
|
|
144
|
-
if (!connection.openClocks) {
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
var offset = elapsed(connection.openClocks.timeStamp, at.timeStamp);
|
|
148
|
-
if (direction === 'in' && connection.firstMessageInOffset === undefined) {
|
|
149
|
-
connection.firstMessageInOffset = offset;
|
|
150
|
-
} else if (direction === 'out' && connection.firstMessageOutOffset === undefined) {
|
|
151
|
-
connection.firstMessageOutOffset = offset;
|
|
152
|
-
}
|
|
153
|
-
if (direction === 'in') {
|
|
154
|
-
if (connection.lastMessageInAt !== undefined) {
|
|
155
|
-
connection.longestInboundSilence = Math.max(connection.longestInboundSilence, elapsed(connection.lastMessageInAt, at.timeStamp));
|
|
156
|
-
}
|
|
157
|
-
connection.lastMessageInAt = at.timeStamp;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
function buildCompletedEvent(connection, endInfo, trackingEndReason, viewContexts) {
|
|
161
|
-
var endClocks = endInfo.at;
|
|
162
|
-
var endView = viewContexts.findView(endClocks.relative, trackingEndReason === 'session_end' || trackingEndReason === 'page_exit' ? {
|
|
163
|
-
returnInactive: true
|
|
164
|
-
} : undefined);
|
|
165
|
-
return {
|
|
166
|
-
webSocket: connection.webSocket,
|
|
167
|
-
connectionId: connection.connectionId,
|
|
168
|
-
url: connection.url,
|
|
169
|
-
protocol: connection.protocol,
|
|
170
|
-
startClocks: connection.startClocks,
|
|
171
|
-
endClocks: endClocks,
|
|
172
|
-
startViewId: connection.startViewId,
|
|
173
|
-
endViewId: endView && endView.id,
|
|
174
|
-
endViewPath: endView && endView.path,
|
|
175
|
-
messagesIn: connection.messagesIn,
|
|
176
|
-
messagesOut: connection.messagesOut,
|
|
177
|
-
firstMessageInOffset: connection.firstMessageInOffset,
|
|
178
|
-
firstMessageOutOffset: connection.firstMessageOutOffset,
|
|
179
|
-
lastMessageInAt: connection.lastMessageInAt,
|
|
180
|
-
longestInboundSilence: connection.longestInboundSilence,
|
|
181
|
-
bufferedAmountMax: connection.bufferedAmountMax,
|
|
182
|
-
inboundIdleDurationBeforeClose: connection.lastMessageInAt === undefined ? undefined : elapsed(connection.lastMessageInAt, endClocks.timeStamp),
|
|
183
|
-
closeCode: endInfo.code,
|
|
184
|
-
closeReason: endInfo.reason,
|
|
185
|
-
wasClean: endInfo.wasClean,
|
|
186
|
-
handshakeSucceeded: connection.openClocks !== undefined,
|
|
187
|
-
trackingEndReason: trackingEndReason,
|
|
188
|
-
setupDuration: connection.setupDuration === undefined ? elapsed(connection.startClocks.timeStamp, endClocks.timeStamp) : connection.setupDuration
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
//# sourceMappingURL=webSocketCollection.js.map
|
|
1
|
+
import{SDKMap}from"@cloudcare/browser-core";import{clocksNow,elapsed,initWebSocketObservable,LifeCycleEventType,PageExitReason,UUID}from"@cloudcare/browser-core";export function startWebSocketCollection(lifeCycle,viewContexts,webSocketContextObservable){var tracker=trackWebSocket(lifeCycle,webSocketContextObservable||initWebSocketObservable(),viewContexts),sessionExpiredSubscription=lifeCycle.subscribe(LifeCycleEventType.SESSION_EXPIRED,(function(){tracker.flushOpenConnections("session_end",!0)})),sessionRenewedSubscription=lifeCycle.subscribe(LifeCycleEventType.SESSION_RENEWED,(function(){tracker.resumeOpenConnections()})),pageExitSubscription=lifeCycle.subscribe(LifeCycleEventType.PAGE_EXITED,(function(event){event.reason===PageExitReason.UNLOADING&&tracker.flushOpenConnections("page_exit")}));return{stop:function stop(){sessionExpiredSubscription.unsubscribe(),sessionRenewedSubscription.unsubscribe(),pageExitSubscription.unsubscribe(),tracker.flushOpenConnections("session_end"),tracker.stop()}}}export function trackWebSocket(lifeCycle,webSocketContextObservable,viewContexts){var registry=new SDKMap,isWaitingForSessionRenewal=!1,subscription=webSocketContextObservable.subscribe((function(context){var connection=registry.get(context.instance);if("connecting"===context.state)return connection=function createConnection(webSocket,url,startClocks,viewContexts){var connection={webSocket:webSocket,connectionId:UUID(),url:url};return resetConnectionSegment(connection,startClocks,viewContexts),connection}(context.instance,context.url,context.startClocks,viewContexts),connection.pendingSessionRenewal=isWaitingForSessionRenewal,void registry.set(context.instance,connection);if(connection){if(!connection.pendingSessionRenewal)return"open"===context.state?(connection.openClocks=context.openClocks,connection.protocol=context.protocol,void(connection.setupDuration=elapsed(connection.startClocks.timeStamp,context.openClocks.timeStamp))):"message-in"===context.state?(connection.messagesIn.count+=1,connection.messagesIn.size+=context.size,void recordMessageTiming(connection,context.at,"in")):"message-out"===context.state?(connection.messagesOut.count+=1,connection.messagesOut.size+=context.size,connection.bufferedAmountMax=Math.max(connection.bufferedAmountMax,context.bufferedAmountPreSend),void recordMessageTiming(connection,context.at,"out")):void("closed"===context.state&&(registry.delete(context.instance),lifeCycle.notify(LifeCycleEventType.WEBSOCKET_COMPLETED,buildCompletedEvent(connection,context,"close_event",viewContexts))));"open"===context.state?(connection.openClocks=context.openClocks,connection.protocol=context.protocol):"closed"===context.state&®istry.delete(context.instance)}}));return{flushOpenConnections:function flushOpenConnections(reason,preserveConnections){var at=clocksNow();isWaitingForSessionRenewal=!!preserveConnections,registry.forEach((function(connection){connection.pendingSessionRenewal||(lifeCycle.notify(LifeCycleEventType.WEBSOCKET_COMPLETED,buildCompletedEvent(connection,{at:at},reason,viewContexts)),preserveConnections&&(connection.pendingSessionRenewal=!0))})),preserveConnections||registry.clear()},resumeOpenConnections:function resumeOpenConnections(){var at=clocksNow();isWaitingForSessionRenewal=!1,registry.forEach((function(connection){connection.pendingSessionRenewal&&resetConnectionSegment(connection,at,viewContexts)}))},stop:function stop(){subscription.unsubscribe(),registry.clear()}}}function resetConnectionSegment(connection,startClocks,viewContexts){var wasOpen=void 0!==connection.openClocks,startView=viewContexts.findView(startClocks.relative);connection.startClocks=startClocks,connection.startViewId=startView&&startView.id,connection.messagesIn={count:0,size:0},connection.messagesOut={count:0,size:0},connection.longestInboundSilence=0,connection.bufferedAmountMax=0,connection.pendingSessionRenewal=!1,delete connection.firstMessageInOffset,delete connection.firstMessageOutOffset,delete connection.lastMessageInAt,wasOpen?(connection.openClocks=startClocks,connection.setupDuration=0):(delete connection.openClocks,delete connection.setupDuration)}function recordMessageTiming(connection,at,direction){if(connection.openClocks){var offset=elapsed(connection.openClocks.timeStamp,at.timeStamp);"in"===direction&&void 0===connection.firstMessageInOffset?connection.firstMessageInOffset=offset:"out"===direction&&void 0===connection.firstMessageOutOffset&&(connection.firstMessageOutOffset=offset),"in"===direction&&(void 0!==connection.lastMessageInAt&&(connection.longestInboundSilence=Math.max(connection.longestInboundSilence,elapsed(connection.lastMessageInAt,at.timeStamp))),connection.lastMessageInAt=at.timeStamp)}}function buildCompletedEvent(connection,endInfo,trackingEndReason,viewContexts){var endClocks=endInfo.at,endView=viewContexts.findView(endClocks.relative,"session_end"===trackingEndReason||"page_exit"===trackingEndReason?{returnInactive:!0}:void 0);return{webSocket:connection.webSocket,connectionId:connection.connectionId,url:connection.url,protocol:connection.protocol,startClocks:connection.startClocks,endClocks:endClocks,startViewId:connection.startViewId,endViewId:endView&&endView.id,endViewPath:endView&&endView.path,messagesIn:connection.messagesIn,messagesOut:connection.messagesOut,firstMessageInOffset:connection.firstMessageInOffset,firstMessageOutOffset:connection.firstMessageOutOffset,lastMessageInAt:connection.lastMessageInAt,longestInboundSilence:connection.longestInboundSilence,bufferedAmountMax:connection.bufferedAmountMax,inboundIdleDurationBeforeClose:void 0===connection.lastMessageInAt?void 0:elapsed(connection.lastMessageInAt,endClocks.timeStamp),closeCode:endInfo.code,closeReason:endInfo.reason,wasClean:endInfo.wasClean,handshakeSucceeded:void 0!==connection.openClocks,trackingEndReason:trackingEndReason,setupDuration:void 0===connection.setupDuration?elapsed(connection.startClocks.timeStamp,endClocks.timeStamp):connection.setupDuration}}
|
|
2
|
+
//# sourceMappingURL=webSocketCollection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webSocketCollection.js","names":["SDKMap","clocksNow","elapsed","initWebSocketObservable","LifeCycleEventType","PageExitReason","UUID","startWebSocketCollection","lifeCycle","viewContexts","webSocketContextObservable","tracker","trackWebSocket","sessionExpiredSubscription","subscribe","SESSION_EXPIRED","flushOpenConnections","sessionRenewedSubscription","SESSION_RENEWED","resumeOpenConnections","pageExitSubscription","PAGE_EXITED","event","reason","UNLOADING","stop","unsubscribe","registry","isWaitingForSessionRenewal","subscription","context","connection","get","instance","state","createConnection","url","startClocks","pendingSessionRenewal","set","openClocks","protocol","setupDuration","timeStamp","messagesIn","count","size","recordMessageTiming","at","messagesOut","bufferedAmountMax","Math","max","bufferedAmountPreSend","notify","WEBSOCKET_COMPLETED","buildCompletedEvent","preserveConnections","forEach","clear","
|
|
1
|
+
{"version":3,"file":"webSocketCollection.js","names":["SDKMap","clocksNow","elapsed","initWebSocketObservable","LifeCycleEventType","PageExitReason","UUID","startWebSocketCollection","lifeCycle","viewContexts","webSocketContextObservable","tracker","trackWebSocket","sessionExpiredSubscription","subscribe","SESSION_EXPIRED","flushOpenConnections","sessionRenewedSubscription","SESSION_RENEWED","resumeOpenConnections","pageExitSubscription","PAGE_EXITED","event","reason","UNLOADING","stop","unsubscribe","registry","isWaitingForSessionRenewal","subscription","context","connection","get","instance","state","createConnection","webSocket","url","startClocks","connectionId","resetConnectionSegment","pendingSessionRenewal","set","openClocks","protocol","setupDuration","timeStamp","messagesIn","count","size","recordMessageTiming","at","messagesOut","bufferedAmountMax","Math","max","bufferedAmountPreSend","notify","WEBSOCKET_COMPLETED","buildCompletedEvent","preserveConnections","forEach","clear","wasOpen","undefined","startView","findView","relative","startViewId","id","longestInboundSilence","firstMessageInOffset","firstMessageOutOffset","lastMessageInAt","direction","offset","endInfo","trackingEndReason","endClocks","endView","returnInactive","endViewId","endViewPath","path","inboundIdleDurationBeforeClose","closeCode","code","closeReason","wasClean","handshakeSucceeded"],"sources":["../../../../src/domain/rumEventsCollection/resource/webSocketCollection.js"],"mappings":"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","ignoreList":[]}
|
|
@@ -1,47 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* The interactionCount is an integer which counts the total number of distinct user interactions,
|
|
5
|
-
* for which there was a unique interactionId.
|
|
6
|
-
*
|
|
7
|
-
* The interactionCount polyfill is an estimate based on a convention specific to Chrome. Cf: https://github.com/GoogleChrome/web-vitals/pull/213
|
|
8
|
-
* This is currently not an issue as the polyfill is only used for INP which is currently only supported on Chrome.
|
|
9
|
-
* Hopefully when/if other browsers will support INP, they will also implement performance.interactionCount at the same time, so we won't need that polyfill.
|
|
10
|
-
*
|
|
11
|
-
* Reference implementation: https://github.com/GoogleChrome/web-vitals/blob/main/src/lib/polyfills/interactionCountPolyfill.ts
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import { monitor } from '@cloudcare/browser-core';
|
|
15
|
-
var observer;
|
|
16
|
-
var interactionCountEstimate = 0;
|
|
17
|
-
var minKnownInteractionId = Infinity;
|
|
18
|
-
var maxKnownInteractionId = 0;
|
|
19
|
-
export function initInteractionCountPolyfill() {
|
|
20
|
-
if ('interactionCount' in performance || observer) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
observer = new window.PerformanceObserver(monitor(function (entries) {
|
|
24
|
-
entries.getEntries().forEach(function (e) {
|
|
25
|
-
var entry = e;
|
|
26
|
-
if (entry.interactionId) {
|
|
27
|
-
minKnownInteractionId = Math.min(minKnownInteractionId, entry.interactionId);
|
|
28
|
-
maxKnownInteractionId = Math.max(maxKnownInteractionId, entry.interactionId);
|
|
29
|
-
interactionCountEstimate = (maxKnownInteractionId - minKnownInteractionId) / 7 + 1;
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
}));
|
|
33
|
-
observer.observe({
|
|
34
|
-
type: 'event',
|
|
35
|
-
buffered: true,
|
|
36
|
-
durationThreshold: 0
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Returns the `interactionCount` value using the native API (if available)
|
|
42
|
-
* or the polyfill estimate in this module.
|
|
43
|
-
*/
|
|
44
|
-
export var getInteractionCount = function getInteractionCount() {
|
|
45
|
-
return observer ? interactionCountEstimate : window.performance.interactionCount || 0;
|
|
46
|
-
};
|
|
47
|
-
//# sourceMappingURL=interactionCountPolyfill.js.map
|
|
1
|
+
import{monitor}from"@cloudcare/browser-core";var observer,interactionCountEstimate=0,minKnownInteractionId=1/0,maxKnownInteractionId=0;export function initInteractionCountPolyfill(){"interactionCount"in performance||observer||(observer=new window.PerformanceObserver(monitor((function(entries){entries.getEntries().forEach((function(e){var entry=e;entry.interactionId&&(minKnownInteractionId=Math.min(minKnownInteractionId,entry.interactionId),maxKnownInteractionId=Math.max(maxKnownInteractionId,entry.interactionId),interactionCountEstimate=(maxKnownInteractionId-minKnownInteractionId)/7+1)}))})))).observe({type:"event",buffered:!0,durationThreshold:0})}export var getInteractionCount=function getInteractionCount(){return observer?interactionCountEstimate:window.performance.interactionCount||0};
|
|
2
|
+
//# sourceMappingURL=interactionCountPolyfill.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactionCountPolyfill.js","names":["monitor","observer","interactionCountEstimate","minKnownInteractionId","Infinity","maxKnownInteractionId","initInteractionCountPolyfill","performance","window","PerformanceObserver","entries","getEntries","forEach","e","entry","interactionId","Math","min","max","observe","type","buffered","durationThreshold","getInteractionCount","interactionCount"],"sources":["../../../../src/domain/rumEventsCollection/view/interactionCountPolyfill.js"],"mappings":"
|
|
1
|
+
{"version":3,"file":"interactionCountPolyfill.js","names":["monitor","observer","interactionCountEstimate","minKnownInteractionId","Infinity","maxKnownInteractionId","initInteractionCountPolyfill","performance","window","PerformanceObserver","entries","getEntries","forEach","e","entry","interactionId","Math","min","max","observe","type","buffered","durationThreshold","getInteractionCount","interactionCount"],"sources":["../../../../src/domain/rumEventsCollection/view/interactionCountPolyfill.js"],"mappings":"OAaSA,YAAe,0BAExB,IAAIC,SAEAC,yBAA2B,EAC3BC,sBAAwBC,IACxBC,sBAAwB,SAErB,SAASC,+BACV,qBAAsBC,aAAeN,WAIzCA,SAAW,IAAIO,OAAOC,oBACpBT,SAAQ,SAAUU,SAChBA,QAAQC,aAAaC,SAAQ,SAAUC,GACrC,IAAMC,MAAQD,EAEVC,MAAMC,gBACRZ,sBAAwBa,KAAKC,IAC3Bd,sBACAW,MAAMC,eAERV,sBAAwBW,KAAKE,IAC3Bb,sBACAS,MAAMC,eAGRb,0BACGG,sBAAwBF,uBAAyB,EAAI,EAE5D,GACF,MAEOgB,QAAQ,CAAEC,KAAM,QAASC,UAAU,EAAMC,kBAAmB,GACvE,QAMO,IAAIC,oBAAsB,SAAtBA,sBACT,OAAOtB,SACHC,yBACAM,OAAOD,YAAYiB,kBAAoB,CAC7C","ignoreList":[]}
|
|
@@ -1,42 +1,2 @@
|
|
|
1
|
-
import { trackScrollMetrics }
|
|
2
|
-
|
|
3
|
-
import { trackCumulativeLayoutShift } from './trackCumulativeLayoutShift';
|
|
4
|
-
import { trackInteractionToNextPaint } from './trackInteractionToNextPaint';
|
|
5
|
-
export function trackCommonViewMetrics(lifeCycle, domMutationObservable, configuration, scheduleViewUpdate, loadingType, viewStart) {
|
|
6
|
-
var commonViewMetrics = {};
|
|
7
|
-
var _trackLoadingTime = trackLoadingTime(lifeCycle, domMutationObservable, configuration, loadingType, viewStart, function (newLoadingTime) {
|
|
8
|
-
commonViewMetrics.loadingTime = newLoadingTime;
|
|
9
|
-
scheduleViewUpdate();
|
|
10
|
-
});
|
|
11
|
-
var stopLoadingTimeTracking = _trackLoadingTime.stop;
|
|
12
|
-
var setLoadEvent = _trackLoadingTime.setLoadEvent;
|
|
13
|
-
var _trackScrollMetrics = trackScrollMetrics(configuration, viewStart, function (newScrollMetrics) {
|
|
14
|
-
commonViewMetrics.scroll = newScrollMetrics;
|
|
15
|
-
});
|
|
16
|
-
var stopScrollMetricsTracking = _trackScrollMetrics.stop;
|
|
17
|
-
var stopCLSTracking;
|
|
18
|
-
var _trackCumulativeLayoutShift = trackCumulativeLayoutShift(configuration, viewStart.relative, function (cumulativeLayoutShift) {
|
|
19
|
-
commonViewMetrics.cumulativeLayoutShift = cumulativeLayoutShift;
|
|
20
|
-
scheduleViewUpdate();
|
|
21
|
-
});
|
|
22
|
-
var stopCLSTracking = _trackCumulativeLayoutShift.stop;
|
|
23
|
-
var _trackInteractionToNextPaint = trackInteractionToNextPaint(configuration, viewStart.relative, loadingType);
|
|
24
|
-
var stopINPTracking = _trackInteractionToNextPaint.stop;
|
|
25
|
-
var getInteractionToNextPaint = _trackInteractionToNextPaint.getInteractionToNextPaint;
|
|
26
|
-
var setViewEnd = _trackInteractionToNextPaint.setViewEnd;
|
|
27
|
-
return {
|
|
28
|
-
stop: function stop() {
|
|
29
|
-
stopLoadingTimeTracking();
|
|
30
|
-
stopCLSTracking();
|
|
31
|
-
stopScrollMetricsTracking();
|
|
32
|
-
},
|
|
33
|
-
stopINPTracking: stopINPTracking,
|
|
34
|
-
setLoadEvent: setLoadEvent,
|
|
35
|
-
setViewEnd: setViewEnd,
|
|
36
|
-
getCommonViewMetrics: function getCommonViewMetrics() {
|
|
37
|
-
commonViewMetrics.interactionToNextPaint = getInteractionToNextPaint();
|
|
38
|
-
return commonViewMetrics;
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=trackCommonViewMetrics.js.map
|
|
1
|
+
import{trackScrollMetrics}from"./trackScrollMetrics";import{trackLoadingTime}from"./trackLoadingTime";import{trackCumulativeLayoutShift}from"./trackCumulativeLayoutShift";import{trackInteractionToNextPaint}from"./trackInteractionToNextPaint";export function trackCommonViewMetrics(lifeCycle,domMutationObservable,configuration,scheduleViewUpdate,loadingType,viewStart){var commonViewMetrics={},_trackLoadingTime=trackLoadingTime(lifeCycle,domMutationObservable,configuration,loadingType,viewStart,(function(newLoadingTime){commonViewMetrics.loadingTime=newLoadingTime,scheduleViewUpdate()})),stopLoadingTimeTracking=_trackLoadingTime.stop,setLoadEvent=_trackLoadingTime.setLoadEvent,stopScrollMetricsTracking=trackScrollMetrics(configuration,viewStart,(function(newScrollMetrics){commonViewMetrics.scroll=newScrollMetrics})).stop,stopCLSTracking=trackCumulativeLayoutShift(configuration,viewStart.relative,(function(cumulativeLayoutShift){commonViewMetrics.cumulativeLayoutShift=cumulativeLayoutShift,scheduleViewUpdate()})).stop,_trackInteractionToNextPaint=trackInteractionToNextPaint(configuration,viewStart.relative,loadingType),stopINPTracking=_trackInteractionToNextPaint.stop,getInteractionToNextPaint=_trackInteractionToNextPaint.getInteractionToNextPaint;return{stop:function stop(){stopLoadingTimeTracking(),stopCLSTracking(),stopScrollMetricsTracking()},stopINPTracking:stopINPTracking,setLoadEvent:setLoadEvent,setViewEnd:_trackInteractionToNextPaint.setViewEnd,getCommonViewMetrics:function getCommonViewMetrics(){return commonViewMetrics.interactionToNextPaint=getInteractionToNextPaint(),commonViewMetrics}}}
|
|
2
|
+
//# sourceMappingURL=trackCommonViewMetrics.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trackCommonViewMetrics.js","names":["trackScrollMetrics","trackLoadingTime","trackCumulativeLayoutShift","trackInteractionToNextPaint","trackCommonViewMetrics","lifeCycle","domMutationObservable","configuration","scheduleViewUpdate","loadingType","viewStart","commonViewMetrics","_trackLoadingTime","newLoadingTime","loadingTime","stopLoadingTimeTracking","stop","setLoadEvent","
|
|
1
|
+
{"version":3,"file":"trackCommonViewMetrics.js","names":["trackScrollMetrics","trackLoadingTime","trackCumulativeLayoutShift","trackInteractionToNextPaint","trackCommonViewMetrics","lifeCycle","domMutationObservable","configuration","scheduleViewUpdate","loadingType","viewStart","commonViewMetrics","_trackLoadingTime","newLoadingTime","loadingTime","stopLoadingTimeTracking","stop","setLoadEvent","stopScrollMetricsTracking","newScrollMetrics","scroll","stopCLSTracking","relative","cumulativeLayoutShift","_trackInteractionToNextPaint","stopINPTracking","getInteractionToNextPaint","setViewEnd","getCommonViewMetrics","interactionToNextPaint"],"sources":["../../../../src/domain/rumEventsCollection/view/trackCommonViewMetrics.js"],"mappings":"OAASA,uBAA0B,8BAC1BC,qBAAwB,4BACxBC,+BAAkC,sCAClCC,gCAAmC,uCAErC,SAASC,uBACdC,UACAC,sBACAC,cACAC,mBACAC,YACAC,WAEA,IAAIC,kBAAoB,CAAC,EACrBC,kBAAoBX,iBACtBI,UACAC,sBACAC,cACAE,YACAC,WACA,SAAUG,gBACRF,kBAAkBG,YAAcD,eAChCL,oBACF,IAEEO,wBAA0BH,kBAAkBI,KAC5CC,aAAeL,kBAAkBK,aAQjCC,0BAPsBlB,mBACxBO,cACAG,WACA,SAAUS,kBACRR,kBAAkBS,OAASD,gBAC7B,IAEkDH,KAUhDK,gBAR8BnB,2BAChCK,cACAG,UAAUY,UACV,SAAUC,uBACRZ,kBAAkBY,sBAAwBA,sBAC1Cf,oBACF,IAEgDQ,KAC9CQ,6BAA+BrB,4BACjCI,cACAG,UAAUY,SACVb,aAEEgB,gBAAkBD,6BAA6BR,KAC/CU,0BACFF,6BAA6BE,0BAE/B,MAAO,CACLV,KAAM,SAANA,OACED,0BACAM,kBACAH,2BACF,EACAO,gBAAiBA,gBACjBR,aAAcA,aACdU,WATeH,6BAA6BG,WAU5CC,qBAAsB,SAAtBA,uBAEE,OADAjB,kBAAkBkB,uBAAyBH,4BACpCf,iBACT,EAEJ","ignoreList":[]}
|
|
@@ -1,117 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import { RumPerformanceEntryType, supportPerformanceTimingEvent, createPerformanceObservable } from '../../performanceObservable';
|
|
4
|
-
/**
|
|
5
|
-
* Track the cumulative layout shifts (CLS).
|
|
6
|
-
* Layout shifts are grouped into session windows.
|
|
7
|
-
* The minimum gap between session windows is 1 second.
|
|
8
|
-
* The maximum duration of a session window is 5 second.
|
|
9
|
-
* The session window layout shift value is the sum of layout shifts inside it.
|
|
10
|
-
* The CLS value is the max of session windows values.
|
|
11
|
-
*
|
|
12
|
-
* This yields a new value whenever the CLS value is updated (a higher session window value is computed).
|
|
13
|
-
*
|
|
14
|
-
* See isLayoutShiftSupported to check for browser support.
|
|
15
|
-
*
|
|
16
|
-
* Documentation:
|
|
17
|
-
* https://web.dev/cls/
|
|
18
|
-
* https://web.dev/evolving-cls/
|
|
19
|
-
* Reference implementation: https://github.com/GoogleChrome/web-vitals/blob/master/src/getCLS.ts
|
|
20
|
-
*/
|
|
21
|
-
export function trackCumulativeLayoutShift(configuration, viewStart, callback) {
|
|
22
|
-
if (!isLayoutShiftSupported()) {
|
|
23
|
-
return {
|
|
24
|
-
stop: noop
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
var maxClsValue = 0;
|
|
28
|
-
// WeakRef is not supported in IE11 and Safari mobile, but so is the layout shift API, so this code won't be executed in these browsers
|
|
29
|
-
var maxClsTarget;
|
|
30
|
-
var maxClsStartTime;
|
|
31
|
-
|
|
32
|
-
// if no layout shift happen the value should be reported as 0
|
|
33
|
-
callback({
|
|
34
|
-
value: 0
|
|
35
|
-
});
|
|
36
|
-
var window = slidingSessionWindow();
|
|
37
|
-
var performanceSubscription = createPerformanceObservable(configuration, {
|
|
38
|
-
type: RumPerformanceEntryType.LAYOUT_SHIFT,
|
|
39
|
-
buffered: true
|
|
40
|
-
}).subscribe(function (entries) {
|
|
41
|
-
for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {
|
|
42
|
-
var entry = entries_1[_i];
|
|
43
|
-
if (entry.hadRecentInput || entry.startTime < viewStart) {
|
|
44
|
-
continue;
|
|
45
|
-
}
|
|
46
|
-
var _update = window.update(entry);
|
|
47
|
-
var cumulatedValue = _update.cumulatedValue;
|
|
48
|
-
var isMaxValue = _update.isMaxValue;
|
|
49
|
-
if (isMaxValue) {
|
|
50
|
-
var target = getTargetFromSource(entry.sources);
|
|
51
|
-
maxClsTarget = target ? new WeakRef(target) : undefined;
|
|
52
|
-
maxClsStartTime = elapsed(viewStart, entry.startTime);
|
|
53
|
-
}
|
|
54
|
-
if (cumulatedValue > maxClsValue) {
|
|
55
|
-
maxClsValue = cumulatedValue;
|
|
56
|
-
var target = maxClsTarget && maxClsTarget.deref();
|
|
57
|
-
callback({
|
|
58
|
-
value: round(maxClsValue, 4),
|
|
59
|
-
targetSelector: target && getSelectorFromElement(target, configuration.actionNameAttribute),
|
|
60
|
-
time: maxClsStartTime
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
return {
|
|
66
|
-
stop: function stop() {
|
|
67
|
-
performanceSubscription.unsubscribe();
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
function getTargetFromSource(sources) {
|
|
72
|
-
if (!sources) {
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
var source = find(sources, function (source) {
|
|
76
|
-
return !!source.node && isElementNode(source.node);
|
|
77
|
-
});
|
|
78
|
-
return source && source.node;
|
|
79
|
-
}
|
|
80
|
-
export var MAX_WINDOW_DURATION = 5 * ONE_SECOND;
|
|
81
|
-
var MAX_UPDATE_GAP = ONE_SECOND;
|
|
82
|
-
function slidingSessionWindow() {
|
|
83
|
-
var cumulatedValue = 0;
|
|
84
|
-
var startTime;
|
|
85
|
-
var endTime;
|
|
86
|
-
var maxValue = 0;
|
|
87
|
-
return {
|
|
88
|
-
update: function update(entry) {
|
|
89
|
-
var shouldCreateNewWindow = startTime === undefined || entry.startTime - endTime >= MAX_UPDATE_GAP || entry.startTime - startTime >= 5 * MAX_WINDOW_DURATION;
|
|
90
|
-
var isMaxValue;
|
|
91
|
-
if (shouldCreateNewWindow) {
|
|
92
|
-
startTime = endTime = entry.startTime;
|
|
93
|
-
maxValue = cumulatedValue = entry.value;
|
|
94
|
-
isMaxValue = true;
|
|
95
|
-
} else {
|
|
96
|
-
cumulatedValue += entry.value;
|
|
97
|
-
endTime = entry.startTime;
|
|
98
|
-
isMaxValue = entry.value > maxValue;
|
|
99
|
-
if (isMaxValue) {
|
|
100
|
-
maxValue = entry.value;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return {
|
|
104
|
-
cumulatedValue: cumulatedValue,
|
|
105
|
-
isMaxValue: isMaxValue
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Check whether `layout-shift` is supported by the browser.
|
|
113
|
-
*/
|
|
114
|
-
export function isLayoutShiftSupported() {
|
|
115
|
-
return supportPerformanceTimingEvent(RumPerformanceEntryType.LAYOUT_SHIFT) && 'WeakRef' in window;
|
|
116
|
-
}
|
|
117
|
-
//# sourceMappingURL=trackCumulativeLayoutShift.js.map
|
|
1
|
+
import{find,noop,round,ONE_SECOND,isElementNode,elapsed}from"@cloudcare/browser-core";import{getSelectorFromElement}from"../actions/getSelectorsFromElement";import{RumPerformanceEntryType,supportPerformanceTimingEvent,createPerformanceObservable}from"../../performanceObservable";export function trackCumulativeLayoutShift(configuration,viewStart,callback){if(!isLayoutShiftSupported())return{stop:noop};var maxClsTarget,maxClsStartTime,maxClsValue=0;callback({value:0});var window=function slidingSessionWindow(){var startTime,endTime,cumulatedValue=0,maxValue=0;return{update:function update(entry){var isMaxValue;return void 0===startTime||entry.startTime-endTime>=MAX_UPDATE_GAP||entry.startTime-startTime>=5*MAX_WINDOW_DURATION?(startTime=endTime=entry.startTime,maxValue=cumulatedValue=entry.value,isMaxValue=!0):(cumulatedValue+=entry.value,endTime=entry.startTime,(isMaxValue=entry.value>maxValue)&&(maxValue=entry.value)),{cumulatedValue:cumulatedValue,isMaxValue:isMaxValue}}}}(),performanceSubscription=createPerformanceObservable(configuration,{type:RumPerformanceEntryType.LAYOUT_SHIFT,buffered:!0}).subscribe((function(entries){for(var _i=0,entries_1=entries;_i<entries_1.length;_i++){var entry=entries_1[_i];if(!(entry.hadRecentInput||entry.startTime<viewStart)){var _update=window.update(entry),cumulatedValue=_update.cumulatedValue;if(_update.isMaxValue){var target=getTargetFromSource(entry.sources);maxClsTarget=target?new WeakRef(target):void 0,maxClsStartTime=elapsed(viewStart,entry.startTime)}if(cumulatedValue>maxClsValue){maxClsValue=cumulatedValue;target=maxClsTarget&&maxClsTarget.deref();callback({value:round(maxClsValue,4),targetSelector:target&&getSelectorFromElement(target,configuration.actionNameAttribute),time:maxClsStartTime})}}}}));return{stop:function stop(){performanceSubscription.unsubscribe()}}}function getTargetFromSource(sources){if(sources){var source=find(sources,(function(source){return!!source.node&&isElementNode(source.node)}));return source&&source.node}}export var MAX_WINDOW_DURATION=5*ONE_SECOND;var MAX_UPDATE_GAP=ONE_SECOND;export function isLayoutShiftSupported(){return supportPerformanceTimingEvent(RumPerformanceEntryType.LAYOUT_SHIFT)&&"WeakRef"in window}
|
|
2
|
+
//# sourceMappingURL=trackCumulativeLayoutShift.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trackCumulativeLayoutShift.js","names":["find","noop","round","ONE_SECOND","isElementNode","elapsed","getSelectorFromElement","RumPerformanceEntryType","supportPerformanceTimingEvent","createPerformanceObservable","trackCumulativeLayoutShift","configuration","viewStart","callback","isLayoutShiftSupported","stop","
|
|
1
|
+
{"version":3,"file":"trackCumulativeLayoutShift.js","names":["find","noop","round","ONE_SECOND","isElementNode","elapsed","getSelectorFromElement","RumPerformanceEntryType","supportPerformanceTimingEvent","createPerformanceObservable","trackCumulativeLayoutShift","configuration","viewStart","callback","isLayoutShiftSupported","stop","maxClsTarget","maxClsStartTime","maxClsValue","value","window","slidingSessionWindow","startTime","endTime","cumulatedValue","maxValue","update","entry","isMaxValue","undefined","MAX_UPDATE_GAP","MAX_WINDOW_DURATION","performanceSubscription","type","LAYOUT_SHIFT","buffered","subscribe","entries","_i","entries_1","length","hadRecentInput","_update","target","getTargetFromSource","sources","WeakRef","deref","targetSelector","actionNameAttribute","time","unsubscribe","source","node"],"sources":["../../../../src/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js"],"mappings":"OACEA,KACAC,KACAC,MACAC,WACAC,cACAC,YACK,iCACEC,2BAA8B,4CAErCC,wBACAC,8BACAC,gCACK,qCAkBA,SAASC,2BAA2BC,cAAeC,UAAWC,UACnE,IAAKC,yBACH,MAAO,CACLC,KAAMd,MAIV,IAEIe,aACAC,gBAHAC,YAAc,EAMlBL,SAAS,CACPM,MAAO,IAGT,IAAIC,OAkDN,SAASC,uBACP,IACIC,UACAC,QAFAC,eAAiB,EAGjBC,SAAW,EACf,MAAO,CACLC,OAAQ,SAARA,OAAkBC,OAChB,IAIIC,WAcJ,YAjBgBC,IAAdP,WACAK,MAAML,UAAYC,SAAWO,gBAC7BH,MAAML,UAAYA,WAAa,EAAIS,qBAInCT,UAAYC,QAAUI,MAAML,UAC5BG,SAAWD,eAAiBG,MAAMR,MAClCS,YAAa,IAEbJ,gBAAkBG,MAAMR,MACxBI,QAAUI,MAAML,WAChBM,WAAaD,MAAMR,MAAQM,YAEzBA,SAAWE,MAAMR,QAGd,CACLK,eAAgBA,eAChBI,WAAYA,WAEhB,EAEJ,CAjFeP,GACTW,wBAA0BvB,4BAA4BE,cAAe,CACvEsB,KAAM1B,wBAAwB2B,aAC9BC,UAAU,IACTC,WAAU,SAAUC,SACrB,IAAK,IAAIC,GAAK,EAAGC,UAAYF,QAASC,GAAKC,UAAUC,OAAQF,KAAM,CACjE,IAAIX,MAAQY,UAAUD,IACtB,KAAIX,MAAMc,gBAAkBd,MAAML,UAAYV,WAA9C,CAGA,IAAI8B,QAAUtB,OAAOM,OAAOC,OACxBH,eAAiBkB,QAAQlB,eAE7B,GADiBkB,QAAQd,WACT,CACd,IAAIe,OAASC,oBAAoBjB,MAAMkB,SACvC7B,aAAe2B,OAAS,IAAIG,QAAQH,aAAUd,EAC9CZ,gBAAkBZ,QAAQO,UAAWe,MAAML,UAC7C,CACA,GAAIE,eAAiBN,YAAa,CAChCA,YAAcM,eACVmB,OAAS3B,cAAgBA,aAAa+B,QAE1ClC,SAAS,CACPM,MAAOjB,MAAMgB,YAAa,GAC1B8B,eACEL,QACArC,uBAAuBqC,OAAQhC,cAAcsC,qBAC/CC,KAAMjC,iBAEV,CApBA,CAqBF,CACF,IAEA,MAAO,CACLF,KAAM,SAANA,OACEiB,wBAAwBmB,aAC1B,EAEJ,CACA,SAASP,oBAAoBC,SAC3B,GAAKA,QAAL,CAGA,IAAIO,OAASpD,KAAK6C,SAAS,SAAUO,QACnC,QAASA,OAAOC,MAAQjD,cAAcgD,OAAOC,KAC/C,IACA,OAAOD,QAAUA,OAAOC,IAJxB,CAKF,QACO,IAAItB,oBAAsB,EAAI5B,WACrC,IAAI2B,eAAiB3B,kBAqCd,SAASW,yBACd,OACEN,8BAA8BD,wBAAwB2B,eACtD,YAAad,MAEjB","ignoreList":[]}
|
|
@@ -1,20 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export var TIMING_MAXIMUM_DELAY = 10 * ONE_MINUTE;
|
|
4
|
-
export function trackFirstContentfulPaint(configuration, firstHidden, callback) {
|
|
5
|
-
var performanceSubscription = createPerformanceObservable(configuration, {
|
|
6
|
-
type: RumPerformanceEntryType.PAINT,
|
|
7
|
-
buffered: true
|
|
8
|
-
}).subscribe(function (entries) {
|
|
9
|
-
var fcpEntry = find(entries, function (entry) {
|
|
10
|
-
return entry.entryType === RumPerformanceEntryType.PAINT && entry.name === 'first-contentful-paint' && entry.startTime < firstHidden.getTimeStamp() && entry.startTime < TIMING_MAXIMUM_DELAY;
|
|
11
|
-
});
|
|
12
|
-
if (fcpEntry) {
|
|
13
|
-
callback(fcpEntry.startTime);
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
return {
|
|
17
|
-
stop: performanceSubscription.unsubscribe
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=trackFirstContentfulPaint.js.map
|
|
1
|
+
import{find,ONE_MINUTE}from"@cloudcare/browser-core";import{RumPerformanceEntryType,createPerformanceObservable}from"../../performanceObservable";export var TIMING_MAXIMUM_DELAY=10*ONE_MINUTE;export function trackFirstContentfulPaint(configuration,firstHidden,callback){return{stop:createPerformanceObservable(configuration,{type:RumPerformanceEntryType.PAINT,buffered:!0}).subscribe((function(entries){var fcpEntry=find(entries,(function(entry){return entry.entryType===RumPerformanceEntryType.PAINT&&"first-contentful-paint"===entry.name&&entry.startTime<firstHidden.getTimeStamp()&&entry.startTime<TIMING_MAXIMUM_DELAY}));fcpEntry&&callback(fcpEntry.startTime)})).unsubscribe}}
|
|
2
|
+
//# sourceMappingURL=trackFirstContentfulPaint.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trackFirstContentfulPaint.js","names":["find","ONE_MINUTE","RumPerformanceEntryType","createPerformanceObservable","TIMING_MAXIMUM_DELAY","trackFirstContentfulPaint","configuration","firstHidden","callback","
|
|
1
|
+
{"version":3,"file":"trackFirstContentfulPaint.js","names":["find","ONE_MINUTE","RumPerformanceEntryType","createPerformanceObservable","TIMING_MAXIMUM_DELAY","trackFirstContentfulPaint","configuration","firstHidden","callback","stop","type","PAINT","buffered","subscribe","entries","fcpEntry","entry","entryType","name","startTime","getTimeStamp","unsubscribe"],"sources":["../../../../src/domain/rumEventsCollection/view/trackFirstContentfulPaint.js"],"mappings":"OAASA,KAAMC,eAAkB,iCAE/BC,wBACAC,gCACK,qCACA,IAAIC,qBAAuB,GAAKH,kBAChC,SAASI,0BACdC,cACAC,YACAC,UAkBA,MAAO,CAAEC,KAhBqBN,4BAA4BG,cAAe,CACvEI,KAAMR,wBAAwBS,MAC9BC,UAAU,IACTC,WAAU,SAAUC,SACrB,IAAIC,SAAWf,KAAKc,SAAS,SAAUE,OACrC,OACEA,MAAMC,YAAcf,wBAAwBS,OAC7B,2BAAfK,MAAME,MACNF,MAAMG,UAAYZ,YAAYa,gBAC9BJ,MAAMG,UAAYf,oBAEtB,IACIW,UACFP,SAASO,SAASI,UAEtB,IACuCE,YACzC","ignoreList":[]}
|