@pendo/agent 2.341.0 → 2.342.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.
package/dist/dom.esm.js CHANGED
@@ -7291,6 +7291,17 @@ function shouldWrapHashChange() {
7291
7291
  function isMobileUserAgent() {
7292
7292
  return (/Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i).test(getUA());
7293
7293
  }
7294
+ // WICG inert polyfills through 3.1.0 install their MutationObserver-driven manager even where
7295
+ // the browser supports inert natively, and inject #inert-style when they do. With one active,
7296
+ // inerting a large subtree costs a full tree walk plus a subtree observer for as long as the
7297
+ // attribute stays, so treat the page as not supporting inert.
7298
+ function supportsInert() {
7299
+ var descriptor = window.HTMLElement && _.isFunction(Object.getOwnPropertyDescriptor) &&
7300
+ Object.getOwnPropertyDescriptor(window.HTMLElement.prototype, 'inert');
7301
+ var isNative = !!(descriptor && descriptor.get && isNativeCode(descriptor.get));
7302
+ var isPolyfilled = !!document.getElementById('inert-style');
7303
+ return isNative && !isPolyfilled;
7304
+ }
7294
7305
  function isSafari(userAgent) {
7295
7306
  if (userAgent === void 0) { userAgent = getUA(); }
7296
7307
  return userAgent.indexOf('Safari') >= 0 && !isChromium(userAgent);
@@ -7305,6 +7316,7 @@ function isChromium(userAgent) {
7305
7316
  var sniffer = {
7306
7317
  supportsHistoryApi: shouldWrapNativeHistory,
7307
7318
  supportsHashChange: shouldWrapHashChange,
7319
+ supportsInert: supportsInert,
7308
7320
  hasEvent: function (event) {
7309
7321
  // IE9 implements 'input' event it's so fubared that we rather pretend that it doesn't have
7310
7322
  // it. In particular the event is not fired when backspace or delete key are pressed or
@@ -7529,7 +7541,7 @@ function applyMatrix2dRect(matrix2d, rect) {
7529
7541
  return transformedRect;
7530
7542
  }
7531
7543
 
7532
- var VERSION = '2.341.0_';
7544
+ var VERSION = '2.342.0_';
7533
7545
 
7534
7546
  var decodeURIComponent = _.isFunction(globalScope.decodeURIComponent) ? globalScope.decodeURIComponent : _.identity;
7535
7547
 
@@ -3926,6 +3926,17 @@ function shouldWrapHashChange() {
3926
3926
  function isMobileUserAgent() {
3927
3927
  return (/Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i).test(getUA());
3928
3928
  }
3929
+ // WICG inert polyfills through 3.1.0 install their MutationObserver-driven manager even where
3930
+ // the browser supports inert natively, and inject #inert-style when they do. With one active,
3931
+ // inerting a large subtree costs a full tree walk plus a subtree observer for as long as the
3932
+ // attribute stays, so treat the page as not supporting inert.
3933
+ function supportsInert() {
3934
+ const descriptor = window.HTMLElement && _.isFunction(Object.getOwnPropertyDescriptor) &&
3935
+ Object.getOwnPropertyDescriptor(window.HTMLElement.prototype, 'inert');
3936
+ const isNative = !!(descriptor && descriptor.get && isNativeCode(descriptor.get));
3937
+ const isPolyfilled = !!document.getElementById('inert-style');
3938
+ return isNative && !isPolyfilled;
3939
+ }
3929
3940
  function isSafari(userAgent = getUA()) {
3930
3941
  return userAgent.indexOf('Safari') >= 0 && !isChromium(userAgent);
3931
3942
  }
@@ -3938,6 +3949,7 @@ function isChromium(userAgent = getUA()) {
3938
3949
  const sniffer = {
3939
3950
  supportsHistoryApi: shouldWrapNativeHistory,
3940
3951
  supportsHashChange: shouldWrapHashChange,
3952
+ supportsInert,
3941
3953
  hasEvent(event) {
3942
3954
  // IE9 implements 'input' event it's so fubared that we rather pretend that it doesn't have
3943
3955
  // it. In particular the event is not fired when backspace or delete key are pressed or
@@ -4046,8 +4058,8 @@ let SERVER = '';
4046
4058
  let ASSET_HOST = '';
4047
4059
  let ASSET_PATH = '';
4048
4060
  let DESIGNER_SERVER = '';
4049
- let VERSION = '2.341.0_';
4050
- let PACKAGE_VERSION = '2.341.0';
4061
+ let VERSION = '2.342.0_';
4062
+ let PACKAGE_VERSION = '2.342.0';
4051
4063
  let LOADER = 'xhr';
4052
4064
  /* eslint-enable web-sdk-eslint-rules/no-gulp-env-references */
4053
4065
  /**
@@ -14353,9 +14365,13 @@ function getPendoCdnHost() {
14353
14365
  return stripScheme(ASSET_HOST);
14354
14366
  return serverHost.replace(appLabel, '$1cdn.');
14355
14367
  }
14356
- // NOTE: this previously was *only* checking the snippet provided config for contentHost
14368
+ // A contentHost set up as a CNAME in app settings is delivered in the hosted config, while a
14369
+ // snippet value is the customer's own override of it. Same precedence getDataHost uses.
14370
+ function getConfiguredContentHost() {
14371
+ return ConfigReader.getLocalConfig('contentHost') || ConfigReader.getHostedConfig('contentHost');
14372
+ }
14357
14373
  function replaceWithContentHost(str) {
14358
- var contentHost = ConfigReader.getLocalConfig('contentHost');
14374
+ var contentHost = getConfiguredContentHost();
14359
14375
  if (!contentHost || !str)
14360
14376
  return str;
14361
14377
  contentHost = normalizeContentHost(contentHost);
@@ -14380,7 +14396,7 @@ function replaceWithContentHost(str) {
14380
14396
  }, str);
14381
14397
  }
14382
14398
  function replaceObjectWithContentHost(obj) {
14383
- var contentHost = ConfigReader.getLocalConfig('contentHost');
14399
+ var contentHost = getConfiguredContentHost();
14384
14400
  if (!contentHost)
14385
14401
  return obj;
14386
14402
  return JSON.parse(replaceWithContentHost(JSON.stringify(obj)));
@@ -22031,7 +22047,9 @@ Badge.behaviors = [
22031
22047
  function InlinePosition() {
22032
22048
  function getShadowDomAdjustedTarget(target) {
22033
22049
  try {
22034
- if (target.shadowRoot && !target.shadowRoot.querySelector('slot')) {
22050
+ // Only a default (unnamed) slot can render a badge appended as a light-DOM
22051
+ // child, so fall back to the shadow root when there isn't one
22052
+ if (target.shadowRoot && !target.shadowRoot.querySelector('slot:not([name])')) {
22035
22053
  return target.shadowRoot;
22036
22054
  }
22037
22055
  }
@@ -22052,7 +22070,7 @@ function InlinePosition() {
22052
22070
  if (targetElem && targetElem.tagName) {
22053
22071
  var tagName = targetElem.tagName.toLowerCase();
22054
22072
  var shadowDomAdjustedTarget = getShadowDomAdjustedTarget(targetElem);
22055
- if (/br|input|img|select|textarea/.test(tagName)) {
22073
+ if (/^(?:br|input|img|select|textarea)$/.test(tagName)) {
22056
22074
  if (badgeElem.parentNode === targetElem.parentNode)
22057
22075
  return;
22058
22076
  // Insert after if targetElem cannot have children
@@ -23590,16 +23608,23 @@ function backdropInertRuntimeScript(step, guide, pendo) {
23590
23608
  return;
23591
23609
  if (step.hasBackdrop) {
23592
23610
  const BuildingBlockGuides = pendo.BuildingBlocks.BuildingBlockGuides;
23593
- const excludeElements = getTargetAreaElementsForBlockOut(step);
23594
- // The preview bar iframe is a sibling of the guide under <body>; inerting it
23595
- // would make preview mode's controls unclickable while the backdrop shows.
23596
- const previewBar = document.getElementById('pendo-preview');
23597
- if (previewBar) {
23598
- excludeElements.push(previewBar);
23599
- }
23600
- const inertElements = BuildingBlockGuides.addInertOutsideGuide(step.guideElement[0], [], excludeElements);
23601
- step.hiddenElements = (step.hiddenElements || []).concat(inertElements);
23611
+ const guideElement = step.guideElement[0];
23612
+ const excludeElements = getExcludedElements(step);
23613
+ const disabledElements = sniffer.supportsInert()
23614
+ ? BuildingBlockGuides.addInertOutsideGuide(guideElement, [], excludeElements)
23615
+ : BuildingBlockGuides.addAriaHiddenOutsideGuide(guideElement, [], excludeElements);
23616
+ step.hiddenElements = (step.hiddenElements || []).concat(disabledElements);
23617
+ }
23618
+ }
23619
+ function getExcludedElements(step) {
23620
+ const excludeElements = getTargetAreaElementsForBlockOut(step);
23621
+ // The preview bar iframe is a sibling of the guide under <body>; inerting it
23622
+ // would make preview mode's controls unclickable while the backdrop shows.
23623
+ const previewBar = document.getElementById('pendo-preview');
23624
+ if (previewBar) {
23625
+ excludeElements.push(previewBar);
23602
23626
  }
23627
+ return excludeElements;
23603
23628
  }
23604
23629
  var backdropInertStep = {
23605
23630
  script: backdropInertRuntimeScript
@@ -30932,21 +30957,26 @@ var BuildingBlockGuides = (function () {
30932
30957
  domElem.append(endFocusBumper);
30933
30958
  return [startFocusBumper, endFocusBumper];
30934
30959
  }
30935
- function addAriaHiddenOutsideGuide(elem, hidden = []) {
30960
+ // native contains() can't see into shadow trees, so excluded elements inside a
30961
+ // shadow root (e.g. blockOut target areas) need the shadow-aware walk
30962
+ function containsExcludedElement(elem, excludeElements) {
30963
+ return _.some(excludeElements, (excluded) => excluded && (elem === excluded || contains(elem, excluded)));
30964
+ }
30965
+ function addAriaHiddenOutsideGuide(elem, hidden = [], excludeElements = []) {
30936
30966
  if (!elem || elem === getBody())
30937
30967
  return hidden;
30938
30968
  const siblings = getSiblings(elem);
30939
30969
  _.each(siblings, (s) => {
30940
- if (hidden.indexOf(s) === -1 && s.getAttribute('aria-hidden') !== 'true') {
30941
- const tagName = s.tagName.toLowerCase();
30942
- if (tagName !== 'script' && tagName !== 'style') {
30943
- s.setAttribute('aria-hidden', 'true');
30944
- hidden.push(s);
30945
- }
30970
+ const tagName = s.tagName.toLowerCase();
30971
+ const alreadyHidden = s.getAttribute('aria-hidden') === 'true';
30972
+ const isExcluded = containsExcludedElement(s, excludeElements);
30973
+ if (hidden.indexOf(s) === -1 && !alreadyHidden && !isExcluded && tagName !== 'script' && tagName !== 'style') {
30974
+ s.setAttribute('aria-hidden', 'true');
30975
+ hidden.push(s);
30946
30976
  }
30947
30977
  });
30948
30978
  if (elem.parentNode) {
30949
- addAriaHiddenOutsideGuide(elem.parentNode, hidden);
30979
+ addAriaHiddenOutsideGuide(elem.parentNode, hidden, excludeElements);
30950
30980
  }
30951
30981
  return hidden;
30952
30982
  }
@@ -30960,9 +30990,7 @@ var BuildingBlockGuides = (function () {
30960
30990
  _.each(siblings, (s) => {
30961
30991
  const tagName = s.tagName.toLowerCase();
30962
30992
  const alreadyDisabled = s.getAttribute('inert') === 'true';
30963
- // native contains() can't see into shadow trees, so excluded elements inside a
30964
- // shadow root (e.g. blockOut target areas) need the shadow-aware walk
30965
- const isExcluded = _.some(excludeElements, (excluded) => excluded && (s === excluded || contains(s, excluded)));
30993
+ const isExcluded = containsExcludedElement(s, excludeElements);
30966
30994
  if (hidden.indexOf(s) === -1 && !alreadyDisabled && !isExcluded && tagName !== 'script' && tagName !== 'style') {
30967
30995
  s.setAttribute('inert', 'true');
30968
30996
  hidden.push(s);