@cloudcare/browser-rum 3.2.18 → 3.2.22
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/README.md +128 -190
- package/bundle/dataflux-rum.js +1 -1
- package/cjs/boot/buildEnv.js +2 -3
- package/cjs/boot/buildEnv.js.map +1 -1
- package/cjs/boot/perStartRum.js +9 -2
- package/cjs/boot/perStartRum.js.map +1 -1
- package/cjs/boot/recorderApi.js +1 -1
- package/cjs/boot/recorderApi.js.map +1 -1
- package/cjs/boot/rum.entry.js +1 -2
- package/cjs/boot/rum.entry.js.map +1 -1
- package/cjs/boot/rum.js +1 -1
- package/cjs/boot/rum.js.map +1 -1
- package/cjs/boot/rumPublicApi.js +1 -1
- package/cjs/boot/rumPublicApi.js.map +1 -1
- package/cjs/boot/startRecording.js +57 -8
- package/cjs/boot/startRecording.js.map +1 -1
- package/cjs/constants.js +13 -26
- package/cjs/constants.js.map +1 -1
- package/cjs/domain/assembly.js +16 -8
- package/cjs/domain/assembly.js.map +1 -1
- package/cjs/domain/configuration.js +13 -3
- package/cjs/domain/configuration.js.map +1 -1
- package/cjs/domain/contexts/displayContext.js.map +1 -1
- package/cjs/domain/contexts/foregroundContexts.js +2 -4
- package/cjs/domain/contexts/foregroundContexts.js.map +1 -1
- package/cjs/domain/contexts/internalContext.js.map +1 -1
- package/cjs/domain/contexts/pageStateHistory.js +4 -8
- package/cjs/domain/contexts/pageStateHistory.js.map +1 -1
- package/cjs/domain/contexts/urlContexts.js +1 -2
- package/cjs/domain/contexts/urlContexts.js.map +1 -1
- package/cjs/domain/contexts/viewContexts.js +1 -2
- package/cjs/domain/contexts/viewContexts.js.map +1 -1
- package/cjs/domain/deflate/deflateEncoder.js +1 -2
- package/cjs/domain/deflate/deflateEncoder.js.map +1 -1
- package/cjs/domain/deflate/deflateWorker.js +3 -5
- package/cjs/domain/deflate/deflateWorker.js.map +1 -1
- package/cjs/domain/firstInputPolyfill.js.map +1 -1
- package/cjs/domain/locationChangeObservable.js.map +1 -1
- package/cjs/domain/performanceObservable.js +3 -3
- package/cjs/domain/performanceObservable.js.map +1 -1
- package/cjs/domain/performanceUtils.js.map +1 -1
- package/cjs/domain/replay/record/elementsScrollPositions.js.map +1 -1
- package/cjs/domain/replay/record/mutationBatch.js +1 -2
- package/cjs/domain/replay/record/mutationBatch.js.map +1 -1
- package/cjs/domain/replay/record/mutationObserver.js +2 -2
- package/cjs/domain/replay/record/mutationObserver.js.map +1 -1
- package/cjs/domain/replay/record/observers.js +31 -32
- package/cjs/domain/replay/record/observers.js.map +1 -1
- package/cjs/domain/replay/record/privacy.js +6 -7
- package/cjs/domain/replay/record/privacy.js.map +1 -1
- package/cjs/domain/replay/record/record.js.map +1 -1
- package/cjs/domain/replay/record/serializationUtils.js +5 -8
- package/cjs/domain/replay/record/serializationUtils.js.map +1 -1
- package/cjs/domain/replay/record/serialize.js +8 -10
- package/cjs/domain/replay/record/serialize.js.map +1 -1
- package/cjs/domain/replay/record/shadowRootsController.js +2 -3
- package/cjs/domain/replay/record/shadowRootsController.js.map +1 -1
- package/cjs/domain/replay/record/viewports.js +2 -4
- package/cjs/domain/replay/record/viewports.js.map +1 -1
- package/cjs/domain/replay/replayStats.js +2 -2
- package/cjs/domain/replay/replayStats.js.map +1 -1
- package/cjs/domain/replay/segmentCollection/buildReplayPayload.js +1 -1
- package/cjs/domain/replay/segmentCollection/buildReplayPayload.js.map +1 -1
- package/cjs/domain/replay/segmentCollection/segment.js +3 -3
- package/cjs/domain/replay/segmentCollection/segment.js.map +1 -1
- package/cjs/domain/replay/segmentCollection/segmentCollection.js +42 -17
- package/cjs/domain/replay/segmentCollection/segmentCollection.js.map +1 -1
- package/cjs/domain/replay/startRecordBridge.js +19 -0
- package/cjs/domain/replay/startRecordBridge.js.map +1 -0
- package/cjs/domain/requestCollection.js.map +1 -1
- package/cjs/domain/rumEventsCollection/actions/actionCollection.js.map +1 -1
- package/cjs/domain/rumEventsCollection/actions/clickChain.js +2 -4
- package/cjs/domain/rumEventsCollection/actions/clickChain.js.map +1 -1
- package/cjs/domain/rumEventsCollection/actions/getActionNameFromElement.js +1 -2
- package/cjs/domain/rumEventsCollection/actions/getActionNameFromElement.js.map +1 -1
- package/cjs/domain/rumEventsCollection/actions/getSelectorsFromElement.js +1 -2
- package/cjs/domain/rumEventsCollection/actions/getSelectorsFromElement.js.map +1 -1
- package/cjs/domain/rumEventsCollection/actions/interactionSelectorCache.js +2 -4
- package/cjs/domain/rumEventsCollection/actions/interactionSelectorCache.js.map +1 -1
- package/cjs/domain/rumEventsCollection/actions/listenActionEvents.js.map +1 -1
- package/cjs/domain/rumEventsCollection/actions/trackClickActions.js +2 -2
- package/cjs/domain/rumEventsCollection/actions/trackClickActions.js.map +1 -1
- package/cjs/domain/rumEventsCollection/error/errorCollection.js +12 -1
- package/cjs/domain/rumEventsCollection/error/errorCollection.js.map +1 -1
- package/cjs/domain/rumEventsCollection/error/trackConsoleError.js.map +1 -1
- package/cjs/domain/rumEventsCollection/error/trackReportError.js.map +1 -1
- package/cjs/domain/rumEventsCollection/longTask/longAnimationFrameCollection.js.map +1 -1
- package/cjs/domain/rumEventsCollection/longTask/longTaskCollection.js.map +1 -1
- package/cjs/domain/rumEventsCollection/resource/resourceCollection.js.map +1 -1
- package/cjs/domain/rumEventsCollection/resource/resourceUtils.js +2 -5
- package/cjs/domain/rumEventsCollection/resource/resourceUtils.js.map +1 -1
- package/cjs/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/interactionCountPolyfill.js +1 -2
- package/cjs/domain/rumEventsCollection/view/interactionCountPolyfill.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackCommonViewMetrics.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js +1 -2
- package/cjs/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackFirstContentfulPaint.js +1 -2
- package/cjs/domain/rumEventsCollection/view/trackFirstContentfulPaint.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackFirstHidden.js +27 -10
- package/cjs/domain/rumEventsCollection/view/trackFirstHidden.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackFirstInput.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackInitialViewTimings.js +1 -2
- package/cjs/domain/rumEventsCollection/view/trackInitialViewTimings.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackInteractionToNextPaint.js +1 -2
- package/cjs/domain/rumEventsCollection/view/trackInteractionToNextPaint.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackLargestContentfulPaint.js +1 -2
- package/cjs/domain/rumEventsCollection/view/trackLargestContentfulPaint.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackLoadingTime.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackNavigationTimings.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackScrollMetrics.js +1 -2
- package/cjs/domain/rumEventsCollection/view/trackScrollMetrics.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackViewEventCounts.js.map +1 -1
- package/cjs/domain/rumEventsCollection/view/trackViews.js +18 -12
- package/cjs/domain/rumEventsCollection/view/trackViews.js.map +1 -1
- package/cjs/domain/rumSessionManager.js +92 -32
- package/cjs/domain/rumSessionManager.js.map +1 -1
- package/cjs/domain/tracing/ddtraceTracer.js.map +1 -1
- package/cjs/domain/tracing/getDocumentTraceId.js +1 -2
- package/cjs/domain/tracing/getDocumentTraceId.js.map +1 -1
- package/cjs/domain/tracing/jaegerTracer.js.map +1 -1
- package/cjs/domain/tracing/sampler.js +69 -0
- package/cjs/domain/tracing/sampler.js.map +1 -0
- package/cjs/domain/tracing/skywalkingTracer.js.map +1 -1
- package/cjs/domain/tracing/traceIdentifier.js.map +1 -1
- package/cjs/domain/tracing/tracer.js +8 -2
- package/cjs/domain/tracing/tracer.js.map +1 -1
- package/cjs/domain/tracing/w3cTraceParentTracer.js.map +1 -1
- package/cjs/domain/tracing/zipkinMultiTracer.js.map +1 -1
- package/cjs/domain/tracing/zipkinSingleTracer.js.map +1 -1
- package/cjs/domain/trackEventCounts.js.map +1 -1
- package/cjs/domain/usr/index.js +3 -6
- package/cjs/domain/usr/index.js.map +1 -1
- package/cjs/domain/waitPageActivityEnd.js +2 -4
- package/cjs/domain/waitPageActivityEnd.js.map +1 -1
- package/cjs/types/sessionReplayConstants.js +5 -10
- package/cjs/types/sessionReplayConstants.js.map +1 -1
- package/esm/boot/buildEnv.js +1 -1
- package/esm/boot/perStartRum.js +10 -3
- package/esm/boot/perStartRum.js.map +1 -1
- package/esm/boot/recorderApi.js +2 -2
- package/esm/boot/recorderApi.js.map +1 -1
- package/esm/boot/rum.js +1 -1
- package/esm/boot/rum.js.map +1 -1
- package/esm/boot/rumPublicApi.js +1 -1
- package/esm/boot/rumPublicApi.js.map +1 -1
- package/esm/boot/startRecording.js +57 -9
- package/esm/boot/startRecording.js.map +1 -1
- package/esm/domain/assembly.js +16 -8
- package/esm/domain/assembly.js.map +1 -1
- package/esm/domain/configuration.js +13 -3
- package/esm/domain/configuration.js.map +1 -1
- package/esm/domain/contexts/displayContext.js.map +1 -1
- package/esm/domain/contexts/foregroundContexts.js.map +1 -1
- package/esm/domain/contexts/internalContext.js.map +1 -1
- package/esm/domain/contexts/pageStateHistory.js.map +1 -1
- package/esm/domain/contexts/urlContexts.js.map +1 -1
- package/esm/domain/contexts/viewContexts.js.map +1 -1
- package/esm/domain/deflate/deflateEncoder.js.map +1 -1
- package/esm/domain/deflate/deflateWorker.js +1 -1
- package/esm/domain/firstInputPolyfill.js.map +1 -1
- package/esm/domain/locationChangeObservable.js.map +1 -1
- package/esm/domain/performanceObservable.js +2 -1
- package/esm/domain/performanceObservable.js.map +1 -1
- package/esm/domain/performanceUtils.js.map +1 -1
- package/esm/domain/replay/record/elementsScrollPositions.js.map +1 -1
- package/esm/domain/replay/record/mutationBatch.js.map +1 -1
- package/esm/domain/replay/record/mutationObserver.js +2 -2
- package/esm/domain/replay/record/mutationObserver.js.map +1 -1
- package/esm/domain/replay/record/observers.js +31 -32
- package/esm/domain/replay/record/observers.js.map +1 -1
- package/esm/domain/replay/record/privacy.js +4 -3
- package/esm/domain/replay/record/privacy.js.map +1 -1
- package/esm/domain/replay/record/record.js.map +1 -1
- package/esm/domain/replay/record/serializationUtils.js +2 -2
- package/esm/domain/replay/record/serializationUtils.js.map +1 -1
- package/esm/domain/replay/record/serialize.js +7 -8
- package/esm/domain/replay/record/serialize.js.map +1 -1
- package/esm/domain/replay/record/shadowRootsController.js +1 -1
- package/esm/domain/replay/record/shadowRootsController.js.map +1 -1
- package/esm/domain/replay/replayStats.js +1 -1
- package/esm/domain/replay/replayStats.js.map +1 -1
- package/esm/domain/replay/segmentCollection/buildReplayPayload.js +1 -1
- package/esm/domain/replay/segmentCollection/segmentCollection.js +39 -13
- package/esm/domain/replay/segmentCollection/segmentCollection.js.map +1 -1
- package/esm/domain/replay/startRecordBridge.js +13 -0
- package/esm/domain/replay/startRecordBridge.js.map +1 -0
- package/esm/domain/requestCollection.js.map +1 -1
- package/esm/domain/rumEventsCollection/actions/actionCollection.js.map +1 -1
- package/esm/domain/rumEventsCollection/actions/clickChain.js.map +1 -1
- package/esm/domain/rumEventsCollection/actions/getSelectorsFromElement.js.map +1 -1
- package/esm/domain/rumEventsCollection/actions/listenActionEvents.js.map +1 -1
- package/esm/domain/rumEventsCollection/actions/trackClickActions.js.map +1 -1
- package/esm/domain/rumEventsCollection/error/errorCollection.js +12 -1
- package/esm/domain/rumEventsCollection/error/errorCollection.js.map +1 -1
- package/esm/domain/rumEventsCollection/error/trackConsoleError.js.map +1 -1
- package/esm/domain/rumEventsCollection/error/trackReportError.js.map +1 -1
- package/esm/domain/rumEventsCollection/longTask/longAnimationFrameCollection.js.map +1 -1
- package/esm/domain/rumEventsCollection/longTask/longTaskCollection.js.map +1 -1
- package/esm/domain/rumEventsCollection/resource/resourceCollection.js.map +1 -1
- package/esm/domain/rumEventsCollection/resource/resourceUtils.js +0 -1
- package/esm/domain/rumEventsCollection/resource/resourceUtils.js.map +1 -1
- package/esm/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackCommonViewMetrics.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackFirstHidden.js +28 -11
- package/esm/domain/rumEventsCollection/view/trackFirstHidden.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackFirstInput.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackInteractionToNextPaint.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackLargestContentfulPaint.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackLoadingTime.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackNavigationTimings.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackScrollMetrics.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackViewEventCounts.js.map +1 -1
- package/esm/domain/rumEventsCollection/view/trackViews.js +15 -6
- package/esm/domain/rumEventsCollection/view/trackViews.js.map +1 -1
- package/esm/domain/rumSessionManager.js +89 -26
- package/esm/domain/rumSessionManager.js.map +1 -1
- package/esm/domain/tracing/ddtraceTracer.js.map +1 -1
- package/esm/domain/tracing/jaegerTracer.js.map +1 -1
- package/esm/domain/tracing/sampler.js +61 -0
- package/esm/domain/tracing/sampler.js.map +1 -0
- package/esm/domain/tracing/skywalkingTracer.js.map +1 -1
- package/esm/domain/tracing/traceIdentifier.js.map +1 -1
- package/esm/domain/tracing/tracer.js +8 -2
- package/esm/domain/tracing/tracer.js.map +1 -1
- package/esm/domain/tracing/w3cTraceParentTracer.js.map +1 -1
- package/esm/domain/tracing/zipkinMultiTracer.js.map +1 -1
- package/esm/domain/tracing/zipkinSingleTracer.js.map +1 -1
- package/esm/domain/trackEventCounts.js.map +1 -1
- package/esm/domain/usr/index.js.map +1 -1
- package/esm/types/sessionReplayConstants.js +0 -1
- package/esm/types/sessionReplayConstants.js.map +1 -1
- package/package.json +35 -35
- package/src/boot/perStartRum.js +13 -4
- package/src/boot/recorderApi.js +6 -2
- package/src/boot/rum.js +1 -0
- package/src/boot/rumPublicApi.js +0 -1
- package/src/boot/startRecording.js +69 -17
- package/src/domain/assembly.js +20 -3
- package/src/domain/configuration.js +36 -3
- package/src/domain/performanceObservable.js +2 -1
- package/src/domain/replay/record/mutationObserver.js +12 -2
- package/src/domain/replay/record/observers.js +43 -28
- package/src/domain/replay/record/privacy.js +8 -2
- package/src/domain/replay/record/serializationUtils.js +2 -2
- package/src/domain/replay/record/serialize.js +9 -2
- package/src/domain/replay/record/shadowRootsController.js +1 -1
- package/src/domain/replay/replayStats.js +1 -1
- package/src/domain/replay/segmentCollection/segmentCollection.js +47 -20
- package/src/domain/replay/startRecordBridge.js +14 -0
- package/src/domain/rumEventsCollection/error/errorCollection.js +12 -0
- package/src/domain/rumEventsCollection/view/trackFirstHidden.js +31 -22
- package/src/domain/rumEventsCollection/view/trackViews.js +18 -9
- package/src/domain/rumSessionManager.js +129 -34
- package/src/domain/tracing/sampler.js +65 -0
- package/src/domain/tracing/tracer.js +11 -5
|
@@ -7,11 +7,11 @@ exports.MAX_STATS_HISTORY = void 0;
|
|
|
7
7
|
exports.addRecord = addRecord;
|
|
8
8
|
exports.addSegment = addSegment;
|
|
9
9
|
exports.addWroteData = addWroteData;
|
|
10
|
+
exports.deleteOldestStats = deleteOldestStats;
|
|
10
11
|
exports.getReplayStats = getReplayStats;
|
|
11
12
|
exports.getSegmentsCount = getSegmentsCount;
|
|
12
13
|
exports.resetReplayStats = resetReplayStats;
|
|
13
|
-
var MAX_STATS_HISTORY = 10;
|
|
14
|
-
exports.MAX_STATS_HISTORY = MAX_STATS_HISTORY;
|
|
14
|
+
var MAX_STATS_HISTORY = exports.MAX_STATS_HISTORY = 10;
|
|
15
15
|
var statsPerView;
|
|
16
16
|
function getSegmentsCount(viewId) {
|
|
17
17
|
return getOrCreateReplayStats(viewId).segments_count;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replayStats.js","names":["MAX_STATS_HISTORY","exports","statsPerView","getSegmentsCount","viewId","getOrCreateReplayStats","segments_count","addSegment","addRecord","records_count","addWroteData","additionalBytesCount","segments_total_raw_size","getReplayStats","get","resetReplayStats","undefined","Map","replayStats","has","set","size","deleteOldestStats","keys","next","value","isFirst","forEach","_value","key"],"sources":["../../../src/domain/replay/replayStats.js"],"sourcesContent":["export var MAX_STATS_HISTORY = 10\nvar statsPerView\n\nexport function getSegmentsCount(viewId) {\n return getOrCreateReplayStats(viewId).segments_count\n}\n\nexport function addSegment(viewId) {\n getOrCreateReplayStats(viewId).segments_count += 1\n}\n\nexport function addRecord(viewId) {\n getOrCreateReplayStats(viewId).records_count += 1\n}\n\nexport function addWroteData(viewId, additionalBytesCount) {\n getOrCreateReplayStats(viewId).segments_total_raw_size += additionalBytesCount\n}\n\nexport function getReplayStats(viewId) {\n return statsPerView && statsPerView.get(viewId)\n}\n\nexport function resetReplayStats() {\n statsPerView = undefined\n}\n\nfunction getOrCreateReplayStats(viewId) {\n if (!statsPerView) {\n statsPerView = new Map()\n }\n\n var replayStats\n if (statsPerView.has(viewId)) {\n replayStats = statsPerView.get(viewId)\n } else {\n replayStats = {\n records_count: 0,\n segments_count: 0,\n segments_total_raw_size: 0\n }\n statsPerView.set(viewId, replayStats)\n if (statsPerView.size > MAX_STATS_HISTORY) {\n deleteOldestStats()\n }\n }\n\n return replayStats\n}\n\
|
|
1
|
+
{"version":3,"file":"replayStats.js","names":["MAX_STATS_HISTORY","exports","statsPerView","getSegmentsCount","viewId","getOrCreateReplayStats","segments_count","addSegment","addRecord","records_count","addWroteData","additionalBytesCount","segments_total_raw_size","getReplayStats","get","resetReplayStats","undefined","Map","replayStats","has","set","size","deleteOldestStats","keys","next","value","isFirst","forEach","_value","key"],"sources":["../../../src/domain/replay/replayStats.js"],"sourcesContent":["export var MAX_STATS_HISTORY = 10\nvar statsPerView\n\nexport function getSegmentsCount(viewId) {\n return getOrCreateReplayStats(viewId).segments_count\n}\n\nexport function addSegment(viewId) {\n getOrCreateReplayStats(viewId).segments_count += 1\n}\n\nexport function addRecord(viewId) {\n getOrCreateReplayStats(viewId).records_count += 1\n}\n\nexport function addWroteData(viewId, additionalBytesCount) {\n getOrCreateReplayStats(viewId).segments_total_raw_size += additionalBytesCount\n}\n\nexport function getReplayStats(viewId) {\n return statsPerView && statsPerView.get(viewId)\n}\n\nexport function resetReplayStats() {\n statsPerView = undefined\n}\n\nfunction getOrCreateReplayStats(viewId) {\n if (!statsPerView) {\n statsPerView = new Map()\n }\n\n var replayStats\n if (statsPerView.has(viewId)) {\n replayStats = statsPerView.get(viewId)\n } else {\n replayStats = {\n records_count: 0,\n segments_count: 0,\n segments_total_raw_size: 0\n }\n statsPerView.set(viewId, replayStats)\n if (statsPerView.size > MAX_STATS_HISTORY) {\n deleteOldestStats()\n }\n }\n\n return replayStats\n}\n\nexport function deleteOldestStats() {\n if (!statsPerView) {\n return\n }\n if (statsPerView.keys) {\n statsPerView.delete(statsPerView.keys().next().value)\n } else {\n // IE11 doesn't support map.keys\n var isFirst = true\n statsPerView.forEach(function (_value, key) {\n if (isFirst) {\n statsPerView.delete(key)\n isFirst = false\n }\n })\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAAO,IAAIA,iBAAiB,GAAAC,OAAA,CAAAD,iBAAA,GAAG,EAAE;AACjC,IAAIE,YAAY;AAET,SAASC,gBAAgBA,CAACC,MAAM,EAAE;EACvC,OAAOC,sBAAsB,CAACD,MAAM,CAAC,CAACE,cAAc;AACtD;AAEO,SAASC,UAAUA,CAACH,MAAM,EAAE;EACjCC,sBAAsB,CAACD,MAAM,CAAC,CAACE,cAAc,IAAI,CAAC;AACpD;AAEO,SAASE,SAASA,CAACJ,MAAM,EAAE;EAChCC,sBA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,EAAE;MAC1C,IAAIH,OAAO,EAAE;QACXxB,YAAY,UAAO,CAAC2B,GAAG,CAAC;QACxBH,OAAO,GAAG,KAAK;MACjB;IACF,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.buildReplayPayload = buildReplayPayload;
|
|
7
7
|
exports.toFormEntries = toFormEntries;
|
|
8
8
|
var _browserCore = require("@cloudcare/browser-core");
|
|
9
|
-
function _typeof(
|
|
9
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
10
10
|
function buildReplayPayload(data, metadata, rawSegmentBytesCount) {
|
|
11
11
|
var formData = new FormData();
|
|
12
12
|
formData.append('segment', new Blob([data], {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buildReplayPayload.js","names":["_browserCore","require","_typeof","
|
|
1
|
+
{"version":3,"file":"buildReplayPayload.js","names":["_browserCore","require","_typeof","o","Symbol","iterator","constructor","prototype","buildReplayPayload","data","metadata","rawSegmentBytesCount","formData","FormData","append","Blob","type","session","id","start","toFormEntries","key","value","bytesCount","byteLength","input","onEntry","prefix","undefined","each","objectEntries","item","String"],"sources":["../../../../src/domain/replay/segmentCollection/buildReplayPayload.js"],"sourcesContent":["import { objectEntries, each } from '@cloudcare/browser-core'\n\nexport function buildReplayPayload(data, metadata, rawSegmentBytesCount) {\n var formData = new FormData()\n formData.append(\n 'segment',\n new Blob([data], {\n type: 'application/octet-stream'\n }),\n metadata.session.id + '-' + metadata.start\n )\n\n toFormEntries(metadata, function (key, value) {\n formData.append(key, value)\n })\n formData.append('raw_segment_size', rawSegmentBytesCount)\n\n return { data: formData, bytesCount: data.byteLength }\n}\n\nexport function toFormEntries(input, onEntry, prefix) {\n if (prefix === undefined) {\n prefix = ''\n }\n each(objectEntries(input), function (item) {\n var value = item[1]\n var key = item[0]\n if (typeof value === 'object' && value !== null) {\n toFormEntries(value, onEntry, '' + prefix + key + '_')\n } else {\n onEntry('' + prefix + key, String(value))\n }\n })\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAA6D,SAAAC,QAAAC,CAAA,sCAAAD,OAAA,wBAAAE,MAAA,uBAAAA,MAAA,CAAAC,QAAA,aAAAF,CAAA,kBAAAA,CAAA,gBAAAA,CAAA,WAAAA,CAAA,yBAAAC,MAAA,IAAAD,CAAA,CAAAG,WAAA,KAAAF,MAAA,IAAAD,CAAA,KAAAC,MAAA,CAAAG,SAAA,qBAAAJ,CAAA,KAAAD,OAAA,CAAAC,CAAA;AAEtD,SAASK,kBAAkBA,CAACC,IAAI,EAAEC,QAAQ,EAAEC,oBAAoB,EAAE;EACvE,IAAIC,QAAQ,GAAG,IAAIC,QAAQ,CAAC,CAAC;EAC7BD,QAAQ,CAACE,MAAM,CACb,SAAS,EACT,IAAIC,IAAI,CAAC,CAACN,IAAI,CAAC,EAAE;IACfO,IAAI,EAAE;EACR,CAAC,CAAC,EACFN,QAAQ,CAACO,OAAO,CAACC,EAAE,GAAG,GAAG,GAAGR,QAAQ,CAACS,KACvC,CAAC;EAEDC,aAAa,CAACV,QAAQ,EAAE,UAAUW,GAAG,EAAEC,KAAK,EAAE;IAC5CV,QAAQ,CAACE,MAAM,CAACO,GAAG,EAAEC,KAAK,CAAC;EAC7B,CAAC,CAAC;EACFV,QAAQ,CAACE,MAAM,CAAC,kBAAkB,EAAEH,oBAAoB,CAAC;EAEzD,OAAO;IAAEF,IAAI,EAAEG,QAAQ;IAAEW,UAAU,EAAEd,IAAI,CAACe;EAAW,CAAC;AACxD;AAEO,SAASJ,aAAaA,CAACK,KAAK,EAAEC,OAAO,EAAEC,MAAM,EAAE;EACpD,IAAIA,MAAM,KAAKC,SAAS,EAAE;IACxBD,MAAM,GAAG,EAAE;EACb;EACA,IAAAE,iBAAI,EAAC,IAAAC,0BAAa,EAACL,KAAK,CAAC,EAAE,UAAUM,IAAI,EAAE;IACzC,IAAIT,KAAK,GAAGS,IAAI,CAAC,CAAC,CAAC;IACnB,IAAIV,GAAG,GAAGU,IAAI,CAAC,CAAC,CAAC;IACjB,IAAI7B,OAAA,CAAOoB,KAAK,MAAK,QAAQ,IAAIA,KAAK,KAAK,IAAI,EAAE;MAC/CF,aAAa,CAACE,KAAK,EAAEI,OAAO,EAAE,EAAE,GAAGC,MAAM,GAAGN,GAAG,GAAG,GAAG,CAAC;IACxD,CAAC,MAAM;MACLK,OAAO,CAAC,EAAE,GAAGC,MAAM,GAAGN,GAAG,EAAEW,MAAM,CAACV,KAAK,CAAC,CAAC;IAC3C;EACF,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
@@ -8,8 +8,8 @@ exports.createSegment = createSegment;
|
|
|
8
8
|
var _browserCore = require("@cloudcare/browser-core");
|
|
9
9
|
var _types = require("../../../types");
|
|
10
10
|
var replayStats = _interopRequireWildcard(require("../replayStats"));
|
|
11
|
-
function _getRequireWildcardCache(
|
|
12
|
-
function _interopRequireWildcard(
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
13
13
|
function createSegment(options) {
|
|
14
14
|
var context = options.context;
|
|
15
15
|
var creationReason = options.creationReason;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segment.js","names":["_browserCore","require","_types","replayStats","_interopRequireWildcard","_getRequireWildcardCache","
|
|
1
|
+
{"version":3,"file":"segment.js","names":["_browserCore","require","_types","replayStats","_interopRequireWildcard","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","createSegment","options","context","creationReason","encoder","encodedBytesCount","viewId","view","id","metadata","assign","start","Infinity","end","creation_reason","records_count","has_full_snapshot","index_in_view","getSegmentsCount","source","addSegment","addRecord","record","callback","Math","min","timestamp","max","type","RecordType","FullSnapshot","prefix","isEmpty","write","JSON","stringify","additionalEncodedBytesCount","flush","Error","slice","finish","encoderResult","addWroteData","rawBytesCount"],"sources":["../../../../src/domain/replay/segmentCollection/segment.js"],"sourcesContent":["import { assign } from '@cloudcare/browser-core'\nimport { RecordType } from '../../../types'\nimport * as replayStats from '../replayStats'\n\nexport function createSegment(options) {\n const context = options.context\n const creationReason = options.creationReason\n const encoder = options.encoder\n let encodedBytesCount = 0\n const viewId = context.view.id\n\n const metadata = assign(\n {\n start: Infinity,\n end: -Infinity,\n creation_reason: creationReason,\n records_count: 0,\n has_full_snapshot: false,\n index_in_view: replayStats.getSegmentsCount(viewId),\n source: 'browser'\n },\n context\n )\n replayStats.addSegment(viewId)\n function addRecord(record, callback) {\n metadata.start = Math.min(metadata.start, record.timestamp)\n metadata.end = Math.max(metadata.end, record.timestamp)\n metadata.records_count += 1\n if (!metadata.has_full_snapshot) {\n metadata.has_full_snapshot = record.type === RecordType.FullSnapshot\n }\n replayStats.addRecord(metadata.view.id)\n const prefix = encoder.isEmpty() ? '{\"records\":[' : ','\n encoder.write(\n prefix + JSON.stringify(record),\n function (additionalEncodedBytesCount) {\n encodedBytesCount += additionalEncodedBytesCount\n callback(encodedBytesCount)\n }\n )\n }\n function flush(callback) {\n if (encoder.isEmpty()) {\n throw new Error('Empty segment flushed')\n }\n encoder.write('],' + JSON.stringify(metadata).slice(1) + '\\n')\n encoder.finish(function (encoderResult) {\n replayStats.addWroteData(metadata.view.id, encoderResult.rawBytesCount)\n callback(metadata, encoderResult)\n })\n }\n return {\n addRecord: addRecord,\n flush: flush\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,uBAAA,CAAAH,OAAA;AAA6C,SAAAI,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAF,wBAAAE,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,gBAAAK,OAAA,CAAAL,CAAA,0BAAAA,CAAA,sBAAAA,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAA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LpB,SAAS,EAAEA,SAAS;IACpBgB,KAAK,EAAEA;EACT,CAAC;AACH","ignoreList":[]}
|
|
@@ -11,13 +11,12 @@ exports.startSegmentCollection = startSegmentCollection;
|
|
|
11
11
|
var _browserCore = require("@cloudcare/browser-core");
|
|
12
12
|
var _buildReplayPayload = require("./buildReplayPayload");
|
|
13
13
|
var _segment = require("./segment");
|
|
14
|
-
var SEGMENT_DURATION_LIMIT = 5 * _browserCore.ONE_SECOND;
|
|
14
|
+
var SEGMENT_DURATION_LIMIT = exports.SEGMENT_DURATION_LIMIT = 5 * _browserCore.ONE_SECOND;
|
|
15
15
|
/**
|
|
16
16
|
* beacon payload max queue size implementation is 64kb
|
|
17
17
|
* ensure that we leave room for logs, rum and potential other users
|
|
18
18
|
*/
|
|
19
|
-
exports.
|
|
20
|
-
var SEGMENT_BYTES_LIMIT = 60000;
|
|
19
|
+
var SEGMENT_BYTES_LIMIT = exports.SEGMENT_BYTES_LIMIT = 60000;
|
|
21
20
|
|
|
22
21
|
// Segments are the main data structure for session replays. They contain context information used
|
|
23
22
|
// for indexing or UI needs, and a list of records (RRWeb 'events', renamed to avoid confusing
|
|
@@ -43,21 +42,23 @@ var SEGMENT_BYTES_LIMIT = 60000;
|
|
|
43
42
|
//
|
|
44
43
|
// To help investigate session replays issues, each segment is created with a "creation reason",
|
|
45
44
|
// indicating why the session has been created.
|
|
46
|
-
|
|
45
|
+
|
|
47
46
|
function startSegmentCollection(lifeCycle, configuration, sessionManager, viewContexts, httpRequest, encoder) {
|
|
47
|
+
var isLocked = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
48
48
|
return doStartSegmentCollection(lifeCycle, function () {
|
|
49
49
|
return computeSegmentContext(configuration, sessionManager, viewContexts);
|
|
50
|
-
}, httpRequest, encoder);
|
|
50
|
+
}, httpRequest, encoder, isLocked);
|
|
51
51
|
}
|
|
52
52
|
var SegmentCollectionStatus = {
|
|
53
53
|
WaitingForInitialRecord: 0,
|
|
54
54
|
SegmentPending: 1,
|
|
55
55
|
Stopped: 2
|
|
56
56
|
};
|
|
57
|
-
function doStartSegmentCollection(lifeCycle, getSegmentContext, httpRequest, encoder) {
|
|
57
|
+
function doStartSegmentCollection(lifeCycle, getSegmentContext, httpRequest, encoder, isLocked) {
|
|
58
58
|
var state = {
|
|
59
59
|
status: SegmentCollectionStatus.WaitingForInitialRecord,
|
|
60
|
-
nextSegmentCreationReason: 'init'
|
|
60
|
+
nextSegmentCreationReason: 'init',
|
|
61
|
+
isLocked: isLocked
|
|
61
62
|
};
|
|
62
63
|
var subscribeViewCreated = lifeCycle.subscribe(_browserCore.LifeCycleEventType.VIEW_CREATED, function () {
|
|
63
64
|
flushSegment('view_change');
|
|
@@ -67,26 +68,40 @@ function doStartSegmentCollection(lifeCycle, getSegmentContext, httpRequest, enc
|
|
|
67
68
|
flushSegment(pageExitEvent.reason);
|
|
68
69
|
});
|
|
69
70
|
var unsubscribePageExited = subscribePageExited.unsubscribe;
|
|
70
|
-
|
|
71
|
+
var lockedFlushReason = ['view_change', 'buffer_checkout'];
|
|
72
|
+
function flushSegment(flushReason, callback) {
|
|
73
|
+
var isLocked = state.isLocked;
|
|
71
74
|
if (state.status === SegmentCollectionStatus.SegmentPending) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
if (isLocked && lockedFlushReason.includes(flushReason)) {
|
|
76
|
+
state.segment.flush(function () {
|
|
77
|
+
if (callback) callback();
|
|
78
|
+
});
|
|
79
|
+
} else {
|
|
80
|
+
// if the segment is locked, we don't send it
|
|
81
|
+
if (isLocked) {
|
|
82
|
+
return;
|
|
78
83
|
}
|
|
79
|
-
|
|
84
|
+
state.segment.flush(function (metadata, encoderResult) {
|
|
85
|
+
var payload = (0, _buildReplayPayload.buildReplayPayload)(encoderResult.output, metadata, encoderResult.rawBytesCount);
|
|
86
|
+
if ((0, _browserCore.isPageExitReason)(flushReason)) {
|
|
87
|
+
httpRequest.sendOnExit(payload);
|
|
88
|
+
} else {
|
|
89
|
+
httpRequest.send(payload);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
80
93
|
(0, _browserCore.clearTimeout)(state.expirationTimeoutId);
|
|
81
94
|
}
|
|
82
95
|
if (flushReason !== 'stop') {
|
|
83
96
|
state = {
|
|
84
97
|
status: SegmentCollectionStatus.WaitingForInitialRecord,
|
|
85
|
-
nextSegmentCreationReason: flushReason
|
|
98
|
+
nextSegmentCreationReason: flushReason,
|
|
99
|
+
isLocked: state.isLocked
|
|
86
100
|
};
|
|
87
101
|
} else {
|
|
88
102
|
state = {
|
|
89
|
-
status: SegmentCollectionStatus.Stopped
|
|
103
|
+
status: SegmentCollectionStatus.Stopped,
|
|
104
|
+
isLocked: false
|
|
90
105
|
};
|
|
91
106
|
}
|
|
92
107
|
}
|
|
@@ -107,6 +122,7 @@ function doStartSegmentCollection(lifeCycle, getSegmentContext, httpRequest, enc
|
|
|
107
122
|
context: context,
|
|
108
123
|
creationReason: state.nextSegmentCreationReason
|
|
109
124
|
}),
|
|
125
|
+
isLocked: state.isLocked,
|
|
110
126
|
expirationTimeoutId: (0, _browserCore.setTimeout)(function () {
|
|
111
127
|
flushSegment('segment_duration_limit');
|
|
112
128
|
}, SEGMENT_DURATION_LIMIT)
|
|
@@ -118,6 +134,15 @@ function doStartSegmentCollection(lifeCycle, getSegmentContext, httpRequest, enc
|
|
|
118
134
|
}
|
|
119
135
|
});
|
|
120
136
|
},
|
|
137
|
+
unlockSegment: function unlockSegment() {
|
|
138
|
+
state.isLocked = false;
|
|
139
|
+
},
|
|
140
|
+
flushBufferSegment: function flushBufferSegment(callback) {
|
|
141
|
+
flushSegment('buffer_checkout', callback);
|
|
142
|
+
},
|
|
143
|
+
isLocked: function isLocked() {
|
|
144
|
+
return state.isLocked;
|
|
145
|
+
},
|
|
121
146
|
stop: function stop() {
|
|
122
147
|
flushSegment('stop');
|
|
123
148
|
unsubscribeViewCreated();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segmentCollection.js","names":["_browserCore","require","_buildReplayPayload","_segment","SEGMENT_DURATION_LIMIT","ONE_SECOND","exports","SEGMENT_BYTES_LIMIT","startSegmentCollection","lifeCycle","configuration","sessionManager","viewContexts","httpRequest","encoder","doStartSegmentCollection","computeSegmentContext","SegmentCollectionStatus","WaitingForInitialRecord","SegmentPending","Stopped","getSegmentContext","state","status","nextSegmentCreationReason","subscribeViewCreated","subscribe","LifeCycleEventType","VIEW_CREATED","flushSegment","unsubscribeViewCreated","unsubscribe","subscribePageExited","PAGE_EXITED","pageExitEvent","reason","unsubscribePageExited","flushReason","segment","flush","metadata","encoderResult","payload","buildReplayPayload","output","rawBytesCount","isPageExitReason","sendOnExit","send","clearTimeout","expirationTimeoutId","addRecord","record","context","createSegment","creationReason","setTimeout","encodedBytesCount","stop","session","findTrackedSession","viewContext","findView","undefined","sdk","name","sdkName","version","sdkVersion","env","service","app","id","applicationId","view","setSegmentBytesLimit","newSegmentBytesLimit","arguments","length"],"sources":["../../../../src/domain/replay/segmentCollection/segmentCollection.js"],"sourcesContent":["import {\n ONE_SECOND,\n LifeCycleEventType,\n isPageExitReason,\n setTimeout,\n clearTimeout\n} from '@cloudcare/browser-core'\nimport { buildReplayPayload } from './buildReplayPayload'\nimport { createSegment } from './segment'\n\nexport var SEGMENT_DURATION_LIMIT = 5 * ONE_SECOND\n/**\n * beacon payload max queue size implementation is 64kb\n * ensure that we leave room for logs, rum and potential other users\n */\nexport var SEGMENT_BYTES_LIMIT = 60000\n\n// Segments are the main data structure for session replays. They contain context information used\n// for indexing or UI needs, and a list of records (RRWeb 'events', renamed to avoid confusing\n// namings). They are stored without any processing from the intake, and fetched one after the\n// other while a session is being replayed. Their encoding (deflate) are carefully crafted to allow\n// concatenating multiple segments together. Segments have a size overhead (metadata), so our goal is to\n// build segments containing as many records as possible while complying with the various flush\n// strategies to guarantee a good replay quality.\n//\n// When the recording starts, a segment is initially created. The segment is flushed (finalized and\n// sent) based on various events (non-exhaustive list):\n//\n// * the page visibility change or becomes to unload\n// * the segment duration reaches a limit\n// * the encoded segment bytes count reaches a limit\n// * ...\n//\n// A segment cannot be created without its context. If the RUM session ends and no session id is\n// available when creating a new segment, records will be ignored, until the session is renewed and\n// a new session id is available.\n//\n// Empty segments (segments with no record) aren't useful and should be ignored.\n//\n// To help investigate session replays issues, each segment is created with a \"creation reason\",\n// indicating why the session has been created.\n\nexport function startSegmentCollection(\n lifeCycle,\n configuration,\n sessionManager,\n viewContexts,\n httpRequest,\n encoder\n) {\n return doStartSegmentCollection(\n lifeCycle,\n function () {\n return computeSegmentContext(configuration, sessionManager, viewContexts)\n },\n httpRequest,\n encoder\n )\n}\n\nvar SegmentCollectionStatus = {\n WaitingForInitialRecord: 0,\n SegmentPending: 1,\n Stopped: 2\n}\n\nexport function doStartSegmentCollection(\n lifeCycle,\n getSegmentContext,\n httpRequest,\n encoder\n) {\n var state = {\n status: SegmentCollectionStatus.WaitingForInitialRecord,\n nextSegmentCreationReason: 'init'\n }\n var subscribeViewCreated = lifeCycle.subscribe(\n LifeCycleEventType.VIEW_CREATED,\n function () {\n flushSegment('view_change')\n }\n )\n var unsubscribeViewCreated = subscribeViewCreated.unsubscribe\n var subscribePageExited = lifeCycle.subscribe(\n LifeCycleEventType.PAGE_EXITED,\n function (pageExitEvent) {\n flushSegment(pageExitEvent.reason)\n }\n )\n var unsubscribePageExited = subscribePageExited.unsubscribe\n\n function flushSegment(flushReason) {\n if (state.status === SegmentCollectionStatus.SegmentPending) {\n state.segment.flush(function (metadata, encoderResult) {\n var payload = buildReplayPayload(\n encoderResult.output,\n metadata,\n encoderResult.rawBytesCount\n )\n\n if (isPageExitReason(flushReason)) {\n httpRequest.sendOnExit(payload)\n } else {\n httpRequest.send(payload)\n }\n })\n clearTimeout(state.expirationTimeoutId)\n }\n\n if (flushReason !== 'stop') {\n state = {\n status: SegmentCollectionStatus.WaitingForInitialRecord,\n nextSegmentCreationReason: flushReason\n }\n } else {\n state = {\n status: SegmentCollectionStatus.Stopped\n }\n }\n }\n\n return {\n addRecord: function (record) {\n if (state.status === SegmentCollectionStatus.Stopped) {\n return\n }\n\n if (state.status === SegmentCollectionStatus.WaitingForInitialRecord) {\n var context = getSegmentContext()\n if (!context) {\n return\n }\n\n state = {\n status: SegmentCollectionStatus.SegmentPending,\n segment: createSegment({\n encoder: encoder,\n context: context,\n creationReason: state.nextSegmentCreationReason\n }),\n expirationTimeoutId: setTimeout(function () {\n flushSegment('segment_duration_limit')\n }, SEGMENT_DURATION_LIMIT)\n }\n }\n\n state.segment.addRecord(record, function (encodedBytesCount) {\n if (encodedBytesCount > SEGMENT_BYTES_LIMIT) {\n flushSegment('segment_bytes_limit')\n }\n })\n },\n\n stop: function () {\n flushSegment('stop')\n unsubscribeViewCreated()\n unsubscribePageExited()\n }\n }\n}\n\nexport function computeSegmentContext(\n configuration,\n sessionManager,\n viewContexts\n) {\n var session = sessionManager.findTrackedSession()\n var viewContext = viewContexts.findView()\n if (!session || !viewContext) {\n return undefined\n }\n return {\n sdk: {\n name: configuration.sdkName,\n version: configuration.sdkVersion\n },\n env: configuration.env || '',\n service: viewContext.service || configuration.service || 'browser',\n version: viewContext.version || configuration.version || '',\n app: {\n id: configuration.applicationId\n },\n session: {\n id: session.id\n },\n view: {\n id: viewContext.id\n }\n }\n}\n\nexport function setSegmentBytesLimit(newSegmentBytesLimit = 60_000) {\n SEGMENT_BYTES_LIMIT = newSegmentBytesLimit\n}\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAOA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAEO,IAAIG,sBAAsB,GAAG,CAAC,GAAGC,uBAAU;AAClD;AACA;AACA;AACA;AAHAC,OAAA,CAAAF,sBAAA,GAAAA,sBAAA;AAIO,IAAIG,mBAAmB,GAAG,KAAK;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;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AAA,QAAAD,SAAA,QAAAd,SAAA,GAAAc,SAAA,MAAG,KAAM;EAChEvE,OAAA,CAAAC,mBAAA,GAAAA,mBAAmB,GAAGqE,oBAAoB;AAC5C","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"segmentCollection.js","names":["_browserCore","require","_buildReplayPayload","_segment","SEGMENT_DURATION_LIMIT","exports","ONE_SECOND","SEGMENT_BYTES_LIMIT","startSegmentCollection","lifeCycle","configuration","sessionManager","viewContexts","httpRequest","encoder","isLocked","arguments","length","undefined","doStartSegmentCollection","computeSegmentContext","SegmentCollectionStatus","WaitingForInitialRecord","SegmentPending","Stopped","getSegmentContext","state","status","nextSegmentCreationReason","subscribeViewCreated","subscribe","LifeCycleEventType","VIEW_CREATED","flushSegment","unsubscribeViewCreated","unsubscribe","subscribePageExited","PAGE_EXITED","pageExitEvent","reason","unsubscribePageExited","lockedFlushReason","flushReason","callback","includes","segment","flush","metadata","encoderResult","payload","buildReplayPayload","output","rawBytesCount","isPageExitReason","sendOnExit","send","clearTimeout","expirationTimeoutId","addRecord","record","context","createSegment","creationReason","setTimeout","encodedBytesCount","unlockSegment","flushBufferSegment","stop","session","findTrackedSession","viewContext","findView","sdk","name","sdkName","version","sdkVersion","env","service","app","id","applicationId","view","setSegmentBytesLimit","newSegmentBytesLimit"],"sources":["../../../../src/domain/replay/segmentCollection/segmentCollection.js"],"sourcesContent":["import {\n ONE_SECOND,\n LifeCycleEventType,\n isPageExitReason,\n setTimeout,\n clearTimeout\n} from '@cloudcare/browser-core'\nimport { buildReplayPayload } from './buildReplayPayload'\nimport { createSegment } from './segment'\n\nexport var SEGMENT_DURATION_LIMIT = 5 * ONE_SECOND\n/**\n * beacon payload max queue size implementation is 64kb\n * ensure that we leave room for logs, rum and potential other users\n */\nexport var SEGMENT_BYTES_LIMIT = 60000\n\n// Segments are the main data structure for session replays. They contain context information used\n// for indexing or UI needs, and a list of records (RRWeb 'events', renamed to avoid confusing\n// namings). They are stored without any processing from the intake, and fetched one after the\n// other while a session is being replayed. Their encoding (deflate) are carefully crafted to allow\n// concatenating multiple segments together. Segments have a size overhead (metadata), so our goal is to\n// build segments containing as many records as possible while complying with the various flush\n// strategies to guarantee a good replay quality.\n//\n// When the recording starts, a segment is initially created. The segment is flushed (finalized and\n// sent) based on various events (non-exhaustive list):\n//\n// * the page visibility change or becomes to unload\n// * the segment duration reaches a limit\n// * the encoded segment bytes count reaches a limit\n// * ...\n//\n// A segment cannot be created without its context. If the RUM session ends and no session id is\n// available when creating a new segment, records will be ignored, until the session is renewed and\n// a new session id is available.\n//\n// Empty segments (segments with no record) aren't useful and should be ignored.\n//\n// To help investigate session replays issues, each segment is created with a \"creation reason\",\n// indicating why the session has been created.\n\nexport function startSegmentCollection(\n lifeCycle,\n configuration,\n sessionManager,\n viewContexts,\n httpRequest,\n encoder,\n isLocked = false\n) {\n return doStartSegmentCollection(\n lifeCycle,\n function () {\n return computeSegmentContext(configuration, sessionManager, viewContexts)\n },\n httpRequest,\n encoder,\n isLocked\n )\n}\n\nvar SegmentCollectionStatus = {\n WaitingForInitialRecord: 0,\n SegmentPending: 1,\n Stopped: 2\n}\n\nexport function doStartSegmentCollection(\n lifeCycle,\n getSegmentContext,\n httpRequest,\n encoder,\n isLocked\n) {\n var state = {\n status: SegmentCollectionStatus.WaitingForInitialRecord,\n nextSegmentCreationReason: 'init',\n isLocked: isLocked\n }\n var subscribeViewCreated = lifeCycle.subscribe(\n LifeCycleEventType.VIEW_CREATED,\n function () {\n flushSegment('view_change')\n }\n )\n var unsubscribeViewCreated = subscribeViewCreated.unsubscribe\n var subscribePageExited = lifeCycle.subscribe(\n LifeCycleEventType.PAGE_EXITED,\n function (pageExitEvent) {\n flushSegment(pageExitEvent.reason)\n }\n )\n var unsubscribePageExited = subscribePageExited.unsubscribe\n const lockedFlushReason = ['view_change', 'buffer_checkout']\n function flushSegment(flushReason, callback) {\n const isLocked = state.isLocked\n if (state.status === SegmentCollectionStatus.SegmentPending) {\n if (isLocked && lockedFlushReason.includes(flushReason)) {\n state.segment.flush(() => {\n if (callback) callback()\n })\n } else {\n // if the segment is locked, we don't send it\n if (isLocked) {\n return\n }\n state.segment.flush(function (metadata, encoderResult) {\n var payload = buildReplayPayload(\n encoderResult.output,\n metadata,\n encoderResult.rawBytesCount\n )\n\n if (isPageExitReason(flushReason)) {\n httpRequest.sendOnExit(payload)\n } else {\n httpRequest.send(payload)\n }\n })\n }\n clearTimeout(state.expirationTimeoutId)\n }\n\n if (flushReason !== 'stop') {\n state = {\n status: SegmentCollectionStatus.WaitingForInitialRecord,\n nextSegmentCreationReason: flushReason,\n isLocked: state.isLocked\n }\n } else {\n state = {\n status: SegmentCollectionStatus.Stopped,\n isLocked: false\n }\n }\n }\n\n return {\n addRecord: function (record) {\n if (state.status === SegmentCollectionStatus.Stopped) {\n return\n }\n\n if (state.status === SegmentCollectionStatus.WaitingForInitialRecord) {\n var context = getSegmentContext()\n if (!context) {\n return\n }\n\n state = {\n status: SegmentCollectionStatus.SegmentPending,\n segment: createSegment({\n encoder: encoder,\n context: context,\n creationReason: state.nextSegmentCreationReason\n }),\n isLocked: state.isLocked,\n expirationTimeoutId: setTimeout(function () {\n flushSegment('segment_duration_limit')\n }, SEGMENT_DURATION_LIMIT)\n }\n }\n\n state.segment.addRecord(record, function (encodedBytesCount) {\n if (encodedBytesCount > SEGMENT_BYTES_LIMIT) {\n flushSegment('segment_bytes_limit')\n }\n })\n },\n\n unlockSegment: function () {\n state.isLocked = false\n },\n flushBufferSegment: function (callback) {\n flushSegment('buffer_checkout', callback)\n },\n isLocked: function () {\n return state.isLocked\n },\n stop: function () {\n flushSegment('stop')\n unsubscribeViewCreated()\n unsubscribePageExited()\n }\n }\n}\n\nexport function computeSegmentContext(\n configuration,\n sessionManager,\n viewContexts\n) {\n var session = sessionManager.findTrackedSession()\n var viewContext = viewContexts.findView()\n if (!session || !viewContext) {\n return undefined\n }\n return {\n sdk: {\n name: configuration.sdkName,\n version: configuration.sdkVersion\n },\n env: configuration.env || '',\n service: viewContext.service || configuration.service || 'browser',\n version: viewContext.version || configuration.version || '',\n app: {\n id: configuration.applicationId\n },\n session: {\n id: session.id\n },\n view: {\n id: viewContext.id\n }\n }\n}\n\nexport function setSegmentBytesLimit(newSegmentBytesLimit = 60_000) {\n SEGMENT_BYTES_LIMIT = newSegmentBytesLimit\n}\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAOA,IAAAC,mBAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAEO,IAAIG,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG,CAAC,GAAGE,uBAAU;AAClD;AACA;AACA;AACA;AACO,IAAIC,mBAAmB,GAAAF,OAAA,CAAAE,mBAAA,GAAG,KAAK;;AAEtC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,SAASC,sBAAsBA,CACpCC,SAAS,EACTC,aAAa,EACbC,cAAc,EACdC,YAAY,EACZC,WAAW,EACXC,OAAO,EAEP;EAAA,IADAC,QAAQ,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,KAAK;EAEhB,OAAOG,wBAAwB,CAC7BV,SAAS,EACT,YAAY;IACV,OAAOW,qBAAqB,CAACV,aAAa,EAAEC,cAAc,EAAEC,YAAY,CAAC;EAC3E,CAAC,EACDC,WAAW,EACXC,OAAO,EACPC,QACF,CAAC;AACH;AAEA,IAAIM,uBAAuB,GAAG;EAC5BC,uBAAuB,EAAE,CAAC;EAC1BC,cAAc,EAAE,CAAC;EACjBC,OAAO,EAAE;AACX,CAAC;AAEM,SAASL,wBAAwBA,CACtCV,SAAS,EACTgB,iBAAiB,EACjBZ,WAAW,EACXC,OAAO,EACPC,QAAQ,EACR;EACA,IAAIW,KAAK,GAAG;IACVC,MAAM,EAAEN,uB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IACpB,CAAC;IACDb,OAAO,EAAE;MACPY,EAAE,EAAEZ,OAAO,CAACY;IACd,CAAC;IACDE,IAAI,EAAE;MACJF,EAAE,EAAEV,WAAW,CAACU;IAClB;EACF,CAAC;AACH;AAEO,SAASG,oBAAoBA,CAAA,EAAgC;EAAA,IAA/BC,oBAAoB,GAAApE,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,KAAM;EAChEX,OAAA,CAAAE,mBAAA,GAAAA,mBAAmB,GAAG6E,oBAAoB;AAC5C","ignoreList":[]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.startRecordBridge = startRecordBridge;
|
|
7
|
+
var _browserCore = require("@cloudcare/browser-core");
|
|
8
|
+
function startRecordBridge(viewHistory) {
|
|
9
|
+
var bridge = (0, _browserCore.getEventBridge)();
|
|
10
|
+
return {
|
|
11
|
+
addRecord: function addRecord(record) {
|
|
12
|
+
// Get the current active view, not at the time of the record, aligning with the segment logic.
|
|
13
|
+
// This approach could potentially associate the record to an incorrect view, in case the record date is in the past (e.g. frustration records).
|
|
14
|
+
var view = viewHistory.findView();
|
|
15
|
+
bridge.send('session_replay', record, view.id);
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=startRecordBridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startRecordBridge.js","names":["_browserCore","require","startRecordBridge","viewHistory","bridge","getEventBridge","addRecord","record","view","findView","send","id"],"sources":["../../../src/domain/replay/startRecordBridge.js"],"sourcesContent":["import { getEventBridge } from '@cloudcare/browser-core'\n\nexport function startRecordBridge(viewHistory) {\n const bridge = getEventBridge()\n\n return {\n addRecord: (record) => {\n // Get the current active view, not at the time of the record, aligning with the segment logic.\n // This approach could potentially associate the record to an incorrect view, in case the record date is in the past (e.g. frustration records).\n const view = viewHistory.findView()\n bridge.send('session_replay', record, view.id)\n }\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEO,SAASC,iBAAiBA,CAACC,WAAW,EAAE;EAC7C,IAAMC,MAAM,GAAG,IAAAC,2BAAc,EAAC,CAAC;EAE/B,OAAO;IACLC,SAAS,EAAE,SAAXA,SAASA,CAAGC,MAAM,EAAK;MACrB;MACA;MACA,IAAMC,IAAI,GAAGL,WAAW,CAACM,QAAQ,CAAC,CAAC;MACnCL,MAAM,CAACM,IAAI,CAAC,gBAAgB,EAAEH,MAAM,EAAEC,IAAI,CAACG,EAAE,CAAC;IAChD;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestCollection.js","names":["_browserCore","require","_resourceUtils","_tracer","nextRequestIndex","startRequestCollection","lifeCycle","configuration","sessionManager","tracer","startTracer","trackXhr","trackFetch","subscription","initXhrObservable","subscribe","rawContext","context","isAllowedRequestUrl","url","state","traceXhr","xhr","requestIndex","getNextRequestIndex","notify","LifeCycleEventType","REQUEST_STARTED","clearTracingIfNeeded","REQUEST_COMPLETED","duration","method","spanId","startClocks","status","traceId","traceSampled","type","RequestType","XHR","isAborted","handlingStack","stop","unsubscribe","initFetchObservable","traceFetch","waitForResponseToComplete","responseType","FETCH","response","init","input","result","callback","clonedResponse","tryToClone","body","elapsed","timeStamp","timeStampNow","readBytesFromStream","bytesLimit","Number","POSITIVE_INFINITY","collectStreamBody"],"sources":["../../src/domain/requestCollection.js"],"sourcesContent":["import {\n RequestType,\n initFetchObservable,\n initXhrObservable,\n LifeCycleEventType,\n tryToClone,\n readBytesFromStream,\n elapsed,\n timeStampNow\n} from '@cloudcare/browser-core'\nimport { isAllowedRequestUrl } from './rumEventsCollection/resource/resourceUtils'\nimport { startTracer } from './tracing/tracer'\n\nvar nextRequestIndex = 1\n\nexport function startRequestCollection(\n lifeCycle,\n configuration,\n sessionManager\n) {\n var tracer = startTracer(configuration, sessionManager)\n trackXhr(lifeCycle, configuration, tracer)\n trackFetch(lifeCycle, configuration, tracer)\n}\n\nexport function trackXhr(lifeCycle, configuration, tracer) {\n var subscription = initXhrObservable().subscribe(function (rawContext) {\n var context = rawContext\n if (!isAllowedRequestUrl(configuration, context.url)) {\n return\n }\n\n switch (context.state) {\n case 'start':\n tracer.traceXhr(context, context.xhr)\n context.requestIndex = getNextRequestIndex()\n\n lifeCycle.notify(LifeCycleEventType.REQUEST_STARTED, {\n requestIndex: context.requestIndex,\n url: context.url\n })\n break\n case 'complete':\n tracer.clearTracingIfNeeded(context)\n lifeCycle.notify(LifeCycleEventType.REQUEST_COMPLETED, {\n duration: context.duration,\n method: context.method,\n requestIndex: context.requestIndex,\n spanId: context.spanId,\n startClocks: context.startClocks,\n status: context.status,\n traceId: context.traceId,\n traceSampled: context.traceSampled,\n type: RequestType.XHR,\n url: context.url,\n xhr: context.xhr,\n isAborted: context.isAborted,\n handlingStack: context.handlingStack\n })\n break\n }\n })\n\n return {\n stop: function () {\n return subscription.unsubscribe()\n }\n }\n}\n\nexport function trackFetch(lifeCycle, configuration, tracer) {\n var subscription = initFetchObservable().subscribe(function (rawContext) {\n var context = rawContext\n if (!isAllowedRequestUrl(configuration, context.url)) {\n return\n }\n\n switch (context.state) {\n case 'start':\n tracer.traceFetch(context)\n context.requestIndex = getNextRequestIndex()\n\n lifeCycle.notify(LifeCycleEventType.REQUEST_STARTED, {\n requestIndex: context.requestIndex,\n url: context.url\n })\n break\n case 'resolve':\n waitForResponseToComplete(context, function (duration) {\n tracer.clearTracingIfNeeded(context)\n lifeCycle.notify(LifeCycleEventType.REQUEST_COMPLETED, {\n duration: duration,\n method: context.method,\n requestIndex: context.requestIndex,\n responseType: context.responseType,\n spanId: context.spanId,\n startClocks: context.startClocks,\n status: context.status,\n traceId: context.traceId,\n traceSampled: context.traceSampled,\n type: RequestType.FETCH,\n url: context.url,\n response: context.response,\n init: context.init,\n input: context.input,\n isAborted: context.isAborted,\n handlingStack: context.handlingStack\n })\n })\n break\n }\n })\n return {\n stop: function () {\n return subscription.unsubscribe()\n }\n }\n}\n\nfunction getNextRequestIndex() {\n var result = nextRequestIndex\n nextRequestIndex += 1\n return result\n}\n\nfunction waitForResponseToComplete(context, callback) {\n var clonedResponse = context.response && tryToClone(context.response)\n if (!clonedResponse || !clonedResponse.body) {\n // do not try to wait for the response if the clone failed, fetch error or null body\n callback(elapsed(context.startClocks.timeStamp, timeStampNow()))\n } else {\n readBytesFromStream(\n clonedResponse.body,\n function () {\n callback(elapsed(context.startClocks.timeStamp, timeStampNow()))\n },\n {\n bytesLimit: Number.POSITIVE_INFINITY,\n collectStreamBody: false\n }\n )\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAUA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEA,IAAIG,gBAAgB,GAAG,CAAC;AAEjB,SAASC,sBAAsBA,CACpCC,SAAS,EACTC,aAAa,EACbC,cAAc,EACd;EACA,IAAIC,MAAM,GAAG,IAAAC,mBAAW,EAACH,aAAa,EAAEC,cAAc,CAAC;EACvDG,QAAQ,CAACL,SAAS,EAAEC,aAAa,EAAEE,MAAM,CAAC;EAC1CG,UAAU,CAACN,SAAS,EAAEC,aAAa,EAAEE,MAAM,CAAC;AAC9C;AAEO,SAASE,QAAQA,CAACL,SAAS,EAAEC,aAAa,EAAEE,MAAM,EAAE;EACzD,IAAII,YAAY,GAAG,IAAAC,8BAAiB,EAAC,CAAC,CAACC,SAAS,CAAC,UAAUC,UAAU,EAAE;IACrE,IAAIC,OAAO,GAAGD,UAAU;IACxB,IAAI,CAAC,IAAAE,kCAAmB,EAACX,aAAa,EAAEU,OAAO,CAACE,GAAG,CAAC,EAAE;MACpD;IACF;IAEA,QAAQF,OAAO,CAACG,KAAK;MACnB,KAAK,OAAO;QACVX,MAAM,CAACY,QAAQ,CAACJ,OAAO,EAAEA,OAAO,CAACK,GAAG,CAAC;QACrCL,OAAO,CAACM,YAAY,GAAGC,mBAAmB,CAAC,CAAC;QAE5ClB,SAAS,CAACmB,MAAM,CAACC,+BAAkB,CAACC,eAAe,EAAE;UACnDJ,YAAY,EAAEN,OAAO,CAACM,YAAY;UAClCJ,GAAG,EAAEF,OAAO,CAACE;QACf,CAAC,CAAC;QACF;MACF,KAAK,UAAU;QACbV,MAAM,CAACmB,oBAAoB,CAACX,OAAO,CAAC;QACpCX,SAAS,CAACmB,MAAM,CAACC,+BAAkB,CAACG,iBAAiB,EAAE;UACrDC,QAAQ,EAAEb,OAAO,CAACa,QAAQ;UAC1BC,MAAM,EAAEd,OAAO,CAACc,MAAM;UACtBR,YAAY,EAAEN,OAAO,CAACM,YAAY;UAClCS,MAAM,EAAEf,OAAO,CAACe,MAAM;UACtBC,WAAW,EAAEhB,OAAO,CAACgB,WAAW;UAChCC,MAAM,EAAEjB,OAAO,CAACiB,MAAM;UACtBC,OAAO,EAAElB,OAAO,CAACkB,OAAO;UACxBC,YAAY,EAAEnB,OAAO,CAACmB,YAAY;UAClCC,IAAI,EAAEC,wBAAW,CAACC,GAAG;UACrBpB,GAAG,EAAEF,OAAO,CAACE,GAAG;UAChBG,GAAG,EAAEL,OAAO,CAACK,GAAG;UAChBkB,SAAS,EAAEvB,OAAO,CAACuB,SAAS;UAC5BC,aAAa,EAAExB,OAAO,CAACwB;QACzB,CAAC,CAAC;QACF;IACJ;EACF,CAAC,CAAC;EAEF,OAAO;IACLC,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"requestCollection.js","names":["_browserCore","require","_resourceUtils","_tracer","nextRequestIndex","startRequestCollection","lifeCycle","configuration","sessionManager","tracer","startTracer","trackXhr","trackFetch","subscription","initXhrObservable","subscribe","rawContext","context","isAllowedRequestUrl","url","state","traceXhr","xhr","requestIndex","getNextRequestIndex","notify","LifeCycleEventType","REQUEST_STARTED","clearTracingIfNeeded","REQUEST_COMPLETED","duration","method","spanId","startClocks","status","traceId","traceSampled","type","RequestType","XHR","isAborted","handlingStack","stop","unsubscribe","initFetchObservable","traceFetch","waitForResponseToComplete","responseType","FETCH","response","init","input","result","callback","clonedResponse","tryToClone","body","elapsed","timeStamp","timeStampNow","readBytesFromStream","bytesLimit","Number","POSITIVE_INFINITY","collectStreamBody"],"sources":["../../src/domain/requestCollection.js"],"sourcesContent":["import {\n RequestType,\n initFetchObservable,\n initXhrObservable,\n LifeCycleEventType,\n tryToClone,\n readBytesFromStream,\n elapsed,\n timeStampNow\n} from '@cloudcare/browser-core'\nimport { isAllowedRequestUrl } from './rumEventsCollection/resource/resourceUtils'\nimport { startTracer } from './tracing/tracer'\n\nvar nextRequestIndex = 1\n\nexport function startRequestCollection(\n lifeCycle,\n configuration,\n sessionManager\n) {\n var tracer = startTracer(configuration, sessionManager)\n trackXhr(lifeCycle, configuration, tracer)\n trackFetch(lifeCycle, configuration, tracer)\n}\n\nexport function trackXhr(lifeCycle, configuration, tracer) {\n var subscription = initXhrObservable().subscribe(function (rawContext) {\n var context = rawContext\n if (!isAllowedRequestUrl(configuration, context.url)) {\n return\n }\n\n switch (context.state) {\n case 'start':\n tracer.traceXhr(context, context.xhr)\n context.requestIndex = getNextRequestIndex()\n\n lifeCycle.notify(LifeCycleEventType.REQUEST_STARTED, {\n requestIndex: context.requestIndex,\n url: context.url\n })\n break\n case 'complete':\n tracer.clearTracingIfNeeded(context)\n lifeCycle.notify(LifeCycleEventType.REQUEST_COMPLETED, {\n duration: context.duration,\n method: context.method,\n requestIndex: context.requestIndex,\n spanId: context.spanId,\n startClocks: context.startClocks,\n status: context.status,\n traceId: context.traceId,\n traceSampled: context.traceSampled,\n type: RequestType.XHR,\n url: context.url,\n xhr: context.xhr,\n isAborted: context.isAborted,\n handlingStack: context.handlingStack\n })\n break\n }\n })\n\n return {\n stop: function () {\n return subscription.unsubscribe()\n }\n }\n}\n\nexport function trackFetch(lifeCycle, configuration, tracer) {\n var subscription = initFetchObservable().subscribe(function (rawContext) {\n var context = rawContext\n if (!isAllowedRequestUrl(configuration, context.url)) {\n return\n }\n\n switch (context.state) {\n case 'start':\n tracer.traceFetch(context)\n context.requestIndex = getNextRequestIndex()\n\n lifeCycle.notify(LifeCycleEventType.REQUEST_STARTED, {\n requestIndex: context.requestIndex,\n url: context.url\n })\n break\n case 'resolve':\n waitForResponseToComplete(context, function (duration) {\n tracer.clearTracingIfNeeded(context)\n lifeCycle.notify(LifeCycleEventType.REQUEST_COMPLETED, {\n duration: duration,\n method: context.method,\n requestIndex: context.requestIndex,\n responseType: context.responseType,\n spanId: context.spanId,\n startClocks: context.startClocks,\n status: context.status,\n traceId: context.traceId,\n traceSampled: context.traceSampled,\n type: RequestType.FETCH,\n url: context.url,\n response: context.response,\n init: context.init,\n input: context.input,\n isAborted: context.isAborted,\n handlingStack: context.handlingStack\n })\n })\n break\n }\n })\n return {\n stop: function () {\n return subscription.unsubscribe()\n }\n }\n}\n\nfunction getNextRequestIndex() {\n var result = nextRequestIndex\n nextRequestIndex += 1\n return result\n}\n\nfunction waitForResponseToComplete(context, callback) {\n var clonedResponse = context.response && tryToClone(context.response)\n if (!clonedResponse || !clonedResponse.body) {\n // do not try to wait for the response if the clone failed, fetch error or null body\n callback(elapsed(context.startClocks.timeStamp, timeStampNow()))\n } else {\n readBytesFromStream(\n clonedResponse.body,\n function () {\n callback(elapsed(context.startClocks.timeStamp, timeStampNow()))\n },\n {\n bytesLimit: Number.POSITIVE_INFINITY,\n collectStreamBody: false\n }\n )\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAUA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEA,IAAIG,gBAAgB,GAAG,CAAC;AAEjB,SAASC,sBAAsBA,CACpCC,SAAS,EACTC,aAAa,EACbC,cAAc,EACd;EACA,IAAIC,MAAM,GAAG,IAAAC,mBAAW,EAACH,aAAa,E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YAAY;MACVH,QAAQ,CAAC,IAAAI,oBAAO,EAACxC,OAAO,CAACgB,WAAW,CAACyB,SAAS,EAAE,IAAAC,yBAAY,EAAC,CAAC,CAAC,CAAC;IAClE,CAAC,EACD;MACEE,UAAU,EAAEC,MAAM,CAACC,iBAAiB;MACpCC,iBAAiB,EAAE;IACrB,CACF,CAAC;EACH;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actionCollection.js","names":["_browserCore","require","_trackClickActions","_pageStateHistory","startActionCollection","lifeCycle","domMutationObservable","configuration","pageStateHistory","subscribe","LifeCycleEventType","AUTO_ACTION_COMPLETED","action","notify","RAW_RUM_EVENT_COLLECTED","processAction","actionContexts","findActionId","noop","findAllActionId","trackUserInteractions","trackClickActions","addAction","savedCommonContext","extend","autoActionProperties","isAutoAction","error","count","counts","errorCount","id","loadingTime","discardNegativeDuration","toServerDuration","duration","frustration","type","frustrationTypes","long_task","longTaskCount","resource","resourceCount","_gc","target","position","customerContext","context","undefined","actionEvent","extend2Lev","UUID","name","date","startClocks","timeStamp","RumEventType","ACTION","view","in_foreground","wasInPageStateAt","PageState","ACTIVE","relative","rawRumEvent","startTime","domainContext","event","events","ActionType","CUSTOM"],"sources":["../../../../src/domain/rumEventsCollection/actions/actionCollection.js"],"sourcesContent":["import {\n toServerDuration,\n extend,\n extend2Lev,\n ActionType,\n RumEventType,\n LifeCycleEventType,\n UUID,\n noop,\n discardNegativeDuration\n} from '@cloudcare/browser-core'\nimport { trackClickActions } from './trackClickActions'\nimport { PageState } from '../../contexts/pageStateHistory'\nexport function startActionCollection(\n lifeCycle,\n domMutationObservable,\n configuration,\n pageStateHistory\n) {\n lifeCycle.subscribe(\n LifeCycleEventType.AUTO_ACTION_COMPLETED,\n function (action) {\n lifeCycle.notify(\n LifeCycleEventType.RAW_RUM_EVENT_COLLECTED,\n processAction(action, pageStateHistory)\n )\n }\n )\n\n var actionContexts = { findActionId: noop, findAllActionId: noop }\n if (configuration.trackUserInteractions) {\n actionContexts = trackClickActions(\n lifeCycle,\n domMutationObservable,\n configuration\n ).actionContexts\n }\n return {\n actionContexts: actionContexts,\n addAction: function (action, savedCommonContext) {\n lifeCycle.notify(\n LifeCycleEventType.RAW_RUM_EVENT_COLLECTED,\n extend(\n { savedCommonContext: savedCommonContext },\n processAction(action, pageStateHistory)\n )\n )\n }\n }\n}\n\nfunction processAction(action, pageStateHistory) {\n var autoActionProperties = isAutoAction(action)\n ? {\n action: {\n error: {\n count: action.counts.errorCount\n },\n id: action.id,\n loadingTime: discardNegativeDuration(\n toServerDuration(action.duration)\n ),\n frustration: {\n type: action.frustrationTypes\n },\n long_task: {\n count: action.counts.longTaskCount\n },\n resource: {\n count: action.counts.resourceCount\n }\n },\n _gc: {\n action: {\n target: action.target,\n position: action.position\n }\n }\n }\n : {\n action: {\n loadingTime: 0\n }\n }\n var customerContext = !isAutoAction(action) ? action.context : undefined\n var actionEvent = extend2Lev(\n {\n action: {\n id: UUID(),\n target: {\n name: action.name\n },\n type: action.type\n },\n date: action.startClocks.timeStamp,\n type: RumEventType.ACTION,\n view: {\n in_foreground: pageStateHistory.wasInPageStateAt(\n PageState.ACTIVE,\n action.startClocks.relative\n )\n }\n },\n autoActionProperties\n )\n\n return {\n customerContext: customerContext,\n rawRumEvent: actionEvent,\n startTime: action.startClocks.relative,\n domainContext: isAutoAction(action)\n ? { event: action.event, events: action.events }\n : {}\n }\n}\n\nfunction isAutoAction(action) {\n return action.type !== ActionType.CUSTOM\n}\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAWA,IAAAC,kBAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACO,SAASG,qBAAqBA,CACnCC,SAAS,EACTC,qBAAqB,EACrBC,aAAa,EACbC,gBAAgB,EAChB;EACAH,SAAS,CAACI,SAAS,CACjBC,+BAAkB,CAACC,qBAAqB,EACxC,UAAUC,MAAM,EAAE;IAChBP,SAAS,CAACQ,MAAM,CACdH,+BAAkB,CAACI,uBAAuB,EAC1CC,aAAa,CAACH,MAAM,EAAEJ,gBAAgB,CACxC,CAAC;EACH,CACF,CAAC;EAED,IAAIQ,cAAc,GAAG;IAAEC,YAAY,EAAEC,iBAAI;IAAEC,eAAe,EAAED;EAAK,CAAC;EAClE,IAAIX,aAAa,CAACa,qBAAqB,EAAE;IACvCJ,cAAc,GAAG,IAAAK,oCAAiB,EAChChB,SAAS,EACTC,qBAAqB,EACrBC,aACF,CAAC,CAACS,cAAc;EAClB;EACA,OAAO;IACLA,cAAc,EAAEA,cAAc;IAC9BM,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"actionCollection.js","names":["_browserCore","require","_trackClickActions","_pageStateHistory","startActionCollection","lifeCycle","domMutationObservable","configuration","pageStateHistory","subscribe","LifeCycleEventType","AUTO_ACTION_COMPLETED","action","notify","RAW_RUM_EVENT_COLLECTED","processAction","actionContexts","findActionId","noop","findAllActionId","trackUserInteractions","trackClickActions","addAction","savedCommonContext","extend","autoActionProperties","isAutoAction","error","count","counts","errorCount","id","loadingTime","discardNegativeDuration","toServerDuration","duration","frustration","type","frustrationTypes","long_task","longTaskCount","resource","resourceCount","_gc","target","position","customerContext","context","undefined","actionEvent","extend2Lev","UUID","name","date","startClocks","timeStamp","RumEventType","ACTION","view","in_foreground","wasInPageStateAt","PageState","ACTIVE","relative","rawRumEvent","startTime","domainContext","event","events","ActionType","CUSTOM"],"sources":["../../../../src/domain/rumEventsCollection/actions/actionCollection.js"],"sourcesContent":["import {\n toServerDuration,\n extend,\n extend2Lev,\n ActionType,\n RumEventType,\n LifeCycleEventType,\n UUID,\n noop,\n discardNegativeDuration\n} from '@cloudcare/browser-core'\nimport { trackClickActions } from './trackClickActions'\nimport { PageState } from '../../contexts/pageStateHistory'\nexport function startActionCollection(\n lifeCycle,\n domMutationObservable,\n configuration,\n pageStateHistory\n) {\n lifeCycle.subscribe(\n LifeCycleEventType.AUTO_ACTION_COMPLETED,\n function (action) {\n lifeCycle.notify(\n LifeCycleEventType.RAW_RUM_EVENT_COLLECTED,\n processAction(action, pageStateHistory)\n )\n }\n )\n\n var actionContexts = { findActionId: noop, findAllActionId: noop }\n if (configuration.trackUserInteractions) {\n actionContexts = trackClickActions(\n lifeCycle,\n domMutationObservable,\n configuration\n ).actionContexts\n }\n return {\n actionContexts: actionContexts,\n addAction: function (action, savedCommonContext) {\n lifeCycle.notify(\n LifeCycleEventType.RAW_RUM_EVENT_COLLECTED,\n extend(\n { savedCommonContext: savedCommonContext },\n processAction(action, pageStateHistory)\n )\n )\n }\n }\n}\n\nfunction processAction(action, pageStateHistory) {\n var autoActionProperties = isAutoAction(action)\n ? {\n action: {\n error: {\n count: action.counts.errorCount\n },\n id: action.id,\n loadingTime: discardNegativeDuration(\n toServerDuration(action.duration)\n ),\n frustration: {\n type: action.frustrationTypes\n },\n long_task: {\n count: action.counts.longTaskCount\n },\n resource: {\n count: action.counts.resourceCount\n }\n },\n _gc: {\n action: {\n target: action.target,\n position: action.position\n }\n }\n }\n : {\n action: {\n loadingTime: 0\n }\n }\n var customerContext = !isAutoAction(action) ? action.context : undefined\n var actionEvent = extend2Lev(\n {\n action: {\n id: UUID(),\n target: {\n name: action.name\n },\n type: action.type\n },\n date: action.startClocks.timeStamp,\n type: RumEventType.ACTION,\n view: {\n in_foreground: pageStateHistory.wasInPageStateAt(\n PageState.ACTIVE,\n action.startClocks.relative\n )\n }\n },\n autoActionProperties\n )\n\n return {\n customerContext: customerContext,\n rawRumEvent: actionEvent,\n startTime: action.startClocks.relative,\n domainContext: isAutoAction(action)\n ? { event: action.event, events: action.events }\n : {}\n }\n}\n\nfunction isAutoAction(action) {\n return action.type !== ActionType.CUSTOM\n}\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAWA,IAAAC,kBAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACO,SAASG,qBAAqBA,CACnCC,SAAS,EACTC,qBAAqB,EACrBC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KAAKgC,uBAAU,CAACC,MAAM;AAC1C","ignoreList":[]}
|
|
@@ -6,10 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.MAX_DURATION_BETWEEN_CLICKS = exports.MAX_DISTANCE_BETWEEN_CLICKS = void 0;
|
|
7
7
|
exports.createClickChain = createClickChain;
|
|
8
8
|
var _browserCore = require("@cloudcare/browser-core");
|
|
9
|
-
var MAX_DURATION_BETWEEN_CLICKS = _browserCore.ONE_SECOND;
|
|
10
|
-
exports.
|
|
11
|
-
var MAX_DISTANCE_BETWEEN_CLICKS = 100;
|
|
12
|
-
exports.MAX_DISTANCE_BETWEEN_CLICKS = MAX_DISTANCE_BETWEEN_CLICKS;
|
|
9
|
+
var MAX_DURATION_BETWEEN_CLICKS = exports.MAX_DURATION_BETWEEN_CLICKS = _browserCore.ONE_SECOND;
|
|
10
|
+
var MAX_DISTANCE_BETWEEN_CLICKS = exports.MAX_DISTANCE_BETWEEN_CLICKS = 100;
|
|
13
11
|
var ClickChainStatus = {
|
|
14
12
|
WaitingForMoreClicks: 0,
|
|
15
13
|
WaitingForClicksToStop: 1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clickChain.js","names":["_browserCore","require","MAX_DURATION_BETWEEN_CLICKS","
|
|
1
|
+
{"version":3,"file":"clickChain.js","names":["_browserCore","require","MAX_DURATION_BETWEEN_CLICKS","exports","ONE_SECOND","MAX_DISTANCE_BETWEEN_CLICKS","ClickChainStatus","WaitingForMoreClicks","WaitingForClicksToStop","Finalized","createClickChain","firstClick","onFinalize","bufferedClicks","status","maxDurationBetweenClicksTimeout","appendClick","click","stopObservable","subscribe","tryFinalize","push","clearTimeout","setTimeout","dontAcceptMoreClick","every","isStopped","tryAppend","length","areEventsSimilar","event","stop","first","second","target","mouseEventDistance","timeStamp","origin","other","Math","sqrt","pow","clientX","clientY"],"sources":["../../../../src/domain/rumEventsCollection/actions/clickChain.js"],"sourcesContent":["import {\n ONE_SECOND,\n every,\n setTimeout,\n clearTimeout\n} from '@cloudcare/browser-core'\n\nexport var MAX_DURATION_BETWEEN_CLICKS = ONE_SECOND\nexport var MAX_DISTANCE_BETWEEN_CLICKS = 100\n\nvar ClickChainStatus = {\n WaitingForMoreClicks: 0,\n WaitingForClicksToStop: 1,\n Finalized: 2\n}\n\nexport function createClickChain(firstClick, onFinalize) {\n var bufferedClicks = []\n var status = ClickChainStatus.WaitingForMoreClicks\n var maxDurationBetweenClicksTimeout\n appendClick(firstClick)\n\n function appendClick(click) {\n click.stopObservable.subscribe(tryFinalize)\n bufferedClicks.push(click)\n clearTimeout(maxDurationBetweenClicksTimeout)\n maxDurationBetweenClicksTimeout = setTimeout(\n dontAcceptMoreClick,\n MAX_DURATION_BETWEEN_CLICKS\n )\n }\n\n function tryFinalize() {\n if (\n status === ClickChainStatus.WaitingForClicksToStop &&\n every(bufferedClicks, function (click) {\n return click.isStopped()\n })\n ) {\n status = ClickChainStatus.Finalized\n onFinalize(bufferedClicks)\n }\n }\n\n function dontAcceptMoreClick() {\n clearTimeout(maxDurationBetweenClicksTimeout)\n if (status === ClickChainStatus.WaitingForMoreClicks) {\n status = ClickChainStatus.WaitingForClicksToStop\n tryFinalize()\n }\n }\n\n return {\n tryAppend: function (click) {\n if (status !== ClickChainStatus.WaitingForMoreClicks) {\n return false\n }\n\n if (\n bufferedClicks.length > 0 &&\n !areEventsSimilar(\n bufferedClicks[bufferedClicks.length - 1].event,\n click.event\n )\n ) {\n dontAcceptMoreClick()\n return false\n }\n\n appendClick(click)\n return true\n },\n stop: function () {\n dontAcceptMoreClick()\n }\n }\n}\n\n/**\n * Checks whether two events are similar by comparing their target, position and timestamp\n */\nfunction areEventsSimilar(first, second) {\n return (\n first.target === second.target &&\n mouseEventDistance(first, second) <= MAX_DISTANCE_BETWEEN_CLICKS &&\n first.timeStamp - second.timeStamp <= MAX_DURATION_BETWEEN_CLICKS\n )\n}\n\nfunction mouseEventDistance(origin, other) {\n return Math.sqrt(\n Math.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_ACTION_NAME_ATTRIBUTE = void 0;
|
|
7
7
|
exports.getActionNameFromElement = getActionNameFromElement;
|
|
8
8
|
var _browserCore = require("@cloudcare/browser-core");
|
|
9
|
-
var DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE = 'data-guance-action-name';
|
|
10
|
-
exports.DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE = DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE;
|
|
9
|
+
var DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE = exports.DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE = 'data-guance-action-name';
|
|
11
10
|
function getActionNameFromElement(element, userProgrammaticAttribute) {
|
|
12
11
|
// Proceed to get the action name in two steps:
|
|
13
12
|
// * first, get the name programmatically, explicitly defined by the user.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getActionNameFromElement.js","names":["_browserCore","require","DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE","exports","getActionNameFromElement","element","userProgrammaticAttribute","getActionNameFromElementProgrammatically","getActionNameFromElementForStrategies","priorityStrategies","fallbackStrategies","targetElement","programmaticAttribute","elementWithAttribute","supportsElementClosest","closest","hasAttribute","parentElement","name","getAttribute","truncate","normalizeWhitespace","trim","supportsLabelProperty","labels","length","getTextualContent","id","label","ownerDocument","find","querySelectorAll","htmlFor","nodeName","input","type","value","labelledByAttribute","split","map","getElementById","filter","Boolean","ele","join","options","MAX_PARENTS_TO_CONSIDER","strategies","recursionCounter","i","strategy","trimmedName","s","replace","safeTruncate","refElement","isContentEditable","text","innerText","removeTextFromElements","query","list","index","_element","textToReplace","supportsInnerTextScriptAndStyleRemoval","textContent","isIE","supportsLabelPropertyResult","undefined","HTMLInputElement","prototype","supportsElementClosestResult","HTMLElement"],"sources":["../../../../src/domain/rumEventsCollection/actions/getActionNameFromElement.js"],"sourcesContent":["import { safeTruncate, isIE, find, map, filter } from '@cloudcare/browser-core'\n\nexport var DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE =\n 'data-guance-action-name'\n\nexport function getActionNameFromElement(element, userProgrammaticAttribute) {\n // Proceed to get the action name in two steps:\n // * first, get the name programmatically, explicitly defined by the user.\n // * then, use strategies that are known to return good results. Those strategies will be used on\n // the element and a few parents, but it's likely that they won't succeed at all.\n // * if no name is found this way, use strategies returning less accurate names as a fallback.\n // Those are much likely to succeed.\n return (\n getActionNameFromElementProgrammatically(\n element,\n DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE\n ) ||\n (userProgrammaticAttribute &&\n getActionNameFromElementProgrammatically(\n element,\n userProgrammaticAttribute\n )) ||\n getActionNameFromElementForStrategies(\n element,\n userProgrammaticAttribute,\n priorityStrategies\n ) ||\n getActionNameFromElementForStrategies(\n element,\n userProgrammaticAttribute,\n fallbackStrategies\n ) ||\n ''\n )\n}\n\nfunction getActionNameFromElementProgrammatically(\n targetElement,\n programmaticAttribute\n) {\n var elementWithAttribute\n // We don't use getActionNameFromElementForStrategies here, because we want to consider all parents,\n // without limit. It is up to the user to declare a relevant naming strategy.\n // If available, use element.closest() to match get the attribute from the element or any of its\n // parent. Else fallback to a more traditional implementation.\n if (supportsElementClosest()) {\n elementWithAttribute = targetElement.closest(\n '[' + programmaticAttribute + ']'\n )\n } else {\n var element = targetElement\n while (element) {\n if (element.hasAttribute(programmaticAttribute)) {\n elementWithAttribute = element\n break\n }\n element = element.parentElement\n }\n }\n\n if (!elementWithAttribute) {\n return\n }\n var name = elementWithAttribute.getAttribute(programmaticAttribute)\n return truncate(normalizeWhitespace(name.trim()))\n}\n\nvar priorityStrategies = [\n // associated LABEL text\n function (element, userProgrammaticAttribute) {\n // IE does not support element.labels, so we fallback to a CSS selector based on the element id\n // instead\n if (supportsLabelProperty()) {\n if ('labels' in element && element.labels && element.labels.length > 0) {\n return getTextualContent(element.labels[0], userProgrammaticAttribute)\n }\n } else if (element.id) {\n var label =\n element.ownerDocument &&\n find(element.ownerDocument.querySelectorAll('label'), function (label) {\n return label.htmlFor === element.id\n })\n return label && getTextualContent(label, userProgrammaticAttribute)\n }\n },\n // INPUT button (and associated) value\n function (element) {\n if (element.nodeName === 'INPUT') {\n var input = element\n var type = input.getAttribute('type')\n if (type === 'button' || type === 'submit' || type === 'reset') {\n return input.value\n }\n }\n },\n // BUTTON, LABEL or button-like element text\n function (element, userProgrammaticAttribute) {\n if (\n element.nodeName === 'BUTTON' ||\n element.nodeName === 'LABEL' ||\n element.getAttribute('role') === 'button'\n ) {\n return getTextualContent(element, userProgrammaticAttribute)\n }\n },\n function (element) {\n return element.getAttribute('aria-label')\n },\n // associated element text designated by the aria-labelledby attribute\n function (element, userProgrammaticAttribute) {\n var labelledByAttribute = element.getAttribute('aria-labelledby')\n if (labelledByAttribute) {\n labelledByAttribute = labelledByAttribute.split(/\\s+/)\n labelledByAttribute = map(labelledByAttribute, function (id) {\n return getElementById(element, id)\n })\n labelledByAttribute = filter(labelledByAttribute, function (label) {\n return Boolean(label)\n })\n labelledByAttribute = map(labelledByAttribute, function (ele) {\n return getTextualContent(ele, userProgrammaticAttribute)\n })\n return labelledByAttribute.join(' ')\n }\n },\n function (element) {\n return element.getAttribute('alt')\n },\n function (element) {\n return element.getAttribute('name')\n },\n function (element) {\n return element.getAttribute('title')\n },\n function (element) {\n return element.getAttribute('placeholder')\n },\n // SELECT first OPTION text\n function (element, userProgrammaticAttribute) {\n if ('options' in element && element.options.length > 0) {\n return getTextualContent(element.options[0], userProgrammaticAttribute)\n }\n }\n]\n\nvar fallbackStrategies = [\n function (element, userProgrammaticAttribute) {\n return getTextualContent(element, userProgrammaticAttribute)\n }\n]\n\n/**\n * Iterates over the target element and its parent, using the strategies list to get an action name.\n * Each strategies are applied on each element, stopping as soon as a non-empty value is returned.\n */\nvar MAX_PARENTS_TO_CONSIDER = 10\nfunction getActionNameFromElementForStrategies(\n targetElement,\n userProgrammaticAttribute,\n strategies\n) {\n var element = targetElement\n var recursionCounter = 0\n while (\n recursionCounter <= MAX_PARENTS_TO_CONSIDER &&\n element &&\n element.nodeName !== 'BODY' &&\n element.nodeName !== 'HTML' &&\n element.nodeName !== 'HEAD'\n ) {\n for (var i = 0; i < strategies.length; i++) {\n var strategy = strategies[i]\n var name = strategy(element, userProgrammaticAttribute)\n if (typeof name === 'string') {\n var trimmedName = name.trim()\n if (trimmedName) {\n return truncate(normalizeWhitespace(trimmedName))\n }\n }\n }\n // Consider a FORM as a contextual limit to get the action name. This is experimental and may\n // be reconsidered in the future.\n if (element.nodeName === 'FORM') {\n break\n }\n element = element.parentElement\n recursionCounter += 1\n }\n}\n\nfunction normalizeWhitespace(s) {\n return s.replace(/\\s+/g, ' ')\n}\n\nfunction truncate(s) {\n return s.length > 100 ? safeTruncate(s, 100) + ' [...]' : s\n}\n\nfunction getElementById(refElement, id) {\n // Use the element ownerDocument here, because tests are executed in an iframe, so\n // document.getElementById won't work.\n return refElement.ownerDocument\n ? refElement.ownerDocument.getElementById(id)\n : null\n}\n\nfunction getTextualContent(element, userProgrammaticAttribute) {\n if (element.isContentEditable) {\n return\n }\n\n if ('innerText' in element) {\n var text = element.innerText\n\n var removeTextFromElements = function (query) {\n var list = element.querySelectorAll(query)\n for (var index = 0; index < list.length; index += 1) {\n var _element = list[index]\n if ('innerText' in _element) {\n var textToReplace = _element.innerText\n if (textToReplace && textToReplace.trim().length > 0) {\n text = text.replace(textToReplace, '')\n }\n }\n }\n }\n\n if (!supportsInnerTextScriptAndStyleRemoval()) {\n // remove the inner text of SCRIPT and STYLES from the result. This is a bit dirty, but should\n // be relatively fast and work in most cases.\n removeTextFromElements('script, style')\n }\n\n // remove the text of elements with programmatic attribute value\n removeTextFromElements(\n '[' + DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE + ']'\n )\n\n if (userProgrammaticAttribute) {\n removeTextFromElements('[' + userProgrammaticAttribute + ']')\n }\n\n return text\n }\n\n return element.textContent\n}\n\n/**\n * Returns true if element.innerText excludes the text from inline SCRIPT and STYLE element. This\n * should be the case everywhere except on Internet Explorer 10 and 11 (see [1])\n *\n * The innerText property relies on what is actually rendered to compute its output, so to check if\n * it actually excludes SCRIPT and STYLE content, a solution would be to create a style element, set\n * its content to '*', inject it in the document body, and check if the style element innerText\n * property returns '*'. Using a new `document` instance won't work as it is not rendered.\n *\n * This solution requires specific CSP rules (see [2]) to be set by the customer. We want to avoid\n * this, so instead we rely on browser detection. In case of false negative, the impact should be\n * low, since we rely on this result to remove the SCRIPT and STYLE innerText (which will be empty)\n * from a parent element innerText.\n *\n * [1]: https://web.archive.org/web/20210602165716/http://perfectionkills.com/the-poor-misunderstood-innerText/#diff-with-textContent\n */\nfunction supportsInnerTextScriptAndStyleRemoval() {\n return !isIE()\n}\n\n/**\n * Returns true if the browser supports the element.labels property. This should be the case\n * everywhere except on Internet Explorer.\n * Note: The result is computed lazily, because we don't want any DOM access when the SDK is\n * evaluated.\n */\nvar supportsLabelPropertyResult\nfunction supportsLabelProperty() {\n if (supportsLabelPropertyResult === undefined) {\n supportsLabelPropertyResult = 'labels' in HTMLInputElement.prototype\n }\n return supportsLabelPropertyResult\n}\n\n/**\n * Returns true if the browser supports the element.closest method. This should be the case\n * everywhere except on Internet Explorer.\n * Note: The result is computed lazily, because we don't want any DOM access when the SDK is\n * evaluated.\n */\nvar supportsElementClosestResult\nfunction supportsElementClosest() {\n if (supportsElementClosestResult === undefined) {\n supportsElementClosestResult = 'closest' in HTMLElement.prototype\n }\n return supportsElementClosestResult\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEO,IAAIC,0CAA0C,GACnD,yBAAyB;AAAAC,OAAA,CAAAD,0CAAA,GAAAA,0CAAA;AAEpB,SAASE,wBAAwBA,CAACC,OAAO,EAAEC,yBAAyB,EAAE;EAC3E;EACA;EACA;EACA;EACA;EACA;EACA,OACEC,wCAAwC,CACtCF,OAAO,EACPH,0CACF,CAAC,IACAI,yBAAyB,IACxBC,wCAAwC,CACtC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AC5B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASD,sCAAsCA,CAAA,EAAG;EAChD,OAAO,CAAC,IAAAE,iBAAI,EAAC,CAAC;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,2BAA2B;AAC/B,SAAS7C,qBAAqBA,CAAA,EAAG;EAC/B,IAAI6C,2BAA2B,KAAKC,SAAS,EAAE;IAC7CD,2BAA2B,GAAG,QAAQ,IAAIE,gBAAgB,CAACC,SAAS;EACtE;EACA,OAAOH,2BAA2B;AACpC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAII,4BAA4B;AAChC,SAAS1D,sBAAsBA,CAAA,EAAG;EAChC,IAAI0D,4BAA4B,KAAKH,SAAS,EAAE;IAC9CG,4BAA4B,GAAG,SAAS,IAAIC,WAAW,CAACF,SAAS;EACnE;EACA,OAAOC,4BAA4B;AACrC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"getActionNameFromElement.js","names":["_browserCore","require","DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE","exports","getActionNameFromElement","element","userProgrammaticAttribute","getActionNameFromElementProgrammatically","getActionNameFromElementForStrategies","priorityStrategies","fallbackStrategies","targetElement","programmaticAttribute","elementWithAttribute","supportsElementClosest","closest","hasAttribute","parentElement","name","getAttribute","truncate","normalizeWhitespace","trim","supportsLabelProperty","labels","length","getTextualContent","id","label","ownerDocument","find","querySelectorAll","htmlFor","nodeName","input","type","value","labelledByAttribute","split","map","getElementById","filter","Boolean","ele","join","options","MAX_PARENTS_TO_CONSIDER","strategies","recursionCounter","i","strategy","trimmedName","s","replace","safeTruncate","refElement","isContentEditable","text","innerText","removeTextFromElements","query","list","index","_element","textToReplace","supportsInnerTextScriptAndStyleRemoval","textContent","isIE","supportsLabelPropertyResult","undefined","HTMLInputElement","prototype","supportsElementClosestResult","HTMLElement"],"sources":["../../../../src/domain/rumEventsCollection/actions/getActionNameFromElement.js"],"sourcesContent":["import { safeTruncate, isIE, find, map, filter } from '@cloudcare/browser-core'\n\nexport var DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE =\n 'data-guance-action-name'\n\nexport function getActionNameFromElement(element, userProgrammaticAttribute) {\n // Proceed to get the action name in two steps:\n // * first, get the name programmatically, explicitly defined by the user.\n // * then, use strategies that are known to return good results. Those strategies will be used on\n // the element and a few parents, but it's likely that they won't succeed at all.\n // * if no name is found this way, use strategies returning less accurate names as a fallback.\n // Those are much likely to succeed.\n return (\n getActionNameFromElementProgrammatically(\n element,\n DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE\n ) ||\n (userProgrammaticAttribute &&\n getActionNameFromElementProgrammatically(\n element,\n userProgrammaticAttribute\n )) ||\n getActionNameFromElementForStrategies(\n element,\n userProgrammaticAttribute,\n priorityStrategies\n ) ||\n getActionNameFromElementForStrategies(\n element,\n userProgrammaticAttribute,\n fallbackStrategies\n ) ||\n ''\n )\n}\n\nfunction getActionNameFromElementProgrammatically(\n targetElement,\n programmaticAttribute\n) {\n var elementWithAttribute\n // We don't use getActionNameFromElementForStrategies here, because we want to consider all parents,\n // without limit. It is up to the user to declare a relevant naming strategy.\n // If available, use element.closest() to match get the attribute from the element or any of its\n // parent. Else fallback to a more traditional implementation.\n if (supportsElementClosest()) {\n elementWithAttribute = targetElement.closest(\n '[' + programmaticAttribute + ']'\n )\n } else {\n var element = targetElement\n while (element) {\n if (element.hasAttribute(programmaticAttribute)) {\n elementWithAttribute = element\n break\n }\n element = element.parentElement\n }\n }\n\n if (!elementWithAttribute) {\n return\n }\n var name = elementWithAttribute.getAttribute(programmaticAttribute)\n return truncate(normalizeWhitespace(name.trim()))\n}\n\nvar priorityStrategies = [\n // associated LABEL text\n function (element, userProgrammaticAttribute) {\n // IE does not support element.labels, so we fallback to a CSS selector based on the element id\n // instead\n if (supportsLabelProperty()) {\n if ('labels' in element && element.labels && element.labels.length > 0) {\n return getTextualContent(element.labels[0], userProgrammaticAttribute)\n }\n } else if (element.id) {\n var label =\n element.ownerDocument &&\n find(element.ownerDocument.querySelectorAll('label'), function (label) {\n return label.htmlFor === element.id\n })\n return label && getTextualContent(label, userProgrammaticAttribute)\n }\n },\n // INPUT button (and associated) value\n function (element) {\n if (element.nodeName === 'INPUT') {\n var input = element\n var type = input.getAttribute('type')\n if (type === 'button' || type === 'submit' || type === 'reset') {\n return input.value\n }\n }\n },\n // BUTTON, LABEL or button-like element text\n function (element, userProgrammaticAttribute) {\n if (\n element.nodeName === 'BUTTON' ||\n element.nodeName === 'LABEL' ||\n element.getAttribute('role') === 'button'\n ) {\n return getTextualContent(element, userProgrammaticAttribute)\n }\n },\n function (element) {\n return element.getAttribute('aria-label')\n },\n // associated element text designated by the aria-labelledby attribute\n function (element, userProgrammaticAttribute) {\n var labelledByAttribute = element.getAttribute('aria-labelledby')\n if (labelledByAttribute) {\n labelledByAttribute = labelledByAttribute.split(/\\s+/)\n labelledByAttribute = map(labelledByAttribute, function (id) {\n return getElementById(element, id)\n })\n labelledByAttribute = filter(labelledByAttribute, function (label) {\n return Boolean(label)\n })\n labelledByAttribute = map(labelledByAttribute, function (ele) {\n return getTextualContent(ele, userProgrammaticAttribute)\n })\n return labelledByAttribute.join(' ')\n }\n },\n function (element) {\n return element.getAttribute('alt')\n },\n function (element) {\n return element.getAttribute('name')\n },\n function (element) {\n return element.getAttribute('title')\n },\n function (element) {\n return element.getAttribute('placeholder')\n },\n // SELECT first OPTION text\n function (element, userProgrammaticAttribute) {\n if ('options' in element && element.options.length > 0) {\n return getTextualContent(element.options[0], userProgrammaticAttribute)\n }\n }\n]\n\nvar fallbackStrategies = [\n function (element, userProgrammaticAttribute) {\n return getTextualContent(element, userProgrammaticAttribute)\n }\n]\n\n/**\n * Iterates over the target element and its parent, using the strategies list to get an action name.\n * Each strategies are applied on each element, stopping as soon as a non-empty value is returned.\n */\nvar MAX_PARENTS_TO_CONSIDER = 10\nfunction getActionNameFromElementForStrategies(\n targetElement,\n userProgrammaticAttribute,\n strategies\n) {\n var element = targetElement\n var recursionCounter = 0\n while (\n recursionCounter <= MAX_PARENTS_TO_CONSIDER &&\n element &&\n element.nodeName !== 'BODY' &&\n element.nodeName !== 'HTML' &&\n element.nodeName !== 'HEAD'\n ) {\n for (var i = 0; i < strategies.length; i++) {\n var strategy = strategies[i]\n var name = strategy(element, userProgrammaticAttribute)\n if (typeof name === 'string') {\n var trimmedName = name.trim()\n if (trimmedName) {\n return truncate(normalizeWhitespace(trimmedName))\n }\n }\n }\n // Consider a FORM as a contextual limit to get the action name. This is experimental and may\n // be reconsidered in the future.\n if (element.nodeName === 'FORM') {\n break\n }\n element = element.parentElement\n recursionCounter += 1\n }\n}\n\nfunction normalizeWhitespace(s) {\n return s.replace(/\\s+/g, ' ')\n}\n\nfunction truncate(s) {\n return s.length > 100 ? safeTruncate(s, 100) + ' [...]' : s\n}\n\nfunction getElementById(refElement, id) {\n // Use the element ownerDocument here, because tests are executed in an iframe, so\n // document.getElementById won't work.\n return refElement.ownerDocument\n ? refElement.ownerDocument.getElementById(id)\n : null\n}\n\nfunction getTextualContent(element, userProgrammaticAttribute) {\n if (element.isContentEditable) {\n return\n }\n\n if ('innerText' in element) {\n var text = element.innerText\n\n var removeTextFromElements = function (query) {\n var list = element.querySelectorAll(query)\n for (var index = 0; index < list.length; index += 1) {\n var _element = list[index]\n if ('innerText' in _element) {\n var textToReplace = _element.innerText\n if (textToReplace && textToReplace.trim().length > 0) {\n text = text.replace(textToReplace, '')\n }\n }\n }\n }\n\n if (!supportsInnerTextScriptAndStyleRemoval()) {\n // remove the inner text of SCRIPT and STYLES from the result. This is a bit dirty, but should\n // be relatively fast and work in most cases.\n removeTextFromElements('script, style')\n }\n\n // remove the text of elements with programmatic attribute value\n removeTextFromElements(\n '[' + DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE + ']'\n )\n\n if (userProgrammaticAttribute) {\n removeTextFromElements('[' + userProgrammaticAttribute + ']')\n }\n\n return text\n }\n\n return element.textContent\n}\n\n/**\n * Returns true if element.innerText excludes the text from inline SCRIPT and STYLE element. This\n * should be the case everywhere except on Internet Explorer 10 and 11 (see [1])\n *\n * The innerText property relies on what is actually rendered to compute its output, so to check if\n * it actually excludes SCRIPT and STYLE content, a solution would be to create a style element, set\n * its content to '*', inject it in the document body, and check if the style element innerText\n * property returns '*'. Using a new `document` instance won't work as it is not rendered.\n *\n * This solution requires specific CSP rules (see [2]) to be set by the customer. We want to avoid\n * this, so instead we rely on browser detection. In case of false negative, the impact should be\n * low, since we rely on this result to remove the SCRIPT and STYLE innerText (which will be empty)\n * from a parent element innerText.\n *\n * [1]: https://web.archive.org/web/20210602165716/http://perfectionkills.com/the-poor-misunderstood-innerText/#diff-with-textContent\n */\nfunction supportsInnerTextScriptAndStyleRemoval() {\n return !isIE()\n}\n\n/**\n * Returns true if the browser supports the element.labels property. This should be the case\n * everywhere except on Internet Explorer.\n * Note: The result is computed lazily, because we don't want any DOM access when the SDK is\n * evaluated.\n */\nvar supportsLabelPropertyResult\nfunction supportsLabelProperty() {\n if (supportsLabelPropertyResult === undefined) {\n supportsLabelPropertyResult = 'labels' in HTMLInputElement.prototype\n }\n return supportsLabelPropertyResult\n}\n\n/**\n * Returns true if the browser supports the element.closest method. This should be the case\n * everywhere except on Internet Explorer.\n * Note: The result is computed lazily, because we don't want any DOM access when the SDK is\n * evaluated.\n */\nvar supportsElementClosestResult\nfunction supportsElementClosest() {\n if (supportsElementClosestResult === undefined) {\n supportsElementClosestResult = 'closest' in HTMLElement.prototype\n }\n return supportsElementClosestResult\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEO,IAAIC,0CAA0C,GAAAC,OAAA,CAAAD,0CAAA,GACnD,yBAAyB;AAEpB,SAASE,wBAAwBA,CAACC,OAAO,EAAEC,yBAAyB,EAAE;EAC3E;EACA;EACA;EACA;EACA;EACA;EACA,OACEC,wCAAwC,CACtCF,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EA,OAAOmD,IAAI;EACb;EAEA,OAAOpD,OAAO,CAAC6D,WAAW;AAC5B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASD,sCAAsCA,CAAA,EAAG;EAChD,OAAO,CAAC,IAAAE,iBAAI,EAAC,CAAC;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,2BAA2B;AAC/B,SAAS7C,qBAAqBA,CAAA,EAAG;EAC/B,IAAI6C,2BAA2B,KAAKC,SAAS,EAAE;IAC7CD,2BAA2B,GAAG,QAAQ,IAAIE,gBAAgB,CAACC,SAAS;EACtE;EACA,OAAOH,2BAA2B;AACpC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAII,4BAA4B;AAChC,SAAS1D,sBAAsBA,CAAA,EAAG;EAChC,IAAI0D,4BAA4B,KAAKH,SAAS,EAAE;IAC9CG,4BAA4B,GAAG,SAAS,IAAIC,WAAW,CAACF,SAAS;EACnE;EACA,OAAOC,4BAA4B;AACrC","ignoreList":[]}
|
|
@@ -13,7 +13,7 @@ var _getActionNameFromElement = require("./getActionNameFromElement");
|
|
|
13
13
|
* component). Those attribute values should not be generated randomly (hardcoded most of the time)
|
|
14
14
|
* and stay the same across deploys. They are not necessarily unique across the document.
|
|
15
15
|
*/
|
|
16
|
-
var STABLE_ATTRIBUTES = [_getActionNameFromElement.DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE,
|
|
16
|
+
var STABLE_ATTRIBUTES = exports.STABLE_ATTRIBUTES = [_getActionNameFromElement.DEFAULT_PROGRAMMATIC_ACTION_NAME_ATTRIBUTE,
|
|
17
17
|
// Common test attributes (list provided by google recorder)
|
|
18
18
|
'data-testid', 'data-test', 'data-qa', 'data-cy', 'data-test-id', 'data-qa-id', 'data-testing',
|
|
19
19
|
// FullStory decorator attributes:
|
|
@@ -21,7 +21,6 @@ var STABLE_ATTRIBUTES = [_getActionNameFromElement.DEFAULT_PROGRAMMATIC_ACTION_N
|
|
|
21
21
|
// Selectors to use if they target a single element on the whole document. Those selectors are
|
|
22
22
|
// considered as "stable" and uniquely identify an element regardless of the page state. If we find
|
|
23
23
|
// one, we should consider the selector "complete" and stop iterating over ancestors.
|
|
24
|
-
exports.STABLE_ATTRIBUTES = STABLE_ATTRIBUTES;
|
|
25
24
|
var GLOBALLY_UNIQUE_SELECTOR_GETTERS = [getStableAttributeSelector, getIDSelector];
|
|
26
25
|
|
|
27
26
|
// Selectors to use if they target a single element among an element descendants. Those selectors
|