@newrelic/browser-agent 1.262.0 → 1.264.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 (259) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +2 -2
  3. package/dist/cjs/cdn/experimental.js +3 -7
  4. package/dist/cjs/cdn/pro.js +2 -2
  5. package/dist/cjs/cdn/spa.js +2 -2
  6. package/dist/cjs/common/aggregate/aggregator.js +3 -3
  7. package/dist/cjs/common/config/state/configurable.js +4 -4
  8. package/dist/cjs/common/config/state/init.js +11 -6
  9. package/dist/cjs/common/constants/env.cdn.js +1 -1
  10. package/dist/cjs/common/constants/env.npm.js +1 -1
  11. package/dist/cjs/common/constants/runtime.js +1 -3
  12. package/dist/cjs/common/context/shared-context.js +2 -2
  13. package/dist/cjs/common/drain/drain.js +5 -5
  14. package/dist/cjs/common/harvest/harvest.js +3 -3
  15. package/dist/cjs/common/serialize/bel-serializer.js +2 -2
  16. package/dist/cjs/common/session/session-entity.js +3 -3
  17. package/dist/cjs/common/timing/time-keeper.js +13 -2
  18. package/dist/cjs/common/url/encode.js +3 -5
  19. package/dist/cjs/common/util/console.js +3 -4
  20. package/dist/cjs/common/util/obfuscate.js +3 -3
  21. package/dist/cjs/common/util/submit-data.js +0 -1
  22. package/dist/cjs/common/vitals/vital-metric.js +1 -1
  23. package/dist/cjs/common/wrap/wrap-logger.js +1 -2
  24. package/dist/cjs/common/wrap/wrap-xhr.js +1 -1
  25. package/dist/cjs/features/ajax/aggregate/index.js +1 -1
  26. package/dist/cjs/features/ajax/instrument/index.js +1 -1
  27. package/dist/cjs/features/generic_events/aggregate/index.js +137 -0
  28. package/dist/cjs/features/generic_events/constants.js +8 -0
  29. package/dist/cjs/features/generic_events/index.js +12 -0
  30. package/dist/cjs/features/generic_events/instrument/index.js +27 -0
  31. package/dist/cjs/features/jserrors/aggregate/index.js +13 -12
  32. package/dist/cjs/features/jserrors/instrument/index.js +1 -1
  33. package/dist/cjs/features/logging/aggregate/index.js +6 -6
  34. package/dist/cjs/features/logging/constants.js +2 -5
  35. package/dist/cjs/features/logging/instrument/index.js +1 -1
  36. package/dist/cjs/features/metrics/aggregate/index.js +17 -1
  37. package/dist/cjs/features/metrics/instrument/index.js +1 -1
  38. package/dist/cjs/features/page_action/instrument/index.js +6 -6
  39. package/dist/cjs/features/page_view_event/aggregate/index.js +21 -5
  40. package/dist/cjs/features/page_view_event/aggregate/initialized-features.js +1 -1
  41. package/dist/cjs/features/page_view_event/instrument/index.js +1 -1
  42. package/dist/cjs/features/page_view_timing/aggregate/index.js +3 -3
  43. package/dist/cjs/features/page_view_timing/instrument/index.js +1 -1
  44. package/dist/cjs/features/session_replay/aggregate/index.js +3 -3
  45. package/dist/cjs/features/session_replay/instrument/index.js +1 -1
  46. package/dist/cjs/features/session_replay/shared/recorder.js +1 -1
  47. package/dist/cjs/features/session_replay/shared/stylesheet-evaluator.js +1 -1
  48. package/dist/cjs/features/session_trace/aggregate/index.js +1 -1
  49. package/dist/cjs/features/session_trace/aggregate/trace/storage.js +2 -2
  50. package/dist/cjs/features/session_trace/instrument/index.js +1 -1
  51. package/dist/cjs/features/soft_navigations/aggregate/bel-node.js +1 -1
  52. package/dist/cjs/features/soft_navigations/aggregate/index.js +1 -1
  53. package/dist/cjs/features/soft_navigations/aggregate/interaction.js +5 -5
  54. package/dist/cjs/features/soft_navigations/instrument/index.js +1 -1
  55. package/dist/cjs/features/spa/aggregate/index.js +3 -4
  56. package/dist/cjs/features/spa/aggregate/interaction.js +2 -2
  57. package/dist/cjs/features/spa/aggregate/serializer.js +1 -2
  58. package/dist/cjs/features/spa/instrument/index.js +1 -1
  59. package/dist/cjs/features/utils/aggregate-base.js +6 -3
  60. package/dist/cjs/features/utils/instrument-base.js +2 -2
  61. package/dist/cjs/features/utils/lazy-feature-loader.js +2 -2
  62. package/dist/cjs/index.js +21 -0
  63. package/dist/cjs/loaders/agent-base.js +1 -5
  64. package/dist/cjs/loaders/agent.js +3 -4
  65. package/dist/cjs/loaders/api/api.js +10 -8
  66. package/dist/cjs/loaders/api/apiAsync.js +1 -1
  67. package/dist/cjs/loaders/browser-agent.js +4 -3
  68. package/dist/cjs/loaders/configure/configure.js +4 -3
  69. package/dist/cjs/loaders/features/features.js +8 -4
  70. package/dist/cjs/loaders/micro-agent.js +6 -6
  71. package/dist/esm/cdn/experimental.js +2 -5
  72. package/dist/esm/cdn/pro.js +2 -2
  73. package/dist/esm/cdn/spa.js +2 -2
  74. package/dist/esm/common/aggregate/aggregator.js +3 -3
  75. package/dist/esm/common/config/state/configurable.js +4 -4
  76. package/dist/esm/common/config/state/init.js +11 -6
  77. package/dist/esm/common/constants/env.cdn.js +1 -1
  78. package/dist/esm/common/constants/env.npm.js +1 -1
  79. package/dist/esm/common/constants/runtime.js +0 -2
  80. package/dist/esm/common/context/shared-context.js +2 -2
  81. package/dist/esm/common/drain/drain.js +5 -5
  82. package/dist/esm/common/harvest/harvest.js +4 -4
  83. package/dist/esm/common/serialize/bel-serializer.js +2 -2
  84. package/dist/esm/common/session/session-entity.js +4 -4
  85. package/dist/esm/common/timing/time-keeper.js +12 -2
  86. package/dist/esm/common/url/encode.js +3 -5
  87. package/dist/esm/common/util/console.js +3 -4
  88. package/dist/esm/common/util/obfuscate.js +3 -3
  89. package/dist/esm/common/util/submit-data.js +0 -1
  90. package/dist/esm/common/vitals/vital-metric.js +1 -1
  91. package/dist/esm/common/wrap/wrap-logger.js +1 -2
  92. package/dist/esm/common/wrap/wrap-xhr.js +1 -1
  93. package/dist/esm/features/ajax/aggregate/index.js +1 -1
  94. package/dist/esm/features/ajax/instrument/index.js +1 -1
  95. package/dist/esm/features/generic_events/aggregate/index.js +129 -0
  96. package/dist/esm/features/generic_events/constants.js +2 -0
  97. package/dist/esm/features/generic_events/index.js +1 -0
  98. package/dist/esm/features/generic_events/instrument/index.js +20 -0
  99. package/dist/esm/features/jserrors/aggregate/index.js +13 -12
  100. package/dist/esm/features/jserrors/instrument/index.js +1 -1
  101. package/dist/esm/features/logging/aggregate/index.js +7 -7
  102. package/dist/esm/features/logging/constants.js +1 -4
  103. package/dist/esm/features/logging/instrument/index.js +1 -1
  104. package/dist/esm/features/metrics/aggregate/index.js +17 -1
  105. package/dist/esm/features/metrics/instrument/index.js +1 -1
  106. package/dist/esm/features/page_action/instrument/index.js +7 -6
  107. package/dist/esm/features/page_view_event/aggregate/index.js +22 -6
  108. package/dist/esm/features/page_view_event/aggregate/initialized-features.js +1 -1
  109. package/dist/esm/features/page_view_event/instrument/index.js +1 -1
  110. package/dist/esm/features/page_view_timing/aggregate/index.js +3 -3
  111. package/dist/esm/features/page_view_timing/instrument/index.js +1 -1
  112. package/dist/esm/features/session_replay/aggregate/index.js +3 -3
  113. package/dist/esm/features/session_replay/instrument/index.js +1 -1
  114. package/dist/esm/features/session_replay/shared/recorder.js +1 -1
  115. package/dist/esm/features/session_replay/shared/stylesheet-evaluator.js +1 -1
  116. package/dist/esm/features/session_trace/aggregate/index.js +1 -1
  117. package/dist/esm/features/session_trace/aggregate/trace/storage.js +2 -2
  118. package/dist/esm/features/session_trace/instrument/index.js +1 -1
  119. package/dist/esm/features/soft_navigations/aggregate/bel-node.js +1 -1
  120. package/dist/esm/features/soft_navigations/aggregate/index.js +1 -1
  121. package/dist/esm/features/soft_navigations/aggregate/interaction.js +5 -5
  122. package/dist/esm/features/soft_navigations/instrument/index.js +1 -1
  123. package/dist/esm/features/spa/aggregate/index.js +3 -4
  124. package/dist/esm/features/spa/aggregate/interaction.js +2 -2
  125. package/dist/esm/features/spa/aggregate/serializer.js +1 -2
  126. package/dist/esm/features/spa/instrument/index.js +1 -1
  127. package/dist/esm/features/utils/aggregate-base.js +7 -4
  128. package/dist/esm/features/utils/instrument-base.js +2 -2
  129. package/dist/esm/features/utils/lazy-feature-loader.js +2 -2
  130. package/dist/esm/index.js +3 -0
  131. package/dist/esm/loaders/agent-base.js +1 -5
  132. package/dist/esm/loaders/agent.js +3 -4
  133. package/dist/esm/loaders/api/api.js +10 -8
  134. package/dist/esm/loaders/api/apiAsync.js +1 -1
  135. package/dist/esm/loaders/browser-agent.js +3 -2
  136. package/dist/esm/loaders/configure/configure.js +4 -3
  137. package/dist/esm/loaders/features/features.js +8 -4
  138. package/dist/esm/loaders/micro-agent.js +6 -6
  139. package/dist/types/common/aggregate/aggregator.d.ts.map +1 -1
  140. package/dist/types/common/config/state/init.d.ts.map +1 -1
  141. package/dist/types/common/constants/runtime.d.ts +0 -1
  142. package/dist/types/common/constants/runtime.d.ts.map +1 -1
  143. package/dist/types/common/drain/drain.d.ts.map +1 -1
  144. package/dist/types/common/serialize/bel-serializer.d.ts.map +1 -1
  145. package/dist/types/common/timing/time-keeper.d.ts +2 -1
  146. package/dist/types/common/timing/time-keeper.d.ts.map +1 -1
  147. package/dist/types/common/url/encode.d.ts.map +1 -1
  148. package/dist/types/common/util/console.d.ts +1 -1
  149. package/dist/types/common/util/console.d.ts.map +1 -1
  150. package/dist/types/common/util/submit-data.d.ts.map +1 -1
  151. package/dist/types/common/wrap/wrap-logger.d.ts.map +1 -1
  152. package/dist/types/features/{page_action → generic_events}/aggregate/index.d.ts +7 -5
  153. package/dist/types/features/generic_events/aggregate/index.d.ts.map +1 -0
  154. package/dist/types/features/generic_events/constants.d.ts +2 -0
  155. package/dist/types/features/generic_events/constants.d.ts.map +1 -0
  156. package/dist/types/features/generic_events/index.d.ts +2 -0
  157. package/dist/types/features/generic_events/index.d.ts.map +1 -0
  158. package/dist/types/features/generic_events/instrument/index.d.ts +6 -0
  159. package/dist/types/features/generic_events/instrument/index.d.ts.map +1 -0
  160. package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -1
  161. package/dist/types/features/logging/constants.d.ts +0 -3
  162. package/dist/types/features/logging/constants.d.ts.map +1 -1
  163. package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -1
  164. package/dist/types/features/page_action/instrument/index.d.ts +5 -4
  165. package/dist/types/features/page_action/instrument/index.d.ts.map +1 -1
  166. package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -1
  167. package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -1
  168. package/dist/types/features/session_replay/shared/recorder.d.ts.map +1 -1
  169. package/dist/types/features/spa/aggregate/index.d.ts.map +1 -1
  170. package/dist/types/features/spa/aggregate/interaction.d.ts.map +1 -1
  171. package/dist/types/features/spa/aggregate/serializer.d.ts.map +1 -1
  172. package/dist/types/features/utils/aggregate-base.d.ts.map +1 -1
  173. package/dist/types/index.d.ts +3 -0
  174. package/dist/types/loaders/agent-base.d.ts +0 -1
  175. package/dist/types/loaders/agent-base.d.ts.map +1 -1
  176. package/dist/types/loaders/agent.d.ts.map +1 -1
  177. package/dist/types/loaders/api/api.d.ts.map +1 -1
  178. package/dist/types/loaders/browser-agent.d.ts.map +1 -1
  179. package/dist/types/loaders/configure/configure.d.ts.map +1 -1
  180. package/dist/types/loaders/features/features.d.ts +1 -0
  181. package/dist/types/loaders/features/features.d.ts.map +1 -1
  182. package/package.json +25 -6
  183. package/src/cdn/experimental.js +2 -4
  184. package/src/cdn/pro.js +2 -2
  185. package/src/cdn/spa.js +2 -2
  186. package/src/common/aggregate/aggregator.js +2 -3
  187. package/src/common/config/state/configurable.js +4 -4
  188. package/src/common/config/state/init.js +6 -4
  189. package/src/common/constants/runtime.js +0 -2
  190. package/src/common/context/shared-context.js +2 -2
  191. package/src/common/drain/drain.js +4 -5
  192. package/src/common/harvest/harvest.js +4 -4
  193. package/src/common/serialize/bel-serializer.js +1 -2
  194. package/src/common/session/session-entity.js +4 -4
  195. package/src/common/timing/time-keeper.js +14 -2
  196. package/src/common/url/encode.js +2 -3
  197. package/src/common/util/console.js +3 -4
  198. package/src/common/util/obfuscate.js +3 -3
  199. package/src/common/util/submit-data.js +0 -1
  200. package/src/common/wrap/wrap-logger.js +1 -2
  201. package/src/common/wrap/wrap-xhr.js +1 -1
  202. package/src/features/generic_events/aggregate/index.js +133 -0
  203. package/src/features/generic_events/constants.js +3 -0
  204. package/src/features/generic_events/index.js +1 -0
  205. package/src/features/generic_events/instrument/index.js +22 -0
  206. package/src/features/jserrors/aggregate/index.js +4 -5
  207. package/src/features/logging/aggregate/index.js +6 -6
  208. package/src/features/logging/constants.js +0 -4
  209. package/src/features/metrics/aggregate/index.js +12 -0
  210. package/src/features/page_action/instrument/index.js +6 -6
  211. package/src/features/page_view_event/aggregate/index.js +22 -5
  212. package/src/features/page_view_event/aggregate/initialized-features.js +1 -1
  213. package/src/features/page_view_timing/aggregate/index.js +1 -2
  214. package/src/features/session_replay/aggregate/index.js +1 -1
  215. package/src/features/session_replay/shared/recorder.js +1 -1
  216. package/src/features/spa/aggregate/index.js +2 -3
  217. package/src/features/spa/aggregate/interaction.js +1 -2
  218. package/src/features/spa/aggregate/serializer.js +1 -2
  219. package/src/features/utils/aggregate-base.js +7 -4
  220. package/src/features/utils/instrument-base.js +2 -2
  221. package/src/features/utils/lazy-feature-loader.js +2 -2
  222. package/src/index.js +3 -0
  223. package/src/loaders/agent-base.js +1 -5
  224. package/src/loaders/agent.js +3 -4
  225. package/src/loaders/api/api.js +10 -8
  226. package/src/loaders/api/apiAsync.js +1 -1
  227. package/src/loaders/browser-agent.js +5 -3
  228. package/src/loaders/configure/configure.js +5 -1
  229. package/src/loaders/features/features.js +8 -4
  230. package/src/loaders/micro-agent.js +6 -6
  231. package/dist/cjs/cdn/polyfills/lite.js +0 -16
  232. package/dist/cjs/cdn/polyfills/pro.js +0 -21
  233. package/dist/cjs/cdn/polyfills/spa.js +0 -22
  234. package/dist/cjs/cdn/polyfills.js +0 -24
  235. package/dist/cjs/common/util/map-own.js +0 -31
  236. package/dist/cjs/features/page_action/aggregate/index.js +0 -121
  237. package/dist/esm/cdn/polyfills/lite.js +0 -14
  238. package/dist/esm/cdn/polyfills/pro.js +0 -19
  239. package/dist/esm/cdn/polyfills/spa.js +0 -20
  240. package/dist/esm/cdn/polyfills.js +0 -27
  241. package/dist/esm/common/util/map-own.js +0 -24
  242. package/dist/esm/features/page_action/aggregate/index.js +0 -114
  243. package/dist/types/cdn/polyfills/lite.d.ts +0 -2
  244. package/dist/types/cdn/polyfills/lite.d.ts.map +0 -1
  245. package/dist/types/cdn/polyfills/pro.d.ts +0 -2
  246. package/dist/types/cdn/polyfills/pro.d.ts.map +0 -1
  247. package/dist/types/cdn/polyfills/spa.d.ts +0 -2
  248. package/dist/types/cdn/polyfills/spa.d.ts.map +0 -1
  249. package/dist/types/cdn/polyfills.d.ts +0 -2
  250. package/dist/types/cdn/polyfills.d.ts.map +0 -1
  251. package/dist/types/common/util/map-own.d.ts +0 -3
  252. package/dist/types/common/util/map-own.d.ts.map +0 -1
  253. package/dist/types/features/page_action/aggregate/index.d.ts.map +0 -1
  254. package/src/cdn/polyfills/lite.js +0 -20
  255. package/src/cdn/polyfills/pro.js +0 -30
  256. package/src/cdn/polyfills/spa.js +0 -32
  257. package/src/cdn/polyfills.js +0 -27
  258. package/src/common/util/map-own.js +0 -22
  259. package/src/features/page_action/aggregate/index.js +0 -114
@@ -19,7 +19,7 @@ var _ajaxNode = require("./ajax-node");
19
19
  var _initialPageLoadInteraction = require("./initial-page-load-interaction");
20
20
  var _interaction = require("./interaction");
21
21
  class Aggregate extends _aggregateBase.AggregateBase {
22
- static featureName = _constants2.FEATURE_NAME;
22
+ static featureName = (() => _constants2.FEATURE_NAME)();
23
23
  constructor(agentIdentifier, aggregator, _ref) {
24
24
  let {
25
25
  domObserver
@@ -16,10 +16,10 @@ var _belNode = require("./bel-node");
16
16
  * link https://github.com/newrelic/nr-querypack/blob/main/schemas/bel/7.qpschema
17
17
  **/
18
18
  class Interaction extends _belNode.BelNode {
19
- id = (0, _uniqueId.generateUuid)(); // unique id that is serialized and used to link interactions with errors
20
- initialPageURL = _runtime.initialLocation;
21
- oldURL = '' + _runtime.globalScope?.location;
22
- newURL = '' + _runtime.globalScope?.location;
19
+ id = (() => (0, _uniqueId.generateUuid)())(); // unique id that is serialized and used to link interactions with errors
20
+ initialPageURL = (() => _runtime.initialLocation)();
21
+ oldURL = (() => '' + _runtime.globalScope?.location)();
22
+ newURL = (() => '' + _runtime.globalScope?.location)();
23
23
  customName;
24
24
  customAttributes = {};
25
25
  customDataByApi = {};
@@ -27,7 +27,7 @@ class Interaction extends _belNode.BelNode {
27
27
  appTime; // only used by initialPageLoad interactions
28
28
  newRoute;
29
29
  /** Internal state of this interaction: in-progress, finished, or cancelled. */
30
- status = _constants.INTERACTION_STATUS.IP;
30
+ status = (() => _constants.INTERACTION_STATUS.IP)();
31
31
  domTimestamp = 0;
32
32
  historyTimestamp = 0;
33
33
  createdByApi = false;
@@ -20,7 +20,7 @@ var _now = require("../../../common/timing/now");
20
20
  const UI_WAIT_INTERVAL = 1 / 10 * 1000; // assume 10 fps
21
21
 
22
22
  class Instrument extends _instrumentBase.InstrumentBase {
23
- static featureName = _constants.FEATURE_NAME;
23
+ static featureName = (() => _constants.FEATURE_NAME)();
24
24
  constructor(agentIdentifier, aggregator) {
25
25
  let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
26
26
  super(agentIdentifier, aggregator, _constants.FEATURE_NAME, auto);
@@ -7,7 +7,6 @@ exports.Aggregate = void 0;
7
7
  var _registerHandler = require("../../../common/event-emitter/register-handler");
8
8
  var _parseUrl = require("../../../common/url/parse-url");
9
9
  var _denyList = require("../../../common/deny-list/deny-list");
10
- var _mapOwn = require("../../../common/util/map-own");
11
10
  var _navTiming = require("../../../common/timing/nav-timing");
12
11
  var _uniqueId = require("../../../common/ids/unique-id");
13
12
  var _interaction = require("./interaction");
@@ -54,7 +53,7 @@ const {
54
53
  originalSetTimeout
55
54
  } = CONSTANTS;
56
55
  class Aggregate extends _aggregateBase.AggregateBase {
57
- static featureName = FEATURE_NAME;
56
+ static featureName = (() => FEATURE_NAME)();
58
57
  constructor(agentIdentifier, aggregator) {
59
58
  super(agentIdentifier, aggregator, FEATURE_NAME);
60
59
  const agentRuntime = (0, _config.getRuntime)(agentIdentifier);
@@ -622,7 +621,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
622
621
 
623
622
  // make sure that newrelic[INTERACTION]() works in end handler
624
623
  state.currentNode = root;
625
- (0, _mapOwn.mapOwn)(interaction.handlers, function (i, cb) {
624
+ Object.values(interaction.handlers || {}).forEach(function (cb) {
626
625
  cb(attrs.store);
627
626
  });
628
627
  setCurrentNode(null);
@@ -702,7 +701,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
702
701
  if (interaction.root?.attrs?.trigger === 'initialPageLoad') smCategory = 'InitialPageLoad';else if (interaction.routeChange) smCategory = 'RouteChange';else smCategory = 'Custom';
703
702
  (0, _handle.handle)(_constants2.SUPPORTABILITY_METRIC_CHANNEL, ["Spa/Interaction/".concat(smCategory, "/Duration/Ms"), Math.max((interaction.root?.end || 0) - (interaction.root?.start || 0), 0)], undefined, _features.FEATURE_NAMES.metrics, baseEE);
704
703
  scheduler?.scheduleHarvest(0);
705
- if (!scheduler) (0, _console.warn)('SPA scheduler is not initialized. Saved interaction is not sent!');
704
+ if (!scheduler) (0, _console.warn)(19);
706
705
  }
707
706
  function isEnabled() {
708
707
  var enabled = (0, _config.getConfigurationValue)(agentIdentifier, 'spa.enabled');
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Interaction = Interaction;
7
7
  var _config = require("../../../common/config/config");
8
- var _mapOwn = require("../../../common/util/map-own");
9
8
  var _contextualEe = require("../../../common/event-emitter/contextual-ee");
10
9
  var _interactionNode = require("./interaction-node");
11
10
  /*
@@ -88,7 +87,8 @@ InteractionPrototype.finish = function finishInteraction() {
88
87
  if (this.onFinished) {
89
88
  this.onFinished(this);
90
89
  }
91
- (0, _mapOwn.mapOwn)((0, _config.getInfo)(interaction.agentIdentifier).jsAttributes, function (attr, value) {
90
+ Object.entries((0, _config.getInfo)(interaction.agentIdentifier).jsAttributes || {}).forEach(_ref => {
91
+ let [attr, value] = _ref;
92
92
  if (!(attr in customAttrs)) customAttrs[attr] = value;
93
93
  });
94
94
  root.end = endTimestamp;
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Serializer = void 0;
7
7
  var _cleanUrl = require("../../../common/url/clean-url");
8
- var _mapOwn = require("../../../common/util/map-own");
9
8
  var _belSerializer = require("../../../common/serialize/bel-serializer");
10
9
  var _sharedContext = require("../../../common/context/shared-context");
11
10
  var _config = require("../../../common/config/config");
@@ -132,7 +131,7 @@ class Serializer extends _sharedContext.SharedContext {
132
131
  // get all navTiming values except navigationStart
133
132
  // (since its the same as interaction.start)
134
133
  // and limit to just the first 20 values we know about
135
- (0, _mapOwn.mapOwn)(navTiming.slice(1, 21), function (i, v) {
134
+ Object.values(navTiming.slice(1, 21) || {}).forEach(v => {
136
135
  if (v !== undefined) {
137
136
  navTimingNode += seperator + (0, _belSerializer.numeric)(v - prev);
138
137
  seperator = ',';
@@ -31,7 +31,7 @@ const {
31
31
  FN_END
32
32
  } = CONSTANTS;
33
33
  class Instrument extends _instrumentBase.InstrumentBase {
34
- static featureName = FEATURE_NAME;
34
+ static featureName = (() => FEATURE_NAME)();
35
35
  constructor(agentIdentifier, aggregator) {
36
36
  var _this;
37
37
  let auto = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
@@ -41,6 +41,8 @@ class AggregateBase extends _featureBase.FeatureBase {
41
41
  });
42
42
  return flagsPromise.catch(err => {
43
43
  this.ee.emit('internal-error', [err]);
44
+ this.blocked = true;
45
+ (0, _drain.deregisterDrain)(this.agentIdentifier, this.featureName);
44
46
  });
45
47
  }
46
48
  drain() {
@@ -55,8 +57,9 @@ class AggregateBase extends _featureBase.FeatureBase {
55
57
  checkConfiguration() {
56
58
  // NOTE: This check has to happen at aggregator load time
57
59
  if (!(0, _config.isConfigured)(this.agentIdentifier)) {
60
+ const cdn = (0, _nreum.gosCDN)();
58
61
  let jsAttributes = {
59
- ...(0, _nreum.gosCDN)().info?.jsAttributes
62
+ ...cdn.info?.jsAttributes
60
63
  };
61
64
  try {
62
65
  jsAttributes = {
@@ -69,9 +72,9 @@ class AggregateBase extends _featureBase.FeatureBase {
69
72
  (0, _configure.configure)({
70
73
  agentIdentifier: this.agentIdentifier
71
74
  }, {
72
- ...(0, _nreum.gosCDN)(),
75
+ ...cdn,
73
76
  info: {
74
- ...(0, _nreum.gosCDN)().info,
77
+ ...cdn.info,
75
78
  jsAttributes
76
79
  },
77
80
  runtime: (0, _config.getRuntime)(this.agentIdentifier)
@@ -92,7 +92,7 @@ class InstrumentBase extends _featureBase.FeatureBase {
92
92
  session = setupAgentSession(this.agentIdentifier);
93
93
  }
94
94
  } catch (e) {
95
- (0, _console.warn)('A problem occurred when starting up session manager. This page will not start or extend any session.', e);
95
+ (0, _console.warn)(20, e);
96
96
  this.ee.emit('internal-error', [e]);
97
97
  if (this.featureName === _features.FEATURE_NAMES.sessionReplay) this.abortHandler?.(); // SR should stop recording if session DNE
98
98
  }
@@ -116,7 +116,7 @@ class InstrumentBase extends _featureBase.FeatureBase {
116
116
  this.featAggregate = new Aggregate(this.agentIdentifier, this.aggregator, argsObjFromInstrument);
117
117
  loadedSuccessfully(true);
118
118
  } catch (e) {
119
- (0, _console.warn)("Downloading and initializing ".concat(this.featureName, " failed..."), e);
119
+ (0, _console.warn)(34, e);
120
120
  this.abortHandler?.(); // undo any important alterations made to the page
121
121
  // not supported yet but nice to do: "abort" this agent's EE for this feature specifically
122
122
  (0, _drain.drain)(this.agentIdentifier, this.featureName, true);
@@ -25,12 +25,12 @@ function lazyFeatureLoader(featureName, featurePart) {
25
25
  return Promise.resolve().then(() => _interopRequireWildcard(require( /* webpackChunkName: "ajax-aggregate" */'../ajax/aggregate')));
26
26
  case _features.FEATURE_NAMES.jserrors:
27
27
  return Promise.resolve().then(() => _interopRequireWildcard(require( /* webpackChunkName: "jserrors-aggregate" */'../jserrors/aggregate')));
28
+ case _features.FEATURE_NAMES.genericEvents:
29
+ return Promise.resolve().then(() => _interopRequireWildcard(require( /* webpackChunkName: "generic_events-aggregate" */'../generic_events/aggregate')));
28
30
  case _features.FEATURE_NAMES.logging:
29
31
  return Promise.resolve().then(() => _interopRequireWildcard(require( /* webpackChunkName: "logging-aggregate" */'../logging/aggregate')));
30
32
  case _features.FEATURE_NAMES.metrics:
31
33
  return Promise.resolve().then(() => _interopRequireWildcard(require( /* webpackChunkName: "metrics-aggregate" */'../metrics/aggregate')));
32
- case _features.FEATURE_NAMES.pageAction:
33
- return Promise.resolve().then(() => _interopRequireWildcard(require( /* webpackChunkName: "page_action-aggregate" */'../page_action/aggregate')));
34
34
  case _features.FEATURE_NAMES.pageViewEvent:
35
35
  return Promise.resolve().then(() => _interopRequireWildcard(require( /* webpackChunkName: "page_view_event-aggregate" */'../page_view_event/aggregate')));
36
36
  case _features.FEATURE_NAMES.pageViewTiming:
package/dist/cjs/index.js CHANGED
@@ -21,12 +21,24 @@ Object.defineProperty(exports, "BrowserAgent", {
21
21
  return _browserAgent.BrowserAgent;
22
22
  }
23
23
  });
24
+ Object.defineProperty(exports, "GenericEvents", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _generic_events.GenericEvents;
28
+ }
29
+ });
24
30
  Object.defineProperty(exports, "JSErrors", {
25
31
  enumerable: true,
26
32
  get: function () {
27
33
  return _jserrors.JSErrors;
28
34
  }
29
35
  });
36
+ Object.defineProperty(exports, "Logging", {
37
+ enumerable: true,
38
+ get: function () {
39
+ return _logging.Logging;
40
+ }
41
+ });
30
42
  Object.defineProperty(exports, "Metrics", {
31
43
  enumerable: true,
32
44
  get: function () {
@@ -57,6 +69,12 @@ Object.defineProperty(exports, "PageViewTiming", {
57
69
  return _page_view_timing.PageViewTiming;
58
70
  }
59
71
  });
72
+ Object.defineProperty(exports, "SessionReplay", {
73
+ enumerable: true,
74
+ get: function () {
75
+ return _session_replay.SessionReplay;
76
+ }
77
+ });
60
78
  Object.defineProperty(exports, "SessionTrace", {
61
79
  enumerable: true,
62
80
  get: function () {
@@ -74,9 +92,12 @@ var _browserAgent = require("./loaders/browser-agent");
74
92
  var _microAgent = require("./loaders/micro-agent");
75
93
  var _ajax = require("./features/ajax");
76
94
  var _jserrors = require("./features/jserrors");
95
+ var _generic_events = require("./features/generic_events");
96
+ var _logging = require("./features/logging");
77
97
  var _metrics = require("./features/metrics");
78
98
  var _page_action = require("./features/page_action");
79
99
  var _page_view_event = require("./features/page_view_event");
80
100
  var _page_view_timing = require("./features/page_view_timing");
81
101
  var _session_trace = require("./features/session_trace");
102
+ var _session_replay = require("./features/session_replay");
82
103
  var _spa = require("./features/spa");
@@ -7,7 +7,6 @@ exports.AgentBase = void 0;
7
7
  var _console = require("../common/util/console");
8
8
  var _constants = require("../features/session_replay/constants");
9
9
  var _uniqueId = require("../common/ids/unique-id");
10
- var _contextualEe = require("../common/event-emitter/contextual-ee");
11
10
  /* eslint-disable n/handle-callback-err */
12
11
 
13
12
  /**
@@ -19,9 +18,6 @@ class AgentBase {
19
18
  constructor() {
20
19
  let agentIdentifier = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : (0, _uniqueId.generateRandomHexString)(16);
21
20
  this.agentIdentifier = agentIdentifier;
22
-
23
- // Assign the observation context to the event emitter, so it knows how to create observation contexts
24
- this.ee = _contextualEe.ee.get(agentIdentifier);
25
21
  }
26
22
 
27
23
  /**
@@ -33,7 +29,7 @@ class AgentBase {
33
29
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
34
30
  args[_key - 1] = arguments[_key];
35
31
  }
36
- if (typeof this.api?.[methodName] !== 'function') (0, _console.warn)("Call to agent api ".concat(methodName, " failed. The API is not currently initialized."));else return this.api[methodName](...args);
32
+ if (typeof this.api?.[methodName] !== 'function') (0, _console.warn)(35, methodName);else return this.api[methodName](...args);
37
33
  }
38
34
 
39
35
  /**
@@ -15,7 +15,6 @@ var _instrument = require("../features/page_view_event/instrument");
15
15
  var _aggregator = require("../common/aggregate/aggregator");
16
16
  var _nreum = require("../common/window/nreum");
17
17
  var _console = require("../common/util/console");
18
- var _stringify = require("../common/util/stringify");
19
18
  var _runtime = require("../common/constants/runtime");
20
19
  // important side effects
21
20
 
@@ -39,7 +38,7 @@ class Agent extends _agentBase.AgentBase {
39
38
  if (!_runtime.globalScope) {
40
39
  // We could not determine the runtime environment. Short-circuite the agent here
41
40
  // to avoid possible exceptions later that may cause issues with customer's application.
42
- (0, _console.warn)('Failed to initialize the agent. Could not determine the runtime environment.');
41
+ (0, _console.warn)(21);
43
42
  return;
44
43
  }
45
44
  this.sharedAggregator = new _aggregator.Aggregator({
@@ -78,11 +77,11 @@ class Agent extends _agentBase.AgentBase {
78
77
  if (!this.runSoftNavOverSpa && InstrumentCtor.featureName === _features.FEATURE_NAMES.softNav) return;
79
78
  const dependencies = (0, _featureDependencies.getFeatureDependencyNames)(InstrumentCtor.featureName);
80
79
  const hasAllDeps = dependencies.every(featName => featName in this.features); // any other feature(s) this depends on should've been initialized on prior iterations by priority order
81
- if (!hasAllDeps) (0, _console.warn)("".concat(InstrumentCtor.featureName, " is enabled but one or more dependent features has not been initialized (").concat((0, _stringify.stringify)(dependencies), "). This may cause unintended consequences or missing data..."));
80
+ if (!hasAllDeps) (0, _console.warn)(36, InstrumentCtor.featureName);
82
81
  this.features[InstrumentCtor.featureName] = new InstrumentCtor(this.agentIdentifier, this.sharedAggregator);
83
82
  });
84
83
  } catch (err) {
85
- (0, _console.warn)('Failed to initialize all enabled instrument classes (agent aborted) -', err);
84
+ (0, _console.warn)(22, err);
86
85
  for (const featName in this.features) {
87
86
  // this.features hold only features that have been instantiated
88
87
  this.features[featName].abortHandler?.();
@@ -44,7 +44,7 @@ function setTopLevelCallers() {
44
44
  let returnVals = [];
45
45
  Object.values(nr.initializedAgents).forEach(val => {
46
46
  if (!val || !val.api) {
47
- (0, _console.warn)("Call to api '".concat(fnName, "' made before agent fully initialized."));
47
+ (0, _console.warn)(38, fnName);
48
48
  } else if (val.exposed && val.api[fnName]) {
49
49
  returnVals.push(val.api[fnName](...args));
50
50
  }
@@ -70,6 +70,7 @@ function setAPI(agentIdentifier, forceDrain) {
70
70
  customAttributes = {},
71
71
  level = _constants4.LOG_LEVELS.INFO
72
72
  } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
73
+ (0, _handle.handle)(_constants.SUPPORTABILITY_METRIC_CHANNEL, ['API/log/called'], undefined, _features.FEATURE_NAMES.metrics, instanceEE);
73
74
  (0, _utils.bufferLog)(instanceEE, message, customAttributes, level);
74
75
  };
75
76
  apiInterface.wrapLogger = function (parent, functionName) {
@@ -77,6 +78,7 @@ function setAPI(agentIdentifier, forceDrain) {
77
78
  customAttributes = {},
78
79
  level = _constants4.LOG_LEVELS.INFO
79
80
  } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
81
+ (0, _handle.handle)(_constants.SUPPORTABILITY_METRIC_CHANNEL, ['API/wrapLogger/called'], undefined, _features.FEATURE_NAMES.metrics, instanceEE);
80
82
  (0, _wrapLogger.wrapLogger)(instanceEE, parent, functionName, {
81
83
  customAttributes,
82
84
  level
@@ -87,7 +89,7 @@ function setAPI(agentIdentifier, forceDrain) {
87
89
  _apiMethods.asyncApiMethods.forEach(fnName => {
88
90
  apiInterface[fnName] = apiCall(prefix, fnName, true, 'api');
89
91
  });
90
- apiInterface.addPageAction = apiCall(prefix, 'addPageAction', true, _features.FEATURE_NAMES.pageAction);
92
+ apiInterface.addPageAction = apiCall(prefix, 'addPageAction', true, _features.FEATURE_NAMES.genericEvents);
91
93
  apiInterface.setPageViewName = function (name, host) {
92
94
  if (typeof name !== 'string') return;
93
95
  if (name.charAt(0) !== '/') name = '/' + name;
@@ -121,11 +123,11 @@ function setAPI(agentIdentifier, forceDrain) {
121
123
  apiInterface.setCustomAttribute = function (name, value) {
122
124
  let persistAttribute = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
123
125
  if (typeof name !== 'string') {
124
- (0, _console.warn)("Failed to execute setCustomAttribute.\nName must be a string type, but a type of <".concat(typeof name, "> was provided."));
126
+ (0, _console.warn)(39, typeof name);
125
127
  return;
126
128
  }
127
129
  if (!(['string', 'number', 'boolean'].includes(typeof value) || value === null)) {
128
- (0, _console.warn)("Failed to execute setCustomAttribute.\nNon-null value must be a string, number or boolean type, but a type of <".concat(typeof value, "> was provided."));
130
+ (0, _console.warn)(40, typeof value);
129
131
  return;
130
132
  }
131
133
  return appendJsAttribute(name, value, 'setCustomAttribute', persistAttribute);
@@ -137,7 +139,7 @@ function setAPI(agentIdentifier, forceDrain) {
137
139
  */
138
140
  apiInterface.setUserId = function (value) {
139
141
  if (!(typeof value === 'string' || value === null)) {
140
- (0, _console.warn)("Failed to execute setUserId.\nNon-null value must be a string type, but a type of <".concat(typeof value, "> was provided."));
142
+ (0, _console.warn)(41, typeof value);
141
143
  return;
142
144
  }
143
145
  return appendJsAttribute('enduser.id', value, 'setUserId', true);
@@ -150,7 +152,7 @@ function setAPI(agentIdentifier, forceDrain) {
150
152
  */
151
153
  apiInterface.setApplicationVersion = function (value) {
152
154
  if (!(typeof value === 'string' || value === null)) {
153
- (0, _console.warn)("Failed to execute setApplicationVersion. Expected <String | null>, but got <".concat(typeof value, ">."));
155
+ (0, _console.warn)(42, typeof value);
154
156
  return;
155
157
  }
156
158
  return appendJsAttribute('application.version', value, 'setApplicationVersion', false);
@@ -160,7 +162,7 @@ function setAPI(agentIdentifier, forceDrain) {
160
162
  (0, _handle.handle)(_constants.SUPPORTABILITY_METRIC_CHANNEL, ['API/start/called'], undefined, _features.FEATURE_NAMES.metrics, instanceEE);
161
163
  instanceEE.emit('manual-start-all');
162
164
  } catch (err) {
163
- (0, _console.warn)('An unexpected issue occurred', err);
165
+ (0, _console.warn)(23, err);
164
166
  }
165
167
  };
166
168
  apiInterface[_constants2.SR_EVENT_EMITTER_TYPES.RECORD] = function () {
@@ -229,7 +231,7 @@ function setAPI(agentIdentifier, forceDrain) {
229
231
  setAPI(agentIdentifier);
230
232
  (0, _drain.drain)(agentIdentifier, 'api');
231
233
  }).catch(err => {
232
- (0, _console.warn)('Downloading runtime APIs failed...', err);
234
+ (0, _console.warn)(27, err);
233
235
  instanceEE.abort();
234
236
  });
235
237
  }
@@ -40,7 +40,7 @@ function setAPI(agentIdentifier) {
40
40
  start: time + _runtime.originTime,
41
41
  origin: 'nr'
42
42
  });
43
- (0, _handle.handle)('api-addPageAction', [time, 'finished'], undefined, _features.FEATURE_NAMES.pageAction, instanceEE);
43
+ (0, _handle.handle)('api-addPageAction', [time, 'finished'], undefined, _features.FEATURE_NAMES.genericEvents, instanceEE);
44
44
  }
45
45
  function addToTrace(t, evt) {
46
46
  if (!(evt && typeof evt === 'object' && evt.name && evt.start)) return;
@@ -12,8 +12,9 @@ var _instrument4 = require("../features/jserrors/instrument");
12
12
  var _instrument5 = require("../features/ajax/instrument");
13
13
  var _instrument6 = require("../features/session_trace/instrument");
14
14
  var _instrument7 = require("../features/spa/instrument");
15
- var _instrument8 = require("../features/page_action/instrument");
16
- var _instrument9 = require("../features/session_replay/instrument");
15
+ var _instrument8 = require("../features/session_replay/instrument");
16
+ var _instrument9 = require("../features/generic_events/instrument");
17
+ var _instrument10 = require("../features/logging/instrument");
17
18
  /**
18
19
  * An agent class with all feature modules available. Features may be disabled and enabled via runtime configuration.
19
20
  * The BrowserAgent class is the most convenient and reliable option for most use cases.
@@ -22,7 +23,7 @@ class BrowserAgent extends _agent.Agent {
22
23
  constructor(args) {
23
24
  super({
24
25
  ...args,
25
- features: [_instrument5.Instrument, _instrument.Instrument, _instrument2.Instrument, _instrument6.Instrument, _instrument3.Instrument, _instrument8.Instrument, _instrument4.Instrument, _instrument7.Instrument, _instrument9.Instrument],
26
+ features: [_instrument5.Instrument, _instrument.Instrument, _instrument2.Instrument, _instrument6.Instrument, _instrument3.Instrument, _instrument4.Instrument, _instrument7.Instrument, _instrument8.Instrument, _instrument9.Instrument, _instrument10.Instrument],
26
27
  loaderType: 'browser-agent'
27
28
  });
28
29
  }
@@ -10,6 +10,7 @@ var _config = require("../../common/config/config");
10
10
  var _featureFlags = require("../../common/util/feature-flags");
11
11
  var _runtime = require("../../common/constants/runtime");
12
12
  var _publicPath = require("./public-path");
13
+ var _contextualEe = require("../../common/event-emitter/contextual-ee");
13
14
  let alreadySetOnce = false; // the configure() function can run multiple times in agent lifecycle
14
15
 
15
16
  /**
@@ -24,11 +25,10 @@ function configure(agent) {
24
25
  init,
25
26
  info,
26
27
  loader_config,
27
- runtime = {
28
- loaderType
29
- },
28
+ runtime = {},
30
29
  exposed = true
31
30
  } = opts;
31
+ runtime.loaderType = loaderType;
32
32
  const nr = (0, _nreum.gosCDN)();
33
33
  if (!info) {
34
34
  init = nr.init;
@@ -62,6 +62,7 @@ function configure(agent) {
62
62
  runtime.denyList = [...(updatedInit.ajax.deny_list || []), ...(updatedInit.ajax.block_internal ? internalTrafficList : [])];
63
63
  runtime.ptid = agent.agentIdentifier;
64
64
  (0, _config.setRuntime)(agent.agentIdentifier, runtime);
65
+ agent.ee = _contextualEe.ee.get(agent.agentIdentifier);
65
66
  if (agent.api === undefined) agent.api = (0, _api.setAPI)(agent.agentIdentifier, forceDrain, agent.runSoftNavOverSpa);
66
67
  if (agent.exposed === undefined) agent.exposed = exposed;
67
68
  alreadySetOnce = true;
@@ -6,9 +6,13 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.featurePriority = exports.FEATURE_NAMES = void 0;
7
7
  const FEATURE_NAMES = exports.FEATURE_NAMES = {
8
8
  ajax: 'ajax',
9
+ genericEvents: 'generic_events',
9
10
  jserrors: 'jserrors',
10
11
  logging: 'logging',
11
12
  metrics: 'metrics',
13
+ /**
14
+ * @deprecated This feature has been replaced by Generic Events. Use/Import `GenericEvents` instead. This wrapper will be removed in a future release
15
+ */
12
16
  pageAction: 'page_action',
13
17
  pageViewEvent: 'page_view_event',
14
18
  pageViewTiming: 'page_view_timing',
@@ -30,8 +34,8 @@ const featurePriority = exports.featurePriority = {
30
34
  [FEATURE_NAMES.spa]: 5,
31
35
  [FEATURE_NAMES.ajax]: 6,
32
36
  [FEATURE_NAMES.sessionTrace]: 7,
33
- [FEATURE_NAMES.pageAction]: 8,
34
- [FEATURE_NAMES.softNav]: 9,
35
- [FEATURE_NAMES.sessionReplay]: 10,
36
- [FEATURE_NAMES.logging]: 11
37
+ [FEATURE_NAMES.softNav]: 8,
38
+ [FEATURE_NAMES.sessionReplay]: 9,
39
+ [FEATURE_NAMES.logging]: 10,
40
+ [FEATURE_NAMES.genericEvents]: 11
37
41
  };
@@ -17,7 +17,7 @@ var _agentBase = require("./agent-base");
17
17
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
18
18
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; } // loader files
19
19
  // core files
20
- const nonAutoFeatures = [_features.FEATURE_NAMES.jserrors, _features.FEATURE_NAMES.pageAction, _features.FEATURE_NAMES.metrics];
20
+ const nonAutoFeatures = [_features.FEATURE_NAMES.jserrors, _features.FEATURE_NAMES.genericEvents, _features.FEATURE_NAMES.metrics];
21
21
 
22
22
  /**
23
23
  * A minimal agent class designed to only respond to manual user input. As such, this class does not
@@ -65,11 +65,11 @@ class MicroAgent extends _agentBase.AgentBase {
65
65
  const featNames = nonAutoFeatures;
66
66
  if (features === undefined) features = featNames;else {
67
67
  features = Array.isArray(features) && features.length ? features : [features];
68
- if (features.some(f => !featNames.includes(f))) return (0, _console.warn)("Invalid feature name supplied. Acceptable feature names are: ".concat(featNames));
68
+ if (features.some(f => !featNames.includes(f))) return (0, _console.warn)(37, featNames);
69
69
  if (!features.includes(_features.FEATURE_NAMES.pageViewEvent)) features.push(_features.FEATURE_NAMES.pageViewEvent);
70
70
  }
71
71
  } catch (err) {
72
- (0, _console.warn)('An unexpected issue occurred', err);
72
+ (0, _console.warn)(23, err);
73
73
  }
74
74
  try {
75
75
  const enabledFeatures = (0, _enabledFeatures.getEnabledFeatures)(this.agentIdentifier);
@@ -77,7 +77,7 @@ class MicroAgent extends _agentBase.AgentBase {
77
77
  // a biproduct of doing this is that the "session manager" is automatically handled through importing this feature
78
78
  this.features.page_view_event = new _instrument.Instrument(this.agentIdentifier, this.sharedAggregator);
79
79
  } catch (err) {
80
- (0, _console.warn)('Something prevented the agent from instrumenting.', err);
80
+ (0, _console.warn)(24, err);
81
81
  }
82
82
  (0, _load.onWindowLoad)(() => {
83
83
  // these features do not import an "instrument" file, meaning they are only hooked up to the API.
@@ -93,13 +93,13 @@ class MicroAgent extends _agentBase.AgentBase {
93
93
  Aggregate
94
94
  } = _ref2;
95
95
  this.features[f] = new Aggregate(this.agentIdentifier, this.sharedAggregator);
96
- }).catch(err => (0, _console.warn)('Something prevented the agent from being downloaded.', err));
96
+ }).catch(err => (0, _console.warn)(25, err));
97
97
  }
98
98
  });
99
99
  });
100
100
  return true;
101
101
  } catch (err) {
102
- (0, _console.warn)('Failed to initialize instrument classes.', err);
102
+ (0, _console.warn)(26, err);
103
103
  return false;
104
104
  }
105
105
  }
@@ -16,13 +16,10 @@ import { Instrument as InstrumentErrors } from '../features/jserrors/instrument'
16
16
  import { Instrument as InstrumentXhr } from '../features/ajax/instrument';
17
17
  import { Instrument as InstrumentSessionTrace } from '../features/session_trace/instrument';
18
18
  import { Instrument as InstrumentSessionReplay } from '../features/session_replay/instrument';
19
- // import { Instrument as InstrumentSpa } from '../features/spa/instrument'
19
+ import { Instrument as InstrumentGenericEvents } from '../features/generic_events/instrument';
20
20
  import { Instrument as InstrumentSoftNav } from '../features/soft_navigations/instrument';
21
- import { Instrument as InstrumentPageAction } from '../features/page_action/instrument';
22
21
  import { Instrument as InstrumentLogs } from '../features/logging/instrument';
23
22
  new Agent({
24
- features: [InstrumentXhr, InstrumentPageViewEvent, InstrumentPageViewTiming, InstrumentSessionTrace, InstrumentSessionReplay, InstrumentMetrics, InstrumentPageAction, InstrumentErrors, InstrumentLogs,
25
- // InstrumentSpa,
26
- InstrumentSoftNav],
23
+ features: [InstrumentXhr, InstrumentPageViewEvent, InstrumentPageViewTiming, InstrumentSessionTrace, InstrumentSessionReplay, InstrumentMetrics, InstrumentErrors, InstrumentGenericEvents, InstrumentLogs, InstrumentSoftNav],
27
24
  loaderType: 'experimental'
28
25
  });
@@ -11,9 +11,9 @@ import { Instrument as InstrumentErrors } from '../features/jserrors/instrument'
11
11
  import { Instrument as InstrumentXhr } from '../features/ajax/instrument';
12
12
  import { Instrument as InstrumentSessionTrace } from '../features/session_trace/instrument';
13
13
  import { Instrument as InstrumentSessionReplay } from '../features/session_replay/instrument';
14
- import { Instrument as InstrumentPageAction } from '../features/page_action/instrument';
14
+ import { Instrument as InstrumentGenericEvents } from '../features/generic_events/instrument';
15
15
  import { Instrument as InstrumentLogs } from '../features/logging/instrument';
16
16
  new Agent({
17
- features: [InstrumentPageViewEvent, InstrumentPageViewTiming, InstrumentSessionTrace, InstrumentSessionReplay, InstrumentXhr, InstrumentMetrics, InstrumentPageAction, InstrumentErrors, InstrumentLogs],
17
+ features: [InstrumentPageViewEvent, InstrumentPageViewTiming, InstrumentSessionTrace, InstrumentSessionReplay, InstrumentXhr, InstrumentMetrics, InstrumentErrors, InstrumentGenericEvents, InstrumentLogs],
18
18
  loaderType: 'pro'
19
19
  });
@@ -12,10 +12,10 @@ import { Instrument as InstrumentSessionTrace } from '../features/session_trace/
12
12
  import { Instrument as InstrumentSessionReplay } from '../features/session_replay/instrument';
13
13
  import { Instrument as InstrumentSoftNav } from '../features/soft_navigations/instrument';
14
14
  import { Instrument as InstrumentSpa } from '../features/spa/instrument';
15
- import { Instrument as InstrumentPageAction } from '../features/page_action/instrument';
15
+ import { Instrument as InstrumentGenericEvents } from '../features/generic_events/instrument';
16
16
  import { Instrument as InstrumentLogs } from '../features/logging/instrument';
17
17
  new Agent({
18
- features: [InstrumentXhr, InstrumentPageViewEvent, InstrumentPageViewTiming, InstrumentSessionTrace, InstrumentSessionReplay, InstrumentMetrics, InstrumentPageAction, InstrumentErrors, InstrumentLogs, InstrumentSoftNav, InstrumentSpa // either the softnav or the old spa will be used (not both), but we still need to pack both to avoid dynamic import for instrument files
18
+ features: [InstrumentXhr, InstrumentPageViewEvent, InstrumentPageViewTiming, InstrumentSessionTrace, InstrumentSessionReplay, InstrumentMetrics, InstrumentErrors, InstrumentGenericEvents, InstrumentLogs, InstrumentSoftNav, InstrumentSpa // either the softnav or the old spa will be used (not both), but we still need to pack both to avoid dynamic import for instrument files
19
19
  ],
20
20
  loaderType: 'spa'
21
21
  });
@@ -4,7 +4,6 @@
4
4
  */
5
5
 
6
6
  import { SharedContext } from '../context/shared-context';
7
- import { mapOwn } from '../util/map-own';
8
7
  export class Aggregator extends SharedContext {
9
8
  constructor(parent) {
10
9
  super(parent);
@@ -30,7 +29,7 @@ export class Aggregator extends SharedContext {
30
29
  oldMetrics.count += metrics.count;
31
30
 
32
31
  // iterate through each new metric and merge
33
- mapOwn(metrics, function (key, value) {
32
+ Object.keys(metrics || {}).forEach(key => {
34
33
  // count is a special case handled above
35
34
  if (key === 'count') return;
36
35
  var oldMetric = oldMetrics[key];
@@ -89,7 +88,8 @@ function aggregateMetrics(newMetrics, oldMetrics) {
89
88
  count: 0
90
89
  };
91
90
  oldMetrics.count += 1;
92
- mapOwn(newMetrics, function (key, value) {
91
+ Object.entries(newMetrics || {}).forEach(_ref => {
92
+ let [key, value] = _ref;
93
93
  oldMetrics[key] = updateMetric(value, oldMetrics[key]);
94
94
  });
95
95
  return oldMetrics;
@@ -1,8 +1,8 @@
1
1
  import { warn } from '../../util/console';
2
2
  export function getModeledObject(obj, model) {
3
3
  try {
4
- if (!obj || typeof obj !== 'object') return warn('Setting a Configurable requires an object as input');
5
- if (!model || typeof model !== 'object') return warn('Setting a Configurable requires a model to set its initial properties');
4
+ if (!obj || typeof obj !== 'object') return warn(3);
5
+ if (!model || typeof model !== 'object') return warn(4);
6
6
  // allow getters and setters to pass from model to target
7
7
  const output = Object.create(Object.getPrototypeOf(model), Object.getOwnPropertyDescriptors(model));
8
8
  const target = Object.keys(output).length === 0 ? obj : output;
@@ -15,11 +15,11 @@ export function getModeledObject(obj, model) {
15
15
  }
16
16
  if (Array.isArray(obj[key]) && Array.isArray(model[key])) output[key] = Array.from(new Set([...obj[key], ...model[key]]));else if (typeof obj[key] === 'object' && typeof model[key] === 'object') output[key] = getModeledObject(obj[key], model[key]);else output[key] = obj[key];
17
17
  } catch (e) {
18
- warn('An error occurred while setting a property of a Configurable', e);
18
+ warn(1, e);
19
19
  }
20
20
  }
21
21
  return output;
22
22
  } catch (err) {
23
- warn('An error occured while setting a Configurable', err);
23
+ warn(2, err);
24
24
  }
25
25
  }