@newrelic/browser-agent 1.270.1 → 1.270.3

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,20 @@
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.270.3](https://github.com/newrelic/newrelic-browser-agent/compare/v1.270.2...v1.270.3) (2024-10-31)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Ensure all lazy loaded modules issue warning instead of errors ([#1234](https://github.com/newrelic/newrelic-browser-agent/issues/1234)) ([cdfdab7](https://github.com/newrelic/newrelic-browser-agent/commit/cdfdab701bda6266416ad27750e63e8e9e0e075b))
12
+
13
+ ## [1.270.2](https://github.com/newrelic/newrelic-browser-agent/compare/v1.270.1...v1.270.2) (2024-10-28)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * Correct naming for logging pageUrl attribute ([#1225](https://github.com/newrelic/newrelic-browser-agent/issues/1225)) ([95f5a77](https://github.com/newrelic/newrelic-browser-agent/commit/95f5a77c60221c0eda61a42f33648f5a2791891f))
19
+
6
20
  ## [1.270.1](https://github.com/newrelic/newrelic-browser-agent/compare/v1.270.0...v1.270.1) (2024-10-23)
7
21
 
8
22
 
@@ -27,7 +27,6 @@ const model = {
27
27
  loaderType: undefined,
28
28
  maxBytes: 30000,
29
29
  onerror: undefined,
30
- origin: '' + _runtime.globalScope.location,
31
30
  ptid: undefined,
32
31
  releaseIds: {},
33
32
  /** Agent-specific metadata found in the RUM call response. ex. entityGuid */
@@ -12,7 +12,7 @@ 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 = exports.VERSION = "1.270.1";
15
+ const VERSION = exports.VERSION = "1.270.3";
16
16
 
17
17
  /**
18
18
  * Exposes the build type of the agent
@@ -12,7 +12,7 @@ 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 = exports.VERSION = "1.270.1";
15
+ const VERSION = exports.VERSION = "1.270.3";
16
16
 
17
17
  /**
18
18
  * Exposes the build type of the agent
@@ -29,7 +29,7 @@ class Log {
29
29
  this.message = message;
30
30
  this.attributes = {
31
31
  ...attributes,
32
- pageUrl: (0, _cleanUrl.cleanURL)('' + _runtime.globalScope.location)
32
+ pageUrl: (0, _cleanUrl.cleanURL)('' + _runtime.initialLocation)
33
33
  };
34
34
  this.level = level.toUpperCase();
35
35
  }
@@ -56,8 +56,8 @@ class Aggregate extends _aggregateBase.AggregateBase {
56
56
  constructor(agentRef) {
57
57
  super(agentRef, FEATURE_NAME);
58
58
  this.state = {
59
- initialPageURL: agentRef.runtime.origin,
60
- lastSeenUrl: agentRef.runtime.origin,
59
+ initialPageURL: _runtime.initialLocation,
60
+ lastSeenUrl: _runtime.initialLocation,
61
61
  lastSeenRouteName: null,
62
62
  timerMap: {},
63
63
  timerBudget: MAX_TIMER_BUDGET,
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.Interaction = Interaction;
7
7
  var _info = require("../../../common/config/info");
8
- var _runtime = require("../../../common/config/runtime");
8
+ var _runtime = require("../../../common/constants/runtime");
9
9
  var _nreum = require("../../../common/window/nreum");
10
10
  var _contextualEe = require("../../../common/event-emitter/contextual-ee");
11
11
  var _interactionNode = require("./interaction-node");
@@ -34,7 +34,7 @@ function Interaction(eventName, timestamp, url, routeName, onFinished, agentIden
34
34
  var root = this.root = new _interactionNode.InteractionNode(this, null, 'interaction', timestamp);
35
35
  var attrs = root.attrs;
36
36
  attrs.trigger = eventName;
37
- attrs.initialPageURL = (0, _runtime.getRuntime)(agentIdentifier).origin;
37
+ attrs.initialPageURL = _runtime.initialLocation;
38
38
  attrs.oldRoute = routeName;
39
39
  attrs.newURL = attrs.oldURL = url;
40
40
  attrs.custom = {};
@@ -95,20 +95,20 @@ class InstrumentBase extends _featureBase.FeatureBase {
95
95
  if (this.featureName === _features.FEATURE_NAMES.sessionReplay) this.abortHandler?.(); // SR should stop recording if session DNE
96
96
  }
97
97
 
98
- // Create a single Aggregator for this agent if DNE yet; to be used by jserror endpoint features.
99
- if (!agentRef.sharedAggregator) {
100
- agentRef.sharedAggregator = Promise.resolve().then(() => _interopRequireWildcard(require(/* webpackChunkName: "shared-aggregator" */'../../common/aggregate/aggregator')));
101
- const {
102
- Aggregator
103
- } = await agentRef.sharedAggregator;
104
- agentRef.sharedAggregator = new Aggregator();
105
- } else await agentRef.sharedAggregator; // if another feature is already importing the aggregator, wait for it to finish
106
-
107
98
  /**
108
99
  * Note this try-catch differs from the one in Agent.run() in that it's placed later in a page's lifecycle and
109
100
  * it's only responsible for aborting its one specific feature, rather than all.
110
101
  */
111
102
  try {
103
+ // Create a single Aggregator for this agent if DNE yet; to be used by jserror endpoint features.
104
+ if (!agentRef.sharedAggregator) {
105
+ agentRef.sharedAggregator = Promise.resolve().then(() => _interopRequireWildcard(require(/* webpackChunkName: "shared-aggregator" */'../../common/aggregate/aggregator')));
106
+ const {
107
+ Aggregator
108
+ } = await agentRef.sharedAggregator;
109
+ agentRef.sharedAggregator = new Aggregator();
110
+ } else await agentRef.sharedAggregator; // if another feature is already importing the aggregator, wait for it to finish
111
+
112
112
  if (!this.#shouldImportAgg(this.featureName, session)) {
113
113
  (0, _drain.drain)(this.agentIdentifier, this.featureName);
114
114
  loadedSuccessfully(false); // aggregate module isn't loaded at all
@@ -1,6 +1,6 @@
1
1
  import { getModeledObject } from './configurable';
2
2
  import { getNREUMInitializedAgent } from '../window/nreum';
3
- import { globalScope, originTime } from '../constants/runtime';
3
+ import { originTime } from '../constants/runtime';
4
4
  import { BUILD_ENV, DIST_METHOD, VERSION } from "../constants/env.npm";
5
5
 
6
6
  /**
@@ -21,7 +21,6 @@ const model = {
21
21
  loaderType: undefined,
22
22
  maxBytes: 30000,
23
23
  onerror: undefined,
24
- origin: '' + globalScope.location,
25
24
  ptid: undefined,
26
25
  releaseIds: {},
27
26
  /** Agent-specific metadata found in the RUM call response. ex. entityGuid */
@@ -6,7 +6,7 @@
6
6
  /**
7
7
  * Exposes the version of the agent
8
8
  */
9
- export const VERSION = "1.270.1";
9
+ export const VERSION = "1.270.3";
10
10
 
11
11
  /**
12
12
  * Exposes the build type of the agent
@@ -6,7 +6,7 @@
6
6
  /**
7
7
  * Exposes the version of the agent
8
8
  */
9
- export const VERSION = "1.270.1";
9
+ export const VERSION = "1.270.3";
10
10
 
11
11
  /**
12
12
  * Exposes the build type of the agent
@@ -1,4 +1,4 @@
1
- import { globalScope } from '../../../common/constants/runtime';
1
+ import { initialLocation } from '../../../common/constants/runtime';
2
2
  import { cleanURL } from '../../../common/url/clean-url';
3
3
  import { LOG_LEVELS } from '../constants';
4
4
  export class Log {
@@ -23,7 +23,7 @@ export class Log {
23
23
  this.message = message;
24
24
  this.attributes = {
25
25
  ...attributes,
26
- pageUrl: cleanURL('' + globalScope.location)
26
+ pageUrl: cleanURL('' + initialLocation)
27
27
  };
28
28
  this.level = level.toUpperCase();
29
29
  }
@@ -19,7 +19,7 @@ import { AggregateBase } from '../../utils/aggregate-base';
19
19
  import { firstContentfulPaint } from '../../../common/vitals/first-contentful-paint';
20
20
  import { firstPaint } from '../../../common/vitals/first-paint';
21
21
  import { bundleId } from '../../../common/ids/bundle-id';
22
- import { loadedAsDeferredBrowserScript } from '../../../common/constants/runtime';
22
+ import { initialLocation, loadedAsDeferredBrowserScript } from '../../../common/constants/runtime';
23
23
  import { handle } from '../../../common/event-emitter/handle';
24
24
  import { SUPPORTABILITY_METRIC_CHANNEL } from '../../metrics/constants';
25
25
  import { warn } from '../../../common/util/console';
@@ -47,8 +47,8 @@ export class Aggregate extends AggregateBase {
47
47
  constructor(agentRef) {
48
48
  super(agentRef, FEATURE_NAME);
49
49
  this.state = {
50
- initialPageURL: agentRef.runtime.origin,
51
- lastSeenUrl: agentRef.runtime.origin,
50
+ initialPageURL: initialLocation,
51
+ lastSeenUrl: initialLocation,
52
52
  lastSeenRouteName: null,
53
53
  timerMap: {},
54
54
  timerBudget: MAX_TIMER_BUDGET,
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import { getInfo } from '../../../common/config/info';
7
- import { getRuntime } from '../../../common/config/runtime';
7
+ import { initialLocation } from '../../../common/constants/runtime';
8
8
  import { gosNREUMOriginals } from '../../../common/window/nreum';
9
9
  import { ee } from '../../../common/event-emitter/contextual-ee';
10
10
  import { InteractionNode } from './interaction-node';
@@ -28,7 +28,7 @@ export function Interaction(eventName, timestamp, url, routeName, onFinished, ag
28
28
  var root = this.root = new InteractionNode(this, null, 'interaction', timestamp);
29
29
  var attrs = root.attrs;
30
30
  attrs.trigger = eventName;
31
- attrs.initialPageURL = getRuntime(agentIdentifier).origin;
31
+ attrs.initialPageURL = initialLocation;
32
32
  attrs.oldRoute = routeName;
33
33
  attrs.newURL = attrs.oldURL = url;
34
34
  attrs.custom = {};
@@ -90,20 +90,20 @@ export class InstrumentBase extends FeatureBase {
90
90
  if (this.featureName === FEATURE_NAMES.sessionReplay) this.abortHandler?.(); // SR should stop recording if session DNE
91
91
  }
92
92
 
93
- // Create a single Aggregator for this agent if DNE yet; to be used by jserror endpoint features.
94
- if (!agentRef.sharedAggregator) {
95
- agentRef.sharedAggregator = import(/* webpackChunkName: "shared-aggregator" */'../../common/aggregate/aggregator');
96
- const {
97
- Aggregator
98
- } = await agentRef.sharedAggregator;
99
- agentRef.sharedAggregator = new Aggregator();
100
- } else await agentRef.sharedAggregator; // if another feature is already importing the aggregator, wait for it to finish
101
-
102
93
  /**
103
94
  * Note this try-catch differs from the one in Agent.run() in that it's placed later in a page's lifecycle and
104
95
  * it's only responsible for aborting its one specific feature, rather than all.
105
96
  */
106
97
  try {
98
+ // Create a single Aggregator for this agent if DNE yet; to be used by jserror endpoint features.
99
+ if (!agentRef.sharedAggregator) {
100
+ agentRef.sharedAggregator = import(/* webpackChunkName: "shared-aggregator" */'../../common/aggregate/aggregator');
101
+ const {
102
+ Aggregator
103
+ } = await agentRef.sharedAggregator;
104
+ agentRef.sharedAggregator = new Aggregator();
105
+ } else await agentRef.sharedAggregator; // if another feature is already importing the aggregator, wait for it to finish
106
+
107
107
  if (!this.#shouldImportAgg(this.featureName, session)) {
108
108
  drain(this.agentIdentifier, this.featureName);
109
109
  loadedSuccessfully(false); // aggregate module isn't loaded at all
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/common/config/runtime.js"],"names":[],"mappings":"AAsCA,yCAIC;AAED,oDAgBC"}
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/common/config/runtime.js"],"names":[],"mappings":"AAqCA,yCAIC;AAED,oDAgBC"}
@@ -2,8 +2,8 @@ export class Aggregate extends AggregateBase {
2
2
  static featureName: string;
3
3
  constructor(agentRef: any);
4
4
  state: {
5
- initialPageURL: any;
6
- lastSeenUrl: any;
5
+ initialPageURL: string;
6
+ lastSeenUrl: string;
7
7
  lastSeenRouteName: null;
8
8
  timerMap: {};
9
9
  timerBudget: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newrelic/browser-agent",
3
- "version": "1.270.1",
3
+ "version": "1.270.3",
4
4
  "private": false,
5
5
  "author": "New Relic Browser Agent Team <browser-agent@newrelic.com>",
6
6
  "description": "New Relic Browser Agent",
@@ -1,6 +1,6 @@
1
1
  import { getModeledObject } from './configurable'
2
2
  import { getNREUMInitializedAgent } from '../window/nreum'
3
- import { globalScope, originTime } from '../constants/runtime'
3
+ import { originTime } from '../constants/runtime'
4
4
  import { BUILD_ENV, DIST_METHOD, VERSION } from '../constants/env'
5
5
 
6
6
  /**
@@ -23,7 +23,6 @@ const model = {
23
23
  loaderType: undefined,
24
24
  maxBytes: 30000,
25
25
  onerror: undefined,
26
- origin: '' + globalScope.location,
27
26
  ptid: undefined,
28
27
  releaseIds: {},
29
28
  /** Agent-specific metadata found in the RUM call response. ex. entityGuid */
@@ -1,4 +1,4 @@
1
- import { globalScope } from '../../../common/constants/runtime'
1
+ import { initialLocation } from '../../../common/constants/runtime'
2
2
  import { cleanURL } from '../../../common/url/clean-url'
3
3
  import { LOG_LEVELS } from '../constants'
4
4
 
@@ -22,7 +22,7 @@ export class Log {
22
22
  /** @type {long} */
23
23
  this.timestamp = timestamp
24
24
  this.message = message
25
- this.attributes = { ...attributes, pageUrl: cleanURL('' + globalScope.location) }
25
+ this.attributes = { ...attributes, pageUrl: cleanURL('' + initialLocation) }
26
26
  this.level = level.toUpperCase()
27
27
  }
28
28
  }
@@ -19,7 +19,7 @@ import { AggregateBase } from '../../utils/aggregate-base'
19
19
  import { firstContentfulPaint } from '../../../common/vitals/first-contentful-paint'
20
20
  import { firstPaint } from '../../../common/vitals/first-paint'
21
21
  import { bundleId } from '../../../common/ids/bundle-id'
22
- import { loadedAsDeferredBrowserScript } from '../../../common/constants/runtime'
22
+ import { initialLocation, loadedAsDeferredBrowserScript } from '../../../common/constants/runtime'
23
23
  import { handle } from '../../../common/event-emitter/handle'
24
24
  import { SUPPORTABILITY_METRIC_CHANNEL } from '../../metrics/constants'
25
25
  import { warn } from '../../../common/util/console'
@@ -35,8 +35,8 @@ export class Aggregate extends AggregateBase {
35
35
  super(agentRef, FEATURE_NAME)
36
36
 
37
37
  this.state = {
38
- initialPageURL: agentRef.runtime.origin,
39
- lastSeenUrl: agentRef.runtime.origin,
38
+ initialPageURL: initialLocation,
39
+ lastSeenUrl: initialLocation,
40
40
  lastSeenRouteName: null,
41
41
  timerMap: {},
42
42
  timerBudget: MAX_TIMER_BUDGET,
@@ -4,7 +4,7 @@
4
4
  */
5
5
 
6
6
  import { getInfo } from '../../../common/config/info'
7
- import { getRuntime } from '../../../common/config/runtime'
7
+ import { initialLocation } from '../../../common/constants/runtime'
8
8
  import { gosNREUMOriginals } from '../../../common/window/nreum'
9
9
  import { ee } from '../../../common/event-emitter/contextual-ee'
10
10
  import { InteractionNode } from './interaction-node'
@@ -34,7 +34,7 @@ export function Interaction (eventName, timestamp, url, routeName, onFinished, a
34
34
  var attrs = root.attrs
35
35
 
36
36
  attrs.trigger = eventName
37
- attrs.initialPageURL = getRuntime(agentIdentifier).origin
37
+ attrs.initialPageURL = initialLocation
38
38
  attrs.oldRoute = routeName
39
39
  attrs.newURL = attrs.oldURL = url
40
40
  attrs.custom = {}
@@ -90,18 +90,18 @@ export class InstrumentBase extends FeatureBase {
90
90
  if (this.featureName === FEATURE_NAMES.sessionReplay) this.abortHandler?.() // SR should stop recording if session DNE
91
91
  }
92
92
 
93
- // Create a single Aggregator for this agent if DNE yet; to be used by jserror endpoint features.
94
- if (!agentRef.sharedAggregator) {
95
- agentRef.sharedAggregator = import(/* webpackChunkName: "shared-aggregator" */ '../../common/aggregate/aggregator')
96
- const { Aggregator } = await agentRef.sharedAggregator
97
- agentRef.sharedAggregator = new Aggregator()
98
- } else await agentRef.sharedAggregator // if another feature is already importing the aggregator, wait for it to finish
99
-
100
93
  /**
101
94
  * Note this try-catch differs from the one in Agent.run() in that it's placed later in a page's lifecycle and
102
95
  * it's only responsible for aborting its one specific feature, rather than all.
103
96
  */
104
97
  try {
98
+ // Create a single Aggregator for this agent if DNE yet; to be used by jserror endpoint features.
99
+ if (!agentRef.sharedAggregator) {
100
+ agentRef.sharedAggregator = import(/* webpackChunkName: "shared-aggregator" */ '../../common/aggregate/aggregator')
101
+ const { Aggregator } = await agentRef.sharedAggregator
102
+ agentRef.sharedAggregator = new Aggregator()
103
+ } else await agentRef.sharedAggregator // if another feature is already importing the aggregator, wait for it to finish
104
+
105
105
  if (!this.#shouldImportAgg(this.featureName, session)) {
106
106
  drain(this.agentIdentifier, this.featureName)
107
107
  loadedSuccessfully(false) // aggregate module isn't loaded at all