@newrelic/browser-agent 1.293.0-rc.3 → 1.293.0-rc.5

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 (91) hide show
  1. package/dist/cjs/common/aggregate/event-aggregator.js +3 -0
  2. package/dist/cjs/common/config/runtime.js +4 -0
  3. package/dist/cjs/common/constants/agent-constants.js +1 -1
  4. package/dist/cjs/common/constants/env.cdn.js +1 -1
  5. package/dist/cjs/common/constants/env.npm.js +1 -1
  6. package/dist/cjs/common/event-emitter/contextual-ee.js +3 -2
  7. package/dist/cjs/common/util/attribute-size.js +31 -0
  8. package/dist/cjs/features/ajax/aggregate/index.js +6 -0
  9. package/dist/cjs/features/generic_events/aggregate/index.js +1 -14
  10. package/dist/cjs/features/generic_events/constants.js +1 -3
  11. package/dist/cjs/features/logging/aggregate/index.js +2 -23
  12. package/dist/cjs/features/page_view_timing/aggregate/index.js +2 -0
  13. package/dist/cjs/features/soft_navigations/aggregate/ajax-node.js +4 -4
  14. package/dist/cjs/features/soft_navigations/aggregate/bel-node.js +0 -4
  15. package/dist/cjs/features/soft_navigations/aggregate/index.js +12 -12
  16. package/dist/cjs/features/soft_navigations/aggregate/initial-page-load-interaction.js +1 -1
  17. package/dist/cjs/features/soft_navigations/aggregate/interaction.js +18 -11
  18. package/dist/cjs/features/utils/agent-session.js +13 -5
  19. package/dist/cjs/features/utils/aggregate-base.js +25 -2
  20. package/dist/cjs/features/utils/event-buffer.js +12 -3
  21. package/dist/cjs/features/utils/event-store-manager.js +6 -6
  22. package/dist/esm/common/aggregate/event-aggregator.js +3 -0
  23. package/dist/esm/common/config/runtime.js +4 -0
  24. package/dist/esm/common/constants/agent-constants.js +1 -1
  25. package/dist/esm/common/constants/env.cdn.js +1 -1
  26. package/dist/esm/common/constants/env.npm.js +1 -1
  27. package/dist/esm/common/event-emitter/contextual-ee.js +3 -2
  28. package/dist/esm/common/util/attribute-size.js +24 -0
  29. package/dist/esm/features/ajax/aggregate/index.js +6 -0
  30. package/dist/esm/features/generic_events/aggregate/index.js +1 -14
  31. package/dist/esm/features/generic_events/constants.js +0 -2
  32. package/dist/esm/features/logging/aggregate/index.js +2 -23
  33. package/dist/esm/features/page_view_timing/aggregate/index.js +2 -0
  34. package/dist/esm/features/soft_navigations/aggregate/ajax-node.js +4 -4
  35. package/dist/esm/features/soft_navigations/aggregate/bel-node.js +0 -4
  36. package/dist/esm/features/soft_navigations/aggregate/index.js +12 -12
  37. package/dist/esm/features/soft_navigations/aggregate/initial-page-load-interaction.js +1 -1
  38. package/dist/esm/features/soft_navigations/aggregate/interaction.js +18 -11
  39. package/dist/esm/features/utils/agent-session.js +13 -5
  40. package/dist/esm/features/utils/aggregate-base.js +25 -2
  41. package/dist/esm/features/utils/event-buffer.js +12 -3
  42. package/dist/esm/features/utils/event-store-manager.js +7 -7
  43. package/dist/tsconfig.tsbuildinfo +1 -1
  44. package/dist/types/common/aggregate/event-aggregator.d.ts +1 -0
  45. package/dist/types/common/aggregate/event-aggregator.d.ts.map +1 -1
  46. package/dist/types/common/config/runtime.d.ts.map +1 -1
  47. package/dist/types/common/constants/agent-constants.d.ts +1 -1
  48. package/dist/types/common/event-emitter/contextual-ee.d.ts.map +1 -1
  49. package/dist/types/common/util/attribute-size.d.ts +4 -0
  50. package/dist/types/common/util/attribute-size.d.ts.map +1 -0
  51. package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -1
  52. package/dist/types/features/generic_events/aggregate/index.d.ts +0 -1
  53. package/dist/types/features/generic_events/aggregate/index.d.ts.map +1 -1
  54. package/dist/types/features/generic_events/constants.d.ts +0 -2
  55. package/dist/types/features/generic_events/constants.d.ts.map +1 -1
  56. package/dist/types/features/logging/aggregate/index.d.ts.map +1 -1
  57. package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -1
  58. package/dist/types/features/soft_navigations/aggregate/ajax-node.d.ts +2 -2
  59. package/dist/types/features/soft_navigations/aggregate/ajax-node.d.ts.map +1 -1
  60. package/dist/types/features/soft_navigations/aggregate/bel-node.d.ts +0 -3
  61. package/dist/types/features/soft_navigations/aggregate/bel-node.d.ts.map +1 -1
  62. package/dist/types/features/soft_navigations/aggregate/index.d.ts.map +1 -1
  63. package/dist/types/features/soft_navigations/aggregate/interaction.d.ts +8 -2
  64. package/dist/types/features/soft_navigations/aggregate/interaction.d.ts.map +1 -1
  65. package/dist/types/features/utils/agent-session.d.ts.map +1 -1
  66. package/dist/types/features/utils/aggregate-base.d.ts +10 -0
  67. package/dist/types/features/utils/aggregate-base.d.ts.map +1 -1
  68. package/dist/types/features/utils/event-buffer.d.ts +5 -2
  69. package/dist/types/features/utils/event-buffer.d.ts.map +1 -1
  70. package/dist/types/features/utils/event-store-manager.d.ts +3 -3
  71. package/dist/types/features/utils/event-store-manager.d.ts.map +1 -1
  72. package/package.json +2 -1
  73. package/src/common/aggregate/event-aggregator.js +4 -0
  74. package/src/common/config/runtime.js +2 -0
  75. package/src/common/constants/agent-constants.js +1 -1
  76. package/src/common/event-emitter/contextual-ee.js +3 -2
  77. package/src/common/util/attribute-size.js +24 -0
  78. package/src/features/ajax/aggregate/index.js +7 -0
  79. package/src/features/generic_events/aggregate/index.js +1 -12
  80. package/src/features/generic_events/constants.js +0 -2
  81. package/src/features/logging/aggregate/index.js +3 -20
  82. package/src/features/page_view_timing/aggregate/index.js +3 -0
  83. package/src/features/soft_navigations/aggregate/ajax-node.js +4 -4
  84. package/src/features/soft_navigations/aggregate/bel-node.js +0 -5
  85. package/src/features/soft_navigations/aggregate/index.js +13 -10
  86. package/src/features/soft_navigations/aggregate/initial-page-load-interaction.js +1 -1
  87. package/src/features/soft_navigations/aggregate/interaction.js +14 -8
  88. package/src/features/utils/agent-session.js +13 -2
  89. package/src/features/utils/aggregate-base.js +22 -2
  90. package/src/features/utils/event-buffer.js +12 -3
  91. package/src/features/utils/event-store-manager.js +7 -7
@@ -2,7 +2,7 @@
2
2
  * Copyright 2020-2025 New Relic, Inc. All rights reserved.
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
- export const IDEAL_PAYLOAD_SIZE: 64000;
5
+ export const IDEAL_PAYLOAD_SIZE: 16000;
6
6
  export const MAX_PAYLOAD_SIZE: 1000000;
7
7
  export const DEFAULT_KEY: "NR_CONTAINER_AGENT";
8
8
  //# sourceMappingURL=agent-constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"contextual-ee.d.ts","sourceRoot":"","sources":["../../../../src/common/event-emitter/contextual-ee.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAWA,+BAA0C;AA6ExC,+FAsBC;AAqBD,6CAEC;AAND,2CAEC;AAMD,mEAaC;AA5FD,+BAKC;AAyFD,iDAGC;AA3HD,qCAA2B"}
1
+ {"version":3,"file":"contextual-ee.d.ts","sourceRoot":"","sources":["../../../../src/common/event-emitter/contextual-ee.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAWA,+BAA0C;AA6ExC,+FAuBC;AAqBD,6CAEC;AAND,2CAEC;AAMD,mEAaC;AA7FD,+BAKC;AA0FD,iDAGC;AA5HD,qCAA2B"}
@@ -0,0 +1,4 @@
1
+ export function trackObjectAttributeSize(parent: any, object: any): {
2
+ bytes: number;
3
+ };
4
+ //# sourceMappingURL=attribute-size.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attribute-size.d.ts","sourceRoot":"","sources":["../../../../src/common/util/attribute-size.js"],"names":[],"mappings":"AAMA;;EAiBC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/ajax/aggregate/index.js"],"names":[],"mappings":"AAcA;IACE,2BAAiC;IAEjC,2BAwBC;IArBC,mBAAwB;IAuB1B,6FA0EC;IAED,iDA6CC;CACF;8BA3J6B,4BAA4B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/ajax/aggregate/index.js"],"names":[],"mappings":"AAcA;IACE,2BAAiC;IAEjC,2BA+BC;IA5BC,mBAAwB;IA8B1B,6FA0EC;IAED,iDA6CC;CACF;8BAlK6B,4BAA4B"}
@@ -1,7 +1,6 @@
1
1
  export class Aggregate extends AggregateBase {
2
2
  static featureName: string;
3
3
  constructor(agentRef: any);
4
- eventsPerHarvest: number;
5
4
  referrerUrl: string | undefined;
6
5
  userActionAggregator: UserActionsAggregator;
7
6
  /** Some keys are set by the query params or request headers sent with the harvest and override the body values, so check those before adding new standard body values...
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/generic_events/aggregate/index.js"],"names":[],"mappings":"AAkBA;IACE,2BAAiC;IACjC,2BA4NC;IA1NC,yBAA4B;IAC5B,gCAAkG;IAwC9F,4CAAuD;IAoL7D;;;;;;;;;;;;OAYG;IACH,eAJW,MAAM,YAAC,qBACP,MAAM,YAAC,QA0CjB;IAED,qCAEC;IAED;;;MAEC;IAED,gCAEC;IAED,mCASC;CACF;8BAvT6B,4BAA4B;sCAMpB,wCAAwC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/generic_events/aggregate/index.js"],"names":[],"mappings":"AAiBA;IACE,2BAAiC;IACjC,2BA2NC;IAzNC,gCAAkG;IAwC9F,4CAAuD;IAoL7D;;;;;;;;;;;;OAYG;IACH,eAJW,MAAM,YAAC,qBACP,MAAM,YAAC,QAiCjB;IAED,qCAEC;IAED;;;MAEC;IAED,gCAEC;IAED,mCASC;CACF;8BA5S6B,4BAA4B;sCAKpB,wCAAwC"}
@@ -1,6 +1,4 @@
1
1
  export const FEATURE_NAME: string;
2
- export const IDEAL_PAYLOAD_SIZE: 64000;
3
- export const MAX_PAYLOAD_SIZE: 1000000;
4
2
  export const OBSERVED_EVENTS: string[];
5
3
  export const OBSERVED_WINDOW_EVENTS: string[];
6
4
  export const RAGE_CLICK_THRESHOLD_EVENTS: 4;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/features/generic_events/constants.js"],"names":[],"mappings":"AAMA,kCAAuD;AACvD,iCAAkC,KAAK,CAAA;AACvC,+BAAgC,OAAO,CAAA;AAEvC,uCAA6F;AAC7F,8CAAuD;AAEvD,0CAA2C,CAAC,CAAA;AAC5C,sCAAuC,IAAI,CAAA;AAE3C,4CAAsF"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/features/generic_events/constants.js"],"names":[],"mappings":"AAMA,kCAAuD;AAEvD,uCAA6F;AAC7F,8CAAuD;AAEvD,0CAA2C,CAAC,CAAA;AAC5C,sCAAuC,IAAI,CAAA;AAE3C,4CAAsF"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/logging/aggregate/index.js"],"names":[],"mappings":"AAkBA;IACE,2BAAiC;IACjC,2BAmCC;IAjCC,8BAAmG;IAU5F,iBAAmC;IAyB5C,0CAKC;IAED,4HAwDC;IAED;;YAKM,0FAA0F;;;QAoB5F,0DAA0D;;QAM7D;IAED;;MAGC;IAED,yDAAyD;IACzD,yBASC;IAED,yCAIC;CACF;8BA1K6B,4BAA4B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/logging/aggregate/index.js"],"names":[],"mappings":"AAiBA;IACE,2BAAiC;IACjC,2BAqCC;IAnCC,8BAAmG;IAY5F,iBAAmC;IAyB5C,0CAKC;IAED,4HAsCC;IAED;;YAKM,0FAA0F;;;QAoB5F,0DAA0D;;QAM7D;IAED;;MAGC;IAED,yDAAyD;IACzD,yBASC;IAED,yCAIC;CACF;8BAzJ6B,4BAA4B"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/page_view_timing/aggregate/index.js"],"names":[],"mappings":"AAsBA;IACE,2BAAiC;IAMjC,2BA4BC;IA1BC,4BAA+B;IAC/B,0BAA6B;IA2B/B;;;OAGG;IACH,6BAFW,MAAM,QAOhB;IAED;;;;MA6BC;IAED;;;OAGG;IACH,4BAFa,IAAI,CAahB;IAED,gDAUC;IAED,4BAGC;IAGD,qCAuBC;;CACF;8BAtJ6B,4BAA4B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/page_view_timing/aggregate/index.js"],"names":[],"mappings":"AAsBA;IACE,2BAAiC;IAMjC,2BA8BC;IA5BC,4BAA+B;IAC/B,0BAA6B;IA6B/B;;;OAGG;IACH,6BAFW,MAAM,QAOhB;IAED;;;;MA6BC;IAED;;;OAGG;IACH,4BAFa,IAAI,CAahB;IAED,gDAUC;IAED,4BAGC;IAGD,qCAwBC;;CACF;8BAzJ6B,4BAA4B"}
@@ -1,5 +1,5 @@
1
1
  export class AjaxNode extends BelNode {
2
- constructor(agentRef: any, ajaxEvent: any);
2
+ constructor(ajaxEvent: any);
3
3
  belType: number;
4
4
  method: any;
5
5
  status: any;
@@ -12,7 +12,7 @@ export class AjaxNode extends BelNode {
12
12
  traceId: any;
13
13
  spanTimestamp: any;
14
14
  gql: any;
15
- serialize(parentStartTimestamp: any): string;
15
+ serialize(parentStartTimestamp: any, agentRef: any): string;
16
16
  }
17
17
  import { BelNode } from './bel-node';
18
18
  //# sourceMappingURL=ajax-node.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ajax-node.d.ts","sourceRoot":"","sources":["../../../../../src/features/soft_navigations/aggregate/ajax-node.js"],"names":[],"mappings":"AAQA;IACE,2CAiBC;IAfC,gBAA6B;IAC7B,YAA8B;IAC9B,YAA8B;IAC9B,YAA8B;IAC9B,UAA0B;IAC1B,YAAmC;IACnC,YAAoC;IACpC,+BAAwD;IACxD,YAA8B;IAC9B,aAAgC;IAChC,mBAA4C;IAC5C,SAAwB;IAM1B,6CA+BC;CACF;wBAtDuB,YAAY"}
1
+ {"version":3,"file":"ajax-node.d.ts","sourceRoot":"","sources":["../../../../../src/features/soft_navigations/aggregate/ajax-node.js"],"names":[],"mappings":"AAQA;IACE,4BAiBC;IAfC,gBAA6B;IAC7B,YAA8B;IAC9B,YAA8B;IAC9B,YAA8B;IAC9B,UAA0B;IAC1B,YAAmC;IACnC,YAAoC;IACpC,+BAAwD;IACxD,YAA8B;IAC9B,aAAgC;IAChC,mBAA4C;IAC5C,SAAwB;IAM1B,4DA+BC;CACF;wBAtDuB,YAAY"}
@@ -1,5 +1,4 @@
1
1
  export class BelNode {
2
- constructor(agentRef: any);
3
2
  belType: any;
4
3
  /** List of other BelNode derivatives. Each children should be of a subclass that implements its own 'serialize' function. */
5
4
  children: any[];
@@ -8,8 +7,6 @@ export class BelNode {
8
7
  callbackEnd: number;
9
8
  callbackDuration: number;
10
9
  nodeId: number;
11
- obfuscator: any;
12
- info: any;
13
10
  addChild(child: any): void;
14
11
  /** Virtual fn for stringifying an instance. */
15
12
  serialize(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"bel-node.d.ts","sourceRoot":"","sources":["../../../../../src/features/soft_navigations/aggregate/bel-node.js"],"names":[],"mappings":"AAMA;IAUE,2BAGC;IAZD,aAAO;IACP,6HAA6H;IAC7H,gBAAa;IACb,WAAK;IACL,SAAG;IACH,oBAAe;IACf,yBAAoB;IACpB,eAAoB;IAGlB,gBAA6C;IAC7C,UAAyB;IAG3B,2BAEC;IAED,+CAA+C;IAC/C,kBAAe;CAChB"}
1
+ {"version":3,"file":"bel-node.d.ts","sourceRoot":"","sources":["../../../../../src/features/soft_navigations/aggregate/bel-node.js"],"names":[],"mappings":"AAMA;IACE,aAAO;IACP,6HAA6H;IAC7H,gBAAa;IACb,WAAK;IACL,SAAG;IACH,oBAAe;IACf,yBAAoB;IACpB,eAAoB;IAEpB,2BAEC;IAED,+CAA+C;IAC/C,kBAAe;CAChB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/soft_navigations/aggregate/index.js"],"names":[],"mappings":"AAeA;IACE,2BAAiC;IACjC;;OAoDC;IAjDC,2BAAwC;IACxC,iBAA8B;IAE9B,uDAA0E;IAe1E,yBAA+B;IAC/B,0CAAiC;IACjC,sBAA4B;IA+B9B,qCAUC;IAED,0EAiBC;IAED,2BAiBC;IAED;;;;;;;OAOG;IACH,6BAHW,mBAAmB,OAqB7B;;CA6FF;8BAvO6B,4BAA4B;2CAGf,iCAAiC;4BAChD,eAAe"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/soft_navigations/aggregate/index.js"],"names":[],"mappings":"AAeA;IACE,2BAAiC;IACjC;;OAsDC;IAjDC,2BAAwC;IACxC,iBAA8B;IAE9B,uDAA0E;IAe1E,yBAA+B;IAC/B,0CAAiC;IACjC,sBAA4B;IA+B9B,qCAUC;IAED,0EAiBC;IAED,2BAiBC;IAED;;;;;;;OAOG;IACH,6BAHW,mBAAmB,OAsB7B;;CA6FF;8BA1O6B,4BAA4B;2CAGf,iCAAiC;4BAChD,eAAe"}
@@ -2,7 +2,7 @@
2
2
  * link https://github.com/newrelic/nr-querypack/blob/main/schemas/bel/7.qpschema
3
3
  **/
4
4
  export class Interaction extends BelNode {
5
- constructor(agentRef: any, uiEvent: any, uiEventTimestamp: any, currentRouteKnown: any, currentUrl: any);
5
+ constructor(uiEvent: any, uiEventTimestamp: any, currentRouteKnown: any, currentUrl: any);
6
6
  id: string;
7
7
  initialPageURL: string;
8
8
  customName: any;
@@ -42,7 +42,13 @@ export class Interaction extends BelNode {
42
42
  get firstPaint(): void;
43
43
  get firstContentfulPaint(): void;
44
44
  get navTiming(): void;
45
- serialize(firstStartTimeOfPayload: any): string;
45
+ /**
46
+ * Serializes (BEL) the interaction data for transmission.
47
+ * @param {Number} firstStartTimeOfPayload timestamp
48
+ * @param {Agent} agentRef Pass in the agent reference directly so that the event itself doesnt need to store the pointers and ruin the evaluation of the event size by including unused object references.
49
+ * @returns {String} A string that is the serialized representation of this interaction.
50
+ */
51
+ serialize(firstStartTimeOfPayload: number, agentRef: Agent): string;
46
52
  #private;
47
53
  }
48
54
  import { BelNode } from './bel-node';
@@ -1 +1 @@
1
- {"version":3,"file":"interaction.d.ts","sourceRoot":"","sources":["../../../../../src/features/soft_navigations/aggregate/interaction.js"],"names":[],"mappings":"AAYA;;IAEI;AACJ;IAkBE,yGAaC;IA9BD,WAAmB;IACnB,uBAAgC;IAChC,gBAAU;IACV,qBAAqB;IACrB,oBAAoB;IACpB,eAAS;IACT,aAAO;IACP,cAAQ;IACR,+EAA+E;IAC/E,eAA8B;IAC9B,qBAAgB;IAChB,yBAAoB;IACpB,sBAAoB;IACpB,6BAA2B;IAC3B,cAAW;IACX,uBAAiB;IAIf,gBAAoC;IACpC,aAAsB;IAEtB,cAAiC;IACjC,wCAGE;IACF,mBAAyC;IAAxB,qBAAwB;IAEzC,YAAsE;IAAxD,YAAwD;IAGxE,gCAEC;IAED,iDAGC;IAED,mCAEC;IAED,8BAIC;IAED,kCAaC;IAsBD;;;;;OAKG;IACH,0BAHW,mBAAmB,WAM7B;IAGD,uBAAoB;IACpB,iCAA8B;IAC9B,sBAAmB;IAEnB,gDA4CC;;CACF;wBAzJuB,YAAY"}
1
+ {"version":3,"file":"interaction.d.ts","sourceRoot":"","sources":["../../../../../src/features/soft_navigations/aggregate/interaction.js"],"names":[],"mappings":"AAYA;;IAEI;AACJ;IAkBE,0FAaC;IA9BD,WAAmB;IACnB,uBAAgC;IAChC,gBAAU;IACV,qBAAqB;IACrB,oBAAoB;IACpB,eAAS;IACT,aAAO;IACP,cAAQ;IACR,+EAA+E;IAC/E,eAA8B;IAC9B,qBAAgB;IAChB,yBAAoB;IACpB,sBAAoB;IACpB,6BAA2B;IAC3B,cAAW;IACX,uBAAiB;IAIf,gBAAoC;IACpC,aAAsB;IAEtB,cAAiC;IACjC,wCAGE;IACF,mBAAyC;IAAxB,qBAAwB;IAEzC,YAAsE;IAAxD,YAAwD;IAGxE,gCAEC;IAED,iDAGC;IAED,mCAEC;IAED,8BAIC;IAED,kCAaC;IAqBD;;;;;OAKG;IACH,0BAHW,mBAAmB,WAM7B;IAGD,uBAAoB;IACpB,iCAA8B;IAC9B,sBAAmB;IAEnB;;;;;OAKG;IACH,qDAHW,KAAK,UAgDf;;CACF;wBA/JuB,YAAY"}
@@ -1 +1 @@
1
- {"version":3,"file":"agent-session.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/agent-session.js"],"names":[],"mappings":"AAWA,sDAuCC"}
1
+ {"version":3,"file":"agent-session.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/agent-session.js"],"names":[],"mappings":"AAaA,sDAgDC"}
@@ -6,8 +6,18 @@ export class AggregateBase extends FeatureBase {
6
6
  */
7
7
  constructor(agentRef: Object, featureName: string);
8
8
  agentRef: Object;
9
+ /** @type {Boolean} indicates if custom attributes are combined in each event payload for size estimation purposes. this is set to true in derived classes that need to evaluate custom attributes separately from the event payload */
10
+ customAttributesAreSeparate: boolean;
11
+ /** @type {Boolean} indicates if the feature can harvest early. This is set to false in derived classes that need to block early harvests, like ajax under certain conditions */
12
+ canHarvestEarly: boolean;
9
13
  harvestOpts: {};
10
14
  events: any;
15
+ /**
16
+ * Evaluates whether a harvest should be made early by estimating the size of the current payload. Currently, this only happens if the event storage is EventBuffer, since that triggers this method directly.
17
+ * If conditions are met, a new harvest will be triggered immediately.
18
+ * @returns void
19
+ */
20
+ decideEarlyHarvest(): void;
11
21
  /**
12
22
  * New handler for waiting for multiple flags. Useful when expecting multiple flags simultaneously (ex. stn vs sr)
13
23
  * @param {string[]} flagNames
@@ -1 +1 @@
1
- {"version":3,"file":"aggregate-base.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/aggregate-base.js"],"names":[],"mappings":"AAqBA;IACE;;;;OAIG;IACH,sBAHW,MAAM,eACN,MAAM,EAoBhB;IAhBC,iBAAwB;IAIxB,gBAAqB;IA6BjB,YAAuI;IAW7I;;;;OAIG;IACH,yBAHW,MAAM,EAAE,gBAwBlB;IAED;;OAEG;IACH,cAGC;IADC,6BAAmB;IAGrB,qCAEC;IAED;;;;;;OAMG;IACH,uDAJW,MAAM,GAAC,SAAS,SAyB1B;IAED;;;;;;;OAOG;IACH,4BALG;QAAwB,SAAS,GAAzB,MAAM,YAAC;KACf,QAQF;IAED;;;OAGG;IACH,6CAsBC;IAED;;;OAGG;IACH,2CAOC;IALC,gBAA6C;IAO/C;;;;OAIG;IACH,uCAHW,GAAC,UACD,GAAC,QAIX;;CACF;4BA1M2B,gBAAgB"}
1
+ {"version":3,"file":"aggregate-base.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/aggregate-base.js"],"names":[],"mappings":"AAsBA;IACE;;;;OAIG;IACH,sBAHW,MAAM,eACN,MAAM,EAyBhB;IArBC,iBAAwB;IAIxB,uOAAuO;IACvO,qCAAwC;IACxC,gLAAgL;IAChL,yBAA2B;IAE3B,gBAAqB;IA6BjB,YAAwJ;IAW9J;;;;OAIG;IACH,2BAOC;IAED;;;;OAIG;IACH,yBAHW,MAAM,EAAE,gBAwBlB;IAED;;OAEG;IACH,cAGC;IADC,6BAAmB;IAGrB,qCAEC;IAED;;;;;;OAMG;IACH,uDAJW,MAAM,GAAC,SAAS,SAyB1B;IAED;;;;;;;OAOG;IACH,4BALG;QAAwB,SAAS,GAAzB,MAAM,YAAC;KACf,QAQF;IAED;;;OAGG;IACH,6CAsBC;IAED;;;OAGG;IACH,2CAOC;IALC,gBAA6C;IAO/C;;;;OAIG;IACH,uCAHW,GAAC,UACD,GAAC,QAIX;;CACF;4BA9N2B,gBAAgB"}
@@ -1,9 +1,12 @@
1
1
  export class EventBuffer {
2
2
  /**
3
- * @param {number} maxPayloadSize
3
+ * Creates an event buffer that can hold feature-processed events.
4
+ * @param {Number} maxPayloadSize The maximum size of the payload that can be stored in this buffer.
5
+ * @param {Object} [featureAgg] - the feature aggregate instance
4
6
  */
5
- constructor(maxPayloadSize?: number);
7
+ constructor(maxPayloadSize?: number, featureAgg?: Object);
6
8
  maxPayloadSize: number;
9
+ featureAgg: Object | undefined;
7
10
  isEmpty(): boolean;
8
11
  get(): any[];
9
12
  byteSize(): number;
@@ -1 +1 @@
1
- {"version":3,"file":"event-buffer.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/event-buffer.js"],"names":[],"mappings":"AAOA;IAME;;OAEG;IACH,6BAFW,MAAM,EAIhB;IADC,uBAAoC;IAGtC,mBAEC;IAED,aAEC;IAED,mBAEC;IAED,+CAEC;IAED;;;;OAIG;IACH,WAHW,GAAG,WASb;IAED;;OAEG;IACH,cAGC;IAED;;OAEG;IACH,aAGC;IAED;;OAEG;IACH,kBAGC;IAED;;OAEG;IACH,mBAKC;;CACF"}
1
+ {"version":3,"file":"event-buffer.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/event-buffer.js"],"names":[],"mappings":"AAOA;IAME;;;;OAIG;IACH,kDAFW,MAAM,EAKhB;IAFC,uBAAoC;IACpC,+BAA4B;IAG9B,mBAEC;IAED,aAEC;IAED,mBAEC;IAED,+CAEC;IAED;;;;OAIG;IACH,WAHW,GAAG,WAeb;IAED;;OAEG;IACH,cAGC;IAED;;OAEG;IACH,aAGC;IAED;;OAEG;IACH,kBAGC;IAED;;OAEG;IACH,mBAKC;;CACF"}
@@ -7,14 +7,14 @@ export class EventStoreManager {
7
7
  * @param {object} agentRef - reference to base agent class
8
8
  * @param {EventBuffer|EventAggregator} storageClass - the type of storage to use in this manager; 'EventBuffer' (1), 'EventAggregator' (2)
9
9
  * @param {string} [defaultEntityGuid] - the entity guid to use as the default storage instance; if not provided, a new one is created
10
- * @param {string} featureName - the name of the feature this manager is for; used for event dispatching
10
+ * @param {Object} featureAgg - the feature aggregate instance that initialized this manager
11
11
  */
12
- constructor(agentRef: object, storageClass: EventBuffer | EventAggregator, defaultEntityGuid?: string, featureName: string);
12
+ constructor(agentRef: object, storageClass: EventBuffer | EventAggregator, defaultEntityGuid?: string, featureAgg: Object);
13
13
  agentRef: object;
14
14
  entityManager: any;
15
15
  StorageClass: any;
16
16
  appStorageMap: Map<string, any>;
17
- featureName: string;
17
+ featureAgg: Object;
18
18
  setEventStore(targetEntityGuid: any): void;
19
19
  /**
20
20
  * Calls the isEmpty method on the underlying storage class. If target is provided, runs just for the target, otherwise runs for all apps.
@@ -1 +1 @@
1
- {"version":3,"file":"event-store-manager.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/event-store-manager.js"],"names":[],"mappings":"AAQA;;;GAGG;AACH;IACE;;;;;OAKG;IACH,sBALW,MAAM,gBACN,WAAW,GAAC,eAAe,sBAC3B,MAAM,eACN,MAAM,EAShB;IANC,iBAAwB;IACxB,mBAAmD;IACnD,kBAAgC;IAChC,gCAAsE;IACtE,oBAA8B;IAchC,2CAQC;IAID;;;;;OAKG;IACH,uBAJW,MAAM,0BAEJ,OAAO,CASnB;IAED;;;;;OAKG;IACH,WAJW,MAAM,oBACN,MAAM,GACJ,OAAO,CAYnB;IAED,0GAA0G;IAC1G,8DAEC;IAED;;;;;OAKG;IACH,WAJW,MAAM,YAAC,gCAgBjB;IAED;;;;OAIG;IACH,2BAHW,GAAC,OAKX;IAED;;;;;OAKG;IACH,iCAJW,GAAC,oBACD,GAAC,OAKX;IAED;;;;;OAKG;IACH,oBAJW,GAAC,oBACD,GAAC,OAMX;IAED;;;;;OAKG;IACH,qBAJW,GAAC,oBACD,GAAC,OAMX;IAGD,2DAEC;IAED,0DAEC;;CACF"}
1
+ {"version":3,"file":"event-store-manager.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/event-store-manager.js"],"names":[],"mappings":"AAQA;;;GAGG;AACH;IACE;;;;;OAKG;IACH,sBALW,MAAM,gBACN,WAAW,GAAC,eAAe,sBAC3B,MAAM,cACN,MAAM,EAShB;IANC,iBAAwB;IACxB,mBAAmD;IACnD,kBAAgC;IAChC,gCAAkG;IAClG,mBAA4B;IAc9B,2CAQC;IAID;;;;;OAKG;IACH,uBAJW,MAAM,0BAEJ,OAAO,CASnB;IAED;;;;;OAKG;IACH,WAJW,MAAM,oBACN,MAAM,GACJ,OAAO,CAYnB;IAED,0GAA0G;IAC1G,8DAEC;IAED;;;;;OAKG;IACH,WAJW,MAAM,YAAC,gCAgBjB;IAED;;;;OAIG;IACH,2BAHW,GAAC,OAKX;IAED;;;;;OAKG;IACH,iCAJW,GAAC,oBACD,GAAC,OAKX;IAED;;;;;OAKG;IACH,oBAJW,GAAC,oBACD,GAAC,OAMX;IAED;;;;;OAKG;IACH,qBAJW,GAAC,oBACD,GAAC,OAMX;IAGD,2DAEC;IAED,0DAEC;;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newrelic/browser-agent",
3
- "version": "1.293.0-rc.3",
3
+ "version": "1.293.0-rc.5",
4
4
  "private": false,
5
5
  "author": "New Relic Browser Agent Team <browser-agent@newrelic.com>",
6
6
  "description": "New Relic Browser Agent",
@@ -189,6 +189,7 @@
189
189
  "test:component": "jest --selectProjects component",
190
190
  "test:types": "tsd -f ./tests/dts/**/*.ts",
191
191
  "wdio": "node --max-old-space-size=8192 tools/wdio/bin/cli.js",
192
+ "wdio:smoke": "node --max-old-space-size=8192 tools/wdio/bin/cli.js -T --concurrent=30",
192
193
  "build:all": "npm run cdn:build:local && npm run build:npm && npm run tools:test-builds",
193
194
  "build:browser-agent-wrapper": "npm run cdn:build:local && npm run build:npm && npm --prefix tools/test-builds/browser-agent-wrapper run build",
194
195
  "build:npm": "npm run npm:build:esm && npm run npm:build:cjs && npm run npm:build:types && npm run npm:pack",
@@ -12,6 +12,10 @@ export class EventAggregator {
12
12
  #aggregator = new Aggregator()
13
13
  #savedNamesToBuckets = {}
14
14
 
15
+ byteSize () {
16
+ return 0 // EventAggregator does not currently track byte size like EventBuffer does, but will in a future update. This is a placeholder to maintain interface consistency.
17
+ }
18
+
15
19
  isEmpty ({ aggregatorTypes }) {
16
20
  if (!aggregatorTypes) return Object.keys(this.#aggregator.aggregatedData).length === 0
17
21
  return aggregatorTypes.every(type => !this.#aggregator.aggregatedData[type]) // no bucket exist for any of the types we're looking for
@@ -37,6 +37,8 @@ const RuntimeModel = {
37
37
  releaseIds: {},
38
38
  session: undefined,
39
39
  timeKeeper: undefined,
40
+ /** a proxy is set in agent-session to track jsAttributes changes for harvesting mechanics */
41
+ jsAttributesMetadata: { bytes: 0 },
40
42
  get harvestCount () { return ++_harvestCount }
41
43
  }
42
44
 
@@ -2,6 +2,6 @@
2
2
  * Copyright 2020-2025 New Relic, Inc. All rights reserved.
3
3
  * SPDX-License-Identifier: Apache-2.0
4
4
  */
5
- export const IDEAL_PAYLOAD_SIZE = 64000
5
+ export const IDEAL_PAYLOAD_SIZE = 16000
6
6
  export const MAX_PAYLOAD_SIZE = 1000000
7
7
  export const DEFAULT_KEY = 'NR_CONTAINER_AGENT'
@@ -93,12 +93,13 @@ function ee (old, debugId) {
93
93
 
94
94
  var ctx = context(contextOrStore)
95
95
  var handlersArray = listeners(type)
96
- var len = handlersArray.length
97
96
 
98
97
  // Apply each handler function in the order they were added
99
98
  // to the context with the arguments
100
99
 
101
- for (var i = 0; i < len; i++) handlersArray[i].apply(ctx, args)
100
+ handlersArray.forEach((handler) => {
101
+ handler.apply(ctx, args)
102
+ })
102
103
 
103
104
  // Buffer after emitting for consistent ordering
104
105
  var bufferGroup = getBuffer()[bufferGroupMap[type]]
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Copyright 2020-2025 New Relic, Inc. All rights reserved.
3
+ * SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ import { stringify } from './stringify'
6
+
7
+ export function trackObjectAttributeSize (parent, object) {
8
+ const originalAttribute = parent[object] ??= {}
9
+ const output = { bytes: Object.keys(originalAttribute).reduce((acc, key) => acc + key.length + stringify(originalAttribute[key]).length, 0) }
10
+ // proxy attribute to calculate its size when changed
11
+ parent[object] = new Proxy(originalAttribute, {
12
+ set (target, prop, value) {
13
+ output.bytes += prop.length + stringify(value).length
14
+ target[prop] = value
15
+ return true
16
+ },
17
+ deleteProperty (target, prop) {
18
+ output.bytes -= prop.length + stringify(target[prop]).length
19
+ return delete target[prop]
20
+ }
21
+ })
22
+
23
+ return output
24
+ }
@@ -21,6 +21,13 @@ export class Aggregate extends AggregateBase {
21
21
  this.underSpaEvents = {}
22
22
  const classThis = this
23
23
 
24
+ if (!agentRef.init.ajax.block_internal) {
25
+ // if the agent is tracking ITSELF, it can spawn endless ajax requests early if they are large from custom attributes, so we just disable early harvest for ajax in this case.
26
+ super.canHarvestEarly = false
27
+ } else {
28
+ super.customAttributesAreSeparate = true
29
+ }
30
+
24
31
  // --- v Used by old spa feature
25
32
  this.ee.on('interactionDone', (interaction, wasSaved) => {
26
33
  if (!this.underSpaEvents[interaction.id]) return
@@ -10,7 +10,6 @@ import { AggregateBase } from '../../utils/aggregate-base'
10
10
  import { warn } from '../../../common/util/console'
11
11
  import { now } from '../../../common/timing/now'
12
12
  import { registerHandler } from '../../../common/event-emitter/register-handler'
13
- import { SUPPORTABILITY_METRIC_CHANNEL } from '../../metrics/constants'
14
13
  import { applyFnToProps } from '../../../common/util/traverse'
15
14
  import { UserActionsAggregator } from './user-actions/user-actions-aggregator'
16
15
  import { isIFrameWindow } from '../../../common/dom/iframe'
@@ -20,7 +19,6 @@ export class Aggregate extends AggregateBase {
20
19
  static featureName = FEATURE_NAME
21
20
  constructor (agentRef) {
22
21
  super(agentRef, FEATURE_NAME)
23
- this.eventsPerHarvest = 1000
24
22
  this.referrerUrl = (isBrowserScope && document.referrer) ? cleanURL(document.referrer) : undefined
25
23
 
26
24
  this.waitForFlags(['ins']).then(([ins]) => {
@@ -283,16 +281,7 @@ export class Aggregate extends AggregateBase {
283
281
  ...obj
284
282
  }
285
283
 
286
- const addedEvent = this.events.add(eventAttributes, targetEntityGuid)
287
- if (!addedEvent && !this.events.isEmpty(undefined, targetEntityGuid)) {
288
- /** could not add the event because it pushed the buffer over the limit
289
- * so we harvest early, and try to add it again now that the buffer is cleared
290
- * if it fails again, we do nothing
291
- */
292
- this.ee.emit(SUPPORTABILITY_METRIC_CHANNEL, ['GenericEvents/Harvest/Max/Seen'])
293
- this.agentRef.runtime.harvester.triggerHarvestFor(this, { targetEntityGuid })
294
- this.events.add(eventAttributes)
295
- }
284
+ this.events.add(eventAttributes, targetEntityGuid)
296
285
  }
297
286
 
298
287
  serializer (eventBuffer) {
@@ -5,8 +5,6 @@
5
5
  import { FEATURE_NAMES } from '../../loaders/features/features'
6
6
 
7
7
  export const FEATURE_NAME = FEATURE_NAMES.genericEvents
8
- export const IDEAL_PAYLOAD_SIZE = 64000
9
- export const MAX_PAYLOAD_SIZE = 1000000
10
8
 
11
9
  export const OBSERVED_EVENTS = ['auxclick', 'click', 'copy', 'keydown', 'paste', 'scrollend']
12
10
  export const OBSERVED_WINDOW_EVENTS = ['focus', 'blur']
@@ -10,7 +10,6 @@ import { FEATURE_NAME, LOGGING_EVENT_EMITTER_CHANNEL, LOG_LEVELS, LOGGING_MODE }
10
10
  import { Log } from '../shared/log'
11
11
  import { isValidLogLevel } from '../shared/utils'
12
12
  import { applyFnToProps } from '../../../common/util/traverse'
13
- import { MAX_PAYLOAD_SIZE } from '../../../common/constants/agent-constants'
14
13
  import { isContainerAgentTarget } from '../../../common/util/target'
15
14
  import { SESSION_EVENT_TYPES, SESSION_EVENTS } from '../../../common/session/constants'
16
15
  import { ABORT_REASONS } from '../../session_replay/constants'
@@ -22,6 +21,8 @@ export class Aggregate extends AggregateBase {
22
21
  super(agentRef, FEATURE_NAME)
23
22
  this.isSessionTrackingEnabled = canEnableSessionTracking(agentRef.init) && agentRef.runtime.session
24
23
 
24
+ super.customAttributesAreSeparate = true
25
+
25
26
  // The SessionEntity class can emit a message indicating the session was cleared and reset (expiry, inactivity). This feature must abort and never resume if that occurs.
26
27
  this.ee.on(SESSION_EVENTS.RESET, () => {
27
28
  this.abort(ABORT_REASONS.RESET)
@@ -98,26 +99,8 @@ export class Aggregate extends AggregateBase {
98
99
  attributes,
99
100
  level
100
101
  )
101
- const logBytes = log.message.length + stringify(log.attributes).length + log.level.length + 10 // timestamp == 10 chars
102
-
103
- const failToHarvestMessage = 'Logging/Harvest/Failed/Seen'
104
- if (logBytes > MAX_PAYLOAD_SIZE) { // cannot possibly send this, even with an empty buffer
105
- this.reportSupportabilityMetric(failToHarvestMessage, logBytes)
106
- warn(31, log.message.slice(0, 25) + '...')
107
- return
108
- }
109
102
 
110
- if (this.events.wouldExceedMaxSize(logBytes, targetEntityGuid)) {
111
- this.reportSupportabilityMetric('Logging/Harvest/Early/Seen', this.events.byteSize() + logBytes)
112
- this.agentRef.runtime.harvester.triggerHarvestFor(this, { targetEntityGuid }) // force a harvest synchronously to try adding again
113
- }
114
-
115
- if (!this.events.add(log, targetEntityGuid)) { // still failed after a harvest attempt despite not being too large would mean harvest failed with options.retry
116
- this.reportSupportabilityMetric(failToHarvestMessage, logBytes)
117
- warn(31, log.message.slice(0, 25) + '...')
118
- } else {
119
- this.reportSupportabilityMetric('Logging/Event/Added/Seen')
120
- }
103
+ this.events.add(log, targetEntityGuid)
121
104
  }
122
105
 
123
106
  serializer (eventBuffer, targetEntityGuid) {
@@ -32,6 +32,8 @@ export class Aggregate extends AggregateBase {
32
32
  this.curSessEndRecorded = false
33
33
  this.firstIxnRecorded = false
34
34
 
35
+ super.customAttributesAreSeparate = true
36
+
35
37
  registerHandler('docHidden', msTimestamp => this.endCurrentSession(msTimestamp), this.featureName, this.ee)
36
38
  // Add the time of _window pagehide event_ firing to the next PVT harvest == NRDB windowUnload attr:
37
39
  registerHandler('winPagehide', msTimestamp => this.addTiming('unload', msTimestamp, null), this.featureName, this.ee)
@@ -135,6 +137,7 @@ export class Aggregate extends AggregateBase {
135
137
 
136
138
  // serialize array of timing data
137
139
  serializer (eventBuffer) {
140
+ if (!eventBuffer?.length) return ''
138
141
  var addString = getAddStringContext(this.agentRef.runtime.obfuscator)
139
142
 
140
143
  var payload = 'bel.6;'
@@ -7,8 +7,8 @@ import { NODE_TYPE } from '../constants'
7
7
  import { BelNode } from './bel-node'
8
8
 
9
9
  export class AjaxNode extends BelNode {
10
- constructor (agentRef, ajaxEvent) {
11
- super(agentRef)
10
+ constructor (ajaxEvent) {
11
+ super()
12
12
  this.belType = NODE_TYPE.AJAX
13
13
  this.method = ajaxEvent.method
14
14
  this.status = ajaxEvent.status
@@ -26,8 +26,8 @@ export class AjaxNode extends BelNode {
26
26
  this.end = ajaxEvent.endTime
27
27
  }
28
28
 
29
- serialize (parentStartTimestamp) {
30
- const addString = getAddStringContext(this.obfuscator)
29
+ serialize (parentStartTimestamp, agentRef) {
30
+ const addString = getAddStringContext(agentRef.runtime.obfuscator)
31
31
  const nodeList = []
32
32
 
33
33
  // IMPORTANT: The order in which addString is called matters and correlates to the order in which string shows up in the harvest payload. Do not re-order the following code.
@@ -14,11 +14,6 @@ export class BelNode {
14
14
  callbackDuration = 0
15
15
  nodeId = ++nodesSeen
16
16
 
17
- constructor (agentRef) {
18
- this.obfuscator = agentRef.runtime.obfuscator
19
- this.info = agentRef.info
20
- }
21
-
22
17
  addChild (child) {
23
18
  this.children.push(child)
24
19
  }
@@ -18,6 +18,8 @@ export class Aggregate extends AggregateBase {
18
18
  constructor (agentRef, { domObserver }) {
19
19
  super(agentRef, FEATURE_NAME)
20
20
 
21
+ super.customAttributesAreSeparate = true
22
+
21
23
  this.interactionsToHarvest = this.events
22
24
  this.domObserver = domObserver
23
25
 
@@ -26,7 +28,7 @@ export class Aggregate extends AggregateBase {
26
28
  if (agentRef.runtime.session?.isNew) this.initialPageLoadInteraction.customAttributes.isFirstOfSession = true // mark the hard page load as first of its session
27
29
  this.initialPageLoadInteraction.forceSave = true // unless forcibly ignored, iPL always finish by default
28
30
  const ixn = this.initialPageLoadInteraction
29
- this.interactionsToHarvest.add(ixn)
31
+ this.events.add(ixn) // add the iPL ixn to the buffer for harvest
30
32
  this.initialPageLoadInteraction = null
31
33
  })
32
34
  timeToFirstByte.subscribe(({ attrs }) => {
@@ -75,7 +77,7 @@ export class Aggregate extends AggregateBase {
75
77
  let firstIxnStartTime
76
78
  const serializedIxnList = []
77
79
  for (const interaction of eventBuffer) {
78
- serializedIxnList.push(interaction.serialize(firstIxnStartTime))
80
+ serializedIxnList.push(interaction.serialize(firstIxnStartTime, this.agentRef))
79
81
  if (firstIxnStartTime === undefined) firstIxnStartTime = Math.floor(interaction.start) // careful not to match or overwrite on 0 value!
80
82
  }
81
83
  return `bel.7;${serializedIxnList.join(';')}`
@@ -86,7 +88,7 @@ export class Aggregate extends AggregateBase {
86
88
  if (this.interactionInProgress?.done() === false) return // current in-progress is blocked from closing, e.g. by 'waitForEnd' api option
87
89
 
88
90
  const oldURL = eventName === INTERACTION_TRIGGERS[3] ? this.latestHistoryUrl : undefined // see related comment in 'newURL' handler above, 'popstate'
89
- this.interactionInProgress = new Interaction(this.agentRef, eventName, startedAt, this.latestRouteSetByApi, oldURL)
91
+ this.interactionInProgress = new Interaction(eventName, startedAt, this.latestRouteSetByApi, oldURL)
90
92
 
91
93
  if (eventName === INTERACTION_TRIGGERS[0]) { // 'click'
92
94
  const sourceElemText = getActionText(sourceElem)
@@ -103,7 +105,7 @@ export class Aggregate extends AggregateBase {
103
105
  setClosureHandlers () {
104
106
  this.interactionInProgress.on('finished', () => {
105
107
  const ref = this.interactionInProgress
106
- this.interactionsToHarvest.add(this.interactionInProgress)
108
+ this.events.add(this.interactionInProgress) // add the ixn to the buffer for harvest
107
109
  this.interactionInProgress = null
108
110
  this.domObserver.disconnect() // can stop observing whenever our interaction logic completes a cycle
109
111
 
@@ -133,7 +135,8 @@ export class Aggregate extends AggregateBase {
133
135
  */
134
136
  if (this.interactionInProgress?.isActiveDuring(timestamp)) return this.interactionInProgress
135
137
  let saveIxn
136
- const [{ data: interactionsBuffer }] = this.interactionsToHarvest.get()
138
+ const interactionsBuffer = this.interactionsToHarvest.get()?.[0]?.data
139
+ if (!interactionsBuffer) return undefined // no interactions have been staged yet, so nothing to search through)
137
140
  for (let idx = interactionsBuffer.length - 1; idx >= 0; idx--) { // reverse search for the latest completed interaction for efficiency
138
141
  const finishedInteraction = interactionsBuffer[idx]
139
142
  if (finishedInteraction.isActiveDuring(timestamp)) {
@@ -156,15 +159,15 @@ export class Aggregate extends AggregateBase {
156
159
  if (!associatedInteraction) { // no interaction was happening when this ajax started, so give it back to Ajax feature for processing
157
160
  handle('returnAjax', [event], undefined, FEATURE_NAMES.ajax, this.ee)
158
161
  } else {
159
- if (associatedInteraction.status === INTERACTION_STATUS.FIN) processAjax(this.agentRef, event, associatedInteraction) // tack ajax onto the ixn object awaiting harvest
162
+ if (associatedInteraction.status === INTERACTION_STATUS.FIN) processAjax(event, associatedInteraction) // tack ajax onto the ixn object awaiting harvest
160
163
  else { // same thing as above, just at a later time -- if the interaction in progress is cancelled, just send the event back to ajax feat unmodified
161
- associatedInteraction.on('finished', () => processAjax(this.agentRef, event, associatedInteraction))
164
+ associatedInteraction.on('finished', () => processAjax(event, associatedInteraction))
162
165
  associatedInteraction.on('cancelled', () => handle('returnAjax', [event], undefined, FEATURE_NAMES.ajax, this.ee))
163
166
  }
164
167
  }
165
168
 
166
- function processAjax (agent, event, parentInteraction) {
167
- const newNode = new AjaxNode(agent, event)
169
+ function processAjax (event, parentInteraction) {
170
+ const newNode = new AjaxNode(event)
168
171
  parentInteraction.addChild(newNode)
169
172
  }
170
173
  }
@@ -205,7 +208,7 @@ export class Aggregate extends AggregateBase {
205
208
  if (this.associatedInteraction?.trigger === IPL_TRIGGER_NAME) this.associatedInteraction = null // the api get-interaction method cannot target IPL
206
209
  if (!this.associatedInteraction) {
207
210
  // This new api-driven interaction will be the target of any subsequent .interaction() call, until it is closed by EITHER .end() OR the regular seenHistoryAndDomChange process.
208
- this.associatedInteraction = thisClass.interactionInProgress = new Interaction(thisClass.agentRef, API_TRIGGER_NAME, time, thisClass.latestRouteSetByApi)
211
+ this.associatedInteraction = thisClass.interactionInProgress = new Interaction(API_TRIGGER_NAME, time, thisClass.latestRouteSetByApi)
209
212
  thisClass.domObserver.observe(document.body, { attributes: true, childList: true, subtree: true, characterData: true }) // start observing for DOM changes like a regular UI-driven interaction
210
213
  thisClass.setClosureHandlers()
211
214
  }
@@ -11,7 +11,7 @@ import { IPL_TRIGGER_NAME } from '../constants'
11
11
 
12
12
  export class InitialPageLoadInteraction extends Interaction {
13
13
  constructor (agentRef) {
14
- super(agentRef, IPL_TRIGGER_NAME, 0, null)
14
+ super(IPL_TRIGGER_NAME, 0, null)
15
15
  this.queueTime = agentRef.info.queueTime
16
16
  this.appTime = agentRef.info.applicationTime
17
17
  /** @type {string|undefined} we assign as undefined if no referrer value is available so that URL grouping is not applied to an empty string at ingest */