@pendo/agent 2.322.1 → 2.323.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3967,8 +3967,8 @@ let SERVER = '';
3967
3967
  let ASSET_HOST = '';
3968
3968
  let ASSET_PATH = '';
3969
3969
  let DESIGNER_SERVER = '';
3970
- let VERSION = '2.322.1_';
3971
- let PACKAGE_VERSION = '2.322.1';
3970
+ let VERSION = '2.323.1_';
3971
+ let PACKAGE_VERSION = '2.323.1';
3972
3972
  let LOADER = 'xhr';
3973
3973
  /* eslint-enable web-sdk-eslint-rules/no-gulp-env-references */
3974
3974
  /**
@@ -4493,7 +4493,9 @@ function enableCookies(enabled) {
4493
4493
  var getCookie = function (name) {
4494
4494
  var result;
4495
4495
  // eslint-disable-next-line no-cond-assign
4496
- return (result = new RegExp('(^|; )' + name + '=([^;]*)').exec(document.cookie)) ? decodeURIComponent(result[2]) : null;
4496
+ return (result = new RegExp('(^|; )' + name + '=([^;]*)').exec(document.cookie))
4497
+ ? decodeURIComponent(result[2])
4498
+ : null;
4497
4499
  };
4498
4500
  var setCookie = function (name, val, millisToExpire, isSecure) {
4499
4501
  if (!areCookiesEnabled)
@@ -4509,7 +4511,14 @@ var setCookie = function (name, val, millisToExpire, isSecure) {
4509
4511
  const canSecure = document.location.protocol === 'https:' || isSecure;
4510
4512
  const sameSite = canSecure ? 'None' : 'Strict';
4511
4513
  expireDate.setTime(expireDate.getTime() + cookieTTL);
4512
- var cookie = name + '=' + encodeURIComponent(val) + (millisToExpire ? ';expires=' + expireDate.toUTCString() : '') + '; path=/' + (canSecure ? ';secure' : '') + '; SameSite=' + sameSite;
4514
+ var cookie = name +
4515
+ '=' +
4516
+ encodeURIComponent(val) +
4517
+ (millisToExpire ? ';expires=' + expireDate.toUTCString() : '') +
4518
+ '; path=/' +
4519
+ (canSecure ? ';secure' : '') +
4520
+ '; SameSite=' +
4521
+ sameSite;
4513
4522
  if (cookieDomain) {
4514
4523
  cookie += ';domain=' + cookieDomain;
4515
4524
  }
@@ -4623,9 +4632,9 @@ class StorageRegistry {
4623
4632
  * moving forward with new Agent refactoring and modularizing the code base.
4624
4633
  */
4625
4634
  /*
4626
- The majority of prior existing functionality still remains where it was. The
4627
- core Storage api is now in `agentStorage` with the original references still in place.
4628
- */
4635
+ The majority of prior existing functionality still remains where it was. The
4636
+ core Storage api is now in `agentStorage` with the original references still in place.
4637
+ */
4629
4638
  var agentStorage = (function () {
4630
4639
  const registry = new StorageRegistry();
4631
4640
  function wrapStorageWriteMethod(writeMethod, registryMethod) {
@@ -4657,18 +4666,18 @@ var agentStorage = (function () {
4657
4666
  return true;
4658
4667
  }
4659
4668
  catch (e) {
4660
- return e instanceof DOMException && (
4661
- // everything except Firefox
4662
- e.code === 22 ||
4663
- // Firefox
4664
- e.code === 1014 ||
4665
- // test name field too, because code might not be present
4669
+ return (e instanceof DOMException &&
4666
4670
  // everything except Firefox
4667
- e.name === 'QuotaExceededError' ||
4668
- // Firefox
4669
- e.name === 'NS_ERROR_DOM_QUOTA_REACHED') &&
4671
+ (e.code === 22 ||
4672
+ // Firefox
4673
+ e.code === 1014 ||
4674
+ // test name field too, because code might not be present
4675
+ // everything except Firefox
4676
+ e.name === 'QuotaExceededError' ||
4677
+ // Firefox
4678
+ e.name === 'NS_ERROR_DOM_QUOTA_REACHED') &&
4670
4679
  // acknowledge QuotaExceededError only if there's something already stored
4671
- (storage && storage.length !== 0);
4680
+ (storage && storage.length !== 0));
4672
4681
  }
4673
4682
  });
4674
4683
  function resetCache(mFn) {
@@ -4724,10 +4733,19 @@ var agentStorage = (function () {
4724
4733
  try {
4725
4734
  // JSON parsables: Numbers, Booleans, and Objects
4726
4735
  var obj = JSON.parse(value);
4727
- if (!obj.ttl) {
4736
+ // value is either a TimedStorageItem or just a PlainOldStorageItem
4737
+ // a TimedStorageItem will have both a ttl and value property
4738
+ const isTimedStorageItem = obj !== null && typeof obj === 'object' && 'ttl' in obj && 'value' in obj;
4739
+ if (!isTimedStorageItem) {
4728
4740
  return value;
4729
4741
  }
4730
- else if (obj.ttl < new Date().getTime()) {
4742
+ // ttl must always be an unsigned, non-zero number (a positive,
4743
+ // finite epoch-millis timestamp). Anything else (null, NaN, a
4744
+ // string, a negative number, 0, etc.) is treated as a missing /
4745
+ // invalid ttl and we fall through to returning the stored value
4746
+ // rather than discarding it as expired.
4747
+ const hasValidTtl = typeof obj.ttl === 'number' && isFinite(obj.ttl) && obj.ttl > 0;
4748
+ if (hasValidTtl && obj.ttl < new Date().getTime()) {
4731
4749
  return null;
4732
4750
  }
4733
4751
  return String(obj.value || obj);
@@ -4813,6 +4831,7 @@ var agentStorage = (function () {
4813
4831
  const wrappedPendoLocalStorage = _.extend({}, pendoLocalStorage$4);
4814
4832
  wrappedPendoLocalStorage.setItem = wrapStorageWriteMethod(wrappedPendoLocalStorage.setItem, 'hasLocal');
4815
4833
  return {
4834
+ /* API */
4816
4835
  read,
4817
4836
  write: wrapStorageWriteMethod(write, 'hasLocal'),
4818
4837
  clear,
@@ -11672,7 +11691,7 @@ function isTrustedOrigin(host) {
11672
11691
  return true;
11673
11692
  // Domains that Pendo owns, will be swapped in by build patches
11674
11693
  const patterns = [
11675
- /^https:\/\/(adopt\.)?((us1)\.)?(app|via|adopt|cdn|oem)(\.(au|eu|gov|hsbc|jpn))?\.pendo\.io$/,
11694
+ /^https:\/\/(adopt\.)?((us1)\.)?(app|via|adopt|cdn|oem|novus-api|novus)(\.(au|eu|gov|hsbc|jpn))?\.pendo\.io$/,
11676
11695
  /^https:\/\/([0-9]{8}t[0-9]{4}-dot-)pendo-(au|eu|govramp|hsbc|io|jp-prod|us1)\.appspot\.com$/,
11677
11696
  /^https:\/\/hotfix-(ops|app)-([0-9]+-dot-)pendo-(au|eu|govramp|hsbc|io|jp-prod|us1)\.appspot\.com$/,
11678
11697
  /^https:\/\/pendo-(au|eu|govramp|hsbc|io|jp-prod|us1)-static\.storage\.googleapis\.com$/,
@@ -16046,6 +16065,12 @@ const TOOLTIP_CONSTANTS = {
16046
16065
  BORDER_CARET: 10
16047
16066
  }
16048
16067
  };
16068
+ const HYPHEN_BORDER_BY_SIDE = {
16069
+ Top: 'border-top',
16070
+ Right: 'border-right',
16071
+ Bottom: 'border-bottom',
16072
+ Left: 'border-left'
16073
+ };
16049
16074
  var BuildingBlockTooltips = (function () {
16050
16075
  return {
16051
16076
  createBBTooltip,
@@ -16190,7 +16215,7 @@ var BuildingBlockTooltips = (function () {
16190
16215
  guideContainer.style.position = 'absolute';
16191
16216
  }
16192
16217
  if (caretDimensions.height && caretDimensions.width) {
16193
- buildTooltipCaret(tooltipDiv, tooltipDimensions, caretDimensions, elementPos);
16218
+ buildTooltipCaret(tooltipDiv, tooltipDimensions, caretDimensions);
16194
16219
  }
16195
16220
  var inheritedZIndex = TOOLTIP_CONSTANTS.Z_INDEX.DEFAULT;
16196
16221
  if (guideContainer && guideContainer.style && guideContainer.style['z-index']) {
@@ -16250,8 +16275,21 @@ var BuildingBlockTooltips = (function () {
16250
16275
  else if (tooltipDimensions.layoutDir === 'left') {
16251
16276
  tooltipDimensions.left -= caretSizes.height;
16252
16277
  }
16278
+ if (caretSizes.height && caretSizes.width) {
16279
+ populateCaretStyleMaps(tooltipDimensions, caretSizes, elementPos);
16280
+ }
16253
16281
  return tooltipDimensions;
16254
16282
  }
16283
+ function populateCaretStyleMaps(tooltipDimensions, caretSizes, elementPos) {
16284
+ tooltipDimensions.caret = {};
16285
+ if (tooltipDimensions.layoutDir === 'top' || tooltipDimensions.layoutDir === 'bottom') {
16286
+ _.extend(tooltipDimensions.caret, buildTopOrBottomCaretStyleMap(tooltipDimensions, caretSizes, elementPos));
16287
+ }
16288
+ if (tooltipDimensions.layoutDir === 'left' || tooltipDimensions.layoutDir === 'right') {
16289
+ _.extend(tooltipDimensions.caret, buildLeftOrRightCaretStyleMap(tooltipDimensions, caretSizes));
16290
+ }
16291
+ tooltipDimensions.caretBorder = buildBorderCaretStyleMap(tooltipDimensions.caret, caretSizes, tooltipDimensions.layoutDir);
16292
+ }
16255
16293
  function calculateVwRelativeToLayoutDir(guideContainer, tooltipContext) {
16256
16294
  const { elementPos, tooltipSizes, screenDimensions, caretDimensions, elementIsNotVisible } = tooltipContext;
16257
16295
  const caretFullWidth = (parseInt(caretDimensions.width, 10) || 0);
@@ -16481,51 +16519,51 @@ var BuildingBlockTooltips = (function () {
16481
16519
  caretDiv.setAttribute('class', 'pendo-tooltip-caret pendo-tooltip-caret--' + tooltipDimensions.layoutDir);
16482
16520
  caretDiv.style.position = 'absolute';
16483
16521
  caretDiv.style.zIndex = TOOLTIP_CONSTANTS.Z_INDEX.CARET;
16484
- updateCaretStyles(caretDiv, tooltipDimensions, caretDimensions, elementPos);
16522
+ updateCaretStyles(caretDiv, tooltipDimensions.caret);
16485
16523
  var guideDiv = tooltipDiv.find('#pendo-guide-container')[0].parentNode;
16486
16524
  guideDiv.appendChild(caretDiv);
16487
16525
  if (!caretDimensions.borderWidth)
16488
16526
  return;
16489
- var borderCaret = buildBorderCaret(caretDiv, caretDimensions, tooltipDimensions.layoutDir);
16527
+ var borderCaret = buildBorderCaret(caretDiv, tooltipDimensions);
16490
16528
  guideDiv.appendChild(borderCaret);
16491
16529
  }
16492
- function updateCaretStyles(caretDiv, tooltipDimensions, caretDimensions, elementPos) {
16493
- if (tooltipDimensions.layoutDir === 'top' || tooltipDimensions.layoutDir === 'bottom') {
16494
- styleTopOrBottomCaret(caretDiv, tooltipDimensions, caretDimensions, elementPos);
16495
- }
16496
- if (tooltipDimensions.layoutDir === 'left' || tooltipDimensions.layoutDir === 'right') {
16497
- styleLeftOrRightCaret(caretDiv, tooltipDimensions, caretDimensions);
16498
- }
16530
+ function updateCaretStyles(caretDiv, caretStyleMap) {
16531
+ _.extend(caretDiv.style, caretStyleMap);
16499
16532
  }
16500
16533
  function styleTopOrBottomCaret(caret, tooltipDimensions, caretDimensions, elementPos) {
16501
- caret.style['border-left'] = caretDimensions.width + 'px solid transparent';
16502
- caret.style['border-right'] = caretDimensions.width + 'px solid transparent';
16503
- caret.style.right = '';
16534
+ _.extend(caret.style, buildTopOrBottomCaretStyleMap(tooltipDimensions, caretDimensions, elementPos));
16535
+ return caret;
16536
+ }
16537
+ function buildTopOrBottomCaretStyleMap(tooltipDimensions, caretDimensions, elementPos) {
16538
+ var styleMap = {};
16539
+ styleMap['border-left'] = caretDimensions.width + 'px solid transparent';
16540
+ styleMap['border-right'] = caretDimensions.width + 'px solid transparent';
16541
+ styleMap.right = '';
16504
16542
  const caretOffset = calculateCaretOffset(elementPos, tooltipDimensions, caretDimensions, tooltipDimensions.hbias);
16505
- caret.style.left = caretOffset + 'px';
16543
+ styleMap.left = caretOffset + 'px';
16506
16544
  // Tooltip is below element, put caret on the top of the tooltip
16507
16545
  if (tooltipDimensions.layoutDir === 'bottom') {
16508
- caret.style['border-bottom'] = caretDimensions.height + 'px solid ' + caretDimensions.backgroundColor;
16509
- caret.style['border-top'] = '';
16546
+ styleMap['border-bottom'] = caretDimensions.height + 'px solid ' + caretDimensions.backgroundColor;
16547
+ styleMap['border-top'] = '';
16510
16548
  var caretTop = -1 * caretDimensions.height;
16511
16549
  if (caretDimensions.borderWidth) {
16512
16550
  caretTop = caretTop + caretDimensions.borderWidth;
16513
16551
  }
16514
- caret.style.top = caretTop + 'px';
16515
- caret.style.bottom = '';
16552
+ styleMap.top = caretTop + 'px';
16553
+ styleMap.bottom = '';
16516
16554
  }
16517
16555
  // Tooltip is above element, put caret on the bottom of the tooltip
16518
16556
  if (tooltipDimensions.layoutDir === 'top') {
16519
- caret.style['border-top'] = caretDimensions.height + 'px solid ' + caretDimensions.backgroundColor;
16520
- caret.style['border-bottom'] = '';
16557
+ styleMap['border-top'] = caretDimensions.height + 'px solid ' + caretDimensions.backgroundColor;
16558
+ styleMap['border-bottom'] = '';
16521
16559
  var caretBottom = -1 * caretDimensions.height;
16522
16560
  if (caretDimensions.borderWidth) {
16523
16561
  caretBottom = caretBottom + caretDimensions.borderWidth;
16524
16562
  }
16525
- caret.style.bottom = caretBottom + 'px';
16526
- caret.style.top = '';
16563
+ styleMap.bottom = caretBottom + 'px';
16564
+ styleMap.top = '';
16527
16565
  }
16528
- return caret;
16566
+ return styleMap;
16529
16567
  }
16530
16568
  function calculateCaretOffset(elementPos, tooltipDimensions, caretDimensions, bias) {
16531
16569
  if (elementPos && elementPos.left) {
@@ -16545,17 +16583,22 @@ var BuildingBlockTooltips = (function () {
16545
16583
  }
16546
16584
  }
16547
16585
  function styleLeftOrRightCaret(caret, tooltipDimensions, caretDimensions) {
16586
+ _.extend(caret.style, buildLeftOrRightCaretStyleMap(tooltipDimensions, caretDimensions));
16587
+ return caret;
16588
+ }
16589
+ function buildLeftOrRightCaretStyleMap(tooltipDimensions, caretDimensions) {
16548
16590
  var screenDimensions = getScreenDimensions();
16549
- caret.style['border-top'] = caretDimensions.width + 'px solid transparent';
16550
- caret.style['border-bottom'] = caretDimensions.width + 'px solid transparent';
16551
- caret.style.bottom = '';
16591
+ var styleMap = {};
16592
+ styleMap['border-top'] = caretDimensions.width + 'px solid transparent';
16593
+ styleMap['border-bottom'] = caretDimensions.width + 'px solid transparent';
16594
+ styleMap.bottom = '';
16552
16595
  if (tooltipDimensions.vbias === TOP) {
16553
16596
  var maxArrowTop = tooltipDimensions.height - caretDimensions.width * 2 - caretDimensions.offset - caretDimensions.borderWidth;
16554
- caret.style.top = maxArrowTop + 'px';
16597
+ styleMap.top = maxArrowTop + 'px';
16555
16598
  tooltipDimensions.top += caretDimensions.offset + caretDimensions.width + caretDimensions.borderWidth;
16556
16599
  }
16557
16600
  else if (tooltipDimensions.vbias === BOTTOM) {
16558
- caret.style.top = (caretDimensions.offset + caretDimensions.borderWidth) + 'px';
16601
+ styleMap.top = (caretDimensions.offset + caretDimensions.borderWidth) + 'px';
16559
16602
  tooltipDimensions.top -= caretDimensions.offset + caretDimensions.width + caretDimensions.borderWidth;
16560
16603
  if (tooltipDimensions.top + tooltipDimensions.height > screenDimensions.height) {
16561
16604
  tooltipDimensions.top = tooltipDimensions.top - (tooltipDimensions.top + tooltipDimensions.height - screenDimensions.height);
@@ -16563,40 +16606,64 @@ var BuildingBlockTooltips = (function () {
16563
16606
  tooltipDimensions.top = Math.max(0, tooltipDimensions.top);
16564
16607
  }
16565
16608
  else { // ASSUME CENTER
16566
- caret.style.top = (tooltipDimensions.height / 2) - caretDimensions.width + 'px';
16609
+ styleMap.top = (tooltipDimensions.height / 2) - caretDimensions.width + 'px';
16567
16610
  }
16568
16611
  // Tooltip is to the left of the element, put caret on the right of the tooltip
16569
16612
  if (tooltipDimensions.layoutDir === 'left') {
16570
- caret.style['border-left'] = caretDimensions.height + 'px solid ' + caretDimensions.backgroundColor;
16571
- caret.style['border-right'] = '';
16613
+ styleMap['border-left'] = caretDimensions.height + 'px solid ' + caretDimensions.backgroundColor;
16614
+ styleMap['border-right'] = '';
16572
16615
  var caretRight = -1 * caretDimensions.height;
16573
16616
  if (caretDimensions.borderWidth) {
16574
16617
  caretRight = caretRight + caretDimensions.borderWidth;
16575
16618
  }
16576
- caret.style.right = caretRight + 'px';
16577
- caret.style.left = '';
16619
+ styleMap.right = caretRight + 'px';
16620
+ styleMap.left = '';
16578
16621
  }
16579
16622
  // Tooltip is to the right of the element, put caret on the left of the tooltip
16580
16623
  if (tooltipDimensions.layoutDir === 'right') {
16581
- caret.style['border-right'] = caretDimensions.height + 'px solid ' + caretDimensions.backgroundColor;
16582
- caret.style['border-left'] = '';
16624
+ styleMap['border-right'] = caretDimensions.height + 'px solid ' + caretDimensions.backgroundColor;
16625
+ styleMap['border-left'] = '';
16583
16626
  var caretLeft = -1 * caretDimensions.height;
16584
16627
  if (caretDimensions.borderWidth) {
16585
16628
  caretLeft = caretLeft + caretDimensions.borderWidth;
16586
16629
  }
16587
- caret.style.left = caretLeft + 'px';
16588
- caret.style.right = '';
16630
+ styleMap.left = caretLeft + 'px';
16631
+ styleMap.right = '';
16589
16632
  }
16590
- return caret;
16633
+ return styleMap;
16591
16634
  }
16592
- function buildBorderCaret(caret, caretDimensions, tooltipLayoutDirection) {
16635
+ function buildBorderCaret(caret, tooltipDimensions) {
16593
16636
  var borderCaret = caret.cloneNode();
16594
16637
  borderCaret.setAttribute('class', 'pendo-tooltip-caret-border');
16595
16638
  borderCaret.style.zIndex = TOOLTIP_CONSTANTS.Z_INDEX.BORDER_CARET;
16596
- updateBorderCaretStyles(borderCaret, caretDimensions, tooltipLayoutDirection, caret);
16639
+ updateCaretStyles(borderCaret, tooltipDimensions.caretBorder);
16597
16640
  return borderCaret;
16598
16641
  }
16599
- function updateBorderCaretStyles(borderCaret, caretDimensions, tooltipLayoutDirection, caretDiv) {
16642
+ function borderColorFromCaretStyleMap(caretMap, borderColorKey, hyphenKey) {
16643
+ if (caretMap[borderColorKey]) {
16644
+ return caretMap[borderColorKey];
16645
+ }
16646
+ var shorthand = caretMap[hyphenKey];
16647
+ if (!shorthand) {
16648
+ return '';
16649
+ }
16650
+ if (/transparent/i.test(shorthand)) {
16651
+ return 'transparent';
16652
+ }
16653
+ var solidIdx = shorthand.indexOf('solid');
16654
+ if (solidIdx === -1) {
16655
+ return '';
16656
+ }
16657
+ return shorthand.slice(solidIdx + 5).trim();
16658
+ }
16659
+ function borderWidthFromCaretStyleMap(caretMap, borderWidthKey, hyphenKey) {
16660
+ if (caretMap[borderWidthKey]) {
16661
+ return parseInt(caretMap[borderWidthKey], 10) || 0;
16662
+ }
16663
+ var shorthand = caretMap[hyphenKey];
16664
+ return shorthand ? (parseInt(shorthand, 10) || 0) : 0;
16665
+ }
16666
+ function buildBorderCaretStyleMap(caretMap, caretDimensions, tooltipLayoutDirection) {
16600
16667
  var borderStyles = {
16601
16668
  top: '',
16602
16669
  right: '',
@@ -16605,12 +16672,15 @@ var BuildingBlockTooltips = (function () {
16605
16672
  };
16606
16673
  var borderDirections = ['Top', 'Right', 'Bottom', 'Left'];
16607
16674
  for (var i = 0; i < borderDirections.length; i++) {
16608
- var borderWidthKey = 'border' + borderDirections[i] + 'Width'; // borderTopWidth, etc
16609
- var borderColorKey = 'border' + borderDirections[i] + 'Color'; // borderTopColor, etc
16610
- var borderStyleKey = 'border' + borderDirections[i] + 'Style'; // borderTopStyle, etc
16611
- if (caretDiv.style[borderWidthKey]) {
16612
- borderStyles[borderWidthKey] = parseInt(caretDiv.style[borderWidthKey], 10) + caretDimensions.borderWidth + 'px';
16613
- borderStyles[borderColorKey] = determineBorderCaretColor(caretDiv.style[borderColorKey], caretDimensions.borderColor);
16675
+ var side = borderDirections[i];
16676
+ var borderWidthKey = 'border' + side + 'Width';
16677
+ var borderColorKey = 'border' + side + 'Color';
16678
+ var borderStyleKey = 'border' + side + 'Style';
16679
+ var hyphenKey = HYPHEN_BORDER_BY_SIDE[side];
16680
+ var widthVal = borderWidthFromCaretStyleMap(caretMap, borderWidthKey, hyphenKey);
16681
+ if (widthVal) {
16682
+ borderStyles[borderWidthKey] = widthVal + caretDimensions.borderWidth + 'px';
16683
+ borderStyles[borderColorKey] = determineBorderCaretColor(borderColorFromCaretStyleMap(caretMap, borderColorKey, hyphenKey), caretDimensions.borderColor);
16614
16684
  borderStyles[borderStyleKey] = 'solid';
16615
16685
  }
16616
16686
  else {
@@ -16619,27 +16689,28 @@ var BuildingBlockTooltips = (function () {
16619
16689
  borderStyles[borderStyleKey] = '';
16620
16690
  }
16621
16691
  }
16692
+ var bw = caretDimensions.borderWidth;
16622
16693
  // Tooltip is above element, border moves further down
16623
16694
  if (tooltipLayoutDirection === 'top') {
16624
- borderStyles.left = parseInt(caretDiv.style.left, 10) - caretDimensions.borderWidth + 'px';
16625
- borderStyles.bottom = parseInt(caretDiv.style.bottom, 10) - caretDimensions.borderWidth + 'px';
16695
+ borderStyles.left = parseInt(caretMap.left, 10) - bw + 'px';
16696
+ borderStyles.bottom = parseInt(caretMap.bottom, 10) - bw + 'px';
16626
16697
  }
16627
16698
  // Tooltip is below element, border moves further up
16628
16699
  if (tooltipLayoutDirection === 'bottom') {
16629
- borderStyles.left = parseInt(caretDiv.style.left, 10) - caretDimensions.borderWidth + 'px';
16630
- borderStyles.top = parseInt(caretDiv.style.top, 10) - caretDimensions.borderWidth + 'px';
16700
+ borderStyles.left = parseInt(caretMap.left, 10) - bw + 'px';
16701
+ borderStyles.top = parseInt(caretMap.top, 10) - bw + 'px';
16631
16702
  }
16632
16703
  // Tooltip is to the right of the element, border moves further left
16633
16704
  if (tooltipLayoutDirection === 'right') {
16634
- borderStyles.top = parseInt(caretDiv.style.top, 10) - caretDimensions.borderWidth + 'px';
16635
- borderStyles.left = parseInt(caretDiv.style.left, 10) - caretDimensions.borderWidth + 'px';
16705
+ borderStyles.top = parseInt(caretMap.top, 10) - bw + 'px';
16706
+ borderStyles.left = parseInt(caretMap.left, 10) - bw + 'px';
16636
16707
  }
16637
16708
  // Tooltip is to the left of the element, border moves further right
16638
16709
  if (tooltipLayoutDirection === 'left') {
16639
- borderStyles.top = parseInt(caretDiv.style.top, 10) - caretDimensions.borderWidth + 'px';
16640
- borderStyles.right = parseInt(caretDiv.style.right, 10) - caretDimensions.borderWidth + 'px';
16710
+ borderStyles.top = parseInt(caretMap.top, 10) - bw + 'px';
16711
+ borderStyles.right = parseInt(caretMap.right, 10) - bw + 'px';
16641
16712
  }
16642
- _.extend(borderCaret.style, borderStyles);
16713
+ return borderStyles;
16643
16714
  }
16644
16715
  function determineBorderCaretColor(currentColor, borderColor) {
16645
16716
  if (currentColor === 'transparent')
@@ -16690,10 +16761,10 @@ var BuildingBlockTooltips = (function () {
16690
16761
  var caretDiv = ttdiv.find('.pendo-tooltip-caret')[0];
16691
16762
  var borderCaret = ttdiv.find('.pendo-tooltip-caret-border')[0];
16692
16763
  if (caretDiv) {
16693
- updateCaretStyles(caretDiv, tooltipDimensions, caretStyles, elPos);
16764
+ updateCaretStyles(caretDiv, tooltipDimensions.caret);
16694
16765
  }
16695
16766
  if (borderCaret) {
16696
- updateBorderCaretStyles(borderCaret, caretStyles, tooltipDimensions.layoutDir, caretDiv);
16767
+ updateCaretStyles(borderCaret, tooltipDimensions.caretBorder);
16697
16768
  }
16698
16769
  }
16699
16770
  // we can update the tooltipDimensions.top and tooltipDimensions.left now
@@ -17756,7 +17827,7 @@ function buildNodeFromJSON(json, step, guides) {
17756
17827
  }
17757
17828
  else if (propKey === 'data-pendo-code-block' && propValue === true && !ConfigReader.get('preventCodeInjection')) {
17758
17829
  const htmlString = step.getContent();
17759
- if (trim.call(htmlString).length === 0)
17830
+ if (!htmlString || trim.call(htmlString).length === 0)
17760
17831
  return;
17761
17832
  curNode.addClass('pendo-code-block').html(htmlString);
17762
17833
  }
@@ -23757,11 +23828,32 @@ const captureStepRenderStatus = (step, eligible, reason) => {
23757
23828
  Events.stepEligibility.trigger({ stepId: id, guideId, eligible, reason });
23758
23829
  return eligible;
23759
23830
  };
23831
+ function isHtmlTooltipStep(step) {
23832
+ if (_.get(step, 'attributes.buildingBlockLayoutType') !== 'tooltip')
23833
+ return false;
23834
+ return Boolean(_.get(step, 'attributes.htmlContent') || step.htmlContent || step.htmlContentUrl);
23835
+ }
23836
+ function getHtmlTooltipSelector(step) {
23837
+ return step.elementPathRule || _.get(step, 'attributes.elementPathRule');
23838
+ }
23760
23839
  var canStepBeRendered = function (step) {
23761
23840
  const statusWriter = _.partial(captureStepRenderStatus, step);
23762
23841
  if (isDismissedUntilReload(step)) {
23763
23842
  return statusWriter(false, 'dismissed');
23764
23843
  }
23844
+ // HTML guide tooltips don't set step.type === 'tooltip' (they keep the
23845
+ // guide-level type, typically 'lightbox') and don't have step.domJson, so
23846
+ // the standard tooltip detection below misses them. Without filtering here,
23847
+ // an HTML tooltip with a missing or invisible anchor sails through eligibility
23848
+ // and silently falls back to a lightbox layout at render time.
23849
+ if (isHtmlTooltipStep(step)) {
23850
+ var htmlSelector = getHtmlTooltipSelector(step);
23851
+ var htmlAnchor = htmlSelector ? SizzleProxy(htmlSelector)[0] : null;
23852
+ if (isElementVisible(htmlAnchor)) {
23853
+ return statusWriter(true, 'target_element_html_tooltip');
23854
+ }
23855
+ return statusWriter(wouldBeVisibleAfterAutoScroll(htmlAnchor), 'target_element_html_tooltip_scroll');
23856
+ }
23765
23857
  if (!step.elementPathRule && (step.type === 'lightbox' || step.type === 'whatsnew')) {
23766
23858
  return statusWriter(true, '');
23767
23859
  }
@@ -24080,7 +24172,6 @@ function createGuideEvent(name, guideId, stepId, visitorId, reason, language) {
24080
24172
  type: name,
24081
24173
  guideId,
24082
24174
  stepId,
24083
- visitorId,
24084
24175
  language
24085
24176
  };
24086
24177
  }
@@ -24096,7 +24187,7 @@ function createGuideEvent(name, guideId, stepId, visitorId, reason, language) {
24096
24187
  }, _.omit(params, 'type', 'guideId', 'stepId', 'visitorId'));
24097
24188
  var event = EventTracer.addTracerIds({
24098
24189
  type: params.type,
24099
- visitor_id: params.visitorId,
24190
+ visitor_id: get_visitor_id({ generate: true }),
24100
24191
  account_id: get_account_id(),
24101
24192
  browser_time: new Date().getTime(),
24102
24193
  url: pendoDotUrl.externalizeURL(),
@@ -25765,7 +25856,7 @@ function createPreviewBar() {
25765
25856
  var script = document.createElement('script');
25766
25857
  script.src = getPreviewModeAssetUrl();
25767
25858
  script.onload = function () {
25768
- var whiteLabelSettings = ConfigReader.get('whiteLabelSettings');
25859
+ var whiteLabelSettings = getWhiteLabelSettings(findStoredPreviewConfig());
25769
25860
  if (whiteLabelSettings && frame.contentWindow) {
25770
25861
  frame.contentWindow.postMessage({
25771
25862
  mutation: 'preview/setWhiteLabelSettings',
@@ -25904,6 +25995,19 @@ function sendPreviewModeFailureMessage(document, errorObj) {
25904
25995
  }
25905
25996
  }, location.origin);
25906
25997
  }
25998
+ function getWhiteLabelSettings(config) {
25999
+ var whiteLabelSettings = ConfigReader.get('whiteLabelSettings');
26000
+ if (!whiteLabelSettings && config && config.ux === 'novus') {
26001
+ whiteLabelSettings = {
26002
+ logoUrl: 'https://novus.pendo.io/novus-square-icon.svg',
26003
+ logoStyle: {
26004
+ maxWidth: '40px',
26005
+ maxHeight: '40px'
26006
+ }
26007
+ };
26008
+ }
26009
+ return whiteLabelSettings;
26010
+ }
25907
26011
  function updatePreview(document, activeGuides, lastGuideStepSeen) {
25908
26012
  if (!isInPreviewMode())
25909
26013
  return;
@@ -25958,7 +26062,7 @@ function updatePreview(document, activeGuides, lastGuideStepSeen) {
25958
26062
  hostname: SERVER
25959
26063
  }
25960
26064
  }, location.origin);
25961
- var whiteLabelSettings = ConfigReader.get('whiteLabelSettings');
26065
+ var whiteLabelSettings = getWhiteLabelSettings(config);
25962
26066
  if (whiteLabelSettings) {
25963
26067
  previewFrame.contentWindow.postMessage({
25964
26068
  mutation: 'preview/setWhiteLabelSettings',
@@ -29159,11 +29263,18 @@ function teardown() {
29159
29263
  try {
29160
29264
  Events.appHidden.trigger();
29161
29265
  Events.appUnloaded.trigger();
29162
- _.each(teardownFns, function (teardownFn) {
29163
- teardownFn();
29164
- });
29266
+ try {
29267
+ _.each(teardownFns, function (teardownFn) {
29268
+ teardownFn();
29269
+ });
29270
+ }
29271
+ finally {
29272
+ // Always drain the registered teardown fns even if one throws;
29273
+ // otherwise a single bad teardown leaves stale entries that
29274
+ // would be re-invoked on the next initialize/teardown cycle.
29275
+ teardownFns.length = 0;
29276
+ }
29165
29277
  pageLoad.reset();
29166
- teardownFns.length = 0;
29167
29278
  SingletonMessageHandler.close();
29168
29279
  Eventable.clear(Events);
29169
29280
  Eventable.clear(PublicEvents);
@@ -40735,19 +40846,17 @@ function TextCapture() {
40735
40846
  }
40736
40847
  }
40737
40848
 
40738
- var substitutionRegex = '\\{(?:\\s?)([^.\\s]?visitor|account|parentAccount)\\.([^|\\s/]*)(?:\\s?\\|\\s?([^}]+|[\\/s]+))?(?:\\s?\\/\\s?){1}\\}';
40739
- var skipStepString = '{skipStep:* *(auto|\\d+)\\/}';
40740
- var goToMiddleString = '(?!0)(\\d+)';
40741
- var goToString = "({goto-".concat(goToMiddleString, "\\/})");
40742
- var containerSelector = '[id^="pendo-guide-container"]';
40743
- function lookupGuideButtons(domJson, buttons) {
40744
- if (buttons === void 0) { buttons = []; }
40849
+ const substitutionRegex = '\\{(?:\\s?)([^.\\s]?visitor|account|parentAccount)\\.([^|\\s/]*)(?:\\s?\\|\\s?([^}]+|[\\/s]+))?(?:\\s?\\/\\s?){1}\\}';
40850
+ const skipStepString = '{skipStep:* *(auto|\\d+)\\/}';
40851
+ const goToMiddleString = '(?!0)(\\d+)';
40852
+ const goToString = `({goto-${goToMiddleString}\\/})`;
40853
+ const containerSelector = '[id^="pendo-guide-container"]';
40854
+ function lookupGuideButtons(domJson, buttons = []) {
40745
40855
  if (domJson.type === 'button' && domJson.actions) {
40746
40856
  buttons.push(domJson);
40747
40857
  }
40748
40858
  if (domJson.children) {
40749
- for (var _i = 0, _a = domJson.children; _i < _a.length; _i++) {
40750
- var child = _a[_i];
40859
+ for (const child of domJson.children) {
40751
40860
  lookupGuideButtons(child, buttons);
40752
40861
  }
40753
40862
  }
@@ -40776,16 +40885,15 @@ function removeMarkdownSyntax(element, textToReplace, replacementText, pendo) {
40776
40885
  }
40777
40886
  }
40778
40887
  var guideMarkdownUtil = {
40779
- substitutionRegex: substitutionRegex,
40780
- skipStepString: skipStepString,
40781
- goToString: goToString,
40782
- containerSelector: containerSelector,
40783
- lookupGuideButtons: lookupGuideButtons,
40784
- removeMarkdownSyntax: removeMarkdownSyntax
40888
+ substitutionRegex,
40889
+ skipStepString,
40890
+ goToString,
40891
+ containerSelector,
40892
+ lookupGuideButtons,
40893
+ removeMarkdownSyntax
40785
40894
  };
40786
40895
 
40787
- function getZoneSafeMethod(_, method, target) {
40788
- if (target === void 0) { target = window; }
40896
+ function getZoneSafeMethod(_, method, target = window) {
40789
40897
  var zoneSymbol = '__symbol__';
40790
40898
  /* global Zone */
40791
40899
  if (typeof Zone !== 'undefined' && _.isFunction(Zone[zoneSymbol])) {
@@ -40798,20 +40906,20 @@ function getZoneSafeMethod(_, method, target) {
40798
40906
  }
40799
40907
 
40800
40908
  // Does not support submit and go to
40801
- var goToRegex = new RegExp(guideMarkdownUtil.goToString);
40802
- var PollBranching = {
40909
+ const goToRegex = new RegExp(guideMarkdownUtil.goToString);
40910
+ const PollBranching = {
40803
40911
  name: 'PollBranching',
40804
- script: function (step, guide, pendo) {
40805
- var isAdvanceIntercepted = false;
40806
- var branchingQuestions = initialBranchingSetup(step, pendo);
40912
+ script(step, guide, pendo) {
40913
+ let isAdvanceIntercepted = false;
40914
+ const branchingQuestions = initialBranchingSetup(step, pendo);
40807
40915
  if (branchingQuestions) {
40808
40916
  // If there are too many branching questions saved, exit and run the guide normally.
40809
40917
  if (pendo._.size(branchingQuestions) > 1)
40810
40918
  return;
40811
- this.on('beforeAdvance', function (evt) {
40812
- var noResponseSelected = step.guideElement.find('[branching] .pendo-radio:checked').length === 0;
40813
- var responseLabel = step.guideElement.find('[branching] .pendo-radio:checked + label')[0];
40814
- var noGotoLabel;
40919
+ this.on('beforeAdvance', (evt) => {
40920
+ const noResponseSelected = step.guideElement.find('[branching] .pendo-radio:checked').length === 0;
40921
+ const responseLabel = step.guideElement.find('[branching] .pendo-radio:checked + label')[0];
40922
+ let noGotoLabel;
40815
40923
  if (responseLabel) {
40816
40924
  noGotoLabel = pendo._.isNull(responseLabel.getAttribute('goToStep'));
40817
40925
  }
@@ -40822,58 +40930,58 @@ var PollBranching = {
40822
40930
  });
40823
40931
  }
40824
40932
  },
40825
- test: function (step, guide, pendo) {
40933
+ test(step, guide, pendo) {
40826
40934
  var _a;
40827
- var branchingQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
40935
+ let branchingQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
40828
40936
  return !pendo._.isUndefined(branchingQuestions) && pendo._.size(branchingQuestions);
40829
40937
  },
40830
- designerListener: function (pendo) {
40831
- var target = pendo.dom.getBody();
40832
- var config = {
40938
+ designerListener(pendo) {
40939
+ const target = pendo.dom.getBody();
40940
+ const config = {
40833
40941
  attributeFilter: ['data-layout'],
40834
40942
  attributes: true,
40835
40943
  childList: true,
40836
40944
  characterData: true,
40837
40945
  subtree: true
40838
40946
  };
40839
- var MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
40840
- var observer = new MutationObserver(applyBranchingIndicators);
40947
+ const MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
40948
+ const observer = new MutationObserver(applyBranchingIndicators);
40841
40949
  observer.observe(target, config);
40842
40950
  function applyBranchingIndicators(mutations) {
40843
40951
  pendo._.each(mutations, function (mutation) {
40844
40952
  var _a;
40845
- var nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelector);
40953
+ const nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelector);
40846
40954
  if (mutation.addedNodes.length && nodeHasQuerySelector) {
40847
40955
  if (mutation.addedNodes[0].querySelector('._pendo-multi-choice-poll-select-border')) {
40848
40956
  if (pendo._.size(pendo.dom('._pendo-multi-choice-poll-question:contains("{branching/}")'))) {
40849
40957
  pendo
40850
40958
  .dom('._pendo-multi-choice-poll-question:contains("{branching/}")')
40851
- .each(function (question, index) {
40852
- pendo._.each(pendo.dom("#".concat(question.id, " *")), function (element) {
40959
+ .each((question, index) => {
40960
+ pendo._.each(pendo.dom(`#${question.id} *`), (element) => {
40853
40961
  guideMarkdownUtil.removeMarkdownSyntax(element, '{branching/}', '', pendo);
40854
40962
  });
40855
40963
  pendo
40856
- .dom("#".concat(question.id, " p"))
40964
+ .dom(`#${question.id} p`)
40857
40965
  .css({ display: 'inline-block !important' })
40858
40966
  .append(branchingIcon('#999', '20px'))
40859
40967
  .attr({ title: 'Custom Branching Added' });
40860
- var dataPendoPollId = question.getAttribute('data-pendo-poll-id');
40861
- if (pendo.dom("._pendo-multi-choice-poll-question[data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0]) {
40968
+ let dataPendoPollId = question.getAttribute('data-pendo-poll-id');
40969
+ if (pendo.dom(`._pendo-multi-choice-poll-question[data-pendo-poll-id=${dataPendoPollId}]`)[0]) {
40862
40970
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
40863
40971
  pendo
40864
- .dom("._pendo-multi-choice-poll-question[data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0]
40972
+ .dom(`._pendo-multi-choice-poll-question[data-pendo-poll-id=${dataPendoPollId}]`)[0]
40865
40973
  .textContent.trim();
40866
40974
  }
40867
- var pollLabels = pendo.dom("label[for*=".concat(dataPendoPollId, "]"));
40975
+ let pollLabels = pendo.dom(`label[for*=${dataPendoPollId}]`);
40868
40976
  if (pendo._.size(pollLabels)) {
40869
- pendo._.forEach(pollLabels, function (label) {
40977
+ pendo._.forEach(pollLabels, (label) => {
40870
40978
  if (goToRegex.test(label.textContent)) {
40871
- var labelTitle = goToRegex.exec(label.textContent)[2];
40979
+ let labelTitle = goToRegex.exec(label.textContent)[2];
40872
40980
  guideMarkdownUtil.removeMarkdownSyntax(label, goToRegex, '', pendo);
40873
40981
  pendo
40874
40982
  .dom(label)
40875
40983
  .append(branchingIcon('#999', '14px'))
40876
- .attr({ title: "Branching to step ".concat(labelTitle) });
40984
+ .attr({ title: `Branching to step ${labelTitle}` });
40877
40985
  }
40878
40986
  });
40879
40987
  }
@@ -40881,9 +40989,9 @@ var PollBranching = {
40881
40989
  pendo
40882
40990
  .dom(question)
40883
40991
  .append(branchingErrorHTML(question.dataset.pendoPollId));
40884
- pendo.dom("#".concat(question.id, " #pendo-ps-branching-svg")).remove();
40992
+ pendo.dom(`#${question.id} #pendo-ps-branching-svg`).remove();
40885
40993
  pendo
40886
- .dom("#".concat(question.id, " p"))
40994
+ .dom(`#${question.id} p`)
40887
40995
  .css({ display: 'inline-block !important' })
40888
40996
  .append(branchingIcon('red', '20px'))
40889
40997
  .attr({ title: 'Unsupported Branching configuration' });
@@ -40895,31 +41003,49 @@ var PollBranching = {
40895
41003
  });
40896
41004
  }
40897
41005
  function branchingErrorHTML(dataPendoPollId) {
40898
- return "<div style=\"text-align:lrft; font-size: 14px; color: red;\n font-style: italic; margin-top: 0px;\" class=\"branching-wrapper\"\n name=\"".concat(dataPendoPollId, "\">\n * Branching Error: Multiple branching polls not supported</div>");
41006
+ return `<div style="text-align:lrft; font-size: 14px; color: red;
41007
+ font-style: italic; margin-top: 0px;" class="branching-wrapper"
41008
+ name="${dataPendoPollId}">
41009
+ * Branching Error: Multiple branching polls not supported</div>`;
40899
41010
  }
40900
41011
  function branchingIcon(color, size) {
40901
- return "<svg id=\"pendo-ps-branching-svg\" viewBox=\"0 0 24 24\" fill=\"none\"\n style=\"margin-left: 5px;\n height:".concat(size, "; width:").concat(size, "; display:inline; vertical-align:middle;\" xmlns=\"http://www.w3.org/2000/svg\">\n <g stroke-width=\"0\"></g>\n <g stroke-linecap=\"round\" stroke-linejoin=\"round\"></g>\n <g> <circle cx=\"4\" cy=\"7\" r=\"2\" stroke=\"").concat(color, "\"\n stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></circle>\n <circle cx=\"20\" cy=\"7\" r=\"2\" stroke=\"").concat(color, "\"\n stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"></circle>\n <circle cx=\"20\" cy=\"17\" r=\"2\" stroke=\"").concat(color, "\" stroke-width=\"2\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\"></circle>\n <path d=\"M18 7H6\" stroke=\"").concat(color, "\" stroke-width=\"2\"\n stroke-linecap=\"round\" stroke-linejoin=\"round\"></path>\n <path d=\"M7 7V7C8.65685 7 10 8.34315 10 10V15C10 16.1046 10.8954 17 12 17H18\"\n stroke=\"").concat(color, "\" stroke-width=\"2\" stroke-linecap=\"round\"\n stroke-linejoin=\"round\"></path> </g></svg>");
41012
+ return `<svg id="pendo-ps-branching-svg" viewBox="0 0 24 24" fill="none"
41013
+ style="margin-left: 5px;
41014
+ height:${size}; width:${size}; display:inline; vertical-align:middle;" xmlns="http://www.w3.org/2000/svg">
41015
+ <g stroke-width="0"></g>
41016
+ <g stroke-linecap="round" stroke-linejoin="round"></g>
41017
+ <g> <circle cx="4" cy="7" r="2" stroke="${color}"
41018
+ stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></circle>
41019
+ <circle cx="20" cy="7" r="2" stroke="${color}"
41020
+ stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></circle>
41021
+ <circle cx="20" cy="17" r="2" stroke="${color}" stroke-width="2"
41022
+ stroke-linecap="round" stroke-linejoin="round"></circle>
41023
+ <path d="M18 7H6" stroke="${color}" stroke-width="2"
41024
+ stroke-linecap="round" stroke-linejoin="round"></path>
41025
+ <path d="M7 7V7C8.65685 7 10 8.34315 10 10V15C10 16.1046 10.8954 17 12 17H18"
41026
+ stroke="${color}" stroke-width="2" stroke-linecap="round"
41027
+ stroke-linejoin="round"></path> </g></svg>`;
40902
41028
  }
40903
41029
  }
40904
41030
  };
40905
41031
  function initialBranchingSetup(step, pendo) {
40906
- var questions = step.guideElement.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
40907
- pendo._.forEach(questions, function (question) {
40908
- var dataPendoPollId = question.getAttribute('data-pendo-poll-id');
40909
- pendo._.each(step.guideElement.find("#".concat(question.id, " *")), function (element) {
41032
+ const questions = step.guideElement.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
41033
+ pendo._.forEach(questions, (question) => {
41034
+ let dataPendoPollId = question.getAttribute('data-pendo-poll-id');
41035
+ pendo._.each(step.guideElement.find(`#${question.id} *`), (element) => {
40910
41036
  guideMarkdownUtil.removeMarkdownSyntax(element, '{branching/}', '', pendo);
40911
41037
  });
40912
- var pollLabels = step.guideElement.find("label[for*=".concat(dataPendoPollId, "]"));
40913
- pendo._.forEach(pollLabels, function (label) {
41038
+ let pollLabels = step.guideElement.find(`label[for*=${dataPendoPollId}]`);
41039
+ pendo._.forEach(pollLabels, (label) => {
40914
41040
  if (pendo._.isNull(goToRegex.exec(label.textContent))) {
40915
41041
  return;
40916
41042
  }
40917
- var gotoSubstring = goToRegex.exec(label.textContent)[1];
40918
- var gotoIndex = goToRegex.exec(label.textContent)[2];
41043
+ let gotoSubstring = goToRegex.exec(label.textContent)[1];
41044
+ let gotoIndex = goToRegex.exec(label.textContent)[2];
40919
41045
  label.setAttribute('goToStep', gotoIndex);
40920
41046
  guideMarkdownUtil.removeMarkdownSyntax(label, gotoSubstring, '', pendo);
40921
41047
  });
40922
- var pollChoiceContainer = step.guideElement.find("[data-pendo-poll-id=".concat(dataPendoPollId, "]._pendo-multi-choice-poll-select-border"));
41048
+ let pollChoiceContainer = step.guideElement.find(`[data-pendo-poll-id=${dataPendoPollId}]._pendo-multi-choice-poll-select-border`);
40923
41049
  if (pollChoiceContainer && pollChoiceContainer.length) {
40924
41050
  pollChoiceContainer[0].setAttribute('branching', '');
40925
41051
  }
@@ -40928,24 +41054,24 @@ function initialBranchingSetup(step, pendo) {
40928
41054
  }
40929
41055
  function branchingGoToStep(event, step, guide, pendo) {
40930
41056
  var _a;
40931
- var checkedPollInputId = (_a = step.guideElement.find('[branching] input.pendo-radio[data-pendo-poll-id]:checked')[0]) === null || _a === void 0 ? void 0 : _a.id;
40932
- var checkedPollLabel = step.guideElement.find("label[for=\"".concat(checkedPollInputId, "\"]"))[0];
40933
- var checkedPollLabelStepIndex = checkedPollLabel === null || checkedPollLabel === void 0 ? void 0 : checkedPollLabel.getAttribute('goToStep');
40934
- var pollStepIndex = checkedPollLabelStepIndex - 1;
41057
+ let checkedPollInputId = (_a = step.guideElement.find('[branching] input.pendo-radio[data-pendo-poll-id]:checked')[0]) === null || _a === void 0 ? void 0 : _a.id;
41058
+ let checkedPollLabel = step.guideElement.find(`label[for="${checkedPollInputId}"]`)[0];
41059
+ let checkedPollLabelStepIndex = checkedPollLabel === null || checkedPollLabel === void 0 ? void 0 : checkedPollLabel.getAttribute('goToStep');
41060
+ let pollStepIndex = checkedPollLabelStepIndex - 1;
40935
41061
  if (pollStepIndex < 0)
40936
41062
  return;
40937
- var destinationObject = {
41063
+ const destinationObject = {
40938
41064
  destinationStepId: guide.steps[pollStepIndex].id,
40939
- step: step
41065
+ step
40940
41066
  };
40941
41067
  pendo.goToStep(destinationObject);
40942
41068
  event.cancel = true;
40943
41069
  }
40944
41070
 
40945
- var MetadataSubstitution = {
41071
+ const MetadataSubstitution = {
40946
41072
  name: 'MetadataSubstitution',
40947
- script: function (step, guide, pendo) {
40948
- var placeholderData = findSubstitutableElements(pendo);
41073
+ script(step, guide, pendo) {
41074
+ const placeholderData = findSubstitutableElements(pendo);
40949
41075
  if (step.domJson) {
40950
41076
  findSubstitutableUrlsInJson(step.domJson, placeholderData, pendo);
40951
41077
  }
@@ -40953,22 +41079,22 @@ var MetadataSubstitution = {
40953
41079
  pendo._.each(placeholderData, function (placeholder) {
40954
41080
  processPlaceholder(placeholder, pendo);
40955
41081
  });
40956
- var containerId = "pendo-g-".concat(step.id);
40957
- var context_1 = step.guideElement;
40958
- updateGuideContainer(containerId, context_1, pendo);
41082
+ const containerId = `pendo-g-${step.id}`;
41083
+ const context = step.guideElement;
41084
+ updateGuideContainer(containerId, context, pendo);
40959
41085
  }
40960
41086
  },
40961
- designerListener: function (pendo) {
40962
- var target = pendo.dom.getBody();
41087
+ designerListener(pendo) {
41088
+ const target = pendo.dom.getBody();
40963
41089
  if (pendo.designerv2) {
40964
41090
  pendo.designerv2.runMetadataSubstitutionForDesignerPreview = function runMetadataSubstitutionForDesignerPreview() {
40965
41091
  var _a;
40966
41092
  if (!document.querySelector(guideMarkdownUtil.containerSelector))
40967
41093
  return;
40968
- var step = (_a = pendo.designerv2.currentlyPreviewedGuide) === null || _a === void 0 ? void 0 : _a.steps[0];
41094
+ const step = (_a = pendo.designerv2.currentlyPreviewedGuide) === null || _a === void 0 ? void 0 : _a.steps[0];
40969
41095
  if (!step)
40970
41096
  return;
40971
- var placeholderData = findSubstitutableElements(pendo);
41097
+ const placeholderData = findSubstitutableElements(pendo);
40972
41098
  if (step.buildingBlocks) {
40973
41099
  findSubstitutableUrlsInJson(step.buildingBlocks, placeholderData, pendo);
40974
41100
  }
@@ -40978,32 +41104,32 @@ var MetadataSubstitution = {
40978
41104
  return;
40979
41105
  processPlaceholder(placeholder, pendo);
40980
41106
  });
40981
- var containerId = "pendo-g-".concat(step.id);
40982
- var context_2 = step.guideElement;
40983
- updateGuideContainer(containerId, context_2, pendo);
41107
+ const containerId = `pendo-g-${step.id}`;
41108
+ const context = step.guideElement;
41109
+ updateGuideContainer(containerId, context, pendo);
40984
41110
  }
40985
41111
  };
40986
41112
  }
40987
- var config = {
41113
+ const config = {
40988
41114
  attributeFilter: ['data-layout'],
40989
41115
  attributes: true,
40990
41116
  childList: true,
40991
41117
  characterData: true,
40992
41118
  subtree: true
40993
41119
  };
40994
- var MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
40995
- var observer = new MutationObserver(applySubstitutionIndicators);
41120
+ const MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
41121
+ const observer = new MutationObserver(applySubstitutionIndicators);
40996
41122
  observer.observe(target, config);
40997
41123
  function applySubstitutionIndicators(mutations) {
40998
41124
  pendo._.each(mutations, function (mutation) {
40999
41125
  var _a;
41000
41126
  if (mutation.addedNodes.length) {
41001
41127
  if (document.querySelector(guideMarkdownUtil.containerSelector)) {
41002
- var placeholderData = findSubstitutableElements(pendo);
41003
- var step = (_a = pendo.designerv2.currentlyPreviewedGuide) === null || _a === void 0 ? void 0 : _a.steps[0];
41128
+ const placeholderData = findSubstitutableElements(pendo);
41129
+ const step = (_a = pendo.designerv2.currentlyPreviewedGuide) === null || _a === void 0 ? void 0 : _a.steps[0];
41004
41130
  if (!step)
41005
41131
  return;
41006
- var pendoBlocks = step.buildingBlocks;
41132
+ const pendoBlocks = step.buildingBlocks;
41007
41133
  if (!pendo._.isUndefined(pendoBlocks)) {
41008
41134
  findSubstitutableUrlsInJson(pendoBlocks, placeholderData, pendo);
41009
41135
  }
@@ -41013,9 +41139,9 @@ var MetadataSubstitution = {
41013
41139
  return;
41014
41140
  processPlaceholder(placeholder, pendo);
41015
41141
  });
41016
- var containerId = "pendo-g-".concat(step.id);
41017
- var context_3 = step.guideElement;
41018
- updateGuideContainer(containerId, context_3, pendo);
41142
+ const containerId = `pendo-g-${step.id}`;
41143
+ const context = step.guideElement;
41144
+ updateGuideContainer(containerId, context, pendo);
41019
41145
  }
41020
41146
  }
41021
41147
  }
@@ -41024,18 +41150,18 @@ var MetadataSubstitution = {
41024
41150
  }
41025
41151
  };
41026
41152
  function processPlaceholder(placeholder, pendo) {
41027
- var match;
41028
- var data = placeholder.data, target = placeholder.target;
41029
- var subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
41153
+ let match;
41154
+ const { data, target } = placeholder;
41155
+ const subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
41030
41156
  while ((match = matchPlaceholder(placeholder, subRegex))) {
41031
- var usedArrayPath = Array.isArray(match) && match.length >= 2;
41032
- var currentStr = target === 'textContent'
41157
+ const usedArrayPath = Array.isArray(match) && match.length >= 2;
41158
+ const currentStr = target === 'textContent'
41033
41159
  ? data[target]
41034
41160
  : decodeURI((data.getAttribute && (target === 'href' || target === 'value') ? (data.getAttribute(target) || '') : data[target]));
41035
- var matched = usedArrayPath ? match : subRegex.exec(currentStr);
41161
+ const matched = usedArrayPath ? match : subRegex.exec(currentStr);
41036
41162
  if (!matched)
41037
41163
  continue;
41038
- var mdValue = getSubstituteValue(matched, pendo);
41164
+ const mdValue = getSubstituteValue(matched, pendo);
41039
41165
  substituteMetadataByTarget(data, target, mdValue, matched);
41040
41166
  }
41041
41167
  }
@@ -41044,48 +41170,48 @@ function matchPlaceholder(placeholder, regex) {
41044
41170
  return placeholder.data[placeholder.target].match(regex);
41045
41171
  }
41046
41172
  else {
41047
- var raw = placeholder.data.getAttribute && (placeholder.target === 'href' || placeholder.target === 'value')
41173
+ const raw = placeholder.data.getAttribute && (placeholder.target === 'href' || placeholder.target === 'value')
41048
41174
  ? (placeholder.data.getAttribute(placeholder.target) || '')
41049
41175
  : placeholder.data[placeholder.target];
41050
41176
  return decodeURI(raw).match(regex);
41051
41177
  }
41052
41178
  }
41053
41179
  function getMetadataValueCaseInsensitive(metadata, type, property) {
41054
- var kind = metadata && metadata[type];
41180
+ const kind = metadata && metadata[type];
41055
41181
  if (!kind || typeof kind !== 'object')
41056
41182
  return undefined;
41057
- var direct = Object.prototype.hasOwnProperty.call(kind, property) ? kind[property] : undefined;
41183
+ const direct = Object.prototype.hasOwnProperty.call(kind, property) ? kind[property] : undefined;
41058
41184
  if (direct !== undefined) {
41059
41185
  return direct;
41060
41186
  }
41061
- var propLower = property.toLowerCase();
41062
- var key = Object.keys(kind).find(function (k) { return k.toLowerCase() === propLower; });
41063
- var value = key !== undefined ? kind[key] : undefined;
41187
+ const propLower = property.toLowerCase();
41188
+ const key = Object.keys(kind).find(k => k.toLowerCase() === propLower);
41189
+ const value = key !== undefined ? kind[key] : undefined;
41064
41190
  return value;
41065
41191
  }
41066
41192
  function getSubstituteValue(match, pendo) {
41067
41193
  if (pendo._.isUndefined(match[1]) || pendo._.isUndefined(match[2])) {
41068
41194
  return;
41069
41195
  }
41070
- var type = match[1];
41071
- var property = match[2];
41072
- var defaultValue = match[3];
41196
+ let type = match[1];
41197
+ let property = match[2];
41198
+ let defaultValue = match[3];
41073
41199
  if (pendo._.isUndefined(type) || pendo._.isUndefined(property)) {
41074
41200
  return;
41075
41201
  }
41076
- var metadata = pendo.getSerializedMetadata();
41077
- var mdValue = getMetadataValueCaseInsensitive(metadata, type, property);
41202
+ const metadata = pendo.getSerializedMetadata();
41203
+ let mdValue = getMetadataValueCaseInsensitive(metadata, type, property);
41078
41204
  if (mdValue === undefined || mdValue === null)
41079
41205
  mdValue = defaultValue || '';
41080
41206
  return mdValue;
41081
41207
  }
41082
41208
  function substituteMetadataByTarget(data, target, mdValue, matched) {
41083
- var isElement = data && typeof data.getAttribute === 'function';
41084
- var current = (target === 'href' || target === 'value') && isElement
41209
+ const isElement = data && typeof data.getAttribute === 'function';
41210
+ const current = (target === 'href' || target === 'value') && isElement
41085
41211
  ? (data.getAttribute(target) || '')
41086
41212
  : data[target];
41087
41213
  if (target === 'href' || target === 'value') {
41088
- var safeValue = window.encodeURIComponent(String(mdValue === undefined || mdValue === null ? '' : mdValue));
41214
+ const safeValue = window.encodeURIComponent(String(mdValue === undefined || mdValue === null ? '' : mdValue));
41089
41215
  data[target] = decodeURI(current).replace(matched[0], safeValue);
41090
41216
  }
41091
41217
  else {
@@ -41099,9 +41225,8 @@ function updateGuideContainer(containerId, context, pendo) {
41099
41225
  pendo.flexElement(pendo.dom(guideMarkdownUtil.containerSelector));
41100
41226
  pendo.BuildingBlocks.BuildingBlockGuides.recalculateGuideHeight(containerId, context);
41101
41227
  }
41102
- function findSubstitutableUrlsInJson(originalData, placeholderData, pendo) {
41103
- if (placeholderData === void 0) { placeholderData = []; }
41104
- var subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
41228
+ function findSubstitutableUrlsInJson(originalData, placeholderData = [], pendo) {
41229
+ const subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
41105
41230
  if ((originalData.name === 'url' || originalData.name === 'href') && originalData.value) {
41106
41231
  if (subRegex.test(originalData.value)) {
41107
41232
  placeholderData.push({
@@ -41111,37 +41236,37 @@ function findSubstitutableUrlsInJson(originalData, placeholderData, pendo) {
41111
41236
  }
41112
41237
  }
41113
41238
  if (originalData.properties && originalData.id === 'href_link_block') {
41114
- pendo._.each(originalData.properties, function (prop) {
41239
+ pendo._.each(originalData.properties, (prop) => {
41115
41240
  findSubstitutableUrlsInJson(prop, placeholderData, pendo);
41116
41241
  });
41117
41242
  }
41118
41243
  if (originalData.views) {
41119
- pendo._.each(originalData.views, function (view) {
41244
+ pendo._.each(originalData.views, (view) => {
41120
41245
  findSubstitutableUrlsInJson(view, placeholderData, pendo);
41121
41246
  });
41122
41247
  }
41123
41248
  if (originalData.parameters) {
41124
- pendo._.each(originalData.parameters, function (param) {
41249
+ pendo._.each(originalData.parameters, (param) => {
41125
41250
  findSubstitutableUrlsInJson(param, placeholderData, pendo);
41126
41251
  });
41127
41252
  }
41128
41253
  if (originalData.actions) {
41129
- pendo._.each(originalData.actions, function (action) {
41254
+ pendo._.each(originalData.actions, (action) => {
41130
41255
  findSubstitutableUrlsInJson(action, placeholderData, pendo);
41131
41256
  });
41132
41257
  }
41133
41258
  if (originalData.children) {
41134
- pendo._.each(originalData.children, function (child) {
41259
+ pendo._.each(originalData.children, (child) => {
41135
41260
  findSubstitutableUrlsInJson(child, placeholderData, pendo);
41136
41261
  });
41137
41262
  }
41138
41263
  return placeholderData;
41139
41264
  }
41140
41265
  function findSubstitutableElements(pendo) {
41141
- var elements = pendo.dom("".concat(guideMarkdownUtil.containerSelector, " *:not(.pendo-inline-ui)"));
41266
+ let elements = pendo.dom(`${guideMarkdownUtil.containerSelector} *:not(.pendo-inline-ui)`);
41142
41267
  return pendo._.chain(elements)
41143
41268
  .filter(function (placeholder) {
41144
- var subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
41269
+ const subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
41145
41270
  if (placeholder.localName === 'a') {
41146
41271
  return subRegex.test(decodeURI(placeholder.href)) || subRegex.test(placeholder.textContent);
41147
41272
  }
@@ -41197,25 +41322,51 @@ function findSubstitutableElements(pendo) {
41197
41322
  .value();
41198
41323
  }
41199
41324
  function substitutionIcon(color, size) {
41200
- return ("<div title=\"Metadata Substitution added\">\n <svg id=\"pendo-ps-substitution-icon\" viewBox=\"0 0 24 24\"\n preserveAspectRatio=\"xMidYMid meet\"\n height=".concat(size, " width=").concat(size, " title=\"Metadata Substitution\"\n style=\"bottom:5px; right:10px; position: absolute;\"\n fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" stroke=\"").concat(color, "\"\n transform=\"matrix(1, 0, 0, 1, 0, 0)rotate(0)\">\n <g stroke-width=\"0\"></g>\n <g stroke-linecap=\"round\" stroke-linejoin=\"round\"\n stroke=\"").concat(color, "\" stroke-width=\"0.528\"></g>\n <g><path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n d=\"M5 5.5C4.17157 5.5 3.5 6.17157 3.5 7V10C3.5 10.8284\n 4.17157 11.5 5 11.5H8C8.82843 11.5 9.5 10.8284 9.5\n 10V9H17V11C17 11.2761 17.2239 11.5 17.5 11.5C17.7761\n 11.5 18 11.2761 18 11V8.5C18 8.22386 17.7761 8 17.5\n 8H9.5V7C9.5 6.17157 8.82843 5.5 8 5.5H5ZM8.5 7C8.5\n 6.72386 8.27614 6.5 8 6.5H5C4.72386 6.5 4.5 6.72386\n 4.5 7V10C4.5 10.2761 4.72386 10.5 5 10.5H8C8.27614\n 10.5 8.5 10.2761 8.5 10V7Z\" fill=\"").concat(color, "\"></path>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n d=\"M7 13C7 12.7239 6.77614 12.5 6.5 12.5C6.22386 12.5\n 6 12.7239 6 13V15.5C6 15.7761 6.22386 16 6.5\n 16H14.5V17C14.5 17.8284 15.1716 18.5 16 18.5H19C19.8284\n 18.5 20.5 17.8284 20.5 17V14C20.5 13.1716 19.8284 12.5\n 19 12.5H16C15.1716 12.5 14.5 13.1716 14.5\n 14V15H7V13ZM15.5 17C15.5 17.2761 15.7239 17.5 16\n 17.5H19C19.2761 17.5 19.5 17.2761 19.5 17V14C19.5\n 13.7239 19.2761 13.5 19 13.5H16C15.7239 13.5 15.5\n 13.7239 15.5 14V17Z\" fill=\"").concat(color, "\"></path> </g></svg></div>"));
41201
- }
41202
-
41203
- var requiredElement = '<span class="_pendo-required-indicator" style="color:red; font-style:italic;" title="Question is required"> *</span>';
41204
- var requiredSyntax = '{required/}';
41205
- var RequiredQuestions = {
41325
+ return (`<div title="Metadata Substitution added">
41326
+ <svg id="pendo-ps-substitution-icon" viewBox="0 0 24 24"
41327
+ preserveAspectRatio="xMidYMid meet"
41328
+ height=${size} width=${size} title="Metadata Substitution"
41329
+ style="bottom:5px; right:10px; position: absolute;"
41330
+ fill="none" xmlns="http://www.w3.org/2000/svg" stroke="${color}"
41331
+ transform="matrix(1, 0, 0, 1, 0, 0)rotate(0)">
41332
+ <g stroke-width="0"></g>
41333
+ <g stroke-linecap="round" stroke-linejoin="round"
41334
+ stroke="${color}" stroke-width="0.528"></g>
41335
+ <g><path fill-rule="evenodd" clip-rule="evenodd"
41336
+ d="M5 5.5C4.17157 5.5 3.5 6.17157 3.5 7V10C3.5 10.8284
41337
+ 4.17157 11.5 5 11.5H8C8.82843 11.5 9.5 10.8284 9.5
41338
+ 10V9H17V11C17 11.2761 17.2239 11.5 17.5 11.5C17.7761
41339
+ 11.5 18 11.2761 18 11V8.5C18 8.22386 17.7761 8 17.5
41340
+ 8H9.5V7C9.5 6.17157 8.82843 5.5 8 5.5H5ZM8.5 7C8.5
41341
+ 6.72386 8.27614 6.5 8 6.5H5C4.72386 6.5 4.5 6.72386
41342
+ 4.5 7V10C4.5 10.2761 4.72386 10.5 5 10.5H8C8.27614
41343
+ 10.5 8.5 10.2761 8.5 10V7Z" fill="${color}"></path>
41344
+ <path fill-rule="evenodd" clip-rule="evenodd"
41345
+ d="M7 13C7 12.7239 6.77614 12.5 6.5 12.5C6.22386 12.5
41346
+ 6 12.7239 6 13V15.5C6 15.7761 6.22386 16 6.5
41347
+ 16H14.5V17C14.5 17.8284 15.1716 18.5 16 18.5H19C19.8284
41348
+ 18.5 20.5 17.8284 20.5 17V14C20.5 13.1716 19.8284 12.5
41349
+ 19 12.5H16C15.1716 12.5 14.5 13.1716 14.5
41350
+ 14V15H7V13ZM15.5 17C15.5 17.2761 15.7239 17.5 16
41351
+ 17.5H19C19.2761 17.5 19.5 17.2761 19.5 17V14C19.5
41352
+ 13.7239 19.2761 13.5 19 13.5H16C15.7239 13.5 15.5
41353
+ 13.7239 15.5 14V17Z" fill="${color}"></path> </g></svg></div>`);
41354
+ }
41355
+
41356
+ const requiredElement = '<span class="_pendo-required-indicator" style="color:red; font-style:italic;" title="Question is required"> *</span>';
41357
+ const requiredSyntax = '{required/}';
41358
+ const RequiredQuestions = {
41206
41359
  name: 'RequiredQuestions',
41207
- script: function (step, guide, pendo) {
41360
+ script(step, guide, pendo) {
41208
41361
  var _a;
41209
- var requiredPollIds = [];
41210
- var submitButtons = (_a = guideMarkdownUtil.lookupGuideButtons(step.domJson)) === null || _a === void 0 ? void 0 : _a.filter(function (button) {
41211
- return button.actions.find(function (action) { return action.action === 'submitPoll' || action.action === 'submitPollAndGoToStep'; });
41212
- });
41213
- var requiredQuestions = processRequiredQuestions();
41362
+ let requiredPollIds = [];
41363
+ let submitButtons = (_a = guideMarkdownUtil.lookupGuideButtons(step.domJson)) === null || _a === void 0 ? void 0 : _a.filter(button => button.actions.find(action => action.action === 'submitPoll' || action.action === 'submitPollAndGoToStep'));
41364
+ const requiredQuestions = processRequiredQuestions();
41214
41365
  if (requiredQuestions) {
41215
- pendo._.forEach(requiredQuestions, function (question) {
41366
+ pendo._.forEach(requiredQuestions, (question) => {
41216
41367
  if (question.classList.contains('_pendo-open-text-poll-question')) {
41217
- var pollId = question.dataset.pendoPollId;
41218
- step.attachEvent(step.guideElement.find("[data-pendo-poll-id=".concat(pollId, "]._pendo-open-text-poll-input"))[0], 'input', function () {
41368
+ let pollId = question.dataset.pendoPollId;
41369
+ step.attachEvent(step.guideElement.find(`[data-pendo-poll-id=${pollId}]._pendo-open-text-poll-input`)[0], 'input', function () {
41219
41370
  evaluateRequiredQuestions(requiredQuestions);
41220
41371
  });
41221
41372
  }
@@ -41227,8 +41378,8 @@ var RequiredQuestions = {
41227
41378
  });
41228
41379
  }
41229
41380
  function getEligibleQuestions() {
41230
- var allQuestions = step.guideElement.find("[class*=-poll-question]:contains(".concat(requiredSyntax, ")"));
41231
- return pendo._.reduce(allQuestions, function (eligibleQuestions, question) {
41381
+ const allQuestions = step.guideElement.find(`[class*=-poll-question]:contains(${requiredSyntax})`);
41382
+ return pendo._.reduce(allQuestions, (eligibleQuestions, question) => {
41232
41383
  if (question.classList.contains('_pendo-yes-no-poll-question'))
41233
41384
  return eligibleQuestions;
41234
41385
  eligibleQuestions.push(question);
@@ -41236,19 +41387,27 @@ var RequiredQuestions = {
41236
41387
  }, []);
41237
41388
  }
41238
41389
  function processRequiredQuestions() {
41239
- var questions = getEligibleQuestions();
41390
+ let questions = getEligibleQuestions();
41240
41391
  if (questions) {
41241
- pendo._.forEach(questions, function (question) {
41242
- var dataPendoPollId = question.getAttribute('data-pendo-poll-id');
41392
+ pendo._.forEach(questions, question => {
41393
+ let dataPendoPollId = question.getAttribute('data-pendo-poll-id');
41243
41394
  requiredPollIds.push(dataPendoPollId);
41244
- pendo._.each(step.guideElement.find("#".concat(question.id, " *, #").concat(question.id)), function (element) {
41395
+ pendo._.each(step.guideElement.find(`#${question.id} *, #${question.id}`), (element) => {
41245
41396
  guideMarkdownUtil.removeMarkdownSyntax(element, requiredSyntax, '', pendo);
41246
41397
  });
41247
- step.guideElement.find("#".concat(question.id, " p")).append(requiredElement);
41398
+ step.guideElement.find(`#${question.id} p`).append(requiredElement);
41248
41399
  });
41249
41400
  }
41250
41401
  if (pendo._.size(requiredPollIds)) {
41251
- var disabledButtonStyles = "<style type=text/css\n id=_pendo-guide-required-disabled>\n ._pendo-button:disabled, ._pendo-buttons[disabled] {\n border: 1px solid #999999 !important;\n background-color: #cccccc !important;\n color: #666666 !important;\n pointer-events: none !important;\n }\n </style>";
41402
+ const disabledButtonStyles = `<style type=text/css
41403
+ id=_pendo-guide-required-disabled>
41404
+ ._pendo-button:disabled, ._pendo-buttons[disabled] {
41405
+ border: 1px solid #999999 !important;
41406
+ background-color: #cccccc !important;
41407
+ color: #666666 !important;
41408
+ pointer-events: none !important;
41409
+ }
41410
+ </style>`;
41252
41411
  if (pendo.dom('#_pendo-guide-required-disabled').length === 0) {
41253
41412
  pendo.dom('head').append(disabledButtonStyles);
41254
41413
  }
@@ -41259,11 +41418,15 @@ var RequiredQuestions = {
41259
41418
  function evaluateRequiredQuestions(questions) {
41260
41419
  if (questions.length === 0)
41261
41420
  return;
41262
- var allRequiredComplete = true;
41263
- var responses = [];
41264
- responses = responses.concat(pendo._.map(questions, function (question) {
41265
- var pollId = question.getAttribute('data-pendo-poll-id');
41266
- var input = step.guideElement.find("\n [data-pendo-poll-id=".concat(pollId, "] textarea,\n [data-pendo-poll-id=").concat(pollId, "] input:text,\n [data-pendo-poll-id=").concat(pollId, "] select,\n [data-pendo-poll-id=").concat(pollId, "] input:radio:checked"));
41421
+ let allRequiredComplete = true;
41422
+ let responses = [];
41423
+ responses = responses.concat(pendo._.map(questions, (question) => {
41424
+ let pollId = question.getAttribute('data-pendo-poll-id');
41425
+ let input = step.guideElement.find(`
41426
+ [data-pendo-poll-id=${pollId}] textarea,
41427
+ [data-pendo-poll-id=${pollId}] input:text,
41428
+ [data-pendo-poll-id=${pollId}] select,
41429
+ [data-pendo-poll-id=${pollId}] input:radio:checked`);
41267
41430
  if (input && input.length && input[0].value) {
41268
41431
  return input[0].value;
41269
41432
  }
@@ -41280,48 +41443,48 @@ var RequiredQuestions = {
41280
41443
  }
41281
41444
  function disableEligibleButtons(buttons) {
41282
41445
  pendo._.each(buttons, function (button) {
41283
- if (step.guideElement.find("#".concat(button.props.id))[0]) {
41284
- step.guideElement.find("#".concat(button.props.id))[0].disabled = true;
41285
- step.guideElement.find("#".concat(button.props.id))[0].parentElement.title = 'Please complete all required questions.';
41446
+ if (step.guideElement.find(`#${button.props.id}`)[0]) {
41447
+ step.guideElement.find(`#${button.props.id}`)[0].disabled = true;
41448
+ step.guideElement.find(`#${button.props.id}`)[0].parentElement.title = 'Please complete all required questions.';
41286
41449
  }
41287
41450
  });
41288
41451
  }
41289
41452
  function enableEligibleButtons(buttons) {
41290
41453
  pendo._.each(buttons, function (button) {
41291
- if (step.guideElement.find("#".concat(button.props.id))[0]) {
41292
- step.guideElement.find("#".concat(button.props.id))[0].disabled = false;
41293
- step.guideElement.find("#".concat(button.props.id))[0].parentElement.title = '';
41454
+ if (step.guideElement.find(`#${button.props.id}`)[0]) {
41455
+ step.guideElement.find(`#${button.props.id}`)[0].disabled = false;
41456
+ step.guideElement.find(`#${button.props.id}`)[0].parentElement.title = '';
41294
41457
  }
41295
41458
  });
41296
41459
  }
41297
41460
  },
41298
- test: function (step, guide, pendo) {
41461
+ test(step, guide, pendo) {
41299
41462
  var _a;
41300
- var requiredQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find("[class*=-poll-question]:contains(".concat(requiredSyntax, ")"));
41463
+ let requiredQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find(`[class*=-poll-question]:contains(${requiredSyntax})`);
41301
41464
  return !pendo._.isUndefined(requiredQuestions) && pendo._.size(requiredQuestions);
41302
41465
  },
41303
- designerListener: function (pendo) {
41304
- var requiredQuestions = [];
41305
- var target = pendo.dom.getBody();
41306
- var config = {
41466
+ designerListener(pendo) {
41467
+ const requiredQuestions = [];
41468
+ const target = pendo.dom.getBody();
41469
+ const config = {
41307
41470
  attributeFilter: ['data-layout'],
41308
41471
  attributes: true,
41309
41472
  childList: true,
41310
41473
  characterData: true,
41311
41474
  subtree: true
41312
41475
  };
41313
- var MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
41314
- var observer = new MutationObserver(applyRequiredIndicators);
41476
+ const MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
41477
+ const observer = new MutationObserver(applyRequiredIndicators);
41315
41478
  observer.observe(target, config);
41316
41479
  function applyRequiredIndicators(mutations) {
41317
41480
  pendo._.each(mutations, function (mutation) {
41318
41481
  var _a;
41319
- var nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
41482
+ const nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
41320
41483
  if (mutation.addedNodes.length && nodeHasQuerySelector) {
41321
- var eligiblePolls = mutation.addedNodes[0].querySelectorAll('[class*=-poll-wrapper], [class*=-poll-select-border]');
41484
+ let eligiblePolls = mutation.addedNodes[0].querySelectorAll('[class*=-poll-wrapper], [class*=-poll-select-border]');
41322
41485
  if (eligiblePolls) {
41323
41486
  pendo._.each(eligiblePolls, function (poll) {
41324
- var dataPendoPollId;
41487
+ let dataPendoPollId;
41325
41488
  if (poll.classList.contains('_pendo-open-text-poll-wrapper') ||
41326
41489
  poll.classList.contains('_pendo-number-scale-poll-wrapper')) {
41327
41490
  dataPendoPollId = poll.getAttribute('name');
@@ -41329,27 +41492,27 @@ var RequiredQuestions = {
41329
41492
  else {
41330
41493
  dataPendoPollId = poll.getAttribute('data-pendo-poll-id');
41331
41494
  }
41332
- var questionText;
41333
- var pollQuesiton = pendo.dom("[class*=\"-poll-question\"][data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0];
41495
+ let questionText;
41496
+ const pollQuesiton = pendo.dom(`[class*="-poll-question"][data-pendo-poll-id=${dataPendoPollId}]`)[0];
41334
41497
  if (pollQuesiton) {
41335
- questionText = pendo.dom("[class*=\"-poll-question\"][data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0].textContent;
41498
+ questionText = pendo.dom(`[class*="-poll-question"][data-pendo-poll-id=${dataPendoPollId}]`)[0].textContent;
41336
41499
  }
41337
- var requiredSyntaxIndex = questionText.indexOf(requiredSyntax);
41500
+ const requiredSyntaxIndex = questionText.indexOf(requiredSyntax);
41338
41501
  if (requiredSyntaxIndex > -1) {
41339
- pendo._.each(pendo.dom("[data-pendo-poll-id=".concat(dataPendoPollId, "]:not(.pendo-radio)")), function (element) {
41340
- pendo._.each(pendo.dom("#".concat(element.id, " *:not(\".pendo-radio\"), #").concat(element.id, ":not(\".pendo-radio\")")), function (item) {
41502
+ pendo._.each(pendo.dom(`[data-pendo-poll-id=${dataPendoPollId}]:not(.pendo-radio)`), (element) => {
41503
+ pendo._.each(pendo.dom(`#${element.id} *:not(".pendo-radio"), #${element.id}:not(".pendo-radio")`), (item) => {
41341
41504
  guideMarkdownUtil.removeMarkdownSyntax(item, requiredSyntax, '', pendo);
41342
41505
  });
41343
41506
  });
41344
- if (pendo.dom(".bb-text[data-pendo-poll-id=".concat(dataPendoPollId, "] p")).length !== 0 || pendo.dom(".bb-text[data-pendo-poll-id=".concat(dataPendoPollId, "] li")).length !== 0) {
41345
- pendo.dom(".bb-text[data-pendo-poll-id=".concat(dataPendoPollId, "] p")).append(requiredElement);
41346
- pendo.dom(".bb-text[data-pendo-poll-id=".concat(dataPendoPollId, "] li")).append(requiredElement);
41507
+ if (pendo.dom(`.bb-text[data-pendo-poll-id=${dataPendoPollId}] p`).length !== 0 || pendo.dom(`.bb-text[data-pendo-poll-id=${dataPendoPollId}] li`).length !== 0) {
41508
+ pendo.dom(`.bb-text[data-pendo-poll-id=${dataPendoPollId}] p`).append(requiredElement);
41509
+ pendo.dom(`.bb-text[data-pendo-poll-id=${dataPendoPollId}] li`).append(requiredElement);
41347
41510
  }
41348
41511
  else {
41349
- pendo.dom(".bb-text[data-pendo-poll-id=".concat(dataPendoPollId, "]")).append(requiredElement);
41512
+ pendo.dom(`.bb-text[data-pendo-poll-id=${dataPendoPollId}]`).append(requiredElement);
41350
41513
  }
41351
41514
  if (pendo._.contains(requiredQuestions, dataPendoPollId)) {
41352
- var questionIndex = requiredQuestions.indexOf(dataPendoPollId);
41515
+ let questionIndex = requiredQuestions.indexOf(dataPendoPollId);
41353
41516
  if (questionIndex !== -1) {
41354
41517
  requiredQuestions.splice(questionIndex, 1);
41355
41518
  }
@@ -41360,7 +41523,7 @@ var RequiredQuestions = {
41360
41523
  }
41361
41524
  else {
41362
41525
  if (pendo._.contains(requiredQuestions, dataPendoPollId)) {
41363
- var index = requiredQuestions.indexOf(dataPendoPollId);
41526
+ let index = requiredQuestions.indexOf(dataPendoPollId);
41364
41527
  if (index !== -1) {
41365
41528
  requiredQuestions.splice(index, 1);
41366
41529
  }
@@ -41374,54 +41537,54 @@ var RequiredQuestions = {
41374
41537
  }
41375
41538
  };
41376
41539
 
41377
- var skipStepRegex = new RegExp(guideMarkdownUtil.skipStepString);
41378
- var SkipToEligibleStep = {
41379
- script: function (step, guide, pendo) {
41380
- var isAdvanceIntercepted = false;
41381
- var isPreviousIntercepted = false;
41382
- var guideContainer = step.guideElement.find(guideMarkdownUtil.containerSelector);
41383
- var guideContainerAriaLabel = guideContainer.attr('aria-label');
41384
- var stepNumberOrAuto = skipStepRegex.exec(guideContainerAriaLabel)[1];
41540
+ const skipStepRegex = new RegExp(guideMarkdownUtil.skipStepString);
41541
+ const SkipToEligibleStep = {
41542
+ script(step, guide, pendo) {
41543
+ let isAdvanceIntercepted = false;
41544
+ let isPreviousIntercepted = false;
41545
+ let guideContainer = step.guideElement.find(guideMarkdownUtil.containerSelector);
41546
+ let guideContainerAriaLabel = guideContainer.attr('aria-label');
41547
+ let stepNumberOrAuto = skipStepRegex.exec(guideContainerAriaLabel)[1];
41385
41548
  if (guideContainer) {
41386
41549
  guideContainer.attr({ 'aria-label': guideContainer.attr('aria-label').replace(skipStepRegex, '') });
41387
41550
  }
41388
- this.on('beforeAdvance', function (evt) {
41551
+ this.on('beforeAdvance', (evt) => {
41389
41552
  if (guide.getPositionOfStep(step) === guide.steps.length || pendo._.isUndefined(stepNumberOrAuto))
41390
41553
  return; // exit on the last step of a guide or when we don't have an argument
41391
- var eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'next');
41554
+ let eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'next');
41392
41555
  if (!isAdvanceIntercepted && stepNumberOrAuto) {
41393
41556
  isAdvanceIntercepted = true;
41394
- pendo.goToStep({ destinationStepId: eligibleStep.id, step: step });
41557
+ pendo.goToStep({ destinationStepId: eligibleStep.id, step });
41395
41558
  evt.cancel = true;
41396
41559
  }
41397
41560
  });
41398
- this.on('beforePrevious', function (evt) {
41561
+ this.on('beforePrevious', (evt) => {
41399
41562
  if (pendo._.isUndefined(stepNumberOrAuto))
41400
41563
  return;
41401
- var eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'previous');
41564
+ let eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'previous');
41402
41565
  if (!isPreviousIntercepted && stepNumberOrAuto) {
41403
41566
  isPreviousIntercepted = true;
41404
- pendo.goToStep({ destinationStepId: eligibleStep.id, step: step });
41567
+ pendo.goToStep({ destinationStepId: eligibleStep.id, step });
41405
41568
  evt.cancel = true;
41406
41569
  }
41407
41570
  });
41408
41571
  function findEligibleSkipStep(stepNumber, direction) {
41409
41572
  // Find the next eligible step by using getPosition of step (1 based)
41410
41573
  // getPosition - 2 gives the previous step
41411
- var skipForwardStep = findStepOnPage(guide.getPositionOfStep(step), 'next', stepNumber);
41412
- var skipPreviousStep = findStepOnPage(guide.getPositionOfStep(step) - 2, 'previous', stepNumber);
41574
+ let skipForwardStep = findStepOnPage(guide.getPositionOfStep(step), 'next', stepNumber);
41575
+ let skipPreviousStep = findStepOnPage(guide.getPositionOfStep(step) - 2, 'previous', stepNumber);
41413
41576
  if (skipForwardStep && direction == 'next') {
41414
- pendo.goToStep({ destinationStepId: skipForwardStep, step: step });
41577
+ pendo.goToStep({ destinationStepId: skipForwardStep, step });
41415
41578
  }
41416
41579
  if (skipPreviousStep && direction == 'previous') {
41417
- pendo.goToStep({ destinationStepId: skipPreviousStep, step: step });
41580
+ pendo.goToStep({ destinationStepId: skipPreviousStep, step });
41418
41581
  }
41419
41582
  return direction === 'next' ? skipForwardStep : skipPreviousStep;
41420
41583
  }
41421
41584
  function findStepOnPage(stepIndex, direction, stepNumber) {
41422
41585
  if (pendo._.isNaN(stepIndex))
41423
41586
  return;
41424
- var $step = guide.steps[stepIndex];
41587
+ let $step = guide.steps[stepIndex];
41425
41588
  if ($step && !$step.canShow()) {
41426
41589
  if (stepNumber !== 'auto') {
41427
41590
  return guide.steps[stepNumber - 1];
@@ -41438,34 +41601,34 @@ var SkipToEligibleStep = {
41438
41601
  }
41439
41602
  }
41440
41603
  },
41441
- test: function (step, guide, pendo) {
41604
+ test(step, guide, pendo) {
41442
41605
  var _a;
41443
- var guideContainerAriaLabel = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find(guideMarkdownUtil.containerSelector).attr('aria-label');
41606
+ const guideContainerAriaLabel = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find(guideMarkdownUtil.containerSelector).attr('aria-label');
41444
41607
  return pendo._.isString(guideContainerAriaLabel) && guideContainerAriaLabel.indexOf('{skipStep') !== -1;
41445
41608
  },
41446
- designerListener: function (pendo) {
41447
- var target = pendo.dom.getBody();
41448
- var config = {
41609
+ designerListener(pendo) {
41610
+ const target = pendo.dom.getBody();
41611
+ const config = {
41449
41612
  attributeFilter: ['data-layout'],
41450
41613
  attributes: true,
41451
41614
  childList: true,
41452
41615
  characterData: true,
41453
41616
  subtree: true
41454
41617
  };
41455
- var MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
41456
- var observer = new MutationObserver(applySkipStepIndicator);
41618
+ const MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
41619
+ const observer = new MutationObserver(applySkipStepIndicator);
41457
41620
  observer.observe(target, config);
41458
41621
  // create an observer instance
41459
41622
  function applySkipStepIndicator(mutations) {
41460
41623
  pendo._.each(mutations, function (mutation) {
41461
41624
  var _a, _b;
41462
- var nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
41625
+ const nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
41463
41626
  if (mutation.addedNodes.length && nodeHasQuerySelector) {
41464
- var guideContainer = mutation.addedNodes[0].querySelectorAll(guideMarkdownUtil.containerSelector);
41465
- var guideContainerAriaLabel = (_b = guideContainer[0]) === null || _b === void 0 ? void 0 : _b.getAttribute('aria-label');
41627
+ let guideContainer = mutation.addedNodes[0].querySelectorAll(guideMarkdownUtil.containerSelector);
41628
+ let guideContainerAriaLabel = (_b = guideContainer[0]) === null || _b === void 0 ? void 0 : _b.getAttribute('aria-label');
41466
41629
  if (guideContainerAriaLabel) {
41467
41630
  if (guideContainerAriaLabel.match(skipStepRegex)) {
41468
- var fullSkipStepString = guideContainerAriaLabel.match(skipStepRegex)[0];
41631
+ let fullSkipStepString = guideContainerAriaLabel.match(skipStepRegex)[0];
41469
41632
  guideContainerAriaLabel.replace(fullSkipStepString, '');
41470
41633
  if (!pendo.dom('#_pendoSkipIcon').length) {
41471
41634
  pendo.dom(guideMarkdownUtil.containerSelector).append(skipIcon('#999', '30px').trim());
@@ -41476,30 +41639,48 @@ var SkipToEligibleStep = {
41476
41639
  });
41477
41640
  }
41478
41641
  function skipIcon(color, size) {
41479
- return ("<div title=\"Skip step added\"><svg id=\"_pendoSkipIcon\" version=\"1.0\" xmlns=\"http://www.w3.org/2000/svg\"\n width=\"".concat(size, "\" height=\"").concat(size, "\" viewBox=\"0 0 512.000000 512.000000\"\n preserveAspectRatio=\"xMidYMid meet\" style=\"bottom:5px; right:10px; position: absolute;\">\n <g transform=\"translate(0.000000,512.000000) scale(0.100000,-0.100000)\"\n fill=\"").concat(color, "\" stroke=\"none\">\n <path d=\"M2185 4469 c-363 -38 -739 -186 -1034 -407 -95 -71 -273 -243 -357\n -343 -205 -246 -364 -577 -429 -897 -25 -121 -45 -288 -45 -373 l0 -49 160 0\n 160 0 0 48 c0 26 5 88 10 137 68 593 417 1103 940 1374 1100 570 2418 -137\n 2560 -1374 5 -49 10 -111 10 -137 l0 -47 -155 -3 -155 -3 235 -235 235 -236\n 235 236 235 235 -155 3 -155 3 0 48 c0 27 -5 95 -10 152 -100 989 -878 1767\n -1869 1868 -117 12 -298 12 -416 0z\"/>\n <path d=\"M320 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z\"/>\n <path d=\"M960 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z\"/>\n <path d=\"M1600 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z\"/>\n <path d=\"M2240 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z\"/>\n <path d=\"M2880 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z\"/>\n <path d=\"M3840 1440 l0 -160 480 0 480 0 0 160 0 160 -480 0 -480 0 0 -160z\"/>\n </g></svg></div>\n "));
41642
+ return (`<div title="Skip step added"><svg id="_pendoSkipIcon" version="1.0" xmlns="http://www.w3.org/2000/svg"
41643
+ width="${size}" height="${size}" viewBox="0 0 512.000000 512.000000"
41644
+ preserveAspectRatio="xMidYMid meet" style="bottom:5px; right:10px; position: absolute;">
41645
+ <g transform="translate(0.000000,512.000000) scale(0.100000,-0.100000)"
41646
+ fill="${color}" stroke="none">
41647
+ <path d="M2185 4469 c-363 -38 -739 -186 -1034 -407 -95 -71 -273 -243 -357
41648
+ -343 -205 -246 -364 -577 -429 -897 -25 -121 -45 -288 -45 -373 l0 -49 160 0
41649
+ 160 0 0 48 c0 26 5 88 10 137 68 593 417 1103 940 1374 1100 570 2418 -137
41650
+ 2560 -1374 5 -49 10 -111 10 -137 l0 -47 -155 -3 -155 -3 235 -235 235 -236
41651
+ 235 236 235 235 -155 3 -155 3 0 48 c0 27 -5 95 -10 152 -100 989 -878 1767
41652
+ -1869 1868 -117 12 -298 12 -416 0z"/>
41653
+ <path d="M320 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
41654
+ <path d="M960 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
41655
+ <path d="M1600 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
41656
+ <path d="M2240 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
41657
+ <path d="M2880 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
41658
+ <path d="M3840 1440 l0 -160 480 0 480 0 0 160 0 160 -480 0 -480 0 0 -160z"/>
41659
+ </g></svg></div>
41660
+ `);
41480
41661
  }
41481
41662
  }
41482
41663
  };
41483
41664
 
41484
41665
  function GuideMarkdown() {
41485
- var guideMarkdown;
41486
- var pluginApi;
41487
- var globalPendo;
41666
+ let guideMarkdown;
41667
+ let pluginApi;
41668
+ let globalPendo;
41488
41669
  return {
41489
41670
  name: 'GuideMarkdown',
41490
41671
  initialize: init,
41491
- teardown: teardown
41672
+ teardown
41492
41673
  };
41493
41674
  function init(pendo, PluginAPI) {
41494
41675
  globalPendo = pendo;
41495
41676
  pluginApi = PluginAPI;
41496
- var configReader = PluginAPI.ConfigReader;
41497
- var GUIDEMARKDOWN_CONFIG = 'guideMarkdown';
41677
+ const configReader = PluginAPI.ConfigReader;
41678
+ const GUIDEMARKDOWN_CONFIG = 'guideMarkdown';
41498
41679
  configReader.addOption(GUIDEMARKDOWN_CONFIG, [
41499
41680
  configReader.sources.SNIPPET_SRC,
41500
41681
  configReader.sources.PENDO_CONFIG_SRC
41501
41682
  ], false);
41502
- var markdownScriptsEnabled = configReader.get(GUIDEMARKDOWN_CONFIG);
41683
+ const markdownScriptsEnabled = configReader.get(GUIDEMARKDOWN_CONFIG);
41503
41684
  if (!markdownScriptsEnabled)
41504
41685
  return;
41505
41686
  guideMarkdown = [PollBranching, MetadataSubstitution, RequiredQuestions, SkipToEligibleStep];
@@ -42538,8 +42719,8 @@ function Feedback() {
42538
42719
  var widgetLoaded = false;
42539
42720
  var feedbackAllowedProductId = '';
42540
42721
  var initialized = false;
42541
- var PING_COOKIE = 'feedback_ping_sent';
42542
- var PING_COOKIE_EXPIRATION = 1000 * 60 * 60;
42722
+ const PING_COOKIE = 'feedback_ping_sent';
42723
+ const PING_COOKIE_EXPIRATION = 1000 * 60 * 60;
42543
42724
  var overflowMediaQuery = '@media only screen and (max-device-width:1112px){#feedback-widget{overflow-y:scroll}}';
42544
42725
  var slideIn = '@-webkit-keyframes pendoFeedbackSlideIn{from{opacity:0;transform:translate(145px,0) rotate(270deg) translateY(-50%)}to{opacity:1;transform:translate(50%,0) rotate(270deg) translateY(-50%)}}@keyframes pendoFeedbackSlideIn{from{opacity:0;transform:translate(145px,0) rotate(270deg) translateY(-50%)}to{opacity:1;transform:translate(50%,0) rotate(270deg) translateY(-50%)}}';
42545
42726
  var slideInLeft = '@-webkit-keyframes pendoFeedbackSlideIn-left{from{opacity:0;transform:rotate(270deg) translateX(-55%) translateY(-55%)}to{opacity:1;transform:rotate(270deg) translateX(-55%) translateY(0)}}@keyframes pendoFeedbackSlideIn-left{from{opacity:0;transform:rotate(270deg) translateX(-55%) translateY(-55%)}to{opacity:1;transform:rotate(270deg) translateX(-55%) translateY(0)}}';
@@ -42559,28 +42740,28 @@ function Feedback() {
42559
42740
  feedbackStyles: 'pendo-feedback-styles',
42560
42741
  feedbackFrameStyles: 'pendo-feedback-visible-buttons-styles'
42561
42742
  };
42562
- var globalPendo;
42563
- var pluginApi;
42743
+ let globalPendo;
42744
+ let pluginApi;
42564
42745
  return {
42565
42746
  name: 'Feedback',
42566
- initialize: initialize,
42567
- teardown: teardown,
42568
- validate: validate
42747
+ initialize,
42748
+ teardown,
42749
+ validate
42569
42750
  };
42570
42751
  function initialize(pendo, PluginAPI) {
42571
42752
  globalPendo = pendo;
42572
42753
  pluginApi = PluginAPI;
42573
42754
  var publicFeedback = {
42574
- ping: ping,
42575
- init: init,
42755
+ ping,
42756
+ init,
42576
42757
  initialized: getInitialized,
42577
- loginAndRedirect: loginAndRedirect,
42578
- openFeedback: openFeedback,
42579
- initializeFeedbackOnce: initializeFeedbackOnce,
42580
- isFeedbackLoaded: isFeedbackLoaded,
42581
- convertPendoToFeedbackOptions: convertPendoToFeedbackOptions,
42758
+ loginAndRedirect,
42759
+ openFeedback,
42760
+ initializeFeedbackOnce,
42761
+ isFeedbackLoaded,
42762
+ convertPendoToFeedbackOptions,
42582
42763
  isUnsupportedIE: pendo._.partial(isUnsupportedIE, PluginAPI),
42583
- removeFeedbackWidget: removeFeedbackWidget
42764
+ removeFeedbackWidget
42584
42765
  };
42585
42766
  pendo.feedback = publicFeedback;
42586
42767
  pendo.getFeedbackSettings = getFeedbackSettings;
@@ -42608,7 +42789,7 @@ function Feedback() {
42608
42789
  */
42609
42790
  PluginAPI.agentStorage.registry.addLocal(PING_COOKIE, { duration: PING_COOKIE_EXPIRATION });
42610
42791
  return {
42611
- validate: validate
42792
+ validate
42612
42793
  };
42613
42794
  }
42614
42795
  function teardown() {
@@ -42628,18 +42809,18 @@ function Feedback() {
42628
42809
  return result;
42629
42810
  }
42630
42811
  function pingOrInitialize() {
42631
- var options = getPendoOptions();
42812
+ const options = getPendoOptions();
42632
42813
  if (initialized) {
42633
- var feedbackOptions = convertPendoToFeedbackOptions(options);
42814
+ const feedbackOptions = convertPendoToFeedbackOptions(options);
42634
42815
  ping(feedbackOptions);
42635
42816
  }
42636
42817
  else if (shouldInitializeFeedback() && !globalPendo._.isEmpty(options)) {
42637
- var settings = pluginApi.ConfigReader.get('feedbackSettings');
42638
- init(options, settings)["catch"](globalPendo._.noop);
42818
+ const settings = pluginApi.ConfigReader.get('feedbackSettings');
42819
+ init(options, settings).catch(globalPendo._.noop);
42639
42820
  }
42640
42821
  }
42641
42822
  function handleIdentityChange(event) {
42642
- var visitorId = globalPendo._.get(event, 'data.0.visitor_id') || globalPendo._.get(event, 'data.0.options.visitor.id');
42823
+ const visitorId = globalPendo._.get(event, 'data.0.visitor_id') || globalPendo._.get(event, 'data.0.options.visitor.id');
42643
42824
  if (globalPendo.isAnonymousVisitor(visitorId)) {
42644
42825
  removeFeedbackWidget();
42645
42826
  return;
@@ -42709,9 +42890,9 @@ function Feedback() {
42709
42890
  if (toSend.data && toSend.data !== '{}' && toSend.data !== 'null') {
42710
42891
  return globalPendo.ajax
42711
42892
  .postJSON(getFullUrl('/widget/pendo_ping'), toSend)
42712
- .then(function (response) {
42893
+ .then((response) => {
42713
42894
  onWidgetPingResponse(response);
42714
- })["catch"](function () { onPingFailure(); });
42895
+ }).catch(() => { onPingFailure(); });
42715
42896
  }
42716
42897
  }
42717
42898
  return pluginApi.q.resolve();
@@ -42845,10 +43026,10 @@ function Feedback() {
42845
43026
  return globalPendo.ajax.postJSON(getFullUrl('/analytics'), toSend);
42846
43027
  }
42847
43028
  function addOverlay() {
42848
- var widget = globalPendo.dom("#".concat(elemIds.feedbackWidget));
43029
+ const widget = globalPendo.dom(`#${elemIds.feedbackWidget}`);
42849
43030
  if (!widget)
42850
43031
  return;
42851
- var overlayStyles = {
43032
+ const overlayStyles = {
42852
43033
  'position': 'fixed',
42853
43034
  'top': '0',
42854
43035
  'right': '0',
@@ -42860,7 +43041,7 @@ function Feedback() {
42860
43041
  'animation': 'pendoFeedbackFadeIn 0.5s 0s 1 alternate both',
42861
43042
  '-webkit-animation': 'pendoFeedbackFadeIn 0.5s 0s 1 alternate both'
42862
43043
  };
42863
- var overlayElement = globalPendo.dom(document.createElement('div'));
43044
+ const overlayElement = globalPendo.dom(document.createElement('div'));
42864
43045
  overlayElement.attr('id', 'feedback-overlay');
42865
43046
  overlayElement.css(overlayStyles);
42866
43047
  overlayElement.appendTo(widget.getParent());
@@ -42965,22 +43146,22 @@ function Feedback() {
42965
43146
  }
42966
43147
  }
42967
43148
  function buildOuterTriggerDiv(positionInfo) {
42968
- var horizontalStyles = getHorizontalPositionStyles(positionInfo);
42969
- var verticalStyles = getVerticalPositionStyles(positionInfo);
42970
- var styles = globalPendo._.extend({
43149
+ const horizontalStyles = getHorizontalPositionStyles(positionInfo);
43150
+ const verticalStyles = getVerticalPositionStyles(positionInfo);
43151
+ const styles = globalPendo._.extend({
42971
43152
  'position': 'fixed',
42972
43153
  'height': '43px',
42973
43154
  'opacity': '1 !important',
42974
43155
  'z-index': '9001'
42975
43156
  }, horizontalStyles, verticalStyles);
42976
- var outerTrigger = globalPendo.dom(document.createElement('div'));
43157
+ const outerTrigger = globalPendo.dom(document.createElement('div'));
42977
43158
  outerTrigger.attr('id', elemIds.feedbackTrigger);
42978
43159
  outerTrigger.css(styles);
42979
43160
  outerTrigger.attr('data-turbolinks-permanent', '');
42980
43161
  return outerTrigger;
42981
43162
  }
42982
43163
  function buildNotification() {
42983
- var styles = {
43164
+ const styles = {
42984
43165
  'background-color': '#D85039',
42985
43166
  'color': '#fff',
42986
43167
  'border-radius': '50%',
@@ -42997,20 +43178,20 @@ function Feedback() {
42997
43178
  'animation-delay': '1s',
42998
43179
  'animation-iteration-count': '1'
42999
43180
  };
43000
- var notification = globalPendo.dom(document.createElement('span'));
43181
+ const notification = globalPendo.dom(document.createElement('span'));
43001
43182
  notification.attr('id', 'feedback-trigger-notification');
43002
43183
  notification.css(styles);
43003
43184
  return notification;
43004
43185
  }
43005
43186
  function buildTriggerButton(settings, positionInfo) {
43006
- var borderRadius;
43187
+ let borderRadius;
43007
43188
  if (positionInfo.horizontalPosition === 'left') {
43008
43189
  borderRadius = '0 0 5px 5px';
43009
43190
  }
43010
43191
  else {
43011
43192
  borderRadius = '3px 3px 0 0';
43012
43193
  }
43013
- var styles = {
43194
+ const styles = {
43014
43195
  'border': 'none',
43015
43196
  'padding': '11px 18px 14px 18px',
43016
43197
  'background-color': settings.triggerColor,
@@ -43021,21 +43202,32 @@ function Feedback() {
43021
43202
  'cursor': 'pointer',
43022
43203
  'text-align': 'left'
43023
43204
  };
43024
- var triggerButton = globalPendo.dom(document.createElement('button'));
43205
+ const triggerButton = globalPendo.dom(document.createElement('button'));
43025
43206
  triggerButton.attr('id', elemIds.feedbackTriggerButton);
43026
43207
  triggerButton.css(styles);
43027
43208
  triggerButton.text(settings.triggerText);
43028
43209
  return triggerButton;
43029
43210
  }
43030
43211
  function addTriggerPseudoStyles() {
43031
- var pseudoStyles = "\n #feedback-trigger button:hover {\n box-shadow: 0 -5px 20px rgba(0,0,0,.19) !important;\n outline: none !important;\n background: #3e566f !important;\n }\n #feedback-trigger button:focus {\n box-shadow: 0 -5px 20px rgba(0,0,0,.19) !important;\n outline: none !important;\n background: #3e566f !important;\n }\n ";
43212
+ const pseudoStyles = `
43213
+ #feedback-trigger button:hover {
43214
+ box-shadow: 0 -5px 20px rgba(0,0,0,.19) !important;
43215
+ outline: none !important;
43216
+ background: #3e566f !important;
43217
+ }
43218
+ #feedback-trigger button:focus {
43219
+ box-shadow: 0 -5px 20px rgba(0,0,0,.19) !important;
43220
+ outline: none !important;
43221
+ background: #3e566f !important;
43222
+ }
43223
+ `;
43032
43224
  pluginApi.util.addInlineStyles('pendo-feedback-trigger-styles', pseudoStyles);
43033
43225
  }
43034
43226
  function createTrigger(settings, positionInfo) {
43035
43227
  addTriggerPseudoStyles();
43036
- var triggerElement = buildOuterTriggerDiv(positionInfo);
43037
- var notificationElement = buildNotification();
43038
- var triggerButtonElement = buildTriggerButton(settings, positionInfo);
43228
+ const triggerElement = buildOuterTriggerDiv(positionInfo);
43229
+ const notificationElement = buildNotification();
43230
+ const triggerButtonElement = buildTriggerButton(settings, positionInfo);
43039
43231
  triggerElement.append(notificationElement);
43040
43232
  triggerElement.append(triggerButtonElement);
43041
43233
  triggerElement.appendTo(globalPendo.dom.getBody());
@@ -43059,7 +43251,7 @@ function Feedback() {
43059
43251
  iframeWrapper.css(getWidgetOriginalStyles());
43060
43252
  iframeWrapper.attr('id', elemIds.feedbackWidget);
43061
43253
  iframeWrapper.attr('data-turbolinks-permanent', 'true');
43062
- iframeWrapper.addClass("buttonIs-".concat(horizontalPosition));
43254
+ iframeWrapper.addClass(`buttonIs-${horizontalPosition}`);
43063
43255
  return iframeWrapper;
43064
43256
  }
43065
43257
  function buildIframeContainer() {
@@ -43076,13 +43268,22 @@ function Feedback() {
43076
43268
  return iframeContainer;
43077
43269
  }
43078
43270
  function addWidgetVisibleButtonStyles(buttonStylePosition) {
43079
- var side = buttonStylePosition === 'left' ? 'left' : 'right'; // just in case something was not left or right for some reason
43080
- var styles = "\n .buttonIs-".concat(side, ".visible {\n ").concat(side, ": 0 !important;\n width: 470px !important;\n animation-direction: alternate-reverse !important;\n animation: pendoFeedbackSlideFrom-").concat(side, " 0.5s 0s 1 alternate both !important;\n -webkit-animation: pendoFeedbackSlideFrom-").concat(side, " 0.5s 0s 1 alternate both !important;\n z-index: 9002 !important;\n }\n ");
43271
+ let side = buttonStylePosition === 'left' ? 'left' : 'right'; // just in case something was not left or right for some reason
43272
+ const styles = `
43273
+ .buttonIs-${side}.visible {
43274
+ ${side}: 0 !important;
43275
+ width: 470px !important;
43276
+ animation-direction: alternate-reverse !important;
43277
+ animation: pendoFeedbackSlideFrom-${side} 0.5s 0s 1 alternate both !important;
43278
+ -webkit-animation: pendoFeedbackSlideFrom-${side} 0.5s 0s 1 alternate both !important;
43279
+ z-index: 9002 !important;
43280
+ }
43281
+ `;
43081
43282
  pluginApi.util.addInlineStyles(elemIds.feedbackFrameStyles, styles);
43082
43283
  }
43083
43284
  function initialiseWidgetFrame(horizontalPosition) {
43084
43285
  addWidgetVisibleButtonStyles(horizontalPosition);
43085
- var iframeElement = buildIframeWrapper(horizontalPosition);
43286
+ const iframeElement = buildIframeWrapper(horizontalPosition);
43086
43287
  iframeElement.append(buildIframeContainer());
43087
43288
  iframeElement.appendTo(globalPendo.dom.getBody());
43088
43289
  subscribeToIframeMessages();
@@ -43106,7 +43307,7 @@ function Feedback() {
43106
43307
  return widgetLoaded;
43107
43308
  }
43108
43309
  function getPendoOptions() {
43109
- var options = pluginApi.ConfigReader.getLocalConfig();
43310
+ let options = pluginApi.ConfigReader.getLocalConfig();
43110
43311
  if (!globalPendo._.isObject(options))
43111
43312
  options = {};
43112
43313
  if (!globalPendo._.isObject(options.visitor))
@@ -43134,7 +43335,7 @@ function Feedback() {
43134
43335
  return true;
43135
43336
  }
43136
43337
  function getQueryParam(url, paramName) {
43137
- var results = new RegExp('[?&]' + paramName + '=([^&#]*)').exec(url);
43338
+ const results = new RegExp('[?&]' + paramName + '=([^&#]*)').exec(url);
43138
43339
  if (results == null) {
43139
43340
  return null;
43140
43341
  }
@@ -43151,13 +43352,13 @@ function Feedback() {
43151
43352
  return pluginApi.q.reject();
43152
43353
  if (!canInitFeedback(pendoOptions))
43153
43354
  return pluginApi.q.reject();
43154
- var feedbackOptions = convertPendoToFeedbackOptions(pendoOptions);
43355
+ const feedbackOptions = convertPendoToFeedbackOptions(pendoOptions);
43155
43356
  try {
43156
- var fdbkDst_1 = getQueryParam(globalPendo.url.get(), 'fdbkDst');
43157
- if (fdbkDst_1 && fdbkDst_1.startsWith('case')) {
43357
+ const fdbkDst = getQueryParam(globalPendo.url.get(), 'fdbkDst');
43358
+ if (fdbkDst && fdbkDst.startsWith('case')) {
43158
43359
  initialized = true;
43159
43360
  getFeedbackLoginUrl().then(function (loginUrl) {
43160
- var destinationUrl = loginUrl + '&fdbkDst=' + fdbkDst_1;
43361
+ const destinationUrl = loginUrl + '&fdbkDst=' + fdbkDst;
43161
43362
  window.location.href = destinationUrl;
43162
43363
  });
43163
43364
  return;
@@ -43206,7 +43407,7 @@ function Feedback() {
43206
43407
  function convertPendoToFeedbackOptions(options) {
43207
43408
  var jwtOptions = pluginApi.agent.getJwtInfoCopy();
43208
43409
  if (globalPendo._.isEmpty(jwtOptions)) {
43209
- var feedbackOptions = {};
43410
+ const feedbackOptions = {};
43210
43411
  feedbackOptions.user = globalPendo._.pick(options.visitor, 'id', 'full_name', 'firstName', 'lastName', 'email', 'tags', 'custom_allowed_products');
43211
43412
  globalPendo._.extend(feedbackOptions.user, { allowed_products: [{ id: feedbackAllowedProductId }] });
43212
43413
  feedbackOptions.account = globalPendo._.pick(options.account, 'id', 'name', 'monthly_value', 'is_paying', 'tags');
@@ -48741,32 +48942,31 @@ var n;
48741
48942
  }(n || (n = {}));
48742
48943
  return record; }
48743
48944
 
48744
- var SessionRecorderBuffer = /** @class */ (function () {
48745
- function SessionRecorderBuffer(interval, maxCount) {
48746
- if (maxCount === void 0) { maxCount = Infinity; }
48945
+ class SessionRecorderBuffer {
48946
+ constructor(interval, maxCount = Infinity) {
48747
48947
  this.data = [];
48748
48948
  this.sequenceNumber = 0;
48749
48949
  this.interval = interval;
48750
48950
  this.maxCount = maxCount;
48751
48951
  this.doubledMaxCount = maxCount * 2;
48752
48952
  }
48753
- SessionRecorderBuffer.prototype.isEmpty = function () {
48953
+ isEmpty() {
48754
48954
  return this.data.length === 0;
48755
- };
48756
- SessionRecorderBuffer.prototype.count = function () {
48955
+ }
48956
+ count() {
48757
48957
  return this.data.length;
48758
- };
48759
- SessionRecorderBuffer.prototype.clear = function () {
48958
+ }
48959
+ clear() {
48760
48960
  this.data.length = 0;
48761
- };
48762
- SessionRecorderBuffer.prototype.clearSequence = function () {
48961
+ }
48962
+ clearSequence() {
48763
48963
  this.sequenceNumber = 0;
48764
- };
48765
- SessionRecorderBuffer.prototype.push = function (event) {
48964
+ }
48965
+ push(event) {
48766
48966
  this.data.push(event);
48767
48967
  this.checkRateLimit();
48768
- };
48769
- SessionRecorderBuffer.prototype.pack = function (envelope, _) {
48968
+ }
48969
+ pack(envelope, _) {
48770
48970
  var eventsToSend = this.data.splice(0, this.maxCount);
48771
48971
  envelope.recordingPayload = eventsToSend;
48772
48972
  envelope.sequence = this.sequenceNumber;
@@ -48774,8 +48974,8 @@ var SessionRecorderBuffer = /** @class */ (function () {
48774
48974
  if (eventsToSend.length) {
48775
48975
  envelope.browserTime = eventsToSend[0].timestamp;
48776
48976
  }
48777
- envelope.recordingPayloadMetadata = _.map(eventsToSend, function (event) {
48778
- var metadata = _.pick(event, 'type', 'timestamp');
48977
+ envelope.recordingPayloadMetadata = _.map(eventsToSend, event => {
48978
+ const metadata = _.pick(event, 'type', 'timestamp');
48779
48979
  if (event.data) {
48780
48980
  metadata.data = _.pick(event.data, 'source', 'type', 'x', 'y', 'id', 'height', 'width', 'href');
48781
48981
  }
@@ -48783,30 +48983,18 @@ var SessionRecorderBuffer = /** @class */ (function () {
48783
48983
  });
48784
48984
  this.sequenceNumber += eventsToSend.length;
48785
48985
  return envelope;
48786
- };
48787
- SessionRecorderBuffer.prototype.checkRateLimit = function () {
48788
- var length = this.data.length;
48986
+ }
48987
+ checkRateLimit() {
48988
+ const length = this.data.length;
48789
48989
  if (length >= this.doubledMaxCount && length % this.maxCount === 0) {
48790
- var elapsed = this.data[length - 1].timestamp - this.data[length - this.doubledMaxCount].timestamp;
48990
+ const elapsed = this.data[length - 1].timestamp - this.data[length - this.doubledMaxCount].timestamp;
48791
48991
  if (elapsed <= this.interval && this.onRateLimit) {
48792
48992
  this.onRateLimit();
48793
48993
  }
48794
48994
  }
48795
- };
48796
- return SessionRecorderBuffer;
48797
- }());
48995
+ }
48996
+ }
48798
48997
 
48799
- var __assign = function() {
48800
- __assign = Object.assign || function __assign(t) {
48801
- for (var s, i = 1, n = arguments.length; i < n; i++) {
48802
- s = arguments[i];
48803
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
48804
- }
48805
- return t;
48806
- };
48807
- return __assign.apply(this, arguments);
48808
- };
48809
-
48810
48998
  function __rest(s, e) {
48811
48999
  var t = {};
48812
49000
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -48829,52 +49017,24 @@ function __awaiter(thisArg, _arguments, P, generator) {
48829
49017
  });
48830
49018
  }
48831
49019
 
48832
- function __generator(thisArg, body) {
48833
- 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);
48834
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
48835
- function verb(n) { return function (v) { return step([n, v]); }; }
48836
- function step(op) {
48837
- if (f) throw new TypeError("Generator is already executing.");
48838
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
48839
- 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;
48840
- if (y = 0, t) op = [op[0] & 2, t.value];
48841
- switch (op[0]) {
48842
- case 0: case 1: t = op; break;
48843
- case 4: _.label++; return { value: op[1], done: false };
48844
- case 5: _.label++; y = op[1]; op = [0]; continue;
48845
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
48846
- default:
48847
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
48848
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
48849
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
48850
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
48851
- if (t[2]) _.ops.pop();
48852
- _.trys.pop(); continue;
48853
- }
48854
- op = body.call(thisArg, _);
48855
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
48856
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
48857
- }
48858
- }
48859
-
48860
49020
  typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
48861
49021
  var e = new Error(message);
48862
49022
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
48863
49023
  };
48864
49024
 
48865
- var RECORDING_CONFIG_WORKERURL$1 = 'recording.workerUrl';
48866
- var MAX_SIZE = 2000000;
48867
- var RESOURCE_CACHING$1 = 'resourceCaching';
48868
- var Transport = /** @class */ (function () {
48869
- function Transport(WorkerClass, pendo, api) {
49025
+ const RECORDING_CONFIG_WORKERURL$1 = 'recording.workerUrl';
49026
+ const MAX_SIZE = 2000000;
49027
+ const RESOURCE_CACHING$1 = 'resourceCaching';
49028
+ class Transport {
49029
+ constructor(WorkerClass, pendo, api) {
48870
49030
  this.WorkerClass = WorkerClass;
48871
49031
  this.pendo = pendo;
48872
49032
  this.api = api;
48873
49033
  this.maxSize = MAX_SIZE;
48874
- this.lockID = "worker-lock-".concat(this.pendo.randomString(16));
49034
+ this.lockID = `worker-lock-${this.pendo.randomString(16)}`;
48875
49035
  this.isResourceCachingEnabled = this.api.ConfigReader.get(RESOURCE_CACHING$1);
48876
49036
  }
48877
- Transport.prototype.start = function (config) {
49037
+ start(config) {
48878
49038
  if (config.disableWorker)
48879
49039
  return;
48880
49040
  if (!this.worker) {
@@ -48884,7 +49044,7 @@ var Transport = /** @class */ (function () {
48884
49044
  this.worker = config.workerOverride;
48885
49045
  }
48886
49046
  else {
48887
- var workerUrl = this.api.ConfigReader.get(RECORDING_CONFIG_WORKERURL$1);
49047
+ const workerUrl = this.api.ConfigReader.get(RECORDING_CONFIG_WORKERURL$1);
48888
49048
  this.usesSelfHostedWorker = workerUrl != null;
48889
49049
  this.worker = workerUrl ? new Worker(workerUrl) : new this.WorkerClass();
48890
49050
  }
@@ -48898,35 +49058,34 @@ var Transport = /** @class */ (function () {
48898
49058
  this.worker = null;
48899
49059
  }
48900
49060
  }
48901
- };
48902
- Transport.prototype.stop = function () {
49061
+ }
49062
+ stop() {
48903
49063
  if (this.worker) {
48904
49064
  this.worker.terminate();
48905
49065
  delete this.worker;
48906
49066
  }
48907
- };
48908
- Transport.prototype.send = function (envelope, isUnload, failureCount) {
48909
- if (failureCount === void 0) { failureCount = 0; }
48910
- var url = envelope.url;
48911
- var payload = envelope.payload;
49067
+ }
49068
+ send(envelope, isUnload, failureCount = 0) {
49069
+ let { url } = envelope;
49070
+ const { payload } = envelope;
48912
49071
  if (failureCount > 0) {
48913
- url = "".concat(url, "&rt=").concat(failureCount);
49072
+ url = `${url}&rt=${failureCount}`;
48914
49073
  }
48915
49074
  if (this.worker && !isUnload && payload) {
48916
- var deferred_1 = {};
48917
- deferred_1.promise = new Promise$2(function (resolve, reject) {
48918
- deferred_1.resolve = resolve;
48919
- deferred_1.reject = reject;
49075
+ const deferred = {};
49076
+ deferred.promise = new Promise$2((resolve, reject) => {
49077
+ deferred.resolve = resolve;
49078
+ deferred.reject = reject;
48920
49079
  });
48921
- this.workerResponse = deferred_1;
48922
- this.worker.postMessage({ url: url, payload: payload, shouldCacheResources: this.isResourceCachingEnabled });
48923
- return deferred_1.promise;
49080
+ this.workerResponse = deferred;
49081
+ this.worker.postMessage({ url, payload, shouldCacheResources: this.isResourceCachingEnabled });
49082
+ return deferred.promise;
48924
49083
  }
48925
49084
  else {
48926
49085
  if (!envelope.body) {
48927
- var strPayload = JSON.stringify(payload);
49086
+ const strPayload = JSON.stringify(payload);
48928
49087
  if (strPayload.length > this.maxSize) {
48929
- var error = new Error('maximum recording payload size exceeded');
49088
+ const error = new Error('maximum recording payload size exceeded');
48930
49089
  error.reason = 'HEAVY_EVENT';
48931
49090
  error.context = {
48932
49091
  size: strPayload.length,
@@ -48937,14 +49096,14 @@ var Transport = /** @class */ (function () {
48937
49096
  envelope.body = this.pendo.compress(strPayload, 'binary');
48938
49097
  delete envelope.payload;
48939
49098
  }
48940
- url = "".concat(url, "&ct=").concat(new Date().getTime());
49099
+ url = `${url}&ct=${new Date().getTime()}`;
48941
49100
  return this.post(url, {
48942
49101
  keepalive: isUnload,
48943
49102
  body: envelope.body
48944
49103
  });
48945
49104
  }
48946
- };
48947
- Transport.prototype.post = function (url, options) {
49105
+ }
49106
+ post(url, options) {
48948
49107
  options.method = 'POST';
48949
49108
  if (options.keepalive && this.api.transmit.fetchKeepalive.supported()) {
48950
49109
  return this.api.transmit.fetchKeepalive(url, options);
@@ -48956,57 +49115,46 @@ var Transport = /** @class */ (function () {
48956
49115
  else {
48957
49116
  return this.pendo.ajax.post(url, options.body);
48958
49117
  }
48959
- };
48960
- Transport.prototype._onMessage = function (messageEvent) {
48961
- return __awaiter(this, void 0, void 0, function () {
48962
- return __generator(this, function (_a) {
48963
- switch (_a.label) {
48964
- case 0:
48965
- if (!(messageEvent.data && messageEvent.data.ready)) return [3 /*break*/, 2];
48966
- // When the lock is released, we can assume the worker was terminated or closed
48967
- return [4 /*yield*/, navigator.locks.request(this.lockID, function () { })];
48968
- case 1:
48969
- // When the lock is released, we can assume the worker was terminated or closed
48970
- _a.sent();
48971
- this.onWorkerMessage({ type: 'workerDied' });
48972
- _a.label = 2;
48973
- case 2:
48974
- // handle non-POST request responses from worker
48975
- if (messageEvent.data && messageEvent.data.type) {
48976
- this.onWorkerMessage(messageEvent.data);
48977
- return [2 /*return*/];
48978
- }
48979
- // handle POST request response from worker
48980
- if (messageEvent.data && messageEvent.data.error) {
48981
- if ((messageEvent.data.status && messageEvent.data.status < 500) ||
48982
- messageEvent.data.sequence == null) {
48983
- this.api.log.critical('Failed to send recording data from web worker', { error: messageEvent.data.error });
48984
- }
48985
- if (this.workerResponse) {
48986
- this.workerResponse.reject();
48987
- this.workerResponse = null;
48988
- }
48989
- }
48990
- if (this.workerResponse) {
48991
- this.workerResponse.resolve();
48992
- this.workerResponse = null;
48993
- }
48994
- return [2 /*return*/];
49118
+ }
49119
+ _onMessage(messageEvent) {
49120
+ return __awaiter(this, void 0, void 0, function* () {
49121
+ if (messageEvent.data && messageEvent.data.ready && navigator.locks) {
49122
+ // When the lock is released, we can assume the worker was terminated or closed
49123
+ yield navigator.locks.request(this.lockID, () => { });
49124
+ this.onWorkerMessage({ type: 'workerDied' });
49125
+ }
49126
+ // handle non-POST request responses from worker
49127
+ if (messageEvent.data && messageEvent.data.type) {
49128
+ this.onWorkerMessage(messageEvent.data);
49129
+ return;
49130
+ }
49131
+ // handle POST request response from worker
49132
+ if (messageEvent.data && messageEvent.data.error) {
49133
+ if ((messageEvent.data.status && messageEvent.data.status < 500) ||
49134
+ messageEvent.data.sequence == null) {
49135
+ this.api.log.critical('Failed to send recording data from web worker', { error: messageEvent.data.error });
48995
49136
  }
48996
- });
49137
+ if (this.workerResponse) {
49138
+ this.workerResponse.reject();
49139
+ this.workerResponse = null;
49140
+ }
49141
+ }
49142
+ if (this.workerResponse) {
49143
+ this.workerResponse.resolve();
49144
+ this.workerResponse = null;
49145
+ }
48997
49146
  });
48998
- };
48999
- Transport.prototype._onError = function () {
49147
+ }
49148
+ _onError() {
49000
49149
  if (this.onError) {
49001
49150
  this.onError();
49002
49151
  }
49003
- };
49004
- return Transport;
49005
- }());
49152
+ }
49153
+ }
49006
49154
 
49007
- var ELEMENT_NODE = 1;
49008
- var INPUT_MASK = '*'.repeat(10);
49009
- var NUMBER_INPUT_MASK = '0'.repeat(10);
49155
+ const ELEMENT_NODE = 1;
49156
+ const INPUT_MASK = '*'.repeat(10);
49157
+ const NUMBER_INPUT_MASK = '0'.repeat(10);
49010
49158
  function isElementNode(node) {
49011
49159
  if (!node)
49012
49160
  return false;
@@ -49015,12 +49163,10 @@ function isElementNode(node) {
49015
49163
  return true;
49016
49164
  }
49017
49165
  function getParent(elem) {
49018
- var isElementShadowRoot = typeof window.ShadowRoot !== 'undefined' && elem instanceof window.ShadowRoot && elem.host;
49166
+ const isElementShadowRoot = typeof window.ShadowRoot !== 'undefined' && elem instanceof window.ShadowRoot && elem.host;
49019
49167
  return isElementShadowRoot ? elem.host : elem.parentNode;
49020
49168
  }
49021
- function distanceToMatch(node, selector, limit, distance) {
49022
- if (limit === void 0) { limit = Infinity; }
49023
- if (distance === void 0) { distance = 0; }
49169
+ function distanceToMatch(node, selector, limit = Infinity, distance = 0) {
49024
49170
  if (distance > limit)
49025
49171
  return -1;
49026
49172
  if (!node)
@@ -49034,13 +49180,13 @@ function distanceToMatch(node, selector, limit, distance) {
49034
49180
  return distanceToMatch(getParent(node), selector, limit, distance + 1);
49035
49181
  }
49036
49182
  function shouldMask(node, options) {
49037
- var maskAllText = options.maskAllText, maskTextSelector = options.maskTextSelector, unmaskTextSelector = options.unmaskTextSelector;
49183
+ const { maskAllText, maskTextSelector, unmaskTextSelector } = options;
49038
49184
  try {
49039
- var el = isElementNode(node) ? node : node.parentElement;
49185
+ const el = isElementNode(node) ? node : node.parentElement;
49040
49186
  if (el === null)
49041
49187
  return false;
49042
- var maskDistance = -1;
49043
- var unmaskDistance = -1;
49188
+ let maskDistance = -1;
49189
+ let unmaskDistance = -1;
49044
49190
  if (maskAllText) {
49045
49191
  unmaskDistance = distanceToMatch(el, unmaskTextSelector);
49046
49192
  if (unmaskDistance < 0) {
@@ -49073,8 +49219,8 @@ function isNumberInput(element) {
49073
49219
  }
49074
49220
  function shouldMaskInput(element, maskInputOptions) {
49075
49221
  if (maskInputOptions && isElementNode(element)) {
49076
- var tagName = (element.tagName || '').toLowerCase();
49077
- var type = (element.type || '').toLowerCase();
49222
+ const tagName = (element.tagName || '').toLowerCase();
49223
+ const type = (element.type || '').toLowerCase();
49078
49224
  if (maskInputOptions[tagName] || maskInputOptions[type]) {
49079
49225
  return true;
49080
49226
  }
@@ -50561,12 +50707,12 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
50561
50707
  }
50562
50708
  }
50563
50709
 
50564
- var ONE_HUNDRED_MB_IN_BYTES = 100 * 1024 * 1024;
50710
+ const ONE_HUNDRED_MB_IN_BYTES = 100 * 1024 * 1024;
50565
50711
  function matchHostedResources(recordingEvent, stringifiedRecordingPayload) {
50566
- var fontURLRegex = /https:\/\/[^"\\\s]+?\.(woff2?|ttf|otf|eot)(\?[^"\\\s]*)?\b/g;
50567
- var matches = stringifiedRecordingPayload.match(fontURLRegex);
50712
+ const fontURLRegex = /https:\/\/[^"\\\s]+?\.(woff2?|ttf|otf|eot)(\?[^"\\\s]*)?\b/g;
50713
+ const matches = stringifiedRecordingPayload.match(fontURLRegex);
50568
50714
  // de-duplicate matches
50569
- var hostedResources = matches ? Array.from(new Set(matches)) : [];
50715
+ const hostedResources = matches ? Array.from(new Set(matches)) : [];
50570
50716
  return {
50571
50717
  type: 'recording',
50572
50718
  visitorId: recordingEvent.visitorId,
@@ -50581,75 +50727,77 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
50581
50727
  recordingPayloadMetadata: [],
50582
50728
  sequence: 0,
50583
50729
  recordingPayloadCount: 0,
50584
- hostedResources: hostedResources
50730
+ hostedResources
50585
50731
  };
50586
50732
  }
50587
50733
  // keep in mind changes here may need addressing in the extension worker proxy as well
50588
50734
  self.onmessage = function (e) {
50589
50735
  try {
50590
50736
  if (e.data.type === 'init' && e.data.lockID) {
50591
- navigator.locks.request(e.data.lockID, function () {
50592
- postMessage({ ready: true });
50593
- // This unresolved promise keeps the lock held with the worker until the worker is
50594
- // terminated at which point the lock is released.
50595
- return new Promise$2(function () { });
50596
- });
50737
+ if (navigator.locks) {
50738
+ navigator.locks.request(e.data.lockID, () => {
50739
+ postMessage({ ready: true });
50740
+ // This unresolved promise keeps the lock held with the worker until the worker is
50741
+ // terminated at which point the lock is released.
50742
+ return new Promise$2(() => { });
50743
+ });
50744
+ }
50597
50745
  return;
50598
50746
  }
50599
50747
  if (e.data.url && e.data.payload) {
50600
- var _a = e.data, url = _a.url, payload = _a.payload, shouldCacheResources = _a.shouldCacheResources;
50748
+ let { url, payload, shouldCacheResources } = e.data;
50601
50749
  if (Object.keys(payload).length === 0) {
50602
50750
  postMessage({
50603
50751
  type: 'emptyPayload'
50604
50752
  });
50605
50753
  }
50606
- var sequence_1 = payload.sequence;
50607
- var stringifiedRecordingPayload = JSON.stringify(payload.recordingPayload);
50754
+ const { sequence } = payload;
50755
+ const stringifiedRecordingPayload = JSON.stringify(payload.recordingPayload);
50608
50756
  // calculate and post back the recording payload size before the payload is compressed
50609
- var recordingPayloadSize = new TextEncoder().encode(stringifiedRecordingPayload).length;
50610
- var exceedsPayloadSizeLimit = recordingPayloadSize >= ONE_HUNDRED_MB_IN_BYTES;
50757
+ const recordingPayloadSize = new TextEncoder().encode(stringifiedRecordingPayload).length;
50758
+ const exceedsPayloadSizeLimit = recordingPayloadSize >= ONE_HUNDRED_MB_IN_BYTES;
50611
50759
  postMessage({
50612
50760
  type: 'recordingPayloadSize',
50613
- recordingPayloadSize: recordingPayloadSize,
50614
- exceedsPayloadSizeLimit: exceedsPayloadSizeLimit
50761
+ recordingPayloadSize,
50762
+ exceedsPayloadSizeLimit
50615
50763
  });
50616
50764
  // don't attempt to send the payload if it exceeds the allowed limit
50617
50765
  if (exceedsPayloadSizeLimit)
50618
50766
  return;
50619
50767
  if (shouldCacheResources) {
50620
- var hostedResourcesEvent = matchHostedResources(payload, stringifiedRecordingPayload);
50768
+ const hostedResourcesEvent = matchHostedResources(payload, stringifiedRecordingPayload);
50621
50769
  if (hostedResourcesEvent.hostedResources.length) {
50622
50770
  postMessage({
50623
50771
  type: 'hostedResources',
50624
- hostedResourcesEvent: hostedResourcesEvent
50772
+ hostedResourcesEvent
50625
50773
  });
50626
50774
  }
50627
50775
  }
50628
50776
  payload.recordingSize = recordingPayloadSize;
50629
- var body = compress(payload, 'binary');
50777
+ const body = compress(payload, 'binary');
50630
50778
  // we want to calculate ct (current time) as close as we can to the actual POST request
50631
50779
  // so that it's as accurate as possible
50632
- url = "".concat(url, "&ct=").concat(new Date().getTime());
50780
+ url = `${url}&ct=${new Date().getTime()}`;
50633
50781
  fetch(url, {
50634
50782
  method: 'POST',
50635
- body: body
50783
+ body
50636
50784
  }).then(function (response) {
50637
50785
  if (response.status < 200 || response.status >= 300) {
50638
50786
  postMessage({
50639
- error: new Error("received status code ".concat(response.status, ": ").concat(response.statusText)),
50787
+ error: new Error(`received status code ${response.status}: ${response.statusText}`),
50640
50788
  status: response.status,
50641
- sequence: sequence_1
50789
+ sequence
50642
50790
  });
50643
50791
  }
50644
50792
  else {
50645
50793
  postMessage({
50646
- sequence: sequence_1
50794
+ sequence
50647
50795
  });
50648
50796
  }
50649
- })["catch"](function (e) {
50797
+ }).catch(function (e) {
50650
50798
  postMessage({
50651
50799
  error: e,
50652
- sequence: sequence_1
50800
+ sequence
50653
50801
  });
50654
50802
  });
50655
50803
  }
@@ -50684,12 +50832,12 @@ function createReplayPlugin() {
50684
50832
  * limit of number of keys in an object
50685
50833
  * if an object contains more keys than this limit, we would call its toString function directly
50686
50834
  */
50687
- var NUM_OF_KEYS_LIMIT = 50;
50835
+ const NUM_OF_KEYS_LIMIT = 50;
50688
50836
  /**
50689
50837
  * limit number of depth in an object
50690
50838
  * if an object is too deep, toString process may cause browser OOM
50691
50839
  */
50692
- var DEPTH_OF_LIMIT = 4;
50840
+ const DEPTH_OF_LIMIT = 4;
50693
50841
  /**
50694
50842
  * serialize an HTML element by creating a shallow clone of it with text content
50695
50843
  * and return the resulting outerHTML string (without the subtree)
@@ -50700,8 +50848,8 @@ function serializeHTML(node) {
50700
50848
  if (!node || node.nodeType !== node.ELEMENT_NODE) {
50701
50849
  return '';
50702
50850
  }
50703
- var nodeClone = node.cloneNode(false);
50704
- var textContent = node.textContent;
50851
+ const nodeClone = node.cloneNode(false);
50852
+ const { textContent } = node;
50705
50853
  if (textContent) {
50706
50854
  nodeClone.textContent = textContent;
50707
50855
  }
@@ -50715,7 +50863,7 @@ function isObject(obj) {
50715
50863
  return false;
50716
50864
  if (typeof obj !== 'object')
50717
50865
  return false;
50718
- var proto = Object.getPrototypeOf(obj);
50866
+ const proto = Object.getPrototypeOf(obj);
50719
50867
  return proto === Object.prototype || proto === null;
50720
50868
  }
50721
50869
  /**
@@ -50724,11 +50872,11 @@ function isObject(obj) {
50724
50872
  function isObjTooDeep(obj, limit) {
50725
50873
  if (limit === 0)
50726
50874
  return true;
50727
- var keys = Object.keys(obj);
50875
+ const keys = Object.keys(obj);
50728
50876
  if (keys.length === 0)
50729
50877
  return false;
50730
- return keys.some(function (key) {
50731
- var value = obj[key];
50878
+ return keys.some(key => {
50879
+ const value = obj[key];
50732
50880
  return isObject(value) && isObjTooDeep(value, limit - 1);
50733
50881
  });
50734
50882
  }
@@ -50744,7 +50892,7 @@ function shouldIgnore(_obj) {
50744
50892
  return false;
50745
50893
  }
50746
50894
  // out of keys limit
50747
- var keys = Object.keys(_obj);
50895
+ const keys = Object.keys(_obj);
50748
50896
  if (keys.length > NUM_OF_KEYS_LIMIT) {
50749
50897
  return true;
50750
50898
  }
@@ -50776,7 +50924,7 @@ function stringify(arg) {
50776
50924
  return value.toString ? value.toString() : '[object Object]';
50777
50925
  }
50778
50926
  if (value instanceof ArrayBuffer)
50779
- return "ArrayBuffer { byteLength: ".concat(value.byteLength, " }");
50927
+ return `ArrayBuffer { byteLength: ${value.byteLength} }`;
50780
50928
  if (value instanceof Error)
50781
50929
  return value.name + ': ' + value.message;
50782
50930
  if (value instanceof Node) {
@@ -50784,10 +50932,10 @@ function stringify(arg) {
50784
50932
  }
50785
50933
  // Handle events
50786
50934
  if (value instanceof Event) {
50787
- var eventResult = {};
50935
+ const eventResult = {};
50788
50936
  // eslint-disable-next-line guard-for-in
50789
- for (var eventKey in value) {
50790
- var eventValue = value[eventKey];
50937
+ for (const eventKey in value) {
50938
+ const eventValue = value[eventKey];
50791
50939
  eventResult[eventKey] = Array.isArray(eventValue) && eventValue[0] instanceof HTMLElement
50792
50940
  ? serializeHTML(eventValue[0])
50793
50941
  : eventValue;
@@ -50798,31 +50946,30 @@ function stringify(arg) {
50798
50946
  });
50799
50947
  }
50800
50948
 
50801
- var StackFrame = /** @class */ (function () {
50802
- function StackFrame(obj) {
50949
+ class StackFrame {
50950
+ constructor(obj) {
50803
50951
  this.fileName = obj.fileName || '';
50804
50952
  this.functionName = obj.functionName || '';
50805
50953
  this.lineNumber = obj.lineNumber;
50806
50954
  this.columnNumber = obj.columnNumber;
50807
50955
  }
50808
- StackFrame.prototype.toString = function () {
50809
- 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;
50956
+ toString() {
50957
+ const { fileName, functionName, lineNumber = '', columnNumber = '' } = this;
50810
50958
  return functionName
50811
- ? "".concat(functionName, " (").concat(fileName, ":").concat(lineNumber, ":").concat(columnNumber, ")")
50812
- : "".concat(fileName, ":").concat(lineNumber, ":").concat(columnNumber);
50813
- };
50814
- return StackFrame;
50815
- }());
50816
- var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
50817
- var CHROME_EDGE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
50818
- var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/;
50819
- var LOCATION_REGEXP = /(.+?)(?::(\d+))?(?::(\d+))?$/;
50820
- var DEFAULT_NUM_FRAMES_TO_SKIP = 5;
50821
- var ErrorStackParser = {
50959
+ ? `${functionName} (${fileName}:${lineNumber}:${columnNumber})`
50960
+ : `${fileName}:${lineNumber}:${columnNumber}`;
50961
+ }
50962
+ }
50963
+ const FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
50964
+ const CHROME_EDGE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
50965
+ const SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/;
50966
+ const LOCATION_REGEXP = /(.+?)(?::(\d+))?(?::(\d+))?$/;
50967
+ const DEFAULT_NUM_FRAMES_TO_SKIP = 5;
50968
+ const ErrorStackParser = {
50822
50969
  /**
50823
50970
  * Given an Error object, extract the most information from it.
50824
50971
  */
50825
- parse: function (error, maxFramesToSave) {
50972
+ parse(error, maxFramesToSave) {
50826
50973
  if (!(error === null || error === void 0 ? void 0 : error.stack))
50827
50974
  return [];
50828
50975
  // Chrome, Edge, Opera ≥15
@@ -50836,25 +50983,24 @@ var ErrorStackParser = {
50836
50983
  return [];
50837
50984
  },
50838
50985
  // Separate line and column numbers from a string of the form: (URI:Line:Column)
50839
- extractLocation: function (urlLike) {
50986
+ extractLocation(urlLike) {
50840
50987
  // Fail-fast but return locations like "(native)"
50841
50988
  if (urlLike.indexOf(':') === -1) {
50842
50989
  return [urlLike];
50843
50990
  }
50844
- var parts = LOCATION_REGEXP.exec(urlLike.replace(/[()]/g, ''));
50991
+ const parts = LOCATION_REGEXP.exec(urlLike.replace(/[()]/g, ''));
50845
50992
  if (!parts)
50846
- throw new Error("Cannot parse given url: ".concat(urlLike));
50993
+ throw new Error(`Cannot parse given url: ${urlLike}`);
50847
50994
  return [parts[1], parts[2] || undefined, parts[3] || undefined];
50848
50995
  },
50849
- parseHelper: function (_a, error, maxFramesToSave, callback) {
50850
- var regex = _a.regex, includeMatchedLine = _a.includeMatchedLine;
50851
- var lines = error.stack.split('\n');
50852
- var frames = [];
50853
- var validFramesFound = 0;
50854
- for (var i = 0; i < lines.length; i++) {
50855
- var line = lines[i];
50856
- var lineMatchesRegex = regex.test(line);
50857
- var shouldSkipLine = (includeMatchedLine && !lineMatchesRegex) || // if line doesn't match regex and we want matched lines, skip it
50996
+ parseHelper({ regex, includeMatchedLine }, error, maxFramesToSave, callback) {
50997
+ const lines = error.stack.split('\n');
50998
+ const frames = [];
50999
+ let validFramesFound = 0;
51000
+ for (let i = 0; i < lines.length; i++) {
51001
+ const line = lines[i];
51002
+ const lineMatchesRegex = regex.test(line);
51003
+ const shouldSkipLine = (includeMatchedLine && !lineMatchesRegex) || // if line doesn't match regex and we want matched lines, skip it
50858
51004
  (!includeMatchedLine && lineMatchesRegex); // if line does match regex but we don't want matched lines, skip it
50859
51005
  if (shouldSkipLine)
50860
51006
  continue;
@@ -50869,12 +51015,11 @@ var ErrorStackParser = {
50869
51015
  }
50870
51016
  return frames;
50871
51017
  },
50872
- parseChromiumStack: function (error, maxFramesToSave) {
50873
- var _this = this;
50874
- return this.parseHelper({ regex: CHROME_EDGE_STACK_REGEXP, includeMatchedLine: true }, error, maxFramesToSave, function (line, frames) {
50875
- var sanitizedLine;
51018
+ parseChromiumStack(error, maxFramesToSave) {
51019
+ return this.parseHelper({ regex: CHROME_EDGE_STACK_REGEXP, includeMatchedLine: true }, error, maxFramesToSave, (line, frames) => {
51020
+ let sanitizedLine;
50876
51021
  if (line.indexOf('(eval ') > -1) {
50877
- var processedLine = line
51022
+ const processedLine = line
50878
51023
  .replace(/eval code/g, 'eval')
50879
51024
  .replace(/(\(eval at [^()]*)|(\),.*$)/g, '');
50880
51025
  sanitizedLine = processedLine.replace(/^\s+/, '').replace(/\(eval code/g, '(');
@@ -50884,7 +51029,7 @@ var ErrorStackParser = {
50884
51029
  }
50885
51030
  // capture and preserve the parenthesized location "(/foo/my bar.js:12:87)"
50886
51031
  // in case it has spaces in it, as the string is split on \s+ later on
50887
- var location;
51032
+ let location;
50888
51033
  if (sanitizedLine.indexOf('(') > -1 && sanitizedLine.indexOf('):') > -1) {
50889
51034
  location = sanitizedLine.match(/ (\((.+):(\d+):(\d+)\)$)/);
50890
51035
  }
@@ -50892,23 +51037,22 @@ var ErrorStackParser = {
50892
51037
  sanitizedLine = location
50893
51038
  ? sanitizedLine.replace(location[0], '')
50894
51039
  : sanitizedLine;
50895
- var tokens = sanitizedLine.split(/\s+/).slice(1);
51040
+ const tokens = sanitizedLine.split(/\s+/).slice(1);
50896
51041
  // if a location was matched, pass it to extractLocation() otherwise pop the last token
50897
- var locationParts = _this.extractLocation(location ? location[1] : tokens.pop() || '');
50898
- var functionName = tokens.join(' ') || undefined;
50899
- var fileName = (locationParts[0] === 'eval' || locationParts[0] === '<anonymous>') ? undefined : locationParts[0];
51042
+ const locationParts = this.extractLocation(location ? location[1] : tokens.pop() || '');
51043
+ const functionName = tokens.join(' ') || undefined;
51044
+ const fileName = (locationParts[0] === 'eval' || locationParts[0] === '<anonymous>') ? undefined : locationParts[0];
50900
51045
  frames.push(new StackFrame({
50901
- functionName: functionName,
50902
- fileName: fileName,
51046
+ functionName,
51047
+ fileName,
50903
51048
  lineNumber: locationParts[1],
50904
51049
  columnNumber: locationParts[2]
50905
51050
  }));
50906
51051
  });
50907
51052
  },
50908
- parseFirefoxSafariStack: function (error, maxFramesToSave) {
50909
- var _this = this;
50910
- return this.parseHelper({ regex: SAFARI_NATIVE_CODE_REGEXP, includeMatchedLine: false }, error, maxFramesToSave, function (line, frames) {
50911
- var processedLine = line;
51053
+ parseFirefoxSafariStack(error, maxFramesToSave) {
51054
+ return this.parseHelper({ regex: SAFARI_NATIVE_CODE_REGEXP, includeMatchedLine: false }, error, maxFramesToSave, (line, frames) => {
51055
+ let processedLine = line;
50912
51056
  // Throw away eval information until we implement stacktrace.js/stackframe#8
50913
51057
  if (processedLine.indexOf(' > eval') > -1) {
50914
51058
  processedLine = processedLine.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ':$1');
@@ -50920,12 +51064,12 @@ var ErrorStackParser = {
50920
51064
  }));
50921
51065
  return;
50922
51066
  }
50923
- var functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/;
50924
- var matches = processedLine.match(functionNameRegex);
50925
- var functionName = matches && matches[1] ? matches[1] : undefined;
50926
- var locationParts = _this.extractLocation(processedLine.replace(functionNameRegex, ''));
51067
+ const functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/;
51068
+ const matches = processedLine.match(functionNameRegex);
51069
+ const functionName = matches && matches[1] ? matches[1] : undefined;
51070
+ const locationParts = this.extractLocation(processedLine.replace(functionNameRegex, ''));
50927
51071
  frames.push(new StackFrame({
50928
- functionName: functionName,
51072
+ functionName,
50929
51073
  fileName: locationParts[0],
50930
51074
  lineNumber: locationParts[1],
50931
51075
  columnNumber: locationParts[2]
@@ -50960,7 +51104,7 @@ function includes(str, substring) {
50960
51104
  function getResourceType(blockedURI, directive) {
50961
51105
  if (!directive || typeof directive !== 'string')
50962
51106
  return 'resource';
50963
- var d = directive.toLowerCase();
51107
+ const d = directive.toLowerCase();
50964
51108
  if (blockedURI === 'inline') {
50965
51109
  if (includes(d, 'script-src-attr')) {
50966
51110
  return 'inline event handler';
@@ -51019,12 +51163,11 @@ function getResourceType(blockedURI, directive) {
51019
51163
  function getDirective(policy, directiveName) {
51020
51164
  if (!policy || !directiveName)
51021
51165
  return '';
51022
- var needle = directiveName.toLowerCase();
51023
- for (var _i = 0, _a = policy.split(';'); _i < _a.length; _i++) {
51024
- var directive = _a[_i];
51025
- var trimmed = directive.trim();
51026
- var lower = trimmed.toLowerCase();
51027
- if (lower === needle || lower.startsWith("".concat(needle, " "))) {
51166
+ const needle = directiveName.toLowerCase();
51167
+ for (const directive of policy.split(';')) {
51168
+ const trimmed = directive.trim();
51169
+ const lower = trimmed.toLowerCase();
51170
+ if (lower === needle || lower.startsWith(`${needle} `)) {
51028
51171
  return trimmed;
51029
51172
  }
51030
51173
  }
@@ -51046,7 +51189,7 @@ function getDirective(policy, directiveName) {
51046
51189
  function getArticle(phrase) {
51047
51190
  if (!phrase || typeof phrase !== 'string')
51048
51191
  return 'A';
51049
- var c = phrase.trim().charAt(0).toLowerCase();
51192
+ const c = phrase.trim().charAt(0).toLowerCase();
51050
51193
  return includes('aeiou', c) ? 'An' : 'A';
51051
51194
  }
51052
51195
  /**
@@ -51089,47 +51232,46 @@ function createCspViolationMessage(blockedURI, directive, isReportOnly, original
51089
51232
  return 'Content Security Policy: Unknown violation occurred.';
51090
51233
  }
51091
51234
  try {
51092
- var reportOnlyText = isReportOnly ? ' (Report-Only)' : '';
51235
+ const reportOnlyText = isReportOnly ? ' (Report-Only)' : '';
51093
51236
  // special case for frame-ancestors since it doesn't fit our template at all
51094
51237
  if ((directive === null || directive === void 0 ? void 0 : directive.toLowerCase()) === 'frame-ancestors') {
51095
- return "Content Security Policy".concat(reportOnlyText, ": The display of ").concat(blockedURI, " in a frame was blocked because an ancestor violates your site's frame-ancestors policy.\nCurrent CSP: \"").concat(originalPolicy, "\".");
51238
+ return `Content Security Policy${reportOnlyText}: The display of ${blockedURI} in a frame was blocked because an ancestor violates your site's frame-ancestors policy.\nCurrent CSP: "${originalPolicy}".`;
51096
51239
  }
51097
- var resourceType = getResourceType(blockedURI, directive);
51098
- var article = getArticle(resourceType);
51099
- var source = formatBlockedUri(blockedURI);
51100
- var directiveValue = getDirective(originalPolicy, directive);
51101
- var policyDisplay = directiveValue || directive;
51102
- var resourceDescription = "".concat(article, " ").concat(resourceType).concat(source ? " from ".concat(source) : '');
51103
- return "Content Security Policy".concat(reportOnlyText, ": ").concat(resourceDescription, " was blocked by your site's `").concat(policyDisplay, "` policy.\nCurrent CSP: \"").concat(originalPolicy, "\".");
51240
+ const resourceType = getResourceType(blockedURI, directive);
51241
+ const article = getArticle(resourceType);
51242
+ const source = formatBlockedUri(blockedURI);
51243
+ const directiveValue = getDirective(originalPolicy, directive);
51244
+ const policyDisplay = directiveValue || directive;
51245
+ const resourceDescription = `${article} ${resourceType}${source ? ` from ${source}` : ''}`;
51246
+ return `Content Security Policy${reportOnlyText}: ${resourceDescription} was blocked by your site's \`${policyDisplay}\` policy.\nCurrent CSP: "${originalPolicy}".`;
51104
51247
  }
51105
51248
  catch (error) {
51106
- return "Content Security Policy: Error formatting violation message: ".concat(error.message);
51249
+ return `Content Security Policy: Error formatting violation message: ${error.message}`;
51107
51250
  }
51108
51251
  }
51109
51252
 
51110
- var MAX_LENGTH = 1000;
51111
- var PII_PATTERN = {
51253
+ const MAX_LENGTH = 1000;
51254
+ const PII_PATTERN = {
51112
51255
  ip: /\b(?:\d{1,3}\.){3}\d{1,3}\b/g,
51113
51256
  ssn: /\b\d{3}-\d{2}-\d{4}\b/g,
51114
51257
  creditCard: /\b(?:\d[ -]?){12,18}\d\b/g,
51115
51258
  httpsUrls: /https:\/\/[^\s]+/g,
51116
51259
  email: /[\w._+-]+@[\w.-]+\.\w+/g
51117
51260
  };
51118
- var PII_REPLACEMENT = '*'.repeat(10);
51119
- var JSON_PII_KEYS = ['password', 'email', 'key', 'token', 'auth', 'authentication', 'phone', 'address', 'ssn'];
51120
- var UNABLE_TO_DISPLAY_BODY = '[Unable to display body: detected PII could not be redacted]';
51121
- var joinedKeys = JSON_PII_KEYS.join('|');
51122
- var keyPattern = "\"([^\"]*(?:".concat(joinedKeys, ")[^\"]*)\"");
51261
+ const PII_REPLACEMENT = '*'.repeat(10);
51262
+ const JSON_PII_KEYS = ['password', 'email', 'key', 'token', 'auth', 'authentication', 'phone', 'address', 'ssn'];
51263
+ const UNABLE_TO_DISPLAY_BODY = '[Unable to display body: detected PII could not be redacted]';
51264
+ const joinedKeys = JSON_PII_KEYS.join('|');
51265
+ const keyPattern = `"([^"]*(?:${joinedKeys})[^"]*)"`;
51123
51266
  // only scrub strings, numbers, and booleans
51124
- var acceptedValues = '("([^"\\\\]*(?:\\\\.[^"\\\\]*)*")|(\\d+)|(true|false))';
51267
+ const acceptedValues = '("([^"\\\\]*(?:\\\\.[^"\\\\]*)*")|(\\d+)|(true|false))';
51125
51268
  /**
51126
51269
  * Truncates a string to the max length
51127
51270
  * @access private
51128
51271
  * @param {String} string
51129
51272
  * @returns {String}
51130
51273
  */
51131
- function truncate(string, includeEllipsis) {
51132
- if (includeEllipsis === void 0) { includeEllipsis = false; }
51274
+ function truncate(string, includeEllipsis = false) {
51133
51275
  if (string.length <= MAX_LENGTH)
51134
51276
  return string;
51135
51277
  if (includeEllipsis) {
@@ -51146,7 +51288,7 @@ function truncate(string, includeEllipsis) {
51146
51288
  * @returns {String}
51147
51289
  */
51148
51290
  function generateLogKey(methodName, message, stackTrace) {
51149
- return "".concat(methodName, "|").concat(message, "|").concat(stackTrace);
51291
+ return `${methodName}|${message}|${stackTrace}`;
51150
51292
  }
51151
51293
  /**
51152
51294
  * Checks if a string has 2 or more digits, a https URL, or an email address
@@ -51163,13 +51305,12 @@ function mightContainPII(string) {
51163
51305
  * @param {String} string
51164
51306
  * @returns {String}
51165
51307
  */
51166
- function scrubPII(_a) {
51167
- var string = _a.string, _ = _a._;
51308
+ function scrubPII({ string, _ }) {
51168
51309
  if (!string || typeof string !== 'string')
51169
51310
  return string;
51170
51311
  if (!mightContainPII(string))
51171
51312
  return string;
51172
- return _.reduce(_.values(PII_PATTERN), function (str, pattern) { return str.replace(pattern, PII_REPLACEMENT); }, string);
51313
+ return _.reduce(_.values(PII_PATTERN), (str, pattern) => str.replace(pattern, PII_REPLACEMENT), string);
51173
51314
  }
51174
51315
  /**
51175
51316
  * Scrub PII from a stringified JSON object
@@ -51178,14 +51319,12 @@ function scrubPII(_a) {
51178
51319
  * @returns {String}
51179
51320
  */
51180
51321
  function scrubJsonPII(string) {
51181
- var fullScrubRegex = new RegExp("".concat(keyPattern, "\\s*:\\s*[\\{\\[]"), 'i');
51322
+ const fullScrubRegex = new RegExp(`${keyPattern}\\s*:\\s*[\\{\\[]`, 'i');
51182
51323
  if (fullScrubRegex.test(string)) {
51183
51324
  return UNABLE_TO_DISPLAY_BODY;
51184
51325
  }
51185
- var keyValueScrubRegex = new RegExp("".concat(keyPattern, "\\s*:\\s*").concat(acceptedValues), 'gi');
51186
- return string.replace(keyValueScrubRegex, function (match, key) {
51187
- return "\"".concat(key, "\":\"").concat(PII_REPLACEMENT, "\"");
51188
- });
51326
+ const keyValueScrubRegex = new RegExp(`${keyPattern}\\s*:\\s*${acceptedValues}`, 'gi');
51327
+ return string.replace(keyValueScrubRegex, (match, key) => `"${key}":"${PII_REPLACEMENT}"`);
51189
51328
  }
51190
51329
  /**
51191
51330
  * Checks if a string is a JSON object
@@ -51197,7 +51336,7 @@ function scrubJsonPII(string) {
51197
51336
  function mightContainJson(string, contentType) {
51198
51337
  if (!string || typeof string !== 'string')
51199
51338
  return false;
51200
- var firstChar = string.charAt(0);
51339
+ const firstChar = string.charAt(0);
51201
51340
  if (contentType && contentType.indexOf('application/json') !== -1) {
51202
51341
  return true;
51203
51342
  }
@@ -51210,20 +51349,19 @@ function mightContainJson(string, contentType) {
51210
51349
  * @param {String} contentType
51211
51350
  * @returns {String}
51212
51351
  */
51213
- function maskSensitiveFields(_a) {
51214
- var string = _a.string, contentType = _a.contentType, _ = _a._;
51352
+ function maskSensitiveFields({ string, contentType, _ }) {
51215
51353
  if (!string || typeof string !== 'string')
51216
51354
  return string;
51217
51355
  if (mightContainJson(string, contentType)) {
51218
51356
  string = scrubJsonPII(string);
51219
51357
  }
51220
51358
  if (mightContainPII(string)) {
51221
- string = scrubPII({ string: string, _: _ });
51359
+ string = scrubPII({ string, _ });
51222
51360
  }
51223
51361
  return string;
51224
51362
  }
51225
51363
 
51226
- var DEV_LOG_TYPE = 'devlog';
51364
+ const DEV_LOG_TYPE = 'devlog';
51227
51365
  function createDevLogEnvelope(pluginAPI, globalPendo) {
51228
51366
  return {
51229
51367
  browser_time: pluginAPI.util.getNow(),
@@ -51234,12 +51372,12 @@ function createDevLogEnvelope(pluginAPI, globalPendo) {
51234
51372
  };
51235
51373
  }
51236
51374
 
51237
- var TOKEN_MAX_SIZE = 100;
51238
- var TOKEN_REFILL_RATE = 10;
51239
- var TOKEN_REFRESH_INTERVAL = 1000;
51240
- var MAX_UNCOMPRESSED_SIZE = 125000; // 125KB
51241
- var DevlogBuffer = /** @class */ (function () {
51242
- function DevlogBuffer(pendo, pluginAPI) {
51375
+ const TOKEN_MAX_SIZE = 100;
51376
+ const TOKEN_REFILL_RATE = 10;
51377
+ const TOKEN_REFRESH_INTERVAL = 1000;
51378
+ const MAX_UNCOMPRESSED_SIZE = 125000; // 125KB
51379
+ class DevlogBuffer {
51380
+ constructor(pendo, pluginAPI) {
51243
51381
  this.pendo = pendo;
51244
51382
  this.pluginAPI = pluginAPI;
51245
51383
  this.events = [];
@@ -51250,36 +51388,36 @@ var DevlogBuffer = /** @class */ (function () {
51250
51388
  this.lastRefillTime = this.pluginAPI.util.getNow();
51251
51389
  this.nextRefillTime = this.lastRefillTime + TOKEN_REFRESH_INTERVAL;
51252
51390
  }
51253
- DevlogBuffer.prototype.isEmpty = function () {
51391
+ isEmpty() {
51254
51392
  return this.events.length === 0 && this.payloads.length === 0;
51255
- };
51256
- DevlogBuffer.prototype.refillTokens = function () {
51257
- var now = this.pluginAPI.util.getNow();
51393
+ }
51394
+ refillTokens() {
51395
+ const now = this.pluginAPI.util.getNow();
51258
51396
  if (now >= this.nextRefillTime) {
51259
- var timeSinceLastRefill = now - this.lastRefillTime;
51260
- var secondsSinceLastRefill = Math.floor(timeSinceLastRefill / TOKEN_REFRESH_INTERVAL);
51261
- var tokensToRefill = secondsSinceLastRefill * TOKEN_REFILL_RATE;
51397
+ const timeSinceLastRefill = now - this.lastRefillTime;
51398
+ const secondsSinceLastRefill = Math.floor(timeSinceLastRefill / TOKEN_REFRESH_INTERVAL);
51399
+ const tokensToRefill = secondsSinceLastRefill * TOKEN_REFILL_RATE;
51262
51400
  this.tokens = Math.min(this.tokens + tokensToRefill, TOKEN_MAX_SIZE);
51263
51401
  this.lastRefillTime = now;
51264
51402
  this.nextRefillTime = now + TOKEN_REFRESH_INTERVAL;
51265
51403
  }
51266
- };
51267
- DevlogBuffer.prototype.clear = function () {
51404
+ }
51405
+ clear() {
51268
51406
  this.events = [];
51269
51407
  this.lastEvent = null;
51270
51408
  this.uncompressedSize = 0;
51271
- };
51272
- DevlogBuffer.prototype.hasTokenAvailable = function () {
51409
+ }
51410
+ hasTokenAvailable() {
51273
51411
  this.refillTokens();
51274
51412
  return this.tokens > 0;
51275
- };
51276
- DevlogBuffer.prototype.estimateEventSize = function (event) {
51413
+ }
51414
+ estimateEventSize(event) {
51277
51415
  return JSON.stringify(event).length;
51278
- };
51279
- DevlogBuffer.prototype.push = function (event) {
51416
+ }
51417
+ push(event) {
51280
51418
  if (!this.hasTokenAvailable())
51281
51419
  return false;
51282
- var eventSize = this.estimateEventSize(event);
51420
+ const eventSize = this.estimateEventSize(event);
51283
51421
  if (this.uncompressedSize + eventSize > MAX_UNCOMPRESSED_SIZE) {
51284
51422
  this.compressCurrentChunk();
51285
51423
  }
@@ -51288,55 +51426,54 @@ var DevlogBuffer = /** @class */ (function () {
51288
51426
  this.events.push(event);
51289
51427
  this.tokens = Math.max(this.tokens - 1, 0);
51290
51428
  return true;
51291
- };
51292
- DevlogBuffer.prototype.compressCurrentChunk = function () {
51429
+ }
51430
+ compressCurrentChunk() {
51293
51431
  if (this.events.length === 0)
51294
51432
  return;
51295
- var jzb = this.pendo.compress(this.events);
51433
+ const jzb = this.pendo.compress(this.events);
51296
51434
  this.payloads.push(jzb);
51297
51435
  this.clear();
51298
- };
51299
- DevlogBuffer.prototype.generateUrl = function () {
51300
- var queryParams = {
51436
+ }
51437
+ generateUrl() {
51438
+ const queryParams = {
51301
51439
  v: this.pendo.VERSION,
51302
51440
  ct: this.pluginAPI.util.getNow()
51303
51441
  };
51304
51442
  return this.pluginAPI.transmit.buildBaseDataUrl(DEV_LOG_TYPE, this.pendo.apiKey, queryParams);
51305
- };
51306
- DevlogBuffer.prototype.pack = function () {
51443
+ }
51444
+ pack() {
51307
51445
  if (this.isEmpty())
51308
51446
  return;
51309
- var url = this.generateUrl();
51447
+ const url = this.generateUrl();
51310
51448
  this.compressCurrentChunk();
51311
- var payloads = this.pendo._.map(this.payloads, function (jzb) { return ({
51312
- jzb: jzb,
51313
- url: url
51314
- }); });
51449
+ const payloads = this.pendo._.map(this.payloads, (jzb) => ({
51450
+ jzb,
51451
+ url
51452
+ }));
51315
51453
  this.payloads = [];
51316
51454
  return payloads;
51317
- };
51318
- return DevlogBuffer;
51319
- }());
51455
+ }
51456
+ }
51320
51457
 
51321
- var DevlogTransport = /** @class */ (function () {
51322
- function DevlogTransport(globalPendo, pluginAPI) {
51458
+ class DevlogTransport {
51459
+ constructor(globalPendo, pluginAPI) {
51323
51460
  this.pendo = globalPendo;
51324
51461
  this.pluginAPI = pluginAPI;
51325
51462
  }
51326
- DevlogTransport.prototype.buildGetUrl = function (baseUrl, jzb) {
51327
- var params = {};
51463
+ buildGetUrl(baseUrl, jzb) {
51464
+ const params = {};
51328
51465
  if (this.pluginAPI.agent.treatAsAdoptPartner()) {
51329
51466
  this.pluginAPI.agent.addAccountIdParams(params, this.pendo.get_account_id(), this.pluginAPI.ConfigReader.get('oemAccountId'));
51330
51467
  }
51331
- var jwtOptions = this.pluginAPI.agent.getJwtInfoCopy();
51468
+ const jwtOptions = this.pluginAPI.agent.getJwtInfoCopy();
51332
51469
  if (!this.pendo._.isEmpty(jwtOptions)) {
51333
51470
  this.pendo._.extend(params, jwtOptions);
51334
51471
  }
51335
51472
  params.jzb = jzb;
51336
- var queryString = this.pendo._.map(params, function (value, key) { return "".concat(key, "=").concat(value); }).join('&');
51337
- return "".concat(baseUrl).concat(baseUrl.indexOf('?') !== -1 ? '&' : '?').concat(queryString);
51338
- };
51339
- DevlogTransport.prototype.get = function (url, options) {
51473
+ const queryString = this.pendo._.map(params, (value, key) => `${key}=${value}`).join('&');
51474
+ return `${baseUrl}${baseUrl.indexOf('?') !== -1 ? '&' : '?'}${queryString}`;
51475
+ }
51476
+ get(url, options) {
51340
51477
  options.method = 'GET';
51341
51478
  if (this.pluginAPI.transmit.fetchKeepalive.supported()) {
51342
51479
  return this.pluginAPI.transmit.fetchKeepalive(url, options);
@@ -51344,90 +51481,86 @@ var DevlogTransport = /** @class */ (function () {
51344
51481
  else {
51345
51482
  return this.pendo.ajax.get(url);
51346
51483
  }
51347
- };
51348
- DevlogTransport.prototype.sendRequestWithGet = function (_a) {
51349
- var url = _a.url, jzb = _a.jzb;
51350
- var getUrl = this.buildGetUrl(url, jzb);
51484
+ }
51485
+ sendRequestWithGet({ url, jzb }) {
51486
+ const getUrl = this.buildGetUrl(url, jzb);
51351
51487
  return this.get(getUrl, {
51352
51488
  headers: {
51353
51489
  'Content-Type': 'application/octet-stream'
51354
51490
  }
51355
51491
  });
51356
- };
51357
- DevlogTransport.prototype.post = function (url, options) {
51492
+ }
51493
+ post(url, options) {
51358
51494
  options.method = 'POST';
51359
51495
  if (options.keepalive && this.pluginAPI.transmit.fetchKeepalive.supported()) {
51360
51496
  return this.pluginAPI.transmit.fetchKeepalive(url, options);
51361
51497
  }
51362
51498
  else if (options.keepalive && this.pluginAPI.transmit.sendBeacon.supported()) {
51363
- var result = this.pluginAPI.transmit.sendBeacon(url, new Blob([options.body]));
51499
+ const result = this.pluginAPI.transmit.sendBeacon(url, new Blob([options.body]));
51364
51500
  return result ? Promise$2.resolve() : Promise$2.reject(new Error('sendBeacon failed to send devlog data'));
51365
51501
  }
51366
51502
  else {
51367
51503
  return this.pendo.ajax.post(url, options.body);
51368
51504
  }
51369
- };
51370
- DevlogTransport.prototype.sendRequestWithPost = function (_a, isUnload) {
51371
- var url = _a.url, jzb = _a.jzb;
51372
- var jwtOptions = this.pluginAPI.agent.getJwtInfoCopy();
51373
- var bodyPayload = {
51505
+ }
51506
+ sendRequestWithPost({ url, jzb }, isUnload) {
51507
+ const jwtOptions = this.pluginAPI.agent.getJwtInfoCopy();
51508
+ const bodyPayload = {
51374
51509
  events: jzb,
51375
51510
  browser_time: this.pluginAPI.util.getNow()
51376
51511
  };
51377
51512
  if (this.pluginAPI.agent.treatAsAdoptPartner()) {
51378
51513
  this.pluginAPI.agent.addAccountIdParams(bodyPayload, this.pendo.get_account_id(), this.pluginAPI.ConfigReader.get('oemAccountId'));
51379
51514
  }
51380
- var body = JSON.stringify(this.pendo._.extend(bodyPayload, jwtOptions));
51515
+ const body = JSON.stringify(this.pendo._.extend(bodyPayload, jwtOptions));
51381
51516
  return this.post(url, {
51382
- body: body,
51517
+ body,
51383
51518
  headers: {
51384
51519
  'Content-Type': 'application/json'
51385
51520
  },
51386
51521
  keepalive: isUnload
51387
51522
  });
51388
- };
51389
- DevlogTransport.prototype.sendRequest = function (_a, isUnload) {
51390
- var url = _a.url, jzb = _a.jzb;
51391
- var compressedLength = jzb.length;
51523
+ }
51524
+ sendRequest({ url, jzb }, isUnload) {
51525
+ const compressedLength = jzb.length;
51392
51526
  if (compressedLength <= this.pluginAPI.constants.ENCODED_EVENT_MAX_LENGTH && !this.pluginAPI.ConfigReader.get('sendEventsWithPostOnly')) {
51393
- return this.sendRequestWithGet({ url: url, jzb: jzb });
51527
+ return this.sendRequestWithGet({ url, jzb });
51394
51528
  }
51395
- return this.sendRequestWithPost({ url: url, jzb: jzb }, isUnload);
51396
- };
51397
- return DevlogTransport;
51398
- }());
51529
+ return this.sendRequestWithPost({ url, jzb }, isUnload);
51530
+ }
51531
+ }
51399
51532
 
51400
51533
  function ConsoleCapture() {
51401
- var pluginAPI;
51402
- var _;
51403
- var globalPendo;
51404
- var buffer;
51405
- var sendQueue;
51406
- var sendInterval;
51407
- var transport;
51408
- var isPtmPaused;
51409
- var isCapturingConsoleLogs = false;
51410
- var CAPTURE_CONSOLE_CONFIG = 'captureConsoleLogs';
51411
- var CONSOLE_METHODS = ['log', 'warn', 'error', 'info'];
51412
- var DEV_LOG_SUB_TYPE = 'console';
51534
+ let pluginAPI;
51535
+ let _;
51536
+ let globalPendo;
51537
+ let buffer;
51538
+ let sendQueue;
51539
+ let sendInterval;
51540
+ let transport;
51541
+ let isPtmPaused;
51542
+ let isCapturingConsoleLogs = false;
51543
+ const CAPTURE_CONSOLE_CONFIG = 'captureConsoleLogs';
51544
+ const CONSOLE_METHODS = ['log', 'warn', 'error', 'info'];
51545
+ const DEV_LOG_SUB_TYPE = 'console';
51413
51546
  // deduplicate logs
51414
- var lastLogKey = '';
51547
+ let lastLogKey = '';
51415
51548
  return {
51416
51549
  name: 'ConsoleCapture',
51417
- initialize: initialize,
51418
- teardown: teardown,
51419
- addIntercepts: addIntercepts,
51420
- createConsoleEvent: createConsoleEvent,
51421
- captureStackTrace: captureStackTrace,
51422
- send: send,
51423
- setCaptureState: setCaptureState,
51424
- recordingStarted: recordingStarted,
51425
- recordingStopped: recordingStopped,
51426
- onAppHidden: onAppHidden,
51427
- onAppUnloaded: onAppUnloaded,
51428
- onPtmPaused: onPtmPaused,
51429
- onPtmUnpaused: onPtmUnpaused,
51430
- securityPolicyViolationFn: securityPolicyViolationFn,
51550
+ initialize,
51551
+ teardown,
51552
+ addIntercepts,
51553
+ createConsoleEvent,
51554
+ captureStackTrace,
51555
+ send,
51556
+ setCaptureState,
51557
+ recordingStarted,
51558
+ recordingStopped,
51559
+ onAppHidden,
51560
+ onAppUnloaded,
51561
+ onPtmPaused,
51562
+ onPtmUnpaused,
51563
+ securityPolicyViolationFn,
51431
51564
  get isCapturingConsoleLogs() {
51432
51565
  return isCapturingConsoleLogs;
51433
51566
  },
@@ -51444,16 +51577,16 @@ function ConsoleCapture() {
51444
51577
  function initialize(pendo, PluginAPI) {
51445
51578
  _ = pendo._;
51446
51579
  pluginAPI = PluginAPI;
51447
- var ConfigReader = pluginAPI.ConfigReader;
51580
+ const { ConfigReader } = pluginAPI;
51448
51581
  ConfigReader.addOption(CAPTURE_CONSOLE_CONFIG, [ConfigReader.sources.PENDO_CONFIG_SRC], false);
51449
- var captureConsoleEnabled = ConfigReader.get(CAPTURE_CONSOLE_CONFIG);
51582
+ const captureConsoleEnabled = ConfigReader.get(CAPTURE_CONSOLE_CONFIG);
51450
51583
  if (!captureConsoleEnabled)
51451
51584
  return;
51452
51585
  globalPendo = pendo;
51453
51586
  buffer = new DevlogBuffer(pendo, pluginAPI);
51454
51587
  transport = new DevlogTransport(pendo, pluginAPI);
51455
51588
  sendQueue = new pluginAPI.SendQueue(transport.sendRequest.bind(transport));
51456
- sendInterval = setInterval(function () {
51589
+ sendInterval = setInterval(() => {
51457
51590
  if (!sendQueue.failed()) {
51458
51591
  send();
51459
51592
  }
@@ -51479,19 +51612,17 @@ function ConsoleCapture() {
51479
51612
  function onPtmUnpaused() {
51480
51613
  isPtmPaused = false;
51481
51614
  if (!buffer.isEmpty()) {
51482
- for (var _i = 0, _a = buffer.events; _i < _a.length; _i++) {
51483
- var event_1 = _a[_i];
51484
- pluginAPI.Events.eventCaptured.trigger(event_1);
51615
+ for (const event of buffer.events) {
51616
+ pluginAPI.Events.eventCaptured.trigger(event);
51485
51617
  }
51486
51618
  send();
51487
51619
  }
51488
51620
  }
51489
- function setCaptureState(_a) {
51490
- var _b = _a === void 0 ? {} : _a, _c = _b.shouldCapture, shouldCapture = _c === void 0 ? false : _c, _d = _b.reason, reason = _d === void 0 ? '' : _d;
51621
+ function setCaptureState({ shouldCapture = false, reason = '' } = {}) {
51491
51622
  if (shouldCapture === isCapturingConsoleLogs)
51492
51623
  return;
51493
51624
  isCapturingConsoleLogs = shouldCapture;
51494
- pluginAPI.log.info("[ConsoleCapture] Console log capture ".concat(shouldCapture ? 'started' : 'stopped').concat(reason ? ": ".concat(reason) : ''));
51625
+ pluginAPI.log.info(`[ConsoleCapture] Console log capture ${shouldCapture ? 'started' : 'stopped'}${reason ? `: ${reason}` : ''}`);
51495
51626
  }
51496
51627
  function recordingStarted() {
51497
51628
  setCaptureState({ shouldCapture: true, reason: 'recording started' });
@@ -51511,12 +51642,12 @@ function ConsoleCapture() {
51511
51642
  }
51512
51643
  function addIntercepts() {
51513
51644
  _.each(CONSOLE_METHODS, function (methodName) {
51514
- var originalMethod = console[methodName];
51645
+ const originalMethod = console[methodName];
51515
51646
  if (!originalMethod)
51516
51647
  return;
51517
51648
  console[methodName] = _.wrap(originalMethod, function (originalFn) {
51518
51649
  // slice 1 to omit originalFn
51519
- var args = _.toArray(arguments).slice(1);
51650
+ const args = _.toArray(arguments).slice(1);
51520
51651
  originalFn.apply(console, args);
51521
51652
  createConsoleEvent(args, methodName);
51522
51653
  });
@@ -51528,10 +51659,10 @@ function ConsoleCapture() {
51528
51659
  function securityPolicyViolationFn(evt) {
51529
51660
  if (!evt || typeof evt !== 'object')
51530
51661
  return;
51531
- var blockedURI = evt.blockedURI, violatedDirective = evt.violatedDirective, effectiveDirective = evt.effectiveDirective, disposition = evt.disposition, originalPolicy = evt.originalPolicy;
51532
- var directive = violatedDirective || effectiveDirective;
51533
- var isReportOnly = disposition === 'report';
51534
- var message = createCspViolationMessage(blockedURI, directive, isReportOnly, originalPolicy);
51662
+ const { blockedURI, violatedDirective, effectiveDirective, disposition, originalPolicy } = evt;
51663
+ const directive = violatedDirective || effectiveDirective;
51664
+ const isReportOnly = disposition === 'report';
51665
+ const message = createCspViolationMessage(blockedURI, directive, isReportOnly, originalPolicy);
51535
51666
  if (isReportOnly) {
51536
51667
  createConsoleEvent([message], 'warn', { skipStackTrace: true, skipScrubPII: true });
51537
51668
  }
@@ -51539,13 +51670,12 @@ function ConsoleCapture() {
51539
51670
  createConsoleEvent([message], 'error', { skipStackTrace: true, skipScrubPII: true });
51540
51671
  }
51541
51672
  }
51542
- function createConsoleEvent(args, methodName, _a) {
51543
- var _b = _a === void 0 ? {} : _a, _c = _b.skipStackTrace, skipStackTrace = _c === void 0 ? false : _c, _d = _b.skipScrubPII, skipScrubPII = _d === void 0 ? false : _d;
51673
+ function createConsoleEvent(args, methodName, { skipStackTrace = false, skipScrubPII = false } = {}) {
51544
51674
  if (!isCapturingConsoleLogs || !args || args.length === 0 || !_.contains(CONSOLE_METHODS, methodName))
51545
51675
  return;
51546
51676
  // stringify args
51547
- var message = _.compact(_.map(args, function (arg) {
51548
- var stringifiedArg;
51677
+ let message = _.compact(_.map(args, arg => {
51678
+ let stringifiedArg;
51549
51679
  try {
51550
51680
  stringifiedArg = stringify(arg);
51551
51681
  }
@@ -51557,22 +51687,22 @@ function ConsoleCapture() {
51557
51687
  if (!message)
51558
51688
  return;
51559
51689
  // capture stack trace
51560
- var stackTrace = '';
51690
+ let stackTrace = '';
51561
51691
  if (!skipStackTrace) {
51562
- var maxStackFrames = methodName === 'error' ? 4 : 1;
51692
+ const maxStackFrames = methodName === 'error' ? 4 : 1;
51563
51693
  stackTrace = captureStackTrace(maxStackFrames);
51564
51694
  }
51565
51695
  // truncate message and stack trace
51566
51696
  message = truncate(message);
51567
51697
  stackTrace = truncate(stackTrace);
51568
51698
  // de-duplicate log
51569
- var logKey = generateLogKey(methodName, message, stackTrace);
51699
+ const logKey = generateLogKey(methodName, message, stackTrace);
51570
51700
  if (isExistingDuplicateLog(logKey)) {
51571
51701
  buffer.lastEvent.devLogCount++;
51572
51702
  return;
51573
51703
  }
51574
- var devLogEnvelope = createDevLogEnvelope(pluginAPI, globalPendo);
51575
- var consoleEvent = __assign(__assign({}, devLogEnvelope), { subType: DEV_LOG_SUB_TYPE, devLogLevel: methodName === 'log' ? 'info' : methodName, devLogMessage: skipScrubPII ? message : scrubPII({ string: message, _: _ }), devLogTrace: stackTrace, devLogCount: 1 });
51704
+ const devLogEnvelope = createDevLogEnvelope(pluginAPI, globalPendo);
51705
+ const consoleEvent = Object.assign(Object.assign({}, devLogEnvelope), { subType: DEV_LOG_SUB_TYPE, devLogLevel: methodName === 'log' ? 'info' : methodName, devLogMessage: skipScrubPII ? message : scrubPII({ string: message, _ }), devLogTrace: stackTrace, devLogCount: 1 });
51576
51706
  if (!buffer.hasTokenAvailable())
51577
51707
  return consoleEvent;
51578
51708
  if (!isPtmPaused) {
@@ -51584,8 +51714,8 @@ function ConsoleCapture() {
51584
51714
  }
51585
51715
  function captureStackTrace(maxStackFrames) {
51586
51716
  try {
51587
- var stackFrames = ErrorStackParser.parse(new Error(), maxStackFrames);
51588
- return _.map(stackFrames, function (frame) { return frame.toString(); }).join('\n');
51717
+ const stackFrames = ErrorStackParser.parse(new Error(), maxStackFrames);
51718
+ return _.map(stackFrames, frame => frame.toString()).join('\n');
51589
51719
  }
51590
51720
  catch (error) {
51591
51721
  return '';
@@ -51597,22 +51727,21 @@ function ConsoleCapture() {
51597
51727
  function updateLastLog(logKey) {
51598
51728
  lastLogKey = logKey;
51599
51729
  }
51600
- function send(_a) {
51601
- var _b = _a === void 0 ? {} : _a, _c = _b.unload, unload = _c === void 0 ? false : _c, _d = _b.hidden, hidden = _d === void 0 ? false : _d;
51730
+ function send({ unload = false, hidden = false } = {}) {
51602
51731
  if (!buffer || buffer.isEmpty())
51603
51732
  return;
51604
51733
  if (!globalPendo.isSendingEvents()) {
51605
51734
  buffer.clear();
51606
51735
  return;
51607
51736
  }
51608
- var payloads = buffer.pack();
51737
+ const payloads = buffer.pack();
51609
51738
  if (!payloads || payloads.length === 0)
51610
51739
  return;
51611
51740
  if (unload || hidden) {
51612
51741
  sendQueue.drain(payloads, unload);
51613
51742
  }
51614
51743
  else {
51615
- sendQueue.push.apply(sendQueue, payloads);
51744
+ sendQueue.push(...payloads);
51616
51745
  }
51617
51746
  }
51618
51747
  function teardown() {
@@ -51636,7 +51765,7 @@ function ConsoleCapture() {
51636
51765
  _.each(CONSOLE_METHODS, function (methodName) {
51637
51766
  if (!console[methodName])
51638
51767
  return _.noop;
51639
- var unwrap = console[methodName]._pendoUnwrap;
51768
+ const unwrap = console[methodName]._pendoUnwrap;
51640
51769
  if (_.isFunction(unwrap)) {
51641
51770
  unwrap();
51642
51771
  }
@@ -52042,20 +52171,18 @@ function NetworkCapture() {
52042
52171
  }
52043
52172
  }
52044
52173
 
52045
- var PREDICT_STEP_REGEX = /\$\$predict\$\$/;
52046
- var DRAG_THRESHOLD = 5;
52047
- var STYLE_ID = 'pendo-predict-plugin-styles';
52048
- var PREDICT_BASE_URL = 'https://predict.pendo.io';
52049
- var GUIDE_BUTTON_IDENTIFIER = 'button:contains("token")';
52050
- var pluginVersion = '1.0.1';
52051
- var $ = function (id) { return document.getElementById(id); };
52052
- var createElement = function (tag, attrs, parent) {
52053
- if (attrs === void 0) { attrs = {}; }
52054
- if (parent === void 0) { parent = null; }
52055
- var el = document.createElement(tag);
52056
- var entries = Object.entries(attrs);
52057
- for (var i = 0; i < entries.length; i++) {
52058
- var _a = entries[i], key = _a[0], value = _a[1];
52174
+ const PREDICT_STEP_REGEX = /\$\$predict\$\$/;
52175
+ const DRAG_THRESHOLD = 5;
52176
+ const STYLE_ID = 'pendo-predict-plugin-styles';
52177
+ const PREDICT_BASE_URL = 'https://predict.pendo.io';
52178
+ const GUIDE_BUTTON_IDENTIFIER = 'button:contains("token")';
52179
+ const pluginVersion = '1.0.1';
52180
+ const $ = (id) => document.getElementById(id);
52181
+ const createElement = (tag, attrs = {}, parent = null) => {
52182
+ const el = document.createElement(tag);
52183
+ const entries = Object.entries(attrs);
52184
+ for (let i = 0; i < entries.length; i++) {
52185
+ const [key, value] = entries[i];
52059
52186
  if (key === 'className')
52060
52187
  el.className = value;
52061
52188
  else if (key === 'innerHTML')
@@ -52067,28 +52194,69 @@ var createElement = function (tag, attrs, parent) {
52067
52194
  parent.appendChild(el);
52068
52195
  return el;
52069
52196
  };
52070
- var injectStyles = function (pendoContainerId, log) {
52071
- if (log === void 0) { log = function () { }; }
52072
- var styleId = "".concat(STYLE_ID, "-").concat(pendoContainerId);
52197
+ const injectStyles = (pendoContainerId, log = () => { }) => {
52198
+ const styleId = `${STYLE_ID}-${pendoContainerId}`;
52073
52199
  if ($(styleId)) {
52074
- log("[predict] style already exists, skipping: ".concat(styleId));
52200
+ log(`[predict] style already exists, skipping: ${styleId}`);
52075
52201
  return;
52076
52202
  }
52077
- log("[predict] injecting styles: ".concat(styleId));
52203
+ log(`[predict] injecting styles: ${styleId}`);
52078
52204
  createElement('style', {
52079
52205
  id: styleId,
52080
- 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: 999999; 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 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 ")
52206
+ textContent: `
52207
+ #${pendoContainerId} {
52208
+ display: none !important;
52209
+ }
52210
+ .frame-explanation {
52211
+ aspect-ratio: 16/9; overflow: hidden; min-height: 300px;
52212
+ width: 100vw; height: 100vh; background: transparent;
52213
+ position: fixed; bottom: 0; right: 0; z-index: 999999; border: none;
52214
+ visibility: hidden; opacity: 0; pointer-events: none;
52215
+ transition: opacity 0.1s ease-out, visibility 0s linear 0.1s;
52216
+ display: none;
52217
+ }
52218
+ .frame-explanation.is-visible {
52219
+ visibility: visible; opacity: 1; pointer-events: auto;
52220
+ transition: opacity 0.1s ease-out, visibility 0s linear 0s;
52221
+ }
52222
+ .frame-explanation.is-exists {
52223
+ display: block !important;
52224
+ }
52225
+ .floating-modal-container {
52226
+ position: fixed; top: 20px; right: 20px; z-index: 500000;
52227
+ visibility: hidden; opacity: 0; pointer-events: none;
52228
+ transition: opacity 0.1s ease-out, visibility 0s linear 0.1s;
52229
+ border-radius: 8px; box-shadow: 0px 4px 12px 0px rgba(0,0,0,0.15);
52230
+ overflow: hidden; width: 384px; height: 176px;
52231
+ }
52232
+ .floating-modal-container.is-visible {
52233
+ visibility: visible; opacity: 1; pointer-events: auto;
52234
+ transition: opacity 0.1s ease-out, visibility 0s linear 0s;
52235
+ }
52236
+ .floating-modal-container.is-dragging { will-change: left, top; }
52237
+ .floating-modal-drag-handle {
52238
+ position: absolute; left: 50%; transform: translateX(-50%);
52239
+ top: 5px; width: calc(100% - 46px); min-width: 166px; height: 17px;
52240
+ z-index: 9999; transition: left 0.2s ease, right 0.2s ease;
52241
+ display: flex; justify-content: center; align-items: center;
52242
+ }
52243
+ .floating-modal-drag-handle svg g { fill: #A0A0A0; }
52244
+ .floating-modal-drag-handle:hover { cursor: grab; }
52245
+ .floating-modal-drag-handle:hover svg g { fill: #1f2937; }
52246
+ .floating-modal-drag-handle.is-dragging { cursor: grabbing; }
52247
+ .floating-modal-drag-handle.is-collapsed { top: 0px; }
52248
+ .frame-floating-modal { width: 100%; height: 100%; background: white; border: none; display: block; }
52249
+ `
52081
52250
  }, document.head);
52082
52251
  };
52083
- var getRecordIdFromUrl = function (recordRegex, log) {
52252
+ const getRecordIdFromUrl = (recordRegex, log = () => { }) => {
52084
52253
  var _a;
52085
- if (log === void 0) { log = function () { }; }
52086
- var match = window.location.href.match(recordRegex);
52087
- var recordId = (_a = match === null || match === void 0 ? void 0 : match[1]) !== null && _a !== void 0 ? _a : null;
52088
- log("[predict] recordId found: ".concat(recordId));
52254
+ const match = window.location.href.match(recordRegex);
52255
+ const recordId = (_a = match === null || match === void 0 ? void 0 : match[1]) !== null && _a !== void 0 ? _a : null;
52256
+ log(`[predict] recordId found: ${recordId}`);
52089
52257
  return recordId;
52090
52258
  };
52091
- var safeStringify = function (value, fallback) {
52259
+ const safeStringify = (value, fallback) => {
52092
52260
  try {
52093
52261
  return JSON.stringify(value);
52094
52262
  }
@@ -52096,22 +52264,21 @@ var safeStringify = function (value, fallback) {
52096
52264
  return fallback !== null && fallback !== void 0 ? fallback : '';
52097
52265
  }
52098
52266
  };
52099
- var safeParse = function (value, fallback, log) {
52100
- if (log === void 0) { log = function () { }; }
52267
+ const safeParse = (value, fallback, log = () => { }) => {
52101
52268
  try {
52102
52269
  return JSON.parse(value);
52103
52270
  }
52104
52271
  catch (error) {
52105
- log("[predict] JSON parse error: ".concat(error));
52272
+ log(`[predict] JSON parse error: ${error}`);
52106
52273
  return fallback;
52107
52274
  }
52108
52275
  };
52109
- var buildQueryParams = function (params) {
52110
- var urlParams = new URLSearchParams();
52111
- var entries = Object.entries(params);
52276
+ const buildQueryParams = (params) => {
52277
+ const urlParams = new URLSearchParams();
52278
+ const entries = Object.entries(params);
52112
52279
  urlParams.set('pluginVersion', pluginVersion);
52113
- for (var i = 0; i < entries.length; i++) {
52114
- var _a = entries[i], key = _a[0], value = _a[1];
52280
+ for (let i = 0; i < entries.length; i++) {
52281
+ const [key, value] = entries[i];
52115
52282
  if (value != null) {
52116
52283
  urlParams.set(key, typeof value === 'object' ? safeStringify(value) : String(value));
52117
52284
  }
@@ -52119,17 +52286,17 @@ var buildQueryParams = function (params) {
52119
52286
  return urlParams.toString();
52120
52287
  };
52121
52288
  // ----- Drag & Drop -----
52122
- var setupDragAndDrop = function (handle, container) {
52123
- var isDragging = false;
52124
- var hasMoved = false;
52125
- var isCollapsed = false;
52126
- var startX = 0;
52127
- var startY = 0;
52128
- var initialLeft = 0;
52129
- var initialTop = 0;
52130
- var rafId = null;
52131
- var iframe = container.querySelector('iframe');
52132
- var onMouseDown = function (e) {
52289
+ const setupDragAndDrop = (handle, container) => {
52290
+ let isDragging = false;
52291
+ let hasMoved = false;
52292
+ let isCollapsed = false;
52293
+ let startX = 0;
52294
+ let startY = 0;
52295
+ let initialLeft = 0;
52296
+ let initialTop = 0;
52297
+ let rafId = null;
52298
+ const iframe = container.querySelector('iframe');
52299
+ const onMouseDown = (e) => {
52133
52300
  if (e.button !== 0)
52134
52301
  return;
52135
52302
  e.preventDefault();
@@ -52139,35 +52306,35 @@ var setupDragAndDrop = function (handle, container) {
52139
52306
  container.classList.add('is-dragging');
52140
52307
  if (iframe)
52141
52308
  iframe.style.pointerEvents = 'none';
52142
- var rect = container.getBoundingClientRect();
52309
+ const rect = container.getBoundingClientRect();
52143
52310
  initialLeft = rect.left;
52144
52311
  initialTop = rect.top;
52145
- container.style.left = "".concat(initialLeft, "px");
52312
+ container.style.left = `${initialLeft}px`;
52146
52313
  container.style.right = 'auto';
52147
52314
  startX = e.clientX;
52148
52315
  startY = e.clientY;
52149
52316
  document.addEventListener('mousemove', onMouseMove);
52150
52317
  document.addEventListener('mouseup', onMouseUp);
52151
52318
  };
52152
- var onMouseMove = function (e) {
52319
+ const onMouseMove = (e) => {
52153
52320
  if (!isDragging)
52154
52321
  return;
52155
- var deltaX = e.clientX - startX;
52156
- var deltaY = e.clientY - startY;
52322
+ const deltaX = e.clientX - startX;
52323
+ const deltaY = e.clientY - startY;
52157
52324
  if (Math.abs(deltaX) > DRAG_THRESHOLD || Math.abs(deltaY) > DRAG_THRESHOLD) {
52158
52325
  hasMoved = true;
52159
52326
  }
52160
52327
  if (rafId)
52161
52328
  cancelAnimationFrame(rafId);
52162
- rafId = requestAnimationFrame(function () {
52163
- var rect = container.getBoundingClientRect();
52164
- var newLeft = Math.max(0, Math.min(initialLeft + deltaX, window.innerWidth - rect.width));
52165
- var newTop = Math.max(0, Math.min(initialTop + deltaY, window.innerHeight - rect.height));
52166
- container.style.left = "".concat(newLeft, "px");
52167
- container.style.top = "".concat(newTop, "px");
52329
+ rafId = requestAnimationFrame(() => {
52330
+ const rect = container.getBoundingClientRect();
52331
+ const newLeft = Math.max(0, Math.min(initialLeft + deltaX, window.innerWidth - rect.width));
52332
+ const newTop = Math.max(0, Math.min(initialTop + deltaY, window.innerHeight - rect.height));
52333
+ container.style.left = `${newLeft}px`;
52334
+ container.style.top = `${newTop}px`;
52168
52335
  });
52169
52336
  };
52170
- var onMouseUp = function (e) {
52337
+ const onMouseUp = (e) => {
52171
52338
  var _a;
52172
52339
  if (!isDragging)
52173
52340
  return;
@@ -52185,12 +52352,12 @@ var setupDragAndDrop = function (handle, container) {
52185
52352
  (_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage({ type: 'TRIGGER_EXPAND' }, PREDICT_BASE_URL);
52186
52353
  }
52187
52354
  };
52188
- handle.setCollapsedState = function (collapsed) {
52355
+ handle.setCollapsedState = (collapsed) => {
52189
52356
  isCollapsed = collapsed;
52190
52357
  handle.classList.toggle('is-collapsed', collapsed);
52191
52358
  };
52192
52359
  handle.addEventListener('mousedown', onMouseDown);
52193
- handle.cleanup = function () {
52360
+ handle.cleanup = () => {
52194
52361
  handle.removeEventListener('mousedown', onMouseDown);
52195
52362
  document.removeEventListener('mousemove', onMouseMove);
52196
52363
  document.removeEventListener('mouseup', onMouseUp);
@@ -52200,13 +52367,12 @@ var setupDragAndDrop = function (handle, container) {
52200
52367
  return handle;
52201
52368
  };
52202
52369
  // ----- Explanation Iframe Creation -----
52203
- var createExplanationIframe = function (_a) {
52204
- var _b;
52205
- var analysisId = _a.analysisId, recordId = _a.recordId, configuration = _a.configuration;
52206
- var frameId = "frameExplanation-".concat(analysisId);
52207
- (_b = $(frameId)) === null || _b === void 0 ? void 0 : _b.remove();
52208
- var base = "".concat(PREDICT_BASE_URL, "/external/analysis/").concat(analysisId, "/prediction/drilldown/").concat(recordId);
52209
- var params = buildQueryParams(configuration);
52370
+ const createExplanationIframe = ({ analysisId, recordId, configuration }) => {
52371
+ var _a;
52372
+ const frameId = `frameExplanation-${analysisId}`;
52373
+ (_a = $(frameId)) === null || _a === void 0 ? void 0 : _a.remove();
52374
+ const base = `${PREDICT_BASE_URL}/external/analysis/${analysisId}/prediction/drilldown/${recordId}`;
52375
+ const params = buildQueryParams(configuration);
52210
52376
  createElement('iframe', {
52211
52377
  id: frameId,
52212
52378
  className: 'frame-explanation',
@@ -52214,24 +52380,28 @@ var createExplanationIframe = function (_a) {
52214
52380
  loading: 'lazy',
52215
52381
  referrerPolicy: 'strict-origin-when-cross-origin',
52216
52382
  allowFullscreen: true,
52217
- src: "".concat(base, "?").concat(params)
52383
+ src: `${base}?${params}`
52218
52384
  }, document.body);
52219
52385
  };
52220
52386
  // ----- Floating Modal Creation -----
52221
- var createFloatingModal = function (_a) {
52222
- var _b;
52223
- var recordId = _a.recordId, configuration = _a.configuration;
52224
- var flatIds = (_b = configuration.analysisIds) === null || _b === void 0 ? void 0 : _b.flat(Infinity);
52225
- for (var i = 0; i < flatIds.length; i++) {
52226
- createExplanationIframe({ analysisId: flatIds[i], recordId: recordId, configuration: configuration });
52227
- }
52228
- var container = createElement('div', { id: 'floatingModalContainer', className: 'floating-modal-container' }, document.body);
52229
- var dragHandle = createElement('div', {
52387
+ const createFloatingModal = ({ recordId, configuration }) => {
52388
+ var _a;
52389
+ const flatIds = (_a = configuration.analysisIds) === null || _a === void 0 ? void 0 : _a.flat(Infinity);
52390
+ for (let i = 0; i < flatIds.length; i++) {
52391
+ createExplanationIframe({ analysisId: flatIds[i], recordId, configuration });
52392
+ }
52393
+ const container = createElement('div', { id: 'floatingModalContainer', className: 'floating-modal-container' }, document.body);
52394
+ const dragHandle = createElement('div', {
52230
52395
  className: 'floating-modal-drag-handle',
52231
- 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>"
52396
+ innerHTML: `<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
52397
+ <g fill="#EBEBEB">
52398
+ <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"/>
52399
+ <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"/>
52400
+ </g>
52401
+ </svg>`
52232
52402
  }, container);
52233
- var baseUrl = "".concat(PREDICT_BASE_URL, "/external/analysis/prediction/summary/").concat(recordId);
52234
- var params = buildQueryParams(configuration);
52403
+ const baseUrl = `${PREDICT_BASE_URL}/external/analysis/prediction/summary/${recordId}`;
52404
+ const params = buildQueryParams(configuration);
52235
52405
  createElement('iframe', {
52236
52406
  id: 'frameFloatingModal',
52237
52407
  className: 'frame-floating-modal',
@@ -52239,136 +52409,133 @@ var createFloatingModal = function (_a) {
52239
52409
  referrerPolicy: 'strict-origin-when-cross-origin',
52240
52410
  allowFullscreen: true,
52241
52411
  title: 'Floating Modal',
52242
- src: "".concat(baseUrl, "?").concat(params)
52412
+ src: `${baseUrl}?${params}`
52243
52413
  }, container);
52244
52414
  container.dragHandle = setupDragAndDrop(dragHandle, container);
52245
- return function () {
52415
+ return () => {
52246
52416
  var _a, _b;
52247
52417
  (_b = (_a = container.dragHandle) === null || _a === void 0 ? void 0 : _a.cleanup) === null || _b === void 0 ? void 0 : _b.call(_a);
52248
52418
  container.remove();
52249
- for (var i = 0; i < flatIds.length; i++) {
52250
- var frame = $("frameExplanation-".concat(flatIds[i]));
52419
+ for (let i = 0; i < flatIds.length; i++) {
52420
+ const frame = $(`frameExplanation-${flatIds[i]}`);
52251
52421
  if (frame)
52252
52422
  frame.remove();
52253
52423
  }
52254
52424
  };
52255
52425
  };
52256
- var setupMessageListener = function (_a) {
52257
- var token = _a.token, forceAccountId = _a.forceAccountId, cleanup = _a.cleanup, pendo = _a.pendo;
52258
- var messageHandler = function (_a) {
52259
- var _b;
52260
- var origin = _a.origin, data = _a.data;
52426
+ const setupMessageListener = ({ token, forceAccountId, cleanup, pendo }) => {
52427
+ const messageHandler = ({ origin, data }) => {
52428
+ var _a;
52261
52429
  if (origin !== PREDICT_BASE_URL || !data || typeof data !== 'object')
52262
52430
  return;
52263
- var _c = data, type = _c.type, analysisId = _c.analysisId, height = _c.height, width = _c.width;
52264
- var explanationFrame = $("frameExplanation-".concat(analysisId));
52265
- var floatingModal = $('floatingModalContainer');
52266
- var setFloatingModalSize = function () {
52431
+ const { type, analysisId, height, width } = data;
52432
+ const explanationFrame = $(`frameExplanation-${analysisId}`);
52433
+ const floatingModal = $('floatingModalContainer');
52434
+ const setFloatingModalSize = () => {
52267
52435
  if (floatingModal) {
52268
- floatingModal.style.height = "".concat(height, "px");
52269
- floatingModal.style.width = "".concat(width, "px");
52436
+ floatingModal.style.height = `${height}px`;
52437
+ floatingModal.style.width = `${width}px`;
52270
52438
  }
52271
52439
  };
52272
- var setFloatingModalCollapsedState = function (collapsed) {
52440
+ const setFloatingModalCollapsedState = (collapsed) => {
52273
52441
  var _a, _b;
52274
52442
  if (floatingModal)
52275
52443
  (_b = (_a = floatingModal.dragHandle) === null || _a === void 0 ? void 0 : _a.setCollapsedState) === null || _b === void 0 ? void 0 : _b.call(_a, collapsed);
52276
52444
  };
52277
- var actions = {
52278
- MODAL_INITIALIZED: function () {
52445
+ const actions = {
52446
+ MODAL_INITIALIZED: () => {
52279
52447
  var _a, _b, _c;
52280
- var iframe = $('frameFloatingModal');
52448
+ const iframe = $('frameFloatingModal');
52281
52449
  if (iframe) {
52282
- var idToken = null;
52283
- var extensionAPIKeys = null;
52284
- var retrieveIDPToken = pendo.getConfigValue('retrieveIDPToken');
52450
+ let idToken = null;
52451
+ let extensionAPIKeys = null;
52452
+ const retrieveIDPToken = pendo.getConfigValue('retrieveIDPToken');
52285
52453
  if (pendo._.isFunction(retrieveIDPToken)) {
52286
- var result = retrieveIDPToken();
52454
+ const result = retrieveIDPToken();
52287
52455
  if (result) {
52288
52456
  idToken = result.idToken;
52289
52457
  extensionAPIKeys = result.extensionAPIKeys;
52290
52458
  }
52291
52459
  }
52292
- var visitorId = (_a = pendo === null || pendo === void 0 ? void 0 : pendo.getVisitorId) === null || _a === void 0 ? void 0 : _a.call(pendo);
52293
- 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);
52294
- (_c = iframe.contentWindow) === null || _c === void 0 ? void 0 : _c.postMessage({ type: 'TOKEN_RECEIVED', token: token, idToken: idToken, extensionAPIKeys: extensionAPIKeys, visitorId: visitorId, accountId: accountId }, PREDICT_BASE_URL);
52460
+ const visitorId = (_a = pendo === null || pendo === void 0 ? void 0 : pendo.getVisitorId) === null || _a === void 0 ? void 0 : _a.call(pendo);
52461
+ 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);
52462
+ (_c = iframe.contentWindow) === null || _c === void 0 ? void 0 : _c.postMessage({ type: 'TOKEN_RECEIVED', token, idToken, extensionAPIKeys, visitorId, accountId }, PREDICT_BASE_URL);
52295
52463
  }
52296
52464
  },
52297
- OPEN_EXPLANATION: function () {
52465
+ OPEN_EXPLANATION: () => {
52298
52466
  var _a;
52299
52467
  explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.add('is-visible');
52300
52468
  (_a = explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(data, PREDICT_BASE_URL);
52301
52469
  },
52302
- CLOSE_EXPLANATION: function () { return explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.remove('is-visible'); },
52303
- AUTH_ERROR_EXPLANATION: function () {
52470
+ CLOSE_EXPLANATION: () => explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.remove('is-visible'),
52471
+ AUTH_ERROR_EXPLANATION: () => {
52304
52472
  explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.remove('is-visible');
52305
- var iframe = $('frameFloatingModal');
52473
+ const iframe = $('frameFloatingModal');
52306
52474
  // eslint-disable-next-line no-self-assign
52307
52475
  if (iframe)
52308
52476
  iframe.src = iframe.src;
52309
52477
  },
52310
- DATA_READY: function () {
52478
+ DATA_READY: () => {
52311
52479
  floatingModal === null || floatingModal === void 0 ? void 0 : floatingModal.classList.add('is-visible');
52312
52480
  setFloatingModalSize();
52313
52481
  // Use analysisIds from the message data if available, otherwise use all IDs
52314
- var idsToShow = data.analysisIds || [];
52315
- for (var i = 0; i < idsToShow.length; i++) {
52316
- var frame = $("frameExplanation-".concat(idsToShow[i]));
52482
+ const idsToShow = data.analysisIds || [];
52483
+ for (let i = 0; i < idsToShow.length; i++) {
52484
+ const frame = $(`frameExplanation-${idsToShow[i]}`);
52317
52485
  if (frame)
52318
52486
  frame.classList.add('is-exists');
52319
52487
  }
52320
52488
  },
52321
- AUTH_ERROR: function () {
52489
+ AUTH_ERROR: () => {
52322
52490
  floatingModal === null || floatingModal === void 0 ? void 0 : floatingModal.classList.add('is-visible');
52323
52491
  setFloatingModalSize();
52324
52492
  },
52325
52493
  CLOSE_FLOATING_MODAL: cleanup,
52326
- EXPAND_FLOATING_MODAL: function () {
52494
+ EXPAND_FLOATING_MODAL: () => {
52327
52495
  setFloatingModalSize();
52328
52496
  setFloatingModalCollapsedState(false);
52329
52497
  },
52330
- COLLAPSE_FLOATING_MODAL: function () {
52498
+ COLLAPSE_FLOATING_MODAL: () => {
52331
52499
  setFloatingModalSize();
52332
52500
  setFloatingModalCollapsedState(true);
52333
52501
  }
52334
52502
  };
52335
52503
  if (type && type in actions) {
52336
- (_b = actions === null || actions === void 0 ? void 0 : actions[type]) === null || _b === void 0 ? void 0 : _b.call(actions);
52504
+ (_a = actions === null || actions === void 0 ? void 0 : actions[type]) === null || _a === void 0 ? void 0 : _a.call(actions);
52337
52505
  }
52338
52506
  };
52339
52507
  window.addEventListener('message', messageHandler);
52340
- return function () { return window.removeEventListener('message', messageHandler); };
52508
+ return () => window.removeEventListener('message', messageHandler);
52341
52509
  };
52342
- var predictGuidesScript = function (_a) {
52343
- var _b;
52344
- var step = _a.step, pendo = _a.pendo, cleanupArray = _a.cleanupArray, cleanup = _a.cleanup, log = _a.log;
52510
+ const predictGuidesScript = ({ step, pendo, cleanupArray, cleanup, log }) => {
52511
+ var _a;
52345
52512
  log('[predict] initializing');
52346
52513
  // Before anything else, inject styles so that the guide will be hidden
52347
- var pendoContainerId = step === null || step === void 0 ? void 0 : step.containerId;
52514
+ const pendoContainerId = step === null || step === void 0 ? void 0 : step.containerId;
52348
52515
  injectStyles(pendoContainerId, log);
52349
52516
  if (cleanupArray.length > 0) {
52350
52517
  log('[predict] cleanupArray is not empty');
52351
52518
  return;
52352
52519
  }
52353
52520
  // ----- Extract Configuration -----
52354
- var guideButton = (_b = step.guideElement.find(GUIDE_BUTTON_IDENTIFIER)) === null || _b === void 0 ? void 0 : _b[0];
52521
+ const guideButton = (_a = step.guideElement.find(GUIDE_BUTTON_IDENTIFIER)) === null || _a === void 0 ? void 0 : _a[0];
52355
52522
  if (!guideButton) {
52356
52523
  log('[predict] no guide button found, aborting');
52357
52524
  return;
52358
52525
  }
52359
- var _c = safeParse(guideButton.textContent, {}, log), token = _c.token, configuration = __rest(_c, ["token"]);
52526
+ const _b = safeParse(guideButton.textContent, {}, log), { token } = _b, configuration = __rest(_b, ["token"]);
52360
52527
  if (!configuration || !token) {
52361
52528
  log('[predict] no configuration found, aborting');
52362
52529
  return;
52363
52530
  }
52364
- var recordRegex = new RegExp("/".concat(configuration.recordRegexName, "/([a-zA-Z0-9]+)(?:/|$)"));
52365
- var recordId = getRecordIdFromUrl(recordRegex, log);
52531
+ const recordRegex = new RegExp(`/${configuration.recordRegexName}/([a-zA-Z0-9]+)(?:/|$)`);
52532
+ const recordId = getRecordIdFromUrl(recordRegex, log);
52366
52533
  if (!recordId) {
52367
52534
  log('[predict] no recordId found in URL, aborting');
52368
52535
  return;
52369
52536
  }
52370
- cleanupArray.push(setupMessageListener({ token: token, forceAccountId: configuration === null || configuration === void 0 ? void 0 : configuration.forceAccountId, cleanup: cleanup, pendo: pendo }));
52371
- cleanupArray.push(createFloatingModal({ recordId: recordId, configuration: configuration }));
52537
+ cleanupArray.push(setupMessageListener({ token, forceAccountId: configuration === null || configuration === void 0 ? void 0 : configuration.forceAccountId, cleanup, pendo }));
52538
+ cleanupArray.push(createFloatingModal({ recordId, configuration }));
52372
52539
  };
52373
52540
 
52374
52541
  const PredictGuides = () => {