@cloudcare/browser-rum 3.3.23 → 3.3.24

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 (255) hide show
  1. package/bundle/dataflux-rum.js +1 -1
  2. package/cjs/boot/buildEnv.js +1 -1
  3. package/cjs/domain/deflate/deflateWorker.js +1 -1
  4. package/cjs/domain/replay/record/canvasEncodeWorker.js +1 -1
  5. package/esm/boot/buildEnv.js +2 -5
  6. package/esm/boot/buildEnv.js.map +1 -1
  7. package/esm/boot/disabledRumPublicApi.js +2 -35
  8. package/esm/boot/disabledRumPublicApi.js.map +1 -1
  9. package/esm/boot/perStartRum.js +2 -260
  10. package/esm/boot/perStartRum.js.map +1 -1
  11. package/esm/boot/recorderApi.js +2 -338
  12. package/esm/boot/recorderApi.js.map +1 -1
  13. package/esm/boot/recorderApiStub.js +2 -21
  14. package/esm/boot/recorderApiStub.js.map +1 -1
  15. package/esm/boot/rum.entry.js +2 -13
  16. package/esm/boot/rum.entry.js.map +1 -1
  17. package/esm/boot/rum.js +2 -184
  18. package/esm/boot/rum.js.map +1 -1
  19. package/esm/boot/rum.slim.entry.js +2 -7
  20. package/esm/boot/rum.slim.entry.js.map +1 -1
  21. package/esm/boot/rumEntryFactory.js +2 -18
  22. package/esm/boot/rumEntryFactory.js.map +1 -1
  23. package/esm/boot/rumPublicApi.js +2 -344
  24. package/esm/boot/rumPublicApi.js.map +1 -1
  25. package/esm/boot/rumRecorderApiStub.js +2 -13
  26. package/esm/boot/rumRecorderApiStub.js.map +1 -1
  27. package/esm/boot/rumSlimConfiguration.js +2 -10
  28. package/esm/boot/rumSlimConfiguration.js.map +1 -1
  29. package/esm/boot/sessionReplayPublicApi.js +2 -43
  30. package/esm/boot/sessionReplayPublicApi.js.map +1 -1
  31. package/esm/boot/startRecording.js +2 -444
  32. package/esm/boot/startRecording.js.map +1 -1
  33. package/esm/constants.js +2 -28
  34. package/esm/constants.js.map +1 -1
  35. package/esm/domain/assembly.js +2 -213
  36. package/esm/domain/assembly.js.map +1 -1
  37. package/esm/domain/configuration.js +2 -323
  38. package/esm/domain/configuration.js.map +1 -1
  39. package/esm/domain/contexts/commonContext.js +2 -8
  40. package/esm/domain/contexts/commonContext.js.map +1 -1
  41. package/esm/domain/contexts/displayContext.js +2 -16
  42. package/esm/domain/contexts/displayContext.js.map +1 -1
  43. package/esm/domain/contexts/foregroundContexts.js +2 -103
  44. package/esm/domain/contexts/foregroundContexts.js.map +1 -1
  45. package/esm/domain/contexts/internalContext.js +2 -41
  46. package/esm/domain/contexts/internalContext.js.map +1 -1
  47. package/esm/domain/contexts/pageStateHistory.js +2 -104
  48. package/esm/domain/contexts/pageStateHistory.js.map +1 -1
  49. package/esm/domain/contexts/urlContexts.js +2 -85
  50. package/esm/domain/contexts/urlContexts.js.map +1 -1
  51. package/esm/domain/contexts/viewContexts.js +2 -45
  52. package/esm/domain/contexts/viewContexts.js.map +1 -1
  53. package/esm/domain/deflate/deflateEncoder.js +2 -592
  54. package/esm/domain/deflate/deflateEncoder.js.map +1 -1
  55. package/esm/domain/deflate/deflateWorker.js +2 -225
  56. package/esm/domain/deflate/deflateWorker.js.map +1 -1
  57. package/esm/domain/deflate/index.js +2 -3
  58. package/esm/domain/deflate/index.js.map +1 -1
  59. package/esm/domain/domMutationObservable.js +2 -62
  60. package/esm/domain/domMutationObservable.js.map +1 -1
  61. package/esm/domain/encoderStreamId.js +2 -6
  62. package/esm/domain/encoderStreamId.js.map +1 -1
  63. package/esm/domain/firstInputPolyfill.js +2 -77
  64. package/esm/domain/firstInputPolyfill.js.map +1 -1
  65. package/esm/domain/initViewportObservable.js +2 -36
  66. package/esm/domain/initViewportObservable.js.map +1 -1
  67. package/esm/domain/locationChangeObservable.js +2 -65
  68. package/esm/domain/locationChangeObservable.js.map +1 -1
  69. package/esm/domain/performanceObservable.js +2 -116
  70. package/esm/domain/performanceObservable.js.map +1 -1
  71. package/esm/domain/performanceUtils.js +2 -45
  72. package/esm/domain/performanceUtils.js.map +1 -1
  73. package/esm/domain/plugins.js +2 -59
  74. package/esm/domain/plugins.js.map +1 -1
  75. package/esm/domain/privacy.js +2 -266
  76. package/esm/domain/privacy.js.map +1 -1
  77. package/esm/domain/replay/record/canvasAutoSnapshot.js +2 -9
  78. package/esm/domain/replay/record/canvasAutoSnapshot.js.map +1 -1
  79. package/esm/domain/replay/record/canvasCommandCapture.js +2 -1275
  80. package/esm/domain/replay/record/canvasCommandCapture.js.map +1 -1
  81. package/esm/domain/replay/record/canvasCommandObserver.js +2 -1207
  82. package/esm/domain/replay/record/canvasCommandObserver.js.map +1 -1
  83. package/esm/domain/replay/record/canvasCommandSerializeArgs.js +2 -111
  84. package/esm/domain/replay/record/canvasCommandSerializeArgs.js.map +1 -1
  85. package/esm/domain/replay/record/canvasContext.js +2 -50
  86. package/esm/domain/replay/record/canvasContext.js.map +1 -1
  87. package/esm/domain/replay/record/canvasContinuousScheduler.js +2 -378
  88. package/esm/domain/replay/record/canvasContinuousScheduler.js.map +1 -1
  89. package/esm/domain/replay/record/canvasEncodeBridge.js +2 -692
  90. package/esm/domain/replay/record/canvasEncodeBridge.js.map +1 -1
  91. package/esm/domain/replay/record/canvasEncodeWorker.js +2 -164
  92. package/esm/domain/replay/record/canvasEncodeWorker.js.map +1 -1
  93. package/esm/domain/replay/record/canvasFrameSignature.js +2 -75
  94. package/esm/domain/replay/record/canvasFrameSignature.js.map +1 -1
  95. package/esm/domain/replay/record/canvasMutationRecord.js +2 -26
  96. package/esm/domain/replay/record/canvasMutationRecord.js.map +1 -1
  97. package/esm/domain/replay/record/canvasObserver.js +2 -420
  98. package/esm/domain/replay/record/canvasObserver.js.map +1 -1
  99. package/esm/domain/replay/record/canvasSerializeArgs.js +2 -101
  100. package/esm/domain/replay/record/canvasSerializeArgs.js.map +1 -1
  101. package/esm/domain/replay/record/canvasWebGLPluginHost.js +2 -26
  102. package/esm/domain/replay/record/canvasWebGLPluginHost.js.map +1 -1
  103. package/esm/domain/replay/record/elementsScrollPositions.js +2 -23
  104. package/esm/domain/replay/record/elementsScrollPositions.js.map +1 -1
  105. package/esm/domain/replay/record/index.js +2 -4
  106. package/esm/domain/replay/record/index.js.map +1 -1
  107. package/esm/domain/replay/record/mutationBatch.js +2 -562
  108. package/esm/domain/replay/record/mutationBatch.js.map +1 -1
  109. package/esm/domain/replay/record/mutationObserver.js +2 -2332
  110. package/esm/domain/replay/record/mutationObserver.js.map +1 -1
  111. package/esm/domain/replay/record/mutationResourceBudget.js +2 -137
  112. package/esm/domain/replay/record/mutationResourceBudget.js.map +1 -1
  113. package/esm/domain/replay/record/observers.js +2 -624
  114. package/esm/domain/replay/record/observers.js.map +1 -1
  115. package/esm/domain/replay/record/privacy.js +2 -1
  116. package/esm/domain/replay/record/privacy.js.map +1 -1
  117. package/esm/domain/replay/record/record.js +2 -3511
  118. package/esm/domain/replay/record/record.js.map +1 -1
  119. package/esm/domain/replay/record/serializationUtils.js +2 -677
  120. package/esm/domain/replay/record/serializationUtils.js.map +1 -1
  121. package/esm/domain/replay/record/serialize.js +2 -735
  122. package/esm/domain/replay/record/serialize.js.map +1 -1
  123. package/esm/domain/replay/record/shadowRootsController.js +2 -902
  124. package/esm/domain/replay/record/shadowRootsController.js.map +1 -1
  125. package/esm/domain/replay/record/utils.js +2 -36
  126. package/esm/domain/replay/record/utils.js.map +1 -1
  127. package/esm/domain/replay/record/viewports.js +2 -58
  128. package/esm/domain/replay/record/viewports.js.map +1 -1
  129. package/esm/domain/replay/replayStats.js +2 -59
  130. package/esm/domain/replay/replayStats.js.map +1 -1
  131. package/esm/domain/replay/segmentCollection/buildReplayPayload.js +2 -31
  132. package/esm/domain/replay/segmentCollection/buildReplayPayload.js.map +1 -1
  133. package/esm/domain/replay/segmentCollection/index.js +2 -3
  134. package/esm/domain/replay/segmentCollection/index.js.map +1 -1
  135. package/esm/domain/replay/segmentCollection/segment.js +2 -415
  136. package/esm/domain/replay/segmentCollection/segment.js.map +1 -1
  137. package/esm/domain/replay/segmentCollection/segmentCollection.js +2 -1114
  138. package/esm/domain/replay/segmentCollection/segmentCollection.js.map +1 -1
  139. package/esm/domain/replay/startRecordBridge.js +2 -13
  140. package/esm/domain/replay/startRecordBridge.js.map +1 -1
  141. package/esm/domain/replay/timeAnchor.js +2 -20
  142. package/esm/domain/replay/timeAnchor.js.map +1 -1
  143. package/esm/domain/requestCollection.js +2 -121
  144. package/esm/domain/requestCollection.js.map +1 -1
  145. package/esm/domain/rumEventsCollection/actions/actionCollection.js +2 -83
  146. package/esm/domain/rumEventsCollection/actions/actionCollection.js.map +1 -1
  147. package/esm/domain/rumEventsCollection/actions/clickChain.js +2 -62
  148. package/esm/domain/rumEventsCollection/actions/clickChain.js.map +1 -1
  149. package/esm/domain/rumEventsCollection/actions/computeFrustration.js +2 -67
  150. package/esm/domain/rumEventsCollection/actions/computeFrustration.js.map +1 -1
  151. package/esm/domain/rumEventsCollection/actions/getActionNameFromElement.js +2 -279
  152. package/esm/domain/rumEventsCollection/actions/getActionNameFromElement.js.map +1 -1
  153. package/esm/domain/rumEventsCollection/actions/getSelectorsFromElement.js +2 -233
  154. package/esm/domain/rumEventsCollection/actions/getSelectorsFromElement.js.map +1 -1
  155. package/esm/domain/rumEventsCollection/actions/interactionSelectorCache.js +2 -21
  156. package/esm/domain/rumEventsCollection/actions/interactionSelectorCache.js.map +1 -1
  157. package/esm/domain/rumEventsCollection/actions/listenActionEvents.js +2 -67
  158. package/esm/domain/rumEventsCollection/actions/listenActionEvents.js.map +1 -1
  159. package/esm/domain/rumEventsCollection/actions/trackClickActions.js +2 -263
  160. package/esm/domain/rumEventsCollection/actions/trackClickActions.js.map +1 -1
  161. package/esm/domain/rumEventsCollection/error/errorCollection.js +2 -93
  162. package/esm/domain/rumEventsCollection/error/errorCollection.js.map +1 -1
  163. package/esm/domain/rumEventsCollection/error/trackConsoleError.js +2 -12
  164. package/esm/domain/rumEventsCollection/error/trackConsoleError.js.map +1 -1
  165. package/esm/domain/rumEventsCollection/error/trackReportError.js +2 -19
  166. package/esm/domain/rumEventsCollection/error/trackReportError.js.map +1 -1
  167. package/esm/domain/rumEventsCollection/longTask/longAnimationFrameCollection.js +2 -55
  168. package/esm/domain/rumEventsCollection/longTask/longAnimationFrameCollection.js.map +1 -1
  169. package/esm/domain/rumEventsCollection/longTask/longTaskCollection.js +2 -38
  170. package/esm/domain/rumEventsCollection/longTask/longTaskCollection.js.map +1 -1
  171. package/esm/domain/rumEventsCollection/resource/matchRequestResourceEntry.js +2 -69
  172. package/esm/domain/rumEventsCollection/resource/matchRequestResourceEntry.js.map +1 -1
  173. package/esm/domain/rumEventsCollection/resource/resourceCollection.js +2 -294
  174. package/esm/domain/rumEventsCollection/resource/resourceCollection.js.map +1 -1
  175. package/esm/domain/rumEventsCollection/resource/resourceTrackerManager.js +2 -232
  176. package/esm/domain/rumEventsCollection/resource/resourceTrackerManager.js.map +1 -1
  177. package/esm/domain/rumEventsCollection/resource/resourceUtils.js +2 -218
  178. package/esm/domain/rumEventsCollection/resource/resourceUtils.js.map +1 -1
  179. package/esm/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js +2 -19
  180. package/esm/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js.map +1 -1
  181. package/esm/domain/rumEventsCollection/resource/webSocketCollection.js +2 -191
  182. package/esm/domain/rumEventsCollection/resource/webSocketCollection.js.map +1 -1
  183. package/esm/domain/rumEventsCollection/view/interactionCountPolyfill.js +2 -47
  184. package/esm/domain/rumEventsCollection/view/interactionCountPolyfill.js.map +1 -1
  185. package/esm/domain/rumEventsCollection/view/trackCommonViewMetrics.js +2 -42
  186. package/esm/domain/rumEventsCollection/view/trackCommonViewMetrics.js.map +1 -1
  187. package/esm/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js +2 -117
  188. package/esm/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js.map +1 -1
  189. package/esm/domain/rumEventsCollection/view/trackFirstContentfulPaint.js +2 -20
  190. package/esm/domain/rumEventsCollection/view/trackFirstContentfulPaint.js.map +1 -1
  191. package/esm/domain/rumEventsCollection/view/trackFirstHidden.js +2 -49
  192. package/esm/domain/rumEventsCollection/view/trackFirstHidden.js.map +1 -1
  193. package/esm/domain/rumEventsCollection/view/trackFirstInput.js +2 -41
  194. package/esm/domain/rumEventsCollection/view/trackFirstInput.js.map +1 -1
  195. package/esm/domain/rumEventsCollection/view/trackInitialViewTimings.js +2 -44
  196. package/esm/domain/rumEventsCollection/view/trackInitialViewTimings.js.map +1 -1
  197. package/esm/domain/rumEventsCollection/view/trackInteractionToNextPaint.js +2 -153
  198. package/esm/domain/rumEventsCollection/view/trackInteractionToNextPaint.js.map +1 -1
  199. package/esm/domain/rumEventsCollection/view/trackLargestContentfulPaint.js +2 -54
  200. package/esm/domain/rumEventsCollection/view/trackLargestContentfulPaint.js.map +1 -1
  201. package/esm/domain/rumEventsCollection/view/trackLoadingTime.js +2 -50
  202. package/esm/domain/rumEventsCollection/view/trackLoadingTime.js.map +1 -1
  203. package/esm/domain/rumEventsCollection/view/trackNavigationTimings.js +2 -73
  204. package/esm/domain/rumEventsCollection/view/trackNavigationTimings.js.map +1 -1
  205. package/esm/domain/rumEventsCollection/view/trackScrollMetrics.js +2 -84
  206. package/esm/domain/rumEventsCollection/view/trackScrollMetrics.js.map +1 -1
  207. package/esm/domain/rumEventsCollection/view/trackSoftNavigationMetrics.js +2 -38
  208. package/esm/domain/rumEventsCollection/view/trackSoftNavigationMetrics.js.map +1 -1
  209. package/esm/domain/rumEventsCollection/view/trackViewEventCounts.js +2 -15
  210. package/esm/domain/rumEventsCollection/view/trackViewEventCounts.js.map +1 -1
  211. package/esm/domain/rumEventsCollection/view/trackViews.js +2 -418
  212. package/esm/domain/rumEventsCollection/view/trackViews.js.map +1 -1
  213. package/esm/domain/rumEventsCollection/view/viewCollection.js +2 -127
  214. package/esm/domain/rumEventsCollection/view/viewCollection.js.map +1 -1
  215. package/esm/domain/rumSessionManager.js +2 -208
  216. package/esm/domain/rumSessionManager.js.map +1 -1
  217. package/esm/domain/tracing/ddtraceTracer.js +2 -40
  218. package/esm/domain/tracing/ddtraceTracer.js.map +1 -1
  219. package/esm/domain/tracing/getDocumentTraceId.js +2 -69
  220. package/esm/domain/tracing/getDocumentTraceId.js.map +1 -1
  221. package/esm/domain/tracing/jaegerTracer.js +2 -42
  222. package/esm/domain/tracing/jaegerTracer.js.map +1 -1
  223. package/esm/domain/tracing/sampler.js +2 -61
  224. package/esm/domain/tracing/sampler.js.map +1 -1
  225. package/esm/domain/tracing/skywalkingTracer.js +2 -90
  226. package/esm/domain/tracing/skywalkingTracer.js.map +1 -1
  227. package/esm/domain/tracing/traceIdentifier.js +2 -57
  228. package/esm/domain/tracing/traceIdentifier.js.map +1 -1
  229. package/esm/domain/tracing/tracer.js +2 -128
  230. package/esm/domain/tracing/tracer.js.map +1 -1
  231. package/esm/domain/tracing/w3cTraceParentTracer.js +2 -69
  232. package/esm/domain/tracing/w3cTraceParentTracer.js.map +1 -1
  233. package/esm/domain/tracing/zipkinMultiTracer.js +2 -42
  234. package/esm/domain/tracing/zipkinMultiTracer.js.map +1 -1
  235. package/esm/domain/tracing/zipkinSingleTracer.js +2 -41
  236. package/esm/domain/tracing/zipkinSingleTracer.js.map +1 -1
  237. package/esm/domain/trackEventCounts.js +2 -49
  238. package/esm/domain/trackEventCounts.js.map +1 -1
  239. package/esm/domain/usr/index.js +2 -38
  240. package/esm/domain/usr/index.js.map +1 -1
  241. package/esm/domain/visitorId/index.js +2 -406
  242. package/esm/domain/visitorId/index.js.map +1 -1
  243. package/esm/domain/waitPageActivityEnd.js +2 -142
  244. package/esm/domain/waitPageActivityEnd.js.map +1 -1
  245. package/esm/index.js +2 -4
  246. package/esm/index.js.map +1 -1
  247. package/esm/transport/startRumBatch.js +2 -74
  248. package/esm/transport/startRumBatch.js.map +1 -1
  249. package/esm/transport/startRumEventBridge.js +2 -9
  250. package/esm/transport/startRumEventBridge.js.map +1 -1
  251. package/esm/types/index.js +2 -1
  252. package/esm/types/index.js.map +1 -1
  253. package/esm/types/sessionReplayConstants.js +2 -46
  254. package/esm/types/sessionReplayConstants.js.map +1 -1
  255. package/package.json +5 -5
@@ -1,213 +1,2 @@
1
- import { extend2Lev, withSnakeCaseKeys, timeStampNow, isEmptyObject, LifeCycleEventType, RumEventType, createBoundedBuffer, getDeviceInfoWithHighEntropyValues, currentDrift, createEventRateLimiter, limitModification, getSyntheticsTestId, getSyntheticsResultId, display, assign, round, WeakSet } from '@cloudcare/browser-core';
2
- var SessionType = {
3
- SYNTHETICS: 'synthetics',
4
- USER: 'user'
5
- };
6
- var VIEW_MODIFIABLE_FIELD_PATHS = {
7
- 'view.url': 'string',
8
- 'view.referrer': 'string'
9
- };
10
- var USER_CUSTOMIZABLE_FIELD_PATHS = {
11
- context: 'object'
12
- };
13
- var ROOT_MODIFIABLE_FIELD_PATHS = {
14
- service: 'string',
15
- version: 'string'
16
- };
17
- var modifiableFieldPathsByEvent = {};
18
- export function startRumAssembly(configuration, lifeCycle, sessionManager, userSessionManager, viewContexts, urlContexts, actionContexts, displayContext, getCommonContext, reportError) {
19
- var getDeviceInfoImp = arguments.length > 10 && arguments[10] !== undefined ? arguments[10] : getDeviceInfoWithHighEntropyValues;
20
- modifiableFieldPathsByEvent[RumEventType.VIEW] = assign({}, USER_CUSTOMIZABLE_FIELD_PATHS, VIEW_MODIFIABLE_FIELD_PATHS);
21
- modifiableFieldPathsByEvent[RumEventType.ERROR] = assign({
22
- 'error.message': 'string',
23
- 'error.stack': 'string',
24
- 'error.resource.url': 'string'
25
- }, USER_CUSTOMIZABLE_FIELD_PATHS, VIEW_MODIFIABLE_FIELD_PATHS, ROOT_MODIFIABLE_FIELD_PATHS);
26
- modifiableFieldPathsByEvent[RumEventType.RESOURCE] = assign({
27
- 'resource.url': 'string'
28
- }, USER_CUSTOMIZABLE_FIELD_PATHS, VIEW_MODIFIABLE_FIELD_PATHS, ROOT_MODIFIABLE_FIELD_PATHS);
29
- modifiableFieldPathsByEvent[RumEventType.ACTION] = assign({
30
- 'action.target.name': 'string'
31
- }, USER_CUSTOMIZABLE_FIELD_PATHS, VIEW_MODIFIABLE_FIELD_PATHS, ROOT_MODIFIABLE_FIELD_PATHS);
32
- modifiableFieldPathsByEvent[RumEventType.LONG_TASK] = assign({}, USER_CUSTOMIZABLE_FIELD_PATHS, VIEW_MODIFIABLE_FIELD_PATHS);
33
- var eventRateLimiters = {};
34
- eventRateLimiters[RumEventType.ERROR] = createEventRateLimiter(RumEventType.ERROR, configuration.eventRateLimiterThreshold, reportError);
35
- eventRateLimiters[RumEventType.ACTION] = createEventRateLimiter(RumEventType.ACTION, configuration.eventRateLimiterThreshold, reportError);
36
- var pendingRawEvents = createBoundedBuffer();
37
- // Context objects belong to the existing View history. Weak references do
38
- // not retain ended Views or require a second history of every collected ID.
39
- var collectedViews = new WeakSet();
40
- var resolvedDeviceInfo;
41
- getDeviceInfoImp(function (deviceInfo) {
42
- resolvedDeviceInfo = deviceInfo;
43
- pendingRawEvents.drain();
44
- });
45
- lifeCycle.subscribe(LifeCycleEventType.RAW_RUM_EVENT_COLLECTED, function assemble(data) {
46
- if (!resolvedDeviceInfo) {
47
- pendingRawEvents.add(function () {
48
- assemble(data);
49
- });
50
- return;
51
- }
52
- var startTime = data.startTime;
53
- var rawRumEvent = data.rawRumEvent;
54
- var savedCommonContext = data.savedCommonContext;
55
- var customerContext = data.customerContext;
56
- var domainContext = data.domainContext;
57
- var viewContext = viewContexts.findView(startTime);
58
- var urlContext = urlContexts.findUrl(startTime);
59
- var session = sessionManager.findTrackedSession(startTime);
60
- if (session && session.isErrorSession && !session.sessionHasError) return;
61
- if (session && viewContext && urlContext) {
62
- var actionId = actionContexts.findActionId(startTime);
63
- var actionIds = actionContexts.findAllActionId(startTime);
64
- var commonContext = savedCommonContext || getCommonContext();
65
- var synthetics = getSyntheticsContext();
66
- var rumContext = {
67
- _gc: {
68
- sdkName: configuration.sdkName,
69
- sdkVersion: configuration.sdkVersion,
70
- drift: currentDrift(),
71
- configuration: {
72
- session_sample_rate: round(configuration.sessionSampleRate, 3),
73
- session_replay_sample_rate: round(configuration.sessionReplaySampleRate, 3),
74
- session_on_error_sample_rate: round(configuration.sessionOnErrorSampleRate, 3),
75
- session_replay_on_error_sample_rate: round(configuration.sessionReplayOnErrorSampleRate, 3)
76
- }
77
- },
78
- terminal: {
79
- type: 'web'
80
- },
81
- application: {
82
- id: configuration.applicationId
83
- },
84
- device: resolvedDeviceInfo,
85
- env: configuration.env || '',
86
- service: viewContext.service || configuration.service || 'browser',
87
- version: viewContext.version || configuration.version || '',
88
- source: 'browser',
89
- date: timeStampNow(),
90
- user: {
91
- id: userSessionManager.getId(),
92
- is_signin: 'F',
93
- is_login: false
94
- },
95
- session: {
96
- // must be computed on each event because synthetics instrumentation can be done after sdk execution
97
- // cf https://github.com/puppeteer/puppeteer/issues/3667
98
- type: getSessionType(synthetics),
99
- id: session.id,
100
- is_forced_session: session.isSessionForced
101
- },
102
- view: {
103
- id: viewContext.id,
104
- name: viewContext.name || urlContext.path,
105
- url: urlContext.url,
106
- referrer: urlContext.referrer,
107
- host: urlContext.host,
108
- path: urlContext.path,
109
- pathGroup: urlContext.pathGroup,
110
- pathname: urlContext.pathname,
111
- urlQuery: urlContext.urlQuery
112
- },
113
- action: needToAssembleWithAction(rawRumEvent) && actionId ? {
114
- id: actionId,
115
- ids: actionIds
116
- } : undefined,
117
- display: displayContext.get()
118
- };
119
- if (synthetics) {
120
- rumContext.synthetics = synthetics;
121
- }
122
- var rumEvent = extend2Lev(rumContext, viewContext, rawRumEvent);
123
- var serverRumEvent = withSnakeCaseKeys(rumEvent);
124
- var context = extend2Lev({}, commonContext.context, viewContext.context, customerContext, rawRumEvent.context);
125
- if (configuration.visitorId && configuration.visitorId.enabled) {
126
- var visitorId = rawRumEvent.type === RumEventType.RESOURCE && rawRumEvent.context && rawRumEvent.context.visitor_id || commonContext.visitorId || savedCommonContext && getCommonContext().visitorId;
127
- if (visitorId) {
128
- context.visitor_id = visitorId;
129
- }
130
- }
131
- if (!isEmptyObject(context)) {
132
- serverRumEvent.context = context;
133
- }
134
- if (!('has_replay' in serverRumEvent.session)) {
135
- serverRumEvent.session.has_replay = commonContext.hasReplay;
136
- }
137
- if (session.errorSessionReplayAllowed) {
138
- serverRumEvent.session.has_replay = serverRumEvent.session.has_replay && session.sessionHasError;
139
- }
140
- if (serverRumEvent.type === 'view') {
141
- serverRumEvent.session.sampled_for_error_replay = session.errorSessionReplayAllowed;
142
- serverRumEvent.session.sampled_for_error_session = session.isErrorSession;
143
- serverRumEvent.session.error_timestamp_for_session = session.sessionErrorTimestamp;
144
- }
145
- if (!isEmptyObject(commonContext.user)) {
146
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
147
- serverRumEvent.user = extend2Lev({
148
- // id: session.getAnonymousID(),
149
- is_signin: 'T',
150
- is_login: true
151
- }, commonContext.user);
152
- }
153
- if (shouldSend(serverRumEvent, configuration.beforeSend, domainContext, eventRateLimiters)) {
154
- if (isEmptyObject(serverRumEvent.context)) {
155
- delete serverRumEvent.context;
156
- }
157
- lifeCycle.notify(LifeCycleEventType.RUM_EVENT_COLLECTED, serverRumEvent);
158
- if (serverRumEvent.type === RumEventType.VIEW) {
159
- if (!collectedViews.has(viewContext)) {
160
- collectedViews.add(viewContext);
161
- lifeCycle.notify(LifeCycleEventType.RUM_VIEW_FIRST_COLLECTED, serverRumEvent);
162
- } else if (data.isForcedSessionUpdate) {
163
- // A sampled View may already have been sent before the user was
164
- // identified. Deliver this activation update without flushing
165
- // unrelated events or waiting for the regular batch deadline.
166
- lifeCycle.notify(LifeCycleEventType.RUM_VIEW_FORCED_COLLECTED, serverRumEvent);
167
- }
168
- }
169
- }
170
- }
171
- });
172
- }
173
- function shouldSend(event, beforeSend, domainContext, eventRateLimiters) {
174
- if (beforeSend) {
175
- var result = limitModification(event, modifiableFieldPathsByEvent[event.type], function (event) {
176
- return beforeSend(event, domainContext);
177
- });
178
- if (result === false && event.type !== RumEventType.VIEW) {
179
- return false;
180
- }
181
- if (result === false) {
182
- display.warn("Can't dismiss view events using beforeSend!");
183
- }
184
- }
185
- var rateLimitReached = false;
186
- if (eventRateLimiters[event.type]) {
187
- rateLimitReached = eventRateLimiters[event.type].isLimitReached();
188
- }
189
- return !rateLimitReached;
190
- }
191
- function needToAssembleWithAction(event) {
192
- return [RumEventType.ERROR, RumEventType.RESOURCE, RumEventType.LONG_TASK].indexOf(event.type) !== -1;
193
- }
194
- function getSyntheticsContext() {
195
- // Read on every event: browser tests can inject or replace IDs after init.
196
- var testId = getSyntheticsTestId();
197
- var resultId = getSyntheticsResultId();
198
- if (!testId && !resultId) {
199
- return undefined;
200
- }
201
- var context = {};
202
- if (testId) {
203
- context.test_id = testId;
204
- }
205
- if (resultId) {
206
- context.result_id = resultId;
207
- }
208
- return context;
209
- }
210
- function getSessionType(synthetics) {
211
- return !synthetics && window._DATAFLUX_SYNTHETICS_BROWSER === undefined ? SessionType.USER : SessionType.SYNTHETICS;
212
- }
213
- //# sourceMappingURL=assembly.js.map
1
+ import{extend2Lev,withSnakeCaseKeys,timeStampNow,isEmptyObject,LifeCycleEventType,RumEventType,createBoundedBuffer,getDeviceInfoWithHighEntropyValues,currentDrift,createEventRateLimiter,limitModification,getSyntheticsTestId,getSyntheticsResultId,display,assign,round,WeakSet}from"@cloudcare/browser-core";var SessionType_SYNTHETICS="synthetics",SessionType_USER="user",VIEW_MODIFIABLE_FIELD_PATHS={"view.url":"string","view.referrer":"string"},USER_CUSTOMIZABLE_FIELD_PATHS={context:"object"},ROOT_MODIFIABLE_FIELD_PATHS={service:"string",version:"string"},modifiableFieldPathsByEvent={};export function startRumAssembly(configuration,lifeCycle,sessionManager,userSessionManager,viewContexts,urlContexts,actionContexts,displayContext,getCommonContext,reportError){var getDeviceInfoImp=arguments.length>10&&void 0!==arguments[10]?arguments[10]:getDeviceInfoWithHighEntropyValues;modifiableFieldPathsByEvent[RumEventType.VIEW]=assign({},USER_CUSTOMIZABLE_FIELD_PATHS,VIEW_MODIFIABLE_FIELD_PATHS),modifiableFieldPathsByEvent[RumEventType.ERROR]=assign({"error.message":"string","error.stack":"string","error.resource.url":"string"},USER_CUSTOMIZABLE_FIELD_PATHS,VIEW_MODIFIABLE_FIELD_PATHS,ROOT_MODIFIABLE_FIELD_PATHS),modifiableFieldPathsByEvent[RumEventType.RESOURCE]=assign({"resource.url":"string"},USER_CUSTOMIZABLE_FIELD_PATHS,VIEW_MODIFIABLE_FIELD_PATHS,ROOT_MODIFIABLE_FIELD_PATHS),modifiableFieldPathsByEvent[RumEventType.ACTION]=assign({"action.target.name":"string"},USER_CUSTOMIZABLE_FIELD_PATHS,VIEW_MODIFIABLE_FIELD_PATHS,ROOT_MODIFIABLE_FIELD_PATHS),modifiableFieldPathsByEvent[RumEventType.LONG_TASK]=assign({},USER_CUSTOMIZABLE_FIELD_PATHS,VIEW_MODIFIABLE_FIELD_PATHS);var eventRateLimiters={};eventRateLimiters[RumEventType.ERROR]=createEventRateLimiter(RumEventType.ERROR,configuration.eventRateLimiterThreshold,reportError),eventRateLimiters[RumEventType.ACTION]=createEventRateLimiter(RumEventType.ACTION,configuration.eventRateLimiterThreshold,reportError);var resolvedDeviceInfo,pendingRawEvents=createBoundedBuffer(),collectedViews=new WeakSet;getDeviceInfoImp((function(deviceInfo){resolvedDeviceInfo=deviceInfo,pendingRawEvents.drain()})),lifeCycle.subscribe(LifeCycleEventType.RAW_RUM_EVENT_COLLECTED,(function assemble(data){if(resolvedDeviceInfo){var startTime=data.startTime,rawRumEvent=data.rawRumEvent,savedCommonContext=data.savedCommonContext,customerContext=data.customerContext,domainContext=data.domainContext,viewContext=viewContexts.findView(startTime),urlContext=urlContexts.findUrl(startTime),session=sessionManager.findTrackedSession(startTime);if((!session||!session.isErrorSession||session.sessionHasError)&&session&&viewContext&&urlContext){var actionId=actionContexts.findActionId(startTime),actionIds=actionContexts.findAllActionId(startTime),commonContext=savedCommonContext||getCommonContext(),synthetics=function getSyntheticsContext(){var testId=getSyntheticsTestId(),resultId=getSyntheticsResultId();if(!testId&&!resultId)return;var context={};testId&&(context.test_id=testId);resultId&&(context.result_id=resultId);return context}(),rumContext={_gc:{sdkName:configuration.sdkName,sdkVersion:configuration.sdkVersion,drift:currentDrift(),configuration:{session_sample_rate:round(configuration.sessionSampleRate,3),session_replay_sample_rate:round(configuration.sessionReplaySampleRate,3),session_on_error_sample_rate:round(configuration.sessionOnErrorSampleRate,3),session_replay_on_error_sample_rate:round(configuration.sessionReplayOnErrorSampleRate,3)}},terminal:{type:"web"},application:{id:configuration.applicationId},device:resolvedDeviceInfo,env:configuration.env||"",service:viewContext.service||configuration.service||"browser",version:viewContext.version||configuration.version||"",source:"browser",date:timeStampNow(),user:{id:userSessionManager.getId(),is_signin:"F",is_login:!1},session:{type:getSessionType(synthetics),id:session.id,is_forced_session:session.isSessionForced},view:{id:viewContext.id,name:viewContext.name||urlContext.path,url:urlContext.url,referrer:urlContext.referrer,host:urlContext.host,path:urlContext.path,pathGroup:urlContext.pathGroup,pathname:urlContext.pathname,urlQuery:urlContext.urlQuery},action:needToAssembleWithAction(rawRumEvent)&&actionId?{id:actionId,ids:actionIds}:void 0,display:displayContext.get()};synthetics&&(rumContext.synthetics=synthetics);var rumEvent=extend2Lev(rumContext,viewContext,rawRumEvent),serverRumEvent=withSnakeCaseKeys(rumEvent),context=extend2Lev({},commonContext.context,viewContext.context,customerContext,rawRumEvent.context);if(configuration.visitorId&&configuration.visitorId.enabled){var visitorId=rawRumEvent.type===RumEventType.RESOURCE&&rawRumEvent.context&&rawRumEvent.context.visitor_id||commonContext.visitorId||savedCommonContext&&getCommonContext().visitorId;visitorId&&(context.visitor_id=visitorId)}isEmptyObject(context)||(serverRumEvent.context=context),"has_replay"in serverRumEvent.session||(serverRumEvent.session.has_replay=commonContext.hasReplay),session.errorSessionReplayAllowed&&(serverRumEvent.session.has_replay=serverRumEvent.session.has_replay&&session.sessionHasError),"view"===serverRumEvent.type&&(serverRumEvent.session.sampled_for_error_replay=session.errorSessionReplayAllowed,serverRumEvent.session.sampled_for_error_session=session.isErrorSession,serverRumEvent.session.error_timestamp_for_session=session.sessionErrorTimestamp),isEmptyObject(commonContext.user)||(serverRumEvent.user=extend2Lev({is_signin:"T",is_login:!0},commonContext.user)),function shouldSend(event,beforeSend,domainContext,eventRateLimiters){if(beforeSend){var result=limitModification(event,modifiableFieldPathsByEvent[event.type],(function(event){return beforeSend(event,domainContext)}));if(!1===result&&event.type!==RumEventType.VIEW)return!1;!1===result&&display.warn("Can't dismiss view events using beforeSend!")}var rateLimitReached=!1;eventRateLimiters[event.type]&&(rateLimitReached=eventRateLimiters[event.type].isLimitReached());return!rateLimitReached}(serverRumEvent,configuration.beforeSend,domainContext,eventRateLimiters)&&(isEmptyObject(serverRumEvent.context)&&delete serverRumEvent.context,lifeCycle.notify(LifeCycleEventType.RUM_EVENT_COLLECTED,serverRumEvent),serverRumEvent.type===RumEventType.VIEW&&(collectedViews.has(viewContext)?data.isForcedSessionUpdate&&lifeCycle.notify(LifeCycleEventType.RUM_VIEW_FORCED_COLLECTED,serverRumEvent):(collectedViews.add(viewContext),lifeCycle.notify(LifeCycleEventType.RUM_VIEW_FIRST_COLLECTED,serverRumEvent))))}}else pendingRawEvents.add((function(){assemble(data)}))}))}function needToAssembleWithAction(event){return-1!==[RumEventType.ERROR,RumEventType.RESOURCE,RumEventType.LONG_TASK].indexOf(event.type)}function getSessionType(synthetics){return synthetics||void 0!==window._DATAFLUX_SYNTHETICS_BROWSER?SessionType_SYNTHETICS:SessionType_USER}
2
+ //# sourceMappingURL=assembly.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"assembly.js","names":["extend2Lev","withSnakeCaseKeys","timeStampNow","isEmptyObject","LifeCycleEventType","RumEventType","createBoundedBuffer","getDeviceInfoWithHighEntropyValues","currentDrift","createEventRateLimiter","limitModification","getSyntheticsTestId","getSyntheticsResultId","display","assign","round","WeakSet","SessionType","SYNTHETICS","USER","VIEW_MODIFIABLE_FIELD_PATHS","USER_CUSTOMIZABLE_FIELD_PATHS","context","ROOT_MODIFIABLE_FIELD_PATHS","service","version","modifiableFieldPathsByEvent","startRumAssembly","configuration","lifeCycle","sessionManager","userSessionManager","viewContexts","urlContexts","actionContexts","displayContext","getCommonContext","reportError","getDeviceInfoImp","arguments","length","undefined","VIEW","ERROR","RESOURCE","ACTION","LONG_TASK","eventRateLimiters","eventRateLimiterThreshold","pendingRawEvents","collectedViews","resolvedDeviceInfo","deviceInfo","drain","subscribe","RAW_RUM_EVENT_COLLECTED","assemble","data","add","startTime","rawRumEvent","savedCommonContext","customerContext","domainContext","viewContext","findView","urlContext","findUrl","session","findTrackedSession","isErrorSession","sessionHasError","actionId","findActionId","actionIds","findAllActionId","commonContext","synthetics","getSyntheticsContext","rumContext","_gc","sdkName","sdkVersion","drift","session_sample_rate","sessionSampleRate","session_replay_sample_rate","sessionReplaySampleRate","session_on_error_sample_rate","sessionOnErrorSampleRate","session_replay_on_error_sample_rate","sessionReplayOnErrorSampleRate","terminal","type","application","id","applicationId","device","env","source","date","user","getId","is_signin","is_login","getSessionType","is_forced_session","isSessionForced","view","name","path","url","referrer","host","pathGroup","pathname","urlQuery","action","needToAssembleWithAction","ids","get","rumEvent","serverRumEvent","visitorId","enabled","visitor_id","has_replay","hasReplay","errorSessionReplayAllowed","sampled_for_error_replay","sampled_for_error_session","error_timestamp_for_session","sessionErrorTimestamp","shouldSend","beforeSend","notify","RUM_EVENT_COLLECTED","has","RUM_VIEW_FIRST_COLLECTED","isForcedSessionUpdate","RUM_VIEW_FORCED_COLLECTED","event","result","warn","rateLimitReached","isLimitReached","indexOf","testId","resultId","test_id","result_id","window","_DATAFLUX_SYNTHETICS_BROWSER"],"sources":["../../src/domain/assembly.js"],"mappings":"AAAA,SACEA,UAAU,EACVC,iBAAiB,EACjBC,YAAY,EACZC,aAAa,EACbC,kBAAkB,EAClBC,YAAY,EACZC,mBAAmB,EACnBC,kCAAkC,EAClCC,YAAY,EACZC,sBAAsB,EACtBC,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I,SAAS,GAAGF,QAAQ;EAC9B;EACA,OAAO9H,OAAO;AAChB;AAEA,SAASmF,cAAcA,CAAC5B,UAAU,EAAE;EAClC,OAAO,CAACA,UAAU,IAAI0E,MAAM,CAACC,4BAA4B,KAAK/G,SAAS,GACnExB,WAAW,CAACE,IAAI,GAChBF,WAAW,CAACC,UAAU;AAC5B","ignoreList":[]}
1
+ {"version":3,"file":"assembly.js","names":["extend2Lev","withSnakeCaseKeys","timeStampNow","isEmptyObject","LifeCycleEventType","RumEventType","createBoundedBuffer","getDeviceInfoWithHighEntropyValues","currentDrift","createEventRateLimiter","limitModification","getSyntheticsTestId","getSyntheticsResultId","display","assign","round","WeakSet","SessionType","VIEW_MODIFIABLE_FIELD_PATHS","USER_CUSTOMIZABLE_FIELD_PATHS","context","ROOT_MODIFIABLE_FIELD_PATHS","service","version","modifiableFieldPathsByEvent","startRumAssembly","configuration","lifeCycle","sessionManager","userSessionManager","viewContexts","urlContexts","actionContexts","displayContext","getCommonContext","reportError","getDeviceInfoImp","arguments","length","undefined","VIEW","ERROR","RESOURCE","ACTION","LONG_TASK","eventRateLimiters","eventRateLimiterThreshold","resolvedDeviceInfo","pendingRawEvents","collectedViews","deviceInfo","drain","subscribe","RAW_RUM_EVENT_COLLECTED","assemble","data","startTime","rawRumEvent","savedCommonContext","customerContext","domainContext","viewContext","findView","urlContext","findUrl","session","findTrackedSession","isErrorSession","sessionHasError","actionId","findActionId","actionIds","findAllActionId","commonContext","synthetics","getSyntheticsContext","testId","resultId","test_id","result_id","rumContext","_gc","sdkName","sdkVersion","drift","session_sample_rate","sessionSampleRate","session_replay_sample_rate","sessionReplaySampleRate","session_on_error_sample_rate","sessionOnErrorSampleRate","session_replay_on_error_sample_rate","sessionReplayOnErrorSampleRate","terminal","type","application","id","applicationId","device","env","source","date","user","getId","is_signin","is_login","getSessionType","is_forced_session","isSessionForced","view","name","path","url","referrer","host","pathGroup","pathname","urlQuery","action","needToAssembleWithAction","ids","get","rumEvent","serverRumEvent","visitorId","enabled","visitor_id","has_replay","hasReplay","errorSessionReplayAllowed","sampled_for_error_replay","sampled_for_error_session","error_timestamp_for_session","sessionErrorTimestamp","shouldSend","event","beforeSend","result","warn","rateLimitReached","isLimitReached","notify","RUM_EVENT_COLLECTED","has","isForcedSessionUpdate","RUM_VIEW_FORCED_COLLECTED","add","RUM_VIEW_FIRST_COLLECTED","indexOf","window","_DATAFLUX_SYNTHETICS_BROWSER"],"sources":["../../src/domain/assembly.js"],"mappings":"OACEA,WACAC,kBACAC,aACAC,cACAC,mBACAC,aACAC,oBACAC,mCACAC,aACAC,uBACAC,kBACAC,oBACAC,sBACAC,QACAC,OACAC,MACAC,YACK,0BACP,IAAIC,uBACU,aADVA,iBAEI,OAGJC,4BAA8B,CAChC,WAAY,SACZ,gBAAiB,UAGfC,8BAAgC,CAClCC,QAAS,UAELC,4BAA8B,CAClCC,QAAS,SACTC,QAAS,UAEPC,4BAA8B,CAAC,SAC5B,SAASC,iBACdC,cACAC,UACAC,eACAC,mBACAC,aACAC,YACAC,eACAC,eACAC,iBACAC,aAEA,IADAC,iBAAgBC,UAAAC,OAAA,SAAAC,IAAAF,UAAA,IAAAA,UAAA,IAAG9B,mCAEnBiB,4BAA4BnB,aAAamC,MAAQ1B,OAC/C,CAAC,EACDK,8BACAD,6BAEFM,4BAA4BnB,aAAaoC,OAAS3B,OAChD,CACE,gBAAiB,SACjB,cAAe,SACf,qBAAsB,UAExBK,8BACAD,4BACAG,6BAEFG,4BAA4BnB,aAAaqC,UAAY5B,OACnD,CACE,eAAgB,UAElBK,8BACAD,4BACAG,6BAEFG,4BAA4BnB,aAAasC,QAAU7B,OACjD,CACE,qBAAsB,UAExBK,8BACAD,4BACAG,6BAEFG,4BAA4BnB,aAAauC,WAAa9B,OACpD,CAAC,EACDK,8BACAD,6BAEF,IAAI2B,kBAAoB,CAAC,EACzBA,kBAAkBxC,aAAaoC,OAAShC,uBACtCJ,aAAaoC,MACbf,cAAcoB,0BACdX,aAEFU,k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,gBAEN","ignoreList":[]}
@@ -1,323 +1,2 @@
1
- import { assign, display, isPercentage, validateAndBuildConfiguration, validatePostRequestRequireParamsConfiguration, isArray, TraceType, isNullUndefinedDefaultValue, DefaultPrivacyLevel, objectHasValue, isMatchOption, catchUserErrors, getOrigin, each, isNumber, isString, getType, ExperimentalFeature } from '@cloudcare/browser-core';
2
- import { buildEnv } from '../boot/buildEnv';
3
- import { isTracingOption } from '../domain/tracing/tracer';
4
- import { validatePlugins } from './plugins';
5
- import { DEFAULT_VISITOR_ID_TTL_HOURS } from './visitorId';
6
- var REPLAY_CANVAS_QUALITY_PRESETS = {
7
- low: {
8
- quality: 0.25,
9
- sampling: 1,
10
- autoInterval: 500,
11
- autoCooldown: 500,
12
- autoUnchangedBackoff: 5000,
13
- autoFailureBackoff: 7000,
14
- autoMaxPerRun: 1
15
- },
16
- medium: {
17
- quality: 0.4,
18
- sampling: 2,
19
- autoInterval: 250,
20
- autoCooldown: 250,
21
- autoUnchangedBackoff: 3000,
22
- autoFailureBackoff: 5000,
23
- autoMaxPerRun: 2
24
- },
25
- high: {
26
- quality: 0.5,
27
- sampling: 4,
28
- autoInterval: 125,
29
- autoCooldown: 125,
30
- autoUnchangedBackoff: 2000,
31
- autoFailureBackoff: 4000,
32
- autoMaxPerRun: 4
33
- }
34
- };
35
- var POSITIVE_REPLAY_CANVAS_OPTIONS = [['replayCanvasMaxCanvasSize', 'Max Canvas Size'], ['replayCanvasMaxEncodedBytes', 'Max Encoded Bytes'], ['replayCanvasMaxConcurrentEncodes', 'Max Concurrent Encodes'], ['replayCanvasAutoInterval', 'Auto Interval'], ['replayCanvasAutoCooldown', 'Auto Cooldown'], ['replayCanvasAutoUnchangedBackoff', 'Auto Unchanged Backoff'], ['replayCanvasAutoFailureBackoff', 'Auto Failure Backoff'], ['replayCanvasAutoMaxPerRun', 'Auto Max Per Run']];
36
- var HTTP_HEADER_NAME_PATTERN = /^[!#$%&'*+\-.^_`|~0-9a-z]+$/;
37
- var FORBIDDEN_VISITOR_ID_HEADERS = ['b3', 'traceparent', 'tracestate', 'uber-trace-id', 'sw8', 'x-gc-trace-id', 'x-gc-span-id', 'x-rum-resource-id'];
38
- var FORBIDDEN_VISITOR_ID_HEADER_FRAGMENTS = ['authorization', 'authentication', 'api-key', 'api_key', 'apikey', 'auth-token', 'auth_token', 'access-token', 'access_token', 'session-token', 'session_token', 'refresh-token', 'refresh_token', 'id-token', 'id_token', 'security-token', 'security_token', 'csrf', 'xsrf', 'jwt', 'signature'];
39
- var FORBIDDEN_REQUEST_HEADERS = ['accept-charset', 'accept-encoding', 'access-control-request-headers', 'access-control-request-method', 'authorization', 'connection', 'content-length', 'cookie', 'cookie2', 'date', 'dnt', 'expect', 'host', 'keep-alive', 'origin', 'permissions-policy', 'referer', 'te', 'trailer', 'transfer-encoding', 'upgrade', 'via'];
40
- function getReplayCanvasQualityPreset(value) {
41
- return typeof value === 'string' ? REPLAY_CANVAS_QUALITY_PRESETS[value] : undefined;
42
- }
43
- export function validateAndBuildRumConfiguration(initConfiguration) {
44
- if (!initConfiguration.applicationId) {
45
- display.error('Application ID is not configured, no RUM data will be collected.');
46
- return;
47
- }
48
- var requireParamsValidate = validatePostRequestRequireParamsConfiguration(initConfiguration);
49
- if (!requireParamsValidate) return;
50
- if (initConfiguration.sessionOnErrorSampleRate !== undefined && !isPercentage(initConfiguration.sessionOnErrorSampleRate)) {
51
- display.error('Error Session Sample Rate should be a number between 0 and 100');
52
- return;
53
- }
54
- if (initConfiguration.sessionReplaySampleRate !== undefined && !isPercentage(initConfiguration.sessionReplaySampleRate)) {
55
- display.error('Session Replay Sample Rate should be a number between 0 and 100');
56
- return;
57
- }
58
- if (initConfiguration.sessionReplayOnErrorSampleRate !== undefined && !isPercentage(initConfiguration.sessionReplayOnErrorSampleRate)) {
59
- display.error('Error Session Replay Sample Rate should be a number between 0 and 100');
60
- return;
61
- }
62
- var allowedTracingUrls = validateAndBuildTracingOptions(initConfiguration);
63
- if (!allowedTracingUrls) {
64
- return;
65
- }
66
- var visitorId = validateAndBuildVisitorIdConfiguration(initConfiguration.visitorId);
67
- if (!visitorId) {
68
- return;
69
- }
70
- // if (initConfiguration.allowedTracingOrigins !== undefined) {
71
- // if (!isArray(initConfiguration.allowedTracingOrigins)) {
72
- // display.error('Allowed Tracing Origins should be an array')
73
- // return
74
- // }
75
- // }
76
- // if (initConfiguration.allowedDDTracingOrigins !== undefined) {
77
- // if (!isArray(initConfiguration.allowedDDTracingOrigins)) {
78
- // display.error('Allowed Tracing Origins should be an array')
79
- // return
80
- // }
81
- // }
82
- if (initConfiguration.tracingSampleRate !== undefined && !isPercentage(initConfiguration.tracingSampleRate)) {
83
- display.error('Tracing Sample Rate should be a number between 0 and 100');
84
- return;
85
- }
86
- if (initConfiguration.excludedActivityUrls !== undefined && !isArray(initConfiguration.excludedActivityUrls)) {
87
- display.error('Excluded Activity Urls should be an array');
88
- return;
89
- }
90
- if (!validatePlugins(initConfiguration.plugins)) {
91
- return;
92
- }
93
- if (initConfiguration.replayCanvasMode !== undefined && initConfiguration.replayCanvasMode !== 'manual' && initConfiguration.replayCanvasMode !== 'auto') {
94
- display.error("Replay Canvas Mode should be 'manual' or 'auto'");
95
- return;
96
- }
97
- if (initConfiguration.replayCanvasQuality !== undefined && !(getReplayCanvasQualityPreset(initConfiguration.replayCanvasQuality) || typeof initConfiguration.replayCanvasQuality === 'number' && initConfiguration.replayCanvasQuality >= 0 && initConfiguration.replayCanvasQuality <= 1)) {
98
- display.error("Replay Canvas Quality should be 'low', 'medium', 'high', or a number between 0 and 1");
99
- return;
100
- }
101
- if (initConfiguration.replayCanvasSampling !== undefined && !(initConfiguration.replayCanvasSampling === 'all' || isNumber(initConfiguration.replayCanvasSampling) && initConfiguration.replayCanvasSampling > 0)) {
102
- display.error("Replay Canvas Sampling should be 'all' or a positive number");
103
- return;
104
- }
105
- for (var replayCanvasOptionIndex = 0; replayCanvasOptionIndex < POSITIVE_REPLAY_CANVAS_OPTIONS.length; replayCanvasOptionIndex += 1) {
106
- var replayCanvasOption = POSITIVE_REPLAY_CANVAS_OPTIONS[replayCanvasOptionIndex];
107
- var replayCanvasOptionValue = initConfiguration[replayCanvasOption[0]];
108
- if (replayCanvasOptionValue !== undefined && (!isNumber(replayCanvasOptionValue) || replayCanvasOptionValue <= 0)) {
109
- display.error('Replay Canvas ' + replayCanvasOption[1] + ' should be a positive number');
110
- return;
111
- }
112
- }
113
- var baseConfiguration = validateAndBuildConfiguration(initConfiguration);
114
- if (!baseConfiguration) {
115
- return;
116
- }
117
- var trackUserInteractions = !!isNullUndefinedDefaultValue(initConfiguration.trackUserInteractions, initConfiguration.trackInteractions);
118
- var replayCanvasMode = isNullUndefinedDefaultValue(initConfiguration.replayCanvasMode, 'auto');
119
- var replayCanvasQualityPreset = getReplayCanvasQualityPreset(initConfiguration.replayCanvasQuality);
120
- var replayCanvasSampling = initConfiguration.replayCanvasSampling;
121
- if (replayCanvasSampling === undefined || replayCanvasSampling === null) {
122
- replayCanvasSampling = replayCanvasQualityPreset ? replayCanvasQualityPreset.sampling : 2;
123
- }
124
- var replayCanvasAutoInterval = isNullUndefinedDefaultValue(initConfiguration.replayCanvasAutoInterval, replayCanvasQualityPreset ? replayCanvasQualityPreset.autoInterval : REPLAY_CANVAS_QUALITY_PRESETS.medium.autoInterval);
125
- var replayCanvasAutoCooldown = isNullUndefinedDefaultValue(initConfiguration.replayCanvasAutoCooldown, replayCanvasQualityPreset ? replayCanvasQualityPreset.autoCooldown : replayCanvasAutoInterval);
126
- return assign({
127
- applicationId: initConfiguration.applicationId,
128
- actionNameAttribute: initConfiguration.actionNameAttribute,
129
- enablePrivacyForActionName: isNullUndefinedDefaultValue(initConfiguration.enablePrivacyForActionName, false),
130
- sessionReplaySampleRate: isNullUndefinedDefaultValue(initConfiguration.sessionReplaySampleRate, 100),
131
- sessionOnErrorSampleRate: isNullUndefinedDefaultValue(initConfiguration.sessionOnErrorSampleRate, 0),
132
- sessionReplayOnErrorSampleRate: isNullUndefinedDefaultValue(initConfiguration.sessionReplayOnErrorSampleRate, 0),
133
- tracingSampleRate: isNullUndefinedDefaultValue(initConfiguration.tracingSampleRate, 100),
134
- allowTraceHeaderWithoutSession: !!initConfiguration.allowTraceHeaderWithoutSession,
135
- allowedTracingUrls: allowedTracingUrls,
136
- visitorId: visitorId,
137
- injectTraceHeader: initConfiguration.injectTraceHeader && catchUserErrors(initConfiguration.injectTraceHeader, 'injectTraceHeader threw an error:'),
138
- generateTraceId: initConfiguration.generateTraceId && catchUserErrors(initConfiguration.generateTraceId, 'generateTraceId threw an error:'),
139
- excludedActivityUrls: isNullUndefinedDefaultValue(initConfiguration.excludedActivityUrls, []),
140
- workerUrl: initConfiguration.workerUrl,
141
- replayCanvasWorkerUrl: initConfiguration.replayCanvasWorkerUrl,
142
- compressIntakeRequests: !!initConfiguration.compressIntakeRequests,
143
- trackUserInteractions: trackUserInteractions,
144
- trackWebSockets: isArray(initConfiguration.enableExperimentalFeatures) && initConfiguration.enableExperimentalFeatures.indexOf(ExperimentalFeature.TRACK_WEBSOCKETS) !== -1,
145
- enableLongAnimationFrame: !!initConfiguration.enableLongAnimationFrame,
146
- trackViewsManually: !!initConfiguration.trackViewsManually,
147
- plugins: initConfiguration.plugins || [],
148
- sessionReplayWebGL: initConfiguration.sessionReplayWebGL,
149
- replayCanvasEnabled: !!initConfiguration.replayCanvasEnabled,
150
- replayCanvasMode: replayCanvasMode,
151
- replayCanvasSampling: replayCanvasSampling,
152
- replayCanvasQuality: isNullUndefinedDefaultValue(replayCanvasQualityPreset ? replayCanvasQualityPreset.quality : initConfiguration.replayCanvasQuality, 0.4),
153
- replayCanvasMimeType: isNullUndefinedDefaultValue(initConfiguration.replayCanvasMimeType, 'image/webp'),
154
- replayCanvasMaxCanvasSize: isNullUndefinedDefaultValue(initConfiguration.replayCanvasMaxCanvasSize, 1280),
155
- replayCanvasMaxEncodedBytes: isNullUndefinedDefaultValue(initConfiguration.replayCanvasMaxEncodedBytes, 40000),
156
- replayCanvasMaxConcurrentEncodes: isNullUndefinedDefaultValue(initConfiguration.replayCanvasMaxConcurrentEncodes, 1),
157
- replayCanvasAutoInterval: replayCanvasAutoInterval,
158
- replayCanvasAutoCooldown: replayCanvasAutoCooldown,
159
- replayCanvasAutoUnchangedBackoff: isNullUndefinedDefaultValue(initConfiguration.replayCanvasAutoUnchangedBackoff, replayCanvasQualityPreset ? replayCanvasQualityPreset.autoUnchangedBackoff : 3000),
160
- replayCanvasAutoFailureBackoff: isNullUndefinedDefaultValue(initConfiguration.replayCanvasAutoFailureBackoff, replayCanvasQualityPreset ? replayCanvasQualityPreset.autoFailureBackoff : 5000),
161
- replayCanvasAutoMaxPerRun: isNullUndefinedDefaultValue(initConfiguration.replayCanvasAutoMaxPerRun, replayCanvasQualityPreset ? replayCanvasQualityPreset.autoMaxPerRun : 2),
162
- replayCanvasFlushImmediately: isNullUndefinedDefaultValue(initConfiguration.replayCanvasFlushImmediately, replayCanvasMode === 'manual'),
163
- traceType: isNullUndefinedDefaultValue(initConfiguration.traceType, TraceType.DDTRACE),
164
- traceId128Bit: !!initConfiguration.traceId128Bit,
165
- defaultPrivacyLevel: objectHasValue(DefaultPrivacyLevel, initConfiguration.defaultPrivacyLevel) ? initConfiguration.defaultPrivacyLevel : DefaultPrivacyLevel.MASK_USER_INPUT,
166
- shouldMaskNode: initConfiguration.shouldMaskNode && catchUserErrors(initConfiguration.shouldMaskNode, 'shouldMaskNode threw an error:'),
167
- shouldRecordCanvas: initConfiguration.shouldRecordCanvas && function (canvas) {
168
- try {
169
- return initConfiguration.shouldRecordCanvas(canvas);
170
- } catch (error) {
171
- display.error('shouldRecordCanvas threw an error:', error);
172
- return false;
173
- }
174
- }
175
- }, baseConfiguration, buildEnv);
176
- }
177
- export function validateAndBuildVisitorIdConfiguration(visitorId) {
178
- if (visitorId === undefined) {
179
- return {
180
- enabled: false
181
- };
182
- }
183
- if (getType(visitorId) !== 'object') {
184
- display.error('Visitor ID configuration should be an object');
185
- return;
186
- }
187
- if (visitorId.enabled !== undefined && typeof visitorId.enabled !== 'boolean') {
188
- display.error('Visitor ID enabled should be a boolean');
189
- return;
190
- }
191
- if (visitorId.enabled !== true) {
192
- return {
193
- enabled: false
194
- };
195
- }
196
- if (!isValidVisitorIdHeader(visitorId.header)) {
197
- display.error('Visitor ID header should be a lowercase, writable HTTP header name and must not overlap authentication, CSRF, signature, tracing, or SDK resource tracking headers');
198
- return;
199
- }
200
- if (!isArray(visitorId.match) || visitorId.match.length === 0 || visitorId.match.some(function (matchOption) {
201
- return !isMatchOption(matchOption) || isString(matchOption) && matchOption.length === 0;
202
- })) {
203
- display.error('Visitor ID match should be a non-empty array of strings, RegExp values, or functions');
204
- return;
205
- }
206
- if (visitorId.ttlHours !== undefined && (!isNumber(visitorId.ttlHours) || !isFinite(visitorId.ttlHours) || visitorId.ttlHours <= 0)) {
207
- display.error('Visitor ID TTL should be a positive number of hours');
208
- return;
209
- }
210
- return {
211
- enabled: true,
212
- header: visitorId.header,
213
- match: visitorId.match.slice(),
214
- ttlHours: isNullUndefinedDefaultValue(visitorId.ttlHours, DEFAULT_VISITOR_ID_TTL_HOURS)
215
- };
216
- }
217
- function isValidVisitorIdHeader(header) {
218
- if (!isString(header) || header !== header.toLowerCase() || !HTTP_HEADER_NAME_PATTERN.test(header)) {
219
- return false;
220
- }
221
- if (header.indexOf('proxy-') === 0 || header.indexOf('sec-') === 0 || header.indexOf('x-datadog-') === 0 || header.indexOf('x-b3-') === 0 || FORBIDDEN_VISITOR_ID_HEADER_FRAGMENTS.some(function (fragment) {
222
- return header.indexOf(fragment) !== -1;
223
- })) {
224
- return false;
225
- }
226
- return FORBIDDEN_REQUEST_HEADERS.indexOf(header) === -1 && FORBIDDEN_VISITOR_ID_HEADERS.indexOf(header) === -1;
227
- }
228
-
229
- /**
230
- * Handles allowedTracingUrls and processes legacy allowedTracingOrigins
231
- */
232
- function validateAndBuildTracingOptions(initConfiguration) {
233
- // Advise about parameters precedence.
234
- if (initConfiguration.allowedTracingUrls !== undefined && initConfiguration.allowedTracingOrigins !== undefined) {
235
- display.warn('Both allowedTracingUrls and allowedTracingOrigins (deprecated) have been defined. The parameter allowedTracingUrls will override allowedTracingOrigins.');
236
- }
237
- // Handle allowedTracingUrls first
238
- if (initConfiguration.allowedTracingUrls !== undefined) {
239
- if (!isArray(initConfiguration.allowedTracingUrls)) {
240
- display.error('Allowed Tracing URLs should be an array');
241
- return;
242
- }
243
- // if (initConfiguration.allowedTracingUrls.length !== 0 && initConfiguration.service === undefined) {
244
- // display.error('Service needs to be configured when tracing is enabled')
245
- // return
246
- // }
247
- // Convert from (MatchOption | TracingOption) to TracingOption, remove unknown properties
248
- var tracingOptions = [];
249
- each(initConfiguration.allowedTracingUrls, function (option) {
250
- if (isMatchOption(option)) {
251
- tracingOptions.push({
252
- match: option,
253
- traceType: isNullUndefinedDefaultValue(initConfiguration.traceType, TraceType.DDTRACE)
254
- });
255
- } else if (isTracingOption(option)) {
256
- tracingOptions.push(option);
257
- } else {
258
- display.warn('Allowed Tracing Urls parameters should be a string, RegExp, function, or an object. Ignoring parameter', option);
259
- }
260
- });
261
- return tracingOptions;
262
- }
263
-
264
- // Handle conversion of allowedTracingOrigins to allowedTracingUrls
265
- if (initConfiguration.allowedTracingOrigins !== undefined) {
266
- if (!isArray(initConfiguration.allowedTracingOrigins)) {
267
- display.error('Allowed Tracing Origins should be an array');
268
- return;
269
- }
270
- var tracingOptions = [];
271
- each(initConfiguration.allowedTracingOrigins, function (legacyMatchOption) {
272
- var tracingOption = convertLegacyMatchOptionToTracingOption(legacyMatchOption, isNullUndefinedDefaultValue(initConfiguration.traceType, TraceType.DDTRACE));
273
- if (tracingOption) {
274
- tracingOptions.push(tracingOption);
275
- }
276
- });
277
- return tracingOptions;
278
- }
279
- // Handle conversion of allowedDDTracingOrigins to allowedTracingUrls
280
- if (initConfiguration.allowedDDTracingOrigins !== undefined) {
281
- if (!isArray(initConfiguration.allowedDDTracingOrigins)) {
282
- display.error('Allowed Tracing Origins should be an array');
283
- return;
284
- }
285
- var tracingOptions = [];
286
- each(initConfiguration.allowedDDTracingOrigins, function (legacyMatchOption) {
287
- var tracingOption = convertLegacyMatchOptionToTracingOption(legacyMatchOption, isNullUndefinedDefaultValue(initConfiguration.traceType, TraceType.DDTRACE));
288
- if (tracingOption) {
289
- tracingOptions.push(tracingOption);
290
- }
291
- });
292
- return tracingOptions;
293
- }
294
- return [];
295
- }
296
-
297
- /**
298
- * Converts parameters from the deprecated allowedTracingOrigins
299
- * to allowedTracingUrls. Handles the change from origin to full URLs.
300
- */
301
- function convertLegacyMatchOptionToTracingOption(item, traceType) {
302
- var match;
303
- if (typeof item === 'string') {
304
- match = item;
305
- } else if (item instanceof RegExp) {
306
- match = function match(url) {
307
- return item.test(getOrigin(url));
308
- };
309
- } else if (typeof item === 'function') {
310
- match = function match(url) {
311
- return item(getOrigin(url));
312
- };
313
- }
314
- if (match === undefined) {
315
- display.warn('Allowed Tracing Origins parameters should be a string, RegExp or function. Ignoring parameter', item);
316
- return undefined;
317
- }
318
- return {
319
- match: match,
320
- traceType: traceType
321
- };
322
- }
323
- //# sourceMappingURL=configuration.js.map
1
+ import{assign,display,isPercentage,validateAndBuildConfiguration,validatePostRequestRequireParamsConfiguration,isArray,TraceType,isNullUndefinedDefaultValue,DefaultPrivacyLevel,objectHasValue,isMatchOption,catchUserErrors,getOrigin,each,isNumber,isString,getType,ExperimentalFeature}from"@cloudcare/browser-core";import{buildEnv}from"../boot/buildEnv";import{isTracingOption}from"../domain/tracing/tracer";import{validatePlugins}from"./plugins";import{DEFAULT_VISITOR_ID_TTL_HOURS}from"./visitorId";var REPLAY_CANVAS_QUALITY_PRESETS={low:{quality:.25,sampling:1,autoInterval:500,autoCooldown:500,autoUnchangedBackoff:5e3,autoFailureBackoff:7e3,autoMaxPerRun:1},medium:{quality:.4,sampling:2,autoInterval:250,autoCooldown:250,autoUnchangedBackoff:3e3,autoFailureBackoff:5e3,autoMaxPerRun:2},high:{quality:.5,sampling:4,autoInterval:125,autoCooldown:125,autoUnchangedBackoff:2e3,autoFailureBackoff:4e3,autoMaxPerRun:4}},POSITIVE_REPLAY_CANVAS_OPTIONS=[["replayCanvasMaxCanvasSize","Max Canvas Size"],["replayCanvasMaxEncodedBytes","Max Encoded Bytes"],["replayCanvasMaxConcurrentEncodes","Max Concurrent Encodes"],["replayCanvasAutoInterval","Auto Interval"],["replayCanvasAutoCooldown","Auto Cooldown"],["replayCanvasAutoUnchangedBackoff","Auto Unchanged Backoff"],["replayCanvasAutoFailureBackoff","Auto Failure Backoff"],["replayCanvasAutoMaxPerRun","Auto Max Per Run"]],HTTP_HEADER_NAME_PATTERN=/^[!#$%&'*+\-.^_`|~0-9a-z]+$/,FORBIDDEN_VISITOR_ID_HEADERS=["b3","traceparent","tracestate","uber-trace-id","sw8","x-gc-trace-id","x-gc-span-id","x-rum-resource-id"],FORBIDDEN_VISITOR_ID_HEADER_FRAGMENTS=["authorization","authentication","api-key","api_key","apikey","auth-token","auth_token","access-token","access_token","session-token","session_token","refresh-token","refresh_token","id-token","id_token","security-token","security_token","csrf","xsrf","jwt","signature"],FORBIDDEN_REQUEST_HEADERS=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","authorization","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","permissions-policy","referer","te","trailer","transfer-encoding","upgrade","via"];function getReplayCanvasQualityPreset(value){return"string"==typeof value?REPLAY_CANVAS_QUALITY_PRESETS[value]:void 0}export function validateAndBuildRumConfiguration(initConfiguration){if(initConfiguration.applicationId){if(validatePostRequestRequireParamsConfiguration(initConfiguration))if(void 0===initConfiguration.sessionOnErrorSampleRate||isPercentage(initConfiguration.sessionOnErrorSampleRate))if(void 0===initConfiguration.sessionReplaySampleRate||isPercentage(initConfiguration.sessionReplaySampleRate))if(void 0===initConfiguration.sessionReplayOnErrorSampleRate||isPercentage(initConfiguration.sessionReplayOnErrorSampleRate)){var allowedTracingUrls=function validateAndBuildTracingOptions(initConfiguration){void 0!==initConfiguration.allowedTracingUrls&&void 0!==initConfiguration.allowedTracingOrigins&&display.warn("Both allowedTracingUrls and allowedTracingOrigins (deprecated) have been defined. The parameter allowedTracingUrls will override allowedTracingOrigins.");if(void 0!==initConfiguration.allowedTracingUrls){if(!isArray(initConfiguration.allowedTracingUrls))return void display.error("Allowed Tracing URLs should be an array");var tracingOptions=[];return each(initConfiguration.allowedTracingUrls,(function(option){isMatchOption(option)?tracingOptions.push({match:option,traceType:isNullUndefinedDefaultValue(initConfiguration.traceType,TraceType.DDTRACE)}):isTracingOption(option)?tracingOptions.push(option):display.warn("Allowed Tracing Urls parameters should be a string, RegExp, function, or an object. Ignoring parameter",option)})),tracingOptions}if(void 0!==initConfiguration.allowedTracingOrigins){if(!isArray(initConfiguration.allowedTracingOrigins))return void display.error("Allowed Tracing Origins should be an array");tracingOptions=[];return each(initConfiguration.allowedTracingOrigins,(function(legacyMatchOption){var tracingOption=convertLegacyMatchOptionToTracingOption(legacyMatchOption,isNullUndefinedDefaultValue(initConfiguration.traceType,TraceType.DDTRACE));tracingOption&&tracingOptions.push(tracingOption)})),tracingOptions}if(void 0!==initConfiguration.allowedDDTracingOrigins){if(!isArray(initConfiguration.allowedDDTracingOrigins))return void display.error("Allowed Tracing Origins should be an array");tracingOptions=[];return each(initConfiguration.allowedDDTracingOrigins,(function(legacyMatchOption){var tracingOption=convertLegacyMatchOptionToTracingOption(legacyMatchOption,isNullUndefinedDefaultValue(initConfiguration.traceType,TraceType.DDTRACE));tracingOption&&tracingOptions.push(tracingOption)})),tracingOptions}return[]}(initConfiguration);if(allowedTracingUrls){var visitorId=validateAndBuildVisitorIdConfiguration(initConfiguration.visitorId);if(visitorId)if(void 0===initConfiguration.tracingSampleRate||isPercentage(initConfiguration.tracingSampleRate))if(void 0===initConfiguration.excludedActivityUrls||isArray(initConfiguration.excludedActivityUrls)){if(validatePlugins(initConfiguration.plugins))if(void 0===initConfiguration.replayCanvasMode||"manual"===initConfiguration.replayCanvasMode||"auto"===initConfiguration.replayCanvasMode)if(void 0===initConfiguration.replayCanvasQuality||getReplayCanvasQualityPreset(initConfiguration.replayCanvasQuality)||"number"==typeof initConfiguration.replayCanvasQuality&&initConfiguration.replayCanvasQuality>=0&&initConfiguration.replayCanvasQuality<=1)if(void 0===initConfiguration.replayCanvasSampling||"all"===initConfiguration.replayCanvasSampling||isNumber(initConfiguration.replayCanvasSampling)&&initConfiguration.replayCanvasSampling>0){for(var replayCanvasOptionIndex=0;replayCanvasOptionIndex<POSITIVE_REPLAY_CANVAS_OPTIONS.length;replayCanvasOptionIndex+=1){var replayCanvasOption=POSITIVE_REPLAY_CANVAS_OPTIONS[replayCanvasOptionIndex],replayCanvasOptionValue=initConfiguration[replayCanvasOption[0]];if(void 0!==replayCanvasOptionValue&&(!isNumber(replayCanvasOptionValue)||replayCanvasOptionValue<=0))return void display.error("Replay Canvas "+replayCanvasOption[1]+" should be a positive number")}var baseConfiguration=validateAndBuildConfiguration(initConfiguration);if(baseConfiguration){var trackUserInteractions=!!isNullUndefinedDefaultValue(initConfiguration.trackUserInteractions,initConfiguration.trackInteractions),replayCanvasMode=isNullUndefinedDefaultValue(initConfiguration.replayCanvasMode,"auto"),replayCanvasQualityPreset=getReplayCanvasQualityPreset(initConfiguration.replayCanvasQuality),replayCanvasSampling=initConfiguration.replayCanvasSampling;null==replayCanvasSampling&&(replayCanvasSampling=replayCanvasQualityPreset?replayCanvasQualityPreset.sampling:2);var replayCanvasAutoInterval=isNullUndefinedDefaultValue(initConfiguration.replayCanvasAutoInterval,replayCanvasQualityPreset?replayCanvasQualityPreset.autoInterval:REPLAY_CANVAS_QUALITY_PRESETS.medium.autoInterval),replayCanvasAutoCooldown=isNullUndefinedDefaultValue(initConfiguration.replayCanvasAutoCooldown,replayCanvasQualityPreset?replayCanvasQualityPreset.autoCooldown:replayCanvasAutoInterval);return assign({applicationId:initConfiguration.applicationId,actionNameAttribute:initConfiguration.actionNameAttribute,enablePrivacyForActionName:isNullUndefinedDefaultValue(initConfiguration.enablePrivacyForActionName,!1),sessionReplaySampleRate:isNullUndefinedDefaultValue(initConfiguration.sessionReplaySampleRate,100),sessionOnErrorSampleRate:isNullUndefinedDefaultValue(initConfiguration.sessionOnErrorSampleRate,0),sessionReplayOnErrorSampleRate:isNullUndefinedDefaultValue(initConfiguration.sessionReplayOnErrorSampleRate,0),tracingSampleRate:isNullUndefinedDefaultValue(initConfiguration.tracingSampleRate,100),allowTraceHeaderWithoutSession:!!initConfiguration.allowTraceHeaderWithoutSession,allowedTracingUrls:allowedTracingUrls,visitorId:visitorId,injectTraceHeader:initConfiguration.injectTraceHeader&&catchUserErrors(initConfiguration.injectTraceHeader,"injectTraceHeader threw an error:"),generateTraceId:initConfiguration.generateTraceId&&catchUserErrors(initConfiguration.generateTraceId,"generateTraceId threw an error:"),excludedActivityUrls:isNullUndefinedDefaultValue(initConfiguration.excludedActivityUrls,[]),workerUrl:initConfiguration.workerUrl,replayCanvasWorkerUrl:initConfiguration.replayCanvasWorkerUrl,compressIntakeRequests:!!initConfiguration.compressIntakeRequests,trackUserInteractions:trackUserInteractions,trackWebSockets:isArray(initConfiguration.enableExperimentalFeatures)&&-1!==initConfiguration.enableExperimentalFeatures.indexOf(ExperimentalFeature.TRACK_WEBSOCKETS),enableLongAnimationFrame:!!initConfiguration.enableLongAnimationFrame,trackViewsManually:!!initConfiguration.trackViewsManually,plugins:initConfiguration.plugins||[],sessionReplayWebGL:initConfiguration.sessionReplayWebGL,replayCanvasEnabled:!!initConfiguration.replayCanvasEnabled,replayCanvasMode:replayCanvasMode,replayCanvasSampling:replayCanvasSampling,replayCanvasQuality:isNullUndefinedDefaultValue(replayCanvasQualityPreset?replayCanvasQualityPreset.quality:initConfiguration.replayCanvasQuality,.4),replayCanvasMimeType:isNullUndefinedDefaultValue(initConfiguration.replayCanvasMimeType,"image/webp"),replayCanvasMaxCanvasSize:isNullUndefinedDefaultValue(initConfiguration.replayCanvasMaxCanvasSize,1280),replayCanvasMaxEncodedBytes:isNullUndefinedDefaultValue(initConfiguration.replayCanvasMaxEncodedBytes,4e4),replayCanvasMaxConcurrentEncodes:isNullUndefinedDefaultValue(initConfiguration.replayCanvasMaxConcurrentEncodes,1),replayCanvasAutoInterval:replayCanvasAutoInterval,replayCanvasAutoCooldown:replayCanvasAutoCooldown,replayCanvasAutoUnchangedBackoff:isNullUndefinedDefaultValue(initConfiguration.replayCanvasAutoUnchangedBackoff,replayCanvasQualityPreset?replayCanvasQualityPreset.autoUnchangedBackoff:3e3),replayCanvasAutoFailureBackoff:isNullUndefinedDefaultValue(initConfiguration.replayCanvasAutoFailureBackoff,replayCanvasQualityPreset?replayCanvasQualityPreset.autoFailureBackoff:5e3),replayCanvasAutoMaxPerRun:isNullUndefinedDefaultValue(initConfiguration.replayCanvasAutoMaxPerRun,replayCanvasQualityPreset?replayCanvasQualityPreset.autoMaxPerRun:2),replayCanvasFlushImmediately:isNullUndefinedDefaultValue(initConfiguration.replayCanvasFlushImmediately,"manual"===replayCanvasMode),traceType:isNullUndefinedDefaultValue(initConfiguration.traceType,TraceType.DDTRACE),traceId128Bit:!!initConfiguration.traceId128Bit,defaultPrivacyLevel:objectHasValue(DefaultPrivacyLevel,initConfiguration.defaultPrivacyLevel)?initConfiguration.defaultPrivacyLevel:DefaultPrivacyLevel.MASK_USER_INPUT,shouldMaskNode:initConfiguration.shouldMaskNode&&catchUserErrors(initConfiguration.shouldMaskNode,"shouldMaskNode threw an error:"),shouldRecordCanvas:initConfiguration.shouldRecordCanvas&&function(canvas){try{return initConfiguration.shouldRecordCanvas(canvas)}catch(error){return display.error("shouldRecordCanvas threw an error:",error),!1}}},baseConfiguration,buildEnv)}}else display.error("Replay Canvas Sampling should be 'all' or a positive number");else display.error("Replay Canvas Quality should be 'low', 'medium', 'high', or a number between 0 and 1");else display.error("Replay Canvas Mode should be 'manual' or 'auto'")}else display.error("Excluded Activity Urls should be an array");else display.error("Tracing Sample Rate should be a number between 0 and 100")}}else display.error("Error Session Replay Sample Rate should be a number between 0 and 100");else display.error("Session Replay Sample Rate should be a number between 0 and 100");else display.error("Error Session Sample Rate should be a number between 0 and 100")}else display.error("Application ID is not configured, no RUM data will be collected.")}export function validateAndBuildVisitorIdConfiguration(visitorId){if(void 0===visitorId)return{enabled:!1};if("object"===getType(visitorId))if(void 0===visitorId.enabled||"boolean"==typeof visitorId.enabled){if(!0!==visitorId.enabled)return{enabled:!1};if(function isValidVisitorIdHeader(header){if(!isString(header)||header!==header.toLowerCase()||!HTTP_HEADER_NAME_PATTERN.test(header))return!1;if(0===header.indexOf("proxy-")||0===header.indexOf("sec-")||0===header.indexOf("x-datadog-")||0===header.indexOf("x-b3-")||FORBIDDEN_VISITOR_ID_HEADER_FRAGMENTS.some((function(fragment){return-1!==header.indexOf(fragment)})))return!1;return-1===FORBIDDEN_REQUEST_HEADERS.indexOf(header)&&-1===FORBIDDEN_VISITOR_ID_HEADERS.indexOf(header)}(visitorId.header))if(isArray(visitorId.match)&&0!==visitorId.match.length&&!visitorId.match.some((function(matchOption){return!isMatchOption(matchOption)||isString(matchOption)&&0===matchOption.length}))){if(void 0===visitorId.ttlHours||isNumber(visitorId.ttlHours)&&isFinite(visitorId.ttlHours)&&!(visitorId.ttlHours<=0))return{enabled:!0,header:visitorId.header,match:visitorId.match.slice(),ttlHours:isNullUndefinedDefaultValue(visitorId.ttlHours,DEFAULT_VISITOR_ID_TTL_HOURS)};display.error("Visitor ID TTL should be a positive number of hours")}else display.error("Visitor ID match should be a non-empty array of strings, RegExp values, or functions");else display.error("Visitor ID header should be a lowercase, writable HTTP header name and must not overlap authentication, CSRF, signature, tracing, or SDK resource tracking headers")}else display.error("Visitor ID enabled should be a boolean");else display.error("Visitor ID configuration should be an object")}function convertLegacyMatchOptionToTracingOption(item,traceType){var match;if("string"==typeof item?match=item:item instanceof RegExp?match=function match(url){return item.test(getOrigin(url))}:"function"==typeof item&&(match=function match(url){return item(getOrigin(url))}),void 0!==match)return{match:match,traceType:traceType};display.warn("Allowed Tracing Origins parameters should be a string, RegExp or function. Ignoring parameter",item)}
2
+ //# sourceMappingURL=configuration.js.map