@pendo/agent 2.301.0 → 2.302.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.
package/dist/dom.esm.js CHANGED
@@ -7359,7 +7359,7 @@ function getScreenPosition(element) {
7359
7359
  };
7360
7360
  }
7361
7361
 
7362
- var VERSION = '2.301.0_';
7362
+ var VERSION = '2.302.0_';
7363
7363
 
7364
7364
  var decodeURIComponent = _.isFunction(window.decodeURIComponent) ? window.decodeURIComponent : _.identity;
7365
7365
 
@@ -3904,8 +3904,8 @@ let SERVER = '';
3904
3904
  let ASSET_HOST = '';
3905
3905
  let ASSET_PATH = '';
3906
3906
  let DESIGNER_SERVER = '';
3907
- let VERSION = '2.301.0_';
3908
- let PACKAGE_VERSION = '2.301.0';
3907
+ let VERSION = '2.302.0_';
3908
+ let PACKAGE_VERSION = '2.302.0';
3909
3909
  let LOADER = 'xhr';
3910
3910
  /* eslint-enable agent-eslint-rules/no-gulp-env-references */
3911
3911
  /**
@@ -12285,8 +12285,14 @@ const BEACON_GIF_FAILURES = {
12285
12285
  poll: 'pendo-poll-gif-failure',
12286
12286
  agentic: 'pendo-agentic-gif-failure'
12287
12287
  };
12288
- const GUIDE_LOOP_TIMER = 'pendo-guide-loop';
12289
- const EVENT_CAPTURED_TIMER = 'pendo-event-captured';
12288
+ const GUIDE_LOOP_TIMER = {
12289
+ name: 'pendo-guide-loop',
12290
+ debuggingOnly: true
12291
+ };
12292
+ const EVENT_CAPTURED_TIMER = {
12293
+ name: 'pendo-event-captured',
12294
+ debuggingOnly: true
12295
+ };
12290
12296
  const INITIALIZE = 'pendo-initialize';
12291
12297
  const TEARDOWN = 'pendo-teardown';
12292
12298
  const METRICS = {};
@@ -12302,12 +12308,8 @@ _.each(BEACON_GIF_FAILURES, (name) => {
12302
12308
  instrument: counter
12303
12309
  };
12304
12310
  });
12305
- METRICS[GUIDE_LOOP_TIMER] = {
12306
- name: GUIDE_LOOP_TIMER
12307
- };
12308
- METRICS[EVENT_CAPTURED_TIMER] = {
12309
- name: EVENT_CAPTURED_TIMER
12310
- };
12311
+ METRICS[GUIDE_LOOP_TIMER.name] = GUIDE_LOOP_TIMER;
12312
+ METRICS[EVENT_CAPTURED_TIMER.name] = EVENT_CAPTURED_TIMER;
12311
12313
  METRICS[INITIALIZE] = {
12312
12314
  name: INITIALIZE
12313
12315
  };
@@ -12315,11 +12317,42 @@ METRICS[TEARDOWN] = {
12315
12317
  name: TEARDOWN
12316
12318
  };
12317
12319
 
12320
+ var debugEnabled = 'debug-enabled';
12321
+ function getDebuggingStorage() {
12322
+ try {
12323
+ const debuggingStorage = agentStorage.read(debugEnabled) || JSON.parse(getCookie(debugEnabled));
12324
+ if (typeof debuggingStorage === 'boolean') { // v1 debugger storage format
12325
+ return { enabled: debuggingStorage };
12326
+ }
12327
+ return debuggingStorage || {};
12328
+ }
12329
+ catch (e) {
12330
+ return {};
12331
+ }
12332
+ }
12333
+ function isDebuggingEnabled(asBoolean = true) {
12334
+ let isEnabled;
12335
+ if (store && store.getters && store.getters['debugger/debuggingEnabled']) {
12336
+ isEnabled = store.getters['debugger/debuggingEnabled']();
12337
+ }
12338
+ else {
12339
+ isEnabled = getDebuggingStorage().enabled === true;
12340
+ }
12341
+ if (asBoolean) {
12342
+ return isEnabled;
12343
+ }
12344
+ else {
12345
+ return isEnabled ? 'Yes' : 'No';
12346
+ }
12347
+ }
12348
+
12318
12349
  const PERFORMANCE_SEND_INTERVAL = 1000 * 60 * 10; // 10 minutes
12319
12350
  class PerformanceMonitor {
12320
12351
  constructor() {
12321
12352
  this._isPerformanceApiAvailable = this._checkPerformanceApi();
12322
12353
  this._measuringPerformance = false;
12354
+ this._debugging = false;
12355
+ this._setDebuggingBound = _.bind(this._setDebugging, this);
12323
12356
  this.marks = new Set();
12324
12357
  this.measures = new Set();
12325
12358
  }
@@ -12328,6 +12361,8 @@ class PerformanceMonitor {
12328
12361
  return _.noop;
12329
12362
  this._measuringPerformance = true;
12330
12363
  this._markPerformance(INITIALIZE);
12364
+ this._setDebugging();
12365
+ Events.debuggerLaunched.on(this._setDebuggingBound);
12331
12366
  this.interval = setInterval(() => {
12332
12367
  this.send();
12333
12368
  }, PERFORMANCE_SEND_INTERVAL);
@@ -12339,13 +12374,19 @@ class PerformanceMonitor {
12339
12374
  this._markPerformance(TEARDOWN);
12340
12375
  this.send();
12341
12376
  this._measuringPerformance = false;
12377
+ this._setDebugging();
12378
+ Events.debuggerLaunched.off(this._setDebuggingBound);
12342
12379
  this._clearMarksAndMeasures();
12343
12380
  clearInterval(this.interval);
12344
12381
  }
12345
- startTimer(name, detail = null) {
12382
+ startTimer({ name, debuggingOnly }, detail = null) {
12383
+ if (debuggingOnly && !this._debugging)
12384
+ return;
12346
12385
  this._markPerformance(`${name}-start`, { detail });
12347
12386
  }
12348
- stopTimer(name, detail = null) {
12387
+ stopTimer({ name, debuggingOnly }, detail = null) {
12388
+ if (debuggingOnly && !this._debugging)
12389
+ return;
12349
12390
  this._markPerformance(`${name}-stop`, { detail });
12350
12391
  this._measurePerformance(name, { detail });
12351
12392
  }
@@ -12384,6 +12425,9 @@ class PerformanceMonitor {
12384
12425
  _shouldMeasurePerformance() {
12385
12426
  return this._isPerformanceApiAvailable && this._measuringPerformance;
12386
12427
  }
12428
+ _setDebugging() {
12429
+ this._debugging = isDebuggingEnabled();
12430
+ }
12387
12431
  _markPerformance(name, metadata) {
12388
12432
  if (!this._shouldMeasurePerformance())
12389
12433
  return;
@@ -12401,13 +12445,15 @@ class PerformanceMonitor {
12401
12445
  }
12402
12446
  }
12403
12447
  _clearMarksAndMeasures() {
12404
- for (const name of this.marks) {
12448
+ // eslint-disable-next-line agent-eslint-rules/no-array-foreach
12449
+ this.marks.forEach(name => {
12405
12450
  performance.clearMarks(name);
12406
- }
12451
+ });
12407
12452
  this.marks.clear();
12408
- for (const name of this.measures) {
12453
+ // eslint-disable-next-line agent-eslint-rules/no-array-foreach
12454
+ this.measures.forEach(name => {
12409
12455
  performance.clearMeasures(name);
12410
- }
12456
+ });
12411
12457
  this.measures.clear();
12412
12458
  }
12413
12459
  }
@@ -18063,6 +18109,11 @@ function throwIllegalKeyError(key, guideId, stepId, type) {
18063
18109
  log.info(error);
18064
18110
  throw new Error(error);
18065
18111
  }
18112
+ function throwIllegalValueforKeyError(value, key, guideId, stepId) {
18113
+ var error = 'illegal value "' + value + '" for building block key "' + key + '" found on guide "' + guideId + '" step "' + stepId + '"';
18114
+ log.info(error);
18115
+ throw new Error(error);
18116
+ }
18066
18117
  // whitelist + aria-* and data-* props to ensure we won't append props that could execute js
18067
18118
  function getAllowedAttributes(attributeKeyValueMap, stepId, guideId, type) {
18068
18119
  var whitelistMap = {
@@ -18076,6 +18127,7 @@ function getAllowedAttributes(attributeKeyValueMap, stepId, guideId, type) {
18076
18127
  'class': true,
18077
18128
  'cols': true,
18078
18129
  'contenteditable': true,
18130
+ 'referrerpolicy': true,
18079
18131
  'dir': true,
18080
18132
  'for': true,
18081
18133
  'frameborder': true,
@@ -18098,6 +18150,9 @@ function getAllowedAttributes(attributeKeyValueMap, stepId, guideId, type) {
18098
18150
  'type': true,
18099
18151
  'value': true
18100
18152
  };
18153
+ let allowedValuesForAttributes = {
18154
+ referrerpolicy: ['strict-origin', 'strict-origin-when-cross-origin']
18155
+ };
18101
18156
  var restrictedNodes = {
18102
18157
  embed: { src: true }
18103
18158
  };
@@ -18112,6 +18167,11 @@ function getAllowedAttributes(attributeKeyValueMap, stepId, guideId, type) {
18112
18167
  if (!whitelistMap[key] && !isDataAttrRegex.test(key) && !isAriaAttrRegex.test(key)) {
18113
18168
  throwIllegalKeyError(key, guideId, stepId);
18114
18169
  }
18170
+ let keyValue = attributeKeyValueMap[key];
18171
+ let allowedValues = allowedValuesForAttributes[key];
18172
+ if (allowedValues && !_.contains(allowedValues, keyValue)) {
18173
+ throwIllegalValueforKeyError(keyValue, key, guideId, stepId);
18174
+ }
18115
18175
  allowed[key] = attributeKeyValueMap[key];
18116
18176
  return allowed;
18117
18177
  }, {});
@@ -21581,35 +21641,6 @@ function Wrappable() {
21581
21641
  return this;
21582
21642
  }
21583
21643
 
21584
- var debugEnabled = 'debug-enabled';
21585
- function getDebuggingStorage() {
21586
- try {
21587
- const debuggingStorage = agentStorage.read(debugEnabled) || JSON.parse(getCookie(debugEnabled));
21588
- if (typeof debuggingStorage === 'boolean') { // v1 debugger storage format
21589
- return { enabled: debuggingStorage };
21590
- }
21591
- return debuggingStorage || {};
21592
- }
21593
- catch (e) {
21594
- return {};
21595
- }
21596
- }
21597
- function isDebuggingEnabled(asBoolean = true) {
21598
- let isEnabled;
21599
- if (store && store.getters && store.getters['debugger/debuggingEnabled']) {
21600
- isEnabled = store.getters['debugger/debuggingEnabled']();
21601
- }
21602
- else {
21603
- isEnabled = getDebuggingStorage().enabled === true;
21604
- }
21605
- if (asBoolean) {
21606
- return isEnabled;
21607
- }
21608
- else {
21609
- return isEnabled ? 'Yes' : 'No';
21610
- }
21611
- }
21612
-
21613
21644
  class GuideTypeIdentifier {
21614
21645
  constructor(identificationFn, typeName) {
21615
21646
  this.type = typeName;
@@ -25400,11 +25431,6 @@ function getDefaultSeenReason(guide) {
25400
25431
  }
25401
25432
  var seenGuide = function (guideId, stepId, visitorId, reason, language, props) {
25402
25433
  if (!reason) {
25403
- log.critical('pendo.io guideSeen exception', {
25404
- guideId,
25405
- stepId,
25406
- error: new Error('seenGuide called without seen reason')
25407
- });
25408
25434
  reason = getDefaultSeenReason(findGuideById(guideId));
25409
25435
  }
25410
25436
  var evt = createGuideEvent({
@@ -37842,11 +37868,16 @@ const FrustrationEvent = (function () {
37842
37868
  if (pendoGlobal.sniffer.MutationObserver) {
37843
37869
  const MutationObserver = getZoneSafeMethod('MutationObserver');
37844
37870
  mutationObserver = new MutationObserver(observeDOMMutation);
37845
- mutationObserver.observe(pendoGlobal.dom.getBody(), {
37846
- childList: true,
37847
- attributes: true,
37848
- subtree: true
37849
- });
37871
+ try {
37872
+ mutationObserver.observe(pendoGlobal.dom.getBody(), {
37873
+ childList: true,
37874
+ attributes: true,
37875
+ subtree: true
37876
+ });
37877
+ }
37878
+ catch (e) {
37879
+ mutationObserver = null;
37880
+ }
37850
37881
  }
37851
37882
  }
37852
37883
  function teardown() {