@pendo/agent 2.333.1 → 2.334.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.
@@ -3407,6 +3407,7 @@ var ConfigReader = (function () {
3407
3407
  * @type {boolean}
3408
3408
  */
3409
3409
  addOption('disableGuidePseudoStyles', [SNIPPET_SRC, PENDO_CONFIG_SRC], false);
3410
+ addOption('disableImportantStyleAttributes', [SNIPPET_SRC, PENDO_CONFIG_SRC], false);
3410
3411
  /**
3411
3412
  * Content of badge and target element activated guides will be prefetched on load to improve guide display
3412
3413
  * time unless set to `true`.
@@ -4028,8 +4029,8 @@ let SERVER = '';
4028
4029
  let ASSET_HOST = '';
4029
4030
  let ASSET_PATH = '';
4030
4031
  let DESIGNER_SERVER = '';
4031
- let VERSION = '2.333.1_';
4032
- let PACKAGE_VERSION = '2.333.1';
4032
+ let VERSION = '2.334.0_';
4033
+ let PACKAGE_VERSION = '2.334.0';
4033
4034
  let LOADER = 'xhr';
4034
4035
  /* eslint-enable web-sdk-eslint-rules/no-gulp-env-references */
4035
4036
  /**
@@ -10392,8 +10393,13 @@ var setStyles = function (element, style) {
10392
10393
  var importantIndex = value.indexOf('!important');
10393
10394
  if (importantIndex !== -1) {
10394
10395
  try {
10395
- var propertyValue = trim.call(propertyValue.substring(0, importantIndex));
10396
- element.style.setProperty(key, propertyValue, 'important');
10396
+ var propertyValue = trim.call(value.substring(0, importantIndex));
10397
+ if (ConfigReader.get('disableImportantStyleAttributes')) {
10398
+ element.style.setProperty(key, propertyValue);
10399
+ }
10400
+ else {
10401
+ element.style.setProperty(key, propertyValue, 'important');
10402
+ }
10397
10403
  return;
10398
10404
  }
10399
10405
  catch (e) { // Fallback for <=IE8
@@ -11781,12 +11787,12 @@ function isTrustedOrigin(host) {
11781
11787
  return true;
11782
11788
  // Domains that Pendo owns, will be swapped in by build patches
11783
11789
  const patterns = [
11784
- /^https:\/\/(adopt\.)?((us1)\.)?(app|via|adopt|cdn|oem|novus-api|novus)(\.(au|eu|gov|hsbc|jpn))?\.pendo\.io$/,
11785
- /^https:\/\/([0-9]{8}t[0-9]{4}-dot-)(pendo-au|pendo-eu|pendo-govramp|pendo-hsbc|pendo-io|pendo-jp-prod|pendo-us1)\.appspot\.com$/,
11786
- /^https:\/\/hotfix-(ops|app)-([0-9]+-dot-)(pendo-au|pendo-eu|pendo-govramp|pendo-hsbc|pendo-io|pendo-jp-prod|pendo-us1)\.appspot\.com$/,
11787
- /^https:\/\/(pendo-au|pendo-eu|pendo-govramp|pendo-hsbc|pendo-io|pendo-jp-prod|pendo-us1)-static\.storage\.googleapis\.com$/,
11790
+ /^https:\/\/(adopt\.)?((us1)\.)?(app|via|adopt|cdn|oem|novus-api|novus)(\.(au|eu|gov|hsbc|jpn|tv))?\.pendo\.io$/,
11791
+ /^https:\/\/([0-9]{8}t[0-9]{4}-dot-)(pendo-au|pendo-eu|pendo-govramp|pendo-hsbc|pendo-io|pendo-jp-prod|pendo-tv|pendo-us1)\.appspot\.com$/,
11792
+ /^https:\/\/hotfix-(ops|app)-([0-9]+-dot-)(pendo-au|pendo-eu|pendo-govramp|pendo-hsbc|pendo-io|pendo-jp-prod|pendo-tv|pendo-us1)\.appspot\.com$/,
11793
+ /^https:\/\/(pendo-au|pendo-eu|pendo-govramp|pendo-hsbc|pendo-io|pendo-jp-prod|pendo-tv|pendo-us1)-static\.storage\.googleapis\.com$/,
11788
11794
  /^https:\/\/([a-zA-Z0-9-]+\.)*pendo-dev\.com$/,
11789
- /^https:\/\/([a-zA-Z0-9-]+-dot-)?(pendo-apollo|pendo-armada|pendo-atlas|pendo-batman|pendo-calypso|pendo-dap|pendo-dev|pendo-dr-us-east1|pendo-eu-dev|pendo-freeze|pendo-helix|pendo-link|pendo-magic|pendo-mango|pendo-mcfly|pendo-ml|pendo-mobile-fbi|pendo-mobile-guides|pendo-mobile-hummus|pendo-mobile-plat|pendo-perfserf|pendo-voc|pendo-wildlings|pendo-ionchef|pendo-scrum-ops|pendo-security|pendo-test|pendo-uat|pendo-au|pendo-eu|pendo-govramp|pendo-hsbc|pendo-io|pendo-jp-prod|pendo-us1)\.appspot\.com$/,
11795
+ /^https:\/\/([a-zA-Z0-9-]+-dot-)?(pendo-apollo|pendo-armada|pendo-atlas|pendo-batman|pendo-calypso|pendo-dap|pendo-dev|pendo-dr-us-east1|pendo-eu-dev|pendo-freeze|pendo-helix|pendo-link|pendo-magic|pendo-mango|pendo-mcfly|pendo-ml|pendo-mobile-fbi|pendo-mobile-guides|pendo-mobile-hummus|pendo-mobile-plat|pendo-perfserf|pendo-voc|pendo-wildlings|pendo-ionchef|pendo-scrum-ops|pendo-security|pendo-test|pendo-uat|pendo-au|pendo-eu|pendo-govramp|pendo-hsbc|pendo-io|pendo-jp-prod|pendo-tv|pendo-us1)\.appspot\.com$/,
11790
11796
  /^https:\/\/(via|adopt|local)\.pendo\.(local|io):\d{4}$/,
11791
11797
  /^https:\/\/(pendo-apollo|pendo-armada|pendo-atlas|pendo-batman|pendo-calypso|pendo-dap|pendo-dev|pendo-dr-us-east1|pendo-eu-dev|pendo-freeze|pendo-helix|pendo-link|pendo-magic|pendo-mango|pendo-mcfly|pendo-ml|pendo-mobile-fbi|pendo-mobile-guides|pendo-mobile-hummus|pendo-mobile-plat|pendo-perfserf|pendo-voc|pendo-wildlings|pendo-ionchef|pendo-scrum-ops|pendo-security|pendo-test|pendo-uat)-static\.storage\.googleapis\.com$/
11792
11798
  ]; // eslint-disable-line web-sdk-eslint-rules/no-gulp-env-references
@@ -17949,6 +17955,7 @@ function buildNodeFromJSON(json, step, guides) {
17949
17955
  var id = json.props && json.props.id;
17950
17956
  // This builds the 4pc backdrop to allow block clicking for any guide without changing how the backdrop is saved
17951
17957
  if (id === 'pendo-backdrop') {
17958
+ step.hasBackdrop = true;
17952
17959
  return buildBackdrop(step);
17953
17960
  }
17954
17961
  _.each(json.props, function (propValue, propKey) {
@@ -23234,6 +23241,20 @@ var autofocusStep = {
23234
23241
  script: autofocusRuntimeScript
23235
23242
  };
23236
23243
 
23244
+ function backdropInertRuntimeScript(step, guide, pendo) {
23245
+ if (pendo.designer || !step.guideElement)
23246
+ return;
23247
+ if (step.hasBackdrop) {
23248
+ const BuildingBlockGuides = pendo.BuildingBlocks.BuildingBlockGuides;
23249
+ const excludeElements = getTargetAreaElementsForBlockOut(step);
23250
+ const inertElements = BuildingBlockGuides.addInertOutsideGuide(step.guideElement[0], [], excludeElements);
23251
+ step.hiddenElements = (step.hiddenElements || []).concat(inertElements);
23252
+ }
23253
+ }
23254
+ var backdropInertStep = {
23255
+ script: backdropInertRuntimeScript
23256
+ };
23257
+
23237
23258
  function isTooltip({ _ }, step) {
23238
23259
  const tooltip = 'tooltip';
23239
23260
  return _.get(step, 'attributes.calculatedType') === tooltip ||
@@ -23391,6 +23412,7 @@ function registerPostrenderScripts(runtime) {
23391
23412
  advanceOnElement,
23392
23413
  announcementMarkSeen,
23393
23414
  autofocusStep,
23415
+ backdropInertStep,
23394
23416
  repositionOnScroll,
23395
23417
  setFocusToActivationElement$1,
23396
23418
  videoLoadingAttribute
@@ -24647,7 +24669,8 @@ var loadGuides = function (apiKey, visitorId, page, callback) {
24647
24669
  visitorId,
24648
24670
  accountId: get_account_id(),
24649
24671
  url: page,
24650
- oldVisitorId: get_old_visitor_id()
24672
+ oldVisitorId: get_old_visitor_id(),
24673
+ timezoneOffset: (new Date()).getTimezoneOffset()
24651
24674
  };
24652
24675
  const reqId = _.uniqueId();
24653
24676
  loadGuides.reqId = reqId;
@@ -29560,6 +29583,7 @@ var BuildingBlockGuides = (function () {
29560
29583
  trapFocusStep,
29561
29584
  attachRCFocusHandlers,
29562
29585
  addAriaHiddenOutsideGuide,
29586
+ addInertOutsideGuide,
29563
29587
  renderResourceCenterModule: BuildingBlockResourceCenter.renderResourceCenterModule,
29564
29588
  buildNodeFromJSON,
29565
29589
  attachImgLoadHandlers,
@@ -29627,6 +29651,7 @@ var BuildingBlockGuides = (function () {
29627
29651
  }
29628
29652
  var isAnnouncementModule = _.get(guide, 'attributes.resourceCenter.moduleId') === 'AnnouncementsModule';
29629
29653
  step.hasEscapeListener = false;
29654
+ step.hasBackdrop = false;
29630
29655
  step.containerId = containerJSON && containerJSON.props && containerJSON.props.id;
29631
29656
  step.element = getElementForGuideStep(step, options.document);
29632
29657
  var modifiableJSON = unwrapFirefoxObject(json);
@@ -29929,7 +29954,7 @@ var BuildingBlockGuides = (function () {
29929
29954
  function trapFocusStep(step, guideContainer) {
29930
29955
  var guideContainerElement = guideContainer.find('#pendo-guide-container');
29931
29956
  var targetElement = _.get(step, 'attributes.blockOutUI.enabled') && getTargetElementForStep(step);
29932
- trapFocus(guideContainerElement, targetElement);
29957
+ trapFocus(guideContainerElement, targetElement, step);
29933
29958
  }
29934
29959
  function getSelectedPollElementForFocus(focusableChildren, bumperElement) {
29935
29960
  let elementToFocus;
@@ -29942,41 +29967,71 @@ var BuildingBlockGuides = (function () {
29942
29967
  }
29943
29968
  return elementToFocus || bumperElement;
29944
29969
  }
29970
+ function isTabbable(element) {
29971
+ if (!isElementVisible(element))
29972
+ return false;
29973
+ if (element.tagName === 'IFRAME')
29974
+ return true;
29975
+ if (element.tabIndex >= 0 && !element.disabled)
29976
+ return true;
29977
+ var editable = element.getAttribute && element.getAttribute('contenteditable');
29978
+ return editable != null && editable !== 'false';
29979
+ }
29945
29980
  function collectTargetFocusables(targetElement) {
29946
29981
  if (!targetElement)
29947
29982
  return [];
29948
- var focusables = _.toArray(targetElement.querySelectorAll(FOCUSABLE_SELECTORS));
29949
- if (targetElement.matches(FOCUSABLE_SELECTORS)) {
29950
- focusables.unshift(targetElement);
29951
- }
29983
+ var focusables = [];
29984
+ var collect = function (node) {
29985
+ if (node.nodeType === 1 && isTabbable(node)) {
29986
+ focusables.push(node);
29987
+ }
29988
+ if (node.shadowRoot) {
29989
+ _.each(node.shadowRoot.children, collect);
29990
+ }
29991
+ _.each(node.children, collect);
29992
+ };
29993
+ collect(targetElement);
29952
29994
  return focusables;
29953
29995
  }
29954
- function createTargetBumper(className) {
29955
- var bumper = document.createElement('div');
29956
- bumper.setAttribute('tabIndex', 0);
29957
- bumper.setAttribute('class', className);
29958
- bumper.setAttribute('aria-hidden', 'true');
29959
- bumper.style.cssText = 'position:absolute !important;width:0 !important;height:0 !important;overflow:hidden !important;outline:none !important;border:none !important;padding:0 !important;margin:0 !important;';
29960
- return bumper;
29996
+ function getDeepActiveElement() {
29997
+ var active = document.activeElement;
29998
+ while (active && active.shadowRoot && active.shadowRoot.activeElement) {
29999
+ active = active.shadowRoot.activeElement;
30000
+ }
30001
+ return active;
29961
30002
  }
29962
- function insertTargetBumpers(targetElement) {
29963
- if (!targetElement || !targetElement.parentNode)
29964
- return null;
29965
- var before = createTargetBumper('pendo-before-target-focus-bumper');
29966
- var after = createTargetBumper('pendo-after-target-focus-bumper');
29967
- targetElement.parentNode.insertBefore(before, targetElement);
29968
- targetElement.parentNode.insertBefore(after, targetElement.nextSibling);
29969
- return { before, after };
30003
+ function isWithinComposedTree(root, element) {
30004
+ if (!root || !element)
30005
+ return false;
30006
+ var node = element;
30007
+ while (node) {
30008
+ if (node.nodeType === 1 && root.contains(node))
30009
+ return true;
30010
+ var rootNode = dom.getRootNode(node);
30011
+ node = rootNode && rootNode.host;
30012
+ }
30013
+ return false;
29970
30014
  }
29971
- function removeTargetBumpers(targetBumpers) {
29972
- if (!targetBumpers)
29973
- return;
29974
- _.each([targetBumpers.before, targetBumpers.after], function (bumper) {
29975
- if (bumper && bumper.parentNode)
29976
- bumper.parentNode.removeChild(bumper);
30015
+ function isWithinAdditionalBlockOutAreas(element, step) {
30016
+ var selectors = _.get(step, 'attributes.blockOutUI.additionalElements');
30017
+ if (!_.isString(selectors) || !selectors.length)
30018
+ return false;
30019
+ return _.some(selectors.replace(/\s/g, '').split(','), function (selector) {
30020
+ if (!selector)
30021
+ return false;
30022
+ var areas;
30023
+ try {
30024
+ areas = dom(selector);
30025
+ }
30026
+ catch (e) {
30027
+ return false;
30028
+ }
30029
+ return _.some(areas, function (area) {
30030
+ return isWithinComposedTree(area, element);
30031
+ });
29977
30032
  });
29978
30033
  }
29979
- function trapFocus(guideContainerElement, targetElement) {
30034
+ function trapFocus(guideContainerElement, targetElement, step) {
29980
30035
  var containerNode = guideContainerElement[0];
29981
30036
  if (!containerNode) {
29982
30037
  return;
@@ -30007,18 +30062,16 @@ var BuildingBlockGuides = (function () {
30007
30062
  var bumpers = insertTrapFocusBumpers(guideContainerElement);
30008
30063
  var startFocusBumper = bumpers[0];
30009
30064
  var endFocusBumper = bumpers[1];
30010
- var targetFocusables = collectTargetFocusables(targetElement);
30011
- var firstTargetFocusable = targetFocusables[0];
30012
- var lastTargetFocusable = targetFocusables[targetFocusables.length - 1];
30013
- // Insert bumpers as siblings of the target so we can catch focus crossings even when focus moves through a
30014
- // cross-origin iframe inside the target (our keydown listener can't see events inside the iframe, but it can
30015
- // see focus landing on a bumper in the parent document afterwards).
30016
- var targetBumpers = targetFocusables.length ? insertTargetBumpers(targetElement) : null;
30017
- var beforeTargetBumper = targetBumpers && targetBumpers.before;
30018
- var afterTargetBumper = targetBumpers && targetBumpers.after;
30019
- var targetRoot = targetElement && dom.getRootNode(targetElement);
30020
- var wrapForward = firstTargetFocusable || firstFocusableEl;
30021
- var wrapBackward = lastTargetFocusable || lastFocusableEl;
30065
+ var isOutsideTrap = function (element) {
30066
+ var guideRoot = step && step.guideElement && step.guideElement[0];
30067
+ return !!element &&
30068
+ element !== document.body &&
30069
+ element !== document.documentElement &&
30070
+ !containerNode.contains(element) &&
30071
+ !(guideRoot && isWithinComposedTree(guideRoot, element)) &&
30072
+ !isWithinComposedTree(targetElement, element) &&
30073
+ !isWithinAdditionalBlockOutAreas(element, step);
30074
+ };
30022
30075
  var trapFocusCallback = function (e) {
30023
30076
  if (!isTabEvent(e)) {
30024
30077
  return;
@@ -30031,34 +30084,31 @@ var BuildingBlockGuides = (function () {
30031
30084
  const bodyActive = document.activeElement === document.body; // if the guide is in a shadow root but you click on the backdrop, the active element is the body of the main document
30032
30085
  const startBumperActive = activeElement === startFocusBumper;
30033
30086
  const endBumperActive = activeElement === endFocusBumper;
30034
- const targetActiveElement = targetRoot && targetRoot.activeElement;
30035
- const beforeTargetBumperActive = !!beforeTargetBumper && targetActiveElement === beforeTargetBumper;
30036
- const afterTargetBumperActive = !!afterTargetBumper && targetActiveElement === afterTargetBumper;
30037
- const onLastTargetFocusable = isKeydown && !!lastTargetFocusable && targetActiveElement === lastTargetFocusable;
30038
- const onFirstTargetFocusable = isKeydown && !!firstTargetFocusable && targetActiveElement === firstTargetFocusable;
30087
+ const deepActive = getDeepActiveElement();
30088
+ const targetFocusables = collectTargetFocusables(targetElement);
30089
+ const activeTargetIndex = deepActive ? targetFocusables.indexOf(deepActive) : -1;
30090
+ const onLastTargetFocusable = isKeydown && activeTargetIndex !== -1 &&
30091
+ activeTargetIndex === targetFocusables.length - 1;
30092
+ const onFirstTargetFocusable = isKeydown && activeTargetIndex === 0;
30039
30093
  let elementToFocus;
30040
30094
  if (isShiftPressed) {
30041
30095
  if (onFirstTargetFocusable)
30042
30096
  elementToFocus = lastFocusableEl;
30043
- else if (beforeTargetBumperActive)
30044
- elementToFocus = lastFocusableEl;
30045
- else if (afterTargetBumperActive)
30046
- elementToFocus = lastTargetFocusable;
30047
- else if (startBumperActive || containerActive || bodyActive)
30048
- elementToFocus = wrapBackward;
30097
+ else if (startBumperActive || containerActive || bodyActive) {
30098
+ elementToFocus = targetFocusables[targetFocusables.length - 1] || lastFocusableEl;
30099
+ }
30049
30100
  }
30050
30101
  else {
30051
30102
  if (onLastTargetFocusable)
30052
30103
  elementToFocus = firstFocusableEl;
30053
- else if (afterTargetBumperActive)
30054
- elementToFocus = firstFocusableEl;
30055
- else if (beforeTargetBumperActive)
30056
- elementToFocus = firstTargetFocusable;
30057
30104
  else if (endBumperActive)
30058
- elementToFocus = wrapForward;
30105
+ elementToFocus = targetFocusables[0] || firstFocusableEl;
30059
30106
  else if (containerActive || bodyActive)
30060
30107
  elementToFocus = firstFocusableEl;
30061
30108
  }
30109
+ if (!elementToFocus && targetFocusables.length && isOutsideTrap(deepActive)) {
30110
+ elementToFocus = isShiftPressed ? lastFocusableEl : firstFocusableEl;
30111
+ }
30062
30112
  if (elementToFocus) {
30063
30113
  const resolved = getSelectedPollElementForFocus(focusableChildren, elementToFocus);
30064
30114
  resolved.focus();
@@ -30068,13 +30118,23 @@ var BuildingBlockGuides = (function () {
30068
30118
  e.preventDefault();
30069
30119
  }
30070
30120
  };
30071
- // attaching to both events helps some edge cases such as breakout by long-pressing the tab
30121
+ var iframeExitCallback = function (e) {
30122
+ var fromTargetIframe = e.relatedTarget && e.relatedTarget.tagName === 'IFRAME' &&
30123
+ isWithinComposedTree(targetElement, e.relatedTarget);
30124
+ if (!fromTargetIframe || !isOutsideTrap(e.target))
30125
+ return;
30126
+ var exitedForward = !!(e.relatedTarget.compareDocumentPosition(e.target) & Node.DOCUMENT_POSITION_FOLLOWING);
30127
+ (exitedForward ? firstFocusableEl : lastFocusableEl).focus();
30128
+ };
30072
30129
  attachEvent(document, 'keyup', trapFocusCallback);
30073
30130
  attachEvent(document, 'keydown', trapFocusCallback);
30131
+ if (targetElement) {
30132
+ attachEvent(document, 'focusin', iframeExitCallback);
30133
+ }
30074
30134
  Events.one('unmounted', () => {
30075
30135
  detachEvent(document, 'keyup', trapFocusCallback);
30076
30136
  detachEvent(document, 'keydown', trapFocusCallback);
30077
- removeTargetBumpers(targetBumpers);
30137
+ detachEvent(document, 'focusin', iframeExitCallback);
30078
30138
  });
30079
30139
  }
30080
30140
  // bumpers are divs with a tabindex to allow them to be focused, but which should immediately
@@ -30163,6 +30223,27 @@ var BuildingBlockGuides = (function () {
30163
30223
  }
30164
30224
  return hidden;
30165
30225
  }
30226
+ function addInertOutsideGuide(elem, hidden = [], excludeElements = []) {
30227
+ if (!elem || elem === getBody())
30228
+ return hidden;
30229
+ const supportsInert = isNaN(msie);
30230
+ if (!supportsInert)
30231
+ return hidden;
30232
+ const siblings = getSiblings(elem);
30233
+ _.each(siblings, (s) => {
30234
+ const tagName = s.tagName.toLowerCase();
30235
+ const alreadyDisabled = s.getAttribute('inert') === 'true';
30236
+ const isExcluded = _.some(excludeElements, (excluded) => excluded && (s === excluded || s.contains(excluded)));
30237
+ if (hidden.indexOf(s) === -1 && !alreadyDisabled && !isExcluded && tagName !== 'script' && tagName !== 'style') {
30238
+ s.setAttribute('inert', 'true');
30239
+ hidden.push(s);
30240
+ }
30241
+ });
30242
+ if (elem.parentNode) {
30243
+ addInertOutsideGuide(elem.parentNode, hidden, excludeElements);
30244
+ }
30245
+ return hidden;
30246
+ }
30166
30247
  function buildStyleString(styleObject) {
30167
30248
  var styleString = '';
30168
30249
  _.each(styleObject, function (styleValue, styleKey) {
@@ -32965,10 +33046,11 @@ function GuideStep(guide) {
32965
33046
  try {
32966
33047
  if (el && typeof el.removeAttribute === 'function') {
32967
33048
  el.removeAttribute('aria-hidden');
33049
+ el.removeAttribute('inert');
32968
33050
  }
32969
33051
  }
32970
33052
  catch (e) {
32971
- log.error('unable to remove aria-hidden from element', { error: e });
33053
+ log.error('unable to remove attribute from element', { error: e });
32972
33054
  }
32973
33055
  });
32974
33056
  this.hiddenElements.length = 0;
@@ -36486,6 +36568,7 @@ var DOMActivation = (function () {
36486
36568
  }
36487
36569
  })();
36488
36570
 
36571
+ const REPOSITION_PHASE = 'embeddedGuidesReposition';
36489
36572
  const EmbeddedGuides = (function () {
36490
36573
  let pluginApi;
36491
36574
  let globalPendo;
@@ -36505,15 +36588,42 @@ const EmbeddedGuides = (function () {
36505
36588
  GuideStepFactory.behaviors.push(EmbeddedGuideStep);
36506
36589
  pluginApi.Events.on('deliverablesLoaded', initializeEmbeddedGuides);
36507
36590
  pluginApi.Events.on('eventCaptured', eventCaptured);
36591
+ // APP-161235: embedded guides render as auto-display guides in the guide
36592
+ // loop, and their dynamic-height content can shift the document position
36593
+ // of elements that *other* guides' tooltips are anchored to (e.g. a badge
36594
+ // below the embed). This phase is appended after the built-in loop phases
36595
+ // (so it runs once the embed has rendered this pass) and re-anchors those
36596
+ // tooltips to the settled layout, instead of leaving them detached until a
36597
+ // later pass corrects them (visibly "floating" on a heavy loop).
36598
+ pluginApi.GuideLoop.addUpdatePhase(repositionGuidesAfterEmbedLayout, REPOSITION_PHASE);
36508
36599
  }
36509
36600
  function teardown() {
36510
36601
  pluginApi.Events.off('deliverablesLoaded', initializeEmbeddedGuides);
36511
36602
  pluginApi.Events.off('eventCaptured', eventCaptured);
36603
+ pluginApi.GuideLoop.removeUpdatePhase(REPOSITION_PHASE);
36512
36604
  const index = GuideStepFactory.behaviors.indexOf(EmbeddedGuideStep);
36513
36605
  if (index !== -1) {
36514
36606
  GuideStepFactory.behaviors.splice(index, 1);
36515
36607
  }
36516
36608
  }
36609
+ function isShown(guide) {
36610
+ return !!(guide && _.isFunction(guide.isShown) && guide.isShown());
36611
+ }
36612
+ function repositionGuidesAfterEmbedLayout() {
36613
+ // Only run when one of our embedded guides is actually shown — the only
36614
+ // condition under which the embed's layout can displace other tooltips.
36615
+ if (!_.some(embeddedGuides, isShown))
36616
+ return;
36617
+ _.each(globalPendo.guides, function (guide) {
36618
+ if (isEmbedded(guide) || !isShown(guide))
36619
+ return;
36620
+ _.each(guide.steps, function (step) {
36621
+ if (_.isFunction(step.isShown) && step.isShown() && _.isFunction(step.checkPlacement)) {
36622
+ step.checkPlacement();
36623
+ }
36624
+ });
36625
+ });
36626
+ }
36517
36627
  function eventCaptured(event) {
36518
36628
  const capturedEvent = _.get(event, 'data.0');
36519
36629
  if (!capturedEvent || capturedEvent.type !== 'guideSeen')
@@ -41209,7 +41319,8 @@ const channels = [
41209
41319
  }]
41210
41320
  ];
41211
41321
  const WEB_ANALYTICS_STORAGE_KEY = 'utm';
41212
- const CAPTURE_REFERRER_CONFIG_KEY = 'enableFullUtmReferrer';
41322
+ const ENABLE_FULL_REFERRER_CONFIG_KEY = 'enableFullUtmReferrer';
41323
+ const DISABLE_REFERRER_CONFIG_KEY = 'disableUtmReferrer';
41213
41324
  class WebAnalytics {
41214
41325
  constructor() {
41215
41326
  this.name = 'WebAnalytics';
@@ -41218,7 +41329,11 @@ class WebAnalytics {
41218
41329
  this.pendo = pendo;
41219
41330
  this.api = PluginAPI;
41220
41331
  const { ConfigReader } = PluginAPI;
41221
- ConfigReader.addOption(CAPTURE_REFERRER_CONFIG_KEY, [
41332
+ ConfigReader.addOption(ENABLE_FULL_REFERRER_CONFIG_KEY, [
41333
+ ConfigReader.sources.SNIPPET_SRC,
41334
+ ConfigReader.sources.PENDO_CONFIG_SRC
41335
+ ], false);
41336
+ ConfigReader.addOption(DISABLE_REFERRER_CONFIG_KEY, [
41222
41337
  ConfigReader.sources.SNIPPET_SRC,
41223
41338
  ConfigReader.sources.PENDO_CONFIG_SRC
41224
41339
  ], false);
@@ -41266,14 +41381,16 @@ class WebAnalytics {
41266
41381
  content
41267
41382
  };
41268
41383
  utm.channel = this.calculateUtmChannel({ referrerValue, utm, gclid, fbclid });
41269
- if (referrer && this.api.ConfigReader.get(CAPTURE_REFERRER_CONFIG_KEY)) {
41270
- utm.referrer = referrer;
41271
- }
41272
- else if (referrerValue === 'self') {
41273
- utm.referrer = currentHost;
41274
- }
41275
- else if (referrerValue !== 'direct') {
41276
- utm.referrer = referrerValue;
41384
+ if (!this.api.ConfigReader.get(DISABLE_REFERRER_CONFIG_KEY)) {
41385
+ if (referrer && this.api.ConfigReader.get(ENABLE_FULL_REFERRER_CONFIG_KEY)) {
41386
+ utm.referrer = referrer;
41387
+ }
41388
+ else if (referrerValue === 'self') {
41389
+ utm.referrer = currentHost;
41390
+ }
41391
+ else if (referrerValue !== 'direct') {
41392
+ utm.referrer = referrerValue;
41393
+ }
41277
41394
  }
41278
41395
  return utm;
41279
41396
  }
@@ -41611,19 +41728,17 @@ function getDefaultExportFromCjs (x) {
41611
41728
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
41612
41729
  }
41613
41730
 
41614
- var substitutionRegex = '\\{(?:\\s?)([^.\\s]?visitor|account|parentAccount)\\.([^|\\s/]*)(?:\\s?\\|\\s?([^}]+|[\\/s]+))?(?:\\s?\\/\\s?){1}\\}';
41615
- var skipStepString = '{skipStep:* *(auto|\\d+)\\/}';
41616
- var goToMiddleString = '(?!0)(\\d+)';
41617
- var goToString = "({goto-".concat(goToMiddleString, "\\/})");
41618
- var containerSelector = '[id^="pendo-guide-container"]';
41619
- function lookupGuideButtons(domJson, buttons) {
41620
- if (buttons === void 0) { buttons = []; }
41731
+ const substitutionRegex = '\\{(?:\\s?)([^.\\s]?visitor|account|parentAccount)\\.([^|\\s/]*)(?:\\s?\\|\\s?([^}]+|[\\/s]+))?(?:\\s?\\/\\s?){1}\\}';
41732
+ const skipStepString = '{skipStep:* *(auto|\\d+)\\/}';
41733
+ const goToMiddleString = '(?!0)(\\d+)';
41734
+ const goToString = `({goto-${goToMiddleString}\\/})`;
41735
+ const containerSelector = '[id^="pendo-guide-container"]';
41736
+ function lookupGuideButtons(domJson, buttons = []) {
41621
41737
  if (domJson.type === 'button' && domJson.actions) {
41622
41738
  buttons.push(domJson);
41623
41739
  }
41624
41740
  if (domJson.children) {
41625
- for (var _i = 0, _a = domJson.children; _i < _a.length; _i++) {
41626
- var child = _a[_i];
41741
+ for (const child of domJson.children) {
41627
41742
  lookupGuideButtons(child, buttons);
41628
41743
  }
41629
41744
  }
@@ -41650,16 +41765,15 @@ function removeMarkdownSyntax(element, textToReplace, replacementText, pendo) {
41650
41765
  }
41651
41766
  }
41652
41767
  var guideMarkdownUtil = {
41653
- substitutionRegex: substitutionRegex,
41654
- skipStepString: skipStepString,
41655
- goToString: goToString,
41656
- containerSelector: containerSelector,
41657
- lookupGuideButtons: lookupGuideButtons,
41658
- removeMarkdownSyntax: removeMarkdownSyntax
41768
+ substitutionRegex,
41769
+ skipStepString,
41770
+ goToString,
41771
+ containerSelector,
41772
+ lookupGuideButtons,
41773
+ removeMarkdownSyntax
41659
41774
  };
41660
41775
 
41661
- function getZoneSafeMethod(_, method, target) {
41662
- if (target === void 0) { target = window; }
41776
+ function getZoneSafeMethod(_, method, target = window) {
41663
41777
  var zoneSymbol = '__symbol__';
41664
41778
  /* global Zone */
41665
41779
  if (typeof Zone !== 'undefined' && _.isFunction(Zone[zoneSymbol])) {
@@ -41834,15 +41948,14 @@ function branchingGoToStep(event, step, guide, pendo) {
41834
41948
  event.cancel = true;
41835
41949
  }
41836
41950
 
41837
- var DANGEROUS_URL_SCHEME = /^\s*(javascript|data|vbscript):/i;
41838
- function encodeMetadataForUrl(value, urlBeforePlaceholder) {
41839
- if (urlBeforePlaceholder === void 0) { urlBeforePlaceholder = ''; }
41840
- var str = value === undefined || value === null ? '' : String(value);
41841
- var inUrlComponent = urlBeforePlaceholder.indexOf('?') !== -1 || urlBeforePlaceholder.indexOf('#') !== -1;
41951
+ const DANGEROUS_URL_SCHEME = /^\s*(javascript|data|vbscript):/i;
41952
+ function encodeMetadataForUrl(value, urlBeforePlaceholder = '') {
41953
+ const str = value === undefined || value === null ? '' : String(value);
41954
+ const inUrlComponent = urlBeforePlaceholder.indexOf('?') !== -1 || urlBeforePlaceholder.indexOf('#') !== -1;
41842
41955
  if (inUrlComponent) {
41843
41956
  return window.encodeURIComponent(str);
41844
41957
  }
41845
- var schemeAlreadySet = urlBeforePlaceholder.indexOf(':') !== -1;
41958
+ const schemeAlreadySet = urlBeforePlaceholder.indexOf(':') !== -1;
41846
41959
  if (!schemeAlreadySet && DANGEROUS_URL_SCHEME.test(str)) {
41847
41960
  return '';
41848
41961
  }
@@ -49782,32 +49895,31 @@ var n;
49782
49895
  }(n || (n = {}));
49783
49896
  return record; }
49784
49897
 
49785
- var SessionRecorderBuffer = /** @class */ (function () {
49786
- function SessionRecorderBuffer(interval, maxCount) {
49787
- if (maxCount === void 0) { maxCount = Infinity; }
49898
+ class SessionRecorderBuffer {
49899
+ constructor(interval, maxCount = Infinity) {
49788
49900
  this.data = [];
49789
49901
  this.sequenceNumber = 0;
49790
49902
  this.interval = interval;
49791
49903
  this.maxCount = maxCount;
49792
49904
  this.doubledMaxCount = maxCount * 2;
49793
49905
  }
49794
- SessionRecorderBuffer.prototype.isEmpty = function () {
49906
+ isEmpty() {
49795
49907
  return this.data.length === 0;
49796
- };
49797
- SessionRecorderBuffer.prototype.count = function () {
49908
+ }
49909
+ count() {
49798
49910
  return this.data.length;
49799
- };
49800
- SessionRecorderBuffer.prototype.clear = function () {
49911
+ }
49912
+ clear() {
49801
49913
  this.data.length = 0;
49802
- };
49803
- SessionRecorderBuffer.prototype.clearSequence = function () {
49914
+ }
49915
+ clearSequence() {
49804
49916
  this.sequenceNumber = 0;
49805
- };
49806
- SessionRecorderBuffer.prototype.push = function (event) {
49917
+ }
49918
+ push(event) {
49807
49919
  this.data.push(event);
49808
49920
  this.checkRateLimit();
49809
- };
49810
- SessionRecorderBuffer.prototype.pack = function (envelope, _) {
49921
+ }
49922
+ pack(envelope, _) {
49811
49923
  var eventsToSend = this.data.splice(0, this.maxCount);
49812
49924
  envelope.recordingPayload = eventsToSend;
49813
49925
  envelope.sequence = this.sequenceNumber;
@@ -49815,8 +49927,8 @@ var SessionRecorderBuffer = /** @class */ (function () {
49815
49927
  if (eventsToSend.length) {
49816
49928
  envelope.browserTime = eventsToSend[0].timestamp;
49817
49929
  }
49818
- envelope.recordingPayloadMetadata = _.map(eventsToSend, function (event) {
49819
- var metadata = _.pick(event, 'type', 'timestamp');
49930
+ envelope.recordingPayloadMetadata = _.map(eventsToSend, event => {
49931
+ const metadata = _.pick(event, 'type', 'timestamp');
49820
49932
  if (event.data) {
49821
49933
  metadata.data = _.pick(event.data, 'source', 'type', 'x', 'y', 'id', 'height', 'width', 'href');
49822
49934
  }
@@ -49824,18 +49936,17 @@ var SessionRecorderBuffer = /** @class */ (function () {
49824
49936
  });
49825
49937
  this.sequenceNumber += eventsToSend.length;
49826
49938
  return envelope;
49827
- };
49828
- SessionRecorderBuffer.prototype.checkRateLimit = function () {
49829
- var length = this.data.length;
49939
+ }
49940
+ checkRateLimit() {
49941
+ const length = this.data.length;
49830
49942
  if (length >= this.doubledMaxCount && length % this.maxCount === 0) {
49831
- var elapsed = this.data[length - 1].timestamp - this.data[length - this.doubledMaxCount].timestamp;
49943
+ const elapsed = this.data[length - 1].timestamp - this.data[length - this.doubledMaxCount].timestamp;
49832
49944
  if (elapsed <= this.interval && this.onRateLimit) {
49833
49945
  this.onRateLimit();
49834
49946
  }
49835
49947
  }
49836
- };
49837
- return SessionRecorderBuffer;
49838
- }());
49948
+ }
49949
+ }
49839
49950
 
49840
49951
  function __rest(s, e) {
49841
49952
  var t = {};
@@ -49859,52 +49970,24 @@ function __awaiter(thisArg, _arguments, P, generator) {
49859
49970
  });
49860
49971
  }
49861
49972
 
49862
- function __generator(thisArg, body) {
49863
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
49864
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
49865
- function verb(n) { return function (v) { return step([n, v]); }; }
49866
- function step(op) {
49867
- if (f) throw new TypeError("Generator is already executing.");
49868
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
49869
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
49870
- if (y = 0, t) op = [op[0] & 2, t.value];
49871
- switch (op[0]) {
49872
- case 0: case 1: t = op; break;
49873
- case 4: _.label++; return { value: op[1], done: false };
49874
- case 5: _.label++; y = op[1]; op = [0]; continue;
49875
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
49876
- default:
49877
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
49878
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
49879
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
49880
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
49881
- if (t[2]) _.ops.pop();
49882
- _.trys.pop(); continue;
49883
- }
49884
- op = body.call(thisArg, _);
49885
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
49886
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
49887
- }
49888
- }
49889
-
49890
49973
  typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
49891
49974
  var e = new Error(message);
49892
49975
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
49893
49976
  };
49894
49977
 
49895
- var RECORDING_CONFIG_WORKERURL$1 = 'recording.workerUrl';
49896
- var MAX_SIZE = 2000000;
49897
- var RESOURCE_CACHING$1 = 'resourceCaching';
49898
- var Transport = /** @class */ (function () {
49899
- function Transport(WorkerClass, pendo, api) {
49978
+ const RECORDING_CONFIG_WORKERURL$1 = 'recording.workerUrl';
49979
+ const MAX_SIZE = 2000000;
49980
+ const RESOURCE_CACHING$1 = 'resourceCaching';
49981
+ class Transport {
49982
+ constructor(WorkerClass, pendo, api) {
49900
49983
  this.WorkerClass = WorkerClass;
49901
49984
  this.pendo = pendo;
49902
49985
  this.api = api;
49903
49986
  this.maxSize = MAX_SIZE;
49904
- this.lockID = "worker-lock-".concat(this.pendo.randomString(16));
49987
+ this.lockID = `worker-lock-${this.pendo.randomString(16)}`;
49905
49988
  this.isResourceCachingEnabled = this.api.ConfigReader.get(RESOURCE_CACHING$1);
49906
49989
  }
49907
- Transport.prototype.start = function (config) {
49990
+ start(config) {
49908
49991
  if (config.disableWorker)
49909
49992
  return;
49910
49993
  if (!this.worker) {
@@ -49914,7 +49997,7 @@ var Transport = /** @class */ (function () {
49914
49997
  this.worker = config.workerOverride;
49915
49998
  }
49916
49999
  else {
49917
- var workerUrl = this.api.ConfigReader.get(RECORDING_CONFIG_WORKERURL$1);
50000
+ const workerUrl = this.api.ConfigReader.get(RECORDING_CONFIG_WORKERURL$1);
49918
50001
  this.usesSelfHostedWorker = workerUrl != null;
49919
50002
  this.worker = workerUrl ? new Worker(workerUrl) : new this.WorkerClass();
49920
50003
  }
@@ -49928,35 +50011,34 @@ var Transport = /** @class */ (function () {
49928
50011
  this.worker = null;
49929
50012
  }
49930
50013
  }
49931
- };
49932
- Transport.prototype.stop = function () {
50014
+ }
50015
+ stop() {
49933
50016
  if (this.worker) {
49934
50017
  this.worker.terminate();
49935
50018
  delete this.worker;
49936
50019
  }
49937
- };
49938
- Transport.prototype.send = function (envelope, isUnload, failureCount) {
49939
- if (failureCount === void 0) { failureCount = 0; }
49940
- var url = envelope.url;
49941
- var payload = envelope.payload;
50020
+ }
50021
+ send(envelope, isUnload, failureCount = 0) {
50022
+ let { url } = envelope;
50023
+ const { payload } = envelope;
49942
50024
  if (failureCount > 0) {
49943
- url = "".concat(url, "&rt=").concat(failureCount);
50025
+ url = `${url}&rt=${failureCount}`;
49944
50026
  }
49945
50027
  if (this.worker && !isUnload && payload) {
49946
- var deferred_1 = {};
49947
- deferred_1.promise = new Promise$2(function (resolve, reject) {
49948
- deferred_1.resolve = resolve;
49949
- deferred_1.reject = reject;
50028
+ const deferred = {};
50029
+ deferred.promise = new Promise$2((resolve, reject) => {
50030
+ deferred.resolve = resolve;
50031
+ deferred.reject = reject;
49950
50032
  });
49951
- this.workerResponse = deferred_1;
49952
- this.worker.postMessage({ url: url, payload: payload, shouldCacheResources: this.isResourceCachingEnabled });
49953
- return deferred_1.promise;
50033
+ this.workerResponse = deferred;
50034
+ this.worker.postMessage({ url, payload, shouldCacheResources: this.isResourceCachingEnabled });
50035
+ return deferred.promise;
49954
50036
  }
49955
50037
  else {
49956
50038
  if (!envelope.body) {
49957
- var strPayload = JSON.stringify(payload);
50039
+ const strPayload = JSON.stringify(payload);
49958
50040
  if (strPayload.length > this.maxSize) {
49959
- var error = new Error('maximum recording payload size exceeded');
50041
+ const error = new Error('maximum recording payload size exceeded');
49960
50042
  error.reason = 'HEAVY_EVENT';
49961
50043
  error.context = {
49962
50044
  size: strPayload.length,
@@ -49967,14 +50049,14 @@ var Transport = /** @class */ (function () {
49967
50049
  envelope.body = this.pendo.compress(strPayload, 'binary');
49968
50050
  delete envelope.payload;
49969
50051
  }
49970
- url = "".concat(url, "&ct=").concat(new Date().getTime());
50052
+ url = `${url}&ct=${new Date().getTime()}`;
49971
50053
  return this.post(url, {
49972
50054
  keepalive: isUnload,
49973
50055
  body: envelope.body
49974
50056
  });
49975
50057
  }
49976
- };
49977
- Transport.prototype.post = function (url, options) {
50058
+ }
50059
+ post(url, options) {
49978
50060
  options.method = 'POST';
49979
50061
  if (options.keepalive && this.api.transmit.fetchKeepalive.supported()) {
49980
50062
  return this.api.transmit.fetchKeepalive(url, options);
@@ -49986,57 +50068,46 @@ var Transport = /** @class */ (function () {
49986
50068
  else {
49987
50069
  return this.pendo.ajax.post(url, options.body);
49988
50070
  }
49989
- };
49990
- Transport.prototype._onMessage = function (messageEvent) {
49991
- return __awaiter(this, void 0, void 0, function () {
49992
- return __generator(this, function (_a) {
49993
- switch (_a.label) {
49994
- case 0:
49995
- if (!(messageEvent.data && messageEvent.data.ready && navigator.locks)) return [3 /*break*/, 2];
49996
- // When the lock is released, we can assume the worker was terminated or closed
49997
- return [4 /*yield*/, navigator.locks.request(this.lockID, function () { })];
49998
- case 1:
49999
- // When the lock is released, we can assume the worker was terminated or closed
50000
- _a.sent();
50001
- this.onWorkerMessage({ type: 'workerDied' });
50002
- _a.label = 2;
50003
- case 2:
50004
- // handle non-POST request responses from worker
50005
- if (messageEvent.data && messageEvent.data.type) {
50006
- this.onWorkerMessage(messageEvent.data);
50007
- return [2 /*return*/];
50008
- }
50009
- // handle POST request response from worker
50010
- if (messageEvent.data && messageEvent.data.error) {
50011
- if ((messageEvent.data.status && messageEvent.data.status < 500) ||
50012
- messageEvent.data.sequence == null) {
50013
- this.api.log.critical('Failed to send recording data from web worker', { error: messageEvent.data.error });
50014
- }
50015
- if (this.workerResponse) {
50016
- this.workerResponse.reject();
50017
- this.workerResponse = null;
50018
- }
50019
- }
50020
- if (this.workerResponse) {
50021
- this.workerResponse.resolve();
50022
- this.workerResponse = null;
50023
- }
50024
- return [2 /*return*/];
50071
+ }
50072
+ _onMessage(messageEvent) {
50073
+ return __awaiter(this, void 0, void 0, function* () {
50074
+ if (messageEvent.data && messageEvent.data.ready && navigator.locks) {
50075
+ // When the lock is released, we can assume the worker was terminated or closed
50076
+ yield navigator.locks.request(this.lockID, () => { });
50077
+ this.onWorkerMessage({ type: 'workerDied' });
50078
+ }
50079
+ // handle non-POST request responses from worker
50080
+ if (messageEvent.data && messageEvent.data.type) {
50081
+ this.onWorkerMessage(messageEvent.data);
50082
+ return;
50083
+ }
50084
+ // handle POST request response from worker
50085
+ if (messageEvent.data && messageEvent.data.error) {
50086
+ if ((messageEvent.data.status && messageEvent.data.status < 500) ||
50087
+ messageEvent.data.sequence == null) {
50088
+ this.api.log.critical('Failed to send recording data from web worker', { error: messageEvent.data.error });
50025
50089
  }
50026
- });
50090
+ if (this.workerResponse) {
50091
+ this.workerResponse.reject();
50092
+ this.workerResponse = null;
50093
+ }
50094
+ }
50095
+ if (this.workerResponse) {
50096
+ this.workerResponse.resolve();
50097
+ this.workerResponse = null;
50098
+ }
50027
50099
  });
50028
- };
50029
- Transport.prototype._onError = function () {
50100
+ }
50101
+ _onError() {
50030
50102
  if (this.onError) {
50031
50103
  this.onError();
50032
50104
  }
50033
- };
50034
- return Transport;
50035
- }());
50105
+ }
50106
+ }
50036
50107
 
50037
- var ELEMENT_NODE = 1;
50038
- var INPUT_MASK = '*'.repeat(10);
50039
- var NUMBER_INPUT_MASK = '0'.repeat(10);
50108
+ const ELEMENT_NODE = 1;
50109
+ const INPUT_MASK = '*'.repeat(10);
50110
+ const NUMBER_INPUT_MASK = '0'.repeat(10);
50040
50111
  function isElementNode(node) {
50041
50112
  if (!node)
50042
50113
  return false;
@@ -50045,12 +50116,10 @@ function isElementNode(node) {
50045
50116
  return true;
50046
50117
  }
50047
50118
  function getParent(elem) {
50048
- var isElementShadowRoot = typeof window.ShadowRoot !== 'undefined' && elem instanceof window.ShadowRoot && elem.host;
50119
+ const isElementShadowRoot = typeof window.ShadowRoot !== 'undefined' && elem instanceof window.ShadowRoot && elem.host;
50049
50120
  return isElementShadowRoot ? elem.host : elem.parentNode;
50050
50121
  }
50051
- function distanceToMatch(node, selector, limit, distance) {
50052
- if (limit === void 0) { limit = Infinity; }
50053
- if (distance === void 0) { distance = 0; }
50122
+ function distanceToMatch(node, selector, limit = Infinity, distance = 0) {
50054
50123
  if (distance > limit)
50055
50124
  return -1;
50056
50125
  if (!node)
@@ -50064,15 +50133,15 @@ function distanceToMatch(node, selector, limit, distance) {
50064
50133
  return distanceToMatch(getParent(node), selector, limit, distance + 1);
50065
50134
  }
50066
50135
  function shouldMask(node, options) {
50067
- var maskAllText = options.maskAllText, maskTextSelector = options.maskTextSelector, unmaskTextSelector = options.unmaskTextSelector;
50136
+ const { maskAllText, maskTextSelector, unmaskTextSelector } = options;
50068
50137
  try {
50069
- var el = isElementNode(node) ? node : node.parentElement;
50138
+ const el = isElementNode(node) ? node : node.parentElement;
50070
50139
  if (el === null)
50071
50140
  return false;
50072
50141
  if ((el.tagName || '').toUpperCase() === 'STYLE')
50073
50142
  return false;
50074
- var maskDistance = -1;
50075
- var unmaskDistance = -1;
50143
+ let maskDistance = -1;
50144
+ let unmaskDistance = -1;
50076
50145
  if (maskAllText) {
50077
50146
  unmaskDistance = distanceToMatch(el, unmaskTextSelector);
50078
50147
  if (unmaskDistance < 0) {
@@ -50105,8 +50174,8 @@ function isNumberInput(element) {
50105
50174
  }
50106
50175
  function shouldMaskInput(element, maskInputOptions) {
50107
50176
  if (maskInputOptions && isElementNode(element)) {
50108
- var tagName = (element.tagName || '').toLowerCase();
50109
- var type = (element.type || '').toLowerCase();
50177
+ const tagName = (element.tagName || '').toLowerCase();
50178
+ const type = (element.type || '').toLowerCase();
50110
50179
  if (maskInputOptions[tagName] || maskInputOptions[type]) {
50111
50180
  return true;
50112
50181
  }
@@ -51745,12 +51814,12 @@ function createReplayPlugin() {
51745
51814
  * limit of number of keys in an object
51746
51815
  * if an object contains more keys than this limit, we would call its toString function directly
51747
51816
  */
51748
- var NUM_OF_KEYS_LIMIT = 50;
51817
+ const NUM_OF_KEYS_LIMIT = 50;
51749
51818
  /**
51750
51819
  * limit number of depth in an object
51751
51820
  * if an object is too deep, toString process may cause browser OOM
51752
51821
  */
51753
- var DEPTH_OF_LIMIT = 4;
51822
+ const DEPTH_OF_LIMIT = 4;
51754
51823
  /**
51755
51824
  * serialize an HTML element by creating a shallow clone of it with text content
51756
51825
  * and return the resulting outerHTML string (without the subtree)
@@ -51761,8 +51830,8 @@ function serializeHTML(node) {
51761
51830
  if (!node || node.nodeType !== node.ELEMENT_NODE) {
51762
51831
  return '';
51763
51832
  }
51764
- var nodeClone = node.cloneNode(false);
51765
- var textContent = node.textContent;
51833
+ const nodeClone = node.cloneNode(false);
51834
+ const { textContent } = node;
51766
51835
  if (textContent) {
51767
51836
  nodeClone.textContent = textContent;
51768
51837
  }
@@ -51776,7 +51845,7 @@ function isObject(obj) {
51776
51845
  return false;
51777
51846
  if (typeof obj !== 'object')
51778
51847
  return false;
51779
- var proto = Object.getPrototypeOf(obj);
51848
+ const proto = Object.getPrototypeOf(obj);
51780
51849
  return proto === Object.prototype || proto === null;
51781
51850
  }
51782
51851
  /**
@@ -51785,11 +51854,11 @@ function isObject(obj) {
51785
51854
  function isObjTooDeep(obj, limit) {
51786
51855
  if (limit === 0)
51787
51856
  return true;
51788
- var keys = Object.keys(obj);
51857
+ const keys = Object.keys(obj);
51789
51858
  if (keys.length === 0)
51790
51859
  return false;
51791
- return keys.some(function (key) {
51792
- var value = obj[key];
51860
+ return keys.some(key => {
51861
+ const value = obj[key];
51793
51862
  return isObject(value) && isObjTooDeep(value, limit - 1);
51794
51863
  });
51795
51864
  }
@@ -51805,7 +51874,7 @@ function shouldIgnore(_obj) {
51805
51874
  return false;
51806
51875
  }
51807
51876
  // out of keys limit
51808
- var keys = Object.keys(_obj);
51877
+ const keys = Object.keys(_obj);
51809
51878
  if (keys.length > NUM_OF_KEYS_LIMIT) {
51810
51879
  return true;
51811
51880
  }
@@ -51837,7 +51906,7 @@ function stringify(arg) {
51837
51906
  return value.toString ? value.toString() : '[object Object]';
51838
51907
  }
51839
51908
  if (value instanceof ArrayBuffer)
51840
- return "ArrayBuffer { byteLength: ".concat(value.byteLength, " }");
51909
+ return `ArrayBuffer { byteLength: ${value.byteLength} }`;
51841
51910
  if (value instanceof Error)
51842
51911
  return value.name + ': ' + value.message;
51843
51912
  if (value instanceof Node) {
@@ -51845,10 +51914,10 @@ function stringify(arg) {
51845
51914
  }
51846
51915
  // Handle events
51847
51916
  if (value instanceof Event) {
51848
- var eventResult = {};
51917
+ const eventResult = {};
51849
51918
  // eslint-disable-next-line guard-for-in
51850
- for (var eventKey in value) {
51851
- var eventValue = value[eventKey];
51919
+ for (const eventKey in value) {
51920
+ const eventValue = value[eventKey];
51852
51921
  eventResult[eventKey] = Array.isArray(eventValue) && eventValue[0] instanceof HTMLElement
51853
51922
  ? serializeHTML(eventValue[0])
51854
51923
  : eventValue;
@@ -51859,31 +51928,30 @@ function stringify(arg) {
51859
51928
  });
51860
51929
  }
51861
51930
 
51862
- var StackFrame = /** @class */ (function () {
51863
- function StackFrame(obj) {
51931
+ class StackFrame {
51932
+ constructor(obj) {
51864
51933
  this.fileName = obj.fileName || '';
51865
51934
  this.functionName = obj.functionName || '';
51866
51935
  this.lineNumber = obj.lineNumber;
51867
51936
  this.columnNumber = obj.columnNumber;
51868
51937
  }
51869
- StackFrame.prototype.toString = function () {
51870
- var _a = this, fileName = _a.fileName, functionName = _a.functionName, _b = _a.lineNumber, lineNumber = _b === void 0 ? '' : _b, _c = _a.columnNumber, columnNumber = _c === void 0 ? '' : _c;
51938
+ toString() {
51939
+ const { fileName, functionName, lineNumber = '', columnNumber = '' } = this;
51871
51940
  return functionName
51872
- ? "".concat(functionName, " (").concat(fileName, ":").concat(lineNumber, ":").concat(columnNumber, ")")
51873
- : "".concat(fileName, ":").concat(lineNumber, ":").concat(columnNumber);
51874
- };
51875
- return StackFrame;
51876
- }());
51877
- var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
51878
- var CHROME_EDGE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
51879
- var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/;
51880
- var LOCATION_REGEXP = /(.+?)(?::(\d+))?(?::(\d+))?$/;
51881
- var DEFAULT_NUM_FRAMES_TO_SKIP = 5;
51882
- var ErrorStackParser = {
51941
+ ? `${functionName} (${fileName}:${lineNumber}:${columnNumber})`
51942
+ : `${fileName}:${lineNumber}:${columnNumber}`;
51943
+ }
51944
+ }
51945
+ const FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
51946
+ const CHROME_EDGE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
51947
+ const SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/;
51948
+ const LOCATION_REGEXP = /(.+?)(?::(\d+))?(?::(\d+))?$/;
51949
+ const DEFAULT_NUM_FRAMES_TO_SKIP = 5;
51950
+ const ErrorStackParser = {
51883
51951
  /**
51884
51952
  * Given an Error object, extract the most information from it.
51885
51953
  */
51886
- parse: function (error, maxFramesToSave) {
51954
+ parse(error, maxFramesToSave) {
51887
51955
  if (!(error === null || error === void 0 ? void 0 : error.stack))
51888
51956
  return [];
51889
51957
  // Chrome, Edge, Opera ≥15
@@ -51897,25 +51965,24 @@ var ErrorStackParser = {
51897
51965
  return [];
51898
51966
  },
51899
51967
  // Separate line and column numbers from a string of the form: (URI:Line:Column)
51900
- extractLocation: function (urlLike) {
51968
+ extractLocation(urlLike) {
51901
51969
  // Fail-fast but return locations like "(native)"
51902
51970
  if (urlLike.indexOf(':') === -1) {
51903
51971
  return [urlLike];
51904
51972
  }
51905
- var parts = LOCATION_REGEXP.exec(urlLike.replace(/[()]/g, ''));
51973
+ const parts = LOCATION_REGEXP.exec(urlLike.replace(/[()]/g, ''));
51906
51974
  if (!parts)
51907
- throw new Error("Cannot parse given url: ".concat(urlLike));
51975
+ throw new Error(`Cannot parse given url: ${urlLike}`);
51908
51976
  return [parts[1], parts[2] || undefined, parts[3] || undefined];
51909
51977
  },
51910
- parseHelper: function (_a, error, maxFramesToSave, callback) {
51911
- var regex = _a.regex, includeMatchedLine = _a.includeMatchedLine;
51912
- var lines = error.stack.split('\n');
51913
- var frames = [];
51914
- var validFramesFound = 0;
51915
- for (var i = 0; i < lines.length; i++) {
51916
- var line = lines[i];
51917
- var lineMatchesRegex = regex.test(line);
51918
- var shouldSkipLine = (includeMatchedLine && !lineMatchesRegex) || // if line doesn't match regex and we want matched lines, skip it
51978
+ parseHelper({ regex, includeMatchedLine }, error, maxFramesToSave, callback) {
51979
+ const lines = error.stack.split('\n');
51980
+ const frames = [];
51981
+ let validFramesFound = 0;
51982
+ for (let i = 0; i < lines.length; i++) {
51983
+ const line = lines[i];
51984
+ const lineMatchesRegex = regex.test(line);
51985
+ const shouldSkipLine = (includeMatchedLine && !lineMatchesRegex) || // if line doesn't match regex and we want matched lines, skip it
51919
51986
  (!includeMatchedLine && lineMatchesRegex); // if line does match regex but we don't want matched lines, skip it
51920
51987
  if (shouldSkipLine)
51921
51988
  continue;
@@ -51930,12 +51997,11 @@ var ErrorStackParser = {
51930
51997
  }
51931
51998
  return frames;
51932
51999
  },
51933
- parseChromiumStack: function (error, maxFramesToSave) {
51934
- var _this = this;
51935
- return this.parseHelper({ regex: CHROME_EDGE_STACK_REGEXP, includeMatchedLine: true }, error, maxFramesToSave, function (line, frames) {
51936
- var sanitizedLine;
52000
+ parseChromiumStack(error, maxFramesToSave) {
52001
+ return this.parseHelper({ regex: CHROME_EDGE_STACK_REGEXP, includeMatchedLine: true }, error, maxFramesToSave, (line, frames) => {
52002
+ let sanitizedLine;
51937
52003
  if (line.indexOf('(eval ') > -1) {
51938
- var processedLine = line
52004
+ const processedLine = line
51939
52005
  .replace(/eval code/g, 'eval')
51940
52006
  .replace(/(\(eval at [^()]*)|(\),.*$)/g, '');
51941
52007
  sanitizedLine = processedLine.replace(/^\s+/, '').replace(/\(eval code/g, '(');
@@ -51945,7 +52011,7 @@ var ErrorStackParser = {
51945
52011
  }
51946
52012
  // capture and preserve the parenthesized location "(/foo/my bar.js:12:87)"
51947
52013
  // in case it has spaces in it, as the string is split on \s+ later on
51948
- var location;
52014
+ let location;
51949
52015
  if (sanitizedLine.indexOf('(') > -1 && sanitizedLine.indexOf('):') > -1) {
51950
52016
  location = sanitizedLine.match(/ (\((.+):(\d+):(\d+)\)$)/);
51951
52017
  }
@@ -51953,23 +52019,22 @@ var ErrorStackParser = {
51953
52019
  sanitizedLine = location
51954
52020
  ? sanitizedLine.replace(location[0], '')
51955
52021
  : sanitizedLine;
51956
- var tokens = sanitizedLine.split(/\s+/).slice(1);
52022
+ const tokens = sanitizedLine.split(/\s+/).slice(1);
51957
52023
  // if a location was matched, pass it to extractLocation() otherwise pop the last token
51958
- var locationParts = _this.extractLocation(location ? location[1] : tokens.pop() || '');
51959
- var functionName = tokens.join(' ') || undefined;
51960
- var fileName = (locationParts[0] === 'eval' || locationParts[0] === '<anonymous>') ? undefined : locationParts[0];
52024
+ const locationParts = this.extractLocation(location ? location[1] : tokens.pop() || '');
52025
+ const functionName = tokens.join(' ') || undefined;
52026
+ const fileName = (locationParts[0] === 'eval' || locationParts[0] === '<anonymous>') ? undefined : locationParts[0];
51961
52027
  frames.push(new StackFrame({
51962
- functionName: functionName,
51963
- fileName: fileName,
52028
+ functionName,
52029
+ fileName,
51964
52030
  lineNumber: locationParts[1],
51965
52031
  columnNumber: locationParts[2]
51966
52032
  }));
51967
52033
  });
51968
52034
  },
51969
- parseFirefoxSafariStack: function (error, maxFramesToSave) {
51970
- var _this = this;
51971
- return this.parseHelper({ regex: SAFARI_NATIVE_CODE_REGEXP, includeMatchedLine: false }, error, maxFramesToSave, function (line, frames) {
51972
- var processedLine = line;
52035
+ parseFirefoxSafariStack(error, maxFramesToSave) {
52036
+ return this.parseHelper({ regex: SAFARI_NATIVE_CODE_REGEXP, includeMatchedLine: false }, error, maxFramesToSave, (line, frames) => {
52037
+ let processedLine = line;
51973
52038
  // Throw away eval information until we implement stacktrace.js/stackframe#8
51974
52039
  if (processedLine.indexOf(' > eval') > -1) {
51975
52040
  processedLine = processedLine.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ':$1');
@@ -51981,12 +52046,12 @@ var ErrorStackParser = {
51981
52046
  }));
51982
52047
  return;
51983
52048
  }
51984
- var functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/;
51985
- var matches = processedLine.match(functionNameRegex);
51986
- var functionName = matches && matches[1] ? matches[1] : undefined;
51987
- var locationParts = _this.extractLocation(processedLine.replace(functionNameRegex, ''));
52049
+ const functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/;
52050
+ const matches = processedLine.match(functionNameRegex);
52051
+ const functionName = matches && matches[1] ? matches[1] : undefined;
52052
+ const locationParts = this.extractLocation(processedLine.replace(functionNameRegex, ''));
51988
52053
  frames.push(new StackFrame({
51989
- functionName: functionName,
52054
+ functionName,
51990
52055
  fileName: locationParts[0],
51991
52056
  lineNumber: locationParts[1],
51992
52057
  columnNumber: locationParts[2]
@@ -55145,46 +55210,42 @@ var _ = /*@__PURE__*/getDefaultExportFromCjs(underscoreExports);
55145
55210
 
55146
55211
  var encodeURIComponent = _.isFunction(window.encodeURIComponent) ? window.encodeURIComponent : _.identity;
55147
55212
 
55148
- var PREDICT_STEP_REGEX = /\$\$predict\$\$/;
55149
- var DRAG_THRESHOLD = 5;
55150
- var STYLE_ID = 'pendo-predict-plugin-styles';
55151
- var GUIDE_BUTTON_IDENTIFIER = 'button:contains("token")';
55152
- var pluginVersion = '1.0.1';
55153
- var PREDICT_SANDBOX_PAGE = 'predict-sandbox.html';
55154
- var getPredictBaseUrl = function (designerServer) { return designerServer.replace('app', 'predict'); };
55155
- var EXTENSION_ORIGIN_REGEX = /^(chrome|moz|safari-web)-extension:\/\//;
55213
+ const PREDICT_STEP_REGEX = /\$\$predict\$\$/;
55214
+ const DRAG_THRESHOLD = 5;
55215
+ const STYLE_ID = 'pendo-predict-plugin-styles';
55216
+ const GUIDE_BUTTON_IDENTIFIER = 'button:contains("token")';
55217
+ const pluginVersion = '1.0.1';
55218
+ const PREDICT_SANDBOX_PAGE = 'predict-sandbox.html';
55219
+ const getPredictBaseUrl = (designerServer) => designerServer.replace('app', 'predict');
55220
+ const EXTENSION_ORIGIN_REGEX = /^(chrome|moz|safari-web)-extension:\/\//;
55156
55221
  /**
55157
55222
  * When running inside the Pendo Launcher extension, a host page's CSP `frame-src`
55158
55223
  * blocks embedding predict.pendo.io directly. The extension ships a web-accessible
55159
55224
  * `predict-sandbox.html` relay (exempt from the page CSP) that we frame instead, passing
55160
55225
  * the real predict URL via `?target=`. assetHost is the extension origin in that context.
55161
55226
  */
55162
- var getFrameWrapperBase = function (pendo) {
55227
+ const getFrameWrapperBase = (pendo) => {
55163
55228
  var _a;
55164
- var assetHost = ((_a = pendo === null || pendo === void 0 ? void 0 : pendo.getConfigValue) === null || _a === void 0 ? void 0 : _a.call(pendo, 'assetHost')) || '';
55229
+ const assetHost = ((_a = pendo === null || pendo === void 0 ? void 0 : pendo.getConfigValue) === null || _a === void 0 ? void 0 : _a.call(pendo, 'assetHost')) || '';
55165
55230
  return EXTENSION_ORIGIN_REGEX.test(assetHost) ? assetHost.replace(/\/$/, '') : '';
55166
55231
  };
55167
55232
  /**
55168
55233
  * Builds the iframe `src`. Outside the extension this is the raw predict URL; inside it,
55169
55234
  * the predict URL is passed as `?target=` to the extension's web-accessible relay page.
55170
55235
  */
55171
- var buildFrameSrc = function (url, wrapperBase) {
55172
- return wrapperBase ? "".concat(wrapperBase, "/").concat(PREDICT_SANDBOX_PAGE, "?target=").concat(encodeURIComponent(url)) : url;
55173
- };
55236
+ const buildFrameSrc = (url, wrapperBase) => wrapperBase ? `${wrapperBase}/${PREDICT_SANDBOX_PAGE}?target=${encodeURIComponent(url)}` : url;
55174
55237
  /**
55175
55238
  * Target origin for outbound postMessage. When wrapped, the relay frame is same-origin
55176
55239
  * with the extension (`wrapperBase`), so we address it explicitly rather than broadcasting
55177
55240
  * with '*' — keeping the auth token off any wildcard. Unwrapped, we post straight to predict.
55178
55241
  */
55179
- var getFrameTargetOrigin = function (wrapperBase, predictBaseUrl) { return wrapperBase || predictBaseUrl; };
55180
- var $ = function (id) { return document.getElementById(id); };
55181
- var createElement = function (tag, attrs, parent) {
55182
- if (attrs === void 0) { attrs = {}; }
55183
- if (parent === void 0) { parent = null; }
55184
- var el = document.createElement(tag);
55185
- var entries = Object.entries(attrs);
55186
- for (var i = 0; i < entries.length; i++) {
55187
- var _a = entries[i], key = _a[0], value = _a[1];
55242
+ const getFrameTargetOrigin = (wrapperBase, predictBaseUrl) => wrapperBase || predictBaseUrl;
55243
+ const $ = (id) => document.getElementById(id);
55244
+ const createElement = (tag, attrs = {}, parent = null) => {
55245
+ const el = document.createElement(tag);
55246
+ const entries = Object.entries(attrs);
55247
+ for (let i = 0; i < entries.length; i++) {
55248
+ const [key, value] = entries[i];
55188
55249
  if (key === 'className')
55189
55250
  el.className = value;
55190
55251
  else if (key === 'innerHTML')
@@ -55196,28 +55257,70 @@ var createElement = function (tag, attrs, parent) {
55196
55257
  parent.appendChild(el);
55197
55258
  return el;
55198
55259
  };
55199
- var injectStyles = function (pendoContainerId, log) {
55200
- if (log === void 0) { log = function () { }; }
55201
- var styleId = "".concat(STYLE_ID, "-").concat(pendoContainerId);
55260
+ const injectStyles = (pendoContainerId, log = () => { }) => {
55261
+ const styleId = `${STYLE_ID}-${pendoContainerId}`;
55202
55262
  if ($(styleId)) {
55203
- log("[predict] style already exists, skipping: ".concat(styleId));
55263
+ log(`[predict] style already exists, skipping: ${styleId}`);
55204
55264
  return;
55205
55265
  }
55206
- log("[predict] injecting styles: ".concat(styleId));
55266
+ log(`[predict] injecting styles: ${styleId}`);
55207
55267
  createElement('style', {
55208
55268
  id: styleId,
55209
- textContent: "\n #".concat(pendoContainerId, " {\n display: none !important;\n }\n .frame-explanation {\n aspect-ratio: 16/9; overflow: hidden; min-height: 300px;\n width: 100vw; height: 100vh; background: transparent;\n position: fixed; bottom: 0; right: 0; z-index: 1; border: none;\n visibility: hidden; opacity: 0; pointer-events: none;\n transition: opacity 0.1s ease-out, visibility 0s linear 0.1s;\n display: none;\n }\n .frame-explanation.is-visible {\n z-index: 999999;\n visibility: visible; opacity: 1; pointer-events: auto;\n transition: opacity 0.1s ease-out, visibility 0s linear 0s;\n }\n .frame-explanation.is-exists {\n display: block !important;\n }\n .floating-modal-container {\n position: fixed; top: 20px; right: 20px; z-index: 500000;\n visibility: hidden; opacity: 0; pointer-events: none;\n transition: opacity 0.1s ease-out, visibility 0s linear 0.1s;\n border-radius: 8px; box-shadow: 0px 4px 12px 0px rgba(0,0,0,0.15);\n overflow: hidden; width: 384px; height: 176px;\n }\n .floating-modal-container.is-visible {\n visibility: visible; opacity: 1; pointer-events: auto;\n transition: opacity 0.1s ease-out, visibility 0s linear 0s;\n }\n .floating-modal-container.is-dragging { will-change: left, top; }\n .floating-modal-drag-handle {\n position: absolute; left: 50%; transform: translateX(-50%);\n top: 5px; width: calc(100% - 46px); min-width: 166px; height: 17px;\n z-index: 9999; transition: left 0.2s ease, right 0.2s ease;\n display: flex; justify-content: center; align-items: center;\n }\n .floating-modal-drag-handle svg g { fill: #A0A0A0; }\n .floating-modal-drag-handle:hover { cursor: grab; }\n .floating-modal-drag-handle:hover svg g { fill: #1f2937; }\n .floating-modal-drag-handle.is-dragging { cursor: grabbing; }\n .floating-modal-drag-handle.is-collapsed { top: 0px; }\n .frame-floating-modal { width: 100%; height: 100%; background: white; border: none; display: block; }\n ")
55269
+ textContent: `
55270
+ #${pendoContainerId} {
55271
+ display: none !important;
55272
+ }
55273
+ .frame-explanation {
55274
+ aspect-ratio: 16/9; overflow: hidden; min-height: 300px;
55275
+ width: 100vw; height: 100vh; background: transparent;
55276
+ position: fixed; bottom: 0; right: 0; z-index: 1; border: none;
55277
+ visibility: hidden; opacity: 0; pointer-events: none;
55278
+ transition: opacity 0.1s ease-out, visibility 0s linear 0.1s;
55279
+ display: none;
55280
+ }
55281
+ .frame-explanation.is-visible {
55282
+ z-index: 999999;
55283
+ visibility: visible; opacity: 1; pointer-events: auto;
55284
+ transition: opacity 0.1s ease-out, visibility 0s linear 0s;
55285
+ }
55286
+ .frame-explanation.is-exists {
55287
+ display: block !important;
55288
+ }
55289
+ .floating-modal-container {
55290
+ position: fixed; top: 20px; right: 20px; z-index: 500000;
55291
+ visibility: hidden; opacity: 0; pointer-events: none;
55292
+ transition: opacity 0.1s ease-out, visibility 0s linear 0.1s;
55293
+ border-radius: 8px; box-shadow: 0px 4px 12px 0px rgba(0,0,0,0.15);
55294
+ overflow: hidden; width: 384px; height: 176px;
55295
+ }
55296
+ .floating-modal-container.is-visible {
55297
+ visibility: visible; opacity: 1; pointer-events: auto;
55298
+ transition: opacity 0.1s ease-out, visibility 0s linear 0s;
55299
+ }
55300
+ .floating-modal-container.is-dragging { will-change: left, top; }
55301
+ .floating-modal-drag-handle {
55302
+ position: absolute; left: 50%; transform: translateX(-50%);
55303
+ top: 5px; width: calc(100% - 46px); min-width: 166px; height: 17px;
55304
+ z-index: 9999; transition: left 0.2s ease, right 0.2s ease;
55305
+ display: flex; justify-content: center; align-items: center;
55306
+ }
55307
+ .floating-modal-drag-handle svg g { fill: #A0A0A0; }
55308
+ .floating-modal-drag-handle:hover { cursor: grab; }
55309
+ .floating-modal-drag-handle:hover svg g { fill: #1f2937; }
55310
+ .floating-modal-drag-handle.is-dragging { cursor: grabbing; }
55311
+ .floating-modal-drag-handle.is-collapsed { top: 0px; }
55312
+ .frame-floating-modal { width: 100%; height: 100%; background: white; border: none; display: block; }
55313
+ `
55210
55314
  }, document.head);
55211
55315
  };
55212
- var getRecordIdFromUrl = function (recordRegex, log) {
55316
+ const getRecordIdFromUrl = (recordRegex, log = () => { }) => {
55213
55317
  var _a;
55214
- if (log === void 0) { log = function () { }; }
55215
- var match = window.location.href.match(recordRegex);
55216
- var recordId = (_a = match === null || match === void 0 ? void 0 : match[1]) !== null && _a !== void 0 ? _a : null;
55217
- log("[predict] recordId found: ".concat(recordId));
55318
+ const match = window.location.href.match(recordRegex);
55319
+ const recordId = (_a = match === null || match === void 0 ? void 0 : match[1]) !== null && _a !== void 0 ? _a : null;
55320
+ log(`[predict] recordId found: ${recordId}`);
55218
55321
  return recordId;
55219
55322
  };
55220
- var safeStringify = function (value, fallback) {
55323
+ const safeStringify = (value, fallback) => {
55221
55324
  try {
55222
55325
  return JSON.stringify(value);
55223
55326
  }
@@ -55225,22 +55328,21 @@ var safeStringify = function (value, fallback) {
55225
55328
  return fallback !== null && fallback !== void 0 ? fallback : '';
55226
55329
  }
55227
55330
  };
55228
- var safeParse = function (value, fallback, log) {
55229
- if (log === void 0) { log = function () { }; }
55331
+ const safeParse = (value, fallback, log = () => { }) => {
55230
55332
  try {
55231
55333
  return JSON.parse(value);
55232
55334
  }
55233
55335
  catch (error) {
55234
- log("[predict] JSON parse error: ".concat(error));
55336
+ log(`[predict] JSON parse error: ${error}`);
55235
55337
  return fallback;
55236
55338
  }
55237
55339
  };
55238
- var buildQueryParams = function (params) {
55239
- var urlParams = new URLSearchParams();
55240
- var entries = Object.entries(params);
55340
+ const buildQueryParams = (params) => {
55341
+ const urlParams = new URLSearchParams();
55342
+ const entries = Object.entries(params);
55241
55343
  urlParams.set('pluginVersion', pluginVersion);
55242
- for (var i = 0; i < entries.length; i++) {
55243
- var _a = entries[i], key = _a[0], value = _a[1];
55344
+ for (let i = 0; i < entries.length; i++) {
55345
+ const [key, value] = entries[i];
55244
55346
  if (value != null) {
55245
55347
  urlParams.set(key, typeof value === 'object' ? safeStringify(value) : String(value));
55246
55348
  }
@@ -55248,17 +55350,17 @@ var buildQueryParams = function (params) {
55248
55350
  return urlParams.toString();
55249
55351
  };
55250
55352
  // ----- Drag & Drop -----
55251
- var setupDragAndDrop = function (handle, container, frameTargetOrigin) {
55252
- var isDragging = false;
55253
- var hasMoved = false;
55254
- var isCollapsed = false;
55255
- var startX = 0;
55256
- var startY = 0;
55257
- var initialLeft = 0;
55258
- var initialTop = 0;
55259
- var rafId = null;
55260
- var iframe = container.querySelector('iframe');
55261
- var onMouseDown = function (e) {
55353
+ const setupDragAndDrop = (handle, container, frameTargetOrigin) => {
55354
+ let isDragging = false;
55355
+ let hasMoved = false;
55356
+ let isCollapsed = false;
55357
+ let startX = 0;
55358
+ let startY = 0;
55359
+ let initialLeft = 0;
55360
+ let initialTop = 0;
55361
+ let rafId = null;
55362
+ const iframe = container.querySelector('iframe');
55363
+ const onMouseDown = (e) => {
55262
55364
  if (e.button !== 0)
55263
55365
  return;
55264
55366
  e.preventDefault();
@@ -55268,35 +55370,35 @@ var setupDragAndDrop = function (handle, container, frameTargetOrigin) {
55268
55370
  container.classList.add('is-dragging');
55269
55371
  if (iframe)
55270
55372
  iframe.style.pointerEvents = 'none';
55271
- var rect = container.getBoundingClientRect();
55373
+ const rect = container.getBoundingClientRect();
55272
55374
  initialLeft = rect.left;
55273
55375
  initialTop = rect.top;
55274
- container.style.left = "".concat(initialLeft, "px");
55376
+ container.style.left = `${initialLeft}px`;
55275
55377
  container.style.right = 'auto';
55276
55378
  startX = e.clientX;
55277
55379
  startY = e.clientY;
55278
55380
  document.addEventListener('mousemove', onMouseMove);
55279
55381
  document.addEventListener('mouseup', onMouseUp);
55280
55382
  };
55281
- var onMouseMove = function (e) {
55383
+ const onMouseMove = (e) => {
55282
55384
  if (!isDragging)
55283
55385
  return;
55284
- var deltaX = e.clientX - startX;
55285
- var deltaY = e.clientY - startY;
55386
+ const deltaX = e.clientX - startX;
55387
+ const deltaY = e.clientY - startY;
55286
55388
  if (Math.abs(deltaX) > DRAG_THRESHOLD || Math.abs(deltaY) > DRAG_THRESHOLD) {
55287
55389
  hasMoved = true;
55288
55390
  }
55289
55391
  if (rafId)
55290
55392
  cancelAnimationFrame(rafId);
55291
- rafId = requestAnimationFrame(function () {
55292
- var rect = container.getBoundingClientRect();
55293
- var newLeft = Math.max(0, Math.min(initialLeft + deltaX, window.innerWidth - rect.width));
55294
- var newTop = Math.max(0, Math.min(initialTop + deltaY, window.innerHeight - rect.height));
55295
- container.style.left = "".concat(newLeft, "px");
55296
- container.style.top = "".concat(newTop, "px");
55393
+ rafId = requestAnimationFrame(() => {
55394
+ const rect = container.getBoundingClientRect();
55395
+ const newLeft = Math.max(0, Math.min(initialLeft + deltaX, window.innerWidth - rect.width));
55396
+ const newTop = Math.max(0, Math.min(initialTop + deltaY, window.innerHeight - rect.height));
55397
+ container.style.left = `${newLeft}px`;
55398
+ container.style.top = `${newTop}px`;
55297
55399
  });
55298
55400
  };
55299
- var onMouseUp = function (e) {
55401
+ const onMouseUp = (e) => {
55300
55402
  var _a;
55301
55403
  if (!isDragging)
55302
55404
  return;
@@ -55314,12 +55416,12 @@ var setupDragAndDrop = function (handle, container, frameTargetOrigin) {
55314
55416
  (_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage({ type: 'TRIGGER_EXPAND' }, frameTargetOrigin);
55315
55417
  }
55316
55418
  };
55317
- handle.setCollapsedState = function (collapsed) {
55419
+ handle.setCollapsedState = (collapsed) => {
55318
55420
  isCollapsed = collapsed;
55319
55421
  handle.classList.toggle('is-collapsed', collapsed);
55320
55422
  };
55321
55423
  handle.addEventListener('mousedown', onMouseDown);
55322
- handle.cleanup = function () {
55424
+ handle.cleanup = () => {
55323
55425
  handle.removeEventListener('mousedown', onMouseDown);
55324
55426
  document.removeEventListener('mousemove', onMouseMove);
55325
55427
  document.removeEventListener('mouseup', onMouseUp);
@@ -55329,13 +55431,12 @@ var setupDragAndDrop = function (handle, container, frameTargetOrigin) {
55329
55431
  return handle;
55330
55432
  };
55331
55433
  // ----- Explanation Iframe Creation -----
55332
- var createExplanationIframe = function (_a) {
55333
- var _b;
55334
- var analysisId = _a.analysisId, recordId = _a.recordId, configuration = _a.configuration, predictBaseUrl = _a.predictBaseUrl, _c = _a.wrapperBase, wrapperBase = _c === void 0 ? '' : _c;
55335
- var frameId = "frameExplanation-".concat(analysisId);
55336
- (_b = $(frameId)) === null || _b === void 0 ? void 0 : _b.remove();
55337
- var base = "".concat(predictBaseUrl, "/external/analysis/").concat(analysisId, "/prediction/drilldown/").concat(recordId);
55338
- var params = buildQueryParams(configuration);
55434
+ const createExplanationIframe = ({ analysisId, recordId, configuration, predictBaseUrl, wrapperBase = '' }) => {
55435
+ var _a;
55436
+ const frameId = `frameExplanation-${analysisId}`;
55437
+ (_a = $(frameId)) === null || _a === void 0 ? void 0 : _a.remove();
55438
+ const base = `${predictBaseUrl}/external/analysis/${analysisId}/prediction/drilldown/${recordId}`;
55439
+ const params = buildQueryParams(configuration);
55339
55440
  createElement('iframe', {
55340
55441
  id: frameId,
55341
55442
  className: 'frame-explanation',
@@ -55343,24 +55444,28 @@ var createExplanationIframe = function (_a) {
55343
55444
  loading: 'lazy',
55344
55445
  referrerPolicy: 'strict-origin-when-cross-origin',
55345
55446
  allowFullscreen: true,
55346
- src: buildFrameSrc("".concat(base, "?").concat(params), wrapperBase)
55447
+ src: buildFrameSrc(`${base}?${params}`, wrapperBase)
55347
55448
  }, document.body);
55348
55449
  };
55349
55450
  // ----- Floating Modal Creation -----
55350
- var createFloatingModal = function (_a) {
55351
- var _b;
55352
- var recordId = _a.recordId, configuration = _a.configuration, predictBaseUrl = _a.predictBaseUrl, _c = _a.wrapperBase, wrapperBase = _c === void 0 ? '' : _c;
55353
- var flatIds = (_b = configuration.analysisIds) === null || _b === void 0 ? void 0 : _b.flat(Infinity);
55354
- for (var i = 0; i < flatIds.length; i++) {
55355
- createExplanationIframe({ analysisId: flatIds[i], recordId: recordId, configuration: configuration, predictBaseUrl: predictBaseUrl, wrapperBase: wrapperBase });
55356
- }
55357
- var container = createElement('div', { id: 'floatingModalContainer', className: 'floating-modal-container' }, document.body);
55358
- var dragHandle = createElement('div', {
55451
+ const createFloatingModal = ({ recordId, configuration, predictBaseUrl, wrapperBase = '' }) => {
55452
+ var _a;
55453
+ const flatIds = (_a = configuration.analysisIds) === null || _a === void 0 ? void 0 : _a.flat(Infinity);
55454
+ for (let i = 0; i < flatIds.length; i++) {
55455
+ createExplanationIframe({ analysisId: flatIds[i], recordId, configuration, predictBaseUrl, wrapperBase });
55456
+ }
55457
+ const container = createElement('div', { id: 'floatingModalContainer', className: 'floating-modal-container' }, document.body);
55458
+ const dragHandle = createElement('div', {
55359
55459
  className: 'floating-modal-drag-handle',
55360
- innerHTML: "<svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" xmlns=\"http://www.w3.org/2000/svg\">\n <g fill=\"#EBEBEB\">\n <circle cx=\"3.33\" cy=\"6\" r=\"1.5\"/><circle cx=\"8\" cy=\"6\" r=\"1.5\"/><circle cx=\"12.67\" cy=\"6\" r=\"1.5\"/>\n <circle cx=\"3.33\" cy=\"10\" r=\"1.5\"/><circle cx=\"8\" cy=\"10\" r=\"1.5\"/><circle cx=\"12.67\" cy=\"10\" r=\"1.5\"/>\n </g>\n </svg>"
55460
+ innerHTML: `<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
55461
+ <g fill="#EBEBEB">
55462
+ <circle cx="3.33" cy="6" r="1.5"/><circle cx="8" cy="6" r="1.5"/><circle cx="12.67" cy="6" r="1.5"/>
55463
+ <circle cx="3.33" cy="10" r="1.5"/><circle cx="8" cy="10" r="1.5"/><circle cx="12.67" cy="10" r="1.5"/>
55464
+ </g>
55465
+ </svg>`
55361
55466
  }, container);
55362
- var baseUrl = "".concat(predictBaseUrl, "/external/analysis/prediction/summary/").concat(recordId);
55363
- var params = buildQueryParams(configuration);
55467
+ const baseUrl = `${predictBaseUrl}/external/analysis/prediction/summary/${recordId}`;
55468
+ const params = buildQueryParams(configuration);
55364
55469
  createElement('iframe', {
55365
55470
  id: 'frameFloatingModal',
55366
55471
  className: 'frame-floating-modal',
@@ -55368,133 +55473,130 @@ var createFloatingModal = function (_a) {
55368
55473
  referrerPolicy: 'strict-origin-when-cross-origin',
55369
55474
  allowFullscreen: true,
55370
55475
  title: 'Floating Modal',
55371
- src: buildFrameSrc("".concat(baseUrl, "?").concat(params), wrapperBase)
55476
+ src: buildFrameSrc(`${baseUrl}?${params}`, wrapperBase)
55372
55477
  }, container);
55373
- var frameTargetOrigin = getFrameTargetOrigin(wrapperBase, predictBaseUrl);
55478
+ const frameTargetOrigin = getFrameTargetOrigin(wrapperBase, predictBaseUrl);
55374
55479
  container.dragHandle = setupDragAndDrop(dragHandle, container, frameTargetOrigin);
55375
- return function () {
55480
+ return () => {
55376
55481
  var _a, _b;
55377
55482
  (_b = (_a = container.dragHandle) === null || _a === void 0 ? void 0 : _a.cleanup) === null || _b === void 0 ? void 0 : _b.call(_a);
55378
55483
  container.remove();
55379
- for (var i = 0; i < flatIds.length; i++) {
55380
- var frame = $("frameExplanation-".concat(flatIds[i]));
55484
+ for (let i = 0; i < flatIds.length; i++) {
55485
+ const frame = $(`frameExplanation-${flatIds[i]}`);
55381
55486
  if (frame)
55382
55487
  frame.remove();
55383
55488
  }
55384
55489
  };
55385
55490
  };
55386
- var setupMessageListener = function (_a) {
55387
- var token = _a.token, forceAccountId = _a.forceAccountId, cleanup = _a.cleanup, pendo = _a.pendo, predictBaseUrl = _a.predictBaseUrl, _b = _a.wrapperBase, wrapperBase = _b === void 0 ? '' : _b;
55388
- var frameTargetOrigin = getFrameTargetOrigin(wrapperBase, predictBaseUrl);
55389
- var isAllowedOrigin = function (origin) { return origin === predictBaseUrl || (!!wrapperBase && origin === wrapperBase); };
55390
- var messageHandler = function (_a) {
55391
- var _b;
55392
- var origin = _a.origin, data = _a.data;
55491
+ const setupMessageListener = ({ token, forceAccountId, cleanup, pendo, predictBaseUrl, wrapperBase = '' }) => {
55492
+ const frameTargetOrigin = getFrameTargetOrigin(wrapperBase, predictBaseUrl);
55493
+ const isAllowedOrigin = (origin) => origin === predictBaseUrl || (!!wrapperBase && origin === wrapperBase);
55494
+ const messageHandler = ({ origin, data }) => {
55495
+ var _a;
55393
55496
  if (!isAllowedOrigin(origin) || !data || typeof data !== 'object')
55394
55497
  return;
55395
- var _c = data, type = _c.type, analysisId = _c.analysisId, height = _c.height, width = _c.width;
55396
- var explanationFrame = $("frameExplanation-".concat(analysisId));
55397
- var floatingModal = $('floatingModalContainer');
55398
- var setFloatingModalSize = function () {
55498
+ const { type, analysisId, height, width } = data;
55499
+ const explanationFrame = $(`frameExplanation-${analysisId}`);
55500
+ const floatingModal = $('floatingModalContainer');
55501
+ const setFloatingModalSize = () => {
55399
55502
  if (floatingModal) {
55400
- floatingModal.style.height = "".concat(height, "px");
55401
- floatingModal.style.width = "".concat(width, "px");
55503
+ floatingModal.style.height = `${height}px`;
55504
+ floatingModal.style.width = `${width}px`;
55402
55505
  }
55403
55506
  };
55404
- var setFloatingModalCollapsedState = function (collapsed) {
55507
+ const setFloatingModalCollapsedState = (collapsed) => {
55405
55508
  var _a, _b;
55406
55509
  if (floatingModal)
55407
55510
  (_b = (_a = floatingModal.dragHandle) === null || _a === void 0 ? void 0 : _a.setCollapsedState) === null || _b === void 0 ? void 0 : _b.call(_a, collapsed);
55408
55511
  };
55409
- var actions = {
55410
- MODAL_INITIALIZED: function () {
55512
+ const actions = {
55513
+ MODAL_INITIALIZED: () => {
55411
55514
  var _a, _b, _c;
55412
- var iframe = $('frameFloatingModal');
55515
+ const iframe = $('frameFloatingModal');
55413
55516
  if (iframe) {
55414
- var idToken = null;
55415
- var extensionAPIKeys = null;
55416
- var retrieveIDPToken = pendo.getConfigValue('retrieveIDPToken');
55517
+ let idToken = null;
55518
+ let extensionAPIKeys = null;
55519
+ const retrieveIDPToken = pendo.getConfigValue('retrieveIDPToken');
55417
55520
  if (pendo._.isFunction(retrieveIDPToken)) {
55418
- var result = retrieveIDPToken();
55521
+ const result = retrieveIDPToken();
55419
55522
  if (result) {
55420
55523
  idToken = result.idToken;
55421
55524
  extensionAPIKeys = result.extensionAPIKeys;
55422
55525
  }
55423
55526
  }
55424
- var visitorId = (_a = pendo === null || pendo === void 0 ? void 0 : pendo.getVisitorId) === null || _a === void 0 ? void 0 : _a.call(pendo);
55425
- var accountId = forceAccountId !== null && forceAccountId !== void 0 ? forceAccountId : (_b = pendo === null || pendo === void 0 ? void 0 : pendo.getAccountId) === null || _b === void 0 ? void 0 : _b.call(pendo);
55426
- (_c = iframe.contentWindow) === null || _c === void 0 ? void 0 : _c.postMessage({ type: 'TOKEN_RECEIVED', token: token, idToken: idToken, extensionAPIKeys: extensionAPIKeys, visitorId: visitorId, accountId: accountId }, frameTargetOrigin);
55527
+ const visitorId = (_a = pendo === null || pendo === void 0 ? void 0 : pendo.getVisitorId) === null || _a === void 0 ? void 0 : _a.call(pendo);
55528
+ const accountId = forceAccountId !== null && forceAccountId !== void 0 ? forceAccountId : (_b = pendo === null || pendo === void 0 ? void 0 : pendo.getAccountId) === null || _b === void 0 ? void 0 : _b.call(pendo);
55529
+ (_c = iframe.contentWindow) === null || _c === void 0 ? void 0 : _c.postMessage({ type: 'TOKEN_RECEIVED', token, idToken, extensionAPIKeys, visitorId, accountId }, frameTargetOrigin);
55427
55530
  }
55428
55531
  },
55429
- OPEN_EXPLANATION: function () {
55532
+ OPEN_EXPLANATION: () => {
55430
55533
  var _a;
55431
55534
  explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.add('is-visible');
55432
55535
  (_a = explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(data, frameTargetOrigin);
55433
55536
  },
55434
- CLOSE_EXPLANATION: function () { return explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.remove('is-visible'); },
55435
- AUTH_ERROR_EXPLANATION: function () {
55537
+ CLOSE_EXPLANATION: () => explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.remove('is-visible'),
55538
+ AUTH_ERROR_EXPLANATION: () => {
55436
55539
  explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.remove('is-visible');
55437
- var iframe = $('frameFloatingModal');
55540
+ const iframe = $('frameFloatingModal');
55438
55541
  // eslint-disable-next-line no-self-assign
55439
55542
  if (iframe)
55440
55543
  iframe.src = iframe.src;
55441
55544
  },
55442
- DATA_READY: function () {
55545
+ DATA_READY: () => {
55443
55546
  floatingModal === null || floatingModal === void 0 ? void 0 : floatingModal.classList.add('is-visible');
55444
55547
  setFloatingModalSize();
55445
55548
  // Use analysisIds from the message data if available, otherwise use all IDs
55446
- var idsToShow = data.analysisIds || [];
55447
- for (var i = 0; i < idsToShow.length; i++) {
55448
- var frame = $("frameExplanation-".concat(idsToShow[i]));
55549
+ const idsToShow = data.analysisIds || [];
55550
+ for (let i = 0; i < idsToShow.length; i++) {
55551
+ const frame = $(`frameExplanation-${idsToShow[i]}`);
55449
55552
  if (frame)
55450
55553
  frame.classList.add('is-exists');
55451
55554
  }
55452
55555
  },
55453
- AUTH_ERROR: function () {
55556
+ AUTH_ERROR: () => {
55454
55557
  floatingModal === null || floatingModal === void 0 ? void 0 : floatingModal.classList.add('is-visible');
55455
55558
  setFloatingModalSize();
55456
55559
  },
55457
55560
  CLOSE_FLOATING_MODAL: cleanup,
55458
- EXPAND_FLOATING_MODAL: function () {
55561
+ EXPAND_FLOATING_MODAL: () => {
55459
55562
  setFloatingModalSize();
55460
55563
  setFloatingModalCollapsedState(false);
55461
55564
  },
55462
- COLLAPSE_FLOATING_MODAL: function () {
55565
+ COLLAPSE_FLOATING_MODAL: () => {
55463
55566
  setFloatingModalSize();
55464
55567
  setFloatingModalCollapsedState(true);
55465
55568
  }
55466
55569
  };
55467
55570
  if (type && type in actions) {
55468
- (_b = actions === null || actions === void 0 ? void 0 : actions[type]) === null || _b === void 0 ? void 0 : _b.call(actions);
55571
+ (_a = actions === null || actions === void 0 ? void 0 : actions[type]) === null || _a === void 0 ? void 0 : _a.call(actions);
55469
55572
  }
55470
55573
  };
55471
55574
  window.addEventListener('message', messageHandler);
55472
- return function () { return window.removeEventListener('message', messageHandler); };
55575
+ return () => window.removeEventListener('message', messageHandler);
55473
55576
  };
55474
- var predictGuidesScript = function (_a) {
55475
- var _b;
55476
- var step = _a.step, pendo = _a.pendo, cleanupArray = _a.cleanupArray, cleanup = _a.cleanup, log = _a.log, designerServer = _a.designerServer;
55577
+ const predictGuidesScript = ({ step, pendo, cleanupArray, cleanup, log, designerServer }) => {
55578
+ var _a;
55477
55579
  log('[predict] initializing');
55478
55580
  // Before anything else, inject styles so that the guide will be hidden
55479
- var pendoContainerId = step === null || step === void 0 ? void 0 : step.containerId;
55581
+ const pendoContainerId = step === null || step === void 0 ? void 0 : step.containerId;
55480
55582
  injectStyles(pendoContainerId, log);
55481
55583
  if (cleanupArray.length > 0) {
55482
55584
  log('[predict] cleanupArray is not empty');
55483
55585
  return;
55484
55586
  }
55485
55587
  // ----- Extract Configuration -----
55486
- var guideButton = (_b = step.guideElement.find(GUIDE_BUTTON_IDENTIFIER)) === null || _b === void 0 ? void 0 : _b[0];
55588
+ const guideButton = (_a = step.guideElement.find(GUIDE_BUTTON_IDENTIFIER)) === null || _a === void 0 ? void 0 : _a[0];
55487
55589
  if (!guideButton) {
55488
55590
  log('[predict] no guide button found, aborting');
55489
55591
  return;
55490
55592
  }
55491
- var _c = safeParse(guideButton.textContent, {}, log), token = _c.token, configuration = __rest(_c, ["token"]);
55593
+ const _b = safeParse(guideButton.textContent, {}, log), { token } = _b, configuration = __rest(_b, ["token"]);
55492
55594
  if (!configuration || !token) {
55493
55595
  log('[predict] no configuration found, aborting');
55494
55596
  return;
55495
55597
  }
55496
- var recordRegex = new RegExp("/".concat(configuration.recordRegexName, "/([a-zA-Z0-9]+)(?:/|$)"));
55497
- var recordId = getRecordIdFromUrl(recordRegex, log);
55598
+ const recordRegex = new RegExp(`/${configuration.recordRegexName}/([a-zA-Z0-9]+)(?:/|$)`);
55599
+ const recordId = getRecordIdFromUrl(recordRegex, log);
55498
55600
  if (!recordId) {
55499
55601
  log('[predict] no recordId found in URL, aborting');
55500
55602
  return;
@@ -55503,11 +55605,11 @@ var predictGuidesScript = function (_a) {
55503
55605
  log('[predict] no designerServer found, aborting');
55504
55606
  return;
55505
55607
  }
55506
- var predictBaseUrl = getPredictBaseUrl(designerServer);
55507
- var wrapperBase = getFrameWrapperBase(pendo);
55508
- log("[predict] predictBaseUrl: ".concat(predictBaseUrl).concat(wrapperBase ? ", wrapping via ".concat(wrapperBase) : ''));
55509
- cleanupArray.push(setupMessageListener({ token: token, forceAccountId: configuration === null || configuration === void 0 ? void 0 : configuration.forceAccountId, cleanup: cleanup, pendo: pendo, predictBaseUrl: predictBaseUrl, wrapperBase: wrapperBase }));
55510
- cleanupArray.push(createFloatingModal({ recordId: recordId, configuration: configuration, predictBaseUrl: predictBaseUrl, wrapperBase: wrapperBase }));
55608
+ const predictBaseUrl = getPredictBaseUrl(designerServer);
55609
+ const wrapperBase = getFrameWrapperBase(pendo);
55610
+ log(`[predict] predictBaseUrl: ${predictBaseUrl}${wrapperBase ? `, wrapping via ${wrapperBase}` : ''}`);
55611
+ cleanupArray.push(setupMessageListener({ token, forceAccountId: configuration === null || configuration === void 0 ? void 0 : configuration.forceAccountId, cleanup, pendo, predictBaseUrl, wrapperBase }));
55612
+ cleanupArray.push(createFloatingModal({ recordId, configuration, predictBaseUrl, wrapperBase }));
55511
55613
  };
55512
55614
 
55513
55615
  const PredictGuides = () => {