@pendo/agent 2.269.1 → 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.1_';
10638
- var PACKAGE_VERSION = '2.269.1';
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
  /**
@@ -27539,13 +27541,13 @@ function Badge(guide, step) {
27539
27541
  var buildBadgeNodeFromJSON = function (badge) {
27540
27542
  return buildNodeFromJSON(badge, { 'id': step.id, 'guideId': guide.id, 'isBadge': true });
27541
27543
  };
27542
- var badgeElem = [
27544
+ var badgeElem = _.reduce([
27543
27545
  setBadgeDirection(isRCBadge, guide.language),
27544
27546
  changeBadgeLocation(ignoreRtl),
27545
27547
  setDefaultCursorStyle,
27546
27548
  replaceObjectWithContentHost,
27547
27549
  buildBadgeNodeFromJSON
27548
- ].reduce(function (badge, func) {
27550
+ ], function (badge, func) {
27549
27551
  return func(badge);
27550
27552
  }, this.domJson)[0];
27551
27553
  element = badgeElem;
@@ -30364,6 +30366,9 @@ var setFocusToActivationElement = function (guide) {
30364
30366
  return;
30365
30367
  }
30366
30368
  };
30369
+ function shouldAffectThrottling(guide, seenReason) {
30370
+ return !guide.isMultiApp && (seenReason === 'auto' || seenReason === 'repeatGuide');
30371
+ }
30367
30372
  /**
30368
30373
  * Hides the current guide and invokes the `guideDismissed` event. Dismissed guides will not
30369
30374
  * be re-displayed by default unless they have a recurrence setting or can be reactivated
@@ -30435,7 +30440,7 @@ var onGuideDismissed = function (evt, step) {
30435
30440
  });
30436
30441
  }
30437
30442
  // maintain latestDismissedAutoAt client-side
30438
- if (seenReason === 'auto' || seenReason === 'repeatGuide') {
30443
+ if (shouldAffectThrottling(currentGuide, seenReason)) {
30439
30444
  writeThrottlingStateCache(now, THROTTLING_STATE.DISMISSED);
30440
30445
  }
30441
30446
  step.hide();
@@ -30507,7 +30512,7 @@ var onGuideSnoozed = function (evt, step, snoozeDuration) {
30507
30512
  });
30508
30513
  }
30509
30514
  // maintain latestSnoozedAutoAt client-side
30510
- if (seenReason === 'auto' || seenReason === 'repeatGuide') {
30515
+ if (shouldAffectThrottling(guide, seenReason)) {
30511
30516
  writeThrottlingStateCache(now, THROTTLING_STATE.SNOOZED);
30512
30517
  }
30513
30518
  step.hide();
@@ -30704,7 +30709,7 @@ var onGuideAdvanced = function (evt, step, isIntermediateStep) {
30704
30709
  });
30705
30710
  }
30706
30711
  // maintain finalAdvancedAutoAt client-side
30707
- if (firstStep && (firstStep.seenReason === 'auto' || firstStep.seenReason === 'repeatGuide')) {
30712
+ if (shouldAffectThrottling(currentGuide, seenReason)) {
30708
30713
  writeThrottlingStateCache(now, THROTTLING_STATE.ADVANCED);
30709
30714
  }
30710
30715
  log.info('stop guide');
@@ -38798,7 +38803,8 @@ var PreviewModule = (function () {
38798
38803
 
38799
38804
  var DebuggerModule = (function () {
38800
38805
  var state = {
38801
- 'isTop': false,
38806
+ 'isTop': undefined,
38807
+ 'isLeader': undefined,
38802
38808
  'frameId': null,
38803
38809
  'tabId': null,
38804
38810
  'frames': {},
@@ -38823,11 +38829,13 @@ var DebuggerModule = (function () {
38823
38829
  };
38824
38830
  var actions = {
38825
38831
  'init': function (context) {
38826
- var isTop = window.top == window;
38827
- context.commit('setIsTop', isTop);
38828
38832
  context.commit('setFrameId', EventTracer.getFrameId());
38829
38833
  context.commit('setTabId', EventTracer.getTabId());
38830
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());
38831
38839
  if (isTop) {
38832
38840
  var debugging = getDebuggingStorage();
38833
38841
  context.commit('debuggingEnabled', debugging.enabled === true);
@@ -38952,6 +38960,9 @@ var DebuggerModule = (function () {
38952
38960
  'setIsTop': function (state, isTop) {
38953
38961
  state.isTop = isTop;
38954
38962
  },
38963
+ 'isLeader': function (state, isLeader) {
38964
+ state.isLeader = isLeader;
38965
+ },
38955
38966
  'setInstallType': function (state, installType) {
38956
38967
  state.installType = installType;
38957
38968
  },
@@ -41921,7 +41932,7 @@ var ActionAutomation = (function () {
41921
41932
  });
41922
41933
  }
41923
41934
  function getAutomationFromGuide(guideAutomations, automationIds) {
41924
- return automationIds.reduce(function (total, automationId) {
41935
+ return _.reduce(automationIds, function (total, automationId) {
41925
41936
  var automation = _.find(guideAutomations, function (guideAutomation) {
41926
41937
  return guideAutomation.id === automationId;
41927
41938
  });
@@ -42334,8 +42345,6 @@ function startDebuggingModuleIfEnabled() {
42334
42345
  var debugging = getDebuggingStorage();
42335
42346
  if (!debugging.enabled)
42336
42347
  return;
42337
- if (window.top !== window)
42338
- return;
42339
42348
  store.commit('debugger/debuggingEnabled', true);
42340
42349
  addDebuggingFunctions();
42341
42350
  if (dom('#pendo-client-debugger').length)
@@ -42385,6 +42394,8 @@ function enableDebugging(andChain) {
42385
42394
  }
42386
42395
  return 'debugging already enabled';
42387
42396
  }
42397
+ if (!isLeader())
42398
+ return;
42388
42399
  var debugging = getDebuggingStorage();
42389
42400
  debugging.enabled = true;
42390
42401
  agentStorage.write(debugEnabled, JSON.stringify(debugging), null, true);
@@ -42417,15 +42428,44 @@ function disableDebugging() {
42417
42428
  }
42418
42429
  _.extend(debug, debugging);
42419
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
+ };
42420
42441
  var DebuggerLauncher = (function () {
42421
42442
  var globalPendo;
42443
+ var store;
42422
42444
  return {
42423
42445
  'name': 'DebuggerLauncher',
42424
42446
  initialize: initialize,
42425
42447
  teardown: teardown
42426
42448
  };
42427
42449
  function initialize(pendo, PluginAPI) {
42428
- 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
+ });
42429
42469
  if (window.addEventListener) {
42430
42470
  window.addEventListener('securitypolicyviolation', securityPolicyViolationFn);
42431
42471
  }
@@ -42447,18 +42487,6 @@ var DebuggerLauncher = (function () {
42447
42487
  pendo.enableDebugging = enableDebugging;
42448
42488
  pendo.disableDebugging = disableDebugging;
42449
42489
  pendo.addDebuggingFunctions = addDebuggingFunctions;
42450
- startDebuggingModuleIfEnabled();
42451
- registerMessageHandler('pendo-debugger::launch', function (data, msg) {
42452
- if (data.config.apiKey !== pendo.apiKey)
42453
- return;
42454
- msg.source.postMessage({
42455
- 'type': 'pendo-debugger::ready',
42456
- 'apiKey': pendo.apiKey
42457
- }, msg.origin);
42458
- if (isDebuggingEnabled())
42459
- return;
42460
- enableDebugging(false);
42461
- });
42462
42490
  }
42463
42491
  function teardown() {
42464
42492
  deregisterMessageHandler('pendo-debugger::launch');