@newrelic/browser-agent 0.1.231 → 1.232.1

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 (256) hide show
  1. package/README.md +2 -2
  2. package/dist/cjs/common/config/state/configurable.js +27 -21
  3. package/dist/cjs/common/config/state/init.js +8 -0
  4. package/dist/cjs/common/config/state/runtime.js +24 -26
  5. package/dist/cjs/common/constants/env.cdn.js +1 -1
  6. package/dist/cjs/common/constants/env.npm.js +1 -1
  7. package/dist/cjs/common/context/shared-context.js +2 -1
  8. package/dist/cjs/common/event-emitter/contextual-ee.test.js +2 -2
  9. package/dist/cjs/common/event-emitter/register-handler.test.js +1 -1
  10. package/dist/cjs/common/event-listener/event-listener-opts.js +4 -2
  11. package/dist/cjs/common/harvest/harvest-scheduler.js +14 -11
  12. package/dist/cjs/common/harvest/harvest.js +3 -1
  13. package/dist/cjs/common/session/constants.js +12 -0
  14. package/dist/cjs/common/session/session-entity.js +278 -0
  15. package/dist/cjs/common/session/session-entity.test.js +436 -0
  16. package/dist/cjs/common/storage/first-party-cookies.js +35 -0
  17. package/dist/cjs/common/storage/local-memory.js +35 -0
  18. package/dist/cjs/common/storage/local-memory.test.js +20 -0
  19. package/dist/cjs/common/storage/local-storage.js +33 -0
  20. package/dist/cjs/common/storage/local-storage.test.js +14 -0
  21. package/dist/cjs/common/timer/interaction-timer.js +78 -0
  22. package/dist/cjs/common/timer/interaction-timer.test.js +216 -0
  23. package/dist/cjs/common/timer/timer.js +32 -0
  24. package/dist/cjs/common/timer/timer.test.js +105 -0
  25. package/dist/cjs/common/unload/eol.js +2 -2
  26. package/dist/cjs/common/url/canonicalize-url.js +32 -0
  27. package/dist/cjs/common/url/canonicalize-url.test.js +42 -0
  28. package/dist/cjs/common/url/clean-url.js +10 -3
  29. package/dist/cjs/common/util/data-size.js +6 -0
  30. package/dist/cjs/common/util/data-size.test.js +47 -0
  31. package/dist/cjs/common/util/global-scope.js +4 -2
  32. package/dist/cjs/common/util/invoke.js +73 -0
  33. package/dist/cjs/common/util/invoke.test.js +49 -0
  34. package/dist/cjs/common/util/obfuscate.js +0 -4
  35. package/dist/cjs/common/window/page-visibility.js +3 -1
  36. package/dist/cjs/common/wrap/wrap-fetch.js +1 -3
  37. package/dist/cjs/common/wrap/wrap-function.js +1 -3
  38. package/dist/cjs/common/wrap/wrap-timer.js +1 -1
  39. package/dist/cjs/features/ajax/aggregate/index.js +2 -2
  40. package/dist/cjs/features/ajax/instrument/index.js +1 -1
  41. package/dist/cjs/features/jserrors/aggregate/canonical-function-name.js +12 -4
  42. package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.js +93 -10
  43. package/dist/cjs/features/jserrors/aggregate/compute-stack-trace.test.js +164 -38
  44. package/dist/cjs/features/jserrors/aggregate/index.js +25 -46
  45. package/dist/cjs/features/jserrors/instrument/index.js +0 -2
  46. package/dist/cjs/features/metrics/aggregate/index.js +13 -2
  47. package/dist/cjs/features/page_action/aggregate/index.js +2 -2
  48. package/dist/cjs/features/page_view_event/aggregate/index.js +6 -3
  49. package/dist/cjs/features/page_view_timing/aggregate/index.js +6 -6
  50. package/dist/cjs/features/session_trace/aggregate/index.js +3 -5
  51. package/dist/cjs/features/spa/aggregate/index.js +6 -5
  52. package/dist/cjs/features/utils/agent-session.js +73 -0
  53. package/dist/cjs/features/utils/feature-base.js +1 -1
  54. package/dist/cjs/features/utils/instrument-base.js +7 -2
  55. package/dist/cjs/features/utils/lazy-loader.js +1 -1
  56. package/dist/cjs/loaders/agent.js +1 -1
  57. package/dist/cjs/loaders/api/api.js +1 -4
  58. package/dist/cjs/loaders/api/apiAsync.js +3 -2
  59. package/dist/cjs/loaders/configure/configure.js +0 -6
  60. package/dist/esm/common/config/state/configurable.js +26 -20
  61. package/dist/esm/common/config/state/init.js +8 -0
  62. package/dist/esm/common/config/state/runtime.js +24 -26
  63. package/dist/esm/common/constants/env.cdn.js +1 -1
  64. package/dist/esm/common/constants/env.npm.js +1 -1
  65. package/dist/esm/common/context/shared-context.js +2 -1
  66. package/dist/esm/common/event-emitter/contextual-ee.test.js +2 -2
  67. package/dist/esm/common/event-emitter/register-handler.test.js +1 -1
  68. package/dist/esm/common/event-listener/event-listener-opts.js +4 -2
  69. package/dist/esm/common/harvest/harvest-scheduler.js +14 -11
  70. package/dist/esm/common/harvest/harvest.js +3 -1
  71. package/dist/esm/common/session/constants.js +3 -0
  72. package/dist/esm/common/session/session-entity.js +271 -0
  73. package/dist/esm/common/session/session-entity.test.js +434 -0
  74. package/dist/esm/common/storage/first-party-cookies.js +28 -0
  75. package/dist/esm/common/storage/local-memory.js +28 -0
  76. package/dist/esm/common/storage/local-memory.test.js +18 -0
  77. package/dist/esm/common/storage/local-storage.js +26 -0
  78. package/dist/esm/common/storage/local-storage.test.js +12 -0
  79. package/dist/esm/common/timer/interaction-timer.js +71 -0
  80. package/dist/esm/common/timer/interaction-timer.test.js +214 -0
  81. package/dist/esm/common/timer/timer.js +25 -0
  82. package/dist/esm/common/timer/timer.test.js +103 -0
  83. package/dist/esm/common/unload/eol.js +1 -1
  84. package/dist/esm/common/url/canonicalize-url.js +27 -0
  85. package/dist/esm/common/url/canonicalize-url.test.js +38 -0
  86. package/dist/esm/common/url/clean-url.js +10 -3
  87. package/dist/esm/common/util/data-size.js +7 -0
  88. package/dist/esm/common/util/data-size.test.js +45 -0
  89. package/dist/esm/common/util/global-scope.js +1 -0
  90. package/dist/esm/common/util/invoke.js +66 -0
  91. package/dist/esm/common/util/invoke.test.js +47 -0
  92. package/dist/esm/common/util/obfuscate.js +0 -4
  93. package/dist/esm/common/window/page-visibility.js +3 -1
  94. package/dist/esm/common/wrap/wrap-fetch.js +1 -2
  95. package/dist/esm/common/wrap/wrap-function.js +1 -2
  96. package/dist/esm/common/wrap/wrap-timer.js +1 -1
  97. package/dist/esm/features/ajax/aggregate/index.js +2 -2
  98. package/dist/esm/features/ajax/instrument/index.js +1 -1
  99. package/dist/esm/features/jserrors/aggregate/canonical-function-name.js +12 -4
  100. package/dist/esm/features/jserrors/aggregate/compute-stack-trace.js +93 -10
  101. package/dist/esm/features/jserrors/aggregate/compute-stack-trace.test.js +149 -25
  102. package/dist/esm/features/jserrors/aggregate/index.js +26 -46
  103. package/dist/esm/features/jserrors/instrument/index.js +0 -1
  104. package/dist/esm/features/metrics/aggregate/index.js +14 -3
  105. package/dist/esm/features/page_action/aggregate/index.js +2 -2
  106. package/dist/esm/features/page_view_event/aggregate/index.js +6 -3
  107. package/dist/esm/features/page_view_timing/aggregate/index.js +6 -6
  108. package/dist/esm/features/session_trace/aggregate/index.js +3 -4
  109. package/dist/esm/features/spa/aggregate/index.js +6 -5
  110. package/dist/esm/features/utils/agent-session.js +67 -0
  111. package/dist/esm/features/utils/feature-base.js +1 -1
  112. package/dist/esm/features/utils/instrument-base.js +7 -2
  113. package/dist/esm/features/utils/lazy-loader.js +1 -1
  114. package/dist/esm/loaders/agent.js +1 -1
  115. package/dist/esm/loaders/api/api.js +2 -5
  116. package/dist/esm/loaders/api/apiAsync.js +2 -1
  117. package/dist/esm/loaders/configure/configure.js +2 -8
  118. package/dist/types/common/config/state/configurable.d.ts.map +1 -1
  119. package/dist/types/common/config/state/init.d.ts.map +1 -1
  120. package/dist/types/common/config/state/runtime.d.ts.map +1 -1
  121. package/dist/types/common/context/shared-context.d.ts.map +1 -1
  122. package/dist/types/common/event-listener/event-listener-opts.d.ts +2 -2
  123. package/dist/types/common/event-listener/event-listener-opts.d.ts.map +1 -1
  124. package/dist/types/common/harvest/harvest-scheduler.d.ts +1 -0
  125. package/dist/types/common/harvest/harvest-scheduler.d.ts.map +1 -1
  126. package/dist/types/common/harvest/harvest.d.ts.map +1 -1
  127. package/dist/types/common/session/constants.d.ts +4 -0
  128. package/dist/types/common/session/constants.d.ts.map +1 -0
  129. package/dist/types/common/session/session-entity.d.ts +72 -0
  130. package/dist/types/common/session/session-entity.d.ts.map +1 -0
  131. package/dist/types/common/storage/first-party-cookies.d.ts +8 -0
  132. package/dist/types/common/storage/first-party-cookies.d.ts.map +1 -0
  133. package/dist/types/common/storage/local-memory.d.ts +8 -0
  134. package/dist/types/common/storage/local-memory.d.ts.map +1 -0
  135. package/dist/types/common/storage/local-storage.d.ts +6 -0
  136. package/dist/types/common/storage/local-storage.d.ts.map +1 -0
  137. package/dist/types/common/timer/interaction-timer.d.ts +11 -0
  138. package/dist/types/common/timer/interaction-timer.d.ts.map +1 -0
  139. package/dist/types/common/timer/timer.d.ts +12 -0
  140. package/dist/types/common/timer/timer.d.ts.map +1 -0
  141. package/dist/types/common/url/canonicalize-url.d.ts +9 -0
  142. package/dist/types/common/url/canonicalize-url.d.ts.map +1 -0
  143. package/dist/types/common/url/clean-url.d.ts +7 -1
  144. package/dist/types/common/url/clean-url.d.ts.map +1 -1
  145. package/dist/types/common/util/data-size.d.ts +7 -1
  146. package/dist/types/common/util/data-size.d.ts.map +1 -1
  147. package/dist/types/common/util/global-scope.d.ts +1 -0
  148. package/dist/types/common/util/global-scope.d.ts.map +1 -1
  149. package/dist/types/common/util/invoke.d.ts +35 -0
  150. package/dist/types/common/util/invoke.d.ts.map +1 -0
  151. package/dist/types/common/util/obfuscate.d.ts.map +1 -1
  152. package/dist/types/common/window/page-visibility.d.ts +1 -1
  153. package/dist/types/common/window/page-visibility.d.ts.map +1 -1
  154. package/dist/types/common/wrap/wrap-fetch.d.ts.map +1 -1
  155. package/dist/types/common/wrap/wrap-function.d.ts.map +1 -1
  156. package/dist/types/features/ajax/aggregate/index.d.ts +2 -2
  157. package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -1
  158. package/dist/types/features/jserrors/aggregate/canonical-function-name.d.ts +8 -1
  159. package/dist/types/features/jserrors/aggregate/canonical-function-name.d.ts.map +1 -1
  160. package/dist/types/features/jserrors/aggregate/compute-stack-trace.d.ts +48 -19
  161. package/dist/types/features/jserrors/aggregate/compute-stack-trace.d.ts.map +1 -1
  162. package/dist/types/features/jserrors/aggregate/index.d.ts +14 -5
  163. package/dist/types/features/jserrors/aggregate/index.d.ts.map +1 -1
  164. package/dist/types/features/jserrors/instrument/index.d.ts.map +1 -1
  165. package/dist/types/features/metrics/aggregate/index.d.ts +2 -2
  166. package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -1
  167. package/dist/types/features/page_action/aggregate/index.d.ts +3 -3
  168. package/dist/types/features/page_action/aggregate/index.d.ts.map +1 -1
  169. package/dist/types/features/page_view_event/aggregate/index.d.ts +2 -2
  170. package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -1
  171. package/dist/types/features/page_view_timing/aggregate/index.d.ts +2 -2
  172. package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -1
  173. package/dist/types/features/session_trace/aggregate/index.d.ts +2 -2
  174. package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -1
  175. package/dist/types/features/spa/aggregate/index.d.ts +2 -2
  176. package/dist/types/features/spa/aggregate/index.d.ts.map +1 -1
  177. package/dist/types/features/utils/agent-session.d.ts +2 -0
  178. package/dist/types/features/utils/agent-session.d.ts.map +1 -0
  179. package/dist/types/features/utils/instrument-base.d.ts.map +1 -1
  180. package/dist/types/features/utils/lazy-loader.d.ts +2 -2
  181. package/dist/types/features/utils/lazy-loader.d.ts.map +1 -1
  182. package/dist/types/loaders/api/api.d.ts.map +1 -1
  183. package/dist/types/loaders/api/apiAsync.d.ts.map +1 -1
  184. package/dist/types/loaders/configure/configure.d.ts.map +1 -1
  185. package/package.json +9 -8
  186. package/src/common/config/state/configurable.js +26 -19
  187. package/src/common/config/state/init.js +7 -0
  188. package/src/common/config/state/runtime.js +22 -27
  189. package/src/common/context/shared-context.js +2 -1
  190. package/src/common/event-emitter/contextual-ee.test.js +2 -2
  191. package/src/common/event-emitter/register-handler.test.js +1 -1
  192. package/src/common/event-listener/event-listener-opts.js +4 -4
  193. package/src/common/harvest/harvest-scheduler.js +12 -8
  194. package/src/common/harvest/harvest.js +3 -1
  195. package/src/common/session/constants.js +3 -0
  196. package/src/common/session/session-entity.js +271 -0
  197. package/src/common/session/session-entity.test.js +317 -0
  198. package/src/common/storage/first-party-cookies.js +31 -0
  199. package/src/common/storage/local-memory.js +30 -0
  200. package/src/common/storage/local-memory.test.js +19 -0
  201. package/src/common/storage/local-storage.js +28 -0
  202. package/src/common/storage/local-storage.test.js +17 -0
  203. package/src/common/timer/interaction-timer.js +75 -0
  204. package/src/common/timer/interaction-timer.test.js +167 -0
  205. package/src/common/timer/timer.js +31 -0
  206. package/src/common/timer/timer.test.js +100 -0
  207. package/src/common/unload/eol.js +1 -1
  208. package/src/common/url/canonicalize-url.js +28 -0
  209. package/src/common/url/canonicalize-url.test.js +34 -0
  210. package/src/common/url/clean-url.js +10 -3
  211. package/src/common/util/data-size.js +6 -0
  212. package/src/common/util/data-size.test.js +50 -0
  213. package/src/common/util/global-scope.js +2 -0
  214. package/src/common/util/invoke.js +55 -0
  215. package/src/common/util/invoke.test.js +65 -0
  216. package/src/common/util/obfuscate.js +0 -4
  217. package/src/common/window/page-visibility.js +2 -2
  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-timer.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 +24 -50
  227. package/src/features/jserrors/instrument/index.js +0 -1
  228. package/src/features/metrics/aggregate/index.js +18 -3
  229. package/src/features/page_action/aggregate/index.js +2 -2
  230. package/src/features/page_view_event/aggregate/index.js +6 -3
  231. package/src/features/page_view_timing/aggregate/index.js +6 -6
  232. package/src/features/session_trace/aggregate/index.js +3 -4
  233. package/src/features/spa/aggregate/index.js +5 -5
  234. package/src/features/utils/agent-session.js +68 -0
  235. package/src/features/utils/feature-base.js +1 -1
  236. package/src/features/utils/instrument-base.js +5 -2
  237. package/src/features/utils/lazy-loader.js +1 -1
  238. package/src/loaders/agent.js +1 -1
  239. package/src/loaders/api/api.js +2 -5
  240. package/src/loaders/api/apiAsync.js +2 -1
  241. package/src/loaders/configure/configure.js +2 -7
  242. package/dist/cjs/common/util/single.js +0 -23
  243. package/dist/cjs/common/window/session-storage.js +0 -87
  244. package/dist/cjs/features/utils/aggregate-base.js +0 -13
  245. package/dist/esm/common/util/single.js +0 -16
  246. package/dist/esm/common/window/session-storage.js +0 -77
  247. package/dist/esm/features/utils/aggregate-base.js +0 -6
  248. package/dist/types/common/util/single.d.ts +0 -2
  249. package/dist/types/common/util/single.d.ts.map +0 -1
  250. package/dist/types/common/window/session-storage.d.ts +0 -18
  251. package/dist/types/common/window/session-storage.d.ts.map +0 -1
  252. package/dist/types/features/utils/aggregate-base.d.ts +0 -4
  253. package/dist/types/features/utils/aggregate-base.d.ts.map +0 -1
  254. package/src/common/util/single.js +0 -18
  255. package/src/common/window/session-storage.js +0 -75
  256. package/src/features/utils/aggregate-base.js +0 -7
@@ -4,7 +4,6 @@
4
4
  */
5
5
 
6
6
  import { canonicalFunctionName } from './canonical-function-name';
7
- import { cleanURL } from '../../../common/url/clean-url';
8
7
  import { computeStackTrace } from './compute-stack-trace';
9
8
  import { stringHashCode } from './string-hash-code';
10
9
  import { truncateSize } from './format-stack-trace';
@@ -16,11 +15,16 @@ import { mapOwn } from '../../../common/util/map-own';
16
15
  import { getInfo, getConfigurationValue, getRuntime } from '../../../common/config/config';
17
16
  import { now } from '../../../common/timing/now';
18
17
  import { globalScope } from '../../../common/util/global-scope';
19
- import { AggregateBase } from '../../utils/aggregate-base';
20
18
  import { FEATURE_NAME } from '../constants';
21
19
  import { drain } from '../../../common/drain/drain';
22
20
  import { FEATURE_NAMES } from '../../../loaders/features/features';
23
- export class Aggregate extends AggregateBase {
21
+ import { FeatureBase } from '../../utils/feature-base';
22
+
23
+ /**
24
+ * @typedef {import('./compute-stack-trace.js').StackInfo} StackInfo
25
+ */
26
+
27
+ export class Aggregate extends FeatureBase {
24
28
  static featureName = FEATURE_NAME;
25
29
  constructor(agentIdentifier, aggregator) {
26
30
  var _this;
@@ -103,49 +107,25 @@ export class Aggregate extends AggregateBase {
103
107
  getBucketName(params, customParams) {
104
108
  return this.nameHash(params) + ':' + stringHashCode(stringify(customParams));
105
109
  }
106
- canonicalizeURL(url, cleanedOrigin) {
107
- if (typeof url !== 'string') return '';
108
- var cleanedURL = cleanURL(url);
109
- if (cleanedURL === cleanedOrigin) {
110
- return '<inline>';
111
- } else {
112
- return cleanedURL;
113
- }
114
- }
115
- buildCanonicalStackString(stackInfo, cleanedOrigin) {
116
- var canonicalStack = '';
117
- for (var i = 0; i < stackInfo.frames.length; i++) {
118
- var frame = stackInfo.frames[i];
119
- var func = canonicalFunctionName(frame.func);
120
- if (canonicalStack) canonicalStack += '\n';
121
- if (func) canonicalStack += func + '@';
122
- if (typeof frame.url === 'string') canonicalStack += frame.url;
123
- if (frame.line) canonicalStack += ':' + frame.line;
124
- }
125
- return canonicalStack;
126
- }
127
110
 
128
- // Strip query parameters and fragments from the stackString property of the
129
- // given stackInfo, along with the 'url' properties of each frame in
130
- // stackInfo.frames.
131
- //
132
- // Any URLs that are equivalent to the cleaned version of the origin will also
133
- // be replaced with the string '<inline>'.
134
- //
135
- canonicalizeStackURLs(stackInfo) {
136
- // Currently, loader.origin might contain a fragment, but we don't want to use it
137
- // for comparing with frame URLs.
138
- var cleanedOrigin = cleanURL(getRuntime(this.agentIdentifier).origin);
111
+ /**
112
+ * Builds a standardized stack trace string from the frames in the given `stackInfo` object, with each frame separated
113
+ * by a newline character. Lines take the form `<functionName>@<url>:<lineNumber>`.
114
+ *
115
+ * @param {StackInfo} stackInfo - An object specifying a stack string and individual frames.
116
+ * @returns {string} A canonical stack string built from the URLs and function names in the given `stackInfo` object.
117
+ */
118
+ buildCanonicalStackString(stackInfo) {
119
+ var canonicalStackString = '';
139
120
  for (var i = 0; i < stackInfo.frames.length; i++) {
140
121
  var frame = stackInfo.frames[i];
141
- var originalURL = frame.url;
142
- var cleanedURL = this.canonicalizeURL(originalURL, cleanedOrigin);
143
- if (cleanedURL && cleanedURL !== frame.url) {
144
- frame.url = cleanedURL;
145
- stackInfo.stackString = stackInfo.stackString.split(originalURL).join(cleanedURL);
146
- }
122
+ var func = canonicalFunctionName(frame.func);
123
+ if (canonicalStackString) canonicalStackString += '\n';
124
+ if (func) canonicalStackString += func + '@';
125
+ if (typeof frame.url === 'string') canonicalStackString += frame.url;
126
+ if (frame.line) canonicalStackString += ':' + frame.line;
147
127
  }
148
- return stackInfo;
128
+ return canonicalStackString;
149
129
  }
150
130
  storeError(err, time, internal, customAttributes) {
151
131
  // are we in an interaction
@@ -162,10 +142,10 @@ export class Aggregate extends AggregateBase {
162
142
  // Again as with previous usage, all falsey values would include the error.
163
143
  }
164
144
 
165
- var stackInfo = this.canonicalizeStackURLs(computeStackTrace(err));
166
- var canonicalStack = this.buildCanonicalStackString(stackInfo);
145
+ var stackInfo = computeStackTrace(err);
146
+ var canonicalStackString = this.buildCanonicalStackString(stackInfo);
167
147
  const params = {
168
- stackHash: stringHashCode(canonicalStack),
148
+ stackHash: stringHashCode(canonicalStackString),
169
149
  exceptionClass: stackInfo.name,
170
150
  request_uri: globalScope?.location.pathname
171
151
  };
@@ -210,6 +190,7 @@ export class Aggregate extends AggregateBase {
210
190
 
211
191
  // still send EE events for other features such as above, but stop this one from aggregating internal data
212
192
  if (this.blocked) return;
193
+ var att = getInfo(this.agentIdentifier).jsAttributes;
213
194
  if (params._interactionId != null) {
214
195
  // hold on to the error until the interaction finishes
215
196
  this.errorCache[params._interactionId] = this.errorCache[params._interactionId] || [];
@@ -217,7 +198,6 @@ export class Aggregate extends AggregateBase {
217
198
  } else {
218
199
  // store custom attributes
219
200
  var customParams = {};
220
- var att = getInfo(this.agentIdentifier).jsAttributes;
221
201
  mapOwn(att, setCustom);
222
202
  if (customAttributes) {
223
203
  mapOwn(customAttributes, setCustom);
@@ -7,7 +7,6 @@ import { handle } from '../../../common/event-emitter/handle';
7
7
  import { now } from '../../../common/timing/now';
8
8
  import { getOrSet } from '../../../common/util/get-or-set';
9
9
  import { wrapRaf, wrapTimer, wrapEvents, wrapXhr } from '../../../common/wrap';
10
- import slice from 'lodash._slice';
11
10
  import './debug';
12
11
  import { InstrumentBase } from '../../utils/instrument-base';
13
12
  import { FEATURE_NAME, NR_ERR_PROP } from '../constants';
@@ -1,7 +1,6 @@
1
- import { getRuntime } from '../../../common/config/config';
1
+ import { getRuntime, getInfo } from '../../../common/config/config';
2
2
  import { registerHandler } from '../../../common/event-emitter/register-handler';
3
3
  import { HarvestScheduler } from '../../../common/harvest/harvest-scheduler';
4
- import { AggregateBase } from '../../utils/aggregate-base';
5
4
  import { FEATURE_NAME, SUPPORTABILITY_METRIC, CUSTOM_METRIC, SUPPORTABILITY_METRIC_CHANNEL, CUSTOM_METRIC_CHANNEL } from '../constants';
6
5
  import { drain } from '../../../common/drain/drain';
7
6
  import { getFrameworks } from '../../../common/metrics/framework-detection';
@@ -11,7 +10,9 @@ import { VERSION } from "../../../common/constants/env.npm";
11
10
  import { onDOMContentLoaded } from '../../../common/window/load';
12
11
  import { windowAddEventListener } from '../../../common/event-listener/event-listener-opts';
13
12
  import { isBrowserScope } from '../../../common/util/global-scope';
14
- export class Aggregate extends AggregateBase {
13
+ import { FeatureBase } from '../../utils/feature-base';
14
+ import { stringify } from '../../../common/util/stringify';
15
+ export class Aggregate extends FeatureBase {
15
16
  static featureName = FEATURE_NAME;
16
17
  constructor(agentIdentifier, aggregator) {
17
18
  super(agentIdentifier, aggregator, FEATURE_NAME);
@@ -103,6 +104,7 @@ export class Aggregate extends AggregateBase {
103
104
  try {
104
105
  if (this.resourcesSent) return;
105
106
  const agentRuntime = getRuntime(this.agentIdentifier);
107
+ const info = getInfo(this.agentIdentifier);
106
108
  // make sure this only gets sent once
107
109
  this.resourcesSent = true;
108
110
  // differentiate between internal+external and ajax+non-ajax
@@ -128,10 +130,19 @@ export class Aggregate extends AggregateBase {
128
130
  this.storeSupportabilityMetrics("PageSession/Endpoint/".concat(endpoint.charAt(0).toUpperCase() + endpoint.slice(1), "/BytesSent"), agentRuntime.bytesSent[endpoint]);
129
131
  });
130
132
 
133
+ // Capture per-agent query bytes sent for each endpoint (see harvest) and RUM call (see page_view_event aggregator).
134
+ Object.keys(agentRuntime.bytesSent).forEach(endpoint => {
135
+ this.storeSupportabilityMetrics("PageSession/Endpoint/".concat(endpoint.charAt(0).toUpperCase() + endpoint.slice(1), "/QueryBytesSent"), agentRuntime.queryBytesSent[endpoint]);
136
+ });
137
+
131
138
  // Capture metrics for session trace if active (`ptid` is set when returned by replay ingest).
132
139
  if (agentRuntime.ptid) {
133
140
  this.storeSupportabilityMetrics('PageSession/Feature/SessionTrace/DurationMs', Math.round(performance.now()));
134
141
  }
142
+
143
+ // Capture metrics for size of custom attributes
144
+ const jsAttributes = stringify(info.jsAttributes);
145
+ this.storeSupportabilityMetrics('PageSession/Feature/CustomData/Bytes', jsAttributes === '{}' ? 0 : jsAttributes.length);
135
146
  } catch (e) {
136
147
  // do nothing
137
148
  }
@@ -9,11 +9,11 @@ import { registerHandler as register } from '../../../common/event-emitter/regis
9
9
  import { HarvestScheduler } from '../../../common/harvest/harvest-scheduler';
10
10
  import { cleanURL } from '../../../common/url/clean-url';
11
11
  import { getConfigurationValue, getInfo, getRuntime } from '../../../common/config/config';
12
- import { AggregateBase } from '../../utils/aggregate-base';
13
12
  import { FEATURE_NAME } from '../constants';
14
13
  import { drain } from '../../../common/drain/drain';
15
14
  import { isBrowserScope } from '../../../common/util/global-scope';
16
- export class Aggregate extends AggregateBase {
15
+ import { FeatureBase } from '../../utils/feature-base';
16
+ export class Aggregate extends FeatureBase {
17
17
  static featureName = FEATURE_NAME;
18
18
  constructor(agentIdentifier, aggregator) {
19
19
  var _this;
@@ -10,13 +10,13 @@ import { paintMetrics } from '../../../common/metrics/paint-metrics';
10
10
  import { submitData } from '../../../common/util/submit-data';
11
11
  import { getConfigurationValue, getInfo, getRuntime } from '../../../common/config/config';
12
12
  import { HarvestScheduler } from '../../../common/harvest/harvest-scheduler';
13
- import { AggregateBase } from '../../utils/aggregate-base';
14
13
  import * as CONSTANTS from '../constants';
15
14
  import { getActivatedFeaturesFlags } from './initialized-features';
16
15
  import { globalScope, isBrowserScope } from '../../../common/util/global-scope';
17
16
  import { drain } from '../../../common/drain/drain';
17
+ import { FeatureBase } from '../../utils/feature-base';
18
18
  const jsonp = 'NREUM.setToken';
19
- export class Aggregate extends AggregateBase {
19
+ export class Aggregate extends FeatureBase {
20
20
  static featureName = CONSTANTS.FEATURE_NAME;
21
21
  constructor(agentIdentifier, aggregator) {
22
22
  super(agentIdentifier, aggregator, CONSTANTS.FEATURE_NAME);
@@ -130,7 +130,10 @@ export class Aggregate extends AggregateBase {
130
130
  var queryString = fromArray(chunksForQueryString, agentRuntime.maxBytes);
131
131
 
132
132
  // Capture bytes sent to RUM call endpoint (currently `1`) as a supportability metric. See metrics aggregator (on unload).
133
- agentRuntime.bytesSent[protocol] = (agentRuntime.bytesSent[protocol] || 0) + queryString?.length || 0;
133
+ agentRuntime.bytesSent[protocol] = 0; // Set to zero for now until RUM is moved to POST
134
+
135
+ // Capture query bytes sent to RUM call endpoint (currently `1`) as a supportability metric. See metrics aggregator (on unload).
136
+ agentRuntime.queryBytesSent[protocol] = (agentRuntime.queryBytesSent[protocol] || 0) + queryString?.length || 0;
134
137
  const isValidJsonp = submitData.jsonp(this.getScheme() + '://' + info.beacon + '/' + protocol + '/' + info.licenseKey + queryString, jsonp);
135
138
  // Usually `drain` is invoked automatically after processing feature flags contained in the JSONP callback from
136
139
  // ingest (see `activateFeatures`), so when JSONP cannot execute (as with module workers), we drain manually.
@@ -14,11 +14,11 @@ import { registerHandler } from '../../../common/event-emitter/register-handler'
14
14
  import { cleanURL } from '../../../common/url/clean-url';
15
15
  import { handle } from '../../../common/event-emitter/handle';
16
16
  import { getInfo, getConfigurationValue, getRuntime } from '../../../common/config/config';
17
- import { AggregateBase } from '../../utils/aggregate-base';
18
17
  import { FEATURE_NAME } from '../constants';
19
18
  import { drain } from '../../../common/drain/drain';
20
19
  import { FEATURE_NAMES } from '../../../loaders/features/features';
21
- export class Aggregate extends AggregateBase {
20
+ import { FeatureBase } from '../../utils/feature-base';
21
+ export class Aggregate extends FeatureBase {
22
22
  static featureName = FEATURE_NAME;
23
23
  constructor(agentIdentifier, aggregator) {
24
24
  var _this;
@@ -29,7 +29,7 @@ export class Aggregate extends AggregateBase {
29
29
  this.curSessEndRecorded = false;
30
30
  this.cls = null; // this should be null unless set to a numeric value by web-vitals so that we differentiate if CLS is supported
31
31
 
32
- /*! This is the section that used to be in the loader portion: !*/
32
+ /* ! This is the section that used to be in the loader portion: ! */
33
33
  /* ------------------------------------------------------------ */
34
34
  const pageStartedHidden = getRuntime(agentIdentifier).initHidden; // our attempt at recapturing initial vis state since this code runs post-load time
35
35
  this.alreadySent = new Set(); // since we don't support timings on BFCache restores, this tracks and helps cap metrics that web-vitals report more than once
@@ -105,10 +105,10 @@ export class Aggregate extends AggregateBase {
105
105
  attributes.size = lcpEntry.size;
106
106
  attributes.eid = lcpEntry.id;
107
107
  if (lcpEntry.url) {
108
- attributes['elUrl'] = cleanURL(lcpEntry.url);
108
+ attributes.elUrl = cleanURL(lcpEntry.url);
109
109
  }
110
110
  if (lcpEntry.element?.tagName) {
111
- attributes['elTag'] = lcpEntry.element.tagName;
111
+ attributes.elTag = lcpEntry.element.tagName;
112
112
  }
113
113
  }
114
114
  this.addConnectionAttributes(attributes);
@@ -221,7 +221,7 @@ export class Aggregate extends AggregateBase {
221
221
  Future: onCLS value changes should be reported directly & CLS separated into its own timing node so it's not beholden to 'pageHide' firing. It'd also be possible to report the real final CLS.
222
222
  */
223
223
  if (this.cls !== null) {
224
- attrs['cls'] = this.cls;
224
+ attrs.cls = this.cls;
225
225
  }
226
226
  this.timings.push({
227
227
  name: name,
@@ -8,14 +8,13 @@ import { mapOwn } from '../../../common/util/map-own';
8
8
  import { stringify } from '../../../common/util/stringify';
9
9
  import { parseUrl } from '../../../common/url/parse-url';
10
10
  import { supportsPerformanceObserver } from '../../../common/window/supports-performance-observer';
11
- import slice from 'lodash._slice';
12
11
  import { getConfigurationValue, getInfo, getRuntime } from '../../../common/config/config';
13
12
  import { now } from '../../../common/timing/now';
14
- import { AggregateBase } from '../../utils/aggregate-base';
15
13
  import { FEATURE_NAME } from '../constants';
16
14
  import { drain } from '../../../common/drain/drain';
17
15
  import { HandlerCache } from '../../utils/handler-cache';
18
- export class Aggregate extends AggregateBase {
16
+ import { FeatureBase } from '../../utils/feature-base';
17
+ export class Aggregate extends FeatureBase {
19
18
  static featureName = FEATURE_NAME;
20
19
  constructor(agentIdentifier, aggregator) {
21
20
  var _this;
@@ -252,7 +251,7 @@ export class Aggregate extends AggregateBase {
252
251
  } else if (t && typeof t.tagName === 'string') {
253
252
  origin = t.tagName.toLowerCase();
254
253
  if (t.id) origin += '#' + t.id;
255
- if (t.className) origin += '.' + slice(t.classList).join('.');
254
+ if (t.className) origin += '.' + Array.from(t.classList).join('.');
256
255
  }
257
256
  if (origin === 'unknown') {
258
257
  if (typeof target === 'string') origin = target;else if (target === document) origin = 'document';else if (target === window) origin = 'window';else if (target instanceof FileReader) origin = 'FileReader';
@@ -2,7 +2,7 @@
2
2
  * Copyright 2020 New Relic Corporation. All rights reserved.
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
- /*eslint no-undef: "error"*/
5
+ /* eslint no-undef: "error" */
6
6
  import { registerHandler as register } from '../../../common/event-emitter/register-handler';
7
7
  import { parseUrl } from '../../../common/url/parse-url';
8
8
  import { shouldCollectEvent } from '../../../common/deny-list/deny-list';
@@ -13,13 +13,13 @@ import { paintMetrics } from '../../../common/metrics/paint-metrics';
13
13
  import { Interaction } from './interaction';
14
14
  import { getConfigurationValue, getRuntime } from '../../../common/config/config';
15
15
  import { eventListenerOpts } from '../../../common/event-listener/event-listener-opts';
16
- import { AggregateBase } from '../../utils/aggregate-base';
17
16
  import { HarvestScheduler } from '../../../common/harvest/harvest-scheduler';
18
17
  import { Serializer } from './serializer';
19
18
  import { ee } from '../../../common/event-emitter/contextual-ee';
20
19
  import * as CONSTANTS from '../constants';
21
20
  import { drain } from '../../../common/drain/drain';
22
21
  import { FEATURE_NAMES } from '../../../loaders/features/features';
22
+ import { FeatureBase } from '../../utils/feature-base';
23
23
  const {
24
24
  FEATURE_NAME,
25
25
  INTERACTION_EVENTS,
@@ -38,7 +38,7 @@ const {
38
38
  JSONP_END,
39
39
  originalSetTimeout
40
40
  } = CONSTANTS;
41
- export class Aggregate extends AggregateBase {
41
+ export class Aggregate extends FeatureBase {
42
42
  static featureName = FEATURE_NAME;
43
43
  constructor(agentIdentifier, aggregator) {
44
44
  super(agentIdentifier, aggregator, FEATURE_NAME);
@@ -81,7 +81,8 @@ export class Aggregate extends AggregateBase {
81
81
  onFinished: onHarvestFinished,
82
82
  retryDelay: state.harvestTimeSeconds
83
83
  }, {
84
- agentIdentifier
84
+ agentIdentifier,
85
+ ee: baseEE
85
86
  });
86
87
  scheduler.harvest.on('events', onHarvestStarted);
87
88
 
@@ -213,7 +214,7 @@ export class Aggregate extends AggregateBase {
213
214
  if (evName === 'click') {
214
215
  var value = getActionText(ev.target);
215
216
  if (value) {
216
- state.currentNode.attrs.custom['actionText'] = value;
217
+ state.currentNode.attrs.custom.actionText = value;
217
218
  }
218
219
  }
219
220
  }
@@ -0,0 +1,67 @@
1
+ import { getConfigurationValue, getInfo, getRuntime, setInfo } from '../../common/config/config';
2
+ import { drain } from '../../common/drain/drain';
3
+ import { ee } from '../../common/event-emitter/contextual-ee';
4
+ import { registerHandler } from '../../common/event-emitter/register-handler';
5
+ import { isBrowserScope } from '../../common/util/global-scope';
6
+ import { SessionEntity } from '../../common/session/session-entity';
7
+ import { LocalStorage } from '../../common/storage/local-storage.js';
8
+ import { FirstPartyCookies } from '../../common/storage/first-party-cookies';
9
+ import { LocalMemory } from '../../common/storage/local-memory';
10
+ let ranOnce = 0;
11
+ export function setupAgentSession(agentIdentifier) {
12
+ const agentRuntime = getRuntime(agentIdentifier);
13
+ if (ranOnce++) return agentRuntime.session;
14
+ const sharedEE = ee.get(agentIdentifier);
15
+
16
+ // domain is a string that can be specified by customer.
17
+ // only way to keep the session object across subdomains is using first party cookies
18
+ // This determines which storage wrapper the session manager will use to keep state
19
+ let storageAPI;
20
+ const cookiesEnabled = getConfigurationValue(agentIdentifier, 'privacy.cookies_enabled') === true;
21
+ if (cookiesEnabled && isBrowserScope) {
22
+ storageAPI = getConfigurationValue(agentIdentifier, 'session.domain') ? new FirstPartyCookies(getConfigurationValue(agentIdentifier, 'session.domain')) : new LocalStorage();
23
+ }
24
+ if (cookiesEnabled) {
25
+ // defaults to "LocalMemory" if storageAPI is undefined, such as in Worker build
26
+ agentRuntime.session = new SessionEntity({
27
+ agentIdentifier,
28
+ key: 'SESSION',
29
+ storageAPI,
30
+ expiresMs: getConfigurationValue(agentIdentifier, 'session.expiresMs'),
31
+ inactiveMs: getConfigurationValue(agentIdentifier, 'session.inactiveMs')
32
+ });
33
+ }
34
+
35
+ // The first time the agent runs on a page, it should put everything
36
+ // that's currently stored in the storage API into the local info.jsAttributes object
37
+ if (isBrowserScope) {
38
+ // retrieve & re-add all of the persisted setCustomAttribute|setUserId k-v from previous page load(s)
39
+ const customSessionData = agentRuntime.session?.read?.()?.custom;
40
+ const agentInfo = getInfo(agentIdentifier);
41
+ if (customSessionData) {
42
+ setInfo(agentIdentifier, {
43
+ ...agentInfo,
44
+ jsAttributes: {
45
+ ...agentInfo.jsAttributes,
46
+ ...customSessionData
47
+ }
48
+ });
49
+ }
50
+ }
51
+
52
+ // any calls to newrelic.setCustomAttribute(<persisted>) will need to be added to:
53
+ // local info.jsAttributes {}
54
+ // the session's storage API
55
+ registerHandler('api-setCustomAttribute', (time, key, value) => {
56
+ agentRuntime.session.syncCustomAttribute(key, value);
57
+ }, 'session', sharedEE);
58
+
59
+ // any calls to newrelic.setUserId(...) will need to be added to:
60
+ // local info.jsAttributes {}
61
+ // the session's storage API
62
+ registerHandler('api-setUserId', (time, key, value) => {
63
+ agentRuntime.session.syncCustomAttribute(key, value);
64
+ }, 'session', sharedEE);
65
+ drain(agentIdentifier, 'session');
66
+ return agentRuntime.session;
67
+ }
@@ -26,7 +26,7 @@ export class FeatureBase {
26
26
  * loader configurations may appear after the loader code is executed.
27
27
  */
28
28
  checkConfiguration() {
29
- // NOTE: This check has to happen at aggregator load time, but could be moved to `AggregateBase`.
29
+ // NOTE: This check has to happen at aggregator load time
30
30
  if (!isConfigured(this.agentIdentifier)) {
31
31
  let jsAttributes = {
32
32
  ...gosCDN().info?.jsAttributes
@@ -48,6 +48,12 @@ export class InstrumentBase extends FeatureBase {
48
48
  * it's only responsible for aborting its one specific feature, rather than all.
49
49
  */
50
50
  try {
51
+ // The session entity needs to be attached to the config internals before the aggregator chunk runs
52
+ const {
53
+ setupAgentSession
54
+ } = await import( /* webpackChunkName: "session-manager" */'./agent-session');
55
+ setupAgentSession(this.agentIdentifier);
56
+ // import and instantiate the aggregator chunk
51
57
  const {
52
58
  lazyLoader
53
59
  } = await import( /* webpackChunkName: "lazy-loader" */'./lazy-loader');
@@ -56,9 +62,8 @@ export class InstrumentBase extends FeatureBase {
56
62
  } = await lazyLoader(this.featureName, 'aggregate');
57
63
  new Aggregate(this.agentIdentifier, this.aggregator);
58
64
  } catch (e) {
59
- warn("Downloading ".concat(this.featureName, " failed..."));
65
+ warn("Downloading ".concat(this.featureName, " failed..."), e);
60
66
  this.abortHandler?.(); // undo any important alterations made to the page
61
-
62
67
  // not supported yet but nice to do: "abort" this agent's EE for this feature specifically
63
68
  }
64
69
  };
@@ -9,7 +9,7 @@ import { FEATURE_NAMES } from '../../loaders/features/features';
9
9
  * should be.
10
10
  * @param featureName Name of the feature to import such as ajax or session_trace
11
11
  * @param featurePart Name of the feature part to load; should be either instrument or aggregate
12
- * @returns {Promise<InstrumentBase|AggregateBase|null>}
12
+ * @returns {Promise<InstrumentBase|FeatureBase|null>}
13
13
  */
14
14
  export function lazyLoader(featureName, featurePart) {
15
15
  if (featurePart === 'aggregate') {
@@ -66,7 +66,7 @@ export class Agent {
66
66
  this.features[featName].abortHandler?.();
67
67
  }
68
68
  const newrelic = gosNREUM();
69
- delete newrelic.initializedAgents[this.agentIdentifier]?.['api']; // prevent further calls to agent-specific APIs (see "configure.js")
69
+ delete newrelic.initializedAgents[this.agentIdentifier]?.api; // prevent further calls to agent-specific APIs (see "configure.js")
70
70
  delete newrelic.initializedAgents[this.agentIdentifier]?.[NR_FEATURES_REF_NAME]; // GC mem used internally by features
71
71
  delete this.sharedAggregator;
72
72
  // Keep the initialized agent object with its configs for troubleshooting purposes.
@@ -9,11 +9,10 @@ import { ee } from '../../common/event-emitter/contextual-ee';
9
9
  import { now } from '../../common/timing/now';
10
10
  import { drain, registerDrain } from '../../common/drain/drain';
11
11
  import { onWindowLoad } from '../../common/window/load';
12
- import { isBrowserScope, isWorkerScope } from '../../common/util/global-scope';
12
+ import { isWorkerScope } from '../../common/util/global-scope';
13
13
  import { warn } from '../../common/util/console';
14
14
  import { SUPPORTABILITY_METRIC_CHANNEL } from '../../features/metrics/constants';
15
15
  import { gosCDN } from '../../common/window/nreum';
16
- import { putInBrowserStorage, removeFromBrowserStorage } from '../../common/window/session-storage';
17
16
  export const CUSTOM_ATTR_GROUP = 'CUSTOM/'; // the subgroup items should be stored under in storage API
18
17
 
19
18
  export function setTopLevelCallers() {
@@ -72,7 +71,6 @@ export function setAPI(agentIdentifier, forceDrain) {
72
71
  const currentInfo = getInfo(agentIdentifier);
73
72
  if (value === null) {
74
73
  delete currentInfo.jsAttributes[key];
75
- if (isBrowserScope) removeFromBrowserStorage(key, CUSTOM_ATTR_GROUP); // addToBrowserStorage flag isn't needed to unset keys from storage
76
74
  } else {
77
75
  setInfo(agentIdentifier, {
78
76
  ...currentInfo,
@@ -81,9 +79,8 @@ export function setAPI(agentIdentifier, forceDrain) {
81
79
  [key]: value
82
80
  }
83
81
  });
84
- if (isBrowserScope && addToBrowserStorage) putInBrowserStorage(key, value, CUSTOM_ATTR_GROUP);
85
82
  }
86
- return apiCall(prefix, apiName, true)();
83
+ return apiCall(prefix, apiName, true, !!addToBrowserStorage || value === null ? 'session' : undefined)(key, value);
87
84
  }
88
85
  apiInterface.setCustomAttribute = function (name, value) {
89
86
  let persistAttribute = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
@@ -3,7 +3,7 @@ import { getConfigurationValue, getInfo, getRuntime } from '../../common/config/
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';
6
- import { single } from '../../common/util/single';
6
+ import { single } from '../../common/util/invoke';
7
7
  import { submitData } from '../../common/util/submit-data';
8
8
  import { isBrowserScope } from '../../common/util/global-scope';
9
9
  import { CUSTOM_METRIC_CHANNEL } from '../../features/metrics/constants';
@@ -65,6 +65,7 @@ export function setAPI(agentIdentifier) {
65
65
  request_name = window.encodeURIComponent(request_name);
66
66
  cycle += 1;
67
67
  const agentInfo = getInfo(agentIdentifier);
68
+ const agentRuntime = getRuntime(agentIdentifier);
68
69
  if (!agentInfo.beacon) return;
69
70
  var url = scheme + '://' + agentInfo.beacon + '/1/' + agentInfo.licenseKey;
70
71
  url += '?a=' + agentInfo.applicationID + '&';
@@ -1,9 +1,8 @@
1
- import { setAPI, setTopLevelCallers, CUSTOM_ATTR_GROUP } from '../api/api';
1
+ import { setAPI, setTopLevelCallers } from '../api/api';
2
2
  import { addToNREUM, gosCDN, gosNREUMInitializedAgents } from '../../common/window/nreum';
3
3
  import { setConfiguration, setInfo, setLoaderConfig, setRuntime } from '../../common/config/config';
4
4
  import { activateFeatures, activatedFeatures } from '../../common/util/feature-flags';
5
- import { isBrowserScope, isWorkerScope } from '../../common/util/global-scope';
6
- import { getAllStorageItemsOfGroup } from '../../common/window/session-storage';
5
+ import { isWorkerScope } from '../../common/util/global-scope';
7
6
  export function configure(agentIdentifier) {
8
7
  let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
9
8
  let loaderType = arguments.length > 2 ? arguments[2] : undefined;
@@ -28,11 +27,6 @@ export function configure(agentIdentifier) {
28
27
  // add a default attr to all worker payloads
29
28
  info.jsAttributes.isWorker = true;
30
29
  }
31
- if (isBrowserScope) {
32
- // retrieve & re-add all of the persisted setCustomAttribute|setUserId k-v from previous page load(s)
33
- let prevPageSessionJsAttrs = getAllStorageItemsOfGroup(CUSTOM_ATTR_GROUP);
34
- Object.assign(info.jsAttributes, prevPageSessionJsAttrs);
35
- }
36
30
  setInfo(agentIdentifier, info);
37
31
  setConfiguration(agentIdentifier, init || {});
38
32
  setLoaderConfig(agentIdentifier, loader_config || {});
@@ -1 +1 @@
1
- {"version":3,"file":"configurable.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/configurable.js"],"names":[],"mappings":"AAGA;IACE,kCAoBC;CACF"}
1
+ {"version":3,"file":"configurable.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/configurable.js"],"names":[],"mappings":"AAGA;IACE,kCAEC;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/init.js"],"names":[],"mappings":"AA4BA,+CAIC;AAED,0DAIC;AAED,+DAYC"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/init.js"],"names":[],"mappings":"AAmCA,+CAIC;AAED,0DAIC;AAED,+DAYC"}
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/runtime.js"],"names":[],"mappings":"AAoCA,yCAIC;AAED,oDAIC"}
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/runtime.js"],"names":[],"mappings":"AA+BA,yCAIC;AAED,oDAIC"}
@@ -1 +1 @@
1
- {"version":3,"file":"shared-context.d.ts","sourceRoot":"","sources":["../../../../src/common/context/shared-context.js"],"names":[],"mappings":"AAOA;IACE,0BAWC;IARG,8BAAuB;CAS5B"}
1
+ {"version":3,"file":"shared-context.d.ts","sourceRoot":"","sources":["../../../../src/common/context/shared-context.js"],"names":[],"mappings":"AAQA;IACE,0BAWC;IARG,8BAAuB;CAS5B"}
@@ -4,7 +4,7 @@ export function eventListenerOpts(useCapture: any, abortSignal: any): boolean |
4
4
  signal: any;
5
5
  };
6
6
  /** Do not use this within the worker context. */
7
- export function windowAddEventListener(event: any, listener: any, capture?: boolean): void;
7
+ export function windowAddEventListener(event: any, listener: any, capture: boolean | undefined, abortSignal: any): void;
8
8
  /** Do not use this within the worker context. */
9
- export function documentAddEventListener(event: any, listener: any, capture?: boolean): void;
9
+ export function documentAddEventListener(event: any, listener: any, capture: boolean | undefined, abortSignal: any): void;
10
10
  //# sourceMappingURL=event-listener-opts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"event-listener-opts.d.ts","sourceRoot":"","sources":["../../../../src/common/event-listener/event-listener-opts.js"],"names":[],"mappings":"AAuBA;;;;EAQC;AAED,iDAAiD;AACjD,2FAEC;AACD,iDAAiD;AACjD,6FAEC"}
1
+ {"version":3,"file":"event-listener-opts.d.ts","sourceRoot":"","sources":["../../../../src/common/event-listener/event-listener-opts.js"],"names":[],"mappings":"AAuBA;;;;EAQC;AAED,iDAAiD;AACjD,wHAEC;AACD,iDAAiD;AACjD,0HAEC"}
@@ -9,6 +9,7 @@ export class HarvestScheduler extends SharedContext {
9
9
  timeoutHandle: NodeJS.Timeout | null;
10
10
  aborted: boolean;
11
11
  harvest: Harvest;
12
+ unload(): void;
12
13
  startTimer(interval: any, initialDelay: any): void;
13
14
  interval: any;
14
15
  stopTimer(permanently?: boolean): void;
@@ -1 +1 @@
1
- {"version":3,"file":"harvest-scheduler.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest-scheduler.js"],"names":[],"mappings":"AAWA;;GAEG;AACH;IACE,mDAiBC;IAfC,cAAwB;IACxB,UAAsB;IACtB,iBAAoB;IACpB,qCAAyB;IACzB,iBAAoB;IAEpB,iBAA8C;IAWhD,mDAIC;IAHC,cAAwB;IAK1B,uCAMC;IAED,6CAWC;IAED,yCA8BC;IAED,gDAiBC;CACF;8BAzG6B,2BAA2B;wBAChB,WAAW"}
1
+ {"version":3,"file":"harvest-scheduler.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest-scheduler.js"],"names":[],"mappings":"AAWA;;GAEG;AACH;IACE,mDAeC;IAbC,cAAwB;IACxB,UAAsB;IACtB,iBAAoB;IACpB,qCAAyB;IACzB,iBAAoB;IAEpB,iBAA8C;IAShD,eAKC;IAED,mDAIC;IAHC,cAAwB;IAK1B,uCAMC;IAED,6CAWC;IAED,yCA6BC;IAED,gDAiBC;CACF;8BA7G6B,2BAA2B;wBAChB,WAAW"}
@@ -1 +1 @@
1
- {"version":3,"file":"harvest.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest.js"],"names":[],"mappings":"AA2MA;;;EAsBC;AA3MD;IAII,0BAA2H;IAC3H,uBAAoD;IACpD,kCAAsH;IAEtH,YAAiB;IAGnB;;;;;;;;;OASG;IACH,gBANW,MAAM;QAGK,YAAY;QACZ,MAAM;6BAS3B;IAED;;;;;;;;;;;;;;KAcC;IACD,eAZS,MAAM;QAIgB,EAAE,EAAxB,MAAM;QACgB,IAAI,EAA1B,MAAM;;QAIK,YAAY;QACZ,MAAM;gDAYzB;IAED,kGAGC;IAED,uFAmEC;IAGD,0BAmBC;IAED;;;MAYC;IAED,mCAGC;IAED,uBAIC;CACF;8BAvL6B,2BAA2B;2BAF9B,mBAAmB"}
1
+ {"version":3,"file":"harvest.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest.js"],"names":[],"mappings":"AA6MA;;;EAsBC;AA7MD;IAII,0BAA2H;IAC3H,uBAAoD;IACpD,kCAAsH;IAEtH,YAAiB;IAGnB;;;;;;;;;OASG;IACH,gBANW,MAAM;QAGK,YAAY;QACZ,MAAM;6BAS3B;IAED;;;;;;;;;;;;;;KAcC;IACD,eAZS,MAAM;QAIgB,EAAE,EAAxB,MAAM;QACgB,IAAI,EAA1B,MAAM;;QAIK,YAAY;QACZ,MAAM;gDAYzB;IAED,kGAGC;IAED,uFAqEC;IAGD,0BAmBC;IAED;;;MAYC;IAED,mCAGC;IAED,uBAIC;CACF;8BAzL6B,2BAA2B;2BAF9B,mBAAmB"}
@@ -0,0 +1,4 @@
1
+ export const PREFIX: "NRBA";
2
+ export const DEFAULT_EXPIRES_MS: 14400000;
3
+ export const DEFAULT_INACTIVE_MS: 1800000;
4
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/common/session/constants.js"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,0CAA0C;AAC1C,0CAA0C"}