@cloudcare/browser-rum 3.3.22 → 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/boot/rum.js +7 -6
- package/cjs/boot/rum.js.map +1 -1
- package/cjs/domain/deflate/deflateWorker.js +1 -1
- package/cjs/domain/performanceUtils.js +6 -1
- package/cjs/domain/performanceUtils.js.map +1 -1
- package/cjs/domain/replay/record/canvasEncodeWorker.js +1 -1
- package/cjs/domain/replay/segmentCollection/segmentCollection.js +3 -1
- package/cjs/domain/replay/segmentCollection/segmentCollection.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackNavigationTimings.js +25 -3
- package/cjs/domain/rumEventsCollection/view/trackNavigationTimings.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackViews.js +56 -32
- package/cjs/domain/rumEventsCollection/view/trackViews.js.map +1 -1
- package/cjs/transport/startRumBatch.js +4 -0
- package/cjs/transport/startRumBatch.js.map +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 -183
- 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 -40
- 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 -1112
- 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 -51
- 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 -394
- 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 -70
- 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
- package/src/boot/rum.js +7 -6
- package/src/domain/performanceUtils.js +17 -1
- package/src/domain/replay/segmentCollection/segmentCollection.js +6 -1
- package/src/domain/rumEventsCollection/view/trackNavigationTimings.js +37 -3
- package/src/domain/rumEventsCollection/view/trackViews.js +66 -38
- package/src/transport/startRumBatch.js +4 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trackNavigationTimings.js","names":["relativeNow","setTimeout","runOnReadyState","clearTimeout","getNavigationEntry","trackNavigationTimings","configuration","callback","getNavigationEntryImpl","undefined","waitAfterLoadEvent","entry","isIncompleteNavigation","processNavigationEntry","fetchStart","responseEnd","domComplete","domContentLoaded","domContentLoadedEventEnd","domInteractive","loadEvent","
|
|
1
|
+
{"version":3,"file":"trackNavigationTimings.js","names":["relativeNow","setTimeout","runOnReadyState","clearTimeout","getNavigationEntry","trackNavigationTimings","configuration","callback","getNavigationEntryImpl","retryTimeoutId","undefined","retries","stopped","loadTracking","waitAfterLoadEvent","timeoutId","_runOnReadyState","stop","readNavigationTimings","entry","isIncompleteNavigation","loadEventEnd","isFinite","processNavigationEntry","fetchStart","responseEnd","domComplete","domContentLoaded","domContentLoadedEventEnd","domInteractive","loadEvent","loadEventStart","domContentLoadedEventStart","firstByte","responseStart"],"sources":["../../../../src/domain/rumEventsCollection/view/trackNavigationTimings.js"],"mappings":"OACEA,YACAC,WACAC,gBACAC,iBACK,iCAEEC,uBAA0B,gCAK5B,SAASC,uBACdC,cACAC,SACAC,wBAKA,IAAIC,oBAH2BC,IAA3BF,yBACFA,uBAAyBJ,oBAG3B,IAAIO,QAAU,EACVC,SAAU,EACVC,aA+DN,SAASC,mBAAmBP,UAC1B,IAAIQ,UACAC,iBAAmBd,gBAAgB,YAAY,WAEjDa,UAAYd,YAAW,WACrBM,UACF,GACF,IACA,MAAO,CACLU,KAAM,SAANA,OACED,iBAAiBC,OACjBd,aAAaY,UACf,EAEJ,CA7EqBD,EAEnB,SAASI,wBACP,GAAIN,QACF,OAEF,IAAIO,MAAQX,0BAgDhB,SAASY,uBAAuBD,OAC9B,OACGA,OAC6B,iBAAvBA,MAAME,eACZC,SAASH,MAAME,eAChBF,MAAME,cAAgB,CAE1B,CArDSD,CAAuBD,QAC1BP,SAAU,EACVL,SAqBN,SAASgB,uBAAuBJ,OAC9B,MAAO,CACLK,WAAYL,MAAMK,WAClBC,YAAaN,MAAMM,YACnBC,YAAaP,MAAMO,YACnBC,iBAAkBR,MAAMS,yBACxBC,eAAgBV,MAAMU,eACtBC,UAAWX,MAAME,aACjBA,aAAcF,MAAME,aACpBU,eAAgBZ,MAAMY,eACtBH,yBAA0BT,MAAMS,yBAChCI,2BAA4Bb,MAAMa,2BAKlCC,UACEd,MAAMe,eAAiB,GAAKf,MAAMe,eAAiBlC,cAC/CmB,MAAMe,mBACNxB,EAEV,CA1Cea,CAAuBJ,SACvBR,QAxBqB,MA2B9BA,SAAW,EACXF,eAAiBR,WACfiB,sBA9B4B,KAkClC,IAEA,MAAO,CACLD,KAAM,SAANA,OACEL,SAAU,EACVC,aAAaI,OACbd,aAAaM,eACf,EAEJ","ignoreList":[]}
|
|
@@ -1,84 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/** Arbitrary scroll throttle duration */
|
|
5
|
-
export var THROTTLE_SCROLL_DURATION = ONE_SECOND;
|
|
6
|
-
export function trackScrollMetrics(configuration, viewStart, callback, scrollValues) {
|
|
7
|
-
if (scrollValues === undefined) {
|
|
8
|
-
scrollValues = createScrollValuesObservable(configuration);
|
|
9
|
-
}
|
|
10
|
-
var maxScrollDepth = 0;
|
|
11
|
-
var maxScrollHeight = 0;
|
|
12
|
-
var maxScrollHeightTime = 0;
|
|
13
|
-
var subscription = scrollValues.subscribe(function (data) {
|
|
14
|
-
var scrollDepth = data.scrollDepth;
|
|
15
|
-
var scrollTop = data.scrollTop;
|
|
16
|
-
var scrollHeight = data.scrollHeight;
|
|
17
|
-
var shouldUpdate = false;
|
|
18
|
-
if (scrollDepth > maxScrollDepth) {
|
|
19
|
-
maxScrollDepth = scrollDepth;
|
|
20
|
-
shouldUpdate = true;
|
|
21
|
-
}
|
|
22
|
-
if (scrollHeight > maxScrollHeight) {
|
|
23
|
-
maxScrollHeight = scrollHeight;
|
|
24
|
-
var now = relativeNow();
|
|
25
|
-
maxScrollHeightTime = elapsed(viewStart.relative, now);
|
|
26
|
-
shouldUpdate = true;
|
|
27
|
-
}
|
|
28
|
-
if (shouldUpdate) {
|
|
29
|
-
callback({
|
|
30
|
-
maxDepth: Math.min(maxScrollDepth, maxScrollHeight),
|
|
31
|
-
maxDepthScrollTop: scrollTop,
|
|
32
|
-
maxScrollHeight: maxScrollHeight,
|
|
33
|
-
maxScrollHeightTime: maxScrollHeightTime
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
return {
|
|
38
|
-
stop: function stop() {
|
|
39
|
-
return subscription.unsubscribe();
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
export function computeScrollValues() {
|
|
44
|
-
var scrollTop = getScrollY();
|
|
45
|
-
var viewport = getViewportDimension();
|
|
46
|
-
var height = viewport.height;
|
|
47
|
-
var scrollHeight = Math.round((document.scrollingElement || document.documentElement).scrollHeight);
|
|
48
|
-
var scrollDepth = Math.round(height + scrollTop);
|
|
49
|
-
return {
|
|
50
|
-
scrollHeight: scrollHeight,
|
|
51
|
-
scrollDepth: scrollDepth,
|
|
52
|
-
scrollTop: scrollTop
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
export function createScrollValuesObservable(configuration, throttleDuration) {
|
|
56
|
-
if (throttleDuration === undefined) {
|
|
57
|
-
throttleDuration = THROTTLE_SCROLL_DURATION;
|
|
58
|
-
}
|
|
59
|
-
return new Observable(function (observable) {
|
|
60
|
-
function notify() {
|
|
61
|
-
observable.notify(computeScrollValues());
|
|
62
|
-
}
|
|
63
|
-
if (window.ResizeObserver) {
|
|
64
|
-
var throttledNotify = throttle(notify, throttleDuration, {
|
|
65
|
-
leading: false,
|
|
66
|
-
trailing: true
|
|
67
|
-
});
|
|
68
|
-
var observerTarget = document.scrollingElement || document.documentElement;
|
|
69
|
-
var resizeObserver = new ResizeObserver(monitor(throttledNotify.throttled));
|
|
70
|
-
if (observerTarget) {
|
|
71
|
-
resizeObserver.observe(observerTarget);
|
|
72
|
-
}
|
|
73
|
-
var eventListener = addEventListener(window, DOM_EVENT.SCROLL, throttledNotify.throttled, {
|
|
74
|
-
passive: true
|
|
75
|
-
});
|
|
76
|
-
return function () {
|
|
77
|
-
throttledNotify.cancel();
|
|
78
|
-
resizeObserver.unobserve(observerTarget);
|
|
79
|
-
eventListener.stop();
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
//# sourceMappingURL=trackScrollMetrics.js.map
|
|
1
|
+
import{ONE_SECOND,elapsed,relativeNow,throttle,addEventListener,DOM_EVENT,getScrollY,monitor,Observable}from"@cloudcare/browser-core";import{getViewportDimension}from"../../initViewportObservable";export var THROTTLE_SCROLL_DURATION=ONE_SECOND;export function trackScrollMetrics(configuration,viewStart,callback,scrollValues){void 0===scrollValues&&(scrollValues=createScrollValuesObservable(configuration));var maxScrollDepth=0,maxScrollHeight=0,maxScrollHeightTime=0,subscription=scrollValues.subscribe((function(data){var scrollDepth=data.scrollDepth,scrollTop=data.scrollTop,scrollHeight=data.scrollHeight,shouldUpdate=!1;if(scrollDepth>maxScrollDepth&&(maxScrollDepth=scrollDepth,shouldUpdate=!0),scrollHeight>maxScrollHeight){maxScrollHeight=scrollHeight;var now=relativeNow();maxScrollHeightTime=elapsed(viewStart.relative,now),shouldUpdate=!0}shouldUpdate&&callback({maxDepth:Math.min(maxScrollDepth,maxScrollHeight),maxDepthScrollTop:scrollTop,maxScrollHeight:maxScrollHeight,maxScrollHeightTime:maxScrollHeightTime})}));return{stop:function stop(){return subscription.unsubscribe()}}}export function computeScrollValues(){var scrollTop=getScrollY(),height=getViewportDimension().height;return{scrollHeight:Math.round((document.scrollingElement||document.documentElement).scrollHeight),scrollDepth:Math.round(height+scrollTop),scrollTop:scrollTop}}export function createScrollValuesObservable(configuration,throttleDuration){return void 0===throttleDuration&&(throttleDuration=THROTTLE_SCROLL_DURATION),new Observable((function(observable){if(window.ResizeObserver){var throttledNotify=throttle((function notify(){observable.notify(computeScrollValues())}),throttleDuration,{leading:!1,trailing:!0}),observerTarget=document.scrollingElement||document.documentElement,resizeObserver=new ResizeObserver(monitor(throttledNotify.throttled));observerTarget&&resizeObserver.observe(observerTarget);var eventListener=addEventListener(window,DOM_EVENT.SCROLL,throttledNotify.throttled,{passive:!0});return function(){throttledNotify.cancel(),resizeObserver.unobserve(observerTarget),eventListener.stop()}}}))}
|
|
2
|
+
//# sourceMappingURL=trackScrollMetrics.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trackScrollMetrics.js","names":["ONE_SECOND","elapsed","relativeNow","throttle","addEventListener","DOM_EVENT","getScrollY","monitor","Observable","getViewportDimension","THROTTLE_SCROLL_DURATION","trackScrollMetrics","configuration","viewStart","callback","scrollValues","undefined","createScrollValuesObservable","maxScrollDepth","maxScrollHeight","maxScrollHeightTime","subscription","subscribe","data","scrollDepth","scrollTop","scrollHeight","shouldUpdate","now","relative","maxDepth","Math","min","maxDepthScrollTop","stop","unsubscribe","computeScrollValues","
|
|
1
|
+
{"version":3,"file":"trackScrollMetrics.js","names":["ONE_SECOND","elapsed","relativeNow","throttle","addEventListener","DOM_EVENT","getScrollY","monitor","Observable","getViewportDimension","THROTTLE_SCROLL_DURATION","trackScrollMetrics","configuration","viewStart","callback","scrollValues","undefined","createScrollValuesObservable","maxScrollDepth","maxScrollHeight","maxScrollHeightTime","subscription","subscribe","data","scrollDepth","scrollTop","scrollHeight","shouldUpdate","now","relative","maxDepth","Math","min","maxDepthScrollTop","stop","unsubscribe","computeScrollValues","height","round","document","scrollingElement","documentElement","throttleDuration","observable","window","ResizeObserver","throttledNotify","notify","leading","trailing","observerTarget","resizeObserver","throttled","observe","eventListener","SCROLL","passive","cancel","unobserve"],"sources":["../../../../src/domain/rumEventsCollection/view/trackScrollMetrics.js"],"mappings":"OACEA,WACAC,QACAC,YACAC,SACAC,iBACAC,UACAC,WACAC,QACAC,eACK,iCACEC,yBAA4B,sCAG9B,IAAIC,yBAA2BV,kBAE/B,SAASW,mBACdC,cACAC,UACAC,SACAC,mBAEqBC,IAAjBD,eACFA,aAAeE,6BAA6BL,gBAE9C,IAAIM,eAAiB,EACjBC,gBAAkB,EAClBC,oBAAsB,EACtBC,aAAeN,aAAaO,WAAU,SAAUC,MAClD,IAAIC,YAAcD,KAAKC,YACnBC,UAAYF,KAAKE,UACjBC,aAAeH,KAAKG,aACpBC,cAAe,EAOnB,GALIH,YAAcN,iBAChBA,eAAiBM,YACjBG,cAAe,GAGbD,aAAeP,gBAAiB,CAClCA,gBAAkBO,aAClB,IAAIE,IAAM1B,cACVkB,oBAAsBnB,QAAQY,UAAUgB,SAAUD,KAClDD,cAAe,CACjB,CAEIA,cACFb,SAAS,CACPgB,SAAUC,KAAKC,IAAId,eAAgBC,iBACnCc,kBAAmBR,UACnBN,gBAAiBA,gBACjBC,oBAAqBA,qBAG3B,IAEA,MAAO,CACLc,KAAM,SAANA,OACE,OAAOb,aAAac,aACtB,EAEJ,QAEO,SAASC,sBACd,IAAIX,UAAYnB,aAGZ+B,OADW5B,uBACO4B,OAMtB,MAAO,CACLX,aANiBK,KAAKO,OACrBC,SAASC,kBAAoBD,SAASE,iBAAiBf,cAMxDF,YAJgBO,KAAKO,MAAMD,OAASZ,WAKpCA,UAAWA,UAEf,QACO,SAASR,6BAA6BL,cAAe8B,kBAI1D,YAHyB1B,IAArB0B,mBACFA,iBAAmBhC,0BAEd,IAAIF,YAAW,SAAUmC,YAK9B,GAAIC,OAAOC,eAAgB,CACzB,IAAIC,gBAAkB3C,UALxB,SAAS4C,SACPJ,WAAWI,OAAOX,sBACpB,GAGyCM,iBAAkB,CACvDM,SAAS,EACTC,UAAU,IAGRC,eAAiBX,SAASC,kBAAoBD,SAASE,gBACvDU,eAAiB,IAAIN,eACvBtC,QAAQuC,gBAAgBM,YAEtBF,gBACFC,eAAeE,QAAQH,gBAEzB,IAAII,cAAgBlD,iBAClBwC,OACAvC,UAAUkD,OACVT,gBAAgBM,UAChB,CACEI,SAAS,IAIb,OAAO,WACLV,gBAAgBW,SAChBN,eAAeO,UAAUR,gBACzBI,cAAcpB,MAChB,CACF,CACF,GACF","ignoreList":[]}
|
|
@@ -1,38 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export function trackSoftNavigationMetrics(callback) {
|
|
4
|
-
if (!window.PerformanceObserver) {
|
|
5
|
-
return noop;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
// Reuse one observer for both final API entry types to keep this optional
|
|
9
|
-
// Chrome-only enhancement small.
|
|
10
|
-
var observer;
|
|
11
|
-
try {
|
|
12
|
-
observer = new window.PerformanceObserver(monitor(function (entries) {
|
|
13
|
-
entries.getEntries().forEach(callback);
|
|
14
|
-
}));
|
|
15
|
-
observer.observe({
|
|
16
|
-
type: SOFT_NAVIGATION,
|
|
17
|
-
buffered: true
|
|
18
|
-
});
|
|
19
|
-
} catch (_unused) {
|
|
20
|
-
if (observer) {
|
|
21
|
-
observer.disconnect();
|
|
22
|
-
}
|
|
23
|
-
return noop;
|
|
24
|
-
}
|
|
25
|
-
try {
|
|
26
|
-
observer.observe({
|
|
27
|
-
type: 'interaction-contentful-paint',
|
|
28
|
-
buffered: true
|
|
29
|
-
});
|
|
30
|
-
} catch (_unused2) {
|
|
31
|
-
// Keep FCP and navigation type when an implementation exposes soft
|
|
32
|
-
// navigations before interaction contentful paint.
|
|
33
|
-
}
|
|
34
|
-
return function () {
|
|
35
|
-
observer.disconnect();
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=trackSoftNavigationMetrics.js.map
|
|
1
|
+
import{monitor,noop}from"@cloudcare/browser-core";export function trackSoftNavigationMetrics(callback){if(!window.PerformanceObserver)return noop;var observer;try{(observer=new window.PerformanceObserver(monitor((function(entries){entries.getEntries().forEach(callback)})))).observe({type:"soft-navigation",buffered:!0})}catch(_unused){return observer&&observer.disconnect(),noop}try{observer.observe({type:"interaction-contentful-paint",buffered:!0})}catch(_unused2){}return function(){observer.disconnect()}}
|
|
2
|
+
//# sourceMappingURL=trackSoftNavigationMetrics.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trackSoftNavigationMetrics.js","names":["monitor","noop","
|
|
1
|
+
{"version":3,"file":"trackSoftNavigationMetrics.js","names":["monitor","noop","trackSoftNavigationMetrics","callback","window","PerformanceObserver","observer","entries","getEntries","forEach","observe","type","buffered","_unused","disconnect","_unused2"],"sources":["../../../../src/domain/rumEventsCollection/view/trackSoftNavigationMetrics.js"],"mappings":"OAASA,QAASC,SAAY,iCAIvB,SAASC,2BAA2BC,UACzC,IAAKC,OAAOC,oBACV,OAAOJ,KAKT,IAAIK,SACJ,KACEA,SAAW,IAAIF,OAAOC,oBACpBL,SAAQ,SAAUO,SAChBA,QAAQC,aAAaC,QAAQN,SAC/B,MAEOO,QAAQ,CACfC,KAjBgB,kBAkBhBC,UAAU,GAEd,CAAE,MAAAC,SAIA,OAHIP,UACFA,SAASQ,aAEJb,IACT,CACA,IACEK,SAASI,QAAQ,CACfC,KAAM,+BACNC,UAAU,GAEd,CAAE,MAAAG,UAEA,CAGF,OAAO,WACLT,SAASQ,YACX,CACF","ignoreList":[]}
|
|
@@ -1,15 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
var _trackEventCounts = trackEventCounts({
|
|
4
|
-
lifeCycle: lifeCycle,
|
|
5
|
-
isChildEvent: function isChildEvent(event) {
|
|
6
|
-
return event.view.id === viewId;
|
|
7
|
-
},
|
|
8
|
-
onChange: onChange
|
|
9
|
-
});
|
|
10
|
-
return {
|
|
11
|
-
stop: _trackEventCounts.stop,
|
|
12
|
-
eventCounts: _trackEventCounts.eventCounts
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=trackViewEventCounts.js.map
|
|
1
|
+
import{trackEventCounts}from"../../trackEventCounts";export function trackViewEventCounts(lifeCycle,viewId,onChange){var _trackEventCounts=trackEventCounts({lifeCycle:lifeCycle,isChildEvent:function isChildEvent(event){return event.view.id===viewId},onChange:onChange});return{stop:_trackEventCounts.stop,eventCounts:_trackEventCounts.eventCounts}}
|
|
2
|
+
//# sourceMappingURL=trackViewEventCounts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trackViewEventCounts.js","names":["trackEventCounts","trackViewEventCounts","lifeCycle","viewId","onChange","_trackEventCounts","isChildEvent","event","view","id","stop","eventCounts"],"sources":["../../../../src/domain/rumEventsCollection/view/trackViewEventCounts.js"],"mappings":"
|
|
1
|
+
{"version":3,"file":"trackViewEventCounts.js","names":["trackEventCounts","trackViewEventCounts","lifeCycle","viewId","onChange","_trackEventCounts","isChildEvent","event","view","id","stop","eventCounts"],"sources":["../../../../src/domain/rumEventsCollection/view/trackViewEventCounts.js"],"mappings":"OAASA,qBAAwB,gCAE1B,SAASC,qBAAqBC,UAAWC,OAAQC,UACtD,IAAIC,kBAAoBL,iBAAiB,CACvCE,UAAWA,UACXI,aAAc,SAAdA,aAAwBC,OACtB,OAAOA,MAAMC,KAAKC,KAAON,MAC3B,EACAC,SAAUA,WAEZ,MAAO,CACLM,KAAML,kBAAkBK,KACxBC,YAAaN,kBAAkBM,YAEnC","ignoreList":[]}
|
|
@@ -1,394 +1,2 @@
|
|
|
1
|
-
import { shallowClone, elapsed, UUID, ONE_MINUTE, throttle, clocksNow, clocksOrigin, timeStampNow, looksLikeRelativeTime, ViewLoadingType, LifeCycleEventType, PageExitReason, SESSION_TIME_OUT_DELAY, isHashAnAnchor, getPathFromHash, noop, setInterval, Observable, clearInterval, setTimeout, isNullUndefinedDefaultValue, createContextManager, addEventListeners, canUseEventBridge } from '@cloudcare/browser-core';
|
|
2
|
-
|
|
3
|
-
import { trackCommonViewMetrics } from './trackCommonViewMetrics';
|
|
4
|
-
import { trackViewEventCounts } from './trackViewEventCounts';
|
|
5
|
-
import { trackSoftNavigationMetrics } from './trackSoftNavigationMetrics';
|
|
6
|
-
import { getSelectorFromElement } from '../actions/getSelectorsFromElement';
|
|
7
|
-
export var THROTTLE_VIEW_UPDATE_PERIOD = 3000;
|
|
8
|
-
export var SESSION_KEEP_ALIVE_INTERVAL = 5 * ONE_MINUTE;
|
|
9
|
-
export var KEEP_TRACKING_AFTER_VIEW_DELAY = 5 * ONE_MINUTE;
|
|
10
|
-
export function trackViews(location, lifeCycle, domMutationObservable, configuration, locationChangeObservable, areViewsTrackedAutomatically, initialViewOptions, recorderApi) {
|
|
11
|
-
var eventBridgeAvailable = canUseEventBridge();
|
|
12
|
-
var maxViewDuration = eventBridgeAvailable ? Infinity : SESSION_TIME_OUT_DELAY;
|
|
13
|
-
var isWebViewActive = !eventBridgeAvailable || document.visibilityState !== 'hidden' && document.hasFocus();
|
|
14
|
-
var activeViews = new Set();
|
|
15
|
-
function startNewView(loadingType, startClocks, viewOptions, canMatchSoftNavigation, fallbackNavigationType) {
|
|
16
|
-
var newlyCreatedView = newView(lifeCycle, domMutationObservable, configuration, location, loadingType, startClocks, viewOptions, canMatchSoftNavigation, fallbackNavigationType, recorderApi, maxViewDuration);
|
|
17
|
-
activeViews.add(newlyCreatedView);
|
|
18
|
-
newlyCreatedView.stopObservable.subscribe(function () {
|
|
19
|
-
activeViews["delete"](newlyCreatedView);
|
|
20
|
-
if (softNavigationView === newlyCreatedView) {
|
|
21
|
-
softNavigationView = undefined;
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
if (!isWebViewActive) {
|
|
25
|
-
newlyCreatedView.end({
|
|
26
|
-
sessionIsActive: false
|
|
27
|
-
});
|
|
28
|
-
newlyCreatedView.stop();
|
|
29
|
-
}
|
|
30
|
-
return newlyCreatedView;
|
|
31
|
-
}
|
|
32
|
-
var currentView = startNewView(ViewLoadingType.INITIAL_LOAD, clocksOrigin(), initialViewOptions);
|
|
33
|
-
var softNavigationView;
|
|
34
|
-
var softNavigationInteractionId;
|
|
35
|
-
var softNavigationMetricsTracking = trackSoftNavigationMetrics(function (entry) {
|
|
36
|
-
if (entry.entryType === 'soft-navigation') {
|
|
37
|
-
softNavigationView = findSoftNavigationView(activeViews, entry);
|
|
38
|
-
softNavigationInteractionId = entry.interactionId;
|
|
39
|
-
if (softNavigationView) {
|
|
40
|
-
softNavigationView.$rSetSoftNavigationMetrics(entry.navigationType, entry.duration, getSoftNavigationLcp(configuration, entry.getLargestInteractionContentfulPaint ? entry.getLargestInteractionContentfulPaint() : entry.largestInteractionContentfulPaint));
|
|
41
|
-
}
|
|
42
|
-
} else if (softNavigationView && softNavigationInteractionId === entry.interactionId) {
|
|
43
|
-
softNavigationView.$rSetSoftNavigationMetrics(undefined, undefined, getSoftNavigationLcp(configuration, entry));
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
var stopWebViewLifecycleTracking = noop;
|
|
47
|
-
var forcedSessionSubscription;
|
|
48
|
-
startViewLifeCycle();
|
|
49
|
-
var pendingNavigation;
|
|
50
|
-
var locationChangeSubscription = renewViewOnLocationChange(locationChangeObservable);
|
|
51
|
-
function startViewLifeCycle() {
|
|
52
|
-
function renewCurrentView() {
|
|
53
|
-
currentView = startNewView(ViewLoadingType.ROUTE_CHANGE, undefined, {
|
|
54
|
-
name: currentView.name,
|
|
55
|
-
service: currentView.service,
|
|
56
|
-
version: currentView.version,
|
|
57
|
-
context: currentView.contextManager.getContext()
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
function endWebView() {
|
|
61
|
-
currentView.end({
|
|
62
|
-
sessionIsActive: false
|
|
63
|
-
});
|
|
64
|
-
currentView.stop();
|
|
65
|
-
}
|
|
66
|
-
lifeCycle.subscribe(LifeCycleEventType.SESSION_RENEWED, renewCurrentView);
|
|
67
|
-
forcedSessionSubscription = lifeCycle.subscribe(LifeCycleEventType.SESSION_FORCED, function () {
|
|
68
|
-
currentView.update({
|
|
69
|
-
isForcedSessionUpdate: true
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
lifeCycle.subscribe(LifeCycleEventType.SESSION_EXPIRED, function (sessionExpirationTime) {
|
|
73
|
-
var sessionExpirationClocks;
|
|
74
|
-
if (typeof sessionExpirationTime === 'number' && sessionExpirationTime >= currentView.startClocks.timeStamp) {
|
|
75
|
-
var origin = clocksOrigin();
|
|
76
|
-
sessionExpirationClocks = {
|
|
77
|
-
relative: elapsed(origin.timeStamp, sessionExpirationTime),
|
|
78
|
-
timeStamp: sessionExpirationTime
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
currentView.end({
|
|
82
|
-
sessionIsActive: false,
|
|
83
|
-
endClocks: sessionExpirationClocks
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
if (eventBridgeAvailable) {
|
|
87
|
-
var updateWebViewLifecycle = function updateWebViewLifecycle(event) {
|
|
88
|
-
var nextIsActive = document.visibilityState !== 'hidden' && event.type !== 'blur';
|
|
89
|
-
if (nextIsActive !== isWebViewActive) {
|
|
90
|
-
isWebViewActive = nextIsActive;
|
|
91
|
-
isWebViewActive ? renewCurrentView() : endWebView();
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
stopWebViewLifecycleTracking = addEventListeners(window, ['blur', 'focus', 'resume', 'visibilitychange'], updateWebViewLifecycle).stop;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
function renewViewOnLocationChange(locationChangeObservable) {
|
|
98
|
-
return locationChangeObservable.subscribe(function (params) {
|
|
99
|
-
var oldLocation = params.oldLocation;
|
|
100
|
-
var newLocation = params.newLocation;
|
|
101
|
-
if (areDifferentLocation(oldLocation, newLocation)) {
|
|
102
|
-
if (!areViewsTrackedAutomatically) {
|
|
103
|
-
pendingNavigation = [newLocation.href, params.navigationType];
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
currentView.end();
|
|
107
|
-
currentView = startNewView(ViewLoadingType.ROUTE_CHANGE, undefined, undefined, true, params.navigationType);
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
return {
|
|
113
|
-
addTiming: function addTiming(name, time) {
|
|
114
|
-
if (typeof time === 'undefined') {
|
|
115
|
-
time = timeStampNow();
|
|
116
|
-
}
|
|
117
|
-
currentView.addTiming(name, time);
|
|
118
|
-
},
|
|
119
|
-
startView: function startView(options, startClocks) {
|
|
120
|
-
var fallbackNavigationType;
|
|
121
|
-
if (pendingNavigation && pendingNavigation[0] === location.href) {
|
|
122
|
-
fallbackNavigationType = pendingNavigation[1];
|
|
123
|
-
}
|
|
124
|
-
pendingNavigation = undefined;
|
|
125
|
-
currentView.end({
|
|
126
|
-
endClocks: startClocks
|
|
127
|
-
});
|
|
128
|
-
currentView = startNewView(ViewLoadingType.ROUTE_CHANGE, startClocks, options, true, fallbackNavigationType);
|
|
129
|
-
},
|
|
130
|
-
setViewContext: function setViewContext(context) {
|
|
131
|
-
currentView.contextManager.setContext(context);
|
|
132
|
-
},
|
|
133
|
-
setViewContextProperty: function setViewContextProperty(key, value) {
|
|
134
|
-
currentView.contextManager.setContextProperty(key, value);
|
|
135
|
-
},
|
|
136
|
-
setViewName: function setViewName(name) {
|
|
137
|
-
currentView.setViewName(name);
|
|
138
|
-
},
|
|
139
|
-
getViewContext: function getViewContext() {
|
|
140
|
-
return currentView.contextManager.getContext();
|
|
141
|
-
},
|
|
142
|
-
stop: function stop() {
|
|
143
|
-
if (locationChangeSubscription) {
|
|
144
|
-
locationChangeSubscription.unsubscribe();
|
|
145
|
-
}
|
|
146
|
-
stopWebViewLifecycleTracking();
|
|
147
|
-
forcedSessionSubscription.unsubscribe();
|
|
148
|
-
softNavigationMetricsTracking();
|
|
149
|
-
currentView.end();
|
|
150
|
-
activeViews.forEach(function (view) {
|
|
151
|
-
view.stop();
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
function newView(lifeCycle, domMutationObservable, configuration, initialLocation, loadingType, startClocks, viewOptions, canMatchSoftNavigation, fallbackNavigationType, recorderApi, maxViewDuration) {
|
|
157
|
-
// Setup initial values
|
|
158
|
-
if (startClocks === undefined) {
|
|
159
|
-
startClocks = clocksNow();
|
|
160
|
-
}
|
|
161
|
-
var id = UUID();
|
|
162
|
-
var stopObservable = new Observable();
|
|
163
|
-
var customTimings = {};
|
|
164
|
-
var documentVersion = 0;
|
|
165
|
-
var endClocks;
|
|
166
|
-
var location = shallowClone(initialLocation);
|
|
167
|
-
var contextManager = createContextManager();
|
|
168
|
-
var sessionIsActive = true;
|
|
169
|
-
var name;
|
|
170
|
-
var service;
|
|
171
|
-
var version;
|
|
172
|
-
var context;
|
|
173
|
-
if (viewOptions) {
|
|
174
|
-
name = viewOptions.name;
|
|
175
|
-
service = viewOptions.service;
|
|
176
|
-
version = viewOptions.version;
|
|
177
|
-
context = viewOptions.context;
|
|
178
|
-
}
|
|
179
|
-
if (context) {
|
|
180
|
-
contextManager.setContext(context);
|
|
181
|
-
}
|
|
182
|
-
var viewCreatedEvent = {
|
|
183
|
-
id: id,
|
|
184
|
-
name: name,
|
|
185
|
-
startClocks: startClocks,
|
|
186
|
-
service: service,
|
|
187
|
-
version: version,
|
|
188
|
-
url: viewOptions && viewOptions.url
|
|
189
|
-
};
|
|
190
|
-
lifeCycle.notify(LifeCycleEventType.BEFORE_VIEW_CREATED, viewCreatedEvent);
|
|
191
|
-
lifeCycle.notify(LifeCycleEventType.VIEW_CREATED, viewCreatedEvent);
|
|
192
|
-
|
|
193
|
-
// Update the view every time the measures are changing
|
|
194
|
-
var _scheduleViewUpdate = throttle(triggerViewUpdate, THROTTLE_VIEW_UPDATE_PERIOD, {
|
|
195
|
-
leading: false
|
|
196
|
-
});
|
|
197
|
-
var throttled = _scheduleViewUpdate.throttled;
|
|
198
|
-
var cancelScheduleViewUpdate = _scheduleViewUpdate.cancel;
|
|
199
|
-
var _trackCommonViewMetrics = trackCommonViewMetrics(lifeCycle, domMutationObservable, configuration, scheduleViewUpdate, loadingType, startClocks);
|
|
200
|
-
var setLoadEvent = _trackCommonViewMetrics.setLoadEvent;
|
|
201
|
-
var stopCommonViewMetricsTracking = _trackCommonViewMetrics.stop;
|
|
202
|
-
var getCommonViewMetrics = _trackCommonViewMetrics.getCommonViewMetrics;
|
|
203
|
-
var stopINPTracking = _trackCommonViewMetrics.stopINPTracking;
|
|
204
|
-
var setViewEnd = _trackCommonViewMetrics.setViewEnd;
|
|
205
|
-
var _trackInitialViewTimings = loadingType === ViewLoadingType.INITIAL_LOAD ? trackInitialViewMetrics(configuration, startClocks, setLoadEvent, scheduleViewUpdate) : {
|
|
206
|
-
stop: noop,
|
|
207
|
-
initialViewMetrics: {}
|
|
208
|
-
};
|
|
209
|
-
var stopInitialViewMetricsTracking = _trackInitialViewTimings.stop;
|
|
210
|
-
var initialViewMetrics = _trackInitialViewTimings.initialViewMetrics;
|
|
211
|
-
var navigationType = fallbackNavigationType;
|
|
212
|
-
var _trackViewEventCounts = trackViewEventCounts(lifeCycle, id, scheduleViewUpdate);
|
|
213
|
-
var stopEventCountsTracking = _trackViewEventCounts.stop;
|
|
214
|
-
var eventCounts = _trackViewEventCounts.eventCounts;
|
|
215
|
-
|
|
216
|
-
// Session keep alive
|
|
217
|
-
var keepAliveIntervalId = setInterval(triggerViewUpdate, SESSION_KEEP_ALIVE_INTERVAL);
|
|
218
|
-
var replayWasRecording = Boolean(recorderApi && typeof recorderApi.isRecording === 'function' && recorderApi.isRecording());
|
|
219
|
-
function updateReplayRecordingState(isRecording) {
|
|
220
|
-
if (replayWasRecording === isRecording) {
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
223
|
-
replayWasRecording = isRecording;
|
|
224
|
-
if (endClocks === undefined) {
|
|
225
|
-
// Recorder start/stop boundaries need an immediate View update. The
|
|
226
|
-
// existing five-minute View keepalive already covers long-lived active
|
|
227
|
-
// Views, so Replay must not add a second one-minute upload loop.
|
|
228
|
-
triggerViewUpdate();
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
var replayRecordingStateSubscription;
|
|
232
|
-
var hasReplayRecordingStateObservable = Boolean(recorderApi && recorderApi.recordingStateObservable && typeof recorderApi.recordingStateObservable.subscribe === 'function');
|
|
233
|
-
if (hasReplayRecordingStateObservable) {
|
|
234
|
-
replayRecordingStateSubscription = recorderApi.recordingStateObservable.subscribe(updateReplayRecordingState);
|
|
235
|
-
}
|
|
236
|
-
var pageMayExitSubscription = lifeCycle.subscribe(LifeCycleEventType.PAGE_EXITED, function (pageMayExitEvent) {
|
|
237
|
-
var isReplayRecording = recorderApi && typeof recorderApi.isRecording === 'function' && recorderApi.isRecording();
|
|
238
|
-
if (pageMayExitEvent.reason === PageExitReason.UNLOADING && (!isReplayRecording || !hasReplayRecordingStateObservable) || pageMayExitEvent.reason !== PageExitReason.UNLOADING && isReplayRecording) {
|
|
239
|
-
// Replay segments flush at every page-exit boundary. Keep the View
|
|
240
|
-
// duration aligned with those boundaries only while Replay is active;
|
|
241
|
-
// unloading remains the existing update boundary for every RUM view.
|
|
242
|
-
// An active recorder with a state observable publishes its final View
|
|
243
|
-
// after stop, so do not publish the same unload boundary twice here.
|
|
244
|
-
triggerViewUpdate();
|
|
245
|
-
}
|
|
246
|
-
});
|
|
247
|
-
triggerViewUpdate();
|
|
248
|
-
// View context update should always be throttled
|
|
249
|
-
contextManager.changeObservable.subscribe(scheduleViewUpdate);
|
|
250
|
-
function triggerBeforeViewUpdate() {
|
|
251
|
-
lifeCycle.notify(LifeCycleEventType.BEFORE_VIEW_UPDATED, {
|
|
252
|
-
id: id,
|
|
253
|
-
name: name,
|
|
254
|
-
context: contextManager.getContext(),
|
|
255
|
-
startClocks: startClocks
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
function scheduleViewUpdate() {
|
|
259
|
-
triggerBeforeViewUpdate();
|
|
260
|
-
throttled();
|
|
261
|
-
}
|
|
262
|
-
function triggerViewUpdate(options) {
|
|
263
|
-
cancelScheduleViewUpdate();
|
|
264
|
-
triggerBeforeViewUpdate();
|
|
265
|
-
documentVersion += 1;
|
|
266
|
-
var currentEnd = endClocks === undefined ? timeStampNow() : endClocks.timeStamp;
|
|
267
|
-
lifeCycle.notify(LifeCycleEventType.VIEW_UPDATED, {
|
|
268
|
-
isForcedSessionUpdate: Boolean(options && options.isForcedSessionUpdate),
|
|
269
|
-
customTimings: customTimings,
|
|
270
|
-
documentVersion: documentVersion,
|
|
271
|
-
id: id,
|
|
272
|
-
name: name,
|
|
273
|
-
service: service,
|
|
274
|
-
version: version,
|
|
275
|
-
context: contextManager.getContext(),
|
|
276
|
-
loadingType: loadingType,
|
|
277
|
-
navigationType: navigationType,
|
|
278
|
-
location: location,
|
|
279
|
-
startClocks: startClocks,
|
|
280
|
-
commonViewMetrics: getCommonViewMetrics(),
|
|
281
|
-
initialViewMetrics: initialViewMetrics,
|
|
282
|
-
duration: Math.min(elapsed(startClocks.timeStamp, currentEnd), maxViewDuration),
|
|
283
|
-
isActive: endClocks === undefined,
|
|
284
|
-
sessionIsActive: sessionIsActive,
|
|
285
|
-
eventCounts: eventCounts
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
var result = {
|
|
289
|
-
update: triggerViewUpdate,
|
|
290
|
-
name: name,
|
|
291
|
-
service: service,
|
|
292
|
-
version: version,
|
|
293
|
-
contextManager: contextManager,
|
|
294
|
-
startClocks: startClocks,
|
|
295
|
-
stopObservable: stopObservable,
|
|
296
|
-
end: function end(options) {
|
|
297
|
-
if (endClocks) {
|
|
298
|
-
// view already ended
|
|
299
|
-
return;
|
|
300
|
-
}
|
|
301
|
-
endClocks = isNullUndefinedDefaultValue(options && options.endClocks, clocksNow());
|
|
302
|
-
sessionIsActive = isNullUndefinedDefaultValue(options && options.sessionIsActive, true);
|
|
303
|
-
lifeCycle.notify(LifeCycleEventType.VIEW_ENDED, {
|
|
304
|
-
endClocks: endClocks
|
|
305
|
-
});
|
|
306
|
-
lifeCycle.notify(LifeCycleEventType.AFTER_VIEW_ENDED, {
|
|
307
|
-
endClocks: endClocks
|
|
308
|
-
});
|
|
309
|
-
clearInterval(keepAliveIntervalId);
|
|
310
|
-
if (replayRecordingStateSubscription) {
|
|
311
|
-
replayRecordingStateSubscription.unsubscribe();
|
|
312
|
-
}
|
|
313
|
-
setViewEnd(endClocks.relative);
|
|
314
|
-
stopCommonViewMetricsTracking();
|
|
315
|
-
pageMayExitSubscription.unsubscribe();
|
|
316
|
-
triggerViewUpdate();
|
|
317
|
-
setTimeout(function () {
|
|
318
|
-
result.stop();
|
|
319
|
-
}, KEEP_TRACKING_AFTER_VIEW_DELAY);
|
|
320
|
-
},
|
|
321
|
-
stop: function stop() {
|
|
322
|
-
stopInitialViewMetricsTracking();
|
|
323
|
-
stopEventCountsTracking();
|
|
324
|
-
stopINPTracking();
|
|
325
|
-
stopObservable.notify();
|
|
326
|
-
},
|
|
327
|
-
addTiming: function addTiming(name, time) {
|
|
328
|
-
if (endClocks) {
|
|
329
|
-
return;
|
|
330
|
-
}
|
|
331
|
-
var relativeTime = looksLikeRelativeTime(time) ? time : elapsed(startClocks.timeStamp, time);
|
|
332
|
-
customTimings[sanitizeTiming(name)] = relativeTime;
|
|
333
|
-
scheduleViewUpdate();
|
|
334
|
-
},
|
|
335
|
-
setViewName: function setViewName(updatedName) {
|
|
336
|
-
name = updatedName;
|
|
337
|
-
triggerViewUpdate();
|
|
338
|
-
},
|
|
339
|
-
$rSetSoftNavigationMetrics: function $rSetSoftNavigationMetrics(softNavigationType, firstContentfulPaint, largestContentfulPaint) {
|
|
340
|
-
navigationType = softNavigationType || navigationType;
|
|
341
|
-
if (typeof firstContentfulPaint === 'number') {
|
|
342
|
-
initialViewMetrics.firstContentfulPaint = firstContentfulPaint;
|
|
343
|
-
}
|
|
344
|
-
if (largestContentfulPaint) {
|
|
345
|
-
initialViewMetrics.largestContentfulPaint = largestContentfulPaint;
|
|
346
|
-
}
|
|
347
|
-
scheduleViewUpdate();
|
|
348
|
-
}
|
|
349
|
-
};
|
|
350
|
-
result.$rLocation = location;
|
|
351
|
-
if (canMatchSoftNavigation) {
|
|
352
|
-
result.$rSoftNavigationStart = startClocks.relative;
|
|
353
|
-
}
|
|
354
|
-
return result;
|
|
355
|
-
}
|
|
356
|
-
function findSoftNavigationView(activeViews, softNavigation) {
|
|
357
|
-
// History tracking creates the View before Chrome emits its paint-backed
|
|
358
|
-
// soft-navigation entry. Enrich that View instead of creating a duplicate.
|
|
359
|
-
var matchingView;
|
|
360
|
-
var closestStart = Infinity;
|
|
361
|
-
activeViews.forEach(function (view) {
|
|
362
|
-
var startDelay = view.$rSoftNavigationStart - softNavigation.startTime;
|
|
363
|
-
if (startDelay >= -1 && startDelay < closestStart && view.$rLocation.href === softNavigation.name) {
|
|
364
|
-
matchingView = view;
|
|
365
|
-
closestStart = startDelay;
|
|
366
|
-
}
|
|
367
|
-
});
|
|
368
|
-
return matchingView;
|
|
369
|
-
}
|
|
370
|
-
function getSoftNavigationLcp(configuration, entry) {
|
|
371
|
-
var candidate = entry && entry.largestContentfulPaint;
|
|
372
|
-
var renderTime = candidate && (candidate.renderTime || candidate.loadTime);
|
|
373
|
-
if (renderTime) {
|
|
374
|
-
return {
|
|
375
|
-
value: Math.max(renderTime - entry.startTime, 0),
|
|
376
|
-
targetSelector: candidate.element && getSelectorFromElement(candidate.element, configuration.actionNameAttribute)
|
|
377
|
-
};
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
/**
|
|
382
|
-
* Timing name is used as facet path that must contain only letters, digits, or the characters - _ . @ $
|
|
383
|
-
*/
|
|
384
|
-
function sanitizeTiming(name) {
|
|
385
|
-
var sanitized = name.replace(/[^a-zA-Z0-9-_.@$]/g, '_');
|
|
386
|
-
if (sanitized !== name) {
|
|
387
|
-
console.warn('Invalid timing name: ' + name + ', sanitized to: ' + sanitized);
|
|
388
|
-
}
|
|
389
|
-
return sanitized;
|
|
390
|
-
}
|
|
391
|
-
function areDifferentLocation(currentLocation, otherLocation) {
|
|
392
|
-
return currentLocation.pathname !== otherLocation.pathname || !isHashAnAnchor(otherLocation.hash) && getPathFromHash(otherLocation.hash) !== getPathFromHash(currentLocation.hash);
|
|
393
|
-
}
|
|
394
|
-
//# sourceMappingURL=trackViews.js.map
|
|
1
|
+
import{shallowClone,elapsed,UUID,ONE_MINUTE,throttle,clocksNow,clocksOrigin,timeStampNow,looksLikeRelativeTime,ViewLoadingType,LifeCycleEventType,PageExitReason,SESSION_TIME_OUT_DELAY,isHashAnAnchor,getPathFromHash,noop,setInterval,Observable,clearInterval,setTimeout,clearTimeout,isNullUndefinedDefaultValue,createContextManager,addEventListeners,DOM_EVENT,canUseEventBridge}from"@cloudcare/browser-core";import{trackInitialViewMetrics}from"./trackInitialViewTimings";import{trackCommonViewMetrics}from"./trackCommonViewMetrics";import{trackViewEventCounts}from"./trackViewEventCounts";import{trackSoftNavigationMetrics}from"./trackSoftNavigationMetrics";import{getSelectorFromElement}from"../actions/getSelectorsFromElement";export var THROTTLE_VIEW_UPDATE_PERIOD=3e3;export var SESSION_KEEP_ALIVE_INTERVAL=5*ONE_MINUTE;export var KEEP_TRACKING_AFTER_VIEW_DELAY=5*ONE_MINUTE;export function trackViews(location,lifeCycle,domMutationObservable,configuration,locationChangeObservable,areViewsTrackedAutomatically,initialViewOptions,recorderApi){var eventBridgeAvailable=canUseEventBridge(),activeViews=new Set;function startNewView(loadingType,startClocks,viewOptions,canMatchSoftNavigation,fallbackNavigationType){var newlyCreatedView=function newView(lifeCycle,domMutationObservable,configuration,initialLocation,loadingType,startClocks,viewOptions,canMatchSoftNavigation,fallbackNavigationType,recorderApi,eventBridgeAvailable){var maxViewDuration=eventBridgeAvailable?1/0:SESSION_TIME_OUT_DELAY;void 0===startClocks&&(startClocks=clocksNow());var endClocks,name,service,version,context,id=UUID(),stopObservable=new Observable,customTimings={},documentVersion=0,location=shallowClone(initialLocation),contextManager=createContextManager(),sessionIsActive=!0;viewOptions&&(name=viewOptions.name,service=viewOptions.service,version=viewOptions.version,context=viewOptions.context);context&&contextManager.setContext(context);var viewCreatedEvent={id:id,name:name,startClocks:startClocks,service:service,version:version,url:viewOptions&&viewOptions.url};lifeCycle.notify(LifeCycleEventType.BEFORE_VIEW_CREATED,viewCreatedEvent),lifeCycle.notify(LifeCycleEventType.VIEW_CREATED,viewCreatedEvent);var replayRecordingStateSubscription,_scheduleViewUpdate=throttle(triggerViewUpdate,THROTTLE_VIEW_UPDATE_PERIOD,{leading:!1}),throttled=_scheduleViewUpdate.throttled,cancelScheduleViewUpdate=_scheduleViewUpdate.cancel,_trackCommonViewMetrics=trackCommonViewMetrics(lifeCycle,domMutationObservable,configuration,scheduleViewUpdate,loadingType,startClocks),setLoadEvent=_trackCommonViewMetrics.setLoadEvent,stopCommonViewMetricsTracking=_trackCommonViewMetrics.stop,getCommonViewMetrics=_trackCommonViewMetrics.getCommonViewMetrics,stopINPTracking=_trackCommonViewMetrics.stopINPTracking,setViewEnd=_trackCommonViewMetrics.setViewEnd,_trackInitialViewTimings=loadingType===ViewLoadingType.INITIAL_LOAD?trackInitialViewMetrics(configuration,startClocks,setLoadEvent,scheduleViewUpdate):{stop:noop,initialViewMetrics:{}},stopInitialViewMetricsTracking=_trackInitialViewTimings.stop,initialViewMetrics=_trackInitialViewTimings.initialViewMetrics,navigationType=fallbackNavigationType,_trackViewEventCounts=trackViewEventCounts(lifeCycle,id,scheduleViewUpdate),stopEventCountsTracking=_trackViewEventCounts.stop,eventCounts=_trackViewEventCounts.eventCounts,keepAliveIntervalId=setInterval(triggerViewUpdate,SESSION_KEEP_ALIVE_INTERVAL),replayWasRecording=Boolean(recorderApi&&"function"==typeof recorderApi.isRecording&&recorderApi.isRecording());function updateReplayRecordingState(isRecording){replayWasRecording!==isRecording&&(replayWasRecording=isRecording,void 0===endClocks&&triggerViewUpdate())}var hasReplayRecordingStateObservable=Boolean(recorderApi&&recorderApi.recordingStateObservable&&"function"==typeof recorderApi.recordingStateObservable.subscribe);hasReplayRecordingStateObservable&&(replayRecordingStateSubscription=recorderApi.recordingStateObservable.subscribe(updateReplayRecordingState));var restoreTimeoutId,terminalViewUpdated=!1;function cancelRestoreViewUpdate(){void 0!==restoreTimeoutId&&(clearTimeout(restoreTimeoutId),restoreTimeoutId=void 0)}var pageMayExitSubscription=lifeCycle.subscribe(LifeCycleEventType.PAGE_EXITED,(function(pageMayExitEvent){if(cancelRestoreViewUpdate(),pageMayExitEvent.reason!==PageExitReason.PAGE_TERMINATED){var isReplayRecording=recorderApi&&"function"==typeof recorderApi.isRecording&&recorderApi.isRecording();(pageMayExitEvent.reason===PageExitReason.UNLOADING&&(!isReplayRecording||!hasReplayRecordingStateObservable)||pageMayExitEvent.reason!==PageExitReason.UNLOADING&&isReplayRecording||eventBridgeAvailable&&pageMayExitEvent.reason===PageExitReason.HIDDEN)&&triggerViewUpdate()}else terminalViewUpdated||(terminalViewUpdated=!0,triggerViewUpdate())})),stopWebViewRestoreTracking=noop;if(eventBridgeAvailable){var wasHidden="hidden"===document.visibilityState,stopRestoreListeners=addEventListeners(window,[DOM_EVENT.VISIBILITY_CHANGE,DOM_EVENT.RESUME,DOM_EVENT.PAGE_SHOW],(function(){var isHidden="hidden"===document.visibilityState,shouldRefresh=wasHidden&&!isHidden;wasHidden=isHidden,isHidden?cancelRestoreViewUpdate():shouldRefresh&&!terminalViewUpdated&&(restoreTimeoutId=setTimeout((function(){restoreTimeoutId=void 0,void 0!==endClocks||terminalViewUpdated||"hidden"===document.visibilityState||triggerViewUpdate()}),0))}),{capture:!0}).stop;stopWebViewRestoreTracking=function stopWebViewRestoreTracking(){stopRestoreListeners(),cancelRestoreViewUpdate()}}function triggerBeforeViewUpdate(){lifeCycle.notify(LifeCycleEventType.BEFORE_VIEW_UPDATED,{id:id,name:name,context:contextManager.getContext(),startClocks:startClocks})}function scheduleViewUpdate(){triggerBeforeViewUpdate(),throttled()}function triggerViewUpdate(options){cancelScheduleViewUpdate(),triggerBeforeViewUpdate(),documentVersion+=1;var currentEnd=void 0===endClocks?timeStampNow():endClocks.timeStamp;lifeCycle.notify(LifeCycleEventType.VIEW_UPDATED,{isForcedSessionUpdate:Boolean(options&&options.isForcedSessionUpdate),customTimings:customTimings,documentVersion:documentVersion,id:id,name:name,service:service,version:version,context:contextManager.getContext(),loadingType:loadingType,navigationType:navigationType,location:location,startClocks:startClocks,commonViewMetrics:getCommonViewMetrics(),initialViewMetrics:initialViewMetrics,duration:Math.min(elapsed(startClocks.timeStamp,currentEnd),maxViewDuration),isActive:void 0===endClocks,sessionIsActive:sessionIsActive,eventCounts:eventCounts})}triggerViewUpdate(),contextManager.changeObservable.subscribe(scheduleViewUpdate);var result={update:triggerViewUpdate,name:name,service:service,version:version,contextManager:contextManager,startClocks:startClocks,stopObservable:stopObservable,end:function end(options){endClocks||(endClocks=isNullUndefinedDefaultValue(options&&options.endClocks,clocksNow()),sessionIsActive=isNullUndefinedDefaultValue(options&&options.sessionIsActive,!0),lifeCycle.notify(LifeCycleEventType.VIEW_ENDED,{endClocks:endClocks}),lifeCycle.notify(LifeCycleEventType.AFTER_VIEW_ENDED,{endClocks:endClocks}),clearInterval(keepAliveIntervalId),replayRecordingStateSubscription&&replayRecordingStateSubscription.unsubscribe(),setViewEnd(endClocks.relative),stopCommonViewMetricsTracking(),pageMayExitSubscription.unsubscribe(),stopWebViewRestoreTracking(),triggerViewUpdate(),setTimeout((function(){result.stop()}),KEEP_TRACKING_AFTER_VIEW_DELAY))},stop:function stop(){stopWebViewRestoreTracking(),stopInitialViewMetricsTracking(),stopEventCountsTracking(),stopINPTracking(),stopObservable.notify()},addTiming:function addTiming(name,time){if(!endClocks){var relativeTime=looksLikeRelativeTime(time)?time:elapsed(startClocks.timeStamp,time);customTimings[function sanitizeTiming(name){var sanitized=name.replace(/[^a-zA-Z0-9-_.@$]/g,"_");sanitized!==name&&console.warn("Invalid timing name: "+name+", sanitized to: "+sanitized);return sanitized}(name)]=relativeTime,scheduleViewUpdate()}},setViewName:function setViewName(updatedName){name=updatedName,triggerViewUpdate()},$rSetSoftNavigationMetrics:function $rSetSoftNavigationMetrics(softNavigationType,firstContentfulPaint,largestContentfulPaint){navigationType=softNavigationType||navigationType,"number"==typeof firstContentfulPaint&&(initialViewMetrics.firstContentfulPaint=firstContentfulPaint),largestContentfulPaint&&(initialViewMetrics.largestContentfulPaint=largestContentfulPaint),scheduleViewUpdate()}};result.$rLocation=location,canMatchSoftNavigation&&(result.$rSoftNavigationStart=startClocks.relative);return result}(lifeCycle,domMutationObservable,configuration,location,loadingType,startClocks,viewOptions,canMatchSoftNavigation,fallbackNavigationType,recorderApi,eventBridgeAvailable);return activeViews.add(newlyCreatedView),newlyCreatedView.stopObservable.subscribe((function(){activeViews.delete(newlyCreatedView),softNavigationView===newlyCreatedView&&(softNavigationView=void 0)})),newlyCreatedView}var softNavigationView,softNavigationInteractionId,forcedSessionSubscription,pendingNavigation,currentView=startNewView(ViewLoadingType.INITIAL_LOAD,clocksOrigin(),initialViewOptions),softNavigationMetricsTracking=trackSoftNavigationMetrics((function(entry){"soft-navigation"===entry.entryType?(softNavigationView=function findSoftNavigationView(activeViews,softNavigation){var matchingView,closestStart=1/0;return activeViews.forEach((function(view){var startDelay=view.$rSoftNavigationStart-softNavigation.startTime;startDelay>=-1&&startDelay<closestStart&&view.$rLocation.href===softNavigation.name&&(matchingView=view,closestStart=startDelay)})),matchingView}(activeViews,entry),softNavigationInteractionId=entry.interactionId,softNavigationView&&softNavigationView.$rSetSoftNavigationMetrics(entry.navigationType,entry.duration,getSoftNavigationLcp(configuration,entry.getLargestInteractionContentfulPaint?entry.getLargestInteractionContentfulPaint():entry.largestInteractionContentfulPaint))):softNavigationView&&softNavigationInteractionId===entry.interactionId&&softNavigationView.$rSetSoftNavigationMetrics(void 0,void 0,getSoftNavigationLcp(configuration,entry))}));!function startViewLifeCycle(){lifeCycle.subscribe(LifeCycleEventType.SESSION_RENEWED,(function renewCurrentView(){currentView=startNewView(ViewLoadingType.ROUTE_CHANGE,void 0,{name:currentView.name,service:currentView.service,version:currentView.version,context:currentView.contextManager.getContext()})})),forcedSessionSubscription=lifeCycle.subscribe(LifeCycleEventType.SESSION_FORCED,(function(){currentView.update({isForcedSessionUpdate:!0})})),lifeCycle.subscribe(LifeCycleEventType.SESSION_EXPIRED,(function(sessionExpirationTime){var sessionExpirationClocks;if("number"==typeof sessionExpirationTime&&sessionExpirationTime>=currentView.startClocks.timeStamp){var origin=clocksOrigin();sessionExpirationClocks={relative:elapsed(origin.timeStamp,sessionExpirationTime),timeStamp:sessionExpirationTime}}currentView.end({sessionIsActive:!1,endClocks:sessionExpirationClocks})}))}();var locationChangeSubscription=function renewViewOnLocationChange(locationChangeObservable){return locationChangeObservable.subscribe((function(params){var oldLocation=params.oldLocation,newLocation=params.newLocation;if(function areDifferentLocation(currentLocation,otherLocation){return currentLocation.pathname!==otherLocation.pathname||!isHashAnAnchor(otherLocation.hash)&&getPathFromHash(otherLocation.hash)!==getPathFromHash(currentLocation.hash)}(oldLocation,newLocation))return areViewsTrackedAutomatically?(currentView.end(),void(currentView=startNewView(ViewLoadingType.ROUTE_CHANGE,void 0,void 0,!0,params.navigationType))):void(pendingNavigation=[newLocation.href,params.navigationType])}))}(locationChangeObservable);return{addTiming:function addTiming(name,time){void 0===time&&(time=timeStampNow()),currentView.addTiming(name,time)},startView:function startView(options,startClocks){var fallbackNavigationType;pendingNavigation&&pendingNavigation[0]===location.href&&(fallbackNavigationType=pendingNavigation[1]),pendingNavigation=void 0,currentView.end({endClocks:startClocks}),currentView=startNewView(ViewLoadingType.ROUTE_CHANGE,startClocks,options,!0,fallbackNavigationType)},setViewContext:function setViewContext(context){currentView.contextManager.setContext(context)},setViewContextProperty:function setViewContextProperty(key,value){currentView.contextManager.setContextProperty(key,value)},setViewName:function setViewName(name){currentView.setViewName(name)},getViewContext:function getViewContext(){return currentView.contextManager.getContext()},stop:function stop(){locationChangeSubscription&&locationChangeSubscription.unsubscribe(),forcedSessionSubscription.unsubscribe(),softNavigationMetricsTracking(),currentView.end(),activeViews.forEach((function(view){view.stop()}))}}}function getSoftNavigationLcp(configuration,entry){var candidate=entry&&entry.largestContentfulPaint,renderTime=candidate&&(candidate.renderTime||candidate.loadTime);if(renderTime)return{value:Math.max(renderTime-entry.startTime,0),targetSelector:candidate.element&&getSelectorFromElement(candidate.element,configuration.actionNameAttribute)}}
|
|
2
|
+
//# sourceMappingURL=trackViews.js.map
|