@newrelic/browser-agent 1.249.0 → 1.251.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 (143) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/cjs/common/config/state/init.js +1 -3
  3. package/dist/cjs/common/config/state/originals.js +1 -2
  4. package/dist/cjs/common/constants/env.cdn.js +4 -8
  5. package/dist/cjs/common/constants/env.js +4 -8
  6. package/dist/cjs/common/constants/env.npm.js +4 -8
  7. package/dist/cjs/common/constants/runtime.js +13 -24
  8. package/dist/cjs/common/constants/shared-channel.js +2 -3
  9. package/dist/cjs/common/event-emitter/contextual-ee.js +2 -4
  10. package/dist/cjs/common/event-emitter/handle.js +1 -2
  11. package/dist/cjs/common/harvest/harvest-scheduler.js +4 -4
  12. package/dist/cjs/common/harvest/harvest.js +6 -5
  13. package/dist/cjs/common/harvest/types.js +1 -2
  14. package/dist/cjs/common/ids/bundle-id.js +1 -2
  15. package/dist/cjs/common/ids/unique-id.js +1 -1
  16. package/dist/cjs/common/session/constants.js +19 -7
  17. package/dist/cjs/common/session/session-entity.js +8 -26
  18. package/dist/cjs/common/timer/interaction-timer.js +0 -1
  19. package/dist/cjs/common/timing/nav-timing.js +1 -2
  20. package/dist/cjs/common/url/encode.js +2 -0
  21. package/dist/cjs/common/util/feature-flags.js +1 -2
  22. package/dist/cjs/common/vitals/constants.js +2 -3
  23. package/dist/cjs/common/vitals/cumulative-layout-shift.js +1 -2
  24. package/dist/cjs/common/vitals/first-contentful-paint.js +1 -2
  25. package/dist/cjs/common/vitals/first-input-delay.js +1 -2
  26. package/dist/cjs/common/vitals/first-paint.js +1 -2
  27. package/dist/cjs/common/vitals/interaction-to-next-paint.js +1 -2
  28. package/dist/cjs/common/vitals/largest-contentful-paint.js +1 -2
  29. package/dist/cjs/common/vitals/long-task.js +1 -3
  30. package/dist/cjs/common/vitals/time-to-first-byte.js +1 -2
  31. package/dist/cjs/common/window/nreum.js +1 -2
  32. package/dist/cjs/common/wrap/wrap-function.js +2 -4
  33. package/dist/cjs/features/ajax/aggregate/index.js +0 -2
  34. package/dist/cjs/features/ajax/constants.js +1 -2
  35. package/dist/cjs/features/jserrors/aggregate/index.js +0 -1
  36. package/dist/cjs/features/jserrors/aggregate/string-hash-code.js +0 -1
  37. package/dist/cjs/features/jserrors/constants.js +1 -2
  38. package/dist/cjs/features/metrics/aggregate/index.js +3 -1
  39. package/dist/cjs/features/metrics/constants.js +5 -10
  40. package/dist/cjs/features/page_action/constants.js +1 -2
  41. package/dist/cjs/features/page_view_event/aggregate/index.js +2 -2
  42. package/dist/cjs/features/page_view_event/constants.js +1 -2
  43. package/dist/cjs/features/page_view_event/instrument/index.js +2 -2
  44. package/dist/cjs/features/page_view_timing/constants.js +1 -2
  45. package/dist/cjs/features/session_replay/aggregate/index.js +128 -289
  46. package/dist/cjs/features/session_replay/constants.js +50 -3
  47. package/dist/cjs/features/session_replay/instrument/index.js +30 -8
  48. package/dist/cjs/features/session_replay/shared/recorder-events.js +33 -0
  49. package/dist/cjs/features/session_replay/shared/recorder.js +201 -0
  50. package/dist/cjs/features/session_replay/{replay-mode.js → shared/replay-mode.js} +5 -5
  51. package/dist/cjs/features/session_replay/shared/stylesheet-evaluator.js +94 -0
  52. package/dist/cjs/features/session_trace/aggregate/index.js +25 -27
  53. package/dist/cjs/features/session_trace/constants.js +8 -16
  54. package/dist/cjs/features/session_trace/instrument/index.js +2 -2
  55. package/dist/cjs/features/spa/aggregate/index.js +2 -2
  56. package/dist/cjs/features/spa/aggregate/interaction-node.js +0 -1
  57. package/dist/cjs/features/spa/constants.js +22 -44
  58. package/dist/cjs/features/spa/instrument/index.js +2 -2
  59. package/dist/cjs/features/utils/instrument-base.js +6 -7
  60. package/dist/cjs/features/utils/lazy-feature-loader.js +2 -2
  61. package/dist/cjs/loaders/agent-base.js +61 -15
  62. package/dist/cjs/loaders/agent.js +0 -38
  63. package/dist/cjs/loaders/api/api.js +7 -7
  64. package/dist/cjs/loaders/api/interaction-types.js +1 -2
  65. package/dist/cjs/loaders/features/features.js +3 -5
  66. package/dist/cjs/loaders/micro-agent.js +2 -2
  67. package/dist/esm/common/config/state/init.js +1 -3
  68. package/dist/esm/common/constants/env.cdn.js +1 -1
  69. package/dist/esm/common/constants/env.npm.js +1 -1
  70. package/dist/esm/common/harvest/harvest-scheduler.js +1 -1
  71. package/dist/esm/common/harvest/harvest.js +4 -3
  72. package/dist/esm/common/ids/unique-id.js +1 -1
  73. package/dist/esm/common/session/constants.js +16 -1
  74. package/dist/esm/common/session/session-entity.js +2 -16
  75. package/dist/esm/common/timer/interaction-timer.js +0 -1
  76. package/dist/esm/common/url/encode.js +2 -0
  77. package/dist/esm/common/vitals/long-task.js +0 -1
  78. package/dist/esm/features/ajax/aggregate/index.js +0 -2
  79. package/dist/esm/features/jserrors/aggregate/index.js +0 -1
  80. package/dist/esm/features/jserrors/aggregate/string-hash-code.js +0 -1
  81. package/dist/esm/features/metrics/aggregate/index.js +3 -1
  82. package/dist/esm/features/session_replay/aggregate/index.js +98 -255
  83. package/dist/esm/features/session_replay/constants.js +49 -1
  84. package/dist/esm/features/session_replay/instrument/index.js +24 -1
  85. package/dist/esm/features/session_replay/shared/recorder-events.js +26 -0
  86. package/dist/esm/features/session_replay/shared/recorder.js +194 -0
  87. package/dist/esm/features/session_replay/{replay-mode.js → shared/replay-mode.js} +4 -4
  88. package/dist/esm/features/session_replay/shared/stylesheet-evaluator.js +88 -0
  89. package/dist/esm/features/session_trace/aggregate/index.js +2 -4
  90. package/dist/esm/features/spa/aggregate/interaction-node.js +0 -1
  91. package/dist/esm/features/utils/instrument-base.js +0 -1
  92. package/dist/esm/loaders/agent-base.js +62 -15
  93. package/dist/esm/loaders/agent.js +0 -38
  94. package/dist/types/common/harvest/harvest.d.ts +1 -1
  95. package/dist/types/common/harvest/harvest.d.ts.map +1 -1
  96. package/dist/types/common/session/constants.d.ts +15 -0
  97. package/dist/types/common/session/session-entity.d.ts +0 -15
  98. package/dist/types/common/session/session-entity.d.ts.map +1 -1
  99. package/dist/types/common/url/encode.d.ts +1 -1
  100. package/dist/types/common/url/encode.d.ts.map +1 -1
  101. package/dist/types/features/metrics/aggregate/index.d.ts.map +1 -1
  102. package/dist/types/features/session_replay/aggregate/index.d.ts +7 -63
  103. package/dist/types/features/session_replay/aggregate/index.d.ts.map +1 -1
  104. package/dist/types/features/session_replay/constants.d.ts +55 -0
  105. package/dist/types/features/session_replay/constants.d.ts.map +1 -1
  106. package/dist/types/features/session_replay/instrument/index.d.ts +2 -0
  107. package/dist/types/features/session_replay/instrument/index.d.ts.map +1 -1
  108. package/dist/types/features/session_replay/shared/recorder-events.d.ts +23 -0
  109. package/dist/types/features/session_replay/shared/recorder-events.d.ts.map +1 -0
  110. package/dist/types/features/session_replay/shared/recorder.d.ts +53 -0
  111. package/dist/types/features/session_replay/shared/recorder.d.ts.map +1 -0
  112. package/dist/types/features/session_replay/shared/replay-mode.d.ts.map +1 -0
  113. package/dist/types/features/session_replay/shared/stylesheet-evaluator.d.ts +22 -0
  114. package/dist/types/features/session_replay/shared/stylesheet-evaluator.d.ts.map +1 -0
  115. package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -1
  116. package/dist/types/loaders/agent-base.d.ts +48 -12
  117. package/dist/types/loaders/agent-base.d.ts.map +1 -1
  118. package/dist/types/loaders/agent.d.ts +0 -33
  119. package/dist/types/loaders/agent.d.ts.map +1 -1
  120. package/package.json +49 -49
  121. package/src/common/config/state/init.js +1 -1
  122. package/src/common/harvest/harvest-scheduler.js +1 -1
  123. package/src/common/harvest/harvest.js +4 -3
  124. package/src/common/ids/__mocks__/bundle-id.js +1 -1
  125. package/src/common/ids/__mocks__/unique-id.js +2 -2
  126. package/src/common/ids/unique-id.js +1 -1
  127. package/src/common/session/__mocks__/session-entity.js +0 -6
  128. package/src/common/session/constants.js +18 -0
  129. package/src/common/session/session-entity.js +1 -17
  130. package/src/common/url/encode.js +2 -1
  131. package/src/features/metrics/aggregate/index.js +3 -1
  132. package/src/features/session_replay/aggregate/index.js +91 -246
  133. package/src/features/session_replay/constants.js +45 -0
  134. package/src/features/session_replay/instrument/index.js +18 -1
  135. package/src/features/session_replay/shared/recorder-events.js +27 -0
  136. package/src/features/session_replay/shared/recorder.js +190 -0
  137. package/src/features/session_replay/{replay-mode.js → shared/replay-mode.js} +4 -4
  138. package/src/features/session_replay/shared/stylesheet-evaluator.js +84 -0
  139. package/src/features/session_trace/aggregate/index.js +2 -2
  140. package/src/loaders/agent-base.js +59 -15
  141. package/src/loaders/agent.js +0 -38
  142. package/dist/types/features/session_replay/replay-mode.d.ts.map +0 -1
  143. /package/dist/types/features/session_replay/{replay-mode.d.ts → shared/replay-mode.d.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,32 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.251.0](https://github.com/newrelic/newrelic-browser-agent/compare/v1.250.0...v1.251.0) (2024-01-24)
7
+
8
+
9
+ ### Features
10
+
11
+ * Session Replay - Detect Non-Inlined Stylesheets ([#859](https://github.com/newrelic/newrelic-browser-agent/issues/859)) ([69a8e00](https://github.com/newrelic/newrelic-browser-agent/commit/69a8e00ce66c41a29f551697299246763e7ae29f))
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * Add fallback for currentBufferTarget ([#861](https://github.com/newrelic/newrelic-browser-agent/issues/861)) ([f43b791](https://github.com/newrelic/newrelic-browser-agent/commit/f43b7914ec1f26f610cbaa1a513bac482a3d6534))
17
+ * Bubble Up API Methods to Top-Level Instance For NPM ([#862](https://github.com/newrelic/newrelic-browser-agent/issues/862)) ([cd6324f](https://github.com/newrelic/newrelic-browser-agent/commit/cd6324fb79edab77725d9c72f91d2bcb7e860f57))
18
+
19
+ ## [1.250.0](https://github.com/newrelic/newrelic-browser-agent/compare/v1.249.0...v1.250.0) (2024-01-09)
20
+
21
+
22
+ ### Features
23
+
24
+ * Add a flag to note that a payload occurred during a replay ([#834](https://github.com/newrelic/newrelic-browser-agent/issues/834)) ([1b898c6](https://github.com/newrelic/newrelic-browser-agent/commit/1b898c61fa260bd0df644b4825ddb6d1c9b54b51))
25
+ * Session Replay Dynamic Loading ([#832](https://github.com/newrelic/newrelic-browser-agent/issues/832)) ([1af7b89](https://github.com/newrelic/newrelic-browser-agent/commit/1af7b896ef41c8b4855ca85e2a4e40c20a8cdfb1))
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * TraceId generation regression (non-random trace ids) ([#853](https://github.com/newrelic/newrelic-browser-agent/issues/853)) ([8767f69](https://github.com/newrelic/newrelic-browser-agent/commit/8767f69122853a4099ed25f5886a91de06703c98))
31
+
6
32
  ## [1.249.0](https://github.com/newrelic/newrelic-browser-agent/compare/v1.248.0...v1.249.0) (2023-12-14)
7
33
 
8
34
 
@@ -36,7 +36,6 @@ const model = () => {
36
36
  password: true // This will be enforced to always be true in the setter
37
37
  }
38
38
  };
39
-
40
39
  return {
41
40
  feature_flags: [],
42
41
  proxy: {
@@ -44,7 +43,6 @@ const model = () => {
44
43
  // if this value is set, it will be used to overwrite the webpack asset path used to fetch assets
45
44
  beacon: undefined // likewise for the url to which we send analytics
46
45
  },
47
-
48
46
  privacy: {
49
47
  cookies_enabled: true
50
48
  },
@@ -115,7 +113,7 @@ const model = () => {
115
113
  collect_fonts: false,
116
114
  // serialize fonts for collection without public asset url, this is currently broken in RRWeb -- https://github.com/rrweb-io/rrweb/issues/1304. When fixed, revisit with test cases
117
115
  inline_images: false,
118
- // serialize images for collection without public asset url
116
+ // serialize images for collection without public asset url -- right now this is only useful for testing as it easily generates payloads too large to be harvested
119
117
  inline_stylesheet: true,
120
118
  // serialize css for collection without public asset url
121
119
  // recording config settings
@@ -5,5 +5,4 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.originals = void 0;
7
7
  var _nreum = require("../../window/nreum");
8
- const originals = (0, _nreum.gosNREUMOriginals)().o;
9
- exports.originals = originals;
8
+ const originals = exports.originals = (0, _nreum.gosNREUMOriginals)().o;
@@ -12,24 +12,20 @@ exports.VERSION = exports.RRWEB_VERSION = exports.DIST_METHOD = exports.BUILD_EN
12
12
  /**
13
13
  * Exposes the version of the agent
14
14
  */
15
- const VERSION = "1.249.0";
15
+ const VERSION = exports.VERSION = "1.251.0";
16
16
 
17
17
  /**
18
18
  * Exposes the build type of the agent
19
19
  * Valid values are LOCAL, PROD, DEV
20
20
  */
21
- exports.VERSION = VERSION;
22
- const BUILD_ENV = "CDN";
21
+ const BUILD_ENV = exports.BUILD_ENV = "CDN";
23
22
 
24
23
  /**
25
24
  * Exposes the distribution method of the agent
26
25
  */
27
- exports.BUILD_ENV = BUILD_ENV;
28
- const DIST_METHOD = 'CDN';
26
+ const DIST_METHOD = exports.DIST_METHOD = 'CDN';
29
27
 
30
28
  /**
31
29
  * Exposes the lib version of rrweb
32
30
  */
33
- exports.DIST_METHOD = DIST_METHOD;
34
- const RRWEB_VERSION = "2.0.0-alpha.11";
35
- exports.RRWEB_VERSION = RRWEB_VERSION;
31
+ const RRWEB_VERSION = exports.RRWEB_VERSION = "2.0.0-alpha.11";
@@ -16,23 +16,19 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
16
16
  /**
17
17
  * Exposes the version of the agent
18
18
  */
19
- const VERSION = _package.default.version;
19
+ const VERSION = exports.VERSION = _package.default.version;
20
20
 
21
21
  /**
22
22
  * Exposes the build type of the agent
23
23
  */
24
- exports.VERSION = VERSION;
25
- const BUILD_ENV = 'NPM';
24
+ const BUILD_ENV = exports.BUILD_ENV = 'NPM';
26
25
 
27
26
  /**
28
27
  * Exposes the distribution method of the agent
29
28
  */
30
- exports.BUILD_ENV = BUILD_ENV;
31
- const DIST_METHOD = 'NPM';
29
+ const DIST_METHOD = exports.DIST_METHOD = 'NPM';
32
30
 
33
31
  /**
34
32
  * Exposes the lib version of rrweb
35
33
  */
36
- exports.DIST_METHOD = DIST_METHOD;
37
- const RRWEB_VERSION = _package.default.dependencies.rrweb;
38
- exports.RRWEB_VERSION = RRWEB_VERSION;
34
+ const RRWEB_VERSION = exports.RRWEB_VERSION = _package.default.dependencies.rrweb;
@@ -12,25 +12,21 @@ exports.VERSION = exports.RRWEB_VERSION = exports.DIST_METHOD = exports.BUILD_EN
12
12
  /**
13
13
  * Exposes the version of the agent
14
14
  */
15
- const VERSION = "1.249.0";
15
+ const VERSION = exports.VERSION = "1.251.0";
16
16
 
17
17
  /**
18
18
  * Exposes the build type of the agent
19
19
  * Valid values are LOCAL, PROD, DEV
20
20
  */
21
- exports.VERSION = VERSION;
22
- const BUILD_ENV = 'NPM';
21
+ const BUILD_ENV = exports.BUILD_ENV = 'NPM';
23
22
 
24
23
  /**
25
24
  * Exposes the distribution method of the agent
26
25
  * Valid valuse are CDN, NPM
27
26
  */
28
- exports.BUILD_ENV = BUILD_ENV;
29
- const DIST_METHOD = 'NPM';
27
+ const DIST_METHOD = exports.DIST_METHOD = 'NPM';
30
28
 
31
29
  /**
32
30
  * Exposes the lib version of rrweb
33
31
  */
34
- exports.DIST_METHOD = DIST_METHOD;
35
- const RRWEB_VERSION = "2.0.0-alpha.11";
36
- exports.RRWEB_VERSION = RRWEB_VERSION;
32
+ const RRWEB_VERSION = exports.RRWEB_VERSION = "2.0.0-alpha.11";
@@ -14,23 +14,17 @@ exports.supportsSendBeacon = exports.offset = exports.loadedAsDeferredBrowserScr
14
14
  /**
15
15
  * Indicates if the agent is running within a normal browser window context.
16
16
  */
17
- const isBrowserScope = typeof window !== 'undefined' && !!window.document;
17
+ const isBrowserScope = exports.isBrowserScope = typeof window !== 'undefined' && !!window.document;
18
18
 
19
19
  /**
20
20
  * Indicates if the agent is running within a worker context.
21
21
  */
22
- exports.isBrowserScope = isBrowserScope;
23
- const isWorkerScope = typeof WorkerGlobalScope !== 'undefined' && (typeof self !== 'undefined' && self instanceof WorkerGlobalScope && self.navigator instanceof WorkerNavigator || typeof globalThis !== 'undefined' && globalThis instanceof WorkerGlobalScope && globalThis.navigator instanceof WorkerNavigator);
24
- exports.isWorkerScope = isWorkerScope;
25
- const globalScope = isBrowserScope ? window : typeof WorkerGlobalScope !== 'undefined' && (typeof self !== 'undefined' && self instanceof WorkerGlobalScope && self || typeof globalThis !== 'undefined' && globalThis instanceof WorkerGlobalScope && globalThis);
26
- exports.globalScope = globalScope;
27
- const loadedAsDeferredBrowserScript = globalScope?.document?.readyState === 'complete';
28
- exports.loadedAsDeferredBrowserScript = loadedAsDeferredBrowserScript;
29
- const initiallyHidden = Boolean(globalScope?.document?.visibilityState === 'hidden');
30
- exports.initiallyHidden = initiallyHidden;
31
- const initialLocation = '' + globalScope?.location;
32
- exports.initialLocation = initialLocation;
33
- const isiOS = /iPad|iPhone|iPod/.test(globalScope.navigator?.userAgent);
22
+ const isWorkerScope = exports.isWorkerScope = typeof WorkerGlobalScope !== 'undefined' && (typeof self !== 'undefined' && self instanceof WorkerGlobalScope && self.navigator instanceof WorkerNavigator || typeof globalThis !== 'undefined' && globalThis instanceof WorkerGlobalScope && globalThis.navigator instanceof WorkerNavigator);
23
+ const globalScope = exports.globalScope = isBrowserScope ? window : typeof WorkerGlobalScope !== 'undefined' && (typeof self !== 'undefined' && self instanceof WorkerGlobalScope && self || typeof globalThis !== 'undefined' && globalThis instanceof WorkerGlobalScope && globalThis);
24
+ const loadedAsDeferredBrowserScript = exports.loadedAsDeferredBrowserScript = globalScope?.document?.readyState === 'complete';
25
+ const initiallyHidden = exports.initiallyHidden = Boolean(globalScope?.document?.visibilityState === 'hidden');
26
+ const initialLocation = exports.initialLocation = '' + globalScope?.location;
27
+ const isiOS = exports.isiOS = /iPad|iPhone|iPod/.test(globalScope.navigator?.userAgent);
34
28
 
35
29
  /**
36
30
  * Shared Web Workers introduced in iOS 16.0+ and n/a in 15.6-
@@ -39,20 +33,15 @@ const isiOS = /iPad|iPhone|iPod/.test(globalScope.navigator?.userAgent);
39
33
  * did not work. This affects our onFCP metric in particular since web-vitals uses that flag to retrieve paint timing entries.
40
34
  * This was fixed in v16+.
41
35
  */
42
- exports.isiOS = isiOS;
43
- const iOSBelow16 = isiOS && typeof SharedWorker === 'undefined';
44
- exports.iOSBelow16 = iOSBelow16;
45
- const ffVersion = (() => {
36
+ const iOSBelow16 = exports.iOSBelow16 = isiOS && typeof SharedWorker === 'undefined';
37
+ const ffVersion = exports.ffVersion = (() => {
46
38
  const match = globalScope.navigator?.userAgent?.match(/Firefox[/\s](\d+\.\d+)/);
47
39
  if (Array.isArray(match) && match.length >= 2) {
48
40
  return +match[1];
49
41
  }
50
42
  return 0;
51
43
  })();
52
- exports.ffVersion = ffVersion;
53
- const isIE = Boolean(isBrowserScope && window.document.documentMode); // deprecated property that only works in IE
54
- exports.isIE = isIE;
55
- const supportsSendBeacon = !!globalScope.navigator?.sendBeacon;
56
- exports.supportsSendBeacon = supportsSendBeacon;
57
- const offset = Math.floor(globalScope?.performance?.timeOrigin || globalScope?.performance?.timing?.navigationStart || Date.now());
58
- exports.offset = offset;
44
+ const isIE = exports.isIE = Boolean(isBrowserScope && window.document.documentMode); // deprecated property that only works in IE
45
+
46
+ const supportsSendBeacon = exports.supportsSendBeacon = !!globalScope.navigator?.sendBeacon;
47
+ const offset = exports.offset = Math.floor(globalScope?.performance?.timeOrigin || globalScope?.performance?.timing?.navigationStart || Date.now());
@@ -14,8 +14,7 @@ let onReplayReady;
14
14
  const sessionReplayInitialized = new Promise(resolve => {
15
15
  onReplayReady = resolve;
16
16
  });
17
- const sharedChannel = Object.freeze({
17
+ const sharedChannel = exports.sharedChannel = Object.freeze({
18
18
  onReplayReady,
19
19
  sessionReplayInitialized
20
- });
21
- exports.sharedChannel = sharedChannel;
20
+ });
@@ -15,13 +15,11 @@ var _bundleId = require("../ids/bundle-id");
15
15
  */
16
16
 
17
17
  // create a unique id to store event context data for the current agent bundle
18
- const contextId = "nr@context:".concat(_bundleId.bundleId);
18
+ const contextId = exports.contextId = "nr@context:".concat(_bundleId.bundleId);
19
19
  // create global emitter instance that can be shared among bundles
20
- exports.contextId = contextId;
21
- const globalInstance = ee(undefined, 'globalEE');
20
+ const globalInstance = exports.ee = ee(undefined, 'globalEE');
22
21
 
23
22
  // Only override the exposed event emitter if one has not already been exposed
24
- exports.ee = globalInstance;
25
23
  const nr = (0, _nreum.gosNREUM)();
26
24
  if (!nr.ee) {
27
25
  nr.ee = globalInstance;
@@ -11,8 +11,7 @@ var _contextualEe = require("./contextual-ee");
11
11
  * SPDX-License-Identifier: Apache-2.0
12
12
  */
13
13
 
14
- var handleEE = _contextualEe.ee.get('handle');
15
- exports.handleEE = handleEE;
14
+ var handleEE = exports.handleEE = _contextualEe.ee.get('handle');
16
15
  function handle(type, args, ctx, group, ee) {
17
16
  if (ee) {
18
17
  ee.buffer([type], group);
@@ -8,9 +8,9 @@ var submitData = _interopRequireWildcard(require("../util/submit-data"));
8
8
  var _sharedContext = require("../context/shared-context");
9
9
  var _harvest = require("./harvest");
10
10
  var _eol = require("../unload/eol");
11
- var _sessionEntity = require("../session/session-entity");
12
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
11
+ var _constants = require("../session/constants");
12
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
13
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
14
14
  /*
15
15
  * Copyright 2020 New Relic Corporation. All rights reserved.
16
16
  * SPDX-License-Identifier: Apache-2.0
@@ -47,7 +47,7 @@ class HarvestScheduler extends _sharedContext.SharedContext {
47
47
  /* Flush all buffered data if session resets and give up retries. This should be synchronous to ensure that the correct `session` value is sent.
48
48
  Since session-reset generates a new session ID and the ID is grabbed at send-time, any delays or retries would cause the payload to be sent under
49
49
  the wrong session ID. */
50
- this.sharedContext?.ee.on(_sessionEntity.SESSION_EVENTS.RESET, () => this.runHarvest({
50
+ this.sharedContext?.ee.on(_constants.SESSION_EVENTS.RESET, () => this.runHarvest({
51
51
  forceNoRetry: true
52
52
  }));
53
53
  }
@@ -18,8 +18,8 @@ var _sharedContext = require("../context/shared-context");
18
18
  var _env = require("../constants/env.npm");
19
19
  var _runtime = require("../constants/runtime");
20
20
  var _console = require("../util/console");
21
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
22
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
22
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
23
23
  /*
24
24
  * Copyright 2020 New Relic Corporation. All rights reserved.
25
25
  * SPDX-License-Identifier: Apache-2.0
@@ -137,7 +137,7 @@ class Harvest extends _sharedContext.SharedContext {
137
137
  let url = "".concat(protocol, "://").concat(perceviedBeacon).concat(endpointURLPart, "/1/").concat(info.licenseKey);
138
138
  if (customUrl) url = customUrl;
139
139
  if (raw) url = "".concat(protocol, "://").concat(perceviedBeacon, "/").concat(endpoint);
140
- const baseParams = !raw && includeBaseParams ? this.baseQueryString() : '';
140
+ const baseParams = !raw && includeBaseParams ? this.baseQueryString(qs) : '';
141
141
  let payloadParams = (0, _encode.obj)(qs, agentRuntime.maxBytes);
142
142
  if (!submitMethod) {
143
143
  submitMethod = submitData.getSubmitMethod({
@@ -202,7 +202,7 @@ class Harvest extends _sharedContext.SharedContext {
202
202
  }
203
203
 
204
204
  // The stuff that gets sent every time.
205
- baseQueryString() {
205
+ baseQueryString(qs) {
206
206
  const runtime = (0, _config.getRuntime)(this.sharedContext.agentIdentifier);
207
207
  const info = (0, _config.getInfo)(this.sharedContext.agentIdentifier);
208
208
  const location = (0, _cleanUrl.cleanURL)((0, _location.getLocation)());
@@ -211,7 +211,8 @@ class Harvest extends _sharedContext.SharedContext {
211
211
  // ck param DEPRECATED - still expected by backend
212
212
  '&s=' + (runtime.session?.state.value || '0'),
213
213
  // the 0 id encaps all untrackable and default traffic
214
- (0, _encode.param)('ref', ref), (0, _encode.param)('ptid', runtime.ptid ? '' + runtime.ptid : '')].join('');
214
+ (0, _encode.param)('ref', ref), (0, _encode.param)('ptid', runtime.ptid ? '' + runtime.ptid : ''), (0, _encode.param)('hr', runtime?.session?.state.sessionReplayMode === 1 ? '1' : '0', qs) // hasReplay
215
+ ].join('');
215
216
  }
216
217
 
217
218
  /**
@@ -50,5 +50,4 @@ exports.unused = void 0;
50
50
  */
51
51
 
52
52
  /* istanbul ignore next */
53
- const unused = {};
54
- exports.unused = unused;
53
+ const unused = exports.unused = {};
@@ -15,5 +15,4 @@ var _uniqueId = require("./unique-id");
15
15
  /**
16
16
  * Provides a unique id for the current agent bundle
17
17
  */
18
- const bundleId = (0, _uniqueId.generateUuid)();
19
- exports.bundleId = bundleId;
18
+ const bundleId = exports.bundleId = (0, _uniqueId.generateUuid)();
@@ -83,7 +83,7 @@ function generateRandomHexString(length) {
83
83
  }
84
84
  const chars = [];
85
85
  for (var i = 0; i < length; i++) {
86
- chars.push(getRandomValue(randomValueTable, ++randomValueIndex).toString(16));
86
+ chars.push(getRandomValue(randomValueTable, randomValueIndex++).toString(16));
87
87
  }
88
88
  return chars.join('');
89
89
  }
@@ -3,10 +3,22 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.PREFIX = exports.DEFAULT_INACTIVE_MS = exports.DEFAULT_EXPIRES_MS = void 0;
7
- const PREFIX = 'NRBA';
8
- exports.PREFIX = PREFIX;
9
- const DEFAULT_EXPIRES_MS = 14400000;
10
- exports.DEFAULT_EXPIRES_MS = DEFAULT_EXPIRES_MS;
11
- const DEFAULT_INACTIVE_MS = 1800000;
12
- exports.DEFAULT_INACTIVE_MS = DEFAULT_INACTIVE_MS;
6
+ exports.SESSION_EVENT_TYPES = exports.SESSION_EVENTS = exports.PREFIX = exports.MODE = exports.DEFAULT_INACTIVE_MS = exports.DEFAULT_EXPIRES_MS = void 0;
7
+ const PREFIX = exports.PREFIX = 'NRBA';
8
+ const DEFAULT_EXPIRES_MS = exports.DEFAULT_EXPIRES_MS = 14400000;
9
+ const DEFAULT_INACTIVE_MS = exports.DEFAULT_INACTIVE_MS = 1800000;
10
+ const SESSION_EVENTS = exports.SESSION_EVENTS = {
11
+ PAUSE: 'session-pause',
12
+ RESET: 'session-reset',
13
+ RESUME: 'session-resume',
14
+ UPDATE: 'session-update'
15
+ };
16
+ const SESSION_EVENT_TYPES = exports.SESSION_EVENT_TYPES = {
17
+ SAME_TAB: 'same-tab',
18
+ CROSS_TAB: 'cross-tab'
19
+ };
20
+ const MODE = exports.MODE = {
21
+ OFF: 0,
22
+ FULL: 1,
23
+ ERROR: 2
24
+ };
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.SessionEntity = exports.SESSION_EVENT_TYPES = exports.SESSION_EVENTS = exports.MODE = void 0;
6
+ exports.SessionEntity = void 0;
7
7
  var _uniqueId = require("../ids/unique-id");
8
8
  var _console = require("../util/console");
9
9
  var _stringify = require("../util/stringify");
@@ -18,37 +18,19 @@ var _handle = require("../event-emitter/handle");
18
18
  var _constants2 = require("../../features/metrics/constants");
19
19
  var _features = require("../../loaders/features/features");
20
20
  var _eventListenerOpts = require("../event-listener/event-listener-opts");
21
- const MODE = {
22
- OFF: 0,
23
- FULL: 1,
24
- ERROR: 2
25
- };
26
21
  // this is what can be stored in local storage (not enforced but probably should be)
27
22
  // these values should sync between local storage and the parent class props
28
- exports.MODE = MODE;
29
23
  const model = {
30
24
  value: '',
31
25
  inactiveAt: 0,
32
26
  expiresAt: 0,
33
27
  updatedAt: Date.now(),
34
- sessionReplayMode: MODE.OFF,
28
+ sessionReplayMode: _constants.MODE.OFF,
35
29
  sessionReplaySentFirstChunk: false,
36
- sessionTraceMode: MODE.OFF,
30
+ sessionTraceMode: _constants.MODE.OFF,
37
31
  traceHarvestStarted: false,
38
32
  custom: {}
39
33
  };
40
- const SESSION_EVENTS = {
41
- PAUSE: 'session-pause',
42
- RESET: 'session-reset',
43
- RESUME: 'session-resume',
44
- UPDATE: 'session-update'
45
- };
46
- exports.SESSION_EVENTS = SESSION_EVENTS;
47
- const SESSION_EVENT_TYPES = {
48
- SAME_TAB: 'same-tab',
49
- CROSS_TAB: 'cross-tab'
50
- };
51
- exports.SESSION_EVENT_TYPES = SESSION_EVENT_TYPES;
52
34
  class SessionEntity {
53
35
  /**
54
36
  * Create a self-managing Session Entity. This entity is scoped to the agent identifier which triggered it, allowing for multiple simultaneous session objects to exist.
@@ -79,7 +61,7 @@ class SessionEntity {
79
61
  if (event.key === this.lookupKey) {
80
62
  const obj = typeof event.newValue === 'string' ? JSON.parse(event.newValue) : event.newValue;
81
63
  this.sync(obj);
82
- this.ee.emit(SESSION_EVENTS.UPDATE, [SESSION_EVENT_TYPES.CROSS_TAB, this.state]);
64
+ this.ee.emit(_constants.SESSION_EVENTS.UPDATE, [_constants.SESSION_EVENT_TYPES.CROSS_TAB, this.state]);
83
65
  }
84
66
  });
85
67
  }
@@ -137,11 +119,11 @@ class SessionEntity {
137
119
  // When the inactive timer refreshes, it will update the storage values with an update timestamp
138
120
  onRefresh: this.refresh.bind(this),
139
121
  onResume: () => {
140
- this.ee.emit(SESSION_EVENTS.RESUME);
122
+ this.ee.emit(_constants.SESSION_EVENTS.RESUME);
141
123
  },
142
124
  // When the inactive timer pauses, update the storage values with an update timestamp
143
125
  onPause: () => {
144
- if (this.initialized) this.ee.emit(SESSION_EVENTS.PAUSE);
126
+ if (this.initialized) this.ee.emit(_constants.SESSION_EVENTS.PAUSE);
145
127
  this.write((0, _configurable.getModeledObject)(this.state, model));
146
128
  },
147
129
  ee: this.ee,
@@ -216,7 +198,7 @@ class SessionEntity {
216
198
  //
217
199
  // TODO - compression would need happen here if we decide to do it
218
200
  this.storage.set(this.lookupKey, (0, _stringify.stringify)(this.state));
219
- this.ee.emit(SESSION_EVENTS.UPDATE, [SESSION_EVENT_TYPES.SAME_TAB, this.state]);
201
+ this.ee.emit(_constants.SESSION_EVENTS.UPDATE, [_constants.SESSION_EVENT_TYPES.SAME_TAB, this.state]);
220
202
  return data;
221
203
  } catch (e) {
222
204
  // storage is inaccessible
@@ -230,7 +212,7 @@ class SessionEntity {
230
212
  // * stop recording (stn and sr)...
231
213
  // * delete the session and start over
232
214
  try {
233
- if (this.initialized) this.ee.emit(SESSION_EVENTS.RESET);
215
+ if (this.initialized) this.ee.emit(_constants.SESSION_EVENTS.RESET);
234
216
  this.storage.remove(this.lookupKey);
235
217
  this.inactiveTimer?.abort?.();
236
218
  this.expiresTimer?.clear?.();
@@ -71,7 +71,6 @@ class InteractionTimer extends _timer.Timer {
71
71
  this.refresh();
72
72
  this.onResume(); // emit resume event after state updated
73
73
  }
74
-
75
74
  refresh(cb, ms) {
76
75
  this.clear();
77
76
  this.timer = this.create(cb, ms);
@@ -32,8 +32,7 @@ var REQUEST = 'request';
32
32
  var RESPONSE = 'response';
33
33
  var LOAD_EVENT = 'loadEvent';
34
34
  var DOM_CONTENT_LOAD_EVENT = 'domContentLoadedEvent';
35
- var navTimingValues = [];
36
- exports.navTimingValues = navTimingValues;
35
+ var navTimingValues = exports.navTimingValues = [];
37
36
  function getPntType(type) {
38
37
  if (typeof type === 'number') return type;
39
38
  const types = {
@@ -72,6 +72,8 @@ function obj(payload, maxBytes) {
72
72
 
73
73
  // Constructs an HTTP parameter to add to the BAM router URL
74
74
  function param(name, value) {
75
+ let base = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
76
+ if (Object.keys(base).includes(name)) return ''; // we assume if feature supplied a matching qp to the base, we should honor what the feature sent over the default
75
77
  if (value && typeof value === 'string') {
76
78
  return '&' + name + '=' + qs(value);
77
79
  }
@@ -54,5 +54,4 @@ function activateFeatures(flags, agentIdentifier) {
54
54
  loaded: true
55
55
  });
56
56
  }
57
- const activatedFeatures = {};
58
- exports.activatedFeatures = activatedFeatures;
57
+ const activatedFeatures = exports.activatedFeatures = {};
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.VITAL_NAMES = void 0;
7
- const VITAL_NAMES = {
7
+ const VITAL_NAMES = exports.VITAL_NAMES = {
8
8
  FIRST_PAINT: 'fp',
9
9
  FIRST_CONTENTFUL_PAINT: 'fcp',
10
10
  FIRST_INPUT_DELAY: 'fi',
@@ -13,5 +13,4 @@ const VITAL_NAMES = {
13
13
  INTERACTION_TO_NEXT_PAINT: 'inp',
14
14
  LONG_TASK: 'lt',
15
15
  TIME_TO_FIRST_BYTE: 'ttfb'
16
- };
17
- exports.VITAL_NAMES = VITAL_NAMES;
16
+ };
@@ -8,8 +8,7 @@ var _webVitals = require("web-vitals");
8
8
  var _constants = require("./constants");
9
9
  var _vitalMetric = require("./vital-metric");
10
10
  var _runtime = require("../constants/runtime");
11
- const cumulativeLayoutShift = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.CUMULATIVE_LAYOUT_SHIFT, x => x);
12
- exports.cumulativeLayoutShift = cumulativeLayoutShift;
11
+ const cumulativeLayoutShift = exports.cumulativeLayoutShift = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.CUMULATIVE_LAYOUT_SHIFT, x => x);
13
12
  if (_runtime.isBrowserScope) {
14
13
  (0, _webVitals.onCLS)(_ref => {
15
14
  let {
@@ -10,10 +10,9 @@ var _constants = require("./constants");
10
10
  var _vitalMetric = require("./vital-metric");
11
11
  // eslint-disable-next-line camelcase
12
12
 
13
- const firstContentfulPaint = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.FIRST_CONTENTFUL_PAINT);
13
+ const firstContentfulPaint = exports.firstContentfulPaint = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.FIRST_CONTENTFUL_PAINT);
14
14
 
15
15
  /* First Contentful Paint - As of WV v3, it still imperfectly tries to detect document vis state asap and isn't supposed to report if page starts hidden. */
16
- exports.firstContentfulPaint = firstContentfulPaint;
17
16
  if (_runtime.isBrowserScope) {
18
17
  // eslint-disable-next-line camelcase
19
18
  if (_runtime.iOSBelow16) {
@@ -8,8 +8,7 @@ var _webVitals = require("web-vitals");
8
8
  var _vitalMetric = require("./vital-metric");
9
9
  var _constants = require("./constants");
10
10
  var _runtime = require("../constants/runtime");
11
- const firstInputDelay = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.FIRST_INPUT_DELAY);
12
- exports.firstInputDelay = firstInputDelay;
11
+ const firstInputDelay = exports.firstInputDelay = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.FIRST_INPUT_DELAY);
13
12
  if (_runtime.isBrowserScope) {
14
13
  (0, _webVitals.onFID)(_ref => {
15
14
  let {
@@ -7,8 +7,7 @@ exports.firstPaint = void 0;
7
7
  var _runtime = require("../constants/runtime");
8
8
  var _constants = require("./constants");
9
9
  var _vitalMetric = require("./vital-metric");
10
- const firstPaint = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.FIRST_PAINT);
11
- exports.firstPaint = firstPaint;
10
+ const firstPaint = exports.firstPaint = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.FIRST_PAINT);
12
11
  if (_runtime.isBrowserScope) {
13
12
  const handleEntries = entries => {
14
13
  entries.forEach(entry => {
@@ -8,8 +8,7 @@ var _webVitals = require("web-vitals");
8
8
  var _vitalMetric = require("./vital-metric");
9
9
  var _constants = require("./constants");
10
10
  var _runtime = require("../constants/runtime");
11
- const interactionToNextPaint = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.INTERACTION_TO_NEXT_PAINT);
12
- exports.interactionToNextPaint = interactionToNextPaint;
11
+ const interactionToNextPaint = exports.interactionToNextPaint = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.INTERACTION_TO_NEXT_PAINT);
13
12
  if (_runtime.isBrowserScope) {
14
13
  /* Interaction-to-Next-Paint */
15
14
  (0, _webVitals.onINP)(_ref => {
@@ -9,8 +9,7 @@ var _vitalMetric = require("./vital-metric");
9
9
  var _constants = require("./constants");
10
10
  var _runtime = require("../constants/runtime");
11
11
  var _cleanUrl = require("../url/clean-url");
12
- const largestContentfulPaint = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.LARGEST_CONTENTFUL_PAINT);
13
- exports.largestContentfulPaint = largestContentfulPaint;
12
+ const largestContentfulPaint = exports.largestContentfulPaint = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.LARGEST_CONTENTFUL_PAINT);
14
13
  if (_runtime.isBrowserScope) {
15
14
  (0, _webVitals.onLCP)(_ref => {
16
15
  let {
@@ -8,8 +8,7 @@ var _runtime = require("../constants/runtime");
8
8
  var _eol = require("../unload/eol");
9
9
  var _constants = require("./constants");
10
10
  var _vitalMetric = require("./vital-metric");
11
- const longTask = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.LONG_TASK);
12
- exports.longTask = longTask;
11
+ const longTask = exports.longTask = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.LONG_TASK);
13
12
  if (_runtime.isBrowserScope) {
14
13
  const handleEntries = entries => {
15
14
  entries.forEach(entry => {
@@ -34,7 +33,6 @@ if (_runtime.isBrowserScope) {
34
33
  });
35
34
  });
36
35
  };
37
-
38
36
  let observer;
39
37
  try {
40
38
  if (PerformanceObserver.supportedEntryTypes.includes('longtask')) {
@@ -8,8 +8,7 @@ var _runtime = require("../constants/runtime");
8
8
  var _constants = require("./constants");
9
9
  var _vitalMetric = require("./vital-metric");
10
10
  var _webVitals = require("web-vitals");
11
- const timeToFirstByte = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.TIME_TO_FIRST_BYTE);
12
- exports.timeToFirstByte = timeToFirstByte;
11
+ const timeToFirstByte = exports.timeToFirstByte = new _vitalMetric.VitalMetric(_constants.VITAL_NAMES.TIME_TO_FIRST_BYTE);
13
12
  if (_runtime.isBrowserScope && typeof PerformanceNavigationTiming !== 'undefined' && !_runtime.isiOS) {
14
13
  (0, _webVitals.onTTFB)(_ref => {
15
14
  let {