@newrelic/browser-agent 1.241.0 → 1.243.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 (132) hide show
  1. package/CHANGELOG.md +1465 -0
  2. package/dist/cjs/cdn/polyfills/lite.js +13 -1
  3. package/dist/cjs/cdn/polyfills/pro.js +17 -1
  4. package/dist/cjs/cdn/polyfills/spa.js +18 -1
  5. package/dist/cjs/common/config/state/init.js +32 -5
  6. package/dist/cjs/common/constants/env.cdn.js +1 -1
  7. package/dist/cjs/common/constants/env.npm.js +1 -1
  8. package/dist/cjs/common/dom/query-selector.js +16 -0
  9. package/dist/cjs/common/session/session-entity.js +20 -2
  10. package/dist/cjs/common/wrap/wrap-function.js +1 -1
  11. package/dist/cjs/features/ajax/aggregate/index.js +1 -1
  12. package/dist/cjs/features/session_replay/aggregate/index.js +84 -50
  13. package/dist/cjs/features/utils/feature-base.js +1 -2
  14. package/dist/cjs/features/utils/instrument-base.js +1 -0
  15. package/dist/cjs/loaders/api/api.js +2 -2
  16. package/dist/cjs/loaders/api/apiAsync.js +0 -37
  17. package/dist/cjs/loaders/configure/configure.js +1 -1
  18. package/dist/cjs/loaders/configure/public-path.js +6 -3
  19. package/dist/esm/cdn/polyfills/lite.js +8 -1
  20. package/dist/esm/cdn/polyfills/pro.js +13 -2
  21. package/dist/esm/cdn/polyfills/spa.js +13 -1
  22. package/dist/esm/common/config/state/init.js +32 -5
  23. package/dist/esm/common/constants/env.cdn.js +1 -1
  24. package/dist/esm/common/constants/env.npm.js +1 -1
  25. package/dist/esm/common/dom/query-selector.js +9 -0
  26. package/dist/esm/common/session/session-entity.js +18 -1
  27. package/dist/esm/common/wrap/wrap-function.js +1 -1
  28. package/dist/esm/features/ajax/aggregate/index.js +1 -1
  29. package/dist/esm/features/session_replay/aggregate/index.js +83 -50
  30. package/dist/esm/features/utils/feature-base.js +1 -2
  31. package/dist/esm/features/utils/instrument-base.js +1 -0
  32. package/dist/esm/loaders/api/api.js +2 -2
  33. package/dist/esm/loaders/api/apiAsync.js +1 -36
  34. package/dist/esm/loaders/configure/configure.js +1 -1
  35. package/dist/esm/loaders/configure/public-path.js +6 -3
  36. package/dist/types/common/config/state/init.d.ts.map +1 -1
  37. package/dist/types/common/dom/query-selector.d.ts +2 -0
  38. package/dist/types/common/dom/query-selector.d.ts.map +1 -0
  39. package/dist/types/common/session/session-entity.d.ts +5 -0
  40. package/dist/types/common/session/session-entity.d.ts.map +1 -1
  41. package/dist/types/features/session_replay/aggregate/index.d.ts +11 -14
  42. package/dist/types/features/session_replay/aggregate/index.d.ts.map +1 -1
  43. package/dist/types/features/utils/feature-base.d.ts.map +1 -1
  44. package/dist/types/features/utils/instrument-base.d.ts.map +1 -1
  45. package/dist/types/loaders/api/api.d.ts.map +1 -1
  46. package/dist/types/loaders/api/apiAsync.d.ts.map +1 -1
  47. package/dist/types/loaders/configure/public-path.d.ts +1 -1
  48. package/dist/types/loaders/configure/public-path.d.ts.map +1 -1
  49. package/package.json +2 -2
  50. package/src/cdn/polyfills/lite.js +14 -1
  51. package/src/cdn/polyfills/pro.js +23 -2
  52. package/src/cdn/polyfills/spa.js +24 -1
  53. package/src/common/config/state/init.js +33 -4
  54. package/src/common/dom/query-selector.js +9 -0
  55. package/src/common/session/session-entity.js +20 -1
  56. package/src/common/wrap/wrap-function.js +1 -1
  57. package/src/features/ajax/aggregate/index.js +2 -2
  58. package/src/features/session_replay/aggregate/index.js +82 -34
  59. package/src/features/utils/feature-base.js +1 -2
  60. package/src/features/utils/instrument-base.js +1 -0
  61. package/src/loaders/api/api.js +1 -2
  62. package/src/loaders/api/apiAsync.js +1 -39
  63. package/src/loaders/configure/configure.js +1 -1
  64. package/src/loaders/configure/public-path.js +6 -3
  65. package/src/common/aggregate/aggregator.test.js +0 -107
  66. package/src/common/config/state/configurable.test.js +0 -73
  67. package/src/common/config/state/info.test.js +0 -31
  68. package/src/common/config/state/init.test.js +0 -28
  69. package/src/common/config/state/loader-config.test.js +0 -21
  70. package/src/common/config/state/runtime.test.js +0 -21
  71. package/src/common/constants/env.cdn.test.js +0 -7
  72. package/src/common/constants/env.npm.test.js +0 -7
  73. package/src/common/constants/env.test.js +0 -7
  74. package/src/common/constants/runtime.test.js +0 -176
  75. package/src/common/deny-list/deny-list.test.js +0 -104
  76. package/src/common/drain/drain.test.js +0 -74
  77. package/src/common/event-emitter/contextual-ee.component-test.js +0 -293
  78. package/src/common/event-emitter/handle.test.js +0 -56
  79. package/src/common/event-emitter/register-handler.test.js +0 -61
  80. package/src/common/harvest/harvest-scheduler.test.js +0 -492
  81. package/src/common/harvest/harvest.test.js +0 -813
  82. package/src/common/ids/id.test.js +0 -92
  83. package/src/common/ids/unique-id.test.js +0 -58
  84. package/src/common/session/session-entity.component-test.js +0 -346
  85. package/src/common/storage/local-storage.test.js +0 -17
  86. package/src/common/timer/interaction-timer.component-test.js +0 -212
  87. package/src/common/timer/timer.test.js +0 -99
  88. package/src/common/timing/nav-timing.test.js +0 -161
  89. package/src/common/url/canonicalize-url.test.js +0 -45
  90. package/src/common/url/clean-url.test.js +0 -25
  91. package/src/common/url/encode.test.js +0 -81
  92. package/src/common/url/location.test.js +0 -15
  93. package/src/common/url/parse-url.test.js +0 -110
  94. package/src/common/url/protocol.test.js +0 -17
  95. package/src/common/util/console.test.js +0 -34
  96. package/src/common/util/data-size.test.js +0 -56
  97. package/src/common/util/feature-flags.test.js +0 -94
  98. package/src/common/util/get-or-set.test.js +0 -58
  99. package/src/common/util/invoke.test.js +0 -65
  100. package/src/common/util/map-own.test.js +0 -52
  101. package/src/common/util/obfuscate.component-test.js +0 -173
  102. package/src/common/util/stringify.test.js +0 -49
  103. package/src/common/util/submit-data.test.js +0 -183
  104. package/src/common/util/traverse.test.js +0 -50
  105. package/src/common/vitals/cumulative-layout-shift.test.js +0 -71
  106. package/src/common/vitals/first-contentful-paint.test.js +0 -124
  107. package/src/common/vitals/first-input-delay.test.js +0 -88
  108. package/src/common/vitals/first-paint.test.js +0 -127
  109. package/src/common/vitals/interaction-to-next-paint.test.js +0 -74
  110. package/src/common/vitals/largest-contentful-paint.test.js +0 -94
  111. package/src/common/vitals/long-task.test.js +0 -122
  112. package/src/common/vitals/time-to-first-byte.test.js +0 -147
  113. package/src/common/vitals/vital-metric.test.js +0 -171
  114. package/src/common/wrap/wrap-promise.component-test.js +0 -110
  115. package/src/features/ajax/instrument/distributed-tracing.test.js +0 -375
  116. package/src/features/jserrors/aggregate/canonical-function-name.test.js +0 -13
  117. package/src/features/jserrors/aggregate/compute-stack-trace.test.js +0 -414
  118. package/src/features/jserrors/aggregate/format-stack-trace.test.js +0 -39
  119. package/src/features/jserrors/aggregate/string-hash-code.test.js +0 -12
  120. package/src/features/metrics/aggregate/framework-detection.test.js +0 -332
  121. package/src/features/page_view_timing/aggregate/index.component-test.js +0 -86
  122. package/src/features/session_replay/aggregate/index.component-test.js +0 -317
  123. package/src/features/spa/aggregate/interaction-node.test.js +0 -17
  124. package/src/features/utils/agent-session.test.js +0 -194
  125. package/src/features/utils/aggregate-base.test.js +0 -123
  126. package/src/features/utils/feature-base.test.js +0 -45
  127. package/src/features/utils/handler-cache.test.js +0 -72
  128. package/src/features/utils/instrument-base.test.js +0 -216
  129. package/src/features/utils/lazy-feature-loader.test.js +0 -37
  130. package/src/loaders/api/api.component-test.js +0 -45
  131. package/src/loaders/api/api.test.js +0 -85
  132. package/src/loaders/api/apiAsync.test.js +0 -17
@@ -1,20 +1,16 @@
1
1
  import { FEATURE_NAMES } from '../features/features';
2
- import { getConfiguration, getInfo, getRuntime } from '../../common/config/config';
2
+ import { getRuntime } from '../../common/config/config';
3
3
  import { ee } from '../../common/event-emitter/contextual-ee';
4
4
  import { handle } from '../../common/event-emitter/handle';
5
5
  import { registerHandler } from '../../common/event-emitter/register-handler';
6
6
  import { single } from '../../common/util/invoke';
7
- import * as submitData from '../../common/util/submit-data';
8
- import { isBrowserScope } from '../../common/constants/runtime';
9
7
  import { CUSTOM_METRIC_CHANNEL } from '../../features/metrics/constants';
10
8
  export function setAPI(agentIdentifier) {
11
9
  var instanceEE = ee.get(agentIdentifier);
12
- var cycle = 0;
13
10
  var api = {
14
11
  finished: single(finished),
15
12
  setErrorHandler,
16
13
  addToTrace,
17
- inlineHit,
18
14
  addRelease
19
15
  };
20
16
 
@@ -50,37 +46,6 @@ export function setAPI(agentIdentifier) {
50
46
  };
51
47
  handle('bstApi', [report], undefined, FEATURE_NAMES.sessionTrace, instanceEE);
52
48
  }
53
-
54
- // NREUM.inlineHit(requestName, queueTime, appTime, totalBackEndTime, domTime, frontEndTime)
55
- //
56
- // requestName - the 'web page' name or service name
57
- // queueTime - the amount of time spent in the app tier queue
58
- // appTime - the amount of time spent in the application code
59
- // totalBackEndTime - the total roundtrip time of the remote service call
60
- // domTime - the time spent processing the result of the service call (or user defined)
61
- // frontEndTime - the time spent rendering the result of the service call (or user defined)
62
- function inlineHit(t, requestName, queueTime, appTime, totalBackEndTime, domTime, frontEndTime) {
63
- if (!isBrowserScope) return;
64
- requestName = window.encodeURIComponent(requestName);
65
- cycle += 1;
66
- const agentInfo = getInfo(agentIdentifier);
67
- if (!agentInfo.beacon) return;
68
- const agentInit = getConfiguration(agentIdentifier);
69
- const scheme = agentInit.ssl === false ? 'http' : 'https';
70
- const beacon = agentInit.proxy.beacon || agentInfo.beacon;
71
- let url = "".concat(scheme, "://").concat(beacon, "/1/").concat(agentInfo.licenseKey);
72
- url += '?a=' + agentInfo.applicationID + '&';
73
- url += 't=' + requestName + '&';
74
- url += 'qt=' + ~~queueTime + '&';
75
- url += 'ap=' + ~~appTime + '&';
76
- url += 'be=' + ~~totalBackEndTime + '&';
77
- url += 'dc=' + ~~domTime + '&';
78
- url += 'fe=' + ~~frontEndTime + '&';
79
- url += 'c=' + cycle;
80
- submitData.xhr({
81
- url
82
- });
83
- }
84
49
  function setErrorHandler(t, handler) {
85
50
  getRuntime(agentIdentifier).onerror = handler;
86
51
  }
@@ -41,7 +41,7 @@ export function configure(agentIdentifier) {
41
41
  if (!alreadySetOnce) {
42
42
  alreadySetOnce = true;
43
43
  if (updatedInit.proxy.assets) {
44
- redefinePublicPath(updatedInit.proxy.assets + '/'); // much like the info.beacon & init.proxy.beacon, this input should not end in a slash, but one is needed for webpack concat
44
+ redefinePublicPath(updatedInit.proxy.assets);
45
45
  internalTrafficList.push(updatedInit.proxy.assets);
46
46
  }
47
47
  if (updatedInit.proxy.beacon) internalTrafficList.push(updatedInit.proxy.beacon);
@@ -1,6 +1,9 @@
1
1
  // Set the default CDN or remote for fetching the assets; NPM shouldn't change this var.
2
2
 
3
- export const redefinePublicPath = url => {
4
- // There's no URL validation here, so caller should check arg if need be.
5
- __webpack_public_path__ = url; // eslint-disable-line
3
+ export const redefinePublicPath = urlString => {
4
+ const isOrigin = urlString.startsWith('http');
5
+ // Input is not expected to end in a slash, but webpack concats as-is, so one is inserted.
6
+ urlString += '/';
7
+ // If there's no existing HTTP scheme, the secure protocol is prepended by default.
8
+ __webpack_public_path__ = isOrigin ? urlString : 'https://' + urlString; // eslint-disable-line
6
9
  };
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/init.js"],"names":[],"mappings":"AA0EA,+CAIC;AAED,0DAIC;AAED,+DAYC"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../../src/common/config/state/init.js"],"names":[],"mappings":"AAuGA,+CAIC;AAED,0DAIC;AAED,+DAYC"}
@@ -0,0 +1,2 @@
1
+ export function isValidSelector(selector: any): boolean;
2
+ //# sourceMappingURL=query-selector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-selector.d.ts","sourceRoot":"","sources":["../../../../src/common/dom/query-selector.js"],"names":[],"mappings":"AAAO,wDAQN"}
@@ -7,6 +7,11 @@ export namespace SESSION_EVENTS {
7
7
  const PAUSE: string;
8
8
  const RESET: string;
9
9
  const RESUME: string;
10
+ const UPDATE: string;
11
+ }
12
+ export namespace SESSION_EVENT_TYPES {
13
+ const SAME_TAB: string;
14
+ const CROSS_TAB: string;
10
15
  }
11
16
  export class SessionEntity {
12
17
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"session-entity.d.ts","sourceRoot":"","sources":["../../../../src/common/session/session-entity.js"],"names":[],"mappings":";;;;;;;;;;AAoCA;IACE;;;;;OAKG;IACH,uBAgBC;IAVC,qBAAsC;IACtC,aAAsB;IACtB,UAAe;IAGf,SAAc;IAEd,QAAiC;IAKnC;;;;aAsEC;IA/DC,8BAA0B;IAC1B,+BAA4B;IAc1B,gCAOqC;IAUrC,4CAiBsC;IAOV,2BAA6C;IAM3E,iCAAuB;IAIzB,wBAEC;IAED,sBAEC;IAED;;;OAGG;IACH,QAFa,MAAM,CA6BlB;IAED;;;;;;OAMG;IACH,YAHW,MAAM,GACJ,MAAM,CAiBlB;IAED,gBAuBC;IAED;;OAEG;IACH,gBAIC;IAED;;;OAGG;IACH,qBAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;OAGG;IACH,gBAHW,MAAM,GACJ,OAAO,CAKnB;IAED,yDAYC;IAED;;;OAGG;IACH,6BAHW,MAAM,GACJ,MAAM,CAIlB;IAED,gDAaC;IAHG,YAAuD;CAI5D;sBA1RqB,gBAAgB;iCAGL,4BAA4B"}
1
+ {"version":3,"file":"session-entity.d.ts","sourceRoot":"","sources":["../../../../src/common/session/session-entity.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AA4CA;IACE;;;;;OAKG;IACH,uBA0BC;IApBC,qBAAsC;IACtC,aAAsB;IACtB,UAAe;IAGf,SAAc;IAEd,QAAiC;IAenC;;;;aAsEC;IA/DC,8BAA0B;IAC1B,+BAA4B;IAc1B,gCAOqC;IAUrC,4CAiBsC;IAOV,2BAA6C;IAM3E,iCAAuB;IAIzB,wBAEC;IAED,sBAEC;IAED;;;OAGG;IACH,QAFa,MAAM,CA6BlB;IAED;;;;;;OAMG;IACH,YAHW,MAAM,GACJ,MAAM,CAkBlB;IAED,gBAuBC;IAED;;OAEG;IACH,gBAIC;IAED;;;OAGG;IACH,qBAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;OAGG;IACH,gBAHW,MAAM,GACJ,OAAO,CAKnB;IAED,yDAYC;IAED;;;OAGG;IACH,6BAHW,MAAM,GACJ,MAAM,CAIlB;IAED,gDAaC;IAHG,YAAuD;CAI5D;sBA7SqB,gBAAgB;iCAGL,4BAA4B"}
@@ -1,5 +1,13 @@
1
1
  export const RRWEB_VERSION: "2.0.0-alpha.8";
2
2
  export const AVG_COMPRESSION: 0.12;
3
+ export namespace RRWEB_EVENT_TYPES {
4
+ const DomContentLoaded: number;
5
+ const Load: number;
6
+ const FullSnapshot: number;
7
+ const IncrementalSnapshot: number;
8
+ const Meta: number;
9
+ const Custom: number;
10
+ }
3
11
  /** Vortex caps payload sizes at 1MB */
4
12
  export const MAX_PAYLOAD_SIZE: 1000000;
5
13
  /** Unloading caps around 64kb */
@@ -21,8 +29,6 @@ export class Aggregate extends AggregateBase {
21
29
  recording: boolean;
22
30
  /** can shut off efforts to compress the data */
23
31
  shouldCompress: boolean;
24
- /** Payload metadata -- Should indicate that the payload being sent is the first of a session */
25
- isFirstChunk: boolean;
26
32
  /** Payload metadata -- Should indicate that the payload being sent has a full DOM snapshot. This can happen
27
33
  * -- When the recording library begins recording, it starts by taking a DOM snapshot
28
34
  * -- When visibility changes from "hidden" -> "visible", it must capture a full snapshot for the replay to work correctly across tabs
@@ -35,16 +41,7 @@ export class Aggregate extends AggregateBase {
35
41
  /** Payload metadata -- Should indicate when a replay blob started recording. Resets each time a harvest occurs.
36
42
  * cycle timestamps are used as fallbacks if event timestamps cannot be used
37
43
  */
38
- timestamp: {
39
- event: {
40
- first: undefined;
41
- last: undefined;
42
- };
43
- cycle: {
44
- first: undefined;
45
- last: undefined;
46
- };
47
- };
44
+ cycleTimestamp: any;
48
45
  /** A value which increments with every new mutation node reported. Resets after a harvest is sent */
49
46
  payloadBytesEstimation: number;
50
47
  /** 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 */
@@ -89,12 +86,12 @@ export class Aggregate extends AggregateBase {
89
86
  store(event: any, isCheckout: any): void;
90
87
  /** force the recording lib to take a full DOM snapshot. This needs to occur in certain cases, like visibility changes */
91
88
  takeFullSnapshot(): void;
92
- setTimestamps(event: any): void;
89
+ setTimestamps(): void;
93
90
  clearTimestamps(): void;
94
91
  /** Estimate the payload size */
95
92
  getPayloadSize(newBytes?: number): any;
96
93
  /** Abort the feature, once aborted it will not resume */
97
- abort(): void;
94
+ abort(reason?: {}): void;
98
95
  /** Extensive research has yielded about an 88% compression factor on these payloads.
99
96
  * This is an estimation using that factor as to not cause performance issues while evaluating
100
97
  * https://staging.onenr.io/037jbJWxbjy
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_replay/aggregate/index.js"],"names":[],"mappings":"AA0BA,4CAA4C;AAE5C,mCAAmC;;;;;;;;;AAgCnC,uCAAuC;AACvC,uCAAuC;AACvC,iCAAiC;AACjC,uCAAuC;AAIvC;IACE,2BAAiC;IACjC,mDA2GC;IAzGC,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;;;MAGE;IACF,qBAAwB;IACxB,4IAA4I;IAC5I,iBAAoB;IACpB,+HAA+H;IAC/H,kBAAqB;IAErB;;OAEG;IACH,oBAA+B;IAE/B,qGAAqG;IACrG,+BAA+B;IAE/B,kIAAkI;IAClI,cAAyB;IAOzB,uIAAuI;IACvI,0BAAyE;IA0BvE,wCAKQ;IAgCZ;;;;;;OAMG;IACH,kCALW,OAAO,eACP,OAAO,cACP,OAAO,GACL,IAAI,CAuDhB;IAED;;;;;;;;;oBAeC;IAED;;;;;;;;;MAiDC;IAED,qCAOC;IAED,kFAAkF;IAClF,oBAOC;IAED,qDAAqD;IACrD,uBA4BC;IAED,yHAAyH;IACzH,yCAsCC;IAED,0HAA0H;IAC1H,yBAGC;IAED,sBAGC;IAED,wBAEC;IAED,gCAAgC;IAChC,uCAGC;IAED,yDAAyD;IACzD,yBASC;IAED;;;SAGK;IACL,oCAGC;IAED,yCAGC;CACF;8BA3a6B,4BAA4B;iCALzB,2CAA2C"}
@@ -1 +1 @@
1
- {"version":3,"file":"feature-base.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/feature-base.js"],"names":[],"mappings":"AAGA;IACE,qEAeC;IAdC,qBAAqB;IACrB,iBADW,MAAM,CACqB;IACtC,yBAAyB;IACzB,uBAA4B;IAC5B,2BAA2B;IAC3B,iBAAmF;IACnF,qBAAqB;IACrB,aADW,MAAM,CACa;IAC9B;;;;OAIG;IACH,SAFU,OAAO,CAEG;CAEvB"}
1
+ {"version":3,"file":"feature-base.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/feature-base.js"],"names":[],"mappings":"AAEA;IACE,qEAeC;IAdC,qBAAqB;IACrB,iBADW,MAAM,CACqB;IACtC,yBAAyB;IACzB,uBAA4B;IAC5B,2BAA2B;IAC3B,iBAAiC;IACjC,qBAAqB;IACrB,aADW,MAAM,CACa;IAC9B;;;;OAIG;IACH,SAFU,OAAO,CAEG;CAEvB"}
@@ -1 +1 @@
1
- {"version":3,"file":"instrument-base.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/instrument-base.js"],"names":[],"mappings":"AAcA;;;GAGG;AACH;IACE;;;;;;;;OAQG;IACH,6BAPW,MAAM,uCAEN,MAAM,8BA4BhB;IArBC,cAAgB;IAEhB,8IAA8I;IAC9I,cADW,WAAW,SAAS,CACF;IAE7B;;;MAGE;IACF,qBAA8B;IAE9B;;;MAGE;IACF,kCAAoC;IAQtC;;;;;OAKG;IACH,mEA2DC;IAED;;;;;KAKC;IACD,6BAJS,MAAM,mCAWd;CACF;4BA/H2B,gBAAgB"}
1
+ {"version":3,"file":"instrument-base.d.ts","sourceRoot":"","sources":["../../../../src/features/utils/instrument-base.js"],"names":[],"mappings":"AAcA;;;GAGG;AACH;IACE;;;;;;;;OAQG;IACH,6BAPW,MAAM,uCAEN,MAAM,8BA4BhB;IArBC,cAAgB;IAEhB,8IAA8I;IAC9I,cADW,WAAW,SAAS,CACF;IAE7B;;;MAGE;IACF,qBAA8B;IAE9B;;;MAGE;IACF,kCAAoC;IAQtC;;;;;OAKG;IACH,mEA4DC;IAED;;;;;KAKC;IACD,6BAJS,MAAM,mCAWd;CACF;4BAhI2B,gBAAgB"}
@@ -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;;;;EA0FvB;AA3LD,0CAA0C"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/api.js"],"names":[],"mappings":"AAkBA,2CAoBC;AAED;;;;;IAyDE;;;;OAIG;qBAFQ,MAAM;IAWjB;;;;OAIG;iCAFQ,MAAM,GAAC,IAAI;;;;EA0FvB;AA1LD,0CAA0C"}
@@ -1 +1 @@
1
- {"version":3,"file":"apiAsync.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/apiAsync.js"],"names":[],"mappings":"AAUA,mDAkFC"}
1
+ {"version":3,"file":"apiAsync.d.ts","sourceRoot":"","sources":["../../../../src/loaders/api/apiAsync.js"],"names":[],"mappings":"AAQA,mDA8CC"}
@@ -1,2 +1,2 @@
1
- export function redefinePublicPath(url: any): void;
1
+ export function redefinePublicPath(urlString: any): void;
2
2
  //# sourceMappingURL=public-path.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"public-path.d.ts","sourceRoot":"","sources":["../../../../src/loaders/configure/public-path.js"],"names":[],"mappings":"AAEO,mDAGN"}
1
+ {"version":3,"file":"public-path.d.ts","sourceRoot":"","sources":["../../../../src/loaders/configure/public-path.js"],"names":[],"mappings":"AAEO,yDAMN"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newrelic/browser-agent",
3
- "version": "1.241.0",
3
+ "version": "1.243.0",
4
4
  "private": false,
5
5
  "author": "New Relic Browser Agent Team <browser-agent@newrelic.com>",
6
6
  "description": "New Relic Browser Agent",
@@ -266,6 +266,6 @@
266
266
  "src",
267
267
  "LICENSE",
268
268
  "README.md",
269
- "types.ts"
269
+ "CHANGELOG.md"
270
270
  ]
271
271
  }
@@ -4,4 +4,17 @@
4
4
  */
5
5
 
6
6
  import '../polyfills.js'
7
- import '../lite'
7
+ import { Agent } from '../../loaders/agent'
8
+
9
+ import { Instrument as InstrumentPageViewEvent } from '../../features/page_view_event/instrument'
10
+ import { Instrument as InstrumentPageViewTiming } from '../../features/page_view_timing/instrument'
11
+ import { Instrument as InstrumentMetrics } from '../../features/metrics/instrument'
12
+
13
+ new Agent({
14
+ features: [
15
+ InstrumentPageViewEvent,
16
+ InstrumentPageViewTiming,
17
+ InstrumentMetrics
18
+ ],
19
+ loaderType: 'lite-polyfills'
20
+ })
@@ -1,7 +1,28 @@
1
1
  /**
2
- * @file Creates a version of the "Pro" agent loader with [core-js]{@link https://github.com/zloirock/core-js}
2
+ * @file Creates a version of the "PRO" agent loader with [core-js]{@link https://github.com/zloirock/core-js}
3
3
  * polyfills for pre-ES6 browsers and IE 11.
4
4
  */
5
5
 
6
6
  import '../polyfills.js'
7
- import '../pro'
7
+ import { Agent } from '../../loaders/agent'
8
+
9
+ import { Instrument as InstrumentPageViewEvent } from '../../features/page_view_event/instrument'
10
+ import { Instrument as InstrumentPageViewTiming } from '../../features/page_view_timing/instrument'
11
+ import { Instrument as InstrumentMetrics } from '../../features/metrics/instrument'
12
+ import { Instrument as InstrumentErrors } from '../../features/jserrors/instrument'
13
+ import { Instrument as InstrumentXhr } from '../../features/ajax/instrument'
14
+ import { Instrument as InstrumentSessionTrace } from '../../features/session_trace/instrument'
15
+ import { Instrument as InstrumentPageAction } from '../../features/page_action/instrument'
16
+
17
+ new Agent({
18
+ features: [
19
+ InstrumentPageViewEvent,
20
+ InstrumentPageViewTiming,
21
+ InstrumentSessionTrace,
22
+ InstrumentXhr,
23
+ InstrumentMetrics,
24
+ InstrumentPageAction,
25
+ InstrumentErrors
26
+ ],
27
+ loaderType: 'pro-polyfills'
28
+ })
@@ -4,4 +4,27 @@
4
4
  */
5
5
 
6
6
  import '../polyfills.js'
7
- import '../spa'
7
+ import { Agent } from '../../loaders/agent'
8
+
9
+ import { Instrument as InstrumentPageViewEvent } from '../../features/page_view_event/instrument'
10
+ import { Instrument as InstrumentPageViewTiming } from '../../features/page_view_timing/instrument'
11
+ import { Instrument as InstrumentMetrics } from '../../features/metrics/instrument'
12
+ import { Instrument as InstrumentErrors } from '../../features/jserrors/instrument'
13
+ import { Instrument as InstrumentXhr } from '../../features/ajax/instrument'
14
+ import { Instrument as InstrumentSessionTrace } from '../../features/session_trace/instrument'
15
+ import { Instrument as InstrumentSpa } from '../../features/spa/instrument'
16
+ import { Instrument as InstrumentPageAction } from '../../features/page_action/instrument'
17
+
18
+ new Agent({
19
+ features: [
20
+ InstrumentXhr,
21
+ InstrumentPageViewEvent,
22
+ InstrumentPageViewTiming,
23
+ InstrumentSessionTrace,
24
+ InstrumentMetrics,
25
+ InstrumentPageAction,
26
+ InstrumentErrors,
27
+ InstrumentSpa
28
+ ],
29
+ loaderType: 'spa-polyfills'
30
+ })
@@ -1,11 +1,32 @@
1
+ import { isValidSelector } from '../../dom/query-selector'
1
2
  import { DEFAULT_EXPIRES_MS, DEFAULT_INACTIVE_MS } from '../../session/constants'
3
+ import { warn } from '../../util/console'
2
4
  import { gosNREUMInitializedAgents } from '../../window/nreum'
3
5
  import { getModeledObject } from './configurable'
4
6
 
5
7
  const model = () => {
6
8
  const hiddenState = {
9
+ mask_selector: '*',
7
10
  block_selector: '[data-nr-block]',
8
- mask_input_options: { password: true }
11
+ mask_input_options: {
12
+ color: false,
13
+ date: false,
14
+ 'datetime-local': false,
15
+ email: false,
16
+ month: false,
17
+ number: false,
18
+ range: false,
19
+ search: false,
20
+ tel: false,
21
+ text: false,
22
+ time: false,
23
+ url: false,
24
+ week: false,
25
+ // unify textarea and select element with text input
26
+ textarea: false,
27
+ select: false,
28
+ password: true // This will be enforced to always be true in the setter
29
+ }
9
30
  }
10
31
  return {
11
32
  proxy: {
@@ -43,8 +64,14 @@ const model = () => {
43
64
  sampling_rate: 50, // float from 0 - 100
44
65
  error_sampling_rate: 50, // float from 0 - 100
45
66
  // recording config settings
46
- mask_text_selector: '*',
47
67
  mask_all_inputs: true,
68
+ // this has a getter/setter to facilitate validation of the selectors
69
+ get mask_text_selector () { return hiddenState.mask_selector },
70
+ set mask_text_selector (val) {
71
+ if (isValidSelector(val)) hiddenState.mask_selector = val + ',[data-nr-mask]'
72
+ else if (val === null) hiddenState.mask_selector = val // null is acceptable, which completely disables the behavior
73
+ else warn('An invalid session_replay.mask_selector was provided and will not be used', val)
74
+ },
48
75
  // these properties only have getters because they are enforcable constants and should error if someone tries to override them
49
76
  get block_class () { return 'nr-block' },
50
77
  get ignore_class () { return 'nr-ignore' },
@@ -55,14 +82,16 @@ const model = () => {
55
82
  return hiddenState.block_selector
56
83
  },
57
84
  set block_selector (val) {
58
- hiddenState.block_selector += `,${val}`
85
+ if (isValidSelector(val)) hiddenState.block_selector += `,${val}`
86
+ else if (val !== '') warn('An invalid session_replay.block_selector was provided and will not be used', val)
59
87
  },
60
88
  // password: must always be present and true no matter what customer sets
61
89
  get mask_input_options () {
62
90
  return hiddenState.mask_input_options
63
91
  },
64
92
  set mask_input_options (val) {
65
- hiddenState.mask_input_options = { ...val, password: true }
93
+ if (val && typeof val === 'object') hiddenState.mask_input_options = { ...val, password: true }
94
+ else warn('An invalid session_replay.mask_input_option was provided and will not be used', val)
66
95
  }
67
96
  },
68
97
  spa: { enabled: true, harvestTimeSeconds: 10, autoStart: true }
@@ -0,0 +1,9 @@
1
+ export const isValidSelector = (selector) => {
2
+ if (!selector || typeof selector !== 'string') return false
3
+ try {
4
+ document.createDocumentFragment().querySelector(selector)
5
+ } catch {
6
+ return false
7
+ }
8
+ return true
9
+ }
@@ -11,6 +11,7 @@ import { getModeledObject } from '../config/state/configurable'
11
11
  import { handle } from '../event-emitter/handle'
12
12
  import { SUPPORTABILITY_METRIC_CHANNEL } from '../../features/metrics/constants'
13
13
  import { FEATURE_NAMES } from '../../loaders/features/features'
14
+ import { windowAddEventListener } from '../event-listener/event-listener-opts'
14
15
 
15
16
  export const MODE = {
16
17
  OFF: 0,
@@ -25,13 +26,20 @@ const model = {
25
26
  expiresAt: 0,
26
27
  updatedAt: Date.now(),
27
28
  sessionReplay: MODE.OFF,
29
+ sessionReplaySentFirstChunk: false,
28
30
  sessionTraceMode: MODE.OFF,
29
31
  custom: {}
30
32
  }
31
33
  export const SESSION_EVENTS = {
32
34
  PAUSE: 'session-pause',
33
35
  RESET: 'session-reset',
34
- RESUME: 'session-resume'
36
+ RESUME: 'session-resume',
37
+ UPDATE: 'session-update'
38
+ }
39
+
40
+ export const SESSION_EVENT_TYPES = {
41
+ SAME_TAB: 'same-tab',
42
+ CROSS_TAB: 'cross-tab'
35
43
  }
36
44
 
37
45
  export class SessionEntity {
@@ -57,6 +65,16 @@ export class SessionEntity {
57
65
  this.ee = ee.get(agentIdentifier)
58
66
  wrapEvents(this.ee)
59
67
  this.setup(opts)
68
+
69
+ if (isBrowserScope) {
70
+ windowAddEventListener('storage', (event) => {
71
+ if (event.key === this.lookupKey) {
72
+ const obj = typeof event.newValue === 'string' ? JSON.parse(event.newValue) : event.newValue
73
+ this.sync(obj)
74
+ this.ee.emit(SESSION_EVENTS.UPDATE, [SESSION_EVENT_TYPES.CROSS_TAB, this.state])
75
+ }
76
+ })
77
+ }
60
78
  }
61
79
 
62
80
  setup ({ value = generateRandomHexString(16), expiresMs = DEFAULT_EXPIRES_MS, inactiveMs = DEFAULT_INACTIVE_MS }) {
@@ -189,6 +207,7 @@ export class SessionEntity {
189
207
  //
190
208
  // TODO - compression would need happen here if we decide to do it
191
209
  this.storage.set(this.lookupKey, stringify(this.state))
210
+ this.ee.emit(SESSION_EVENTS.UPDATE, [SESSION_EVENT_TYPES.SAME_TAB, this.state])
192
211
  return data
193
212
  } catch (e) {
194
213
  // storage is inaccessible
@@ -215,5 +215,5 @@ function copy (from, to, emitter) {
215
215
  * @returns {boolean} Whether the passed function is ineligible to be wrapped.
216
216
  */
217
217
  function notWrappable (fn) {
218
- return !(fn && fn instanceof Function && fn.apply && !fn[flag])
218
+ return !(fn && typeof fn === 'function' && fn.apply && !fn[flag])
219
219
  }
@@ -81,8 +81,6 @@ export class Aggregate extends AggregateBase {
81
81
  hash = stringify([params.status, params.host, params.pathname])
82
82
  }
83
83
 
84
- handle('bstXhrAgg', ['xhr', hash, params, metrics], undefined, FEATURE_NAMES.sessionTrace, ee)
85
-
86
84
  // store as metric
87
85
  aggregator.store('xhr', hash, params, metrics)
88
86
 
@@ -98,6 +96,8 @@ export class Aggregate extends AggregateBase {
98
96
  return
99
97
  }
100
98
 
99
+ handle('bstXhrAgg', ['xhr', hash, params, metrics], undefined, FEATURE_NAMES.sessionTrace, ee)
100
+
101
101
  var xhrContext = this
102
102
 
103
103
  var event = {