@depup/datadog__browser-rum 6.31.0-depup.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 +25 -0
- package/bundle/chunks/profiler-9f1c1103f1ef0aa98257-datadog-rum.js +1 -0
- package/bundle/chunks/recorder-926b641c6ef51d09a378-datadog-rum.js +1 -0
- package/bundle/datadog-rum.js +1 -0
- package/changes.json +5 -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 +3 -0
- package/cjs/boot/lazyLoadProfiler.js +56 -0
- package/cjs/boot/lazyLoadProfiler.js.map +1 -0
- package/cjs/boot/lazyLoadRecorder.d.ts +3 -0
- package/cjs/boot/lazyLoadRecorder.js +56 -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 +52 -0
- package/cjs/boot/profilerApi.js.map +1 -0
- package/cjs/boot/recorderApi.d.ts +3 -0
- package/cjs/boot/recorderApi.js +71 -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 +29 -0
- package/cjs/domain/deflate/deflateWorker.js +105 -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 +11 -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/actionHistory.d.ts +10 -0
- package/cjs/domain/profiling/actionHistory.js +49 -0
- package/cjs/domain/profiling/actionHistory.js.map +1 -0
- package/cjs/domain/profiling/longTaskHistory.d.ts +11 -0
- package/cjs/domain/profiling/longTaskHistory.js +28 -0
- package/cjs/domain/profiling/longTaskHistory.js.map +1 -0
- package/cjs/domain/profiling/profiler.d.ts +7 -0
- package/cjs/domain/profiling/profiler.js +267 -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 +31 -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 +7 -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 +33 -0
- package/cjs/domain/profiling/transport/buildProfileEventAttributes.js +63 -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 +55 -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 +8 -0
- package/cjs/domain/profiling/utils/getNumberOfSamples.js +19 -0
- package/cjs/domain/profiling/utils/getNumberOfSamples.js.map +1 -0
- package/cjs/domain/profiling/vitalHistory.d.ts +10 -0
- package/cjs/domain/profiling/vitalHistory.js +42 -0
- package/cjs/domain/profiling/vitalHistory.js.map +1 -0
- package/cjs/domain/record/assembly.d.ts +3 -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/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 +6 -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 +55 -0
- package/cjs/domain/record/internalApi.js.map +1 -0
- package/cjs/domain/record/itemIds.d.ts +40 -0
- package/cjs/domain/record/itemIds.js +58 -0
- package/cjs/domain/record/itemIds.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/record.d.ts +16 -0
- package/cjs/domain/record/record.js +88 -0
- package/cjs/domain/record/record.js.map +1 -0
- package/cjs/domain/record/record.types.d.ts +18 -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 +24 -0
- package/cjs/domain/record/recordingScope.js +29 -0
- package/cjs/domain/record/recordingScope.js.map +1 -0
- package/cjs/domain/record/serialization/changeEncoder.d.ts +22 -0
- package/cjs/domain/record/serialization/changeEncoder.js +59 -0
- package/cjs/domain/record/serialization/changeEncoder.js.map +1 -0
- package/cjs/domain/record/serialization/conversions/changeConverter.d.ts +10 -0
- package/cjs/domain/record/serialization/conversions/changeConverter.js +216 -0
- package/cjs/domain/record/serialization/conversions/changeConverter.js.map +1 -0
- package/cjs/domain/record/serialization/conversions/changeDecoder.d.ts +16 -0
- package/cjs/domain/record/serialization/conversions/changeDecoder.js +137 -0
- package/cjs/domain/record/serialization/conversions/changeDecoder.js.map +1 -0
- package/cjs/domain/record/serialization/conversions/index.d.ts +7 -0
- package/cjs/domain/record/serialization/conversions/index.js +11 -0
- package/cjs/domain/record/serialization/conversions/index.js.map +1 -0
- package/cjs/domain/record/serialization/conversions/mutationLog.d.ts +15 -0
- package/cjs/domain/record/serialization/conversions/mutationLog.js +36 -0
- package/cjs/domain/record/serialization/conversions/mutationLog.js.map +1 -0
- package/cjs/domain/record/serialization/conversions/nodeIdRemapper.d.ts +10 -0
- package/cjs/domain/record/serialization/conversions/nodeIdRemapper.js +53 -0
- package/cjs/domain/record/serialization/conversions/nodeIdRemapper.js.map +1 -0
- package/cjs/domain/record/serialization/conversions/renderOptions.d.ts +6 -0
- package/cjs/domain/record/serialization/conversions/renderOptions.js +12 -0
- package/cjs/domain/record/serialization/conversions/renderOptions.js.map +1 -0
- package/cjs/domain/record/serialization/conversions/stringTable.d.ts +5 -0
- package/cjs/domain/record/serialization/conversions/stringTable.js +22 -0
- package/cjs/domain/record/serialization/conversions/stringTable.js.map +1 -0
- package/cjs/domain/record/serialization/conversions/vDocument.d.ts +23 -0
- package/cjs/domain/record/serialization/conversions/vDocument.js +176 -0
- package/cjs/domain/record/serialization/conversions/vDocument.js.map +1 -0
- package/cjs/domain/record/serialization/conversions/vNode.d.ts +66 -0
- package/cjs/domain/record/serialization/conversions/vNode.js +285 -0
- package/cjs/domain/record/serialization/conversions/vNode.js.map +1 -0
- package/cjs/domain/record/serialization/conversions/vStyleSheet.d.ts +16 -0
- package/cjs/domain/record/serialization/conversions/vStyleSheet.js +29 -0
- package/cjs/domain/record/serialization/conversions/vStyleSheet.js.map +1 -0
- package/cjs/domain/record/serialization/experimentalFeatures.d.ts +2 -0
- package/cjs/domain/record/serialization/experimentalFeatures.js +16 -0
- package/cjs/domain/record/serialization/experimentalFeatures.js.map +1 -0
- package/cjs/domain/record/serialization/index.d.ts +17 -0
- package/cjs/domain/record/serialization/index.js +37 -0
- package/cjs/domain/record/serialization/index.js.map +1 -0
- package/cjs/domain/record/serialization/insertionCursor.d.ts +57 -0
- package/cjs/domain/record/serialization/insertionCursor.js +68 -0
- package/cjs/domain/record/serialization/insertionCursor.js.map +1 -0
- package/cjs/domain/record/serialization/serialization.types.d.ts +24 -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 +96 -0
- package/cjs/domain/record/serialization/serializationTransaction.js +103 -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/serializeFullSnapshot.d.ts +5 -0
- package/cjs/domain/record/serialization/serializeFullSnapshot.js +34 -0
- package/cjs/domain/record/serialization/serializeFullSnapshot.js.map +1 -0
- package/cjs/domain/record/serialization/serializeFullSnapshotAsChange.d.ts +5 -0
- package/cjs/domain/record/serialization/serializeFullSnapshotAsChange.js +13 -0
- package/cjs/domain/record/serialization/serializeFullSnapshotAsChange.js.map +1 -0
- package/cjs/domain/record/serialization/serializeMutations.d.ts +11 -0
- package/cjs/domain/record/serialization/serializeMutations.js +262 -0
- package/cjs/domain/record/serialization/serializeMutations.js.map +1 -0
- package/cjs/domain/record/serialization/serializeMutationsAsChange.d.ts +5 -0
- package/cjs/domain/record/serialization/serializeMutationsAsChange.js +204 -0
- package/cjs/domain/record/serialization/serializeMutationsAsChange.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/serializeNodeAsChange.d.ts +4 -0
- package/cjs/domain/record/serialization/serializeNodeAsChange.js +153 -0
- package/cjs/domain/record/serialization/serializeNodeAsChange.js.map +1 -0
- package/cjs/domain/record/serialization/serializeStyleSheets.d.ts +3 -0
- package/cjs/domain/record/serialization/serializeStyleSheets.js +30 -0
- package/cjs/domain/record/serialization/serializeStyleSheets.js.map +1 -0
- package/cjs/domain/record/serializationVerifier.d.ts +18 -0
- package/cjs/domain/record/serializationVerifier.js +126 -0
- package/cjs/domain/record/serializationVerifier.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 +10 -0
- package/cjs/domain/record/startFullSnapshots.js +50 -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 +6 -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 +13 -0
- package/cjs/domain/record/trackers/trackMutation.js +41 -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 +52 -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 +3 -0
- package/cjs/types/index.js +18 -0
- package/cjs/types/index.js.map +1 -0
- package/cjs/types/profiling.d.ts +296 -0
- package/cjs/types/profiling.js +6 -0
- package/cjs/types/profiling.js.map +1 -0
- package/cjs/types/sessionReplay.d.ts +934 -0
- package/cjs/types/sessionReplay.js +6 -0
- package/cjs/types/sessionReplay.js.map +1 -0
- package/cjs/types/sessionReplayConstants.d.ts +71 -0
- package/cjs/types/sessionReplayConstants.js +67 -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 +3 -0
- package/esm/boot/lazyLoadProfiler.js +19 -0
- package/esm/boot/lazyLoadProfiler.js.map +1 -0
- package/esm/boot/lazyLoadRecorder.d.ts +3 -0
- package/esm/boot/lazyLoadRecorder.js +19 -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 +49 -0
- package/esm/boot/profilerApi.js.map +1 -0
- package/esm/boot/recorderApi.d.ts +3 -0
- package/esm/boot/recorderApi.js +68 -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 +29 -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/actionHistory.d.ts +10 -0
- package/esm/domain/profiling/actionHistory.js +45 -0
- package/esm/domain/profiling/actionHistory.js.map +1 -0
- package/esm/domain/profiling/longTaskHistory.d.ts +11 -0
- package/esm/domain/profiling/longTaskHistory.js +24 -0
- package/esm/domain/profiling/longTaskHistory.js.map +1 -0
- package/esm/domain/profiling/profiler.d.ts +7 -0
- package/esm/domain/profiling/profiler.js +263 -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 +28 -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 +7 -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 +33 -0
- package/esm/domain/profiling/transport/buildProfileEventAttributes.js +60 -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 +55 -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 +8 -0
- package/esm/domain/profiling/utils/getNumberOfSamples.js +16 -0
- package/esm/domain/profiling/utils/getNumberOfSamples.js.map +1 -0
- package/esm/domain/profiling/vitalHistory.d.ts +10 -0
- package/esm/domain/profiling/vitalHistory.js +38 -0
- package/esm/domain/profiling/vitalHistory.js.map +1 -0
- package/esm/domain/record/assembly.d.ts +3 -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/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 +6 -0
- package/esm/domain/record/index.js +5 -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 +51 -0
- package/esm/domain/record/internalApi.js.map +1 -0
- package/esm/domain/record/itemIds.d.ts +40 -0
- package/esm/domain/record/itemIds.js +52 -0
- package/esm/domain/record/itemIds.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/record.d.ts +16 -0
- package/esm/domain/record/record.js +52 -0
- package/esm/domain/record/record.js.map +1 -0
- package/esm/domain/record/record.types.d.ts +18 -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 +24 -0
- package/esm/domain/record/recordingScope.js +26 -0
- package/esm/domain/record/recordingScope.js.map +1 -0
- package/esm/domain/record/serialization/changeEncoder.d.ts +22 -0
- package/esm/domain/record/serialization/changeEncoder.js +56 -0
- package/esm/domain/record/serialization/changeEncoder.js.map +1 -0
- package/esm/domain/record/serialization/conversions/changeConverter.d.ts +10 -0
- package/esm/domain/record/serialization/conversions/changeConverter.js +213 -0
- package/esm/domain/record/serialization/conversions/changeConverter.js.map +1 -0
- package/esm/domain/record/serialization/conversions/changeDecoder.d.ts +16 -0
- package/esm/domain/record/serialization/conversions/changeDecoder.js +134 -0
- package/esm/domain/record/serialization/conversions/changeDecoder.js.map +1 -0
- package/esm/domain/record/serialization/conversions/index.d.ts +7 -0
- package/esm/domain/record/serialization/conversions/index.js +4 -0
- package/esm/domain/record/serialization/conversions/index.js.map +1 -0
- package/esm/domain/record/serialization/conversions/mutationLog.d.ts +15 -0
- package/esm/domain/record/serialization/conversions/mutationLog.js +33 -0
- package/esm/domain/record/serialization/conversions/mutationLog.js.map +1 -0
- package/esm/domain/record/serialization/conversions/nodeIdRemapper.d.ts +10 -0
- package/esm/domain/record/serialization/conversions/nodeIdRemapper.js +49 -0
- package/esm/domain/record/serialization/conversions/nodeIdRemapper.js.map +1 -0
- package/esm/domain/record/serialization/conversions/renderOptions.d.ts +6 -0
- package/esm/domain/record/serialization/conversions/renderOptions.js +9 -0
- package/esm/domain/record/serialization/conversions/renderOptions.js.map +1 -0
- package/esm/domain/record/serialization/conversions/stringTable.d.ts +5 -0
- package/esm/domain/record/serialization/conversions/stringTable.js +19 -0
- package/esm/domain/record/serialization/conversions/stringTable.js.map +1 -0
- package/esm/domain/record/serialization/conversions/vDocument.d.ts +23 -0
- package/esm/domain/record/serialization/conversions/vDocument.js +173 -0
- package/esm/domain/record/serialization/conversions/vDocument.js.map +1 -0
- package/esm/domain/record/serialization/conversions/vNode.d.ts +66 -0
- package/esm/domain/record/serialization/conversions/vNode.js +282 -0
- package/esm/domain/record/serialization/conversions/vNode.js.map +1 -0
- package/esm/domain/record/serialization/conversions/vStyleSheet.d.ts +16 -0
- package/esm/domain/record/serialization/conversions/vStyleSheet.js +26 -0
- package/esm/domain/record/serialization/conversions/vStyleSheet.js.map +1 -0
- package/esm/domain/record/serialization/experimentalFeatures.d.ts +2 -0
- package/esm/domain/record/serialization/experimentalFeatures.js +12 -0
- package/esm/domain/record/serialization/experimentalFeatures.js.map +1 -0
- package/esm/domain/record/serialization/index.d.ts +17 -0
- package/esm/domain/record/serialization/index.js +14 -0
- package/esm/domain/record/serialization/index.js.map +1 -0
- package/esm/domain/record/serialization/insertionCursor.d.ts +57 -0
- package/esm/domain/record/serialization/insertionCursor.js +64 -0
- package/esm/domain/record/serialization/insertionCursor.js.map +1 -0
- package/esm/domain/record/serialization/serialization.types.d.ts +24 -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 +96 -0
- package/esm/domain/record/serialization/serializationTransaction.js +99 -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/serializeFullSnapshot.d.ts +5 -0
- package/esm/domain/record/serialization/serializeFullSnapshot.js +31 -0
- package/esm/domain/record/serialization/serializeFullSnapshot.js.map +1 -0
- package/esm/domain/record/serialization/serializeFullSnapshotAsChange.d.ts +5 -0
- package/esm/domain/record/serialization/serializeFullSnapshotAsChange.js +10 -0
- package/esm/domain/record/serialization/serializeFullSnapshotAsChange.js.map +1 -0
- package/esm/domain/record/serialization/serializeMutations.d.ts +11 -0
- package/esm/domain/record/serialization/serializeMutations.js +257 -0
- package/esm/domain/record/serialization/serializeMutations.js.map +1 -0
- package/esm/domain/record/serialization/serializeMutationsAsChange.d.ts +5 -0
- package/esm/domain/record/serialization/serializeMutationsAsChange.js +201 -0
- package/esm/domain/record/serialization/serializeMutationsAsChange.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/serializeNodeAsChange.d.ts +4 -0
- package/esm/domain/record/serialization/serializeNodeAsChange.js +150 -0
- package/esm/domain/record/serialization/serializeNodeAsChange.js.map +1 -0
- package/esm/domain/record/serialization/serializeStyleSheets.d.ts +3 -0
- package/esm/domain/record/serialization/serializeStyleSheets.js +27 -0
- package/esm/domain/record/serialization/serializeStyleSheets.js.map +1 -0
- package/esm/domain/record/serializationVerifier.d.ts +18 -0
- package/esm/domain/record/serializationVerifier.js +123 -0
- package/esm/domain/record/serializationVerifier.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 +10 -0
- package/esm/domain/record/startFullSnapshots.js +46 -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 +6 -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 +13 -0
- package/esm/domain/record/trackers/trackMutation.js +38 -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 +49 -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 +3 -0
- package/esm/types/index.js +2 -0
- package/esm/types/index.js.map +1 -0
- package/esm/types/profiling.d.ts +296 -0
- package/esm/types/profiling.js +5 -0
- package/esm/types/profiling.js.map +1 -0
- package/esm/types/sessionReplay.d.ts +934 -0
- package/esm/types/sessionReplay.js +5 -0
- package/esm/types/sessionReplay.js.map +1 -0
- package/esm/types/sessionReplayConstants.d.ts +71 -0
- package/esm/types/sessionReplayConstants.js +64 -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 +52 -0
- package/src/boot/isBrowserSupported.ts +14 -0
- package/src/boot/lazyLoadProfiler.ts +20 -0
- package/src/boot/lazyLoadRecorder.ts +20 -0
- package/src/boot/postStartStrategy.ts +176 -0
- package/src/boot/preStartStrategy.ts +34 -0
- package/src/boot/profilerApi.ts +82 -0
- package/src/boot/recorderApi.ts +113 -0
- package/src/boot/startRecording.ts +70 -0
- package/src/domain/deflate/deflateEncoder.ts +144 -0
- package/src/domain/deflate/deflateWorker.ts +152 -0
- package/src/domain/deflate/index.ts +9 -0
- package/src/domain/getSessionReplayLink.ts +40 -0
- package/src/domain/profiling/actionHistory.ts +65 -0
- package/src/domain/profiling/longTaskHistory.ts +40 -0
- package/src/domain/profiling/profiler.ts +366 -0
- package/src/domain/profiling/profilingContext.ts +39 -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 +63 -0
- package/src/domain/profiling/transport/buildProfileEventAttributes.ts +106 -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 +62 -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 +17 -0
- package/src/domain/profiling/vitalHistory.ts +58 -0
- package/src/domain/record/assembly.ts +19 -0
- package/src/domain/record/elementsScrollPositions.ts +28 -0
- package/src/domain/record/eventsUtils.ts +12 -0
- package/src/domain/record/index.ts +12 -0
- package/src/domain/record/internalApi.ts +84 -0
- package/src/domain/record/itemIds.ts +97 -0
- package/src/domain/record/mutationBatch.ts +47 -0
- package/src/domain/record/record.ts +90 -0
- package/src/domain/record/record.types.ts +22 -0
- package/src/domain/record/recordingScope.ts +58 -0
- package/src/domain/record/serialization/changeEncoder.ts +89 -0
- package/src/domain/record/serialization/conversions/changeConverter.ts +277 -0
- package/src/domain/record/serialization/conversions/changeDecoder.ts +192 -0
- package/src/domain/record/serialization/conversions/index.ts +7 -0
- package/src/domain/record/serialization/conversions/mutationLog.ts +56 -0
- package/src/domain/record/serialization/conversions/nodeIdRemapper.ts +69 -0
- package/src/domain/record/serialization/conversions/renderOptions.ts +14 -0
- package/src/domain/record/serialization/conversions/stringTable.ts +25 -0
- package/src/domain/record/serialization/conversions/vDocument.ts +239 -0
- package/src/domain/record/serialization/conversions/vNode.ts +417 -0
- package/src/domain/record/serialization/conversions/vStyleSheet.ts +47 -0
- package/src/domain/record/serialization/experimentalFeatures.ts +15 -0
- package/src/domain/record/serialization/index.ts +21 -0
- package/src/domain/record/serialization/insertionCursor.ts +131 -0
- package/src/domain/record/serialization/serialization.types.ts +38 -0
- package/src/domain/record/serialization/serializationStats.ts +43 -0
- package/src/domain/record/serialization/serializationTransaction.ts +255 -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/serializeFullSnapshot.ts +46 -0
- package/src/domain/record/serialization/serializeFullSnapshotAsChange.ts +33 -0
- package/src/domain/record/serialization/serializeMutations.ts +395 -0
- package/src/domain/record/serialization/serializeMutationsAsChange.ts +298 -0
- package/src/domain/record/serialization/serializeNode.ts +229 -0
- package/src/domain/record/serialization/serializeNodeAsChange.ts +237 -0
- package/src/domain/record/serialization/serializeStyleSheets.ts +36 -0
- package/src/domain/record/serializationVerifier.ts +208 -0
- package/src/domain/record/shadowRootsController.ts +62 -0
- package/src/domain/record/startFullSnapshots.ts +92 -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 +39 -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 +74 -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 +79 -0
- package/src/domain/segmentCollection/segmentCollection.ts +200 -0
- package/src/domain/segmentCollection/startSegmentTelemetry.ts +91 -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 +96 -0
- package/src/types/index.ts +3 -0
- package/src/types/profiling.ts +298 -0
- package/src/types/sessionReplay.ts +990 -0
- package/src/types/sessionReplayConstants.ts +130 -0
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import type { TimeStamp } from '@datadog/browser-core'
|
|
2
|
+
import type { NodePrivacyLevelCache, RumMutationRecord } from '@datadog/browser-rum-core'
|
|
3
|
+
import {
|
|
4
|
+
isNodeShadowHost,
|
|
5
|
+
getParentNode,
|
|
6
|
+
forEachChildNodes,
|
|
7
|
+
getNodePrivacyLevel,
|
|
8
|
+
getTextContent,
|
|
9
|
+
NodePrivacyLevel,
|
|
10
|
+
} from '@datadog/browser-rum-core'
|
|
11
|
+
import type { AttributeChange } from '../../../types'
|
|
12
|
+
import type { RecordingScope } from '../recordingScope'
|
|
13
|
+
import type { EmitRecordCallback, EmitStatsCallback } from '../record.types'
|
|
14
|
+
import type { NodeId, NodeIds } from '../itemIds'
|
|
15
|
+
import type { ChangeSerializationTransaction } from './serializationTransaction'
|
|
16
|
+
import { SerializationKind, serializeChangesInTransaction } from './serializationTransaction'
|
|
17
|
+
import { serializeNodeAsChange } from './serializeNodeAsChange'
|
|
18
|
+
import { createChildInsertionCursor } from './insertionCursor'
|
|
19
|
+
import { getElementInputValue } from './serializationUtils'
|
|
20
|
+
import { serializeAttribute } from './serializeAttribute'
|
|
21
|
+
|
|
22
|
+
export function serializeMutationsAsChange(
|
|
23
|
+
timestamp: TimeStamp,
|
|
24
|
+
mutations: RumMutationRecord[],
|
|
25
|
+
emitRecord: EmitRecordCallback,
|
|
26
|
+
emitStats: EmitStatsCallback,
|
|
27
|
+
scope: RecordingScope
|
|
28
|
+
): void {
|
|
29
|
+
serializeChangesInTransaction(
|
|
30
|
+
SerializationKind.INCREMENTAL_SNAPSHOT,
|
|
31
|
+
emitRecord,
|
|
32
|
+
emitStats,
|
|
33
|
+
scope,
|
|
34
|
+
timestamp,
|
|
35
|
+
(transaction: ChangeSerializationTransaction) => processMutations(mutations, transaction)
|
|
36
|
+
)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
type AttributeName = string
|
|
40
|
+
type OldValue = string | null
|
|
41
|
+
|
|
42
|
+
function processMutations(mutations: RumMutationRecord[], transaction: ChangeSerializationTransaction): void {
|
|
43
|
+
const addedNodes = new Set<Node>()
|
|
44
|
+
const attributeMutations = new Map<Element, Map<AttributeName, OldValue>>()
|
|
45
|
+
const characterDataMutations = new Map<Node, OldValue>()
|
|
46
|
+
const removedNodes = new Set<Node>()
|
|
47
|
+
|
|
48
|
+
// Collect the changes made by this sequence of mutations. It's important to think of
|
|
49
|
+
// the mutations as telling us which parts of the tree are dirty, but not necessarily as
|
|
50
|
+
// specifying exactly which changes have occurred; trying to be too clever will result
|
|
51
|
+
// in incorrect behavior. For example, if we see a sequence of mutations where a node is
|
|
52
|
+
// removed and then added back in the same position, one might be tempted to "cancel
|
|
53
|
+
// out" these two changes and ignore both mutations, but that could cause us to miss
|
|
54
|
+
// changes to the node that occurred while it was detached.
|
|
55
|
+
for (const mutation of mutations) {
|
|
56
|
+
switch (mutation.type) {
|
|
57
|
+
case 'attributes': {
|
|
58
|
+
const node = mutation.target
|
|
59
|
+
let attributes = attributeMutations.get(node)
|
|
60
|
+
if (!attributes) {
|
|
61
|
+
attributes = new Map<AttributeName, OldValue>()
|
|
62
|
+
attributeMutations.set(node, attributes)
|
|
63
|
+
}
|
|
64
|
+
const attributeName = mutation.attributeName!
|
|
65
|
+
if (!attributes.has(attributeName)) {
|
|
66
|
+
attributes.set(attributeName, mutation.oldValue)
|
|
67
|
+
}
|
|
68
|
+
break
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
case 'characterData':
|
|
72
|
+
if (!characterDataMutations.has(mutation.target)) {
|
|
73
|
+
characterDataMutations.set(mutation.target, mutation.oldValue)
|
|
74
|
+
}
|
|
75
|
+
break
|
|
76
|
+
|
|
77
|
+
case 'childList':
|
|
78
|
+
for (let index = 0; index < mutation.addedNodes.length; index++) {
|
|
79
|
+
addedNodes.add(mutation.addedNodes[index])
|
|
80
|
+
}
|
|
81
|
+
for (let index = 0; index < mutation.removedNodes.length; index++) {
|
|
82
|
+
removedNodes.add(mutation.removedNodes[index])
|
|
83
|
+
}
|
|
84
|
+
break
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Before we process any mutations, snapshot the id that the next newly-added node will
|
|
89
|
+
// receive. We know that any node with an id greater than or equal to this one is new
|
|
90
|
+
// and will have been serialized in its entirety in processAddedNodes(), so we can skip
|
|
91
|
+
// processing more fine-grained mutations for these nodes.
|
|
92
|
+
const firstNewNodeId = transaction.scope.nodeIds.nextId
|
|
93
|
+
|
|
94
|
+
// Because we process incremental mutations synchronously, we know that privacy levels
|
|
95
|
+
// cannot change during the process, so we use a single, shared privacy level cache.
|
|
96
|
+
const nodePrivacyLevelCache: NodePrivacyLevelCache = new Map()
|
|
97
|
+
|
|
98
|
+
processRemovedNodes(removedNodes, transaction)
|
|
99
|
+
processAddedNodes(addedNodes, nodePrivacyLevelCache, transaction)
|
|
100
|
+
processCharacterDataMutations(characterDataMutations, firstNewNodeId, nodePrivacyLevelCache, transaction)
|
|
101
|
+
processAttributeMutations(attributeMutations, firstNewNodeId, nodePrivacyLevelCache, transaction)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function processRemovedNodes(nodes: Set<Node>, transaction: ChangeSerializationTransaction): void {
|
|
105
|
+
const nodeIds = transaction.scope.nodeIds
|
|
106
|
+
|
|
107
|
+
for (const node of nodes) {
|
|
108
|
+
const nodeId = nodeIds.get(node)
|
|
109
|
+
if (nodeId === undefined) {
|
|
110
|
+
continue // This node wasn't serialized.
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
forNodeAndDescendants(node, (node: Node) => {
|
|
114
|
+
if (isNodeShadowHost(node)) {
|
|
115
|
+
transaction.scope.shadowRootsController.removeShadowRoot(node.shadowRoot)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Forget this node's identity. If it's added to the DOM again in another mutation,
|
|
119
|
+
// we'll treat it as a new node. This reduces the number of edge cases that we need
|
|
120
|
+
// to deal with; for example, changes in privacy level as a result of the different
|
|
121
|
+
// ancestor chain in the new position are handled without any special effort on our
|
|
122
|
+
// part.
|
|
123
|
+
nodeIds.delete(node)
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
transaction.removeNode(nodeId)
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
function processAddedNodes(
|
|
131
|
+
nodes: Set<Node>,
|
|
132
|
+
nodePrivacyLevelCache: NodePrivacyLevelCache,
|
|
133
|
+
transaction: ChangeSerializationTransaction
|
|
134
|
+
): void {
|
|
135
|
+
const nodeIds = transaction.scope.nodeIds
|
|
136
|
+
|
|
137
|
+
for (const node of nodes) {
|
|
138
|
+
if (!node.isConnected) {
|
|
139
|
+
continue // This node is not in the DOM.
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const existingNodeId = nodeIds.get(node)
|
|
143
|
+
if (existingNodeId !== undefined) {
|
|
144
|
+
continue // This node has already been serialized.
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const parentNode = getParentNode(node)
|
|
148
|
+
if (!parentNode) {
|
|
149
|
+
continue // This node has no parent.
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const parentId = nodeIds.get(parentNode)
|
|
153
|
+
if (parentId === undefined) {
|
|
154
|
+
// This node's parent hasn't been serialized (e.g. because it has privacy level
|
|
155
|
+
// HIDDEN), so we shouldn't serialize this node either.
|
|
156
|
+
continue
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
const parentNodePrivacyLevel = getNodePrivacyLevel(
|
|
160
|
+
parentNode,
|
|
161
|
+
transaction.scope.configuration.defaultPrivacyLevel,
|
|
162
|
+
nodePrivacyLevelCache
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
const nextSiblingId = getNextSiblingId(node, nodeIds)
|
|
166
|
+
|
|
167
|
+
serializeNodeAsChange(
|
|
168
|
+
createChildInsertionCursor(parentId, nextSiblingId, nodeIds),
|
|
169
|
+
node,
|
|
170
|
+
parentNodePrivacyLevel,
|
|
171
|
+
transaction
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function processCharacterDataMutations(
|
|
177
|
+
mutations: Map<Node, OldValue>,
|
|
178
|
+
firstNewNodeId: NodeId,
|
|
179
|
+
nodePrivacyLevelCache: NodePrivacyLevelCache,
|
|
180
|
+
transaction: ChangeSerializationTransaction
|
|
181
|
+
): void {
|
|
182
|
+
const nodeIds = transaction.scope.nodeIds
|
|
183
|
+
|
|
184
|
+
for (const [node, oldValue] of mutations) {
|
|
185
|
+
if (node.textContent === oldValue) {
|
|
186
|
+
continue // No change since the last snapshot.
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
if (!node.isConnected) {
|
|
190
|
+
continue // This node is not in the DOM.
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const nodeId = nodeIds.get(node)
|
|
194
|
+
if (nodeId === undefined) {
|
|
195
|
+
continue // This node was never serialized.
|
|
196
|
+
}
|
|
197
|
+
if (nodeId >= firstNewNodeId) {
|
|
198
|
+
// This node was just serialized, so we've already got an up-to-date copy of its
|
|
199
|
+
// text content.
|
|
200
|
+
continue
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const parentNode = getParentNode(node)
|
|
204
|
+
if (!parentNode) {
|
|
205
|
+
continue // This node has no parent.
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const parentNodePrivacyLevel = getNodePrivacyLevel(
|
|
209
|
+
parentNode,
|
|
210
|
+
transaction.scope.configuration.defaultPrivacyLevel,
|
|
211
|
+
nodePrivacyLevelCache
|
|
212
|
+
)
|
|
213
|
+
if (parentNodePrivacyLevel === NodePrivacyLevel.HIDDEN || parentNodePrivacyLevel === NodePrivacyLevel.IGNORE) {
|
|
214
|
+
continue // Mutations to this node should be ignored.
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const content = getTextContent(node, parentNodePrivacyLevel) ?? ''
|
|
218
|
+
transaction.setText(nodeId, content)
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
function processAttributeMutations(
|
|
223
|
+
mutations: Map<Element, Map<AttributeName, OldValue>>,
|
|
224
|
+
firstNewNodeId: NodeId,
|
|
225
|
+
nodePrivacyLevelCache: NodePrivacyLevelCache,
|
|
226
|
+
transaction: ChangeSerializationTransaction
|
|
227
|
+
): void {
|
|
228
|
+
const nodeIds = transaction.scope.nodeIds
|
|
229
|
+
|
|
230
|
+
for (const [node, attributeNames] of mutations) {
|
|
231
|
+
if (!node.isConnected) {
|
|
232
|
+
continue // This node is not in the DOM.
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
const nodeId = nodeIds.get(node)
|
|
236
|
+
if (nodeId === undefined) {
|
|
237
|
+
continue // This node was never serialized.
|
|
238
|
+
}
|
|
239
|
+
if (nodeId >= firstNewNodeId) {
|
|
240
|
+
// This node was just serialized, so we've already got an up-to-date copy of its
|
|
241
|
+
// attributes.
|
|
242
|
+
continue
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
const privacyLevel = getNodePrivacyLevel(
|
|
246
|
+
node,
|
|
247
|
+
transaction.scope.configuration.defaultPrivacyLevel,
|
|
248
|
+
nodePrivacyLevelCache
|
|
249
|
+
)
|
|
250
|
+
if (privacyLevel === NodePrivacyLevel.HIDDEN || privacyLevel === NodePrivacyLevel.IGNORE) {
|
|
251
|
+
continue // Mutations to this node should be ignored.
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
const change: AttributeChange = [nodeId]
|
|
255
|
+
for (const [attributeName, oldValue] of attributeNames) {
|
|
256
|
+
if (node.getAttribute(attributeName) === oldValue) {
|
|
257
|
+
continue // No change since the last snapshot.
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
if (attributeName === 'value') {
|
|
261
|
+
const attributeValue = getElementInputValue(node, privacyLevel)
|
|
262
|
+
if (attributeValue !== undefined) {
|
|
263
|
+
change.push([attributeName, attributeValue])
|
|
264
|
+
}
|
|
265
|
+
continue
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
const attributeValue = serializeAttribute(node, privacyLevel, attributeName, transaction.scope.configuration)
|
|
269
|
+
if (attributeValue === null) {
|
|
270
|
+
change.push([attributeName])
|
|
271
|
+
} else {
|
|
272
|
+
change.push([attributeName, attributeValue])
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
if (change.length > 1) {
|
|
277
|
+
transaction.setAttributes(change)
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function getNextSiblingId(node: Node, nodeIds: NodeIds): NodeId | undefined {
|
|
283
|
+
let nextSibling = node.nextSibling
|
|
284
|
+
while (nextSibling) {
|
|
285
|
+
const id = nodeIds.get(nextSibling)
|
|
286
|
+
if (id !== undefined) {
|
|
287
|
+
return id
|
|
288
|
+
}
|
|
289
|
+
nextSibling = nextSibling.nextSibling
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
return undefined
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
function forNodeAndDescendants(node: Node, action: (node: Node) => void): void {
|
|
296
|
+
action(node)
|
|
297
|
+
forEachChildNodes(node, (childNode) => forNodeAndDescendants(childNode, action))
|
|
298
|
+
}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import {
|
|
2
|
+
reducePrivacyLevel,
|
|
3
|
+
getNodeSelfPrivacyLevel,
|
|
4
|
+
getTextContent,
|
|
5
|
+
isNodeShadowRoot,
|
|
6
|
+
hasChildNodes,
|
|
7
|
+
forEachChildNodes,
|
|
8
|
+
NodePrivacyLevel,
|
|
9
|
+
PRIVACY_ATTR_NAME,
|
|
10
|
+
PRIVACY_ATTR_VALUE_HIDDEN,
|
|
11
|
+
} from '@datadog/browser-rum-core'
|
|
12
|
+
import type {
|
|
13
|
+
DocumentFragmentNode,
|
|
14
|
+
DocumentNode,
|
|
15
|
+
SerializedNodeWithId,
|
|
16
|
+
CDataNode,
|
|
17
|
+
DocumentTypeNode,
|
|
18
|
+
ElementNode,
|
|
19
|
+
TextNode,
|
|
20
|
+
} from '../../../types'
|
|
21
|
+
import { NodeType } from '../../../types'
|
|
22
|
+
import { getValidTagName } from './serializationUtils'
|
|
23
|
+
import type { ParentNodePrivacyLevel } from './serialization.types'
|
|
24
|
+
import { serializeStyleSheets } from './serializeStyleSheets'
|
|
25
|
+
import { serializeAttributes } from './serializeAttributes'
|
|
26
|
+
import type { SerializationTransaction } from './serializationTransaction'
|
|
27
|
+
|
|
28
|
+
export function serializeNode(
|
|
29
|
+
node: Element,
|
|
30
|
+
parentNodePrivacyLevel: ParentNodePrivacyLevel,
|
|
31
|
+
transaction: SerializationTransaction
|
|
32
|
+
): (SerializedNodeWithId & ElementNode) | null
|
|
33
|
+
export function serializeNode(
|
|
34
|
+
node: Node,
|
|
35
|
+
parentNodePrivacyLevel: ParentNodePrivacyLevel,
|
|
36
|
+
transaction: SerializationTransaction
|
|
37
|
+
): SerializedNodeWithId | null
|
|
38
|
+
export function serializeNode(
|
|
39
|
+
node: Node,
|
|
40
|
+
parentNodePrivacyLevel: ParentNodePrivacyLevel,
|
|
41
|
+
transaction: SerializationTransaction
|
|
42
|
+
): SerializedNodeWithId | null {
|
|
43
|
+
switch (node.nodeType) {
|
|
44
|
+
case node.DOCUMENT_NODE:
|
|
45
|
+
return serializeDocumentNode(node as Document, parentNodePrivacyLevel, transaction)
|
|
46
|
+
case node.DOCUMENT_FRAGMENT_NODE:
|
|
47
|
+
return serializeDocumentFragmentNode(node as DocumentFragment, parentNodePrivacyLevel, transaction)
|
|
48
|
+
case node.DOCUMENT_TYPE_NODE:
|
|
49
|
+
return serializeDocumentTypeNode(node as DocumentType, transaction)
|
|
50
|
+
case node.ELEMENT_NODE:
|
|
51
|
+
return serializeElementNode(node as Element, parentNodePrivacyLevel, transaction)
|
|
52
|
+
case node.TEXT_NODE:
|
|
53
|
+
return serializeTextNode(node as Text, parentNodePrivacyLevel, transaction)
|
|
54
|
+
case node.CDATA_SECTION_NODE:
|
|
55
|
+
return serializeCDataNode(node as CDATASection, transaction)
|
|
56
|
+
default:
|
|
57
|
+
return null
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function serializeChildNodes(
|
|
62
|
+
node: Node,
|
|
63
|
+
parentNodePrivacyLevel: ParentNodePrivacyLevel,
|
|
64
|
+
transaction: SerializationTransaction
|
|
65
|
+
): SerializedNodeWithId[] {
|
|
66
|
+
const result: SerializedNodeWithId[] = []
|
|
67
|
+
forEachChildNodes(node, (childNode) => {
|
|
68
|
+
const serializedChildNode = serializeNode(childNode, parentNodePrivacyLevel, transaction)
|
|
69
|
+
if (serializedChildNode) {
|
|
70
|
+
result.push(serializedChildNode)
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
return result
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function serializeDocumentNode(
|
|
77
|
+
document: Document,
|
|
78
|
+
parentNodePrivacyLevel: ParentNodePrivacyLevel,
|
|
79
|
+
transaction: SerializationTransaction
|
|
80
|
+
): DocumentNode & SerializedNodeWithId {
|
|
81
|
+
return {
|
|
82
|
+
type: NodeType.Document,
|
|
83
|
+
id: transaction.assignId(document),
|
|
84
|
+
childNodes: serializeChildNodes(document, parentNodePrivacyLevel, transaction),
|
|
85
|
+
adoptedStyleSheets: serializeStyleSheets(document.adoptedStyleSheets, transaction),
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function serializeDocumentFragmentNode(
|
|
90
|
+
element: DocumentFragment,
|
|
91
|
+
parentNodePrivacyLevel: ParentNodePrivacyLevel,
|
|
92
|
+
transaction: SerializationTransaction
|
|
93
|
+
): DocumentFragmentNode & SerializedNodeWithId {
|
|
94
|
+
const isShadowRoot = isNodeShadowRoot(element)
|
|
95
|
+
if (isShadowRoot) {
|
|
96
|
+
transaction.scope.shadowRootsController.addShadowRoot(element, transaction.scope)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return {
|
|
100
|
+
type: NodeType.DocumentFragment,
|
|
101
|
+
id: transaction.assignId(element),
|
|
102
|
+
childNodes: serializeChildNodes(element, parentNodePrivacyLevel, transaction),
|
|
103
|
+
isShadowRoot,
|
|
104
|
+
adoptedStyleSheets: isShadowRoot ? serializeStyleSheets(element.adoptedStyleSheets, transaction) : undefined,
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
function serializeDocumentTypeNode(
|
|
109
|
+
documentType: DocumentType,
|
|
110
|
+
transaction: SerializationTransaction
|
|
111
|
+
): DocumentTypeNode & SerializedNodeWithId {
|
|
112
|
+
return {
|
|
113
|
+
type: NodeType.DocumentType,
|
|
114
|
+
id: transaction.assignId(documentType),
|
|
115
|
+
name: documentType.name,
|
|
116
|
+
publicId: documentType.publicId,
|
|
117
|
+
systemId: documentType.systemId,
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Serializing Element nodes involves capturing:
|
|
123
|
+
* 1. HTML ATTRIBUTES:
|
|
124
|
+
* 2. JS STATE:
|
|
125
|
+
* - scroll offsets
|
|
126
|
+
* - Form fields (input value, checkbox checked, option selection, range)
|
|
127
|
+
* - Canvas state,
|
|
128
|
+
* - Media (video/audio) play mode + currentTime
|
|
129
|
+
* - iframe contents
|
|
130
|
+
* - webcomponents
|
|
131
|
+
* 3. CUSTOM PROPERTIES:
|
|
132
|
+
* - height+width for when `hidden` to cover the element
|
|
133
|
+
* 4. EXCLUDED INTERACTION STATE:
|
|
134
|
+
* - focus (possible, but not worth perf impact)
|
|
135
|
+
* - hover (tracked only via mouse activity)
|
|
136
|
+
* - fullscreen mode
|
|
137
|
+
*/
|
|
138
|
+
|
|
139
|
+
function serializeElementNode(
|
|
140
|
+
element: Element,
|
|
141
|
+
parentNodePrivacyLevel: ParentNodePrivacyLevel,
|
|
142
|
+
transaction: SerializationTransaction
|
|
143
|
+
): (ElementNode & SerializedNodeWithId) | null {
|
|
144
|
+
const tagName = getValidTagName(element.tagName)
|
|
145
|
+
const isSVG = isSVGElement(element) || undefined
|
|
146
|
+
|
|
147
|
+
// For performance reason, we don't use getNodePrivacyLevel directly: we leverage the
|
|
148
|
+
// parentNodePrivacyLevel option to avoid iterating over all parents
|
|
149
|
+
const nodePrivacyLevel = reducePrivacyLevel(getNodeSelfPrivacyLevel(element), parentNodePrivacyLevel)
|
|
150
|
+
|
|
151
|
+
if (nodePrivacyLevel === NodePrivacyLevel.HIDDEN) {
|
|
152
|
+
const { width, height } = element.getBoundingClientRect()
|
|
153
|
+
return {
|
|
154
|
+
type: NodeType.Element,
|
|
155
|
+
id: transaction.assignId(element),
|
|
156
|
+
tagName,
|
|
157
|
+
attributes: {
|
|
158
|
+
rr_width: `${width}px`,
|
|
159
|
+
rr_height: `${height}px`,
|
|
160
|
+
[PRIVACY_ATTR_NAME]: PRIVACY_ATTR_VALUE_HIDDEN,
|
|
161
|
+
},
|
|
162
|
+
childNodes: [],
|
|
163
|
+
isSVG,
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Ignore Elements like Script and some Link, Metas
|
|
168
|
+
if (nodePrivacyLevel === NodePrivacyLevel.IGNORE) {
|
|
169
|
+
return null
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
const id = transaction.assignId(element)
|
|
173
|
+
const attributes = serializeAttributes(element, nodePrivacyLevel, transaction)
|
|
174
|
+
|
|
175
|
+
let childNodes: SerializedNodeWithId[] = []
|
|
176
|
+
if (
|
|
177
|
+
hasChildNodes(element) &&
|
|
178
|
+
// Do not serialize style children as the css rules are already in the _cssText attribute
|
|
179
|
+
tagName !== 'style'
|
|
180
|
+
) {
|
|
181
|
+
childNodes = serializeChildNodes(element, nodePrivacyLevel, transaction)
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return {
|
|
185
|
+
type: NodeType.Element,
|
|
186
|
+
id,
|
|
187
|
+
tagName,
|
|
188
|
+
attributes,
|
|
189
|
+
childNodes,
|
|
190
|
+
isSVG,
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function isSVGElement(el: Element): boolean {
|
|
195
|
+
return el.tagName === 'svg' || el instanceof SVGElement
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Text Nodes are dependant on Element nodes
|
|
200
|
+
* Privacy levels are set on elements so we check the parentElement of a text node
|
|
201
|
+
* for privacy level.
|
|
202
|
+
*/
|
|
203
|
+
|
|
204
|
+
function serializeTextNode(
|
|
205
|
+
textNode: Text,
|
|
206
|
+
parentNodePrivacyLevel: ParentNodePrivacyLevel,
|
|
207
|
+
transaction: SerializationTransaction
|
|
208
|
+
): (TextNode & SerializedNodeWithId) | null {
|
|
209
|
+
const textContent = getTextContent(textNode, parentNodePrivacyLevel)
|
|
210
|
+
if (textContent === undefined) {
|
|
211
|
+
return null
|
|
212
|
+
}
|
|
213
|
+
return {
|
|
214
|
+
type: NodeType.Text,
|
|
215
|
+
id: transaction.assignId(textNode),
|
|
216
|
+
textContent,
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function serializeCDataNode(
|
|
221
|
+
node: CDATASection,
|
|
222
|
+
transaction: SerializationTransaction
|
|
223
|
+
): CDataNode & SerializedNodeWithId {
|
|
224
|
+
return {
|
|
225
|
+
type: NodeType.CDATA,
|
|
226
|
+
id: transaction.assignId(node),
|
|
227
|
+
textContent: '',
|
|
228
|
+
}
|
|
229
|
+
}
|