@newrelic/browser-agent 1.243.0 → 1.243.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,13 @@
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.243.1](https://github.com/newrelic/newrelic-browser-agent/compare/v1.243.0...v1.243.1) (2023-10-04)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * Improve Session Replay abort metric reliability ([#754](https://github.com/newrelic/newrelic-browser-agent/issues/754)) ([14f08ac](https://github.com/newrelic/newrelic-browser-agent/commit/14f08aca8bf1a610984fc2303604a04910f07db6))
12
+
6
13
  ## [1.243.0](https://github.com/newrelic/newrelic-browser-agent/compare/v1.242.0...v1.243.0) (2023-10-04)
7
14
 
8
15
 
@@ -12,7 +12,7 @@ exports.VERSION = exports.DIST_METHOD = exports.BUILD_ENV = void 0;
12
12
  /**
13
13
  * Exposes the version of the agent
14
14
  */
15
- const VERSION = "1.243.0";
15
+ const VERSION = "1.243.1";
16
16
 
17
17
  /**
18
18
  * Exposes the build type of the agent
@@ -12,7 +12,7 @@ exports.VERSION = exports.DIST_METHOD = exports.BUILD_ENV = void 0;
12
12
  /**
13
13
  * Exposes the version of the agent
14
14
  */
15
- const VERSION = "1.243.0";
15
+ const VERSION = "1.243.1";
16
16
 
17
17
  /**
18
18
  * Exposes the build type of the agent
@@ -16,6 +16,8 @@ var _encode = require("../../../common/url/encode");
16
16
  var _console = require("../../../common/util/console");
17
17
  var _runtime = require("../../../common/constants/runtime");
18
18
  var _constants2 = require("../../metrics/constants");
19
+ var _handle = require("../../../common/event-emitter/handle");
20
+ var _features = require("../../../loaders/features/features");
19
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); }
20
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
23
  * Copyright 2023 New Relic Corporation. All rights reserved.
@@ -57,6 +59,10 @@ const ABORT_REASONS = {
57
59
  TOO_BIG: {
58
60
  message: 'Payload was too large',
59
61
  sm: 'Too-Big'
62
+ },
63
+ CROSS_TAB: {
64
+ message: 'Session Entity was set to OFF on another tab',
65
+ sm: 'Cross-Tab'
60
66
  }
61
67
  };
62
68
  let recorder, gzipper, u8;
@@ -140,7 +146,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
140
146
  });
141
147
  this.ee.on(_sessionEntity.SESSION_EVENTS.UPDATE, (type, data) => {
142
148
  if (!this.initialized || this.blocked || type !== _sessionEntity.SESSION_EVENT_TYPES.CROSS_TAB) return;
143
- if (this.mode !== _sessionEntity.MODE.OFF && data.sessionReplay === _sessionEntity.MODE.OFF) this.abort('Session Entity was set to OFF on another tab');
149
+ if (this.mode !== _sessionEntity.MODE.OFF && data.sessionReplay === _sessionEntity.MODE.OFF) this.abort(ABORT_REASONS.CROSS_TAB);
144
150
  this.mode = data.sessionReplay;
145
151
  });
146
152
 
@@ -436,7 +442,7 @@ class Aggregate extends _aggregateBase.AggregateBase {
436
442
  abort() {
437
443
  let reason = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
438
444
  (0, _console.warn)("SR aborted -- ".concat(reason.message));
439
- this.ee.emit(_constants2.SUPPORTABILITY_METRIC_CHANNEL, ["SessionReplay/Abort/".concat(ABORT_REASONS[reason.sm])]);
445
+ (0, _handle.handle)(_constants2.SUPPORTABILITY_METRIC_CHANNEL, ["SessionReplay/Abort/".concat(reason.sm)], undefined, _features.FEATURE_NAMES.metrics, this.ee);
440
446
  this.blocked = true;
441
447
  this.mode = _sessionEntity.MODE.OFF;
442
448
  this.stopRecording();
@@ -6,7 +6,7 @@
6
6
  /**
7
7
  * Exposes the version of the agent
8
8
  */
9
- export const VERSION = "1.243.0";
9
+ export const VERSION = "1.243.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.243.0";
9
+ export const VERSION = "1.243.1";
10
10
 
11
11
  /**
12
12
  * Exposes the build type of the agent
@@ -22,6 +22,8 @@ import { obj as encodeObj } from '../../../common/url/encode';
22
22
  import { warn } from '../../../common/util/console';
23
23
  import { globalScope } from '../../../common/constants/runtime';
24
24
  import { SUPPORTABILITY_METRIC_CHANNEL } from '../../metrics/constants';
25
+ import { handle } from '../../../common/event-emitter/handle';
26
+ import { FEATURE_NAMES } from '../../../loaders/features/features';
25
27
 
26
28
  // would be better to get this dynamically in some way
27
29
  export const RRWEB_VERSION = '2.0.0-alpha.8';
@@ -50,6 +52,10 @@ const ABORT_REASONS = {
50
52
  TOO_BIG: {
51
53
  message: 'Payload was too large',
52
54
  sm: 'Too-Big'
55
+ },
56
+ CROSS_TAB: {
57
+ message: 'Session Entity was set to OFF on another tab',
58
+ sm: 'Cross-Tab'
53
59
  }
54
60
  };
55
61
  let recorder, gzipper, u8;
@@ -131,7 +137,7 @@ export class Aggregate extends AggregateBase {
131
137
  });
132
138
  this.ee.on(SESSION_EVENTS.UPDATE, (type, data) => {
133
139
  if (!this.initialized || this.blocked || type !== SESSION_EVENT_TYPES.CROSS_TAB) return;
134
- if (this.mode !== MODE.OFF && data.sessionReplay === MODE.OFF) this.abort('Session Entity was set to OFF on another tab');
140
+ if (this.mode !== MODE.OFF && data.sessionReplay === MODE.OFF) this.abort(ABORT_REASONS.CROSS_TAB);
135
141
  this.mode = data.sessionReplay;
136
142
  });
137
143
 
@@ -427,7 +433,7 @@ export class Aggregate extends AggregateBase {
427
433
  abort() {
428
434
  let reason = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
429
435
  warn("SR aborted -- ".concat(reason.message));
430
- this.ee.emit(SUPPORTABILITY_METRIC_CHANNEL, ["SessionReplay/Abort/".concat(ABORT_REASONS[reason.sm])]);
436
+ handle(SUPPORTABILITY_METRIC_CHANNEL, ["SessionReplay/Abort/".concat(reason.sm)], undefined, FEATURE_NAMES.metrics, this.ee);
431
437
  this.blocked = true;
432
438
  this.mode = MODE.OFF;
433
439
  this.stopRecording();
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_replay/aggregate/index.js"],"names":[],"mappings":"AA0BA,4CAA4C;AAE5C,mCAAmC;;;;;;;;;AAgCnC,uCAAuC;AACvC,uCAAuC;AACvC,iCAAiC;AACjC,uCAAuC;AAIvC;IACE,2BAAiC;IACjC,mDA2GC;IAzGC,iHAAiH;IACjH,cAAgB;IAChB,8GAA8G;IAC9G,wBAAgH;IAChH,iFAAiF;IACjF,qBAAwB;IACxB,mEAAmE;IACnE,sBAAyB;IACzB,6GAA6G;IAC7G,aAAoB;IAGpB,iEAAiE;IACjE,mBAAsB;IACtB,gDAAgD;IAChD,wBAA0B;IAE1B;;;MAGE;IACF,qBAAwB;IACxB,4IAA4I;IAC5I,iBAAoB;IACpB,+HAA+H;IAC/H,kBAAqB;IAErB;;OAEG;IACH,oBAA+B;IAE/B,qGAAqG;IACrG,+BAA+B;IAE/B,kIAAkI;IAClI,cAAyB;IAOzB,uIAAuI;IACvI,0BAAyE;IA0BvE,wCAKQ;IAgCZ;;;;;;OAMG;IACH,kCALW,OAAO,eACP,OAAO,cACP,OAAO,GACL,IAAI,CAuDhB;IAED;;;;;;;;;oBAeC;IAED;;;;;;;;;MAiDC;IAED,qCAOC;IAED,kFAAkF;IAClF,oBAOC;IAED,qDAAqD;IACrD,uBA4BC;IAED,yHAAyH;IACzH,yCAsCC;IAED,0HAA0H;IAC1H,yBAGC;IAED,sBAGC;IAED,wBAEC;IAED,gCAAgC;IAChC,uCAGC;IAED,yDAAyD;IACzD,yBASC;IAED;;;SAGK;IACL,oCAGC;IAED,yCAGC;CACF;8BA3a6B,4BAA4B;iCALzB,2CAA2C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/session_replay/aggregate/index.js"],"names":[],"mappings":"AA4BA,4CAA4C;AAE5C,mCAAmC;;;;;;;;;AAoCnC,uCAAuC;AACvC,uCAAuC;AACvC,iCAAiC;AACjC,uCAAuC;AAIvC;IACE,2BAAiC;IACjC,mDA2GC;IAzGC,iHAAiH;IACjH,cAAgB;IAChB,8GAA8G;IAC9G,wBAAgH;IAChH,iFAAiF;IACjF,qBAAwB;IACxB,mEAAmE;IACnE,sBAAyB;IACzB,6GAA6G;IAC7G,aAAoB;IAGpB,iEAAiE;IACjE,mBAAsB;IACtB,gDAAgD;IAChD,wBAA0B;IAE1B;;;MAGE;IACF,qBAAwB;IACxB,4IAA4I;IAC5I,iBAAoB;IACpB,+HAA+H;IAC/H,kBAAqB;IAErB;;OAEG;IACH,oBAA+B;IAE/B,qGAAqG;IACrG,+BAA+B;IAE/B,kIAAkI;IAClI,cAAyB;IAOzB,uIAAuI;IACvI,0BAAyE;IA0BvE,wCAKQ;IAgCZ;;;;;;OAMG;IACH,kCALW,OAAO,eACP,OAAO,cACP,OAAO,GACL,IAAI,CAuDhB;IAED;;;;;;;;;oBAeC;IAED;;;;;;;;;MAiDC;IAED,qCAOC;IAED,kFAAkF;IAClF,oBAOC;IAED,qDAAqD;IACrD,uBA4BC;IAED,yHAAyH;IACzH,yCAsCC;IAED,0HAA0H;IAC1H,yBAGC;IAED,sBAGC;IAED,wBAEC;IAED,gCAAgC;IAChC,uCAGC;IAED,yDAAyD;IACzD,yBASC;IAED;;;SAGK;IACL,oCAGC;IAED,yCAGC;CACF;8BAjb6B,4BAA4B;iCALzB,2CAA2C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newrelic/browser-agent",
3
- "version": "1.243.0",
3
+ "version": "1.243.1",
4
4
  "private": false,
5
5
  "author": "New Relic Browser Agent Team <browser-agent@newrelic.com>",
6
6
  "description": "New Relic Browser Agent",
@@ -22,6 +22,8 @@ import { obj as encodeObj } from '../../../common/url/encode'
22
22
  import { warn } from '../../../common/util/console'
23
23
  import { globalScope } from '../../../common/constants/runtime'
24
24
  import { SUPPORTABILITY_METRIC_CHANNEL } from '../../metrics/constants'
25
+ import { handle } from '../../../common/event-emitter/handle'
26
+ import { FEATURE_NAMES } from '../../../loaders/features/features'
25
27
 
26
28
  // would be better to get this dynamically in some way
27
29
  export const RRWEB_VERSION = '2.0.0-alpha.8'
@@ -53,6 +55,10 @@ const ABORT_REASONS = {
53
55
  TOO_BIG: {
54
56
  message: 'Payload was too large',
55
57
  sm: 'Too-Big'
58
+ },
59
+ CROSS_TAB: {
60
+ message: 'Session Entity was set to OFF on another tab',
61
+ sm: 'Cross-Tab'
56
62
  }
57
63
  }
58
64
 
@@ -134,7 +140,7 @@ export class Aggregate extends AggregateBase {
134
140
 
135
141
  this.ee.on(SESSION_EVENTS.UPDATE, (type, data) => {
136
142
  if (!this.initialized || this.blocked || type !== SESSION_EVENT_TYPES.CROSS_TAB) return
137
- if (this.mode !== MODE.OFF && data.sessionReplay === MODE.OFF) this.abort('Session Entity was set to OFF on another tab')
143
+ if (this.mode !== MODE.OFF && data.sessionReplay === MODE.OFF) this.abort(ABORT_REASONS.CROSS_TAB)
138
144
  this.mode = data.sessionReplay
139
145
  })
140
146
 
@@ -421,7 +427,7 @@ export class Aggregate extends AggregateBase {
421
427
  /** Abort the feature, once aborted it will not resume */
422
428
  abort (reason = {}) {
423
429
  warn(`SR aborted -- ${reason.message}`)
424
- this.ee.emit(SUPPORTABILITY_METRIC_CHANNEL, [`SessionReplay/Abort/${ABORT_REASONS[reason.sm]}`])
430
+ handle(SUPPORTABILITY_METRIC_CHANNEL, [`SessionReplay/Abort/${reason.sm}`], undefined, FEATURE_NAMES.metrics, this.ee)
425
431
  this.blocked = true
426
432
  this.mode = MODE.OFF
427
433
  this.stopRecording()