@newrelic/browser-agent 1.232.1 → 1.233.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 (233) hide show
  1. package/dist/cjs/cdn/polyfills.js +5 -2
  2. package/dist/cjs/common/config/state/configurable.js +15 -26
  3. package/dist/cjs/common/config/state/info.js +1 -1
  4. package/dist/cjs/common/config/state/init.js +101 -56
  5. package/dist/cjs/common/config/state/loader-config.js +1 -1
  6. package/dist/cjs/common/config/state/runtime.js +1 -5
  7. package/dist/cjs/common/constants/env.cdn.js +1 -1
  8. package/dist/cjs/common/constants/env.npm.js +1 -1
  9. package/dist/cjs/common/drain/drain.js +1 -1
  10. package/dist/cjs/common/harvest/harvest-scheduler.js +30 -10
  11. package/dist/cjs/common/harvest/harvest.js +119 -55
  12. package/dist/cjs/common/session/session-entity.js +35 -22
  13. package/dist/cjs/common/session/session-entity.test.js +73 -49
  14. package/dist/cjs/common/timer/interaction-timer.js +9 -12
  15. package/dist/cjs/common/url/protocol.test.js +0 -1
  16. package/dist/cjs/common/util/feature-flags.js +2 -1
  17. package/dist/cjs/common/util/submit-data.js +57 -18
  18. package/dist/cjs/common/wrap/wrap-fetch.js +1 -1
  19. package/dist/cjs/common/wrap/wrap-function.js +1 -1
  20. package/dist/cjs/common/wrap/wrap-promise.js +1 -1
  21. package/dist/cjs/features/ajax/aggregate/index.js +2 -2
  22. package/dist/cjs/features/jserrors/aggregate/index.js +7 -5
  23. package/dist/cjs/features/metrics/aggregate/framework-detection.js +67 -0
  24. package/dist/cjs/features/metrics/aggregate/framework-detection.test.js +137 -0
  25. package/dist/cjs/features/metrics/aggregate/index.js +7 -3
  26. package/dist/cjs/features/metrics/aggregate/polyfill-detection.es5.js +14 -0
  27. package/dist/cjs/features/metrics/aggregate/polyfill-detection.es5.test.js +17 -0
  28. package/dist/cjs/features/metrics/aggregate/polyfill-detection.js +53 -0
  29. package/dist/cjs/features/metrics/aggregate/polyfill-detection.test.js +165 -0
  30. package/dist/cjs/features/page_action/aggregate/index.js +2 -2
  31. package/dist/cjs/features/page_view_event/aggregate/index.js +6 -3
  32. package/dist/cjs/features/page_view_timing/aggregate/index.js +2 -2
  33. package/dist/cjs/features/session_replay/aggregate/index.js +333 -0
  34. package/dist/cjs/features/session_replay/constants.js +9 -0
  35. package/dist/cjs/features/session_replay/index.js +12 -0
  36. package/dist/cjs/features/session_replay/instrument/index.js +29 -0
  37. package/dist/cjs/features/session_trace/aggregate/index.js +163 -162
  38. package/dist/cjs/features/session_trace/constants.js +2 -9
  39. package/dist/cjs/features/session_trace/instrument/index.js +24 -66
  40. package/dist/cjs/features/spa/aggregate/index.js +2 -2
  41. package/dist/cjs/features/utils/agent-session.js +1 -2
  42. package/dist/cjs/features/utils/aggregate-base.js +64 -0
  43. package/dist/cjs/features/utils/feature-base.js +0 -31
  44. package/dist/cjs/features/utils/handler-cache.js +3 -4
  45. package/dist/cjs/features/utils/instrument-base.js +42 -10
  46. package/dist/cjs/features/utils/{lazy-loader.js → lazy-feature-loader.js} +4 -2
  47. package/dist/cjs/loaders/agent.js +1 -1
  48. package/dist/cjs/loaders/api/apiAsync.js +3 -1
  49. package/dist/cjs/loaders/configure/configure.js +3 -3
  50. package/dist/cjs/loaders/features/featureDependencies.js +0 -12
  51. package/dist/cjs/loaders/features/features.js +3 -1
  52. package/dist/cjs/loaders/micro-agent.js +6 -6
  53. package/dist/esm/cdn/polyfills.js +5 -2
  54. package/dist/esm/common/config/state/configurable.js +14 -24
  55. package/dist/esm/common/config/state/info.js +2 -2
  56. package/dist/esm/common/config/state/init.js +102 -57
  57. package/dist/esm/common/config/state/loader-config.js +2 -2
  58. package/dist/esm/common/config/state/runtime.js +2 -4
  59. package/dist/esm/common/constants/env.cdn.js +1 -1
  60. package/dist/esm/common/constants/env.npm.js +1 -1
  61. package/dist/esm/common/drain/drain.js +1 -1
  62. package/dist/esm/common/harvest/harvest-scheduler.js +30 -10
  63. package/dist/esm/common/harvest/harvest.js +121 -56
  64. package/dist/esm/common/session/session-entity.js +35 -22
  65. package/dist/esm/common/session/session-entity.test.js +73 -49
  66. package/dist/esm/common/timer/interaction-timer.js +9 -12
  67. package/dist/esm/common/url/protocol.test.js +0 -1
  68. package/dist/esm/common/util/feature-flags.js +2 -1
  69. package/dist/esm/common/util/submit-data.js +57 -18
  70. package/dist/esm/common/wrap/wrap-fetch.js +1 -1
  71. package/dist/esm/common/wrap/wrap-function.js +1 -1
  72. package/dist/esm/common/wrap/wrap-promise.js +1 -1
  73. package/dist/esm/features/ajax/aggregate/index.js +2 -2
  74. package/dist/esm/features/jserrors/aggregate/index.js +7 -5
  75. package/dist/esm/features/metrics/aggregate/framework-detection.js +61 -0
  76. package/dist/esm/features/metrics/aggregate/framework-detection.test.js +133 -0
  77. package/dist/esm/features/metrics/aggregate/index.js +7 -3
  78. package/dist/esm/features/metrics/aggregate/polyfill-detection.es5.js +8 -0
  79. package/dist/esm/features/metrics/aggregate/polyfill-detection.es5.test.js +15 -0
  80. package/dist/esm/features/metrics/aggregate/polyfill-detection.js +47 -0
  81. package/dist/esm/features/metrics/aggregate/polyfill-detection.test.js +163 -0
  82. package/dist/esm/features/page_action/aggregate/index.js +2 -2
  83. package/dist/esm/features/page_view_event/aggregate/index.js +6 -3
  84. package/dist/esm/features/page_view_timing/aggregate/index.js +2 -2
  85. package/dist/esm/features/session_replay/aggregate/index.js +327 -0
  86. package/dist/esm/features/session_replay/constants.js +2 -0
  87. package/dist/esm/features/session_replay/index.js +12 -0
  88. package/dist/esm/features/session_replay/instrument/index.js +21 -0
  89. package/dist/esm/features/session_trace/aggregate/index.js +163 -162
  90. package/dist/esm/features/session_trace/constants.js +1 -5
  91. package/dist/esm/features/session_trace/instrument/index.js +24 -66
  92. package/dist/esm/features/spa/aggregate/index.js +2 -2
  93. package/dist/esm/features/utils/agent-session.js +1 -2
  94. package/dist/esm/features/utils/aggregate-base.js +57 -0
  95. package/dist/esm/features/utils/feature-base.js +1 -32
  96. package/dist/esm/features/utils/handler-cache.js +3 -4
  97. package/dist/esm/features/utils/instrument-base.js +42 -10
  98. package/dist/esm/features/utils/{lazy-loader.js → lazy-feature-loader.js} +3 -1
  99. package/dist/esm/loaders/agent.js +1 -1
  100. package/dist/esm/loaders/api/apiAsync.js +3 -1
  101. package/dist/esm/loaders/configure/configure.js +3 -3
  102. package/dist/esm/loaders/features/featureDependencies.js +0 -11
  103. package/dist/esm/loaders/features/features.js +3 -1
  104. package/dist/esm/loaders/micro-agent.js +6 -6
  105. package/dist/types/common/config/state/configurable.d.ts +1 -3
  106. package/dist/types/common/config/state/configurable.d.ts.map +1 -1
  107. package/dist/types/common/config/state/init.d.ts.map +1 -1
  108. package/dist/types/common/config/state/runtime.d.ts.map +1 -1
  109. package/dist/types/common/harvest/harvest-scheduler.d.ts.map +1 -1
  110. package/dist/types/common/harvest/harvest.d.ts +37 -34
  111. package/dist/types/common/harvest/harvest.d.ts.map +1 -1
  112. package/dist/types/common/session/session-entity.d.ts +6 -3
  113. package/dist/types/common/session/session-entity.d.ts.map +1 -1
  114. package/dist/types/common/timer/interaction-timer.d.ts +2 -1
  115. package/dist/types/common/timer/interaction-timer.d.ts.map +1 -1
  116. package/dist/types/common/util/feature-flags.d.ts.map +1 -1
  117. package/dist/types/common/util/submit-data.d.ts +40 -14
  118. package/dist/types/common/util/submit-data.d.ts.map +1 -1
  119. package/dist/types/features/ajax/aggregate/index.d.ts +2 -2
  120. package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -1
  121. package/dist/types/features/jserrors/aggregate/index.d.ts +2 -2
  122. package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -1
  123. package/dist/types/features/metrics/aggregate/framework-detection.d.ts.map +1 -0
  124. package/dist/types/features/metrics/aggregate/index.d.ts +2 -2
  125. package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -1
  126. package/dist/types/features/metrics/aggregate/polyfill-detection.d.ts +6 -0
  127. package/dist/types/features/metrics/aggregate/polyfill-detection.d.ts.map +1 -0
  128. package/dist/types/features/metrics/aggregate/polyfill-detection.es5.d.ts +7 -0
  129. package/dist/types/features/metrics/aggregate/polyfill-detection.es5.d.ts.map +1 -0
  130. package/dist/types/features/page_action/aggregate/index.d.ts +2 -2
  131. package/dist/types/features/page_action/aggregate/index.d.ts.map +1 -1
  132. package/dist/types/features/page_view_event/aggregate/index.d.ts +2 -2
  133. package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -1
  134. package/dist/types/features/page_view_timing/aggregate/index.d.ts +2 -2
  135. package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -1
  136. package/dist/types/features/session_replay/aggregate/index.d.ts +96 -0
  137. package/dist/types/features/session_replay/aggregate/index.d.ts.map +1 -0
  138. package/dist/types/features/session_replay/constants.d.ts +2 -0
  139. package/dist/types/features/session_replay/constants.d.ts.map +1 -0
  140. package/dist/types/features/session_replay/index.d.ts +2 -0
  141. package/dist/types/features/session_replay/index.d.ts.map +1 -0
  142. package/dist/types/features/session_replay/instrument/index.d.ts +6 -0
  143. package/dist/types/features/session_replay/instrument/index.d.ts.map +1 -0
  144. package/dist/types/features/session_trace/aggregate/index.d.ts +8 -57
  145. package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -1
  146. package/dist/types/features/session_trace/constants.d.ts +0 -3
  147. package/dist/types/features/session_trace/constants.d.ts.map +1 -1
  148. package/dist/types/features/session_trace/instrument/index.d.ts +1 -3
  149. package/dist/types/features/session_trace/instrument/index.d.ts.map +1 -1
  150. package/dist/types/features/spa/aggregate/index.d.ts +2 -2
  151. package/dist/types/features/spa/aggregate/index.d.ts.map +1 -1
  152. package/dist/types/features/utils/agent-session.d.ts.map +1 -1
  153. package/dist/types/features/utils/aggregate-base.d.ts +11 -0
  154. package/dist/types/features/utils/aggregate-base.d.ts.map +1 -0
  155. package/dist/types/features/utils/feature-base.d.ts +0 -5
  156. package/dist/types/features/utils/feature-base.d.ts.map +1 -1
  157. package/dist/types/features/utils/handler-cache.d.ts.map +1 -1
  158. package/dist/types/features/utils/instrument-base.d.ts +3 -1
  159. package/dist/types/features/utils/instrument-base.d.ts.map +1 -1
  160. package/dist/types/features/utils/{lazy-loader.d.ts → lazy-feature-loader.d.ts} +2 -2
  161. package/dist/types/features/utils/lazy-feature-loader.d.ts.map +1 -0
  162. package/dist/types/loaders/configure/configure.d.ts.map +1 -1
  163. package/dist/types/loaders/features/featureDependencies.d.ts +0 -1
  164. package/dist/types/loaders/features/featureDependencies.d.ts.map +1 -1
  165. package/dist/types/loaders/features/features.d.ts +1 -0
  166. package/dist/types/loaders/features/features.d.ts.map +1 -1
  167. package/package.json +28 -19
  168. package/src/cdn/polyfills.js +4 -1
  169. package/src/common/config/state/configurable.js +18 -24
  170. package/src/common/config/state/info.js +2 -2
  171. package/src/common/config/state/init.js +62 -28
  172. package/src/common/config/state/loader-config.js +2 -2
  173. package/src/common/config/state/runtime.js +2 -4
  174. package/src/common/drain/drain.js +1 -1
  175. package/src/common/harvest/harvest-scheduler.js +35 -10
  176. package/src/common/harvest/harvest.js +73 -50
  177. package/src/common/session/session-entity.js +34 -23
  178. package/src/common/session/session-entity.test.js +57 -51
  179. package/src/common/timer/interaction-timer.js +9 -12
  180. package/src/common/url/protocol.test.js +0 -1
  181. package/src/common/util/feature-flags.js +2 -2
  182. package/src/common/util/submit-data.js +28 -17
  183. package/src/common/wrap/wrap-fetch.js +1 -1
  184. package/src/common/wrap/wrap-function.js +1 -1
  185. package/src/common/wrap/wrap-promise.js +1 -1
  186. package/src/features/ajax/aggregate/index.js +2 -2
  187. package/src/features/jserrors/aggregate/index.js +7 -5
  188. package/src/features/metrics/aggregate/framework-detection.js +73 -0
  189. package/src/features/metrics/aggregate/framework-detection.test.js +201 -0
  190. package/src/features/metrics/aggregate/index.js +8 -3
  191. package/src/features/metrics/aggregate/polyfill-detection.es5.js +9 -0
  192. package/src/features/metrics/aggregate/polyfill-detection.es5.test.js +16 -0
  193. package/src/features/metrics/aggregate/polyfill-detection.js +48 -0
  194. package/src/features/metrics/aggregate/polyfill-detection.test.js +163 -0
  195. package/src/features/page_action/aggregate/index.js +2 -2
  196. package/src/features/page_view_event/aggregate/index.js +5 -5
  197. package/src/features/page_view_timing/aggregate/index.js +2 -2
  198. package/src/features/session_replay/aggregate/index.js +314 -0
  199. package/src/features/session_replay/constants.js +3 -0
  200. package/src/features/session_replay/index.js +12 -0
  201. package/src/features/session_replay/instrument/index.js +22 -0
  202. package/src/features/session_trace/aggregate/index.js +148 -187
  203. package/src/features/session_trace/constants.js +0 -4
  204. package/src/features/session_trace/instrument/index.js +17 -69
  205. package/src/features/spa/aggregate/index.js +2 -2
  206. package/src/features/utils/agent-session.js +1 -2
  207. package/src/features/utils/aggregate-base.js +51 -0
  208. package/src/features/utils/feature-base.js +1 -31
  209. package/src/features/utils/handler-cache.js +3 -4
  210. package/src/features/utils/instrument-base.js +40 -8
  211. package/src/features/utils/{lazy-loader.js → lazy-feature-loader.js} +3 -1
  212. package/src/loaders/agent.js +1 -1
  213. package/src/loaders/api/apiAsync.js +1 -1
  214. package/src/loaders/configure/configure.js +4 -3
  215. package/src/loaders/features/featureDependencies.js +0 -12
  216. package/src/loaders/features/features.js +3 -1
  217. package/src/loaders/micro-agent.js +4 -4
  218. package/dist/cjs/common/metrics/framework-detection.js +0 -72
  219. package/dist/cjs/common/util/user-agent.js +0 -57
  220. package/dist/cjs/common/window/supports-performance-observer.js +0 -15
  221. package/dist/esm/common/metrics/framework-detection.js +0 -66
  222. package/dist/esm/common/util/user-agent.js +0 -48
  223. package/dist/esm/common/window/supports-performance-observer.js +0 -9
  224. package/dist/types/common/metrics/framework-detection.d.ts.map +0 -1
  225. package/dist/types/common/util/user-agent.d.ts +0 -5
  226. package/dist/types/common/util/user-agent.d.ts.map +0 -1
  227. package/dist/types/common/window/supports-performance-observer.d.ts +0 -2
  228. package/dist/types/common/window/supports-performance-observer.d.ts.map +0 -1
  229. package/dist/types/features/utils/lazy-loader.d.ts.map +0 -1
  230. package/src/common/metrics/framework-detection.js +0 -71
  231. package/src/common/util/user-agent.js +0 -56
  232. package/src/common/window/supports-performance-observer.js +0 -10
  233. /package/dist/types/{common/metrics → features/metrics/aggregate}/framework-detection.d.ts +0 -0
@@ -75,7 +75,7 @@ function wrapFetch(sharedEE) {
75
75
  var fn = target[name];
76
76
  if (typeof fn === 'function') {
77
77
  target[name] = function () {
78
- var args = Array.from(arguments);
78
+ var args = [...arguments];
79
79
  var ctx = {};
80
80
  // we are wrapping args in an array so we can preserve the reference
81
81
  ee.emit(prefix + 'before-start', [args], ctx);
@@ -81,7 +81,7 @@ function createWrapperWithEmitter(emitter, always) {
81
81
  var result;
82
82
  try {
83
83
  originalThis = this;
84
- args = Array.from(arguments);
84
+ args = [...arguments];
85
85
  if (typeof getContext === 'function') {
86
86
  ctx = getContext(args, originalThis);
87
87
  } else {
@@ -76,7 +76,7 @@ function wrapPromise(sharedEE) {
76
76
  WrappedPromise[method] = function (subPromises) {
77
77
  // use our own wrapped version of "Promise.all" and ".race" static fns
78
78
  let finalized = false;
79
- Array.from(subPromises || []).forEach(sub => {
79
+ [...(subPromises || [])].forEach(sub => {
80
80
  this.resolve(sub).then(setNrId(method === 'all'), setNrId(false));
81
81
  });
82
82
  const origFnCallWithThis = prevStaticFn.apply(this, arguments);
@@ -15,13 +15,13 @@ var _constants = require("../constants");
15
15
  var _drain = require("../../../common/drain/drain");
16
16
  var _features = require("../../../loaders/features/features");
17
17
  var _constants2 = require("../../metrics/constants");
18
- var _featureBase = require("../../utils/feature-base");
18
+ var _aggregateBase = require("../../utils/aggregate-base");
19
19
  /*
20
20
  * Copyright 2020 New Relic Corporation. All rights reserved.
21
21
  * SPDX-License-Identifier: Apache-2.0
22
22
  */
23
23
 
24
- class Aggregate extends _featureBase.FeatureBase {
24
+ class Aggregate extends _aggregateBase.AggregateBase {
25
25
  static featureName = _constants.FEATURE_NAME;
26
26
  constructor(agentIdentifier, aggregator) {
27
27
  super(agentIdentifier, aggregator, _constants.FEATURE_NAME);
@@ -19,7 +19,7 @@ var _globalScope = require("../../../common/util/global-scope");
19
19
  var _constants = require("../constants");
20
20
  var _drain = require("../../../common/drain/drain");
21
21
  var _features = require("../../../loaders/features/features");
22
- var _featureBase = require("../../utils/feature-base");
22
+ var _aggregateBase = require("../../utils/aggregate-base");
23
23
  /*
24
24
  * Copyright 2020 New Relic Corporation. All rights reserved.
25
25
  * SPDX-License-Identifier: Apache-2.0
@@ -29,7 +29,7 @@ var _featureBase = require("../../utils/feature-base");
29
29
  * @typedef {import('./compute-stack-trace.js').StackInfo} StackInfo
30
30
  */
31
31
 
32
- class Aggregate extends _featureBase.FeatureBase {
32
+ class Aggregate extends _aggregateBase.AggregateBase {
33
33
  static featureName = _constants.FEATURE_NAME;
34
34
  constructor(agentIdentifier, aggregator) {
35
35
  var _this;
@@ -188,10 +188,12 @@ class Aggregate extends _featureBase.FeatureBase {
188
188
  time: time
189
189
  };
190
190
 
191
- // stn and spa aggregators listen to this event - stn sends the error in its payload,
191
+ // sr, stn and spa aggregators listen to this event - stn sends the error in its payload,
192
192
  // and spa annotates the error with interaction info
193
- (0, _handle.handle)('errorAgg', [type, bucketHash, params, newMetrics], undefined, _features.FEATURE_NAMES.sessionTrace, this.ee);
194
- (0, _handle.handle)('errorAgg', [type, bucketHash, params, newMetrics], undefined, _features.FEATURE_NAMES.spa, this.ee);
193
+ const msg = [type, bucketHash, params, newMetrics];
194
+ (0, _handle.handle)('errorAgg', msg, undefined, _features.FEATURE_NAMES.sessionTrace, this.ee);
195
+ (0, _handle.handle)('errorAgg', msg, undefined, _features.FEATURE_NAMES.spa, this.ee);
196
+ (0, _handle.handle)('errorAgg', msg, undefined, _features.FEATURE_NAMES.sessionReplay, this.ee);
195
197
 
196
198
  // still send EE events for other features such as above, but stop this one from aggregating internal data
197
199
  if (this.blocked) return;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getFrameworks = getFrameworks;
7
+ var _globalScope = require("../../../common/util/global-scope");
8
+ const FRAMEWORKS = {
9
+ REACT: 'React',
10
+ ANGULAR: 'Angular',
11
+ ANGULARJS: 'AngularJS',
12
+ BACKBONE: 'Backbone',
13
+ EMBER: 'Ember',
14
+ VUE: 'Vue',
15
+ METEOR: 'Meteor',
16
+ ZEPTO: 'Zepto',
17
+ JQUERY: 'Jquery',
18
+ MOOTOOLS: 'MooTools'
19
+ };
20
+ function getFrameworks() {
21
+ if (!_globalScope.isBrowserScope) return []; // don't bother detecting frameworks if not in the main window context
22
+
23
+ const frameworks = [];
24
+ try {
25
+ if (detectReact()) frameworks.push(FRAMEWORKS.REACT);
26
+ if (detectAngularJs()) frameworks.push(FRAMEWORKS.ANGULARJS);
27
+ if (detectAngular()) frameworks.push(FRAMEWORKS.ANGULAR);
28
+ if (Object.prototype.hasOwnProperty.call(window, 'Backbone')) frameworks.push(FRAMEWORKS.BACKBONE);
29
+ if (Object.prototype.hasOwnProperty.call(window, 'Ember')) frameworks.push(FRAMEWORKS.EMBER);
30
+ if (Object.prototype.hasOwnProperty.call(window, 'Vue')) frameworks.push(FRAMEWORKS.VUE);
31
+ if (Object.prototype.hasOwnProperty.call(window, 'Meteor')) frameworks.push(FRAMEWORKS.METEOR);
32
+ if (Object.prototype.hasOwnProperty.call(window, 'Zepto')) frameworks.push(FRAMEWORKS.ZEPTO);
33
+ if (Object.prototype.hasOwnProperty.call(window, 'jQuery')) frameworks.push(FRAMEWORKS.JQUERY);
34
+ if (Object.prototype.hasOwnProperty.call(window, 'MooTools')) frameworks.push(FRAMEWORKS.MOOTOOLS);
35
+ } catch (err) {
36
+ // Possibly not supported
37
+ }
38
+ return frameworks;
39
+ }
40
+ function detectReact() {
41
+ try {
42
+ return Object.prototype.hasOwnProperty.call(window, 'React') || Object.prototype.hasOwnProperty.call(window, 'ReactDOM') || Object.prototype.hasOwnProperty.call(window, 'ReactRedux') || document.querySelector('[data-reactroot], [data-reactid]') || (() => {
43
+ const divs = document.querySelectorAll('body > div');
44
+ for (let i = 0; i < divs.length; i++) {
45
+ if (Object.prototype.hasOwnProperty.call(divs[i], '_reactRootContainer')) {
46
+ return true;
47
+ }
48
+ }
49
+ })();
50
+ } catch (err) {
51
+ return false;
52
+ }
53
+ }
54
+ function detectAngularJs() {
55
+ try {
56
+ return Object.prototype.hasOwnProperty.call(window, 'angular') || document.querySelector('.ng-binding, [ng-app], [data-ng-app], [ng-controller], [data-ng-controller], [ng-repeat], [data-ng-repeat]') || document.querySelector('script[src*="angular.js"], script[src*="angular.min.js"]');
57
+ } catch (err) {
58
+ return false;
59
+ }
60
+ }
61
+ function detectAngular() {
62
+ try {
63
+ return Object.prototype.hasOwnProperty.call(window, 'ng') || document.querySelector('[ng-version]');
64
+ } catch (err) {
65
+ return false;
66
+ }
67
+ }
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+
3
+ var _faker = require("@faker-js/faker");
4
+ var _frameworkDetection = require("./framework-detection");
5
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
6
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
7
+ jest.mock('../../../common/util/global-scope', () => ({
8
+ isBrowserScope: true
9
+ }));
10
+ afterEach(() => {
11
+ document.body.innerHTML = '';
12
+ });
13
+ test('framework detection should not happen in non-browser scope', async () => {
14
+ global.React = {};
15
+ jest.resetModules();
16
+ jest.doMock('../../../common/util/global-scope', () => ({
17
+ isBrowserScope: false
18
+ }));
19
+ const frameworkDetector = await Promise.resolve().then(() => _interopRequireWildcard(require('./framework-detection')));
20
+ expect(frameworkDetector.getFrameworks()).toEqual([]);
21
+ delete global.React;
22
+ });
23
+ test('should detect react from global React property', () => {
24
+ global.React = {};
25
+ expect((0, _frameworkDetection.getFrameworks)()).toEqual(['React']);
26
+ delete global.React;
27
+ });
28
+ test('should detect react from global ReactDOM property', () => {
29
+ global.ReactDOM = {};
30
+ expect((0, _frameworkDetection.getFrameworks)()).toEqual(['React']);
31
+ delete global.ReactDOM;
32
+ });
33
+ test('should detect react from global ReactRedux property', () => {
34
+ global.ReactRedux = {};
35
+ expect((0, _frameworkDetection.getFrameworks)()).toEqual(['React']);
36
+ delete global.ReactRedux;
37
+ });
38
+ test('should detect react from html [data-reactroot] property', () => {
39
+ document.body.innerHTML = '<div data-reactroot=""></div>';
40
+ expect((0, _frameworkDetection.getFrameworks)()).toEqual(['React']);
41
+ });
42
+ test('should detect react from html [data-reactid] property', () => {
43
+ document.body.innerHTML = '<div data-reactid=""></div>';
44
+ expect((0, _frameworkDetection.getFrameworks)()).toEqual(['React']);
45
+ });
46
+ test('should detect react from element _reactRootContainer property', () => {
47
+ const element = document.createElement('div');
48
+ element._reactRootContainer = {};
49
+ document.body.innerHTML = '<html><body></body></html>';
50
+ document.body.appendChild(element);
51
+ expect((0, _frameworkDetection.getFrameworks)()).toEqual(['React']);
52
+ });
53
+ test('should detect angularjs from global angular property', () => {
54
+ global.angular = {};
55
+ expect((0, _frameworkDetection.getFrameworks)()).toEqual(['AngularJS']);
56
+ delete global.angular;
57
+ });
58
+ test('should detect angularjs from html .ng-binding property', () => {
59
+ document.body.innerHTML = '<div class="ng-binding"></div>';
60
+ expect((0, _frameworkDetection.getFrameworks)()).toEqual(['AngularJS']);
61
+ });
62
+ test('should detect angularjs from html [ng-app] property', () => {
63
+ document.body.innerHTML = '<div ng-app=""></div>';
64
+ expect((0, _frameworkDetection.getFrameworks)()).toEqual(['AngularJS']);
65
+ });
66
+ test('should detect angularjs from html [data-ng-app] property', () => {
67
+ document.body.innerHTML = '<div data-ng-app=""></div>';
68
+ expect((0, _frameworkDetection.getFrameworks)()).toEqual(['AngularJS']);
69
+ });
70
+ test('should detect angularjs from html [ng-controller] property', () => {
71
+ document.body.innerHTML = '<div ng-controller=""></div>';
72
+ expect((0, _frameworkDetection.getFrameworks)()).toEqual(['AngularJS']);
73
+ });
74
+ test('should detect angularjs from html [data-ng-controller] property', () => {
75
+ document.body.innerHTML = '<div data-ng-controller=""></div>';
76
+ expect((0, _frameworkDetection.getFrameworks)()).toEqual(['AngularJS']);
77
+ });
78
+ test('should detect angularjs from html [ng-repeat] property', () => {
79
+ document.body.innerHTML = '<div ng-repeat=""></div>';
80
+ expect((0, _frameworkDetection.getFrameworks)()).toEqual(['AngularJS']);
81
+ });
82
+ test('should detect angularjs from html [data-ng-repeat] property', () => {
83
+ document.body.innerHTML = '<div data-ng-repeat=""></div>';
84
+ expect((0, _frameworkDetection.getFrameworks)()).toEqual(['AngularJS']);
85
+ });
86
+ test('should detect angularjs from angular.js script element', () => {
87
+ document.body.innerHTML = "<script src=\"".concat(_faker.faker.internet.url(), "/angular.js\"></script>");
88
+ expect((0, _frameworkDetection.getFrameworks)()).toEqual(['AngularJS']);
89
+ });
90
+ test('should detect angularjs from angular.min.js script element', () => {
91
+ document.body.innerHTML = "<script src=\"".concat(_faker.faker.internet.url(), "/angular.min.js\"></script>");
92
+ expect((0, _frameworkDetection.getFrameworks)()).toEqual(['AngularJS']);
93
+ });
94
+ test('should detect angular from global ng property', () => {
95
+ global.ng = {};
96
+ expect((0, _frameworkDetection.getFrameworks)()).toEqual(['Angular']);
97
+ delete global.ng;
98
+ });
99
+ test('should detect angular from html [ng-version] property', () => {
100
+ document.body.innerHTML = '<div ng-version=""></div>';
101
+ expect((0, _frameworkDetection.getFrameworks)()).toEqual(['Angular']);
102
+ });
103
+ test('should detect backbone from global Backbone property', () => {
104
+ global.Backbone = {};
105
+ expect((0, _frameworkDetection.getFrameworks)()).toEqual(['Backbone']);
106
+ delete global.Backbone;
107
+ });
108
+ test('should detect ember from global Ember property', () => {
109
+ global.Ember = {};
110
+ expect((0, _frameworkDetection.getFrameworks)()).toEqual(['Ember']);
111
+ delete global.Ember;
112
+ });
113
+ test('should detect vue from global Vue property', () => {
114
+ global.Vue = {};
115
+ expect((0, _frameworkDetection.getFrameworks)()).toEqual(['Vue']);
116
+ delete global.Vue;
117
+ });
118
+ test('should detect meteor from global Meteor property', () => {
119
+ global.Meteor = {};
120
+ expect((0, _frameworkDetection.getFrameworks)()).toEqual(['Meteor']);
121
+ delete global.Meteor;
122
+ });
123
+ test('should detect zepto from global Zepto property', () => {
124
+ global.Zepto = {};
125
+ expect((0, _frameworkDetection.getFrameworks)()).toEqual(['Zepto']);
126
+ delete global.Zepto;
127
+ });
128
+ test('should detect jquery from global jQuery property', () => {
129
+ global.jQuery = {};
130
+ expect((0, _frameworkDetection.getFrameworks)()).toEqual(['Jquery']);
131
+ delete global.jQuery;
132
+ });
133
+ test('should detect mootools from global MooTools property', () => {
134
+ global.MooTools = {};
135
+ expect((0, _frameworkDetection.getFrameworks)()).toEqual(['MooTools']);
136
+ delete global.MooTools;
137
+ });
@@ -9,16 +9,17 @@ var _registerHandler = require("../../../common/event-emitter/register-handler")
9
9
  var _harvestScheduler = require("../../../common/harvest/harvest-scheduler");
10
10
  var _constants = require("../constants");
11
11
  var _drain = require("../../../common/drain/drain");
12
- var _frameworkDetection = require("../../../common/metrics/framework-detection");
12
+ var _frameworkDetection = require("./framework-detection");
13
+ var _polyfillDetection = require("./polyfill-detection");
13
14
  var _protocol = require("../../../common/url/protocol");
14
15
  var _obfuscate = require("../../../common/util/obfuscate");
15
16
  var _env = require("../../../common/constants/env.npm");
16
17
  var _load = require("../../../common/window/load");
17
18
  var _eventListenerOpts = require("../../../common/event-listener/event-listener-opts");
18
19
  var _globalScope = require("../../../common/util/global-scope");
19
- var _featureBase = require("../../utils/feature-base");
20
+ var _aggregateBase = require("../../utils/aggregate-base");
20
21
  var _stringify = require("../../../common/util/stringify");
21
- class Aggregate extends _featureBase.FeatureBase {
22
+ class Aggregate extends _aggregateBase.AggregateBase {
22
23
  static featureName = _constants.FEATURE_NAME;
23
24
  constructor(agentIdentifier, aggregator) {
24
25
  super(agentIdentifier, aggregator, _constants.FEATURE_NAME);
@@ -82,6 +83,9 @@ class Aggregate extends _featureBase.FeatureBase {
82
83
  });
83
84
  });
84
85
  }
86
+ (0, _polyfillDetection.getPolyfills)().forEach(polyfill => {
87
+ this.storeSupportabilityMetrics('Polyfill/' + polyfill + '/Detected');
88
+ });
85
89
 
86
90
  // file protocol detection
87
91
  if ((0, _protocol.isFileProtocol)()) {
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getPolyfills = getPolyfills;
7
+ /**
8
+ * This file is used as a replacement for the polyfill-detection.es5.js
9
+ * file when running the polyfills webpack build.
10
+ * @returns {string[]} an empty array
11
+ */
12
+ function getPolyfills() {
13
+ return [];
14
+ }
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ var _polyfillDetection = require("./polyfill-detection.es5");
4
+ afterEach(() => {
5
+ jest.resetAllMocks();
6
+ });
7
+ test('should always return an empty array', () => {
8
+ const originalFn = Array.from;
9
+ Array.from = jest.fn(function () {
10
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
11
+ args[_key] = arguments[_key];
12
+ }
13
+ return originalFn.apply(this, args);
14
+ });
15
+ expect((0, _polyfillDetection.getPolyfills)()).toEqual([]);
16
+ Array.from = originalFn;
17
+ });
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getPolyfills = getPolyfills;
7
+ const detectionRegex = /\{ \[native code\] \}/;
8
+ const POLYFILLS = {
9
+ FUNCTION_BIND: 'Function.bind',
10
+ FUNCTION_APPLY: 'Function.apply',
11
+ FUNCTION_CALL: 'Function.call',
12
+ ARRAY_INCLUDES: 'Array.includes',
13
+ ARRAY_FROM: 'Array.from',
14
+ ARRAY_FIND: 'Array.find',
15
+ ARRAY_FLAT: 'Array.flat',
16
+ ARRAY_FLATMAP: 'Array.flatMap',
17
+ OBJECT_ASSIGN: 'Object.assign',
18
+ OBJECT_ENTRIES: 'Object.entries',
19
+ OBJECT_VALUES: 'Object.values',
20
+ MAP: 'Map',
21
+ SET: 'Set',
22
+ WEAK_MAP: 'WeakMap',
23
+ WEAK_SET: 'WeakSet'
24
+ };
25
+
26
+ /**
27
+ * Checks for native globals to see if they have been polyfilled by customer code.
28
+ * @returns {string[]} Array of methods that were detected to have been polyfilled
29
+ */
30
+ function getPolyfills() {
31
+ const polyfills = [];
32
+ const mockFunction = function () {/* noop */};
33
+ try {
34
+ if (typeof mockFunction.bind === 'function' && !detectionRegex.test(mockFunction.bind.toString())) polyfills.push(POLYFILLS.FUNCTION_BIND);
35
+ if (typeof mockFunction.apply === 'function' && !detectionRegex.test(mockFunction.apply.toString())) polyfills.push(POLYFILLS.FUNCTION_APPLY);
36
+ if (typeof mockFunction.call === 'function' && !detectionRegex.test(mockFunction.call.toString())) polyfills.push(POLYFILLS.FUNCTION_CALL);
37
+ if (typeof [].includes === 'function' && !detectionRegex.test([].includes.toString())) polyfills.push(POLYFILLS.ARRAY_INCLUDES);
38
+ if (typeof Array.from === 'function' && !detectionRegex.test(Array.from.toString())) polyfills.push(POLYFILLS.ARRAY_FROM);
39
+ if (typeof [].find === 'function' && !detectionRegex.test([].find.toString())) polyfills.push(POLYFILLS.ARRAY_FIND);
40
+ if (typeof [].flat === 'function' && !detectionRegex.test([].flat.toString())) polyfills.push(POLYFILLS.ARRAY_FLAT);
41
+ if (typeof [].flatMap === 'function' && !detectionRegex.test([].flatMap.toString())) polyfills.push(POLYFILLS.ARRAY_FLATMAP);
42
+ if (typeof Object.assign === 'function' && !detectionRegex.test(Object.assign.toString())) polyfills.push(POLYFILLS.OBJECT_ASSIGN);
43
+ if (typeof Object.entries === 'function' && !detectionRegex.test(Object.entries.toString())) polyfills.push(POLYFILLS.OBJECT_ENTRIES);
44
+ if (typeof Object.values === 'function' && !detectionRegex.test(Object.values.toString())) polyfills.push(POLYFILLS.OBJECT_VALUES);
45
+ if (typeof Map === 'function' && !detectionRegex.test(Map.toString())) polyfills.push(POLYFILLS.MAP);
46
+ if (typeof Set === 'function' && !detectionRegex.test(Set.toString())) polyfills.push(POLYFILLS.SET);
47
+ if (typeof WeakMap === 'function' && !detectionRegex.test(WeakMap.toString())) polyfills.push(POLYFILLS.WEAK_MAP);
48
+ if (typeof WeakSet === 'function' && !detectionRegex.test(WeakSet.toString())) polyfills.push(POLYFILLS.WEAK_SET);
49
+ } catch (err) {
50
+ // Possibly not supported
51
+ }
52
+ return polyfills;
53
+ }
@@ -0,0 +1,165 @@
1
+ "use strict";
2
+
3
+ var _polyfillDetection = require("./polyfill-detection");
4
+ /* eslint-disable no-global-assign */
5
+ /* eslint-disable no-extend-native */
6
+
7
+ // DO NOT test Function.prototype.apply, it causes recursion in Jest
8
+
9
+ test('should return an empty array when nothing is polyfilled', () => {
10
+ expect((0, _polyfillDetection.getPolyfills)()).toEqual([]);
11
+ });
12
+ test('should indicate Function.prototype.bind is polyfilled', () => {
13
+ const originalFn = Function.prototype.bind;
14
+ Function.prototype.bind = jest.fn(function () {
15
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
16
+ args[_key] = arguments[_key];
17
+ }
18
+ return originalFn.apply(this, args);
19
+ });
20
+ expect((0, _polyfillDetection.getPolyfills)()).toEqual(['Function.bind']);
21
+ Function.prototype.bind = originalFn;
22
+ });
23
+ test('should indicate Function.prototype.call is polyfilled', () => {
24
+ const originalFn = Function.prototype.call;
25
+ Function.prototype.call = jest.fn(function () {
26
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
27
+ args[_key2] = arguments[_key2];
28
+ }
29
+ return originalFn.apply(this, args);
30
+ });
31
+ expect((0, _polyfillDetection.getPolyfills)()).toEqual(['Function.call']);
32
+ Function.prototype.call = originalFn;
33
+ });
34
+ test('should indicate Array.prototype.includes is polyfilled', () => {
35
+ const originalFn = Array.prototype.includes;
36
+ Array.prototype.includes = jest.fn(function () {
37
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
38
+ args[_key3] = arguments[_key3];
39
+ }
40
+ return originalFn.apply(this, args);
41
+ });
42
+ expect((0, _polyfillDetection.getPolyfills)()).toEqual(['Array.includes']);
43
+ Array.prototype.includes = originalFn;
44
+ });
45
+ test('should indicate Array.from is polyfilled', () => {
46
+ const originalFn = Array.from;
47
+ Array.from = jest.fn(function () {
48
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
49
+ args[_key4] = arguments[_key4];
50
+ }
51
+ return originalFn.apply(this, args);
52
+ });
53
+ expect((0, _polyfillDetection.getPolyfills)()).toEqual(['Array.from']);
54
+ Array.from = originalFn;
55
+ });
56
+ test('should indicate Array.prototype.find is polyfilled', () => {
57
+ const originalFn = Array.prototype.find;
58
+ Array.prototype.find = jest.fn(function () {
59
+ for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
60
+ args[_key5] = arguments[_key5];
61
+ }
62
+ return originalFn.apply(this, args);
63
+ });
64
+ expect((0, _polyfillDetection.getPolyfills)()).toEqual(['Array.find']);
65
+ Array.prototype.find = originalFn;
66
+ });
67
+ test('should indicate Array.prototype.flat is polyfilled', () => {
68
+ const originalFn = Array.prototype.flat;
69
+ Array.prototype.flat = jest.fn(function () {
70
+ for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
71
+ args[_key6] = arguments[_key6];
72
+ }
73
+ return originalFn.apply(this, args);
74
+ });
75
+ expect((0, _polyfillDetection.getPolyfills)()).toEqual(['Array.flat']);
76
+ Array.prototype.flat = originalFn;
77
+ });
78
+ test('should indicate Array.prototype.flatMap is polyfilled', () => {
79
+ const originalFn = Array.prototype.flatMap;
80
+ Array.prototype.flatMap = jest.fn(function () {
81
+ for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
82
+ args[_key7] = arguments[_key7];
83
+ }
84
+ return originalFn.apply(this, args);
85
+ });
86
+ expect((0, _polyfillDetection.getPolyfills)()).toEqual(['Array.flatMap']);
87
+ Array.prototype.flatMap = originalFn;
88
+ });
89
+ test('should indicate Object.assign is polyfilled', () => {
90
+ const originalFn = Object.assign;
91
+ Object.assign = jest.fn(function () {
92
+ for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
93
+ args[_key8] = arguments[_key8];
94
+ }
95
+ return originalFn.apply(this, args);
96
+ });
97
+ expect((0, _polyfillDetection.getPolyfills)()).toEqual(['Object.assign']);
98
+ Object.assign = originalFn;
99
+ });
100
+ test('should indicate Object.entries is polyfilled', () => {
101
+ const originalFn = Object.entries;
102
+ Object.entries = jest.fn(function () {
103
+ for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
104
+ args[_key9] = arguments[_key9];
105
+ }
106
+ return originalFn.apply(this, args);
107
+ });
108
+ expect((0, _polyfillDetection.getPolyfills)()).toEqual(['Object.entries']);
109
+ Object.entries = originalFn;
110
+ });
111
+ test('should indicate Object.values is polyfilled', () => {
112
+ const originalFn = Object.values;
113
+ Object.values = jest.fn(function () {
114
+ for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
115
+ args[_key10] = arguments[_key10];
116
+ }
117
+ return originalFn.apply(this, args);
118
+ });
119
+ expect((0, _polyfillDetection.getPolyfills)()).toEqual(['Object.values']);
120
+ Object.values = originalFn;
121
+ });
122
+ test('should indicate Map constructor is polyfilled', () => {
123
+ const originalFn = Map;
124
+ Map = jest.fn(function () {
125
+ for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
126
+ args[_key11] = arguments[_key11];
127
+ }
128
+ return originalFn.apply(this, args);
129
+ });
130
+ expect((0, _polyfillDetection.getPolyfills)()).toEqual(['Map']);
131
+ Map = originalFn;
132
+ });
133
+ test('should indicate Set constructor is polyfilled', () => {
134
+ const originalFn = Set;
135
+ Set = jest.fn(function () {
136
+ for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
137
+ args[_key12] = arguments[_key12];
138
+ }
139
+ return originalFn.apply(this, args);
140
+ });
141
+ expect((0, _polyfillDetection.getPolyfills)()).toEqual(['Set']);
142
+ Set = originalFn;
143
+ });
144
+ test('should indicate WeakMap constructor is polyfilled', () => {
145
+ const originalFn = WeakMap;
146
+ WeakMap = jest.fn(function () {
147
+ for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
148
+ args[_key13] = arguments[_key13];
149
+ }
150
+ return originalFn.apply(this, args);
151
+ });
152
+ expect((0, _polyfillDetection.getPolyfills)()).toEqual(['WeakMap']);
153
+ WeakMap = originalFn;
154
+ });
155
+ test('should indicate WeakSet constructor is polyfilled', () => {
156
+ const originalFn = WeakSet;
157
+ WeakSet = jest.fn(function () {
158
+ for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {
159
+ args[_key14] = arguments[_key14];
160
+ }
161
+ return originalFn.apply(this, args);
162
+ });
163
+ expect((0, _polyfillDetection.getPolyfills)()).toEqual(['WeakSet']);
164
+ WeakSet = originalFn;
165
+ });
@@ -13,13 +13,13 @@ var _config = require("../../../common/config/config");
13
13
  var _constants = require("../constants");
14
14
  var _drain = require("../../../common/drain/drain");
15
15
  var _globalScope = require("../../../common/util/global-scope");
16
- var _featureBase = require("../../utils/feature-base");
16
+ var _aggregateBase = require("../../utils/aggregate-base");
17
17
  /*
18
18
  * Copyright 2020 New Relic Corporation. All rights reserved.
19
19
  * SPDX-License-Identifier: Apache-2.0
20
20
  */
21
21
 
22
- class Aggregate extends _featureBase.FeatureBase {
22
+ class Aggregate extends _aggregateBase.AggregateBase {
23
23
  static featureName = _constants.FEATURE_NAME;
24
24
  constructor(agentIdentifier, aggregator) {
25
25
  var _this;
@@ -20,11 +20,11 @@ var CONSTANTS = _interopRequireWildcard(require("../constants"));
20
20
  var _initializedFeatures = require("./initialized-features");
21
21
  var _globalScope = require("../../../common/util/global-scope");
22
22
  var _drain = require("../../../common/drain/drain");
23
- var _featureBase = require("../../utils/feature-base");
23
+ var _aggregateBase = require("../../utils/aggregate-base");
24
24
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
25
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
26
26
  const jsonp = 'NREUM.setToken';
27
- class Aggregate extends _featureBase.FeatureBase {
27
+ class Aggregate extends _aggregateBase.AggregateBase {
28
28
  static featureName = CONSTANTS.FEATURE_NAME;
29
29
  constructor(agentIdentifier, aggregator) {
30
30
  super(agentIdentifier, aggregator, CONSTANTS.FEATURE_NAME);
@@ -142,7 +142,10 @@ class Aggregate extends _featureBase.FeatureBase {
142
142
 
143
143
  // Capture query bytes sent to RUM call endpoint (currently `1`) as a supportability metric. See metrics aggregator (on unload).
144
144
  agentRuntime.queryBytesSent[protocol] = (agentRuntime.queryBytesSent[protocol] || 0) + queryString?.length || 0;
145
- const isValidJsonp = _submitData.submitData.jsonp(this.getScheme() + '://' + info.beacon + '/' + protocol + '/' + info.licenseKey + queryString, jsonp);
145
+ const isValidJsonp = _submitData.submitData.jsonp({
146
+ url: this.getScheme() + '://' + info.beacon + '/' + protocol + '/' + info.licenseKey + '?' + queryString,
147
+ jsonp
148
+ });
146
149
  // Usually `drain` is invoked automatically after processing feature flags contained in the JSONP callback from
147
150
  // ingest (see `activateFeatures`), so when JSONP cannot execute (as with module workers), we drain manually.
148
151
  if (!isValidJsonp) (0, _drain.drain)(this.agentIdentifier, CONSTANTS.FEATURE_NAME);
@@ -18,13 +18,13 @@ var _config = require("../../../common/config/config");
18
18
  var _constants = require("../constants");
19
19
  var _drain = require("../../../common/drain/drain");
20
20
  var _features = require("../../../loaders/features/features");
21
- var _featureBase = require("../../utils/feature-base");
21
+ var _aggregateBase = require("../../utils/aggregate-base");
22
22
  /*
23
23
  * Copyright 2020 New Relic Corporation. All rights reserved.
24
24
  * SPDX-License-Identifier: Apache-2.0
25
25
  */
26
26
 
27
- class Aggregate extends _featureBase.FeatureBase {
27
+ class Aggregate extends _aggregateBase.AggregateBase {
28
28
  static featureName = _constants.FEATURE_NAME;
29
29
  constructor(agentIdentifier, aggregator) {
30
30
  var _this;