@pendo/agent 2.296.0 → 2.296.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/dist/dom.esm.js CHANGED
@@ -7313,7 +7313,7 @@ function getScreenPosition(element) {
7313
7313
  };
7314
7314
  }
7315
7315
 
7316
- var VERSION = '2.296.0_';
7316
+ var VERSION = '2.296.1_';
7317
7317
 
7318
7318
  var decodeURIComponent = _.isFunction(window.decodeURIComponent) ? window.decodeURIComponent : _.identity;
7319
7319
 
@@ -3892,8 +3892,8 @@ let SERVER = '';
3892
3892
  let ASSET_HOST = '';
3893
3893
  let ASSET_PATH = '';
3894
3894
  let DESIGNER_SERVER = '';
3895
- let VERSION = '2.296.0_';
3896
- let PACKAGE_VERSION = '2.296.0';
3895
+ let VERSION = '2.296.1_';
3896
+ let PACKAGE_VERSION = '2.296.1';
3897
3897
  let LOADER = 'xhr';
3898
3898
  /* eslint-enable agent-eslint-rules/no-gulp-env-references */
3899
3899
  /**
@@ -9779,11 +9779,9 @@ function writeErrorPOST(msg) {
9779
9779
  * @returns void
9780
9780
  */
9781
9781
  function writeMetricsPOST(payload) {
9782
- if (_.size(payload).length < 1)
9783
- return;
9784
9782
  try {
9785
9783
  const url = `${HOST}/data/agentmetrics?apiKey=${pendo$1.apiKey}`;
9786
- log.debug(`Will send ${payload} to ${url} using ${fetchKeepalive.supported() ? 'fetch' : 'xhr'} once the endpoint exists`);
9784
+ log.debug(`Will send ${JSON.stringify(payload)} to ${url} using ${fetchKeepalive.supported() ? 'fetch' : 'xhr'} once the endpoint exists`);
9787
9785
  if (fetchKeepalive.supported()) {
9788
9786
  // fetch(url, {
9789
9787
  // method: 'POST',
@@ -12261,13 +12259,19 @@ class PerformanceMonitor {
12261
12259
  });
12262
12260
  }
12263
12261
  send() {
12264
- const payload = _.reduce(_.keys(Metrics), (acc, name) => {
12262
+ const metrics = _.reduce(_.keys(Metrics), (acc, name) => {
12265
12263
  const entries = performance.getEntriesByName(name);
12266
- const result = Metrics[name].instrument(entries);
12267
- acc[name] = result;
12268
- }, {});
12264
+ const value = Metrics[name].instrument(entries);
12265
+ acc.push({ name, value });
12266
+ return acc;
12267
+ }, []);
12268
+ const payload = _.filter(metrics, (metric) => {
12269
+ return metric.value > 0;
12270
+ });
12269
12271
  this._clearMarksAndMeasures();
12270
- writeMetricsPOST(payload);
12272
+ if (_.size(payload)) {
12273
+ writeMetricsPOST(payload);
12274
+ }
12271
12275
  }
12272
12276
  _checkPerformanceApi() {
12273
12277
  return ConfigReader.get('performanceMetricsEnabled') &&
@@ -12300,11 +12304,14 @@ class PerformanceMonitor {
12300
12304
  }
12301
12305
  }
12302
12306
  _clearMarksAndMeasures() {
12303
- _.each(this.marks.entries, (name) => {
12307
+ // TODO: fix custom lint rule to handle sets
12308
+ // eslint-disable-next-line agent-eslint-rules/no-array-foreach
12309
+ this.marks.forEach(name => {
12304
12310
  performance.clearMarks(name);
12305
12311
  });
12306
12312
  this.marks.clear();
12307
- _.each(this.measures.entries, (name) => {
12313
+ // eslint-disable-next-line agent-eslint-rules/no-array-foreach
12314
+ this.measures.forEach(name => {
12308
12315
  performance.clearMeasures(name);
12309
12316
  });
12310
12317
  this.measures.clear();