@newrelic/browser-agent 1.250.0 → 1.251.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 (104) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/cjs/common/config/state/init.js +0 -2
  3. package/dist/cjs/common/config/state/originals.js +1 -2
  4. package/dist/cjs/common/constants/env.cdn.js +4 -8
  5. package/dist/cjs/common/constants/env.js +4 -8
  6. package/dist/cjs/common/constants/env.npm.js +4 -8
  7. package/dist/cjs/common/constants/runtime.js +13 -24
  8. package/dist/cjs/common/constants/shared-channel.js +2 -3
  9. package/dist/cjs/common/event-emitter/contextual-ee.js +2 -4
  10. package/dist/cjs/common/event-emitter/handle.js +1 -2
  11. package/dist/cjs/common/harvest/harvest-scheduler.js +4 -3
  12. package/dist/cjs/common/harvest/harvest.js +2 -2
  13. package/dist/cjs/common/harvest/types.js +1 -2
  14. package/dist/cjs/common/ids/bundle-id.js +1 -2
  15. package/dist/cjs/common/session/constants.js +7 -13
  16. package/dist/cjs/common/timer/interaction-timer.js +0 -1
  17. package/dist/cjs/common/timing/nav-timing.js +1 -2
  18. package/dist/cjs/common/util/feature-flags.js +1 -2
  19. package/dist/cjs/common/vitals/constants.js +2 -3
  20. package/dist/cjs/common/vitals/cumulative-layout-shift.js +1 -2
  21. package/dist/cjs/common/vitals/first-contentful-paint.js +1 -2
  22. package/dist/cjs/common/vitals/first-input-delay.js +1 -2
  23. package/dist/cjs/common/vitals/first-paint.js +1 -2
  24. package/dist/cjs/common/vitals/interaction-to-next-paint.js +1 -2
  25. package/dist/cjs/common/vitals/largest-contentful-paint.js +1 -2
  26. package/dist/cjs/common/vitals/long-task.js +1 -3
  27. package/dist/cjs/common/vitals/time-to-first-byte.js +1 -2
  28. package/dist/cjs/common/window/nreum.js +1 -2
  29. package/dist/cjs/common/wrap/wrap-function.js +2 -4
  30. package/dist/cjs/features/ajax/aggregate/index.js +0 -2
  31. package/dist/cjs/features/ajax/constants.js +1 -2
  32. package/dist/cjs/features/jserrors/aggregate/index.js +0 -1
  33. package/dist/cjs/features/jserrors/aggregate/string-hash-code.js +0 -1
  34. package/dist/cjs/features/jserrors/constants.js +1 -2
  35. package/dist/cjs/features/metrics/aggregate/index.js +1 -1
  36. package/dist/cjs/features/metrics/constants.js +5 -10
  37. package/dist/cjs/features/page_action/constants.js +1 -2
  38. package/dist/cjs/features/page_view_event/aggregate/index.js +2 -2
  39. package/dist/cjs/features/page_view_event/constants.js +1 -2
  40. package/dist/cjs/features/page_view_event/instrument/index.js +2 -2
  41. package/dist/cjs/features/page_view_timing/constants.js +1 -2
  42. package/dist/cjs/features/session_replay/aggregate/index.js +40 -27
  43. package/dist/cjs/features/session_replay/constants.js +8 -16
  44. package/dist/cjs/features/session_replay/instrument/index.js +11 -11
  45. package/dist/cjs/features/session_replay/shared/recorder-events.js +2 -0
  46. package/dist/cjs/features/session_replay/shared/recorder.js +51 -5
  47. package/dist/cjs/features/session_replay/shared/stylesheet-evaluator.js +99 -0
  48. package/dist/cjs/features/session_trace/aggregate/index.js +0 -2
  49. package/dist/cjs/features/session_trace/constants.js +8 -16
  50. package/dist/cjs/features/session_trace/instrument/index.js +2 -2
  51. package/dist/cjs/features/spa/aggregate/index.js +2 -2
  52. package/dist/cjs/features/spa/aggregate/interaction-node.js +0 -1
  53. package/dist/cjs/features/spa/constants.js +22 -44
  54. package/dist/cjs/features/spa/instrument/index.js +2 -2
  55. package/dist/cjs/features/utils/instrument-base.js +6 -7
  56. package/dist/cjs/features/utils/lazy-feature-loader.js +2 -2
  57. package/dist/cjs/loaders/agent-base.js +61 -15
  58. package/dist/cjs/loaders/agent.js +0 -38
  59. package/dist/cjs/loaders/api/api.js +7 -7
  60. package/dist/cjs/loaders/api/interaction-types.js +1 -2
  61. package/dist/cjs/loaders/features/features.js +3 -5
  62. package/dist/cjs/loaders/micro-agent.js +2 -2
  63. package/dist/esm/common/config/state/init.js +0 -2
  64. package/dist/esm/common/constants/env.cdn.js +1 -1
  65. package/dist/esm/common/constants/env.npm.js +1 -1
  66. package/dist/esm/common/harvest/harvest-scheduler.js +2 -1
  67. package/dist/esm/common/timer/interaction-timer.js +0 -1
  68. package/dist/esm/common/vitals/long-task.js +0 -1
  69. package/dist/esm/features/ajax/aggregate/index.js +0 -2
  70. package/dist/esm/features/jserrors/aggregate/index.js +0 -1
  71. package/dist/esm/features/jserrors/aggregate/string-hash-code.js +0 -1
  72. package/dist/esm/features/metrics/aggregate/index.js +1 -1
  73. package/dist/esm/features/session_replay/aggregate/index.js +29 -16
  74. package/dist/esm/features/session_replay/shared/recorder-events.js +2 -0
  75. package/dist/esm/features/session_replay/shared/recorder.js +51 -5
  76. package/dist/esm/features/session_replay/shared/stylesheet-evaluator.js +93 -0
  77. package/dist/esm/features/session_trace/aggregate/index.js +0 -2
  78. package/dist/esm/features/spa/aggregate/interaction-node.js +0 -1
  79. package/dist/esm/features/utils/instrument-base.js +0 -1
  80. package/dist/esm/loaders/agent-base.js +62 -15
  81. package/dist/esm/loaders/agent.js +0 -38
  82. package/dist/types/features/session_replay/aggregate/index.d.ts +8 -3
  83. package/dist/types/features/session_replay/aggregate/index.d.ts.map +1 -1
  84. package/dist/types/features/session_replay/shared/recorder-events.d.ts +2 -0
  85. package/dist/types/features/session_replay/shared/recorder-events.d.ts.map +1 -1
  86. package/dist/types/features/session_replay/shared/recorder.d.ts +14 -1
  87. package/dist/types/features/session_replay/shared/recorder.d.ts.map +1 -1
  88. package/dist/types/features/session_replay/shared/stylesheet-evaluator.d.ts +22 -0
  89. package/dist/types/features/session_replay/shared/stylesheet-evaluator.d.ts.map +1 -0
  90. package/dist/types/loaders/agent-base.d.ts +48 -12
  91. package/dist/types/loaders/agent-base.d.ts.map +1 -1
  92. package/dist/types/loaders/agent.d.ts +0 -33
  93. package/dist/types/loaders/agent.d.ts.map +1 -1
  94. package/package.json +49 -49
  95. package/src/common/harvest/harvest-scheduler.js +1 -1
  96. package/src/common/ids/__mocks__/bundle-id.js +1 -1
  97. package/src/common/ids/__mocks__/unique-id.js +2 -2
  98. package/src/features/metrics/aggregate/index.js +1 -1
  99. package/src/features/session_replay/aggregate/index.js +29 -16
  100. package/src/features/session_replay/shared/recorder-events.js +2 -0
  101. package/src/features/session_replay/shared/recorder.js +51 -6
  102. package/src/features/session_replay/shared/stylesheet-evaluator.js +89 -0
  103. package/src/loaders/agent-base.js +59 -15
  104. package/src/loaders/agent.js +0 -38
package/CHANGELOG.md CHANGED
@@ -3,6 +3,27 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.251.1](https://github.com/newrelic/newrelic-browser-agent/compare/v1.251.0...v1.251.1) (2024-01-29)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Fix deferred Session Replay payloads ([#868](https://github.com/newrelic/newrelic-browser-agent/issues/868)) ([f69e4b0](https://github.com/newrelic/newrelic-browser-agent/commit/f69e4b0eba5a54f4e67316f5e6a30090cf7360cc))
12
+ * Pass unload options to simultaneous harvests in Session Replay ([#870](https://github.com/newrelic/newrelic-browser-agent/issues/870)) ([655aa5d](https://github.com/newrelic/newrelic-browser-agent/commit/655aa5d261d03f71086d3cfc73cb72db51cb28c7))
13
+
14
+ ## [1.251.0](https://github.com/newrelic/newrelic-browser-agent/compare/v1.250.0...v1.251.0) (2024-01-24)
15
+
16
+
17
+ ### Features
18
+
19
+ * Session Replay - Detect Non-Inlined Stylesheets ([#859](https://github.com/newrelic/newrelic-browser-agent/issues/859)) ([69a8e00](https://github.com/newrelic/newrelic-browser-agent/commit/69a8e00ce66c41a29f551697299246763e7ae29f))
20
+
21
+
22
+ ### Bug Fixes
23
+
24
+ * Add fallback for currentBufferTarget ([#861](https://github.com/newrelic/newrelic-browser-agent/issues/861)) ([f43b791](https://github.com/newrelic/newrelic-browser-agent/commit/f43b7914ec1f26f610cbaa1a513bac482a3d6534))
25
+ * Bubble Up API Methods to Top-Level Instance For NPM ([#862](https://github.com/newrelic/newrelic-browser-agent/issues/862)) ([cd6324f](https://github.com/newrelic/newrelic-browser-agent/commit/cd6324fb79edab77725d9c72f91d2bcb7e860f57))
26
+
6
27
  ## [1.250.0](https://github.com/newrelic/newrelic-browser-agent/compare/v1.249.0...v1.250.0) (2024-01-09)
7
28
 
8
29
 
@@ -36,7 +36,6 @@ const model = () => {
36
36
  password: true // This will be enforced to always be true in the setter
37
37
  }
38
38
  };
39
-
40
39
  return {
41
40
  feature_flags: [],
42
41
  proxy: {
@@ -44,7 +43,6 @@ const model = () => {
44
43
  // if this value is set, it will be used to overwrite the webpack asset path used to fetch assets
45
44
  beacon: undefined // likewise for the url to which we send analytics
46
45
  },
47
-
48
46
  privacy: {
49
47
  cookies_enabled: true
50
48
  },
@@ -5,5 +5,4 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.originals = void 0;
7
7
  var _nreum = require("../../window/nreum");
8
- const originals = (0, _nreum.gosNREUMOriginals)().o;
9
- exports.originals = originals;
8
+ const originals = exports.originals = (0, _nreum.gosNREUMOriginals)().o;
@@ -12,24 +12,20 @@ exports.VERSION = exports.RRWEB_VERSION = exports.DIST_METHOD = exports.BUILD_EN
12
12
  /**
13
13
  * Exposes the version of the agent
14
14
  */
15
- const VERSION = "1.250.0";
15
+ const VERSION = exports.VERSION = "1.251.1";
16
16
 
17
17
  /**
18
18
  * Exposes the build type of the agent
19
19
  * Valid values are LOCAL, PROD, DEV
20
20
  */
21
- exports.VERSION = VERSION;
22
- const BUILD_ENV = "CDN";
21
+ const BUILD_ENV = exports.BUILD_ENV = "CDN";
23
22
 
24
23
  /**
25
24
  * Exposes the distribution method of the agent
26
25
  */
27
- exports.BUILD_ENV = BUILD_ENV;
28
- const DIST_METHOD = 'CDN';
26
+ const DIST_METHOD = exports.DIST_METHOD = 'CDN';
29
27
 
30
28
  /**
31
29
  * Exposes the lib version of rrweb
32
30
  */
33
- exports.DIST_METHOD = DIST_METHOD;
34
- const RRWEB_VERSION = "2.0.0-alpha.11";
35
- exports.RRWEB_VERSION = RRWEB_VERSION;
31
+ const RRWEB_VERSION = exports.RRWEB_VERSION = "2.0.0-alpha.11";
@@ -16,23 +16,19 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
16
16
  /**
17
17
  * Exposes the version of the agent
18
18
  */
19
- const VERSION = _package.default.version;
19
+ const VERSION = exports.VERSION = _package.default.version;
20
20
 
21
21
  /**
22
22
  * Exposes the build type of the agent
23
23
  */
24
- exports.VERSION = VERSION;
25
- const BUILD_ENV = 'NPM';
24
+ const BUILD_ENV = exports.BUILD_ENV = 'NPM';
26
25
 
27
26
  /**
28
27
  * Exposes the distribution method of the agent
29
28
  */
30
- exports.BUILD_ENV = BUILD_ENV;
31
- const DIST_METHOD = 'NPM';
29
+ const DIST_METHOD = exports.DIST_METHOD = 'NPM';
32
30
 
33
31
  /**
34
32
  * Exposes the lib version of rrweb
35
33
  */
36
- exports.DIST_METHOD = DIST_METHOD;
37
- const RRWEB_VERSION = _package.default.dependencies.rrweb;
38
- exports.RRWEB_VERSION = RRWEB_VERSION;
34
+ const RRWEB_VERSION = exports.RRWEB_VERSION = _package.default.dependencies.rrweb;
@@ -12,25 +12,21 @@ exports.VERSION = exports.RRWEB_VERSION = exports.DIST_METHOD = exports.BUILD_EN
12
12
  /**
13
13
  * Exposes the version of the agent
14
14
  */
15
- const VERSION = "1.250.0";
15
+ const VERSION = exports.VERSION = "1.251.1";
16
16
 
17
17
  /**
18
18
  * Exposes the build type of the agent
19
19
  * Valid values are LOCAL, PROD, DEV
20
20
  */
21
- exports.VERSION = VERSION;
22
- const BUILD_ENV = 'NPM';
21
+ const BUILD_ENV = exports.BUILD_ENV = 'NPM';
23
22
 
24
23
  /**
25
24
  * Exposes the distribution method of the agent
26
25
  * Valid valuse are CDN, NPM
27
26
  */
28
- exports.BUILD_ENV = BUILD_ENV;
29
- const DIST_METHOD = 'NPM';
27
+ const DIST_METHOD = exports.DIST_METHOD = 'NPM';
30
28
 
31
29
  /**
32
30
  * Exposes the lib version of rrweb
33
31
  */
34
- exports.DIST_METHOD = DIST_METHOD;
35
- const RRWEB_VERSION = "2.0.0-alpha.11";
36
- exports.RRWEB_VERSION = RRWEB_VERSION;
32
+ const RRWEB_VERSION = exports.RRWEB_VERSION = "2.0.0-alpha.11";
@@ -14,23 +14,17 @@ exports.supportsSendBeacon = exports.offset = exports.loadedAsDeferredBrowserScr
14
14
  /**
15
15
  * Indicates if the agent is running within a normal browser window context.
16
16
  */
17
- const isBrowserScope = typeof window !== 'undefined' && !!window.document;
17
+ const isBrowserScope = exports.isBrowserScope = typeof window !== 'undefined' && !!window.document;
18
18
 
19
19
  /**
20
20
  * Indicates if the agent is running within a worker context.
21
21
  */
22
- exports.isBrowserScope = isBrowserScope;
23
- const isWorkerScope = typeof WorkerGlobalScope !== 'undefined' && (typeof self !== 'undefined' && self instanceof WorkerGlobalScope && self.navigator instanceof WorkerNavigator || typeof globalThis !== 'undefined' && globalThis instanceof WorkerGlobalScope && globalThis.navigator instanceof WorkerNavigator);
24
- exports.isWorkerScope = isWorkerScope;
25
- const globalScope = isBrowserScope ? window : typeof WorkerGlobalScope !== 'undefined' && (typeof self !== 'undefined' && self instanceof WorkerGlobalScope && self || typeof globalThis !== 'undefined' && globalThis instanceof WorkerGlobalScope && globalThis);
26
- exports.globalScope = globalScope;
27
- const loadedAsDeferredBrowserScript = globalScope?.document?.readyState === 'complete';
28
- exports.loadedAsDeferredBrowserScript = loadedAsDeferredBrowserScript;
29
- const initiallyHidden = Boolean(globalScope?.document?.visibilityState === 'hidden');
30
- exports.initiallyHidden = initiallyHidden;
31
- const initialLocation = '' + globalScope?.location;
32
- exports.initialLocation = initialLocation;
33
- const isiOS = /iPad|iPhone|iPod/.test(globalScope.navigator?.userAgent);
22
+ const isWorkerScope = exports.isWorkerScope = typeof WorkerGlobalScope !== 'undefined' && (typeof self !== 'undefined' && self instanceof WorkerGlobalScope && self.navigator instanceof WorkerNavigator || typeof globalThis !== 'undefined' && globalThis instanceof WorkerGlobalScope && globalThis.navigator instanceof WorkerNavigator);
23
+ const globalScope = exports.globalScope = isBrowserScope ? window : typeof WorkerGlobalScope !== 'undefined' && (typeof self !== 'undefined' && self instanceof WorkerGlobalScope && self || typeof globalThis !== 'undefined' && globalThis instanceof WorkerGlobalScope && globalThis);
24
+ const loadedAsDeferredBrowserScript = exports.loadedAsDeferredBrowserScript = globalScope?.document?.readyState === 'complete';
25
+ const initiallyHidden = exports.initiallyHidden = Boolean(globalScope?.document?.visibilityState === 'hidden');
26
+ const initialLocation = exports.initialLocation = '' + globalScope?.location;
27
+ const isiOS = exports.isiOS = /iPad|iPhone|iPod/.test(globalScope.navigator?.userAgent);
34
28
 
35
29
  /**
36
30
  * Shared Web Workers introduced in iOS 16.0+ and n/a in 15.6-
@@ -39,20 +33,15 @@ const isiOS = /iPad|iPhone|iPod/.test(globalScope.navigator?.userAgent);
39
33
  * did not work. This affects our onFCP metric in particular since web-vitals uses that flag to retrieve paint timing entries.
40
34
  * This was fixed in v16+.
41
35
  */
42
- exports.isiOS = isiOS;
43
- const iOSBelow16 = isiOS && typeof SharedWorker === 'undefined';
44
- exports.iOSBelow16 = iOSBelow16;
45
- const ffVersion = (() => {
36
+ const iOSBelow16 = exports.iOSBelow16 = isiOS && typeof SharedWorker === 'undefined';
37
+ const ffVersion = exports.ffVersion = (() => {
46
38
  const match = globalScope.navigator?.userAgent?.match(/Firefox[/\s](\d+\.\d+)/);
47
39
  if (Array.isArray(match) && match.length >= 2) {
48
40
  return +match[1];
49
41
  }
50
42
  return 0;
51
43
  })();
52
- exports.ffVersion = ffVersion;
53
- const isIE = Boolean(isBrowserScope && window.document.documentMode); // deprecated property that only works in IE
54
- exports.isIE = isIE;
55
- const supportsSendBeacon = !!globalScope.navigator?.sendBeacon;
56
- exports.supportsSendBeacon = supportsSendBeacon;
57
- const offset = Math.floor(globalScope?.performance?.timeOrigin || globalScope?.performance?.timing?.navigationStart || Date.now());
58
- exports.offset = offset;
44
+ const isIE = exports.isIE = Boolean(isBrowserScope && window.document.documentMode); // deprecated property that only works in IE
45
+
46
+ const supportsSendBeacon = exports.supportsSendBeacon = !!globalScope.navigator?.sendBeacon;
47
+ const offset = exports.offset = Math.floor(globalScope?.performance?.timeOrigin || globalScope?.performance?.timing?.navigationStart || Date.now());
@@ -14,8 +14,7 @@ let onReplayReady;
14
14
  const sessionReplayInitialized = new Promise(resolve => {
15
15
  onReplayReady = resolve;
16
16
  });
17
- const sharedChannel = Object.freeze({
17
+ const sharedChannel = exports.sharedChannel = Object.freeze({
18
18
  onReplayReady,
19
19
  sessionReplayInitialized
20
- });
21
- exports.sharedChannel = sharedChannel;
20
+ });
@@ -15,13 +15,11 @@ var _bundleId = require("../ids/bundle-id");
15
15
  */
16
16
 
17
17
  // create a unique id to store event context data for the current agent bundle
18
- const contextId = "nr@context:".concat(_bundleId.bundleId);
18
+ const contextId = exports.contextId = "nr@context:".concat(_bundleId.bundleId);
19
19
  // create global emitter instance that can be shared among bundles
20
- exports.contextId = contextId;
21
- const globalInstance = ee(undefined, 'globalEE');
20
+ const globalInstance = exports.ee = ee(undefined, 'globalEE');
22
21
 
23
22
  // Only override the exposed event emitter if one has not already been exposed
24
- exports.ee = globalInstance;
25
23
  const nr = (0, _nreum.gosNREUM)();
26
24
  if (!nr.ee) {
27
25
  nr.ee = globalInstance;
@@ -11,8 +11,7 @@ var _contextualEe = require("./contextual-ee");
11
11
  * SPDX-License-Identifier: Apache-2.0
12
12
  */
13
13
 
14
- var handleEE = _contextualEe.ee.get('handle');
15
- exports.handleEE = handleEE;
14
+ var handleEE = exports.handleEE = _contextualEe.ee.get('handle');
16
15
  function handle(type, args, ctx, group, ee) {
17
16
  if (ee) {
18
17
  ee.buffer([type], group);
@@ -9,8 +9,8 @@ var _sharedContext = require("../context/shared-context");
9
9
  var _harvest = require("./harvest");
10
10
  var _eol = require("../unload/eol");
11
11
  var _constants = require("../session/constants");
12
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
12
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
13
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
14
  /*
15
15
  * Copyright 2020 New Relic Corporation. All rights reserved.
16
16
  * SPDX-License-Identifier: Apache-2.0
@@ -109,7 +109,8 @@ class HarvestScheduler extends _sharedContext.SharedContext {
109
109
  if (!submitMethod) return false;
110
110
  const retry = !opts?.unload && submitMethod === submitData.xhr;
111
111
  payload = this.opts.getPayload({
112
- retry
112
+ retry,
113
+ opts
113
114
  });
114
115
  if (!payload) {
115
116
  if (this.started) {
@@ -18,8 +18,8 @@ var _sharedContext = require("../context/shared-context");
18
18
  var _env = require("../constants/env.npm");
19
19
  var _runtime = require("../constants/runtime");
20
20
  var _console = require("../util/console");
21
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
22
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
22
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
23
23
  /*
24
24
  * Copyright 2020 New Relic Corporation. All rights reserved.
25
25
  * SPDX-License-Identifier: Apache-2.0
@@ -50,5 +50,4 @@ exports.unused = void 0;
50
50
  */
51
51
 
52
52
  /* istanbul ignore next */
53
- const unused = {};
54
- exports.unused = unused;
53
+ const unused = exports.unused = {};
@@ -15,5 +15,4 @@ var _uniqueId = require("./unique-id");
15
15
  /**
16
16
  * Provides a unique id for the current agent bundle
17
17
  */
18
- const bundleId = (0, _uniqueId.generateUuid)();
19
- exports.bundleId = bundleId;
18
+ const bundleId = exports.bundleId = (0, _uniqueId.generateUuid)();
@@ -4,27 +4,21 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.SESSION_EVENT_TYPES = exports.SESSION_EVENTS = exports.PREFIX = exports.MODE = exports.DEFAULT_INACTIVE_MS = exports.DEFAULT_EXPIRES_MS = void 0;
7
- const PREFIX = 'NRBA';
8
- exports.PREFIX = PREFIX;
9
- const DEFAULT_EXPIRES_MS = 14400000;
10
- exports.DEFAULT_EXPIRES_MS = DEFAULT_EXPIRES_MS;
11
- const DEFAULT_INACTIVE_MS = 1800000;
12
- exports.DEFAULT_INACTIVE_MS = DEFAULT_INACTIVE_MS;
13
- const SESSION_EVENTS = {
7
+ const PREFIX = exports.PREFIX = 'NRBA';
8
+ const DEFAULT_EXPIRES_MS = exports.DEFAULT_EXPIRES_MS = 14400000;
9
+ const DEFAULT_INACTIVE_MS = exports.DEFAULT_INACTIVE_MS = 1800000;
10
+ const SESSION_EVENTS = exports.SESSION_EVENTS = {
14
11
  PAUSE: 'session-pause',
15
12
  RESET: 'session-reset',
16
13
  RESUME: 'session-resume',
17
14
  UPDATE: 'session-update'
18
15
  };
19
- exports.SESSION_EVENTS = SESSION_EVENTS;
20
- const SESSION_EVENT_TYPES = {
16
+ const SESSION_EVENT_TYPES = exports.SESSION_EVENT_TYPES = {
21
17
  SAME_TAB: 'same-tab',
22
18
  CROSS_TAB: 'cross-tab'
23
19
  };
24
- exports.SESSION_EVENT_TYPES = SESSION_EVENT_TYPES;
25
- const MODE = {
20
+ const MODE = exports.MODE = {
26
21
  OFF: 0,
27
22
  FULL: 1,
28
23
  ERROR: 2
29
- };
30
- exports.MODE = MODE;
24
+ };
@@ -71,7 +71,6 @@ class InteractionTimer extends _timer.Timer {
71
71
  this.refresh();
72
72
  this.onResume(); // emit resume event after state updated
73
73
  }
74
-
75
74
  refresh(cb, ms) {
76
75
  this.clear();
77
76
  this.timer = this.create(cb, ms);
@@ -32,8 +32,7 @@ var REQUEST = 'request';
32
32
  var RESPONSE = 'response';
33
33
  var LOAD_EVENT = 'loadEvent';
34
34
  var DOM_CONTENT_LOAD_EVENT = 'domContentLoadedEvent';
35
- var navTimingValues = [];
36
- exports.navTimingValues = navTimingValues;
35
+ var navTimingValues = exports.navTimingValues = [];
37
36
  function getPntType(type) {
38
37
  if (typeof type === 'number') return type;
39
38
  const types = {
@@ -54,5 +54,4 @@ function activateFeatures(flags, agentIdentifier) {
54
54
  loaded: true
55
55
  });
56
56
  }
57
- const activatedFeatures = {};
58
- exports.activatedFeatures = activatedFeatures;
57
+ const activatedFeatures = exports.activatedFeatures = {};
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.VITAL_NAMES = void 0;
7
- const VITAL_NAMES = {
7
+ const VITAL_NAMES = exports.VITAL_NAMES = {
8
8
  FIRST_PAINT: 'fp',
9
9
  FIRST_CONTENTFUL_PAINT: 'fcp',
10
10
  FIRST_INPUT_DELAY: 'fi',
@@ -13,5 +13,4 @@ const VITAL_NAMES = {
13
13
  INTERACTION_TO_NEXT_PAINT: 'inp',
14
14
  LONG_TASK: 'lt',
15
15
  TIME_TO_FIRST_BYTE: 'ttfb'
16
- };
17
- exports.VITAL_NAMES = VITAL_NAMES;
16
+ };
@@ -8,8 +8,7 @@ var _webVitals = require("web-vitals");
8
8
  var _constants = require("./constants");
9
9
  var _vitalMetric = require("./vital-metric");
10
10
  var _runtime = require("../constants/runtime");
11
- const cumulativeLayoutShift = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.CUMULATIVE_LAYOUT_SHIFT, x => x);
12
- exports.cumulativeLayoutShift = cumulativeLayoutShift;
11
+ const cumulativeLayoutShift = exports.cumulativeLayoutShift = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.CUMULATIVE_LAYOUT_SHIFT, x => x);
13
12
  if (_runtime.isBrowserScope) {
14
13
  (0, _webVitals.onCLS)(_ref => {
15
14
  let {
@@ -10,10 +10,9 @@ var _constants = require("./constants");
10
10
  var _vitalMetric = require("./vital-metric");
11
11
  // eslint-disable-next-line camelcase
12
12
 
13
- const firstContentfulPaint = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.FIRST_CONTENTFUL_PAINT);
13
+ const firstContentfulPaint = exports.firstContentfulPaint = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.FIRST_CONTENTFUL_PAINT);
14
14
 
15
15
  /* First Contentful Paint - As of WV v3, it still imperfectly tries to detect document vis state asap and isn't supposed to report if page starts hidden. */
16
- exports.firstContentfulPaint = firstContentfulPaint;
17
16
  if (_runtime.isBrowserScope) {
18
17
  // eslint-disable-next-line camelcase
19
18
  if (_runtime.iOSBelow16) {
@@ -8,8 +8,7 @@ var _webVitals = require("web-vitals");
8
8
  var _vitalMetric = require("./vital-metric");
9
9
  var _constants = require("./constants");
10
10
  var _runtime = require("../constants/runtime");
11
- const firstInputDelay = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.FIRST_INPUT_DELAY);
12
- exports.firstInputDelay = firstInputDelay;
11
+ const firstInputDelay = exports.firstInputDelay = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.FIRST_INPUT_DELAY);
13
12
  if (_runtime.isBrowserScope) {
14
13
  (0, _webVitals.onFID)(_ref => {
15
14
  let {
@@ -7,8 +7,7 @@ exports.firstPaint = void 0;
7
7
  var _runtime = require("../constants/runtime");
8
8
  var _constants = require("./constants");
9
9
  var _vitalMetric = require("./vital-metric");
10
- const firstPaint = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.FIRST_PAINT);
11
- exports.firstPaint = firstPaint;
10
+ const firstPaint = exports.firstPaint = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.FIRST_PAINT);
12
11
  if (_runtime.isBrowserScope) {
13
12
  const handleEntries = entries => {
14
13
  entries.forEach(entry => {
@@ -8,8 +8,7 @@ var _webVitals = require("web-vitals");
8
8
  var _vitalMetric = require("./vital-metric");
9
9
  var _constants = require("./constants");
10
10
  var _runtime = require("../constants/runtime");
11
- const interactionToNextPaint = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.INTERACTION_TO_NEXT_PAINT);
12
- exports.interactionToNextPaint = interactionToNextPaint;
11
+ const interactionToNextPaint = exports.interactionToNextPaint = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.INTERACTION_TO_NEXT_PAINT);
13
12
  if (_runtime.isBrowserScope) {
14
13
  /* Interaction-to-Next-Paint */
15
14
  (0, _webVitals.onINP)(_ref => {
@@ -9,8 +9,7 @@ var _vitalMetric = require("./vital-metric");
9
9
  var _constants = require("./constants");
10
10
  var _runtime = require("../constants/runtime");
11
11
  var _cleanUrl = require("../url/clean-url");
12
- const largestContentfulPaint = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.LARGEST_CONTENTFUL_PAINT);
13
- exports.largestContentfulPaint = largestContentfulPaint;
12
+ const largestContentfulPaint = exports.largestContentfulPaint = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.LARGEST_CONTENTFUL_PAINT);
14
13
  if (_runtime.isBrowserScope) {
15
14
  (0, _webVitals.onLCP)(_ref => {
16
15
  let {
@@ -8,8 +8,7 @@ var _runtime = require("../constants/runtime");
8
8
  var _eol = require("../unload/eol");
9
9
  var _constants = require("./constants");
10
10
  var _vitalMetric = require("./vital-metric");
11
- const longTask = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.LONG_TASK);
12
- exports.longTask = longTask;
11
+ const longTask = exports.longTask = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.LONG_TASK);
13
12
  if (_runtime.isBrowserScope) {
14
13
  const handleEntries = entries => {
15
14
  entries.forEach(entry => {
@@ -34,7 +33,6 @@ if (_runtime.isBrowserScope) {
34
33
  });
35
34
  });
36
35
  };
37
-
38
36
  let observer;
39
37
  try {
40
38
  if (PerformanceObserver.supportedEntryTypes.includes('longtask')) {
@@ -8,8 +8,7 @@ var _runtime = require("../constants/runtime");
8
8
  var _constants = require("./constants");
9
9
  var _vitalMetric = require("./vital-metric");
10
10
  var _webVitals = require("web-vitals");
11
- const timeToFirstByte = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.TIME_TO_FIRST_BYTE);
12
- exports.timeToFirstByte = timeToFirstByte;
11
+ const timeToFirstByte = exports.timeToFirstByte = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.TIME_TO_FIRST_BYTE);
13
12
  if (_runtime.isBrowserScope && typeof PerformanceNavigationTiming !== 'undefined' && !_runtime.isiOS) {
14
13
  (0, _webVitals.onTTFB)(_ref => {
15
14
  let {
@@ -16,11 +16,10 @@ exports.gosNREUMOriginals = gosNREUMOriginals;
16
16
  exports.setNREUMInitializedAgent = setNREUMInitializedAgent;
17
17
  var _now = require("../timing/now");
18
18
  var _runtime = require("../constants/runtime");
19
- const defaults = {
19
+ const defaults = exports.defaults = {
20
20
  beacon: 'bam.nr-data.net',
21
21
  errorBeacon: 'bam.nr-data.net'
22
22
  };
23
- exports.defaults = defaults;
24
23
  function gosNREUM() {
25
24
  if (!_runtime.globalScope.NREUM) {
26
25
  _runtime.globalScope.NREUM = {};
@@ -15,13 +15,12 @@ var _bundleId = require("../ids/bundle-id");
15
15
  * @file Provides helper functions for wrapping functions in various scenarios.
16
16
  */
17
17
 
18
- const flag = "nr@original:".concat(_bundleId.bundleId);
18
+ const flag = exports.flag = "nr@original:".concat(_bundleId.bundleId);
19
19
 
20
20
  /**
21
21
  * A convenience alias of `hasOwnProperty`.
22
22
  * @type {function}
23
23
  */
24
- exports.flag = flag;
25
24
  var has = Object.prototype.hasOwnProperty;
26
25
 
27
26
  /**
@@ -31,14 +30,13 @@ var has = Object.prototype.hasOwnProperty;
31
30
  var inWrapper = false;
32
31
 
33
32
  // eslint-disable-next-line
34
- var _default = createWrapperWithEmitter;
33
+ var _default = exports.default = createWrapperWithEmitter;
35
34
  /**
36
35
  * Wraps a function in order to emit events on start, end, and error.
37
36
  * @param {Object} [emitter] - The desired emitter for events emitted by the wrapper. Defaults to the global emitter.
38
37
  * @param {boolean} always - If `true`, emit events even if already emitting an event.
39
38
  * @returns {function} The wrapped function.
40
39
  */
41
- exports.default = _default;
42
40
  function createWrapperWithEmitter(emitter, always) {
43
41
  emitter || (emitter = _contextualEe.ee);
44
42
  wrapFn.inPlace = inPlace;
@@ -32,7 +32,6 @@ class Aggregate extends _aggregateBase.AggregateBase {
32
32
  this.drain();
33
33
  return; // feature will only collect timeslice metrics & ajax trace nodes if it's not fully enabled
34
34
  }
35
-
36
35
  const denyList = (0, _config.getRuntime)(agentIdentifier).denyList;
37
36
  (0, _denyList.setDenyList)(denyList);
38
37
  let ajaxEvents = [];
@@ -209,7 +208,6 @@ class Aggregate extends _aggregateBase.AggregateBase {
209
208
  // traceId
210
209
  (0, _belSerializer.nullable)(event.spanTimestamp, _belSerializer.numeric, false) // timestamp
211
210
  ];
212
-
213
211
  var insert = '2,';
214
212
 
215
213
  // add custom attributes
@@ -5,5 +5,4 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.FEATURE_NAME = void 0;
7
7
  var _features = require("../../loaders/features/features");
8
- const FEATURE_NAME = _features.FEATURE_NAMES.ajax;
9
- exports.FEATURE_NAME = FEATURE_NAME;
8
+ const FEATURE_NAME = exports.FEATURE_NAME = _features.FEATURE_NAMES.ajax;
@@ -149,7 +149,6 @@ class Aggregate extends _aggregateBase.AggregateBase {
149
149
  }
150
150
  // Again as with previous usage, all falsey values would include the error.
151
151
  }
152
-
153
152
  var stackInfo = (0, _computeStackTrace.computeStackTrace)(err);
154
153
  var canonicalStackString = this.buildCanonicalStackString(stackInfo);
155
154
  const params = {
@@ -18,6 +18,5 @@ function stringHashCode(string) {
18
18
  hash = (hash << 5) - hash + charVal;
19
19
  hash = hash | 0; // Convert to 32bit integer
20
20
  }
21
-
22
21
  return hash;
23
22
  }
@@ -5,5 +5,4 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.FEATURE_NAME = void 0;
7
7
  var _features = require("../../loaders/features/features");
8
- const FEATURE_NAME = _features.FEATURE_NAMES.jserrors;
9
- exports.FEATURE_NAME = FEATURE_NAME;
8
+ const FEATURE_NAME = exports.FEATURE_NAME = _features.FEATURE_NAMES.jserrors;
@@ -113,7 +113,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
113
113
 
114
114
  // [Temporary] Report restores from BFCache to NR1 while feature flag is in place in lieu of sending pageshow events.
115
115
  (0, _eventListenerOpts.windowAddEventListener)('pageshow', evt => {
116
- if (evt.persisted) {
116
+ if (evt?.persisted) {
117
117
  this.storeSupportabilityMetrics('Generic/BFCache/PageRestored');
118
118
  }
119
119
  });
@@ -5,13 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.SUPPORTABILITY_METRIC_CHANNEL = exports.SUPPORTABILITY_METRIC = exports.FEATURE_NAME = exports.CUSTOM_METRIC_CHANNEL = exports.CUSTOM_METRIC = void 0;
7
7
  var _features = require("../../loaders/features/features");
8
- const FEATURE_NAME = _features.FEATURE_NAMES.metrics;
9
- exports.FEATURE_NAME = FEATURE_NAME;
10
- const SUPPORTABILITY_METRIC = 'sm';
11
- exports.SUPPORTABILITY_METRIC = SUPPORTABILITY_METRIC;
12
- const CUSTOM_METRIC = 'cm';
13
- exports.CUSTOM_METRIC = CUSTOM_METRIC;
14
- const SUPPORTABILITY_METRIC_CHANNEL = 'storeSupportabilityMetrics';
15
- exports.SUPPORTABILITY_METRIC_CHANNEL = SUPPORTABILITY_METRIC_CHANNEL;
16
- const CUSTOM_METRIC_CHANNEL = 'storeEventMetrics';
17
- exports.CUSTOM_METRIC_CHANNEL = CUSTOM_METRIC_CHANNEL;
8
+ const FEATURE_NAME = exports.FEATURE_NAME = _features.FEATURE_NAMES.metrics;
9
+ const SUPPORTABILITY_METRIC = exports.SUPPORTABILITY_METRIC = 'sm';
10
+ const CUSTOM_METRIC = exports.CUSTOM_METRIC = 'cm';
11
+ const SUPPORTABILITY_METRIC_CHANNEL = exports.SUPPORTABILITY_METRIC_CHANNEL = 'storeSupportabilityMetrics';
12
+ const CUSTOM_METRIC_CHANNEL = exports.CUSTOM_METRIC_CHANNEL = 'storeEventMetrics';
@@ -5,5 +5,4 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.FEATURE_NAME = void 0;
7
7
  var _features = require("../../loaders/features/features");
8
- const FEATURE_NAME = _features.FEATURE_NAMES.pageAction;
9
- exports.FEATURE_NAME = FEATURE_NAME;
8
+ const FEATURE_NAME = exports.FEATURE_NAME = _features.FEATURE_NAMES.pageAction;