@pendo/agent 2.269.0 → 2.270.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.
@@ -5998,7 +5998,9 @@ SessionRecorder.prototype.addConfigOptions = function () {
5998
5998
  * @default undefined
5999
5999
  * @type {function}
6000
6000
  */
6001
- cf.addOption(RECORDING_CONFIG_ON_RECORDING_START, [cf.sources.PENDO_CONFIG_SRC], undefined);
6001
+ // Passed as a config option by the extension. See:
6002
+ // https://github.com/pendo-io/pendo-browser-extension/blob/master/src/common/agent-loader.js
6003
+ cf.addOption(RECORDING_CONFIG_ON_RECORDING_START, [cf.sources.SNIPPET_SRC, cf.sources.PENDO_CONFIG_SRC], undefined);
6002
6004
  /**
6003
6005
  * A function that gets called when replay stops collecting data.
6004
6006
  *
@@ -6008,10 +6010,11 @@ SessionRecorder.prototype.addConfigOptions = function () {
6008
6010
  * @default undefined
6009
6011
  * @type {function}
6010
6012
  */
6011
- cf.addOption(RECORDING_CONFIG_ON_RECORDING_STOP, [cf.sources.PENDO_CONFIG_SRC], undefined);
6013
+ // Passed as a config option by the extension. See:
6014
+ // https://github.com/pendo-io/pendo-browser-extension/blob/master/src/common/agent-loader.js
6015
+ cf.addOption(RECORDING_CONFIG_ON_RECORDING_STOP, [cf.sources.SNIPPET_SRC, cf.sources.PENDO_CONFIG_SRC], undefined);
6012
6016
  /**
6013
- * Used alongside `recording.workerOverride` when self hosting the replay web worker. Specifies
6014
- * the URL that points to the self hosted web worker.
6017
+ * Used when self hosting the replay web worker. Specifies the URL that points to the self hosted web worker.
6015
6018
  *
6016
6019
  * @access public
6017
6020
  * @category Config/Replay
@@ -6021,14 +6024,13 @@ SessionRecorder.prototype.addConfigOptions = function () {
6021
6024
  */
6022
6025
  cf.addOption(RECORDING_CONFIG_WORKERURL, [cf.sources.SNIPPET_SRC], undefined);
6023
6026
  /**
6024
- * Used alongside `recording.workerUrl` when self hosting the replay web worker. When `true`, indicates that you
6025
- * wish to ignore the built in replay web worker and instead use a self hosted version of the replay web worker.
6027
+ * Internal only option used by the extension to avoid CSP issues on POST. See:
6028
+ * https://github.com/pendo-io/pendo-browser-extension/blob/master/src/common/agent-loader.js
6026
6029
  *
6027
- * @access public
6028
- * @category Config/Replay
6030
+ * @access private
6029
6031
  * @name recording.workerOverride
6030
- * @default false
6031
- * @type {boolean}
6032
+ * @default undefined
6033
+ * @type {object}
6032
6034
  */
6033
6035
  cf.addOption(RECORDING_CONFIG_WORKER_OVERRIDE, [cf.sources.PENDO_CONFIG_SRC], undefined);
6034
6036
  cf.addOption(RESOURCE_CACHING, [cf.sources.PENDO_CONFIG_SRC], undefined);
@@ -6122,7 +6124,7 @@ SessionRecorder.prototype.teardown = function () {
6122
6124
  this.transport.stop();
6123
6125
  };
6124
6126
  SessionRecorder.prototype.ready = function () {
6125
- if (this.config.autoStart !== false) {
6127
+ if (this.api.ConfigReader.get(RECORDING_CONFIG_AUTO_START) !== false) {
6126
6128
  this.start();
6127
6129
  }
6128
6130
  };
@@ -10634,8 +10636,8 @@ var SERVER = '';
10634
10636
  var ASSET_HOST = '';
10635
10637
  var ASSET_PATH = '';
10636
10638
  var DESIGNER_ENV = '';
10637
- var VERSION = '2.269.0_';
10638
- var PACKAGE_VERSION = '2.269.0';
10639
+ var VERSION = '2.270.0_';
10640
+ var PACKAGE_VERSION = '2.270.0';
10639
10641
  var LOADER = 'xhr';
10640
10642
  /* eslint-enable agent-eslint-rules/no-gulp-env-references */
10641
10643
  /**
@@ -19525,29 +19527,38 @@ function getHtmlAttributeTester(htmlAttributes) {
19525
19527
  }
19526
19528
  return _.constant(false);
19527
19529
  }
19530
+ // APP-118929
19531
+ // Due to SFDC being SFDC and the fact that their apps will sometimes use Proxies as part of their event targets
19532
+ // we need to protect ourselves from unexpected invalid attributes.
19528
19533
  function filterAttributeList(attributeNodes, defaultAttributes, includeFn, excludeFn) {
19529
- var defaultAttributeLookup = _.indexBy(defaultAttributes);
19530
- var filteredAttributes = _.filter(_.filter(attributeNodes, function (attributeNode) {
19531
- return includeFn(attributeNode.nodeName) || defaultAttributeLookup[attributeNode.nodeName];
19532
- }), function (attributeNode) {
19533
- return !excludeFn(attributeNode.nodeName);
19534
- });
19535
- if (filteredAttributes.length <= MAX_ATTRIBUTES) {
19536
- return _.pluck(filteredAttributes, 'nodeName');
19537
- }
19538
- var groupedAttributes = _.groupBy(attributeNodes, function (attributeNode) {
19539
- if (defaultAttributeLookup[attributeNode.nodeName]) {
19540
- return 'defaults';
19541
- }
19542
- if (_.isString(attributeNode.value) && attributeNode.value.length > MAX_ATTRIBUTE_LENGTH) {
19543
- return 'large';
19534
+ try {
19535
+ var defaultAttributeLookup = _.indexBy(defaultAttributes);
19536
+ var filteredAttributes = _.filter(_.filter(attributeNodes, function (attributeNode) {
19537
+ return includeFn(attributeNode.nodeName) || defaultAttributeLookup[attributeNode.nodeName];
19538
+ }), function (attributeNode) {
19539
+ return !excludeFn(attributeNode.nodeName);
19540
+ });
19541
+ if (filteredAttributes.length <= MAX_ATTRIBUTES) {
19542
+ return _.pluck(filteredAttributes, 'nodeName');
19544
19543
  }
19545
- return 'small';
19546
- });
19547
- return _.pluck([].concat(_.sortBy(groupedAttributes.defaults, 'nodeName'))
19548
- .concat(_.sortBy(groupedAttributes.small, 'nodeName'))
19549
- .concat(_.sortBy(groupedAttributes.large, 'nodeName'))
19550
- .slice(0, MAX_ATTRIBUTES), 'nodeName');
19544
+ var groupedAttributes = _.groupBy(attributeNodes, function (attributeNode) {
19545
+ if (defaultAttributeLookup[attributeNode.nodeName]) {
19546
+ return 'defaults';
19547
+ }
19548
+ if (_.isString(attributeNode.value) && attributeNode.value.length > MAX_ATTRIBUTE_LENGTH) {
19549
+ return 'large';
19550
+ }
19551
+ return 'small';
19552
+ });
19553
+ return _.pluck([].concat(_.sortBy(groupedAttributes.defaults, 'nodeName'))
19554
+ .concat(_.sortBy(groupedAttributes.small, 'nodeName'))
19555
+ .concat(_.sortBy(groupedAttributes.large, 'nodeName'))
19556
+ .slice(0, MAX_ATTRIBUTES), 'nodeName');
19557
+ }
19558
+ catch (e) {
19559
+ log.error("Error collecting DOM Node attributes: ".concat(e));
19560
+ return [];
19561
+ }
19551
19562
  }
19552
19563
  function attributeSerializer(context, node) {
19553
19564
  var shouldIncludeAttribute = getHtmlAttributeTester(ConfigReader.get('htmlAttributes'));
@@ -27530,13 +27541,13 @@ function Badge(guide, step) {
27530
27541
  var buildBadgeNodeFromJSON = function (badge) {
27531
27542
  return buildNodeFromJSON(badge, { 'id': step.id, 'guideId': guide.id, 'isBadge': true });
27532
27543
  };
27533
- var badgeElem = [
27544
+ var badgeElem = _.reduce([
27534
27545
  setBadgeDirection(isRCBadge, guide.language),
27535
27546
  changeBadgeLocation(ignoreRtl),
27536
27547
  setDefaultCursorStyle,
27537
27548
  replaceObjectWithContentHost,
27538
27549
  buildBadgeNodeFromJSON
27539
- ].reduce(function (badge, func) {
27550
+ ], function (badge, func) {
27540
27551
  return func(badge);
27541
27552
  }, this.domJson)[0];
27542
27553
  element = badgeElem;
@@ -30355,6 +30366,9 @@ var setFocusToActivationElement = function (guide) {
30355
30366
  return;
30356
30367
  }
30357
30368
  };
30369
+ function shouldAffectThrottling(guide, seenReason) {
30370
+ return !guide.isMultiApp && (seenReason === 'auto' || seenReason === 'repeatGuide');
30371
+ }
30358
30372
  /**
30359
30373
  * Hides the current guide and invokes the `guideDismissed` event. Dismissed guides will not
30360
30374
  * be re-displayed by default unless they have a recurrence setting or can be reactivated
@@ -30426,7 +30440,7 @@ var onGuideDismissed = function (evt, step) {
30426
30440
  });
30427
30441
  }
30428
30442
  // maintain latestDismissedAutoAt client-side
30429
- if (seenReason === 'auto' || seenReason === 'repeatGuide') {
30443
+ if (shouldAffectThrottling(currentGuide, seenReason)) {
30430
30444
  writeThrottlingStateCache(now, THROTTLING_STATE.DISMISSED);
30431
30445
  }
30432
30446
  step.hide();
@@ -30498,7 +30512,7 @@ var onGuideSnoozed = function (evt, step, snoozeDuration) {
30498
30512
  });
30499
30513
  }
30500
30514
  // maintain latestSnoozedAutoAt client-side
30501
- if (seenReason === 'auto' || seenReason === 'repeatGuide') {
30515
+ if (shouldAffectThrottling(guide, seenReason)) {
30502
30516
  writeThrottlingStateCache(now, THROTTLING_STATE.SNOOZED);
30503
30517
  }
30504
30518
  step.hide();
@@ -30695,7 +30709,7 @@ var onGuideAdvanced = function (evt, step, isIntermediateStep) {
30695
30709
  });
30696
30710
  }
30697
30711
  // maintain finalAdvancedAutoAt client-side
30698
- if (firstStep && (firstStep.seenReason === 'auto' || firstStep.seenReason === 'repeatGuide')) {
30712
+ if (shouldAffectThrottling(currentGuide, seenReason)) {
30699
30713
  writeThrottlingStateCache(now, THROTTLING_STATE.ADVANCED);
30700
30714
  }
30701
30715
  log.info('stop guide');
@@ -38789,7 +38803,8 @@ var PreviewModule = (function () {
38789
38803
 
38790
38804
  var DebuggerModule = (function () {
38791
38805
  var state = {
38792
- 'isTop': false,
38806
+ 'isTop': undefined,
38807
+ 'isLeader': undefined,
38793
38808
  'frameId': null,
38794
38809
  'tabId': null,
38795
38810
  'frames': {},
@@ -38814,11 +38829,13 @@ var DebuggerModule = (function () {
38814
38829
  };
38815
38830
  var actions = {
38816
38831
  'init': function (context) {
38817
- var isTop = window.top == window;
38818
- context.commit('setIsTop', isTop);
38819
38832
  context.commit('setFrameId', EventTracer.getFrameId());
38820
38833
  context.commit('setTabId', EventTracer.getTabId());
38821
38834
  context.commit('setInstallType', getInstallType());
38835
+ var isTop = isLeader() && window.top === window; // only a leader frame that is a top window can launch debugger
38836
+ state.isTop !== isTop;
38837
+ context.commit('setIsTop', isTop);
38838
+ context.commit('isLeader', isLeader());
38822
38839
  if (isTop) {
38823
38840
  var debugging = getDebuggingStorage();
38824
38841
  context.commit('debuggingEnabled', debugging.enabled === true);
@@ -38943,6 +38960,9 @@ var DebuggerModule = (function () {
38943
38960
  'setIsTop': function (state, isTop) {
38944
38961
  state.isTop = isTop;
38945
38962
  },
38963
+ 'isLeader': function (state, isLeader) {
38964
+ state.isLeader = isLeader;
38965
+ },
38946
38966
  'setInstallType': function (state, installType) {
38947
38967
  state.installType = installType;
38948
38968
  },
@@ -41912,7 +41932,7 @@ var ActionAutomation = (function () {
41912
41932
  });
41913
41933
  }
41914
41934
  function getAutomationFromGuide(guideAutomations, automationIds) {
41915
- return automationIds.reduce(function (total, automationId) {
41935
+ return _.reduce(automationIds, function (total, automationId) {
41916
41936
  var automation = _.find(guideAutomations, function (guideAutomation) {
41917
41937
  return guideAutomation.id === automationId;
41918
41938
  });
@@ -42325,8 +42345,6 @@ function startDebuggingModuleIfEnabled() {
42325
42345
  var debugging = getDebuggingStorage();
42326
42346
  if (!debugging.enabled)
42327
42347
  return;
42328
- if (window.top !== window)
42329
- return;
42330
42348
  store.commit('debugger/debuggingEnabled', true);
42331
42349
  addDebuggingFunctions();
42332
42350
  if (dom('#pendo-client-debugger').length)
@@ -42376,6 +42394,8 @@ function enableDebugging(andChain) {
42376
42394
  }
42377
42395
  return 'debugging already enabled';
42378
42396
  }
42397
+ if (!isLeader())
42398
+ return;
42379
42399
  var debugging = getDebuggingStorage();
42380
42400
  debugging.enabled = true;
42381
42401
  agentStorage.write(debugEnabled, JSON.stringify(debugging), null, true);
@@ -42408,15 +42428,44 @@ function disableDebugging() {
42408
42428
  }
42409
42429
  _.extend(debug, debugging);
42410
42430
 
42431
+ var waitForLeader = function (Events, store, q) {
42432
+ if (store.getters['frames/leaderExists']()) {
42433
+ return q.resolve();
42434
+ }
42435
+ var deferred = q.defer();
42436
+ Events.on('leaderChanged', function () {
42437
+ deferred.resolve();
42438
+ });
42439
+ return deferred.promise;
42440
+ };
42411
42441
  var DebuggerLauncher = (function () {
42412
42442
  var globalPendo;
42443
+ var store;
42413
42444
  return {
42414
42445
  'name': 'DebuggerLauncher',
42415
42446
  initialize: initialize,
42416
42447
  teardown: teardown
42417
42448
  };
42418
42449
  function initialize(pendo, PluginAPI) {
42419
- store.dispatch('debugger/init');
42450
+ var Events = PluginAPI.Events, q = PluginAPI.q;
42451
+ store = PluginAPI.store;
42452
+ waitForLeader(Events, store, q).then(function () {
42453
+ store.dispatch('debugger/init');
42454
+ if (store.getters['frames/isLeader']()) {
42455
+ startDebuggingModuleIfEnabled();
42456
+ }
42457
+ registerMessageHandler('pendo-debugger::launch', function (data, msg) {
42458
+ if (data.config.apiKey !== pendo.apiKey)
42459
+ return;
42460
+ msg.source.postMessage({
42461
+ 'type': 'pendo-debugger::ready',
42462
+ 'apiKey': pendo.apiKey
42463
+ }, msg.origin);
42464
+ if (isDebuggingEnabled())
42465
+ return;
42466
+ enableDebugging(false);
42467
+ });
42468
+ });
42420
42469
  if (window.addEventListener) {
42421
42470
  window.addEventListener('securitypolicyviolation', securityPolicyViolationFn);
42422
42471
  }
@@ -42438,18 +42487,6 @@ var DebuggerLauncher = (function () {
42438
42487
  pendo.enableDebugging = enableDebugging;
42439
42488
  pendo.disableDebugging = disableDebugging;
42440
42489
  pendo.addDebuggingFunctions = addDebuggingFunctions;
42441
- startDebuggingModuleIfEnabled();
42442
- registerMessageHandler('pendo-debugger::launch', function (data, msg) {
42443
- if (data.config.apiKey !== pendo.apiKey)
42444
- return;
42445
- msg.source.postMessage({
42446
- 'type': 'pendo-debugger::ready',
42447
- 'apiKey': pendo.apiKey
42448
- }, msg.origin);
42449
- if (isDebuggingEnabled())
42450
- return;
42451
- enableDebugging(false);
42452
- });
42453
42490
  }
42454
42491
  function teardown() {
42455
42492
  deregisterMessageHandler('pendo-debugger::launch');