@newrelic/browser-agent 1.239.1 → 1.241.0

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 (178) hide show
  1. package/README.md +4 -0
  2. package/dist/cjs/cdn/pro.js +3 -2
  3. package/dist/cjs/cdn/spa.js +4 -3
  4. package/dist/cjs/common/config/state/init.js +25 -17
  5. package/dist/cjs/common/constants/env.cdn.js +1 -1
  6. package/dist/cjs/common/constants/env.npm.js +1 -1
  7. package/dist/cjs/common/constants/runtime.js +9 -5
  8. package/dist/cjs/common/harvest/harvest.js +5 -3
  9. package/dist/cjs/common/vitals/constants.js +17 -0
  10. package/dist/cjs/common/vitals/cumulative-layout-shift.js +27 -0
  11. package/dist/cjs/common/vitals/first-contentful-paint.js +49 -0
  12. package/dist/cjs/common/vitals/first-input-delay.js +32 -0
  13. package/dist/{esm/features/page_view_timing → cjs/common/vitals}/first-paint.js +19 -17
  14. package/dist/cjs/common/vitals/interaction-to-next-paint.js +29 -0
  15. package/dist/cjs/common/vitals/largest-contentful-paint.js +41 -0
  16. package/dist/cjs/common/vitals/long-task.js +64 -0
  17. package/dist/cjs/common/vitals/time-to-first-byte.js +36 -0
  18. package/dist/cjs/common/vitals/vital-metric.js +71 -0
  19. package/dist/cjs/features/ajax/aggregate/index.js +4 -1
  20. package/dist/cjs/features/metrics/aggregate/index.js +17 -7
  21. package/dist/cjs/features/page_view_event/aggregate/index.js +18 -40
  22. package/dist/cjs/features/page_view_event/constants.js +2 -8
  23. package/dist/cjs/features/page_view_event/instrument/index.js +0 -22
  24. package/dist/cjs/features/page_view_timing/aggregate/index.js +36 -147
  25. package/dist/cjs/features/page_view_timing/instrument/index.js +0 -3
  26. package/dist/cjs/features/session_replay/aggregate/index.js +81 -35
  27. package/dist/cjs/features/session_trace/aggregate/index.js +13 -1
  28. package/dist/cjs/features/spa/aggregate/index.js +4 -3
  29. package/dist/cjs/loaders/agent.js +3 -0
  30. package/dist/cjs/loaders/api/api.js +2 -0
  31. package/dist/cjs/loaders/api/apiAsync.js +4 -2
  32. package/dist/cjs/loaders/browser-agent.js +2 -1
  33. package/dist/cjs/loaders/configure/configure.js +13 -1
  34. package/dist/cjs/loaders/configure/public-path.js +13 -0
  35. package/dist/cjs/loaders/configure/public-path.npm.js +10 -0
  36. package/dist/esm/cdn/pro.js +2 -1
  37. package/dist/esm/cdn/spa.js +2 -1
  38. package/dist/esm/common/config/state/init.js +25 -17
  39. package/dist/esm/common/constants/env.cdn.js +1 -1
  40. package/dist/esm/common/constants/env.npm.js +1 -1
  41. package/dist/esm/common/constants/runtime.js +5 -3
  42. package/dist/esm/common/harvest/harvest.js +6 -4
  43. package/dist/esm/common/vitals/constants.js +10 -0
  44. package/dist/esm/common/vitals/cumulative-layout-shift.js +20 -0
  45. package/dist/esm/common/vitals/first-contentful-paint.js +41 -0
  46. package/dist/esm/common/vitals/first-input-delay.js +25 -0
  47. package/dist/{cjs/features/page_view_timing → esm/common/vitals}/first-paint.js +12 -24
  48. package/dist/esm/common/vitals/interaction-to-next-paint.js +22 -0
  49. package/dist/esm/common/vitals/largest-contentful-paint.js +34 -0
  50. package/dist/esm/common/vitals/long-task.js +57 -0
  51. package/dist/esm/common/vitals/time-to-first-byte.js +29 -0
  52. package/dist/esm/common/vitals/vital-metric.js +64 -0
  53. package/dist/esm/features/ajax/aggregate/index.js +4 -1
  54. package/dist/esm/features/metrics/aggregate/index.js +18 -8
  55. package/dist/esm/features/page_view_event/aggregate/index.js +20 -42
  56. package/dist/esm/features/page_view_event/constants.js +1 -4
  57. package/dist/esm/features/page_view_event/instrument/index.js +0 -22
  58. package/dist/esm/features/page_view_timing/aggregate/index.js +37 -148
  59. package/dist/esm/features/page_view_timing/instrument/index.js +0 -3
  60. package/dist/esm/features/session_replay/aggregate/index.js +81 -35
  61. package/dist/esm/features/session_trace/aggregate/index.js +13 -1
  62. package/dist/esm/features/spa/aggregate/index.js +4 -3
  63. package/dist/esm/loaders/agent.js +2 -0
  64. package/dist/esm/loaders/api/api.js +2 -0
  65. package/dist/esm/loaders/api/apiAsync.js +5 -3
  66. package/dist/esm/loaders/browser-agent.js +2 -1
  67. package/dist/esm/loaders/configure/configure.js +13 -1
  68. package/dist/esm/loaders/configure/public-path.js +6 -0
  69. package/dist/esm/loaders/configure/public-path.npm.js +3 -0
  70. package/dist/types/common/config/state/init.d.ts.map +1 -1
  71. package/dist/types/common/constants/runtime.d.ts +3 -1
  72. package/dist/types/common/constants/runtime.d.ts.map +1 -1
  73. package/dist/types/common/harvest/harvest.d.ts +0 -1
  74. package/dist/types/common/harvest/harvest.d.ts.map +1 -1
  75. package/dist/types/common/vitals/constants.d.ts +11 -0
  76. package/dist/types/common/vitals/constants.d.ts.map +1 -0
  77. package/dist/types/common/vitals/cumulative-layout-shift.d.ts +3 -0
  78. package/dist/types/common/vitals/cumulative-layout-shift.d.ts.map +1 -0
  79. package/dist/types/common/vitals/first-contentful-paint.d.ts +3 -0
  80. package/dist/types/common/vitals/first-contentful-paint.d.ts.map +1 -0
  81. package/dist/types/common/vitals/first-input-delay.d.ts +3 -0
  82. package/dist/types/common/vitals/first-input-delay.d.ts.map +1 -0
  83. package/dist/types/common/vitals/first-paint.d.ts +3 -0
  84. package/dist/types/common/vitals/first-paint.d.ts.map +1 -0
  85. package/dist/types/common/vitals/interaction-to-next-paint.d.ts +3 -0
  86. package/dist/types/common/vitals/interaction-to-next-paint.d.ts.map +1 -0
  87. package/dist/types/common/vitals/largest-contentful-paint.d.ts +3 -0
  88. package/dist/types/common/vitals/largest-contentful-paint.d.ts.map +1 -0
  89. package/dist/types/common/vitals/long-task.d.ts +3 -0
  90. package/dist/types/common/vitals/long-task.d.ts.map +1 -0
  91. package/dist/types/common/vitals/time-to-first-byte.d.ts +3 -0
  92. package/dist/types/common/vitals/time-to-first-byte.d.ts.map +1 -0
  93. package/dist/types/common/vitals/vital-metric.d.ts +18 -0
  94. package/dist/types/common/vitals/vital-metric.d.ts.map +1 -0
  95. package/dist/types/features/ajax/aggregate/index.d.ts.map +1 -1
  96. package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -1
  97. package/dist/types/features/page_view_event/aggregate/index.d.ts +3 -2
  98. package/dist/types/features/page_view_event/aggregate/index.d.ts.map +1 -1
  99. package/dist/types/features/page_view_event/constants.d.ts +0 -3
  100. package/dist/types/features/page_view_event/constants.d.ts.map +1 -1
  101. package/dist/types/features/page_view_event/instrument/index.d.ts.map +1 -1
  102. package/dist/types/features/page_view_timing/aggregate/index.d.ts +1 -3
  103. package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -1
  104. package/dist/types/features/page_view_timing/instrument/index.d.ts.map +1 -1
  105. package/dist/types/features/session_replay/aggregate/index.d.ts +16 -4
  106. package/dist/types/features/session_replay/aggregate/index.d.ts.map +1 -1
  107. package/dist/types/features/session_trace/aggregate/index.d.ts +9 -1
  108. package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -1
  109. package/dist/types/features/spa/aggregate/index.d.ts.map +1 -1
  110. package/dist/types/loaders/agent.d.ts.map +1 -1
  111. package/dist/types/loaders/api/api.d.ts.map +1 -1
  112. package/dist/types/loaders/api/apiAsync.d.ts.map +1 -1
  113. package/dist/types/loaders/browser-agent.d.ts.map +1 -1
  114. package/dist/types/loaders/configure/configure.d.ts.map +1 -1
  115. package/dist/types/loaders/configure/public-path.d.ts +2 -0
  116. package/dist/types/loaders/configure/public-path.d.ts.map +1 -0
  117. package/dist/types/loaders/configure/public-path.npm.d.ts +2 -0
  118. package/dist/types/loaders/configure/public-path.npm.d.ts.map +1 -0
  119. package/package.json +2 -3
  120. package/src/cdn/pro.js +2 -0
  121. package/src/cdn/spa.js +2 -0
  122. package/src/common/config/state/init.js +21 -17
  123. package/src/common/constants/runtime.js +7 -3
  124. package/src/common/constants/runtime.test.js +8 -0
  125. package/src/common/harvest/harvest-scheduler.test.js +2 -2
  126. package/src/common/harvest/harvest.js +6 -4
  127. package/src/common/harvest/harvest.test.js +17 -0
  128. package/src/common/vitals/__mocks__/web-vitals.js +19 -0
  129. package/src/common/vitals/constants.js +10 -0
  130. package/src/common/vitals/cumulative-layout-shift.js +13 -0
  131. package/src/common/vitals/cumulative-layout-shift.test.js +71 -0
  132. package/src/common/vitals/first-contentful-paint.js +31 -0
  133. package/src/common/vitals/first-contentful-paint.test.js +124 -0
  134. package/src/common/vitals/first-input-delay.js +20 -0
  135. package/src/common/vitals/first-input-delay.test.js +88 -0
  136. package/src/{features/page_view_timing → common/vitals}/first-paint.js +11 -17
  137. package/src/common/vitals/first-paint.test.js +127 -0
  138. package/src/common/vitals/interaction-to-next-paint.js +13 -0
  139. package/src/common/vitals/interaction-to-next-paint.test.js +74 -0
  140. package/src/common/vitals/largest-contentful-paint.js +29 -0
  141. package/src/common/vitals/largest-contentful-paint.test.js +94 -0
  142. package/src/common/vitals/long-task.js +52 -0
  143. package/src/common/vitals/long-task.test.js +122 -0
  144. package/src/common/vitals/time-to-first-byte.js +21 -0
  145. package/src/common/vitals/time-to-first-byte.test.js +147 -0
  146. package/src/common/vitals/vital-metric.js +60 -0
  147. package/src/common/vitals/vital-metric.test.js +171 -0
  148. package/src/features/ajax/aggregate/index.js +5 -1
  149. package/src/features/metrics/aggregate/index.js +11 -4
  150. package/src/features/page_view_event/aggregate/index.js +20 -43
  151. package/src/features/page_view_event/constants.js +0 -3
  152. package/src/features/page_view_event/instrument/index.js +0 -21
  153. package/src/features/page_view_timing/aggregate/index.component-test.js +86 -0
  154. package/src/features/page_view_timing/aggregate/index.js +31 -108
  155. package/src/features/page_view_timing/instrument/index.js +0 -3
  156. package/src/features/session_replay/aggregate/index.component-test.js +10 -10
  157. package/src/features/session_replay/aggregate/index.js +62 -29
  158. package/src/features/session_trace/aggregate/index.js +15 -1
  159. package/src/features/spa/aggregate/index.js +4 -3
  160. package/src/loaders/agent.js +2 -0
  161. package/src/loaders/api/api.js +2 -0
  162. package/src/loaders/api/apiAsync.js +5 -4
  163. package/src/loaders/browser-agent.js +3 -1
  164. package/src/loaders/configure/configure.js +15 -7
  165. package/src/loaders/configure/public-path.js +6 -0
  166. package/src/loaders/configure/public-path.npm.js +4 -0
  167. package/dist/cjs/common/metrics/paint-metrics.js +0 -13
  168. package/dist/cjs/features/page_view_timing/long-tasks.js +0 -75
  169. package/dist/esm/common/metrics/paint-metrics.js +0 -6
  170. package/dist/esm/features/page_view_timing/long-tasks.js +0 -69
  171. package/dist/types/common/metrics/paint-metrics.d.ts +0 -2
  172. package/dist/types/common/metrics/paint-metrics.d.ts.map +0 -1
  173. package/dist/types/features/page_view_timing/first-paint.d.ts +0 -2
  174. package/dist/types/features/page_view_timing/first-paint.d.ts.map +0 -1
  175. package/dist/types/features/page_view_timing/long-tasks.d.ts +0 -2
  176. package/dist/types/features/page_view_timing/long-tasks.d.ts.map +0 -1
  177. package/src/common/metrics/paint-metrics.js +0 -6
  178. package/src/features/page_view_timing/long-tasks.js +0 -60
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/common/constants/runtime.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,qCAEqB;AAErB;;GAEG;AACH,oCAeK;AAEL,oDAUI;AAEJ,qCAAyD;AAEzD,4BAAiE;AAEjE;;;;;;GAMG;AACH,iCAAwE;AAExE,+BAOI;AAEJ,2BAA2E;AAE3E,sCAAwD"}
1
+ {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../../src/common/constants/runtime.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,qCAEqB;AAErB;;GAEG;AACH,oCAeK;AAEL,oDAUI;AAEJ,sCAA2F;AAE3F,qCAAyD;AAEzD,4BAA8E;AAE9E;;;;;;GAMG;AACH,iCAAwE;AAExE,+BAOI;AAEJ,2BAA2E;AAE3E,yCAAqE;AAErE,4BAAyI"}
@@ -8,7 +8,6 @@
8
8
  export class Harvest extends SharedContext {
9
9
  tooManyRequestsDelay: any;
10
10
  obfuscator: Obfuscator;
11
- getScheme: () => "http" | "https";
12
11
  _events: {};
13
12
  /**
14
13
  * Initiate a harvest from multiple sources. An event that corresponds to the endpoint
@@ -1 +1 @@
1
- {"version":3,"file":"harvest.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest.js"],"names":[],"mappings":"AAsBA;;;;;;GAMG;AACH;IAII,0BAA2H;IAC3H,uBAAoD;IACpD,kCAAsH;IAEtH,YAAiB;IAGnB;;;;;OAKG;IACH,aAFW,eAAe,WAWzB;IAED;;;OAGG;IACH,YAFW,eAAe,WAMzB;IAED;;;OAGG;IACH,wBAFW,eAAe,WAMzB;IAED;;;;;;OAMG;IACH,gGAJW,eAAe,GACb,OAAO,CA+EnB;IAGD,0BAmBC;IAED;;;;;;;OAOG;IACH,wBALW,yBAAyB,WACzB,6BAA6B,GAE3B,cAAc,CA2B1B;IAED;;;;;;;OAOG;IACH,uBAHW,cAAc,GACZ,cAAc,CAuB1B;IAED;;;;;OAKG;IACH,aAHW,yBAAyB,YACzB,sBAAsB,QAQhC;CACF;8BAhPY,OAAO,YAAY,EAAE,eAAe;wCACpC,OAAO,YAAY,EAAE,yBAAyB;6BAC9C,OAAO,YAAY,EAAE,cAAc;qCACnC,OAAO,YAAY,EAAE,sBAAsB;4CAC3C,OAAO,YAAY,EAAE,6BAA6B;8BAZjC,2BAA2B;2BAF9B,mBAAmB"}
1
+ {"version":3,"file":"harvest.d.ts","sourceRoot":"","sources":["../../../../src/common/harvest/harvest.js"],"names":[],"mappings":"AAsBA;;;;;;GAMG;AACH;IAII,0BAA2H;IAC3H,uBAAoD;IAEpD,YAAiB;IAGnB;;;;;OAKG;IACH,aAFW,eAAe,WAWzB;IAED;;;OAGG;IACH,YAFW,eAAe,WAMzB;IAED;;;OAGG;IACH,wBAFW,eAAe,WAMzB;IAED;;;;;;OAMG;IACH,gGAJW,eAAe,GACb,OAAO,CAkFnB;IAGD,0BAmBC;IAED;;;;;;;OAOG;IACH,wBALW,yBAAyB,WACzB,6BAA6B,GAE3B,cAAc,CA2B1B;IAED;;;;;;;OAOG;IACH,uBAHW,cAAc,GACZ,cAAc,CAuB1B;IAED;;;;;OAKG;IACH,aAHW,yBAAyB,YACzB,sBAAsB,QAQhC;CACF;8BAlPY,OAAO,YAAY,EAAE,eAAe;wCACpC,OAAO,YAAY,EAAE,yBAAyB;6BAC9C,OAAO,YAAY,EAAE,cAAc;qCACnC,OAAO,YAAY,EAAE,sBAAsB;4CAC3C,OAAO,YAAY,EAAE,6BAA6B;8BAZjC,2BAA2B;2BAF9B,mBAAmB"}
@@ -0,0 +1,11 @@
1
+ export namespace VITAL_NAMES {
2
+ const FIRST_PAINT: string;
3
+ const FIRST_CONTENTFUL_PAINT: string;
4
+ const FIRST_INPUT_DELAY: string;
5
+ const LARGEST_CONTENTFUL_PAINT: string;
6
+ const CUMULATIVE_LAYOUT_SHIFT: string;
7
+ const INTERACTION_TO_NEXT_PAINT: string;
8
+ const LONG_TASK: string;
9
+ const TIME_TO_FIRST_BYTE: string;
10
+ }
11
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/common/vitals/constants.js"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export const cumulativeLayoutShift: VitalMetric;
2
+ import { VitalMetric } from './vital-metric';
3
+ //# sourceMappingURL=cumulative-layout-shift.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cumulative-layout-shift.d.ts","sourceRoot":"","sources":["../../../../src/common/vitals/cumulative-layout-shift.js"],"names":[],"mappings":"AAKA,gDAAmG;4BAHvE,gBAAgB"}
@@ -0,0 +1,3 @@
1
+ export const firstContentfulPaint: VitalMetric;
2
+ import { VitalMetric } from './vital-metric';
3
+ //# sourceMappingURL=first-contentful-paint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"first-contentful-paint.d.ts","sourceRoot":"","sources":["../../../../src/common/vitals/first-contentful-paint.js"],"names":[],"mappings":"AAMA,+CAAuF;4BAF3D,gBAAgB"}
@@ -0,0 +1,3 @@
1
+ export const firstInputDelay: VitalMetric;
2
+ import { VitalMetric } from './vital-metric';
3
+ //# sourceMappingURL=first-input-delay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"first-input-delay.d.ts","sourceRoot":"","sources":["../../../../src/common/vitals/first-input-delay.js"],"names":[],"mappings":"AAKA,0CAA6E;4BAJjD,gBAAgB"}
@@ -0,0 +1,3 @@
1
+ export const firstPaint: VitalMetric;
2
+ import { VitalMetric } from './vital-metric';
3
+ //# sourceMappingURL=first-paint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"first-paint.d.ts","sourceRoot":"","sources":["../../../../src/common/vitals/first-paint.js"],"names":[],"mappings":"AAIA,qCAAkE;4BAFtC,gBAAgB"}
@@ -0,0 +1,3 @@
1
+ export const interactionToNextPaint: VitalMetric;
2
+ import { VitalMetric } from './vital-metric';
3
+ //# sourceMappingURL=interaction-to-next-paint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interaction-to-next-paint.d.ts","sourceRoot":"","sources":["../../../../src/common/vitals/interaction-to-next-paint.js"],"names":[],"mappings":"AAKA,iDAA4F;4BAJhE,gBAAgB"}
@@ -0,0 +1,3 @@
1
+ export const largestContentfulPaint: VitalMetric;
2
+ import { VitalMetric } from './vital-metric';
3
+ //# sourceMappingURL=largest-contentful-paint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"largest-contentful-paint.d.ts","sourceRoot":"","sources":["../../../../src/common/vitals/largest-contentful-paint.js"],"names":[],"mappings":"AAMA,iDAA2F;4BAL/D,gBAAgB"}
@@ -0,0 +1,3 @@
1
+ export const longTask: VitalMetric;
2
+ import { VitalMetric } from './vital-metric';
3
+ //# sourceMappingURL=long-task.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"long-task.d.ts","sourceRoot":"","sources":["../../../../src/common/vitals/long-task.js"],"names":[],"mappings":"AAKA,mCAA8D;4BAFlC,gBAAgB"}
@@ -0,0 +1,3 @@
1
+ export const timeToFirstByte: VitalMetric;
2
+ import { VitalMetric } from './vital-metric';
3
+ //# sourceMappingURL=time-to-first-byte.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time-to-first-byte.d.ts","sourceRoot":"","sources":["../../../../src/common/vitals/time-to-first-byte.js"],"names":[],"mappings":"AAKA,0CAA8E;4BAHlD,gBAAgB"}
@@ -0,0 +1,18 @@
1
+ export class VitalMetric {
2
+ constructor(name: any, roundingMethod: any);
3
+ history: any[];
4
+ name: any;
5
+ attrs: {};
6
+ roundingMethod: any;
7
+ update({ value, entries, attrs, shouldAddConnectionAttributes }: {
8
+ value: any;
9
+ entries?: any[] | undefined;
10
+ attrs?: {} | undefined;
11
+ shouldAddConnectionAttributes?: boolean | undefined;
12
+ }): void;
13
+ get current(): any;
14
+ get isValid(): boolean;
15
+ subscribe(callback: any, buffered?: boolean): (() => void) | undefined;
16
+ #private;
17
+ }
18
+ //# sourceMappingURL=vital-metric.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vital-metric.d.ts","sourceRoot":"","sources":["../../../../src/common/vitals/vital-metric.js"],"names":[],"mappings":"AAAA;IAIE,4CAIC;IAND,eAAY;IAGV,UAAgB;IAChB,UAAe;IACf,oBAAwF;IAG1F;;;;;aAiBC;IAED,mBAOC;IAED,uBAEC;IAED,uEAMC;;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/ajax/aggregate/index.js"],"names":[],"mappings":"AAgBA;IACE,2BAAiC;IACjC,mDA4NC;IArMC,qGAAwB;IACxB;;;;4BAAoC;IACpC;;;mBAA2E;CAoM9E;8BAjO6B,4BAA4B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/ajax/aggregate/index.js"],"names":[],"mappings":"AAgBA;IACE,2BAAiC;IACjC,mDAgOC;IAzMC,qGAAwB;IACxB;;;;4BAAoC;IACpC;;;mBAA2E;CAwM9E;8BArO6B,4BAA4B"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/metrics/aggregate/index.js"],"names":[],"mappings":"AAYA;IACE,2BAAiC;IACjC,mDAsBC;IAED,wDAKC;IAED,iDAKC;IAED,qBAgCC;IAED,0BAOC;IAED,eA0CC;IAvCG,mCAAyB;CAwC9B;8BAhI6B,4BAA4B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/metrics/aggregate/index.js"],"names":[],"mappings":"AAYA;IACE,2BAAiC;IACjC,mDAwBC;IAED,wDAKC;IAED,iDAKC;IAED,qBAqCC;IAED,0BAOC;IAED,eA0CC;IAvCG,mCAAyB;CAwC9B;8BAvI6B,4BAA4B"}
@@ -1,8 +1,9 @@
1
1
  export class Aggregate extends AggregateBase {
2
2
  static featureName: string;
3
3
  constructor(agentIdentifier: any, aggregator: any);
4
- alreadySent: boolean | undefined;
5
- getScheme(): "http" | "https";
4
+ timeToFirstByte: number;
5
+ firstByteToWindowLoad: number;
6
+ firstByteToDomContent: number;
6
7
  sendRum(): void;
7
8
  }
8
9
  import { AggregateBase } from '../../utils/aggregate-base';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/page_view_event/aggregate/index.js"],"names":[],"mappings":"AAeA;IACE,2BAA2C;IAC3C,mDA2BC;IAvBG,iCAAwB;IAyB5B,8BAEC;IAED,gBAyFC;CACF;8BA/H6B,4BAA4B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/page_view_event/aggregate/index.js"],"names":[],"mappings":"AAcA;IACE,2BAA2C;IAC3C,mDAoBC;IAjBC,wBAAwB;IACxB,8BAA8B;IAC9B,8BAA8B;IAiBhC,gBA8EC;CACF;8BA5G6B,4BAA4B"}
@@ -1,5 +1,2 @@
1
1
  export const FEATURE_NAME: string;
2
- export const TTFB: "firstbyte";
3
- export const FBTDC: "domcontent";
4
- export const FBTWL: "windowload";
5
2
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/features/page_view_event/constants.js"],"names":[],"mappings":"AAEA,kCAAuD;AACvD,+BAA+B;AAC/B,iCAAiC;AACjC,iCAAiC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/features/page_view_event/constants.js"],"names":[],"mappings":"AAEA,kCAAuD"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/page_view_event/instrument/index.js"],"names":[],"mappings":"AASA;IACE,2BAA2C;IAC3C,mEAmBC;CACF;+BA7B8B,6BAA6B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/page_view_event/instrument/index.js"],"names":[],"mappings":"AAGA;IACE,2BAA2C;IAC3C,mEAIC;CACF;+BAV8B,6BAA6B"}
@@ -4,10 +4,7 @@ export class Aggregate extends AggregateBase {
4
4
  timings: any[];
5
5
  timingsSent: any[];
6
6
  curSessEndRecorded: boolean;
7
- cls: number | null;
8
- alreadySent: Set<any>;
9
7
  scheduler: HarvestScheduler;
10
- addConnectionAttributes(attributes: any): any;
11
8
  /**
12
9
  * Add the time of _document visibilitychange to hidden_ to the next PVT harvest == NRDB pageHide attr.
13
10
  * @param {number} timestamp
@@ -26,6 +23,7 @@ export class Aggregate extends AggregateBase {
26
23
  };
27
24
  } | undefined;
28
25
  getPayload(data: any): string;
26
+ #private;
29
27
  }
30
28
  import { AggregateBase } from '../../utils/aggregate-base';
31
29
  import { HarvestScheduler } from '../../../common/harvest/harvest-scheduler';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/page_view_timing/aggregate/index.js"],"names":[],"mappings":"AAoBA;IACE,2BAAiC;IACjC,mDA4GC;IAzGC,eAAiB;IACjB,mBAAqB;IACrB,4BAA+B;IAC/B,mBAAe;IAKf,sBAA4B;IAkF5B,4BAGQ;IAeV,8CAUC;IAED;;;OAGG;IACH,6BAFW,MAAM,QAOhB;IAED;;OAEG;IACH,uCAUC;IAED,mDAqBC;IAED,qCAKC;IAED,gDAWC;IAGD;;;;kBAWC;IAGD,8BAuBC;CACF;8BA3O6B,4BAA4B;iCAPzB,2CAA2C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/page_view_timing/aggregate/index.js"],"names":[],"mappings":"AAuBA;IACE,2BAAiC;IAMjC,mDAoCC;IAjCC,eAAiB;IACjB,mBAAqB;IACrB,4BAA+B;IAuB7B,4BAGQ;IAOZ;;;OAGG;IACH,6BAFW,MAAM,QAOhB;IAED;;OAEG;IACH,uCAUC;IAED,mDAqBC;IAED,qCAKC;IAED,gDAWC;IAGD;;;;kBAWC;IAGD,8BAuBC;;CACF;8BAnK6B,4BAA4B;iCANzB,2CAA2C"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/page_view_timing/instrument/index.js"],"names":[],"mappings":"AAaA;IACE,2BAAiC;IACjC,mEAaC;CACF;+BApB8B,6BAA6B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/page_view_timing/instrument/index.js"],"names":[],"mappings":"AAYA;IACE,2BAAiC;IACjC,mEAWC;CACF;+BAlB8B,6BAA6B"}
@@ -28,15 +28,27 @@ export class Aggregate extends AggregateBase {
28
28
  * -- When visibility changes from "hidden" -> "visible", it must capture a full snapshot for the replay to work correctly across tabs
29
29
  */
30
30
  hasSnapshot: boolean;
31
+ /** Payload metadata -- Should indicate that the payload being sent has a meta node. The meta node should always precede a snapshot node. */
32
+ hasMeta: boolean;
31
33
  /** Payload metadata -- Should indicate that the payload being sent contains an error. Used for query/filter purposes in UI */
32
34
  hasError: boolean;
33
- /** Payload metadata -- Should indicate when a replay blob started recording. Resets each time a harvest occurs. */
35
+ /** Payload metadata -- Should indicate when a replay blob started recording. Resets each time a harvest occurs.
36
+ * cycle timestamps are used as fallbacks if event timestamps cannot be used
37
+ */
34
38
  timestamp: {
35
- first: undefined;
36
- last: undefined;
39
+ event: {
40
+ first: undefined;
41
+ last: undefined;
42
+ };
43
+ cycle: {
44
+ first: undefined;
45
+ last: undefined;
46
+ };
37
47
  };
38
48
  /** A value which increments with every new mutation node reported. Resets after a harvest is sent */
39
49
  payloadBytesEstimation: number;
50
+ /** Hold on to the last meta node, so that it can be re-inserted if the meta and snapshot nodes are broken up due to harvesting */
51
+ lastMeta: any;
40
52
  /** The method to stop recording. This defaults to a noop, but is overwritten once the recording library is imported and initialized */
41
53
  stopRecording: () => void;
42
54
  scheduler: HarvestScheduler | undefined;
@@ -77,7 +89,7 @@ export class Aggregate extends AggregateBase {
77
89
  store(event: any, isCheckout: any): void;
78
90
  /** force the recording lib to take a full DOM snapshot. This needs to occur in certain cases, like visibility changes */
79
91
  takeFullSnapshot(): void;
80
- setTimestamps(rrwebEvent: any): void;
92
+ setTimestamps(event: any): void;
81
93
  clearTimestamps(): void;
82
94
  /** Estimate the payload size */
83
95
  getPayloadSize(newBytes?: number): any;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_replay/aggregate/index.js"],"names":[],"mappings":"AAwBA,4CAA4C;AAE5C,mCAAmC;AAInC,uCAAuC;AACvC,uCAAuC;AACvC,iCAAiC;AACjC,uCAAuC;AAIvC;IACE,2BAAiC;IACjC,mDA4FC;IA1FC,iHAAiH;IACjH,cAAgB;IAChB,8GAA8G;IAC9G,wBAAgH;IAChH,iFAAiF;IACjF,qBAAwB;IACxB,mEAAmE;IACnE,sBAAyB;IACzB,6GAA6G;IAC7G,aAAoB;IAGpB,iEAAiE;IACjE,mBAAsB;IACtB,gDAAgD;IAChD,wBAA0B;IAE1B,gGAAgG;IAChG,sBAAyB;IACzB;;;MAGE;IACF,qBAAwB;IACxB,+HAA+H;IAC/H,kBAAqB;IAErB,oHAAoH;IACpH;;;MAAsD;IAEtD,qGAAqG;IACrG,+BAA+B;IAO/B,uIAAuI;IACvI,0BAAyE;IAiBvE,wCAKQ;IA+BZ;;;;;;OAMG;IACH,kCALW,OAAO,eACP,OAAO,cACP,OAAO,GACL,IAAI,CAyDhB;IAED;;;;;;;;;oBAaC;IAED;;;;;;;;;MAyBC;IAED,qCAOC;IAED,kFAAkF;IAClF,oBAOC;IAED,qDAAqD;IACrD,uBAyBC;IAED,yHAAyH;IACzH,yCA8BC;IAED,0HAA0H;IAC1H,yBAGC;IAED,qCAIC;IAED,wBAEC;IAED,gCAAgC;IAChC,uCAGC;IAED,yDAAyD;IACzD,cAOC;IAED;;;SAGK;IACL,oCAGC;IAED,yCAGC;CACF;8BA1V6B,4BAA4B;iCALzB,2CAA2C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_replay/aggregate/index.js"],"names":[],"mappings":"AAyBA,4CAA4C;AAE5C,mCAAmC;AAInC,uCAAuC;AACvC,uCAAuC;AACvC,iCAAiC;AACjC,uCAAuC;AAIvC;IACE,2BAAiC;IACjC,mDAmGC;IAjGC,iHAAiH;IACjH,cAAgB;IAChB,8GAA8G;IAC9G,wBAAgH;IAChH,iFAAiF;IACjF,qBAAwB;IACxB,mEAAmE;IACnE,sBAAyB;IACzB,6GAA6G;IAC7G,aAAoB;IAGpB,iEAAiE;IACjE,mBAAsB;IACtB,gDAAgD;IAChD,wBAA0B;IAE1B,gGAAgG;IAChG,sBAAyB;IACzB;;;MAGE;IACF,qBAAwB;IACxB,4IAA4I;IAC5I,iBAAoB;IACpB,+HAA+H;IAC/H,kBAAqB;IAErB;;OAEG;IACH;;;;;;;;;MAA+G;IAE/G,qGAAqG;IACrG,+BAA+B;IAE/B,kIAAkI;IAClI,cAAyB;IAOzB,uIAAuI;IACvI,0BAAyE;IAiBvE,wCAKQ;IA+BZ;;;;;;OAMG;IACH,kCALW,OAAO,eACP,OAAO,cACP,OAAO,GACL,IAAI,CAyDhB;IAED;;;;;;;;;oBAaC;IAED;;;;;;;;;MA4BC;IAED,qCAOC;IAED,kFAAkF;IAClF,oBAQC;IAED,qDAAqD;IACrD,uBA4BC;IAED,yHAAyH;IACzH,yCA4CC;IAED,0HAA0H;IAC1H,yBAGC;IAED,gCAQC;IAED,wBAEC;IAED,gCAAgC;IAChC,uCAGC;IAED,yDAAyD;IACzD,cAOC;IAED;;;SAGK;IACL,oCAGC;IAED,yCAGC;CACF;8BA3X6B,4BAA4B;iCALzB,2CAA2C"}
@@ -37,7 +37,15 @@ export class Aggregate extends AggregateBase {
37
37
  body?: undefined;
38
38
  } | {
39
39
  qs: {
40
- st: string;
40
+ st: any;
41
+ /** hr === "hasReplay" in NR1, standalone is always checked and processed before harvesting
42
+ * so a race condition between ST and SR states should not be a concern if implemented here */
43
+ hr: number;
44
+ /** fts === "firstTimestamp" in NR1, indicates what the earliest NODE timestamp was
45
+ * so that blob parsing doesn't need to happen to support UI/API functions */
46
+ fts: any;
47
+ /** n === "nodeCount" in NR1, a count of nodes in the ST payload, so that blob parsing doesn't need to happen to support UI/API functions */
48
+ n: number;
41
49
  };
42
50
  body: {
43
51
  res: any[];
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_trace/aggregate/index.js"],"names":[],"mappings":"AAiCA;IACE,2BAAiC;IAGjC,iEAyHC;IAvHC,kBAA+C;IAK/C,sBAAiD;IACjD,yBAAc;IACd,sBAAe;IACf,8BAAkB;IAClB,iCAAqB;IACrB,wBAA0G;IAC1G,wBAA4G;IAC5G;;4EAEwE;IACxE,kCAAyB;IAGzB,0CAAsC;IAuGxC,sEAcC;IA6CD,oDAOC;IAGD,oCAwBC;IAGD,uEAkBC;IAED,oDAKC;IAED,wBAwBC;IAED,uCAuBC;IAGD,gDASC;IAID,qCAkBC;IAGD,qEAUC;IAGD,mEAUC;IAGD,yBAeC;IAED;;;;OAIG;IACH,2BAHW,MAAM,GACJ,MAAM,CAsBlB;IAGD;;;;;;;;;;MAwBC;IAED,mEA6BC;;CACF;8BAne6B,4BAA4B;6BAH7B,2BAA2B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_trace/aggregate/index.js"],"names":[],"mappings":"AAiCA;IACE,2BAAiC;IAGjC,iEAyHC;IAvHC,kBAA+C;IAK/C,sBAAiD;IACjD,yBAAc;IACd,sBAAe;IACf,8BAAkB;IAClB,iCAAqB;IACrB,wBAA0G;IAC1G,wBAA4G;IAC5G;;4EAEwE;IACxE,kCAAyB;IAGzB,0CAAsC;IAuGxC,sEAcC;IA6CD,oDAOC;IAGD,oCAwBC;IAGD,uEAkBC;IAED,oDAKC;IAED,wBAwBC;IAED,uCAuBC;IAGD,gDASC;IAID,qCAkBC;IAGD,qEAUC;IAGD,mEAUC;IAGD,yBAeC;IAED;;;;OAIG;IACH,2BAHW,MAAM,GACJ,MAAM,CAsBlB;IAGD;;;;;;YA2BM;0GAC8F;;YAE9F;0FAC8E;;YAE9E,4IAA4I;;;;;;MAKjJ;IAED,mEA6BC;;CACF;8BAjf6B,4BAA4B;6BAH7B,2BAA2B"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/spa/aggregate/index.js"],"names":[],"mappings":"AA0BA;IACE,2BAAiC;IACjC,mDA8rBC;IA3rBC;;;;;;;;;;;;;;;;MAgBC;IAED,uBAAsC;CA0qBzC;8BAvsB6B,4BAA4B;2BAJ/B,cAAc"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/spa/aggregate/index.js"],"names":[],"mappings":"AA2BA;IACE,2BAAiC;IACjC,mDA8rBC;IA3rBC;;;;;;;;;;;;;;;;MAgBC;IAED,uBAAsC;CA0qBzC;8BAzsB6B,4BAA4B;2BAJ/B,cAAc"}
@@ -1 +1 @@
1
- {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../src/loaders/agent.js"],"names":[],"mappings":"AAiBA;;GAEG;AAEH;;;GAGG;AACH;IACE,oDAuBC;IAbC,oCAAsC;IACtC,yCAAiF;IACjF,yBAAkB;IAElB,sCAAsD;IAWxD;;;;;MAOC;IAED,yBAgCC;IAID;;;;;;;;;OASG;IACH,6BAPW;QAAC,MAAM,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,QASrF;IAED;;;;OAIG;IACH,0BAFW,MAAM,QAIhB;IAED;;;;OAIG;IACH,eAFa,mBAAmB,CAI/B;CACF;kCA7GY,OAAO,yBAAyB,EAAE,mBAAmB;0BAjBxC,cAAc;2BAQb,gCAAgC"}
1
+ {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../src/loaders/agent.js"],"names":[],"mappings":"AAmBA;;GAEG;AAEH;;;GAGG;AACH;IACE,oDAuBC;IAbC,oCAAsC;IACtC,yCAAiF;IACjF,yBAAkB;IAElB,sCAAsD;IAWxD;;;;;MAOC;IAED,yBAgCC;IAID;;;;;;;;;OASG;IACH,6BAPW;QAAC,MAAM,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,QASrF;IAED;;;;OAIG;IACH,0BAFW,MAAM,QAIhB;IAED;;;;OAIG;IACH,eAFa,mBAAmB,CAI/B;CACF;kCA7GY,OAAO,yBAAyB,EAAE,mBAAmB;0BAjBxC,cAAc;2BAQb,gCAAgC"}
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/api.js"],"names":[],"mappings":"AAkBA,2CAoBC;AAED;;;;;IA0DE;;;;OAIG;qBAFQ,MAAM;IAWjB;;;;OAIG;iCAFQ,MAAM,GAAC,IAAI;;;;EAwFvB;AAzLD,0CAA0C"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/api.js"],"names":[],"mappings":"AAkBA,2CAoBC;AAED;;;;;IA0DE;;;;OAIG;qBAFQ,MAAM;IAWjB;;;;OAIG;iCAFQ,MAAM,GAAC,IAAI;;;;EA0FvB;AA3LD,0CAA0C"}
@@ -1 +1 @@
1
- {"version":3,"file":"apiAsync.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/apiAsync.js"],"names":[],"mappings":"AAUA,mDAiFC"}
1
+ {"version":3,"file":"apiAsync.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/apiAsync.js"],"names":[],"mappings":"AAUA,mDAkFC"}
@@ -1 +1 @@
1
- {"version":3,"file":"browser-agent.d.ts","sourceRoot":"","sources":["../../../src/loaders/browser-agent.js"],"names":[],"mappings":"AAWA;;;GAGG;AACH;IACE,uBAeC;CACF;sBAhCqB,SAAS"}
1
+ {"version":3,"file":"browser-agent.d.ts","sourceRoot":"","sources":["../../../src/loaders/browser-agent.js"],"names":[],"mappings":"AAYA;;;GAGG;AACH;IACE,uBAgBC;CACF;sBAlCqB,SAAS"}
@@ -1 +1 @@
1
- {"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../../../src/loaders/configure/configure.js"],"names":[],"mappings":"AAMA;;;;;;;;;;EAwCC"}
1
+ {"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../../../src/loaders/configure/configure.js"],"names":[],"mappings":"AASA;;;;;;;;;;EA6CC"}
@@ -0,0 +1,2 @@
1
+ export function redefinePublicPath(url: any): void;
2
+ //# sourceMappingURL=public-path.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-path.d.ts","sourceRoot":"","sources":["../../../../src/loaders/configure/public-path.js"],"names":[],"mappings":"AAEO,mDAGN"}
@@ -0,0 +1,2 @@
1
+ export function redefinePublicPath(): void;
2
+ //# sourceMappingURL=public-path.npm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-path.npm.d.ts","sourceRoot":"","sources":["../../../../src/loaders/configure/public-path.npm.js"],"names":[],"mappings":"AACO,2CAEN"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newrelic/browser-agent",
3
- "version": "1.239.1",
3
+ "version": "1.241.0",
4
4
  "private": false,
5
5
  "author": "New Relic Browser Agent Team <browser-agent@newrelic.com>",
6
6
  "description": "New Relic Browser Agent",
@@ -176,7 +176,7 @@
176
176
  "dependencies": {
177
177
  "core-js": "^3.26.0",
178
178
  "fflate": "^0.7.4",
179
- "rrweb": "^2.0.0-alpha.8",
179
+ "rrweb": "2.0.0-alpha.8",
180
180
  "web-vitals": "^3.1.0"
181
181
  },
182
182
  "devDependencies": {
@@ -236,7 +236,6 @@
236
236
  "jest-extended": "^3.2.4",
237
237
  "jung": "^2.1.0",
238
238
  "just-debounce": "^1.0.0",
239
- "newrelic": "^9.7.5",
240
239
  "node-fetch": "^3.3.0",
241
240
  "npm-run-all": "^4.1.5",
242
241
  "object-inspect": "^1.5.0",
package/src/cdn/pro.js CHANGED
@@ -11,6 +11,7 @@ import { Instrument as InstrumentMetrics } from '../features/metrics/instrument'
11
11
  import { Instrument as InstrumentErrors } from '../features/jserrors/instrument'
12
12
  import { Instrument as InstrumentXhr } from '../features/ajax/instrument'
13
13
  import { Instrument as InstrumentSessionTrace } from '../features/session_trace/instrument'
14
+ import { Instrument as InstrumentSessionReplay } from '../features/session_replay/instrument'
14
15
  import { Instrument as InstrumentPageAction } from '../features/page_action/instrument'
15
16
 
16
17
  new Agent({
@@ -18,6 +19,7 @@ new Agent({
18
19
  InstrumentPageViewEvent,
19
20
  InstrumentPageViewTiming,
20
21
  InstrumentSessionTrace,
22
+ InstrumentSessionReplay,
21
23
  InstrumentXhr,
22
24
  InstrumentMetrics,
23
25
  InstrumentPageAction,
package/src/cdn/spa.js CHANGED
@@ -10,6 +10,7 @@ import { Instrument as InstrumentMetrics } from '../features/metrics/instrument'
10
10
  import { Instrument as InstrumentErrors } from '../features/jserrors/instrument'
11
11
  import { Instrument as InstrumentXhr } from '../features/ajax/instrument'
12
12
  import { Instrument as InstrumentSessionTrace } from '../features/session_trace/instrument'
13
+ import { Instrument as InstrumentSessionReplay } from '../features/session_replay/instrument'
13
14
  import { Instrument as InstrumentSpa } from '../features/spa/instrument'
14
15
  import { Instrument as InstrumentPageAction } from '../features/page_action/instrument'
15
16
 
@@ -19,6 +20,7 @@ new Agent({
19
20
  InstrumentPageViewEvent,
20
21
  InstrumentPageViewTiming,
21
22
  InstrumentSessionTrace,
23
+ InstrumentSessionReplay,
22
24
  InstrumentMetrics,
23
25
  InstrumentPageAction,
24
26
  InstrumentErrors,
@@ -4,10 +4,14 @@ import { getModeledObject } from './configurable'
4
4
 
5
5
  const model = () => {
6
6
  const hiddenState = {
7
- blockSelector: '[data-nr-block]',
8
- maskInputOptions: { password: true }
7
+ block_selector: '[data-nr-block]',
8
+ mask_input_options: { password: true }
9
9
  }
10
10
  return {
11
+ proxy: {
12
+ assets: undefined, // if this value is set, it will be used to overwrite the webpack asset path used to fetch assets
13
+ beacon: undefined // likewise for the url to which we send analytics
14
+ },
11
15
  privacy: { cookies_enabled: true }, // *cli - per discussion, default should be true
12
16
  ajax: { deny_list: undefined, block_internal: true, enabled: true, harvestTimeSeconds: 10, autoStart: true },
13
17
  distributed_tracing: {
@@ -36,29 +40,29 @@ const model = () => {
36
40
  autoStart: true,
37
41
  enabled: false,
38
42
  harvestTimeSeconds: 60,
39
- sampleRate: 0.1,
40
- errorSampleRate: 0.1,
43
+ sampling_rate: 50, // float from 0 - 100
44
+ error_sampling_rate: 50, // float from 0 - 100
41
45
  // recording config settings
42
- maskTextSelector: '*',
43
- maskAllInputs: true,
46
+ mask_text_selector: '*',
47
+ mask_all_inputs: true,
44
48
  // these properties only have getters because they are enforcable constants and should error if someone tries to override them
45
- get blockClass () { return 'nr-block' },
46
- get ignoreClass () { return 'nr-ignore' },
47
- get maskTextClass () { return 'nr-mask' },
49
+ get block_class () { return 'nr-block' },
50
+ get ignore_class () { return 'nr-ignore' },
51
+ get mask_text_class () { return 'nr-mask' },
48
52
  // props with a getter and setter are used to extend enforcable constants with customer input
49
53
  // we must preserve data-nr-block no matter what else the customer sets
50
- get blockSelector () {
51
- return hiddenState.blockSelector
54
+ get block_selector () {
55
+ return hiddenState.block_selector
52
56
  },
53
- set blockSelector (val) {
54
- hiddenState.blockSelector += `,${val}`
57
+ set block_selector (val) {
58
+ hiddenState.block_selector += `,${val}`
55
59
  },
56
60
  // password: must always be present and true no matter what customer sets
57
- get maskInputOptions () {
58
- return hiddenState.maskInputOptions
61
+ get mask_input_options () {
62
+ return hiddenState.mask_input_options
59
63
  },
60
- set maskInputOptions (val) {
61
- hiddenState.maskInputOptions = { ...val, password: true }
64
+ set mask_input_options (val) {
65
+ hiddenState.mask_input_options = { ...val, password: true }
62
66
  }
63
67
  },
64
68
  spa: { enabled: true, harvestTimeSeconds: 10, autoStart: true }
@@ -44,9 +44,11 @@ export const globalScope = isBrowserScope
44
44
  globalThis
45
45
  ))
46
46
 
47
+ export const initiallyHidden = Boolean(globalScope?.document?.visibilityState === 'hidden')
48
+
47
49
  export const initialLocation = '' + globalScope?.location
48
50
 
49
- export const isiOS = /iPad|iPhone|iPod/.test(navigator.userAgent)
51
+ export const isiOS = /iPad|iPhone|iPod/.test(globalScope.navigator?.userAgent)
50
52
 
51
53
  /**
52
54
  * Shared Web Workers introduced in iOS 16.0+ and n/a in 15.6-
@@ -58,7 +60,7 @@ export const isiOS = /iPad|iPhone|iPod/.test(navigator.userAgent)
58
60
  export const iOSBelow16 = (isiOS && typeof SharedWorker === 'undefined')
59
61
 
60
62
  export const ffVersion = (() => {
61
- const match = navigator.userAgent.match(/Firefox[/\s](\d+\.\d+)/)
63
+ const match = globalScope.navigator?.userAgent?.match(/Firefox[/\s](\d+\.\d+)/)
62
64
  if (Array.isArray(match) && match.length >= 2) {
63
65
  return +match[1]
64
66
  }
@@ -68,4 +70,6 @@ export const ffVersion = (() => {
68
70
 
69
71
  export const isIE = Boolean(isBrowserScope && window.document.documentMode) // deprecated property that only works in IE
70
72
 
71
- export const supportsSendBeacon = !!navigator.sendBeacon
73
+ export const supportsSendBeacon = !!globalScope.navigator?.sendBeacon
74
+
75
+ export const offset = Math.floor(globalScope?.performance?.timeOrigin || globalScope?.performance?.timing?.navigationStart || Date.now())
@@ -106,10 +106,12 @@ test.each([
106
106
  { userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 13.4; rv:109.0) Gecko/20100101 Firefox/114.0', expected: false }
107
107
  ])('should set isiOS to $expected for $userAgent', async ({ userAgent, expected }) => {
108
108
  global.navigator.userAgent = userAgent
109
+ global.window = { navigator: global.navigator, document: true }
109
110
 
110
111
  const runtime = await import('./runtime')
111
112
 
112
113
  expect(runtime.isiOS).toEqual(expected)
114
+ delete global.window
113
115
  })
114
116
 
115
117
  test.each([
@@ -127,12 +129,14 @@ test.each([
127
129
  global.SharedWorker = class SharedWorker {}
128
130
  }
129
131
  global.navigator.userAgent = userAgent
132
+ global.window = { navigator: global.navigator, document: true }
130
133
 
131
134
  const runtime = await import('./runtime')
132
135
 
133
136
  delete global.SharedWorker
134
137
 
135
138
  expect(runtime.iOSBelow16).toEqual(expected)
139
+ delete global.window
136
140
  })
137
141
 
138
142
  test.each([
@@ -144,10 +148,12 @@ test.each([
144
148
  { userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 13.4; rv:109.0) Gecko/20100101 Firefox/114.0', expected: 114 }
145
149
  ])('should set ffVersion to $expected for $userAgent', async ({ userAgent, expected }) => {
146
150
  global.navigator.userAgent = userAgent
151
+ global.window = { navigator: global.navigator, document: true }
147
152
 
148
153
  const runtime = await import('./runtime')
149
154
 
150
155
  expect(runtime.ffVersion).toEqual(expected)
156
+ delete global.window
151
157
  })
152
158
 
153
159
  test('should set supportsSendBeacon to false', async () => {
@@ -161,8 +167,10 @@ test('should set supportsSendBeacon to false', async () => {
161
167
 
162
168
  test('should set supportsSendBeacon to true', async () => {
163
169
  global.navigator.sendBeacon = jest.fn()
170
+ global.window = { navigator: global.navigator, document: true }
164
171
 
165
172
  const runtime = await import('./runtime')
166
173
 
167
174
  expect(runtime.supportsSendBeacon).toEqual(true)
175
+ delete global.window
168
176
  })
@@ -36,7 +36,7 @@ describe('unload', () => {
36
36
  expect(subscribeToEOL).toHaveBeenCalledWith(expect.any(Function))
37
37
  })
38
38
 
39
- test('should run onUnload callback', () => {
39
+ test('should run onUnload callback when started', () => {
40
40
  harvestSchedulerInstance.opts.onUnload = jest.fn()
41
41
 
42
42
  eolSubscribeFn()
@@ -44,7 +44,7 @@ describe('unload', () => {
44
44
  expect(harvestSchedulerInstance.opts.onUnload).toHaveBeenCalledTimes(1)
45
45
  })
46
46
 
47
- test('should run harvest when not aborted', () => {
47
+ test('should run harvest when started and not aborted', () => {
48
48
  harvestSchedulerInstance.aborted = false
49
49
 
50
50
  eolSubscribeFn()
@@ -7,7 +7,7 @@ import { obj as encodeObj, param as encodeParam } from '../url/encode'
7
7
  import { stringify } from '../util/stringify'
8
8
  import * as submitData from '../util/submit-data'
9
9
  import { getLocation } from '../url/location'
10
- import { getInfo, getConfigurationValue, getRuntime } from '../config/config'
10
+ import { getInfo, getConfigurationValue, getRuntime, getConfiguration } from '../config/config'
11
11
  import { cleanURL } from '../url/clean-url'
12
12
  import { now } from '../timing/now'
13
13
  import { eventListenerOpts } from '../event-listener/event-listener-opts'
@@ -33,7 +33,6 @@ export class Harvest extends SharedContext {
33
33
 
34
34
  this.tooManyRequestsDelay = getConfigurationValue(this.sharedContext.agentIdentifier, 'harvest.tooManyRequestsDelay') || 60
35
35
  this.obfuscator = new Obfuscator(this.sharedContext)
36
- this.getScheme = () => (getConfigurationValue(this.sharedContext.agentIdentifier, 'ssl') === false) ? 'http' : 'https'
37
36
 
38
37
  this._events = {}
39
38
  }
@@ -96,10 +95,13 @@ export class Harvest extends SharedContext {
96
95
  return false
97
96
  }
98
97
 
98
+ const init = getConfiguration(this.sharedContext.agentIdentifier)
99
+ const protocol = init.ssl === false ? 'http' : 'https'
100
+ const perceviedBeacon = init.proxy.beacon || info.errorBeacon
99
101
  const endpointURLPart = endpoint !== 'rum' ? `/${endpoint}` : ''
100
- let url = `${this.getScheme()}://${info.errorBeacon}${endpointURLPart}/1/${info.licenseKey}`
102
+ let url = `${protocol}://${perceviedBeacon}${endpointURLPart}/1/${info.licenseKey}`
101
103
  if (customUrl) url = customUrl
102
- if (raw) url = `${this.getScheme()}://${info.errorBeacon}/${endpoint}`
104
+ if (raw) url = `${protocol}://${perceviedBeacon}/${endpoint}`
103
105
 
104
106
  const baseParams = !raw && includeBaseParams ? this.baseQueryString() : ''
105
107
  let payloadParams = encodeObj(qs, agentRuntime.maxBytes)