@pendo/agent 2.319.1 → 2.319.2

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.
@@ -3956,8 +3956,8 @@ let SERVER = '';
3956
3956
  let ASSET_HOST = '';
3957
3957
  let ASSET_PATH = '';
3958
3958
  let DESIGNER_SERVER = '';
3959
- let VERSION = '2.319.1_';
3960
- let PACKAGE_VERSION = '2.319.1';
3959
+ let VERSION = '2.319.2_';
3960
+ let PACKAGE_VERSION = '2.319.2';
3961
3961
  let LOADER = 'xhr';
3962
3962
  /* eslint-enable web-sdk-eslint-rules/no-gulp-env-references */
3963
3963
  /**
@@ -40595,12 +40595,12 @@ function TextCapture() {
40595
40595
  return {
40596
40596
  name: 'TextCapture',
40597
40597
  initialize: init,
40598
- teardown: teardown,
40599
- isEnabled: isEnabled,
40600
- isTextCapturable: isTextCapturable,
40601
- hasWhitelist: hasWhitelist,
40598
+ teardown,
40599
+ isEnabled,
40600
+ isTextCapturable,
40601
+ hasWhitelist,
40602
40602
  serializer: textSerializer,
40603
- guideActivity: guideActivity
40603
+ guideActivity
40604
40604
  };
40605
40605
  // technically not idempotent but might actually be right. not sure.
40606
40606
  function init(pendo, PluginAPI) {
@@ -40639,30 +40639,30 @@ function TextCapture() {
40639
40639
  function guideActivity(pendo, event) {
40640
40640
  if (!isEnabled())
40641
40641
  return;
40642
- var _ = pendo._;
40643
- var eventData = event.data[0];
40642
+ const { _ } = pendo;
40643
+ const eventData = event.data[0];
40644
40644
  if (eventData && eventData.type === 'guideActivity') {
40645
- var shownSteps = _.reduce(pendo.getActiveGuides({ channel: '*' }), function (shown, guide) {
40645
+ const shownSteps = _.reduce(pendo.getActiveGuides({ channel: '*' }), (shown, guide) => {
40646
40646
  if (guide.isShown()) {
40647
- return shown.concat(_.filter(guide.steps, function (step) { return step.isShown(); }));
40647
+ return shown.concat(_.filter(guide.steps, (step) => step.isShown()));
40648
40648
  }
40649
40649
  return shown;
40650
40650
  }, []);
40651
40651
  if (!shownSteps.length)
40652
40652
  return;
40653
- var findDomBlockInDomJson_1 = pendo.BuildingBlocks.BuildingBlockGuides.findDomBlockInDomJson;
40654
- var elementJson_1;
40655
- _.find(shownSteps, function (step) {
40653
+ const findDomBlockInDomJson = pendo.BuildingBlocks.BuildingBlockGuides.findDomBlockInDomJson;
40654
+ let elementJson;
40655
+ _.find(shownSteps, (step) => {
40656
40656
  if (!step.domJson)
40657
40657
  return false;
40658
- elementJson_1 = findDomBlockInDomJson_1(step.domJson, function (domJson) {
40658
+ elementJson = findDomBlockInDomJson(step.domJson, function (domJson) {
40659
40659
  return domJson.props && domJson.props.id && domJson.props.id === eventData.props.ui_element_id;
40660
40660
  });
40661
- return elementJson_1;
40661
+ return elementJson;
40662
40662
  });
40663
- if (!elementJson_1)
40663
+ if (!elementJson)
40664
40664
  return;
40665
- eventData.props.ui_element_text = elementJson_1.content;
40665
+ eventData.props.ui_element_text = elementJson.content;
40666
40666
  }
40667
40667
  }
40668
40668
  function isEnabled() {
@@ -40679,19 +40679,17 @@ function TextCapture() {
40679
40679
  }
40680
40680
  }
40681
40681
 
40682
- var substitutionRegex = '\\{(?:\\s?)([^.\\s]?visitor|account|parentAccount)\\.([^|\\s/]*)(?:\\s?\\|\\s?([^}]+|[\\/s]+))?(?:\\s?\\/\\s?){1}\\}';
40683
- var skipStepString = '{skipStep:* *(auto|\\d+)\\/}';
40684
- var goToMiddleString = '(?!0)(\\d+)';
40685
- var goToString = "({goto-".concat(goToMiddleString, "\\/})");
40686
- var containerSelector = '[id^="pendo-guide-container"]';
40687
- function lookupGuideButtons(domJson, buttons) {
40688
- if (buttons === void 0) { buttons = []; }
40682
+ const substitutionRegex = '\\{(?:\\s?)([^.\\s]?visitor|account|parentAccount)\\.([^|\\s/]*)(?:\\s?\\|\\s?([^}]+|[\\/s]+))?(?:\\s?\\/\\s?){1}\\}';
40683
+ const skipStepString = '{skipStep:* *(auto|\\d+)\\/}';
40684
+ const goToMiddleString = '(?!0)(\\d+)';
40685
+ const goToString = `({goto-${goToMiddleString}\\/})`;
40686
+ const containerSelector = '[id^="pendo-guide-container"]';
40687
+ function lookupGuideButtons(domJson, buttons = []) {
40689
40688
  if (domJson.type === 'button' && domJson.actions) {
40690
40689
  buttons.push(domJson);
40691
40690
  }
40692
40691
  if (domJson.children) {
40693
- for (var _i = 0, _a = domJson.children; _i < _a.length; _i++) {
40694
- var child = _a[_i];
40692
+ for (const child of domJson.children) {
40695
40693
  lookupGuideButtons(child, buttons);
40696
40694
  }
40697
40695
  }
@@ -40720,16 +40718,15 @@ function removeMarkdownSyntax(element, textToReplace, replacementText, pendo) {
40720
40718
  }
40721
40719
  }
40722
40720
  var guideMarkdownUtil = {
40723
- substitutionRegex: substitutionRegex,
40724
- skipStepString: skipStepString,
40725
- goToString: goToString,
40726
- containerSelector: containerSelector,
40727
- lookupGuideButtons: lookupGuideButtons,
40728
- removeMarkdownSyntax: removeMarkdownSyntax
40721
+ substitutionRegex,
40722
+ skipStepString,
40723
+ goToString,
40724
+ containerSelector,
40725
+ lookupGuideButtons,
40726
+ removeMarkdownSyntax
40729
40727
  };
40730
40728
 
40731
- function getZoneSafeMethod(_, method, target) {
40732
- if (target === void 0) { target = window; }
40729
+ function getZoneSafeMethod(_, method, target = window) {
40733
40730
  var zoneSymbol = '__symbol__';
40734
40731
  /* global Zone */
40735
40732
  if (typeof Zone !== 'undefined' && _.isFunction(Zone[zoneSymbol])) {
@@ -40742,20 +40739,20 @@ function getZoneSafeMethod(_, method, target) {
40742
40739
  }
40743
40740
 
40744
40741
  // Does not support submit and go to
40745
- var goToRegex = new RegExp(guideMarkdownUtil.goToString);
40746
- var PollBranching = {
40742
+ const goToRegex = new RegExp(guideMarkdownUtil.goToString);
40743
+ const PollBranching = {
40747
40744
  name: 'PollBranching',
40748
- script: function (step, guide, pendo) {
40749
- var isAdvanceIntercepted = false;
40750
- var branchingQuestions = initialBranchingSetup(step, pendo);
40745
+ script(step, guide, pendo) {
40746
+ let isAdvanceIntercepted = false;
40747
+ const branchingQuestions = initialBranchingSetup(step, pendo);
40751
40748
  if (branchingQuestions) {
40752
40749
  // If there are too many branching questions saved, exit and run the guide normally.
40753
40750
  if (pendo._.size(branchingQuestions) > 1)
40754
40751
  return;
40755
- this.on('beforeAdvance', function (evt) {
40756
- var noResponseSelected = step.guideElement.find('[branching] .pendo-radio:checked').length === 0;
40757
- var responseLabel = step.guideElement.find('[branching] .pendo-radio:checked + label')[0];
40758
- var noGotoLabel;
40752
+ this.on('beforeAdvance', (evt) => {
40753
+ const noResponseSelected = step.guideElement.find('[branching] .pendo-radio:checked').length === 0;
40754
+ const responseLabel = step.guideElement.find('[branching] .pendo-radio:checked + label')[0];
40755
+ let noGotoLabel;
40759
40756
  if (responseLabel) {
40760
40757
  noGotoLabel = pendo._.isNull(responseLabel.getAttribute('goToStep'));
40761
40758
  }
@@ -40766,58 +40763,58 @@ var PollBranching = {
40766
40763
  });
40767
40764
  }
40768
40765
  },
40769
- test: function (step, guide, pendo) {
40766
+ test(step, guide, pendo) {
40770
40767
  var _a;
40771
- var branchingQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
40768
+ let branchingQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
40772
40769
  return !pendo._.isUndefined(branchingQuestions) && pendo._.size(branchingQuestions);
40773
40770
  },
40774
- designerListener: function (pendo) {
40775
- var target = pendo.dom.getBody();
40776
- var config = {
40771
+ designerListener(pendo) {
40772
+ const target = pendo.dom.getBody();
40773
+ const config = {
40777
40774
  attributeFilter: ['data-layout'],
40778
40775
  attributes: true,
40779
40776
  childList: true,
40780
40777
  characterData: true,
40781
40778
  subtree: true
40782
40779
  };
40783
- var MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
40784
- var observer = new MutationObserver(applyBranchingIndicators);
40780
+ const MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
40781
+ const observer = new MutationObserver(applyBranchingIndicators);
40785
40782
  observer.observe(target, config);
40786
40783
  function applyBranchingIndicators(mutations) {
40787
40784
  pendo._.each(mutations, function (mutation) {
40788
40785
  var _a;
40789
- var nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelector);
40786
+ const nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelector);
40790
40787
  if (mutation.addedNodes.length && nodeHasQuerySelector) {
40791
40788
  if (mutation.addedNodes[0].querySelector('._pendo-multi-choice-poll-select-border')) {
40792
40789
  if (pendo._.size(pendo.dom('._pendo-multi-choice-poll-question:contains("{branching/}")'))) {
40793
40790
  pendo
40794
40791
  .dom('._pendo-multi-choice-poll-question:contains("{branching/}")')
40795
- .each(function (question, index) {
40796
- pendo._.each(pendo.dom("#".concat(question.id, " *")), function (element) {
40792
+ .each((question, index) => {
40793
+ pendo._.each(pendo.dom(`#${question.id} *`), (element) => {
40797
40794
  guideMarkdownUtil.removeMarkdownSyntax(element, '{branching/}', '', pendo);
40798
40795
  });
40799
40796
  pendo
40800
- .dom("#".concat(question.id, " p"))
40797
+ .dom(`#${question.id} p`)
40801
40798
  .css({ display: 'inline-block !important' })
40802
40799
  .append(branchingIcon('#999', '20px'))
40803
40800
  .attr({ title: 'Custom Branching Added' });
40804
- var dataPendoPollId = question.getAttribute('data-pendo-poll-id');
40805
- if (pendo.dom("._pendo-multi-choice-poll-question[data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0]) {
40801
+ let dataPendoPollId = question.getAttribute('data-pendo-poll-id');
40802
+ if (pendo.dom(`._pendo-multi-choice-poll-question[data-pendo-poll-id=${dataPendoPollId}]`)[0]) {
40806
40803
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
40807
40804
  pendo
40808
- .dom("._pendo-multi-choice-poll-question[data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0]
40805
+ .dom(`._pendo-multi-choice-poll-question[data-pendo-poll-id=${dataPendoPollId}]`)[0]
40809
40806
  .textContent.trim();
40810
40807
  }
40811
- var pollLabels = pendo.dom("label[for*=".concat(dataPendoPollId, "]"));
40808
+ let pollLabels = pendo.dom(`label[for*=${dataPendoPollId}]`);
40812
40809
  if (pendo._.size(pollLabels)) {
40813
- pendo._.forEach(pollLabels, function (label) {
40810
+ pendo._.forEach(pollLabels, (label) => {
40814
40811
  if (goToRegex.test(label.textContent)) {
40815
- var labelTitle = goToRegex.exec(label.textContent)[2];
40812
+ let labelTitle = goToRegex.exec(label.textContent)[2];
40816
40813
  guideMarkdownUtil.removeMarkdownSyntax(label, goToRegex, '', pendo);
40817
40814
  pendo
40818
40815
  .dom(label)
40819
40816
  .append(branchingIcon('#999', '14px'))
40820
- .attr({ title: "Branching to step ".concat(labelTitle) });
40817
+ .attr({ title: `Branching to step ${labelTitle}` });
40821
40818
  }
40822
40819
  });
40823
40820
  }
@@ -40825,9 +40822,9 @@ var PollBranching = {
40825
40822
  pendo
40826
40823
  .dom(question)
40827
40824
  .append(branchingErrorHTML(question.dataset.pendoPollId));
40828
- pendo.dom("#".concat(question.id, " #pendo-ps-branching-svg")).remove();
40825
+ pendo.dom(`#${question.id} #pendo-ps-branching-svg`).remove();
40829
40826
  pendo
40830
- .dom("#".concat(question.id, " p"))
40827
+ .dom(`#${question.id} p`)
40831
40828
  .css({ display: 'inline-block !important' })
40832
40829
  .append(branchingIcon('red', '20px'))
40833
40830
  .attr({ title: 'Unsupported Branching configuration' });
@@ -40839,31 +40836,49 @@ var PollBranching = {
40839
40836
  });
40840
40837
  }
40841
40838
  function branchingErrorHTML(dataPendoPollId) {
40842
- 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>");
40839
+ return `<div style="text-align:lrft; font-size: 14px; color: red;
40840
+ font-style: italic; margin-top: 0px;" class="branching-wrapper"
40841
+ name="${dataPendoPollId}">
40842
+ * Branching Error: Multiple branching polls not supported</div>`;
40843
40843
  }
40844
40844
  function branchingIcon(color, size) {
40845
- 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>");
40845
+ return `<svg id="pendo-ps-branching-svg" viewBox="0 0 24 24" fill="none"
40846
+ style="margin-left: 5px;
40847
+ height:${size}; width:${size}; display:inline; vertical-align:middle;" xmlns="http://www.w3.org/2000/svg">
40848
+ <g stroke-width="0"></g>
40849
+ <g stroke-linecap="round" stroke-linejoin="round"></g>
40850
+ <g> <circle cx="4" cy="7" r="2" stroke="${color}"
40851
+ stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></circle>
40852
+ <circle cx="20" cy="7" r="2" stroke="${color}"
40853
+ stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></circle>
40854
+ <circle cx="20" cy="17" r="2" stroke="${color}" stroke-width="2"
40855
+ stroke-linecap="round" stroke-linejoin="round"></circle>
40856
+ <path d="M18 7H6" stroke="${color}" stroke-width="2"
40857
+ stroke-linecap="round" stroke-linejoin="round"></path>
40858
+ <path d="M7 7V7C8.65685 7 10 8.34315 10 10V15C10 16.1046 10.8954 17 12 17H18"
40859
+ stroke="${color}" stroke-width="2" stroke-linecap="round"
40860
+ stroke-linejoin="round"></path> </g></svg>`;
40846
40861
  }
40847
40862
  }
40848
40863
  };
40849
40864
  function initialBranchingSetup(step, pendo) {
40850
- var questions = step.guideElement.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
40851
- pendo._.forEach(questions, function (question) {
40852
- var dataPendoPollId = question.getAttribute('data-pendo-poll-id');
40853
- pendo._.each(step.guideElement.find("#".concat(question.id, " *")), function (element) {
40865
+ const questions = step.guideElement.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
40866
+ pendo._.forEach(questions, (question) => {
40867
+ let dataPendoPollId = question.getAttribute('data-pendo-poll-id');
40868
+ pendo._.each(step.guideElement.find(`#${question.id} *`), (element) => {
40854
40869
  guideMarkdownUtil.removeMarkdownSyntax(element, '{branching/}', '', pendo);
40855
40870
  });
40856
- var pollLabels = step.guideElement.find("label[for*=".concat(dataPendoPollId, "]"));
40857
- pendo._.forEach(pollLabels, function (label) {
40871
+ let pollLabels = step.guideElement.find(`label[for*=${dataPendoPollId}]`);
40872
+ pendo._.forEach(pollLabels, (label) => {
40858
40873
  if (pendo._.isNull(goToRegex.exec(label.textContent))) {
40859
40874
  return;
40860
40875
  }
40861
- var gotoSubstring = goToRegex.exec(label.textContent)[1];
40862
- var gotoIndex = goToRegex.exec(label.textContent)[2];
40876
+ let gotoSubstring = goToRegex.exec(label.textContent)[1];
40877
+ let gotoIndex = goToRegex.exec(label.textContent)[2];
40863
40878
  label.setAttribute('goToStep', gotoIndex);
40864
40879
  guideMarkdownUtil.removeMarkdownSyntax(label, gotoSubstring, '', pendo);
40865
40880
  });
40866
- var pollChoiceContainer = step.guideElement.find("[data-pendo-poll-id=".concat(dataPendoPollId, "]._pendo-multi-choice-poll-select-border"));
40881
+ let pollChoiceContainer = step.guideElement.find(`[data-pendo-poll-id=${dataPendoPollId}]._pendo-multi-choice-poll-select-border`);
40867
40882
  if (pollChoiceContainer && pollChoiceContainer.length) {
40868
40883
  pollChoiceContainer[0].setAttribute('branching', '');
40869
40884
  }
@@ -40872,24 +40887,24 @@ function initialBranchingSetup(step, pendo) {
40872
40887
  }
40873
40888
  function branchingGoToStep(event, step, guide, pendo) {
40874
40889
  var _a;
40875
- var checkedPollInputId = (_a = step.guideElement.find('[branching] input.pendo-radio[data-pendo-poll-id]:checked')[0]) === null || _a === void 0 ? void 0 : _a.id;
40876
- var checkedPollLabel = step.guideElement.find("label[for=\"".concat(checkedPollInputId, "\"]"))[0];
40877
- var checkedPollLabelStepIndex = checkedPollLabel === null || checkedPollLabel === void 0 ? void 0 : checkedPollLabel.getAttribute('goToStep');
40878
- var pollStepIndex = checkedPollLabelStepIndex - 1;
40890
+ let checkedPollInputId = (_a = step.guideElement.find('[branching] input.pendo-radio[data-pendo-poll-id]:checked')[0]) === null || _a === void 0 ? void 0 : _a.id;
40891
+ let checkedPollLabel = step.guideElement.find(`label[for="${checkedPollInputId}"]`)[0];
40892
+ let checkedPollLabelStepIndex = checkedPollLabel === null || checkedPollLabel === void 0 ? void 0 : checkedPollLabel.getAttribute('goToStep');
40893
+ let pollStepIndex = checkedPollLabelStepIndex - 1;
40879
40894
  if (pollStepIndex < 0)
40880
40895
  return;
40881
- var destinationObject = {
40896
+ const destinationObject = {
40882
40897
  destinationStepId: guide.steps[pollStepIndex].id,
40883
- step: step
40898
+ step
40884
40899
  };
40885
40900
  pendo.goToStep(destinationObject);
40886
40901
  event.cancel = true;
40887
40902
  }
40888
40903
 
40889
- var MetadataSubstitution = {
40904
+ const MetadataSubstitution = {
40890
40905
  name: 'MetadataSubstitution',
40891
- script: function (step, guide, pendo) {
40892
- var placeholderData = findSubstitutableElements(pendo);
40906
+ script(step, guide, pendo) {
40907
+ const placeholderData = findSubstitutableElements(pendo);
40893
40908
  if (step.domJson) {
40894
40909
  findSubstitutableUrlsInJson(step.domJson, placeholderData, pendo);
40895
40910
  }
@@ -40897,22 +40912,22 @@ var MetadataSubstitution = {
40897
40912
  pendo._.each(placeholderData, function (placeholder) {
40898
40913
  processPlaceholder(placeholder, pendo);
40899
40914
  });
40900
- var containerId = "pendo-g-".concat(step.id);
40901
- var context_1 = step.guideElement;
40902
- updateGuideContainer(containerId, context_1, pendo);
40915
+ const containerId = `pendo-g-${step.id}`;
40916
+ const context = step.guideElement;
40917
+ updateGuideContainer(containerId, context, pendo);
40903
40918
  }
40904
40919
  },
40905
- designerListener: function (pendo) {
40906
- var target = pendo.dom.getBody();
40920
+ designerListener(pendo) {
40921
+ const target = pendo.dom.getBody();
40907
40922
  if (pendo.designerv2) {
40908
40923
  pendo.designerv2.runMetadataSubstitutionForDesignerPreview = function runMetadataSubstitutionForDesignerPreview() {
40909
40924
  var _a;
40910
40925
  if (!document.querySelector(guideMarkdownUtil.containerSelector))
40911
40926
  return;
40912
- var step = (_a = pendo.designerv2.currentlyPreviewedGuide) === null || _a === void 0 ? void 0 : _a.steps[0];
40927
+ const step = (_a = pendo.designerv2.currentlyPreviewedGuide) === null || _a === void 0 ? void 0 : _a.steps[0];
40913
40928
  if (!step)
40914
40929
  return;
40915
- var placeholderData = findSubstitutableElements(pendo);
40930
+ const placeholderData = findSubstitutableElements(pendo);
40916
40931
  if (step.buildingBlocks) {
40917
40932
  findSubstitutableUrlsInJson(step.buildingBlocks, placeholderData, pendo);
40918
40933
  }
@@ -40922,32 +40937,32 @@ var MetadataSubstitution = {
40922
40937
  return;
40923
40938
  processPlaceholder(placeholder, pendo);
40924
40939
  });
40925
- var containerId = "pendo-g-".concat(step.id);
40926
- var context_2 = step.guideElement;
40927
- updateGuideContainer(containerId, context_2, pendo);
40940
+ const containerId = `pendo-g-${step.id}`;
40941
+ const context = step.guideElement;
40942
+ updateGuideContainer(containerId, context, pendo);
40928
40943
  }
40929
40944
  };
40930
40945
  }
40931
- var config = {
40946
+ const config = {
40932
40947
  attributeFilter: ['data-layout'],
40933
40948
  attributes: true,
40934
40949
  childList: true,
40935
40950
  characterData: true,
40936
40951
  subtree: true
40937
40952
  };
40938
- var MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
40939
- var observer = new MutationObserver(applySubstitutionIndicators);
40953
+ const MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
40954
+ const observer = new MutationObserver(applySubstitutionIndicators);
40940
40955
  observer.observe(target, config);
40941
40956
  function applySubstitutionIndicators(mutations) {
40942
40957
  pendo._.each(mutations, function (mutation) {
40943
40958
  var _a;
40944
40959
  if (mutation.addedNodes.length) {
40945
40960
  if (document.querySelector(guideMarkdownUtil.containerSelector)) {
40946
- var placeholderData = findSubstitutableElements(pendo);
40947
- var step = (_a = pendo.designerv2.currentlyPreviewedGuide) === null || _a === void 0 ? void 0 : _a.steps[0];
40961
+ const placeholderData = findSubstitutableElements(pendo);
40962
+ const step = (_a = pendo.designerv2.currentlyPreviewedGuide) === null || _a === void 0 ? void 0 : _a.steps[0];
40948
40963
  if (!step)
40949
40964
  return;
40950
- var pendoBlocks = step.buildingBlocks;
40965
+ const pendoBlocks = step.buildingBlocks;
40951
40966
  if (!pendo._.isUndefined(pendoBlocks)) {
40952
40967
  findSubstitutableUrlsInJson(pendoBlocks, placeholderData, pendo);
40953
40968
  }
@@ -40957,9 +40972,9 @@ var MetadataSubstitution = {
40957
40972
  return;
40958
40973
  processPlaceholder(placeholder, pendo);
40959
40974
  });
40960
- var containerId = "pendo-g-".concat(step.id);
40961
- var context_3 = step.guideElement;
40962
- updateGuideContainer(containerId, context_3, pendo);
40975
+ const containerId = `pendo-g-${step.id}`;
40976
+ const context = step.guideElement;
40977
+ updateGuideContainer(containerId, context, pendo);
40963
40978
  }
40964
40979
  }
40965
40980
  }
@@ -40968,18 +40983,18 @@ var MetadataSubstitution = {
40968
40983
  }
40969
40984
  };
40970
40985
  function processPlaceholder(placeholder, pendo) {
40971
- var match;
40972
- var data = placeholder.data, target = placeholder.target;
40973
- var subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
40986
+ let match;
40987
+ const { data, target } = placeholder;
40988
+ const subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
40974
40989
  while ((match = matchPlaceholder(placeholder, subRegex))) {
40975
- var usedArrayPath = Array.isArray(match) && match.length >= 2;
40976
- var currentStr = target === 'textContent'
40990
+ const usedArrayPath = Array.isArray(match) && match.length >= 2;
40991
+ const currentStr = target === 'textContent'
40977
40992
  ? data[target]
40978
40993
  : decodeURI((data.getAttribute && (target === 'href' || target === 'value') ? (data.getAttribute(target) || '') : data[target]));
40979
- var matched = usedArrayPath ? match : subRegex.exec(currentStr);
40994
+ const matched = usedArrayPath ? match : subRegex.exec(currentStr);
40980
40995
  if (!matched)
40981
40996
  continue;
40982
- var mdValue = getSubstituteValue(matched, pendo);
40997
+ const mdValue = getSubstituteValue(matched, pendo);
40983
40998
  substituteMetadataByTarget(data, target, mdValue, matched);
40984
40999
  }
40985
41000
  }
@@ -40988,48 +41003,48 @@ function matchPlaceholder(placeholder, regex) {
40988
41003
  return placeholder.data[placeholder.target].match(regex);
40989
41004
  }
40990
41005
  else {
40991
- var raw = placeholder.data.getAttribute && (placeholder.target === 'href' || placeholder.target === 'value')
41006
+ const raw = placeholder.data.getAttribute && (placeholder.target === 'href' || placeholder.target === 'value')
40992
41007
  ? (placeholder.data.getAttribute(placeholder.target) || '')
40993
41008
  : placeholder.data[placeholder.target];
40994
41009
  return decodeURI(raw).match(regex);
40995
41010
  }
40996
41011
  }
40997
41012
  function getMetadataValueCaseInsensitive(metadata, type, property) {
40998
- var kind = metadata && metadata[type];
41013
+ const kind = metadata && metadata[type];
40999
41014
  if (!kind || typeof kind !== 'object')
41000
41015
  return undefined;
41001
- var direct = Object.prototype.hasOwnProperty.call(kind, property) ? kind[property] : undefined;
41016
+ const direct = Object.prototype.hasOwnProperty.call(kind, property) ? kind[property] : undefined;
41002
41017
  if (direct !== undefined) {
41003
41018
  return direct;
41004
41019
  }
41005
- var propLower = property.toLowerCase();
41006
- var key = Object.keys(kind).find(function (k) { return k.toLowerCase() === propLower; });
41007
- var value = key !== undefined ? kind[key] : undefined;
41020
+ const propLower = property.toLowerCase();
41021
+ const key = Object.keys(kind).find(k => k.toLowerCase() === propLower);
41022
+ const value = key !== undefined ? kind[key] : undefined;
41008
41023
  return value;
41009
41024
  }
41010
41025
  function getSubstituteValue(match, pendo) {
41011
41026
  if (pendo._.isUndefined(match[1]) || pendo._.isUndefined(match[2])) {
41012
41027
  return;
41013
41028
  }
41014
- var type = match[1];
41015
- var property = match[2];
41016
- var defaultValue = match[3];
41029
+ let type = match[1];
41030
+ let property = match[2];
41031
+ let defaultValue = match[3];
41017
41032
  if (pendo._.isUndefined(type) || pendo._.isUndefined(property)) {
41018
41033
  return;
41019
41034
  }
41020
- var metadata = pendo.getSerializedMetadata();
41021
- var mdValue = getMetadataValueCaseInsensitive(metadata, type, property);
41035
+ const metadata = pendo.getSerializedMetadata();
41036
+ let mdValue = getMetadataValueCaseInsensitive(metadata, type, property);
41022
41037
  if (mdValue === undefined || mdValue === null)
41023
41038
  mdValue = defaultValue || '';
41024
41039
  return mdValue;
41025
41040
  }
41026
41041
  function substituteMetadataByTarget(data, target, mdValue, matched) {
41027
- var isElement = data && typeof data.getAttribute === 'function';
41028
- var current = (target === 'href' || target === 'value') && isElement
41042
+ const isElement = data && typeof data.getAttribute === 'function';
41043
+ const current = (target === 'href' || target === 'value') && isElement
41029
41044
  ? (data.getAttribute(target) || '')
41030
41045
  : data[target];
41031
41046
  if (target === 'href' || target === 'value') {
41032
- var safeValue = window.encodeURIComponent(String(mdValue === undefined || mdValue === null ? '' : mdValue));
41047
+ const safeValue = window.encodeURIComponent(String(mdValue === undefined || mdValue === null ? '' : mdValue));
41033
41048
  data[target] = decodeURI(current).replace(matched[0], safeValue);
41034
41049
  }
41035
41050
  else {
@@ -41043,9 +41058,8 @@ function updateGuideContainer(containerId, context, pendo) {
41043
41058
  pendo.flexElement(pendo.dom(guideMarkdownUtil.containerSelector));
41044
41059
  pendo.BuildingBlocks.BuildingBlockGuides.recalculateGuideHeight(containerId, context);
41045
41060
  }
41046
- function findSubstitutableUrlsInJson(originalData, placeholderData, pendo) {
41047
- if (placeholderData === void 0) { placeholderData = []; }
41048
- var subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
41061
+ function findSubstitutableUrlsInJson(originalData, placeholderData = [], pendo) {
41062
+ const subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
41049
41063
  if ((originalData.name === 'url' || originalData.name === 'href') && originalData.value) {
41050
41064
  if (subRegex.test(originalData.value)) {
41051
41065
  placeholderData.push({
@@ -41055,37 +41069,37 @@ function findSubstitutableUrlsInJson(originalData, placeholderData, pendo) {
41055
41069
  }
41056
41070
  }
41057
41071
  if (originalData.properties && originalData.id === 'href_link_block') {
41058
- pendo._.each(originalData.properties, function (prop) {
41072
+ pendo._.each(originalData.properties, (prop) => {
41059
41073
  findSubstitutableUrlsInJson(prop, placeholderData, pendo);
41060
41074
  });
41061
41075
  }
41062
41076
  if (originalData.views) {
41063
- pendo._.each(originalData.views, function (view) {
41077
+ pendo._.each(originalData.views, (view) => {
41064
41078
  findSubstitutableUrlsInJson(view, placeholderData, pendo);
41065
41079
  });
41066
41080
  }
41067
41081
  if (originalData.parameters) {
41068
- pendo._.each(originalData.parameters, function (param) {
41082
+ pendo._.each(originalData.parameters, (param) => {
41069
41083
  findSubstitutableUrlsInJson(param, placeholderData, pendo);
41070
41084
  });
41071
41085
  }
41072
41086
  if (originalData.actions) {
41073
- pendo._.each(originalData.actions, function (action) {
41087
+ pendo._.each(originalData.actions, (action) => {
41074
41088
  findSubstitutableUrlsInJson(action, placeholderData, pendo);
41075
41089
  });
41076
41090
  }
41077
41091
  if (originalData.children) {
41078
- pendo._.each(originalData.children, function (child) {
41092
+ pendo._.each(originalData.children, (child) => {
41079
41093
  findSubstitutableUrlsInJson(child, placeholderData, pendo);
41080
41094
  });
41081
41095
  }
41082
41096
  return placeholderData;
41083
41097
  }
41084
41098
  function findSubstitutableElements(pendo) {
41085
- var elements = pendo.dom("".concat(guideMarkdownUtil.containerSelector, " *:not(.pendo-inline-ui)"));
41099
+ let elements = pendo.dom(`${guideMarkdownUtil.containerSelector} *:not(.pendo-inline-ui)`);
41086
41100
  return pendo._.chain(elements)
41087
41101
  .filter(function (placeholder) {
41088
- var subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
41102
+ const subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
41089
41103
  if (placeholder.localName === 'a') {
41090
41104
  return subRegex.test(decodeURI(placeholder.href)) || subRegex.test(placeholder.textContent);
41091
41105
  }
@@ -41141,25 +41155,51 @@ function findSubstitutableElements(pendo) {
41141
41155
  .value();
41142
41156
  }
41143
41157
  function substitutionIcon(color, size) {
41144
- 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>"));
41145
- }
41146
-
41147
- var requiredElement = '<span class="_pendo-required-indicator" style="color:red; font-style:italic;" title="Question is required"> *</span>';
41148
- var requiredSyntax = '{required/}';
41149
- var RequiredQuestions = {
41158
+ return (`<div title="Metadata Substitution added">
41159
+ <svg id="pendo-ps-substitution-icon" viewBox="0 0 24 24"
41160
+ preserveAspectRatio="xMidYMid meet"
41161
+ height=${size} width=${size} title="Metadata Substitution"
41162
+ style="bottom:5px; right:10px; position: absolute;"
41163
+ fill="none" xmlns="http://www.w3.org/2000/svg" stroke="${color}"
41164
+ transform="matrix(1, 0, 0, 1, 0, 0)rotate(0)">
41165
+ <g stroke-width="0"></g>
41166
+ <g stroke-linecap="round" stroke-linejoin="round"
41167
+ stroke="${color}" stroke-width="0.528"></g>
41168
+ <g><path fill-rule="evenodd" clip-rule="evenodd"
41169
+ d="M5 5.5C4.17157 5.5 3.5 6.17157 3.5 7V10C3.5 10.8284
41170
+ 4.17157 11.5 5 11.5H8C8.82843 11.5 9.5 10.8284 9.5
41171
+ 10V9H17V11C17 11.2761 17.2239 11.5 17.5 11.5C17.7761
41172
+ 11.5 18 11.2761 18 11V8.5C18 8.22386 17.7761 8 17.5
41173
+ 8H9.5V7C9.5 6.17157 8.82843 5.5 8 5.5H5ZM8.5 7C8.5
41174
+ 6.72386 8.27614 6.5 8 6.5H5C4.72386 6.5 4.5 6.72386
41175
+ 4.5 7V10C4.5 10.2761 4.72386 10.5 5 10.5H8C8.27614
41176
+ 10.5 8.5 10.2761 8.5 10V7Z" fill="${color}"></path>
41177
+ <path fill-rule="evenodd" clip-rule="evenodd"
41178
+ d="M7 13C7 12.7239 6.77614 12.5 6.5 12.5C6.22386 12.5
41179
+ 6 12.7239 6 13V15.5C6 15.7761 6.22386 16 6.5
41180
+ 16H14.5V17C14.5 17.8284 15.1716 18.5 16 18.5H19C19.8284
41181
+ 18.5 20.5 17.8284 20.5 17V14C20.5 13.1716 19.8284 12.5
41182
+ 19 12.5H16C15.1716 12.5 14.5 13.1716 14.5
41183
+ 14V15H7V13ZM15.5 17C15.5 17.2761 15.7239 17.5 16
41184
+ 17.5H19C19.2761 17.5 19.5 17.2761 19.5 17V14C19.5
41185
+ 13.7239 19.2761 13.5 19 13.5H16C15.7239 13.5 15.5
41186
+ 13.7239 15.5 14V17Z" fill="${color}"></path> </g></svg></div>`);
41187
+ }
41188
+
41189
+ const requiredElement = '<span class="_pendo-required-indicator" style="color:red; font-style:italic;" title="Question is required"> *</span>';
41190
+ const requiredSyntax = '{required/}';
41191
+ const RequiredQuestions = {
41150
41192
  name: 'RequiredQuestions',
41151
- script: function (step, guide, pendo) {
41193
+ script(step, guide, pendo) {
41152
41194
  var _a;
41153
- var requiredPollIds = [];
41154
- var submitButtons = (_a = guideMarkdownUtil.lookupGuideButtons(step.domJson)) === null || _a === void 0 ? void 0 : _a.filter(function (button) {
41155
- return button.actions.find(function (action) { return action.action === 'submitPoll' || action.action === 'submitPollAndGoToStep'; });
41156
- });
41157
- var requiredQuestions = processRequiredQuestions();
41195
+ let requiredPollIds = [];
41196
+ 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'));
41197
+ const requiredQuestions = processRequiredQuestions();
41158
41198
  if (requiredQuestions) {
41159
- pendo._.forEach(requiredQuestions, function (question) {
41199
+ pendo._.forEach(requiredQuestions, (question) => {
41160
41200
  if (question.classList.contains('_pendo-open-text-poll-question')) {
41161
- var pollId = question.dataset.pendoPollId;
41162
- step.attachEvent(step.guideElement.find("[data-pendo-poll-id=".concat(pollId, "]._pendo-open-text-poll-input"))[0], 'input', function () {
41201
+ let pollId = question.dataset.pendoPollId;
41202
+ step.attachEvent(step.guideElement.find(`[data-pendo-poll-id=${pollId}]._pendo-open-text-poll-input`)[0], 'input', function () {
41163
41203
  evaluateRequiredQuestions(requiredQuestions);
41164
41204
  });
41165
41205
  }
@@ -41171,8 +41211,8 @@ var RequiredQuestions = {
41171
41211
  });
41172
41212
  }
41173
41213
  function getEligibleQuestions() {
41174
- var allQuestions = step.guideElement.find("[class*=-poll-question]:contains(".concat(requiredSyntax, ")"));
41175
- return pendo._.reduce(allQuestions, function (eligibleQuestions, question) {
41214
+ const allQuestions = step.guideElement.find(`[class*=-poll-question]:contains(${requiredSyntax})`);
41215
+ return pendo._.reduce(allQuestions, (eligibleQuestions, question) => {
41176
41216
  if (question.classList.contains('_pendo-yes-no-poll-question'))
41177
41217
  return eligibleQuestions;
41178
41218
  eligibleQuestions.push(question);
@@ -41180,19 +41220,27 @@ var RequiredQuestions = {
41180
41220
  }, []);
41181
41221
  }
41182
41222
  function processRequiredQuestions() {
41183
- var questions = getEligibleQuestions();
41223
+ let questions = getEligibleQuestions();
41184
41224
  if (questions) {
41185
- pendo._.forEach(questions, function (question) {
41186
- var dataPendoPollId = question.getAttribute('data-pendo-poll-id');
41225
+ pendo._.forEach(questions, question => {
41226
+ let dataPendoPollId = question.getAttribute('data-pendo-poll-id');
41187
41227
  requiredPollIds.push(dataPendoPollId);
41188
- pendo._.each(step.guideElement.find("#".concat(question.id, " *, #").concat(question.id)), function (element) {
41228
+ pendo._.each(step.guideElement.find(`#${question.id} *, #${question.id}`), (element) => {
41189
41229
  guideMarkdownUtil.removeMarkdownSyntax(element, requiredSyntax, '', pendo);
41190
41230
  });
41191
- step.guideElement.find("#".concat(question.id, " p")).append(requiredElement);
41231
+ step.guideElement.find(`#${question.id} p`).append(requiredElement);
41192
41232
  });
41193
41233
  }
41194
41234
  if (pendo._.size(requiredPollIds)) {
41195
- 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>";
41235
+ const disabledButtonStyles = `<style type=text/css
41236
+ id=_pendo-guide-required-disabled>
41237
+ ._pendo-button:disabled, ._pendo-buttons[disabled] {
41238
+ border: 1px solid #999999 !important;
41239
+ background-color: #cccccc !important;
41240
+ color: #666666 !important;
41241
+ pointer-events: none !important;
41242
+ }
41243
+ </style>`;
41196
41244
  if (pendo.dom('#_pendo-guide-required-disabled').length === 0) {
41197
41245
  pendo.dom('head').append(disabledButtonStyles);
41198
41246
  }
@@ -41203,11 +41251,15 @@ var RequiredQuestions = {
41203
41251
  function evaluateRequiredQuestions(questions) {
41204
41252
  if (questions.length === 0)
41205
41253
  return;
41206
- var allRequiredComplete = true;
41207
- var responses = [];
41208
- responses = responses.concat(pendo._.map(questions, function (question) {
41209
- var pollId = question.getAttribute('data-pendo-poll-id');
41210
- 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"));
41254
+ let allRequiredComplete = true;
41255
+ let responses = [];
41256
+ responses = responses.concat(pendo._.map(questions, (question) => {
41257
+ let pollId = question.getAttribute('data-pendo-poll-id');
41258
+ let input = step.guideElement.find(`
41259
+ [data-pendo-poll-id=${pollId}] textarea,
41260
+ [data-pendo-poll-id=${pollId}] input:text,
41261
+ [data-pendo-poll-id=${pollId}] select,
41262
+ [data-pendo-poll-id=${pollId}] input:radio:checked`);
41211
41263
  if (input && input.length && input[0].value) {
41212
41264
  return input[0].value;
41213
41265
  }
@@ -41224,48 +41276,48 @@ var RequiredQuestions = {
41224
41276
  }
41225
41277
  function disableEligibleButtons(buttons) {
41226
41278
  pendo._.each(buttons, function (button) {
41227
- if (step.guideElement.find("#".concat(button.props.id))[0]) {
41228
- step.guideElement.find("#".concat(button.props.id))[0].disabled = true;
41229
- step.guideElement.find("#".concat(button.props.id))[0].parentElement.title = 'Please complete all required questions.';
41279
+ if (step.guideElement.find(`#${button.props.id}`)[0]) {
41280
+ step.guideElement.find(`#${button.props.id}`)[0].disabled = true;
41281
+ step.guideElement.find(`#${button.props.id}`)[0].parentElement.title = 'Please complete all required questions.';
41230
41282
  }
41231
41283
  });
41232
41284
  }
41233
41285
  function enableEligibleButtons(buttons) {
41234
41286
  pendo._.each(buttons, function (button) {
41235
- if (step.guideElement.find("#".concat(button.props.id))[0]) {
41236
- step.guideElement.find("#".concat(button.props.id))[0].disabled = false;
41237
- step.guideElement.find("#".concat(button.props.id))[0].parentElement.title = '';
41287
+ if (step.guideElement.find(`#${button.props.id}`)[0]) {
41288
+ step.guideElement.find(`#${button.props.id}`)[0].disabled = false;
41289
+ step.guideElement.find(`#${button.props.id}`)[0].parentElement.title = '';
41238
41290
  }
41239
41291
  });
41240
41292
  }
41241
41293
  },
41242
- test: function (step, guide, pendo) {
41294
+ test(step, guide, pendo) {
41243
41295
  var _a;
41244
- var requiredQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find("[class*=-poll-question]:contains(".concat(requiredSyntax, ")"));
41296
+ let requiredQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find(`[class*=-poll-question]:contains(${requiredSyntax})`);
41245
41297
  return !pendo._.isUndefined(requiredQuestions) && pendo._.size(requiredQuestions);
41246
41298
  },
41247
- designerListener: function (pendo) {
41248
- var requiredQuestions = [];
41249
- var target = pendo.dom.getBody();
41250
- var config = {
41299
+ designerListener(pendo) {
41300
+ const requiredQuestions = [];
41301
+ const target = pendo.dom.getBody();
41302
+ const config = {
41251
41303
  attributeFilter: ['data-layout'],
41252
41304
  attributes: true,
41253
41305
  childList: true,
41254
41306
  characterData: true,
41255
41307
  subtree: true
41256
41308
  };
41257
- var MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
41258
- var observer = new MutationObserver(applyRequiredIndicators);
41309
+ const MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
41310
+ const observer = new MutationObserver(applyRequiredIndicators);
41259
41311
  observer.observe(target, config);
41260
41312
  function applyRequiredIndicators(mutations) {
41261
41313
  pendo._.each(mutations, function (mutation) {
41262
41314
  var _a;
41263
- var nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
41315
+ const nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
41264
41316
  if (mutation.addedNodes.length && nodeHasQuerySelector) {
41265
- var eligiblePolls = mutation.addedNodes[0].querySelectorAll('[class*=-poll-wrapper], [class*=-poll-select-border]');
41317
+ let eligiblePolls = mutation.addedNodes[0].querySelectorAll('[class*=-poll-wrapper], [class*=-poll-select-border]');
41266
41318
  if (eligiblePolls) {
41267
41319
  pendo._.each(eligiblePolls, function (poll) {
41268
- var dataPendoPollId;
41320
+ let dataPendoPollId;
41269
41321
  if (poll.classList.contains('_pendo-open-text-poll-wrapper') ||
41270
41322
  poll.classList.contains('_pendo-number-scale-poll-wrapper')) {
41271
41323
  dataPendoPollId = poll.getAttribute('name');
@@ -41273,27 +41325,27 @@ var RequiredQuestions = {
41273
41325
  else {
41274
41326
  dataPendoPollId = poll.getAttribute('data-pendo-poll-id');
41275
41327
  }
41276
- var questionText;
41277
- var pollQuesiton = pendo.dom("[class*=\"-poll-question\"][data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0];
41328
+ let questionText;
41329
+ const pollQuesiton = pendo.dom(`[class*="-poll-question"][data-pendo-poll-id=${dataPendoPollId}]`)[0];
41278
41330
  if (pollQuesiton) {
41279
- questionText = pendo.dom("[class*=\"-poll-question\"][data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0].textContent;
41331
+ questionText = pendo.dom(`[class*="-poll-question"][data-pendo-poll-id=${dataPendoPollId}]`)[0].textContent;
41280
41332
  }
41281
- var requiredSyntaxIndex = questionText.indexOf(requiredSyntax);
41333
+ const requiredSyntaxIndex = questionText.indexOf(requiredSyntax);
41282
41334
  if (requiredSyntaxIndex > -1) {
41283
- pendo._.each(pendo.dom("[data-pendo-poll-id=".concat(dataPendoPollId, "]:not(.pendo-radio)")), function (element) {
41284
- pendo._.each(pendo.dom("#".concat(element.id, " *:not(\".pendo-radio\"), #").concat(element.id, ":not(\".pendo-radio\")")), function (item) {
41335
+ pendo._.each(pendo.dom(`[data-pendo-poll-id=${dataPendoPollId}]:not(.pendo-radio)`), (element) => {
41336
+ pendo._.each(pendo.dom(`#${element.id} *:not(".pendo-radio"), #${element.id}:not(".pendo-radio")`), (item) => {
41285
41337
  guideMarkdownUtil.removeMarkdownSyntax(item, requiredSyntax, '', pendo);
41286
41338
  });
41287
41339
  });
41288
- 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) {
41289
- pendo.dom(".bb-text[data-pendo-poll-id=".concat(dataPendoPollId, "] p")).append(requiredElement);
41290
- pendo.dom(".bb-text[data-pendo-poll-id=".concat(dataPendoPollId, "] li")).append(requiredElement);
41340
+ 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) {
41341
+ pendo.dom(`.bb-text[data-pendo-poll-id=${dataPendoPollId}] p`).append(requiredElement);
41342
+ pendo.dom(`.bb-text[data-pendo-poll-id=${dataPendoPollId}] li`).append(requiredElement);
41291
41343
  }
41292
41344
  else {
41293
- pendo.dom(".bb-text[data-pendo-poll-id=".concat(dataPendoPollId, "]")).append(requiredElement);
41345
+ pendo.dom(`.bb-text[data-pendo-poll-id=${dataPendoPollId}]`).append(requiredElement);
41294
41346
  }
41295
41347
  if (pendo._.contains(requiredQuestions, dataPendoPollId)) {
41296
- var questionIndex = requiredQuestions.indexOf(dataPendoPollId);
41348
+ let questionIndex = requiredQuestions.indexOf(dataPendoPollId);
41297
41349
  if (questionIndex !== -1) {
41298
41350
  requiredQuestions.splice(questionIndex, 1);
41299
41351
  }
@@ -41304,7 +41356,7 @@ var RequiredQuestions = {
41304
41356
  }
41305
41357
  else {
41306
41358
  if (pendo._.contains(requiredQuestions, dataPendoPollId)) {
41307
- var index = requiredQuestions.indexOf(dataPendoPollId);
41359
+ let index = requiredQuestions.indexOf(dataPendoPollId);
41308
41360
  if (index !== -1) {
41309
41361
  requiredQuestions.splice(index, 1);
41310
41362
  }
@@ -41318,54 +41370,54 @@ var RequiredQuestions = {
41318
41370
  }
41319
41371
  };
41320
41372
 
41321
- var skipStepRegex = new RegExp(guideMarkdownUtil.skipStepString);
41322
- var SkipToEligibleStep = {
41323
- script: function (step, guide, pendo) {
41324
- var isAdvanceIntercepted = false;
41325
- var isPreviousIntercepted = false;
41326
- var guideContainer = step.guideElement.find(guideMarkdownUtil.containerSelector);
41327
- var guideContainerAriaLabel = guideContainer.attr('aria-label');
41328
- var stepNumberOrAuto = skipStepRegex.exec(guideContainerAriaLabel)[1];
41373
+ const skipStepRegex = new RegExp(guideMarkdownUtil.skipStepString);
41374
+ const SkipToEligibleStep = {
41375
+ script(step, guide, pendo) {
41376
+ let isAdvanceIntercepted = false;
41377
+ let isPreviousIntercepted = false;
41378
+ let guideContainer = step.guideElement.find(guideMarkdownUtil.containerSelector);
41379
+ let guideContainerAriaLabel = guideContainer.attr('aria-label');
41380
+ let stepNumberOrAuto = skipStepRegex.exec(guideContainerAriaLabel)[1];
41329
41381
  if (guideContainer) {
41330
41382
  guideContainer.attr({ 'aria-label': guideContainer.attr('aria-label').replace(skipStepRegex, '') });
41331
41383
  }
41332
- this.on('beforeAdvance', function (evt) {
41384
+ this.on('beforeAdvance', (evt) => {
41333
41385
  if (guide.getPositionOfStep(step) === guide.steps.length || pendo._.isUndefined(stepNumberOrAuto))
41334
41386
  return; // exit on the last step of a guide or when we don't have an argument
41335
- var eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'next');
41387
+ let eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'next');
41336
41388
  if (!isAdvanceIntercepted && stepNumberOrAuto) {
41337
41389
  isAdvanceIntercepted = true;
41338
- pendo.goToStep({ destinationStepId: eligibleStep.id, step: step });
41390
+ pendo.goToStep({ destinationStepId: eligibleStep.id, step });
41339
41391
  evt.cancel = true;
41340
41392
  }
41341
41393
  });
41342
- this.on('beforePrevious', function (evt) {
41394
+ this.on('beforePrevious', (evt) => {
41343
41395
  if (pendo._.isUndefined(stepNumberOrAuto))
41344
41396
  return;
41345
- var eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'previous');
41397
+ let eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'previous');
41346
41398
  if (!isPreviousIntercepted && stepNumberOrAuto) {
41347
41399
  isPreviousIntercepted = true;
41348
- pendo.goToStep({ destinationStepId: eligibleStep.id, step: step });
41400
+ pendo.goToStep({ destinationStepId: eligibleStep.id, step });
41349
41401
  evt.cancel = true;
41350
41402
  }
41351
41403
  });
41352
41404
  function findEligibleSkipStep(stepNumber, direction) {
41353
41405
  // Find the next eligible step by using getPosition of step (1 based)
41354
41406
  // getPosition - 2 gives the previous step
41355
- var skipForwardStep = findStepOnPage(guide.getPositionOfStep(step), 'next', stepNumber);
41356
- var skipPreviousStep = findStepOnPage(guide.getPositionOfStep(step) - 2, 'previous', stepNumber);
41407
+ let skipForwardStep = findStepOnPage(guide.getPositionOfStep(step), 'next', stepNumber);
41408
+ let skipPreviousStep = findStepOnPage(guide.getPositionOfStep(step) - 2, 'previous', stepNumber);
41357
41409
  if (skipForwardStep && direction == 'next') {
41358
- pendo.goToStep({ destinationStepId: skipForwardStep, step: step });
41410
+ pendo.goToStep({ destinationStepId: skipForwardStep, step });
41359
41411
  }
41360
41412
  if (skipPreviousStep && direction == 'previous') {
41361
- pendo.goToStep({ destinationStepId: skipPreviousStep, step: step });
41413
+ pendo.goToStep({ destinationStepId: skipPreviousStep, step });
41362
41414
  }
41363
41415
  return direction === 'next' ? skipForwardStep : skipPreviousStep;
41364
41416
  }
41365
41417
  function findStepOnPage(stepIndex, direction, stepNumber) {
41366
41418
  if (pendo._.isNaN(stepIndex))
41367
41419
  return;
41368
- var $step = guide.steps[stepIndex];
41420
+ let $step = guide.steps[stepIndex];
41369
41421
  if ($step && !$step.canShow()) {
41370
41422
  if (stepNumber !== 'auto') {
41371
41423
  return guide.steps[stepNumber - 1];
@@ -41382,34 +41434,34 @@ var SkipToEligibleStep = {
41382
41434
  }
41383
41435
  }
41384
41436
  },
41385
- test: function (step, guide, pendo) {
41437
+ test(step, guide, pendo) {
41386
41438
  var _a;
41387
- var guideContainerAriaLabel = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find(guideMarkdownUtil.containerSelector).attr('aria-label');
41439
+ const guideContainerAriaLabel = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find(guideMarkdownUtil.containerSelector).attr('aria-label');
41388
41440
  return pendo._.isString(guideContainerAriaLabel) && guideContainerAriaLabel.indexOf('{skipStep') !== -1;
41389
41441
  },
41390
- designerListener: function (pendo) {
41391
- var target = pendo.dom.getBody();
41392
- var config = {
41442
+ designerListener(pendo) {
41443
+ const target = pendo.dom.getBody();
41444
+ const config = {
41393
41445
  attributeFilter: ['data-layout'],
41394
41446
  attributes: true,
41395
41447
  childList: true,
41396
41448
  characterData: true,
41397
41449
  subtree: true
41398
41450
  };
41399
- var MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
41400
- var observer = new MutationObserver(applySkipStepIndicator);
41451
+ const MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
41452
+ const observer = new MutationObserver(applySkipStepIndicator);
41401
41453
  observer.observe(target, config);
41402
41454
  // create an observer instance
41403
41455
  function applySkipStepIndicator(mutations) {
41404
41456
  pendo._.each(mutations, function (mutation) {
41405
41457
  var _a, _b;
41406
- var nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
41458
+ const nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
41407
41459
  if (mutation.addedNodes.length && nodeHasQuerySelector) {
41408
- var guideContainer = mutation.addedNodes[0].querySelectorAll(guideMarkdownUtil.containerSelector);
41409
- var guideContainerAriaLabel = (_b = guideContainer[0]) === null || _b === void 0 ? void 0 : _b.getAttribute('aria-label');
41460
+ let guideContainer = mutation.addedNodes[0].querySelectorAll(guideMarkdownUtil.containerSelector);
41461
+ let guideContainerAriaLabel = (_b = guideContainer[0]) === null || _b === void 0 ? void 0 : _b.getAttribute('aria-label');
41410
41462
  if (guideContainerAriaLabel) {
41411
41463
  if (guideContainerAriaLabel.match(skipStepRegex)) {
41412
- var fullSkipStepString = guideContainerAriaLabel.match(skipStepRegex)[0];
41464
+ let fullSkipStepString = guideContainerAriaLabel.match(skipStepRegex)[0];
41413
41465
  guideContainerAriaLabel.replace(fullSkipStepString, '');
41414
41466
  if (!pendo.dom('#_pendoSkipIcon').length) {
41415
41467
  pendo.dom(guideMarkdownUtil.containerSelector).append(skipIcon('#999', '30px').trim());
@@ -41420,30 +41472,48 @@ var SkipToEligibleStep = {
41420
41472
  });
41421
41473
  }
41422
41474
  function skipIcon(color, size) {
41423
- 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 "));
41475
+ return (`<div title="Skip step added"><svg id="_pendoSkipIcon" version="1.0" xmlns="http://www.w3.org/2000/svg"
41476
+ width="${size}" height="${size}" viewBox="0 0 512.000000 512.000000"
41477
+ preserveAspectRatio="xMidYMid meet" style="bottom:5px; right:10px; position: absolute;">
41478
+ <g transform="translate(0.000000,512.000000) scale(0.100000,-0.100000)"
41479
+ fill="${color}" stroke="none">
41480
+ <path d="M2185 4469 c-363 -38 -739 -186 -1034 -407 -95 -71 -273 -243 -357
41481
+ -343 -205 -246 -364 -577 -429 -897 -25 -121 -45 -288 -45 -373 l0 -49 160 0
41482
+ 160 0 0 48 c0 26 5 88 10 137 68 593 417 1103 940 1374 1100 570 2418 -137
41483
+ 2560 -1374 5 -49 10 -111 10 -137 l0 -47 -155 -3 -155 -3 235 -235 235 -236
41484
+ 235 236 235 235 -155 3 -155 3 0 48 c0 27 -5 95 -10 152 -100 989 -878 1767
41485
+ -1869 1868 -117 12 -298 12 -416 0z"/>
41486
+ <path d="M320 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
41487
+ <path d="M960 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
41488
+ <path d="M1600 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
41489
+ <path d="M2240 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
41490
+ <path d="M2880 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
41491
+ <path d="M3840 1440 l0 -160 480 0 480 0 0 160 0 160 -480 0 -480 0 0 -160z"/>
41492
+ </g></svg></div>
41493
+ `);
41424
41494
  }
41425
41495
  }
41426
41496
  };
41427
41497
 
41428
41498
  function GuideMarkdown() {
41429
- var guideMarkdown;
41430
- var pluginApi;
41431
- var globalPendo;
41499
+ let guideMarkdown;
41500
+ let pluginApi;
41501
+ let globalPendo;
41432
41502
  return {
41433
41503
  name: 'GuideMarkdown',
41434
41504
  initialize: init,
41435
- teardown: teardown
41505
+ teardown
41436
41506
  };
41437
41507
  function init(pendo, PluginAPI) {
41438
41508
  globalPendo = pendo;
41439
41509
  pluginApi = PluginAPI;
41440
- var configReader = PluginAPI.ConfigReader;
41441
- var GUIDEMARKDOWN_CONFIG = 'guideMarkdown';
41510
+ const configReader = PluginAPI.ConfigReader;
41511
+ const GUIDEMARKDOWN_CONFIG = 'guideMarkdown';
41442
41512
  configReader.addOption(GUIDEMARKDOWN_CONFIG, [
41443
41513
  configReader.sources.SNIPPET_SRC,
41444
41514
  configReader.sources.PENDO_CONFIG_SRC
41445
41515
  ], false);
41446
- var markdownScriptsEnabled = configReader.get(GUIDEMARKDOWN_CONFIG);
41516
+ const markdownScriptsEnabled = configReader.get(GUIDEMARKDOWN_CONFIG);
41447
41517
  if (!markdownScriptsEnabled)
41448
41518
  return;
41449
41519
  guideMarkdown = [PollBranching, MetadataSubstitution, RequiredQuestions, SkipToEligibleStep];
@@ -42372,22 +42442,22 @@ const startListening = (
42372
42442
  };
42373
42443
 
42374
42444
  function VocPortal() {
42375
- var pendoGlobal;
42376
- var pluginAPI;
42445
+ let pendoGlobal;
42446
+ let pluginAPI;
42377
42447
  return {
42378
42448
  name: 'VocPortal',
42379
- initialize: initialize,
42380
- routeHandlerLookup: routeHandlerLookup,
42381
- queryMessageHandler: queryMessageHandler,
42382
- resizeMessageHandler: resizeMessageHandler,
42383
- teardown: teardown
42449
+ initialize,
42450
+ routeHandlerLookup,
42451
+ queryMessageHandler,
42452
+ resizeMessageHandler,
42453
+ teardown
42384
42454
  };
42385
42455
  function initialize(pendo, PluginAPI) {
42386
42456
  pendoGlobal = pendo;
42387
42457
  pluginAPI = PluginAPI;
42388
- var frameId = PluginAPI.EventTracer.addTracerIds({}).frameId;
42458
+ const { frameId } = PluginAPI.EventTracer.addTracerIds({});
42389
42459
  this.removeResizeEvent = pendoGlobal.attachEvent(window, 'resize', resizePortalIframe);
42390
- startListening('VocPortal', frameId, routeHandlerLookup, function () { return '*'; });
42460
+ startListening('VocPortal', frameId, routeHandlerLookup, () => '*');
42391
42461
  }
42392
42462
  function routeHandlerLookup(path) {
42393
42463
  switch (path) {
@@ -42400,14 +42470,14 @@ function VocPortal() {
42400
42470
  }
42401
42471
  }
42402
42472
  function resizePortalIframe() {
42403
- var vocPortalRcContainer = document.getElementById('pendo-resource-center-container');
42404
- var vocPortalRcDOM = pendoGlobal.dom(vocPortalRcContainer);
42473
+ const vocPortalRcContainer = document.getElementById('pendo-resource-center-container');
42474
+ const vocPortalRcDOM = pendoGlobal.dom(vocPortalRcContainer);
42405
42475
  pluginAPI.sizeElements(vocPortalRcDOM);
42406
42476
  }
42407
42477
  function queryMessageHandler(_, responseHandler) {
42408
- var metadata = pendoGlobal.getSerializedMetadata();
42409
- var sandBoxMode = !!pendoGlobal.designer || pluginAPI.store.getters['preview/isInPreviewMode']();
42410
- var response = {
42478
+ const metadata = pendoGlobal.getSerializedMetadata();
42479
+ const sandBoxMode = !!pendoGlobal.designer || pluginAPI.store.getters['preview/isInPreviewMode']();
42480
+ const response = {
42411
42481
  apiKey: pendoGlobal.apiKey,
42412
42482
  url: pendoGlobal.url.externalizeURL(),
42413
42483
  visitor: metadata.visitor,
@@ -42421,19 +42491,26 @@ function VocPortal() {
42421
42491
  }
42422
42492
  function resizeMessageHandler(msg) {
42423
42493
  try {
42424
- var _a = msg.data.width, widthValue = _a["value"], widthUnit = _a["unit"], widthIsImportant = _a["isImportant"];
42425
- var _b = msg.data.height, heightValue = _b["value"], heightUnit = _b["unit"], heightIsImportant = _b["isImportant"];
42494
+ const { 'value': widthValue, 'unit': widthUnit, 'isImportant': widthIsImportant } = msg.data.width;
42495
+ const { 'value': heightValue, 'unit': heightUnit, 'isImportant': heightIsImportant } = msg.data.height;
42426
42496
  if (typeof widthValue !== 'number' || typeof heightValue !== 'number') {
42427
42497
  return;
42428
42498
  }
42429
- var validUnits = ['px', '%', 'vh', 'vw'];
42499
+ const validUnits = ['px', '%', 'vh', 'vw'];
42430
42500
  if (!pendoGlobal._.contains(validUnits, widthUnit) || !pendoGlobal._.contains(validUnits, heightUnit)) {
42431
42501
  return;
42432
42502
  }
42433
- var width = "".concat(widthValue).concat(widthUnit).concat(widthIsImportant ? ' !important' : '');
42434
- var height = "".concat(heightValue).concat(heightUnit).concat(heightIsImportant ? ' !important' : '');
42435
- var container = document.getElementById('pendo-resource-center-container');
42436
- pluginAPI.util.addInlineStyles('pendo-voc-portal-styles', "#pendo-resource-center-container:has(iframe[src*=\"portal\"][src*=\"mode=rc\"]) {\n width: ".concat(width, ";\n height: ").concat(height, ";\n ._pendo-step-container-size {\n width: ").concat(width, ";\n height: ").concat(height, ";\n }\n }"), container);
42503
+ const width = `${widthValue}${widthUnit}${widthIsImportant ? ' !important' : ''}`;
42504
+ const height = `${heightValue}${heightUnit}${heightIsImportant ? ' !important' : ''}`;
42505
+ const container = document.getElementById('pendo-resource-center-container');
42506
+ pluginAPI.util.addInlineStyles('pendo-voc-portal-styles', `#pendo-resource-center-container:has(iframe[src*="portal"][src*="mode=rc"]) {
42507
+ width: ${width};
42508
+ height: ${height};
42509
+ ._pendo-step-container-size {
42510
+ width: ${width};
42511
+ height: ${height};
42512
+ }
42513
+ }`, container);
42437
42514
  resizePortalIframe();
42438
42515
  }
42439
42516
  catch (err) {
@@ -42462,8 +42539,8 @@ function Feedback() {
42462
42539
  var widgetLoaded = false;
42463
42540
  var feedbackAllowedProductId = '';
42464
42541
  var initialized = false;
42465
- var PING_COOKIE = 'feedback_ping_sent';
42466
- var PING_COOKIE_EXPIRATION = 1000 * 60 * 60;
42542
+ const PING_COOKIE = 'feedback_ping_sent';
42543
+ const PING_COOKIE_EXPIRATION = 1000 * 60 * 60;
42467
42544
  var overflowMediaQuery = '@media only screen and (max-device-width:1112px){#feedback-widget{overflow-y:scroll}}';
42468
42545
  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%)}}';
42469
42546
  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)}}';
@@ -42483,28 +42560,28 @@ function Feedback() {
42483
42560
  feedbackStyles: 'pendo-feedback-styles',
42484
42561
  feedbackFrameStyles: 'pendo-feedback-visible-buttons-styles'
42485
42562
  };
42486
- var globalPendo;
42487
- var pluginApi;
42563
+ let globalPendo;
42564
+ let pluginApi;
42488
42565
  return {
42489
42566
  name: 'Feedback',
42490
- initialize: initialize,
42491
- teardown: teardown,
42492
- validate: validate
42567
+ initialize,
42568
+ teardown,
42569
+ validate
42493
42570
  };
42494
42571
  function initialize(pendo, PluginAPI) {
42495
42572
  globalPendo = pendo;
42496
42573
  pluginApi = PluginAPI;
42497
42574
  var publicFeedback = {
42498
- ping: ping,
42499
- init: init,
42575
+ ping,
42576
+ init,
42500
42577
  initialized: getInitialized,
42501
- loginAndRedirect: loginAndRedirect,
42502
- openFeedback: openFeedback,
42503
- initializeFeedbackOnce: initializeFeedbackOnce,
42504
- isFeedbackLoaded: isFeedbackLoaded,
42505
- convertPendoToFeedbackOptions: convertPendoToFeedbackOptions,
42578
+ loginAndRedirect,
42579
+ openFeedback,
42580
+ initializeFeedbackOnce,
42581
+ isFeedbackLoaded,
42582
+ convertPendoToFeedbackOptions,
42506
42583
  isUnsupportedIE: pendo._.partial(isUnsupportedIE, PluginAPI),
42507
- removeFeedbackWidget: removeFeedbackWidget
42584
+ removeFeedbackWidget
42508
42585
  };
42509
42586
  pendo.feedback = publicFeedback;
42510
42587
  pendo.getFeedbackSettings = getFeedbackSettings;
@@ -42532,7 +42609,7 @@ function Feedback() {
42532
42609
  */
42533
42610
  PluginAPI.agentStorage.registry.addLocal(PING_COOKIE, { duration: PING_COOKIE_EXPIRATION });
42534
42611
  return {
42535
- validate: validate
42612
+ validate
42536
42613
  };
42537
42614
  }
42538
42615
  function teardown() {
@@ -42552,18 +42629,18 @@ function Feedback() {
42552
42629
  return result;
42553
42630
  }
42554
42631
  function pingOrInitialize() {
42555
- var options = getPendoOptions();
42632
+ const options = getPendoOptions();
42556
42633
  if (initialized) {
42557
- var feedbackOptions = convertPendoToFeedbackOptions(options);
42634
+ const feedbackOptions = convertPendoToFeedbackOptions(options);
42558
42635
  ping(feedbackOptions);
42559
42636
  }
42560
42637
  else if (shouldInitializeFeedback() && !globalPendo._.isEmpty(options)) {
42561
- var settings = pluginApi.ConfigReader.get('feedbackSettings');
42562
- init(options, settings)["catch"](globalPendo._.noop);
42638
+ const settings = pluginApi.ConfigReader.get('feedbackSettings');
42639
+ init(options, settings).catch(globalPendo._.noop);
42563
42640
  }
42564
42641
  }
42565
42642
  function handleIdentityChange(event) {
42566
- var visitorId = globalPendo._.get(event, 'data.0.visitor_id') || globalPendo._.get(event, 'data.0.options.visitor.id');
42643
+ const visitorId = globalPendo._.get(event, 'data.0.visitor_id') || globalPendo._.get(event, 'data.0.options.visitor.id');
42567
42644
  if (globalPendo.isAnonymousVisitor(visitorId)) {
42568
42645
  removeFeedbackWidget();
42569
42646
  return;
@@ -42633,9 +42710,9 @@ function Feedback() {
42633
42710
  if (toSend.data && toSend.data !== '{}' && toSend.data !== 'null') {
42634
42711
  return globalPendo.ajax
42635
42712
  .postJSON(getFullUrl('/widget/pendo_ping'), toSend)
42636
- .then(function (response) {
42713
+ .then((response) => {
42637
42714
  onWidgetPingResponse(response);
42638
- })["catch"](function () { onPingFailure(); });
42715
+ }).catch(() => { onPingFailure(); });
42639
42716
  }
42640
42717
  }
42641
42718
  return pluginApi.q.resolve();
@@ -42769,10 +42846,10 @@ function Feedback() {
42769
42846
  return globalPendo.ajax.postJSON(getFullUrl('/analytics'), toSend);
42770
42847
  }
42771
42848
  function addOverlay() {
42772
- var widget = globalPendo.dom("#".concat(elemIds.feedbackWidget));
42849
+ const widget = globalPendo.dom(`#${elemIds.feedbackWidget}`);
42773
42850
  if (!widget)
42774
42851
  return;
42775
- var overlayStyles = {
42852
+ const overlayStyles = {
42776
42853
  'position': 'fixed',
42777
42854
  'top': '0',
42778
42855
  'right': '0',
@@ -42784,7 +42861,7 @@ function Feedback() {
42784
42861
  'animation': 'pendoFeedbackFadeIn 0.5s 0s 1 alternate both',
42785
42862
  '-webkit-animation': 'pendoFeedbackFadeIn 0.5s 0s 1 alternate both'
42786
42863
  };
42787
- var overlayElement = globalPendo.dom(document.createElement('div'));
42864
+ const overlayElement = globalPendo.dom(document.createElement('div'));
42788
42865
  overlayElement.attr('id', 'feedback-overlay');
42789
42866
  overlayElement.css(overlayStyles);
42790
42867
  overlayElement.appendTo(widget.getParent());
@@ -42889,22 +42966,22 @@ function Feedback() {
42889
42966
  }
42890
42967
  }
42891
42968
  function buildOuterTriggerDiv(positionInfo) {
42892
- var horizontalStyles = getHorizontalPositionStyles(positionInfo);
42893
- var verticalStyles = getVerticalPositionStyles(positionInfo);
42894
- var styles = globalPendo._.extend({
42969
+ const horizontalStyles = getHorizontalPositionStyles(positionInfo);
42970
+ const verticalStyles = getVerticalPositionStyles(positionInfo);
42971
+ const styles = globalPendo._.extend({
42895
42972
  'position': 'fixed',
42896
42973
  'height': '43px',
42897
42974
  'opacity': '1 !important',
42898
42975
  'z-index': '9001'
42899
42976
  }, horizontalStyles, verticalStyles);
42900
- var outerTrigger = globalPendo.dom(document.createElement('div'));
42977
+ const outerTrigger = globalPendo.dom(document.createElement('div'));
42901
42978
  outerTrigger.attr('id', elemIds.feedbackTrigger);
42902
42979
  outerTrigger.css(styles);
42903
42980
  outerTrigger.attr('data-turbolinks-permanent', '');
42904
42981
  return outerTrigger;
42905
42982
  }
42906
42983
  function buildNotification() {
42907
- var styles = {
42984
+ const styles = {
42908
42985
  'background-color': '#D85039',
42909
42986
  'color': '#fff',
42910
42987
  'border-radius': '50%',
@@ -42921,20 +42998,20 @@ function Feedback() {
42921
42998
  'animation-delay': '1s',
42922
42999
  'animation-iteration-count': '1'
42923
43000
  };
42924
- var notification = globalPendo.dom(document.createElement('span'));
43001
+ const notification = globalPendo.dom(document.createElement('span'));
42925
43002
  notification.attr('id', 'feedback-trigger-notification');
42926
43003
  notification.css(styles);
42927
43004
  return notification;
42928
43005
  }
42929
43006
  function buildTriggerButton(settings, positionInfo) {
42930
- var borderRadius;
43007
+ let borderRadius;
42931
43008
  if (positionInfo.horizontalPosition === 'left') {
42932
43009
  borderRadius = '0 0 5px 5px';
42933
43010
  }
42934
43011
  else {
42935
43012
  borderRadius = '3px 3px 0 0';
42936
43013
  }
42937
- var styles = {
43014
+ const styles = {
42938
43015
  'border': 'none',
42939
43016
  'padding': '11px 18px 14px 18px',
42940
43017
  'background-color': settings.triggerColor,
@@ -42945,21 +43022,32 @@ function Feedback() {
42945
43022
  'cursor': 'pointer',
42946
43023
  'text-align': 'left'
42947
43024
  };
42948
- var triggerButton = globalPendo.dom(document.createElement('button'));
43025
+ const triggerButton = globalPendo.dom(document.createElement('button'));
42949
43026
  triggerButton.attr('id', elemIds.feedbackTriggerButton);
42950
43027
  triggerButton.css(styles);
42951
43028
  triggerButton.text(settings.triggerText);
42952
43029
  return triggerButton;
42953
43030
  }
42954
43031
  function addTriggerPseudoStyles() {
42955
- 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 ";
43032
+ const pseudoStyles = `
43033
+ #feedback-trigger button:hover {
43034
+ box-shadow: 0 -5px 20px rgba(0,0,0,.19) !important;
43035
+ outline: none !important;
43036
+ background: #3e566f !important;
43037
+ }
43038
+ #feedback-trigger button:focus {
43039
+ box-shadow: 0 -5px 20px rgba(0,0,0,.19) !important;
43040
+ outline: none !important;
43041
+ background: #3e566f !important;
43042
+ }
43043
+ `;
42956
43044
  pluginApi.util.addInlineStyles('pendo-feedback-trigger-styles', pseudoStyles);
42957
43045
  }
42958
43046
  function createTrigger(settings, positionInfo) {
42959
43047
  addTriggerPseudoStyles();
42960
- var triggerElement = buildOuterTriggerDiv(positionInfo);
42961
- var notificationElement = buildNotification();
42962
- var triggerButtonElement = buildTriggerButton(settings, positionInfo);
43048
+ const triggerElement = buildOuterTriggerDiv(positionInfo);
43049
+ const notificationElement = buildNotification();
43050
+ const triggerButtonElement = buildTriggerButton(settings, positionInfo);
42963
43051
  triggerElement.append(notificationElement);
42964
43052
  triggerElement.append(triggerButtonElement);
42965
43053
  triggerElement.appendTo(globalPendo.dom.getBody());
@@ -42983,7 +43071,7 @@ function Feedback() {
42983
43071
  iframeWrapper.css(getWidgetOriginalStyles());
42984
43072
  iframeWrapper.attr('id', elemIds.feedbackWidget);
42985
43073
  iframeWrapper.attr('data-turbolinks-permanent', 'true');
42986
- iframeWrapper.addClass("buttonIs-".concat(horizontalPosition));
43074
+ iframeWrapper.addClass(`buttonIs-${horizontalPosition}`);
42987
43075
  return iframeWrapper;
42988
43076
  }
42989
43077
  function buildIframeContainer() {
@@ -43000,13 +43088,22 @@ function Feedback() {
43000
43088
  return iframeContainer;
43001
43089
  }
43002
43090
  function addWidgetVisibleButtonStyles(buttonStylePosition) {
43003
- var side = buttonStylePosition === 'left' ? 'left' : 'right'; // just in case something was not left or right for some reason
43004
- 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 ");
43091
+ let side = buttonStylePosition === 'left' ? 'left' : 'right'; // just in case something was not left or right for some reason
43092
+ const styles = `
43093
+ .buttonIs-${side}.visible {
43094
+ ${side}: 0 !important;
43095
+ width: 470px !important;
43096
+ animation-direction: alternate-reverse !important;
43097
+ animation: pendoFeedbackSlideFrom-${side} 0.5s 0s 1 alternate both !important;
43098
+ -webkit-animation: pendoFeedbackSlideFrom-${side} 0.5s 0s 1 alternate both !important;
43099
+ z-index: 9002 !important;
43100
+ }
43101
+ `;
43005
43102
  pluginApi.util.addInlineStyles(elemIds.feedbackFrameStyles, styles);
43006
43103
  }
43007
43104
  function initialiseWidgetFrame(horizontalPosition) {
43008
43105
  addWidgetVisibleButtonStyles(horizontalPosition);
43009
- var iframeElement = buildIframeWrapper(horizontalPosition);
43106
+ const iframeElement = buildIframeWrapper(horizontalPosition);
43010
43107
  iframeElement.append(buildIframeContainer());
43011
43108
  iframeElement.appendTo(globalPendo.dom.getBody());
43012
43109
  subscribeToIframeMessages();
@@ -43030,7 +43127,7 @@ function Feedback() {
43030
43127
  return widgetLoaded;
43031
43128
  }
43032
43129
  function getPendoOptions() {
43033
- var options = pluginApi.ConfigReader.getLocalConfig();
43130
+ let options = pluginApi.ConfigReader.getLocalConfig();
43034
43131
  if (!globalPendo._.isObject(options))
43035
43132
  options = {};
43036
43133
  if (!globalPendo._.isObject(options.visitor))
@@ -43058,7 +43155,7 @@ function Feedback() {
43058
43155
  return true;
43059
43156
  }
43060
43157
  function getQueryParam(url, paramName) {
43061
- var results = new RegExp('[?&]' + paramName + '=([^&#]*)').exec(url);
43158
+ const results = new RegExp('[?&]' + paramName + '=([^&#]*)').exec(url);
43062
43159
  if (results == null) {
43063
43160
  return null;
43064
43161
  }
@@ -43075,13 +43172,13 @@ function Feedback() {
43075
43172
  return pluginApi.q.reject();
43076
43173
  if (!canInitFeedback(pendoOptions))
43077
43174
  return pluginApi.q.reject();
43078
- var feedbackOptions = convertPendoToFeedbackOptions(pendoOptions);
43175
+ const feedbackOptions = convertPendoToFeedbackOptions(pendoOptions);
43079
43176
  try {
43080
- var fdbkDst_1 = getQueryParam(globalPendo.url.get(), 'fdbkDst');
43081
- if (fdbkDst_1 && fdbkDst_1.startsWith('case')) {
43177
+ const fdbkDst = getQueryParam(globalPendo.url.get(), 'fdbkDst');
43178
+ if (fdbkDst && fdbkDst.startsWith('case')) {
43082
43179
  initialized = true;
43083
43180
  getFeedbackLoginUrl().then(function (loginUrl) {
43084
- var destinationUrl = loginUrl + '&fdbkDst=' + fdbkDst_1;
43181
+ const destinationUrl = loginUrl + '&fdbkDst=' + fdbkDst;
43085
43182
  window.location.href = destinationUrl;
43086
43183
  });
43087
43184
  return;
@@ -43130,7 +43227,7 @@ function Feedback() {
43130
43227
  function convertPendoToFeedbackOptions(options) {
43131
43228
  var jwtOptions = pluginApi.agent.getJwtInfoCopy();
43132
43229
  if (globalPendo._.isEmpty(jwtOptions)) {
43133
- var feedbackOptions = {};
43230
+ const feedbackOptions = {};
43134
43231
  feedbackOptions.user = globalPendo._.pick(options.visitor, 'id', 'full_name', 'firstName', 'lastName', 'email', 'tags', 'custom_allowed_products');
43135
43232
  globalPendo._.extend(feedbackOptions.user, { allowed_products: [{ id: feedbackAllowedProductId }] });
43136
43233
  feedbackOptions.account = globalPendo._.pick(options.account, 'id', 'name', 'monthly_value', 'is_paying', 'tags');
@@ -43233,24 +43330,20 @@ var NodeType$3 = /* @__PURE__ */ ((NodeType2) => {
43233
43330
  NodeType2[NodeType2["Comment"] = 5] = "Comment";
43234
43331
  return NodeType2;
43235
43332
  })(NodeType$3 || {});
43236
- const testableAccessors$2 = {
43333
+ const testableAccessors$1 = {
43237
43334
  Node: ["childNodes", "parentNode", "parentElement", "textContent"],
43238
43335
  ShadowRoot: ["host", "styleSheets"],
43239
43336
  Element: ["shadowRoot"],
43240
- MutationObserver: [],
43241
- EventTarget: [],
43242
- Window: []
43337
+ MutationObserver: []
43243
43338
  };
43244
- const testableMethods$2 = {
43339
+ const testableMethods$1 = {
43245
43340
  Node: ["contains", "getRootNode"],
43246
43341
  ShadowRoot: ["getSelection"],
43247
43342
  Element: ["querySelector", "querySelectorAll"],
43248
- MutationObserver: ["constructor"],
43249
- EventTarget: ["addEventListener", "removeEventListener"],
43250
- Window: ["setTimeout"]
43343
+ MutationObserver: ["constructor"]
43251
43344
  };
43252
- const untaintedBasePrototype$2 = {};
43253
- function angularZoneUnpatchedAlternative$2(key) {
43345
+ const untaintedBasePrototype$1 = {};
43346
+ function angularZoneUnpatchedAlternative$1(key) {
43254
43347
  var _a2, _b;
43255
43348
  const angularUnpatchedVersionSymbol = (_b = (_a2 = globalThis == null ? void 0 : globalThis.Zone) == null ? void 0 : _a2.__symbol__) == null ? void 0 : _b.call(_a2, key);
43256
43349
  if (angularUnpatchedVersionSymbol && globalThis[angularUnpatchedVersionSymbol]) {
@@ -43259,12 +43352,12 @@ function angularZoneUnpatchedAlternative$2(key) {
43259
43352
  return void 0;
43260
43353
  }
43261
43354
  }
43262
- function getUntaintedPrototype$2(key) {
43263
- if (untaintedBasePrototype$2[key])
43264
- return untaintedBasePrototype$2[key];
43265
- const candidate = angularZoneUnpatchedAlternative$2(key) || globalThis[key];
43355
+ function getUntaintedPrototype$1(key) {
43356
+ if (untaintedBasePrototype$1[key])
43357
+ return untaintedBasePrototype$1[key];
43358
+ const candidate = angularZoneUnpatchedAlternative$1(key) || globalThis[key];
43266
43359
  const defaultPrototype = candidate.prototype;
43267
- const accessorNames = key in testableAccessors$2 ? testableAccessors$2[key] : void 0;
43360
+ const accessorNames = key in testableAccessors$1 ? testableAccessors$1[key] : void 0;
43268
43361
  const isUntaintedAccessors = Boolean(
43269
43362
  accessorNames && // @ts-expect-error 2345
43270
43363
  accessorNames.every(
@@ -43276,7 +43369,7 @@ function getUntaintedPrototype$2(key) {
43276
43369
  }
43277
43370
  )
43278
43371
  );
43279
- const methodNames = key in testableMethods$2 ? testableMethods$2[key] : void 0;
43372
+ const methodNames = key in testableMethods$1 ? testableMethods$1[key] : void 0;
43280
43373
  const isUntaintedMethods = Boolean(
43281
43374
  methodNames && methodNames.every(
43282
43375
  // @ts-expect-error 2345
@@ -43287,7 +43380,7 @@ function getUntaintedPrototype$2(key) {
43287
43380
  )
43288
43381
  );
43289
43382
  if (isUntaintedAccessors && isUntaintedMethods) {
43290
- untaintedBasePrototype$2[key] = candidate.prototype;
43383
+ untaintedBasePrototype$1[key] = candidate.prototype;
43291
43384
  return candidate.prototype;
43292
43385
  }
43293
43386
  try {
@@ -43298,7 +43391,7 @@ function getUntaintedPrototype$2(key) {
43298
43391
  const untaintedObject = win[key].prototype;
43299
43392
  document.body.removeChild(iframeEl);
43300
43393
  if (!untaintedObject) return defaultPrototype;
43301
- return untaintedBasePrototype$2[key] = untaintedObject;
43394
+ return untaintedBasePrototype$1[key] = untaintedObject;
43302
43395
  } catch {
43303
43396
  return defaultPrototype;
43304
43397
  }
@@ -43311,7 +43404,7 @@ function getUntaintedAccessor$1(key, instance, accessor) {
43311
43404
  return untaintedAccessorCache$1[cacheKey].call(
43312
43405
  instance
43313
43406
  );
43314
- const untaintedPrototype = getUntaintedPrototype$2(key);
43407
+ const untaintedPrototype = getUntaintedPrototype$1(key);
43315
43408
  const untaintedAccessor = (_a2 = Object.getOwnPropertyDescriptor(
43316
43409
  untaintedPrototype,
43317
43410
  accessor
@@ -43320,17 +43413,17 @@ function getUntaintedAccessor$1(key, instance, accessor) {
43320
43413
  untaintedAccessorCache$1[cacheKey] = untaintedAccessor;
43321
43414
  return untaintedAccessor.call(instance);
43322
43415
  }
43323
- const untaintedMethodCache$2 = {};
43324
- function getUntaintedMethod$2(key, instance, method) {
43416
+ const untaintedMethodCache$1 = {};
43417
+ function getUntaintedMethod$1(key, instance, method) {
43325
43418
  const cacheKey = `${key}.${String(method)}`;
43326
- if (untaintedMethodCache$2[cacheKey])
43327
- return untaintedMethodCache$2[cacheKey].bind(
43419
+ if (untaintedMethodCache$1[cacheKey])
43420
+ return untaintedMethodCache$1[cacheKey].bind(
43328
43421
  instance
43329
43422
  );
43330
- const untaintedPrototype = getUntaintedPrototype$2(key);
43423
+ const untaintedPrototype = getUntaintedPrototype$1(key);
43331
43424
  const untaintedMethod = untaintedPrototype[method];
43332
43425
  if (typeof untaintedMethod !== "function") return instance[method];
43333
- untaintedMethodCache$2[cacheKey] = untaintedMethod;
43426
+ untaintedMethodCache$1[cacheKey] = untaintedMethod;
43334
43427
  return untaintedMethod.bind(instance);
43335
43428
  }
43336
43429
  function childNodes$1(n2) {
@@ -43346,10 +43439,10 @@ function textContent$1(n2) {
43346
43439
  return getUntaintedAccessor$1("Node", n2, "textContent");
43347
43440
  }
43348
43441
  function contains$1(n2, other) {
43349
- return getUntaintedMethod$2("Node", n2, "contains")(other);
43442
+ return getUntaintedMethod$1("Node", n2, "contains")(other);
43350
43443
  }
43351
43444
  function getRootNode$1(n2) {
43352
- return getUntaintedMethod$2("Node", n2, "getRootNode")();
43445
+ return getUntaintedMethod$1("Node", n2, "getRootNode")();
43353
43446
  }
43354
43447
  function host$1(n2) {
43355
43448
  if (!n2 || !("host" in n2)) return null;
@@ -43363,13 +43456,13 @@ function shadowRoot$1(n2) {
43363
43456
  return getUntaintedAccessor$1("Element", n2, "shadowRoot");
43364
43457
  }
43365
43458
  function querySelector$1(n2, selectors) {
43366
- return getUntaintedMethod$2("Element", n2, "querySelector")(selectors);
43459
+ return getUntaintedMethod$1("Element", n2, "querySelector")(selectors);
43367
43460
  }
43368
43461
  function querySelectorAll$1(n2, selectors) {
43369
- return getUntaintedMethod$2("Element", n2, "querySelectorAll")(selectors);
43462
+ return getUntaintedMethod$1("Element", n2, "querySelectorAll")(selectors);
43370
43463
  }
43371
43464
  function mutationObserverCtor$1() {
43372
- return getUntaintedPrototype$2("MutationObserver").constructor;
43465
+ return getUntaintedPrototype$1("MutationObserver").constructor;
43373
43466
  }
43374
43467
  function patch$1(source, name, replacement) {
43375
43468
  try {
@@ -43428,7 +43521,19 @@ function isShadowRoot(n2) {
43428
43521
  function isNativeShadowDom(shadowRoot2) {
43429
43522
  return Object.prototype.toString.call(shadowRoot2) === "[object ShadowRoot]";
43430
43523
  }
43431
- const nativeSetTimeout = typeof window !== "undefined" ? getUntaintedMethod$2("Window", window, "setTimeout").bind(window) : global.setTimeout;
43524
+ function getNative$1(symbolName, windowObj = window) {
43525
+ var _a2, _b;
43526
+ const windowWithZone = windowObj;
43527
+ const angularZoneSymbol = (_b = (_a2 = windowWithZone == null ? void 0 : windowWithZone.Zone) == null ? void 0 : _a2.__symbol__) == null ? void 0 : _b.call(_a2, symbolName);
43528
+ if (angularZoneSymbol) {
43529
+ const zonelessImpl = windowWithZone[angularZoneSymbol];
43530
+ if (zonelessImpl) {
43531
+ return zonelessImpl;
43532
+ }
43533
+ }
43534
+ return windowWithZone[symbolName];
43535
+ }
43536
+ const nativeSetTimeout = typeof window !== "undefined" ? getNative$1("setTimeout").bind(window) : global.setTimeout;
43432
43537
  function fixBrowserCompatibilityIssuesInCSS(cssText) {
43433
43538
  if (cssText.includes(" background-clip: text;") && !cssText.includes(" -webkit-background-clip: text;")) {
43434
43539
  cssText = cssText.replace(
@@ -44752,90 +44857,19 @@ function snapshot(n2, options) {
44752
44857
  var __defProp2 = Object.defineProperty;
44753
44858
  var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
44754
44859
  var __publicField2 = (obj, key, value) => __defNormalProp2(obj, typeof key !== "symbol" ? key + "" : key, value);
44755
- const testableAccessors$1 = {
44756
- Node: ["childNodes", "parentNode", "parentElement", "textContent"],
44757
- ShadowRoot: ["host", "styleSheets"],
44758
- Element: ["shadowRoot"],
44759
- MutationObserver: [],
44760
- EventTarget: [],
44761
- Window: []
44762
- };
44763
- const testableMethods$1 = {
44764
- Node: ["contains", "getRootNode"],
44765
- ShadowRoot: ["getSelection"],
44766
- Element: ["querySelector", "querySelectorAll"],
44767
- MutationObserver: ["constructor"],
44768
- EventTarget: ["addEventListener", "removeEventListener"],
44769
- Window: ["setTimeout"]
44770
- };
44771
- const untaintedBasePrototype$1 = {};
44772
- function angularZoneUnpatchedAlternative$1(key) {
44860
+ function getNative(symbolName, windowObj = window) {
44773
44861
  var _a2, _b;
44774
- const angularUnpatchedVersionSymbol = (_b = (_a2 = globalThis == null ? void 0 : globalThis.Zone) == null ? void 0 : _a2.__symbol__) == null ? void 0 : _b.call(_a2, key);
44775
- if (angularUnpatchedVersionSymbol && globalThis[angularUnpatchedVersionSymbol]) {
44776
- return globalThis[angularUnpatchedVersionSymbol];
44777
- } else {
44778
- return void 0;
44779
- }
44780
- }
44781
- function getUntaintedPrototype$1(key) {
44782
- if (untaintedBasePrototype$1[key])
44783
- return untaintedBasePrototype$1[key];
44784
- const candidate = angularZoneUnpatchedAlternative$1(key) || globalThis[key];
44785
- const defaultPrototype = candidate.prototype;
44786
- const accessorNames = key in testableAccessors$1 ? testableAccessors$1[key] : void 0;
44787
- const isUntaintedAccessors = Boolean(
44788
- accessorNames && // @ts-expect-error 2345
44789
- accessorNames.every(
44790
- (accessor) => {
44791
- var _a2, _b;
44792
- return Boolean(
44793
- (_b = (_a2 = Object.getOwnPropertyDescriptor(defaultPrototype, accessor)) == null ? void 0 : _a2.get) == null ? void 0 : _b.toString().includes("[native code]")
44794
- );
44795
- }
44796
- )
44797
- );
44798
- const methodNames = key in testableMethods$1 ? testableMethods$1[key] : void 0;
44799
- const isUntaintedMethods = Boolean(
44800
- methodNames && methodNames.every(
44801
- // @ts-expect-error 2345
44802
- (method) => {
44803
- var _a2;
44804
- return typeof defaultPrototype[method] === "function" && ((_a2 = defaultPrototype[method]) == null ? void 0 : _a2.toString().includes("[native code]"));
44805
- }
44806
- )
44807
- );
44808
- if (isUntaintedAccessors && isUntaintedMethods) {
44809
- untaintedBasePrototype$1[key] = candidate.prototype;
44810
- return candidate.prototype;
44811
- }
44812
- try {
44813
- const iframeEl = document.createElement("iframe");
44814
- document.body.appendChild(iframeEl);
44815
- const win = iframeEl.contentWindow;
44816
- if (!win) return candidate.prototype;
44817
- const untaintedObject = win[key].prototype;
44818
- document.body.removeChild(iframeEl);
44819
- if (!untaintedObject) return defaultPrototype;
44820
- return untaintedBasePrototype$1[key] = untaintedObject;
44821
- } catch {
44822
- return defaultPrototype;
44862
+ const windowWithZone = windowObj;
44863
+ const angularZoneSymbol = (_b = (_a2 = windowWithZone == null ? void 0 : windowWithZone.Zone) == null ? void 0 : _a2.__symbol__) == null ? void 0 : _b.call(_a2, symbolName);
44864
+ if (angularZoneSymbol) {
44865
+ const zonelessImpl = windowWithZone[angularZoneSymbol];
44866
+ if (zonelessImpl) {
44867
+ return zonelessImpl;
44868
+ }
44823
44869
  }
44870
+ return windowWithZone[symbolName];
44824
44871
  }
44825
- const untaintedMethodCache$1 = {};
44826
- function getUntaintedMethod$1(key, instance, method) {
44827
- const cacheKey = `${key}.${String(method)}`;
44828
- if (untaintedMethodCache$1[cacheKey])
44829
- return untaintedMethodCache$1[cacheKey].bind(
44830
- instance
44831
- );
44832
- const untaintedPrototype = getUntaintedPrototype$1(key);
44833
- const untaintedMethod = untaintedPrototype[method];
44834
- if (typeof untaintedMethod !== "function") return instance[method];
44835
- untaintedMethodCache$1[cacheKey] = untaintedMethod;
44836
- return untaintedMethod.bind(instance);
44837
- }
44838
- typeof window !== "undefined" ? getUntaintedMethod$1("Window", window, "setTimeout").bind(window) : global.setTimeout;
44872
+ typeof window !== "undefined" ? getNative("setTimeout").bind(window) : global.setTimeout;
44839
44873
  class BaseRRNode {
44840
44874
  // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-explicit-any
44841
44875
  constructor(..._args) {
@@ -44897,17 +44931,13 @@ const testableAccessors = {
44897
44931
  Node: ["childNodes", "parentNode", "parentElement", "textContent"],
44898
44932
  ShadowRoot: ["host", "styleSheets"],
44899
44933
  Element: ["shadowRoot"],
44900
- MutationObserver: [],
44901
- EventTarget: [],
44902
- Window: []
44934
+ MutationObserver: []
44903
44935
  };
44904
44936
  const testableMethods = {
44905
44937
  Node: ["contains", "getRootNode"],
44906
44938
  ShadowRoot: ["getSelection"],
44907
44939
  Element: ["querySelector", "querySelectorAll"],
44908
- MutationObserver: ["constructor"],
44909
- EventTarget: ["addEventListener", "removeEventListener"],
44910
- Window: ["setTimeout"]
44940
+ MutationObserver: ["constructor"]
44911
44941
  };
44912
44942
  const untaintedBasePrototype = {};
44913
44943
  function angularZoneUnpatchedAlternative(key) {
@@ -45088,11 +45118,20 @@ const index = {
45088
45118
  mutationObserver: mutationObserverCtor,
45089
45119
  patch
45090
45120
  };
45121
+ function getWindow(documentOrWindow) {
45122
+ const defaultView = documentOrWindow.defaultView;
45123
+ return defaultView ? defaultView : documentOrWindow;
45124
+ }
45091
45125
  function on(type, fn, target = document) {
45126
+ const windowObj = getWindow(target);
45127
+ const nativeAddEventListener = getNative$1(
45128
+ "addEventListener",
45129
+ windowObj
45130
+ );
45131
+ const nativeRemoveEventListener = getNative$1("removeEventListener", windowObj);
45092
45132
  const options = { capture: true, passive: true };
45093
- const eventTarget = target;
45094
- getUntaintedMethod("EventTarget", eventTarget, "addEventListener")(type, fn, options);
45095
- return () => getUntaintedMethod("EventTarget", eventTarget, "removeEventListener")(type, fn, options);
45133
+ nativeAddEventListener.call(target, type, fn, options);
45134
+ return () => nativeRemoveEventListener.call(target, type, fn, options);
45096
45135
  }
45097
45136
  const DEPARTED_MIRROR_ACCESS_WARNING = "Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";
45098
45137
  let _mirror = {
@@ -48675,32 +48714,31 @@ var n;
48675
48714
  }(n || (n = {}));
48676
48715
  return record; }
48677
48716
 
48678
- var SessionRecorderBuffer = /** @class */ (function () {
48679
- function SessionRecorderBuffer(interval, maxCount) {
48680
- if (maxCount === void 0) { maxCount = Infinity; }
48717
+ class SessionRecorderBuffer {
48718
+ constructor(interval, maxCount = Infinity) {
48681
48719
  this.data = [];
48682
48720
  this.sequenceNumber = 0;
48683
48721
  this.interval = interval;
48684
48722
  this.maxCount = maxCount;
48685
48723
  this.doubledMaxCount = maxCount * 2;
48686
48724
  }
48687
- SessionRecorderBuffer.prototype.isEmpty = function () {
48725
+ isEmpty() {
48688
48726
  return this.data.length === 0;
48689
- };
48690
- SessionRecorderBuffer.prototype.count = function () {
48727
+ }
48728
+ count() {
48691
48729
  return this.data.length;
48692
- };
48693
- SessionRecorderBuffer.prototype.clear = function () {
48730
+ }
48731
+ clear() {
48694
48732
  this.data.length = 0;
48695
- };
48696
- SessionRecorderBuffer.prototype.clearSequence = function () {
48733
+ }
48734
+ clearSequence() {
48697
48735
  this.sequenceNumber = 0;
48698
- };
48699
- SessionRecorderBuffer.prototype.push = function (event) {
48736
+ }
48737
+ push(event) {
48700
48738
  this.data.push(event);
48701
48739
  this.checkRateLimit();
48702
- };
48703
- SessionRecorderBuffer.prototype.pack = function (envelope, _) {
48740
+ }
48741
+ pack(envelope, _) {
48704
48742
  var eventsToSend = this.data.splice(0, this.maxCount);
48705
48743
  envelope.recordingPayload = eventsToSend;
48706
48744
  envelope.sequence = this.sequenceNumber;
@@ -48708,8 +48746,8 @@ var SessionRecorderBuffer = /** @class */ (function () {
48708
48746
  if (eventsToSend.length) {
48709
48747
  envelope.browserTime = eventsToSend[0].timestamp;
48710
48748
  }
48711
- envelope.recordingPayloadMetadata = _.map(eventsToSend, function (event) {
48712
- var metadata = _.pick(event, 'type', 'timestamp');
48749
+ envelope.recordingPayloadMetadata = _.map(eventsToSend, event => {
48750
+ const metadata = _.pick(event, 'type', 'timestamp');
48713
48751
  if (event.data) {
48714
48752
  metadata.data = _.pick(event.data, 'source', 'type', 'x', 'y', 'id', 'height', 'width', 'href');
48715
48753
  }
@@ -48717,30 +48755,18 @@ var SessionRecorderBuffer = /** @class */ (function () {
48717
48755
  });
48718
48756
  this.sequenceNumber += eventsToSend.length;
48719
48757
  return envelope;
48720
- };
48721
- SessionRecorderBuffer.prototype.checkRateLimit = function () {
48722
- var length = this.data.length;
48758
+ }
48759
+ checkRateLimit() {
48760
+ const length = this.data.length;
48723
48761
  if (length >= this.doubledMaxCount && length % this.maxCount === 0) {
48724
- var elapsed = this.data[length - 1].timestamp - this.data[length - this.doubledMaxCount].timestamp;
48762
+ const elapsed = this.data[length - 1].timestamp - this.data[length - this.doubledMaxCount].timestamp;
48725
48763
  if (elapsed <= this.interval && this.onRateLimit) {
48726
48764
  this.onRateLimit();
48727
48765
  }
48728
48766
  }
48729
- };
48730
- return SessionRecorderBuffer;
48731
- }());
48767
+ }
48768
+ }
48732
48769
 
48733
- var __assign = function() {
48734
- __assign = Object.assign || function __assign(t) {
48735
- for (var s, i = 1, n = arguments.length; i < n; i++) {
48736
- s = arguments[i];
48737
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
48738
- }
48739
- return t;
48740
- };
48741
- return __assign.apply(this, arguments);
48742
- };
48743
-
48744
48770
  function __rest(s, e) {
48745
48771
  var t = {};
48746
48772
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -48763,52 +48789,24 @@ function __awaiter(thisArg, _arguments, P, generator) {
48763
48789
  });
48764
48790
  }
48765
48791
 
48766
- function __generator(thisArg, body) {
48767
- 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);
48768
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
48769
- function verb(n) { return function (v) { return step([n, v]); }; }
48770
- function step(op) {
48771
- if (f) throw new TypeError("Generator is already executing.");
48772
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
48773
- 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;
48774
- if (y = 0, t) op = [op[0] & 2, t.value];
48775
- switch (op[0]) {
48776
- case 0: case 1: t = op; break;
48777
- case 4: _.label++; return { value: op[1], done: false };
48778
- case 5: _.label++; y = op[1]; op = [0]; continue;
48779
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
48780
- default:
48781
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
48782
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
48783
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
48784
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
48785
- if (t[2]) _.ops.pop();
48786
- _.trys.pop(); continue;
48787
- }
48788
- op = body.call(thisArg, _);
48789
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
48790
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
48791
- }
48792
- }
48793
-
48794
48792
  typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
48795
48793
  var e = new Error(message);
48796
48794
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
48797
48795
  };
48798
48796
 
48799
- var RECORDING_CONFIG_WORKERURL$1 = 'recording.workerUrl';
48800
- var MAX_SIZE = 2000000;
48801
- var RESOURCE_CACHING$1 = 'resourceCaching';
48802
- var Transport = /** @class */ (function () {
48803
- function Transport(WorkerClass, pendo, api) {
48797
+ const RECORDING_CONFIG_WORKERURL$1 = 'recording.workerUrl';
48798
+ const MAX_SIZE = 2000000;
48799
+ const RESOURCE_CACHING$1 = 'resourceCaching';
48800
+ class Transport {
48801
+ constructor(WorkerClass, pendo, api) {
48804
48802
  this.WorkerClass = WorkerClass;
48805
48803
  this.pendo = pendo;
48806
48804
  this.api = api;
48807
48805
  this.maxSize = MAX_SIZE;
48808
- this.lockID = "worker-lock-".concat(this.pendo.randomString(16));
48806
+ this.lockID = `worker-lock-${this.pendo.randomString(16)}`;
48809
48807
  this.isResourceCachingEnabled = this.api.ConfigReader.get(RESOURCE_CACHING$1);
48810
48808
  }
48811
- Transport.prototype.start = function (config) {
48809
+ start(config) {
48812
48810
  if (config.disableWorker)
48813
48811
  return;
48814
48812
  if (!this.worker) {
@@ -48818,7 +48816,7 @@ var Transport = /** @class */ (function () {
48818
48816
  this.worker = config.workerOverride;
48819
48817
  }
48820
48818
  else {
48821
- var workerUrl = this.api.ConfigReader.get(RECORDING_CONFIG_WORKERURL$1);
48819
+ const workerUrl = this.api.ConfigReader.get(RECORDING_CONFIG_WORKERURL$1);
48822
48820
  this.usesSelfHostedWorker = workerUrl != null;
48823
48821
  this.worker = workerUrl ? new Worker(workerUrl) : new this.WorkerClass();
48824
48822
  }
@@ -48832,35 +48830,34 @@ var Transport = /** @class */ (function () {
48832
48830
  this.worker = null;
48833
48831
  }
48834
48832
  }
48835
- };
48836
- Transport.prototype.stop = function () {
48833
+ }
48834
+ stop() {
48837
48835
  if (this.worker) {
48838
48836
  this.worker.terminate();
48839
48837
  delete this.worker;
48840
48838
  }
48841
- };
48842
- Transport.prototype.send = function (envelope, isUnload, failureCount) {
48843
- if (failureCount === void 0) { failureCount = 0; }
48844
- var url = envelope.url;
48845
- var payload = envelope.payload;
48839
+ }
48840
+ send(envelope, isUnload, failureCount = 0) {
48841
+ let { url } = envelope;
48842
+ const { payload } = envelope;
48846
48843
  if (failureCount > 0) {
48847
- url = "".concat(url, "&rt=").concat(failureCount);
48844
+ url = `${url}&rt=${failureCount}`;
48848
48845
  }
48849
48846
  if (this.worker && !isUnload && payload) {
48850
- var deferred_1 = {};
48851
- deferred_1.promise = new Promise$2(function (resolve, reject) {
48852
- deferred_1.resolve = resolve;
48853
- deferred_1.reject = reject;
48847
+ const deferred = {};
48848
+ deferred.promise = new Promise$2((resolve, reject) => {
48849
+ deferred.resolve = resolve;
48850
+ deferred.reject = reject;
48854
48851
  });
48855
- this.workerResponse = deferred_1;
48856
- this.worker.postMessage({ url: url, payload: payload, shouldCacheResources: this.isResourceCachingEnabled });
48857
- return deferred_1.promise;
48852
+ this.workerResponse = deferred;
48853
+ this.worker.postMessage({ url, payload, shouldCacheResources: this.isResourceCachingEnabled });
48854
+ return deferred.promise;
48858
48855
  }
48859
48856
  else {
48860
48857
  if (!envelope.body) {
48861
- var strPayload = JSON.stringify(payload);
48858
+ const strPayload = JSON.stringify(payload);
48862
48859
  if (strPayload.length > this.maxSize) {
48863
- var error = new Error('maximum recording payload size exceeded');
48860
+ const error = new Error('maximum recording payload size exceeded');
48864
48861
  error.reason = 'HEAVY_EVENT';
48865
48862
  error.context = {
48866
48863
  size: strPayload.length,
@@ -48871,14 +48868,14 @@ var Transport = /** @class */ (function () {
48871
48868
  envelope.body = this.pendo.compress(strPayload, 'binary');
48872
48869
  delete envelope.payload;
48873
48870
  }
48874
- url = "".concat(url, "&ct=").concat(new Date().getTime());
48871
+ url = `${url}&ct=${new Date().getTime()}`;
48875
48872
  return this.post(url, {
48876
48873
  keepalive: isUnload,
48877
48874
  body: envelope.body
48878
48875
  });
48879
48876
  }
48880
- };
48881
- Transport.prototype.post = function (url, options) {
48877
+ }
48878
+ post(url, options) {
48882
48879
  options.method = 'POST';
48883
48880
  if (options.keepalive && this.api.transmit.fetchKeepalive.supported()) {
48884
48881
  return this.api.transmit.fetchKeepalive(url, options);
@@ -48890,53 +48887,42 @@ var Transport = /** @class */ (function () {
48890
48887
  else {
48891
48888
  return this.pendo.ajax.post(url, options.body);
48892
48889
  }
48893
- };
48894
- Transport.prototype._onMessage = function (messageEvent) {
48895
- return __awaiter(this, void 0, void 0, function () {
48896
- return __generator(this, function (_a) {
48897
- switch (_a.label) {
48898
- case 0:
48899
- if (!(messageEvent.data && messageEvent.data.ready)) return [3 /*break*/, 2];
48900
- // When the lock is released, we can assume the worker was terminated or closed
48901
- return [4 /*yield*/, navigator.locks.request(this.lockID, function () { })];
48902
- case 1:
48903
- // When the lock is released, we can assume the worker was terminated or closed
48904
- _a.sent();
48905
- this.onWorkerMessage({ type: 'workerDied' });
48906
- _a.label = 2;
48907
- case 2:
48908
- // handle non-POST request responses from worker
48909
- if (messageEvent.data && messageEvent.data.type) {
48910
- this.onWorkerMessage(messageEvent.data);
48911
- return [2 /*return*/];
48912
- }
48913
- // handle POST request response from worker
48914
- if (messageEvent.data && messageEvent.data.error) {
48915
- if ((messageEvent.data.status && messageEvent.data.status < 500) ||
48916
- messageEvent.data.sequence == null) {
48917
- this.api.log.critical('Failed to send recording data from web worker', { error: messageEvent.data.error });
48918
- }
48919
- if (this.workerResponse) {
48920
- this.workerResponse.reject();
48921
- this.workerResponse = null;
48922
- }
48923
- }
48924
- if (this.workerResponse) {
48925
- this.workerResponse.resolve();
48926
- this.workerResponse = null;
48927
- }
48928
- return [2 /*return*/];
48890
+ }
48891
+ _onMessage(messageEvent) {
48892
+ return __awaiter(this, void 0, void 0, function* () {
48893
+ if (messageEvent.data && messageEvent.data.ready) {
48894
+ // When the lock is released, we can assume the worker was terminated or closed
48895
+ yield navigator.locks.request(this.lockID, () => { });
48896
+ this.onWorkerMessage({ type: 'workerDied' });
48897
+ }
48898
+ // handle non-POST request responses from worker
48899
+ if (messageEvent.data && messageEvent.data.type) {
48900
+ this.onWorkerMessage(messageEvent.data);
48901
+ return;
48902
+ }
48903
+ // handle POST request response from worker
48904
+ if (messageEvent.data && messageEvent.data.error) {
48905
+ if ((messageEvent.data.status && messageEvent.data.status < 500) ||
48906
+ messageEvent.data.sequence == null) {
48907
+ this.api.log.critical('Failed to send recording data from web worker', { error: messageEvent.data.error });
48929
48908
  }
48930
- });
48909
+ if (this.workerResponse) {
48910
+ this.workerResponse.reject();
48911
+ this.workerResponse = null;
48912
+ }
48913
+ }
48914
+ if (this.workerResponse) {
48915
+ this.workerResponse.resolve();
48916
+ this.workerResponse = null;
48917
+ }
48931
48918
  });
48932
- };
48933
- Transport.prototype._onError = function () {
48919
+ }
48920
+ _onError() {
48934
48921
  if (this.onError) {
48935
48922
  this.onError();
48936
48923
  }
48937
- };
48938
- return Transport;
48939
- }());
48924
+ }
48925
+ }
48940
48926
 
48941
48927
  function isElementShadowRoot(elem, _win) {
48942
48928
  if (!_win) {
@@ -48948,9 +48934,9 @@ function getParent(elem, _win) {
48948
48934
  return isElementShadowRoot(elem, _win) ? elem.host : elem.parentNode;
48949
48935
  }
48950
48936
 
48951
- var ELEMENT_NODE = 1;
48952
- var INPUT_MASK = '*'.repeat(10);
48953
- var NUMBER_INPUT_MASK = '0'.repeat(10);
48937
+ const ELEMENT_NODE = 1;
48938
+ const INPUT_MASK = '*'.repeat(10);
48939
+ const NUMBER_INPUT_MASK = '0'.repeat(10);
48954
48940
  function isElementNode(node) {
48955
48941
  if (!node)
48956
48942
  return false;
@@ -48958,9 +48944,7 @@ function isElementNode(node) {
48958
48944
  return false;
48959
48945
  return true;
48960
48946
  }
48961
- function distanceToMatch(node, selector, limit, distance) {
48962
- if (limit === void 0) { limit = Infinity; }
48963
- if (distance === void 0) { distance = 0; }
48947
+ function distanceToMatch(node, selector, limit = Infinity, distance = 0) {
48964
48948
  if (distance > limit)
48965
48949
  return -1;
48966
48950
  if (!node)
@@ -48974,13 +48958,13 @@ function distanceToMatch(node, selector, limit, distance) {
48974
48958
  return distanceToMatch(getParent(node), selector, limit, distance + 1);
48975
48959
  }
48976
48960
  function shouldMask(node, options) {
48977
- var maskAllText = options.maskAllText, maskTextSelector = options.maskTextSelector, unmaskTextSelector = options.unmaskTextSelector;
48961
+ const { maskAllText, maskTextSelector, unmaskTextSelector } = options;
48978
48962
  try {
48979
- var el = isElementNode(node) ? node : node.parentElement;
48963
+ const el = isElementNode(node) ? node : node.parentElement;
48980
48964
  if (el === null)
48981
48965
  return false;
48982
- var maskDistance = -1;
48983
- var unmaskDistance = -1;
48966
+ let maskDistance = -1;
48967
+ let unmaskDistance = -1;
48984
48968
  if (maskAllText) {
48985
48969
  unmaskDistance = distanceToMatch(el, unmaskTextSelector);
48986
48970
  if (unmaskDistance < 0) {
@@ -49013,8 +48997,8 @@ function isNumberInput(element) {
49013
48997
  }
49014
48998
  function shouldMaskInput(element, maskInputOptions) {
49015
48999
  if (maskInputOptions && isElementNode(element)) {
49016
- var tagName = (element.tagName || '').toLowerCase();
49017
- var type = (element.type || '').toLowerCase();
49000
+ const tagName = (element.tagName || '').toLowerCase();
49001
+ const type = (element.type || '').toLowerCase();
49018
49002
  if (maskInputOptions[tagName] || maskInputOptions[type]) {
49019
49003
  return true;
49020
49004
  }
@@ -50501,12 +50485,12 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
50501
50485
  }
50502
50486
  }
50503
50487
 
50504
- var ONE_HUNDRED_MB_IN_BYTES = 100 * 1024 * 1024;
50488
+ const ONE_HUNDRED_MB_IN_BYTES = 100 * 1024 * 1024;
50505
50489
  function matchHostedResources(recordingEvent, stringifiedRecordingPayload) {
50506
- var fontURLRegex = /https:\/\/[^"\\\s]+?\.(woff2?|ttf|otf|eot)(\?[^"\\\s]*)?\b/g;
50507
- var matches = stringifiedRecordingPayload.match(fontURLRegex);
50490
+ const fontURLRegex = /https:\/\/[^"\\\s]+?\.(woff2?|ttf|otf|eot)(\?[^"\\\s]*)?\b/g;
50491
+ const matches = stringifiedRecordingPayload.match(fontURLRegex);
50508
50492
  // de-duplicate matches
50509
- var hostedResources = matches ? Array.from(new Set(matches)) : [];
50493
+ const hostedResources = matches ? Array.from(new Set(matches)) : [];
50510
50494
  return {
50511
50495
  type: 'recording',
50512
50496
  visitorId: recordingEvent.visitorId,
@@ -50521,75 +50505,75 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
50521
50505
  recordingPayloadMetadata: [],
50522
50506
  sequence: 0,
50523
50507
  recordingPayloadCount: 0,
50524
- hostedResources: hostedResources
50508
+ hostedResources
50525
50509
  };
50526
50510
  }
50527
50511
  // keep in mind changes here may need addressing in the extension worker proxy as well
50528
50512
  self.onmessage = function (e) {
50529
50513
  try {
50530
50514
  if (e.data.type === 'init' && e.data.lockID) {
50531
- navigator.locks.request(e.data.lockID, function () {
50515
+ navigator.locks.request(e.data.lockID, () => {
50532
50516
  postMessage({ ready: true });
50533
50517
  // This unresolved promise keeps the lock held with the worker until the worker is
50534
50518
  // terminated at which point the lock is released.
50535
- return new Promise$2(function () { });
50519
+ return new Promise$2(() => { });
50536
50520
  });
50537
50521
  return;
50538
50522
  }
50539
50523
  if (e.data.url && e.data.payload) {
50540
- var _a = e.data, url = _a.url, payload = _a.payload, shouldCacheResources = _a.shouldCacheResources;
50524
+ let { url, payload, shouldCacheResources } = e.data;
50541
50525
  if (Object.keys(payload).length === 0) {
50542
50526
  postMessage({
50543
50527
  type: 'emptyPayload'
50544
50528
  });
50545
50529
  }
50546
- var sequence_1 = payload.sequence;
50547
- var stringifiedRecordingPayload = JSON.stringify(payload.recordingPayload);
50530
+ const { sequence } = payload;
50531
+ const stringifiedRecordingPayload = JSON.stringify(payload.recordingPayload);
50548
50532
  // calculate and post back the recording payload size before the payload is compressed
50549
- var recordingPayloadSize = new TextEncoder().encode(stringifiedRecordingPayload).length;
50550
- var exceedsPayloadSizeLimit = recordingPayloadSize >= ONE_HUNDRED_MB_IN_BYTES;
50533
+ const recordingPayloadSize = new TextEncoder().encode(stringifiedRecordingPayload).length;
50534
+ const exceedsPayloadSizeLimit = recordingPayloadSize >= ONE_HUNDRED_MB_IN_BYTES;
50551
50535
  postMessage({
50552
50536
  type: 'recordingPayloadSize',
50553
- recordingPayloadSize: recordingPayloadSize,
50554
- exceedsPayloadSizeLimit: exceedsPayloadSizeLimit
50537
+ recordingPayloadSize,
50538
+ exceedsPayloadSizeLimit
50555
50539
  });
50556
50540
  // don't attempt to send the payload if it exceeds the allowed limit
50557
50541
  if (exceedsPayloadSizeLimit)
50558
50542
  return;
50559
50543
  if (shouldCacheResources) {
50560
- var hostedResourcesEvent = matchHostedResources(payload, stringifiedRecordingPayload);
50544
+ const hostedResourcesEvent = matchHostedResources(payload, stringifiedRecordingPayload);
50561
50545
  if (hostedResourcesEvent.hostedResources.length) {
50562
50546
  postMessage({
50563
50547
  type: 'hostedResources',
50564
- hostedResourcesEvent: hostedResourcesEvent
50548
+ hostedResourcesEvent
50565
50549
  });
50566
50550
  }
50567
50551
  }
50568
50552
  payload.recordingSize = recordingPayloadSize;
50569
- var body = compress(payload, 'binary');
50553
+ const body = compress(payload, 'binary');
50570
50554
  // we want to calculate ct (current time) as close as we can to the actual POST request
50571
50555
  // so that it's as accurate as possible
50572
- url = "".concat(url, "&ct=").concat(new Date().getTime());
50556
+ url = `${url}&ct=${new Date().getTime()}`;
50573
50557
  fetch(url, {
50574
50558
  method: 'POST',
50575
- body: body
50559
+ body
50576
50560
  }).then(function (response) {
50577
50561
  if (response.status < 200 || response.status >= 300) {
50578
50562
  postMessage({
50579
- error: new Error("received status code ".concat(response.status, ": ").concat(response.statusText)),
50563
+ error: new Error(`received status code ${response.status}: ${response.statusText}`),
50580
50564
  status: response.status,
50581
- sequence: sequence_1
50565
+ sequence
50582
50566
  });
50583
50567
  }
50584
50568
  else {
50585
50569
  postMessage({
50586
- sequence: sequence_1
50570
+ sequence
50587
50571
  });
50588
50572
  }
50589
- })["catch"](function (e) {
50573
+ }).catch(function (e) {
50590
50574
  postMessage({
50591
50575
  error: e,
50592
- sequence: sequence_1
50576
+ sequence
50593
50577
  });
50594
50578
  });
50595
50579
  }
@@ -50624,12 +50608,12 @@ function createReplayPlugin() {
50624
50608
  * limit of number of keys in an object
50625
50609
  * if an object contains more keys than this limit, we would call its toString function directly
50626
50610
  */
50627
- var NUM_OF_KEYS_LIMIT = 50;
50611
+ const NUM_OF_KEYS_LIMIT = 50;
50628
50612
  /**
50629
50613
  * limit number of depth in an object
50630
50614
  * if an object is too deep, toString process may cause browser OOM
50631
50615
  */
50632
- var DEPTH_OF_LIMIT = 4;
50616
+ const DEPTH_OF_LIMIT = 4;
50633
50617
  /**
50634
50618
  * serialize an HTML element by creating a shallow clone of it with text content
50635
50619
  * and return the resulting outerHTML string (without the subtree)
@@ -50640,8 +50624,8 @@ function serializeHTML(node) {
50640
50624
  if (!node || node.nodeType !== node.ELEMENT_NODE) {
50641
50625
  return '';
50642
50626
  }
50643
- var nodeClone = node.cloneNode(false);
50644
- var textContent = node.textContent;
50627
+ const nodeClone = node.cloneNode(false);
50628
+ const { textContent } = node;
50645
50629
  if (textContent) {
50646
50630
  nodeClone.textContent = textContent;
50647
50631
  }
@@ -50655,7 +50639,7 @@ function isObject(obj) {
50655
50639
  return false;
50656
50640
  if (typeof obj !== 'object')
50657
50641
  return false;
50658
- var proto = Object.getPrototypeOf(obj);
50642
+ const proto = Object.getPrototypeOf(obj);
50659
50643
  return proto === Object.prototype || proto === null;
50660
50644
  }
50661
50645
  /**
@@ -50664,11 +50648,11 @@ function isObject(obj) {
50664
50648
  function isObjTooDeep(obj, limit) {
50665
50649
  if (limit === 0)
50666
50650
  return true;
50667
- var keys = Object.keys(obj);
50651
+ const keys = Object.keys(obj);
50668
50652
  if (keys.length === 0)
50669
50653
  return false;
50670
- return keys.some(function (key) {
50671
- var value = obj[key];
50654
+ return keys.some(key => {
50655
+ const value = obj[key];
50672
50656
  return isObject(value) && isObjTooDeep(value, limit - 1);
50673
50657
  });
50674
50658
  }
@@ -50684,7 +50668,7 @@ function shouldIgnore(_obj) {
50684
50668
  return false;
50685
50669
  }
50686
50670
  // out of keys limit
50687
- var keys = Object.keys(_obj);
50671
+ const keys = Object.keys(_obj);
50688
50672
  if (keys.length > NUM_OF_KEYS_LIMIT) {
50689
50673
  return true;
50690
50674
  }
@@ -50716,7 +50700,7 @@ function stringify(arg) {
50716
50700
  return value.toString ? value.toString() : '[object Object]';
50717
50701
  }
50718
50702
  if (value instanceof ArrayBuffer)
50719
- return "ArrayBuffer { byteLength: ".concat(value.byteLength, " }");
50703
+ return `ArrayBuffer { byteLength: ${value.byteLength} }`;
50720
50704
  if (value instanceof Error)
50721
50705
  return value.name + ': ' + value.message;
50722
50706
  if (value instanceof Node) {
@@ -50724,10 +50708,10 @@ function stringify(arg) {
50724
50708
  }
50725
50709
  // Handle events
50726
50710
  if (value instanceof Event) {
50727
- var eventResult = {};
50711
+ const eventResult = {};
50728
50712
  // eslint-disable-next-line guard-for-in
50729
- for (var eventKey in value) {
50730
- var eventValue = value[eventKey];
50713
+ for (const eventKey in value) {
50714
+ const eventValue = value[eventKey];
50731
50715
  eventResult[eventKey] = Array.isArray(eventValue) && eventValue[0] instanceof HTMLElement
50732
50716
  ? serializeHTML(eventValue[0])
50733
50717
  : eventValue;
@@ -50738,31 +50722,30 @@ function stringify(arg) {
50738
50722
  });
50739
50723
  }
50740
50724
 
50741
- var StackFrame = /** @class */ (function () {
50742
- function StackFrame(obj) {
50725
+ class StackFrame {
50726
+ constructor(obj) {
50743
50727
  this.fileName = obj.fileName || '';
50744
50728
  this.functionName = obj.functionName || '';
50745
50729
  this.lineNumber = obj.lineNumber;
50746
50730
  this.columnNumber = obj.columnNumber;
50747
50731
  }
50748
- StackFrame.prototype.toString = function () {
50749
- 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;
50732
+ toString() {
50733
+ const { fileName, functionName, lineNumber = '', columnNumber = '' } = this;
50750
50734
  return functionName
50751
- ? "".concat(functionName, " (").concat(fileName, ":").concat(lineNumber, ":").concat(columnNumber, ")")
50752
- : "".concat(fileName, ":").concat(lineNumber, ":").concat(columnNumber);
50753
- };
50754
- return StackFrame;
50755
- }());
50756
- var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
50757
- var CHROME_EDGE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
50758
- var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/;
50759
- var LOCATION_REGEXP = /(.+?)(?::(\d+))?(?::(\d+))?$/;
50760
- var DEFAULT_NUM_FRAMES_TO_SKIP = 5;
50761
- var ErrorStackParser = {
50735
+ ? `${functionName} (${fileName}:${lineNumber}:${columnNumber})`
50736
+ : `${fileName}:${lineNumber}:${columnNumber}`;
50737
+ }
50738
+ }
50739
+ const FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
50740
+ const CHROME_EDGE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
50741
+ const SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/;
50742
+ const LOCATION_REGEXP = /(.+?)(?::(\d+))?(?::(\d+))?$/;
50743
+ const DEFAULT_NUM_FRAMES_TO_SKIP = 5;
50744
+ const ErrorStackParser = {
50762
50745
  /**
50763
50746
  * Given an Error object, extract the most information from it.
50764
50747
  */
50765
- parse: function (error, maxFramesToSave) {
50748
+ parse(error, maxFramesToSave) {
50766
50749
  if (!(error === null || error === void 0 ? void 0 : error.stack))
50767
50750
  return [];
50768
50751
  // Chrome, Edge, Opera ≥15
@@ -50776,25 +50759,24 @@ var ErrorStackParser = {
50776
50759
  return [];
50777
50760
  },
50778
50761
  // Separate line and column numbers from a string of the form: (URI:Line:Column)
50779
- extractLocation: function (urlLike) {
50762
+ extractLocation(urlLike) {
50780
50763
  // Fail-fast but return locations like "(native)"
50781
50764
  if (urlLike.indexOf(':') === -1) {
50782
50765
  return [urlLike];
50783
50766
  }
50784
- var parts = LOCATION_REGEXP.exec(urlLike.replace(/[()]/g, ''));
50767
+ const parts = LOCATION_REGEXP.exec(urlLike.replace(/[()]/g, ''));
50785
50768
  if (!parts)
50786
- throw new Error("Cannot parse given url: ".concat(urlLike));
50769
+ throw new Error(`Cannot parse given url: ${urlLike}`);
50787
50770
  return [parts[1], parts[2] || undefined, parts[3] || undefined];
50788
50771
  },
50789
- parseHelper: function (_a, error, maxFramesToSave, callback) {
50790
- var regex = _a.regex, includeMatchedLine = _a.includeMatchedLine;
50791
- var lines = error.stack.split('\n');
50792
- var frames = [];
50793
- var validFramesFound = 0;
50794
- for (var i = 0; i < lines.length; i++) {
50795
- var line = lines[i];
50796
- var lineMatchesRegex = regex.test(line);
50797
- var shouldSkipLine = (includeMatchedLine && !lineMatchesRegex) || // if line doesn't match regex and we want matched lines, skip it
50772
+ parseHelper({ regex, includeMatchedLine }, error, maxFramesToSave, callback) {
50773
+ const lines = error.stack.split('\n');
50774
+ const frames = [];
50775
+ let validFramesFound = 0;
50776
+ for (let i = 0; i < lines.length; i++) {
50777
+ const line = lines[i];
50778
+ const lineMatchesRegex = regex.test(line);
50779
+ const shouldSkipLine = (includeMatchedLine && !lineMatchesRegex) || // if line doesn't match regex and we want matched lines, skip it
50798
50780
  (!includeMatchedLine && lineMatchesRegex); // if line does match regex but we don't want matched lines, skip it
50799
50781
  if (shouldSkipLine)
50800
50782
  continue;
@@ -50809,12 +50791,11 @@ var ErrorStackParser = {
50809
50791
  }
50810
50792
  return frames;
50811
50793
  },
50812
- parseChromiumStack: function (error, maxFramesToSave) {
50813
- var _this = this;
50814
- return this.parseHelper({ regex: CHROME_EDGE_STACK_REGEXP, includeMatchedLine: true }, error, maxFramesToSave, function (line, frames) {
50815
- var sanitizedLine;
50794
+ parseChromiumStack(error, maxFramesToSave) {
50795
+ return this.parseHelper({ regex: CHROME_EDGE_STACK_REGEXP, includeMatchedLine: true }, error, maxFramesToSave, (line, frames) => {
50796
+ let sanitizedLine;
50816
50797
  if (line.indexOf('(eval ') > -1) {
50817
- var processedLine = line
50798
+ const processedLine = line
50818
50799
  .replace(/eval code/g, 'eval')
50819
50800
  .replace(/(\(eval at [^()]*)|(\),.*$)/g, '');
50820
50801
  sanitizedLine = processedLine.replace(/^\s+/, '').replace(/\(eval code/g, '(');
@@ -50824,7 +50805,7 @@ var ErrorStackParser = {
50824
50805
  }
50825
50806
  // capture and preserve the parenthesized location "(/foo/my bar.js:12:87)"
50826
50807
  // in case it has spaces in it, as the string is split on \s+ later on
50827
- var location;
50808
+ let location;
50828
50809
  if (sanitizedLine.indexOf('(') > -1 && sanitizedLine.indexOf('):') > -1) {
50829
50810
  location = sanitizedLine.match(/ (\((.+):(\d+):(\d+)\)$)/);
50830
50811
  }
@@ -50832,23 +50813,22 @@ var ErrorStackParser = {
50832
50813
  sanitizedLine = location
50833
50814
  ? sanitizedLine.replace(location[0], '')
50834
50815
  : sanitizedLine;
50835
- var tokens = sanitizedLine.split(/\s+/).slice(1);
50816
+ const tokens = sanitizedLine.split(/\s+/).slice(1);
50836
50817
  // if a location was matched, pass it to extractLocation() otherwise pop the last token
50837
- var locationParts = _this.extractLocation(location ? location[1] : tokens.pop() || '');
50838
- var functionName = tokens.join(' ') || undefined;
50839
- var fileName = (locationParts[0] === 'eval' || locationParts[0] === '<anonymous>') ? undefined : locationParts[0];
50818
+ const locationParts = this.extractLocation(location ? location[1] : tokens.pop() || '');
50819
+ const functionName = tokens.join(' ') || undefined;
50820
+ const fileName = (locationParts[0] === 'eval' || locationParts[0] === '<anonymous>') ? undefined : locationParts[0];
50840
50821
  frames.push(new StackFrame({
50841
- functionName: functionName,
50842
- fileName: fileName,
50822
+ functionName,
50823
+ fileName,
50843
50824
  lineNumber: locationParts[1],
50844
50825
  columnNumber: locationParts[2]
50845
50826
  }));
50846
50827
  });
50847
50828
  },
50848
- parseFirefoxSafariStack: function (error, maxFramesToSave) {
50849
- var _this = this;
50850
- return this.parseHelper({ regex: SAFARI_NATIVE_CODE_REGEXP, includeMatchedLine: false }, error, maxFramesToSave, function (line, frames) {
50851
- var processedLine = line;
50829
+ parseFirefoxSafariStack(error, maxFramesToSave) {
50830
+ return this.parseHelper({ regex: SAFARI_NATIVE_CODE_REGEXP, includeMatchedLine: false }, error, maxFramesToSave, (line, frames) => {
50831
+ let processedLine = line;
50852
50832
  // Throw away eval information until we implement stacktrace.js/stackframe#8
50853
50833
  if (processedLine.indexOf(' > eval') > -1) {
50854
50834
  processedLine = processedLine.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ':$1');
@@ -50860,12 +50840,12 @@ var ErrorStackParser = {
50860
50840
  }));
50861
50841
  return;
50862
50842
  }
50863
- var functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/;
50864
- var matches = processedLine.match(functionNameRegex);
50865
- var functionName = matches && matches[1] ? matches[1] : undefined;
50866
- var locationParts = _this.extractLocation(processedLine.replace(functionNameRegex, ''));
50843
+ const functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/;
50844
+ const matches = processedLine.match(functionNameRegex);
50845
+ const functionName = matches && matches[1] ? matches[1] : undefined;
50846
+ const locationParts = this.extractLocation(processedLine.replace(functionNameRegex, ''));
50867
50847
  frames.push(new StackFrame({
50868
- functionName: functionName,
50848
+ functionName,
50869
50849
  fileName: locationParts[0],
50870
50850
  lineNumber: locationParts[1],
50871
50851
  columnNumber: locationParts[2]
@@ -50874,29 +50854,28 @@ var ErrorStackParser = {
50874
50854
  }
50875
50855
  };
50876
50856
 
50877
- var MAX_LENGTH = 1000;
50878
- var PII_PATTERN = {
50857
+ const MAX_LENGTH = 1000;
50858
+ const PII_PATTERN = {
50879
50859
  ip: /\b(?:\d{1,3}\.){3}\d{1,3}\b/g,
50880
50860
  ssn: /\b\d{3}-\d{2}-\d{4}\b/g,
50881
50861
  creditCard: /\b(?:\d[ -]?){12,18}\d\b/g,
50882
50862
  httpsUrls: /https:\/\/[^\s]+/g,
50883
50863
  email: /[\w._+-]+@[\w.-]+\.\w+/g
50884
50864
  };
50885
- var PII_REPLACEMENT = '*'.repeat(10);
50886
- var JSON_PII_KEYS = ['password', 'email', 'key', 'token', 'auth', 'authentication', 'phone', 'address', 'ssn'];
50887
- var UNABLE_TO_DISPLAY_BODY = '[Unable to display body: detected PII could not be redacted]';
50888
- var joinedKeys = JSON_PII_KEYS.join('|');
50889
- var keyPattern = "\"([^\"]*(?:".concat(joinedKeys, ")[^\"]*)\"");
50865
+ const PII_REPLACEMENT = '*'.repeat(10);
50866
+ const JSON_PII_KEYS = ['password', 'email', 'key', 'token', 'auth', 'authentication', 'phone', 'address', 'ssn'];
50867
+ const UNABLE_TO_DISPLAY_BODY = '[Unable to display body: detected PII could not be redacted]';
50868
+ const joinedKeys = JSON_PII_KEYS.join('|');
50869
+ const keyPattern = `"([^"]*(?:${joinedKeys})[^"]*)"`;
50890
50870
  // only scrub strings, numbers, and booleans
50891
- var acceptedValues = '("([^"\\\\]*(?:\\\\.[^"\\\\]*)*")|(\\d+)|(true|false))';
50871
+ const acceptedValues = '("([^"\\\\]*(?:\\\\.[^"\\\\]*)*")|(\\d+)|(true|false))';
50892
50872
  /**
50893
50873
  * Truncates a string to the max length
50894
50874
  * @access private
50895
50875
  * @param {String} string
50896
50876
  * @returns {String}
50897
50877
  */
50898
- function truncate(string, includeEllipsis) {
50899
- if (includeEllipsis === void 0) { includeEllipsis = false; }
50878
+ function truncate(string, includeEllipsis = false) {
50900
50879
  if (string.length <= MAX_LENGTH)
50901
50880
  return string;
50902
50881
  if (includeEllipsis) {
@@ -50913,7 +50892,7 @@ function truncate(string, includeEllipsis) {
50913
50892
  * @returns {String}
50914
50893
  */
50915
50894
  function generateLogKey(methodName, message, stackTrace) {
50916
- return "".concat(methodName, "|").concat(message, "|").concat(stackTrace);
50895
+ return `${methodName}|${message}|${stackTrace}`;
50917
50896
  }
50918
50897
  /**
50919
50898
  * Checks if a string has 2 or more digits, a https URL, or an email address
@@ -50930,13 +50909,12 @@ function mightContainPII(string) {
50930
50909
  * @param {String} string
50931
50910
  * @returns {String}
50932
50911
  */
50933
- function scrubPII(_a) {
50934
- var string = _a.string, _ = _a._;
50912
+ function scrubPII({ string, _ }) {
50935
50913
  if (!string || typeof string !== 'string')
50936
50914
  return string;
50937
50915
  if (!mightContainPII(string))
50938
50916
  return string;
50939
- return _.reduce(_.values(PII_PATTERN), function (str, pattern) { return str.replace(pattern, PII_REPLACEMENT); }, string);
50917
+ return _.reduce(_.values(PII_PATTERN), (str, pattern) => str.replace(pattern, PII_REPLACEMENT), string);
50940
50918
  }
50941
50919
  /**
50942
50920
  * Scrub PII from a stringified JSON object
@@ -50945,14 +50923,12 @@ function scrubPII(_a) {
50945
50923
  * @returns {String}
50946
50924
  */
50947
50925
  function scrubJsonPII(string) {
50948
- var fullScrubRegex = new RegExp("".concat(keyPattern, "\\s*:\\s*[\\{\\[]"), 'i');
50926
+ const fullScrubRegex = new RegExp(`${keyPattern}\\s*:\\s*[\\{\\[]`, 'i');
50949
50927
  if (fullScrubRegex.test(string)) {
50950
50928
  return UNABLE_TO_DISPLAY_BODY;
50951
50929
  }
50952
- var keyValueScrubRegex = new RegExp("".concat(keyPattern, "\\s*:\\s*").concat(acceptedValues), 'gi');
50953
- return string.replace(keyValueScrubRegex, function (match, key) {
50954
- return "\"".concat(key, "\":\"").concat(PII_REPLACEMENT, "\"");
50955
- });
50930
+ const keyValueScrubRegex = new RegExp(`${keyPattern}\\s*:\\s*${acceptedValues}`, 'gi');
50931
+ return string.replace(keyValueScrubRegex, (match, key) => `"${key}":"${PII_REPLACEMENT}"`);
50956
50932
  }
50957
50933
  /**
50958
50934
  * Checks if a string is a JSON object
@@ -50964,7 +50940,7 @@ function scrubJsonPII(string) {
50964
50940
  function mightContainJson(string, contentType) {
50965
50941
  if (!string || typeof string !== 'string')
50966
50942
  return false;
50967
- var firstChar = string.charAt(0);
50943
+ const firstChar = string.charAt(0);
50968
50944
  if (contentType && contentType.indexOf('application/json') !== -1) {
50969
50945
  return true;
50970
50946
  }
@@ -50977,15 +50953,14 @@ function mightContainJson(string, contentType) {
50977
50953
  * @param {String} contentType
50978
50954
  * @returns {String}
50979
50955
  */
50980
- function maskSensitiveFields(_a) {
50981
- var string = _a.string, contentType = _a.contentType, _ = _a._;
50956
+ function maskSensitiveFields({ string, contentType, _ }) {
50982
50957
  if (!string || typeof string !== 'string')
50983
50958
  return string;
50984
50959
  if (mightContainJson(string, contentType)) {
50985
50960
  string = scrubJsonPII(string);
50986
50961
  }
50987
50962
  if (mightContainPII(string)) {
50988
- string = scrubPII({ string: string, _: _ });
50963
+ string = scrubPII({ string, _ });
50989
50964
  }
50990
50965
  return string;
50991
50966
  }
@@ -51016,7 +50991,7 @@ function includes(str, substring) {
51016
50991
  function getResourceType(blockedURI, directive) {
51017
50992
  if (!directive || typeof directive !== 'string')
51018
50993
  return 'resource';
51019
- var d = directive.toLowerCase();
50994
+ const d = directive.toLowerCase();
51020
50995
  if (blockedURI === 'inline') {
51021
50996
  if (includes(d, 'script-src-attr')) {
51022
50997
  return 'inline event handler';
@@ -51075,12 +51050,11 @@ function getResourceType(blockedURI, directive) {
51075
51050
  function getDirective(policy, directiveName) {
51076
51051
  if (!policy || !directiveName)
51077
51052
  return '';
51078
- var needle = directiveName.toLowerCase();
51079
- for (var _i = 0, _a = policy.split(';'); _i < _a.length; _i++) {
51080
- var directive = _a[_i];
51081
- var trimmed = directive.trim();
51082
- var lower = trimmed.toLowerCase();
51083
- if (lower === needle || lower.startsWith("".concat(needle, " "))) {
51053
+ const needle = directiveName.toLowerCase();
51054
+ for (const directive of policy.split(';')) {
51055
+ const trimmed = directive.trim();
51056
+ const lower = trimmed.toLowerCase();
51057
+ if (lower === needle || lower.startsWith(`${needle} `)) {
51084
51058
  return trimmed;
51085
51059
  }
51086
51060
  }
@@ -51102,7 +51076,7 @@ function getDirective(policy, directiveName) {
51102
51076
  function getArticle(phrase) {
51103
51077
  if (!phrase || typeof phrase !== 'string')
51104
51078
  return 'A';
51105
- var c = phrase.trim().charAt(0).toLowerCase();
51079
+ const c = phrase.trim().charAt(0).toLowerCase();
51106
51080
  return includes('aeiou', c) ? 'An' : 'A';
51107
51081
  }
51108
51082
  /**
@@ -51145,25 +51119,25 @@ function createCspViolationMessage(blockedURI, directive, isReportOnly, original
51145
51119
  return 'Content Security Policy: Unknown violation occurred.';
51146
51120
  }
51147
51121
  try {
51148
- var reportOnlyText = isReportOnly ? ' (Report-Only)' : '';
51122
+ const reportOnlyText = isReportOnly ? ' (Report-Only)' : '';
51149
51123
  // special case for frame-ancestors since it doesn't fit our template at all
51150
51124
  if ((directive === null || directive === void 0 ? void 0 : directive.toLowerCase()) === 'frame-ancestors') {
51151
- 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, "\".");
51125
+ 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}".`;
51152
51126
  }
51153
- var resourceType = getResourceType(blockedURI, directive);
51154
- var article = getArticle(resourceType);
51155
- var source = formatBlockedUri(blockedURI);
51156
- var directiveValue = getDirective(originalPolicy, directive);
51157
- var policyDisplay = directiveValue || directive;
51158
- var resourceDescription = "".concat(article, " ").concat(resourceType).concat(source ? " from ".concat(source) : '');
51159
- return "Content Security Policy".concat(reportOnlyText, ": ").concat(resourceDescription, " was blocked by your site's `").concat(policyDisplay, "` policy.\nCurrent CSP: \"").concat(originalPolicy, "\".");
51127
+ const resourceType = getResourceType(blockedURI, directive);
51128
+ const article = getArticle(resourceType);
51129
+ const source = formatBlockedUri(blockedURI);
51130
+ const directiveValue = getDirective(originalPolicy, directive);
51131
+ const policyDisplay = directiveValue || directive;
51132
+ const resourceDescription = `${article} ${resourceType}${source ? ` from ${source}` : ''}`;
51133
+ return `Content Security Policy${reportOnlyText}: ${resourceDescription} was blocked by your site's \`${policyDisplay}\` policy.\nCurrent CSP: "${originalPolicy}".`;
51160
51134
  }
51161
51135
  catch (error) {
51162
- return "Content Security Policy: Error formatting violation message: ".concat(error.message);
51136
+ return `Content Security Policy: Error formatting violation message: ${error.message}`;
51163
51137
  }
51164
51138
  }
51165
51139
 
51166
- var DEV_LOG_TYPE = 'devlog';
51140
+ const DEV_LOG_TYPE = 'devlog';
51167
51141
  function createDevLogEnvelope(pluginAPI, globalPendo) {
51168
51142
  return {
51169
51143
  browser_time: pluginAPI.util.getNow(),
@@ -51174,12 +51148,12 @@ function createDevLogEnvelope(pluginAPI, globalPendo) {
51174
51148
  };
51175
51149
  }
51176
51150
 
51177
- var TOKEN_MAX_SIZE = 100;
51178
- var TOKEN_REFILL_RATE = 10;
51179
- var TOKEN_REFRESH_INTERVAL = 1000;
51180
- var MAX_UNCOMPRESSED_SIZE = 125000; // 125KB
51181
- var DevlogBuffer = /** @class */ (function () {
51182
- function DevlogBuffer(pendo, pluginAPI) {
51151
+ const TOKEN_MAX_SIZE = 100;
51152
+ const TOKEN_REFILL_RATE = 10;
51153
+ const TOKEN_REFRESH_INTERVAL = 1000;
51154
+ const MAX_UNCOMPRESSED_SIZE = 125000; // 125KB
51155
+ class DevlogBuffer {
51156
+ constructor(pendo, pluginAPI) {
51183
51157
  this.pendo = pendo;
51184
51158
  this.pluginAPI = pluginAPI;
51185
51159
  this.events = [];
@@ -51190,36 +51164,36 @@ var DevlogBuffer = /** @class */ (function () {
51190
51164
  this.lastRefillTime = this.pluginAPI.util.getNow();
51191
51165
  this.nextRefillTime = this.lastRefillTime + TOKEN_REFRESH_INTERVAL;
51192
51166
  }
51193
- DevlogBuffer.prototype.isEmpty = function () {
51167
+ isEmpty() {
51194
51168
  return this.events.length === 0 && this.payloads.length === 0;
51195
- };
51196
- DevlogBuffer.prototype.refillTokens = function () {
51197
- var now = this.pluginAPI.util.getNow();
51169
+ }
51170
+ refillTokens() {
51171
+ const now = this.pluginAPI.util.getNow();
51198
51172
  if (now >= this.nextRefillTime) {
51199
- var timeSinceLastRefill = now - this.lastRefillTime;
51200
- var secondsSinceLastRefill = Math.floor(timeSinceLastRefill / TOKEN_REFRESH_INTERVAL);
51201
- var tokensToRefill = secondsSinceLastRefill * TOKEN_REFILL_RATE;
51173
+ const timeSinceLastRefill = now - this.lastRefillTime;
51174
+ const secondsSinceLastRefill = Math.floor(timeSinceLastRefill / TOKEN_REFRESH_INTERVAL);
51175
+ const tokensToRefill = secondsSinceLastRefill * TOKEN_REFILL_RATE;
51202
51176
  this.tokens = Math.min(this.tokens + tokensToRefill, TOKEN_MAX_SIZE);
51203
51177
  this.lastRefillTime = now;
51204
51178
  this.nextRefillTime = now + TOKEN_REFRESH_INTERVAL;
51205
51179
  }
51206
- };
51207
- DevlogBuffer.prototype.clear = function () {
51180
+ }
51181
+ clear() {
51208
51182
  this.events = [];
51209
51183
  this.lastEvent = null;
51210
51184
  this.uncompressedSize = 0;
51211
- };
51212
- DevlogBuffer.prototype.hasTokenAvailable = function () {
51185
+ }
51186
+ hasTokenAvailable() {
51213
51187
  this.refillTokens();
51214
51188
  return this.tokens > 0;
51215
- };
51216
- DevlogBuffer.prototype.estimateEventSize = function (event) {
51189
+ }
51190
+ estimateEventSize(event) {
51217
51191
  return JSON.stringify(event).length;
51218
- };
51219
- DevlogBuffer.prototype.push = function (event) {
51192
+ }
51193
+ push(event) {
51220
51194
  if (!this.hasTokenAvailable())
51221
51195
  return false;
51222
- var eventSize = this.estimateEventSize(event);
51196
+ const eventSize = this.estimateEventSize(event);
51223
51197
  if (this.uncompressedSize + eventSize > MAX_UNCOMPRESSED_SIZE) {
51224
51198
  this.compressCurrentChunk();
51225
51199
  }
@@ -51228,55 +51202,54 @@ var DevlogBuffer = /** @class */ (function () {
51228
51202
  this.events.push(event);
51229
51203
  this.tokens = Math.max(this.tokens - 1, 0);
51230
51204
  return true;
51231
- };
51232
- DevlogBuffer.prototype.compressCurrentChunk = function () {
51205
+ }
51206
+ compressCurrentChunk() {
51233
51207
  if (this.events.length === 0)
51234
51208
  return;
51235
- var jzb = this.pendo.compress(this.events);
51209
+ const jzb = this.pendo.compress(this.events);
51236
51210
  this.payloads.push(jzb);
51237
51211
  this.clear();
51238
- };
51239
- DevlogBuffer.prototype.generateUrl = function () {
51240
- var queryParams = {
51212
+ }
51213
+ generateUrl() {
51214
+ const queryParams = {
51241
51215
  v: this.pendo.VERSION,
51242
51216
  ct: this.pluginAPI.util.getNow()
51243
51217
  };
51244
51218
  return this.pluginAPI.transmit.buildBaseDataUrl(DEV_LOG_TYPE, this.pendo.apiKey, queryParams);
51245
- };
51246
- DevlogBuffer.prototype.pack = function () {
51219
+ }
51220
+ pack() {
51247
51221
  if (this.isEmpty())
51248
51222
  return;
51249
- var url = this.generateUrl();
51223
+ const url = this.generateUrl();
51250
51224
  this.compressCurrentChunk();
51251
- var payloads = this.pendo._.map(this.payloads, function (jzb) { return ({
51252
- jzb: jzb,
51253
- url: url
51254
- }); });
51225
+ const payloads = this.pendo._.map(this.payloads, (jzb) => ({
51226
+ jzb,
51227
+ url
51228
+ }));
51255
51229
  this.payloads = [];
51256
51230
  return payloads;
51257
- };
51258
- return DevlogBuffer;
51259
- }());
51231
+ }
51232
+ }
51260
51233
 
51261
- var DevlogTransport = /** @class */ (function () {
51262
- function DevlogTransport(globalPendo, pluginAPI) {
51234
+ class DevlogTransport {
51235
+ constructor(globalPendo, pluginAPI) {
51263
51236
  this.pendo = globalPendo;
51264
51237
  this.pluginAPI = pluginAPI;
51265
51238
  }
51266
- DevlogTransport.prototype.buildGetUrl = function (baseUrl, jzb) {
51267
- var params = {};
51239
+ buildGetUrl(baseUrl, jzb) {
51240
+ const params = {};
51268
51241
  if (this.pluginAPI.agent.treatAsAdoptPartner()) {
51269
51242
  this.pluginAPI.agent.addAccountIdParams(params, this.pendo.get_account_id(), this.pluginAPI.ConfigReader.get('oemAccountId'));
51270
51243
  }
51271
- var jwtOptions = this.pluginAPI.agent.getJwtInfoCopy();
51244
+ const jwtOptions = this.pluginAPI.agent.getJwtInfoCopy();
51272
51245
  if (!this.pendo._.isEmpty(jwtOptions)) {
51273
51246
  this.pendo._.extend(params, jwtOptions);
51274
51247
  }
51275
51248
  params.jzb = jzb;
51276
- var queryString = this.pendo._.map(params, function (value, key) { return "".concat(key, "=").concat(value); }).join('&');
51277
- return "".concat(baseUrl).concat(baseUrl.indexOf('?') !== -1 ? '&' : '?').concat(queryString);
51278
- };
51279
- DevlogTransport.prototype.get = function (url, options) {
51249
+ const queryString = this.pendo._.map(params, (value, key) => `${key}=${value}`).join('&');
51250
+ return `${baseUrl}${baseUrl.indexOf('?') !== -1 ? '&' : '?'}${queryString}`;
51251
+ }
51252
+ get(url, options) {
51280
51253
  options.method = 'GET';
51281
51254
  if (this.pluginAPI.transmit.fetchKeepalive.supported()) {
51282
51255
  return this.pluginAPI.transmit.fetchKeepalive(url, options);
@@ -51284,90 +51257,86 @@ var DevlogTransport = /** @class */ (function () {
51284
51257
  else {
51285
51258
  return this.pendo.ajax.get(url);
51286
51259
  }
51287
- };
51288
- DevlogTransport.prototype.sendRequestWithGet = function (_a) {
51289
- var url = _a.url, jzb = _a.jzb;
51290
- var getUrl = this.buildGetUrl(url, jzb);
51260
+ }
51261
+ sendRequestWithGet({ url, jzb }) {
51262
+ const getUrl = this.buildGetUrl(url, jzb);
51291
51263
  return this.get(getUrl, {
51292
51264
  headers: {
51293
51265
  'Content-Type': 'application/octet-stream'
51294
51266
  }
51295
51267
  });
51296
- };
51297
- DevlogTransport.prototype.post = function (url, options) {
51268
+ }
51269
+ post(url, options) {
51298
51270
  options.method = 'POST';
51299
51271
  if (options.keepalive && this.pluginAPI.transmit.fetchKeepalive.supported()) {
51300
51272
  return this.pluginAPI.transmit.fetchKeepalive(url, options);
51301
51273
  }
51302
51274
  else if (options.keepalive && this.pluginAPI.transmit.sendBeacon.supported()) {
51303
- var result = this.pluginAPI.transmit.sendBeacon(url, new Blob([options.body]));
51275
+ const result = this.pluginAPI.transmit.sendBeacon(url, new Blob([options.body]));
51304
51276
  return result ? Promise$2.resolve() : Promise$2.reject(new Error('sendBeacon failed to send devlog data'));
51305
51277
  }
51306
51278
  else {
51307
51279
  return this.pendo.ajax.post(url, options.body);
51308
51280
  }
51309
- };
51310
- DevlogTransport.prototype.sendRequestWithPost = function (_a, isUnload) {
51311
- var url = _a.url, jzb = _a.jzb;
51312
- var jwtOptions = this.pluginAPI.agent.getJwtInfoCopy();
51313
- var bodyPayload = {
51281
+ }
51282
+ sendRequestWithPost({ url, jzb }, isUnload) {
51283
+ const jwtOptions = this.pluginAPI.agent.getJwtInfoCopy();
51284
+ const bodyPayload = {
51314
51285
  events: jzb,
51315
51286
  browser_time: this.pluginAPI.util.getNow()
51316
51287
  };
51317
51288
  if (this.pluginAPI.agent.treatAsAdoptPartner()) {
51318
51289
  this.pluginAPI.agent.addAccountIdParams(bodyPayload, this.pendo.get_account_id(), this.pluginAPI.ConfigReader.get('oemAccountId'));
51319
51290
  }
51320
- var body = JSON.stringify(this.pendo._.extend(bodyPayload, jwtOptions));
51291
+ const body = JSON.stringify(this.pendo._.extend(bodyPayload, jwtOptions));
51321
51292
  return this.post(url, {
51322
- body: body,
51293
+ body,
51323
51294
  headers: {
51324
51295
  'Content-Type': 'application/json'
51325
51296
  },
51326
51297
  keepalive: isUnload
51327
51298
  });
51328
- };
51329
- DevlogTransport.prototype.sendRequest = function (_a, isUnload) {
51330
- var url = _a.url, jzb = _a.jzb;
51331
- var compressedLength = jzb.length;
51299
+ }
51300
+ sendRequest({ url, jzb }, isUnload) {
51301
+ const compressedLength = jzb.length;
51332
51302
  if (compressedLength <= this.pluginAPI.constants.ENCODED_EVENT_MAX_LENGTH && !this.pluginAPI.ConfigReader.get('sendEventsWithPostOnly')) {
51333
- return this.sendRequestWithGet({ url: url, jzb: jzb });
51303
+ return this.sendRequestWithGet({ url, jzb });
51334
51304
  }
51335
- return this.sendRequestWithPost({ url: url, jzb: jzb }, isUnload);
51336
- };
51337
- return DevlogTransport;
51338
- }());
51305
+ return this.sendRequestWithPost({ url, jzb }, isUnload);
51306
+ }
51307
+ }
51339
51308
 
51340
51309
  function ConsoleCapture() {
51341
- var pluginAPI;
51342
- var _;
51343
- var globalPendo;
51344
- var buffer;
51345
- var sendQueue;
51346
- var sendInterval;
51347
- var transport;
51348
- var isPtmPaused;
51349
- var isCapturingConsoleLogs = false;
51350
- var CAPTURE_CONSOLE_CONFIG = 'captureConsoleLogs';
51351
- var CONSOLE_METHODS = ['log', 'warn', 'error', 'info'];
51352
- var DEV_LOG_SUB_TYPE = 'console';
51310
+ let pluginAPI;
51311
+ let _;
51312
+ let globalPendo;
51313
+ let buffer;
51314
+ let sendQueue;
51315
+ let sendInterval;
51316
+ let transport;
51317
+ let isPtmPaused;
51318
+ let isCapturingConsoleLogs = false;
51319
+ const CAPTURE_CONSOLE_CONFIG = 'captureConsoleLogs';
51320
+ const CONSOLE_METHODS = ['log', 'warn', 'error', 'info'];
51321
+ const DEV_LOG_SUB_TYPE = 'console';
51353
51322
  // deduplicate logs
51354
- var lastLogKey = '';
51323
+ let lastLogKey = '';
51355
51324
  return {
51356
51325
  name: 'ConsoleCapture',
51357
- initialize: initialize,
51358
- teardown: teardown,
51359
- addIntercepts: addIntercepts,
51360
- createConsoleEvent: createConsoleEvent,
51361
- captureStackTrace: captureStackTrace,
51362
- send: send,
51363
- setCaptureState: setCaptureState,
51364
- recordingStarted: recordingStarted,
51365
- recordingStopped: recordingStopped,
51366
- onAppHidden: onAppHidden,
51367
- onAppUnloaded: onAppUnloaded,
51368
- onPtmPaused: onPtmPaused,
51369
- onPtmUnpaused: onPtmUnpaused,
51370
- securityPolicyViolationFn: securityPolicyViolationFn,
51326
+ initialize,
51327
+ teardown,
51328
+ addIntercepts,
51329
+ createConsoleEvent,
51330
+ captureStackTrace,
51331
+ send,
51332
+ setCaptureState,
51333
+ recordingStarted,
51334
+ recordingStopped,
51335
+ onAppHidden,
51336
+ onAppUnloaded,
51337
+ onPtmPaused,
51338
+ onPtmUnpaused,
51339
+ securityPolicyViolationFn,
51371
51340
  get isCapturingConsoleLogs() {
51372
51341
  return isCapturingConsoleLogs;
51373
51342
  },
@@ -51384,16 +51353,16 @@ function ConsoleCapture() {
51384
51353
  function initialize(pendo, PluginAPI) {
51385
51354
  _ = pendo._;
51386
51355
  pluginAPI = PluginAPI;
51387
- var ConfigReader = pluginAPI.ConfigReader;
51356
+ const { ConfigReader } = pluginAPI;
51388
51357
  ConfigReader.addOption(CAPTURE_CONSOLE_CONFIG, [ConfigReader.sources.PENDO_CONFIG_SRC], false);
51389
- var captureConsoleEnabled = ConfigReader.get(CAPTURE_CONSOLE_CONFIG);
51358
+ const captureConsoleEnabled = ConfigReader.get(CAPTURE_CONSOLE_CONFIG);
51390
51359
  if (!captureConsoleEnabled)
51391
51360
  return;
51392
51361
  globalPendo = pendo;
51393
51362
  buffer = new DevlogBuffer(pendo, pluginAPI);
51394
51363
  transport = new DevlogTransport(pendo, pluginAPI);
51395
51364
  sendQueue = new pluginAPI.SendQueue(transport.sendRequest.bind(transport));
51396
- sendInterval = setInterval(function () {
51365
+ sendInterval = setInterval(() => {
51397
51366
  if (!sendQueue.failed()) {
51398
51367
  send();
51399
51368
  }
@@ -51419,19 +51388,17 @@ function ConsoleCapture() {
51419
51388
  function onPtmUnpaused() {
51420
51389
  isPtmPaused = false;
51421
51390
  if (!buffer.isEmpty()) {
51422
- for (var _i = 0, _a = buffer.events; _i < _a.length; _i++) {
51423
- var event_1 = _a[_i];
51424
- pluginAPI.Events.eventCaptured.trigger(event_1);
51391
+ for (const event of buffer.events) {
51392
+ pluginAPI.Events.eventCaptured.trigger(event);
51425
51393
  }
51426
51394
  send();
51427
51395
  }
51428
51396
  }
51429
- function setCaptureState(_a) {
51430
- var _b = _a === void 0 ? {} : _a, _c = _b.shouldCapture, shouldCapture = _c === void 0 ? false : _c, _d = _b.reason, reason = _d === void 0 ? '' : _d;
51397
+ function setCaptureState({ shouldCapture = false, reason = '' } = {}) {
51431
51398
  if (shouldCapture === isCapturingConsoleLogs)
51432
51399
  return;
51433
51400
  isCapturingConsoleLogs = shouldCapture;
51434
- pluginAPI.log.info("[ConsoleCapture] Console log capture ".concat(shouldCapture ? 'started' : 'stopped').concat(reason ? ": ".concat(reason) : ''));
51401
+ pluginAPI.log.info(`[ConsoleCapture] Console log capture ${shouldCapture ? 'started' : 'stopped'}${reason ? `: ${reason}` : ''}`);
51435
51402
  }
51436
51403
  function recordingStarted() {
51437
51404
  setCaptureState({ shouldCapture: true, reason: 'recording started' });
@@ -51445,12 +51412,12 @@ function ConsoleCapture() {
51445
51412
  }
51446
51413
  function addIntercepts() {
51447
51414
  _.each(CONSOLE_METHODS, function (methodName) {
51448
- var originalMethod = console[methodName];
51415
+ const originalMethod = console[methodName];
51449
51416
  if (!originalMethod)
51450
51417
  return;
51451
51418
  console[methodName] = _.wrap(originalMethod, function (originalFn) {
51452
51419
  // slice 1 to omit originalFn
51453
- var args = _.toArray(arguments).slice(1);
51420
+ const args = _.toArray(arguments).slice(1);
51454
51421
  originalFn.apply(console, args);
51455
51422
  createConsoleEvent(args, methodName);
51456
51423
  });
@@ -51462,10 +51429,10 @@ function ConsoleCapture() {
51462
51429
  function securityPolicyViolationFn(evt) {
51463
51430
  if (!evt || typeof evt !== 'object')
51464
51431
  return;
51465
- var blockedURI = evt.blockedURI, violatedDirective = evt.violatedDirective, effectiveDirective = evt.effectiveDirective, disposition = evt.disposition, originalPolicy = evt.originalPolicy;
51466
- var directive = violatedDirective || effectiveDirective;
51467
- var isReportOnly = disposition === 'report';
51468
- var message = createCspViolationMessage(blockedURI, directive, isReportOnly, originalPolicy);
51432
+ const { blockedURI, violatedDirective, effectiveDirective, disposition, originalPolicy } = evt;
51433
+ const directive = violatedDirective || effectiveDirective;
51434
+ const isReportOnly = disposition === 'report';
51435
+ const message = createCspViolationMessage(blockedURI, directive, isReportOnly, originalPolicy);
51469
51436
  if (isReportOnly) {
51470
51437
  createConsoleEvent([message], 'warn', { skipStackTrace: true, skipScrubPII: true });
51471
51438
  }
@@ -51473,13 +51440,12 @@ function ConsoleCapture() {
51473
51440
  createConsoleEvent([message], 'error', { skipStackTrace: true, skipScrubPII: true });
51474
51441
  }
51475
51442
  }
51476
- function createConsoleEvent(args, methodName, _a) {
51477
- var _b = _a === void 0 ? {} : _a, _c = _b.skipStackTrace, skipStackTrace = _c === void 0 ? false : _c, _d = _b.skipScrubPII, skipScrubPII = _d === void 0 ? false : _d;
51443
+ function createConsoleEvent(args, methodName, { skipStackTrace = false, skipScrubPII = false } = {}) {
51478
51444
  if (!isCapturingConsoleLogs || !args || args.length === 0 || !_.contains(CONSOLE_METHODS, methodName))
51479
51445
  return;
51480
51446
  // stringify args
51481
- var message = _.compact(_.map(args, function (arg) {
51482
- var stringifiedArg;
51447
+ let message = _.compact(_.map(args, arg => {
51448
+ let stringifiedArg;
51483
51449
  try {
51484
51450
  stringifiedArg = stringify(arg);
51485
51451
  }
@@ -51491,22 +51457,22 @@ function ConsoleCapture() {
51491
51457
  if (!message)
51492
51458
  return;
51493
51459
  // capture stack trace
51494
- var stackTrace = '';
51460
+ let stackTrace = '';
51495
51461
  if (!skipStackTrace) {
51496
- var maxStackFrames = methodName === 'error' ? 4 : 1;
51462
+ const maxStackFrames = methodName === 'error' ? 4 : 1;
51497
51463
  stackTrace = captureStackTrace(maxStackFrames);
51498
51464
  }
51499
51465
  // truncate message and stack trace
51500
51466
  message = truncate(message);
51501
51467
  stackTrace = truncate(stackTrace);
51502
51468
  // de-duplicate log
51503
- var logKey = generateLogKey(methodName, message, stackTrace);
51469
+ const logKey = generateLogKey(methodName, message, stackTrace);
51504
51470
  if (isExistingDuplicateLog(logKey)) {
51505
51471
  buffer.lastEvent.devLogCount++;
51506
51472
  return;
51507
51473
  }
51508
- var devLogEnvelope = createDevLogEnvelope(pluginAPI, globalPendo);
51509
- 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 });
51474
+ const devLogEnvelope = createDevLogEnvelope(pluginAPI, globalPendo);
51475
+ 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 });
51510
51476
  if (!buffer.hasTokenAvailable())
51511
51477
  return consoleEvent;
51512
51478
  if (!isPtmPaused) {
@@ -51518,8 +51484,8 @@ function ConsoleCapture() {
51518
51484
  }
51519
51485
  function captureStackTrace(maxStackFrames) {
51520
51486
  try {
51521
- var stackFrames = ErrorStackParser.parse(new Error(), maxStackFrames);
51522
- return _.map(stackFrames, function (frame) { return frame.toString(); }).join('\n');
51487
+ const stackFrames = ErrorStackParser.parse(new Error(), maxStackFrames);
51488
+ return _.map(stackFrames, frame => frame.toString()).join('\n');
51523
51489
  }
51524
51490
  catch (error) {
51525
51491
  return '';
@@ -51531,22 +51497,21 @@ function ConsoleCapture() {
51531
51497
  function updateLastLog(logKey) {
51532
51498
  lastLogKey = logKey;
51533
51499
  }
51534
- function send(_a) {
51535
- var _b = _a === void 0 ? {} : _a, _c = _b.unload, unload = _c === void 0 ? false : _c, _d = _b.hidden, hidden = _d === void 0 ? false : _d;
51500
+ function send({ unload = false, hidden = false } = {}) {
51536
51501
  if (!buffer || buffer.isEmpty())
51537
51502
  return;
51538
51503
  if (!globalPendo.isSendingEvents()) {
51539
51504
  buffer.clear();
51540
51505
  return;
51541
51506
  }
51542
- var payloads = buffer.pack();
51507
+ const payloads = buffer.pack();
51543
51508
  if (!payloads || payloads.length === 0)
51544
51509
  return;
51545
51510
  if (unload || hidden) {
51546
51511
  sendQueue.drain(payloads, unload);
51547
51512
  }
51548
51513
  else {
51549
- sendQueue.push.apply(sendQueue, payloads);
51514
+ sendQueue.push(...payloads);
51550
51515
  }
51551
51516
  }
51552
51517
  function teardown() {
@@ -51570,7 +51535,7 @@ function ConsoleCapture() {
51570
51535
  _.each(CONSOLE_METHODS, function (methodName) {
51571
51536
  if (!console[methodName])
51572
51537
  return _.noop;
51573
- var unwrap = console[methodName]._pendoUnwrap;
51538
+ const unwrap = console[methodName]._pendoUnwrap;
51574
51539
  if (_.isFunction(unwrap)) {
51575
51540
  unwrap();
51576
51541
  }
@@ -51976,20 +51941,18 @@ function NetworkCapture() {
51976
51941
  }
51977
51942
  }
51978
51943
 
51979
- var PREDICT_STEP_REGEX = /\$\$predict\$\$/;
51980
- var DRAG_THRESHOLD = 5;
51981
- var STYLE_ID = 'pendo-predict-plugin-styles';
51982
- var PREDICT_BASE_URL = 'https://predict.pendo.io';
51983
- var GUIDE_BUTTON_IDENTIFIER = 'button:contains("token")';
51984
- var pluginVersion = '1.0.1';
51985
- var $ = function (id) { return document.getElementById(id); };
51986
- var createElement = function (tag, attrs, parent) {
51987
- if (attrs === void 0) { attrs = {}; }
51988
- if (parent === void 0) { parent = null; }
51989
- var el = document.createElement(tag);
51990
- var entries = Object.entries(attrs);
51991
- for (var i = 0; i < entries.length; i++) {
51992
- var _a = entries[i], key = _a[0], value = _a[1];
51944
+ const PREDICT_STEP_REGEX = /\$\$predict\$\$/;
51945
+ const DRAG_THRESHOLD = 5;
51946
+ const STYLE_ID = 'pendo-predict-plugin-styles';
51947
+ const PREDICT_BASE_URL = 'https://predict.pendo.io';
51948
+ const GUIDE_BUTTON_IDENTIFIER = 'button:contains("token")';
51949
+ const pluginVersion = '1.0.1';
51950
+ const $ = (id) => document.getElementById(id);
51951
+ const createElement = (tag, attrs = {}, parent = null) => {
51952
+ const el = document.createElement(tag);
51953
+ const entries = Object.entries(attrs);
51954
+ for (let i = 0; i < entries.length; i++) {
51955
+ const [key, value] = entries[i];
51993
51956
  if (key === 'className')
51994
51957
  el.className = value;
51995
51958
  else if (key === 'innerHTML')
@@ -52001,28 +51964,69 @@ var createElement = function (tag, attrs, parent) {
52001
51964
  parent.appendChild(el);
52002
51965
  return el;
52003
51966
  };
52004
- var injectStyles = function (pendoContainerId, log) {
52005
- if (log === void 0) { log = function () { }; }
52006
- var styleId = "".concat(STYLE_ID, "-").concat(pendoContainerId);
51967
+ const injectStyles = (pendoContainerId, log = () => { }) => {
51968
+ const styleId = `${STYLE_ID}-${pendoContainerId}`;
52007
51969
  if ($(styleId)) {
52008
- log("[predict] style already exists, skipping: ".concat(styleId));
51970
+ log(`[predict] style already exists, skipping: ${styleId}`);
52009
51971
  return;
52010
51972
  }
52011
- log("[predict] injecting styles: ".concat(styleId));
51973
+ log(`[predict] injecting styles: ${styleId}`);
52012
51974
  createElement('style', {
52013
51975
  id: styleId,
52014
- 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 ")
51976
+ textContent: `
51977
+ #${pendoContainerId} {
51978
+ display: none !important;
51979
+ }
51980
+ .frame-explanation {
51981
+ aspect-ratio: 16/9; overflow: hidden; min-height: 300px;
51982
+ width: 100vw; height: 100vh; background: transparent;
51983
+ position: fixed; bottom: 0; right: 0; z-index: 999999; border: none;
51984
+ visibility: hidden; opacity: 0; pointer-events: none;
51985
+ transition: opacity 0.1s ease-out, visibility 0s linear 0.1s;
51986
+ display: none;
51987
+ }
51988
+ .frame-explanation.is-visible {
51989
+ visibility: visible; opacity: 1; pointer-events: auto;
51990
+ transition: opacity 0.1s ease-out, visibility 0s linear 0s;
51991
+ }
51992
+ .frame-explanation.is-exists {
51993
+ display: block !important;
51994
+ }
51995
+ .floating-modal-container {
51996
+ position: fixed; top: 20px; right: 20px; z-index: 500000;
51997
+ visibility: hidden; opacity: 0; pointer-events: none;
51998
+ transition: opacity 0.1s ease-out, visibility 0s linear 0.1s;
51999
+ border-radius: 8px; box-shadow: 0px 4px 12px 0px rgba(0,0,0,0.15);
52000
+ overflow: hidden; width: 384px; height: 176px;
52001
+ }
52002
+ .floating-modal-container.is-visible {
52003
+ visibility: visible; opacity: 1; pointer-events: auto;
52004
+ transition: opacity 0.1s ease-out, visibility 0s linear 0s;
52005
+ }
52006
+ .floating-modal-container.is-dragging { will-change: left, top; }
52007
+ .floating-modal-drag-handle {
52008
+ position: absolute; left: 50%; transform: translateX(-50%);
52009
+ top: 5px; width: calc(100% - 46px); min-width: 166px; height: 17px;
52010
+ z-index: 9999; transition: left 0.2s ease, right 0.2s ease;
52011
+ display: flex; justify-content: center; align-items: center;
52012
+ }
52013
+ .floating-modal-drag-handle svg g { fill: #A0A0A0; }
52014
+ .floating-modal-drag-handle:hover { cursor: grab; }
52015
+ .floating-modal-drag-handle:hover svg g { fill: #1f2937; }
52016
+ .floating-modal-drag-handle.is-dragging { cursor: grabbing; }
52017
+ .floating-modal-drag-handle.is-collapsed { top: 0px; }
52018
+ .frame-floating-modal { width: 100%; height: 100%; background: white; border: none; display: block; }
52019
+ `
52015
52020
  }, document.head);
52016
52021
  };
52017
- var getRecordIdFromUrl = function (recordRegex, log) {
52022
+ const getRecordIdFromUrl = (recordRegex, log = () => { }) => {
52018
52023
  var _a;
52019
- if (log === void 0) { log = function () { }; }
52020
- var match = window.location.href.match(recordRegex);
52021
- var recordId = (_a = match === null || match === void 0 ? void 0 : match[1]) !== null && _a !== void 0 ? _a : null;
52022
- log("[predict] recordId found: ".concat(recordId));
52024
+ const match = window.location.href.match(recordRegex);
52025
+ const recordId = (_a = match === null || match === void 0 ? void 0 : match[1]) !== null && _a !== void 0 ? _a : null;
52026
+ log(`[predict] recordId found: ${recordId}`);
52023
52027
  return recordId;
52024
52028
  };
52025
- var safeStringify = function (value, fallback) {
52029
+ const safeStringify = (value, fallback) => {
52026
52030
  try {
52027
52031
  return JSON.stringify(value);
52028
52032
  }
@@ -52030,22 +52034,21 @@ var safeStringify = function (value, fallback) {
52030
52034
  return fallback !== null && fallback !== void 0 ? fallback : '';
52031
52035
  }
52032
52036
  };
52033
- var safeParse = function (value, fallback, log) {
52034
- if (log === void 0) { log = function () { }; }
52037
+ const safeParse = (value, fallback, log = () => { }) => {
52035
52038
  try {
52036
52039
  return JSON.parse(value);
52037
52040
  }
52038
52041
  catch (error) {
52039
- log("[predict] JSON parse error: ".concat(error));
52042
+ log(`[predict] JSON parse error: ${error}`);
52040
52043
  return fallback;
52041
52044
  }
52042
52045
  };
52043
- var buildQueryParams = function (params) {
52044
- var urlParams = new URLSearchParams();
52045
- var entries = Object.entries(params);
52046
+ const buildQueryParams = (params) => {
52047
+ const urlParams = new URLSearchParams();
52048
+ const entries = Object.entries(params);
52046
52049
  urlParams.set('pluginVersion', pluginVersion);
52047
- for (var i = 0; i < entries.length; i++) {
52048
- var _a = entries[i], key = _a[0], value = _a[1];
52050
+ for (let i = 0; i < entries.length; i++) {
52051
+ const [key, value] = entries[i];
52049
52052
  if (value != null) {
52050
52053
  urlParams.set(key, typeof value === 'object' ? safeStringify(value) : String(value));
52051
52054
  }
@@ -52053,17 +52056,17 @@ var buildQueryParams = function (params) {
52053
52056
  return urlParams.toString();
52054
52057
  };
52055
52058
  // ----- Drag & Drop -----
52056
- var setupDragAndDrop = function (handle, container) {
52057
- var isDragging = false;
52058
- var hasMoved = false;
52059
- var isCollapsed = false;
52060
- var startX = 0;
52061
- var startY = 0;
52062
- var initialLeft = 0;
52063
- var initialTop = 0;
52064
- var rafId = null;
52065
- var iframe = container.querySelector('iframe');
52066
- var onMouseDown = function (e) {
52059
+ const setupDragAndDrop = (handle, container) => {
52060
+ let isDragging = false;
52061
+ let hasMoved = false;
52062
+ let isCollapsed = false;
52063
+ let startX = 0;
52064
+ let startY = 0;
52065
+ let initialLeft = 0;
52066
+ let initialTop = 0;
52067
+ let rafId = null;
52068
+ const iframe = container.querySelector('iframe');
52069
+ const onMouseDown = (e) => {
52067
52070
  if (e.button !== 0)
52068
52071
  return;
52069
52072
  e.preventDefault();
@@ -52073,35 +52076,35 @@ var setupDragAndDrop = function (handle, container) {
52073
52076
  container.classList.add('is-dragging');
52074
52077
  if (iframe)
52075
52078
  iframe.style.pointerEvents = 'none';
52076
- var rect = container.getBoundingClientRect();
52079
+ const rect = container.getBoundingClientRect();
52077
52080
  initialLeft = rect.left;
52078
52081
  initialTop = rect.top;
52079
- container.style.left = "".concat(initialLeft, "px");
52082
+ container.style.left = `${initialLeft}px`;
52080
52083
  container.style.right = 'auto';
52081
52084
  startX = e.clientX;
52082
52085
  startY = e.clientY;
52083
52086
  document.addEventListener('mousemove', onMouseMove);
52084
52087
  document.addEventListener('mouseup', onMouseUp);
52085
52088
  };
52086
- var onMouseMove = function (e) {
52089
+ const onMouseMove = (e) => {
52087
52090
  if (!isDragging)
52088
52091
  return;
52089
- var deltaX = e.clientX - startX;
52090
- var deltaY = e.clientY - startY;
52092
+ const deltaX = e.clientX - startX;
52093
+ const deltaY = e.clientY - startY;
52091
52094
  if (Math.abs(deltaX) > DRAG_THRESHOLD || Math.abs(deltaY) > DRAG_THRESHOLD) {
52092
52095
  hasMoved = true;
52093
52096
  }
52094
52097
  if (rafId)
52095
52098
  cancelAnimationFrame(rafId);
52096
- rafId = requestAnimationFrame(function () {
52097
- var rect = container.getBoundingClientRect();
52098
- var newLeft = Math.max(0, Math.min(initialLeft + deltaX, window.innerWidth - rect.width));
52099
- var newTop = Math.max(0, Math.min(initialTop + deltaY, window.innerHeight - rect.height));
52100
- container.style.left = "".concat(newLeft, "px");
52101
- container.style.top = "".concat(newTop, "px");
52099
+ rafId = requestAnimationFrame(() => {
52100
+ const rect = container.getBoundingClientRect();
52101
+ const newLeft = Math.max(0, Math.min(initialLeft + deltaX, window.innerWidth - rect.width));
52102
+ const newTop = Math.max(0, Math.min(initialTop + deltaY, window.innerHeight - rect.height));
52103
+ container.style.left = `${newLeft}px`;
52104
+ container.style.top = `${newTop}px`;
52102
52105
  });
52103
52106
  };
52104
- var onMouseUp = function (e) {
52107
+ const onMouseUp = (e) => {
52105
52108
  var _a;
52106
52109
  if (!isDragging)
52107
52110
  return;
@@ -52119,12 +52122,12 @@ var setupDragAndDrop = function (handle, container) {
52119
52122
  (_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage({ type: 'TRIGGER_EXPAND' }, PREDICT_BASE_URL);
52120
52123
  }
52121
52124
  };
52122
- handle.setCollapsedState = function (collapsed) {
52125
+ handle.setCollapsedState = (collapsed) => {
52123
52126
  isCollapsed = collapsed;
52124
52127
  handle.classList.toggle('is-collapsed', collapsed);
52125
52128
  };
52126
52129
  handle.addEventListener('mousedown', onMouseDown);
52127
- handle.cleanup = function () {
52130
+ handle.cleanup = () => {
52128
52131
  handle.removeEventListener('mousedown', onMouseDown);
52129
52132
  document.removeEventListener('mousemove', onMouseMove);
52130
52133
  document.removeEventListener('mouseup', onMouseUp);
@@ -52134,13 +52137,12 @@ var setupDragAndDrop = function (handle, container) {
52134
52137
  return handle;
52135
52138
  };
52136
52139
  // ----- Explanation Iframe Creation -----
52137
- var createExplanationIframe = function (_a) {
52138
- var _b;
52139
- var analysisId = _a.analysisId, recordId = _a.recordId, configuration = _a.configuration;
52140
- var frameId = "frameExplanation-".concat(analysisId);
52141
- (_b = $(frameId)) === null || _b === void 0 ? void 0 : _b.remove();
52142
- var base = "".concat(PREDICT_BASE_URL, "/external/analysis/").concat(analysisId, "/prediction/drilldown/").concat(recordId);
52143
- var params = buildQueryParams(configuration);
52140
+ const createExplanationIframe = ({ analysisId, recordId, configuration }) => {
52141
+ var _a;
52142
+ const frameId = `frameExplanation-${analysisId}`;
52143
+ (_a = $(frameId)) === null || _a === void 0 ? void 0 : _a.remove();
52144
+ const base = `${PREDICT_BASE_URL}/external/analysis/${analysisId}/prediction/drilldown/${recordId}`;
52145
+ const params = buildQueryParams(configuration);
52144
52146
  createElement('iframe', {
52145
52147
  id: frameId,
52146
52148
  className: 'frame-explanation',
@@ -52148,24 +52150,28 @@ var createExplanationIframe = function (_a) {
52148
52150
  loading: 'lazy',
52149
52151
  referrerPolicy: 'strict-origin-when-cross-origin',
52150
52152
  allowFullscreen: true,
52151
- src: "".concat(base, "?").concat(params)
52153
+ src: `${base}?${params}`
52152
52154
  }, document.body);
52153
52155
  };
52154
52156
  // ----- Floating Modal Creation -----
52155
- var createFloatingModal = function (_a) {
52156
- var _b;
52157
- var recordId = _a.recordId, configuration = _a.configuration;
52158
- var flatIds = (_b = configuration.analysisIds) === null || _b === void 0 ? void 0 : _b.flat(Infinity);
52159
- for (var i = 0; i < flatIds.length; i++) {
52160
- createExplanationIframe({ analysisId: flatIds[i], recordId: recordId, configuration: configuration });
52161
- }
52162
- var container = createElement('div', { id: 'floatingModalContainer', className: 'floating-modal-container' }, document.body);
52163
- var dragHandle = createElement('div', {
52157
+ const createFloatingModal = ({ recordId, configuration }) => {
52158
+ var _a;
52159
+ const flatIds = (_a = configuration.analysisIds) === null || _a === void 0 ? void 0 : _a.flat(Infinity);
52160
+ for (let i = 0; i < flatIds.length; i++) {
52161
+ createExplanationIframe({ analysisId: flatIds[i], recordId, configuration });
52162
+ }
52163
+ const container = createElement('div', { id: 'floatingModalContainer', className: 'floating-modal-container' }, document.body);
52164
+ const dragHandle = createElement('div', {
52164
52165
  className: 'floating-modal-drag-handle',
52165
- 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>"
52166
+ innerHTML: `<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
52167
+ <g fill="#EBEBEB">
52168
+ <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"/>
52169
+ <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"/>
52170
+ </g>
52171
+ </svg>`
52166
52172
  }, container);
52167
- var baseUrl = "".concat(PREDICT_BASE_URL, "/external/analysis/prediction/summary/").concat(recordId);
52168
- var params = buildQueryParams(configuration);
52173
+ const baseUrl = `${PREDICT_BASE_URL}/external/analysis/prediction/summary/${recordId}`;
52174
+ const params = buildQueryParams(configuration);
52169
52175
  createElement('iframe', {
52170
52176
  id: 'frameFloatingModal',
52171
52177
  className: 'frame-floating-modal',
@@ -52173,136 +52179,133 @@ var createFloatingModal = function (_a) {
52173
52179
  referrerPolicy: 'strict-origin-when-cross-origin',
52174
52180
  allowFullscreen: true,
52175
52181
  title: 'Floating Modal',
52176
- src: "".concat(baseUrl, "?").concat(params)
52182
+ src: `${baseUrl}?${params}`
52177
52183
  }, container);
52178
52184
  container.dragHandle = setupDragAndDrop(dragHandle, container);
52179
- return function () {
52185
+ return () => {
52180
52186
  var _a, _b;
52181
52187
  (_b = (_a = container.dragHandle) === null || _a === void 0 ? void 0 : _a.cleanup) === null || _b === void 0 ? void 0 : _b.call(_a);
52182
52188
  container.remove();
52183
- for (var i = 0; i < flatIds.length; i++) {
52184
- var frame = $("frameExplanation-".concat(flatIds[i]));
52189
+ for (let i = 0; i < flatIds.length; i++) {
52190
+ const frame = $(`frameExplanation-${flatIds[i]}`);
52185
52191
  if (frame)
52186
52192
  frame.remove();
52187
52193
  }
52188
52194
  };
52189
52195
  };
52190
- var setupMessageListener = function (_a) {
52191
- var token = _a.token, forceAccountId = _a.forceAccountId, cleanup = _a.cleanup, pendo = _a.pendo;
52192
- var messageHandler = function (_a) {
52193
- var _b;
52194
- var origin = _a.origin, data = _a.data;
52196
+ const setupMessageListener = ({ token, forceAccountId, cleanup, pendo }) => {
52197
+ const messageHandler = ({ origin, data }) => {
52198
+ var _a;
52195
52199
  if (origin !== PREDICT_BASE_URL || !data || typeof data !== 'object')
52196
52200
  return;
52197
- var _c = data, type = _c.type, analysisId = _c.analysisId, height = _c.height, width = _c.width;
52198
- var explanationFrame = $("frameExplanation-".concat(analysisId));
52199
- var floatingModal = $('floatingModalContainer');
52200
- var setFloatingModalSize = function () {
52201
+ const { type, analysisId, height, width } = data;
52202
+ const explanationFrame = $(`frameExplanation-${analysisId}`);
52203
+ const floatingModal = $('floatingModalContainer');
52204
+ const setFloatingModalSize = () => {
52201
52205
  if (floatingModal) {
52202
- floatingModal.style.height = "".concat(height, "px");
52203
- floatingModal.style.width = "".concat(width, "px");
52206
+ floatingModal.style.height = `${height}px`;
52207
+ floatingModal.style.width = `${width}px`;
52204
52208
  }
52205
52209
  };
52206
- var setFloatingModalCollapsedState = function (collapsed) {
52210
+ const setFloatingModalCollapsedState = (collapsed) => {
52207
52211
  var _a, _b;
52208
52212
  if (floatingModal)
52209
52213
  (_b = (_a = floatingModal.dragHandle) === null || _a === void 0 ? void 0 : _a.setCollapsedState) === null || _b === void 0 ? void 0 : _b.call(_a, collapsed);
52210
52214
  };
52211
- var actions = {
52212
- MODAL_INITIALIZED: function () {
52215
+ const actions = {
52216
+ MODAL_INITIALIZED: () => {
52213
52217
  var _a, _b, _c;
52214
- var iframe = $('frameFloatingModal');
52218
+ const iframe = $('frameFloatingModal');
52215
52219
  if (iframe) {
52216
- var idToken = null;
52217
- var extensionAPIKeys = null;
52218
- var retrieveIDPToken = pendo.getConfigValue('retrieveIDPToken');
52220
+ let idToken = null;
52221
+ let extensionAPIKeys = null;
52222
+ const retrieveIDPToken = pendo.getConfigValue('retrieveIDPToken');
52219
52223
  if (pendo._.isFunction(retrieveIDPToken)) {
52220
- var result = retrieveIDPToken();
52224
+ const result = retrieveIDPToken();
52221
52225
  if (result) {
52222
52226
  idToken = result.idToken;
52223
52227
  extensionAPIKeys = result.extensionAPIKeys;
52224
52228
  }
52225
52229
  }
52226
- var visitorId = (_a = pendo === null || pendo === void 0 ? void 0 : pendo.getVisitorId) === null || _a === void 0 ? void 0 : _a.call(pendo);
52227
- 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);
52228
- (_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);
52230
+ const visitorId = (_a = pendo === null || pendo === void 0 ? void 0 : pendo.getVisitorId) === null || _a === void 0 ? void 0 : _a.call(pendo);
52231
+ 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);
52232
+ (_c = iframe.contentWindow) === null || _c === void 0 ? void 0 : _c.postMessage({ type: 'TOKEN_RECEIVED', token, idToken, extensionAPIKeys, visitorId, accountId }, PREDICT_BASE_URL);
52229
52233
  }
52230
52234
  },
52231
- OPEN_EXPLANATION: function () {
52235
+ OPEN_EXPLANATION: () => {
52232
52236
  var _a;
52233
52237
  explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.add('is-visible');
52234
52238
  (_a = explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(data, PREDICT_BASE_URL);
52235
52239
  },
52236
- CLOSE_EXPLANATION: function () { return explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.remove('is-visible'); },
52237
- AUTH_ERROR_EXPLANATION: function () {
52240
+ CLOSE_EXPLANATION: () => explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.remove('is-visible'),
52241
+ AUTH_ERROR_EXPLANATION: () => {
52238
52242
  explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.remove('is-visible');
52239
- var iframe = $('frameFloatingModal');
52243
+ const iframe = $('frameFloatingModal');
52240
52244
  // eslint-disable-next-line no-self-assign
52241
52245
  if (iframe)
52242
52246
  iframe.src = iframe.src;
52243
52247
  },
52244
- DATA_READY: function () {
52248
+ DATA_READY: () => {
52245
52249
  floatingModal === null || floatingModal === void 0 ? void 0 : floatingModal.classList.add('is-visible');
52246
52250
  setFloatingModalSize();
52247
52251
  // Use analysisIds from the message data if available, otherwise use all IDs
52248
- var idsToShow = data.analysisIds || [];
52249
- for (var i = 0; i < idsToShow.length; i++) {
52250
- var frame = $("frameExplanation-".concat(idsToShow[i]));
52252
+ const idsToShow = data.analysisIds || [];
52253
+ for (let i = 0; i < idsToShow.length; i++) {
52254
+ const frame = $(`frameExplanation-${idsToShow[i]}`);
52251
52255
  if (frame)
52252
52256
  frame.classList.add('is-exists');
52253
52257
  }
52254
52258
  },
52255
- AUTH_ERROR: function () {
52259
+ AUTH_ERROR: () => {
52256
52260
  floatingModal === null || floatingModal === void 0 ? void 0 : floatingModal.classList.add('is-visible');
52257
52261
  setFloatingModalSize();
52258
52262
  },
52259
52263
  CLOSE_FLOATING_MODAL: cleanup,
52260
- EXPAND_FLOATING_MODAL: function () {
52264
+ EXPAND_FLOATING_MODAL: () => {
52261
52265
  setFloatingModalSize();
52262
52266
  setFloatingModalCollapsedState(false);
52263
52267
  },
52264
- COLLAPSE_FLOATING_MODAL: function () {
52268
+ COLLAPSE_FLOATING_MODAL: () => {
52265
52269
  setFloatingModalSize();
52266
52270
  setFloatingModalCollapsedState(true);
52267
52271
  }
52268
52272
  };
52269
52273
  if (type && type in actions) {
52270
- (_b = actions === null || actions === void 0 ? void 0 : actions[type]) === null || _b === void 0 ? void 0 : _b.call(actions);
52274
+ (_a = actions === null || actions === void 0 ? void 0 : actions[type]) === null || _a === void 0 ? void 0 : _a.call(actions);
52271
52275
  }
52272
52276
  };
52273
52277
  window.addEventListener('message', messageHandler);
52274
- return function () { return window.removeEventListener('message', messageHandler); };
52278
+ return () => window.removeEventListener('message', messageHandler);
52275
52279
  };
52276
- var predictGuidesScript = function (_a) {
52277
- var _b;
52278
- var step = _a.step, pendo = _a.pendo, cleanupArray = _a.cleanupArray, cleanup = _a.cleanup, log = _a.log;
52280
+ const predictGuidesScript = ({ step, pendo, cleanupArray, cleanup, log }) => {
52281
+ var _a;
52279
52282
  log('[predict] initializing');
52280
52283
  // Before anything else, inject styles so that the guide will be hidden
52281
- var pendoContainerId = step === null || step === void 0 ? void 0 : step.containerId;
52284
+ const pendoContainerId = step === null || step === void 0 ? void 0 : step.containerId;
52282
52285
  injectStyles(pendoContainerId, log);
52283
52286
  if (cleanupArray.length > 0) {
52284
52287
  log('[predict] cleanupArray is not empty');
52285
52288
  return;
52286
52289
  }
52287
52290
  // ----- Extract Configuration -----
52288
- var guideButton = (_b = step.guideElement.find(GUIDE_BUTTON_IDENTIFIER)) === null || _b === void 0 ? void 0 : _b[0];
52291
+ const guideButton = (_a = step.guideElement.find(GUIDE_BUTTON_IDENTIFIER)) === null || _a === void 0 ? void 0 : _a[0];
52289
52292
  if (!guideButton) {
52290
52293
  log('[predict] no guide button found, aborting');
52291
52294
  return;
52292
52295
  }
52293
- var _c = safeParse(guideButton.textContent, {}, log), token = _c.token, configuration = __rest(_c, ["token"]);
52296
+ const _b = safeParse(guideButton.textContent, {}, log), { token } = _b, configuration = __rest(_b, ["token"]);
52294
52297
  if (!configuration || !token) {
52295
52298
  log('[predict] no configuration found, aborting');
52296
52299
  return;
52297
52300
  }
52298
- var recordRegex = new RegExp("/".concat(configuration.recordRegexName, "/([a-zA-Z0-9]+)(?:/|$)"));
52299
- var recordId = getRecordIdFromUrl(recordRegex, log);
52301
+ const recordRegex = new RegExp(`/${configuration.recordRegexName}/([a-zA-Z0-9]+)(?:/|$)`);
52302
+ const recordId = getRecordIdFromUrl(recordRegex, log);
52300
52303
  if (!recordId) {
52301
52304
  log('[predict] no recordId found in URL, aborting');
52302
52305
  return;
52303
52306
  }
52304
- cleanupArray.push(setupMessageListener({ token: token, forceAccountId: configuration === null || configuration === void 0 ? void 0 : configuration.forceAccountId, cleanup: cleanup, pendo: pendo }));
52305
- cleanupArray.push(createFloatingModal({ recordId: recordId, configuration: configuration }));
52307
+ cleanupArray.push(setupMessageListener({ token, forceAccountId: configuration === null || configuration === void 0 ? void 0 : configuration.forceAccountId, cleanup, pendo }));
52308
+ cleanupArray.push(createFloatingModal({ recordId, configuration }));
52306
52309
  };
52307
52310
 
52308
52311
  const PredictGuides = () => {