@cloudcare/browser-rum 3.0.29 → 3.1.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.
Files changed (380) hide show
  1. package/bundle/dataflux-rum.js +1 -1
  2. package/cjs/boot/buildEnv.js +3 -2
  3. package/cjs/boot/buildEnv.js.map +1 -0
  4. package/cjs/boot/recorderApi.js +5 -25
  5. package/cjs/boot/recorderApi.js.map +1 -0
  6. package/cjs/boot/rum.entry.js +2 -7
  7. package/cjs/boot/rum.entry.js.map +1 -0
  8. package/cjs/boot/rum.js +40 -43
  9. package/cjs/boot/rum.js.map +1 -0
  10. package/cjs/boot/rumPublicApi.js +3 -49
  11. package/cjs/boot/rumPublicApi.js.map +1 -0
  12. package/cjs/boot/startRecording.js +2 -9
  13. package/cjs/boot/startRecording.js.map +1 -0
  14. package/cjs/constants.js +8 -6
  15. package/cjs/constants.js.map +1 -0
  16. package/cjs/domain/assembly.js +8 -20
  17. package/cjs/domain/assembly.js.map +1 -0
  18. package/cjs/domain/configuration.js +15 -52
  19. package/cjs/domain/configuration.js.map +1 -0
  20. package/cjs/domain/contexts/commonContext.js +2 -2
  21. package/cjs/domain/contexts/commonContext.js.map +1 -0
  22. package/cjs/domain/contexts/displayContext.js +28 -0
  23. package/cjs/domain/contexts/displayContext.js.map +1 -0
  24. package/cjs/domain/contexts/foregroundContexts.js +4 -29
  25. package/cjs/domain/contexts/foregroundContexts.js.map +1 -0
  26. package/cjs/domain/contexts/internalContext.js +5 -4
  27. package/cjs/domain/contexts/internalContext.js.map +1 -0
  28. package/cjs/domain/contexts/pageStateHistory.js +106 -0
  29. package/cjs/domain/contexts/pageStateHistory.js.map +1 -0
  30. package/cjs/domain/contexts/urlContexts.js +3 -9
  31. package/cjs/domain/contexts/urlContexts.js.map +1 -0
  32. package/cjs/domain/contexts/viewContexts.js +2 -6
  33. package/cjs/domain/contexts/viewContexts.js.map +1 -0
  34. package/cjs/domain/domMutationCollection.js +6 -10
  35. package/cjs/domain/domMutationCollection.js.map +1 -0
  36. package/cjs/domain/initViewportObservable.js +4 -11
  37. package/cjs/domain/initViewportObservable.js.map +1 -0
  38. package/cjs/domain/locationChangeObservable.js +2 -11
  39. package/cjs/domain/locationChangeObservable.js.map +1 -0
  40. package/cjs/domain/performanceCollection.js +11 -39
  41. package/cjs/domain/performanceCollection.js.map +1 -0
  42. package/cjs/domain/replay/record/elementsScrollPositions.js +2 -3
  43. package/cjs/domain/replay/record/elementsScrollPositions.js.map +1 -0
  44. package/cjs/domain/replay/record/index.js +2 -4
  45. package/cjs/domain/replay/record/index.js.map +1 -0
  46. package/cjs/domain/replay/record/mutationBatch.js +4 -11
  47. package/cjs/domain/replay/record/mutationBatch.js.map +1 -0
  48. package/cjs/domain/replay/record/mutationObserver.js +27 -86
  49. package/cjs/domain/replay/record/mutationObserver.js.map +1 -0
  50. package/cjs/domain/replay/record/observers.js +15 -89
  51. package/cjs/domain/replay/record/observers.js.map +1 -0
  52. package/cjs/domain/replay/record/privacy.js +57 -75
  53. package/cjs/domain/replay/record/privacy.js.map +1 -0
  54. package/cjs/domain/replay/record/record.js +6 -29
  55. package/cjs/domain/replay/record/record.js.map +1 -0
  56. package/cjs/domain/replay/record/serializationUtils.js +8 -68
  57. package/cjs/domain/replay/record/serializationUtils.js.map +1 -0
  58. package/cjs/domain/replay/record/serialize.js +43 -118
  59. package/cjs/domain/replay/record/serialize.js.map +1 -0
  60. package/cjs/domain/replay/record/shadowRootsController.js +4 -11
  61. package/cjs/domain/replay/record/shadowRootsController.js.map +1 -0
  62. package/cjs/domain/replay/record/utils.js +4 -12
  63. package/cjs/domain/replay/record/utils.js.map +1 -0
  64. package/cjs/domain/replay/record/viewports.js +4 -42
  65. package/cjs/domain/replay/record/viewports.js.map +1 -0
  66. package/cjs/domain/replay/replayStats.js +2 -14
  67. package/cjs/domain/replay/replayStats.js.map +1 -0
  68. package/cjs/domain/replay/segmentCollection/buildReplayPayload.js +3 -8
  69. package/cjs/domain/replay/segmentCollection/buildReplayPayload.js.map +1 -0
  70. package/cjs/domain/replay/segmentCollection/index.js +2 -3
  71. package/cjs/domain/replay/segmentCollection/index.js.map +1 -0
  72. package/cjs/domain/replay/segmentCollection/segment.js +7 -23
  73. package/cjs/domain/replay/segmentCollection/segment.js.map +1 -0
  74. package/cjs/domain/replay/segmentCollection/segmentCollection.js +5 -24
  75. package/cjs/domain/replay/segmentCollection/segmentCollection.js.map +1 -0
  76. package/cjs/domain/replay/segmentCollection/startDeflateWorker.js +5 -24
  77. package/cjs/domain/replay/segmentCollection/startDeflateWorker.js.map +1 -0
  78. package/cjs/domain/requestCollection.js +2 -17
  79. package/cjs/domain/requestCollection.js.map +1 -0
  80. package/cjs/domain/rumEventsCollection/actions/actionCollection.js +12 -22
  81. package/cjs/domain/rumEventsCollection/actions/actionCollection.js.map +1 -0
  82. package/cjs/domain/rumEventsCollection/actions/clickChain.js +3 -14
  83. package/cjs/domain/rumEventsCollection/actions/clickChain.js.map +1 -0
  84. package/cjs/domain/rumEventsCollection/actions/computeFrustration.js +12 -20
  85. package/cjs/domain/rumEventsCollection/actions/computeFrustration.js.map +1 -0
  86. package/cjs/domain/rumEventsCollection/actions/getActionNameFromElement.js +22 -53
  87. package/cjs/domain/rumEventsCollection/actions/getActionNameFromElement.js.map +1 -0
  88. package/cjs/domain/rumEventsCollection/actions/getSelectorsFromElement.js +13 -45
  89. package/cjs/domain/rumEventsCollection/actions/getSelectorsFromElement.js.map +1 -0
  90. package/cjs/domain/rumEventsCollection/actions/listenActionEvents.js +4 -6
  91. package/cjs/domain/rumEventsCollection/actions/listenActionEvents.js.map +1 -0
  92. package/cjs/domain/rumEventsCollection/actions/trackClickActions.js +15 -45
  93. package/cjs/domain/rumEventsCollection/actions/trackClickActions.js.map +1 -0
  94. package/cjs/domain/rumEventsCollection/error/errorCollection.js +13 -23
  95. package/cjs/domain/rumEventsCollection/error/errorCollection.js.map +1 -0
  96. package/cjs/domain/rumEventsCollection/error/trackConsoleError.js +2 -3
  97. package/cjs/domain/rumEventsCollection/error/trackConsoleError.js.map +1 -0
  98. package/cjs/domain/rumEventsCollection/error/trackReportError.js +4 -5
  99. package/cjs/domain/rumEventsCollection/error/trackReportError.js.map +1 -0
  100. package/cjs/domain/rumEventsCollection/longTask/longTaskCollection.js +2 -7
  101. package/cjs/domain/rumEventsCollection/longTask/longTaskCollection.js.map +1 -0
  102. package/cjs/domain/rumEventsCollection/resource/matchRequestTiming.js +2 -13
  103. package/cjs/domain/rumEventsCollection/resource/matchRequestTiming.js.map +1 -0
  104. package/cjs/domain/rumEventsCollection/resource/resourceCollection.js +2 -18
  105. package/cjs/domain/rumEventsCollection/resource/resourceCollection.js.map +1 -0
  106. package/cjs/domain/rumEventsCollection/resource/resourceUtils.js +58 -69
  107. package/cjs/domain/rumEventsCollection/resource/resourceUtils.js.map +1 -0
  108. package/cjs/domain/rumEventsCollection/view/interactionCountPolyfill.js +55 -0
  109. package/cjs/domain/rumEventsCollection/view/interactionCountPolyfill.js.map +1 -0
  110. package/cjs/domain/rumEventsCollection/view/trackCommonViewMetrics.js +62 -0
  111. package/cjs/domain/rumEventsCollection/view/trackCommonViewMetrics.js.map +1 -0
  112. package/cjs/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js +74 -0
  113. package/cjs/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js.map +1 -0
  114. package/cjs/domain/rumEventsCollection/view/trackFirstContentfulPaint.js +26 -0
  115. package/cjs/domain/rumEventsCollection/view/trackFirstContentfulPaint.js.map +1 -0
  116. package/cjs/domain/rumEventsCollection/view/trackFirstHidden.js +2 -8
  117. package/cjs/domain/rumEventsCollection/view/trackFirstHidden.js.map +1 -0
  118. package/cjs/domain/rumEventsCollection/view/trackFirstInputTimings.js +38 -0
  119. package/cjs/domain/rumEventsCollection/view/trackFirstInputTimings.js.map +1 -0
  120. package/cjs/domain/rumEventsCollection/view/trackInitialViewTimings.js +26 -179
  121. package/cjs/domain/rumEventsCollection/view/trackInitialViewTimings.js.map +1 -0
  122. package/cjs/domain/rumEventsCollection/view/trackInteractionToNextPaint.js +120 -0
  123. package/cjs/domain/rumEventsCollection/view/trackInteractionToNextPaint.js.map +1 -0
  124. package/cjs/domain/rumEventsCollection/view/trackLargestContentfulPaint.js +49 -0
  125. package/cjs/domain/rumEventsCollection/view/trackLargestContentfulPaint.js.map +1 -0
  126. package/cjs/domain/rumEventsCollection/view/trackLoadingTime.js +39 -0
  127. package/cjs/domain/rumEventsCollection/view/trackLoadingTime.js.map +1 -0
  128. package/cjs/domain/rumEventsCollection/view/trackNavigationTimings.js +37 -0
  129. package/cjs/domain/rumEventsCollection/view/trackNavigationTimings.js.map +1 -0
  130. package/cjs/domain/rumEventsCollection/view/trackScrollMetrics.js +61 -0
  131. package/cjs/domain/rumEventsCollection/view/trackScrollMetrics.js.map +1 -0
  132. package/cjs/domain/rumEventsCollection/view/trackViewEventCounts.js +3 -6
  133. package/cjs/domain/rumEventsCollection/view/trackViewEventCounts.js.map +1 -0
  134. package/cjs/domain/rumEventsCollection/view/trackViews.js +26 -58
  135. package/cjs/domain/rumEventsCollection/view/trackViews.js.map +1 -0
  136. package/cjs/domain/rumEventsCollection/view/viewCollection.js +43 -48
  137. package/cjs/domain/rumEventsCollection/view/viewCollection.js.map +1 -0
  138. package/cjs/domain/rumSessionManager.js +3 -13
  139. package/cjs/domain/rumSessionManager.js.map +1 -0
  140. package/cjs/domain/tracing/ddtraceTracer.js +2 -4
  141. package/cjs/domain/tracing/ddtraceTracer.js.map +1 -0
  142. package/cjs/domain/tracing/getDocumentTraceId.js +5 -22
  143. package/cjs/domain/tracing/getDocumentTraceId.js.map +1 -0
  144. package/cjs/domain/tracing/jaegerTracer.js +2 -4
  145. package/cjs/domain/tracing/jaegerTracer.js.map +1 -0
  146. package/cjs/domain/tracing/skywalkingTracer.js +6 -13
  147. package/cjs/domain/tracing/skywalkingTracer.js.map +1 -0
  148. package/cjs/domain/tracing/traceIdentifier.js +2 -7
  149. package/cjs/domain/tracing/traceIdentifier.js.map +1 -0
  150. package/cjs/domain/tracing/tracer.js +5 -30
  151. package/cjs/domain/tracing/tracer.js.map +1 -0
  152. package/cjs/domain/tracing/w3cTraceParentTracer.js +2 -11
  153. package/cjs/domain/tracing/w3cTraceParentTracer.js.map +1 -0
  154. package/cjs/domain/tracing/zipkinMultiTracer.js +4 -6
  155. package/cjs/domain/tracing/zipkinMultiTracer.js.map +1 -0
  156. package/cjs/domain/tracing/zipkinSingleTracer.js +2 -4
  157. package/cjs/domain/tracing/zipkinSingleTracer.js.map +1 -0
  158. package/cjs/domain/trackEventCounts.js +2 -10
  159. package/cjs/domain/trackEventCounts.js.map +1 -0
  160. package/cjs/domain/usr/index.js +2 -7
  161. package/cjs/domain/usr/index.js.map +1 -0
  162. package/cjs/domain/waitPageActivityEnd.js +7 -23
  163. package/cjs/domain/waitPageActivityEnd.js.map +1 -0
  164. package/cjs/index.js +2 -2
  165. package/cjs/index.js.map +1 -0
  166. package/cjs/transport/startRumBatch.js +7 -8
  167. package/cjs/transport/startRumBatch.js.map +1 -0
  168. package/cjs/transport/startRumEventBridge.js +2 -3
  169. package/cjs/transport/startRumEventBridge.js.map +1 -0
  170. package/cjs/types/index.js +2 -3
  171. package/cjs/types/index.js.map +1 -0
  172. package/cjs/types/sessionReplayConstants.js +4 -3
  173. package/cjs/types/sessionReplayConstants.js.map +1 -0
  174. package/esm/boot/buildEnv.js +3 -2
  175. package/esm/boot/buildEnv.js.map +1 -0
  176. package/esm/boot/recorderApi.js +5 -19
  177. package/esm/boot/recorderApi.js.map +1 -0
  178. package/esm/boot/rum.entry.js +2 -1
  179. package/esm/boot/rum.entry.js.map +1 -0
  180. package/esm/boot/rum.js +41 -23
  181. package/esm/boot/rum.js.map +1 -0
  182. package/esm/boot/rumPublicApi.js +3 -43
  183. package/esm/boot/rumPublicApi.js.map +1 -0
  184. package/esm/boot/startRecording.js +2 -4
  185. package/esm/boot/startRecording.js.map +1 -0
  186. package/esm/constants.js +8 -4
  187. package/esm/constants.js.map +1 -0
  188. package/esm/domain/assembly.js +8 -17
  189. package/esm/domain/assembly.js.map +1 -0
  190. package/esm/domain/configuration.js +15 -38
  191. package/esm/domain/configuration.js.map +1 -0
  192. package/esm/domain/contexts/commonContext.js +2 -1
  193. package/esm/domain/contexts/commonContext.js.map +1 -0
  194. package/esm/domain/contexts/displayContext.js +21 -0
  195. package/esm/domain/contexts/displayContext.js.map +1 -0
  196. package/esm/domain/contexts/foregroundContexts.js +6 -25
  197. package/esm/domain/contexts/foregroundContexts.js.map +1 -0
  198. package/esm/domain/contexts/internalContext.js +5 -3
  199. package/esm/domain/contexts/internalContext.js.map +1 -0
  200. package/esm/domain/contexts/pageStateHistory.js +96 -0
  201. package/esm/domain/contexts/pageStateHistory.js.map +1 -0
  202. package/esm/domain/contexts/urlContexts.js +3 -6
  203. package/esm/domain/contexts/urlContexts.js.map +1 -0
  204. package/esm/domain/contexts/viewContexts.js +2 -3
  205. package/esm/domain/contexts/viewContexts.js.map +1 -0
  206. package/esm/domain/domMutationCollection.js +6 -7
  207. package/esm/domain/domMutationCollection.js.map +1 -0
  208. package/esm/domain/initViewportObservable.js +4 -6
  209. package/esm/domain/initViewportObservable.js.map +1 -0
  210. package/esm/domain/locationChangeObservable.js +2 -9
  211. package/esm/domain/locationChangeObservable.js.map +1 -0
  212. package/esm/domain/performanceCollection.js +11 -35
  213. package/esm/domain/performanceCollection.js.map +1 -0
  214. package/esm/domain/replay/record/elementsScrollPositions.js +2 -2
  215. package/esm/domain/replay/record/elementsScrollPositions.js.map +1 -0
  216. package/esm/domain/replay/record/index.js +2 -1
  217. package/esm/domain/replay/record/index.js.map +1 -0
  218. package/esm/domain/replay/record/mutationBatch.js +5 -9
  219. package/esm/domain/replay/record/mutationBatch.js.map +1 -0
  220. package/esm/domain/replay/record/mutationObserver.js +29 -80
  221. package/esm/domain/replay/record/mutationObserver.js.map +1 -0
  222. package/esm/domain/replay/record/observers.js +15 -72
  223. package/esm/domain/replay/record/observers.js.map +1 -0
  224. package/esm/domain/replay/record/privacy.js +57 -65
  225. package/esm/domain/replay/record/privacy.js.map +1 -0
  226. package/esm/domain/replay/record/record.js +6 -19
  227. package/esm/domain/replay/record/record.js.map +1 -0
  228. package/esm/domain/replay/record/serializationUtils.js +8 -46
  229. package/esm/domain/replay/record/serializationUtils.js.map +1 -0
  230. package/esm/domain/replay/record/serialize.js +45 -107
  231. package/esm/domain/replay/record/serialize.js.map +1 -0
  232. package/esm/domain/replay/record/shadowRootsController.js +4 -6
  233. package/esm/domain/replay/record/shadowRootsController.js.map +1 -0
  234. package/esm/domain/replay/record/utils.js +4 -6
  235. package/esm/domain/replay/record/utils.js.map +1 -0
  236. package/esm/domain/replay/record/viewports.js +3 -32
  237. package/esm/domain/replay/record/viewports.js.map +1 -0
  238. package/esm/domain/replay/replayStats.js +2 -8
  239. package/esm/domain/replay/replayStats.js.map +1 -0
  240. package/esm/domain/replay/segmentCollection/buildReplayPayload.js +3 -5
  241. package/esm/domain/replay/segmentCollection/buildReplayPayload.js.map +1 -0
  242. package/esm/domain/replay/segmentCollection/index.js +2 -1
  243. package/esm/domain/replay/segmentCollection/index.js.map +1 -0
  244. package/esm/domain/replay/segmentCollection/segment.js +4 -12
  245. package/esm/domain/replay/segmentCollection/segment.js.map +1 -0
  246. package/esm/domain/replay/segmentCollection/segmentCollection.js +4 -13
  247. package/esm/domain/replay/segmentCollection/segmentCollection.js.map +1 -0
  248. package/esm/domain/replay/segmentCollection/startDeflateWorker.js +5 -16
  249. package/esm/domain/replay/segmentCollection/startDeflateWorker.js.map +1 -0
  250. package/esm/domain/requestCollection.js +2 -10
  251. package/esm/domain/requestCollection.js.map +1 -0
  252. package/esm/domain/rumEventsCollection/actions/actionCollection.js +12 -19
  253. package/esm/domain/rumEventsCollection/actions/actionCollection.js.map +1 -0
  254. package/esm/domain/rumEventsCollection/actions/clickChain.js +3 -10
  255. package/esm/domain/rumEventsCollection/actions/clickChain.js.map +1 -0
  256. package/esm/domain/rumEventsCollection/actions/computeFrustration.js +12 -14
  257. package/esm/domain/rumEventsCollection/actions/computeFrustration.js.map +1 -0
  258. package/esm/domain/rumEventsCollection/actions/getActionNameFromElement.js +22 -50
  259. package/esm/domain/rumEventsCollection/actions/getActionNameFromElement.js.map +1 -0
  260. package/esm/domain/rumEventsCollection/actions/getSelectorsFromElement.js +12 -40
  261. package/esm/domain/rumEventsCollection/actions/getSelectorsFromElement.js.map +1 -0
  262. package/esm/domain/rumEventsCollection/actions/listenActionEvents.js +4 -4
  263. package/esm/domain/rumEventsCollection/actions/listenActionEvents.js.map +1 -0
  264. package/esm/domain/rumEventsCollection/actions/trackClickActions.js +18 -37
  265. package/esm/domain/rumEventsCollection/actions/trackClickActions.js.map +1 -0
  266. package/esm/domain/rumEventsCollection/error/errorCollection.js +14 -19
  267. package/esm/domain/rumEventsCollection/error/errorCollection.js.map +1 -0
  268. package/esm/domain/rumEventsCollection/error/trackConsoleError.js +2 -1
  269. package/esm/domain/rumEventsCollection/error/trackConsoleError.js.map +1 -0
  270. package/esm/domain/rumEventsCollection/error/trackReportError.js +4 -3
  271. package/esm/domain/rumEventsCollection/error/trackReportError.js.map +1 -0
  272. package/esm/domain/rumEventsCollection/longTask/longTaskCollection.js +2 -5
  273. package/esm/domain/rumEventsCollection/longTask/longTaskCollection.js.map +1 -0
  274. package/esm/domain/rumEventsCollection/resource/matchRequestTiming.js +3 -11
  275. package/esm/domain/rumEventsCollection/resource/matchRequestTiming.js.map +1 -0
  276. package/esm/domain/rumEventsCollection/resource/resourceCollection.js +2 -13
  277. package/esm/domain/rumEventsCollection/resource/resourceCollection.js.map +1 -0
  278. package/esm/domain/rumEventsCollection/resource/resourceUtils.js +58 -57
  279. package/esm/domain/rumEventsCollection/resource/resourceUtils.js.map +1 -0
  280. package/esm/domain/rumEventsCollection/view/interactionCountPolyfill.js +47 -0
  281. package/esm/domain/rumEventsCollection/view/interactionCountPolyfill.js.map +1 -0
  282. package/esm/domain/rumEventsCollection/view/trackCommonViewMetrics.js +56 -0
  283. package/esm/domain/rumEventsCollection/view/trackCommonViewMetrics.js.map +1 -0
  284. package/esm/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js +67 -0
  285. package/esm/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js.map +1 -0
  286. package/esm/domain/rumEventsCollection/view/trackFirstContentfulPaint.js +18 -0
  287. package/esm/domain/rumEventsCollection/view/trackFirstContentfulPaint.js.map +1 -0
  288. package/esm/domain/rumEventsCollection/view/trackFirstHidden.js +2 -4
  289. package/esm/domain/rumEventsCollection/view/trackFirstHidden.js.map +1 -0
  290. package/esm/domain/rumEventsCollection/view/trackFirstInputTimings.js +32 -0
  291. package/esm/domain/rumEventsCollection/view/trackFirstInputTimings.js.map +1 -0
  292. package/esm/domain/rumEventsCollection/view/trackInitialViewTimings.js +25 -164
  293. package/esm/domain/rumEventsCollection/view/trackInitialViewTimings.js.map +1 -0
  294. package/esm/domain/rumEventsCollection/view/trackInteractionToNextPaint.js +113 -0
  295. package/esm/domain/rumEventsCollection/view/trackInteractionToNextPaint.js.map +1 -0
  296. package/esm/domain/rumEventsCollection/view/trackLargestContentfulPaint.js +41 -0
  297. package/esm/domain/rumEventsCollection/view/trackLargestContentfulPaint.js.map +1 -0
  298. package/esm/domain/rumEventsCollection/view/trackLoadingTime.js +33 -0
  299. package/esm/domain/rumEventsCollection/view/trackLoadingTime.js.map +1 -0
  300. package/esm/domain/rumEventsCollection/view/trackNavigationTimings.js +31 -0
  301. package/esm/domain/rumEventsCollection/view/trackNavigationTimings.js.map +1 -0
  302. package/esm/domain/rumEventsCollection/view/trackScrollMetrics.js +53 -0
  303. package/esm/domain/rumEventsCollection/view/trackScrollMetrics.js.map +1 -0
  304. package/esm/domain/rumEventsCollection/view/trackViewEventCounts.js +5 -3
  305. package/esm/domain/rumEventsCollection/view/trackViewEventCounts.js.map +1 -0
  306. package/esm/domain/rumEventsCollection/view/trackViews.js +28 -54
  307. package/esm/domain/rumEventsCollection/view/trackViews.js.map +1 -0
  308. package/esm/domain/rumEventsCollection/view/viewCollection.js +43 -44
  309. package/esm/domain/rumEventsCollection/view/viewCollection.js.map +1 -0
  310. package/esm/domain/rumSessionManager.js +3 -9
  311. package/esm/domain/rumSessionManager.js.map +1 -0
  312. package/esm/domain/tracing/ddtraceTracer.js +2 -2
  313. package/esm/domain/tracing/ddtraceTracer.js.map +1 -0
  314. package/esm/domain/tracing/getDocumentTraceId.js +5 -15
  315. package/esm/domain/tracing/getDocumentTraceId.js.map +1 -0
  316. package/esm/domain/tracing/jaegerTracer.js +3 -2
  317. package/esm/domain/tracing/jaegerTracer.js.map +1 -0
  318. package/esm/domain/tracing/skywalkingTracer.js +8 -12
  319. package/esm/domain/tracing/skywalkingTracer.js.map +1 -0
  320. package/esm/domain/tracing/traceIdentifier.js +2 -4
  321. package/esm/domain/tracing/traceIdentifier.js.map +1 -0
  322. package/esm/domain/tracing/tracer.js +5 -19
  323. package/esm/domain/tracing/tracer.js.map +1 -0
  324. package/esm/domain/tracing/w3cTraceParentTracer.js +4 -8
  325. package/esm/domain/tracing/w3cTraceParentTracer.js.map +1 -0
  326. package/esm/domain/tracing/zipkinMultiTracer.js +5 -4
  327. package/esm/domain/tracing/zipkinMultiTracer.js.map +1 -0
  328. package/esm/domain/tracing/zipkinSingleTracer.js +3 -2
  329. package/esm/domain/tracing/zipkinSingleTracer.js.map +1 -0
  330. package/esm/domain/trackEventCounts.js +2 -8
  331. package/esm/domain/trackEventCounts.js.map +1 -0
  332. package/esm/domain/usr/index.js +2 -3
  333. package/esm/domain/usr/index.js.map +1 -0
  334. package/esm/domain/waitPageActivityEnd.js +9 -19
  335. package/esm/domain/waitPageActivityEnd.js.map +1 -0
  336. package/esm/index.js +2 -1
  337. package/esm/index.js.map +1 -0
  338. package/esm/transport/startRumBatch.js +7 -6
  339. package/esm/transport/startRumBatch.js.map +1 -0
  340. package/esm/transport/startRumEventBridge.js +2 -1
  341. package/esm/transport/startRumEventBridge.js.map +1 -0
  342. package/esm/types/index.js.map +1 -0
  343. package/esm/types/sessionReplayConstants.js +5 -3
  344. package/esm/types/sessionReplayConstants.js.map +1 -0
  345. package/package.json +6 -5
  346. package/src/boot/rum.js +45 -10
  347. package/src/domain/assembly.js +5 -2
  348. package/src/domain/configuration.js +0 -1
  349. package/src/domain/contexts/displayContext.js +29 -0
  350. package/src/domain/contexts/internalContext.js +3 -1
  351. package/src/domain/contexts/pageStateHistory.js +139 -0
  352. package/src/domain/replay/record/mutationObserver.js +2 -1
  353. package/src/domain/replay/record/observers.js +3 -3
  354. package/src/domain/replay/record/privacy.js +20 -23
  355. package/src/domain/replay/record/record.js +2 -2
  356. package/src/domain/replay/record/serializationUtils.js +4 -2
  357. package/src/domain/replay/record/serialize.js +11 -14
  358. package/src/domain/replay/record/shadowRootsController.js +0 -1
  359. package/src/domain/replay/record/viewports.js +0 -26
  360. package/src/domain/rumEventsCollection/actions/actionCollection.js +12 -12
  361. package/src/domain/rumEventsCollection/actions/trackClickActions.js +8 -6
  362. package/src/domain/rumEventsCollection/error/errorCollection.js +20 -15
  363. package/src/domain/rumEventsCollection/error/trackReportError.js +22 -16
  364. package/src/domain/rumEventsCollection/view/interactionCountPolyfill.js +59 -0
  365. package/src/domain/rumEventsCollection/view/trackCommonViewMetrics.js +87 -0
  366. package/src/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js +73 -0
  367. package/src/domain/rumEventsCollection/view/trackFirstContentfulPaint.js +23 -0
  368. package/src/domain/rumEventsCollection/view/trackFirstInputTimings.js +40 -0
  369. package/src/domain/rumEventsCollection/view/trackInitialViewTimings.js +29 -199
  370. package/src/domain/rumEventsCollection/view/trackInteractionToNextPaint.js +144 -0
  371. package/src/domain/rumEventsCollection/view/trackLargestContentfulPaint.js +57 -0
  372. package/src/domain/rumEventsCollection/view/trackLoadingTime.js +50 -0
  373. package/src/domain/rumEventsCollection/view/trackNavigationTimings.js +35 -0
  374. package/src/domain/rumEventsCollection/view/trackScrollMetrics.js +74 -0
  375. package/src/domain/rumEventsCollection/view/trackViews.js +32 -37
  376. package/src/domain/rumEventsCollection/view/viewCollection.js +51 -22
  377. package/src/transport/startRumBatch.js +5 -1
  378. package/cjs/domain/rumEventsCollection/view/trackViewMetrics.js +0 -156
  379. package/esm/domain/rumEventsCollection/view/trackViewMetrics.js +0 -146
  380. package/src/domain/rumEventsCollection/view/trackViewMetrics.js +0 -176
@@ -10,34 +10,29 @@ exports.getTextContent = getTextContent;
10
10
  exports.reducePrivacyLevel = reducePrivacyLevel;
11
11
  exports.shouldIgnoreElement = shouldIgnoreElement;
12
12
  exports.shouldMaskNode = shouldMaskNode;
13
-
14
13
  var _browserCore = require("@cloudcare/browser-core");
15
-
16
14
  var _serializationUtils = require("./serializationUtils");
17
-
18
15
  var _constants = require("../../../constants");
19
-
20
16
  var MAX_ATTRIBUTE_VALUE_CHAR_LENGTH = 100000;
21
17
  exports.MAX_ATTRIBUTE_VALUE_CHAR_LENGTH = MAX_ATTRIBUTE_VALUE_CHAR_LENGTH;
22
18
  var TEXT_MASKING_CHAR = 'x';
19
+
23
20
  /**
24
21
  * Get node privacy level by iterating over its ancestors. When the direct parent privacy level is
25
22
  * know, it is best to use something like:
26
23
  *
27
24
  * derivePrivacyLevelGivenParent(getNodeSelfPrivacyLevel(node), parentNodePrivacyLevel)
28
25
  */
29
-
30
26
  function getNodePrivacyLevel(node, defaultPrivacyLevel) {
31
27
  var parentNode = (0, _browserCore.getParentNode)(node);
32
28
  var parentNodePrivacyLevel = parentNode ? getNodePrivacyLevel(parentNode, defaultPrivacyLevel) : defaultPrivacyLevel;
33
29
  var selfNodePrivacyLevel = getNodeSelfPrivacyLevel(node);
34
30
  return reducePrivacyLevel(selfNodePrivacyLevel, parentNodePrivacyLevel);
35
31
  }
32
+
36
33
  /**
37
34
  * Reduces the next privacy level based on self + parent privacy levels
38
35
  */
39
-
40
-
41
36
  function reducePrivacyLevel(childPrivacyLevel, parentNodePrivacyLevel) {
42
37
  switch (parentNodePrivacyLevel) {
43
38
  // These values cannot be overridden
@@ -45,7 +40,6 @@ function reducePrivacyLevel(childPrivacyLevel, parentNodePrivacyLevel) {
45
40
  case _constants.NodePrivacyLevel.IGNORE:
46
41
  return parentNodePrivacyLevel;
47
42
  }
48
-
49
43
  switch (childPrivacyLevel) {
50
44
  case _constants.NodePrivacyLevel.ALLOW:
51
45
  case _constants.NodePrivacyLevel.MASK:
@@ -53,68 +47,60 @@ function reducePrivacyLevel(childPrivacyLevel, parentNodePrivacyLevel) {
53
47
  case _constants.NodePrivacyLevel.HIDDEN:
54
48
  case _constants.NodePrivacyLevel.IGNORE:
55
49
  return childPrivacyLevel;
56
-
57
50
  default:
58
51
  return parentNodePrivacyLevel;
59
52
  }
60
53
  }
54
+
61
55
  /**
62
56
  * Determines the node's own privacy level without checking for ancestors.
63
57
  */
64
-
65
-
66
58
  function getNodeSelfPrivacyLevel(node) {
67
59
  // Only Element types can have a privacy level set
68
60
  if (!(0, _browserCore.isElementNode)(node)) {
69
61
  return;
70
62
  }
63
+ var privAttr = node.getAttribute(_constants.PRIVACY_ATTR_NAME);
71
64
 
72
- var privAttr = node.getAttribute(_constants.PRIVACY_ATTR_NAME); // Overrules for replay purpose
73
-
65
+ // Overrules for replay purpose
74
66
  if (node.tagName === 'BASE') {
75
67
  return _constants.NodePrivacyLevel.ALLOW;
76
- } // Overrules to enforce end-user protection
77
-
68
+ }
78
69
 
70
+ // Overrules to enforce end-user protection
79
71
  if (node.tagName === 'INPUT') {
80
72
  var inputElement = node;
81
-
82
73
  if (inputElement.type === 'password' || inputElement.type === 'email' || inputElement.type === 'tel') {
83
74
  return _constants.NodePrivacyLevel.MASK;
84
75
  }
85
-
86
76
  if (inputElement.type === 'hidden') {
87
77
  return _constants.NodePrivacyLevel.MASK;
88
78
  }
89
-
90
- var autocomplete = inputElement.getAttribute('autocomplete'); // Handle input[autocomplete=cc-number/cc-csc/cc-exp/cc-exp-month/cc-exp-year]
91
-
79
+ var autocomplete = inputElement.getAttribute('autocomplete');
80
+ // Handle input[autocomplete=cc-number/cc-csc/cc-exp/cc-exp-month/cc-exp-year]
92
81
  if (autocomplete && autocomplete.indexOf('cc-') === 0) {
93
82
  return _constants.NodePrivacyLevel.MASK;
94
83
  }
95
- } // Check HTML privacy attributes and classes
96
-
84
+ }
97
85
 
86
+ // Check HTML privacy attributes and classes
98
87
  if (privAttr === _constants.PRIVACY_ATTR_VALUE_HIDDEN || node.classList.contains(_constants.PRIVACY_CLASS_HIDDEN)) {
99
88
  return _constants.NodePrivacyLevel.HIDDEN;
100
89
  }
101
-
102
90
  if (privAttr === _constants.PRIVACY_ATTR_VALUE_MASK || node.classList.contains(_constants.PRIVACY_CLASS_MASK)) {
103
91
  return _constants.NodePrivacyLevel.MASK;
104
92
  }
105
-
106
93
  if (privAttr === _constants.PRIVACY_ATTR_VALUE_MASK_USER_INPUT || node.classList.contains(_constants.PRIVACY_CLASS_MASK_USER_INPUT)) {
107
94
  return _constants.NodePrivacyLevel.MASK_USER_INPUT;
108
95
  }
109
-
110
96
  if (privAttr === _constants.PRIVACY_ATTR_VALUE_ALLOW || node.classList.contains(_constants.PRIVACY_CLASS_ALLOW)) {
111
97
  return _constants.NodePrivacyLevel.ALLOW;
112
98
  }
113
-
114
99
  if (shouldIgnoreElement(node)) {
115
100
  return _constants.NodePrivacyLevel.IGNORE;
116
101
  }
117
102
  }
103
+
118
104
  /**
119
105
  * Helper aiming to unify `mask` and `mask-user-input` privacy levels:
120
106
  *
@@ -126,30 +112,23 @@ function getNodeSelfPrivacyLevel(node) {
126
112
  * Other `shouldMaskNode` cases are edge cases that should not matter too much (ex: should we mask a
127
113
  * node if it is ignored or hidden? it doesn't matter since it won't be serialized).
128
114
  */
129
-
130
-
131
115
  function shouldMaskNode(node, privacyLevel) {
132
116
  switch (privacyLevel) {
133
117
  case _constants.NodePrivacyLevel.MASK:
134
118
  case _constants.NodePrivacyLevel.HIDDEN:
135
119
  case _constants.NodePrivacyLevel.IGNORE:
136
120
  return true;
137
-
138
121
  case _constants.NodePrivacyLevel.MASK_USER_INPUT:
139
122
  return (0, _browserCore.isTextNode)(node) ? isFormElement(node.parentNode) : isFormElement(node);
140
-
141
123
  default:
142
124
  return false;
143
125
  }
144
126
  }
145
-
146
127
  function isFormElement(node) {
147
128
  if (!node || node.nodeType !== node.ELEMENT_NODE) {
148
129
  return false;
149
130
  }
150
-
151
131
  var element = node;
152
-
153
132
  if (element.tagName === 'INPUT') {
154
133
  switch (element.type) {
155
134
  case 'button':
@@ -159,44 +138,38 @@ function isFormElement(node) {
159
138
  return false;
160
139
  }
161
140
  }
162
-
163
141
  return !!_constants.FORM_PRIVATE_TAG_NAMES[element.tagName];
164
142
  }
143
+
165
144
  /**
166
145
  * Text censoring non-destructively maintains whitespace characters in order to preserve text shape
167
146
  * during replay.
168
147
  */
169
-
170
-
171
148
  var censorText = function censorText(text) {
172
149
  return text.replace(/\S/g, TEXT_MASKING_CHAR);
173
150
  };
174
-
175
151
  exports.censorText = censorText;
176
-
177
152
  function getTextContent(textNode, ignoreWhiteSpace, parentNodePrivacyLevel) {
178
153
  // The parent node may not be a html element which has a tagName attribute.
179
154
  // So just let it be undefined which is ok in this use case.
180
155
  var parentTagName = textNode.parentElement && textNode.parentElement.tagName;
181
156
  var textContent = textNode.textContent || '';
182
-
183
157
  if (ignoreWhiteSpace && !textContent.trim()) {
184
158
  return;
185
159
  }
186
-
187
160
  var nodePrivacyLevel = parentNodePrivacyLevel;
188
- var isStyle = parentTagName === 'STYLE' ? true : undefined;
189
- var isScript = parentTagName === 'SCRIPT';
190
161
 
162
+ // var isStyle = parentTagName === 'STYLE' ? true : undefined
163
+ var isScript = parentTagName === 'SCRIPT';
191
164
  if (isScript) {
192
165
  // For perf reasons, we don't record script (heuristic)
193
166
  textContent = _constants.CENSORED_STRING_MARK;
194
167
  } else if (nodePrivacyLevel === _constants.NodePrivacyLevel.HIDDEN) {
195
168
  // Should never occur, but just in case, we set to CENSORED_MARK.
196
169
  textContent = _constants.CENSORED_STRING_MARK;
197
- } else if (shouldMaskNode(textNode, nodePrivacyLevel) && // Style tags are `overruled` (Use `hide` to enforce privacy)
198
- !isStyle) {
199
- if ( // Scrambling the child list breaks text nodes for DATALIST/SELECT/OPTGROUP
170
+ } else if (shouldMaskNode(textNode, nodePrivacyLevel)) {
171
+ if (
172
+ // Scrambling the child list breaks text nodes for DATALIST/SELECT/OPTGROUP
200
173
  parentTagName === 'DATALIST' || parentTagName === 'SELECT' || parentTagName === 'OPTGROUP') {
201
174
  if (!textContent.trim()) {
202
175
  return;
@@ -207,63 +180,72 @@ function getTextContent(textNode, ignoreWhiteSpace, parentNodePrivacyLevel) {
207
180
  } else {
208
181
  textContent = censorText(textContent);
209
182
  }
210
- } else if (isStyle && textContent) {
211
- try {
212
- // try to read style sheet
213
- if (textNode.nextSibling || textNode.previousSibling) {// This is not the only child of the stylesheet.
214
- // We can't read all of the sheet's .cssRules and expect them
215
- // to _only_ include the current rule(s) added by the text node.
216
- // So we'll be conservative and keep textContent as-is.
217
- } else if (textNode.parentNode && textNode.parentNode.sheet && textNode.parentNode.sheet.cssRules) {
218
- textContent = (0, _serializationUtils.getCssRulesString)(textNode.parentNode.sheet);
219
- }
220
- } catch (err) {}
221
-
222
- textContent = (0, _serializationUtils.switchToAbsoluteUrl)(textContent, (0, _serializationUtils.getHref)());
223
183
  }
224
-
184
+ // else if (isStyle && textContent) {
185
+ // try {
186
+ // // try to read style sheet
187
+ // if (textNode.nextSibling || textNode.previousSibling) {
188
+ // // This is not the only child of the stylesheet.
189
+ // // We can't read all of the sheet's .cssRules and expect them
190
+ // // to _only_ include the current rule(s) added by the text node.
191
+ // // So we'll be conservative and keep textContent as-is.
192
+ // } else if (
193
+ // textNode.parentNode &&
194
+ // textNode.parentNode.sheet &&
195
+ // textNode.parentNode.sheet.cssRules
196
+ // ) {
197
+ // textContent = getCssRulesString(textNode.parentNode.sheet)
198
+ // }
199
+ // } catch (err) {}
200
+ // textContent = switchToAbsoluteUrl(textContent, getHref())
201
+ // }
225
202
  return textContent;
226
203
  }
204
+
227
205
  /**
228
206
  * TODO: Preserve CSS element order, and record the presence of the tag, just don't render
229
207
  * We don't need this logic on the recorder side.
230
208
  * For security related meta's, customer can mask themmanually given they
231
209
  * are easy to identify in the HEAD tag.
232
210
  */
233
-
234
-
235
211
  function shouldIgnoreElement(element) {
236
212
  if (element.nodeName === 'SCRIPT') {
237
213
  return true;
238
214
  }
239
-
240
215
  if (element.nodeName === 'LINK') {
241
216
  var relAttribute = getLowerCaseAttribute('rel');
242
- return (// Link as script - Ignore only when rel=preload, modulepreload or prefetch
243
- /preload|prefetch/i.test(relAttribute) && getLowerCaseAttribute('as') === 'script' || // Favicons
217
+ return (
218
+ // Link as script - Ignore only when rel=preload, modulepreload or prefetch
219
+ /preload|prefetch/i.test(relAttribute) && getLowerCaseAttribute('as') === 'script' ||
220
+ // Favicons
244
221
  relAttribute === 'shortcut icon' || relAttribute === 'icon'
245
222
  );
246
223
  }
247
-
248
224
  if (element.nodeName === 'META') {
249
225
  var nameAttribute = getLowerCaseAttribute('name');
250
226
  var relAttribute = getLowerCaseAttribute('rel');
251
227
  var propertyAttribute = getLowerCaseAttribute('property');
252
- return (// Favicons
253
- /^msapplication-tile(image|color)$/.test(nameAttribute) || nameAttribute === 'application-name' || relAttribute === 'icon' || relAttribute === 'apple-touch-icon' || relAttribute === 'shortcut icon' || // Description
254
- nameAttribute === 'keywords' || nameAttribute === 'description' || // Social
255
- /^(og|twitter|fb):/.test(propertyAttribute) || /^(og|twitter):/.test(nameAttribute) || nameAttribute === 'pinterest' || // Robots
256
- nameAttribute === 'robots' || nameAttribute === 'googlebot' || nameAttribute === 'bingbot' || // Http headers. Ex: X-UA-Compatible, Content-Type, Content-Language, cache-control,
228
+ return (
229
+ // Favicons
230
+ /^msapplication-tile(image|color)$/.test(nameAttribute) || nameAttribute === 'application-name' || relAttribute === 'icon' || relAttribute === 'apple-touch-icon' || relAttribute === 'shortcut icon' ||
231
+ // Description
232
+ nameAttribute === 'keywords' || nameAttribute === 'description' ||
233
+ // Social
234
+ /^(og|twitter|fb):/.test(propertyAttribute) || /^(og|twitter):/.test(nameAttribute) || nameAttribute === 'pinterest' ||
235
+ // Robots
236
+ nameAttribute === 'robots' || nameAttribute === 'googlebot' || nameAttribute === 'bingbot' ||
237
+ // Http headers. Ex: X-UA-Compatible, Content-Type, Content-Language, cache-control,
257
238
  // X-Translated-By
258
- element.hasAttribute('http-equiv') || // Authorship
259
- nameAttribute === 'author' || nameAttribute === 'generator' || nameAttribute === 'framework' || nameAttribute === 'publisher' || nameAttribute === 'progid' || /^article:/.test(propertyAttribute) || /^product:/.test(propertyAttribute) || // Verification
239
+ element.hasAttribute('http-equiv') ||
240
+ // Authorship
241
+ nameAttribute === 'author' || nameAttribute === 'generator' || nameAttribute === 'framework' || nameAttribute === 'publisher' || nameAttribute === 'progid' || /^article:/.test(propertyAttribute) || /^product:/.test(propertyAttribute) ||
242
+ // Verification
260
243
  nameAttribute === 'google-site-verification' || nameAttribute === 'yandex-verification' || nameAttribute === 'csrf-token' || nameAttribute === 'p:domain_verify' || nameAttribute === 'verify-v1' || nameAttribute === 'verification' || nameAttribute === 'shopify-checkout-api-token'
261
244
  );
262
245
  }
263
-
264
246
  function getLowerCaseAttribute(name) {
265
247
  return (element.getAttribute(name) || '').toLowerCase();
266
248
  }
267
-
268
249
  return false;
269
- }
250
+ }
251
+ //# sourceMappingURL=privacy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"privacy.js","names":["_browserCore","require","_serializationUtils","_constants","MAX_ATTRIBUTE_VALUE_CHAR_LENGTH","exports","TEXT_MASKING_CHAR","getNodePrivacyLevel","node","defaultPrivacyLevel","parentNode","getParentNode","parentNodePrivacyLevel","selfNodePrivacyLevel","getNodeSelfPrivacyLevel","reducePrivacyLevel","childPrivacyLevel","NodePrivacyLevel","HIDDEN","IGNORE","ALLOW","MASK","MASK_USER_INPUT","isElementNode","privAttr","getAttribute","PRIVACY_ATTR_NAME","tagName","inputElement","type","autocomplete","indexOf","PRIVACY_ATTR_VALUE_HIDDEN","classList","contains","PRIVACY_CLASS_HIDDEN","PRIVACY_ATTR_VALUE_MASK","PRIVACY_CLASS_MASK","PRIVACY_ATTR_VALUE_MASK_USER_INPUT","PRIVACY_CLASS_MASK_USER_INPUT","PRIVACY_ATTR_VALUE_ALLOW","PRIVACY_CLASS_ALLOW","shouldIgnoreElement","shouldMaskNode","privacyLevel","isTextNode","isFormElement","nodeType","ELEMENT_NODE","element","FORM_PRIVATE_TAG_NAMES","censorText","text","replace","getTextContent","textNode","ignoreWhiteSpace","parentTagName","parentElement","textContent","trim","nodePrivacyLevel","isScript","CENSORED_STRING_MARK","nodeName","relAttribute","getLowerCaseAttribute","test","nameAttribute","propertyAttribute","hasAttribute","name","toLowerCase"],"sources":["../../../../src/domain/replay/record/privacy.js"],"sourcesContent":["import {\n isElementNode,\n getParentNode,\n isTextNode\n} from '@cloudcare/browser-core'\nimport {\n switchToAbsoluteUrl,\n getCssRulesString,\n getHref\n} from './serializationUtils'\nimport {\n NodePrivacyLevel,\n PRIVACY_ATTR_NAME,\n PRIVACY_ATTR_VALUE_ALLOW,\n PRIVACY_ATTR_VALUE_MASK,\n PRIVACY_ATTR_VALUE_MASK_USER_INPUT,\n PRIVACY_ATTR_VALUE_HIDDEN,\n PRIVACY_CLASS_ALLOW,\n PRIVACY_CLASS_MASK,\n PRIVACY_CLASS_MASK_USER_INPUT,\n PRIVACY_CLASS_HIDDEN,\n FORM_PRIVATE_TAG_NAMES,\n CENSORED_STRING_MARK\n} from '../../../constants'\n\nexport var MAX_ATTRIBUTE_VALUE_CHAR_LENGTH = 100_000\n\nvar TEXT_MASKING_CHAR = 'x'\n\n/**\n * Get node privacy level by iterating over its ancestors. When the direct parent privacy level is\n * know, it is best to use something like:\n *\n * derivePrivacyLevelGivenParent(getNodeSelfPrivacyLevel(node), parentNodePrivacyLevel)\n */\nexport function getNodePrivacyLevel(node, defaultPrivacyLevel) {\n var parentNode = getParentNode(node)\n var parentNodePrivacyLevel = parentNode\n ? getNodePrivacyLevel(parentNode, defaultPrivacyLevel)\n : defaultPrivacyLevel\n var selfNodePrivacyLevel = getNodeSelfPrivacyLevel(node)\n return reducePrivacyLevel(selfNodePrivacyLevel, parentNodePrivacyLevel)\n}\n\n/**\n * Reduces the next privacy level based on self + parent privacy levels\n */\nexport function reducePrivacyLevel(childPrivacyLevel, parentNodePrivacyLevel) {\n switch (parentNodePrivacyLevel) {\n // These values cannot be overridden\n case NodePrivacyLevel.HIDDEN:\n case NodePrivacyLevel.IGNORE:\n return parentNodePrivacyLevel\n }\n switch (childPrivacyLevel) {\n case NodePrivacyLevel.ALLOW:\n case NodePrivacyLevel.MASK:\n case NodePrivacyLevel.MASK_USER_INPUT:\n case NodePrivacyLevel.HIDDEN:\n case NodePrivacyLevel.IGNORE:\n return childPrivacyLevel\n default:\n return parentNodePrivacyLevel\n }\n}\n\n/**\n * Determines the node's own privacy level without checking for ancestors.\n */\nexport function getNodeSelfPrivacyLevel(node) {\n // Only Element types can have a privacy level set\n if (!isElementNode(node)) {\n return\n }\n\n var privAttr = node.getAttribute(PRIVACY_ATTR_NAME)\n\n // Overrules for replay purpose\n if (node.tagName === 'BASE') {\n return NodePrivacyLevel.ALLOW\n }\n\n // Overrules to enforce end-user protection\n if (node.tagName === 'INPUT') {\n var inputElement = node\n if (\n inputElement.type === 'password' ||\n inputElement.type === 'email' ||\n inputElement.type === 'tel'\n ) {\n return NodePrivacyLevel.MASK\n }\n if (inputElement.type === 'hidden') {\n return NodePrivacyLevel.MASK\n }\n var autocomplete = inputElement.getAttribute('autocomplete')\n // Handle input[autocomplete=cc-number/cc-csc/cc-exp/cc-exp-month/cc-exp-year]\n if (autocomplete && autocomplete.indexOf('cc-') === 0) {\n return NodePrivacyLevel.MASK\n }\n }\n\n // Check HTML privacy attributes and classes\n if (\n privAttr === PRIVACY_ATTR_VALUE_HIDDEN ||\n node.classList.contains(PRIVACY_CLASS_HIDDEN)\n ) {\n return NodePrivacyLevel.HIDDEN\n }\n\n if (\n privAttr === PRIVACY_ATTR_VALUE_MASK ||\n node.classList.contains(PRIVACY_CLASS_MASK)\n ) {\n return NodePrivacyLevel.MASK\n }\n\n if (\n privAttr === PRIVACY_ATTR_VALUE_MASK_USER_INPUT ||\n node.classList.contains(PRIVACY_CLASS_MASK_USER_INPUT)\n ) {\n return NodePrivacyLevel.MASK_USER_INPUT\n }\n\n if (\n privAttr === PRIVACY_ATTR_VALUE_ALLOW ||\n node.classList.contains(PRIVACY_CLASS_ALLOW)\n ) {\n return NodePrivacyLevel.ALLOW\n }\n\n if (shouldIgnoreElement(node)) {\n return NodePrivacyLevel.IGNORE\n }\n}\n\n/**\n * Helper aiming to unify `mask` and `mask-user-input` privacy levels:\n *\n * In the `mask` case, it is trivial: we should mask the element.\n *\n * In the `mask-user-input` case, we should mask the element only if it is a \"form\" element or the\n * direct parent is a form element for text nodes).\n *\n * Other `shouldMaskNode` cases are edge cases that should not matter too much (ex: should we mask a\n * node if it is ignored or hidden? it doesn't matter since it won't be serialized).\n */\nexport function shouldMaskNode(node, privacyLevel) {\n switch (privacyLevel) {\n case NodePrivacyLevel.MASK:\n case NodePrivacyLevel.HIDDEN:\n case NodePrivacyLevel.IGNORE:\n return true\n case NodePrivacyLevel.MASK_USER_INPUT:\n return isTextNode(node)\n ? isFormElement(node.parentNode)\n : isFormElement(node)\n default:\n return false\n }\n}\n\nfunction isFormElement(node) {\n if (!node || node.nodeType !== node.ELEMENT_NODE) {\n return false\n }\n var element = node\n if (element.tagName === 'INPUT') {\n switch (element.type) {\n case 'button':\n case 'color':\n case 'reset':\n case 'submit':\n return false\n }\n }\n return !!FORM_PRIVATE_TAG_NAMES[element.tagName]\n}\n\n/**\n * Text censoring non-destructively maintains whitespace characters in order to preserve text shape\n * during replay.\n */\nexport var censorText = function (text) {\n return text.replace(/\\S/g, TEXT_MASKING_CHAR)\n}\n\nexport function getTextContent(\n textNode,\n ignoreWhiteSpace,\n parentNodePrivacyLevel\n) {\n // The parent node may not be a html element which has a tagName attribute.\n // So just let it be undefined which is ok in this use case.\n var parentTagName = textNode.parentElement && textNode.parentElement.tagName\n var textContent = textNode.textContent || ''\n\n if (ignoreWhiteSpace && !textContent.trim()) {\n return\n }\n\n var nodePrivacyLevel = parentNodePrivacyLevel\n\n // var isStyle = parentTagName === 'STYLE' ? true : undefined\n var isScript = parentTagName === 'SCRIPT'\n\n if (isScript) {\n // For perf reasons, we don't record script (heuristic)\n textContent = CENSORED_STRING_MARK\n } else if (nodePrivacyLevel === NodePrivacyLevel.HIDDEN) {\n // Should never occur, but just in case, we set to CENSORED_MARK.\n textContent = CENSORED_STRING_MARK\n } else if (shouldMaskNode(textNode, nodePrivacyLevel)) {\n if (\n // Scrambling the child list breaks text nodes for DATALIST/SELECT/OPTGROUP\n parentTagName === 'DATALIST' ||\n parentTagName === 'SELECT' ||\n parentTagName === 'OPTGROUP'\n ) {\n if (!textContent.trim()) {\n return\n }\n } else if (parentTagName === 'OPTION') {\n // <Option> has low entropy in charset + text length, so use `CENSORED_STRING_MARK` when masked\n textContent = CENSORED_STRING_MARK\n } else {\n textContent = censorText(textContent)\n }\n }\n // else if (isStyle && textContent) {\n // try {\n // // try to read style sheet\n // if (textNode.nextSibling || textNode.previousSibling) {\n // // This is not the only child of the stylesheet.\n // // We can't read all of the sheet's .cssRules and expect them\n // // to _only_ include the current rule(s) added by the text node.\n // // So we'll be conservative and keep textContent as-is.\n // } else if (\n // textNode.parentNode &&\n // textNode.parentNode.sheet &&\n // textNode.parentNode.sheet.cssRules\n // ) {\n // textContent = getCssRulesString(textNode.parentNode.sheet)\n // }\n // } catch (err) {}\n // textContent = switchToAbsoluteUrl(textContent, getHref())\n // }\n return textContent\n}\n\n/**\n * TODO: Preserve CSS element order, and record the presence of the tag, just don't render\n * We don't need this logic on the recorder side.\n * For security related meta's, customer can mask themmanually given they\n * are easy to identify in the HEAD tag.\n */\nexport function shouldIgnoreElement(element) {\n if (element.nodeName === 'SCRIPT') {\n return true\n }\n\n if (element.nodeName === 'LINK') {\n var relAttribute = getLowerCaseAttribute('rel')\n return (\n // Link as script - Ignore only when rel=preload, modulepreload or prefetch\n (/preload|prefetch/i.test(relAttribute) &&\n getLowerCaseAttribute('as') === 'script') ||\n // Favicons\n relAttribute === 'shortcut icon' ||\n relAttribute === 'icon'\n )\n }\n\n if (element.nodeName === 'META') {\n var nameAttribute = getLowerCaseAttribute('name')\n var relAttribute = getLowerCaseAttribute('rel')\n var propertyAttribute = getLowerCaseAttribute('property')\n return (\n // Favicons\n /^msapplication-tile(image|color)$/.test(nameAttribute) ||\n nameAttribute === 'application-name' ||\n relAttribute === 'icon' ||\n relAttribute === 'apple-touch-icon' ||\n relAttribute === 'shortcut icon' ||\n // Description\n nameAttribute === 'keywords' ||\n nameAttribute === 'description' ||\n // Social\n /^(og|twitter|fb):/.test(propertyAttribute) ||\n /^(og|twitter):/.test(nameAttribute) ||\n nameAttribute === 'pinterest' ||\n // Robots\n nameAttribute === 'robots' ||\n nameAttribute === 'googlebot' ||\n nameAttribute === 'bingbot' ||\n // Http headers. Ex: X-UA-Compatible, Content-Type, Content-Language, cache-control,\n // X-Translated-By\n element.hasAttribute('http-equiv') ||\n // Authorship\n nameAttribute === 'author' ||\n nameAttribute === 'generator' ||\n nameAttribute === 'framework' ||\n nameAttribute === 'publisher' ||\n nameAttribute === 'progid' ||\n /^article:/.test(propertyAttribute) ||\n /^product:/.test(propertyAttribute) ||\n // Verification\n nameAttribute === 'google-site-verification' ||\n nameAttribute === 'yandex-verification' ||\n nameAttribute === 'csrf-token' ||\n nameAttribute === 'p:domain_verify' ||\n nameAttribute === 'verify-v1' ||\n nameAttribute === 'verification' ||\n nameAttribute === 'shopify-checkout-api-token'\n )\n }\n\n function getLowerCaseAttribute(name) {\n return (element.getAttribute(name) || '').toLowerCase()\n }\n\n return false\n}\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,mBAAA,GAAAD,OAAA;AAKA,I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K;IAA4B;EAElD;EAEA,SAASF,qBAAqBA,CAACK,IAAI,EAAE;IACnC,OAAO,CAACtB,OAAO,CAACxB,YAAY,CAAC8C,IAAI,CAAC,IAAI,EAAE,EAAEC,WAAW,CAAC,CAAC;EACzD;EAEA,OAAO,KAAK;AACd"}
@@ -4,52 +4,36 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.record = record;
7
-
8
7
  var _browserCore = require("@cloudcare/browser-core");
9
-
10
8
  var _initViewportObservable = require("../../initViewportObservable");
11
-
12
9
  var _types = require("../../../types");
13
-
14
10
  var _serialize = require("./serialize");
15
-
16
11
  var _observers = require("./observers");
17
-
18
12
  var _viewports = require("./viewports");
19
-
20
13
  var _utils = require("./utils");
21
-
22
14
  var _elementsScrollPositions = require("./elementsScrollPositions");
23
-
24
15
  var _shadowRootsController = require("./shadowRootsController");
25
-
26
16
  function record(options) {
27
- var emit = options.emit; // runtime checks for user options
28
-
17
+ var emit = options.emit;
18
+ // runtime checks for user options
29
19
  if (!emit) {
30
20
  throw new Error('emit function is required');
31
21
  }
32
-
33
22
  var elementsScrollPositions = (0, _elementsScrollPositions.createElementsScrollPositions)();
34
-
35
23
  var mutationCb = function mutationCb(mutation) {
36
24
  emit((0, _utils.assembleIncrementalSnapshot)(_types.IncrementalSource.Mutation, mutation));
37
25
  };
38
-
39
26
  var inputCb = function inputCb(s) {
40
27
  emit((0, _utils.assembleIncrementalSnapshot)(_types.IncrementalSource.Input, s));
41
28
  };
42
-
43
29
  var shadowRootsController = (0, _shadowRootsController.initShadowRootsController)(options.configuration, {
44
30
  mutationCb: mutationCb,
45
31
  inputCb: inputCb
46
32
  });
47
-
48
33
  var takeFullSnapshot = function takeFullSnapshot(timestamp, serializationContext) {
49
34
  if (typeof timestamp === 'undefined') {
50
35
  timestamp = (0, _browserCore.timeStampNow)();
51
36
  }
52
-
53
37
  if (typeof serializationContext === 'undefined') {
54
38
  serializationContext = {
55
39
  status: _serialize.SerializationContextStatus.INITIAL_FULL_SNAPSHOT,
@@ -57,9 +41,7 @@ function record(options) {
57
41
  shadowRootsController: shadowRootsController
58
42
  };
59
43
  }
60
-
61
44
  var _viewportDimension = (0, _initViewportObservable.getViewportDimension)();
62
-
63
45
  var width = _viewportDimension.width;
64
46
  var height = _viewportDimension.height;
65
47
  emit({
@@ -82,14 +64,13 @@ function record(options) {
82
64
  data: {
83
65
  node: (0, _serialize.serializeDocument)(document, options.configuration, serializationContext),
84
66
  initialOffset: {
85
- left: (0, _viewports.getScrollX)(),
86
- top: (0, _viewports.getScrollY)()
67
+ left: (0, _browserCore.getScrollX)(),
68
+ top: (0, _browserCore.getScrollY)()
87
69
  }
88
70
  },
89
71
  type: _types.RecordType.FullSnapshot,
90
72
  timestamp: timestamp
91
73
  });
92
-
93
74
  if (window.visualViewport) {
94
75
  emit({
95
76
  data: (0, _viewports.getVisualViewport)(),
@@ -98,9 +79,7 @@ function record(options) {
98
79
  });
99
80
  }
100
81
  };
101
-
102
82
  takeFullSnapshot();
103
-
104
83
  var _initObservers = (0, _observers.initObservers)({
105
84
  lifeCycle: options.lifeCycle,
106
85
  configuration: options.configuration,
@@ -146,15 +125,12 @@ function record(options) {
146
125
  },
147
126
  shadowRootsController: shadowRootsController
148
127
  });
149
-
150
128
  var stopObservers = _initObservers.stop;
151
129
  var flushMutationsFromObservers = _initObservers.flush;
152
-
153
130
  function flushMutations() {
154
131
  shadowRootsController.flush();
155
132
  flushMutationsFromObservers();
156
133
  }
157
-
158
134
  return {
159
135
  stop: function stop() {
160
136
  shadowRootsController.stop();
@@ -171,4 +147,5 @@ function record(options) {
171
147
  flushMutations: flushMutations,
172
148
  shadowRootsController: shadowRootsController
173
149
  };
174
- }
150
+ }
151
+ //# sourceMappingURL=record.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"record.js","names":["_browserCore","require","_initViewportObservable","_types","_serialize","_observers","_viewports","_utils","_elementsScrollPositions","_shadowRootsController","record","options","emit","Error","elementsScrollPositions","createElementsScrollPositions","mutationCb","mutation","assembleIncrementalSnapshot","IncrementalSource","Mutation","inputCb","s","Input","shadowRootsController","initShadowRootsController","configuration","takeFullSnapshot","timestamp","serializationContext","timeStampNow","status","SerializationContextStatus","INITIAL_FULL_SNAPSHOT","_viewportDimension","getViewportDimension","width","height","data","href","window","location","type","RecordType","Meta","has_focus","document","hasFocus","Focus","node","serializeDocument","initialOffset","left","getScrollX","top","getScrollY","FullSnapshot","visualViewport","getVisualViewport","VisualViewport","_initObservers","initObservers","lifeCycle","mediaInteractionCb","p","MediaInteraction","mouseInteractionCb","mouseInteractionRecord","mousemoveCb","positions","source","scrollCb","Scroll","styleSheetCb","r","StyleSheetRule","viewportResizeCb","d","ViewportResize","frustrationCb","frustrationRecord","focusCb","visualViewportResizeCb","stopObservers","stop","flushMutationsFromObservers","flush","flushMutations","takeSubsequentFullSnapshot","SUBSEQUENT_FULL_SNAPSHOT"],"sources":["../../../../src/domain/replay/record/record.js"],"sourcesContent":["import { timeStampNow, getScrollX, getScrollY } from '@cloudcare/browser-core'\nimport { getViewportDimension } from '../../initViewportObservable'\n\nimport { RecordType, IncrementalSource } from '../../../types'\nimport { serializeDocument, SerializationContextStatus } from './serialize'\nimport { initObservers } from './observers'\n\nimport { getVisualViewport } from './viewports'\nimport { assembleIncrementalSnapshot } from './utils'\nimport { createElementsScrollPositions } from './elementsScrollPositions'\nimport { initShadowRootsController } from './shadowRootsController'\n\nexport function record(options) {\n var emit = options.emit\n // runtime checks for user options\n if (!emit) {\n throw new Error('emit function is required')\n }\n\n var elementsScrollPositions = createElementsScrollPositions()\n\n var mutationCb = function (mutation) {\n emit(assembleIncrementalSnapshot(IncrementalSource.Mutation, mutation))\n }\n var inputCb = function (s) {\n emit(assembleIncrementalSnapshot(IncrementalSource.Input, s))\n }\n\n var shadowRootsController = initShadowRootsController(options.configuration, {\n mutationCb,\n inputCb\n })\n\n var takeFullSnapshot = function (timestamp, serializationContext) {\n if (typeof timestamp === 'undefined') {\n timestamp = timeStampNow()\n }\n if (typeof serializationContext === 'undefined') {\n serializationContext = {\n status: SerializationContextStatus.INITIAL_FULL_SNAPSHOT,\n elementsScrollPositions: elementsScrollPositions,\n shadowRootsController: shadowRootsController\n }\n }\n var _viewportDimension = getViewportDimension()\n var width = _viewportDimension.width\n var height = _viewportDimension.height\n emit({\n data: {\n height: height,\n href: window.location.href,\n width: width\n },\n type: RecordType.Meta,\n timestamp: timestamp\n })\n\n emit({\n data: {\n has_focus: document.hasFocus()\n },\n type: RecordType.Focus,\n timestamp: timestamp\n })\n\n emit({\n data: {\n node: serializeDocument(\n document,\n options.configuration,\n serializationContext\n ),\n initialOffset: {\n left: getScrollX(),\n top: getScrollY()\n }\n },\n type: RecordType.FullSnapshot,\n timestamp: timestamp\n })\n\n if (window.visualViewport) {\n emit({\n data: getVisualViewport(),\n type: RecordType.VisualViewport,\n timestamp: timestamp\n })\n }\n }\n\n takeFullSnapshot()\n var _initObservers = initObservers({\n lifeCycle: options.lifeCycle,\n configuration: options.configuration,\n elementsScrollPositions: elementsScrollPositions,\n inputCb: inputCb,\n mediaInteractionCb: function (p) {\n emit(assembleIncrementalSnapshot(IncrementalSource.MediaInteraction, p))\n },\n mouseInteractionCb: function (mouseInteractionRecord) {\n emit(mouseInteractionRecord)\n },\n mousemoveCb: function (positions, source) {\n emit(assembleIncrementalSnapshot(source, { positions: positions }))\n },\n mutationCb: mutationCb,\n scrollCb: function (p) {\n emit(assembleIncrementalSnapshot(IncrementalSource.Scroll, p))\n },\n styleSheetCb: function (r) {\n emit(assembleIncrementalSnapshot(IncrementalSource.StyleSheetRule, r))\n },\n viewportResizeCb: function (d) {\n emit(assembleIncrementalSnapshot(IncrementalSource.ViewportResize, d))\n },\n frustrationCb: function (frustrationRecord) {\n emit(frustrationRecord)\n },\n focusCb: function (data) {\n emit({\n data: data,\n type: RecordType.Focus,\n timestamp: timeStampNow()\n })\n },\n visualViewportResizeCb: function (data) {\n emit({\n data: data,\n type: RecordType.VisualViewport,\n timestamp: timeStampNow()\n })\n },\n shadowRootsController: shadowRootsController\n })\n var stopObservers = _initObservers.stop\n var flushMutationsFromObservers = _initObservers.flush\n function flushMutations() {\n shadowRootsController.flush()\n flushMutationsFromObservers()\n }\n\n return {\n stop: function () {\n shadowRootsController.stop()\n stopObservers()\n },\n takeSubsequentFullSnapshot: function (timestamp) {\n flushMutations()\n takeFullSnapshot(timestamp, {\n shadowRootsController: shadowRootsController,\n status: SerializationContextStatus.SUBSEQUENT_FULL_SNAPSHOT,\n elementsScrollPositions: elementsScrollPositions\n })\n },\n flushMutations: flushMutations,\n shadowRootsController: shadowRootsController\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AAEA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,wBAAA,GAAAP,OAAA;AACA,IAAAQ,sBAAA,GAAAR,OAAA;AAEO,SAASS,MAAMA,CAACC,OAAO,EAAE;EAC9B,IAAIC,IAAI,GAAGD,OAAO,CAACC,IAAI;EACvB;EACA,IAAI,CAACA,IAAI,EAAE;IACT,MAAM,IAAIC,KAAK,CAAC,2BAA2B,CAAC;EAC9C;EAEA,IAAIC,uBAAuB,GAAG,IAAAC,sDAA6B,EAAC,CAAC;EAE7D,IAAIC,UAAU,GAAG,SAAbA,UAAUA,CAAaC,QAAQ,EAAE;IACnCL,IAAI,CAAC,IAAAM,kCAA2B,EAACC,wBAAiB,CAACC,QAAQ,EAAEH,QAAQ,CAAC,CAAC;EACzE,CAAC;EACD,IAAII,OAAO,GAAG,SAAVA,OAAOA,CAAaC,CAAC,EAAE;IACzBV,IAAI,CAAC,IAAAM,kCAA2B,EAACC,wBAAiB,CAACI,KAAK,EAAED,CAAC,CAAC,CAAC;EAC/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