@newrelic/browser-agent 1.232.0 → 1.233.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (273) hide show
  1. package/dist/cjs/cdn/polyfills.js +5 -2
  2. package/dist/cjs/common/config/state/configurable.js +15 -26
  3. package/dist/cjs/common/config/state/info.js +1 -1
  4. package/dist/cjs/common/config/state/init.js +101 -56
  5. package/dist/cjs/common/config/state/loader-config.js +1 -1
  6. package/dist/cjs/common/config/state/runtime.js +1 -5
  7. package/dist/cjs/common/constants/env.cdn.js +1 -1
  8. package/dist/cjs/common/constants/env.npm.js +1 -1
  9. package/dist/cjs/common/drain/drain.js +1 -1
  10. package/dist/cjs/common/harvest/harvest-scheduler.js +30 -10
  11. package/dist/cjs/common/harvest/harvest.js +119 -55
  12. package/dist/cjs/common/session/session-entity.js +35 -22
  13. package/dist/cjs/common/session/session-entity.test.js +73 -49
  14. package/dist/cjs/common/timer/interaction-timer.js +9 -12
  15. package/dist/cjs/common/url/canonicalize-url.js +32 -0
  16. package/dist/cjs/common/url/canonicalize-url.test.js +42 -0
  17. package/dist/cjs/common/url/clean-url.js +10 -3
  18. package/dist/cjs/common/url/protocol.test.js +0 -1
  19. package/dist/cjs/common/util/feature-flags.js +2 -1
  20. package/dist/cjs/common/util/global-scope.js +4 -2
  21. package/dist/cjs/common/util/submit-data.js +57 -18
  22. package/dist/cjs/common/wrap/wrap-fetch.js +1 -3
  23. package/dist/cjs/common/wrap/wrap-function.js +1 -3
  24. package/dist/cjs/common/wrap/wrap-promise.js +1 -1
  25. package/dist/cjs/features/ajax/aggregate/index.js +2 -2
  26. package/dist/cjs/features/ajax/instrument/index.js +1 -1
  27. package/dist/cjs/features/jserrors/aggregate/canonical-function-name.js +12 -4
  28. package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.js +93 -10
  29. package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.test.js +164 -38
  30. package/dist/cjs/features/jserrors/aggregate/index.js +29 -48
  31. package/dist/cjs/features/jserrors/instrument/index.js +0 -2
  32. package/dist/cjs/features/metrics/aggregate/framework-detection.js +67 -0
  33. package/dist/cjs/features/metrics/aggregate/framework-detection.test.js +137 -0
  34. package/dist/cjs/features/metrics/aggregate/index.js +7 -3
  35. package/dist/cjs/features/metrics/aggregate/polyfill-detection.es5.js +14 -0
  36. package/dist/cjs/features/metrics/aggregate/polyfill-detection.es5.test.js +17 -0
  37. package/dist/cjs/features/metrics/aggregate/polyfill-detection.js +53 -0
  38. package/dist/cjs/features/metrics/aggregate/polyfill-detection.test.js +165 -0
  39. package/dist/cjs/features/page_action/aggregate/index.js +2 -2
  40. package/dist/cjs/features/page_view_event/aggregate/index.js +6 -3
  41. package/dist/cjs/features/page_view_timing/aggregate/index.js +2 -2
  42. package/dist/cjs/features/session_replay/aggregate/index.js +333 -0
  43. package/dist/cjs/features/session_replay/constants.js +9 -0
  44. package/dist/cjs/features/session_replay/index.js +12 -0
  45. package/dist/cjs/features/session_replay/instrument/index.js +29 -0
  46. package/dist/cjs/features/session_trace/aggregate/index.js +163 -164
  47. package/dist/cjs/features/session_trace/constants.js +2 -9
  48. package/dist/cjs/features/session_trace/instrument/index.js +24 -66
  49. package/dist/cjs/features/spa/aggregate/index.js +2 -2
  50. package/dist/cjs/features/utils/agent-session.js +1 -2
  51. package/dist/cjs/features/utils/aggregate-base.js +64 -0
  52. package/dist/cjs/features/utils/feature-base.js +0 -31
  53. package/dist/cjs/features/utils/handler-cache.js +3 -4
  54. package/dist/cjs/features/utils/instrument-base.js +42 -10
  55. package/dist/cjs/features/utils/{lazy-loader.js → lazy-feature-loader.js} +4 -2
  56. package/dist/cjs/loaders/agent.js +1 -1
  57. package/dist/cjs/loaders/api/apiAsync.js +3 -1
  58. package/dist/cjs/loaders/configure/configure.js +3 -3
  59. package/dist/cjs/loaders/features/featureDependencies.js +0 -12
  60. package/dist/cjs/loaders/features/features.js +3 -1
  61. package/dist/cjs/loaders/micro-agent.js +6 -6
  62. package/dist/esm/cdn/polyfills.js +5 -2
  63. package/dist/esm/common/config/state/configurable.js +14 -24
  64. package/dist/esm/common/config/state/info.js +2 -2
  65. package/dist/esm/common/config/state/init.js +102 -57
  66. package/dist/esm/common/config/state/loader-config.js +2 -2
  67. package/dist/esm/common/config/state/runtime.js +2 -4
  68. package/dist/esm/common/constants/env.cdn.js +1 -1
  69. package/dist/esm/common/constants/env.npm.js +1 -1
  70. package/dist/esm/common/drain/drain.js +1 -1
  71. package/dist/esm/common/harvest/harvest-scheduler.js +30 -10
  72. package/dist/esm/common/harvest/harvest.js +121 -56
  73. package/dist/esm/common/session/session-entity.js +35 -22
  74. package/dist/esm/common/session/session-entity.test.js +73 -49
  75. package/dist/esm/common/timer/interaction-timer.js +9 -12
  76. package/dist/esm/common/url/canonicalize-url.js +27 -0
  77. package/dist/esm/common/url/canonicalize-url.test.js +38 -0
  78. package/dist/esm/common/url/clean-url.js +10 -3
  79. package/dist/esm/common/url/protocol.test.js +0 -1
  80. package/dist/esm/common/util/feature-flags.js +2 -1
  81. package/dist/esm/common/util/global-scope.js +1 -0
  82. package/dist/esm/common/util/submit-data.js +57 -18
  83. package/dist/esm/common/wrap/wrap-fetch.js +1 -2
  84. package/dist/esm/common/wrap/wrap-function.js +1 -2
  85. package/dist/esm/common/wrap/wrap-promise.js +1 -1
  86. package/dist/esm/features/ajax/aggregate/index.js +2 -2
  87. package/dist/esm/features/ajax/instrument/index.js +1 -1
  88. package/dist/esm/features/jserrors/aggregate/canonical-function-name.js +12 -4
  89. package/dist/esm/features/jserrors/aggregate/compute-stack-trace.js +93 -10
  90. package/dist/esm/features/jserrors/aggregate/compute-stack-trace.test.js +149 -25
  91. package/dist/esm/features/jserrors/aggregate/index.js +30 -48
  92. package/dist/esm/features/jserrors/instrument/index.js +0 -1
  93. package/dist/esm/features/metrics/aggregate/framework-detection.js +61 -0
  94. package/dist/esm/features/metrics/aggregate/framework-detection.test.js +133 -0
  95. package/dist/esm/features/metrics/aggregate/index.js +7 -3
  96. package/dist/esm/features/metrics/aggregate/polyfill-detection.es5.js +8 -0
  97. package/dist/esm/features/metrics/aggregate/polyfill-detection.es5.test.js +15 -0
  98. package/dist/esm/features/metrics/aggregate/polyfill-detection.js +47 -0
  99. package/dist/esm/features/metrics/aggregate/polyfill-detection.test.js +163 -0
  100. package/dist/esm/features/page_action/aggregate/index.js +2 -2
  101. package/dist/esm/features/page_view_event/aggregate/index.js +6 -3
  102. package/dist/esm/features/page_view_timing/aggregate/index.js +2 -2
  103. package/dist/esm/features/session_replay/aggregate/index.js +327 -0
  104. package/dist/esm/features/session_replay/constants.js +2 -0
  105. package/dist/esm/features/session_replay/index.js +12 -0
  106. package/dist/esm/features/session_replay/instrument/index.js +21 -0
  107. package/dist/esm/features/session_trace/aggregate/index.js +163 -163
  108. package/dist/esm/features/session_trace/constants.js +1 -5
  109. package/dist/esm/features/session_trace/instrument/index.js +24 -66
  110. package/dist/esm/features/spa/aggregate/index.js +2 -2
  111. package/dist/esm/features/utils/agent-session.js +1 -2
  112. package/dist/esm/features/utils/aggregate-base.js +57 -0
  113. package/dist/esm/features/utils/feature-base.js +1 -32
  114. package/dist/esm/features/utils/handler-cache.js +3 -4
  115. package/dist/esm/features/utils/instrument-base.js +42 -10
  116. package/dist/esm/features/utils/{lazy-loader.js → lazy-feature-loader.js} +3 -1
  117. package/dist/esm/loaders/agent.js +1 -1
  118. package/dist/esm/loaders/api/apiAsync.js +3 -1
  119. package/dist/esm/loaders/configure/configure.js +3 -3
  120. package/dist/esm/loaders/features/featureDependencies.js +0 -11
  121. package/dist/esm/loaders/features/features.js +3 -1
  122. package/dist/esm/loaders/micro-agent.js +6 -6
  123. package/dist/types/common/config/state/configurable.d.ts +1 -3
  124. package/dist/types/common/config/state/configurable.d.ts.map +1 -1
  125. package/dist/types/common/config/state/init.d.ts.map +1 -1
  126. package/dist/types/common/config/state/runtime.d.ts.map +1 -1
  127. package/dist/types/common/harvest/harvest-scheduler.d.ts.map +1 -1
  128. package/dist/types/common/harvest/harvest.d.ts +37 -34
  129. package/dist/types/common/harvest/harvest.d.ts.map +1 -1
  130. package/dist/types/common/session/session-entity.d.ts +6 -3
  131. package/dist/types/common/session/session-entity.d.ts.map +1 -1
  132. package/dist/types/common/timer/interaction-timer.d.ts +2 -1
  133. package/dist/types/common/timer/interaction-timer.d.ts.map +1 -1
  134. package/dist/types/common/url/canonicalize-url.d.ts +9 -0
  135. package/dist/types/common/url/canonicalize-url.d.ts.map +1 -0
  136. package/dist/types/common/url/clean-url.d.ts +7 -1
  137. package/dist/types/common/url/clean-url.d.ts.map +1 -1
  138. package/dist/types/common/util/feature-flags.d.ts.map +1 -1
  139. package/dist/types/common/util/global-scope.d.ts +1 -0
  140. package/dist/types/common/util/global-scope.d.ts.map +1 -1
  141. package/dist/types/common/util/submit-data.d.ts +40 -14
  142. package/dist/types/common/util/submit-data.d.ts.map +1 -1
  143. package/dist/types/common/wrap/wrap-fetch.d.ts.map +1 -1
  144. package/dist/types/common/wrap/wrap-function.d.ts.map +1 -1
  145. package/dist/types/features/ajax/aggregate/index.d.ts +2 -2
  146. package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -1
  147. package/dist/types/features/jserrors/aggregate/canonical-function-name.d.ts +8 -1
  148. package/dist/types/features/jserrors/aggregate/canonical-function-name.d.ts.map +1 -1
  149. package/dist/types/features/jserrors/aggregate/compute-stack-trace.d.ts +48 -19
  150. package/dist/types/features/jserrors/aggregate/compute-stack-trace.d.ts.map +1 -1
  151. package/dist/types/features/jserrors/aggregate/index.d.ts +14 -5
  152. package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -1
  153. package/dist/types/features/jserrors/instrument/index.d.ts.map +1 -1
  154. package/dist/types/features/metrics/aggregate/framework-detection.d.ts.map +1 -0
  155. package/dist/types/features/metrics/aggregate/index.d.ts +2 -2
  156. package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -1
  157. package/dist/types/features/metrics/aggregate/polyfill-detection.d.ts +6 -0
  158. package/dist/types/features/metrics/aggregate/polyfill-detection.d.ts.map +1 -0
  159. package/dist/types/features/metrics/aggregate/polyfill-detection.es5.d.ts +7 -0
  160. package/dist/types/features/metrics/aggregate/polyfill-detection.es5.d.ts.map +1 -0
  161. package/dist/types/features/page_action/aggregate/index.d.ts +3 -3
  162. package/dist/types/features/page_action/aggregate/index.d.ts.map +1 -1
  163. package/dist/types/features/page_view_event/aggregate/index.d.ts +2 -2
  164. package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -1
  165. package/dist/types/features/page_view_timing/aggregate/index.d.ts +2 -2
  166. package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -1
  167. package/dist/types/features/session_replay/aggregate/index.d.ts +96 -0
  168. package/dist/types/features/session_replay/aggregate/index.d.ts.map +1 -0
  169. package/dist/types/features/session_replay/constants.d.ts +2 -0
  170. package/dist/types/features/session_replay/constants.d.ts.map +1 -0
  171. package/dist/types/features/session_replay/index.d.ts +2 -0
  172. package/dist/types/features/session_replay/index.d.ts.map +1 -0
  173. package/dist/types/features/session_replay/instrument/index.d.ts +6 -0
  174. package/dist/types/features/session_replay/instrument/index.d.ts.map +1 -0
  175. package/dist/types/features/session_trace/aggregate/index.d.ts +8 -57
  176. package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -1
  177. package/dist/types/features/session_trace/constants.d.ts +0 -3
  178. package/dist/types/features/session_trace/constants.d.ts.map +1 -1
  179. package/dist/types/features/session_trace/instrument/index.d.ts +1 -3
  180. package/dist/types/features/session_trace/instrument/index.d.ts.map +1 -1
  181. package/dist/types/features/spa/aggregate/index.d.ts +2 -2
  182. package/dist/types/features/spa/aggregate/index.d.ts.map +1 -1
  183. package/dist/types/features/utils/agent-session.d.ts.map +1 -1
  184. package/dist/types/features/utils/aggregate-base.d.ts +11 -0
  185. package/dist/types/features/utils/aggregate-base.d.ts.map +1 -0
  186. package/dist/types/features/utils/feature-base.d.ts +0 -5
  187. package/dist/types/features/utils/feature-base.d.ts.map +1 -1
  188. package/dist/types/features/utils/handler-cache.d.ts.map +1 -1
  189. package/dist/types/features/utils/instrument-base.d.ts +3 -1
  190. package/dist/types/features/utils/instrument-base.d.ts.map +1 -1
  191. package/dist/types/features/utils/{lazy-loader.d.ts → lazy-feature-loader.d.ts} +2 -2
  192. package/dist/types/features/utils/lazy-feature-loader.d.ts.map +1 -0
  193. package/dist/types/loaders/configure/configure.d.ts.map +1 -1
  194. package/dist/types/loaders/features/featureDependencies.d.ts +0 -1
  195. package/dist/types/loaders/features/featureDependencies.d.ts.map +1 -1
  196. package/dist/types/loaders/features/features.d.ts +1 -0
  197. package/dist/types/loaders/features/features.d.ts.map +1 -1
  198. package/package.json +31 -22
  199. package/src/cdn/polyfills.js +4 -1
  200. package/src/common/config/state/configurable.js +18 -24
  201. package/src/common/config/state/info.js +2 -2
  202. package/src/common/config/state/init.js +62 -28
  203. package/src/common/config/state/loader-config.js +2 -2
  204. package/src/common/config/state/runtime.js +2 -4
  205. package/src/common/drain/drain.js +1 -1
  206. package/src/common/harvest/harvest-scheduler.js +35 -10
  207. package/src/common/harvest/harvest.js +73 -50
  208. package/src/common/session/session-entity.js +34 -23
  209. package/src/common/session/session-entity.test.js +57 -51
  210. package/src/common/timer/interaction-timer.js +9 -12
  211. package/src/common/url/canonicalize-url.js +28 -0
  212. package/src/common/url/canonicalize-url.test.js +34 -0
  213. package/src/common/url/clean-url.js +10 -3
  214. package/src/common/url/protocol.test.js +0 -1
  215. package/src/common/util/feature-flags.js +2 -2
  216. package/src/common/util/global-scope.js +2 -0
  217. package/src/common/util/submit-data.js +28 -17
  218. package/src/common/wrap/wrap-fetch.js +1 -2
  219. package/src/common/wrap/wrap-function.js +1 -2
  220. package/src/common/wrap/wrap-promise.js +1 -1
  221. package/src/features/ajax/aggregate/index.js +2 -2
  222. package/src/features/ajax/instrument/index.js +1 -1
  223. package/src/features/jserrors/aggregate/canonical-function-name.js +12 -4
  224. package/src/features/jserrors/aggregate/compute-stack-trace.js +85 -11
  225. package/src/features/jserrors/aggregate/compute-stack-trace.test.js +141 -24
  226. package/src/features/jserrors/aggregate/index.js +28 -52
  227. package/src/features/jserrors/instrument/index.js +0 -1
  228. package/src/features/metrics/aggregate/framework-detection.js +73 -0
  229. package/src/features/metrics/aggregate/framework-detection.test.js +201 -0
  230. package/src/features/metrics/aggregate/index.js +8 -3
  231. package/src/features/metrics/aggregate/polyfill-detection.es5.js +9 -0
  232. package/src/features/metrics/aggregate/polyfill-detection.es5.test.js +16 -0
  233. package/src/features/metrics/aggregate/polyfill-detection.js +48 -0
  234. package/src/features/metrics/aggregate/polyfill-detection.test.js +163 -0
  235. package/src/features/page_action/aggregate/index.js +2 -2
  236. package/src/features/page_view_event/aggregate/index.js +5 -5
  237. package/src/features/page_view_timing/aggregate/index.js +2 -2
  238. package/src/features/session_replay/aggregate/index.js +314 -0
  239. package/src/features/session_replay/constants.js +3 -0
  240. package/src/features/session_replay/index.js +12 -0
  241. package/src/features/session_replay/instrument/index.js +22 -0
  242. package/src/features/session_trace/aggregate/index.js +148 -188
  243. package/src/features/session_trace/constants.js +0 -4
  244. package/src/features/session_trace/instrument/index.js +17 -69
  245. package/src/features/spa/aggregate/index.js +2 -2
  246. package/src/features/utils/agent-session.js +1 -2
  247. package/src/features/utils/aggregate-base.js +51 -0
  248. package/src/features/utils/feature-base.js +1 -31
  249. package/src/features/utils/handler-cache.js +3 -4
  250. package/src/features/utils/instrument-base.js +40 -8
  251. package/src/features/utils/{lazy-loader.js → lazy-feature-loader.js} +3 -1
  252. package/src/loaders/agent.js +1 -1
  253. package/src/loaders/api/apiAsync.js +1 -1
  254. package/src/loaders/configure/configure.js +4 -3
  255. package/src/loaders/features/featureDependencies.js +0 -12
  256. package/src/loaders/features/features.js +3 -1
  257. package/src/loaders/micro-agent.js +4 -4
  258. package/dist/cjs/common/metrics/framework-detection.js +0 -72
  259. package/dist/cjs/common/util/user-agent.js +0 -57
  260. package/dist/cjs/common/window/supports-performance-observer.js +0 -15
  261. package/dist/esm/common/metrics/framework-detection.js +0 -66
  262. package/dist/esm/common/util/user-agent.js +0 -48
  263. package/dist/esm/common/window/supports-performance-observer.js +0 -9
  264. package/dist/types/common/metrics/framework-detection.d.ts.map +0 -1
  265. package/dist/types/common/util/user-agent.d.ts +0 -5
  266. package/dist/types/common/util/user-agent.d.ts.map +0 -1
  267. package/dist/types/common/window/supports-performance-observer.d.ts +0 -2
  268. package/dist/types/common/window/supports-performance-observer.d.ts.map +0 -1
  269. package/dist/types/features/utils/lazy-loader.d.ts.map +0 -1
  270. package/src/common/metrics/framework-detection.js +0 -71
  271. package/src/common/util/user-agent.js +0 -56
  272. package/src/common/window/supports-performance-observer.js +0 -10
  273. /package/dist/types/{common/metrics → features/metrics/aggregate}/framework-detection.d.ts +0 -0
@@ -1,51 +1,8 @@
1
- export class Aggregate extends FeatureBase {
1
+ export class Aggregate extends AggregateBase {
2
2
  static featureName: string;
3
- constructor(agentIdentifier: any, aggregator: any);
3
+ constructor(agentIdentifier: any, aggregator: any, argsObj: any);
4
+ resourceObserver: any;
4
5
  ptid: string | undefined;
5
- ignoredEvents: {
6
- global: {
7
- mouseup: boolean;
8
- mousedown: boolean;
9
- };
10
- window: {
11
- load: boolean;
12
- pagehide: boolean;
13
- };
14
- xhrOriginMissing: {
15
- ignoreAll: boolean;
16
- };
17
- } | undefined;
18
- toAggregate: {
19
- typing: number[];
20
- scrolling: number[];
21
- mousing: number[];
22
- touching: number[];
23
- } | undefined;
24
- rename: {
25
- typing: {
26
- keydown: boolean;
27
- keyup: boolean;
28
- keypress: boolean;
29
- };
30
- mousing: {
31
- mousemove: boolean;
32
- mouseenter: boolean;
33
- mouseleave: boolean;
34
- mouseover: boolean;
35
- mouseout: boolean;
36
- };
37
- scrolling: {
38
- scroll: boolean;
39
- };
40
- touching: {
41
- touchstart: boolean;
42
- touchmove: boolean;
43
- touchend: boolean;
44
- touchcancel: boolean;
45
- touchenter: boolean;
46
- touchleave: boolean;
47
- };
48
- } | undefined;
49
6
  trace: {} | undefined;
50
7
  nodeCount: number | undefined;
51
8
  sentTrace: {} | null | undefined;
@@ -53,9 +10,10 @@ export class Aggregate extends FeatureBase {
53
10
  maxNodesPerHarvest: any;
54
11
  laststart: number | undefined;
55
12
  processPVT(name: any, value: any, attrs: any): void;
56
- storeTiming(_t: any): void;
13
+ storeTiming(timingEntry: any): void;
57
14
  storeTimer(target: any, start: any, end: any, type: any): void;
58
- storeEvent(currentEvent: any, target: any, start: any, end: any): false | undefined;
15
+ storeEvent(currentEvent: any, target: any, start: any, end: any): void;
16
+ shouldIgnoreEvent(event: any, target: any): boolean;
59
17
  evtName(type: any): any;
60
18
  evtOrigin(t: any, target: any): string;
61
19
  storeHist(path: any, old: any, time: any): void;
@@ -63,15 +21,8 @@ export class Aggregate extends FeatureBase {
63
21
  storeErrorAgg(type: any, name: any, params: any, metrics: any): void;
64
22
  storeXhrAgg(type: any, name: any, params: any, metrics: any): void;
65
23
  storeSTN(stn: any): void;
66
- mergeSTNs(key: any, nodes: any): void;
67
24
  takeSTNs(retry: any): {};
68
- byStart(a: any, b: any): number;
69
- smearEvtsByOrigin(name: any): (byOrigin: any, evt: any) => any;
70
- val(key: any, value: any): any;
71
- flatten(a: any, b: any): any;
72
- hasFID(name: any, attrs: any): boolean;
73
- trivial(node: any): boolean;
74
- shouldIgnoreEvent(event: any, target: any): boolean;
25
+ smearEvtsByOrigin(name: any): (byOrigin: any, evtNode: any) => any;
75
26
  }
76
- import { FeatureBase } from '../../utils/feature-base';
27
+ import { AggregateBase } from '../../utils/aggregate-base';
77
28
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_trace/aggregate/index.js"],"names":[],"mappings":"AAkBA;IACE,2BAAiC;IACjC,mDAoHC;IA7GC,yBAAc;IACd;;;;;;;;;;;;kBAOC;IACD;;;;;kBAKC;IACD;;;;;;;;;;;;;;;;;;;;;;;;kBAwBC;IAED,sBAAe;IACf,8BAAkB;IAClB,iCAAqB;IACrB,wBAA0G;IAC1G,wBAA4G;IAE5G,8BAAkB;IAgEpB,oDAKC;IAED,2BAuBC;IAED,+DAaC;IAED,oFAmBC;IAED,wBAQC;IAED,uCAqBC;IAED,gDAUC;IAED,qCAoBC;IAED,qEAUC;IAED,mEAUC;IAED,yBASC;IAED,sCASC;IAED,yBAmCC;IAED,gCAEC;IAED,+DAyBC;IAED,+BAEC;IAED,6BAEC;IAED,uCAEC;IAED,4BAIC;IAED,oDAMC;CACF;4BA5Y2B,0BAA0B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_trace/aggregate/index.js"],"names":[],"mappings":"AA+BA;IACE,2BAAiC;IACjC,iEAyEC;IAnEC,sBAAiD;IACjD,yBAAc;IACd,sBAAe;IACf,8BAAkB;IAClB,iCAAqB;IACrB,wBAA0G;IAC1G,wBAA4G;IAC5G,8BAAkB;IA+DpB,oDAOC;IAGD,oCAwBC;IAGD,+DASC;IAGD,uEAkBC;IAED,oDAMC;IAED,wBAwBC;IAED,uCAuBC;IAGD,gDASC;IAGD,qCAkBC;IAGD,qEAUC;IAGD,mEAUC;IAGD,yBAOC;IAGD,yBAgCC;IAED,mEA8BC;CACF;8BAvW6B,4BAA4B"}
@@ -1,5 +1,4 @@
1
1
  export const FEATURE_NAME: string;
2
- export const RESOURCE_TIMING_BUFFER_FULL: "resourcetimingbufferfull";
3
2
  export const BST_RESOURCE: "bstResource";
4
3
  export const RESOURCE: "resource";
5
4
  export const START: "-start";
@@ -8,6 +7,4 @@ export const FN_START: string;
8
7
  export const FN_END: string;
9
8
  export const BST_TIMER: "bstTimer";
10
9
  export const PUSH_STATE: "pushState";
11
- export const ORIG_EVENT: any;
12
- export const ADD_EVENT_LISTENER: "addEventListener";
13
10
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/features/session_trace/constants.js"],"names":[],"mappings":"AAGA,kCAAsD;AACtD,qEAAqE;AACrE,yCAAyC;AACzC,kCAAkC;AAClC,6BAA6B;AAC7B,yBAAyB;AACzB,8BAAoC;AACpC,4BAAgC;AAChC,mCAAmC;AACnC,qCAAqC;AACrC,6BAAsC;AACtC,oDAAoD"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/features/session_trace/constants.js"],"names":[],"mappings":"AAEA,kCAAsD;AACtD,yCAAyC;AACzC,kCAAkC;AAClC,6BAA6B;AAC7B,yBAAyB;AACzB,8BAAoC;AACpC,4BAAgC;AAChC,mCAAmC;AACnC,qCAAqC"}
@@ -3,9 +3,7 @@ export class Instrument extends InstrumentBase {
3
3
  constructor(agentIdentifier: any, aggregator: any, auto?: boolean);
4
4
  timerEE: Object | undefined;
5
5
  rafEE: Object | undefined;
6
- noOp(e: any): void;
7
- onResourceTimingBufferFull(evt: any): void;
8
- #private;
6
+ eventsEE: Object | undefined;
9
7
  }
10
8
  import { InstrumentBase } from '../../utils/instrument-base';
11
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_trace/instrument/index.js"],"names":[],"mappings":"AAoBA;IACE,2BAAiC;IACjC,mEAmFC;IA9EC,4BAA0C;IAC1C,0BAAsC;IAsFxC,mBAAwB;IAExB,2CASC;;CACF;+BArH8B,6BAA6B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_trace/instrument/index.js"],"names":[],"mappings":"AAgBA;IACE,2BAAiC;IACjC,mEAuDC;IAlDC,4BAA0C;IAC1C,0BAAsC;IAEtC,6BAA4C;CAgD/C;+BAnE8B,6BAA6B"}
@@ -1,4 +1,4 @@
1
- export class Aggregate extends FeatureBase {
1
+ export class Aggregate extends AggregateBase {
2
2
  static featureName: string;
3
3
  constructor(agentIdentifier: any, aggregator: any);
4
4
  state: {
@@ -20,6 +20,6 @@ export class Aggregate extends FeatureBase {
20
20
  };
21
21
  serializer: Serializer;
22
22
  }
23
- import { FeatureBase } from '../../utils/feature-base';
23
+ import { AggregateBase } from '../../utils/aggregate-base';
24
24
  import { Serializer } from './serializer';
25
25
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/spa/aggregate/index.js"],"names":[],"mappings":"AA2BA;IACE,2BAAiC;IACjC,mDAmsBC;IAhsBC;;;;;;;;;;;;;;;;MAgBC;IAED,uBAAsC;CA+qBzC;4BA5sB2B,0BAA0B;2BAL3B,cAAc"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/spa/aggregate/index.js"],"names":[],"mappings":"AA2BA;IACE,2BAAiC;IACjC,mDAmsBC;IAhsBC;;;;;;;;;;;;;;;;MAgBC;IAED,uBAAsC;CA+qBzC;8BA5sB6B,4BAA4B;2BAL/B,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"agent-session.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/agent-session.js"],"names":[],"mappings":"AAWA,6DAwDC"}
1
+ {"version":3,"file":"agent-session.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/agent-session.js"],"names":[],"mappings":"AAUA,6DAwDC"}
@@ -0,0 +1,11 @@
1
+ export class AggregateBase extends FeatureBase {
2
+ constructor(...args: any[]);
3
+ waitForFlags(flagNames?: any[]): Promise<any[]>;
4
+ /**
5
+ * Checks for additional `jsAttributes` items to support backward compatibility with implementations of the agent where
6
+ * loader configurations may appear after the loader code is executed.
7
+ */
8
+ checkConfiguration(): void;
9
+ }
10
+ import { FeatureBase } from './feature-base';
11
+ //# sourceMappingURL=aggregate-base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aggregate-base.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/aggregate-base.js"],"names":[],"mappings":"AAMA;IACE,4BAGC;IAED,gDAUC;IAED;;;OAGG;IACH,2BAqBC;CACF;4BAjD2B,gBAAgB"}
@@ -14,10 +14,5 @@ export class FeatureBase {
14
14
  * @type {boolean}
15
15
  */
16
16
  blocked: boolean;
17
- /**
18
- * Checks for additional `jsAttributes` items to support backward compatibility with implementations of the agent where
19
- * loader configurations may appear after the loader code is executed.
20
- */
21
- checkConfiguration(): void;
22
17
  }
23
18
  //# sourceMappingURL=feature-base.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"feature-base.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/feature-base.js"],"names":[],"mappings":"AAKA;IACE,qEAiBC;IAhBC,qBAAqB;IACrB,iBADW,MAAM,CACqB;IACtC,yBAAyB;IACzB,uBAA4B;IAC5B,2BAA2B;IAC3B,iBAAmF;IACnF,qBAAqB;IACrB,aADW,MAAM,CACa;IAC9B;;;;OAIG;IACH,SAFU,OAAO,CAEG;IAKtB;;;OAGG;IACH,2BAoBC;CACF"}
1
+ {"version":3,"file":"feature-base.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/feature-base.js"],"names":[],"mappings":"AAGA;IACE,qEAeC;IAdC,qBAAqB;IACrB,iBADW,MAAM,CACqB;IACtC,yBAAyB;IACzB,uBAA4B;IAC5B,2BAA2B;IAC3B,iBAAmF;IACnF,qBAAqB;IACrB,aADW,MAAM,CACa;IAC9B;;;;OAIG;IACH,SAFU,OAAO,CAEG;CAEvB"}
@@ -1 +1 @@
1
- {"version":3,"file":"handler-cache.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/handler-cache.js"],"names":[],"mappings":"AACA;;GAEG;AACH;IA+BE;;;;SAIK;IACL,2BAFe,IAAI,CAMlB;IAED;;;;;;;SAOK;IACL,iBAFa,OAAO,QAMnB;;CACF"}
1
+ {"version":3,"file":"handler-cache.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/handler-cache.js"],"names":[],"mappings":"AACA;;GAEG;AACH;IA6BE;;;;SAIK;IACL,2BAFe,IAAI,CAMlB;IAED;;;;;;;SAOK;IACL,iBAFa,OAAO,QAOnB;;CACF"}
@@ -20,8 +20,10 @@ export class InstrumentBase extends FeatureBase {
20
20
  /**
21
21
  * Lazy-load the latter part of the feature: its aggregator. This method is called by the first part of the feature
22
22
  * (the instrumentation) when instrumentation is complete.
23
+ * @param {Object} [argsObjFromInstrument] - any values or references to pass down to aggregate
24
+ * @returns void
23
25
  */
24
- importAggregator(): void;
26
+ importAggregator(argsObjFromInstrument?: Object | undefined): void;
25
27
  }
26
28
  import { FeatureBase } from './feature-base';
27
29
  //# sourceMappingURL=instrument-base.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"instrument-base.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/instrument-base.js"],"names":[],"mappings":"AAYA;;;GAGG;AACH;IACE;;;;;;;;OAQG;IACH,6BAPW,MAAM,uCAEN,MAAM,8BAchB;IAPC,uBAA0B;IAC1B,cAAgB;IAEhB,8IAA8I;IAC9I,cADW,WAAW,SAAS,CACd;IAKnB;;;OAGG;IACH,yBA4BC;CACF;4BA/D2B,gBAAgB"}
1
+ {"version":3,"file":"instrument-base.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/instrument-base.js"],"names":[],"mappings":"AAcA;;;GAGG;AACH;IACE;;;;;;;;OAQG;IACH,6BAPW,MAAM,uCAEN,MAAM,8BAchB;IAPC,uBAA0B;IAC1B,cAAgB;IAEhB,8IAA8I;IAC9I,cADW,WAAW,SAAS,CACd;IAKnB;;;;;OAKG;IACH,mEAyCC;CACF;4BAhF2B,gBAAgB"}
@@ -9,5 +9,5 @@
9
9
  * @param featurePart Name of the feature part to load; should be either instrument or aggregate
10
10
  * @returns {Promise<InstrumentBase|FeatureBase|null>}
11
11
  */
12
- export function lazyLoader(featureName: any, featurePart: any): Promise<InstrumentBase | FeatureBase | null>;
13
- //# sourceMappingURL=lazy-loader.d.ts.map
12
+ export function lazyFeatureLoader(featureName: any, featurePart: any): Promise<InstrumentBase | FeatureBase | null>;
13
+ //# sourceMappingURL=lazy-feature-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lazy-feature-loader.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/lazy-feature-loader.js"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,uEAFa,QAAQ,+BAA2B,IAAI,CAAC,CA2BpD"}
@@ -1 +1 @@
1
- {"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../../../src/loaders/configure/configure.js"],"names":[],"mappings":"AAMA;;;;;;;;EA2BC"}
1
+ {"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../../../src/loaders/configure/configure.js"],"names":[],"mappings":"AAMA;;;;;;;;EA4BC"}
@@ -1,3 +1,2 @@
1
1
  export function getFeatureDependencyNames(feature: any): string[];
2
- export function getFrozenAttributes(feature: any): string[];
3
2
  //# sourceMappingURL=featureDependencies.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"featureDependencies.d.ts","sourceRoot":"","sources":["../../../../src/loaders/features/featureDependencies.js"],"names":[],"mappings":"AAEA,kEAWC;AAED,4DAUC"}
1
+ {"version":3,"file":"featureDependencies.d.ts","sourceRoot":"","sources":["../../../../src/loaders/features/featureDependencies.js"],"names":[],"mappings":"AAEA,kEAWC"}
@@ -5,6 +5,7 @@ export namespace FEATURE_NAMES {
5
5
  const pageAction: string;
6
6
  const pageViewEvent: string;
7
7
  const pageViewTiming: string;
8
+ const sessionReplay: string;
8
9
  const sessionTrace: string;
9
10
  const spa: string;
10
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"features.d.ts","sourceRoot":"","sources":["../../../../src/loaders/features/features.js"],"names":[],"mappings":";;;;;;;;;;AAWA;;;GAGG;AACH;;EASC"}
1
+ {"version":3,"file":"features.d.ts","sourceRoot":"","sources":["../../../../src/loaders/features/features.js"],"names":[],"mappings":";;;;;;;;;;;AAYA;;;GAGG;AACH;;EAUC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newrelic/browser-agent",
3
- "version": "1.232.0",
3
+ "version": "1.233.0",
4
4
  "private": false,
5
5
  "author": "New Relic Browser Agent Team <browser-agent@newrelic.com>",
6
6
  "description": "Tests for the New Relic JavaScript agent",
@@ -87,16 +87,17 @@
87
87
  "node": ">=12.17.0 < 13.0.0 || >=13.7.0"
88
88
  },
89
89
  "scripts": {
90
- "wdio": "node tools/wdio/bin/cli.js",
90
+ "wdio": "node --max-old-space-size=8192 tools/wdio/bin/cli.js",
91
91
  "start": "npm-run-all --parallel cdn:watch test-server",
92
92
  "test": "jest",
93
93
  "test:watch": "jest --watch",
94
94
  "test:coverage": "jest --coverage",
95
95
  "build:all": "npm run cdn:build:local && npm run build:npm && npm run tools:test-builds",
96
96
  "build:npm": "npm run npm:build:esm && npm run npm:build:cjs && npm run npm:build:types && npm run npm:pack",
97
+ "build:browser-tests": "npm --prefix ./tools/test-builds/browser-tests run build",
97
98
  "lint": "eslint -c .eslintrc.js --ext .js,.cjs,.mjs .",
98
99
  "lint:fix": "npm run lint -- --fix",
99
- "test-all": "tools/jil/bin/cli.js -b *@*",
100
+ "test-jil": "tools/jil/bin/cli.js",
100
101
  "ci-build": "npm ci --cache ./.npm",
101
102
  "build-tar": "npm run ci-build && tar czf ./build/browser-agent.tar.gz --exclude=.git --exclude=.npm --exclude=build/browser-agent.tar.gz .",
102
103
  "watch": "jung -D '\\.npm|.git|node_modules|build|tools|tests' --run -- npm run build:all",
@@ -116,8 +117,8 @@
116
117
  "cdn:watch:extension": "jung -r ./src -F '.*\\.test\\.js' --run -- npm run cdn:build:extension",
117
118
  "cdn:webpack": "npx webpack --progress --config ./webpack.config.js",
118
119
  "packages:bundle": "webpack -c tools/jil/webpack.modular.js",
119
- "test-server": "node ./tools/jil/bin/server",
120
- "sauce:connect": "node ./tools/wdio/bin/sauce",
120
+ "test-server": "node ./tools/wdio/bin/server",
121
+ "sauce:connect": "node ./tools/saucelabs/bin.mjs",
121
122
  "sauce:get-browsers": "node ./tools/browsers-lists/sauce-browsers.mjs",
122
123
  "tools:test-builds": "npm --prefix ./tools/test-builds run build-all",
123
124
  "third-party-updates": "oss third-party manifest --includeOptDeps && oss third-party notices --includeOptDeps",
@@ -136,7 +137,8 @@
136
137
  },
137
138
  "dependencies": {
138
139
  "core-js": "^3.26.0",
139
- "lodash._slice": "^2.4.1",
140
+ "fflate": "^0.7.4",
141
+ "rrweb": "^2.0.0-alpha.8",
140
142
  "web-vitals": "^3.1.0"
141
143
  },
142
144
  "devDependencies": {
@@ -146,19 +148,21 @@
146
148
  "@babel/eslint-parser": "^7.19.1",
147
149
  "@babel/plugin-syntax-import-assertions": "^7.20.0",
148
150
  "@babel/preset-env": "^7.20.2",
151
+ "@babel/register": "^7.21.0",
149
152
  "@faker-js/faker": "^7.6.0",
150
- "@fastify/cors": "^8.2.0",
151
- "@fastify/multipart": "^7.3.0",
152
- "@fastify/static": "^6.6.0",
153
+ "@fastify/compress": "^6.2.1",
154
+ "@fastify/cors": "^8.2.1",
155
+ "@fastify/multipart": "^7.6.0",
156
+ "@fastify/static": "^6.10.1",
153
157
  "@newrelic/newrelic-oss-cli": "^0.1.2",
154
158
  "@newrelic/nr-querypack": "https://git@github.com/newrelic/nr-querypack",
155
159
  "@octokit/rest": "^19.0.7",
156
- "@wdio/cli": "^8.1.2",
157
- "@wdio/local-runner": "^8.1.2",
158
- "@wdio/mocha-framework": "^8.1.2",
159
- "@wdio/sauce-service": "^8.1.2",
160
- "@wdio/selenium-standalone-service": "^8.1.2",
161
- "@wdio/spec-reporter": "^8.1.2",
160
+ "@wdio/cli": "^8.10.5",
161
+ "@wdio/local-runner": "^8.10.5",
162
+ "@wdio/mocha-framework": "^8.10.4",
163
+ "@wdio/sauce-service": "^8.10.5",
164
+ "@wdio/selenium-standalone-service": "^8.10.4",
165
+ "@wdio/spec-reporter": "^8.10.5",
162
166
  "aws-sdk": "^2.894.0",
163
167
  "babel-jest": "^29.4.1",
164
168
  "babel-loader": "^8.2.5",
@@ -168,7 +172,7 @@
168
172
  "chalk": "^5.1.2",
169
173
  "charm": "^1.0.1",
170
174
  "concat-stream": "^1.5.1",
171
- "deepmerge-ts": "^4.2.2",
175
+ "deepmerge-ts": "^5.1.0",
172
176
  "defined": "^1.0.0",
173
177
  "dotenv-webpack": "^8.0.1",
174
178
  "eslint": "^8.34.0",
@@ -177,17 +181,18 @@
177
181
  "eslint-plugin-n": "^15.6.1",
178
182
  "eslint-plugin-promise": "^6.1.1",
179
183
  "eslint-plugin-sonarjs": "^0.19.0",
180
- "fastify": "^4.13.0",
181
- "fastify-plugin": "^4.4.0",
182
- "filesize": "^10.0.6",
184
+ "fastify": "^4.17.0",
185
+ "fastify-plugin": "^4.5.0",
186
+ "filesize": "^10.0.7",
183
187
  "fs-extra": "^11.1.0",
184
188
  "function-bind": "^1.1.1",
185
- "glob": "^7.0.5",
189
+ "glob": "^10.2.5",
186
190
  "gzip-size": "^7.0.0",
187
191
  "html-webpack-plugin": "^5.5.0",
188
192
  "husky": "^8.0.0",
189
193
  "jest": "^28.1.1",
190
194
  "jest-environment-jsdom": "28.1.1",
195
+ "jest-extended": "^3.2.4",
191
196
  "jquery": "1.11.3",
192
197
  "jung": "^2.1.0",
193
198
  "just-debounce": "^1.0.0",
@@ -197,13 +202,16 @@
197
202
  "npm-run-all": "^4.1.5",
198
203
  "object-inspect": "^1.5.0",
199
204
  "octokit": "^2.0.14",
205
+ "path-browserify": "^1.0.1",
200
206
  "preprocessify": "0.0.6",
207
+ "process": "^0.11.10",
201
208
  "request": "2.74.0",
202
209
  "sauce-connect-launcher": "^1.2.4",
203
- "saucelabs": "^7.2.0",
210
+ "saucelabs": "^7.2.1",
204
211
  "semver": "^5.3.0",
205
212
  "serialize-anything": "^1.2.3",
206
- "sinon": "^1.17.5",
213
+ "sinon": "^2.4.1",
214
+ "stream-browserify": "^3.0.0",
207
215
  "tap-parser": "^1.2.2",
208
216
  "tape": "^4.8.0",
209
217
  "through": "^2.3.8",
@@ -215,6 +223,7 @@
215
223
  "webpack": "^5.74.0",
216
224
  "webpack-bundle-analyzer": "^4.7.0",
217
225
  "webpack-cli": "^4.10.0",
226
+ "webpack-stream": "^7.0.0",
218
227
  "yargs": "^17.6.2"
219
228
  },
220
229
  "files": [
@@ -5,8 +5,10 @@
5
5
 
6
6
  import 'core-js/stable/promise'
7
7
  import 'core-js/stable/array/includes'
8
- import 'core-js/stable/array/from'
9
8
  import 'core-js/stable/array/find'
9
+ import 'core-js/stable/array/flat'
10
+ import 'core-js/stable/array/flat-map'
11
+ import 'core-js/stable/array/from'
10
12
  import 'core-js/stable/array/some'
11
13
  import 'core-js/stable/object/assign'
12
14
  import 'core-js/stable/object/entries'
@@ -15,3 +17,4 @@ import 'core-js/stable/map'
15
17
  import 'core-js/stable/reflect'
16
18
  import 'core-js/stable/set'
17
19
  import 'core-js/stable/weak-set'
20
+ import 'core-js/stable/object/get-own-property-descriptors'
@@ -1,32 +1,26 @@
1
- import { getFrozenAttributes } from '../../../loaders/features/featureDependencies'
2
1
  import { warn } from '../../util/console'
3
2
 
4
- export class Configurable {
5
- constructor (obj, model) {
6
- Object.assign(this, setValues(obj, model))
7
- }
8
- }
9
-
10
- function setValues (obj, model) {
11
- const state = {}
3
+ export function getModeledObject (obj, model) {
12
4
  try {
13
- if (!obj || typeof obj !== 'object') return warn('New setting a Configurable requires an object as input')
5
+ if (!obj || typeof obj !== 'object') return warn('Setting a Configurable requires an object as input')
14
6
  if (!model || typeof model !== 'object') return warn('Setting a Configurable requires a model to set its initial properties')
15
- Object.assign(state, model)
16
- Object.entries(obj).forEach(([key, value]) => {
17
- if (!Object.keys(model).includes(key)) return
18
- const frozenAttrs = getFrozenAttributes(key)
19
- if (frozenAttrs.length && value && typeof value === 'object') {
20
- frozenAttrs.forEach(attr => {
21
- if (attr in value) {
22
- warn(`"${attr}" is a protected attribute and can not be changed in feature ${key}. It will have no effect.`)
23
- delete value[attr]
24
- }
25
- })
7
+ // allow getters and setters to pass from model to target
8
+ const output = Object.create(
9
+ Object.getPrototypeOf(model),
10
+ Object.getOwnPropertyDescriptors(model)
11
+ )
12
+ const target = Object.keys(output).length === 0 ? obj : output
13
+ for (let key in target) {
14
+ if (obj[key] !== undefined) {
15
+ try {
16
+ if (typeof obj[key] === 'object' && typeof model[key] === 'object') output[key] = getModeledObject(obj[key], model[key])
17
+ else output[key] = obj[key]
18
+ } catch (e) {
19
+ warn('An error occurred while setting a property of a Configurable', e)
20
+ }
26
21
  }
27
- state[key] = value
28
- })
29
- return state
22
+ }
23
+ return output
30
24
  } catch (err) {
31
25
  warn('An error occured while setting a Configurable', err)
32
26
  }
@@ -1,5 +1,5 @@
1
1
  import { defaults as nrDefaults, gosNREUMInitializedAgents } from '../../window/nreum'
2
- import { Configurable } from './configurable'
2
+ import { getModeledObject } from './configurable'
3
3
 
4
4
  const model = {
5
5
  // preset defaults
@@ -44,6 +44,6 @@ export function getInfo (id) {
44
44
 
45
45
  export function setInfo (id, obj) {
46
46
  if (!id) throw new Error('All info objects require an agent identifier!')
47
- _cache[id] = new Configurable(obj, model)
47
+ _cache[id] = getModeledObject(obj, model)
48
48
  gosNREUMInitializedAgents(id, _cache[id], 'info')
49
49
  }
@@ -1,34 +1,68 @@
1
1
 
2
2
  import { DEFAULT_EXPIRES_MS, DEFAULT_INACTIVE_MS } from '../../session/constants'
3
- import { globalScope } from '../../util/global-scope'
4
3
  import { gosNREUMInitializedAgents } from '../../window/nreum'
5
- import { Configurable } from './configurable'
4
+ import { getModeledObject } from './configurable'
6
5
 
7
- const model = {
8
- allow_bfcache: true, // *cli - temporary feature flag for BFCache work
9
- privacy: { cookies_enabled: true }, // *cli - per discussion, default should be true
10
- ajax: { deny_list: undefined, enabled: true, harvestTimeSeconds: 10 },
11
- distributed_tracing: {
12
- enabled: undefined,
13
- exclude_newrelic_header: undefined,
14
- cors_use_newrelic_header: undefined,
15
- cors_use_tracecontext_headers: undefined,
16
- allowed_origins: undefined
17
- },
18
- session: {
19
- domain: undefined, // used by first party cookies to set the top-level domain
20
- expiresMs: DEFAULT_EXPIRES_MS,
21
- inactiveMs: DEFAULT_INACTIVE_MS
22
- },
23
- ssl: undefined,
24
- obfuscate: undefined,
25
- jserrors: { enabled: true, harvestTimeSeconds: 10 },
26
- metrics: { enabled: true },
27
- page_action: { enabled: true, harvestTimeSeconds: 30 },
28
- page_view_event: { enabled: true },
29
- page_view_timing: { enabled: true, harvestTimeSeconds: 30, long_task: false },
30
- session_trace: { enabled: true, harvestTimeSeconds: 10 },
31
- spa: { enabled: true, harvestTimeSeconds: 10 }
6
+ const model = () => {
7
+ const hiddenState = {
8
+ blockSelector: '[data-nr-block]',
9
+ maskInputOptions: { password: true }
10
+ }
11
+ return {
12
+ allow_bfcache: true, // *cli - temporary feature flag for BFCache work
13
+ privacy: { cookies_enabled: true }, // *cli - per discussion, default should be true
14
+ ajax: { deny_list: undefined, enabled: true, harvestTimeSeconds: 10 },
15
+ distributed_tracing: {
16
+ enabled: undefined,
17
+ exclude_newrelic_header: undefined,
18
+ cors_use_newrelic_header: undefined,
19
+ cors_use_tracecontext_headers: undefined,
20
+ allowed_origins: undefined
21
+ },
22
+ session: {
23
+ domain: undefined, // used by first party cookies to set the top-level domain
24
+ expiresMs: DEFAULT_EXPIRES_MS,
25
+ inactiveMs: DEFAULT_INACTIVE_MS
26
+ },
27
+ ssl: undefined,
28
+ obfuscate: undefined,
29
+ jserrors: { enabled: true, harvestTimeSeconds: 10 },
30
+ metrics: { enabled: true },
31
+ page_action: { enabled: true, harvestTimeSeconds: 30 },
32
+ page_view_event: { enabled: true },
33
+ page_view_timing: { enabled: true, harvestTimeSeconds: 30, long_task: false },
34
+ session_trace: { enabled: true, harvestTimeSeconds: 10 },
35
+ session_replay: {
36
+ // feature settings
37
+ enabled: true,
38
+ harvestTimeSeconds: 60,
39
+ sampleRate: 0.1,
40
+ errorSampleRate: 0.1,
41
+ // recording config settings
42
+ maskTextSelector: '*',
43
+ maskAllInputs: true,
44
+ // these properties only have getters because they are enforcable constants and should error if someone tries to override them
45
+ get blockClass () { return 'nr-block' },
46
+ get ignoreClass () { return 'nr-ignore' },
47
+ get maskTextClass () { return 'nr-mask' },
48
+ // props with a getter and setter are used to extend enforcable constants with customer input
49
+ // we must preserve data-nr-block no matter what else the customer sets
50
+ get blockSelector () {
51
+ return hiddenState.blockSelector
52
+ },
53
+ set blockSelector (val) {
54
+ hiddenState.blockSelector += `,${val}`
55
+ },
56
+ // password: must always be present and true no matter what customer sets
57
+ get maskInputOptions () {
58
+ return hiddenState.maskInputOptions
59
+ },
60
+ set maskInputOptions (val) {
61
+ hiddenState.maskInputOptions = { ...val, password: true }
62
+ }
63
+ },
64
+ spa: { enabled: true, harvestTimeSeconds: 10 }
65
+ }
32
66
  }
33
67
 
34
68
  const _cache = {}
@@ -41,7 +75,7 @@ export function getConfiguration (id) {
41
75
 
42
76
  export function setConfiguration (id, obj) {
43
77
  if (!id) throw new Error('All configuration objects require an agent identifier!')
44
- _cache[id] = new Configurable(obj, model)
78
+ _cache[id] = getModeledObject(obj, model())
45
79
  gosNREUMInitializedAgents(id, _cache[id], 'config')
46
80
  }
47
81
 
@@ -1,5 +1,5 @@
1
1
  import { gosNREUMInitializedAgents } from '../../window/nreum'
2
- import { Configurable } from './configurable'
2
+ import { getModeledObject } from './configurable'
3
3
 
4
4
  const model = {
5
5
  accountID: undefined,
@@ -20,6 +20,6 @@ export function getLoaderConfig (id) {
20
20
 
21
21
  export function setLoaderConfig (id, obj) {
22
22
  if (!id) throw new Error('All loader-config objects require an agent identifier!')
23
- _cache[id] = new Configurable(obj, model)
23
+ _cache[id] = getModeledObject(obj, model)
24
24
  gosNREUMInitializedAgents(id, _cache[id], 'loader_config')
25
25
  }
@@ -1,5 +1,4 @@
1
- import * as userAgent from '../../util/user-agent'
2
- import { Configurable } from './configurable'
1
+ import { getModeledObject } from './configurable'
3
2
  import { gosNREUMInitializedAgents } from '../../window/nreum'
4
3
  import { globalScope } from '../../util/global-scope'
5
4
  import { BUILD_ENV, DIST_METHOD, VERSION } from '../../constants/env'
@@ -23,7 +22,6 @@ const model = {
23
22
  releaseIds: {},
24
23
  session: undefined,
25
24
  xhrWrappable: typeof globalScope.XMLHttpRequest?.prototype?.addEventListener === 'function',
26
- userAgent,
27
25
  version: VERSION
28
26
  }
29
27
 
@@ -37,6 +35,6 @@ export function getRuntime (id) {
37
35
 
38
36
  export function setRuntime (id, obj) {
39
37
  if (!id) throw new Error('All runtime objects require an agent identifier!')
40
- _cache[id] = new Configurable(obj, model)
38
+ _cache[id] = getModeledObject(obj, model)
41
39
  gosNREUMInitializedAgents(id, _cache[id], 'runtime')
42
40
  }
@@ -55,7 +55,7 @@ export function drain (agentIdentifier = '', featureName = 'feature') {
55
55
 
56
56
  // Only when the event-groups for all features are ready to drain (staged) do we execute the drain. This has the effect
57
57
  // that the last feature to call drain triggers drain for all features.
58
- const items = Array.from(registry[agentIdentifier])
58
+ const items = [...registry[agentIdentifier]]
59
59
  if (items.every(([key, values]) => values.staged)) {
60
60
  items.sort((a, b) => a[1].priority - b[1].priority)
61
61
  items.forEach(([group]) => {