@newrelic/browser-agent 1.302.0-rc.0 → 1.302.0-rc.10

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 (116) hide show
  1. package/dist/cjs/common/config/init-types.js +2 -0
  2. package/dist/cjs/common/config/init.js +3 -0
  3. package/dist/cjs/common/constants/env.cdn.js +1 -1
  4. package/dist/cjs/common/constants/env.npm.js +1 -1
  5. package/dist/cjs/common/harvest/harvester.js +13 -9
  6. package/dist/cjs/common/harvest/types.js +0 -1
  7. package/dist/cjs/common/session/session-entity.js +4 -2
  8. package/dist/cjs/common/util/mfe.js +4 -0
  9. package/dist/cjs/common/wrap/wrap-promise.js +10 -5
  10. package/dist/cjs/features/generic_events/aggregate/index.js +4 -4
  11. package/dist/cjs/features/logging/aggregate/index.js +1 -2
  12. package/dist/cjs/features/page_view_event/aggregate/index.js +84 -22
  13. package/dist/cjs/features/page_view_event/instrument/index.js +0 -4
  14. package/dist/cjs/features/session_replay/aggregate/index.js +3 -2
  15. package/dist/cjs/features/session_replay/constants.js +2 -6
  16. package/dist/cjs/features/session_replay/instrument/index.js +3 -2
  17. package/dist/cjs/features/utils/agent-session.js +13 -0
  18. package/dist/cjs/features/utils/instrument-base.js +7 -8
  19. package/dist/cjs/interfaces/registered-entity.js +21 -0
  20. package/dist/cjs/loaders/agent.js +2 -0
  21. package/dist/cjs/loaders/api/consent.js +24 -0
  22. package/dist/cjs/loaders/api/constants.js +3 -2
  23. package/dist/cjs/loaders/api/measure.js +36 -35
  24. package/dist/cjs/loaders/api/recordCustomEvent.js +5 -3
  25. package/dist/cjs/loaders/api/register-api-types.js +10 -9
  26. package/dist/cjs/loaders/api/register.js +16 -0
  27. package/dist/cjs/loaders/api-base.js +14 -7
  28. package/dist/esm/common/config/init-types.js +2 -0
  29. package/dist/esm/common/config/init.js +3 -0
  30. package/dist/esm/common/constants/env.cdn.js +1 -1
  31. package/dist/esm/common/constants/env.npm.js +1 -1
  32. package/dist/esm/common/harvest/harvester.js +13 -9
  33. package/dist/esm/common/harvest/types.js +0 -1
  34. package/dist/esm/common/session/session-entity.js +4 -2
  35. package/dist/esm/common/util/mfe.js +3 -0
  36. package/dist/esm/common/wrap/wrap-promise.js +10 -5
  37. package/dist/esm/features/generic_events/aggregate/index.js +4 -4
  38. package/dist/esm/features/logging/aggregate/index.js +1 -2
  39. package/dist/esm/features/page_view_event/aggregate/index.js +84 -22
  40. package/dist/esm/features/page_view_event/instrument/index.js +0 -4
  41. package/dist/esm/features/session_replay/aggregate/index.js +4 -3
  42. package/dist/esm/features/session_replay/constants.js +1 -5
  43. package/dist/esm/features/session_replay/instrument/index.js +4 -3
  44. package/dist/esm/features/utils/agent-session.js +13 -0
  45. package/dist/esm/features/utils/instrument-base.js +7 -8
  46. package/dist/esm/interfaces/registered-entity.js +21 -0
  47. package/dist/esm/loaders/agent.js +2 -0
  48. package/dist/esm/loaders/api/consent.js +17 -0
  49. package/dist/esm/loaders/api/constants.js +2 -1
  50. package/dist/esm/loaders/api/measure.js +35 -35
  51. package/dist/esm/loaders/api/recordCustomEvent.js +4 -3
  52. package/dist/esm/loaders/api/register-api-types.js +10 -9
  53. package/dist/esm/loaders/api/register.js +17 -1
  54. package/dist/esm/loaders/api-base.js +15 -8
  55. package/dist/tsconfig.tsbuildinfo +1 -1
  56. package/dist/types/common/config/init-types.d.ts +6 -0
  57. package/dist/types/common/config/init.d.ts.map +1 -1
  58. package/dist/types/common/harvest/harvester.d.ts.map +1 -1
  59. package/dist/types/common/harvest/types.d.ts +0 -2
  60. package/dist/types/common/harvest/types.d.ts.map +1 -1
  61. package/dist/types/common/session/session-entity.d.ts.map +1 -1
  62. package/dist/types/common/util/mfe.d.ts +1 -0
  63. package/dist/types/common/util/mfe.d.ts.map +1 -1
  64. package/dist/types/common/wrap/wrap-promise.d.ts.map +1 -1
  65. package/dist/types/features/page_view_event/aggregate/index.d.ts +22 -3
  66. package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -1
  67. package/dist/types/features/page_view_event/instrument/index.d.ts.map +1 -1
  68. package/dist/types/features/session_replay/aggregate/index.d.ts.map +1 -1
  69. package/dist/types/features/session_replay/constants.d.ts +1 -5
  70. package/dist/types/features/session_replay/constants.d.ts.map +1 -1
  71. package/dist/types/features/session_replay/instrument/index.d.ts.map +1 -1
  72. package/dist/types/features/utils/agent-session.d.ts.map +1 -1
  73. package/dist/types/features/utils/instrument-base.d.ts +1 -0
  74. package/dist/types/features/utils/instrument-base.d.ts.map +1 -1
  75. package/dist/types/interfaces/registered-entity.d.ts +25 -0
  76. package/dist/types/interfaces/registered-entity.d.ts.map +1 -1
  77. package/dist/types/loaders/agent.d.ts.map +1 -1
  78. package/dist/types/loaders/api/consent.d.ts +2 -0
  79. package/dist/types/loaders/api/consent.d.ts.map +1 -0
  80. package/dist/types/loaders/api/constants.d.ts +1 -0
  81. package/dist/types/loaders/api/constants.d.ts.map +1 -1
  82. package/dist/types/loaders/api/measure.d.ts +3 -0
  83. package/dist/types/loaders/api/measure.d.ts.map +1 -1
  84. package/dist/types/loaders/api/recordCustomEvent.d.ts +1 -0
  85. package/dist/types/loaders/api/recordCustomEvent.d.ts.map +1 -1
  86. package/dist/types/loaders/api/register-api-types.d.ts +28 -11
  87. package/dist/types/loaders/api/register-api-types.d.ts.map +1 -1
  88. package/dist/types/loaders/api/register.d.ts.map +1 -1
  89. package/dist/types/loaders/api-base.d.ts +20 -15
  90. package/dist/types/loaders/api-base.d.ts.map +1 -1
  91. package/package.json +2 -2
  92. package/src/common/config/init-types.js +2 -0
  93. package/src/common/config/init.js +1 -0
  94. package/src/common/harvest/harvester.js +11 -8
  95. package/src/common/harvest/types.js +0 -1
  96. package/src/common/session/session-entity.js +6 -2
  97. package/src/common/util/mfe.js +4 -0
  98. package/src/common/wrap/wrap-promise.js +16 -6
  99. package/src/features/generic_events/aggregate/index.js +4 -4
  100. package/src/features/logging/aggregate/index.js +1 -1
  101. package/src/features/page_view_event/aggregate/index.js +79 -15
  102. package/src/features/page_view_event/instrument/index.js +0 -4
  103. package/src/features/session_replay/aggregate/index.js +4 -3
  104. package/src/features/session_replay/constants.js +1 -5
  105. package/src/features/session_replay/instrument/index.js +4 -3
  106. package/src/features/utils/agent-session.js +12 -0
  107. package/src/features/utils/instrument-base.js +7 -9
  108. package/src/interfaces/registered-entity.js +21 -0
  109. package/src/loaders/agent.js +2 -0
  110. package/src/loaders/api/consent.js +18 -0
  111. package/src/loaders/api/constants.js +1 -0
  112. package/src/loaders/api/measure.js +34 -33
  113. package/src/loaders/api/recordCustomEvent.js +5 -3
  114. package/src/loaders/api/register-api-types.js +10 -9
  115. package/src/loaders/api/register.js +8 -1
  116. package/src/loaders/api-base.js +15 -8
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_replay/aggregate/index.js"],"names":[],"mappings":"AAwBA;IACE,2BAAiC;IAIjC,sCAyFC;IA5FD,aAAe;IAKb,iFAAiF;IACjF,qBAAwB;IAGxB,2CAA2C;IAC3C,sDAAwB;IACxB,6CAA6C;IAC7C,gDAAmB;IACnB,+DAA+D;IAC/D,wBAA0B;IAE1B,0BAA0B;IAC1B,kBAAqB;IACrB,6CAA6C;IAC7C,gBAA2B;IAE3B,qBAA2B;IAE3B,cAA8C;IAI9C,kCAAqG;IAmEvG,0BAEC;IAED,0BAMC;IAED,qBAUC;IAED;;;;;;OAMG;IACH,4BALW,OAAO,iBACP,OAAO;;;;;;QAEL,IAAI,CA8ChB;IAED,2BAUC;IAED;;;;;;;;;;kBAwCC;IAED;;;;OAIG;IACH,6BAHW,MAAM,EAAE,GACN;QAAE,UAAU,EAAE,MAAM,GAAC,SAAS,CAAC;QAAC,SAAS,EAAE,MAAM,GAAC,SAAS,CAAA;KAAE,CAUzE;IAED;;;;;;;;;;MAsEC;IAED,sCAKC;IAED;;;;OAIG;IACH,mCAKC;IAED,yDAAyD;IACzD,+CASC;IAED,yCAIC;CACF;8BA5W6B,4BAA4B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_replay/aggregate/index.js"],"names":[],"mappings":"AAyBA;IACE,2BAAiC;IAIjC,sCAyFC;IA5FD,aAAe;IAKb,iFAAiF;IACjF,qBAAwB;IAGxB,2CAA2C;IAC3C,sDAAwB;IACxB,6CAA6C;IAC7C,gDAAmB;IACnB,+DAA+D;IAC/D,wBAA0B;IAE1B,0BAA0B;IAC1B,kBAAqB;IACrB,6CAA6C;IAC7C,gBAA2B;IAE3B,qBAA2B;IAE3B,cAA8C;IAI9C,kCAAqG;IAmEvG,0BAEC;IAED,0BAMC;IAED,qBAUC;IAED;;;;;;OAMG;IACH,4BALW,OAAO,iBACP,OAAO;;;;;;QAEL,IAAI,CA8ChB;IAED,2BAUC;IAED;;;;;;;;;;kBAwCC;IAED;;;;OAIG;IACH,6BAHW,MAAM,EAAE,GACN;QAAE,UAAU,EAAE,MAAM,GAAC,SAAS,CAAC;QAAC,SAAS,EAAE,MAAM,GAAC,SAAS,CAAA;KAAE,CAUzE;IAED;;;;;;;;;;MAsEC;IAED,sCAKC;IAED;;;;OAIG;IACH,mCAKC;IAED,yDAAyD;IACzD,+CASC;IAED,yCAIC;CACF;8BA7W6B,4BAA4B"}
@@ -1,9 +1,5 @@
1
1
  export const FEATURE_NAME: string;
2
- export namespace SR_EVENT_EMITTER_TYPES {
3
- let RECORD: string;
4
- let PAUSE: string;
5
- let ERROR_DURING_REPLAY: string;
6
- }
2
+ export const ERROR_DURING_REPLAY: "errorDuringReplay";
7
3
  export const AVG_COMPRESSION: 0.12;
8
4
  export namespace RRWEB_EVENT_TYPES {
9
5
  let DomContentLoaded: number;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/features/session_replay/constants.js"],"names":[],"mappings":"AAOA,kCAAuD;;;;;;AAQvD,8BAA+B,IAAI,CAAA;;;;;;;;;AASnC,2GAA2G;AAC3G;IAA6B,CAAC,IAAI,CAAC,KAAK,CAAC,SAAO;IAAE,CAAC,IAAI,CAAC,IAAI,CAAC,SAAQ;IAAE,CAAC,IAAI,CAAC,GAAG,CAAC,SAAG;EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BtF,0CAA0C;AAC1C,kCAAmC,IAAI,CAAA;;;;;;;;qBAjDlB,gCAAgC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/features/session_replay/constants.js"],"names":[],"mappings":"AAOA,kCAAuD;AAEvD,kCAAmC,mBAAmB,CAAA;AAEtD,8BAA+B,IAAI,CAAA;;;;;;;;;AASnC,2GAA2G;AAC3G;IAA6B,CAAC,IAAI,CAAC,KAAK,CAAC,SAAO;IAAE,CAAC,IAAI,CAAC,IAAI,CAAC,SAAQ;IAAE,CAAC,IAAI,CAAC,GAAG,CAAC,SAAG;EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BtF,0CAA0C;AAC1C,kCAAmC,IAAI,CAAA;;;;;;;;qBA7ClB,gCAAgC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_replay/instrument/index.js"],"names":[],"mappings":"AAgBA;IACE,2BAAiC;IAMjC,2BAgCC;IAnCD,+CAA+C;IAC/C,cAAQ;IA8BF,sBAAwB;IAmB9B;;;OAGG;IACH,+BAkBC;;CAgBF;AAED,8CAAuC;+BApGR,6BAA6B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_replay/instrument/index.js"],"names":[],"mappings":"AAiBA;IACE,2BAAiC;IAMjC,2BAgCC;IAnCD,+CAA+C;IAC/C,cAAQ;IA8BF,sBAAwB;IAmB9B;;;OAGG;IACH,+BAkBC;;CAgBF;AAED,8CAAuC;+BArGR,6BAA6B"}
@@ -1 +1 @@
1
- {"version":3,"file":"agent-session.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/agent-session.js"],"names":[],"mappings":"AAaA,sDAgDC"}
1
+ {"version":3,"file":"agent-session.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/agent-session.js"],"names":[],"mappings":"AAaA,sDA4DC"}
@@ -21,6 +21,7 @@ export class InstrumentBase extends FeatureBase {
21
21
  * @type {Promise} Assigned immediately after @see importAggregator runs. Serves as a signal for when the inner async fn finishes execution. Useful for features to await
22
22
  * one another if there are inter-features dependencies.
23
23
  */
24
+ loadedSuccessfully: Promise<any>;
24
25
  onAggregateImported: Promise<any>;
25
26
  /**
26
27
  * used in conjunction with newrelic.start() to defer harvesting in features
@@ -1 +1 @@
1
- {"version":3,"file":"instrument-base.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/instrument-base.js"],"names":[],"mappings":"AAuBA;;;GAGG;AACH;IACE;;;;OAIG;IACH,wCAFW,MAAM,EAyChB;IApCC,cAAwB;IAExB,8IAA8I;IAC9I,cADW,WAAW,SAAS,CACF;IAE7B;;;MAGE;IACF,eAHU,OAAO,kBAAkB,EAAE,aAAa,CAGpB;IAE9B;;;MAGE;IACF,kCAAoC;IAEpC;;;MAGE;IACF,uBAAiC;IAiBnC;;;;;;;OAOG;IACH,2BALW,MAAM,qDAEN,MAAM,QA0DhB;;CAmBF;4BAhJ2B,gBAAgB"}
1
+ {"version":3,"file":"instrument-base.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/instrument-base.js"],"names":[],"mappings":"AAuBA;;;GAGG;AACH;IACE;;;;OAIG;IACH,wCAFW,MAAM,EA4ChB;IAvCC,cAAwB;IAExB,8IAA8I;IAC9I,cADW,WAAW,SAAS,CACF;IAE7B;;;MAGE;IACF,eAHU,OAAO,kBAAkB,EAAE,aAAa,CAGpB;IAE9B;;;MAGE;IACF,iCAAmC;IACnC,kCAEE;IAEF;;;MAGE;IACF,uBAAiC;IAiBnC;;;;;;;OAOG;IACH,2BALW,MAAM,qDAEN,MAAM,QAqDhB;;CAmBF;4BA9I2B,gBAAgB"}
@@ -25,6 +25,31 @@ export class RegisteredEntity {
25
25
  * @param {object} [attributes] JSON object with one or more key/value pairs. For example: {key:"value"}. The key is reported as its own PageAction attribute with the specified values.
26
26
  */
27
27
  addPageAction(name: string, attributes?: object): void;
28
+ /**
29
+ * Records a custom event with a specified eventType and attributes.
30
+ * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/recordCustomEvent/}
31
+ * @param {string} eventType The eventType to store the event as.
32
+ * @param {Object} [attributes] JSON object with one or more key/value pairs. For example: {key:"value"}.
33
+ */
34
+ recordCustomEvent(eventType: string, attributes?: Object): void;
35
+ /**
36
+ * Measures a task that is recorded as a BrowserPerformance event.
37
+ * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/measure/}
38
+ * @param {string} name The name of the task
39
+ * @param {{start: number, end: number, duration: number, customAttributes: object}} [options] An object used to control the way the measure API operates
40
+ * @returns {{start: number, end: number, duration: number, customAttributes: object}} Measurement details
41
+ */
42
+ measure(name: string, options?: {
43
+ start: number;
44
+ end: number;
45
+ duration: number;
46
+ customAttributes: object;
47
+ }): {
48
+ start: number;
49
+ end: number;
50
+ duration: number;
51
+ customAttributes: object;
52
+ };
28
53
  /**
29
54
  * Adds a user-defined attribute name and value to subsequent events on the page for the registered target. Note -- the persist flag does not work with the register API.
30
55
  * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/setcustomattribute/}
@@ -1 +1 @@
1
- {"version":3,"file":"registered-entity.d.ts","sourceRoot":"","sources":["../../../src/interfaces/registered-entity.js"],"names":[],"mappings":"AAMA;;;;GAIG;AAEH;;;;;;GAMG;AACH;IAOE;;;OAGG;IACH,kBAFW,sBAAsB,EAShC;IAjBD,kCAAkC;IAClC,UADW,mBAAmB,CAI7B;IAeD;;;;;OAKG;IACH,oBAHW,MAAM,eACN,MAAM,QAKhB;IAED;;;;;;OAMG;IACH,yBAJW,MAAM,SACN,MAAM,GAAC,MAAM,GAAC,OAAO,GAAC,IAAI,YAC1B,OAAO,QAKjB;IAED;;;;;OAKG;IACH,mBAHW,KAAK,GAAC,MAAM,qBACZ,MAAM,QAKhB;IAED;;;;OAIG;IACH,iBAFW,MAAM,GAAC,IAAI,QAKrB;IAED;;;;;;;OAOG;IACH,6BAJW,MAAM,GAAC,IAAI,QAOrB;IAED;;;;;MAKE;IACF,aAHW,MAAM,YACN;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,GAAC,OAAO,GAAC,OAAO,GAAC,MAAM,GAAC,MAAM,CAAA;KAAC,QAKpF;CACF;0BAnGY,OAAO,mCAAmC,EAAE,WAAW;kCACvD,OAAO,mCAAmC,EAAE,mBAAmB;qCAC/D,OAAO,mCAAmC,EAAE,sBAAsB"}
1
+ {"version":3,"file":"registered-entity.d.ts","sourceRoot":"","sources":["../../../src/interfaces/registered-entity.js"],"names":[],"mappings":"AAMA;;;;GAIG;AAEH;;;;;;GAMG;AACH;IAOE;;;OAGG;IACH,kBAFW,sBAAsB,EAShC;IAjBD,kCAAkC;IAClC,UADW,mBAAmB,CAI7B;IAeD;;;;;OAKG;IACH,oBAHW,MAAM,eACN,MAAM,QAKhB;IAED;;;;;SAKK;IACL,6BAHa,MAAM,eACN,MAAM,QAIlB;IAED;;;;;;OAMG;IACH,cAJW,MAAM,YACN;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,gBAAgB,EAAE,MAAM,CAAA;KAAC,GACtE;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,gBAAgB,EAAE,MAAM,CAAA;KAAC,CAIpF;IAED;;;;;;OAMG;IACH,yBAJW,MAAM,SACN,MAAM,GAAC,MAAM,GAAC,OAAO,GAAC,IAAI,YAC1B,OAAO,QAKjB;IAED;;;;;OAKG;IACH,mBAHW,KAAK,GAAC,MAAM,qBACZ,MAAM,QAKhB;IAED;;;;OAIG;IACH,iBAFW,MAAM,GAAC,IAAI,QAKrB;IAED;;;;;;;OAOG;IACH,6BAJW,MAAM,GAAC,IAAI,QAOrB;IAED;;;;;MAKE;IACF,aAHW,MAAM,YACN;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,GAAC,OAAO,GAAC,OAAO,GAAC,MAAM,GAAC,MAAM,CAAA;KAAC,QAKpF;CACF;0BAxHY,OAAO,mCAAmC,EAAE,WAAW;kCACvD,OAAO,mCAAmC,EAAE,mBAAmB;qCAC/D,OAAO,mCAAmC,EAAE,sBAAsB"}
@@ -1 +1 @@
1
- {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../src/loaders/agent.js"],"names":[],"mappings":"AA0BA;;;;;;;;;GASG;AAEH;;;GAGG;AACH;IACE;;OAEG;IACH,qBAFW,YAAY,EA+BtB;IAnBC,yBAAkB;IAGlB,yCAAsD;IAMtD,uCAA6G;IAY/G;;;;;MAOC;IAED,gBAEC;IAED,yBAqCC;CACF;;;;;UAnGa,OAAO,uBAAuB,EAAE,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;0BAnBxB,cAAc"}
1
+ {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../src/loaders/agent.js"],"names":[],"mappings":"AA2BA;;;;;;;;;GASG;AAEH;;;GAGG;AACH;IACE;;OAEG;IACH,qBAFW,YAAY,EAgCtB;IApBC,yBAAkB;IAGlB,yCAAsD;IAMtD,uCAA6G;IAa/G;;;;;MAOC;IAED,gBAEC;IAED,yBAqCC;CACF;;;;;UApGa,OAAO,uBAAuB,EAAE,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;0BApBxB,cAAc"}
@@ -0,0 +1,2 @@
1
+ export function setupConsentAPI(agent: any): void;
2
+ //# sourceMappingURL=consent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"consent.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/consent.js"],"names":[],"mappings":"AASA,kDAQC"}
@@ -24,4 +24,5 @@ export const SET_USER_ID: "setUserId";
24
24
  export const START: "start";
25
25
  export const WRAP_LOGGER: "wrapLogger";
26
26
  export const MEASURE: "measure";
27
+ export const CONSENT: "consent";
27
28
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/constants.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAsB,MAAM,CAAA;AAC5B,+BAAwC;AAExC,8BAA+B,eAAe,CAAA;AAC9C,2BAA4B,YAAY,CAAA;AACxC,0BAA2B,YAAY,CAAA;AACvC,uBAAwB,UAAU,CAAA;AAClC,0BAA2B,aAAa,CAAA;AACxC,kBAAmB,KAAK,CAAA;AACxB,2BAA4B,aAAa,CAAA;AACzC,2BAA4B,aAAa,CAAA;AACzC,kCAAmC,mBAAmB,CAAA;AACtD,4BAA6B,cAAc,CAAA;AAC3C,uBAAwB,UAAU,CAAA;AAClC,sCAAuC,uBAAuB,CAAA;AAC9D,qCAAsC,qBAAqB,CAAA;AAC3D,mCAAoC,oBAAoB,CAAA;AACxD,gCAAiC,iBAAiB,CAAA;AAClD,iCAAkC,iBAAiB,CAAA;AACnD,0BAA2B,WAAW,CAAA;AACtC,oBAAqB,OAAO,CAAA;AAC5B,0BAA2B,YAAY,CAAA;AACvC,sBAAuB,SAAS,CAAA"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/constants.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH,qBAAsB,MAAM,CAAA;AAC5B,+BAAwC;AAExC,8BAA+B,eAAe,CAAA;AAC9C,2BAA4B,YAAY,CAAA;AACxC,0BAA2B,YAAY,CAAA;AACvC,uBAAwB,UAAU,CAAA;AAClC,0BAA2B,aAAa,CAAA;AACxC,kBAAmB,KAAK,CAAA;AACxB,2BAA4B,aAAa,CAAA;AACzC,2BAA4B,aAAa,CAAA;AACzC,kCAAmC,mBAAmB,CAAA;AACtD,4BAA6B,cAAc,CAAA;AAC3C,uBAAwB,UAAU,CAAA;AAClC,sCAAuC,uBAAuB,CAAA;AAC9D,qCAAsC,qBAAqB,CAAA;AAC3D,mCAAoC,oBAAoB,CAAA;AACxD,gCAAiC,iBAAiB,CAAA;AAClD,iCAAkC,iBAAiB,CAAA;AACnD,0BAA2B,WAAW,CAAA;AACtC,oBAAqB,OAAO,CAAA;AAC5B,0BAA2B,YAAY,CAAA;AACvC,sBAAuB,SAAS,CAAA;AAChC,sBAAuB,SAAS,CAAA"}
@@ -1,2 +1,5 @@
1
1
  export function setupMeasureAPI(agent: any): void;
2
+ export function measure(name: any, options: any, agentRef: any, target: any, timestamp?: number): {
3
+ customAttributes: any;
4
+ } | undefined;
2
5
  //# sourceMappingURL=measure.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"measure.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/measure.js"],"names":[],"mappings":"AAWA,kDAyCC"}
1
+ {"version":3,"file":"measure.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/measure.js"],"names":[],"mappings":"AAWA,kDAEC;AAED;;cAsCC"}
@@ -1,2 +1,3 @@
1
1
  export function setupRecordCustomEventAPI(agent: any): void;
2
+ export function recordCustomEvent(eventType: any, attributes: {} | undefined, agentRef: any, target: any, timestamp?: number): void;
2
3
  //# sourceMappingURL=recordCustomEvent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"recordCustomEvent.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/recordCustomEvent.js"],"names":[],"mappings":"AAUA,4DAIC"}
1
+ {"version":3,"file":"recordCustomEvent.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/recordCustomEvent.js"],"names":[],"mappings":"AAUA,4DAEC;AAED,oIAEC"}
@@ -4,27 +4,43 @@ export type RegisterAPI = {
4
4
  /**
5
5
  * - Add a page action for the registered entity.
6
6
  */
7
- addPageAction: Function;
7
+ addPageAction: (name: string, attributes?: object) => void;
8
8
  /**
9
9
  * - Capture a log for the registered entity.
10
10
  */
11
- log: Function;
11
+ log: (message: string, options?: {
12
+ customAttributes?: object;
13
+ level?: "ERROR" | "TRACE" | "DEBUG" | "INFO" | "WARN";
14
+ }) => void;
12
15
  /**
13
16
  * - Notice an error for the registered entity.
14
17
  */
15
- noticeError: Function;
18
+ noticeError: (error: Error | string, customAttributes?: object) => void;
19
+ /**
20
+ * - Record a custom event for the registered entity.
21
+ */
22
+ recordCustomEvent: (eventType: string, attributes?: Object) => void;
23
+ /**
24
+ * {start: number, end: number, duration: number, customAttributes: object}}} measure - Measures a task that is recorded as a BrowserPerformance event.
25
+ */
26
+ "": (eventType: string, options?: {
27
+ start: number;
28
+ end: number;
29
+ duration: number;
30
+ customAttributes: object;
31
+ }) => {};
16
32
  /**
17
33
  * - Add an application.version attribute to all outgoing data for the registered entity.
18
34
  */
19
- setApplicationVersion: Function;
35
+ setApplicationVersion: (value: string | null) => void;
20
36
  /**
21
37
  * - Add a custom attribute to outgoing data for the registered entity.
22
38
  */
23
- setCustomAttribute: Function;
39
+ setCustomAttribute: (name: string, value: string | number | boolean | null, persist?: boolean) => void;
24
40
  /**
25
41
  * - Add an enduser.id attribute to all outgoing API data for the registered entity.
26
42
  */
27
- setUserId: Function;
43
+ setUserId: (value: string | null) => void;
28
44
  /**
29
45
  * - The metadata object containing the custom attributes and target information for the registered entity.
30
46
  */
@@ -32,12 +48,13 @@ export type RegisterAPI = {
32
48
  };
33
49
  export type RegisterAPIConstructor = {
34
50
  /**
35
- * - The options for the registered entity.
51
+ * - The unique id for the registered entity. This will be assigned to any synthesized entities.
36
52
  */
37
- opts: {
38
- id: string;
39
- name: string;
40
- };
53
+ id: string | number;
54
+ /**
55
+ * - The readable name for the registered entity. This will be assigned to any synthesized entities.
56
+ */
57
+ name: string;
41
58
  };
42
59
  export type RegisterAPIMetadata = {
43
60
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"register-api-types.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/register-api-types.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAac,mBAAmB;;;;;;UAM9B;QAAwB,EAAE,EAAf,MAAM;QACO,IAAI,EAAjB,MAAM;KACnB;;;;;;sBAIa,MAAM;;;;YAEjB;QAA0B,UAAU,EAAzB,MAAM;QACS,EAAE,EAAjB,MAAM;QACS,IAAI,EAAnB,MAAM;KACnB"}
1
+ {"version":3,"file":"register-api-types.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/register-api-types.js"],"names":[],"mappings":";;;;;;mBAOc,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,IAAI;;;;SAC3C,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;KAAC,KAAK,IAAI;;;;iBACxH,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,EAAE,gBAAgB,CAAC,EAAE,MAAM,KAAK,IAAI;;;;uBAC1D,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,KAAK,IAAI;;;;QAChD,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,gBAAgB,EAAE,MAAM,CAAA;KAAC,KAAK,EAAC;;;;2BAC5G,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI;;;;wBAC9B,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI;;;;eAClF,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI;;;;cAC9B,mBAAmB;;;;;;QAKnB,MAAM,GAAC,MAAM;;;;UACb,MAAM;;;;;;sBAKN,MAAM;;;;YAEjB;QAA0B,UAAU,EAAzB,MAAM;QACS,EAAE,EAAjB,MAAM;QACS,IAAI,EAAnB,MAAM;KACnB"}
@@ -1 +1 @@
1
- {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/register.js"],"names":[],"mappings":"AAiBA;;GAEG;AAEH;;;;GAIG;AACH,mDAIC;AAED;;;;;;;;;;GAUG;AACH,2CARW,MAAM,UAGd;IAAwB,UAAU;IACX,EAAE,EAAjB,MAAM;IACS,IAAI,EAAnB,MAAM;CACd,GAAU,WAAW,CAmGvB;0BA1HY,OAAO,sBAAsB,EAAE,WAAW"}
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/register.js"],"names":[],"mappings":"AAmBA;;GAEG;AAEH;;;;GAIG;AACH,mDAIC;AAED;;;;;;;;;;GAUG;AACH,2CARW,MAAM,UAGd;IAAwB,UAAU;IACX,EAAE,EAAjB,MAAM;IACS,IAAI,EAAnB,MAAM;CACd,GAAU,WAAW,CAwGvB;0BA/HY,OAAO,sBAAsB,EAAE,WAAW"}
@@ -15,24 +15,17 @@ export class ApiBase {
15
15
  * It is not recommended for use in production environments and will not receive support for issues.
16
16
  *
17
17
  * Registers an external caller to report through the base agent to a different target than the base agent.
18
- * @param {object} target the target object to report data to
19
- * @param {string} target.licenseKey The licenseKey to report data to
20
- * @param {string} target.applicationID The applicationID to report data to
21
- * @param {string=} target.entityGuid The entityGuid to report data to
22
- * @returns {object} Returns an object that contains the available API methods and configurations to use with the external caller. See loaders/api/api.js for more information.
23
- */
24
- register(target: {
25
- licenseKey: string;
26
- applicationID: string;
27
- entityGuid?: string | undefined;
28
- }): object;
18
+ * @param {import('./api/register-api-types').RegisterAPIConstructor} target the target object to report data to
19
+ @returns {import('./api/register-api-types').RegisterAPI} Returns an object that contains the available API methods and configurations to use with the external caller. See loaders/api/api.js for more information.
20
+ */
21
+ register(target: import("./api/register-api-types").RegisterAPIConstructor): import("./api/register-api-types").RegisterAPI;
29
22
  /**
30
23
  * Records a custom event with a specified eventType and attributes.
31
24
  * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/recordCustomEvent/}
32
25
  * @param {string} eventType The eventType to store the event as.
33
- * @param {object} [attributes] JSON object with one or more key/value pairs. For example: {key:"value"}.
26
+ * @param {Object} [attributes] JSON object with one or more key/value pairs. For example: {key:"value"}.
34
27
  */
35
- recordCustomEvent(eventType: string, attributes?: object): any;
28
+ recordCustomEvent(eventType: string, attributes?: Object): any;
36
29
  /**
37
30
  * Groups page views to help URL structure or to capture the URL's routing information.
38
31
  * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/setpageviewname/}
@@ -171,15 +164,27 @@ export class ApiBase {
171
164
  * Measures a task that is recorded as a BrowserPerformance event.
172
165
  * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/measure/}
173
166
  * @param {string} name The name of the task
174
- * @param {object?} options An object used to control the way the measure API operates
167
+ * @param {{start: number, end: number, duration: number, customAttributes: object}} [options] An object used to control the way the measure API operates
175
168
  * @returns {{start: number, end: number, duration: number, customAttributes: object}} Measurement details
176
169
  */
177
- measure(name: string, options: object | null): {
170
+ measure(name: string, options?: {
171
+ start: number;
172
+ end: number;
173
+ duration: number;
174
+ customAttributes: object;
175
+ }): {
178
176
  start: number;
179
177
  end: number;
180
178
  duration: number;
181
179
  customAttributes: object;
182
180
  };
181
+ /**
182
+ * Accepts or rejects consent when the agent is configured to require consent before harvesting.
183
+ * The consent state is stored in session storage inside the NRBA_SESSION object.
184
+ * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/consent/}
185
+ * @param {boolean?} accept Whether to accept or reject consent. Defaults to true (accept) if left undefined.
186
+ */
187
+ consent(accept: boolean | null): any;
183
188
  #private;
184
189
  }
185
190
  export type InteractionInstance = import("./api/interaction-types").InteractionInstance;
@@ -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;;;;;;;;;;;OAWG;IACH,iBALG;QAAuB,UAAU,EAAzB,MAAM;QACS,aAAa,EAA5B,MAAM;QACU,UAAU,GAA1B,MAAM,YAAC;KACf,GAAU,MAAM,CAIlB;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;;;;OAIG;IACH,iBAFW,MAAM,GAAC,IAAI,OAIrB;IAED;;;;;;;OAOG;IACH,6BAJW,MAAM,GAAC,IAAI,OAMrB;IAED;;;;OAIG;IACH,0BAFW,CAAC,KAAK,EAAE,KAAK,GAAC,MAAM,KAAK,OAAO,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,OAI9D;IAED;;;;;OAKG;IACH,iBAHW,MAAM,MACN,MAAM,OAIhB;IAED;;;;;MAKE;IACF,aAHW,MAAM,YACN;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,GAAC,OAAO,GAAC,OAAO,GAAC,MAAM,GAAC,MAAM,CAAA;KAAC,OAIpF;IAED;;;OAGG;IACH,aAEC;IAED;;;;OAIG;IACH,qBAFW,MAAM,OAIhB;IAED;;;;OAIG;IACH,oBAEC;IAED;;;;;OAKG;IACH,mBAEC;IAED;;;;;;;;;;OAUG;IACH,6BARW;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAC,OAUrF;IAED;;;;;OAKG;IACH,0BAHW,MAAM,OAKhB;IAED;;;;;;;;MAQE;IACF,mBALG;QAAuB,UAAU;KACjC,GAAU,mBAAmB,CAM/B;IAED;;;;;;MAME;IACF,mBAJW,MAAM,gBACN,MAAM,YACN;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,GAAC,OAAO,GAAC,OAAO,GAAC,MAAM,GAAC,MAAM,CAAA;KAAC,OAIpF;IAED;;;;;;OAMG;IACH,cAJW,MAAM,WACN,MAAM,OAAC,GACL;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,gBAAgB,EAAE,MAAM,CAAA;KAAC,CAIpF;;CACF;kCA9NY,OAAO,yBAAyB,EAAE,mBAAmB"}
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;;;;OAIG;IACH,iBAFW,MAAM,GAAC,IAAI,OAIrB;IAED;;;;;;;OAOG;IACH,6BAJW,MAAM,GAAC,IAAI,OAMrB;IAED;;;;OAIG;IACH,0BAFW,CAAC,KAAK,EAAE,KAAK,GAAC,MAAM,KAAK,OAAO,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,OAI9D;IAED;;;;;OAKG;IACH,iBAHW,MAAM,MACN,MAAM,OAIhB;IAED;;;;;MAKE;IACF,aAHW,MAAM,YACN;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,GAAC,OAAO,GAAC,OAAO,GAAC,MAAM,GAAC,MAAM,CAAA;KAAC,OAIpF;IAED;;;OAGG;IACH,aAEC;IAED;;;;OAIG;IACH,qBAFW,MAAM,OAIhB;IAED;;;;OAIG;IACH,oBAEC;IAED;;;;;OAKG;IACH,mBAEC;IAED;;;;;;;;;;OAUG;IACH,6BARW;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAC,OAUrF;IAED;;;;;OAKG;IACH,0BAHW,MAAM,OAKhB;IAED;;;;;;;;MAQE;IACF,mBALG;QAAuB,UAAU;KACjC,GAAU,mBAAmB,CAM/B;IAED;;;;;;MAME;IACF,mBAJW,MAAM,gBACN,MAAM,YACN;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,GAAC,OAAO,GAAC,OAAO,GAAC,MAAM,GAAC,MAAM,CAAA;KAAC,OAIpF;IAED;;;;;;OAMG;IACH,cAJW,MAAM,YACN;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,gBAAgB,EAAE,MAAM,CAAA;KAAC,GACtE;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;kCArOY,OAAO,yBAAyB,EAAE,mBAAmB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newrelic/browser-agent",
3
- "version": "1.302.0-rc.0",
3
+ "version": "1.302.0-rc.10",
4
4
  "private": false,
5
5
  "author": "New Relic Browser Agent Team <browser-agent@newrelic.com>",
6
6
  "description": "New Relic Browser Agent",
@@ -170,7 +170,7 @@
170
170
  "runtime": {
171
171
  "name": "node",
172
172
  "onFail": "error",
173
- "version": "22.11.0"
173
+ "version": ">=22.11.0"
174
174
  },
175
175
  "packageManager": {
176
176
  "name": "npm",
@@ -84,6 +84,8 @@
84
84
  * @property {boolean} [spa.enabled] - Turn on/off the single page application feature (on by default). NOTE: the SPA feature is deprecated and under removal procedure.
85
85
  * @property {boolean} [spa.autoStart] - If true, the agent will automatically start the single page application feature. Otherwise, it will be in a deferred state until the `start` API method is called.
86
86
  * @property {boolean} [ssl] - If explicitly false, the agent will use HTTP instead of HTTPS. This setting should NOT be used.
87
+ * @property {Object} [browser_consent_mode]
88
+ * @property {boolean} [browser_consent_mode.enabled] - If true, the agent will use consent mode for whether to allow or disallow data harvest.
87
89
  * @property {Object} [user_actions]
88
90
  * @property {boolean} [user_actions.enabled] - Must be true to allow UserAction events to be captured.
89
91
  * @property {Array<string>} [user_actions.elementAttributes] - List of HTML Element properties to be captured with UserAction events' target elements. This may help to identify the source element being interacted with in the UI.
@@ -53,6 +53,7 @@ const InitModelFn = () => {
53
53
  set allow_registered_children (val) { hiddenState.experimental.allow_registered_children = val },
54
54
  duplicate_registered_data: false
55
55
  },
56
+ browser_consent_mode: { enabled: false },
56
57
  distributed_tracing: {
57
58
  enabled: undefined,
58
59
  exclude_newrelic_header: undefined,
@@ -18,8 +18,10 @@ import { getSubmitMethod, xhr as xhrMethod, xhrFetch as fetchMethod } from '../u
18
18
  import { activatedFeatures } from '../util/feature-flags'
19
19
  import { dispatchGlobalEvent } from '../dispatch/global-event'
20
20
 
21
- const RETRY_FAILED = 'Harvester/Retry/Failed/'
22
- const RETRY_SUCCEEDED = 'Harvester/Retry/Succeeded/'
21
+ const RETRY = 'Harvester/Retry/'
22
+ const RETRY_ATTEMPTED = RETRY + 'Attempted/'
23
+ const RETRY_FAILED = RETRY + 'Failed/'
24
+ const RETRY_SUCCEEDED = RETRY + 'Succeeded/'
23
25
 
24
26
  export class Harvester {
25
27
  #started = false
@@ -57,12 +59,13 @@ export class Harvester {
57
59
  triggerHarvestFor (aggregateInst, localOpts = {}) {
58
60
  const output = { ranSend: false, payload: undefined, endpointVersion: aggregateInst.harvestEndpointVersion || 1 }
59
61
  if (aggregateInst.blocked) return output
62
+ if (this.agentRef.init?.browser_consent_mode?.enabled && !this.agentRef.runtime?.session?.state?.consent) return output
60
63
 
61
64
  const submitMethod = getSubmitMethod(localOpts)
62
65
  if (!submitMethod) return output
63
66
 
64
67
  const shouldRetryOnFail = !localOpts.isFinalHarvest && submitMethod === xhrMethod // always retry all features harvests except for final
65
- output.payload = !localOpts.directSend ? aggregateInst.makeHarvestPayload(shouldRetryOnFail, localOpts) : localOpts.directSend?.payload // features like PVE can define the payload directly, bypassing the makeHarvestPayload logic
68
+ output.payload = aggregateInst.makeHarvestPayload(shouldRetryOnFail, localOpts)
66
69
 
67
70
  if (!output.payload) return output
68
71
 
@@ -86,7 +89,9 @@ export class Harvester {
86
89
  */
87
90
  function cbFinished (result) {
88
91
  if (aggregateInst.harvestOpts.prevAttemptCode) { // this means we just retried a harvest that last failed
89
- handle(SUPPORTABILITY_METRIC_CHANNEL, [(result.retry ? RETRY_FAILED : RETRY_SUCCEEDED) + aggregateInst.harvestOpts.prevAttemptCode], undefined, FEATURE_NAMES.metrics, aggregateInst.ee)
92
+ const reportSM = (message) => handle(SUPPORTABILITY_METRIC_CHANNEL, [message], undefined, FEATURE_NAMES.metrics, aggregateInst.ee)
93
+ reportSM(RETRY_ATTEMPTED + aggregateInst.featureName)
94
+ reportSM((result.retry ? RETRY_FAILED : RETRY_SUCCEEDED) + aggregateInst.harvestOpts.prevAttemptCode)
90
95
  delete aggregateInst.harvestOpts.prevAttemptCode // always reset last observation so we don't falsely report again next harvest
91
96
  // In case this re-attempt failed again, that'll be handled (re-marked again) next.
92
97
  }
@@ -155,8 +160,7 @@ export function send (agentRef, { endpoint, payload, localOpts = {}, submitMetho
155
160
  result.addEventListener('loadend', function () {
156
161
  // `this` here in block refers to the XHR object in this scope, do not change the anon function to an arrow function
157
162
  // status 0 refers to a local error, such as CORS or network failure, or a blocked request by the browser (e.g. adblocker)
158
- const cbResult = { sent: this.status !== 0, status: this.status, retry: shouldRetry(this.status), fullUrl, xhr: this }
159
- if (localOpts.needResponse) cbResult.responseText = this.responseText
163
+ const cbResult = { sent: this.status !== 0, status: this.status, retry: shouldRetry(this.status), fullUrl, xhr: this, responseText: this.responseText }
160
164
  cbFinished(cbResult)
161
165
 
162
166
  /** temporary audit of consistency of harvest metadata flags */
@@ -165,8 +169,7 @@ export function send (agentRef, { endpoint, payload, localOpts = {}, submitMetho
165
169
  } else if (submitMethod === fetchMethod) {
166
170
  result.then(async function (response) {
167
171
  const status = response.status
168
- const cbResult = { sent: true, status, retry: shouldRetry(status), fullUrl, fetchResponse: response }
169
- if (localOpts.needResponse) cbResult.responseText = await response.text()
172
+ const cbResult = { sent: true, status, retry: shouldRetry(status), fullUrl, fetchResponse: response, responseText: await response.text() }
170
173
  cbFinished(cbResult)
171
174
  /** temporary audit of consistency of harvest metadata flags */
172
175
  if (!shouldRetry(status)) trackHarvestMetadata()
@@ -24,7 +24,6 @@
24
24
  * @property {HarvestEndpointIdentifier} endpoint The endpoint to use (jserrors, events, resources etc.)
25
25
  * @property {HarvestPayload} payload Object representing payload.
26
26
  * @property {object} localOpts Additional options for sending data
27
- * @property {boolean} localOpts.needResponse Specify whether the caller expects a response data.
28
27
  * @property {boolean} localOpts.isFinalHarvest Specify whether the call is a final harvest during page unload.
29
28
  * @property {boolean} localOpts.sendEmptyBody Specify whether the call should be made even if the body is empty. Useful for rum calls.
30
29
  * @property {boolean} localOpts.forceNoRetry Don't save the buffered data in the case of a need to retry the transmission.
@@ -32,7 +32,8 @@ const model = {
32
32
  loggingMode: LOGGING_MODE.OFF,
33
33
  serverTimeDiff: null, // set by TimeKeeper; "undefined" value will not be stringified and stored but "null" will
34
34
  custom: {},
35
- numOfResets: 0
35
+ numOfResets: 0,
36
+ consent: false // set by consent() API call
36
37
  }
37
38
 
38
39
  export class SessionEntity {
@@ -77,7 +78,10 @@ export class SessionEntity {
77
78
 
78
79
  setup ({ value = generateRandomHexString(16), expiresMs = DEFAULT_EXPIRES_MS, inactiveMs = DEFAULT_INACTIVE_MS, numOfResets = 0 }) {
79
80
  /** Ensure that certain properties are preserved across a reset if already set */
80
- const persistentAttributes = { serverTimeDiff: this.state.serverTimeDiff || model.serverTimeDiff }
81
+ const persistentAttributes = {
82
+ serverTimeDiff: this.state.serverTimeDiff || model.serverTimeDiff,
83
+ consent: this.state.consent || model.consent
84
+ }
81
85
  this.state = {}
82
86
  this.sync({ ...model, ...persistentAttributes })
83
87
 
@@ -11,6 +11,10 @@ export function isValidMFETarget (target = {}) {
11
11
  return !!(target.id && target.name)
12
12
  }
13
13
 
14
+ export function hasValidValue (val) {
15
+ return (typeof val === 'string' && val.trim().length < 501) || (typeof val === 'number')
16
+ }
17
+
14
18
  /**
15
19
  * When given a valid target, returns an object with the MFE payload attributes. Returns an empty object otherwise.
16
20
  * @param {Object} [target] the registered target
@@ -140,13 +140,23 @@ export function wrapPromise (sharedEE) {
140
140
 
141
141
  promiseEE.on('propagate', function (val, overwrite, trigger) {
142
142
  if (!this.getCtx || overwrite) {
143
- this.getCtx = function () {
144
- // eslint-disable-next-line
145
- if (val instanceof Promise) {
146
- var store = promiseEE.context(val)
143
+ const selfStore = this
144
+ const parentStore =
145
+ val instanceof Promise ? promiseEE.context(val) : null
146
+ let cachedCtx
147
+
148
+ this.getCtx = function getCtx () {
149
+ if (cachedCtx) return cachedCtx
150
+
151
+ if (parentStore && parentStore !== selfStore) {
152
+ cachedCtx =
153
+ typeof parentStore.getCtx === 'function'
154
+ ? parentStore.getCtx()
155
+ : parentStore
156
+ } else {
157
+ cachedCtx = selfStore
147
158
  }
148
-
149
- return store && store.getCtx ? store.getCtx() : this
159
+ return cachedCtx
150
160
  }
151
161
  }
152
162
  })
@@ -33,13 +33,13 @@ export class Aggregate extends AggregateBase {
33
33
 
34
34
  this.#trackSupportabilityMetrics()
35
35
 
36
- registerHandler('api-recordCustomEvent', (timestamp, eventType, attributes) => {
36
+ registerHandler('api-recordCustomEvent', (timestamp, eventType, attributes, target) => {
37
37
  if (RESERVED_EVENT_TYPES.includes(eventType)) return warn(46)
38
38
  this.addEvent({
39
39
  eventType,
40
40
  timestamp: this.toEpoch(timestamp),
41
41
  ...attributes
42
- })
42
+ }, target)
43
43
  }, this.featureName, this.ee)
44
44
 
45
45
  if (agentRef.init.page_action.enabled) {
@@ -227,7 +227,7 @@ export class Aggregate extends AggregateBase {
227
227
  }, this.featureName, this.ee)
228
228
  }
229
229
 
230
- registerHandler('api-measure', (args, n) => {
230
+ registerHandler('api-measure', (args, n, target) => {
231
231
  const { start, duration, customAttributes } = args
232
232
 
233
233
  const event = {
@@ -239,7 +239,7 @@ export class Aggregate extends AggregateBase {
239
239
  entryType: 'measure'
240
240
  }
241
241
 
242
- this.addEvent(event)
242
+ this.addEvent(event, target)
243
243
  }, this.featureName, this.ee)
244
244
 
245
245
  this.drain()
@@ -116,7 +116,7 @@ export class Aggregate extends AggregateBase {
116
116
  common: {
117
117
  /** Attributes in the `common` section are added to `all` logs generated in the payload */
118
118
  attributes: {
119
- ...this.agentRef.info.jsAttributes, // user-provided custom attributes
119
+ ...(applyFnToProps(this.agentRef.info.jsAttributes, this.obfuscator.obfuscateString.bind(this.obfuscator), 'string')),
120
120
  ...(this.harvestEndpointVersion === 1 && {
121
121
  'entity.guid': this.agentRef.runtime.appMetadata.agents[0].entityGuid,
122
122
  appId: this.agentRef.info.applicationID