@newrelic/browser-agent 1.260.1 → 1.261.1

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 (149) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/cjs/cdn/experimental.js +2 -1
  3. package/dist/cjs/cdn/polyfills/pro.js +2 -1
  4. package/dist/cjs/cdn/polyfills/spa.js +2 -1
  5. package/dist/cjs/cdn/pro.js +2 -1
  6. package/dist/cjs/cdn/spa.js +2 -1
  7. package/dist/cjs/common/config/state/init.js +31 -24
  8. package/dist/cjs/common/constants/env.cdn.js +1 -1
  9. package/dist/cjs/common/constants/env.js +1 -1
  10. package/dist/cjs/common/constants/env.npm.js +1 -1
  11. package/dist/cjs/common/deny-list/deny-list.js +1 -1
  12. package/dist/cjs/common/harvest/harvest-scheduler.js +1 -1
  13. package/dist/cjs/common/harvest/harvest.js +1 -1
  14. package/dist/cjs/common/session/session-entity.js +7 -1
  15. package/dist/cjs/common/wrap/wrap-logger.js +54 -0
  16. package/dist/cjs/features/ajax/aggregate/index.js +1 -1
  17. package/dist/cjs/features/logging/aggregate/index.js +102 -0
  18. package/dist/cjs/features/logging/constants.js +20 -0
  19. package/dist/cjs/features/logging/index.js +12 -0
  20. package/dist/cjs/features/logging/instrument/index.js +28 -0
  21. package/dist/cjs/features/logging/shared/log.js +39 -0
  22. package/dist/cjs/features/logging/shared/utils.js +50 -0
  23. package/dist/cjs/features/page_view_event/aggregate/index.js +1 -1
  24. package/dist/cjs/features/page_view_event/instrument/index.js +1 -1
  25. package/dist/cjs/features/page_view_timing/aggregate/index.js +1 -2
  26. package/dist/cjs/features/session_replay/aggregate/index.js +4 -3
  27. package/dist/cjs/features/session_replay/instrument/index.js +1 -1
  28. package/dist/cjs/features/session_trace/aggregate/index.js +15 -8
  29. package/dist/cjs/features/session_trace/instrument/index.js +1 -1
  30. package/dist/cjs/features/spa/aggregate/index.js +2 -2
  31. package/dist/cjs/features/spa/instrument/index.js +1 -1
  32. package/dist/cjs/features/utils/aggregate-base.js +4 -1
  33. package/dist/cjs/features/utils/instrument-base.js +3 -2
  34. package/dist/cjs/features/utils/lazy-feature-loader.js +3 -1
  35. package/dist/cjs/loaders/agent-base.js +23 -2
  36. package/dist/cjs/loaders/api/api-methods.js +1 -1
  37. package/dist/cjs/loaders/api/api.js +29 -2
  38. package/dist/cjs/loaders/features/features.js +7 -5
  39. package/dist/cjs/loaders/micro-agent.js +1 -1
  40. package/dist/esm/cdn/experimental.js +2 -1
  41. package/dist/esm/cdn/polyfills/pro.js +2 -1
  42. package/dist/esm/cdn/polyfills/spa.js +2 -1
  43. package/dist/esm/cdn/pro.js +2 -1
  44. package/dist/esm/cdn/spa.js +2 -1
  45. package/dist/esm/common/config/state/init.js +30 -23
  46. package/dist/esm/common/constants/env.cdn.js +1 -1
  47. package/dist/esm/common/constants/env.npm.js +1 -1
  48. package/dist/esm/common/deny-list/deny-list.js +1 -1
  49. package/dist/esm/common/session/session-entity.js +8 -2
  50. package/dist/esm/common/wrap/wrap-logger.js +48 -0
  51. package/dist/esm/features/logging/aggregate/index.js +95 -0
  52. package/dist/esm/features/logging/constants.js +14 -0
  53. package/dist/esm/features/logging/index.js +1 -0
  54. package/dist/esm/features/logging/instrument/index.js +21 -0
  55. package/dist/esm/features/logging/shared/log.js +32 -0
  56. package/dist/esm/features/logging/shared/utils.js +44 -0
  57. package/dist/esm/features/page_view_timing/aggregate/index.js +1 -2
  58. package/dist/esm/features/session_replay/aggregate/index.js +3 -2
  59. package/dist/esm/features/session_trace/aggregate/index.js +15 -8
  60. package/dist/esm/features/spa/aggregate/index.js +1 -1
  61. package/dist/esm/features/utils/aggregate-base.js +4 -1
  62. package/dist/esm/features/utils/instrument-base.js +2 -1
  63. package/dist/esm/features/utils/lazy-feature-loader.js +2 -0
  64. package/dist/esm/loaders/agent-base.js +23 -2
  65. package/dist/esm/loaders/api/api-methods.js +1 -1
  66. package/dist/esm/loaders/api/api.js +28 -1
  67. package/dist/esm/loaders/features/features.js +7 -5
  68. package/dist/types/common/config/state/init.d.ts.map +1 -1
  69. package/dist/types/common/drain/drain.d.ts.map +1 -1
  70. package/dist/types/common/harvest/harvest-scheduler.d.ts.map +1 -1
  71. package/dist/types/common/harvest/harvest.d.ts +5 -5
  72. package/dist/types/common/harvest/types.d.ts +2 -2
  73. package/dist/types/common/harvest/types.d.ts.map +1 -1
  74. package/dist/types/common/ids/id.d.ts.map +1 -1
  75. package/dist/types/common/ids/unique-id.d.ts.map +1 -1
  76. package/dist/types/common/session/session-entity.d.ts.map +1 -1
  77. package/dist/types/common/util/console.d.ts.map +1 -1
  78. package/dist/types/common/util/data-size.d.ts.map +1 -1
  79. package/dist/types/common/util/feature-flags.d.ts.map +1 -1
  80. package/dist/types/common/util/get-or-set.d.ts.map +1 -1
  81. package/dist/types/common/util/invoke.d.ts.map +1 -1
  82. package/dist/types/common/util/stringify.d.ts.map +1 -1
  83. package/dist/types/common/util/submit-data.d.ts.map +1 -1
  84. package/dist/types/common/util/type-check.d.ts.map +1 -1
  85. package/dist/types/common/wrap/wrap-logger.d.ts +17 -0
  86. package/dist/types/common/wrap/wrap-logger.d.ts.map +1 -0
  87. package/dist/types/features/jserrors/aggregate/compute-stack-trace.d.ts.map +1 -1
  88. package/dist/types/features/jserrors/aggregate/index.d.ts +1 -1
  89. package/dist/types/features/logging/aggregate/index.d.ts +40 -0
  90. package/dist/types/features/logging/aggregate/index.d.ts.map +1 -0
  91. package/dist/types/features/logging/constants.d.ts +14 -0
  92. package/dist/types/features/logging/constants.d.ts.map +1 -0
  93. package/dist/types/features/logging/index.d.ts +2 -0
  94. package/dist/types/features/logging/index.d.ts.map +1 -0
  95. package/dist/types/features/logging/instrument/index.d.ts +6 -0
  96. package/dist/types/features/logging/instrument/index.d.ts.map +1 -0
  97. package/dist/types/features/logging/shared/log.d.ts +18 -0
  98. package/dist/types/features/logging/shared/log.d.ts.map +1 -0
  99. package/dist/types/features/logging/shared/utils.d.ts +16 -0
  100. package/dist/types/features/logging/shared/utils.d.ts.map +1 -0
  101. package/dist/types/features/page_view_timing/aggregate/index.d.ts.map +1 -1
  102. package/dist/types/features/session_replay/aggregate/index.d.ts +1 -1
  103. package/dist/types/features/session_replay/aggregate/index.d.ts.map +1 -1
  104. package/dist/types/features/session_replay/shared/recorder.d.ts.map +1 -1
  105. package/dist/types/features/session_trace/aggregate/index.d.ts +7 -4
  106. package/dist/types/features/session_trace/aggregate/index.d.ts.map +1 -1
  107. package/dist/types/features/utils/aggregate-base.d.ts.map +1 -1
  108. package/dist/types/features/utils/feature-base.d.ts +1 -1
  109. package/dist/types/features/utils/feature-base.d.ts.map +1 -1
  110. package/dist/types/features/utils/instrument-base.d.ts +2 -2
  111. package/dist/types/features/utils/instrument-base.d.ts.map +1 -1
  112. package/dist/types/features/utils/lazy-feature-loader.d.ts.map +1 -1
  113. package/dist/types/loaders/agent-base.d.ts +25 -4
  114. package/dist/types/loaders/agent-base.d.ts.map +1 -1
  115. package/dist/types/loaders/api/api.d.ts +8 -0
  116. package/dist/types/loaders/api/api.d.ts.map +1 -1
  117. package/dist/types/loaders/api/interaction-types.d.ts.map +1 -1
  118. package/dist/types/loaders/features/features.d.ts +1 -0
  119. package/dist/types/loaders/features/features.d.ts.map +1 -1
  120. package/dist/types/loaders/micro-agent.d.ts.map +1 -1
  121. package/package.json +15 -28
  122. package/src/cdn/experimental.js +2 -0
  123. package/src/cdn/polyfills/pro.js +3 -1
  124. package/src/cdn/polyfills/spa.js +2 -0
  125. package/src/cdn/pro.js +3 -1
  126. package/src/cdn/spa.js +2 -0
  127. package/src/common/config/state/init.js +17 -15
  128. package/src/common/deny-list/deny-list.js +1 -1
  129. package/src/common/session/session-entity.js +7 -2
  130. package/src/common/wrap/wrap-logger.js +49 -0
  131. package/src/features/logging/aggregate/index.js +101 -0
  132. package/src/features/logging/constants.js +19 -0
  133. package/src/features/logging/index.js +1 -0
  134. package/src/features/logging/instrument/index.js +18 -0
  135. package/src/features/logging/shared/log.js +28 -0
  136. package/src/features/logging/shared/utils.js +43 -0
  137. package/src/features/page_view_timing/aggregate/index.js +1 -2
  138. package/src/features/session_replay/aggregate/index.js +3 -3
  139. package/src/features/session_trace/aggregate/index.js +14 -8
  140. package/src/features/spa/aggregate/index.js +1 -1
  141. package/src/features/utils/__mocks__/agent-session.js +3 -1
  142. package/src/features/utils/__mocks__/feature-base.js +2 -1
  143. package/src/features/utils/aggregate-base.js +4 -1
  144. package/src/features/utils/instrument-base.js +2 -1
  145. package/src/features/utils/lazy-feature-loader.js +2 -0
  146. package/src/loaders/agent-base.js +23 -2
  147. package/src/loaders/api/api-methods.js +1 -1
  148. package/src/loaders/api/api.js +19 -1
  149. package/src/loaders/features/features.js +7 -5
@@ -7,7 +7,7 @@ exports.Instrument = void 0;
7
7
  var _instrumentBase = require("../../utils/instrument-base");
8
8
  var CONSTANTS = _interopRequireWildcard(require("../constants"));
9
9
  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); }
10
- 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; }
10
+ 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 && {}.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; }
11
11
  class Instrument extends _instrumentBase.InstrumentBase {
12
12
  static featureName = CONSTANTS.FEATURE_NAME;
13
13
  constructor(agentIdentifier, aggregator) {
@@ -48,7 +48,6 @@ class Aggregate extends _aggregateBase.AggregateBase {
48
48
  if ((0, _config.getConfigurationValue)(this.agentIdentifier, 'page_view_timing.long_task') === true) _longTask.longTask.subscribe(this.#handleVitalMetric);
49
49
  (0, _registerHandler.registerHandler)('docHidden', msTimestamp => this.endCurrentSession(msTimestamp), this.featureName, this.ee);
50
50
  (0, _registerHandler.registerHandler)('winPagehide', msTimestamp => this.recordPageUnload(msTimestamp), this.featureName, this.ee);
51
- const initialHarvestSeconds = (0, _config.getConfigurationValue)(this.agentIdentifier, 'page_view_timing.initialHarvestSeconds') || 10;
52
51
  const harvestTimeSeconds = (0, _config.getConfigurationValue)(this.agentIdentifier, 'page_view_timing.harvestTimeSeconds') || 30;
53
52
  this.waitForFlags([]).then(() => {
54
53
  /* It's important that CWV api, like "onLCP", is called before the **scheduler** is initialized. The reason is because they listen to the same
@@ -85,7 +84,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
85
84
  return _this.prepareHarvest(...arguments);
86
85
  }
87
86
  }, this);
88
- scheduler.startTimer(harvestTimeSeconds, initialHarvestSeconds);
87
+ scheduler.startTimer(harvestTimeSeconds);
89
88
  this.drain();
90
89
  });
91
90
  }
@@ -24,7 +24,7 @@ var _drain = require("../../../common/drain/drain");
24
24
  var _now = require("../../../common/timing/now");
25
25
  var _utils = require("../shared/utils");
26
26
  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); }
27
- 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; } /*
27
+ 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 && {}.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; } /*
28
28
  * Copyright 2023 New Relic Corporation. All rights reserved.
29
29
  * SPDX-License-Identifier: Apache-2.0
30
30
  */ /**
@@ -303,7 +303,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
303
303
  this.scheduler.opts.gzip = false;
304
304
  }
305
305
  if (len > _constants.MAX_PAYLOAD_SIZE) {
306
- this.abort(_constants.ABORT_REASONS.TOO_BIG);
306
+ this.abort(_constants.ABORT_REASONS.TOO_BIG, len);
307
307
  return;
308
308
  }
309
309
  // TODO -- Gracefully handle the buffer for retries.
@@ -420,8 +420,9 @@ class Aggregate extends _aggregateBase.AggregateBase {
420
420
  /** Abort the feature, once aborted it will not resume */
421
421
  abort() {
422
422
  let reason = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
423
+ let data = arguments.length > 1 ? arguments[1] : undefined;
423
424
  (0, _console.warn)("SR aborted -- ".concat(reason.message));
424
- (0, _handle.handle)(_constants2.SUPPORTABILITY_METRIC_CHANNEL, ["SessionReplay/Abort/".concat(reason.sm)], undefined, _features.FEATURE_NAMES.metrics, this.ee);
425
+ (0, _handle.handle)(_constants2.SUPPORTABILITY_METRIC_CHANNEL, ["SessionReplay/Abort/".concat(reason.sm), data], undefined, _features.FEATURE_NAMES.metrics, this.ee);
425
426
  this.blocked = true;
426
427
  this.mode = _constants3.MODE.OFF;
427
428
  this.recorder?.stopRecording?.();
@@ -10,7 +10,7 @@ var _instrumentBase = require("../../utils/instrument-base");
10
10
  var _utils = require("../shared/utils");
11
11
  var _constants2 = require("../constants");
12
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; } /*
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 && {}.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
  * Copyright 2023 New Relic Corporation. All rights reserved.
15
15
  * SPDX-License-Identifier: Apache-2.0
16
16
  */ /**
@@ -48,22 +48,30 @@ class Aggregate extends _aggregateBase.AggregateBase {
48
48
  this.entitled ??= stEntitled;
49
49
  if (this.blocked || !this.entitled) return (0, _drain.deregisterDrain)(this.agentIdentifier, this.featureName);
50
50
  if (!this.initialized) {
51
+ this.initialized = true;
52
+ /** Store session identifiers at initialization time to be cross-checked later at harvest time for session changes that are subject to race conditions */
53
+ this.ptid = this.agentRuntime.ptid;
54
+ this.sessionId = this.agentRuntime.session?.state.value;
51
55
  // The SessionEntity class can emit a message indicating the session was cleared and reset (expiry, inactivity). This feature must abort and never resume if that occurs.
52
56
  this.ee.on(_constants2.SESSION_EVENTS.RESET, () => {
53
- this.abort();
57
+ if (this.blocked) return;
58
+ this.abort(1);
54
59
  });
55
60
  // The SessionEntity can have updates (locally or across tabs for SR mode changes), (across tabs for ST mode changes).
56
61
  // Those updates should be sync'd here to ensure this page also honors the mode after initialization
57
62
  this.ee.on(_constants2.SESSION_EVENTS.UPDATE, (eventType, sessionState) => {
63
+ if (this.blocked) return;
58
64
  // this will only have an effect if ST is NOT already in full mode
59
65
  if (this.mode !== _constants2.MODE.FULL && (sessionState.sessionReplayMode === _constants2.MODE.FULL || sessionState.sessionTraceMode === _constants2.MODE.FULL)) this.switchToFull();
66
+ // if another page's session entity has expired, or another page has transitioned to off and this one hasn't... we can just abort straight away here
67
+ if (this.sessionId !== sessionState.value || eventType === 'cross-tab' && this.scheduler?.started && sessionState.sessionTraceMode === _constants2.MODE.OFF) this.abort(2);
60
68
  });
61
69
  }
62
70
 
63
71
  /** ST/SR sampling flow in BCS - https://drive.google.com/file/d/19hwt2oft-8Hh4RrjpLqEXfpP_9wYBLcq/view?usp=sharing */
64
72
  /** ST will run in the mode provided by BCS if the session IS NEW. If not... it will use the state of the session entity to determine what mode to run in */
65
73
  if (!this.agentRuntime.session.isNew && !ignoreSession) this.mode = this.agentRuntime.session.state.sessionTraceMode;else this.mode = stMode;
66
- this.initialized = true;
74
+
67
75
  /** If the mode is off, we do not want to hold up draining for other features, so we deregister the feature for now.
68
76
  * If it drains later (due to a mode change), data and handlers will instantly drain instead of waiting for the registry. */
69
77
  if (this.mode === _constants2.MODE.OFF) return (0, _drain.deregisterDrain)(this.agentIdentifier, this.featureName);
@@ -128,9 +136,8 @@ class Aggregate extends _aggregateBase.AggregateBase {
128
136
  let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
129
137
  this.traceStorage.prevStoredEvents.clear(); // release references to past events for GC
130
138
  if (!this.timeKeeper?.ready) return; // this should likely never happen, but just to be safe, we should never harvest if we cant correct time
131
- if (this.mode === _constants2.MODE.OFF && this.traceStorage.nodeCount === 0) return;
132
- if (this.mode === _constants2.MODE.ERROR) return; // Trace in this mode should never be harvesting, even on unload
133
-
139
+ if (this.blocked || this.mode !== _constants2.MODE.FULL || this.traceStorage.nodeCount === 0) return;
140
+ if (this.sessionId !== this.agentRuntime.session?.state.value || this.ptid !== this.agentRuntime.ptid) return this.abort(3); // if something unexpected happened and we somehow still got to the point of harvesting after a session identifier changed, we should force-exit instead of harvesting
134
141
  /** Get the ST nodes from the traceStorage buffer. This also returns helpful metadata about the payload. */
135
142
  const {
136
143
  stns,
@@ -186,8 +193,8 @@ class Aggregate extends _aggregateBase.AggregateBase {
186
193
  ...(hasReplay && {
187
194
  hasReplay
188
195
  }),
189
- ptid: "".concat(this.agentRuntime.ptid),
190
- session: "".concat(this.agentRuntime.session?.state.value),
196
+ ptid: "".concat(this.ptid),
197
+ session: "".concat(this.sessionId),
191
198
  // customer-defined data should go last so that if it exceeds the query param padding limit it will be truncated instead of important attrs
192
199
  ...(endUserId && {
193
200
  'enduser.id': endUserId
@@ -229,7 +236,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
229
236
  }
230
237
 
231
238
  /** Stop running for the remainder of the page lifecycle */
232
- abort() {
239
+ abort(reason) {
233
240
  this.blocked = true;
234
241
  this.mode = _constants2.MODE.OFF;
235
242
  this.agentRuntime.session.write({
@@ -13,7 +13,7 @@ var _drain = require("../../../common/drain/drain");
13
13
  var _featureGates = require("../../utils/feature-gates");
14
14
  var _now = require("../../../common/timing/now");
15
15
  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); }
16
- 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; }
16
+ 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 && {}.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; }
17
17
  /*
18
18
  * Copyright 2020 New Relic Corporation. All rights reserved.
19
19
  * SPDX-License-Identifier: Apache-2.0
@@ -28,7 +28,7 @@ var _constants2 = require("../../metrics/constants");
28
28
  var _drain = require("../../../common/drain/drain");
29
29
  var _console = require("../../../common/util/console");
30
30
  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); }
31
- 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; }
31
+ 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 && {}.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; }
32
32
  /*
33
33
  * Copyright 2020 New Relic Corporation. All rights reserved.
34
34
  * SPDX-License-Identifier: Apache-2.0
@@ -545,7 +545,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
545
545
  var interaction = this.ixn;
546
546
  var node = activeNodeFor(interaction);
547
547
  setCurrentNode(null);
548
- node.child('customEnd', timestamp).finish(timestamp);
548
+ node.child('customEnd', timestamp)?.finish(timestamp);
549
549
  interaction.finish();
550
550
  }, this.featureName, baseEE);
551
551
  (0, _registerHandler.registerHandler)(INTERACTION_API + 'ignore', function (t) {
@@ -12,7 +12,7 @@ var _runtime = require("../../../common/constants/runtime");
12
12
  var _now = require("../../../common/timing/now");
13
13
  var _handle = require("../../../common/event-emitter/handle");
14
14
  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); }
15
- 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; }
15
+ 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 && {}.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; }
16
16
  /*
17
17
  * Copyright 2020 New Relic Corporation. All rights reserved.
18
18
  * SPDX-License-Identifier: Apache-2.0
@@ -23,7 +23,7 @@ class AggregateBase extends _featureBase.FeatureBase {
23
23
  */
24
24
  waitForFlags() {
25
25
  let flagNames = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
26
- return new Promise((resolve, reject) => {
26
+ const flagsPromise = new Promise((resolve, reject) => {
27
27
  if (_featureFlags.activatedFeatures[this.agentIdentifier]) {
28
28
  resolve(buildOutput(_featureFlags.activatedFeatures[this.agentIdentifier]));
29
29
  } else {
@@ -39,6 +39,9 @@ class AggregateBase extends _featureBase.FeatureBase {
39
39
  });
40
40
  }
41
41
  });
42
+ return flagsPromise.catch(err => {
43
+ this.ee.emit('internal-error', [err]);
44
+ });
42
45
  }
43
46
  drain() {
44
47
  (0, _drain.drain)(this.agentIdentifier, this.featureName);
@@ -15,7 +15,7 @@ var _utils = require("../session_replay/shared/utils");
15
15
  var _featureGates = require("./feature-gates");
16
16
  var _invoke = require("../../common/util/invoke");
17
17
  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); }
18
- 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; } /**
18
+ 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 && {}.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; } /**
19
19
  * @file Defines `InstrumentBase` to be used as the super of the Instrument classes implemented by each feature.
20
20
  * Inherits and executes the `checkConfiguration` method from [FeatureBase]{@link ./feature-base}, which also
21
21
  * exposes the `blocked` property.
@@ -93,6 +93,7 @@ class InstrumentBase extends _featureBase.FeatureBase {
93
93
  }
94
94
  } catch (e) {
95
95
  (0, _console.warn)('A problem occurred when starting up session manager. This page will not start or extend any session.', e);
96
+ this.ee.emit('internal-error', [e]);
96
97
  if (this.featureName === _features.FEATURE_NAMES.sessionReplay) this.abortHandler?.(); // SR should stop recording if session DNE
97
98
  }
98
99
 
@@ -137,7 +138,7 @@ class InstrumentBase extends _featureBase.FeatureBase {
137
138
  */
138
139
  #shouldImportAgg(featureName, session) {
139
140
  if (featureName === _features.FEATURE_NAMES.sessionReplay) return (0, _utils.canImportReplayAgg)(this.agentIdentifier, session);
140
- return true;
141
+ return !(featureName === _features.FEATURE_NAMES.sessionTrace && !session);
141
142
  }
142
143
  }
143
144
  exports.InstrumentBase = InstrumentBase;
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.lazyFeatureLoader = lazyFeatureLoader;
7
7
  var _features = require("../../loaders/features/features");
8
8
  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); }
9
- 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; }
9
+ 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 && {}.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; }
10
10
  /**
11
11
  * Centralizes the lazy loading of agent feature aggregate and instrument sources.
12
12
  *
@@ -25,6 +25,8 @@ function lazyFeatureLoader(featureName, featurePart) {
25
25
  return Promise.resolve().then(() => _interopRequireWildcard(require( /* webpackChunkName: "ajax-aggregate" */'../ajax/aggregate')));
26
26
  case _features.FEATURE_NAMES.jserrors:
27
27
  return Promise.resolve().then(() => _interopRequireWildcard(require( /* webpackChunkName: "jserrors-aggregate" */'../jserrors/aggregate')));
28
+ case _features.FEATURE_NAMES.logging:
29
+ return Promise.resolve().then(() => _interopRequireWildcard(require( /* webpackChunkName: "logging-aggregate" */'../logging/aggregate')));
28
30
  case _features.FEATURE_NAMES.metrics:
29
31
  return Promise.resolve().then(() => _interopRequireWildcard(require( /* webpackChunkName: "metrics-aggregate" */'../metrics/aggregate')));
30
32
  case _features.FEATURE_NAMES.pageAction:
@@ -60,8 +60,8 @@ class AgentBase {
60
60
  * Adds a user-defined attribute name and value to subsequent events on the page.
61
61
  * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/setcustomattribute/}
62
62
  * @param {string} name Name of the attribute. Appears as column in the PageView event. It will also appear as a column in the PageAction event if you are using it.
63
- * @param {string|number|null} value Value of the attribute. Appears as the value in the named attribute column in the PageView event. It will appear as a column in the PageAction event if you are using it. Custom attribute values cannot be complex objects, only simple types such as Strings and Integers.
64
- * @param {boolean} [persist] Default false. f set to true, the name-value pair will also be set into the browser's storage API. Then on the following instrumented pages that load within the same session, the pair will be re-applied as a custom attribute.
63
+ * @param {string|number|boolean|null} value Value of the attribute. Appears as the value in the named attribute column in the PageView event. It will appear as a column in the PageAction event if you are using it. Custom attribute values cannot be complex objects, only simple types such as Strings, Integers and Booleans. Passing a null value unsets any existing attribute of the same name.
64
+ * @param {boolean} [persist] Default false. If set to true, the name-value pair will also be set into the browser's storage API. Then on the following instrumented pages that load within the same session, the pair will be re-applied as a custom attribute.
65
65
  */
66
66
  setCustomAttribute(name, value, persist) {
67
67
  return this.#callMethod('setCustomAttribute', name, value, persist);
@@ -188,5 +188,26 @@ class AgentBase {
188
188
  interaction() {
189
189
  return this.#callMethod('interaction');
190
190
  }
191
+
192
+ /**
193
+ * Capture a single log.
194
+ * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/loginfo/}
195
+ * @param {string} message String to be captured as log message
196
+ * @param {{customAttributes?: object, level?: 'ERROR'|'TRACE'|'DEBUG'|'INFO'|'WARN'}} [options] customAttributes defaults to `{}` if not assigned, level defaults to `info` if not assigned.
197
+ */
198
+ log(message, options) {
199
+ return this.#callMethod('logInfo', message, options);
200
+ }
201
+
202
+ /**
203
+ * Wrap a logger function to capture a log each time the function is invoked with the message and arguments passed
204
+ * {@link https://docs.newrelic.com/docs/browser/new-relic-browser/browser-apis/wraplogger/}
205
+ * @param {object} parent The parent object containing the logger method
206
+ * @param {string} functionName The property name of the function in the parent object to be wrapped
207
+ * @param {{customAttributes?: object, level?: 'ERROR'|'TRACE'|'DEBUG'|'INFO'|'WARN'}} [options] customAttributes defaults to `{}` if not assigned, level defaults to `info` if not assigned.
208
+ */
209
+ wrapLogger(parent, functionName, options) {
210
+ return this.#callMethod('wrapLogger', parent, functionName, options);
211
+ }
191
212
  }
192
213
  exports.AgentBase = AgentBase;
@@ -5,5 +5,5 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.asyncApiMethods = exports.apiMethods = void 0;
7
7
  var _constants = require("../../features/session_replay/constants");
8
- const apiMethods = exports.apiMethods = ['setErrorHandler', 'finished', 'addToTrace', 'addRelease', 'addPageAction', 'setCurrentRouteName', 'setPageViewName', 'setCustomAttribute', 'interaction', 'noticeError', 'setUserId', 'setApplicationVersion', 'start', _constants.SR_EVENT_EMITTER_TYPES.RECORD, _constants.SR_EVENT_EMITTER_TYPES.PAUSE];
8
+ const apiMethods = exports.apiMethods = ['setErrorHandler', 'finished', 'addToTrace', 'addRelease', 'addPageAction', 'setCurrentRouteName', 'setPageViewName', 'setCustomAttribute', 'interaction', 'noticeError', 'setUserId', 'setApplicationVersion', 'start', _constants.SR_EVENT_EMITTER_TYPES.RECORD, _constants.SR_EVENT_EMITTER_TYPES.PAUSE, 'log', 'wrapLogger'];
9
9
  const asyncApiMethods = exports.asyncApiMethods = ['setErrorHandler', 'finished', 'addToTrace', 'addRelease'];
@@ -19,8 +19,11 @@ var _apiMethods = require("./api-methods");
19
19
  var _constants2 = require("../../features/session_replay/constants");
20
20
  var _now = require("../../common/timing/now");
21
21
  var _constants3 = require("../../common/session/constants");
22
+ var _constants4 = require("../../features/logging/constants");
23
+ var _utils = require("../../features/logging/shared/utils");
24
+ var _wrapLogger = require("../../common/wrap/wrap-logger");
22
25
  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); }
23
- 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; } /*
26
+ 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 && {}.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; } /*
24
27
  * Copyright 2020 New Relic Corporation. All rights reserved.
25
28
  * SPDX-License-Identifier: Apache-2.0
26
29
  */
@@ -60,6 +63,30 @@ function setAPI(agentIdentifier, forceDrain) {
60
63
  });
61
64
  var prefix = 'api-';
62
65
  var spaPrefix = prefix + 'ixn-';
66
+ apiInterface.log = function (message) {
67
+ let {
68
+ customAttributes = {},
69
+ level = _constants4.LOG_LEVELS.INFO
70
+ } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
71
+ if (!customAttributes || typeof customAttributes !== 'object') customAttributes = {};
72
+ if (typeof message !== 'string' || !message) return (0, _console.warn)(_constants4.LOGGING_IGNORED + 'invalid message');
73
+ if (!(0, _utils.isValidLogLevel)(level)) return (0, _console.warn)(_constants4.LOGGING_LEVEL_FAILURE_MESSAGE + level, _constants4.LOG_LEVELS);
74
+ if (message.length > _constants4.MAX_PAYLOAD_SIZE) return (0, _console.warn)(_constants4.LOGGING_IGNORED + '> ' + _constants4.MAX_PAYLOAD_SIZE + ' bytes: ', message.slice(0, 25) + '...');
75
+ (0, _utils.bufferLog)(instanceEE, message, customAttributes, level.toUpperCase());
76
+ };
77
+ apiInterface.wrapLogger = function (parent, functionName) {
78
+ let {
79
+ customAttributes = {},
80
+ level = _constants4.LOG_LEVELS.INFO
81
+ } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
82
+ if (!customAttributes || typeof customAttributes !== 'object') customAttributes = {};
83
+ if (!(typeof parent === 'object' && !!parent && typeof functionName === 'string' && !!functionName && typeof parent[functionName] === 'function' && typeof customAttributes === 'object')) return (0, _console.warn)(_constants4.LOGGING_FAILURE_MESSAGE + 'invalid argument(s)');
84
+ if (!(0, _utils.isValidLogLevel)(level)) return (0, _console.warn)(_constants4.LOGGING_FAILURE_MESSAGE + _constants4.LOGGING_LEVEL_FAILURE_MESSAGE + level, _constants4.LOG_LEVELS);
85
+ (0, _wrapLogger.wrapLogger)(instanceEE, parent, functionName, {
86
+ customAttributes,
87
+ level: level.toUpperCase()
88
+ });
89
+ };
63
90
 
64
91
  // Setup stub functions that queue calls for later processing.
65
92
  _apiMethods.asyncApiMethods.forEach(fnName => {
@@ -76,7 +103,7 @@ function setAPI(agentIdentifier, forceDrain) {
76
103
  /**
77
104
  * Attach the key-value attribute onto agent payloads. All browser events in NR will be affected.
78
105
  * @param {string} key
79
- * @param {string|number|null} value - null indicates the key should be removed or erased
106
+ * @param {string|number|boolean|null} value - null indicates the key should be removed or erased
80
107
  * @param {string} apiName
81
108
  * @param {boolean} addToBrowserStorage - whether this attribute should be stored in browser storage API and retrieved by the next agent context or initialization
82
109
  * @returns @see apiCall
@@ -7,6 +7,7 @@ exports.featurePriority = exports.FEATURE_NAMES = void 0;
7
7
  const FEATURE_NAMES = exports.FEATURE_NAMES = {
8
8
  ajax: 'ajax',
9
9
  jserrors: 'jserrors',
10
+ logging: 'logging',
10
11
  metrics: 'metrics',
11
12
  pageAction: 'page_action',
12
13
  pageViewEvent: 'page_view_event',
@@ -26,10 +27,11 @@ const featurePriority = exports.featurePriority = {
26
27
  [FEATURE_NAMES.pageViewTiming]: 2,
27
28
  [FEATURE_NAMES.metrics]: 3,
28
29
  [FEATURE_NAMES.jserrors]: 4,
29
- [FEATURE_NAMES.ajax]: 5,
30
- [FEATURE_NAMES.sessionTrace]: 6,
31
- [FEATURE_NAMES.pageAction]: 7,
32
- [FEATURE_NAMES.spa]: 8,
30
+ [FEATURE_NAMES.spa]: 5,
31
+ [FEATURE_NAMES.ajax]: 6,
32
+ [FEATURE_NAMES.sessionTrace]: 7,
33
+ [FEATURE_NAMES.pageAction]: 8,
33
34
  [FEATURE_NAMES.softNav]: 9,
34
- [FEATURE_NAMES.sessionReplay]: 10
35
+ [FEATURE_NAMES.sessionReplay]: 10,
36
+ [FEATURE_NAMES.logging]: 11
35
37
  };
@@ -15,7 +15,7 @@ var _console = require("../common/util/console");
15
15
  var _load = require("../common/window/load");
16
16
  var _agentBase = require("./agent-base");
17
17
  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); }
18
- 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; } // loader files
18
+ 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 && {}.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; } // loader files
19
19
  // core files
20
20
  const nonAutoFeatures = [_features.FEATURE_NAMES.jserrors, _features.FEATURE_NAMES.pageAction, _features.FEATURE_NAMES.metrics];
21
21
 
@@ -19,8 +19,9 @@ import { Instrument as InstrumentSessionReplay } from '../features/session_repla
19
19
  // import { Instrument as InstrumentSpa } from '../features/spa/instrument'
20
20
  import { Instrument as InstrumentSoftNav } from '../features/soft_navigations/instrument';
21
21
  import { Instrument as InstrumentPageAction } from '../features/page_action/instrument';
22
+ import { Instrument as InstrumentLogs } from '../features/logging/instrument';
22
23
  new Agent({
23
- features: [InstrumentXhr, InstrumentPageViewEvent, InstrumentPageViewTiming, InstrumentSessionTrace, InstrumentSessionReplay, InstrumentMetrics, InstrumentPageAction, InstrumentErrors,
24
+ features: [InstrumentXhr, InstrumentPageViewEvent, InstrumentPageViewTiming, InstrumentSessionTrace, InstrumentSessionReplay, InstrumentMetrics, InstrumentPageAction, InstrumentErrors, InstrumentLogs,
24
25
  // InstrumentSpa,
25
26
  InstrumentSoftNav],
26
27
  loaderType: 'experimental'
@@ -12,7 +12,8 @@ import { Instrument as InstrumentErrors } from '../../features/jserrors/instrume
12
12
  import { Instrument as InstrumentXhr } from '../../features/ajax/instrument';
13
13
  import { Instrument as InstrumentSessionTrace } from '../../features/session_trace/instrument';
14
14
  import { Instrument as InstrumentPageAction } from '../../features/page_action/instrument';
15
+ import { Instrument as InstrumentLogs } from '../../features/logging/instrument';
15
16
  new Agent({
16
- features: [InstrumentPageViewEvent, InstrumentPageViewTiming, InstrumentSessionTrace, InstrumentXhr, InstrumentMetrics, InstrumentPageAction, InstrumentErrors],
17
+ features: [InstrumentPageViewEvent, InstrumentPageViewTiming, InstrumentSessionTrace, InstrumentXhr, InstrumentMetrics, InstrumentPageAction, InstrumentErrors, InstrumentLogs],
17
18
  loaderType: 'pro-polyfills'
18
19
  });
@@ -13,7 +13,8 @@ import { Instrument as InstrumentXhr } from '../../features/ajax/instrument';
13
13
  import { Instrument as InstrumentSessionTrace } from '../../features/session_trace/instrument';
14
14
  import { Instrument as InstrumentSpa } from '../../features/spa/instrument';
15
15
  import { Instrument as InstrumentPageAction } from '../../features/page_action/instrument';
16
+ import { Instrument as InstrumentLogs } from '../../features/logging/instrument';
16
17
  new Agent({
17
- features: [InstrumentXhr, InstrumentPageViewEvent, InstrumentPageViewTiming, InstrumentSessionTrace, InstrumentMetrics, InstrumentPageAction, InstrumentErrors, InstrumentSpa],
18
+ features: [InstrumentXhr, InstrumentPageViewEvent, InstrumentPageViewTiming, InstrumentSessionTrace, InstrumentMetrics, InstrumentPageAction, InstrumentErrors, InstrumentLogs, InstrumentSpa],
18
19
  loaderType: 'spa-polyfills'
19
20
  });
@@ -12,7 +12,8 @@ import { Instrument as InstrumentXhr } from '../features/ajax/instrument';
12
12
  import { Instrument as InstrumentSessionTrace } from '../features/session_trace/instrument';
13
13
  import { Instrument as InstrumentSessionReplay } from '../features/session_replay/instrument';
14
14
  import { Instrument as InstrumentPageAction } from '../features/page_action/instrument';
15
+ import { Instrument as InstrumentLogs } from '../features/logging/instrument';
15
16
  new Agent({
16
- features: [InstrumentPageViewEvent, InstrumentPageViewTiming, InstrumentSessionTrace, InstrumentSessionReplay, InstrumentXhr, InstrumentMetrics, InstrumentPageAction, InstrumentErrors],
17
+ features: [InstrumentPageViewEvent, InstrumentPageViewTiming, InstrumentSessionTrace, InstrumentSessionReplay, InstrumentXhr, InstrumentMetrics, InstrumentPageAction, InstrumentErrors, InstrumentLogs],
17
18
  loaderType: 'pro'
18
19
  });
@@ -13,8 +13,9 @@ import { Instrument as InstrumentSessionReplay } from '../features/session_repla
13
13
  import { Instrument as InstrumentSoftNav } from '../features/soft_navigations/instrument';
14
14
  import { Instrument as InstrumentSpa } from '../features/spa/instrument';
15
15
  import { Instrument as InstrumentPageAction } from '../features/page_action/instrument';
16
+ import { Instrument as InstrumentLogs } from '../features/logging/instrument';
16
17
  new Agent({
17
- features: [InstrumentXhr, InstrumentPageViewEvent, InstrumentPageViewTiming, InstrumentSessionTrace, InstrumentSessionReplay, InstrumentMetrics, InstrumentPageAction, InstrumentErrors, InstrumentSoftNav, InstrumentSpa // either the softnav or the old spa will be used (not both), but we still need to pack both to avoid dynamic import for instrument files
18
+ features: [InstrumentXhr, InstrumentPageViewEvent, InstrumentPageViewTiming, InstrumentSessionTrace, InstrumentSessionReplay, InstrumentMetrics, InstrumentPageAction, InstrumentErrors, InstrumentLogs, InstrumentSoftNav, InstrumentSpa // either the softnav or the old spa will be used (not both), but we still need to pack both to avoid dynamic import for instrument files
18
19
  ],
19
20
  loaderType: 'spa'
20
21
  });
@@ -1,3 +1,4 @@
1
+ import { LOG_LEVELS } from '../../../features/logging/constants';
1
2
  import { isValidSelector } from '../../dom/query-selector';
2
3
  import { DEFAULT_EXPIRES_MS, DEFAULT_INACTIVE_MS } from '../../session/constants';
3
4
  import { warn } from '../../util/console';
@@ -29,16 +30,6 @@ const model = () => {
29
30
  }
30
31
  };
31
32
  return {
32
- feature_flags: [],
33
- proxy: {
34
- assets: undefined,
35
- // if this value is set, it will be used to overwrite the webpack asset path used to fetch assets
36
- beacon: undefined // likewise for the url to which we send analytics
37
- },
38
- privacy: {
39
- cookies_enabled: true
40
- },
41
- // *cli - per discussion, default should be true
42
33
  ajax: {
43
34
  deny_list: undefined,
44
35
  block_internal: true,
@@ -53,21 +44,26 @@ const model = () => {
53
44
  cors_use_tracecontext_headers: undefined,
54
45
  allowed_origins: undefined
55
46
  },
56
- session: {
57
- expiresMs: DEFAULT_EXPIRES_MS,
58
- inactiveMs: DEFAULT_INACTIVE_MS
47
+ feature_flags: [],
48
+ harvest: {
49
+ tooManyRequestsDelay: 60
59
50
  },
60
- ssl: undefined,
61
- obfuscate: undefined,
62
51
  jserrors: {
63
52
  enabled: true,
64
53
  harvestTimeSeconds: 10,
65
54
  autoStart: true
66
55
  },
56
+ logging: {
57
+ enabled: true,
58
+ harvestTimeSeconds: 10,
59
+ autoStart: true,
60
+ level: LOG_LEVELS.INFO
61
+ },
67
62
  metrics: {
68
63
  enabled: true,
69
64
  autoStart: true
70
65
  },
66
+ obfuscate: undefined,
71
67
  page_action: {
72
68
  enabled: true,
73
69
  harvestTimeSeconds: 30,
@@ -83,13 +79,18 @@ const model = () => {
83
79
  long_task: false,
84
80
  autoStart: true
85
81
  },
86
- session_trace: {
87
- enabled: true,
88
- harvestTimeSeconds: 10,
89
- autoStart: true
82
+ privacy: {
83
+ cookies_enabled: true
90
84
  },
91
- harvest: {
92
- tooManyRequestsDelay: 60
85
+ // *cli - per discussion, default should be true
86
+ proxy: {
87
+ assets: undefined,
88
+ // if this value is set, it will be used to overwrite the webpack asset path used to fetch assets
89
+ beacon: undefined // likewise for the url to which we send analytics
90
+ },
91
+ session: {
92
+ expiresMs: DEFAULT_EXPIRES_MS,
93
+ inactiveMs: DEFAULT_INACTIVE_MS
93
94
  },
94
95
  session_replay: {
95
96
  // feature settings
@@ -146,7 +147,7 @@ const model = () => {
146
147
  };else warn('An invalid session_replay.mask_input_option was provided and will not be used', val);
147
148
  }
148
149
  },
149
- spa: {
150
+ session_trace: {
150
151
  enabled: true,
151
152
  harvestTimeSeconds: 10,
152
153
  autoStart: true
@@ -155,7 +156,13 @@ const model = () => {
155
156
  enabled: true,
156
157
  harvestTimeSeconds: 10,
157
158
  autoStart: true
158
- }
159
+ },
160
+ spa: {
161
+ enabled: true,
162
+ harvestTimeSeconds: 10,
163
+ autoStart: true
164
+ },
165
+ ssl: undefined
159
166
  };
160
167
  };
161
168
  const _cache = {};
@@ -6,7 +6,7 @@
6
6
  /**
7
7
  * Exposes the version of the agent
8
8
  */
9
- export const VERSION = "1.260.1";
9
+ export const VERSION = "1.261.1";
10
10
 
11
11
  /**
12
12
  * Exposes the build type of the agent
@@ -6,7 +6,7 @@
6
6
  /**
7
7
  * Exposes the version of the agent
8
8
  */
9
- export const VERSION = "1.260.1";
9
+ export const VERSION = "1.261.1";
10
10
 
11
11
  /**
12
12
  * Exposes the build type of the agent
@@ -10,7 +10,7 @@ var denyList = [];
10
10
  * @returns {boolean} `true` if request does not match any entries of {@link denyList|deny list}; else `false`
11
11
  */
12
12
  export function shouldCollectEvent(params) {
13
- if (hasUndefinedHostname(params)) return false;
13
+ if (!params || hasUndefinedHostname(params)) return false;
14
14
  if (denyList.length === 0) return true;
15
15
  for (var i = 0; i < denyList.length; i++) {
16
16
  var parsed = denyList[i];
@@ -3,7 +3,7 @@ import { warn } from '../util/console';
3
3
  import { stringify } from '../util/stringify';
4
4
  import { ee } from '../event-emitter/contextual-ee';
5
5
  import { Timer } from '../timer/timer';
6
- import { isBrowserScope } from '../constants/runtime';
6
+ import { isBrowserScope, isIE } from '../constants/runtime';
7
7
  import { DEFAULT_EXPIRES_MS, DEFAULT_INACTIVE_MS, MODE, PREFIX, SESSION_EVENTS, SESSION_EVENT_TYPES } from './constants';
8
8
  import { InteractionTimer } from '../timer/interaction-timer';
9
9
  import { wrapEvents } from '../wrap';
@@ -53,7 +53,13 @@ export class SessionEntity {
53
53
  this.ee = ee.get(agentIdentifier);
54
54
  wrapEvents(this.ee);
55
55
  this.setup(opts);
56
- if (isBrowserScope) {
56
+
57
+ /**
58
+ * Do not emit session storage events for IE11, because IE11 is unable to determine
59
+ * if the event was spawned on the current page or an adjacent page, and the behavior tied
60
+ * to storage events is critical to apply only to cross-tab behavior
61
+ * */
62
+ if (isBrowserScope && !isIE) {
57
63
  windowAddEventListener('storage', event => {
58
64
  if (event.key === this.lookupKey) {
59
65
  const obj = typeof event.newValue === 'string' ? JSON.parse(event.newValue) : event.newValue;