@kubesense/kubesense-browser-rum 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +34 -0
- package/bundle/chunks/profiler-b64730a2109c3ddbc539-kubesense-rum.js +1 -0
- package/bundle/chunks/recorder-9ae532a18bac5f4280da-kubesense-rum.js +1 -0
- package/bundle/kubesense-rum.js +1 -0
- package/cjs/boot/isBrowserSupported.d.ts +4 -0
- package/cjs/boot/isBrowserSupported.js +17 -0
- package/cjs/boot/isBrowserSupported.js.map +1 -0
- package/cjs/boot/lazyLoadProfiler.d.ts +4 -0
- package/cjs/boot/lazyLoadProfiler.js +54 -0
- package/cjs/boot/lazyLoadProfiler.js.map +1 -0
- package/cjs/boot/lazyLoadRecorder.d.ts +4 -0
- package/cjs/boot/lazyLoadRecorder.js +54 -0
- package/cjs/boot/lazyLoadRecorder.js.map +1 -0
- package/cjs/boot/postStartStrategy.d.ts +33 -0
- package/cjs/boot/postStartStrategy.js +98 -0
- package/cjs/boot/postStartStrategy.js.map +1 -0
- package/cjs/boot/preStartStrategy.d.ts +6 -0
- package/cjs/boot/preStartStrategy.js +24 -0
- package/cjs/boot/preStartStrategy.js.map +1 -0
- package/cjs/boot/profilerApi.d.ts +2 -0
- package/cjs/boot/profilerApi.js +53 -0
- package/cjs/boot/profilerApi.js.map +1 -0
- package/cjs/boot/recorderApi.d.ts +4 -0
- package/cjs/boot/recorderApi.js +73 -0
- package/cjs/boot/recorderApi.js.map +1 -0
- package/cjs/boot/startRecording.d.ts +6 -0
- package/cjs/boot/startRecording.js +45 -0
- package/cjs/boot/startRecording.js.map +1 -0
- package/cjs/domain/deflate/deflateEncoder.d.ts +3 -0
- package/cjs/domain/deflate/deflateEncoder.js +110 -0
- package/cjs/domain/deflate/deflateEncoder.js.map +1 -0
- package/cjs/domain/deflate/deflateWorker.d.ts +30 -0
- package/cjs/domain/deflate/deflateWorker.js +104 -0
- package/cjs/domain/deflate/deflateWorker.js.map +1 -0
- package/cjs/domain/deflate/index.d.ts +3 -0
- package/cjs/domain/deflate/index.js +10 -0
- package/cjs/domain/deflate/index.js.map +1 -0
- package/cjs/domain/getSessionReplayLink.d.ts +2 -0
- package/cjs/domain/getSessionReplayLink.js +35 -0
- package/cjs/domain/getSessionReplayLink.js.map +1 -0
- package/cjs/domain/profiling/profiler.d.ts +7 -0
- package/cjs/domain/profiling/profiler.js +244 -0
- package/cjs/domain/profiling/profiler.js.map +1 -0
- package/cjs/domain/profiling/profilingContext.d.ts +6 -0
- package/cjs/domain/profiling/profilingContext.js +28 -0
- package/cjs/domain/profiling/profilingContext.js.map +1 -0
- package/cjs/domain/profiling/profilingSupported.d.ts +1 -0
- package/cjs/domain/profiling/profilingSupported.js +11 -0
- package/cjs/domain/profiling/profilingSupported.js.map +1 -0
- package/cjs/domain/profiling/test-utils/mockedTrace.d.ts +3 -0
- package/cjs/domain/profiling/test-utils/mockedTrace.js +57 -0
- package/cjs/domain/profiling/test-utils/mockedTrace.js.map +1 -0
- package/cjs/domain/profiling/transport/assembly.d.ts +21 -0
- package/cjs/domain/profiling/transport/assembly.js +45 -0
- package/cjs/domain/profiling/transport/assembly.js.map +1 -0
- package/cjs/domain/profiling/transport/buildProfileEventAttributes.d.ts +25 -0
- package/cjs/domain/profiling/transport/buildProfileEventAttributes.js +50 -0
- package/cjs/domain/profiling/transport/buildProfileEventAttributes.js.map +1 -0
- package/cjs/domain/profiling/types/index.d.ts +2 -0
- package/cjs/domain/profiling/types/index.js +3 -0
- package/cjs/domain/profiling/types/index.js.map +1 -0
- package/cjs/domain/profiling/types/profilerApi.types.d.ts +58 -0
- package/cjs/domain/profiling/types/profilerApi.types.js +5 -0
- package/cjs/domain/profiling/types/profilerApi.types.js.map +1 -0
- package/cjs/domain/profiling/types/rumProfiler.types.d.ts +72 -0
- package/cjs/domain/profiling/types/rumProfiler.types.js +3 -0
- package/cjs/domain/profiling/types/rumProfiler.types.js.map +1 -0
- package/cjs/domain/profiling/utils/getCustomOrDefaultViewName.d.ts +1 -0
- package/cjs/domain/profiling/utils/getCustomOrDefaultViewName.js +7 -0
- package/cjs/domain/profiling/utils/getCustomOrDefaultViewName.js.map +1 -0
- package/cjs/domain/profiling/utils/getDefaultViewName.d.ts +1 -0
- package/cjs/domain/profiling/utils/getDefaultViewName.js +14 -0
- package/cjs/domain/profiling/utils/getDefaultViewName.js.map +1 -0
- package/cjs/domain/profiling/utils/getNumberOfSamples.d.ts +7 -0
- package/cjs/domain/profiling/utils/getNumberOfSamples.js +18 -0
- package/cjs/domain/profiling/utils/getNumberOfSamples.js.map +1 -0
- package/cjs/domain/record/assembly.d.ts +2 -0
- package/cjs/domain/record/assembly.js +16 -0
- package/cjs/domain/record/assembly.js.map +1 -0
- package/cjs/domain/record/elementsScrollPositions.d.ts +10 -0
- package/cjs/domain/record/elementsScrollPositions.js +23 -0
- package/cjs/domain/record/elementsScrollPositions.js.map +1 -0
- package/cjs/domain/record/eventIds.d.ts +4 -0
- package/cjs/domain/record/eventIds.js +16 -0
- package/cjs/domain/record/eventIds.js.map +1 -0
- package/cjs/domain/record/eventsUtils.d.ts +2 -0
- package/cjs/domain/record/eventsUtils.js +15 -0
- package/cjs/domain/record/eventsUtils.js.map +1 -0
- package/cjs/domain/record/index.d.ts +7 -0
- package/cjs/domain/record/index.js +17 -0
- package/cjs/domain/record/index.js.map +1 -0
- package/cjs/domain/record/internalApi.d.ts +22 -0
- package/cjs/domain/record/internalApi.js +57 -0
- package/cjs/domain/record/internalApi.js.map +1 -0
- package/cjs/domain/record/mutationBatch.d.ts +12 -0
- package/cjs/domain/record/mutationBatch.js +44 -0
- package/cjs/domain/record/mutationBatch.js.map +1 -0
- package/cjs/domain/record/nodeIds.d.ts +15 -0
- package/cjs/domain/record/nodeIds.js +32 -0
- package/cjs/domain/record/nodeIds.js.map +1 -0
- package/cjs/domain/record/record.d.ts +16 -0
- package/cjs/domain/record/record.js +90 -0
- package/cjs/domain/record/record.js.map +1 -0
- package/cjs/domain/record/record.types.d.ts +4 -0
- package/cjs/domain/record/record.types.js +3 -0
- package/cjs/domain/record/record.types.js.map +1 -0
- package/cjs/domain/record/recordingScope.d.ts +19 -0
- package/cjs/domain/record/recordingScope.js +13 -0
- package/cjs/domain/record/recordingScope.js.map +1 -0
- package/cjs/domain/record/serialization/index.d.ts +8 -0
- package/cjs/domain/record/serialization/index.js +18 -0
- package/cjs/domain/record/serialization/index.js.map +1 -0
- package/cjs/domain/record/serialization/serialization.types.d.ts +28 -0
- package/cjs/domain/record/serialization/serialization.types.js +3 -0
- package/cjs/domain/record/serialization/serialization.types.js.map +1 -0
- package/cjs/domain/record/serialization/serializationStats.d.ts +12 -0
- package/cjs/domain/record/serialization/serializationStats.js +32 -0
- package/cjs/domain/record/serialization/serializationStats.js.map +1 -0
- package/cjs/domain/record/serialization/serializationTransaction.d.ts +45 -0
- package/cjs/domain/record/serialization/serializationTransaction.js +38 -0
- package/cjs/domain/record/serialization/serializationTransaction.js.map +1 -0
- package/cjs/domain/record/serialization/serializationUtils.d.ts +18 -0
- package/cjs/domain/record/serialization/serializationUtils.js +88 -0
- package/cjs/domain/record/serialization/serializationUtils.js.map +1 -0
- package/cjs/domain/record/serialization/serializeAttribute.d.ts +4 -0
- package/cjs/domain/record/serialization/serializeAttribute.js +42 -0
- package/cjs/domain/record/serialization/serializeAttribute.js.map +1 -0
- package/cjs/domain/record/serialization/serializeAttributes.d.ts +7 -0
- package/cjs/domain/record/serialization/serializeAttributes.js +167 -0
- package/cjs/domain/record/serialization/serializeAttributes.js.map +1 -0
- package/cjs/domain/record/serialization/serializeDocument.d.ts +3 -0
- package/cjs/domain/record/serialization/serializeDocument.js +11 -0
- package/cjs/domain/record/serialization/serializeDocument.js.map +1 -0
- package/cjs/domain/record/serialization/serializeNode.d.ts +7 -0
- package/cjs/domain/record/serialization/serializeNode.js +154 -0
- package/cjs/domain/record/serialization/serializeNode.js.map +1 -0
- package/cjs/domain/record/serialization/serializeStyleSheets.d.ts +2 -0
- package/cjs/domain/record/serialization/serializeStyleSheets.js +19 -0
- package/cjs/domain/record/serialization/serializeStyleSheets.js.map +1 -0
- package/cjs/domain/record/shadowRootsController.d.ts +11 -0
- package/cjs/domain/record/shadowRootsController.js +45 -0
- package/cjs/domain/record/shadowRootsController.js.map +1 -0
- package/cjs/domain/record/startFullSnapshots.d.ts +9 -0
- package/cjs/domain/record/startFullSnapshots.js +59 -0
- package/cjs/domain/record/startFullSnapshots.js.map +1 -0
- package/cjs/domain/record/trackers/index.d.ts +12 -0
- package/cjs/domain/record/trackers/index.js +27 -0
- package/cjs/domain/record/trackers/index.js.map +1 -0
- package/cjs/domain/record/trackers/trackFocus.d.ts +5 -0
- package/cjs/domain/record/trackers/trackFocus.js +15 -0
- package/cjs/domain/record/trackers/trackFocus.js.map +1 -0
- package/cjs/domain/record/trackers/trackFrustration.d.ts +7 -0
- package/cjs/domain/record/trackers/trackFrustration.js +31 -0
- package/cjs/domain/record/trackers/trackFrustration.js.map +1 -0
- package/cjs/domain/record/trackers/trackInput.d.ts +4 -0
- package/cjs/domain/record/trackers/trackInput.js +104 -0
- package/cjs/domain/record/trackers/trackInput.js.map +1 -0
- package/cjs/domain/record/trackers/trackMediaInteraction.d.ts +5 -0
- package/cjs/domain/record/trackers/trackMediaInteraction.js +29 -0
- package/cjs/domain/record/trackers/trackMediaInteraction.js.map +1 -0
- package/cjs/domain/record/trackers/trackMouseInteraction.d.ts +5 -0
- package/cjs/domain/record/trackers/trackMouseInteraction.js +59 -0
- package/cjs/domain/record/trackers/trackMouseInteraction.js.map +1 -0
- package/cjs/domain/record/trackers/trackMove.d.ts +9 -0
- package/cjs/domain/record/trackers/trackMove.js +55 -0
- package/cjs/domain/record/trackers/trackMove.js.map +1 -0
- package/cjs/domain/record/trackers/trackMutation.d.ts +11 -0
- package/cjs/domain/record/trackers/trackMutation.js +270 -0
- package/cjs/domain/record/trackers/trackMutation.js.map +1 -0
- package/cjs/domain/record/trackers/trackScroll.d.ts +5 -0
- package/cjs/domain/record/trackers/trackScroll.js +48 -0
- package/cjs/domain/record/trackers/trackScroll.js.map +1 -0
- package/cjs/domain/record/trackers/trackStyleSheet.d.ts +6 -0
- package/cjs/domain/record/trackers/trackStyleSheet.js +89 -0
- package/cjs/domain/record/trackers/trackStyleSheet.js.map +1 -0
- package/cjs/domain/record/trackers/trackViewEnd.d.ts +5 -0
- package/cjs/domain/record/trackers/trackViewEnd.js +20 -0
- package/cjs/domain/record/trackers/trackViewEnd.js.map +1 -0
- package/cjs/domain/record/trackers/trackViewportResize.d.ts +6 -0
- package/cjs/domain/record/trackers/trackViewportResize.js +46 -0
- package/cjs/domain/record/trackers/trackViewportResize.js.map +1 -0
- package/cjs/domain/record/trackers/tracker.types.d.ts +3 -0
- package/cjs/domain/record/trackers/tracker.types.js +3 -0
- package/cjs/domain/record/trackers/tracker.types.js.map +1 -0
- package/cjs/domain/record/viewports.d.ts +20 -0
- package/cjs/domain/record/viewports.js +60 -0
- package/cjs/domain/record/viewports.js.map +1 -0
- package/cjs/domain/replayStats.d.ts +8 -0
- package/cjs/domain/replayStats.js +60 -0
- package/cjs/domain/replayStats.js.map +1 -0
- package/cjs/domain/scriptLoadingError.d.ts +6 -0
- package/cjs/domain/scriptLoadingError.js +26 -0
- package/cjs/domain/scriptLoadingError.js.map +1 -0
- package/cjs/domain/segmentCollection/buildReplayPayload.d.ts +15 -0
- package/cjs/domain/segmentCollection/buildReplayPayload.js +26 -0
- package/cjs/domain/segmentCollection/buildReplayPayload.js.map +1 -0
- package/cjs/domain/segmentCollection/index.d.ts +4 -0
- package/cjs/domain/segmentCollection/index.js +11 -0
- package/cjs/domain/segmentCollection/index.js.map +1 -0
- package/cjs/domain/segmentCollection/segment.d.ts +16 -0
- package/cjs/domain/segmentCollection/segment.js +82 -0
- package/cjs/domain/segmentCollection/segment.js.map +1 -0
- package/cjs/domain/segmentCollection/segmentCollection.d.ts +31 -0
- package/cjs/domain/segmentCollection/segmentCollection.js +113 -0
- package/cjs/domain/segmentCollection/segmentCollection.js.map +1 -0
- package/cjs/domain/segmentCollection/startSegmentTelemetry.d.ts +6 -0
- package/cjs/domain/segmentCollection/startSegmentTelemetry.js +47 -0
- package/cjs/domain/segmentCollection/startSegmentTelemetry.js.map +1 -0
- package/cjs/domain/startRecordBridge.d.ts +5 -0
- package/cjs/domain/startRecordBridge.js +17 -0
- package/cjs/domain/startRecordBridge.js.map +1 -0
- package/cjs/domain/startRecorderInitTelemetry.d.ts +15 -0
- package/cjs/domain/startRecorderInitTelemetry.js +55 -0
- package/cjs/domain/startRecorderInitTelemetry.js.map +1 -0
- package/cjs/entries/internal.d.ts +11 -0
- package/cjs/entries/internal.js +28 -0
- package/cjs/entries/internal.js.map +1 -0
- package/cjs/entries/internalSynthetics.d.ts +2 -0
- package/cjs/entries/internalSynthetics.js +27 -0
- package/cjs/entries/internalSynthetics.js.map +1 -0
- package/cjs/entries/main.d.ts +23 -0
- package/cjs/entries/main.js +35 -0
- package/cjs/entries/main.js.map +1 -0
- package/cjs/types/index.d.ts +2 -0
- package/cjs/types/index.js +18 -0
- package/cjs/types/index.js.map +1 -0
- package/cjs/types/sessionReplay.d.ts +703 -0
- package/cjs/types/sessionReplay.js +7 -0
- package/cjs/types/sessionReplay.js.map +1 -0
- package/cjs/types/sessionReplayConstants.d.ts +49 -0
- package/cjs/types/sessionReplayConstants.js +49 -0
- package/cjs/types/sessionReplayConstants.js.map +1 -0
- package/esm/boot/isBrowserSupported.d.ts +4 -0
- package/esm/boot/isBrowserSupported.js +14 -0
- package/esm/boot/isBrowserSupported.js.map +1 -0
- package/esm/boot/lazyLoadProfiler.d.ts +4 -0
- package/esm/boot/lazyLoadProfiler.js +18 -0
- package/esm/boot/lazyLoadProfiler.js.map +1 -0
- package/esm/boot/lazyLoadRecorder.d.ts +4 -0
- package/esm/boot/lazyLoadRecorder.js +18 -0
- package/esm/boot/lazyLoadRecorder.js.map +1 -0
- package/esm/boot/postStartStrategy.d.ts +33 -0
- package/esm/boot/postStartStrategy.js +95 -0
- package/esm/boot/postStartStrategy.js.map +1 -0
- package/esm/boot/preStartStrategy.d.ts +6 -0
- package/esm/boot/preStartStrategy.js +21 -0
- package/esm/boot/preStartStrategy.js.map +1 -0
- package/esm/boot/profilerApi.d.ts +2 -0
- package/esm/boot/profilerApi.js +50 -0
- package/esm/boot/profilerApi.js.map +1 -0
- package/esm/boot/recorderApi.d.ts +4 -0
- package/esm/boot/recorderApi.js +70 -0
- package/esm/boot/recorderApi.js.map +1 -0
- package/esm/boot/startRecording.d.ts +6 -0
- package/esm/boot/startRecording.js +42 -0
- package/esm/boot/startRecording.js.map +1 -0
- package/esm/domain/deflate/deflateEncoder.d.ts +3 -0
- package/esm/domain/deflate/deflateEncoder.js +107 -0
- package/esm/domain/deflate/deflateEncoder.js.map +1 -0
- package/esm/domain/deflate/deflateWorker.d.ts +30 -0
- package/esm/domain/deflate/deflateWorker.js +97 -0
- package/esm/domain/deflate/deflateWorker.js.map +1 -0
- package/esm/domain/deflate/index.d.ts +3 -0
- package/esm/domain/deflate/index.js +3 -0
- package/esm/domain/deflate/index.js.map +1 -0
- package/esm/domain/getSessionReplayLink.d.ts +2 -0
- package/esm/domain/getSessionReplayLink.js +32 -0
- package/esm/domain/getSessionReplayLink.js.map +1 -0
- package/esm/domain/profiling/profiler.d.ts +7 -0
- package/esm/domain/profiling/profiler.js +240 -0
- package/esm/domain/profiling/profiler.js.map +1 -0
- package/esm/domain/profiling/profilingContext.d.ts +6 -0
- package/esm/domain/profiling/profilingContext.js +25 -0
- package/esm/domain/profiling/profilingContext.js.map +1 -0
- package/esm/domain/profiling/profilingSupported.d.ts +1 -0
- package/esm/domain/profiling/profilingSupported.js +8 -0
- package/esm/domain/profiling/profilingSupported.js.map +1 -0
- package/esm/domain/profiling/test-utils/mockedTrace.d.ts +3 -0
- package/esm/domain/profiling/test-utils/mockedTrace.js +54 -0
- package/esm/domain/profiling/test-utils/mockedTrace.js.map +1 -0
- package/esm/domain/profiling/transport/assembly.d.ts +21 -0
- package/esm/domain/profiling/transport/assembly.js +42 -0
- package/esm/domain/profiling/transport/assembly.js.map +1 -0
- package/esm/domain/profiling/transport/buildProfileEventAttributes.d.ts +25 -0
- package/esm/domain/profiling/transport/buildProfileEventAttributes.js +47 -0
- package/esm/domain/profiling/transport/buildProfileEventAttributes.js.map +1 -0
- package/esm/domain/profiling/types/index.d.ts +2 -0
- package/esm/domain/profiling/types/index.js +2 -0
- package/esm/domain/profiling/types/index.js.map +1 -0
- package/esm/domain/profiling/types/profilerApi.types.d.ts +58 -0
- package/esm/domain/profiling/types/profilerApi.types.js +4 -0
- package/esm/domain/profiling/types/profilerApi.types.js.map +1 -0
- package/esm/domain/profiling/types/rumProfiler.types.d.ts +72 -0
- package/esm/domain/profiling/types/rumProfiler.types.js +2 -0
- package/esm/domain/profiling/types/rumProfiler.types.js.map +1 -0
- package/esm/domain/profiling/utils/getCustomOrDefaultViewName.d.ts +1 -0
- package/esm/domain/profiling/utils/getCustomOrDefaultViewName.js +3 -0
- package/esm/domain/profiling/utils/getCustomOrDefaultViewName.js.map +1 -0
- package/esm/domain/profiling/utils/getDefaultViewName.d.ts +1 -0
- package/esm/domain/profiling/utils/getDefaultViewName.js +11 -0
- package/esm/domain/profiling/utils/getDefaultViewName.js.map +1 -0
- package/esm/domain/profiling/utils/getNumberOfSamples.d.ts +7 -0
- package/esm/domain/profiling/utils/getNumberOfSamples.js +15 -0
- package/esm/domain/profiling/utils/getNumberOfSamples.js.map +1 -0
- package/esm/domain/record/assembly.d.ts +2 -0
- package/esm/domain/record/assembly.js +13 -0
- package/esm/domain/record/assembly.js.map +1 -0
- package/esm/domain/record/elementsScrollPositions.d.ts +10 -0
- package/esm/domain/record/elementsScrollPositions.js +20 -0
- package/esm/domain/record/elementsScrollPositions.js.map +1 -0
- package/esm/domain/record/eventIds.d.ts +4 -0
- package/esm/domain/record/eventIds.js +13 -0
- package/esm/domain/record/eventIds.js.map +1 -0
- package/esm/domain/record/eventsUtils.d.ts +2 -0
- package/esm/domain/record/eventsUtils.js +11 -0
- package/esm/domain/record/eventsUtils.js.map +1 -0
- package/esm/domain/record/index.d.ts +7 -0
- package/esm/domain/record/index.js +6 -0
- package/esm/domain/record/index.js.map +1 -0
- package/esm/domain/record/internalApi.d.ts +22 -0
- package/esm/domain/record/internalApi.js +53 -0
- package/esm/domain/record/internalApi.js.map +1 -0
- package/esm/domain/record/mutationBatch.d.ts +12 -0
- package/esm/domain/record/mutationBatch.js +40 -0
- package/esm/domain/record/mutationBatch.js.map +1 -0
- package/esm/domain/record/nodeIds.d.ts +15 -0
- package/esm/domain/record/nodeIds.js +29 -0
- package/esm/domain/record/nodeIds.js.map +1 -0
- package/esm/domain/record/record.d.ts +16 -0
- package/esm/domain/record/record.js +54 -0
- package/esm/domain/record/record.js.map +1 -0
- package/esm/domain/record/record.types.d.ts +4 -0
- package/esm/domain/record/record.types.js +2 -0
- package/esm/domain/record/record.types.js.map +1 -0
- package/esm/domain/record/recordingScope.d.ts +19 -0
- package/esm/domain/record/recordingScope.js +10 -0
- package/esm/domain/record/recordingScope.js.map +1 -0
- package/esm/domain/record/serialization/index.d.ts +8 -0
- package/esm/domain/record/serialization/index.js +7 -0
- package/esm/domain/record/serialization/index.js.map +1 -0
- package/esm/domain/record/serialization/serialization.types.d.ts +28 -0
- package/esm/domain/record/serialization/serialization.types.js +2 -0
- package/esm/domain/record/serialization/serialization.types.js.map +1 -0
- package/esm/domain/record/serialization/serializationStats.d.ts +12 -0
- package/esm/domain/record/serialization/serializationStats.js +27 -0
- package/esm/domain/record/serialization/serializationStats.js.map +1 -0
- package/esm/domain/record/serialization/serializationTransaction.d.ts +45 -0
- package/esm/domain/record/serialization/serializationTransaction.js +35 -0
- package/esm/domain/record/serialization/serializationTransaction.js.map +1 -0
- package/esm/domain/record/serialization/serializationUtils.d.ts +18 -0
- package/esm/domain/record/serialization/serializationUtils.js +80 -0
- package/esm/domain/record/serialization/serializationUtils.js.map +1 -0
- package/esm/domain/record/serialization/serializeAttribute.d.ts +4 -0
- package/esm/domain/record/serialization/serializeAttribute.js +38 -0
- package/esm/domain/record/serialization/serializeAttribute.js.map +1 -0
- package/esm/domain/record/serialization/serializeAttributes.d.ts +7 -0
- package/esm/domain/record/serialization/serializeAttributes.js +161 -0
- package/esm/domain/record/serialization/serializeAttributes.js.map +1 -0
- package/esm/domain/record/serialization/serializeDocument.d.ts +3 -0
- package/esm/domain/record/serialization/serializeDocument.js +8 -0
- package/esm/domain/record/serialization/serializeDocument.js.map +1 -0
- package/esm/domain/record/serialization/serializeNode.d.ts +7 -0
- package/esm/domain/record/serialization/serializeNode.js +149 -0
- package/esm/domain/record/serialization/serializeNode.js.map +1 -0
- package/esm/domain/record/serialization/serializeStyleSheets.d.ts +2 -0
- package/esm/domain/record/serialization/serializeStyleSheets.js +16 -0
- package/esm/domain/record/serialization/serializeStyleSheets.js.map +1 -0
- package/esm/domain/record/shadowRootsController.d.ts +11 -0
- package/esm/domain/record/shadowRootsController.js +41 -0
- package/esm/domain/record/shadowRootsController.js.map +1 -0
- package/esm/domain/record/startFullSnapshots.d.ts +9 -0
- package/esm/domain/record/startFullSnapshots.js +55 -0
- package/esm/domain/record/startFullSnapshots.js.map +1 -0
- package/esm/domain/record/trackers/index.d.ts +12 -0
- package/esm/domain/record/trackers/index.js +12 -0
- package/esm/domain/record/trackers/index.js.map +1 -0
- package/esm/domain/record/trackers/trackFocus.d.ts +5 -0
- package/esm/domain/record/trackers/trackFocus.js +12 -0
- package/esm/domain/record/trackers/trackFocus.js.map +1 -0
- package/esm/domain/record/trackers/trackFrustration.d.ts +7 -0
- package/esm/domain/record/trackers/trackFrustration.js +28 -0
- package/esm/domain/record/trackers/trackFrustration.js.map +1 -0
- package/esm/domain/record/trackers/trackInput.d.ts +4 -0
- package/esm/domain/record/trackers/trackInput.js +101 -0
- package/esm/domain/record/trackers/trackInput.js.map +1 -0
- package/esm/domain/record/trackers/trackMediaInteraction.d.ts +5 -0
- package/esm/domain/record/trackers/trackMediaInteraction.js +26 -0
- package/esm/domain/record/trackers/trackMediaInteraction.js.map +1 -0
- package/esm/domain/record/trackers/trackMouseInteraction.d.ts +5 -0
- package/esm/domain/record/trackers/trackMouseInteraction.js +56 -0
- package/esm/domain/record/trackers/trackMouseInteraction.js.map +1 -0
- package/esm/domain/record/trackers/trackMove.d.ts +9 -0
- package/esm/domain/record/trackers/trackMove.js +51 -0
- package/esm/domain/record/trackers/trackMove.js.map +1 -0
- package/esm/domain/record/trackers/trackMutation.d.ts +11 -0
- package/esm/domain/record/trackers/trackMutation.js +266 -0
- package/esm/domain/record/trackers/trackMutation.js.map +1 -0
- package/esm/domain/record/trackers/trackScroll.d.ts +5 -0
- package/esm/domain/record/trackers/trackScroll.js +45 -0
- package/esm/domain/record/trackers/trackScroll.js.map +1 -0
- package/esm/domain/record/trackers/trackStyleSheet.d.ts +6 -0
- package/esm/domain/record/trackers/trackStyleSheet.js +85 -0
- package/esm/domain/record/trackers/trackStyleSheet.js.map +1 -0
- package/esm/domain/record/trackers/trackViewEnd.d.ts +5 -0
- package/esm/domain/record/trackers/trackViewEnd.js +17 -0
- package/esm/domain/record/trackers/trackViewEnd.js.map +1 -0
- package/esm/domain/record/trackers/trackViewportResize.d.ts +6 -0
- package/esm/domain/record/trackers/trackViewportResize.js +42 -0
- package/esm/domain/record/trackers/trackViewportResize.js.map +1 -0
- package/esm/domain/record/trackers/tracker.types.d.ts +3 -0
- package/esm/domain/record/trackers/tracker.types.js +2 -0
- package/esm/domain/record/trackers/tracker.types.js.map +1 -0
- package/esm/domain/record/viewports.d.ts +20 -0
- package/esm/domain/record/viewports.js +55 -0
- package/esm/domain/record/viewports.js.map +1 -0
- package/esm/domain/replayStats.d.ts +8 -0
- package/esm/domain/replayStats.js +51 -0
- package/esm/domain/replayStats.js.map +1 -0
- package/esm/domain/scriptLoadingError.d.ts +6 -0
- package/esm/domain/scriptLoadingError.js +23 -0
- package/esm/domain/scriptLoadingError.js.map +1 -0
- package/esm/domain/segmentCollection/buildReplayPayload.d.ts +15 -0
- package/esm/domain/segmentCollection/buildReplayPayload.js +23 -0
- package/esm/domain/segmentCollection/buildReplayPayload.js.map +1 -0
- package/esm/domain/segmentCollection/index.d.ts +4 -0
- package/esm/domain/segmentCollection/index.js +4 -0
- package/esm/domain/segmentCollection/index.js.map +1 -0
- package/esm/domain/segmentCollection/segment.d.ts +16 -0
- package/esm/domain/segmentCollection/segment.js +46 -0
- package/esm/domain/segmentCollection/segment.js.map +1 -0
- package/esm/domain/segmentCollection/segmentCollection.d.ts +31 -0
- package/esm/domain/segmentCollection/segmentCollection.js +106 -0
- package/esm/domain/segmentCollection/segmentCollection.js.map +1 -0
- package/esm/domain/segmentCollection/startSegmentTelemetry.d.ts +6 -0
- package/esm/domain/segmentCollection/startSegmentTelemetry.js +44 -0
- package/esm/domain/segmentCollection/startSegmentTelemetry.js.map +1 -0
- package/esm/domain/startRecordBridge.d.ts +5 -0
- package/esm/domain/startRecordBridge.js +14 -0
- package/esm/domain/startRecordBridge.js.map +1 -0
- package/esm/domain/startRecorderInitTelemetry.d.ts +15 -0
- package/esm/domain/startRecorderInitTelemetry.js +52 -0
- package/esm/domain/startRecorderInitTelemetry.js.map +1 -0
- package/esm/entries/internal.d.ts +11 -0
- package/esm/entries/internal.js +4 -0
- package/esm/entries/internal.js.map +1 -0
- package/esm/entries/internalSynthetics.d.ts +2 -0
- package/esm/entries/internalSynthetics.js +23 -0
- package/esm/entries/internalSynthetics.js.map +1 -0
- package/esm/entries/main.d.ts +23 -0
- package/esm/entries/main.js +31 -0
- package/esm/entries/main.js.map +1 -0
- package/esm/types/index.d.ts +2 -0
- package/esm/types/index.js +2 -0
- package/esm/types/index.js.map +1 -0
- package/esm/types/sessionReplay.d.ts +703 -0
- package/esm/types/sessionReplay.js +6 -0
- package/esm/types/sessionReplay.js.map +1 -0
- package/esm/types/sessionReplayConstants.d.ts +49 -0
- package/esm/types/sessionReplayConstants.js +46 -0
- package/esm/types/sessionReplayConstants.js.map +1 -0
- package/internal/package.json +6 -0
- package/internal-synthetics/package.json +6 -0
- package/package.json +40 -0
- package/src/boot/isBrowserSupported.ts +14 -0
- package/src/boot/lazyLoadProfiler.ts +21 -0
- package/src/boot/lazyLoadRecorder.ts +21 -0
- package/src/boot/postStartStrategy.ts +176 -0
- package/src/boot/preStartStrategy.ts +34 -0
- package/src/boot/profilerApi.ts +86 -0
- package/src/boot/recorderApi.ts +124 -0
- package/src/boot/startRecording.ts +70 -0
- package/src/domain/deflate/deflateEncoder.ts +144 -0
- package/src/domain/deflate/deflateWorker.ts +157 -0
- package/src/domain/deflate/index.ts +8 -0
- package/src/domain/getSessionReplayLink.ts +40 -0
- package/src/domain/profiling/profiler.ts +338 -0
- package/src/domain/profiling/profilingContext.ts +34 -0
- package/src/domain/profiling/profilingSupported.ts +10 -0
- package/src/domain/profiling/test-utils/mockedTrace.ts +58 -0
- package/src/domain/profiling/transport/assembly.ts +78 -0
- package/src/domain/profiling/transport/buildProfileEventAttributes.ts +66 -0
- package/src/domain/profiling/types/index.ts +2 -0
- package/src/domain/profiling/types/profilerApi.types.ts +87 -0
- package/src/domain/profiling/types/rumProfiler.types.ts +81 -0
- package/src/domain/profiling/utils/getCustomOrDefaultViewName.ts +4 -0
- package/src/domain/profiling/utils/getDefaultViewName.ts +12 -0
- package/src/domain/profiling/utils/getNumberOfSamples.ts +16 -0
- package/src/domain/record/assembly.ts +17 -0
- package/src/domain/record/elementsScrollPositions.ts +28 -0
- package/src/domain/record/eventIds.ts +17 -0
- package/src/domain/record/eventsUtils.ts +12 -0
- package/src/domain/record/index.ts +7 -0
- package/src/domain/record/internalApi.ts +88 -0
- package/src/domain/record/mutationBatch.ts +47 -0
- package/src/domain/record/nodeIds.ts +46 -0
- package/src/domain/record/record.ts +98 -0
- package/src/domain/record/record.types.ts +5 -0
- package/src/domain/record/recordingScope.ts +36 -0
- package/src/domain/record/serialization/index.ts +8 -0
- package/src/domain/record/serialization/serialization.types.ts +43 -0
- package/src/domain/record/serialization/serializationStats.ts +43 -0
- package/src/domain/record/serialization/serializationTransaction.ts +94 -0
- package/src/domain/record/serialization/serializationUtils.ts +103 -0
- package/src/domain/record/serialization/serializeAttribute.ts +55 -0
- package/src/domain/record/serialization/serializeAttributes.ts +194 -0
- package/src/domain/record/serialization/serializeDocument.ts +13 -0
- package/src/domain/record/serialization/serializeNode.ts +229 -0
- package/src/domain/record/serialization/serializeStyleSheets.ts +18 -0
- package/src/domain/record/shadowRootsController.ts +62 -0
- package/src/domain/record/startFullSnapshots.ts +84 -0
- package/src/domain/record/trackers/index.ts +12 -0
- package/src/domain/record/trackers/trackFocus.ts +16 -0
- package/src/domain/record/trackers/trackFrustration.ts +41 -0
- package/src/domain/record/trackers/trackInput.ts +128 -0
- package/src/domain/record/trackers/trackMediaInteraction.ts +43 -0
- package/src/domain/record/trackers/trackMouseInteraction.ts +74 -0
- package/src/domain/record/trackers/trackMove.ts +78 -0
- package/src/domain/record/trackers/trackMutation.ts +399 -0
- package/src/domain/record/trackers/trackScroll.ts +61 -0
- package/src/domain/record/trackers/trackStyleSheet.ts +117 -0
- package/src/domain/record/trackers/trackViewEnd.ts +27 -0
- package/src/domain/record/trackers/trackViewportResize.ts +69 -0
- package/src/domain/record/trackers/tracker.types.ts +3 -0
- package/src/domain/record/viewports.ts +68 -0
- package/src/domain/replayStats.ts +61 -0
- package/src/domain/scriptLoadingError.ts +36 -0
- package/src/domain/segmentCollection/buildReplayPayload.ts +52 -0
- package/src/domain/segmentCollection/index.ts +4 -0
- package/src/domain/segmentCollection/segment.ts +78 -0
- package/src/domain/segmentCollection/segmentCollection.ts +200 -0
- package/src/domain/segmentCollection/startSegmentTelemetry.ts +82 -0
- package/src/domain/startRecordBridge.ts +17 -0
- package/src/domain/startRecorderInitTelemetry.ts +90 -0
- package/src/entries/internal.ts +18 -0
- package/src/entries/internalSynthetics.ts +24 -0
- package/src/entries/main.ts +95 -0
- package/src/types/index.ts +2 -0
- package/src/types/sessionReplay.ts +734 -0
- package/src/types/sessionReplayConstants.ts +86 -0
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.trackMutation = trackMutation;
|
|
4
|
+
exports.sortAddedAndMovedNodes = sortAddedAndMovedNodes;
|
|
5
|
+
const kubesense_browser_core_1 = require("@kubesense/kubesense-browser-core");
|
|
6
|
+
const kubesense_browser_rum_core_1 = require("@kubesense/kubesense-browser-rum-core");
|
|
7
|
+
const types_1 = require("../../../types");
|
|
8
|
+
const serialization_1 = require("../serialization");
|
|
9
|
+
const mutationBatch_1 = require("../mutationBatch");
|
|
10
|
+
const assembly_1 = require("../assembly");
|
|
11
|
+
/**
|
|
12
|
+
* Buffers and aggregate mutations generated by a MutationObserver into MutationPayload
|
|
13
|
+
*/
|
|
14
|
+
function trackMutation(target, emitRecord, emitStats, scope) {
|
|
15
|
+
const MutationObserver = (0, kubesense_browser_rum_core_1.getMutationObserverConstructor)();
|
|
16
|
+
if (!MutationObserver) {
|
|
17
|
+
return { stop: kubesense_browser_core_1.noop, flush: kubesense_browser_core_1.noop };
|
|
18
|
+
}
|
|
19
|
+
const mutationBatch = (0, mutationBatch_1.createMutationBatch)((mutations) => {
|
|
20
|
+
(0, serialization_1.serializeInTransaction)(2 /* SerializationKind.INCREMENTAL_SNAPSHOT */, emitRecord, emitStats, scope, (transaction) => processMutations(mutations.concat(observer.takeRecords()), transaction));
|
|
21
|
+
});
|
|
22
|
+
const observer = new MutationObserver((0, kubesense_browser_core_1.monitor)(mutationBatch.addMutations));
|
|
23
|
+
observer.observe(target, {
|
|
24
|
+
attributeOldValue: true,
|
|
25
|
+
attributes: true,
|
|
26
|
+
characterData: true,
|
|
27
|
+
characterDataOldValue: true,
|
|
28
|
+
childList: true,
|
|
29
|
+
subtree: true,
|
|
30
|
+
});
|
|
31
|
+
return {
|
|
32
|
+
stop: () => {
|
|
33
|
+
observer.disconnect();
|
|
34
|
+
mutationBatch.stop();
|
|
35
|
+
},
|
|
36
|
+
flush: () => {
|
|
37
|
+
mutationBatch.flush();
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function processMutations(mutations, transaction) {
|
|
42
|
+
const nodePrivacyLevelCache = new Map();
|
|
43
|
+
mutations
|
|
44
|
+
.filter((mutation) => mutation.type === 'childList')
|
|
45
|
+
.forEach((mutation) => {
|
|
46
|
+
mutation.removedNodes.forEach((removedNode) => {
|
|
47
|
+
traverseRemovedShadowDom(removedNode, transaction.scope.shadowRootsController.removeShadowRoot);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
// Discard any mutation with a 'target' node that:
|
|
51
|
+
// * isn't injected in the current document or isn't known/serialized yet: those nodes are likely
|
|
52
|
+
// part of a mutation occurring in a parent Node
|
|
53
|
+
// * should be hidden or ignored
|
|
54
|
+
const filteredMutations = mutations.filter((mutation) => mutation.target.isConnected &&
|
|
55
|
+
transaction.scope.nodeIds.areAssignedForNodeAndAncestors(mutation.target) &&
|
|
56
|
+
(0, kubesense_browser_rum_core_1.getNodePrivacyLevel)(mutation.target, transaction.scope.configuration.defaultPrivacyLevel, nodePrivacyLevelCache) !== kubesense_browser_rum_core_1.NodePrivacyLevel.HIDDEN);
|
|
57
|
+
const { adds, removes, hasBeenSerialized } = processChildListMutations(filteredMutations.filter((mutation) => mutation.type === 'childList'), nodePrivacyLevelCache, transaction);
|
|
58
|
+
const texts = processCharacterDataMutations(filteredMutations.filter((mutation) => mutation.type === 'characterData' && !hasBeenSerialized(mutation.target)), nodePrivacyLevelCache, transaction);
|
|
59
|
+
const attributes = processAttributesMutations(filteredMutations.filter((mutation) => mutation.type === 'attributes' && !hasBeenSerialized(mutation.target)), nodePrivacyLevelCache, transaction);
|
|
60
|
+
if (!texts.length && !attributes.length && !removes.length && !adds.length) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
transaction.add((0, assembly_1.assembleIncrementalSnapshot)(types_1.IncrementalSource.Mutation, {
|
|
64
|
+
adds,
|
|
65
|
+
removes,
|
|
66
|
+
texts,
|
|
67
|
+
attributes,
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
70
|
+
function processChildListMutations(mutations, nodePrivacyLevelCache, transaction) {
|
|
71
|
+
// First, we iterate over mutations to collect:
|
|
72
|
+
//
|
|
73
|
+
// * nodes that have been added in the document and not removed by a subsequent mutation
|
|
74
|
+
// * nodes that have been removed from the document but were not added in a previous mutation
|
|
75
|
+
//
|
|
76
|
+
// For this second category, we also collect their previous parent (mutation.target) because we'll
|
|
77
|
+
// need it to emit a 'remove' mutation.
|
|
78
|
+
//
|
|
79
|
+
// Those two categories may overlap: if a node moved from a position to another, it is reported as
|
|
80
|
+
// two mutation records, one with a "removedNodes" and the other with "addedNodes". In this case,
|
|
81
|
+
// the node will be in both sets.
|
|
82
|
+
const addedAndMovedNodes = new Set();
|
|
83
|
+
const removedNodes = new Map();
|
|
84
|
+
for (const mutation of mutations) {
|
|
85
|
+
mutation.addedNodes.forEach((node) => {
|
|
86
|
+
addedAndMovedNodes.add(node);
|
|
87
|
+
});
|
|
88
|
+
mutation.removedNodes.forEach((node) => {
|
|
89
|
+
if (!addedAndMovedNodes.has(node)) {
|
|
90
|
+
removedNodes.set(node, mutation.target);
|
|
91
|
+
}
|
|
92
|
+
addedAndMovedNodes.delete(node);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
// Then, we sort nodes that are still in the document by topological order, for two reasons:
|
|
96
|
+
//
|
|
97
|
+
// * We will serialize each added nodes with their descendants. We don't want to serialize a node
|
|
98
|
+
// twice, so we need to iterate over the parent nodes first and skip any node that is contained in
|
|
99
|
+
// a precedent node.
|
|
100
|
+
//
|
|
101
|
+
// * To emit "add" mutations, we need references to the parent and potential next sibling of each
|
|
102
|
+
// added node. So we need to iterate over the parent nodes first, and when multiple nodes are
|
|
103
|
+
// siblings, we want to iterate from last to first. This will ensure that any "next" node is
|
|
104
|
+
// already serialized and have an id.
|
|
105
|
+
const sortedAddedAndMovedNodes = Array.from(addedAndMovedNodes);
|
|
106
|
+
sortAddedAndMovedNodes(sortedAddedAndMovedNodes);
|
|
107
|
+
// Then, we iterate over our sorted node sets to emit mutations. We collect the newly serialized
|
|
108
|
+
// node ids in a set to be able to skip subsequent related mutations.
|
|
109
|
+
transaction.serializedNodeIds = new Set();
|
|
110
|
+
const addedNodeMutations = [];
|
|
111
|
+
for (const node of sortedAddedAndMovedNodes) {
|
|
112
|
+
if (hasBeenSerialized(node)) {
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
const parentNodePrivacyLevel = (0, kubesense_browser_rum_core_1.getNodePrivacyLevel)(node.parentNode, transaction.scope.configuration.defaultPrivacyLevel, nodePrivacyLevelCache);
|
|
116
|
+
if (parentNodePrivacyLevel === kubesense_browser_rum_core_1.NodePrivacyLevel.HIDDEN || parentNodePrivacyLevel === kubesense_browser_rum_core_1.NodePrivacyLevel.IGNORE) {
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
const serializedNode = (0, serialization_1.serializeNode)(node, parentNodePrivacyLevel, transaction);
|
|
120
|
+
if (!serializedNode) {
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
const parentNode = (0, kubesense_browser_rum_core_1.getParentNode)(node);
|
|
124
|
+
addedNodeMutations.push({
|
|
125
|
+
nextId: getNextSibling(node),
|
|
126
|
+
parentId: transaction.scope.nodeIds.get(parentNode),
|
|
127
|
+
node: serializedNode,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
// Finally, we emit remove mutations.
|
|
131
|
+
const removedNodeMutations = [];
|
|
132
|
+
removedNodes.forEach((parent, node) => {
|
|
133
|
+
const parentId = transaction.scope.nodeIds.get(parent);
|
|
134
|
+
const id = transaction.scope.nodeIds.get(node);
|
|
135
|
+
if (parentId !== undefined && id !== undefined) {
|
|
136
|
+
removedNodeMutations.push({ parentId, id });
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
return { adds: addedNodeMutations, removes: removedNodeMutations, hasBeenSerialized };
|
|
140
|
+
function hasBeenSerialized(node) {
|
|
141
|
+
var _a;
|
|
142
|
+
const id = transaction.scope.nodeIds.get(node);
|
|
143
|
+
return id !== undefined && ((_a = transaction.serializedNodeIds) === null || _a === void 0 ? void 0 : _a.has(id));
|
|
144
|
+
}
|
|
145
|
+
function getNextSibling(node) {
|
|
146
|
+
let nextSibling = node.nextSibling;
|
|
147
|
+
while (nextSibling) {
|
|
148
|
+
const id = transaction.scope.nodeIds.get(nextSibling);
|
|
149
|
+
if (id !== undefined) {
|
|
150
|
+
return id;
|
|
151
|
+
}
|
|
152
|
+
nextSibling = nextSibling.nextSibling;
|
|
153
|
+
}
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function processCharacterDataMutations(mutations, nodePrivacyLevelCache, transaction) {
|
|
158
|
+
var _a;
|
|
159
|
+
const textMutations = [];
|
|
160
|
+
// Deduplicate mutations based on their target node
|
|
161
|
+
const handledNodes = new Set();
|
|
162
|
+
const filteredMutations = mutations.filter((mutation) => {
|
|
163
|
+
if (handledNodes.has(mutation.target)) {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
handledNodes.add(mutation.target);
|
|
167
|
+
return true;
|
|
168
|
+
});
|
|
169
|
+
// Emit mutations
|
|
170
|
+
for (const mutation of filteredMutations) {
|
|
171
|
+
const value = mutation.target.textContent;
|
|
172
|
+
if (value === mutation.oldValue) {
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
const id = transaction.scope.nodeIds.get(mutation.target);
|
|
176
|
+
if (id === undefined) {
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
const parentNodePrivacyLevel = (0, kubesense_browser_rum_core_1.getNodePrivacyLevel)((0, kubesense_browser_rum_core_1.getParentNode)(mutation.target), transaction.scope.configuration.defaultPrivacyLevel, nodePrivacyLevelCache);
|
|
180
|
+
if (parentNodePrivacyLevel === kubesense_browser_rum_core_1.NodePrivacyLevel.HIDDEN || parentNodePrivacyLevel === kubesense_browser_rum_core_1.NodePrivacyLevel.IGNORE) {
|
|
181
|
+
continue;
|
|
182
|
+
}
|
|
183
|
+
textMutations.push({
|
|
184
|
+
id,
|
|
185
|
+
value: (_a = (0, kubesense_browser_rum_core_1.getTextContent)(mutation.target, parentNodePrivacyLevel)) !== null && _a !== void 0 ? _a : null,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
return textMutations;
|
|
189
|
+
}
|
|
190
|
+
function processAttributesMutations(mutations, nodePrivacyLevelCache, transaction) {
|
|
191
|
+
const attributeMutations = [];
|
|
192
|
+
// Deduplicate mutations based on their target node and changed attribute
|
|
193
|
+
const handledElements = new Map();
|
|
194
|
+
const filteredMutations = mutations.filter((mutation) => {
|
|
195
|
+
const handledAttributes = handledElements.get(mutation.target);
|
|
196
|
+
if (handledAttributes && handledAttributes.has(mutation.attributeName)) {
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
if (!handledAttributes) {
|
|
200
|
+
handledElements.set(mutation.target, new Set([mutation.attributeName]));
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
handledAttributes.add(mutation.attributeName);
|
|
204
|
+
}
|
|
205
|
+
return true;
|
|
206
|
+
});
|
|
207
|
+
// Emit mutations
|
|
208
|
+
const emittedMutations = new Map();
|
|
209
|
+
for (const mutation of filteredMutations) {
|
|
210
|
+
const uncensoredValue = mutation.target.getAttribute(mutation.attributeName);
|
|
211
|
+
if (uncensoredValue === mutation.oldValue) {
|
|
212
|
+
continue;
|
|
213
|
+
}
|
|
214
|
+
const id = transaction.scope.nodeIds.get(mutation.target);
|
|
215
|
+
if (id === undefined) {
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
const privacyLevel = (0, kubesense_browser_rum_core_1.getNodePrivacyLevel)(mutation.target, transaction.scope.configuration.defaultPrivacyLevel, nodePrivacyLevelCache);
|
|
219
|
+
const attributeValue = (0, serialization_1.serializeAttribute)(mutation.target, privacyLevel, mutation.attributeName, transaction.scope.configuration);
|
|
220
|
+
let transformedValue;
|
|
221
|
+
if (mutation.attributeName === 'value') {
|
|
222
|
+
const inputValue = (0, serialization_1.getElementInputValue)(mutation.target, privacyLevel);
|
|
223
|
+
if (inputValue === undefined) {
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
transformedValue = inputValue;
|
|
227
|
+
}
|
|
228
|
+
else if (typeof attributeValue === 'string') {
|
|
229
|
+
transformedValue = attributeValue;
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
transformedValue = null;
|
|
233
|
+
}
|
|
234
|
+
let emittedMutation = emittedMutations.get(mutation.target);
|
|
235
|
+
if (!emittedMutation) {
|
|
236
|
+
emittedMutation = { id, attributes: {} };
|
|
237
|
+
attributeMutations.push(emittedMutation);
|
|
238
|
+
emittedMutations.set(mutation.target, emittedMutation);
|
|
239
|
+
}
|
|
240
|
+
emittedMutation.attributes[mutation.attributeName] = transformedValue;
|
|
241
|
+
}
|
|
242
|
+
return attributeMutations;
|
|
243
|
+
}
|
|
244
|
+
function sortAddedAndMovedNodes(nodes) {
|
|
245
|
+
nodes.sort((a, b) => {
|
|
246
|
+
const position = a.compareDocumentPosition(b);
|
|
247
|
+
/* eslint-disable no-bitwise */
|
|
248
|
+
if (position & Node.DOCUMENT_POSITION_CONTAINED_BY) {
|
|
249
|
+
return -1;
|
|
250
|
+
}
|
|
251
|
+
else if (position & Node.DOCUMENT_POSITION_CONTAINS) {
|
|
252
|
+
return 1;
|
|
253
|
+
}
|
|
254
|
+
else if (position & Node.DOCUMENT_POSITION_FOLLOWING) {
|
|
255
|
+
return 1;
|
|
256
|
+
}
|
|
257
|
+
else if (position & Node.DOCUMENT_POSITION_PRECEDING) {
|
|
258
|
+
return -1;
|
|
259
|
+
}
|
|
260
|
+
/* eslint-enable no-bitwise */
|
|
261
|
+
return 0;
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
function traverseRemovedShadowDom(removedNode, shadowDomRemovedCallback) {
|
|
265
|
+
if ((0, kubesense_browser_rum_core_1.isNodeShadowHost)(removedNode)) {
|
|
266
|
+
shadowDomRemovedCallback(removedNode.shadowRoot);
|
|
267
|
+
}
|
|
268
|
+
(0, kubesense_browser_rum_core_1.forEachChildNodes)(removedNode, (childNode) => traverseRemovedShadowDom(childNode, shadowDomRemovedCallback));
|
|
269
|
+
}
|
|
270
|
+
//# sourceMappingURL=trackMutation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackMutation.js","sourceRoot":"","sources":["../../../../src/domain/record/trackers/trackMutation.ts"],"names":[],"mappings":";;AAwCA,sCA0CC;AAqSD,wDAgBC;AAvYD,8EAAiE;AAQjE,sFAAiM;AACjM,0CAAkD;AAUlD,oDAMyB;AACzB,oDAAsD;AAEtD,0CAAyD;AASzD;;GAEG;AACH,SAAgB,aAAa,CAC3B,MAAY,EACZ,UAA8B,EAC9B,SAA4B,EAC5B,KAAqB;IAErB,MAAM,gBAAgB,GAAG,IAAA,2DAA8B,GAAE,CAAA;IACzD,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACtB,OAAO,EAAE,IAAI,EAAE,6BAAI,EAAE,KAAK,EAAE,6BAAI,EAAE,CAAA;IACpC,CAAC;IAED,MAAM,aAAa,GAAG,IAAA,mCAAmB,EAAC,CAAC,SAAS,EAAE,EAAE;QACtD,IAAA,sCAAsB,kDAEpB,UAAU,EACV,SAAS,EACT,KAAK,EACL,CAAC,WAAqC,EAAE,EAAE,CACxC,gBAAgB,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,WAAW,EAAyB,CAAC,EAAE,WAAW,CAAC,CACjG,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,IAAA,gCAAO,EAAC,aAAa,CAAC,YAAY,CAA4C,CAAC,CAAA;IAErH,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE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,CAAC,EAAE,CAAC;QAClC,wBAAwB,CAAC,WAAW,CAAC,UAAU,CAAC,CAAA;IAClD,CAAC;IACD,IAAA,8CAAiB,EAAC,WAAW,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,wBAAwB,CAAC,SAAS,EAAE,wBAAwB,CAAC,CAAC,CAAA;AAC9G,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { BrowserIncrementalSnapshotRecord } from '../../../types';
|
|
2
|
+
import type { RecordingScope } from '../recordingScope';
|
|
3
|
+
import type { EmitRecordCallback } from '../record.types';
|
|
4
|
+
import type { Tracker } from './tracker.types';
|
|
5
|
+
export declare function trackScroll(target: Document | ShadowRoot, emitRecord: EmitRecordCallback<BrowserIncrementalSnapshotRecord>, scope: RecordingScope): Tracker;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.trackScroll = trackScroll;
|
|
4
|
+
const kubesense_browser_core_1 = require("@kubesense/kubesense-browser-core");
|
|
5
|
+
const kubesense_browser_rum_core_1 = require("@kubesense/kubesense-browser-rum-core");
|
|
6
|
+
const eventsUtils_1 = require("../eventsUtils");
|
|
7
|
+
const types_1 = require("../../../types");
|
|
8
|
+
const assembly_1 = require("../assembly");
|
|
9
|
+
const SCROLL_OBSERVER_THRESHOLD = 100;
|
|
10
|
+
function trackScroll(target, emitRecord, scope) {
|
|
11
|
+
const { throttled: updatePosition, cancel: cancelThrottle } = (0, kubesense_browser_core_1.throttle)((event) => {
|
|
12
|
+
const target = (0, eventsUtils_1.getEventTarget)(event);
|
|
13
|
+
if (!target) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const id = scope.nodeIds.get(target);
|
|
17
|
+
if (id === undefined ||
|
|
18
|
+
(0, kubesense_browser_rum_core_1.getNodePrivacyLevel)(target, scope.configuration.defaultPrivacyLevel) === kubesense_browser_rum_core_1.NodePrivacyLevel.HIDDEN) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const scrollPositions = target === document
|
|
22
|
+
? {
|
|
23
|
+
scrollTop: (0, kubesense_browser_rum_core_1.getScrollY)(),
|
|
24
|
+
scrollLeft: (0, kubesense_browser_rum_core_1.getScrollX)(),
|
|
25
|
+
}
|
|
26
|
+
: {
|
|
27
|
+
scrollTop: Math.round(target.scrollTop),
|
|
28
|
+
scrollLeft: Math.round(target.scrollLeft),
|
|
29
|
+
};
|
|
30
|
+
scope.elementsScrollPositions.set(target, scrollPositions);
|
|
31
|
+
emitRecord((0, assembly_1.assembleIncrementalSnapshot)(types_1.IncrementalSource.Scroll, {
|
|
32
|
+
id,
|
|
33
|
+
x: scrollPositions.scrollLeft,
|
|
34
|
+
y: scrollPositions.scrollTop,
|
|
35
|
+
}));
|
|
36
|
+
}, SCROLL_OBSERVER_THRESHOLD);
|
|
37
|
+
const { stop: removeListener } = (0, kubesense_browser_core_1.addEventListener)(scope.configuration, target, "scroll" /* DOM_EVENT.SCROLL */, updatePosition, {
|
|
38
|
+
capture: true,
|
|
39
|
+
passive: true,
|
|
40
|
+
});
|
|
41
|
+
return {
|
|
42
|
+
stop: () => {
|
|
43
|
+
removeListener();
|
|
44
|
+
cancelThrottle();
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=trackScroll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackScroll.js","sourceRoot":"","sources":["../../../../src/domain/record/trackers/trackScroll.ts"],"names":[],"mappings":";;AAYA,kCAgDC;AA5DD,8EAAyF;AACzF,sFAAqH;AACrH,gDAA+C;AAC/C,0CAAkD;AAElD,0CAAyD;AAKzD,MAAM,yBAAyB,GAAG,GAAG,CAAA;AAErC,SAAgB,WAAW,CACzB,MAA6B,EAC7B,UAAgE,EAChE,KAAqB;IAErB,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,cA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GAAG,EAAE;YACT,cAAc,EAAE,CAAA;YAChB,cAAc,EAAE,CAAA;QAClB,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { BrowserIncrementalSnapshotRecord } from '../../../types';
|
|
2
|
+
import type { RecordingScope } from '../recordingScope';
|
|
3
|
+
import type { EmitRecordCallback } from '../record.types';
|
|
4
|
+
import type { Tracker } from './tracker.types';
|
|
5
|
+
export declare function trackStyleSheet(emitRecord: EmitRecordCallback<BrowserIncrementalSnapshotRecord>, scope: RecordingScope): Tracker;
|
|
6
|
+
export declare function getPathToNestedCSSRule(rule: CSSRule): number[] | undefined;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.trackStyleSheet = trackStyleSheet;
|
|
4
|
+
exports.getPathToNestedCSSRule = getPathToNestedCSSRule;
|
|
5
|
+
const kubesense_browser_core_1 = require("@kubesense/kubesense-browser-core");
|
|
6
|
+
const types_1 = require("../../../types");
|
|
7
|
+
const assembly_1 = require("../assembly");
|
|
8
|
+
function trackStyleSheet(emitRecord, scope) {
|
|
9
|
+
function checkStyleSheetAndCallback(styleSheet, callback) {
|
|
10
|
+
if (!styleSheet || !styleSheet.ownerNode) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const id = scope.nodeIds.get(styleSheet.ownerNode);
|
|
14
|
+
if (id === undefined) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
callback(id);
|
|
18
|
+
}
|
|
19
|
+
const instrumentationStoppers = [
|
|
20
|
+
(0, kubesense_browser_core_1.instrumentMethod)(CSSStyleSheet.prototype, 'insertRule', ({ target: styleSheet, parameters: [rule, index] }) => {
|
|
21
|
+
checkStyleSheetAndCallback(styleSheet, (id) => emitRecord((0, assembly_1.assembleIncrementalSnapshot)(types_1.IncrementalSource.StyleSheetRule, {
|
|
22
|
+
id,
|
|
23
|
+
adds: [{ rule, index }],
|
|
24
|
+
})));
|
|
25
|
+
}),
|
|
26
|
+
(0, kubesense_browser_core_1.instrumentMethod)(CSSStyleSheet.prototype, 'deleteRule', ({ target: styleSheet, parameters: [index] }) => {
|
|
27
|
+
checkStyleSheetAndCallback(styleSheet, (id) => emitRecord((0, assembly_1.assembleIncrementalSnapshot)(types_1.IncrementalSource.StyleSheetRule, {
|
|
28
|
+
id,
|
|
29
|
+
removes: [{ index }],
|
|
30
|
+
})));
|
|
31
|
+
}),
|
|
32
|
+
];
|
|
33
|
+
if (typeof CSSGroupingRule !== 'undefined') {
|
|
34
|
+
instrumentGroupingCSSRuleClass(CSSGroupingRule);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
instrumentGroupingCSSRuleClass(CSSMediaRule);
|
|
38
|
+
instrumentGroupingCSSRuleClass(CSSSupportsRule);
|
|
39
|
+
}
|
|
40
|
+
function instrumentGroupingCSSRuleClass(cls) {
|
|
41
|
+
instrumentationStoppers.push((0, kubesense_browser_core_1.instrumentMethod)(cls.prototype, 'insertRule', ({ target: styleSheet, parameters: [rule, index] }) => {
|
|
42
|
+
checkStyleSheetAndCallback(styleSheet.parentStyleSheet, (id) => {
|
|
43
|
+
const path = getPathToNestedCSSRule(styleSheet);
|
|
44
|
+
if (path) {
|
|
45
|
+
path.push(index || 0);
|
|
46
|
+
emitRecord((0, assembly_1.assembleIncrementalSnapshot)(types_1.IncrementalSource.StyleSheetRule, {
|
|
47
|
+
id,
|
|
48
|
+
adds: [{ rule, index: path }],
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}), (0, kubesense_browser_core_1.instrumentMethod)(cls.prototype, 'deleteRule', ({ target: styleSheet, parameters: [index] }) => {
|
|
53
|
+
checkStyleSheetAndCallback(styleSheet.parentStyleSheet, (id) => {
|
|
54
|
+
const path = getPathToNestedCSSRule(styleSheet);
|
|
55
|
+
if (path) {
|
|
56
|
+
path.push(index);
|
|
57
|
+
emitRecord((0, assembly_1.assembleIncrementalSnapshot)(types_1.IncrementalSource.StyleSheetRule, {
|
|
58
|
+
id,
|
|
59
|
+
removes: [{ index: path }],
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
stop: () => {
|
|
67
|
+
instrumentationStoppers.forEach((stopper) => stopper.stop());
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function getPathToNestedCSSRule(rule) {
|
|
72
|
+
const path = [];
|
|
73
|
+
let currentRule = rule;
|
|
74
|
+
while (currentRule.parentRule) {
|
|
75
|
+
const rules = Array.from(currentRule.parentRule.cssRules);
|
|
76
|
+
const index = rules.indexOf(currentRule);
|
|
77
|
+
path.unshift(index);
|
|
78
|
+
currentRule = currentRule.parentRule;
|
|
79
|
+
}
|
|
80
|
+
// A rule may not be attached to a stylesheet
|
|
81
|
+
if (!currentRule.parentStyleSheet) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const rules = Array.from(currentRule.parentStyleSheet.cssRules);
|
|
85
|
+
const index = rules.indexOf(currentRule);
|
|
86
|
+
path.unshift(index);
|
|
87
|
+
return path;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=trackStyleSheet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackStyleSheet.js","sourceRoot":"","sources":["../../../../src/domain/record/trackers/trackStyleSheet.ts"],"names":[],"mappings":";;AAUA,0CAqFC;AAED,wDAmBC;AApHD,8EAAoE;AACpE,0CAAkD;AAElD,0CAAyD;AAOzD,SAAgB,eAAe,CAC7B,UAAgE,EAChE,KAAqB;IAErB,SAAS,0BAA0B,CAAC,UAAgC,EAAE,QAA8B;QAClG,IAAI,CAAC,UAAU,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC;YACzC,OAAM;QACR,CAAC;QACD,MAAM,EAAE,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AC;IAED,OAAO;QACL,IAAI,EAAE,GAAG,EAAE;YACT,uBAAuB,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAA;QAC9D,CAAC;KACF,CAAA;AACH,CAAC;AAED,SAAgB,sBAAsB,CAAC,IAAa;IAClD,MAAM,IAAI,GAAa,EAAE,CAAA;IACzB,IAAI,WAAW,GAAG,IAAI,CAAA;IACtB,OAAO,WAAW,CAAC,UAAU,EAAE,CAAC;QAC9B,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAE,WAAW,CAAC,UAA8B,CAAC,QAAQ,CAAC,CAAA;QAC9E,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;QACxC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;QACnB,WAAW,GAAG,WAAW,CAAC,UAAU,CAAA;IACtC,CAAC;IACD,6CAA6C;IAC7C,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE,CAAC;QAClC,OAAM;IACR,CAAC;IAED,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAA;IAC/D,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;IACxC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;IAEnB,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { LifeCycle } from '@kubesense/kubesense-browser-rum-core';
|
|
2
|
+
import type { ViewEndRecord } from '../../../types';
|
|
3
|
+
import type { EmitRecordCallback } from '../record.types';
|
|
4
|
+
import type { Tracker } from './tracker.types';
|
|
5
|
+
export declare function trackViewEnd(lifeCycle: LifeCycle, emitRecord: EmitRecordCallback<ViewEndRecord>, flushMutations: () => void): Tracker;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.trackViewEnd = trackViewEnd;
|
|
4
|
+
const kubesense_browser_core_1 = require("@kubesense/kubesense-browser-core");
|
|
5
|
+
const types_1 = require("../../../types");
|
|
6
|
+
function trackViewEnd(lifeCycle, emitRecord, flushMutations) {
|
|
7
|
+
const viewEndSubscription = lifeCycle.subscribe(5 /* LifeCycleEventType.VIEW_ENDED */, () => {
|
|
8
|
+
flushMutations();
|
|
9
|
+
emitRecord({
|
|
10
|
+
timestamp: (0, kubesense_browser_core_1.timeStampNow)(),
|
|
11
|
+
type: types_1.RecordType.ViewEnd,
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
return {
|
|
15
|
+
stop: () => {
|
|
16
|
+
viewEndSubscription.unsubscribe();
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=trackViewEnd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackViewEnd.js","sourceRoot":"","sources":["../../../../src/domain/record/trackers/trackViewEnd.ts"],"names":[],"mappings":";;AAQA,oCAkBC;AA1BD,8EAAgE;AAIhE,0CAA2C;AAI3C,SAAgB,YAAY,CAC1B,SAAoB,EACpB,UAA6C,EAC7C,cAA0B;IAE1B,MAAM,mBAAmB,GAAG,SAAS,CAAC,SAAS,wCAAgC,GAAG,EAAE;QAClF,cAAc,EAAE,CAAA;QAChB,UAAU,CAAC;YACT,SAAS,EAAE,IAAA,qCAAY,GAAE;YACzB,IAAI,EAAE,kBAAU,CAAC,OAAO;SACzB,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,OAAO;QACL,IAAI,EAAE,GAAG,EAAE;YACT,mBAAmB,CAAC,WAAW,EAAE,CAAA;QACnC,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { BrowserIncrementalSnapshotRecord, VisualViewportRecord } from '../../../types';
|
|
2
|
+
import type { EmitRecordCallback } from '../record.types';
|
|
3
|
+
import type { RecordingScope } from '../recordingScope';
|
|
4
|
+
import type { Tracker } from './tracker.types';
|
|
5
|
+
export declare function trackViewportResize(emitRecord: EmitRecordCallback<BrowserIncrementalSnapshotRecord>, scope: RecordingScope): Tracker;
|
|
6
|
+
export declare function trackVisualViewportResize(emitRecord: EmitRecordCallback<VisualViewportRecord>, scope: RecordingScope): Tracker;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.trackViewportResize = trackViewportResize;
|
|
4
|
+
exports.trackVisualViewportResize = trackVisualViewportResize;
|
|
5
|
+
const kubesense_browser_core_1 = require("@kubesense/kubesense-browser-core");
|
|
6
|
+
const kubesense_browser_rum_core_1 = require("@kubesense/kubesense-browser-rum-core");
|
|
7
|
+
const types_1 = require("../../../types");
|
|
8
|
+
const viewports_1 = require("../viewports");
|
|
9
|
+
const assembly_1 = require("../assembly");
|
|
10
|
+
const VISUAL_VIEWPORT_OBSERVER_THRESHOLD = 200;
|
|
11
|
+
function trackViewportResize(emitRecord, scope) {
|
|
12
|
+
const viewportResizeSubscription = (0, kubesense_browser_rum_core_1.initViewportObservable)(scope.configuration).subscribe((data) => {
|
|
13
|
+
emitRecord((0, assembly_1.assembleIncrementalSnapshot)(types_1.IncrementalSource.ViewportResize, data));
|
|
14
|
+
});
|
|
15
|
+
return {
|
|
16
|
+
stop: () => {
|
|
17
|
+
viewportResizeSubscription.unsubscribe();
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function trackVisualViewportResize(emitRecord, scope) {
|
|
22
|
+
const visualViewport = window.visualViewport;
|
|
23
|
+
if (!visualViewport) {
|
|
24
|
+
return { stop: kubesense_browser_core_1.noop };
|
|
25
|
+
}
|
|
26
|
+
const { throttled: updateDimension, cancel: cancelThrottle } = (0, kubesense_browser_core_1.throttle)(() => {
|
|
27
|
+
emitRecord({
|
|
28
|
+
data: (0, viewports_1.getVisualViewport)(visualViewport),
|
|
29
|
+
type: types_1.RecordType.VisualViewport,
|
|
30
|
+
timestamp: (0, kubesense_browser_core_1.timeStampNow)(),
|
|
31
|
+
});
|
|
32
|
+
}, VISUAL_VIEWPORT_OBSERVER_THRESHOLD, {
|
|
33
|
+
trailing: false,
|
|
34
|
+
});
|
|
35
|
+
const { stop: removeListener } = (0, kubesense_browser_core_1.addEventListeners)(scope.configuration, visualViewport, ["resize" /* DOM_EVENT.RESIZE */, "scroll" /* DOM_EVENT.SCROLL */], updateDimension, {
|
|
36
|
+
capture: true,
|
|
37
|
+
passive: true,
|
|
38
|
+
});
|
|
39
|
+
return {
|
|
40
|
+
stop: () => {
|
|
41
|
+
removeListener();
|
|
42
|
+
cancelThrottle();
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=trackViewportResize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trackViewportResize.js","sourceRoot":"","sources":["../../../../src/domain/record/trackers/trackViewportResize.ts"],"names":[],"mappings":";;AAaA,kDAeC;AAED,8DAsCC;AApED,8EAA8G;AAE9G,sFAA8E;AAC9E,0CAA8D;AAE9D,4CAAgD;AAChD,0CAAyD;AAKzD,MAAM,kCAAkC,GAAG,GAAG,CAAA;AAE9C,SAAgB,mBAAmB,CACjC,UAAgE,EAChE,KAAqB;IAErB,MAAM,0BAA0B,GAAG,IAAA,mDAAsB,EAAC,KAAK,CAAC,aAAa,CAAC,CAAC,SAAS,CACtF,CAAC,IAAuB,EAAE,EAAE;QAC1B,UAAU,CAAC,IAAA,sCAA2B,EAAqB,yBAAiB,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC,CAAA;IACrG,CAAC,CACF,CAAA;IAED,OAAO;QACL,IAAI,EAAE,GAAG,EAAE;YACT,0BAA0B,CAAC,WAAW,EAAE,CAAA;QAC1C,CAAC;KACF,CAAA;AACH,CAAC;AAED,SAAgB,yBAAyB,CACvC,UAAoD,EACpD,KAAqB;IAErB,MAAM,cAAc,GAAG,MAAM,CAAC,cAAc,CAAA;IAC5C,IAAI,CAAC,cAAc,EAAE,CAAC;QACpB,OAAO,EAAE,IAAI,EAAE,6BAAI,EAAE,CAAA;IACvB,CAAC;IACD,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,IAAA,iCAAQ,EACrE,GAAG,EAAE;QACH,UAAU,CAAC;YACT,IAAI,EAAE,IAAA,6BAAiB,EAAC,cAAc,CAAC;YACvC,IAAI,EAAE,kBAAU,CAAC,cAAc;YAC/B,SAAS,EAAE,IAAA,qCAAY,GAAE;SAC1B,CAAC,CAAA;IACJ,CAAC,EACD,kCAAkC,EAClC;QACE,QAAQ,EAAE,KAAK;KAChB,CACF,CAAA;IACD,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,IAAA,0CAAiB,EAChD,KAAK,CAAC,aAAa,EACnB,cAAc,EACd,kEAAoC,EACpC,eAAe,EACf;QACE,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,IAAI;KACd,CACF,CAAA;IAED,OAAO;QACL,IAAI,EAAE,GAAG,EAAE;YACT,cAAc,EAAE,CAAA;YAChB,cAAc,EAAE,CAAA;QAClB,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracker.types.js","sourceRoot":"","sources":["../../../../src/domain/record/trackers/tracker.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browsers have not standardized various dimension properties. Mobile devices typically report
|
|
3
|
+
* dimensions in reference to the visual viewport, while desktop uses the layout viewport. For example,
|
|
4
|
+
* Mobile Chrome will change innerWidth when a pinch zoom takes place, while Chrome Desktop (mac) will not.
|
|
5
|
+
*
|
|
6
|
+
* With the new Viewport API, we now calculate and normalize dimension properties to the layout viewport.
|
|
7
|
+
* If the VisualViewport API is not supported by a browser, it isn't reasonably possible to detect or normalize
|
|
8
|
+
* which viewport is being measured. Therefore these exported functions will fallback to assuming that the layout
|
|
9
|
+
* viewport is being measured by the browser
|
|
10
|
+
*/
|
|
11
|
+
import type { VisualViewportRecord } from '../../types';
|
|
12
|
+
interface LayoutCoordinates {
|
|
13
|
+
layoutViewportX: number;
|
|
14
|
+
layoutViewportY: number;
|
|
15
|
+
visualViewportX: number;
|
|
16
|
+
visualViewportY: number;
|
|
17
|
+
}
|
|
18
|
+
export declare const convertMouseEventToLayoutCoordinates: (clientX: number, clientY: number) => LayoutCoordinates;
|
|
19
|
+
export declare const getVisualViewport: (visualViewport: VisualViewport) => VisualViewportRecord["data"];
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Browsers have not standardized various dimension properties. Mobile devices typically report
|
|
4
|
+
* dimensions in reference to the visual viewport, while desktop uses the layout viewport. For example,
|
|
5
|
+
* Mobile Chrome will change innerWidth when a pinch zoom takes place, while Chrome Desktop (mac) will not.
|
|
6
|
+
*
|
|
7
|
+
* With the new Viewport API, we now calculate and normalize dimension properties to the layout viewport.
|
|
8
|
+
* If the VisualViewport API is not supported by a browser, it isn't reasonably possible to detect or normalize
|
|
9
|
+
* which viewport is being measured. Therefore these exported functions will fallback to assuming that the layout
|
|
10
|
+
* viewport is being measured by the browser
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.getVisualViewport = exports.convertMouseEventToLayoutCoordinates = void 0;
|
|
14
|
+
// Scrollbar widths vary across properties on different devices and browsers
|
|
15
|
+
const TOLERANCE = 25;
|
|
16
|
+
/**
|
|
17
|
+
* Use the Visual Viewport API's properties to measure scrollX/Y in reference to the layout viewport
|
|
18
|
+
* in order to determine if window.scrollX/Y is measuring the layout or visual viewport.
|
|
19
|
+
* This finding corresponds to which viewport mouseEvent.clientX/Y and window.innerWidth/Height measures.
|
|
20
|
+
*/
|
|
21
|
+
function isVisualViewportFactoredIn(visualViewport) {
|
|
22
|
+
return (Math.abs(visualViewport.pageTop - visualViewport.offsetTop - window.scrollY) > TOLERANCE ||
|
|
23
|
+
Math.abs(visualViewport.pageLeft - visualViewport.offsetLeft - window.scrollX) > TOLERANCE);
|
|
24
|
+
}
|
|
25
|
+
const convertMouseEventToLayoutCoordinates = (clientX, clientY) => {
|
|
26
|
+
const visualViewport = window.visualViewport;
|
|
27
|
+
const normalized = {
|
|
28
|
+
layoutViewportX: clientX,
|
|
29
|
+
layoutViewportY: clientY,
|
|
30
|
+
visualViewportX: clientX,
|
|
31
|
+
visualViewportY: clientY,
|
|
32
|
+
};
|
|
33
|
+
if (!visualViewport) {
|
|
34
|
+
// On old browsers, we cannot normalize, so fallback to clientX/Y
|
|
35
|
+
return normalized;
|
|
36
|
+
}
|
|
37
|
+
else if (isVisualViewportFactoredIn(visualViewport)) {
|
|
38
|
+
// Typically Mobile Devices
|
|
39
|
+
normalized.layoutViewportX = Math.round(clientX + visualViewport.offsetLeft);
|
|
40
|
+
normalized.layoutViewportY = Math.round(clientY + visualViewport.offsetTop);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
// Typically Desktop Devices
|
|
44
|
+
normalized.visualViewportX = Math.round(clientX - visualViewport.offsetLeft);
|
|
45
|
+
normalized.visualViewportY = Math.round(clientY - visualViewport.offsetTop);
|
|
46
|
+
}
|
|
47
|
+
return normalized;
|
|
48
|
+
};
|
|
49
|
+
exports.convertMouseEventToLayoutCoordinates = convertMouseEventToLayoutCoordinates;
|
|
50
|
+
const getVisualViewport = (visualViewport) => ({
|
|
51
|
+
scale: visualViewport.scale,
|
|
52
|
+
offsetLeft: visualViewport.offsetLeft,
|
|
53
|
+
offsetTop: visualViewport.offsetTop,
|
|
54
|
+
pageLeft: visualViewport.pageLeft,
|
|
55
|
+
pageTop: visualViewport.pageTop,
|
|
56
|
+
height: visualViewport.height,
|
|
57
|
+
width: visualViewport.width,
|
|
58
|
+
});
|
|
59
|
+
exports.getVisualViewport = getVisualViewport;
|
|
60
|
+
//# sourceMappingURL=viewports.js.map
|