@pendo/agent 2.308.1 → 2.309.1

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
@@ -7428,7 +7428,7 @@ function applyMatrix2dRect(matrix2d, rect) {
7428
7428
  return transformedRect;
7429
7429
  }
7430
7430
 
7431
- var VERSION = '2.308.1_';
7431
+ var VERSION = '2.309.1_';
7432
7432
 
7433
7433
  var decodeURIComponent = _.isFunction(window.decodeURIComponent) ? window.decodeURIComponent : _.identity;
7434
7434
 
@@ -7661,6 +7661,7 @@ var agentStorage = (function () {
7661
7661
  storage = window[type];
7662
7662
  var x = '__storage_test__';
7663
7663
  storage.setItem(x, x);
7664
+ storage.getItem(x);
7664
7665
  storage.removeItem(x);
7665
7666
  return true;
7666
7667
  }
@@ -7691,22 +7692,27 @@ var agentStorage = (function () {
7691
7692
  isPlain = registry.getKeyConfig(name, 'isPlain', isPlain);
7692
7693
  cookieSuffix = registry.getKeyConfig(name, 'cookieSuffix', cookieSuffix);
7693
7694
  var rawValue;
7695
+ var deserialize = registry.getKeyDeserializer(name);
7694
7696
  if (canUseLocalStorage()) {
7695
7697
  var key = !isPlain ? getPendoCookieKey(name, cookieSuffix) : name;
7696
- rawValue = ttlApply(localStorage.getItem(key));
7697
- if (rawValue === null) {
7698
- clear(name, isPlain, cookieSuffix);
7698
+ try {
7699
+ rawValue = ttlApply(localStorage.getItem(key));
7700
+ if (rawValue === null) {
7701
+ clear(name, isPlain, cookieSuffix);
7702
+ }
7703
+ return deserialize(rawValue);
7704
+ }
7705
+ catch (e) {
7706
+ resetCache(storageAvailable);
7699
7707
  }
7700
7708
  }
7709
+ if (!isPlain) {
7710
+ rawValue = get_pendo_cookie(name, cookieSuffix);
7711
+ }
7701
7712
  else {
7702
- if (!isPlain) {
7703
- rawValue = get_pendo_cookie(name, cookieSuffix);
7704
- }
7705
- else {
7706
- rawValue = getCookie(name);
7707
- }
7713
+ rawValue = getCookie(name);
7708
7714
  }
7709
- return registry.getKeyDeserializer(name)(rawValue);
7715
+ return deserialize(rawValue);
7710
7716
  }
7711
7717
  function ttlApply(value) {
7712
7718
  if (value === null)
@@ -3912,8 +3912,8 @@ let SERVER = '';
3912
3912
  let ASSET_HOST = '';
3913
3913
  let ASSET_PATH = '';
3914
3914
  let DESIGNER_SERVER = '';
3915
- let VERSION = '2.308.1_';
3916
- let PACKAGE_VERSION = '2.308.1';
3915
+ let VERSION = '2.309.1_';
3916
+ let PACKAGE_VERSION = '2.309.1';
3917
3917
  let LOADER = 'xhr';
3918
3918
  /* eslint-enable agent-eslint-rules/no-gulp-env-references */
3919
3919
  /**
@@ -4610,6 +4610,7 @@ var agentStorage = (function () {
4610
4610
  storage = window[type];
4611
4611
  var x = '__storage_test__';
4612
4612
  storage.setItem(x, x);
4613
+ storage.getItem(x);
4613
4614
  storage.removeItem(x);
4614
4615
  return true;
4615
4616
  }
@@ -4640,22 +4641,27 @@ var agentStorage = (function () {
4640
4641
  isPlain = registry.getKeyConfig(name, 'isPlain', isPlain);
4641
4642
  cookieSuffix = registry.getKeyConfig(name, 'cookieSuffix', cookieSuffix);
4642
4643
  let rawValue;
4644
+ const deserialize = registry.getKeyDeserializer(name);
4643
4645
  if (canUseLocalStorage()) {
4644
4646
  var key = !isPlain ? getPendoCookieKey(name, cookieSuffix) : name;
4645
- rawValue = ttlApply(localStorage.getItem(key));
4646
- if (rawValue === null) {
4647
- clear(name, isPlain, cookieSuffix);
4647
+ try {
4648
+ rawValue = ttlApply(localStorage.getItem(key));
4649
+ if (rawValue === null) {
4650
+ clear(name, isPlain, cookieSuffix);
4651
+ }
4652
+ return deserialize(rawValue);
4653
+ }
4654
+ catch (e) {
4655
+ resetCache(storageAvailable);
4648
4656
  }
4649
4657
  }
4658
+ if (!isPlain) {
4659
+ rawValue = get_pendo_cookie(name, cookieSuffix);
4660
+ }
4650
4661
  else {
4651
- if (!isPlain) {
4652
- rawValue = get_pendo_cookie(name, cookieSuffix);
4653
- }
4654
- else {
4655
- rawValue = getCookie(name);
4656
- }
4662
+ rawValue = getCookie(name);
4657
4663
  }
4658
- return registry.getKeyDeserializer(name)(rawValue);
4664
+ return deserialize(rawValue);
4659
4665
  }
4660
4666
  function ttlApply(value) {
4661
4667
  if (value === null)
@@ -14292,9 +14298,6 @@ var findBadgeForStep = function (step) {
14292
14298
  return badgeElement;
14293
14299
  };
14294
14300
  /*
14295
- * TODO: refactor this.
14296
- * override is really only used for steps with badges.
14297
- *
14298
14301
  * need a way to check: is original element visible.
14299
14302
  * if so, rendering is a go.
14300
14303
  * then
@@ -14306,15 +14309,19 @@ var getElementForGuideStep = function (step, doc) {
14306
14309
  log.info('Can\'t get element for null step');
14307
14310
  return null;
14308
14311
  }
14309
- var guide = step.getGuide();
14310
- var isBuildingBlockGuide = _.get(guide, 'attributes.type') === 'building-block';
14311
- var canSetOverrideElement = isBuildingBlockGuide || !isWalkthrough(guide);
14312
- if (!step.overrideElement && canSetOverrideElement) {
14313
- step.overrideElement = findBadgeForStep(step);
14312
+ const guide = step.getGuide();
14313
+ const isBuildingBlockGuide = _.get(guide, 'attributes.type') === 'building-block';
14314
+ const canSetOverrideElement = isBuildingBlockGuide || !isWalkthrough(guide);
14315
+ let badge = step.overrideElement;
14316
+ const isFirstStep = _.get(guide, 'steps.0.id') === step.id;
14317
+ if (!badge && canSetOverrideElement) {
14318
+ badge = findBadgeForStep(step);
14319
+ step.overrideElement = badge;
14314
14320
  }
14315
14321
  step.targetElement = getElementForTargeting(step, doc);
14316
- if (step.overrideElement) {
14317
- return step.overrideElement;
14322
+ const targetToBadge = badge || (isBadge(guide) && isFirstStep);
14323
+ if (targetToBadge) {
14324
+ return badge;
14318
14325
  }
14319
14326
  return step.targetElement;
14320
14327
  };
@@ -17487,7 +17494,11 @@ function recalculateGuideWidth(containerId, context) {
17487
17494
  // reset the margin-right while the code below determines if it should be applied.
17488
17495
  $guideContainer.css({ 'margin-right': '0px' });
17489
17496
  var computedWidth = parseInt(getComputedStyle_safe(guideContainer).width, 10);
17490
- var windowInnerWidth = getScreenDimensions().width;
17497
+ const body = dom.getBody();
17498
+ const screenDimensions = positionFixedActsLikePositionAbsolute(body)
17499
+ ? getClientRect(body)
17500
+ : getScreenDimensions();
17501
+ var windowInnerWidth = screenDimensions.width;
17491
17502
  var leftOffset = parseInt(guideContainer.style.left || 0, 10);
17492
17503
  var rightOffset = parseInt(guideContainer.style.right || 0, 10);
17493
17504
  // We need to respect any left or right offsets set by the user in VDS
@@ -30926,6 +30937,19 @@ function exportPublicApi(pendo) {
30926
30937
  pendo.guideContent = exportPendoCoreOnly(ContentLoader.guideContent);
30927
30938
  pendo.receiveDomStructureJson = exportPendoCoreOnly(ContentLoader.receiveDomStructureJson);
30928
30939
  pendo.addExtension = addExtension;
30940
+ /**
30941
+ * Retrieve a configuration value from the web sdk's config. Available configuration keys can be
30942
+ * found in the [configuration section](/config).
30943
+ *
30944
+ * @access public
30945
+ * @name getConfigValue
30946
+ * @category Core
30947
+ * @param {string} key The configuration key to retrieve.
30948
+ * @returns {*} The configuration value.
30949
+ * @example
30950
+ * pendo.getConfigValue('excludeAllText') => false
30951
+ */
30952
+ pendo.getConfigValue = ConfigReader.get;
30929
30953
  }
30930
30954
 
30931
30955
  var IS_GOING_AWAY = 'is going away';
@@ -34616,7 +34640,7 @@ const IFrameMonitor = (function () {
34616
34640
  (frame.document.head || frame.document.body).appendChild(script);
34617
34641
  }
34618
34642
  }
34619
- function handleContentLoaded(frame, agentUrl) {
34643
+ function handleLoaded(frame, agentUrl) {
34620
34644
  frame.pendo.iframeWaiting = false;
34621
34645
  appendScriptTagToFrame(frame, agentUrl);
34622
34646
  }
@@ -34638,7 +34662,7 @@ const IFrameMonitor = (function () {
34638
34662
  }
34639
34663
  else {
34640
34664
  frame.pendo = { iframeWaiting: true }; // Add empty pendo object just so we don't try to add pendo to the frame twice while we wait
34641
- frame.document.addEventListener('DOMContentLoaded', pendoGlobal._.partial(handleContentLoaded, frame, agentUrl));
34665
+ frame.addEventListener('load', pendoGlobal._.partial(handleLoaded, frame, agentUrl));
34642
34666
  }
34643
34667
  }
34644
34668
  function checkForFrames() {