@pendo/agent 2.269.1 → 2.271.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.271.0_';
10640
+ var PACKAGE_VERSION = '2.271.0';
10639
10641
  var LOADER = 'xhr';
10640
10642
  /* eslint-enable agent-eslint-rules/no-gulp-env-references */
10641
10643
  /**
@@ -26646,6 +26648,14 @@ function PermalinkConstructor(findGuideById) {
26646
26648
  var permalinkGuide = this.getGuideFromUrl(queryString);
26647
26649
  if (permalinkGuide && this.shouldShowPermalinkGuide(permalinkGuide)) {
26648
26650
  var step = this.getStepFromUrl(queryString, permalinkGuide);
26651
+ var once = queryString.pendo_once;
26652
+ if (once) {
26653
+ delete queryString.pendo_once;
26654
+ delete queryString.pendo;
26655
+ delete queryString.step;
26656
+ delete queryString.c__pendo;
26657
+ window.history.replaceState({}, document.title, window.location.pathname + '?' + objectToQueryString(queryString));
26658
+ }
26649
26659
  return this.showPermalinkGuide(permalinkGuide, step);
26650
26660
  }
26651
26661
  }
@@ -27539,13 +27549,13 @@ function Badge(guide, step) {
27539
27549
  var buildBadgeNodeFromJSON = function (badge) {
27540
27550
  return buildNodeFromJSON(badge, { 'id': step.id, 'guideId': guide.id, 'isBadge': true });
27541
27551
  };
27542
- var badgeElem = [
27552
+ var badgeElem = _.reduce([
27543
27553
  setBadgeDirection(isRCBadge, guide.language),
27544
27554
  changeBadgeLocation(ignoreRtl),
27545
27555
  setDefaultCursorStyle,
27546
27556
  replaceObjectWithContentHost,
27547
27557
  buildBadgeNodeFromJSON
27548
- ].reduce(function (badge, func) {
27558
+ ], function (badge, func) {
27549
27559
  return func(badge);
27550
27560
  }, this.domJson)[0];
27551
27561
  element = badgeElem;
@@ -30364,6 +30374,9 @@ var setFocusToActivationElement = function (guide) {
30364
30374
  return;
30365
30375
  }
30366
30376
  };
30377
+ function shouldAffectThrottling(guide, seenReason) {
30378
+ return !guide.isMultiApp && (seenReason === 'auto' || seenReason === 'repeatGuide');
30379
+ }
30367
30380
  /**
30368
30381
  * Hides the current guide and invokes the `guideDismissed` event. Dismissed guides will not
30369
30382
  * be re-displayed by default unless they have a recurrence setting or can be reactivated
@@ -30435,7 +30448,7 @@ var onGuideDismissed = function (evt, step) {
30435
30448
  });
30436
30449
  }
30437
30450
  // maintain latestDismissedAutoAt client-side
30438
- if (seenReason === 'auto' || seenReason === 'repeatGuide') {
30451
+ if (shouldAffectThrottling(currentGuide, seenReason)) {
30439
30452
  writeThrottlingStateCache(now, THROTTLING_STATE.DISMISSED);
30440
30453
  }
30441
30454
  step.hide();
@@ -30507,7 +30520,7 @@ var onGuideSnoozed = function (evt, step, snoozeDuration) {
30507
30520
  });
30508
30521
  }
30509
30522
  // maintain latestSnoozedAutoAt client-side
30510
- if (seenReason === 'auto' || seenReason === 'repeatGuide') {
30523
+ if (shouldAffectThrottling(guide, seenReason)) {
30511
30524
  writeThrottlingStateCache(now, THROTTLING_STATE.SNOOZED);
30512
30525
  }
30513
30526
  step.hide();
@@ -30704,7 +30717,7 @@ var onGuideAdvanced = function (evt, step, isIntermediateStep) {
30704
30717
  });
30705
30718
  }
30706
30719
  // maintain finalAdvancedAutoAt client-side
30707
- if (firstStep && (firstStep.seenReason === 'auto' || firstStep.seenReason === 'repeatGuide')) {
30720
+ if (shouldAffectThrottling(currentGuide, seenReason)) {
30708
30721
  writeThrottlingStateCache(now, THROTTLING_STATE.ADVANCED);
30709
30722
  }
30710
30723
  log.info('stop guide');
@@ -38798,7 +38811,8 @@ var PreviewModule = (function () {
38798
38811
 
38799
38812
  var DebuggerModule = (function () {
38800
38813
  var state = {
38801
- 'isTop': false,
38814
+ 'isTop': undefined,
38815
+ 'isLeader': undefined,
38802
38816
  'frameId': null,
38803
38817
  'tabId': null,
38804
38818
  'frames': {},
@@ -38823,11 +38837,13 @@ var DebuggerModule = (function () {
38823
38837
  };
38824
38838
  var actions = {
38825
38839
  'init': function (context) {
38826
- var isTop = window.top == window;
38827
- context.commit('setIsTop', isTop);
38828
38840
  context.commit('setFrameId', EventTracer.getFrameId());
38829
38841
  context.commit('setTabId', EventTracer.getTabId());
38830
38842
  context.commit('setInstallType', getInstallType());
38843
+ var isTop = isLeader() && window.top === window; // only a leader frame that is a top window can launch debugger
38844
+ state.isTop !== isTop;
38845
+ context.commit('setIsTop', isTop);
38846
+ context.commit('isLeader', isLeader());
38831
38847
  if (isTop) {
38832
38848
  var debugging = getDebuggingStorage();
38833
38849
  context.commit('debuggingEnabled', debugging.enabled === true);
@@ -38952,6 +38968,9 @@ var DebuggerModule = (function () {
38952
38968
  'setIsTop': function (state, isTop) {
38953
38969
  state.isTop = isTop;
38954
38970
  },
38971
+ 'isLeader': function (state, isLeader) {
38972
+ state.isLeader = isLeader;
38973
+ },
38955
38974
  'setInstallType': function (state, installType) {
38956
38975
  state.installType = installType;
38957
38976
  },
@@ -41909,10 +41928,22 @@ var ActionAutomation = (function () {
41909
41928
  return config.value;
41910
41929
  }
41911
41930
  function injectText(element, value) {
41931
+ var valueDescriptor;
41932
+ if (element.tagName === 'INPUT') {
41933
+ valueDescriptor = Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype, 'value');
41934
+ }
41935
+ if (element.tagName === 'TEXTAREA') {
41936
+ valueDescriptor = Object.getOwnPropertyDescriptor(window.HTMLTextAreaElement.prototype, 'value');
41937
+ }
41938
+ if (valueDescriptor && typeof valueDescriptor.set === 'function') {
41939
+ valueDescriptor.set.call(element, value); // ensures React ≥ 15.6.1 updates value in state
41940
+ }
41912
41941
  element.value = value;
41913
41942
  var inputEvent = new InputEvent('input', { 'bubbles': true, 'data': value[value.length - 1] });
41943
+ inputEvent.simulated = true; // for React ≤ 15.6.0
41914
41944
  element.dispatchEvent(inputEvent);
41915
41945
  var changeEvent = new InputEvent('change', { 'bubbles': true });
41946
+ changeEvent.simulated = true; // for React ≤ 15.6.0
41916
41947
  element.dispatchEvent(changeEvent);
41917
41948
  }
41918
41949
  function isAutomationInQueue(automation) {
@@ -41921,7 +41952,7 @@ var ActionAutomation = (function () {
41921
41952
  });
41922
41953
  }
41923
41954
  function getAutomationFromGuide(guideAutomations, automationIds) {
41924
- return automationIds.reduce(function (total, automationId) {
41955
+ return _.reduce(automationIds, function (total, automationId) {
41925
41956
  var automation = _.find(guideAutomations, function (guideAutomation) {
41926
41957
  return guideAutomation.id === automationId;
41927
41958
  });
@@ -42334,8 +42365,6 @@ function startDebuggingModuleIfEnabled() {
42334
42365
  var debugging = getDebuggingStorage();
42335
42366
  if (!debugging.enabled)
42336
42367
  return;
42337
- if (window.top !== window)
42338
- return;
42339
42368
  store.commit('debugger/debuggingEnabled', true);
42340
42369
  addDebuggingFunctions();
42341
42370
  if (dom('#pendo-client-debugger').length)
@@ -42385,6 +42414,8 @@ function enableDebugging(andChain) {
42385
42414
  }
42386
42415
  return 'debugging already enabled';
42387
42416
  }
42417
+ if (!isLeader())
42418
+ return;
42388
42419
  var debugging = getDebuggingStorage();
42389
42420
  debugging.enabled = true;
42390
42421
  agentStorage.write(debugEnabled, JSON.stringify(debugging), null, true);
@@ -42417,15 +42448,44 @@ function disableDebugging() {
42417
42448
  }
42418
42449
  _.extend(debug, debugging);
42419
42450
 
42451
+ var waitForLeader = function (Events, store, q) {
42452
+ if (store.getters['frames/leaderExists']()) {
42453
+ return q.resolve();
42454
+ }
42455
+ var deferred = q.defer();
42456
+ Events.on('leaderChanged', function () {
42457
+ deferred.resolve();
42458
+ });
42459
+ return deferred.promise;
42460
+ };
42420
42461
  var DebuggerLauncher = (function () {
42421
42462
  var globalPendo;
42463
+ var store;
42422
42464
  return {
42423
42465
  'name': 'DebuggerLauncher',
42424
42466
  initialize: initialize,
42425
42467
  teardown: teardown
42426
42468
  };
42427
42469
  function initialize(pendo, PluginAPI) {
42428
- store.dispatch('debugger/init');
42470
+ var Events = PluginAPI.Events, q = PluginAPI.q;
42471
+ store = PluginAPI.store;
42472
+ waitForLeader(Events, store, q).then(function () {
42473
+ store.dispatch('debugger/init');
42474
+ if (store.getters['frames/isLeader']()) {
42475
+ startDebuggingModuleIfEnabled();
42476
+ }
42477
+ registerMessageHandler('pendo-debugger::launch', function (data, msg) {
42478
+ if (data.config.apiKey !== pendo.apiKey)
42479
+ return;
42480
+ msg.source.postMessage({
42481
+ 'type': 'pendo-debugger::ready',
42482
+ 'apiKey': pendo.apiKey
42483
+ }, msg.origin);
42484
+ if (isDebuggingEnabled())
42485
+ return;
42486
+ enableDebugging(false);
42487
+ });
42488
+ });
42429
42489
  if (window.addEventListener) {
42430
42490
  window.addEventListener('securitypolicyviolation', securityPolicyViolationFn);
42431
42491
  }
@@ -42447,18 +42507,6 @@ var DebuggerLauncher = (function () {
42447
42507
  pendo.enableDebugging = enableDebugging;
42448
42508
  pendo.disableDebugging = disableDebugging;
42449
42509
  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
42510
  }
42463
42511
  function teardown() {
42464
42512
  deregisterMessageHandler('pendo-debugger::launch');
@@ -42790,9 +42838,9 @@ var FrustrationEvent = (function () {
42790
42838
  function getPreviousPageLoads() {
42791
42839
  var previousPageLoads = pluginApi.sessionStorage.getItem(previousPageLoadsCookie);
42792
42840
  if (previousPageLoads != null && previousPageLoads.length > 0) {
42793
- return JSON.parse(previousPageLoads);
42841
+ previousPageLoads = JSON.parse(previousPageLoads);
42794
42842
  }
42795
- return [];
42843
+ return _.isArray(previousPageLoads) ? previousPageLoads : [];
42796
42844
  }
42797
42845
  function setPreviousPageLoads(pageLoads) {
42798
42846
  pluginApi.sessionStorage.setItem(previousPageLoadsCookie, JSON.stringify(pageLoads));