@newrelic/browser-agent 1.263.0 → 1.265.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 (478) hide show
  1. package/CHANGELOG.md +32 -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 +2 -3
  7. package/dist/cjs/common/config/{state/configurable.js → configurable.js} +1 -1
  8. package/dist/cjs/common/config/{state/info.js → info.js} +1 -1
  9. package/dist/cjs/common/config/{state/init.js → init.js} +11 -8
  10. package/dist/cjs/common/config/{state/loader-config.js → loader-config.js} +1 -1
  11. package/dist/cjs/common/config/{state/runtime.js → runtime.js} +16 -5
  12. package/dist/cjs/common/constants/agent-constants.js +8 -0
  13. package/dist/cjs/common/constants/env.cdn.js +1 -1
  14. package/dist/cjs/common/constants/env.npm.js +1 -1
  15. package/dist/cjs/common/constants/runtime.js +1 -3
  16. package/dist/cjs/common/context/shared-context.js +1 -2
  17. package/dist/cjs/common/dispatch/global-event.js +1 -2
  18. package/dist/cjs/common/drain/drain.js +12 -18
  19. package/dist/cjs/common/event-emitter/contextual-ee.js +3 -4
  20. package/dist/cjs/common/event-listener/event-listener-opts.js +2 -6
  21. package/dist/cjs/common/harvest/harvest-scheduler.js +1 -2
  22. package/dist/cjs/common/harvest/harvest.js +30 -57
  23. package/dist/cjs/common/serialize/bel-serializer.js +6 -11
  24. package/dist/cjs/common/session/session-entity.js +10 -13
  25. package/dist/cjs/common/timing/nav-timing.js +1 -3
  26. package/dist/cjs/common/timing/time-keeper.js +16 -6
  27. package/dist/cjs/common/url/encode.js +3 -7
  28. package/dist/cjs/common/util/console.js +2 -0
  29. package/dist/cjs/common/util/invoke.js +6 -16
  30. package/dist/cjs/common/util/obfuscate.js +97 -53
  31. package/dist/cjs/common/util/submit-data.js +17 -21
  32. package/dist/cjs/common/util/text.js +9 -0
  33. package/dist/cjs/common/util/traverse.js +1 -3
  34. package/dist/cjs/common/vitals/cumulative-layout-shift.js +5 -6
  35. package/dist/cjs/common/vitals/first-contentful-paint.js +4 -5
  36. package/dist/cjs/common/vitals/first-input-delay.js +4 -5
  37. package/dist/cjs/common/vitals/interaction-to-next-paint.js +5 -6
  38. package/dist/cjs/common/vitals/largest-contentful-paint.js +4 -5
  39. package/dist/cjs/common/vitals/time-to-first-byte.js +4 -5
  40. package/dist/cjs/common/vitals/vital-metric.js +5 -7
  41. package/dist/cjs/common/window/nreum.js +2 -1
  42. package/dist/cjs/common/window/page-visibility.js +1 -4
  43. package/dist/cjs/common/wrap/wrap-events.js +1 -4
  44. package/dist/cjs/common/wrap/wrap-promise.js +1 -4
  45. package/dist/cjs/common/wrap/wrap-websocket.js +74 -0
  46. package/dist/cjs/features/ajax/aggregate/chunk.js +4 -3
  47. package/dist/cjs/features/ajax/aggregate/gql.js +4 -5
  48. package/dist/cjs/features/ajax/aggregate/index.js +19 -22
  49. package/dist/cjs/features/ajax/constants.js +2 -3
  50. package/dist/cjs/features/ajax/instrument/distributed-tracing.js +9 -8
  51. package/dist/cjs/features/ajax/instrument/index.js +14 -12
  52. package/dist/cjs/features/generic_events/aggregate/index.js +128 -0
  53. package/dist/cjs/features/generic_events/constants.js +10 -0
  54. package/dist/cjs/features/generic_events/index.js +12 -0
  55. package/dist/cjs/features/generic_events/instrument/index.js +27 -0
  56. package/dist/cjs/features/jserrors/aggregate/index.js +25 -44
  57. package/dist/cjs/features/jserrors/instrument/index.js +4 -4
  58. package/dist/cjs/features/logging/aggregate/index.js +33 -36
  59. package/dist/cjs/features/logging/constants.js +2 -3
  60. package/dist/cjs/features/logging/instrument/index.js +5 -6
  61. package/dist/cjs/features/logging/shared/log.js +1 -3
  62. package/dist/cjs/features/logging/shared/utils.js +2 -4
  63. package/dist/cjs/features/metrics/aggregate/index.js +34 -17
  64. package/dist/cjs/features/metrics/aggregate/websocket-detection.js +34 -0
  65. package/dist/cjs/features/metrics/constants.js +4 -2
  66. package/dist/cjs/features/metrics/instrument/index.js +12 -4
  67. package/dist/cjs/features/page_action/instrument/index.js +14 -10
  68. package/dist/cjs/features/page_view_event/aggregate/index.js +19 -39
  69. package/dist/cjs/features/page_view_event/aggregate/initialized-features.js +1 -1
  70. package/dist/cjs/features/page_view_event/instrument/index.js +4 -4
  71. package/dist/cjs/features/page_view_timing/aggregate/index.js +23 -39
  72. package/dist/cjs/features/page_view_timing/instrument/index.js +4 -4
  73. package/dist/cjs/features/session_replay/aggregate/index.js +35 -42
  74. package/dist/cjs/features/session_replay/constants.js +1 -5
  75. package/dist/cjs/features/session_replay/instrument/index.js +5 -9
  76. package/dist/cjs/features/session_replay/shared/recorder-events.js +25 -20
  77. package/dist/cjs/features/session_replay/shared/recorder.js +17 -13
  78. package/dist/cjs/features/session_replay/shared/stylesheet-evaluator.js +2 -2
  79. package/dist/cjs/features/session_replay/shared/utils.js +5 -4
  80. package/dist/cjs/features/session_trace/aggregate/index.js +25 -42
  81. package/dist/cjs/features/session_trace/aggregate/trace/storage.js +5 -3
  82. package/dist/cjs/features/session_trace/instrument/index.js +8 -7
  83. package/dist/cjs/features/soft_navigations/aggregate/ajax-node.js +1 -1
  84. package/dist/cjs/features/soft_navigations/aggregate/index.js +22 -30
  85. package/dist/cjs/features/soft_navigations/aggregate/initial-page-load-interaction.js +2 -2
  86. package/dist/cjs/features/soft_navigations/aggregate/interaction.js +4 -5
  87. package/dist/cjs/features/soft_navigations/instrument/index.js +14 -13
  88. package/dist/cjs/features/spa/aggregate/index.js +17 -28
  89. package/dist/cjs/features/spa/aggregate/interaction.js +7 -6
  90. package/dist/cjs/features/spa/aggregate/serializer.js +4 -5
  91. package/dist/cjs/features/spa/constants.js +2 -2
  92. package/dist/cjs/features/spa/instrument/index.js +20 -19
  93. package/dist/cjs/features/utils/agent-session.js +6 -4
  94. package/dist/cjs/features/utils/aggregate-base.js +17 -10
  95. package/dist/cjs/features/utils/event-buffer.js +132 -0
  96. package/dist/cjs/features/utils/feature-gates.js +2 -2
  97. package/dist/cjs/features/utils/instrument-base.js +7 -8
  98. package/dist/cjs/features/utils/lazy-feature-loader.js +12 -12
  99. package/dist/cjs/features/utils/nr1-debugger.js +1 -3
  100. package/dist/cjs/index.js +21 -0
  101. package/dist/cjs/loaders/agent-base.js +4 -12
  102. package/dist/cjs/loaders/agent.js +7 -2
  103. package/dist/cjs/loaders/api/api.js +23 -35
  104. package/dist/cjs/loaders/api/apiAsync.js +10 -13
  105. package/dist/cjs/loaders/browser-agent.js +4 -3
  106. package/dist/cjs/loaders/configure/configure.js +16 -15
  107. package/dist/cjs/loaders/features/enabled-features.js +2 -2
  108. package/dist/cjs/loaders/features/features.js +8 -4
  109. package/dist/cjs/loaders/micro-agent.js +16 -15
  110. package/dist/esm/cdn/experimental.js +2 -5
  111. package/dist/esm/cdn/pro.js +2 -2
  112. package/dist/esm/cdn/spa.js +2 -2
  113. package/dist/esm/common/aggregate/aggregator.js +2 -3
  114. package/dist/esm/common/config/{state/configurable.js → configurable.js} +1 -1
  115. package/dist/esm/common/config/{state/info.js → info.js} +1 -1
  116. package/dist/esm/common/config/{state/init.js → init.js} +11 -8
  117. package/dist/esm/common/config/{state/loader-config.js → loader-config.js} +1 -1
  118. package/dist/esm/common/config/{state/runtime.js → runtime.js} +17 -5
  119. package/dist/esm/common/constants/agent-constants.js +2 -0
  120. package/dist/esm/common/constants/env.cdn.js +1 -1
  121. package/dist/esm/common/constants/env.npm.js +1 -1
  122. package/dist/esm/common/constants/runtime.js +0 -2
  123. package/dist/esm/common/context/shared-context.js +1 -2
  124. package/dist/esm/common/dispatch/global-event.js +1 -2
  125. package/dist/esm/common/drain/drain.js +12 -18
  126. package/dist/esm/common/event-emitter/contextual-ee.js +2 -3
  127. package/dist/esm/common/event-listener/event-listener-opts.js +2 -6
  128. package/dist/esm/common/harvest/harvest-scheduler.js +1 -2
  129. package/dist/esm/common/harvest/harvest.js +24 -51
  130. package/dist/esm/common/serialize/bel-serializer.js +6 -11
  131. package/dist/esm/common/session/session-entity.js +10 -13
  132. package/dist/esm/common/timing/nav-timing.js +1 -3
  133. package/dist/esm/common/timing/time-keeper.js +15 -5
  134. package/dist/esm/common/url/encode.js +3 -7
  135. package/dist/esm/common/util/console.js +2 -0
  136. package/dist/esm/common/util/invoke.js +6 -16
  137. package/dist/esm/common/util/obfuscate.js +96 -49
  138. package/dist/esm/common/util/submit-data.js +17 -21
  139. package/dist/esm/common/util/text.js +3 -0
  140. package/dist/esm/common/util/traverse.js +1 -3
  141. package/dist/esm/common/vitals/cumulative-layout-shift.js +5 -6
  142. package/dist/esm/common/vitals/first-contentful-paint.js +4 -5
  143. package/dist/esm/common/vitals/first-input-delay.js +4 -5
  144. package/dist/esm/common/vitals/interaction-to-next-paint.js +5 -6
  145. package/dist/esm/common/vitals/largest-contentful-paint.js +4 -5
  146. package/dist/esm/common/vitals/time-to-first-byte.js +4 -5
  147. package/dist/esm/common/vitals/vital-metric.js +5 -7
  148. package/dist/esm/common/window/nreum.js +2 -1
  149. package/dist/esm/common/window/page-visibility.js +1 -4
  150. package/dist/esm/common/wrap/wrap-events.js +1 -4
  151. package/dist/esm/common/wrap/wrap-promise.js +1 -4
  152. package/dist/esm/common/wrap/wrap-websocket.js +67 -0
  153. package/dist/esm/features/ajax/aggregate/chunk.js +3 -2
  154. package/dist/esm/features/ajax/aggregate/gql.js +4 -5
  155. package/dist/esm/features/ajax/aggregate/index.js +16 -19
  156. package/dist/esm/features/ajax/constants.js +1 -2
  157. package/dist/esm/features/ajax/instrument/distributed-tracing.js +2 -1
  158. package/dist/esm/features/ajax/instrument/index.js +10 -8
  159. package/dist/esm/features/generic_events/aggregate/index.js +120 -0
  160. package/dist/esm/features/generic_events/constants.js +4 -0
  161. package/dist/esm/features/generic_events/index.js +1 -0
  162. package/dist/esm/features/generic_events/instrument/index.js +20 -0
  163. package/dist/esm/features/jserrors/aggregate/index.js +20 -39
  164. package/dist/esm/features/jserrors/instrument/index.js +3 -3
  165. package/dist/esm/features/logging/aggregate/index.js +31 -34
  166. package/dist/esm/features/logging/constants.js +1 -2
  167. package/dist/esm/features/logging/instrument/index.js +4 -5
  168. package/dist/esm/features/logging/shared/log.js +1 -3
  169. package/dist/esm/features/logging/shared/utils.js +2 -4
  170. package/dist/esm/features/metrics/aggregate/index.js +28 -11
  171. package/dist/esm/features/metrics/aggregate/websocket-detection.js +29 -0
  172. package/dist/esm/features/metrics/constants.js +3 -1
  173. package/dist/esm/features/metrics/instrument/index.js +12 -4
  174. package/dist/esm/features/page_action/instrument/index.js +14 -9
  175. package/dist/esm/features/page_view_event/aggregate/index.js +17 -37
  176. package/dist/esm/features/page_view_event/aggregate/initialized-features.js +1 -1
  177. package/dist/esm/features/page_view_event/instrument/index.js +3 -3
  178. package/dist/esm/features/page_view_timing/aggregate/index.js +20 -36
  179. package/dist/esm/features/page_view_timing/instrument/index.js +3 -3
  180. package/dist/esm/features/session_replay/aggregate/index.js +25 -32
  181. package/dist/esm/features/session_replay/constants.js +0 -4
  182. package/dist/esm/features/session_replay/index.js +1 -7
  183. package/dist/esm/features/session_replay/instrument/index.js +5 -8
  184. package/dist/esm/features/session_replay/shared/recorder-events.js +25 -20
  185. package/dist/esm/features/session_replay/shared/recorder.js +14 -10
  186. package/dist/esm/features/session_replay/shared/stylesheet-evaluator.js +2 -2
  187. package/dist/esm/features/session_replay/shared/utils.js +3 -2
  188. package/dist/esm/features/session_trace/aggregate/index.js +20 -37
  189. package/dist/esm/features/session_trace/aggregate/trace/storage.js +5 -3
  190. package/dist/esm/features/session_trace/instrument/index.js +5 -4
  191. package/dist/esm/features/soft_navigations/aggregate/ajax-node.js +1 -1
  192. package/dist/esm/features/soft_navigations/aggregate/index.js +21 -29
  193. package/dist/esm/features/soft_navigations/aggregate/initial-page-load-interaction.js +1 -1
  194. package/dist/esm/features/soft_navigations/aggregate/interaction.js +2 -3
  195. package/dist/esm/features/soft_navigations/instrument/index.js +11 -10
  196. package/dist/esm/features/spa/aggregate/index.js +11 -22
  197. package/dist/esm/features/spa/aggregate/interaction.js +6 -5
  198. package/dist/esm/features/spa/aggregate/serializer.js +2 -3
  199. package/dist/esm/features/spa/constants.js +2 -2
  200. package/dist/esm/features/spa/instrument/index.js +12 -11
  201. package/dist/esm/features/utils/agent-session.js +3 -1
  202. package/dist/esm/features/utils/aggregate-base.js +16 -9
  203. package/dist/esm/features/utils/event-buffer.js +126 -0
  204. package/dist/esm/features/utils/feature-gates.js +1 -1
  205. package/dist/esm/features/utils/instrument-base.js +6 -7
  206. package/dist/esm/features/utils/lazy-feature-loader.js +12 -12
  207. package/dist/esm/features/utils/nr1-debugger.js +1 -3
  208. package/dist/esm/index.js +3 -0
  209. package/dist/esm/loaders/agent-base.js +4 -12
  210. package/dist/esm/loaders/agent.js +7 -2
  211. package/dist/esm/loaders/api/api.js +18 -30
  212. package/dist/esm/loaders/api/apiAsync.js +3 -6
  213. package/dist/esm/loaders/browser-agent.js +3 -2
  214. package/dist/esm/loaders/configure/configure.js +9 -8
  215. package/dist/esm/loaders/features/enabled-features.js +1 -1
  216. package/dist/esm/loaders/features/features.js +8 -4
  217. package/dist/esm/loaders/micro-agent.js +11 -10
  218. package/dist/types/common/aggregate/aggregator.d.ts.map +1 -1
  219. package/dist/types/common/config/configurable.d.ts.map +1 -0
  220. package/dist/types/common/config/info.d.ts.map +1 -0
  221. package/dist/types/common/config/init.d.ts.map +1 -0
  222. package/dist/types/common/config/loader-config.d.ts.map +1 -0
  223. package/dist/types/common/config/runtime.d.ts.map +1 -0
  224. package/dist/types/common/constants/agent-constants.d.ts +3 -0
  225. package/dist/types/common/constants/agent-constants.d.ts.map +1 -0
  226. package/dist/types/common/constants/runtime.d.ts +0 -1
  227. package/dist/types/common/constants/runtime.d.ts.map +1 -1
  228. package/dist/types/common/harvest/harvest.d.ts +1 -7
  229. package/dist/types/common/harvest/harvest.d.ts.map +1 -1
  230. package/dist/types/common/serialize/bel-serializer.d.ts.map +1 -1
  231. package/dist/types/common/timing/time-keeper.d.ts +9 -2
  232. package/dist/types/common/timing/time-keeper.d.ts.map +1 -1
  233. package/dist/types/common/url/encode.d.ts.map +1 -1
  234. package/dist/types/common/util/console.d.ts.map +1 -1
  235. package/dist/types/common/util/obfuscate.d.ts +78 -6
  236. package/dist/types/common/util/obfuscate.d.ts.map +1 -1
  237. package/dist/types/common/util/submit-data.d.ts.map +1 -1
  238. package/dist/types/common/util/text.d.ts +2 -0
  239. package/dist/types/common/util/text.d.ts.map +1 -0
  240. package/dist/types/common/window/nreum.d.ts.map +1 -1
  241. package/dist/types/common/wrap/wrap-websocket.d.ts +4 -0
  242. package/dist/types/common/wrap/wrap-websocket.d.ts.map +1 -0
  243. package/dist/types/features/ajax/aggregate/chunk.d.ts.map +1 -1
  244. package/dist/types/features/ajax/aggregate/index.d.ts +2 -3
  245. package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -1
  246. package/dist/types/features/ajax/constants.d.ts +0 -1
  247. package/dist/types/features/ajax/constants.d.ts.map +1 -1
  248. package/dist/types/features/ajax/instrument/distributed-tracing.d.ts.map +1 -1
  249. package/dist/types/features/ajax/instrument/index.d.ts +1 -0
  250. package/dist/types/features/ajax/instrument/index.d.ts.map +1 -1
  251. package/dist/types/features/{page_action → generic_events}/aggregate/index.d.ts +10 -10
  252. package/dist/types/features/generic_events/aggregate/index.d.ts.map +1 -0
  253. package/dist/types/features/generic_events/constants.d.ts +4 -0
  254. package/dist/types/features/generic_events/constants.d.ts.map +1 -0
  255. package/dist/types/features/generic_events/index.d.ts +2 -0
  256. package/dist/types/features/generic_events/index.d.ts.map +1 -0
  257. package/dist/types/features/generic_events/instrument/index.d.ts +7 -0
  258. package/dist/types/features/generic_events/instrument/index.d.ts.map +1 -0
  259. package/dist/types/features/jserrors/aggregate/index.d.ts +2 -2
  260. package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -1
  261. package/dist/types/features/jserrors/instrument/index.d.ts +1 -0
  262. package/dist/types/features/jserrors/instrument/index.d.ts.map +1 -1
  263. package/dist/types/features/logging/aggregate/index.d.ts +4 -7
  264. package/dist/types/features/logging/aggregate/index.d.ts.map +1 -1
  265. package/dist/types/features/logging/constants.d.ts +0 -1
  266. package/dist/types/features/logging/constants.d.ts.map +1 -1
  267. package/dist/types/features/logging/instrument/index.d.ts +1 -0
  268. package/dist/types/features/logging/instrument/index.d.ts.map +1 -1
  269. package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -1
  270. package/dist/types/features/metrics/aggregate/websocket-detection.d.ts +12 -0
  271. package/dist/types/features/metrics/aggregate/websocket-detection.d.ts.map +1 -0
  272. package/dist/types/features/metrics/constants.d.ts +1 -0
  273. package/dist/types/features/metrics/constants.d.ts.map +1 -1
  274. package/dist/types/features/metrics/instrument/index.d.ts +1 -0
  275. package/dist/types/features/metrics/instrument/index.d.ts.map +1 -1
  276. package/dist/types/features/page_action/instrument/index.d.ts +9 -4
  277. package/dist/types/features/page_action/instrument/index.d.ts.map +1 -1
  278. package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -1
  279. package/dist/types/features/page_view_event/instrument/index.d.ts +1 -0
  280. package/dist/types/features/page_view_event/instrument/index.d.ts.map +1 -1
  281. package/dist/types/features/page_view_timing/aggregate/index.d.ts +2 -2
  282. package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -1
  283. package/dist/types/features/page_view_timing/instrument/index.d.ts +1 -0
  284. package/dist/types/features/page_view_timing/instrument/index.d.ts.map +1 -1
  285. package/dist/types/features/session_replay/aggregate/index.d.ts.map +1 -1
  286. package/dist/types/features/session_replay/constants.d.ts +0 -4
  287. package/dist/types/features/session_replay/constants.d.ts.map +1 -1
  288. package/dist/types/features/session_replay/instrument/index.d.ts +1 -0
  289. package/dist/types/features/session_replay/instrument/index.d.ts.map +1 -1
  290. package/dist/types/features/session_replay/shared/recorder-events.d.ts +6 -6
  291. package/dist/types/features/session_replay/shared/recorder-events.d.ts.map +1 -1
  292. package/dist/types/features/session_replay/shared/recorder.d.ts +2 -2
  293. package/dist/types/features/session_replay/shared/recorder.d.ts.map +1 -1
  294. package/dist/types/features/session_replay/shared/utils.d.ts.map +1 -1
  295. package/dist/types/features/session_trace/aggregate/index.d.ts +2 -2
  296. package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -1
  297. package/dist/types/features/session_trace/aggregate/trace/storage.d.ts +1 -1
  298. package/dist/types/features/session_trace/aggregate/trace/storage.d.ts.map +1 -1
  299. package/dist/types/features/session_trace/instrument/index.d.ts +1 -0
  300. package/dist/types/features/session_trace/instrument/index.d.ts.map +1 -1
  301. package/dist/types/features/soft_navigations/aggregate/index.d.ts +3 -3
  302. package/dist/types/features/soft_navigations/aggregate/index.d.ts.map +1 -1
  303. package/dist/types/features/soft_navigations/instrument/index.d.ts +1 -0
  304. package/dist/types/features/soft_navigations/instrument/index.d.ts.map +1 -1
  305. package/dist/types/features/spa/aggregate/index.d.ts +2 -2
  306. package/dist/types/features/spa/aggregate/index.d.ts.map +1 -1
  307. package/dist/types/features/spa/aggregate/interaction.d.ts.map +1 -1
  308. package/dist/types/features/spa/aggregate/serializer.d.ts.map +1 -1
  309. package/dist/types/features/spa/constants.d.ts.map +1 -1
  310. package/dist/types/features/spa/instrument/index.d.ts +1 -0
  311. package/dist/types/features/spa/instrument/index.d.ts.map +1 -1
  312. package/dist/types/features/utils/agent-session.d.ts.map +1 -1
  313. package/dist/types/features/utils/aggregate-base.d.ts +1 -0
  314. package/dist/types/features/utils/aggregate-base.d.ts.map +1 -1
  315. package/dist/types/features/utils/event-buffer.d.ts +72 -0
  316. package/dist/types/features/utils/event-buffer.d.ts.map +1 -0
  317. package/dist/types/features/utils/instrument-base.d.ts +1 -0
  318. package/dist/types/features/utils/instrument-base.d.ts.map +1 -1
  319. package/dist/types/index.d.ts +3 -0
  320. package/dist/types/loaders/agent-base.d.ts +1 -2
  321. package/dist/types/loaders/agent-base.d.ts.map +1 -1
  322. package/dist/types/loaders/agent.d.ts.map +1 -1
  323. package/dist/types/loaders/api/api.d.ts.map +1 -1
  324. package/dist/types/loaders/browser-agent.d.ts.map +1 -1
  325. package/dist/types/loaders/configure/configure.d.ts.map +1 -1
  326. package/dist/types/loaders/features/features.d.ts +1 -0
  327. package/dist/types/loaders/features/features.d.ts.map +1 -1
  328. package/dist/types/loaders/micro-agent.d.ts.map +1 -1
  329. package/package.json +67 -52
  330. package/src/cdn/experimental.js +2 -4
  331. package/src/cdn/pro.js +2 -2
  332. package/src/cdn/spa.js +2 -2
  333. package/src/common/aggregate/aggregator.js +2 -3
  334. package/src/common/config/__mocks__/info.js +3 -0
  335. package/src/common/config/__mocks__/init.js +3 -0
  336. package/src/common/config/__mocks__/loader-config.js +2 -0
  337. package/src/common/config/__mocks__/runtime.js +2 -0
  338. package/src/common/config/{state/configurable.js → configurable.js} +1 -1
  339. package/src/common/config/{state/info.js → info.js} +1 -1
  340. package/src/common/config/{state/init.js → init.js} +7 -6
  341. package/src/common/config/{state/loader-config.js → loader-config.js} +1 -1
  342. package/src/common/config/{state/runtime.js → runtime.js} +19 -5
  343. package/src/common/constants/agent-constants.js +2 -0
  344. package/src/common/constants/runtime.js +0 -2
  345. package/src/common/drain/drain.js +8 -6
  346. package/src/common/event-emitter/contextual-ee.js +1 -1
  347. package/src/common/harvest/harvest.js +10 -24
  348. package/src/common/serialize/bel-serializer.js +6 -9
  349. package/src/common/session/session-entity.js +4 -4
  350. package/src/common/timing/__mocks__/time-keeper.js +6 -2
  351. package/src/common/timing/time-keeper.js +15 -5
  352. package/src/common/url/encode.js +2 -3
  353. package/src/common/util/__mocks__/console.js +1 -0
  354. package/src/common/util/__mocks__/obfuscate.js +5 -8
  355. package/src/common/util/console.js +2 -0
  356. package/src/common/util/obfuscate.js +94 -50
  357. package/src/common/util/submit-data.js +0 -1
  358. package/src/common/util/text.js +6 -0
  359. package/src/common/window/__mocks__/nreum.js +1 -1
  360. package/src/common/window/nreum.js +2 -1
  361. package/src/common/wrap/wrap-websocket.js +73 -0
  362. package/src/features/ajax/aggregate/chunk.js +3 -2
  363. package/src/features/ajax/aggregate/index.js +20 -19
  364. package/src/features/ajax/constants.js +0 -2
  365. package/src/features/ajax/instrument/distributed-tracing.js +2 -1
  366. package/src/features/ajax/instrument/index.js +9 -5
  367. package/src/features/generic_events/aggregate/index.js +139 -0
  368. package/src/features/generic_events/constants.js +5 -0
  369. package/src/features/generic_events/index.js +1 -0
  370. package/src/features/generic_events/instrument/index.js +24 -0
  371. package/src/features/jserrors/aggregate/index.js +18 -9
  372. package/src/features/jserrors/instrument/index.js +2 -0
  373. package/src/features/logging/aggregate/index.js +39 -31
  374. package/src/features/logging/constants.js +0 -2
  375. package/src/features/logging/instrument/index.js +2 -0
  376. package/src/features/logging/shared/utils.js +1 -1
  377. package/src/features/metrics/aggregate/index.js +24 -9
  378. package/src/features/metrics/aggregate/websocket-detection.js +31 -0
  379. package/src/features/metrics/constants.js +3 -0
  380. package/src/features/metrics/instrument/index.js +13 -1
  381. package/src/features/page_action/instrument/index.js +11 -6
  382. package/src/features/page_view_event/aggregate/index.js +8 -23
  383. package/src/features/page_view_event/aggregate/initialized-features.js +1 -1
  384. package/src/features/page_view_event/instrument/index.js +2 -0
  385. package/src/features/page_view_timing/aggregate/index.js +15 -18
  386. package/src/features/page_view_timing/instrument/index.js +2 -0
  387. package/src/features/session_replay/aggregate/index.js +13 -9
  388. package/src/features/session_replay/constants.js +0 -4
  389. package/src/features/session_replay/index.js +1 -7
  390. package/src/features/session_replay/instrument/index.js +3 -4
  391. package/src/features/session_replay/shared/recorder-events.js +27 -20
  392. package/src/features/session_replay/shared/recorder.js +13 -6
  393. package/src/features/session_replay/shared/stylesheet-evaluator.js +2 -2
  394. package/src/features/session_replay/shared/utils.js +3 -2
  395. package/src/features/session_trace/aggregate/index.js +16 -7
  396. package/src/features/session_trace/aggregate/trace/storage.js +6 -1
  397. package/src/features/session_trace/instrument/index.js +4 -1
  398. package/src/features/soft_navigations/aggregate/ajax-node.js +1 -1
  399. package/src/features/soft_navigations/aggregate/index.js +13 -15
  400. package/src/features/soft_navigations/aggregate/initial-page-load-interaction.js +1 -1
  401. package/src/features/soft_navigations/aggregate/interaction.js +1 -1
  402. package/src/features/soft_navigations/instrument/index.js +9 -5
  403. package/src/features/spa/aggregate/index.js +12 -20
  404. package/src/features/spa/aggregate/interaction.js +6 -5
  405. package/src/features/spa/aggregate/serializer.js +2 -3
  406. package/src/features/spa/constants.js +2 -2
  407. package/src/features/spa/instrument/index.js +9 -3
  408. package/src/features/utils/agent-session.js +3 -1
  409. package/src/features/utils/aggregate-base.js +13 -3
  410. package/src/features/utils/event-buffer.js +126 -0
  411. package/src/features/utils/feature-gates.js +1 -1
  412. package/src/features/utils/instrument-base.js +2 -1
  413. package/src/features/utils/lazy-feature-loader.js +2 -2
  414. package/src/index.js +3 -0
  415. package/src/loaders/agent-base.js +2 -6
  416. package/src/loaders/agent.js +7 -2
  417. package/src/loaders/api/api.js +3 -2
  418. package/src/loaders/api/apiAsync.js +2 -2
  419. package/src/loaders/browser-agent.js +5 -3
  420. package/src/loaders/configure/configure.js +9 -2
  421. package/src/loaders/features/enabled-features.js +1 -1
  422. package/src/loaders/features/features.js +8 -4
  423. package/src/loaders/micro-agent.js +5 -2
  424. package/dist/cjs/cdn/polyfills/lite.js +0 -16
  425. package/dist/cjs/cdn/polyfills/pro.js +0 -21
  426. package/dist/cjs/cdn/polyfills/spa.js +0 -22
  427. package/dist/cjs/cdn/polyfills.js +0 -24
  428. package/dist/cjs/common/config/config.js +0 -76
  429. package/dist/cjs/common/config/state/originals.js +0 -8
  430. package/dist/cjs/common/util/map-own.js +0 -31
  431. package/dist/cjs/common/wrap/index.js +0 -61
  432. package/dist/cjs/features/page_action/aggregate/index.js +0 -121
  433. package/dist/esm/cdn/polyfills/lite.js +0 -14
  434. package/dist/esm/cdn/polyfills/pro.js +0 -19
  435. package/dist/esm/cdn/polyfills/spa.js +0 -20
  436. package/dist/esm/cdn/polyfills.js +0 -27
  437. package/dist/esm/common/config/config.js +0 -11
  438. package/dist/esm/common/config/state/originals.js +0 -2
  439. package/dist/esm/common/util/map-own.js +0 -24
  440. package/dist/esm/common/wrap/index.js +0 -13
  441. package/dist/esm/features/page_action/aggregate/index.js +0 -114
  442. package/dist/types/cdn/polyfills/lite.d.ts +0 -2
  443. package/dist/types/cdn/polyfills/lite.d.ts.map +0 -1
  444. package/dist/types/cdn/polyfills/pro.d.ts +0 -2
  445. package/dist/types/cdn/polyfills/pro.d.ts.map +0 -1
  446. package/dist/types/cdn/polyfills/spa.d.ts +0 -2
  447. package/dist/types/cdn/polyfills/spa.d.ts.map +0 -1
  448. package/dist/types/cdn/polyfills.d.ts +0 -2
  449. package/dist/types/cdn/polyfills.d.ts.map +0 -1
  450. package/dist/types/common/config/config.d.ts +0 -13
  451. package/dist/types/common/config/config.d.ts.map +0 -1
  452. package/dist/types/common/config/state/configurable.d.ts.map +0 -1
  453. package/dist/types/common/config/state/info.d.ts.map +0 -1
  454. package/dist/types/common/config/state/init.d.ts.map +0 -1
  455. package/dist/types/common/config/state/loader-config.d.ts.map +0 -1
  456. package/dist/types/common/config/state/originals.d.ts +0 -2
  457. package/dist/types/common/config/state/originals.d.ts.map +0 -1
  458. package/dist/types/common/config/state/runtime.d.ts.map +0 -1
  459. package/dist/types/common/util/map-own.d.ts +0 -3
  460. package/dist/types/common/util/map-own.d.ts.map +0 -1
  461. package/dist/types/common/wrap/index.d.ts +0 -10
  462. package/dist/types/common/wrap/index.d.ts.map +0 -1
  463. package/dist/types/features/page_action/aggregate/index.d.ts.map +0 -1
  464. package/src/cdn/polyfills/lite.js +0 -20
  465. package/src/cdn/polyfills/pro.js +0 -30
  466. package/src/cdn/polyfills/spa.js +0 -32
  467. package/src/cdn/polyfills.js +0 -27
  468. package/src/common/config/__mocks__/config.js +0 -11
  469. package/src/common/config/config.js +0 -12
  470. package/src/common/config/state/originals.js +0 -3
  471. package/src/common/util/map-own.js +0 -22
  472. package/src/common/wrap/index.js +0 -16
  473. package/src/features/page_action/aggregate/index.js +0 -114
  474. /package/dist/types/common/config/{state/configurable.d.ts → configurable.d.ts} +0 -0
  475. /package/dist/types/common/config/{state/info.d.ts → info.d.ts} +0 -0
  476. /package/dist/types/common/config/{state/init.d.ts → init.d.ts} +0 -0
  477. /package/dist/types/common/config/{state/loader-config.d.ts → loader-config.d.ts} +0 -0
  478. /package/dist/types/common/config/{state/runtime.d.ts → runtime.d.ts} +0 -0
@@ -1,14 +1,17 @@
1
1
  import { FeatureBase } from './feature-base'
2
- import { getInfo, isConfigured, getRuntime } from '../../common/config/config'
2
+ import { getInfo, isValid } from '../../common/config/info'
3
+ import { getRuntime } from '../../common/config/runtime'
3
4
  import { configure } from '../../loaders/configure/configure'
4
5
  import { gosCDN } from '../../common/window/nreum'
5
- import { drain } from '../../common/drain/drain'
6
+ import { deregisterDrain, drain } from '../../common/drain/drain'
6
7
  import { activatedFeatures } from '../../common/util/feature-flags'
8
+ import { Obfuscator } from '../../common/util/obfuscate'
7
9
 
8
10
  export class AggregateBase extends FeatureBase {
9
11
  constructor (...args) {
10
12
  super(...args)
11
13
  this.checkConfiguration()
14
+ this.obfuscator = getRuntime(this.agentIdentifier).obfuscator
12
15
  }
13
16
 
14
17
  /**
@@ -34,6 +37,8 @@ export class AggregateBase extends FeatureBase {
34
37
  })
35
38
  return flagsPromise.catch(err => {
36
39
  this.ee.emit('internal-error', [err])
40
+ this.blocked = true
41
+ deregisterDrain(this.agentIdentifier, this.featureName)
37
42
  })
38
43
  }
39
44
 
@@ -48,7 +53,7 @@ export class AggregateBase extends FeatureBase {
48
53
  */
49
54
  checkConfiguration () {
50
55
  // NOTE: This check has to happen at aggregator load time
51
- if (!isConfigured(this.agentIdentifier)) {
56
+ if (!isValid(this.agentIdentifier)) {
52
57
  const cdn = gosCDN()
53
58
  let jsAttributes = { ...cdn.info?.jsAttributes }
54
59
  try {
@@ -68,5 +73,10 @@ export class AggregateBase extends FeatureBase {
68
73
  runtime: getRuntime(this.agentIdentifier)
69
74
  })
70
75
  }
76
+
77
+ const runtime = getRuntime(this.agentIdentifier)
78
+ if (!runtime.obfuscator) {
79
+ runtime.obfuscator = new Obfuscator(this.agentIdentifier)
80
+ }
71
81
  }
72
82
  }
@@ -0,0 +1,126 @@
1
+ import { stringify } from '../../common/util/stringify'
2
+ import { MAX_PAYLOAD_SIZE } from '../../common/constants/agent-constants'
3
+
4
+ /**
5
+ * A container that keeps an event buffer and size with helper methods
6
+ * @typedef {Object} EventBuffer
7
+ * @property {number} size
8
+ * @property {*[]} buffer
9
+ */
10
+
11
+ /**
12
+ * A container that holds, evaluates, and merges event objects for harvesting
13
+ */
14
+ export class EventBuffer {
15
+ /** @type {Object[]} */
16
+ #buffer = []
17
+ /** @type {number} */
18
+ #bytes = 0
19
+ /** @type {EventBuffer} */
20
+ #held
21
+
22
+ /**
23
+ *
24
+ * @param {number=} maxPayloadSize
25
+ */
26
+ constructor (maxPayloadSize = MAX_PAYLOAD_SIZE) {
27
+ this.maxPayloadSize = maxPayloadSize
28
+ }
29
+
30
+ /**
31
+ * buffer is read only, use the helper methods to add or clear buffer data
32
+ */
33
+ get buffer () {
34
+ return this.#buffer
35
+ }
36
+
37
+ /**
38
+ * bytes is read only, use the helper methods to add or clear buffer data
39
+ */
40
+ get bytes () {
41
+ return this.#bytes
42
+ }
43
+
44
+ /**
45
+ * held is another event buffer
46
+ */
47
+ get held () {
48
+ this.#held ??= new EventBuffer(this.maxPayloadSize)
49
+ return this.#held
50
+ }
51
+
52
+ /**
53
+ * Returns a boolean indicating whether the current size and buffer contain valid data
54
+ * @returns {boolean}
55
+ */
56
+ get hasData () {
57
+ return this.buffer.length > 0 && this.bytes > 0
58
+ }
59
+
60
+ /**
61
+ * Adds an event object to the buffer while tallying size
62
+ * @param {Object} event the event object to add to the buffer
63
+ * @returns {EventBuffer} returns the event buffer for chaining
64
+ */
65
+ add (event) {
66
+ const size = stringify(event).length
67
+ if (!this.canMerge(size)) return this
68
+ this.#buffer.push(event)
69
+ this.#bytes += size
70
+ return this
71
+ }
72
+
73
+ /**
74
+ * clear the buffer data
75
+ * @returns {EventBuffer}
76
+ */
77
+ clear () {
78
+ this.#bytes = 0
79
+ this.#buffer = []
80
+ return this
81
+ }
82
+
83
+ /**
84
+ * Hold the buffer data in a new (child) EventBuffer (.held) to unblock the main buffer.
85
+ * This action clears the main buffer
86
+ * @returns {EventBuffer}
87
+ */
88
+ hold () {
89
+ this.held.merge(this)
90
+ this.clear()
91
+ return this
92
+ }
93
+
94
+ /**
95
+ * Prepend the held EventBuffer (.held) back into the main buffer
96
+ * This action clears the held buffer
97
+ * @returns {EventBuffer}
98
+ */
99
+ unhold () {
100
+ this.merge(this.held, true)
101
+ this.held.clear()
102
+ return this
103
+ }
104
+
105
+ /**
106
+ * Merges an EventBuffer into this EventBuffer
107
+ * @param {EventBuffer} events an EventBuffer intended to merge with this EventBuffer
108
+ * @param {boolean} prepend if true, the supplied events will be prepended before the events of this class
109
+ * @returns {EventBuffer} returns the event buffer for chaining
110
+ */
111
+ merge (eventBuffer, prepend = false) {
112
+ if (!this.canMerge(eventBuffer.bytes)) return this
113
+ this.#buffer = prepend ? [...eventBuffer.buffer, ...this.#buffer] : [...this.#buffer, ...eventBuffer.buffer]
114
+ this.#bytes += eventBuffer.#bytes
115
+ return this
116
+ }
117
+
118
+ /**
119
+ * Returns a boolean indicating the resulting size of a merge would be valid. Compares against the maxPayloadSize provided at initialization time.
120
+ * @param {number} size
121
+ * @returns {boolean}
122
+ */
123
+ canMerge (size) {
124
+ return this.bytes + (size || Infinity) < this.maxPayloadSize
125
+ }
126
+ }
@@ -1,4 +1,4 @@
1
- import { getConfigurationValue } from '../../common/config/config'
1
+ import { getConfigurationValue } from '../../common/config/init'
2
2
  import { isBrowserScope } from '../../common/constants/runtime'
3
3
 
4
4
  /**
@@ -10,7 +10,7 @@ import { onWindowLoad } from '../../common/window/load'
10
10
  import { isBrowserScope } from '../../common/constants/runtime'
11
11
  import { warn } from '../../common/util/console'
12
12
  import { FEATURE_NAMES } from '../../loaders/features/features'
13
- import { getConfigurationValue } from '../../common/config/config'
13
+ import { getConfigurationValue } from '../../common/config/init'
14
14
  import { hasReplayPrerequisite } from '../session_replay/shared/utils'
15
15
  import { canEnableSessionTracking } from './feature-gates'
16
16
  import { single } from '../../common/util/invoke'
@@ -45,6 +45,7 @@ export class InstrumentBase extends FeatureBase {
45
45
  /**
46
46
  * @type {Promise} Assigned immediately after @see importAggregator runs. Serves as a signal for when the inner async fn finishes execution. Useful for features to await
47
47
  * one another if there are inter-features dependencies.
48
+ * TODO: This is only used for the SPA feature component tests and should be refactored out.
48
49
  */
49
50
  this.onAggregateImported = undefined
50
51
 
@@ -18,12 +18,12 @@ export function lazyFeatureLoader (featureName, featurePart) {
18
18
  return import(/* webpackChunkName: "ajax-aggregate" */ '../ajax/aggregate')
19
19
  case FEATURE_NAMES.jserrors:
20
20
  return import(/* webpackChunkName: "jserrors-aggregate" */ '../jserrors/aggregate')
21
+ case FEATURE_NAMES.genericEvents:
22
+ return import(/* webpackChunkName: "generic_events-aggregate" */ '../generic_events/aggregate')
21
23
  case FEATURE_NAMES.logging:
22
24
  return import(/* webpackChunkName: "logging-aggregate" */ '../logging/aggregate')
23
25
  case FEATURE_NAMES.metrics:
24
26
  return import(/* webpackChunkName: "metrics-aggregate" */ '../metrics/aggregate')
25
- case FEATURE_NAMES.pageAction:
26
- return import(/* webpackChunkName: "page_action-aggregate" */ '../page_action/aggregate')
27
27
  case FEATURE_NAMES.pageViewEvent:
28
28
  return import(/* webpackChunkName: "page_view_event-aggregate" */ '../page_view_event/aggregate')
29
29
  case FEATURE_NAMES.pageViewTiming:
package/src/index.js CHANGED
@@ -4,9 +4,12 @@ export { MicroAgent } from './loaders/micro-agent'
4
4
 
5
5
  export { Ajax } from './features/ajax'
6
6
  export { JSErrors } from './features/jserrors'
7
+ export { GenericEvents } from './features/generic_events'
8
+ export { Logging } from './features/logging'
7
9
  export { Metrics } from './features/metrics'
8
10
  export { PageAction } from './features/page_action'
9
11
  export { PageViewEvent } from './features/page_view_event'
10
12
  export { PageViewTiming } from './features/page_view_timing'
11
13
  export { SessionTrace } from './features/session_trace'
14
+ export { SessionReplay } from './features/session_replay'
12
15
  export { Spa } from './features/spa'
@@ -3,7 +3,6 @@
3
3
  import { warn } from '../common/util/console'
4
4
  import { SR_EVENT_EMITTER_TYPES } from '../features/session_replay/constants'
5
5
  import { generateRandomHexString } from '../common/ids/unique-id'
6
- import { ee } from '../common/event-emitter/contextual-ee'
7
6
 
8
7
  /**
9
8
  * @typedef {import('./api/interaction-types').InteractionInstance} InteractionInstance
@@ -14,9 +13,6 @@ export class AgentBase {
14
13
 
15
14
  constructor (agentIdentifier = generateRandomHexString(16)) {
16
15
  this.agentIdentifier = agentIdentifier
17
-
18
- // Assign the observation context to the event emitter, so it knows how to create observation contexts
19
- this.ee = ee.get(agentIdentifier)
20
16
  }
21
17
 
22
18
  /**
@@ -184,12 +180,12 @@ export class AgentBase {
184
180
 
185
181
  /**
186
182
  * Capture a single log.
187
- * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/loginfo/}
183
+ * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/log/}
188
184
  * @param {string} message String to be captured as log message
189
185
  * @param {{customAttributes?: object, level?: 'ERROR'|'TRACE'|'DEBUG'|'INFO'|'WARN'}} [options] customAttributes defaults to `{}` if not assigned, level defaults to `info` if not assigned.
190
186
  */
191
187
  log (message, options) {
192
- return this.#callMethod('logInfo', message, options)
188
+ return this.#callMethod('log', message, options)
193
189
  }
194
190
 
195
191
  /**
@@ -72,8 +72,13 @@ export class Agent extends AgentBase {
72
72
  if (!this.runSoftNavOverSpa && InstrumentCtor.featureName === FEATURE_NAMES.softNav) return
73
73
 
74
74
  const dependencies = getFeatureDependencyNames(InstrumentCtor.featureName)
75
- 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
76
- if (!hasAllDeps) warn(36, InstrumentCtor.featureName)
75
+ const missingDependencies = dependencies.filter(featName => !(featName in this.features)) // any other feature(s) this depends on should've been initialized on prior iterations by priority order
76
+ if (missingDependencies.length > 0) {
77
+ warn(36, {
78
+ targetFeature: InstrumentCtor.featureName,
79
+ missingDependencies
80
+ })
81
+ }
77
82
 
78
83
  this.features[InstrumentCtor.featureName] = new InstrumentCtor(this.agentIdentifier, this.sharedAggregator)
79
84
  })
@@ -3,7 +3,8 @@
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
5
  import { FEATURE_NAMES } from '../features/features'
6
- import { getRuntime, setInfo, getInfo } from '../../common/config/config'
6
+ import { getInfo, setInfo } from '../../common/config/info'
7
+ import { getRuntime } from '../../common/config/runtime'
7
8
  import { handle } from '../../common/event-emitter/handle'
8
9
  import { ee } from '../../common/event-emitter/contextual-ee'
9
10
  import { drain, registerDrain } from '../../common/drain/drain'
@@ -69,7 +70,7 @@ export function setAPI (agentIdentifier, forceDrain, runSoftNavOverSpa = false)
69
70
  // Setup stub functions that queue calls for later processing.
70
71
  asyncApiMethods.forEach(fnName => { apiInterface[fnName] = apiCall(prefix, fnName, true, 'api') })
71
72
 
72
- apiInterface.addPageAction = apiCall(prefix, 'addPageAction', true, FEATURE_NAMES.pageAction)
73
+ apiInterface.addPageAction = apiCall(prefix, 'addPageAction', true, FEATURE_NAMES.genericEvents)
73
74
 
74
75
  apiInterface.setPageViewName = function (name, host) {
75
76
  if (typeof name !== 'string') return
@@ -1,5 +1,5 @@
1
1
  import { FEATURE_NAMES } from '../features/features'
2
- import { getRuntime } from '../../common/config/config'
2
+ import { getRuntime } from '../../common/config/runtime'
3
3
  import { ee } from '../../common/event-emitter/contextual-ee'
4
4
  import { handle } from '../../common/event-emitter/handle'
5
5
  import { registerHandler } from '../../common/event-emitter/register-handler'
@@ -27,7 +27,7 @@ export function setAPI (agentIdentifier) {
27
27
  var time = providedTime ? providedTime - originTime : t
28
28
  handle(CUSTOM_METRIC_CHANNEL, ['finished', { time }], undefined, FEATURE_NAMES.metrics, instanceEE)
29
29
  addToTrace(t, { name: 'finished', start: time + originTime, origin: 'nr' })
30
- handle('api-addPageAction', [time, 'finished'], undefined, FEATURE_NAMES.pageAction, instanceEE)
30
+ handle('api-addPageAction', [time, 'finished'], undefined, FEATURE_NAMES.genericEvents, instanceEE)
31
31
  }
32
32
 
33
33
  function addToTrace (t, evt) {
@@ -7,8 +7,9 @@ import { Instrument as InstrumentErrors } from '../features/jserrors/instrument'
7
7
  import { Instrument as InstrumentXhr } from '../features/ajax/instrument'
8
8
  import { Instrument as InstrumentSessionTrace } from '../features/session_trace/instrument'
9
9
  import { Instrument as InstrumentSpa } from '../features/spa/instrument'
10
- import { Instrument as InstrumentPageAction } from '../features/page_action/instrument'
11
10
  import { Instrument as InstrumentSessionReplay } from '../features/session_replay/instrument'
11
+ import { Instrument as InstrumentGenericEvents } from '../features/generic_events/instrument'
12
+ import { Instrument as InstrumentLogs } from '../features/logging/instrument'
12
13
 
13
14
  /**
14
15
  * An agent class with all feature modules available. Features may be disabled and enabled via runtime configuration.
@@ -24,10 +25,11 @@ export class BrowserAgent extends Agent {
24
25
  InstrumentPageViewTiming,
25
26
  InstrumentSessionTrace,
26
27
  InstrumentMetrics,
27
- InstrumentPageAction,
28
28
  InstrumentErrors,
29
29
  InstrumentSpa,
30
- InstrumentSessionReplay
30
+ InstrumentSessionReplay,
31
+ InstrumentGenericEvents,
32
+ InstrumentLogs
31
33
  ],
32
34
  loaderType: 'browser-agent'
33
35
  })
@@ -1,9 +1,13 @@
1
1
  import { setAPI, setTopLevelCallers } from '../api/api'
2
2
  import { addToNREUM, gosCDN } from '../../common/window/nreum'
3
- import { getConfiguration, setConfiguration, setInfo, setLoaderConfig, setRuntime } from '../../common/config/config'
3
+ import { setInfo } from '../../common/config/info'
4
+ import { getConfiguration, setConfiguration } from '../../common/config/init'
5
+ import { setLoaderConfig } from '../../common/config/loader-config'
6
+ import { setRuntime } from '../../common/config/runtime'
4
7
  import { activatedFeatures } from '../../common/util/feature-flags'
5
8
  import { isWorkerScope } from '../../common/constants/runtime'
6
9
  import { redefinePublicPath } from './public-path'
10
+ import { ee } from '../../common/event-emitter/contextual-ee'
7
11
 
8
12
  let alreadySetOnce = false // the configure() function can run multiple times in agent lifecycle
9
13
 
@@ -12,7 +16,8 @@ let alreadySetOnce = false // the configure() function can run multiple times in
12
16
  */
13
17
  export function configure (agent, opts = {}, loaderType, forceDrain) {
14
18
  // eslint-disable-next-line camelcase
15
- let { init, info, loader_config, runtime = { loaderType }, exposed = true } = opts
19
+ let { init, info, loader_config, runtime = {}, exposed = true } = opts
20
+ runtime.loaderType = loaderType
16
21
  const nr = gosCDN()
17
22
  if (!info) {
18
23
  init = nr.init
@@ -55,6 +60,8 @@ export function configure (agent, opts = {}, loaderType, forceDrain) {
55
60
  runtime.ptid = agent.agentIdentifier
56
61
  setRuntime(agent.agentIdentifier, runtime)
57
62
 
63
+ agent.ee = ee.get(agent.agentIdentifier)
64
+
58
65
  if (agent.api === undefined) agent.api = setAPI(agent.agentIdentifier, forceDrain, agent.runSoftNavOverSpa)
59
66
  if (agent.exposed === undefined) agent.exposed = exposed
60
67
  alreadySetOnce = true
@@ -1,5 +1,5 @@
1
1
  import { FEATURE_NAMES } from './features'
2
- import { getConfigurationValue } from '../../common/config/config'
2
+ import { getConfigurationValue } from '../../common/config/init'
3
3
 
4
4
  const featureNames = Object.values(FEATURE_NAMES)
5
5
 
@@ -1,8 +1,12 @@
1
1
  export const FEATURE_NAMES = {
2
2
  ajax: 'ajax',
3
+ genericEvents: 'generic_events',
3
4
  jserrors: 'jserrors',
4
5
  logging: 'logging',
5
6
  metrics: 'metrics',
7
+ /**
8
+ * @deprecated This feature has been replaced by Generic Events. Use/Import `GenericEvents` instead. This wrapper will be removed in a future release
9
+ */
6
10
  pageAction: 'page_action',
7
11
  pageViewEvent: 'page_view_event',
8
12
  pageViewTiming: 'page_view_timing',
@@ -24,8 +28,8 @@ export const featurePriority = {
24
28
  [FEATURE_NAMES.spa]: 5,
25
29
  [FEATURE_NAMES.ajax]: 6,
26
30
  [FEATURE_NAMES.sessionTrace]: 7,
27
- [FEATURE_NAMES.pageAction]: 8,
28
- [FEATURE_NAMES.softNav]: 9,
29
- [FEATURE_NAMES.sessionReplay]: 10,
30
- [FEATURE_NAMES.logging]: 11
31
+ [FEATURE_NAMES.softNav]: 8,
32
+ [FEATURE_NAMES.sessionReplay]: 9,
33
+ [FEATURE_NAMES.logging]: 10,
34
+ [FEATURE_NAMES.genericEvents]: 11
31
35
  }
@@ -5,7 +5,10 @@ import { configure } from './configure/configure'
5
5
  // core files
6
6
  import { Aggregator } from '../common/aggregate/aggregator'
7
7
  import { setNREUMInitializedAgent } from '../common/window/nreum'
8
- import { getConfiguration, getConfigurationValue, getInfo, getLoaderConfig, getRuntime } from '../common/config/config'
8
+ import { getInfo } from '../common/config/info'
9
+ import { getConfiguration, getConfigurationValue } from '../common/config/init'
10
+ import { getLoaderConfig } from '../common/config/loader-config'
11
+ import { getRuntime } from '../common/config/runtime'
9
12
  import { FEATURE_NAMES } from './features/features'
10
13
  import { warn } from '../common/util/console'
11
14
  import { onWindowLoad } from '../common/window/load'
@@ -13,7 +16,7 @@ import { AgentBase } from './agent-base'
13
16
 
14
17
  const nonAutoFeatures = [
15
18
  FEATURE_NAMES.jserrors,
16
- FEATURE_NAMES.pageAction,
19
+ FEATURE_NAMES.genericEvents,
17
20
  FEATURE_NAMES.metrics
18
21
  ]
19
22
 
@@ -1,16 +0,0 @@
1
- "use strict";
2
-
3
- require("../polyfills.js");
4
- var _agent = require("../../loaders/agent");
5
- var _instrument = require("../../features/page_view_event/instrument");
6
- var _instrument2 = require("../../features/page_view_timing/instrument");
7
- var _instrument3 = require("../../features/metrics/instrument");
8
- /**
9
- * @file Creates a version of the "Lite" agent loader with [core-js]{@link https://github.com/zloirock/core-js}
10
- * polyfills for pre-ES6 browsers and IE 11.
11
- */
12
-
13
- new _agent.Agent({
14
- features: [_instrument.Instrument, _instrument2.Instrument, _instrument3.Instrument],
15
- loaderType: 'lite-polyfills'
16
- });
@@ -1,21 +0,0 @@
1
- "use strict";
2
-
3
- require("../polyfills.js");
4
- var _agent = require("../../loaders/agent");
5
- var _instrument = require("../../features/page_view_event/instrument");
6
- var _instrument2 = require("../../features/page_view_timing/instrument");
7
- var _instrument3 = require("../../features/metrics/instrument");
8
- var _instrument4 = require("../../features/jserrors/instrument");
9
- var _instrument5 = require("../../features/ajax/instrument");
10
- var _instrument6 = require("../../features/session_trace/instrument");
11
- var _instrument7 = require("../../features/page_action/instrument");
12
- var _instrument8 = require("../../features/logging/instrument");
13
- /**
14
- * @file Creates a version of the "PRO" agent loader with [core-js]{@link https://github.com/zloirock/core-js}
15
- * polyfills for pre-ES6 browsers and IE 11.
16
- */
17
-
18
- new _agent.Agent({
19
- features: [_instrument.Instrument, _instrument2.Instrument, _instrument6.Instrument, _instrument5.Instrument, _instrument3.Instrument, _instrument7.Instrument, _instrument4.Instrument, _instrument8.Instrument],
20
- loaderType: 'pro-polyfills'
21
- });
@@ -1,22 +0,0 @@
1
- "use strict";
2
-
3
- require("../polyfills.js");
4
- var _agent = require("../../loaders/agent");
5
- var _instrument = require("../../features/page_view_event/instrument");
6
- var _instrument2 = require("../../features/page_view_timing/instrument");
7
- var _instrument3 = require("../../features/metrics/instrument");
8
- var _instrument4 = require("../../features/jserrors/instrument");
9
- var _instrument5 = require("../../features/ajax/instrument");
10
- var _instrument6 = require("../../features/session_trace/instrument");
11
- var _instrument7 = require("../../features/spa/instrument");
12
- var _instrument8 = require("../../features/page_action/instrument");
13
- var _instrument9 = require("../../features/logging/instrument");
14
- /**
15
- * @file Creates a version of the "SPA" agent loader with [core-js]{@link https://github.com/zloirock/core-js}
16
- * polyfills for pre-ES6 browsers and IE 11.
17
- */
18
-
19
- new _agent.Agent({
20
- features: [_instrument5.Instrument, _instrument.Instrument, _instrument2.Instrument, _instrument6.Instrument, _instrument3.Instrument, _instrument8.Instrument, _instrument4.Instrument, _instrument9.Instrument, _instrument7.Instrument],
21
- loaderType: 'spa-polyfills'
22
- });
@@ -1,24 +0,0 @@
1
- "use strict";
2
-
3
- require("core-js/stable/promise");
4
- require("core-js/stable/array/includes");
5
- require("core-js/stable/array/find");
6
- require("core-js/stable/array/flat");
7
- require("core-js/stable/array/flat-map");
8
- require("core-js/stable/array/from");
9
- require("core-js/stable/array/some");
10
- require("core-js/stable/array/find-index");
11
- require("core-js/stable/object/assign");
12
- require("core-js/stable/object/entries");
13
- require("core-js/stable/object/values");
14
- require("core-js/stable/object/from-entries");
15
- require("core-js/stable/map");
16
- require("core-js/stable/reflect");
17
- require("core-js/stable/set");
18
- require("core-js/stable/weak-set");
19
- require("core-js/stable/object/get-own-property-descriptors");
20
- require("core-js/stable/url");
21
- require("core-js/stable/url-search-params");
22
- require("core-js/stable/string/starts-with");
23
- require("core-js/stable/number/is-nan");
24
- require("core-js/stable/string/includes");
@@ -1,76 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "getConfiguration", {
7
- enumerable: true,
8
- get: function () {
9
- return _init.getConfiguration;
10
- }
11
- });
12
- Object.defineProperty(exports, "getConfigurationValue", {
13
- enumerable: true,
14
- get: function () {
15
- return _init.getConfigurationValue;
16
- }
17
- });
18
- Object.defineProperty(exports, "getInfo", {
19
- enumerable: true,
20
- get: function () {
21
- return _info.getInfo;
22
- }
23
- });
24
- Object.defineProperty(exports, "getLoaderConfig", {
25
- enumerable: true,
26
- get: function () {
27
- return _loaderConfig.getLoaderConfig;
28
- }
29
- });
30
- Object.defineProperty(exports, "getRuntime", {
31
- enumerable: true,
32
- get: function () {
33
- return _runtime.getRuntime;
34
- }
35
- });
36
- exports.isConfigured = isConfigured;
37
- Object.defineProperty(exports, "originals", {
38
- enumerable: true,
39
- get: function () {
40
- return _originals.originals;
41
- }
42
- });
43
- Object.defineProperty(exports, "setConfiguration", {
44
- enumerable: true,
45
- get: function () {
46
- return _init.setConfiguration;
47
- }
48
- });
49
- Object.defineProperty(exports, "setInfo", {
50
- enumerable: true,
51
- get: function () {
52
- return _info.setInfo;
53
- }
54
- });
55
- Object.defineProperty(exports, "setLoaderConfig", {
56
- enumerable: true,
57
- get: function () {
58
- return _loaderConfig.setLoaderConfig;
59
- }
60
- });
61
- Object.defineProperty(exports, "setRuntime", {
62
- enumerable: true,
63
- get: function () {
64
- return _runtime.setRuntime;
65
- }
66
- });
67
- var _info = require("./state/info");
68
- var _init = require("./state/init");
69
- var _loaderConfig = require("./state/loader-config");
70
- var _originals = require("./state/originals");
71
- var _runtime = require("./state/runtime");
72
- function isConfigured(agentIdentifier) {
73
- return (0, _info.isValid)(agentIdentifier);
74
- }
75
-
76
- // This module acts as a hub that bundles the static and dynamic properties used by each agent instance into one single interface
@@ -1,8 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.originals = void 0;
7
- var _nreum = require("../../window/nreum");
8
- const originals = exports.originals = (0, _nreum.gosNREUMOriginals)().o;
@@ -1,31 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.mapOwn = void 0;
7
- /*
8
- * Copyright 2020 New Relic Corporation. All rights reserved.
9
- * SPDX-License-Identifier: Apache-2.0
10
- */
11
-
12
- /**
13
- * @typedef {function} MapOwnCallback
14
- * @param {string} key Object key
15
- * @param {any} value Object value
16
- * @returns {any}
17
- */
18
-
19
- /**
20
- * Iterates the own enumerable properties of an object passing the key and value pair to a given
21
- * callback function.
22
- * @param {object} obj Input object to iterate over. If null or undefined, an empty array will be returned.
23
- * @param {MapOwnCallback} fn A callback function called for each property. The callback should take the key
24
- * and value from the object iteration and return some value.
25
- * @returns {any[]} An array of values returned by the callback function.
26
- */
27
- const mapOwn = (obj, fn) => Object.entries(obj || {}).map(_ref => {
28
- let [key, value] = _ref;
29
- return fn(key, value);
30
- });
31
- exports.mapOwn = mapOwn;