@cloudcare/browser-rum 3.0.27 → 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 (386) 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 +40 -87
  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 +12 -26
  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 +8 -12
  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 +13 -42
  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 +22 -24
  47. package/cjs/domain/replay/record/mutationBatch.js.map +1 -0
  48. package/cjs/domain/replay/record/mutationObserver.js +28 -87
  49. package/cjs/domain/replay/record/mutationObserver.js.map +1 -0
  50. package/cjs/domain/replay/record/observers.js +16 -90
  51. package/cjs/domain/replay/record/observers.js.map +1 -0
  52. package/cjs/domain/replay/record/privacy.js +58 -61
  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 +65 -52
  57. package/cjs/domain/replay/record/serializationUtils.js.map +1 -0
  58. package/cjs/domain/replay/record/serialize.js +47 -189
  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 +16 -48
  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 +59 -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 +41 -82
  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 +12 -23
  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 +9 -10
  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 +14 -39
  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 +22 -21
  219. package/esm/domain/replay/record/mutationBatch.js.map +1 -0
  220. package/esm/domain/replay/record/mutationObserver.js +30 -81
  221. package/esm/domain/replay/record/mutationObserver.js.map +1 -0
  222. package/esm/domain/replay/record/observers.js +16 -73
  223. package/esm/domain/replay/record/observers.js.map +1 -0
  224. package/esm/domain/replay/record/privacy.js +58 -52
  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 +59 -36
  229. package/esm/domain/replay/record/serializationUtils.js.map +1 -0
  230. package/esm/domain/replay/record/serialize.js +46 -175
  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 +15 -43
  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 +59 -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/boot/rumPublicApi.js +41 -38
  348. package/src/domain/assembly.js +9 -8
  349. package/src/domain/configuration.js +0 -1
  350. package/src/domain/contexts/displayContext.js +29 -0
  351. package/src/domain/contexts/internalContext.js +3 -1
  352. package/src/domain/contexts/pageStateHistory.js +139 -0
  353. package/src/domain/domMutationCollection.js +20 -17
  354. package/src/domain/performanceCollection.js +4 -3
  355. package/src/domain/replay/record/mutationBatch.js +21 -3
  356. package/src/domain/replay/record/mutationObserver.js +4 -2
  357. package/src/domain/replay/record/observers.js +7 -4
  358. package/src/domain/replay/record/privacy.js +25 -6
  359. package/src/domain/replay/record/record.js +2 -2
  360. package/src/domain/replay/record/serializationUtils.js +67 -3
  361. package/src/domain/replay/record/serialize.js +16 -82
  362. package/src/domain/replay/record/shadowRootsController.js +0 -1
  363. package/src/domain/replay/record/viewports.js +0 -26
  364. package/src/domain/rumEventsCollection/actions/actionCollection.js +12 -12
  365. package/src/domain/rumEventsCollection/actions/getSelectorsFromElement.js +4 -4
  366. package/src/domain/rumEventsCollection/actions/trackClickActions.js +8 -6
  367. package/src/domain/rumEventsCollection/error/errorCollection.js +20 -15
  368. package/src/domain/rumEventsCollection/error/trackReportError.js +22 -16
  369. package/src/domain/rumEventsCollection/resource/resourceUtils.js +4 -1
  370. package/src/domain/rumEventsCollection/view/interactionCountPolyfill.js +59 -0
  371. package/src/domain/rumEventsCollection/view/trackCommonViewMetrics.js +87 -0
  372. package/src/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js +73 -0
  373. package/src/domain/rumEventsCollection/view/trackFirstContentfulPaint.js +23 -0
  374. package/src/domain/rumEventsCollection/view/trackFirstInputTimings.js +40 -0
  375. package/src/domain/rumEventsCollection/view/trackInitialViewTimings.js +29 -199
  376. package/src/domain/rumEventsCollection/view/trackInteractionToNextPaint.js +144 -0
  377. package/src/domain/rumEventsCollection/view/trackLargestContentfulPaint.js +57 -0
  378. package/src/domain/rumEventsCollection/view/trackLoadingTime.js +50 -0
  379. package/src/domain/rumEventsCollection/view/trackNavigationTimings.js +35 -0
  380. package/src/domain/rumEventsCollection/view/trackScrollMetrics.js +74 -0
  381. package/src/domain/rumEventsCollection/view/trackViews.js +32 -37
  382. package/src/domain/rumEventsCollection/view/viewCollection.js +51 -22
  383. package/src/transport/startRumBatch.js +5 -1
  384. package/cjs/domain/rumEventsCollection/view/trackViewMetrics.js +0 -156
  385. package/esm/domain/rumEventsCollection/view/trackViewMetrics.js +0 -146
  386. package/src/domain/rumEventsCollection/view/trackViewMetrics.js +0 -176
@@ -1,24 +1,25 @@
1
1
  import { isElementNode, getParentNode, isTextNode } from '@cloudcare/browser-core';
2
+ import { switchToAbsoluteUrl, getCssRulesString, getHref } from './serializationUtils';
2
3
  import { NodePrivacyLevel, PRIVACY_ATTR_NAME, PRIVACY_ATTR_VALUE_ALLOW, PRIVACY_ATTR_VALUE_MASK, PRIVACY_ATTR_VALUE_MASK_USER_INPUT, PRIVACY_ATTR_VALUE_HIDDEN, PRIVACY_CLASS_ALLOW, PRIVACY_CLASS_MASK, PRIVACY_CLASS_MASK_USER_INPUT, PRIVACY_CLASS_HIDDEN, FORM_PRIVATE_TAG_NAMES, CENSORED_STRING_MARK } from '../../../constants';
3
4
  export var MAX_ATTRIBUTE_VALUE_CHAR_LENGTH = 100000;
4
5
  var TEXT_MASKING_CHAR = 'x';
6
+
5
7
  /**
6
8
  * Get node privacy level by iterating over its ancestors. When the direct parent privacy level is
7
9
  * know, it is best to use something like:
8
10
  *
9
11
  * derivePrivacyLevelGivenParent(getNodeSelfPrivacyLevel(node), parentNodePrivacyLevel)
10
12
  */
11
-
12
13
  export function getNodePrivacyLevel(node, defaultPrivacyLevel) {
13
14
  var parentNode = getParentNode(node);
14
15
  var parentNodePrivacyLevel = parentNode ? getNodePrivacyLevel(parentNode, defaultPrivacyLevel) : defaultPrivacyLevel;
15
16
  var selfNodePrivacyLevel = getNodeSelfPrivacyLevel(node);
16
17
  return reducePrivacyLevel(selfNodePrivacyLevel, parentNodePrivacyLevel);
17
18
  }
19
+
18
20
  /**
19
21
  * Reduces the next privacy level based on self + parent privacy levels
20
22
  */
21
-
22
23
  export function reducePrivacyLevel(childPrivacyLevel, parentNodePrivacyLevel) {
23
24
  switch (parentNodePrivacyLevel) {
24
25
  // These values cannot be overridden
@@ -26,7 +27,6 @@ export function reducePrivacyLevel(childPrivacyLevel, parentNodePrivacyLevel) {
26
27
  case NodePrivacyLevel.IGNORE:
27
28
  return parentNodePrivacyLevel;
28
29
  }
29
-
30
30
  switch (childPrivacyLevel) {
31
31
  case NodePrivacyLevel.ALLOW:
32
32
  case NodePrivacyLevel.MASK:
@@ -34,67 +34,60 @@ export function reducePrivacyLevel(childPrivacyLevel, parentNodePrivacyLevel) {
34
34
  case NodePrivacyLevel.HIDDEN:
35
35
  case NodePrivacyLevel.IGNORE:
36
36
  return childPrivacyLevel;
37
-
38
37
  default:
39
38
  return parentNodePrivacyLevel;
40
39
  }
41
40
  }
41
+
42
42
  /**
43
43
  * Determines the node's own privacy level without checking for ancestors.
44
44
  */
45
-
46
45
  export function getNodeSelfPrivacyLevel(node) {
47
46
  // Only Element types can have a privacy level set
48
47
  if (!isElementNode(node)) {
49
48
  return;
50
49
  }
50
+ var privAttr = node.getAttribute(PRIVACY_ATTR_NAME);
51
51
 
52
- var privAttr = node.getAttribute(PRIVACY_ATTR_NAME); // Overrules for replay purpose
53
-
52
+ // Overrules for replay purpose
54
53
  if (node.tagName === 'BASE') {
55
54
  return NodePrivacyLevel.ALLOW;
56
- } // Overrules to enforce end-user protection
57
-
55
+ }
58
56
 
57
+ // Overrules to enforce end-user protection
59
58
  if (node.tagName === 'INPUT') {
60
59
  var inputElement = node;
61
-
62
60
  if (inputElement.type === 'password' || inputElement.type === 'email' || inputElement.type === 'tel') {
63
61
  return NodePrivacyLevel.MASK;
64
62
  }
65
-
66
63
  if (inputElement.type === 'hidden') {
67
64
  return NodePrivacyLevel.MASK;
68
65
  }
69
-
70
- var autocomplete = inputElement.getAttribute('autocomplete'); // Handle input[autocomplete=cc-number/cc-csc/cc-exp/cc-exp-month/cc-exp-year]
71
-
66
+ var autocomplete = inputElement.getAttribute('autocomplete');
67
+ // Handle input[autocomplete=cc-number/cc-csc/cc-exp/cc-exp-month/cc-exp-year]
72
68
  if (autocomplete && autocomplete.indexOf('cc-') === 0) {
73
69
  return NodePrivacyLevel.MASK;
74
70
  }
75
- } // Check HTML privacy attributes and classes
76
-
71
+ }
77
72
 
73
+ // Check HTML privacy attributes and classes
78
74
  if (privAttr === PRIVACY_ATTR_VALUE_HIDDEN || node.classList.contains(PRIVACY_CLASS_HIDDEN)) {
79
75
  return NodePrivacyLevel.HIDDEN;
80
76
  }
81
-
82
77
  if (privAttr === PRIVACY_ATTR_VALUE_MASK || node.classList.contains(PRIVACY_CLASS_MASK)) {
83
78
  return NodePrivacyLevel.MASK;
84
79
  }
85
-
86
80
  if (privAttr === PRIVACY_ATTR_VALUE_MASK_USER_INPUT || node.classList.contains(PRIVACY_CLASS_MASK_USER_INPUT)) {
87
81
  return NodePrivacyLevel.MASK_USER_INPUT;
88
82
  }
89
-
90
83
  if (privAttr === PRIVACY_ATTR_VALUE_ALLOW || node.classList.contains(PRIVACY_CLASS_ALLOW)) {
91
84
  return NodePrivacyLevel.ALLOW;
92
85
  }
93
-
94
86
  if (shouldIgnoreElement(node)) {
95
87
  return NodePrivacyLevel.IGNORE;
96
88
  }
97
89
  }
90
+
98
91
  /**
99
92
  * Helper aiming to unify `mask` and `mask-user-input` privacy levels:
100
93
  *
@@ -106,29 +99,23 @@ export function getNodeSelfPrivacyLevel(node) {
106
99
  * Other `shouldMaskNode` cases are edge cases that should not matter too much (ex: should we mask a
107
100
  * node if it is ignored or hidden? it doesn't matter since it won't be serialized).
108
101
  */
109
-
110
102
  export function shouldMaskNode(node, privacyLevel) {
111
103
  switch (privacyLevel) {
112
104
  case NodePrivacyLevel.MASK:
113
105
  case NodePrivacyLevel.HIDDEN:
114
106
  case NodePrivacyLevel.IGNORE:
115
107
  return true;
116
-
117
108
  case NodePrivacyLevel.MASK_USER_INPUT:
118
109
  return isTextNode(node) ? isFormElement(node.parentNode) : isFormElement(node);
119
-
120
110
  default:
121
111
  return false;
122
112
  }
123
113
  }
124
-
125
114
  function isFormElement(node) {
126
115
  if (!node || node.nodeType !== node.ELEMENT_NODE) {
127
116
  return false;
128
117
  }
129
-
130
118
  var element = node;
131
-
132
119
  if (element.tagName === 'INPUT') {
133
120
  switch (element.type) {
134
121
  case 'button':
@@ -138,15 +125,13 @@ function isFormElement(node) {
138
125
  return false;
139
126
  }
140
127
  }
141
-
142
128
  return !!FORM_PRIVATE_TAG_NAMES[element.tagName];
143
129
  }
130
+
144
131
  /**
145
132
  * Text censoring non-destructively maintains whitespace characters in order to preserve text shape
146
133
  * during replay.
147
134
  */
148
-
149
-
150
135
  export var censorText = function censorText(text) {
151
136
  return text.replace(/\S/g, TEXT_MASKING_CHAR);
152
137
  };
@@ -155,24 +140,22 @@ export function getTextContent(textNode, ignoreWhiteSpace, parentNodePrivacyLeve
155
140
  // So just let it be undefined which is ok in this use case.
156
141
  var parentTagName = textNode.parentElement && textNode.parentElement.tagName;
157
142
  var textContent = textNode.textContent || '';
158
-
159
143
  if (ignoreWhiteSpace && !textContent.trim()) {
160
144
  return;
161
145
  }
162
-
163
146
  var nodePrivacyLevel = parentNodePrivacyLevel;
164
- var isStyle = parentTagName === 'STYLE' ? true : undefined;
165
- var isScript = parentTagName === 'SCRIPT';
166
147
 
148
+ // var isStyle = parentTagName === 'STYLE' ? true : undefined
149
+ var isScript = parentTagName === 'SCRIPT';
167
150
  if (isScript) {
168
151
  // For perf reasons, we don't record script (heuristic)
169
152
  textContent = CENSORED_STRING_MARK;
170
153
  } else if (nodePrivacyLevel === NodePrivacyLevel.HIDDEN) {
171
154
  // Should never occur, but just in case, we set to CENSORED_MARK.
172
155
  textContent = CENSORED_STRING_MARK;
173
- } else if (shouldMaskNode(textNode, nodePrivacyLevel) && // Style tags are `overruled` (Use `hide` to enforce privacy)
174
- !isStyle) {
175
- if ( // Scrambling the child list breaks text nodes for DATALIST/SELECT/OPTGROUP
156
+ } else if (shouldMaskNode(textNode, nodePrivacyLevel)) {
157
+ if (
158
+ // Scrambling the child list breaks text nodes for DATALIST/SELECT/OPTGROUP
176
159
  parentTagName === 'DATALIST' || parentTagName === 'SELECT' || parentTagName === 'OPTGROUP') {
177
160
  if (!textContent.trim()) {
178
161
  return;
@@ -184,48 +167,71 @@ export function getTextContent(textNode, ignoreWhiteSpace, parentNodePrivacyLeve
184
167
  textContent = censorText(textContent);
185
168
  }
186
169
  }
187
-
170
+ // else if (isStyle && textContent) {
171
+ // try {
172
+ // // try to read style sheet
173
+ // if (textNode.nextSibling || textNode.previousSibling) {
174
+ // // This is not the only child of the stylesheet.
175
+ // // We can't read all of the sheet's .cssRules and expect them
176
+ // // to _only_ include the current rule(s) added by the text node.
177
+ // // So we'll be conservative and keep textContent as-is.
178
+ // } else if (
179
+ // textNode.parentNode &&
180
+ // textNode.parentNode.sheet &&
181
+ // textNode.parentNode.sheet.cssRules
182
+ // ) {
183
+ // textContent = getCssRulesString(textNode.parentNode.sheet)
184
+ // }
185
+ // } catch (err) {}
186
+ // textContent = switchToAbsoluteUrl(textContent, getHref())
187
+ // }
188
188
  return textContent;
189
189
  }
190
+
190
191
  /**
191
192
  * TODO: Preserve CSS element order, and record the presence of the tag, just don't render
192
193
  * We don't need this logic on the recorder side.
193
194
  * For security related meta's, customer can mask themmanually given they
194
195
  * are easy to identify in the HEAD tag.
195
196
  */
196
-
197
197
  export function shouldIgnoreElement(element) {
198
198
  if (element.nodeName === 'SCRIPT') {
199
199
  return true;
200
200
  }
201
-
202
201
  if (element.nodeName === 'LINK') {
203
202
  var relAttribute = getLowerCaseAttribute('rel');
204
- return (// Link as script - Ignore only when rel=preload, modulepreload or prefetch
205
- /preload|prefetch/i.test(relAttribute) && getLowerCaseAttribute('as') === 'script' || // Favicons
203
+ return (
204
+ // Link as script - Ignore only when rel=preload, modulepreload or prefetch
205
+ /preload|prefetch/i.test(relAttribute) && getLowerCaseAttribute('as') === 'script' ||
206
+ // Favicons
206
207
  relAttribute === 'shortcut icon' || relAttribute === 'icon'
207
208
  );
208
209
  }
209
-
210
210
  if (element.nodeName === 'META') {
211
211
  var nameAttribute = getLowerCaseAttribute('name');
212
212
  var relAttribute = getLowerCaseAttribute('rel');
213
213
  var propertyAttribute = getLowerCaseAttribute('property');
214
- return (// Favicons
215
- /^msapplication-tile(image|color)$/.test(nameAttribute) || nameAttribute === 'application-name' || relAttribute === 'icon' || relAttribute === 'apple-touch-icon' || relAttribute === 'shortcut icon' || // Description
216
- nameAttribute === 'keywords' || nameAttribute === 'description' || // Social
217
- /^(og|twitter|fb):/.test(propertyAttribute) || /^(og|twitter):/.test(nameAttribute) || nameAttribute === 'pinterest' || // Robots
218
- nameAttribute === 'robots' || nameAttribute === 'googlebot' || nameAttribute === 'bingbot' || // Http headers. Ex: X-UA-Compatible, Content-Type, Content-Language, cache-control,
214
+ return (
215
+ // Favicons
216
+ /^msapplication-tile(image|color)$/.test(nameAttribute) || nameAttribute === 'application-name' || relAttribute === 'icon' || relAttribute === 'apple-touch-icon' || relAttribute === 'shortcut icon' ||
217
+ // Description
218
+ nameAttribute === 'keywords' || nameAttribute === 'description' ||
219
+ // Social
220
+ /^(og|twitter|fb):/.test(propertyAttribute) || /^(og|twitter):/.test(nameAttribute) || nameAttribute === 'pinterest' ||
221
+ // Robots
222
+ nameAttribute === 'robots' || nameAttribute === 'googlebot' || nameAttribute === 'bingbot' ||
223
+ // Http headers. Ex: X-UA-Compatible, Content-Type, Content-Language, cache-control,
219
224
  // X-Translated-By
220
- element.hasAttribute('http-equiv') || // Authorship
221
- nameAttribute === 'author' || nameAttribute === 'generator' || nameAttribute === 'framework' || nameAttribute === 'publisher' || nameAttribute === 'progid' || /^article:/.test(propertyAttribute) || /^product:/.test(propertyAttribute) || // Verification
225
+ element.hasAttribute('http-equiv') ||
226
+ // Authorship
227
+ nameAttribute === 'author' || nameAttribute === 'generator' || nameAttribute === 'framework' || nameAttribute === 'publisher' || nameAttribute === 'progid' || /^article:/.test(propertyAttribute) || /^product:/.test(propertyAttribute) ||
228
+ // Verification
222
229
  nameAttribute === 'google-site-verification' || nameAttribute === 'yandex-verification' || nameAttribute === 'csrf-token' || nameAttribute === 'p:domain_verify' || nameAttribute === 'verify-v1' || nameAttribute === 'verification' || nameAttribute === 'shopify-checkout-api-token'
223
230
  );
224
231
  }
225
-
226
232
  function getLowerCaseAttribute(name) {
227
233
  return (element.getAttribute(name) || '').toLowerCase();
228
234
  }
229
-
230
235
  return false;
231
- }
236
+ }
237
+ //# sourceMappingURL=privacy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"privacy.js","names":["isElementNode","getParentNode","isTextNode","switchToAbsoluteUrl","getCssRulesString","getHref","NodePrivacyLevel","PRIVACY_ATTR_NAME","PRIVACY_ATTR_VALUE_ALLOW","PRIVACY_ATTR_VALUE_MASK","PRIVACY_ATTR_VALUE_MASK_USER_INPUT","PRIVACY_ATTR_VALUE_HIDDEN","PRIVACY_CLASS_ALLOW","PRIVACY_CLASS_MASK","PRIVACY_CLASS_MASK_USER_INPUT","PRIVACY_CLASS_HIDDEN","FORM_PRIVATE_TAG_NAMES","CENSORED_STRING_MARK","MAX_ATTRIBUTE_VALUE_CHAR_LENGTH","TEXT_MASKING_CHAR","getNodePrivacyLevel","node","defaultPrivacyLevel","parentNode","parentNodePrivacyLevel","selfNodePrivacyLevel","getNodeSelfPrivacyLevel","reducePrivacyLevel","childPrivacyLevel","HIDDEN","IGNORE","ALLOW","MASK","MASK_USER_INPUT","privAttr","getAttribute","tagName","inputElement","type","autocomplete","indexOf","classList","contains","shouldIgnoreElement","shouldMaskNode","privacyLevel","isFormElement","nodeType","ELEMENT_NODE","element","censorText","text","replace","getTextContent","textNode","ignoreWhiteSpace","parentTagName","parentElement","textContent","trim","nodePrivacyLevel","isScript","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,SACEA,aAAa,EACbC,aAAa,EACbC,UAAU,QACL,yBAAyB;AAChC,SACEC,mBAAmB,EACnBC,iBAAiB,EACjBC,OAAO,QACF,sBAAsB;AAC7B,SACEC,gBAAgB,EAChBC,iBAAiB,EACjBC,wBAAwB,EACxBC,uBAAuB,EACvBC,kCAAkC,EAClCC,yBAAyB,EACzBC,mBAAmB,EACnBC,kBAAkB,EAClBC,6BAA6B,EAC7BC,oBAAoB,EACpBC,sBAAsB,EACtBC,oBAAoB,QACf,oBAAoB;AAE3B,OAAO,IAAIC,+BAA+B,GAAG,MAAO;AAEpD,IAAIC,iBAAiB,GAAG,GAAG;;AAE3B;AACA;AACA;A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AW,CAAC,CAAC;EACzD;EAEA,OAAO,KAAK;AACd"}
@@ -1,39 +1,33 @@
1
- import { timeStampNow } from '@cloudcare/browser-core';
1
+ import { timeStampNow, getScrollX, getScrollY } from '@cloudcare/browser-core';
2
2
  import { getViewportDimension } from '../../initViewportObservable';
3
3
  import { RecordType, IncrementalSource } from '../../../types';
4
4
  import { serializeDocument, SerializationContextStatus } from './serialize';
5
5
  import { initObservers } from './observers';
6
- import { getVisualViewport, getScrollX, getScrollY } from './viewports';
6
+ import { getVisualViewport } from './viewports';
7
7
  import { assembleIncrementalSnapshot } from './utils';
8
8
  import { createElementsScrollPositions } from './elementsScrollPositions';
9
9
  import { initShadowRootsController } from './shadowRootsController';
10
10
  export function record(options) {
11
- var emit = options.emit; // runtime checks for user options
12
-
11
+ var emit = options.emit;
12
+ // runtime checks for user options
13
13
  if (!emit) {
14
14
  throw new Error('emit function is required');
15
15
  }
16
-
17
16
  var elementsScrollPositions = createElementsScrollPositions();
18
-
19
17
  var mutationCb = function mutationCb(mutation) {
20
18
  emit(assembleIncrementalSnapshot(IncrementalSource.Mutation, mutation));
21
19
  };
22
-
23
20
  var inputCb = function inputCb(s) {
24
21
  emit(assembleIncrementalSnapshot(IncrementalSource.Input, s));
25
22
  };
26
-
27
23
  var shadowRootsController = initShadowRootsController(options.configuration, {
28
24
  mutationCb: mutationCb,
29
25
  inputCb: inputCb
30
26
  });
31
-
32
27
  var takeFullSnapshot = function takeFullSnapshot(timestamp, serializationContext) {
33
28
  if (typeof timestamp === 'undefined') {
34
29
  timestamp = timeStampNow();
35
30
  }
36
-
37
31
  if (typeof serializationContext === 'undefined') {
38
32
  serializationContext = {
39
33
  status: SerializationContextStatus.INITIAL_FULL_SNAPSHOT,
@@ -41,9 +35,7 @@ export function record(options) {
41
35
  shadowRootsController: shadowRootsController
42
36
  };
43
37
  }
44
-
45
38
  var _viewportDimension = getViewportDimension();
46
-
47
39
  var width = _viewportDimension.width;
48
40
  var height = _viewportDimension.height;
49
41
  emit({
@@ -73,7 +65,6 @@ export function record(options) {
73
65
  type: RecordType.FullSnapshot,
74
66
  timestamp: timestamp
75
67
  });
76
-
77
68
  if (window.visualViewport) {
78
69
  emit({
79
70
  data: getVisualViewport(),
@@ -82,9 +73,7 @@ export function record(options) {
82
73
  });
83
74
  }
84
75
  };
85
-
86
76
  takeFullSnapshot();
87
-
88
77
  var _initObservers = initObservers({
89
78
  lifeCycle: options.lifeCycle,
90
79
  configuration: options.configuration,
@@ -130,15 +119,12 @@ export function record(options) {
130
119
  },
131
120
  shadowRootsController: shadowRootsController
132
121
  });
133
-
134
122
  var stopObservers = _initObservers.stop;
135
123
  var flushMutationsFromObservers = _initObservers.flush;
136
-
137
124
  function flushMutations() {
138
125
  shadowRootsController.flush();
139
126
  flushMutationsFromObservers();
140
127
  }
141
-
142
128
  return {
143
129
  stop: function stop() {
144
130
  shadowRootsController.stop();
@@ -155,4 +141,5 @@ export function record(options) {
155
141
  flushMutations: flushMutations,
156
142
  shadowRootsController: shadowRootsController
157
143
  };
158
- }
144
+ }
145
+ //# sourceMappingURL=record.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"record.js","names":["timeStampNow","getScrollX","getScrollY","getViewportDimension","RecordType","IncrementalSource","serializeDocument","SerializationContextStatus","initObservers","getVisualViewport","assembleIncrementalSnapshot","createElementsScrollPositions","initShadowRootsController","record","options","emit","Error","elementsScrollPositions","mutationCb","mutation","Mutation","inputCb","s","Input","shadowRootsController","configuration","takeFullSnapshot","timestamp","serializationContext","status","INITIAL_FULL_SNAPSHOT","_viewportDimension","width","height","data","href","window","location","type","Meta","has_focus","document","hasFocus","Focus","node","initialOffset","left","top","FullSnapshot","visualViewport","VisualViewport","_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,SAASA,YAAY,EAAEC,UAAU,EAAEC,UAAU,QAAQ,yBAAyB;AAC9E,SAASC,oBAAoB,QAAQ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C;MAC1B,CAAC,CAAC;IACJ,CAAC;IACDwE,sBAAsB,EAAE,SAAAA,uBAAUtC,IAAI,EAAE;MACtCnB,IAAI,CAAC;QACHmB,IAAI,EAAEA,IAAI;QACVI,IAAI,EAAElC,UAAU,CAAC8C,cAAc;QAC/BvB,SAAS,EAAE3B,YAAY,CAAC;MAC1B,CAAC,CAAC;IACJ,CAAC;IACDwB,qBAAqB,EAAEA;EACzB,CAAC,CAAC;EACF,IAAIiD,aAAa,GAAGtB,cAAc,CAACuB,IAAI;EACvC,IAAIC,2BAA2B,GAAGxB,cAAc,CAACyB,KAAK;EACtD,SAASC,cAAcA,CAAA,EAAG;IACxBrD,qBAAqB,CAACoD,KAAK,CAAC,CAAC;IAC7BD,2BAA2B,CAAC,CAAC;EAC/B;EAEA,OAAO;IACLD,IAAI,EAAE,SAAAA,KAAA,EAAY;MAChBlD,qBAAqB,CAACkD,IAAI,CAAC,CAAC;MAC5BD,aAAa,CAAC,CAAC;IACjB,CAAC;IACDK,0BAA0B,EAAE,SAAAA,2BAAUnD,SAAS,EAAE;MAC/CkD,cAAc,CAAC,CAAC;MAChBnD,gBAAgB,CAACC,SAAS,EAAE;QAC1BH,qBAAqB,EAAEA,qBAAqB;QAC5CK,MAAM,EAAEtB,0BAA0B,CAACwE,wBAAwB;QAC3D9D,uBAAuB,EAAEA;MAC3B,CAAC,CAAC;IACJ,CAAC;IACD4D,cAAc,EAAEA,cAAc;IAC9BrD,qBAAqB,EAAEA;EACzB,CAAC;AACH"}
@@ -7,15 +7,12 @@ export function hasSerializedNode(node) {
7
7
  }
8
8
  export function nodeAndAncestorsHaveSerializedNode(node) {
9
9
  var current = node;
10
-
11
10
  while (current) {
12
11
  if (!hasSerializedNode(current) && !isNodeShadowRoot(current)) {
13
12
  return false;
14
13
  }
15
-
16
14
  current = getParentNode(current);
17
15
  }
18
-
19
16
  return true;
20
17
  }
21
18
  export function getSerializedNodeId(node) {
@@ -24,12 +21,12 @@ export function getSerializedNodeId(node) {
24
21
  export function setSerializedNodeId(node, serializeNodeId) {
25
22
  serializedNodeIds.set(node, serializeNodeId);
26
23
  }
24
+
27
25
  /**
28
26
  * Get the element "value" to be serialized as an attribute or an input update record. It respects
29
27
  * the input privacy mode of the element.
30
28
  * PERFROMANCE OPTIMIZATION: Assumes that privacy level `HIDDEN` is never encountered because of earlier checks.
31
29
  */
32
-
33
30
  export function getElementInputValue(element, nodePrivacyLevel) {
34
31
  /*
35
32
  BROWSER SPEC NOTE: <input>, <select>
@@ -39,11 +36,9 @@ export function getElementInputValue(element, nodePrivacyLevel) {
39
36
  */
40
37
  var tagName = element.tagName;
41
38
  var value = element.value;
42
-
43
39
  if (shouldMaskNode(element, nodePrivacyLevel)) {
44
40
  var type = element.type;
45
-
46
- if (tagName === 'INPUT' && (type === 'button' || type === 'submit' || type === 'reset')) {
41
+ if (tagName === 'INPUT' && (type === 'button' || type === 'submit' || type === 'reset' || type === 'range')) {
47
42
  // Overrule `MASK` privacy level for button-like element values, as they are used during replay
48
43
  // to display their label. They can still be hidden via the "hidden" privacy attribute or class name.
49
44
  return value;
@@ -51,54 +46,97 @@ export function getElementInputValue(element, nodePrivacyLevel) {
51
46
  // <Option> value provides no benefit
52
47
  return;
53
48
  }
54
-
55
49
  return CENSORED_STRING_MARK;
56
50
  }
57
-
58
51
  if (tagName === 'OPTION' || tagName === 'SELECT') {
59
52
  return element.value;
60
53
  }
61
-
62
54
  if (tagName !== 'INPUT' && tagName !== 'TEXTAREA') {
63
55
  return;
64
56
  }
65
-
66
57
  return value;
67
58
  }
68
-
69
59
  function extractOrigin(url) {
70
60
  var origin = '';
71
-
72
61
  if (url.indexOf('//') > -1) {
73
62
  origin = url.split('/').slice(0, 3).join('/');
74
63
  } else {
75
64
  origin = url.split('/')[0];
76
65
  }
77
-
78
66
  origin = origin.split('?')[0];
79
67
  return origin;
80
68
  }
81
-
82
69
  export var URL_IN_CSS_REF = /url\((?:(')([^']*)'|(")([^"]*)"|([^)]*))\)/gm;
83
70
  export var ABSOLUTE_URL = /^[A-Za-z]+:|^\/\//;
84
71
  export var DATA_URI = /^data:.*,/i;
72
+ /**
73
+ * Browsers sometimes destructively modify the css rules they receive.
74
+ * This function tries to rectify the modifications the browser made to make it more cross platform compatible.
75
+ * @param cssText - output of `CSSStyleRule.cssText`
76
+ * @returns `cssText` with browser inconsistencies fixed.
77
+ */
78
+ export function fixBrowserCompatibilityIssuesInCSS(cssText) {
79
+ /**
80
+ * Chrome outputs `-webkit-background-clip` as `background-clip` in `CSSStyleRule.cssText`.
81
+ * But then Chrome ignores `background-clip` as css input.
82
+ * Re-introduce `-webkit-background-clip` to fix this issue.
83
+ */
84
+ if (cssText.includes(' background-clip: text;') && !cssText.includes(' -webkit-background-clip: text;')) {
85
+ cssText = cssText.replace(' background-clip: text;', ' -webkit-background-clip: text; background-clip: text;');
86
+ }
87
+ return cssText;
88
+ }
89
+ export function getHref() {
90
+ var a = document.createElement('a');
91
+ a.href = '';
92
+ return a.href;
93
+ }
85
94
  export function switchToAbsoluteUrl(cssText, cssHref) {
86
95
  return cssText.replace(URL_IN_CSS_REF, function (matchingSubstring, singleQuote, urlWrappedInSingleQuotes, doubleQuote, urlWrappedInDoubleQuotes, urlNotWrappedInQuotes) {
87
96
  var url = urlWrappedInSingleQuotes || urlWrappedInDoubleQuotes || urlNotWrappedInQuotes;
88
-
89
97
  if (!cssHref || !url || ABSOLUTE_URL.test(url) || DATA_URI.test(url)) {
90
98
  return matchingSubstring;
91
99
  }
92
-
93
100
  var quote = singleQuote || doubleQuote || '';
94
-
95
101
  if (url[0] === '/') {
96
102
  return 'url('.concat(quote).concat(extractOrigin(cssHref) + url).concat(quote, ')');
97
103
  }
98
-
99
104
  return "url(".concat(quote).concat(makeUrlAbsolute(url, cssHref)).concat(quote, ")");
100
105
  });
101
106
  }
107
+ export function getCssRulesString(cssStyleSheet) {
108
+ if (!cssStyleSheet) {
109
+ return null;
110
+ }
111
+ var rules;
112
+ try {
113
+ rules = cssStyleSheet.rules || cssStyleSheet.cssRules;
114
+ } catch (_unused) {
115
+ // if css is protected by CORS we cannot access cssRules see: https://www.w3.org/TR/cssom-1/#the-cssstylesheet-interface
116
+ }
117
+ if (!rules) {
118
+ return null;
119
+ }
120
+ var styleSheetCssText = fixBrowserCompatibilityIssuesInCSS(Array.from(rules, getCssRuleString).join(''));
121
+ return switchToAbsoluteUrl(styleSheetCssText, cssStyleSheet.href);
122
+ }
123
+ export function isCSSImportRule(rule) {
124
+ return 'styleSheet' in rule;
125
+ }
126
+ export function isSVGElement(el) {
127
+ return el.tagName === 'svg' || el instanceof SVGElement;
128
+ }
129
+ export function getCssRuleString(rule) {
130
+ var cssStringified = rule.cssText;
131
+ if (isCSSImportRule(rule)) {
132
+ try {
133
+ cssStringified = getCssRulesString(rule.styleSheet) || cssStringified;
134
+ } catch (_unused2) {
135
+ // ignore
136
+ }
137
+ }
138
+ return validateStringifiedCssRule(cssStringified);
139
+ }
102
140
  export function makeUrlAbsolute(url, baseUrl) {
103
141
  try {
104
142
  return buildUrl(url, baseUrl).href;
@@ -113,14 +151,12 @@ export function validateStringifiedCssRule(cssStringified) {
113
151
  var regex = /(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;
114
152
  return cssStringified.replace(regex, '$1\\$2');
115
153
  }
116
-
117
154
  return cssStringified;
118
155
  }
119
156
  export function serializeStyleSheets(cssStyleSheets) {
120
157
  if (cssStyleSheets === undefined || cssStyleSheets.length === 0) {
121
158
  return undefined;
122
159
  }
123
-
124
160
  return cssStyleSheets.map(function (cssStyleSheet) {
125
161
  var rules = cssStyleSheet.cssRules || cssStyleSheet.rules;
126
162
  var cssRules = Array.from(rules, function (cssRule) {
@@ -138,7 +174,6 @@ export function absoluteToDoc(doc, attributeValue) {
138
174
  if (!attributeValue || attributeValue.trim() === '') {
139
175
  return attributeValue;
140
176
  }
141
-
142
177
  var a = doc.createElement('a');
143
178
  a.href = attributeValue;
144
179
  return a.href;
@@ -149,33 +184,24 @@ export function getAbsoluteSrcsetString(doc, attributeValue) {
149
184
  if (attributeValue.trim() === '') {
150
185
  return attributeValue;
151
186
  }
152
-
153
187
  var pos = 0;
154
-
155
188
  function collectCharacters(regEx) {
156
189
  var chars;
157
190
  var match = regEx.exec(attributeValue.substring(pos));
158
-
159
191
  if (match) {
160
192
  chars = match[0];
161
193
  pos += chars.length;
162
194
  return chars;
163
195
  }
164
-
165
196
  return '';
166
197
  }
167
-
168
198
  var output = [];
169
-
170
199
  while (true) {
171
200
  collectCharacters(SRCSET_COMMAS_OR_SPACES);
172
-
173
201
  if (pos >= attributeValue.length) {
174
202
  break;
175
203
  }
176
-
177
204
  var url = collectCharacters(SRCSET_NOT_SPACES);
178
-
179
205
  if (url.slice(-1) === ',') {
180
206
  url = absoluteToDoc(doc, url.substring(0, url.length - 1));
181
207
  output.push(url);
@@ -183,10 +209,8 @@ export function getAbsoluteSrcsetString(doc, attributeValue) {
183
209
  var descriptorsStr = '';
184
210
  url = absoluteToDoc(doc, url);
185
211
  var inParens = false;
186
-
187
212
  while (true) {
188
213
  var c = attributeValue.charAt(pos);
189
-
190
214
  if (c === '') {
191
215
  output.push((url + descriptorsStr).trim());
192
216
  break;
@@ -203,12 +227,11 @@ export function getAbsoluteSrcsetString(doc, attributeValue) {
203
227
  inParens = false;
204
228
  }
205
229
  }
206
-
207
230
  descriptorsStr += c;
208
231
  pos += 1;
209
232
  }
210
233
  }
211
234
  }
212
-
213
235
  return output.join(', ');
214
- }
236
+ }
237
+ //# sourceMappingURL=serializationUtils.js.map