@cloudcare/browser-rum 3.1.23 → 3.2.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 (186) hide show
  1. package/README.md +49 -30
  2. package/bundle/dataflux-rum.js +1 -1
  3. package/cjs/boot/buildEnv.js +1 -1
  4. package/cjs/boot/perStartRum.js +158 -0
  5. package/cjs/boot/perStartRum.js.map +1 -0
  6. package/cjs/boot/recorderApi.js +10 -17
  7. package/cjs/boot/recorderApi.js.map +1 -1
  8. package/cjs/boot/rum.entry.js +5 -1
  9. package/cjs/boot/rum.entry.js.map +1 -1
  10. package/cjs/boot/rum.js +32 -33
  11. package/cjs/boot/rum.js.map +1 -1
  12. package/cjs/boot/rumPublicApi.js +90 -156
  13. package/cjs/boot/rumPublicApi.js.map +1 -1
  14. package/cjs/boot/startRecording.js +9 -7
  15. package/cjs/boot/startRecording.js.map +1 -1
  16. package/cjs/domain/assembly.js +3 -3
  17. package/cjs/domain/assembly.js.map +1 -1
  18. package/cjs/domain/configuration.js +3 -0
  19. package/cjs/domain/configuration.js.map +1 -1
  20. package/cjs/domain/deflate/deflateEncoder.js +121 -0
  21. package/cjs/domain/deflate/deflateEncoder.js.map +1 -0
  22. package/cjs/domain/deflate/deflateWorker.js +160 -0
  23. package/cjs/domain/deflate/deflateWorker.js.map +1 -0
  24. package/cjs/domain/deflate/index.js.map +1 -0
  25. package/cjs/domain/firstInputPolyfill.js +83 -0
  26. package/cjs/domain/firstInputPolyfill.js.map +1 -0
  27. package/cjs/domain/performanceObservable.js +11 -0
  28. package/cjs/domain/performanceObservable.js.map +1 -1
  29. package/cjs/domain/performanceUtils.js +30 -2
  30. package/cjs/domain/performanceUtils.js.map +1 -1
  31. package/cjs/domain/replay/segmentCollection/segment.js +34 -25
  32. package/cjs/domain/replay/segmentCollection/segment.js.map +1 -1
  33. package/cjs/domain/replay/segmentCollection/segmentCollection.js +9 -8
  34. package/cjs/domain/replay/segmentCollection/segmentCollection.js.map +1 -1
  35. package/cjs/domain/rumEventsCollection/actions/interactionSelectorCache.js +29 -0
  36. package/cjs/domain/rumEventsCollection/actions/interactionSelectorCache.js.map +1 -0
  37. package/cjs/domain/rumEventsCollection/actions/trackClickActions.js +12 -5
  38. package/cjs/domain/rumEventsCollection/actions/trackClickActions.js.map +1 -1
  39. package/cjs/domain/rumEventsCollection/error/trackConsoleError.js +2 -9
  40. package/cjs/domain/rumEventsCollection/error/trackConsoleError.js.map +1 -1
  41. package/cjs/domain/rumEventsCollection/longTask/longAnimationFrameCollection.js +72 -0
  42. package/cjs/domain/rumEventsCollection/longTask/longAnimationFrameCollection.js.map +1 -0
  43. package/cjs/domain/rumEventsCollection/longTask/longTaskCollection.js +11 -3
  44. package/cjs/domain/rumEventsCollection/longTask/longTaskCollection.js.map +1 -1
  45. package/cjs/domain/rumEventsCollection/resource/resourceCollection.js +1 -1
  46. package/cjs/domain/rumEventsCollection/resource/resourceCollection.js.map +1 -1
  47. package/cjs/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js +4 -20
  48. package/cjs/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js.map +1 -1
  49. package/cjs/domain/rumEventsCollection/view/trackCommonViewMetrics.js +2 -2
  50. package/cjs/domain/rumEventsCollection/view/trackCommonViewMetrics.js.map +1 -1
  51. package/cjs/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js +27 -22
  52. package/cjs/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js.map +1 -1
  53. package/cjs/domain/rumEventsCollection/view/trackFirstContentfulPaint.js +6 -3
  54. package/cjs/domain/rumEventsCollection/view/trackFirstContentfulPaint.js.map +1 -1
  55. package/cjs/domain/rumEventsCollection/view/trackFirstInput.js +8 -3
  56. package/cjs/domain/rumEventsCollection/view/trackFirstInput.js.map +1 -1
  57. package/cjs/domain/rumEventsCollection/view/trackInitialViewTimings.js +4 -4
  58. package/cjs/domain/rumEventsCollection/view/trackInitialViewTimings.js.map +1 -1
  59. package/cjs/domain/rumEventsCollection/view/trackInteractionToNextPaint.js +26 -10
  60. package/cjs/domain/rumEventsCollection/view/trackInteractionToNextPaint.js.map +1 -1
  61. package/cjs/domain/rumEventsCollection/view/trackLargestContentfulPaint.js +6 -4
  62. package/cjs/domain/rumEventsCollection/view/trackLargestContentfulPaint.js.map +1 -1
  63. package/cjs/domain/rumEventsCollection/view/trackNavigationTimings.js +19 -24
  64. package/cjs/domain/rumEventsCollection/view/trackNavigationTimings.js.map +1 -1
  65. package/cjs/domain/rumEventsCollection/view/trackViews.js +1 -1
  66. package/cjs/domain/rumEventsCollection/view/trackViews.js.map +1 -1
  67. package/cjs/transport/startRumBatch.js +7 -30
  68. package/cjs/transport/startRumBatch.js.map +1 -1
  69. package/esm/boot/buildEnv.js +1 -1
  70. package/esm/boot/perStartRum.js +152 -0
  71. package/esm/boot/perStartRum.js.map +1 -0
  72. package/esm/boot/recorderApi.js +11 -18
  73. package/esm/boot/recorderApi.js.map +1 -1
  74. package/esm/boot/rum.entry.js +5 -1
  75. package/esm/boot/rum.entry.js.map +1 -1
  76. package/esm/boot/rum.js +33 -33
  77. package/esm/boot/rum.js.map +1 -1
  78. package/esm/boot/rumPublicApi.js +91 -157
  79. package/esm/boot/rumPublicApi.js.map +1 -1
  80. package/esm/boot/startRecording.js +9 -7
  81. package/esm/boot/startRecording.js.map +1 -1
  82. package/esm/domain/assembly.js +3 -3
  83. package/esm/domain/assembly.js.map +1 -1
  84. package/esm/domain/configuration.js +3 -0
  85. package/esm/domain/configuration.js.map +1 -1
  86. package/esm/domain/deflate/deflateEncoder.js +113 -0
  87. package/esm/domain/deflate/deflateEncoder.js.map +1 -0
  88. package/esm/domain/deflate/deflateWorker.js +147 -0
  89. package/esm/domain/deflate/deflateWorker.js.map +1 -0
  90. package/esm/domain/deflate/index.js.map +1 -0
  91. package/esm/domain/firstInputPolyfill.js +77 -0
  92. package/esm/domain/firstInputPolyfill.js.map +1 -0
  93. package/esm/domain/performanceObservable.js +11 -1
  94. package/esm/domain/performanceObservable.js.map +1 -1
  95. package/esm/domain/performanceUtils.js +29 -2
  96. package/esm/domain/performanceUtils.js.map +1 -1
  97. package/esm/domain/replay/segmentCollection/segment.js +33 -24
  98. package/esm/domain/replay/segmentCollection/segment.js.map +1 -1
  99. package/esm/domain/replay/segmentCollection/segmentCollection.js +10 -9
  100. package/esm/domain/replay/segmentCollection/segmentCollection.js.map +1 -1
  101. package/esm/domain/rumEventsCollection/actions/interactionSelectorCache.js +19 -0
  102. package/esm/domain/rumEventsCollection/actions/interactionSelectorCache.js.map +1 -0
  103. package/esm/domain/rumEventsCollection/actions/trackClickActions.js +10 -3
  104. package/esm/domain/rumEventsCollection/actions/trackClickActions.js.map +1 -1
  105. package/esm/domain/rumEventsCollection/error/trackConsoleError.js +3 -10
  106. package/esm/domain/rumEventsCollection/error/trackConsoleError.js.map +1 -1
  107. package/esm/domain/rumEventsCollection/longTask/longAnimationFrameCollection.js +66 -0
  108. package/esm/domain/rumEventsCollection/longTask/longAnimationFrameCollection.js.map +1 -0
  109. package/esm/domain/rumEventsCollection/longTask/longTaskCollection.js +12 -4
  110. package/esm/domain/rumEventsCollection/longTask/longTaskCollection.js.map +1 -1
  111. package/esm/domain/rumEventsCollection/resource/resourceCollection.js +1 -1
  112. package/esm/domain/rumEventsCollection/resource/resourceCollection.js.map +1 -1
  113. package/esm/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js +6 -22
  114. package/esm/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js.map +1 -1
  115. package/esm/domain/rumEventsCollection/view/trackCommonViewMetrics.js +2 -2
  116. package/esm/domain/rumEventsCollection/view/trackCommonViewMetrics.js.map +1 -1
  117. package/esm/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js +29 -24
  118. package/esm/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js.map +1 -1
  119. package/esm/domain/rumEventsCollection/view/trackFirstContentfulPaint.js +8 -5
  120. package/esm/domain/rumEventsCollection/view/trackFirstContentfulPaint.js.map +1 -1
  121. package/esm/domain/rumEventsCollection/view/trackFirstInput.js +10 -5
  122. package/esm/domain/rumEventsCollection/view/trackFirstInput.js.map +1 -1
  123. package/esm/domain/rumEventsCollection/view/trackInitialViewTimings.js +4 -4
  124. package/esm/domain/rumEventsCollection/view/trackInitialViewTimings.js.map +1 -1
  125. package/esm/domain/rumEventsCollection/view/trackInteractionToNextPaint.js +28 -12
  126. package/esm/domain/rumEventsCollection/view/trackInteractionToNextPaint.js.map +1 -1
  127. package/esm/domain/rumEventsCollection/view/trackLargestContentfulPaint.js +7 -5
  128. package/esm/domain/rumEventsCollection/view/trackLargestContentfulPaint.js.map +1 -1
  129. package/esm/domain/rumEventsCollection/view/trackNavigationTimings.js +21 -26
  130. package/esm/domain/rumEventsCollection/view/trackNavigationTimings.js.map +1 -1
  131. package/esm/domain/rumEventsCollection/view/trackViews.js +1 -1
  132. package/esm/domain/rumEventsCollection/view/trackViews.js.map +1 -1
  133. package/esm/transport/startRumBatch.js +8 -31
  134. package/esm/transport/startRumBatch.js.map +1 -1
  135. package/package.json +4 -4
  136. package/src/boot/perStartRum.js +207 -0
  137. package/src/boot/recorderApi.js +18 -26
  138. package/src/boot/rum.entry.js +5 -1
  139. package/src/boot/rum.js +47 -48
  140. package/src/boot/rumPublicApi.js +115 -198
  141. package/src/boot/startRecording.js +8 -9
  142. package/src/domain/assembly.js +3 -5
  143. package/src/domain/configuration.js +3 -0
  144. package/src/domain/deflate/deflateEncoder.js +139 -0
  145. package/src/domain/{replay/deflate → deflate}/deflateWorker.js +57 -20
  146. package/src/domain/firstInputPolyfill.js +92 -0
  147. package/src/domain/performanceObservable.js +17 -2
  148. package/src/domain/performanceUtils.js +37 -2
  149. package/src/domain/replay/segmentCollection/segment.js +36 -30
  150. package/src/domain/replay/segmentCollection/segmentCollection.js +11 -18
  151. package/src/domain/rumEventsCollection/actions/interactionSelectorCache.js +20 -0
  152. package/src/domain/rumEventsCollection/actions/trackClickActions.js +14 -3
  153. package/src/domain/rumEventsCollection/error/trackConsoleError.js +6 -12
  154. package/src/domain/rumEventsCollection/longTask/longAnimationFrameCollection.js +69 -0
  155. package/src/domain/rumEventsCollection/longTask/longTaskCollection.js +37 -26
  156. package/src/domain/rumEventsCollection/resource/resourceCollection.js +1 -1
  157. package/src/domain/rumEventsCollection/resource/retrieveInitialDocumentResourceTiming.js +6 -35
  158. package/src/domain/rumEventsCollection/view/trackCommonViewMetrics.js +1 -3
  159. package/src/domain/rumEventsCollection/view/trackCumulativeLayoutShift.js +33 -42
  160. package/src/domain/rumEventsCollection/view/trackFirstContentfulPaint.js +26 -19
  161. package/src/domain/rumEventsCollection/view/trackFirstInput.js +40 -42
  162. package/src/domain/rumEventsCollection/view/trackInitialViewTimings.js +1 -4
  163. package/src/domain/rumEventsCollection/view/trackInteractionToNextPaint.js +50 -35
  164. package/src/domain/rumEventsCollection/view/trackLargestContentfulPaint.js +32 -32
  165. package/src/domain/rumEventsCollection/view/trackNavigationTimings.js +29 -31
  166. package/src/domain/rumEventsCollection/view/trackViews.js +1 -6
  167. package/src/transport/startRumBatch.js +10 -52
  168. package/cjs/domain/performanceCollection.js +0 -161
  169. package/cjs/domain/performanceCollection.js.map +0 -1
  170. package/cjs/domain/replay/deflate/deflateEncoder.js +0 -82
  171. package/cjs/domain/replay/deflate/deflateEncoder.js.map +0 -1
  172. package/cjs/domain/replay/deflate/deflateWorker.js +0 -142
  173. package/cjs/domain/replay/deflate/deflateWorker.js.map +0 -1
  174. package/cjs/domain/replay/deflate/index.js.map +0 -1
  175. package/esm/domain/performanceCollection.js +0 -155
  176. package/esm/domain/performanceCollection.js.map +0 -1
  177. package/esm/domain/replay/deflate/deflateEncoder.js +0 -74
  178. package/esm/domain/replay/deflate/deflateEncoder.js.map +0 -1
  179. package/esm/domain/replay/deflate/deflateWorker.js +0 -129
  180. package/esm/domain/replay/deflate/deflateWorker.js.map +0 -1
  181. package/esm/domain/replay/deflate/index.js.map +0 -1
  182. package/src/domain/performanceCollection.js +0 -202
  183. package/src/domain/replay/deflate/deflateEncoder.js +0 -88
  184. /package/cjs/domain/{replay/deflate → deflate}/index.js +0 -0
  185. /package/esm/domain/{replay/deflate → deflate}/index.js +0 -0
  186. /package/src/domain/{replay/deflate → deflate}/index.js +0 -0
@@ -1,135 +1,54 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- import { makePublicApi, areCookiesAuthorized, BoundedBuffer, display, buildCookieOptions, createContextManager, CustomerDataType, clocksNow, timeStampNow, ActionType, deepClone, createHandlingStack, sanitizeUser, checkUser, noop, assign, canUseEventBridge, monitor, storeContextManager } from '@cloudcare/browser-core';
3
- import { validateAndBuildRumConfiguration } from '../domain/configuration';
2
+ import { makePublicApi, createContextManager, CustomerDataType, clocksNow, ActionType, deepClone, createHandlingStack, sanitizeUser, checkUser, callMonitored, assign, monitor, storeContextManager, createIdentityEncoder, addTelemetryUsage, sanitize, displayAlreadyInitializedError } from '@cloudcare/browser-core';
4
3
  import { buildCommonContext } from '../domain/contexts/commonContext';
4
+ import { createPreStartStrategy } from './perStartRum';
5
5
  var RUM_STORAGE_KEY = 'rum';
6
- export function makeRumPublicApi(startRumImpl, recorderApi) {
7
- var isAlreadyInitialized = false;
6
+ export function makeRumPublicApi(startRumImpl, recorderApi, options) {
7
+ if (options === undefined) {
8
+ options = {};
9
+ }
8
10
  var globalContextManager = createContextManager(CustomerDataType.GlobalContext);
9
11
  var userContextManager = createContextManager(CustomerDataType.User);
10
- var getInternalContextStrategy = function getInternalContextStrategy() {
11
- return undefined;
12
- };
13
- var getInitConfigurationStrategy = function getInitConfigurationStrategy() {
14
- return undefined;
15
- };
16
- var stopSessionStrategy = function stopSessionStrategy() {
17
- return noop();
18
- };
19
- var bufferApiCalls = new BoundedBuffer();
20
- var _addTimingStrategy = function addTimingStrategy(name, time) {
21
- if (typeof time === 'undefined') {
22
- time = timeStampNow();
23
- }
24
- bufferApiCalls.add(function () {
25
- return _addTimingStrategy(name, time);
26
- });
27
- };
28
- var _startViewStrategy = function startViewStrategy(options, startClocks) {
29
- if (typeof startClocks === 'undefined') {
30
- startClocks = clocksNow();
31
- }
32
- bufferApiCalls.add(function () {
33
- return _startViewStrategy(options, startClocks);
34
- });
35
- };
36
- var _addActionStrategy = function addActionStrategy(action, commonContext) {
37
- if (typeof commonContext == 'undefined') {
38
- commonContext = buildCommonContext(globalContextManager, userContextManager, recorderApi);
39
- }
40
- bufferApiCalls.add(function () {
41
- return _addActionStrategy(action, commonContext);
42
- });
43
- };
44
- var _addErrorStrategy = function addErrorStrategy(providedError, commonContext) {
45
- if (typeof commonContext == 'undefined') {
46
- commonContext = buildCommonContext(globalContextManager, userContextManager, recorderApi);
47
- }
48
- bufferApiCalls.add(function () {
49
- return _addErrorStrategy(providedError, commonContext);
50
- });
51
- };
52
- function initRum(initConfiguration) {
53
- getInitConfigurationStrategy = function getInitConfigurationStrategy() {
54
- return deepClone(initConfiguration);
55
- };
56
- var eventBridgeAvailable = canUseEventBridge();
57
- if (eventBridgeAvailable) {
58
- initConfiguration = overrideInitConfigurationForBridge(initConfiguration);
59
- }
60
- if (!canHandleSession(initConfiguration)) {
61
- return;
62
- }
63
- if (!canInitRum(initConfiguration)) {
64
- return;
65
- }
66
- var configuration = validateAndBuildRumConfiguration(initConfiguration);
67
- if (!configuration) {
68
- return;
69
- }
70
- if (!configuration.trackViewsManually) {
71
- doStartRum(configuration);
72
- } else {
73
- // drain beforeInitCalls by buffering them until we start RUM
74
- // if we get a startView, drain re-buffered calls before continuing to drain beforeInitCalls
75
- // in order to ensure that calls are processed in order
76
- var beforeInitCalls = bufferApiCalls;
77
- bufferApiCalls = new BoundedBuffer();
78
- _startViewStrategy = function _startViewStrategy(options) {
79
- doStartRum(configuration, options);
80
- };
81
- beforeInitCalls.drain();
82
- }
83
- isAlreadyInitialized = true;
12
+ function getCommonContext() {
13
+ return buildCommonContext(globalContextManager, userContextManager, recorderApi);
84
14
  }
85
- function doStartRum(configuration, initialViewOptions) {
15
+ var strategy = createPreStartStrategy(options, getCommonContext, function (configuration, deflateWorker, initialViewOptions) {
86
16
  if (configuration.storeContextsToLocal) {
87
17
  storeContextManager(configuration, globalContextManager, RUM_STORAGE_KEY, CustomerDataType.GlobalContext);
88
18
  storeContextManager(configuration, userContextManager, RUM_STORAGE_KEY, CustomerDataType.User);
89
- // // localstorage
90
- // var beforeInitGlobalContext = globalContextManager.getContext()
91
- // globalContextManager = createStoredContextManager(
92
- // RUM_STORAGE_KEY,
93
- // CustomerDataType.GlobalContext
94
- // )
95
- // globalContextManager.setContext(
96
- // extend2Lev(globalContextManager.getContext(), beforeInitGlobalContext)
97
- // )
98
-
99
- // var beforeInitUserContext = userContextManager.getContext()
100
- // userContextManager = createStoredContextManager(
101
- // RUM_STORAGE_KEY,
102
- // CustomerDataType.User
103
- // )
104
- // userContextManager.setContext(
105
- // extend2Lev(userContextManager.getContext(), beforeInitUserContext)
106
- // )
107
19
  }
108
-
109
- var startRumResults = startRumImpl(configuration, recorderApi, globalContextManager, userContextManager, initialViewOptions);
110
- _startViewStrategy = startRumResults.startView;
111
- _addActionStrategy = startRumResults.addAction;
112
- _addErrorStrategy = startRumResults.addError;
113
- _addTimingStrategy = startRumResults.addTiming;
114
- getInternalContextStrategy = startRumResults.getInternalContext;
115
- stopSessionStrategy = startRumResults.stopSession;
116
- bufferApiCalls.drain();
117
- recorderApi.onRumStart(startRumResults.lifeCycle, configuration, startRumResults.session, startRumResults.viewContexts);
118
- }
20
+ var startRumResult = startRumImpl(configuration, recorderApi, getCommonContext, initialViewOptions, deflateWorker && options.createDeflateEncoder ? function (streamId) {
21
+ return options.createDeflateEncoder(deflateWorker, streamId);
22
+ } : createIdentityEncoder);
23
+ recorderApi.onRumStart(startRumResult.lifeCycle, configuration, startRumResult.session, startRumResult.viewContexts, deflateWorker);
24
+ strategy = createPostStartStrategy(strategy, startRumResult);
25
+ return startRumResult;
26
+ });
119
27
  var startView = monitor(function (options) {
120
28
  var sanitizedOptions = _typeof(options) === 'object' ? options : {
121
29
  name: options
122
30
  };
123
- _startViewStrategy(sanitizedOptions);
31
+ strategy.startView(sanitizedOptions);
32
+ addTelemetryUsage({
33
+ feature: 'start-view'
34
+ });
124
35
  });
125
36
  var rumPublicApi = makePublicApi({
126
- init: monitor(initRum),
37
+ init: monitor(function (initConfiguration) {
38
+ strategy.init(initConfiguration);
39
+ }),
127
40
  /** @deprecated: use setGlobalContextProperty instead */
128
41
  addRumGlobalContext: monitor(function (key, value) {
129
- return globalContextManager.add(key, value);
42
+ globalContextManager.add(key, value);
43
+ addTelemetryUsage({
44
+ feature: 'set-global-context'
45
+ });
130
46
  }),
131
47
  setGlobalContextProperty: monitor(function (key, value) {
132
- return globalContextManager.setContextProperty(key, value);
48
+ globalContextManager.setContextProperty(key, value);
49
+ addTelemetryUsage({
50
+ feature: 'set-global-context'
51
+ });
133
52
  }),
134
53
  /** @deprecated: use removeGlobalContextProperty instead */
135
54
  removeRumGlobalContext: monitor(function (key) {
@@ -147,47 +66,69 @@ export function makeRumPublicApi(startRumImpl, recorderApi) {
147
66
  }),
148
67
  /** @deprecated: use setGlobalContext instead */
149
68
  setRumGlobalContext: monitor(function (context) {
150
- return globalContextManager.set(context);
69
+ globalContextManager.set(context);
70
+ addTelemetryUsage({
71
+ feature: 'set-global-context'
72
+ });
151
73
  }),
152
74
  setGlobalContext: monitor(function (context) {
153
- return globalContextManager.setContext(context);
75
+ globalContextManager.setContext(context);
76
+ addTelemetryUsage({
77
+ feature: 'set-global-context'
78
+ });
154
79
  }),
155
80
  clearGlobalContext: monitor(function () {
156
81
  return globalContextManager.clearContext();
157
82
  }),
158
83
  getInitConfiguration: monitor(function () {
159
- return getInitConfigurationStrategy();
84
+ return deepClone(strategy.getInitConfiguration());
160
85
  }),
161
86
  getInternalContext: monitor(function (startTime) {
162
- return getInternalContextStrategy(startTime);
87
+ return strategy.getInternalContext(startTime);
163
88
  }),
164
89
  addDebugSession: monitor(function (id) {}),
165
90
  clearDebugSession: monitor(function () {}),
166
91
  getDebugSession: monitor(function () {}),
167
92
  addAction: monitor(function (name, context) {
168
- _addActionStrategy({
169
- name: name,
170
- context: deepClone(context),
171
- startClocks: clocksNow(),
172
- type: ActionType.CUSTOM
93
+ var handlingStack = createHandlingStack();
94
+ callMonitored(function () {
95
+ strategy.addAction({
96
+ name: sanitize(name),
97
+ context: sanitize(context),
98
+ startClocks: clocksNow(),
99
+ type: ActionType.CUSTOM,
100
+ handlingStack: handlingStack
101
+ });
102
+ addTelemetryUsage({
103
+ feature: 'add-action'
104
+ });
173
105
  });
174
106
  }),
175
107
  addError: monitor(function (error, context) {
176
108
  var handlingStack = createHandlingStack();
177
- _addErrorStrategy({
178
- error: error,
179
- handlingStack: handlingStack,
180
- context: deepClone(context),
181
- startClocks: clocksNow()
109
+ callMonitored(function () {
110
+ strategy.addError({
111
+ error: error,
112
+ // Do not sanitize error here, it is needed unserialized by computeRawError()
113
+ handlingStack: handlingStack,
114
+ context: sanitize(context),
115
+ startClocks: clocksNow()
116
+ });
117
+ addTelemetryUsage({
118
+ feature: 'add-error'
119
+ });
182
120
  });
183
121
  }),
184
122
  addTiming: monitor(function (name, time) {
185
- _addTimingStrategy(name, time);
123
+ strategy.addTiming(sanitize(name), time);
186
124
  }),
187
125
  setUser: monitor(function (newUser) {
188
126
  if (checkUser(newUser)) {
189
127
  userContextManager.setContext(sanitizeUser(newUser));
190
128
  }
129
+ addTelemetryUsage({
130
+ feature: 'set-user'
131
+ });
191
132
  }),
192
133
  getUser: monitor(function () {
193
134
  return userContextManager.getContext();
@@ -197,6 +138,9 @@ export function makeRumPublicApi(startRumImpl, recorderApi) {
197
138
  newUser[key] = property;
198
139
  var sanitizedProperty = sanitizeUser(newUser)[key];
199
140
  userContextManager.setContextProperty(key, sanitizedProperty);
141
+ addTelemetryUsage({
142
+ feature: 'set-user'
143
+ });
200
144
  }),
201
145
  removeUserProperty: monitor(function (key) {
202
146
  return userContextManager.removeContextProperty(key);
@@ -210,40 +154,30 @@ export function makeRumPublicApi(startRumImpl, recorderApi) {
210
154
  }),
211
155
  startView: startView,
212
156
  stopSession: monitor(function () {
213
- stopSessionStrategy();
157
+ strategy.stopSession();
158
+ addTelemetryUsage({
159
+ feature: 'stop-session'
160
+ });
161
+ }),
162
+ startSessionReplayRecording: monitor(function (options) {
163
+ recorderApi.start(options);
164
+ addTelemetryUsage({
165
+ feature: 'start-session-replay-recording',
166
+ force: options && options.force
167
+ });
214
168
  }),
215
- startSessionReplayRecording: monitor(recorderApi.start),
216
169
  stopSessionReplayRecording: monitor(recorderApi.stop)
217
170
  });
218
171
  return rumPublicApi;
219
- function canHandleSession(initConfiguration) {
220
- if (!areCookiesAuthorized(buildCookieOptions(initConfiguration))) {
221
- display.warn('Cookies are not authorized, we will not send any data.');
222
- return false;
223
- }
224
- if (isLocalFile()) {
225
- display.error('Execution is not allowed in the current context.');
226
- return false;
227
- }
228
- return true;
229
- }
230
- function canInitRum(initConfiguration) {
231
- if (isAlreadyInitialized) {
232
- if (!initConfiguration.silentMultipleInit) {
233
- display.error('DATAFLUX_RUM is already initialized.');
234
- }
235
- return false;
172
+ }
173
+ function createPostStartStrategy(preStartStrategy, startRumResult) {
174
+ return assign({
175
+ init: function init(initConfiguration) {
176
+ displayAlreadyInitializedError('DATAFLUX_RUM', initConfiguration);
177
+ },
178
+ getInitConfiguration: function getInitConfiguration() {
179
+ return preStartStrategy.initConfiguration;
236
180
  }
237
- return true;
238
- }
239
- function isLocalFile() {
240
- return window.location.protocol === 'file:';
241
- }
242
- function overrideInitConfigurationForBridge(initConfiguration) {
243
- return assign({}, initConfiguration, {
244
- applicationId: '00000000-aaaa-0000-aaaa-000000000000',
245
- sessionSampleRate: 100
246
- });
247
- }
181
+ }, startRumResult);
248
182
  }
249
183
  //# sourceMappingURL=rumPublicApi.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rumPublicApi.js","names":["makePublicApi","areCookiesAuthorized","BoundedBuffer","display","buildCookieOptions","createContextManager","CustomerDataType","clocksNow","timeStampNow","ActionType","deepClone","createHandlingStack","sanitizeUser","checkUser","noop","assign","canUseEventBridge","monitor","storeContextManager","validateAndBuildRumConfiguration","buildCommonContext","RUM_STORAGE_KEY","makeRumPublicApi","startRumImpl","recorderApi","isAlreadyInitialized","globalContextManager","GlobalContext","userContextManager","User","getInternalContextStrategy","undefined","getInitConfigurationStrategy","stopSessionStrategy","bufferApiCalls","addTimingStrategy","name","time","add","startViewStrategy","options","startClocks","addActionStrategy","action","commonContext","addErrorStrategy","providedError","initRum","initConfiguration","eventBridgeAvailable","overrideInitConfigurationForBridge","canHandleSession","canInitRum","configuration","trackViewsManually","doStartRum","beforeInitCalls","_startViewStrategy","drain","initialViewOptions","storeContextsToLocal","startRumResults","startView","addAction","addError","addTiming","getInternalContext","stopSession","onRumStart","lifeCycle","session","viewContexts","sanitizedOptions","_typeof","rumPublicApi","init","addRumGlobalContext","key","value","setGlobalContextProperty","setContextProperty","removeRumGlobalContext","remove","removeGlobalContextProperty","removeContextProperty","getRumGlobalContext","get","getGlobalContext","getContext","setRumGlobalContext","context","set","setGlobalContext","setContext","clearGlobalContext","clearContext","getInitConfiguration","startTime","addDebugSession","id","clearDebugSession","getDebugSession","type","CUSTOM","error","handlingStack","setUser","newUser","getUser","setUserProperty","property","sanitizedProperty","removeUserProperty","removeUser","clearUser","startSessionReplayRecording","start","stopSessionReplayRecording","stop","warn","isLocalFile","silentMultipleInit","window","location","protocol","applicationId","sessionSampleRate"],"sources":["../../src/boot/rumPublicApi.js"],"sourcesContent":["import {\n makePublicApi,\n areCookiesAuthorized,\n BoundedBuffer,\n display,\n buildCookieOptions,\n createContextManager,\n CustomerDataType,\n clocksNow,\n timeStampNow,\n ActionType,\n deepClone,\n createHandlingStack,\n sanitizeUser,\n checkUser,\n noop,\n assign,\n canUseEventBridge,\n monitor,\n storeContextManager\n} from '@cloudcare/browser-core'\nimport { validateAndBuildRumConfiguration } from '../domain/configuration'\nimport { buildCommonContext } from '../domain/contexts/commonContext'\nvar RUM_STORAGE_KEY = 'rum'\nexport function makeRumPublicApi(startRumImpl, recorderApi) {\n var isAlreadyInitialized = false\n\n var globalContextManager = createContextManager(\n CustomerDataType.GlobalContext\n )\n var userContextManager = createContextManager(CustomerDataType.User)\n\n var getInternalContextStrategy = function () {\n return undefined\n }\n var getInitConfigurationStrategy = function () {\n return undefined\n }\n var stopSessionStrategy = function () {\n return noop()\n }\n var bufferApiCalls = new BoundedBuffer()\n var addTimingStrategy = function (name, time) {\n if (typeof time === 'undefined') {\n time = timeStampNow()\n }\n bufferApiCalls.add(function () {\n return addTimingStrategy(name, time)\n })\n }\n var startViewStrategy = function (options, startClocks) {\n if (typeof startClocks === 'undefined') {\n startClocks = clocksNow()\n }\n bufferApiCalls.add(function () {\n return startViewStrategy(options, startClocks)\n })\n }\n var addActionStrategy = function (action, commonContext) {\n if (typeof commonContext == 'undefined') {\n commonContext = buildCommonContext(\n globalContextManager,\n userContextManager,\n recorderApi\n )\n }\n bufferApiCalls.add(function () {\n return addActionStrategy(action, commonContext)\n })\n }\n var addErrorStrategy = function (providedError, commonContext) {\n if (typeof commonContext == 'undefined') {\n commonContext = buildCommonContext(\n globalContextManager,\n userContextManager,\n recorderApi\n )\n }\n bufferApiCalls.add(function () {\n return addErrorStrategy(providedError, commonContext)\n })\n }\n\n function initRum(initConfiguration) {\n getInitConfigurationStrategy = function () {\n return deepClone(initConfiguration)\n }\n var eventBridgeAvailable = canUseEventBridge()\n if (eventBridgeAvailable) {\n initConfiguration = overrideInitConfigurationForBridge(initConfiguration)\n }\n if (!canHandleSession(initConfiguration)) {\n return\n }\n\n if (!canInitRum(initConfiguration)) {\n return\n }\n\n var configuration = validateAndBuildRumConfiguration(initConfiguration)\n if (!configuration) {\n return\n }\n\n if (!configuration.trackViewsManually) {\n doStartRum(configuration)\n } else {\n // drain beforeInitCalls by buffering them until we start RUM\n // if we get a startView, drain re-buffered calls before continuing to drain beforeInitCalls\n // in order to ensure that calls are processed in order\n var beforeInitCalls = bufferApiCalls\n bufferApiCalls = new BoundedBuffer()\n\n startViewStrategy = function (options) {\n doStartRum(configuration, options)\n }\n beforeInitCalls.drain()\n }\n\n isAlreadyInitialized = true\n }\n function doStartRum(configuration, initialViewOptions) {\n if (configuration.storeContextsToLocal) {\n storeContextManager(\n configuration,\n globalContextManager,\n RUM_STORAGE_KEY,\n CustomerDataType.GlobalContext\n )\n storeContextManager(\n configuration,\n userContextManager,\n RUM_STORAGE_KEY,\n CustomerDataType.User\n )\n // // localstorage\n // var beforeInitGlobalContext = globalContextManager.getContext()\n // globalContextManager = createStoredContextManager(\n // RUM_STORAGE_KEY,\n // CustomerDataType.GlobalContext\n // )\n // globalContextManager.setContext(\n // extend2Lev(globalContextManager.getContext(), beforeInitGlobalContext)\n // )\n\n // var beforeInitUserContext = userContextManager.getContext()\n // userContextManager = createStoredContextManager(\n // RUM_STORAGE_KEY,\n // CustomerDataType.User\n // )\n // userContextManager.setContext(\n // extend2Lev(userContextManager.getContext(), beforeInitUserContext)\n // )\n }\n var startRumResults = startRumImpl(\n configuration,\n recorderApi,\n globalContextManager,\n userContextManager,\n initialViewOptions\n )\n startViewStrategy = startRumResults.startView\n addActionStrategy = startRumResults.addAction\n addErrorStrategy = startRumResults.addError\n addTimingStrategy = startRumResults.addTiming\n getInternalContextStrategy = startRumResults.getInternalContext\n stopSessionStrategy = startRumResults.stopSession\n bufferApiCalls.drain()\n recorderApi.onRumStart(\n startRumResults.lifeCycle,\n configuration,\n startRumResults.session,\n startRumResults.viewContexts\n )\n }\n var startView = monitor(function (options) {\n var sanitizedOptions =\n typeof options === 'object' ? options : { name: options }\n startViewStrategy(sanitizedOptions)\n })\n var rumPublicApi = makePublicApi({\n init: monitor(initRum),\n /** @deprecated: use setGlobalContextProperty instead */\n addRumGlobalContext: monitor(function (key, value) {\n return globalContextManager.add(key, value)\n }),\n setGlobalContextProperty: monitor(function (key, value) {\n return globalContextManager.setContextProperty(key, value)\n }),\n\n /** @deprecated: use removeGlobalContextProperty instead */\n removeRumGlobalContext: monitor(function (key) {\n return globalContextManager.remove(key)\n }),\n removeGlobalContextProperty: monitor(function (key) {\n return globalContextManager.removeContextProperty(key)\n }),\n\n /** @deprecated: use getGlobalContext instead */\n getRumGlobalContext: monitor(function () {\n return globalContextManager.get()\n }),\n getGlobalContext: monitor(function () {\n return globalContextManager.getContext()\n }),\n\n /** @deprecated: use setGlobalContext instead */\n setRumGlobalContext: monitor(function (context) {\n return globalContextManager.set(context)\n }),\n setGlobalContext: monitor(function (context) {\n return globalContextManager.setContext(context)\n }),\n\n clearGlobalContext: monitor(function () {\n return globalContextManager.clearContext()\n }),\n\n getInitConfiguration: monitor(function () {\n return getInitConfigurationStrategy()\n }),\n getInternalContext: monitor(function (startTime) {\n return getInternalContextStrategy(startTime)\n }),\n addDebugSession: monitor(function (id) {}),\n clearDebugSession: monitor(function () {}),\n getDebugSession: monitor(function () {}),\n addAction: monitor(function (name, context) {\n addActionStrategy({\n name: name,\n context: deepClone(context),\n startClocks: clocksNow(),\n type: ActionType.CUSTOM\n })\n }),\n addError: monitor(function (error, context) {\n var handlingStack = createHandlingStack()\n addErrorStrategy({\n error: error,\n handlingStack: handlingStack,\n context: deepClone(context),\n startClocks: clocksNow()\n })\n }),\n addTiming: monitor(function (name, time) {\n addTimingStrategy(name, time)\n }),\n setUser: monitor(function (newUser) {\n if (checkUser(newUser)) {\n userContextManager.setContext(sanitizeUser(newUser))\n }\n }),\n getUser: monitor(function () {\n return userContextManager.getContext()\n }),\n setUserProperty: monitor(function (key, property) {\n var newUser = {}\n newUser[key] = property\n var sanitizedProperty = sanitizeUser(newUser)[key]\n userContextManager.setContextProperty(key, sanitizedProperty)\n }),\n removeUserProperty: monitor(function (key) {\n return userContextManager.removeContextProperty(key)\n }),\n\n /** @deprecated: renamed to clearUser */\n removeUser: monitor(function () {\n return userContextManager.clearContext()\n }),\n clearUser: monitor(function () {\n return userContextManager.clearContext()\n }),\n startView: startView,\n stopSession: monitor(function () {\n stopSessionStrategy()\n }),\n startSessionReplayRecording: monitor(recorderApi.start),\n stopSessionReplayRecording: monitor(recorderApi.stop)\n })\n return rumPublicApi\n function canHandleSession(initConfiguration) {\n if (!areCookiesAuthorized(buildCookieOptions(initConfiguration))) {\n display.warn('Cookies are not authorized, we will not send any data.')\n return false\n }\n\n if (isLocalFile()) {\n display.error('Execution is not allowed in the current context.')\n return false\n }\n return true\n }\n function canInitRum(initConfiguration) {\n if (isAlreadyInitialized) {\n if (!initConfiguration.silentMultipleInit) {\n display.error('DATAFLUX_RUM is already initialized.')\n }\n return false\n }\n return true\n }\n function isLocalFile() {\n return window.location.protocol === 'file:'\n }\n function overrideInitConfigurationForBridge(initConfiguration) {\n return assign({}, initConfiguration, {\n applicationId: '00000000-aaaa-0000-aaaa-000000000000',\n sessionSampleRate: 100\n })\n }\n}\n"],"mappings":";AAAA,SACEA,aAAa,EACbC,oBAAoB,EACpBC,aAAa,EACbC,OAAO,EACPC,kBAAkB,EAClBC,oBAAoB,EACpBC,gBAAgB,EAChBC,SAAS,EACTC,YAAY,EACZC,UAAU,EACVC,SAAS,EACTC,mBAAmB,EACnBC,YAAY,EACZC,SAAS,EACTC,IAAI,EACJC,MAAM,EACNC,iBAAiB,EACjBC,OAAO,EACPC,mBAAmB,QACd,yBAAyB;AAChC,SAASC,gCAAgC,QAAQ,yBAAyB;AAC1E,SAASC,kBAAkB,QAAQ,kCAAkC;AACrE,IAAIC,eAAe,GAAG,KAAK;AAC3B,OAAO,SAASC,gBAAgBA,CAACC,YAAY,EAAEC,WAAW,EAAE;EAC1D,IAAIC,oBAAoB,GAAG,KAAK;EAEhC,IAAIC,oBAAoB,GAAGrB,oBAAoB,CAC7CC,gBAAgB,CAACqB,aACnB,CAAC;EACD,IAAIC,kBAAkB,GA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AAO,KAAK;IACd;IAEA,IAAIC,WAAW,CAAC,CAAC,EAAE;MACjBrH,OAAO,CAACqG,KAAK,CAAC,kDAAkD,CAAC;MACjE,OAAO,KAAK;IACd;IACA,OAAO,IAAI;EACb;EACA,SAASpD,UAAUA,CAACJ,iBAAiB,EAAE;IACrC,IAAIvB,oBAAoB,EAAE;MACxB,IAAI,CAACuB,iBAAiB,CAACyE,kBAAkB,EAAE;QACzCtH,OAAO,CAACqG,KAAK,CAAC,sCAAsC,CAAC;MACvD;MACA,OAAO,KAAK;IACd;IACA,OAAO,IAAI;EACb;EACA,SAASgB,WAAWA,CAAA,EAAG;IACrB,OAAOE,MAAM,CAACC,QAAQ,CAACC,QAAQ,KAAK,OAAO;EAC7C;EACA,SAAS1E,kCAAkCA,CAACF,iBAAiB,EAAE;IAC7D,OAAOjC,MAAM,CAAC,CAAC,CAAC,EAAEiC,iBAAiB,EAAE;MACnC6E,aAAa,EAAE,sCAAsC;MACrDC,iBAAiB,EAAE;IACrB,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
1
+ {"version":3,"file":"rumPublicApi.js","names":["makePublicApi","createContextManager","CustomerDataType","clocksNow","ActionType","deepClone","createHandlingStack","sanitizeUser","checkUser","callMonitored","assign","monitor","storeContextManager","createIdentityEncoder","addTelemetryUsage","sanitize","displayAlreadyInitializedError","buildCommonContext","createPreStartStrategy","RUM_STORAGE_KEY","makeRumPublicApi","startRumImpl","recorderApi","options","undefined","globalContextManager","GlobalContext","userContextManager","User","getCommonContext","strategy","configuration","deflateWorker","initialViewOptions","storeContextsToLocal","startRumResult","createDeflateEncoder","streamId","onRumStart","lifeCycle","session","viewContexts","createPostStartStrategy","startView","sanitizedOptions","_typeof","name","feature","rumPublicApi","init","initConfiguration","addRumGlobalContext","key","value","add","setGlobalContextProperty","setContextProperty","removeRumGlobalContext","remove","removeGlobalContextProperty","removeContextProperty","getRumGlobalContext","get","getGlobalContext","getContext","setRumGlobalContext","context","set","setGlobalContext","setContext","clearGlobalContext","clearContext","getInitConfiguration","getInternalContext","startTime","addDebugSession","id","clearDebugSession","getDebugSession","addAction","handlingStack","startClocks","type","CUSTOM","addError","error","addTiming","time","setUser","newUser","getUser","setUserProperty","property","sanitizedProperty","removeUserProperty","removeUser","clearUser","stopSession","startSessionReplayRecording","start","force","stopSessionReplayRecording","stop","preStartStrategy"],"sources":["../../src/boot/rumPublicApi.js"],"sourcesContent":["import {\n makePublicApi,\n createContextManager,\n CustomerDataType,\n clocksNow,\n ActionType,\n deepClone,\n createHandlingStack,\n sanitizeUser,\n checkUser,\n callMonitored,\n assign,\n monitor,\n storeContextManager,\n createIdentityEncoder,\n addTelemetryUsage,\n sanitize,\n displayAlreadyInitializedError\n} from '@cloudcare/browser-core'\nimport { buildCommonContext } from '../domain/contexts/commonContext'\nimport { createPreStartStrategy } from './perStartRum'\nvar RUM_STORAGE_KEY = 'rum'\nexport function makeRumPublicApi(startRumImpl, recorderApi, options) {\n if (options === undefined) {\n options = {}\n }\n\n var globalContextManager = createContextManager(\n CustomerDataType.GlobalContext\n )\n var userContextManager = createContextManager(CustomerDataType.User)\n function getCommonContext() {\n return buildCommonContext(\n globalContextManager,\n userContextManager,\n recorderApi\n )\n }\n let strategy = createPreStartStrategy(\n options,\n getCommonContext,\n function (configuration, deflateWorker, initialViewOptions) {\n if (configuration.storeContextsToLocal) {\n storeContextManager(\n configuration,\n globalContextManager,\n RUM_STORAGE_KEY,\n CustomerDataType.GlobalContext\n )\n storeContextManager(\n configuration,\n userContextManager,\n RUM_STORAGE_KEY,\n CustomerDataType.User\n )\n }\n\n var startRumResult = startRumImpl(\n configuration,\n recorderApi,\n getCommonContext,\n initialViewOptions,\n deflateWorker && options.createDeflateEncoder\n ? function (streamId) {\n return options.createDeflateEncoder(deflateWorker, streamId)\n }\n : createIdentityEncoder\n )\n\n recorderApi.onRumStart(\n startRumResult.lifeCycle,\n configuration,\n startRumResult.session,\n startRumResult.viewContexts,\n deflateWorker\n )\n\n strategy = createPostStartStrategy(strategy, startRumResult)\n\n return startRumResult\n }\n )\n\n const startView = monitor(function (options) {\n const sanitizedOptions =\n typeof options === 'object' ? options : { name: options }\n strategy.startView(sanitizedOptions)\n addTelemetryUsage({ feature: 'start-view' })\n })\n\n var rumPublicApi = makePublicApi({\n init: monitor(function (initConfiguration) {\n strategy.init(initConfiguration)\n }),\n /** @deprecated: use setGlobalContextProperty instead */\n addRumGlobalContext: monitor(function (key, value) {\n globalContextManager.add(key, value)\n addTelemetryUsage({ feature: 'set-global-context' })\n }),\n setGlobalContextProperty: monitor(function (key, value) {\n globalContextManager.setContextProperty(key, value)\n addTelemetryUsage({ feature: 'set-global-context' })\n }),\n\n /** @deprecated: use removeGlobalContextProperty instead */\n removeRumGlobalContext: monitor(function (key) {\n return globalContextManager.remove(key)\n }),\n removeGlobalContextProperty: monitor(function (key) {\n return globalContextManager.removeContextProperty(key)\n }),\n\n /** @deprecated: use getGlobalContext instead */\n getRumGlobalContext: monitor(function () {\n return globalContextManager.get()\n }),\n getGlobalContext: monitor(function () {\n return globalContextManager.getContext()\n }),\n\n /** @deprecated: use setGlobalContext instead */\n setRumGlobalContext: monitor(function (context) {\n globalContextManager.set(context)\n addTelemetryUsage({ feature: 'set-global-context' })\n }),\n setGlobalContext: monitor(function (context) {\n globalContextManager.setContext(context)\n addTelemetryUsage({ feature: 'set-global-context' })\n }),\n\n clearGlobalContext: monitor(function () {\n return globalContextManager.clearContext()\n }),\n\n getInitConfiguration: monitor(function () {\n return deepClone(strategy.getInitConfiguration())\n }),\n getInternalContext: monitor(function (startTime) {\n return strategy.getInternalContext(startTime)\n }),\n addDebugSession: monitor(function (id) {}),\n clearDebugSession: monitor(function () {}),\n getDebugSession: monitor(function () {}),\n addAction: monitor(function (name, context) {\n const handlingStack = createHandlingStack()\n\n callMonitored(function () {\n strategy.addAction({\n name: sanitize(name),\n context: sanitize(context),\n startClocks: clocksNow(),\n type: ActionType.CUSTOM,\n handlingStack: handlingStack\n })\n addTelemetryUsage({ feature: 'add-action' })\n })\n }),\n addError: monitor(function (error, context) {\n var handlingStack = createHandlingStack()\n callMonitored(function () {\n strategy.addError({\n error, // Do not sanitize error here, it is needed unserialized by computeRawError()\n handlingStack,\n context: sanitize(context),\n startClocks: clocksNow()\n })\n addTelemetryUsage({ feature: 'add-error' })\n })\n }),\n addTiming: monitor(function (name, time) {\n strategy.addTiming(sanitize(name), time)\n }),\n setUser: monitor(function (newUser) {\n if (checkUser(newUser)) {\n userContextManager.setContext(sanitizeUser(newUser))\n }\n addTelemetryUsage({ feature: 'set-user' })\n }),\n getUser: monitor(function () {\n return userContextManager.getContext()\n }),\n setUserProperty: monitor(function (key, property) {\n var newUser = {}\n newUser[key] = property\n var sanitizedProperty = sanitizeUser(newUser)[key]\n userContextManager.setContextProperty(key, sanitizedProperty)\n addTelemetryUsage({ feature: 'set-user' })\n }),\n removeUserProperty: monitor(function (key) {\n return userContextManager.removeContextProperty(key)\n }),\n\n /** @deprecated: renamed to clearUser */\n removeUser: monitor(function () {\n return userContextManager.clearContext()\n }),\n clearUser: monitor(function () {\n return userContextManager.clearContext()\n }),\n startView: startView,\n stopSession: monitor(function () {\n strategy.stopSession()\n addTelemetryUsage({ feature: 'stop-session' })\n }),\n startSessionReplayRecording: monitor(function (options) {\n recorderApi.start(options)\n addTelemetryUsage({\n feature: 'start-session-replay-recording',\n force: options && options.force\n })\n }),\n stopSessionReplayRecording: monitor(recorderApi.stop)\n })\n return rumPublicApi\n}\nfunction createPostStartStrategy(preStartStrategy, startRumResult) {\n return assign(\n {\n init: function (initConfiguration) {\n displayAlreadyInitializedError('DATAFLUX_RUM', initConfiguration)\n },\n getInitConfiguration: function () {\n return preStartStrategy.initConfiguration\n }\n },\n startRumResult\n )\n}\n"],"mappings":";AAAA,SACEA,aAAa,EACbC,oBAAoB,EACpBC,gBAAgB,EAChBC,SAAS,EACTC,UAAU,EACVC,SAAS,EACTC,mBAAmB,EACnBC,YAAY,EACZC,SAAS,EACTC,aAAa,EACbC,MAAM,EACNC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CAAC,CAAC;IACFmD,2BAA2B,EAAEvF,OAAO,CAAC,UAAUY,OAAO,EAAE;MACtDD,WAAW,CAAC6E,KAAK,CAAC5E,OAAO,CAAC;MAC1BT,iBAAiB,CAAC;QAChBiC,OAAO,EAAE,gCAAgC;QACzCqD,KAAK,EAAE7E,OAAO,IAAIA,OAAO,CAAC6E;MAC5B,CAAC,CAAC;IACJ,CAAC,CAAC;IACFC,0BAA0B,EAAE1F,OAAO,CAACW,WAAW,CAACgF,IAAI;EACtD,CAAC,CAAC;EACF,OAAOtD,YAAY;AACrB;AACA,SAASN,uBAAuBA,CAAC6D,gBAAgB,EAAEpE,cAAc,EAAE;EACjE,OAAOzB,MAAM,CACX;IACEuC,IAAI,EAAE,SAAAA,KAAUC,iBAAiB,EAAE;MACjClC,8BAA8B,CAAC,cAAc,EAAEkC,iBAAiB,CAAC;IACnE,CAAC;IACDsB,oBAAoB,EAAE,SAAAA,qBAAA,EAAY;MAChC,OAAO+B,gBAAgB,CAACrD,iBAAiB;IAC3C;EACF,CAAC,EACDf,cACF,CAAC;AACH","ignoreList":[]}
@@ -3,6 +3,7 @@ import { record } from '../domain/replay/record';
3
3
  import { startSegmentCollection, SEGMENT_BYTES_LIMIT } from '../domain/replay/segmentCollection';
4
4
  import { RecordType } from '../types';
5
5
  export function startRecording(lifeCycle, configuration, sessionManager, viewContexts, encoder, httpRequest) {
6
+ var cleanupTasks = [];
6
7
  var reportError = function reportError(error) {
7
8
  lifeCycle.notify(LifeCycleEventType.RAW_ERROR_COLLECTED, {
8
9
  error: error
@@ -11,16 +12,16 @@ export function startRecording(lifeCycle, configuration, sessionManager, viewCon
11
12
  'error.message': error.message
12
13
  });
13
14
  };
14
- var replayRequest = httpRequest || createHttpRequest(configuration.sessionReplayEndPoint, SEGMENT_BYTES_LIMIT, false, reportError);
15
+ var replayRequest = httpRequest || createHttpRequest(configuration.sessionReplayEndPoint, SEGMENT_BYTES_LIMIT, reportError);
15
16
  var segmentCollection = startSegmentCollection(lifeCycle, configuration, sessionManager, viewContexts, replayRequest, encoder);
16
17
  var addRecord = segmentCollection.addRecord;
17
- var stopSegmentCollection = segmentCollection.stop;
18
+ cleanupTasks.push(segmentCollection.stop);
18
19
  var _record = record({
19
20
  emit: addRecord,
20
21
  configuration: configuration,
21
22
  lifeCycle: lifeCycle
22
23
  });
23
- var stopRecording = _record.stop;
24
+ cleanupTasks.push(_record.stop);
24
25
  var takeSubsequentFullSnapshot = _record.takeSubsequentFullSnapshot;
25
26
  var flushMutations = _record.flushMutations;
26
27
  var subscribeViewEnded = lifeCycle.subscribe(LifeCycleEventType.VIEW_ENDED, function () {
@@ -30,15 +31,16 @@ export function startRecording(lifeCycle, configuration, sessionManager, viewCon
30
31
  type: RecordType.ViewEnd
31
32
  });
32
33
  });
34
+ cleanupTasks.push(subscribeViewEnded.unsubscribe);
33
35
  var scribeViewCreated = lifeCycle.subscribe(LifeCycleEventType.VIEW_CREATED, function (view) {
34
36
  takeSubsequentFullSnapshot(view.startClocks.timeStamp);
35
37
  });
38
+ cleanupTasks.push(scribeViewCreated.unsubscribe);
36
39
  return {
37
40
  stop: function stop() {
38
- subscribeViewEnded.unsubscribe();
39
- scribeViewCreated.unsubscribe();
40
- stopRecording();
41
- stopSegmentCollection();
41
+ cleanupTasks.forEach(function (task) {
42
+ task();
43
+ });
42
44
  }
43
45
  };
44
46
  }
@@ -1 +1 @@
1
- {"version":3,"file":"startRecording.js","names":["timeStampNow","createHttpRequest","LifeCycleEventType","addTelemetryDebug","record","startSegmentCollection","SEGMENT_BYTES_LIMIT","RecordType","startRecording","lifeCycle","configuration","sessionManager","viewContexts","encoder","httpRequest","reportError","error","notify","RAW_ERROR_COLLECTED","message","replayRequest","sessionReplayEndPoint","segmentCollection","addRecord","stopSegmentCollection","stop","_record","emit","stopRecording","takeSubsequentFullSnapshot","flushMutations","subscribeViewEnded","subscribe","VIEW_ENDED","timestamp","type","ViewEnd","scribeViewCreated","VIEW_CREATED","view","startClocks","timeStamp","unsubscribe"],"sources":["../../src/boot/startRecording.js"],"sourcesContent":["import {\n timeStampNow,\n createHttpRequest,\n LifeCycleEventType,\n addTelemetryDebug\n} from '@cloudcare/browser-core'\nimport { record } from '../domain/replay/record'\nimport {\n startSegmentCollection,\n SEGMENT_BYTES_LIMIT\n} from '../domain/replay/segmentCollection'\nimport { RecordType } from '../types'\n\nexport function startRecording(\n lifeCycle,\n configuration,\n sessionManager,\n viewContexts,\n encoder,\n httpRequest\n) {\n var reportError = function (error) {\n lifeCycle.notify(LifeCycleEventType.RAW_ERROR_COLLECTED, { error: error })\n addTelemetryDebug('Error reported to customer', {\n 'error.message': error.message\n })\n }\n\n var replayRequest =\n httpRequest ||\n createHttpRequest(\n configuration.sessionReplayEndPoint,\n SEGMENT_BYTES_LIMIT,\n false,\n reportError\n )\n\n var segmentCollection = startSegmentCollection(\n lifeCycle,\n configuration,\n sessionManager,\n viewContexts,\n replayRequest,\n encoder\n )\n var addRecord = segmentCollection.addRecord\n var stopSegmentCollection = segmentCollection.stop\n\n var _record = record({\n emit: addRecord,\n configuration: configuration,\n lifeCycle: lifeCycle\n })\n var stopRecording = _record.stop\n var takeSubsequentFullSnapshot = _record.takeSubsequentFullSnapshot\n var flushMutations = _record.flushMutations\n var subscribeViewEnded = lifeCycle.subscribe(\n LifeCycleEventType.VIEW_ENDED,\n function () {\n flushMutations()\n addRecord({\n timestamp: timeStampNow(),\n type: RecordType.ViewEnd\n })\n }\n )\n var scribeViewCreated = lifeCycle.subscribe(\n LifeCycleEventType.VIEW_CREATED,\n function (view) {\n takeSubsequentFullSnapshot(view.startClocks.timeStamp)\n }\n )\n\n return {\n stop: function () {\n subscribeViewEnded.unsubscribe()\n scribeViewCreated.unsubscribe()\n stopRecording()\n stopSegmentCollection()\n }\n }\n}\n"],"mappings":"AAAA,SACEA,YAAY,EACZC,iBAAiB,EACjBC,kBAAkB,EAClBC,iBAAiB,QACZ,yBAAyB;AAChC,SAASC,MAAM,QAAQ,yBAAyB;AAChD,SACEC,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B,UAAU,CAAC6B;IACnB,CAAC,CAAC;EACJ,CACF,CAAC;EACD,IAAIC,iBAAiB,GAAG5B,SAAS,CAACuB,SAAS,CACzC9B,kBAAkB,CAACoC,YAAY,EAC/B,UAAUC,IAAI,EAAE;IACdV,0BAA0B,CAACU,IAAI,CAACC,WAAW,CAACC,SAAS,CAAC;EACxD,CACF,CAAC;EAED,OAAO;IACLhB,IAAI,EAAE,SAAAA,KAAA,EAAY;MAChBM,kBAAkB,CAACW,WAAW,CAAC,CAAC;MAChCL,iBAAiB,CAACK,WAAW,CAAC,CAAC;MAC/Bd,aAAa,CAAC,CAAC;MACfJ,qBAAqB,CAAC,CAAC;IACzB;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"startRecording.js","names":["timeStampNow","createHttpRequest","LifeCycleEventType","addTelemetryDebug","record","startSegmentCollection","SEGMENT_BYTES_LIMIT","RecordType","startRecording","lifeCycle","configuration","sessionManager","viewContexts","encoder","httpRequest","cleanupTasks","reportError","error","notify","RAW_ERROR_COLLECTED","message","replayRequest","sessionReplayEndPoint","segmentCollection","addRecord","push","stop","_record","emit","takeSubsequentFullSnapshot","flushMutations","subscribeViewEnded","subscribe","VIEW_ENDED","timestamp","type","ViewEnd","unsubscribe","scribeViewCreated","VIEW_CREATED","view","startClocks","timeStamp","forEach","task"],"sources":["../../src/boot/startRecording.js"],"sourcesContent":["import {\n timeStampNow,\n createHttpRequest,\n LifeCycleEventType,\n addTelemetryDebug\n} from '@cloudcare/browser-core'\nimport { record } from '../domain/replay/record'\nimport {\n startSegmentCollection,\n SEGMENT_BYTES_LIMIT\n} from '../domain/replay/segmentCollection'\nimport { RecordType } from '../types'\n\nexport function startRecording(\n lifeCycle,\n configuration,\n sessionManager,\n viewContexts,\n encoder,\n httpRequest\n) {\n var cleanupTasks = []\n var reportError = function (error) {\n lifeCycle.notify(LifeCycleEventType.RAW_ERROR_COLLECTED, { error: error })\n addTelemetryDebug('Error reported to customer', {\n 'error.message': error.message\n })\n }\n\n var replayRequest =\n httpRequest ||\n createHttpRequest(\n configuration.sessionReplayEndPoint,\n SEGMENT_BYTES_LIMIT,\n reportError\n )\n\n var segmentCollection = startSegmentCollection(\n lifeCycle,\n configuration,\n sessionManager,\n viewContexts,\n replayRequest,\n encoder\n )\n var addRecord = segmentCollection.addRecord\n cleanupTasks.push(segmentCollection.stop)\n var _record = record({\n emit: addRecord,\n configuration: configuration,\n lifeCycle: lifeCycle\n })\n cleanupTasks.push(_record.stop)\n var takeSubsequentFullSnapshot = _record.takeSubsequentFullSnapshot\n var flushMutations = _record.flushMutations\n var subscribeViewEnded = lifeCycle.subscribe(\n LifeCycleEventType.VIEW_ENDED,\n function () {\n flushMutations()\n addRecord({\n timestamp: timeStampNow(),\n type: RecordType.ViewEnd\n })\n }\n )\n cleanupTasks.push(subscribeViewEnded.unsubscribe)\n var scribeViewCreated = lifeCycle.subscribe(\n LifeCycleEventType.VIEW_CREATED,\n function (view) {\n takeSubsequentFullSnapshot(view.startClocks.timeStamp)\n }\n )\n cleanupTasks.push(scribeViewCreated.unsubscribe)\n return {\n stop: function () {\n cleanupTasks.forEach(function (task) {\n task()\n })\n }\n }\n}\n"],"mappings":"AAAA,SACEA,YAAY,EACZC,iBAAiB,EACjBC,kBAAkB,EAClBC,iBAAiB,QACZ,yBAAyB;AAChC,SAASC,MAAM,QAAQ,yBAAyB;AAChD,SACEC,sBAAsB,EACtBC,mBAAmB,QACd,oCAAoC;AAC3C,SAASC,UAAU,QAAQ,UAAU;AAErC,OAAO,SAASC,cAAcA,CAC5BC,SAAS,EACTC,aAAa,EACbC,cAAc,EACdC,YAAY,EACZC,OAAO,EACPC,WAAW,EACX;EACA,IAAIC,YAAY,GAAG,EAAE;EACrB,IAAIC,WAAW,GAAG,SAAdA,WAAWA,CAAaC,KAAK,EAAE;IACjCR,SAAS,CAACS,MAAM,CAAChB,kBAAkB,CAACiB,mBAAmB,EAAE;MAAEF,KAAK,EAAEA;IAAM,CAAC,CAAC;IAC1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ACD,WAAW,CAAC;EAChD,OAAO;IACLX,IAAI,EAAE,SAAAA,KAAA,EAAY;MAChBX,YAAY,CAAC4B,OAAO,CAAC,UAAUC,IAAI,EAAE;QACnCA,IAAI,CAAC,CAAC;MACR,CAAC,CAAC;IACJ;EACF,CAAC;AACH","ignoreList":[]}
@@ -11,7 +11,7 @@ var USER_CUSTOMIZABLE_FIELD_PATHS = {
11
11
  context: 'object'
12
12
  };
13
13
  var modifiableFieldPathsByEvent = {};
14
- export function startRumAssembly(configuration, lifeCycle, sessionManager, userSessionManager, viewContexts, urlContexts, actionContexts, displayContext, buildCommonContext, reportError) {
14
+ export function startRumAssembly(configuration, lifeCycle, sessionManager, userSessionManager, viewContexts, urlContexts, actionContexts, displayContext, getCommonContext, reportError) {
15
15
  modifiableFieldPathsByEvent[RumEventType.VIEW] = VIEW_MODIFIABLE_FIELD_PATHS;
16
16
  modifiableFieldPathsByEvent[RumEventType.ERROR] = assign({
17
17
  'error.message': 'string',
@@ -36,11 +36,11 @@ export function startRumAssembly(configuration, lifeCycle, sessionManager, userS
36
36
  var domainContext = data.domainContext;
37
37
  var viewContext = viewContexts.findView(startTime);
38
38
  var urlContext = urlContexts.findUrl(startTime);
39
- var session = sessionManager.findTrackedSession(rawRumEvent.type !== RumEventType.VIEW ? startTime : undefined);
39
+ var session = sessionManager.findTrackedSession(startTime);
40
40
  if (session && viewContext && urlContext) {
41
41
  var actionId = actionContexts.findActionId(startTime);
42
42
  var actionIds = actionContexts.findAllActionId(startTime);
43
- var commonContext = savedCommonContext || buildCommonContext();
43
+ var commonContext = savedCommonContext || getCommonContext();
44
44
  var rumContext = {
45
45
  _gc: {
46
46
  sdkName: configuration.sdkName,
@@ -1 +1 @@
1
- {"version":3,"file":"assembly.js","names":["extend2Lev","withSnakeCaseKeys","timeStampNow","isEmptyObject","LifeCycleEventType","RumEventType","deviceInfo","currentDrift","createEventRateLimiter","limitModification","display","assign","round","SessionType","SYNTHETICS","USER","VIEW_MODIFIABLE_FIELD_PATHS","USER_CUSTOMIZABLE_FIELD_PATHS","context","modifiableFieldPathsByEvent","startRumAssembly","configuration","lifeCycle","sessionManager","userSessionManager","viewContexts","urlContexts","actionContexts","displayContext","buildCommonContext","reportError","VIEW","ERROR","RESOURCE","ACTION","LONG_TASK","eventRateLimiters","eventRateLimiterThreshold","subscribe","RAW_RUM_EVENT_COLLECTED","data","startTime","rawRumEvent","savedCommonContext","customerContext","domainContext","viewContext","findView","urlContext","findUrl","session","findTrackedSession","type","undefined","actionId","findActionId","actionIds","findAllActionId","commonContext","rumContext","_gc","sdkName","sdkVersion","drift","session_sample_rate","sessionSampleRate","session_replay_sample_rate","sessionReplaySampleRate","terminal","application","id","applicationId","device","env","service","version","source","date","user","getId","is_signin","is_login","getSessionType","view","name","url","referrer","host","path","pathGroup","urlQuery","action","needToAssembleWithAction","ids","get","rumEvent","serverRumEvent","has_replay","hasReplay","sampled_for_replay","sessionReplayAllowed","shouldSend","beforeSend","notify","RUM_EVENT_COLLECTED","event","result","warn","rateLimitReached","isLimitReached","indexOf","window","_DATAFLUX_SYNTHETICS_BROWSER"],"sources":["../../src/domain/assembly.js"],"sourcesContent":["import {\n extend2Lev,\n withSnakeCaseKeys,\n timeStampNow,\n isEmptyObject,\n LifeCycleEventType,\n RumEventType,\n deviceInfo,\n currentDrift,\n createEventRateLimiter,\n limitModification,\n display,\n assign,\n round\n} from '@cloudcare/browser-core'\nvar SessionType = {\n SYNTHETICS: 'synthetics',\n USER: 'user'\n}\n\nvar VIEW_MODIFIABLE_FIELD_PATHS = {\n 'view.url': 'string',\n 'view.referrer': 'string'\n}\n\nvar USER_CUSTOMIZABLE_FIELD_PATHS = {\n context: 'object'\n}\n\nvar modifiableFieldPathsByEvent = {}\nexport function startRumAssembly(\n configuration,\n lifeCycle,\n sessionManager,\n userSessionManager,\n viewContexts,\n urlContexts,\n actionContexts,\n displayContext,\n buildCommonContext,\n reportError\n) {\n modifiableFieldPathsByEvent[RumEventType.VIEW] = VIEW_MODIFIABLE_FIELD_PATHS\n modifiableFieldPathsByEvent[RumEventType.ERROR] = assign(\n {\n 'error.message': 'string',\n 'error.stack': 'string',\n 'error.resource.url': 'string'\n },\n USER_CUSTOMIZABLE_FIELD_PATHS,\n VIEW_MODIFIABLE_FIELD_PATHS\n )\n modifiableFieldPathsByEvent[RumEventType.RESOURCE] = assign(\n {\n 'resource.url': 'string'\n },\n USER_CUSTOMIZABLE_FIELD_PATHS,\n VIEW_MODIFIABLE_FIELD_PATHS\n )\n modifiableFieldPathsByEvent[RumEventType.ACTION] = assign(\n {\n 'action.target.name': 'string'\n },\n USER_CUSTOMIZABLE_FIELD_PATHS,\n VIEW_MODIFIABLE_FIELD_PATHS\n )\n modifiableFieldPathsByEvent[RumEventType.LONG_TASK] = assign(\n {},\n USER_CUSTOMIZABLE_FIELD_PATHS,\n VIEW_MODIFIABLE_FIELD_PATHS\n )\n var eventRateLimiters = {}\n eventRateLimiters[RumEventType.ERROR] = createEventRateLimiter(\n RumEventType.ERROR,\n configuration.eventRateLimiterThreshold,\n reportError\n )\n eventRateLimiters[RumEventType.ACTION] = createEventRateLimiter(\n RumEventType.ACTION,\n configuration.eventRateLimiterThreshold,\n reportError\n )\n lifeCycle.subscribe(\n LifeCycleEventType.RAW_RUM_EVENT_COLLECTED,\n function (data) {\n var startTime = data.startTime\n var rawRumEvent = data.rawRumEvent\n var savedCommonContext = data.savedCommonContext\n var customerContext = data.customerContext\n var domainContext = data.domainContext\n var viewContext = viewContexts.findView(startTime)\n var urlContext = urlContexts.findUrl(startTime)\n var session = sessionManager.findTrackedSession(\n rawRumEvent.type !== RumEventType.VIEW ? startTime : undefined\n )\n\n if (session && viewContext && urlContext) {\n var actionId = actionContexts.findActionId(startTime)\n var actionIds = actionContexts.findAllActionId(startTime)\n var commonContext = savedCommonContext || buildCommonContext()\n var rumContext = {\n _gc: {\n sdkName: configuration.sdkName,\n sdkVersion: configuration.sdkVersion,\n drift: currentDrift(),\n configuration: {\n session_sample_rate: round(configuration.sessionSampleRate, 3),\n session_replay_sample_rate: round(\n configuration.sessionReplaySampleRate,\n 3\n )\n }\n },\n terminal: {\n type: 'web'\n },\n application: {\n id: configuration.applicationId\n },\n device: deviceInfo,\n env: configuration.env || '',\n service: viewContext.service || configuration.service || 'browser',\n version: viewContext.version || configuration.version || '',\n source: 'browser',\n date: timeStampNow(),\n user: {\n id: userSessionManager.getId(),\n is_signin: 'F',\n is_login: false\n },\n session: {\n // must be computed on each event because synthetics instrumentation can be done after sdk execution\n // cf https://github.com/puppeteer/puppeteer/issues/3667\n type: getSessionType(),\n id: session.id\n },\n view: {\n id: viewContext.id,\n name: viewContext.name,\n url: urlContext.url,\n referrer: urlContext.referrer,\n host: urlContext.host,\n path: urlContext.path,\n pathGroup: urlContext.pathGroup,\n urlQuery: urlContext.urlQuery\n },\n action:\n needToAssembleWithAction(rawRumEvent) && actionId\n ? { id: actionId, ids: actionIds }\n : undefined,\n display: displayContext.get()\n }\n var rumEvent = extend2Lev(rumContext, viewContext, rawRumEvent)\n var serverRumEvent = withSnakeCaseKeys(rumEvent)\n var context = extend2Lev({}, commonContext.context, customerContext)\n if (!isEmptyObject(context)) {\n serverRumEvent.context = context\n }\n if (!('has_replay' in serverRumEvent.session)) {\n serverRumEvent.session.has_replay = commonContext.hasReplay\n }\n if (serverRumEvent.type === 'view') {\n serverRumEvent.session.sampled_for_replay =\n session.sessionReplayAllowed\n }\n if (!isEmptyObject(commonContext.user)) {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n serverRumEvent.user = extend2Lev(\n {\n // id: session.getAnonymousID(),\n is_signin: 'T',\n is_login: true\n },\n commonContext.user\n )\n }\n\n if (\n shouldSend(\n serverRumEvent,\n configuration.beforeSend,\n domainContext,\n eventRateLimiters\n )\n ) {\n if (isEmptyObject(serverRumEvent.context)) {\n delete serverRumEvent.context\n }\n lifeCycle.notify(\n LifeCycleEventType.RUM_EVENT_COLLECTED,\n serverRumEvent\n )\n }\n }\n }\n )\n}\n\nfunction shouldSend(event, beforeSend, domainContext, eventRateLimiters) {\n if (beforeSend) {\n var result = limitModification(\n event,\n modifiableFieldPathsByEvent[event.type],\n function (event) {\n return beforeSend(event, domainContext)\n }\n )\n if (result === false && event.type !== RumEventType.VIEW) {\n return false\n }\n if (result === false) {\n display.warn(\"Can't dismiss view events using beforeSend!\")\n }\n }\n var rateLimitReached = false\n if (eventRateLimiters[event.type]) {\n rateLimitReached = eventRateLimiters[event.type].isLimitReached()\n }\n return !rateLimitReached\n}\nfunction needToAssembleWithAction(event) {\n return (\n [RumEventType.ERROR, RumEventType.RESOURCE, RumEventType.LONG_TASK].indexOf(\n event.type\n ) !== -1\n )\n}\n\nfunction getSessionType() {\n return window._DATAFLUX_SYNTHETICS_BROWSER === undefined\n ? SessionType.USER\n : SessionType.SYNTHETICS\n}\n"],"mappings":"AAAA,SACEA,UAAU,EACVC,iBAAiB,EACjBC,YAAY,EACZC,aAAa,EACbC,kBAAkB,EAClBC,YAAY,EACZC,UAAU,EACVC,YAAY,EACZC,sBAAsB,EACtBC,iBAAiB,EACjBC,OAAO,EACPC,MAAM,EACNC,KAAK,QACA,yBAAyB;AAChC,IAAIC,WAAW,GAAG;EAChBC,UAAU,EAAE,YAAY;EACxBC,IAAI,EAAE;AACR,CAAC;AAED,IAAIC,2BAA2B,GAAG;EAChC,UAAU,EAAE,QAAQ;EACpB,eAAe,EAAE;AACnB,CAAC;AAED,IAAIC,6BAA6B,GAAG;EAClCC,OAAO,EAAE;AACX,CAAC;AAED,IAAIC,2BAA2B,GAAG,CAAC,CAAC;AACpC,OAAO,SAASC,gBAAgBA,CAC9BC,aAAa,EACbC,SAAS,EACTC,cAAc,EACdC,kBAAkB,EAClBC,YAAY,EACZC,WAAW,EACXC,cAAc,EACdC,cAAc,EACdC,kBAAkB,EAClBC,WAAW,EACX;EACAX,2BAA2B,CAACd,YAAY,CAAC0B,IAAI,CAAC,GAAGf,2BAA2B;EAC5EG,2BAA2B,CAACd,YAAY,CAAC2B,KA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,GAAG,KAAK;EAC5B,IAAIxE,iBAAiB,CAACqE,KAAK,CAACrD,IAAI,CAAC,EAAE;IACjCwD,gBAAgB,GAAGxE,iBAAiB,CAACqE,KAAK,CAACrD,IAAI,CAAC,CAACyD,cAAc,CAAC,CAAC;EACnE;EACA,OAAO,CAACD,gBAAgB;AAC1B;AACA,SAAShB,wBAAwBA,CAACa,KAAK,EAAE;EACvC,OACE,CAACpG,YAAY,CAAC2B,KAAK,EAAE3B,YAAY,CAAC4B,QAAQ,EAAE5B,YAAY,CAAC8B,SAAS,CAAC,CAAC2E,OAAO,CACzEL,KAAK,CAACrD,IACR,CAAC,KAAK,CAAC,CAAC;AAEZ;AAEA,SAAS8B,cAAcA,CAAA,EAAG;EACxB,OAAO6B,MAAM,CAACC,4BAA4B,KAAK3D,SAAS,GACpDxC,WAAW,CAACE,IAAI,GAChBF,WAAW,CAACC,UAAU;AAC5B","ignoreList":[]}
1
+ {"version":3,"file":"assembly.js","names":["extend2Lev","withSnakeCaseKeys","timeStampNow","isEmptyObject","LifeCycleEventType","RumEventType","deviceInfo","currentDrift","createEventRateLimiter","limitModification","display","assign","round","SessionType","SYNTHETICS","USER","VIEW_MODIFIABLE_FIELD_PATHS","USER_CUSTOMIZABLE_FIELD_PATHS","context","modifiableFieldPathsByEvent","startRumAssembly","configuration","lifeCycle","sessionManager","userSessionManager","viewContexts","urlContexts","actionContexts","displayContext","getCommonContext","reportError","VIEW","ERROR","RESOURCE","ACTION","LONG_TASK","eventRateLimiters","eventRateLimiterThreshold","subscribe","RAW_RUM_EVENT_COLLECTED","data","startTime","rawRumEvent","savedCommonContext","customerContext","domainContext","viewContext","findView","urlContext","findUrl","session","findTrackedSession","actionId","findActionId","actionIds","findAllActionId","commonContext","rumContext","_gc","sdkName","sdkVersion","drift","session_sample_rate","sessionSampleRate","session_replay_sample_rate","sessionReplaySampleRate","terminal","type","application","id","applicationId","device","env","service","version","source","date","user","getId","is_signin","is_login","getSessionType","view","name","url","referrer","host","path","pathGroup","urlQuery","action","needToAssembleWithAction","ids","undefined","get","rumEvent","serverRumEvent","has_replay","hasReplay","sampled_for_replay","sessionReplayAllowed","shouldSend","beforeSend","notify","RUM_EVENT_COLLECTED","event","result","warn","rateLimitReached","isLimitReached","indexOf","window","_DATAFLUX_SYNTHETICS_BROWSER"],"sources":["../../src/domain/assembly.js"],"sourcesContent":["import {\n extend2Lev,\n withSnakeCaseKeys,\n timeStampNow,\n isEmptyObject,\n LifeCycleEventType,\n RumEventType,\n deviceInfo,\n currentDrift,\n createEventRateLimiter,\n limitModification,\n display,\n assign,\n round\n} from '@cloudcare/browser-core'\nvar SessionType = {\n SYNTHETICS: 'synthetics',\n USER: 'user'\n}\n\nvar VIEW_MODIFIABLE_FIELD_PATHS = {\n 'view.url': 'string',\n 'view.referrer': 'string'\n}\n\nvar USER_CUSTOMIZABLE_FIELD_PATHS = {\n context: 'object'\n}\n\nvar modifiableFieldPathsByEvent = {}\nexport function startRumAssembly(\n configuration,\n lifeCycle,\n sessionManager,\n userSessionManager,\n viewContexts,\n urlContexts,\n actionContexts,\n displayContext,\n getCommonContext,\n reportError\n) {\n modifiableFieldPathsByEvent[RumEventType.VIEW] = VIEW_MODIFIABLE_FIELD_PATHS\n modifiableFieldPathsByEvent[RumEventType.ERROR] = assign(\n {\n 'error.message': 'string',\n 'error.stack': 'string',\n 'error.resource.url': 'string'\n },\n USER_CUSTOMIZABLE_FIELD_PATHS,\n VIEW_MODIFIABLE_FIELD_PATHS\n )\n modifiableFieldPathsByEvent[RumEventType.RESOURCE] = assign(\n {\n 'resource.url': 'string'\n },\n USER_CUSTOMIZABLE_FIELD_PATHS,\n VIEW_MODIFIABLE_FIELD_PATHS\n )\n modifiableFieldPathsByEvent[RumEventType.ACTION] = assign(\n {\n 'action.target.name': 'string'\n },\n USER_CUSTOMIZABLE_FIELD_PATHS,\n VIEW_MODIFIABLE_FIELD_PATHS\n )\n modifiableFieldPathsByEvent[RumEventType.LONG_TASK] = assign(\n {},\n USER_CUSTOMIZABLE_FIELD_PATHS,\n VIEW_MODIFIABLE_FIELD_PATHS\n )\n var eventRateLimiters = {}\n eventRateLimiters[RumEventType.ERROR] = createEventRateLimiter(\n RumEventType.ERROR,\n configuration.eventRateLimiterThreshold,\n reportError\n )\n eventRateLimiters[RumEventType.ACTION] = createEventRateLimiter(\n RumEventType.ACTION,\n configuration.eventRateLimiterThreshold,\n reportError\n )\n lifeCycle.subscribe(\n LifeCycleEventType.RAW_RUM_EVENT_COLLECTED,\n function (data) {\n var startTime = data.startTime\n var rawRumEvent = data.rawRumEvent\n var savedCommonContext = data.savedCommonContext\n var customerContext = data.customerContext\n var domainContext = data.domainContext\n var viewContext = viewContexts.findView(startTime)\n var urlContext = urlContexts.findUrl(startTime)\n var session = sessionManager.findTrackedSession(startTime)\n\n if (session && viewContext && urlContext) {\n var actionId = actionContexts.findActionId(startTime)\n var actionIds = actionContexts.findAllActionId(startTime)\n var commonContext = savedCommonContext || getCommonContext()\n var rumContext = {\n _gc: {\n sdkName: configuration.sdkName,\n sdkVersion: configuration.sdkVersion,\n drift: currentDrift(),\n configuration: {\n session_sample_rate: round(configuration.sessionSampleRate, 3),\n session_replay_sample_rate: round(\n configuration.sessionReplaySampleRate,\n 3\n )\n }\n },\n terminal: {\n type: 'web'\n },\n application: {\n id: configuration.applicationId\n },\n device: deviceInfo,\n env: configuration.env || '',\n service: viewContext.service || configuration.service || 'browser',\n version: viewContext.version || configuration.version || '',\n source: 'browser',\n date: timeStampNow(),\n user: {\n id: userSessionManager.getId(),\n is_signin: 'F',\n is_login: false\n },\n session: {\n // must be computed on each event because synthetics instrumentation can be done after sdk execution\n // cf https://github.com/puppeteer/puppeteer/issues/3667\n type: getSessionType(),\n id: session.id\n },\n view: {\n id: viewContext.id,\n name: viewContext.name,\n url: urlContext.url,\n referrer: urlContext.referrer,\n host: urlContext.host,\n path: urlContext.path,\n pathGroup: urlContext.pathGroup,\n urlQuery: urlContext.urlQuery\n },\n action:\n needToAssembleWithAction(rawRumEvent) && actionId\n ? { id: actionId, ids: actionIds }\n : undefined,\n display: displayContext.get()\n }\n var rumEvent = extend2Lev(rumContext, viewContext, rawRumEvent)\n var serverRumEvent = withSnakeCaseKeys(rumEvent)\n var context = extend2Lev({}, commonContext.context, customerContext)\n if (!isEmptyObject(context)) {\n serverRumEvent.context = context\n }\n if (!('has_replay' in serverRumEvent.session)) {\n serverRumEvent.session.has_replay = commonContext.hasReplay\n }\n if (serverRumEvent.type === 'view') {\n serverRumEvent.session.sampled_for_replay =\n session.sessionReplayAllowed\n }\n if (!isEmptyObject(commonContext.user)) {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n serverRumEvent.user = extend2Lev(\n {\n // id: session.getAnonymousID(),\n is_signin: 'T',\n is_login: true\n },\n commonContext.user\n )\n }\n\n if (\n shouldSend(\n serverRumEvent,\n configuration.beforeSend,\n domainContext,\n eventRateLimiters\n )\n ) {\n if (isEmptyObject(serverRumEvent.context)) {\n delete serverRumEvent.context\n }\n lifeCycle.notify(\n LifeCycleEventType.RUM_EVENT_COLLECTED,\n serverRumEvent\n )\n }\n }\n }\n )\n}\n\nfunction shouldSend(event, beforeSend, domainContext, eventRateLimiters) {\n if (beforeSend) {\n var result = limitModification(\n event,\n modifiableFieldPathsByEvent[event.type],\n function (event) {\n return beforeSend(event, domainContext)\n }\n )\n if (result === false && event.type !== RumEventType.VIEW) {\n return false\n }\n if (result === false) {\n display.warn(\"Can't dismiss view events using beforeSend!\")\n }\n }\n var rateLimitReached = false\n if (eventRateLimiters[event.type]) {\n rateLimitReached = eventRateLimiters[event.type].isLimitReached()\n }\n return !rateLimitReached\n}\nfunction needToAssembleWithAction(event) {\n return (\n [RumEventType.ERROR, RumEventType.RESOURCE, RumEventType.LONG_TASK].indexOf(\n event.type\n ) !== -1\n )\n}\n\nfunction getSessionType() {\n return window._DATAFLUX_SYNTHETICS_BROWSER === undefined\n ? SessionType.USER\n : SessionType.SYNTHETICS\n}\n"],"mappings":"AAAA,SAC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ateAndBuildRumConfiguration(initConfiguration) {
50
50
  allowedTracingUrls: allowedTracingUrls,
51
51
  injectTraceHeader: initConfiguration.injectTraceHeader && catchUserErrors(initConfiguration.injectTraceHeader, 'injectTraceHeader threw an error:'),
52
52
  excludedActivityUrls: isNullUndefinedDefaultValue(initConfiguration.excludedActivityUrls, []),
53
+ workerUrl: initConfiguration.workerUrl,
54
+ compressIntakeRequests: !!initConfiguration.compressIntakeRequests,
53
55
  trackUserInteractions: trackUserInteractions,
56
+ enableLongAnimationFrame: !!initConfiguration.enableLongAnimationFrame,
54
57
  trackViewsManually: !!initConfiguration.trackViewsManually,
55
58
  traceType: isNullUndefinedDefaultValue(initConfiguration.traceType, TraceType.DDTRACE),
56
59
  traceId128Bit: !!initConfiguration.traceId128Bit,