@pendo/agent 2.277.0 → 2.278.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.
@@ -438,8 +438,13 @@ function loadAsModule(config) {
438
438
  }
439
439
  function createPendoObject(config) {
440
440
  var windowOrMountPoint = loadAsModule(config) ? {} : window;
441
- // eslint-disable-next-line no-return-assign
442
- pendo$1 = windowOrMountPoint.pendo = windowOrMountPoint.pendo || {};
441
+ var agentScriptTag = findAgentScriptTag(document.getElementsByTagName('script'), config.apiKey);
442
+ var globalKey = config.pendoGlobalKey || 'pendo';
443
+ if (agentScriptTag) {
444
+ globalKey = agentScriptTag.getAttribute('data-pendo-global-key') || globalKey;
445
+ config.pendoGlobalKey = globalKey;
446
+ }
447
+ pendo$1 = windowOrMountPoint[globalKey] = windowOrMountPoint[globalKey] || {};
443
448
  return pendo$1;
444
449
  }
445
450
  function isStagingEnvironment(config) {
@@ -457,16 +462,23 @@ function shouldUseStagingAgent(config) {
457
462
  function shouldUseUnminifiedAgent(config, debuggingEnabled) {
458
463
  return !isExtension(config) && isMinifiedAgent(config) && debuggingEnabled;
459
464
  }
460
- function buildCDNStagingAgentUrl(scripts) {
465
+ function findAgentScriptTag(scripts, apiKey) {
461
466
  if (scripts === void 0) { scripts = []; }
462
467
  var regex = /^https:\/\/[\w\-.]*cdn[\w\-.]*\.(pendo-dev\.com|pendo\.io)\/agent\/static\/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12}|PENDO_API_KEY)\/pendo\.js$/g;
463
468
  for (var i = 0; i < scripts.length; i++) {
464
469
  var script = scripts[i];
465
- if (regex.test(script.src)) {
466
- return script.src.replace(/\.js$/, '-staging.js');
470
+ if (regex.test(script.src) || script.id === "pendo-".concat(apiKey)) {
471
+ return script;
467
472
  }
468
473
  }
469
474
  }
475
+ function buildCDNStagingAgentUrl(scripts) {
476
+ if (scripts === void 0) { scripts = []; }
477
+ var agentScript = findAgentScriptTag(scripts);
478
+ if (agentScript) {
479
+ return agentScript.src.replace(/\.js$/, '-staging.js');
480
+ }
481
+ }
470
482
  function getAlternateAgentUrl(config, useStaging, debuggingEnabled) {
471
483
  var agentUrl = buildCDNStagingAgentUrl(document.getElementsByTagName('script')) || config.stagingAgentUrl;
472
484
  if (debuggingEnabled) {
@@ -3882,8 +3894,8 @@ var SERVER = '';
3882
3894
  var ASSET_HOST = '';
3883
3895
  var ASSET_PATH = '';
3884
3896
  var DESIGNER_ENV = '';
3885
- var VERSION = '2.277.0_';
3886
- var PACKAGE_VERSION = '2.277.0';
3897
+ var VERSION = '2.278.0_';
3898
+ var PACKAGE_VERSION = '2.278.0';
3887
3899
  var LOADER = 'xhr';
3888
3900
  /* eslint-enable agent-eslint-rules/no-gulp-env-references */
3889
3901
  /**
@@ -22010,10 +22022,10 @@ var watermarkGuideRequest = function (config) {
22010
22022
  });
22011
22023
  };
22012
22024
  var PreviewGuideLoader = {
22013
- 'load': function (url, callback) {
22025
+ 'load': function (url, pendo, callback) {
22014
22026
  return previewLoadGuideJs(url, callback);
22015
22027
  },
22016
- 'post': function (url, payload, callback) {
22028
+ 'post': function (url, payload, pendo, callback) {
22017
22029
  return previewLoadGuideJs(url, callback);
22018
22030
  },
22019
22031
  'endpoint': function () {
@@ -25146,10 +25158,16 @@ var loadGuides = function (apiKey, visitorId, page, callback) {
25146
25158
  store.dispatch('frames/changeGuideList', displayableGuides);
25147
25159
  // define event properties to be consumed during handle_event
25148
25160
  pendo$1.eventProperties = createEventPropertiesFromFeatures(pendo$1.features);
25161
+ var globalJsPromise = q.resolve();
25162
+ if (pendo$1.globalJsUrl) {
25163
+ globalJsPromise = loadGlobalScriptOnce(replaceWithContentHost(pendo$1.globalJsUrl))['catch'](function (err) {
25164
+ log.error('Error loading global script: ', err);
25165
+ });
25166
+ }
25149
25167
  if (displayableGuides.length) {
25150
25168
  q.all([
25151
25169
  loadGuideCss(),
25152
- loadGlobalScriptOnce(replaceWithContentHost(pendo$1.globalJsUrl)),
25170
+ globalJsPromise,
25153
25171
  initializeResourceCenter(activeGuides),
25154
25172
  BuildingBlockWatermark.initializeWatermark(activeGuides),
25155
25173
  waitForGlobalCssToLoad(5000)
@@ -30806,7 +30824,7 @@ var CloneDetection = /** @class */ (function () {
30806
30824
  };
30807
30825
  CloneDetection.prototype.startCloneDetectionTimer = function () {
30808
30826
  this.stopCloneDetectionTimer();
30809
- this.cloneDetectionTimer = setTimeout$1(this.clearCloneDetectionValue.bind(this), 1000 * 10);
30827
+ this.cloneDetectionTimer = setTimeout$1(_.bind(this.clearCloneDetectionValue, this), 1000 * 10);
30810
30828
  };
30811
30829
  CloneDetection.prototype.stopCloneDetectionTimer = function () {
30812
30830
  if (this.cloneDetectionTimer) {
@@ -35379,8 +35397,8 @@ var ActionAutomation = (function () {
35379
35397
  }
35380
35398
  function getElement(automation, retries) {
35381
35399
  if (retries === void 0) { retries = DEFAULT_ELEMENT_RETRIES; }
35382
- return new Promise$2(function (resolve) {
35383
- return setTimeout$1(function () {
35400
+ return new Promise$2(_.bind(function (resolve) {
35401
+ return setTimeout$1(_.bind(function () {
35384
35402
  var element = this.getTarget(automation);
35385
35403
  var isElementValid = element && !element.disabled;
35386
35404
  if ((isElementValid) || retries < 1) {
@@ -35390,8 +35408,8 @@ var ActionAutomation = (function () {
35390
35408
  this.getElement(automation, retries - 1).then(function (ele) {
35391
35409
  resolve(ele);
35392
35410
  });
35393
- }.bind(this), DEFAULT_TARGET_LOOKUP_RETRY_CADENCE);
35394
- }.bind(this));
35411
+ }, this), DEFAULT_TARGET_LOOKUP_RETRY_CADENCE);
35412
+ }, this));
35395
35413
  }
35396
35414
  function getValue(config) {
35397
35415
  return config.value;
@@ -35469,8 +35487,8 @@ var ActionAutomation = (function () {
35469
35487
  if (automationConfig.type === 'autoclick') {
35470
35488
  waitTime = DEFAULT_WAIT_BETWEEN_AUTOMATION_CLICKS;
35471
35489
  }
35472
- return setTimeout$1(function () {
35473
- return this.getElement(automationConfig, DEFAULT_ELEMENT_RETRIES).then(function (element) {
35490
+ return setTimeout$1(_.bind(function () {
35491
+ return this.getElement(automationConfig, DEFAULT_ELEMENT_RETRIES).then(_.bind(function (element) {
35474
35492
  if (!element) {
35475
35493
  this.automationQueue = [];
35476
35494
  pendoGlobal.log('automation target element not found. id: ' + automationConfig.id + ', pathRule: ' + automationConfig.target.elementPathRules, 'debug');
@@ -35495,8 +35513,8 @@ var ActionAutomation = (function () {
35495
35513
  this.automationQueue.shift();
35496
35514
  if (this.automationQueue.length)
35497
35515
  this.popQueue();
35498
- }.bind(this));
35499
- }.bind(this), waitTime);
35516
+ }, this));
35517
+ }, this), waitTime);
35500
35518
  }
35501
35519
  function guideActivity(event) {
35502
35520
  if (!event.step)
@@ -35629,7 +35647,7 @@ var EventProperties = (function () {
35629
35647
  function createClickEventProperties(eventPropertyHandler) {
35630
35648
  if (globalPendo.eventProperties && globalPendo.eventProperties.length) {
35631
35649
  var eventProps = createFeatureEventPropertyMap(eventPropertyHandler.target);
35632
- _.pairs(eventProps).forEach(function (_a) {
35650
+ globalPendo._.pairs(eventProps).forEach(function (_a) {
35633
35651
  var key = _a[0], value = _a[1];
35634
35652
  eventPropertyHandler.addEventProperty(key, value);
35635
35653
  });
@@ -35750,7 +35768,7 @@ var EventProperties = (function () {
35750
35768
  else {
35751
35769
  logMessage += '\n For page event with name: ' + ep.name;
35752
35770
  }
35753
- log.critical(logMessage);
35771
+ pluginAPI.log.critical(logMessage);
35754
35772
  // Once we fail to collect an eventProperty because of a pause we will not continue
35755
35773
  // to punish our customer's customer by letting it happen again
35756
35774
  // we have the log so we can investigate, no need to register a ton more while they
@@ -35856,6 +35874,10 @@ function startDebuggingModuleIfEnabled() {
35856
35874
  else {
35857
35875
  var script = document.createElement('script');
35858
35876
  script.src = getPolicy(pendo$1).createScriptURL(getAssetUrl('debugger-plugin.min.js'));
35877
+ script.setAttribute('id', 'pendo-debugger-plugin');
35878
+ if (ConfigReader.get('pendoGlobalKey')) {
35879
+ script.setAttribute('data-pendo-global-key', ConfigReader.get('pendoGlobalKey'));
35880
+ }
35859
35881
  dom.getBody().appendChild(script);
35860
35882
  }
35861
35883
  Events.debuggerLaunched.trigger();
@@ -36038,7 +36060,8 @@ var FrustrationEvent = (function () {
36038
36060
  'addErrorClickLog': addErrorClickLog,
36039
36061
  'getErrorEventTarget': getErrorEventTarget,
36040
36062
  'checkErrorEvent': checkErrorEvent,
36041
- 'observeDOMMutation': observeDOMMutation
36063
+ 'observeDOMMutation': observeDOMMutation,
36064
+ 'checkFrustrationEvent': checkFrustrationEvent
36042
36065
  };
36043
36066
  function init(pendo, PluginAPI) {
36044
36067
  pendoGlobal = pendo;
@@ -38008,7 +38031,8 @@ var TextCapture = (function () {
38008
38031
  'isEnabled': isEnabled,
38009
38032
  'isTextCapturable': isTextCapturable,
38010
38033
  'hasWhitelist': hasWhitelist,
38011
- 'serializer': textSerializer
38034
+ 'serializer': textSerializer,
38035
+ 'guideActivity': guideActivity
38012
38036
  };
38013
38037
  // technically not idempotent but might actually be right. not sure.
38014
38038
  function init(pendo, PluginAPI) {