@newrelic/browser-agent 1.314.0-rc.1 → 1.314.0-rc.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/dist/cjs/common/constants/env.cdn.js +1 -1
- package/dist/cjs/common/constants/env.npm.js +1 -1
- package/dist/cjs/features/soft_navigations/aggregate/index.js +17 -14
- package/dist/cjs/loaders/api-base.js +1 -0
- package/dist/esm/common/constants/env.cdn.js +1 -1
- package/dist/esm/common/constants/env.npm.js +1 -1
- package/dist/esm/features/soft_navigations/aggregate/index.js +17 -14
- package/dist/esm/loaders/api-base.js +1 -0
- package/dist/types/features/soft_navigations/aggregate/index.d.ts.map +1 -1
- package/dist/types/loaders/api-base.d.ts +2 -0
- package/dist/types/loaders/api-base.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/features/soft_navigations/aggregate/index.js +10 -8
- package/src/loaders/api-base.js +1 -0
|
@@ -17,7 +17,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.RRWEB_PACKAGE_NAME = exports.D
|
|
|
17
17
|
/**
|
|
18
18
|
* Exposes the version of the agent
|
|
19
19
|
*/
|
|
20
|
-
const VERSION = exports.VERSION = "1.314.0-rc.
|
|
20
|
+
const VERSION = exports.VERSION = "1.314.0-rc.3";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Exposes the build type of the agent
|
|
@@ -17,7 +17,7 @@ exports.VERSION = exports.RRWEB_VERSION = exports.RRWEB_PACKAGE_NAME = exports.D
|
|
|
17
17
|
/**
|
|
18
18
|
* Exposes the version of the agent
|
|
19
19
|
*/
|
|
20
|
-
const VERSION = exports.VERSION = "1.314.0-rc.
|
|
20
|
+
const VERSION = exports.VERSION = "1.314.0-rc.3";
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Exposes the build type of the agent
|
|
@@ -36,7 +36,6 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
36
36
|
this.initialPageLoadInteraction.forceSave = true; // unless forcibly ignored, iPL always finish by default
|
|
37
37
|
const ixn = this.initialPageLoadInteraction;
|
|
38
38
|
this.events.add(ixn); // add the iPL ixn to the buffer for harvest
|
|
39
|
-
this.initialPageLoadInteraction = null;
|
|
40
39
|
});
|
|
41
40
|
_loadTime.loadTime.subscribe(({
|
|
42
41
|
value: loadEventTime
|
|
@@ -230,22 +229,26 @@ class Aggregate extends _aggregateBase.AggregateBase {
|
|
|
230
229
|
const INTERACTION_API = 'api-ixn-';
|
|
231
230
|
const thisClass = this;
|
|
232
231
|
(0, _registerHandler.registerHandler)(INTERACTION_API + 'get', function (time, {
|
|
233
|
-
waitForEnd
|
|
232
|
+
waitForEnd,
|
|
233
|
+
targetPageLoad
|
|
234
234
|
} = {}) {
|
|
235
235
|
// In here, 'this' refers to the EventContext specific to per InteractionHandle instance spawned by each .interaction() api call.
|
|
236
236
|
// Each api call aka IH instance would therefore retain a reference to either the in-progress interaction *at the time of the call* OR a new api-started interaction.
|
|
237
|
-
this.associatedInteraction = thisClass.
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
this.associatedInteraction
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
237
|
+
if (targetPageLoad) this.associatedInteraction = thisClass.initialPageLoadInteraction; // this option only grabs the IPL, no frills
|
|
238
|
+
else {
|
|
239
|
+
this.associatedInteraction = thisClass.getInteractionFor(time);
|
|
240
|
+
if (this.associatedInteraction?.trigger === _constants.IPL_TRIGGER_NAME) this.associatedInteraction = null; // the api get-interaction method cannot target IPL
|
|
241
|
+
if (!this.associatedInteraction) {
|
|
242
|
+
// This new api-driven interaction will be the target of any subsequent .interaction() call, until it is closed by EITHER .end() OR the regular url>dom change process.
|
|
243
|
+
this.associatedInteraction = thisClass.interactionInProgress = new _interaction.Interaction(_constants.API_TRIGGER_NAME, Math.floor(time), thisClass.latestRouteSetByApi);
|
|
244
|
+
thisClass.domObserver.observe(document.body, {
|
|
245
|
+
attributes: true,
|
|
246
|
+
childList: true,
|
|
247
|
+
subtree: true,
|
|
248
|
+
characterData: true
|
|
249
|
+
}); // start observing for DOM changes like a regular UI-driven interaction
|
|
250
|
+
thisClass.setClosureHandlers();
|
|
251
|
+
}
|
|
249
252
|
}
|
|
250
253
|
if (waitForEnd === true) {
|
|
251
254
|
this.associatedInteraction.keepOpenUntilEndApi = true;
|
|
@@ -202,6 +202,7 @@ class ApiBase {
|
|
|
202
202
|
* {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/interaction/}
|
|
203
203
|
* @param {Object} [opts] Options to configure the new or existing interaction with
|
|
204
204
|
* @param {boolean} [opts.waitForEnd=false] To forcibly keep the interaction open until the `.end` method is called on its handle, set to true. Defaults to false. After an interaction is earmarked with this, it cannot be undone.
|
|
205
|
+
* @param {boolean} [opts.targetPageLoad=false] If true, bind this API handle to the initial page load interaction forcibly instead of creating or targeting a soft navigation interaction.
|
|
205
206
|
* @returns {InteractionInstance} An API object that is bound to a specific BrowserInteraction event. Each time this method is called for the same BrowserInteraction, a new object is created, but it still references the same interaction.
|
|
206
207
|
* - Note: Does not apply to MicroAgent
|
|
207
208
|
* - Deprecation Notice: interaction.createTracer is deprecated. See https://docs.newrelic.com/eol/2024/04/eol-04-24-24-createtracer/ for more information.
|
|
@@ -29,7 +29,6 @@ export class Aggregate extends AggregateBase {
|
|
|
29
29
|
this.initialPageLoadInteraction.forceSave = true; // unless forcibly ignored, iPL always finish by default
|
|
30
30
|
const ixn = this.initialPageLoadInteraction;
|
|
31
31
|
this.events.add(ixn); // add the iPL ixn to the buffer for harvest
|
|
32
|
-
this.initialPageLoadInteraction = null;
|
|
33
32
|
});
|
|
34
33
|
loadTime.subscribe(({
|
|
35
34
|
value: loadEventTime
|
|
@@ -223,22 +222,26 @@ export class Aggregate extends AggregateBase {
|
|
|
223
222
|
const INTERACTION_API = 'api-ixn-';
|
|
224
223
|
const thisClass = this;
|
|
225
224
|
registerHandler(INTERACTION_API + 'get', function (time, {
|
|
226
|
-
waitForEnd
|
|
225
|
+
waitForEnd,
|
|
226
|
+
targetPageLoad
|
|
227
227
|
} = {}) {
|
|
228
228
|
// In here, 'this' refers to the EventContext specific to per InteractionHandle instance spawned by each .interaction() api call.
|
|
229
229
|
// Each api call aka IH instance would therefore retain a reference to either the in-progress interaction *at the time of the call* OR a new api-started interaction.
|
|
230
|
-
this.associatedInteraction = thisClass.
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
this.associatedInteraction
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
230
|
+
if (targetPageLoad) this.associatedInteraction = thisClass.initialPageLoadInteraction; // this option only grabs the IPL, no frills
|
|
231
|
+
else {
|
|
232
|
+
this.associatedInteraction = thisClass.getInteractionFor(time);
|
|
233
|
+
if (this.associatedInteraction?.trigger === IPL_TRIGGER_NAME) this.associatedInteraction = null; // the api get-interaction method cannot target IPL
|
|
234
|
+
if (!this.associatedInteraction) {
|
|
235
|
+
// This new api-driven interaction will be the target of any subsequent .interaction() call, until it is closed by EITHER .end() OR the regular url>dom change process.
|
|
236
|
+
this.associatedInteraction = thisClass.interactionInProgress = new Interaction(API_TRIGGER_NAME, Math.floor(time), thisClass.latestRouteSetByApi);
|
|
237
|
+
thisClass.domObserver.observe(document.body, {
|
|
238
|
+
attributes: true,
|
|
239
|
+
childList: true,
|
|
240
|
+
subtree: true,
|
|
241
|
+
characterData: true
|
|
242
|
+
}); // start observing for DOM changes like a regular UI-driven interaction
|
|
243
|
+
thisClass.setClosureHandlers();
|
|
244
|
+
}
|
|
242
245
|
}
|
|
243
246
|
if (waitForEnd === true) {
|
|
244
247
|
this.associatedInteraction.keepOpenUntilEndApi = true;
|
|
@@ -196,6 +196,7 @@ export class ApiBase {
|
|
|
196
196
|
* {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/interaction/}
|
|
197
197
|
* @param {Object} [opts] Options to configure the new or existing interaction with
|
|
198
198
|
* @param {boolean} [opts.waitForEnd=false] To forcibly keep the interaction open until the `.end` method is called on its handle, set to true. Defaults to false. After an interaction is earmarked with this, it cannot be undone.
|
|
199
|
+
* @param {boolean} [opts.targetPageLoad=false] If true, bind this API handle to the initial page load interaction forcibly instead of creating or targeting a soft navigation interaction.
|
|
199
200
|
* @returns {InteractionInstance} An API object that is bound to a specific BrowserInteraction event. Each time this method is called for the same BrowserInteraction, a new object is created, but it still references the same interaction.
|
|
200
201
|
* - Note: Does not apply to MicroAgent
|
|
201
202
|
* - Deprecation Notice: interaction.createTracer is deprecated. See https://docs.newrelic.com/eol/2024/04/eol-04-24-24-createtracer/ for more information.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/soft_navigations/aggregate/index.js"],"names":[],"mappings":"AAeA;IACE,2BAAiC;IACjC;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/soft_navigations/aggregate/index.js"],"names":[],"mappings":"AAeA;IACE,2BAAiC;IACjC;;OA+DC;IA1DC,2BAAwC;IACxC,iBAA8B;IAE9B,uDAA0E;IAc1E,yBAA+B;IAC/B,0CAAiC;IACjC,yBAA4C;IAyC9C,qCAUC;IAED,0EAmBC;IAED,2BAiBC;IAED;;;;;;;OAOG;IACH,6BAHW,mBAAmB,OAsB7B;;CAoHF;8BA5Q6B,4BAA4B;2CAGf,iCAAiC;4BAChD,eAAe"}
|
|
@@ -143,12 +143,14 @@ export class ApiBase {
|
|
|
143
143
|
* {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/interaction/}
|
|
144
144
|
* @param {Object} [opts] Options to configure the new or existing interaction with
|
|
145
145
|
* @param {boolean} [opts.waitForEnd=false] To forcibly keep the interaction open until the `.end` method is called on its handle, set to true. Defaults to false. After an interaction is earmarked with this, it cannot be undone.
|
|
146
|
+
* @param {boolean} [opts.targetPageLoad=false] If true, bind this API handle to the initial page load interaction forcibly instead of creating or targeting a soft navigation interaction.
|
|
146
147
|
* @returns {InteractionInstance} An API object that is bound to a specific BrowserInteraction event. Each time this method is called for the same BrowserInteraction, a new object is created, but it still references the same interaction.
|
|
147
148
|
* - Note: Does not apply to MicroAgent
|
|
148
149
|
* - Deprecation Notice: interaction.createTracer is deprecated. See https://docs.newrelic.com/eol/2024/04/eol-04-24-24-createtracer/ for more information.
|
|
149
150
|
*/
|
|
150
151
|
interaction(opts?: {
|
|
151
152
|
waitForEnd?: boolean | undefined;
|
|
153
|
+
targetPageLoad?: boolean | undefined;
|
|
152
154
|
}): InteractionInstance;
|
|
153
155
|
/**
|
|
154
156
|
* Wrap a logger function to capture a log each time the function is invoked with the message and arguments passed
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-base.d.ts","sourceRoot":"","sources":["../../../src/loaders/api-base.js"],"names":[],"mappings":"AAOA;;GAEG;AACH;IAQE;;;;;OAKG;IACH,oBAHW,MAAM,eACN,MAAM,OAIhB;IAED;;;;;;;;OAQG;IACH,iBAHW,OAAO,0BAA0B,EAAE,sBAAsB,GAC1D,OAAO,0BAA0B,EAAE,WAAW,CAIvD;IAED;;;;;OAKG;IACH,6BAHW,MAAM,eACN,MAAM,OAIhB;IAED;;;;;OAKG;IACH,sBAHW,MAAM,SACN,MAAM,OAIhB;IAED;;;;;;OAMG;IACH,yBAJW,MAAM,SACN,MAAM,GAAC,MAAM,GAAC,OAAO,GAAC,IAAI,YAC1B,OAAO,OAIjB;IAED;;;;;OAKG;IACH,mBAHW,KAAK,GAAC,MAAM,qBACZ,MAAM,OAIhB;IAED;;;;;OAKG;IACH,iBAHW,MAAM,GAAC,IAAI,iBACX,OAAO,OAIjB;IAED;;;;;;;OAOG;IACH,6BAJW,MAAM,GAAC,IAAI,OAMrB;IAED;;;;OAIG;IACH,0BAFW,CAAC,KAAK,EAAE,KAAK,GAAC,MAAM,KAAK,OA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A;KAAC,GACvF;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,gBAAgB,EAAE,MAAM,CAAA;KAAC,CAIpF;IAED;;;;;OAKG;IACH,gBAFW,OAAO,OAAC,OAIlB;;CACF;kCAvOY,OAAO,yBAAyB,EAAE,mBAAmB"}
|
package/package.json
CHANGED
|
@@ -30,7 +30,6 @@ export class Aggregate extends AggregateBase {
|
|
|
30
30
|
this.initialPageLoadInteraction.forceSave = true // unless forcibly ignored, iPL always finish by default
|
|
31
31
|
const ixn = this.initialPageLoadInteraction
|
|
32
32
|
this.events.add(ixn) // add the iPL ixn to the buffer for harvest
|
|
33
|
-
this.initialPageLoadInteraction = null
|
|
34
33
|
})
|
|
35
34
|
|
|
36
35
|
loadTime.subscribe(({ value: loadEventTime }) => {
|
|
@@ -230,16 +229,19 @@ export class Aggregate extends AggregateBase {
|
|
|
230
229
|
const INTERACTION_API = 'api-ixn-'
|
|
231
230
|
const thisClass = this
|
|
232
231
|
|
|
233
|
-
registerHandler(INTERACTION_API + 'get', function (time, { waitForEnd } = {}) {
|
|
232
|
+
registerHandler(INTERACTION_API + 'get', function (time, { waitForEnd, targetPageLoad } = {}) {
|
|
234
233
|
// In here, 'this' refers to the EventContext specific to per InteractionHandle instance spawned by each .interaction() api call.
|
|
235
234
|
// Each api call aka IH instance would therefore retain a reference to either the in-progress interaction *at the time of the call* OR a new api-started interaction.
|
|
236
|
-
this.associatedInteraction = thisClass.
|
|
237
|
-
|
|
238
|
-
|
|
235
|
+
if (targetPageLoad) this.associatedInteraction = thisClass.initialPageLoadInteraction // this option only grabs the IPL, no frills
|
|
236
|
+
else {
|
|
237
|
+
this.associatedInteraction = thisClass.getInteractionFor(time)
|
|
238
|
+
if (this.associatedInteraction?.trigger === IPL_TRIGGER_NAME) this.associatedInteraction = null // the api get-interaction method cannot target IPL
|
|
239
|
+
if (!this.associatedInteraction) {
|
|
239
240
|
// This new api-driven interaction will be the target of any subsequent .interaction() call, until it is closed by EITHER .end() OR the regular url>dom change process.
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
241
|
+
this.associatedInteraction = thisClass.interactionInProgress = new Interaction(API_TRIGGER_NAME, Math.floor(time), thisClass.latestRouteSetByApi)
|
|
242
|
+
thisClass.domObserver.observe(document.body, { attributes: true, childList: true, subtree: true, characterData: true }) // start observing for DOM changes like a regular UI-driven interaction
|
|
243
|
+
thisClass.setClosureHandlers()
|
|
244
|
+
}
|
|
243
245
|
}
|
|
244
246
|
if (waitForEnd === true) {
|
|
245
247
|
this.associatedInteraction.keepOpenUntilEndApi = true
|
package/src/loaders/api-base.js
CHANGED
|
@@ -197,6 +197,7 @@ export class ApiBase {
|
|
|
197
197
|
* {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/interaction/}
|
|
198
198
|
* @param {Object} [opts] Options to configure the new or existing interaction with
|
|
199
199
|
* @param {boolean} [opts.waitForEnd=false] To forcibly keep the interaction open until the `.end` method is called on its handle, set to true. Defaults to false. After an interaction is earmarked with this, it cannot be undone.
|
|
200
|
+
* @param {boolean} [opts.targetPageLoad=false] If true, bind this API handle to the initial page load interaction forcibly instead of creating or targeting a soft navigation interaction.
|
|
200
201
|
* @returns {InteractionInstance} An API object that is bound to a specific BrowserInteraction event. Each time this method is called for the same BrowserInteraction, a new object is created, but it still references the same interaction.
|
|
201
202
|
* - Note: Does not apply to MicroAgent
|
|
202
203
|
* - Deprecation Notice: interaction.createTracer is deprecated. See https://docs.newrelic.com/eol/2024/04/eol-04-24-24-createtracer/ for more information.
|