@pendo/agent 2.321.0 → 2.321.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3967,8 +3967,8 @@ let SERVER = '';
3967
3967
  let ASSET_HOST = '';
3968
3968
  let ASSET_PATH = '';
3969
3969
  let DESIGNER_SERVER = '';
3970
- let VERSION = '2.321.0_';
3971
- let PACKAGE_VERSION = '2.321.0';
3970
+ let VERSION = '2.321.1_';
3971
+ let PACKAGE_VERSION = '2.321.1';
3972
3972
  let LOADER = 'xhr';
3973
3973
  /* eslint-enable web-sdk-eslint-rules/no-gulp-env-references */
3974
3974
  /**
@@ -40707,19 +40707,17 @@ function TextCapture() {
40707
40707
  }
40708
40708
  }
40709
40709
 
40710
- var substitutionRegex = '\\{(?:\\s?)([^.\\s]?visitor|account|parentAccount)\\.([^|\\s/]*)(?:\\s?\\|\\s?([^}]+|[\\/s]+))?(?:\\s?\\/\\s?){1}\\}';
40711
- var skipStepString = '{skipStep:* *(auto|\\d+)\\/}';
40712
- var goToMiddleString = '(?!0)(\\d+)';
40713
- var goToString = "({goto-".concat(goToMiddleString, "\\/})");
40714
- var containerSelector = '[id^="pendo-guide-container"]';
40715
- function lookupGuideButtons(domJson, buttons) {
40716
- if (buttons === void 0) { buttons = []; }
40710
+ const substitutionRegex = '\\{(?:\\s?)([^.\\s]?visitor|account|parentAccount)\\.([^|\\s/]*)(?:\\s?\\|\\s?([^}]+|[\\/s]+))?(?:\\s?\\/\\s?){1}\\}';
40711
+ const skipStepString = '{skipStep:* *(auto|\\d+)\\/}';
40712
+ const goToMiddleString = '(?!0)(\\d+)';
40713
+ const goToString = `({goto-${goToMiddleString}\\/})`;
40714
+ const containerSelector = '[id^="pendo-guide-container"]';
40715
+ function lookupGuideButtons(domJson, buttons = []) {
40717
40716
  if (domJson.type === 'button' && domJson.actions) {
40718
40717
  buttons.push(domJson);
40719
40718
  }
40720
40719
  if (domJson.children) {
40721
- for (var _i = 0, _a = domJson.children; _i < _a.length; _i++) {
40722
- var child = _a[_i];
40720
+ for (const child of domJson.children) {
40723
40721
  lookupGuideButtons(child, buttons);
40724
40722
  }
40725
40723
  }
@@ -40748,16 +40746,15 @@ function removeMarkdownSyntax(element, textToReplace, replacementText, pendo) {
40748
40746
  }
40749
40747
  }
40750
40748
  var guideMarkdownUtil = {
40751
- substitutionRegex: substitutionRegex,
40752
- skipStepString: skipStepString,
40753
- goToString: goToString,
40754
- containerSelector: containerSelector,
40755
- lookupGuideButtons: lookupGuideButtons,
40756
- removeMarkdownSyntax: removeMarkdownSyntax
40749
+ substitutionRegex,
40750
+ skipStepString,
40751
+ goToString,
40752
+ containerSelector,
40753
+ lookupGuideButtons,
40754
+ removeMarkdownSyntax
40757
40755
  };
40758
40756
 
40759
- function getZoneSafeMethod(_, method, target) {
40760
- if (target === void 0) { target = window; }
40757
+ function getZoneSafeMethod(_, method, target = window) {
40761
40758
  var zoneSymbol = '__symbol__';
40762
40759
  /* global Zone */
40763
40760
  if (typeof Zone !== 'undefined' && _.isFunction(Zone[zoneSymbol])) {
@@ -40770,20 +40767,20 @@ function getZoneSafeMethod(_, method, target) {
40770
40767
  }
40771
40768
 
40772
40769
  // Does not support submit and go to
40773
- var goToRegex = new RegExp(guideMarkdownUtil.goToString);
40774
- var PollBranching = {
40770
+ const goToRegex = new RegExp(guideMarkdownUtil.goToString);
40771
+ const PollBranching = {
40775
40772
  name: 'PollBranching',
40776
- script: function (step, guide, pendo) {
40777
- var isAdvanceIntercepted = false;
40778
- var branchingQuestions = initialBranchingSetup(step, pendo);
40773
+ script(step, guide, pendo) {
40774
+ let isAdvanceIntercepted = false;
40775
+ const branchingQuestions = initialBranchingSetup(step, pendo);
40779
40776
  if (branchingQuestions) {
40780
40777
  // If there are too many branching questions saved, exit and run the guide normally.
40781
40778
  if (pendo._.size(branchingQuestions) > 1)
40782
40779
  return;
40783
- this.on('beforeAdvance', function (evt) {
40784
- var noResponseSelected = step.guideElement.find('[branching] .pendo-radio:checked').length === 0;
40785
- var responseLabel = step.guideElement.find('[branching] .pendo-radio:checked + label')[0];
40786
- var noGotoLabel;
40780
+ this.on('beforeAdvance', (evt) => {
40781
+ const noResponseSelected = step.guideElement.find('[branching] .pendo-radio:checked').length === 0;
40782
+ const responseLabel = step.guideElement.find('[branching] .pendo-radio:checked + label')[0];
40783
+ let noGotoLabel;
40787
40784
  if (responseLabel) {
40788
40785
  noGotoLabel = pendo._.isNull(responseLabel.getAttribute('goToStep'));
40789
40786
  }
@@ -40794,58 +40791,58 @@ var PollBranching = {
40794
40791
  });
40795
40792
  }
40796
40793
  },
40797
- test: function (step, guide, pendo) {
40794
+ test(step, guide, pendo) {
40798
40795
  var _a;
40799
- var branchingQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
40796
+ let branchingQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
40800
40797
  return !pendo._.isUndefined(branchingQuestions) && pendo._.size(branchingQuestions);
40801
40798
  },
40802
- designerListener: function (pendo) {
40803
- var target = pendo.dom.getBody();
40804
- var config = {
40799
+ designerListener(pendo) {
40800
+ const target = pendo.dom.getBody();
40801
+ const config = {
40805
40802
  attributeFilter: ['data-layout'],
40806
40803
  attributes: true,
40807
40804
  childList: true,
40808
40805
  characterData: true,
40809
40806
  subtree: true
40810
40807
  };
40811
- var MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
40812
- var observer = new MutationObserver(applyBranchingIndicators);
40808
+ const MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
40809
+ const observer = new MutationObserver(applyBranchingIndicators);
40813
40810
  observer.observe(target, config);
40814
40811
  function applyBranchingIndicators(mutations) {
40815
40812
  pendo._.each(mutations, function (mutation) {
40816
40813
  var _a;
40817
- var nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelector);
40814
+ const nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelector);
40818
40815
  if (mutation.addedNodes.length && nodeHasQuerySelector) {
40819
40816
  if (mutation.addedNodes[0].querySelector('._pendo-multi-choice-poll-select-border')) {
40820
40817
  if (pendo._.size(pendo.dom('._pendo-multi-choice-poll-question:contains("{branching/}")'))) {
40821
40818
  pendo
40822
40819
  .dom('._pendo-multi-choice-poll-question:contains("{branching/}")')
40823
- .each(function (question, index) {
40824
- pendo._.each(pendo.dom("#".concat(question.id, " *")), function (element) {
40820
+ .each((question, index) => {
40821
+ pendo._.each(pendo.dom(`#${question.id} *`), (element) => {
40825
40822
  guideMarkdownUtil.removeMarkdownSyntax(element, '{branching/}', '', pendo);
40826
40823
  });
40827
40824
  pendo
40828
- .dom("#".concat(question.id, " p"))
40825
+ .dom(`#${question.id} p`)
40829
40826
  .css({ display: 'inline-block !important' })
40830
40827
  .append(branchingIcon('#999', '20px'))
40831
40828
  .attr({ title: 'Custom Branching Added' });
40832
- var dataPendoPollId = question.getAttribute('data-pendo-poll-id');
40833
- if (pendo.dom("._pendo-multi-choice-poll-question[data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0]) {
40829
+ let dataPendoPollId = question.getAttribute('data-pendo-poll-id');
40830
+ if (pendo.dom(`._pendo-multi-choice-poll-question[data-pendo-poll-id=${dataPendoPollId}]`)[0]) {
40834
40831
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
40835
40832
  pendo
40836
- .dom("._pendo-multi-choice-poll-question[data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0]
40833
+ .dom(`._pendo-multi-choice-poll-question[data-pendo-poll-id=${dataPendoPollId}]`)[0]
40837
40834
  .textContent.trim();
40838
40835
  }
40839
- var pollLabels = pendo.dom("label[for*=".concat(dataPendoPollId, "]"));
40836
+ let pollLabels = pendo.dom(`label[for*=${dataPendoPollId}]`);
40840
40837
  if (pendo._.size(pollLabels)) {
40841
- pendo._.forEach(pollLabels, function (label) {
40838
+ pendo._.forEach(pollLabels, (label) => {
40842
40839
  if (goToRegex.test(label.textContent)) {
40843
- var labelTitle = goToRegex.exec(label.textContent)[2];
40840
+ let labelTitle = goToRegex.exec(label.textContent)[2];
40844
40841
  guideMarkdownUtil.removeMarkdownSyntax(label, goToRegex, '', pendo);
40845
40842
  pendo
40846
40843
  .dom(label)
40847
40844
  .append(branchingIcon('#999', '14px'))
40848
- .attr({ title: "Branching to step ".concat(labelTitle) });
40845
+ .attr({ title: `Branching to step ${labelTitle}` });
40849
40846
  }
40850
40847
  });
40851
40848
  }
@@ -40853,9 +40850,9 @@ var PollBranching = {
40853
40850
  pendo
40854
40851
  .dom(question)
40855
40852
  .append(branchingErrorHTML(question.dataset.pendoPollId));
40856
- pendo.dom("#".concat(question.id, " #pendo-ps-branching-svg")).remove();
40853
+ pendo.dom(`#${question.id} #pendo-ps-branching-svg`).remove();
40857
40854
  pendo
40858
- .dom("#".concat(question.id, " p"))
40855
+ .dom(`#${question.id} p`)
40859
40856
  .css({ display: 'inline-block !important' })
40860
40857
  .append(branchingIcon('red', '20px'))
40861
40858
  .attr({ title: 'Unsupported Branching configuration' });
@@ -40867,31 +40864,49 @@ var PollBranching = {
40867
40864
  });
40868
40865
  }
40869
40866
  function branchingErrorHTML(dataPendoPollId) {
40870
- 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>");
40867
+ return `<div style="text-align:lrft; font-size: 14px; color: red;
40868
+ font-style: italic; margin-top: 0px;" class="branching-wrapper"
40869
+ name="${dataPendoPollId}">
40870
+ * Branching Error: Multiple branching polls not supported</div>`;
40871
40871
  }
40872
40872
  function branchingIcon(color, size) {
40873
- 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>");
40873
+ return `<svg id="pendo-ps-branching-svg" viewBox="0 0 24 24" fill="none"
40874
+ style="margin-left: 5px;
40875
+ height:${size}; width:${size}; display:inline; vertical-align:middle;" xmlns="http://www.w3.org/2000/svg">
40876
+ <g stroke-width="0"></g>
40877
+ <g stroke-linecap="round" stroke-linejoin="round"></g>
40878
+ <g> <circle cx="4" cy="7" r="2" stroke="${color}"
40879
+ stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></circle>
40880
+ <circle cx="20" cy="7" r="2" stroke="${color}"
40881
+ stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></circle>
40882
+ <circle cx="20" cy="17" r="2" stroke="${color}" stroke-width="2"
40883
+ stroke-linecap="round" stroke-linejoin="round"></circle>
40884
+ <path d="M18 7H6" stroke="${color}" stroke-width="2"
40885
+ stroke-linecap="round" stroke-linejoin="round"></path>
40886
+ <path d="M7 7V7C8.65685 7 10 8.34315 10 10V15C10 16.1046 10.8954 17 12 17H18"
40887
+ stroke="${color}" stroke-width="2" stroke-linecap="round"
40888
+ stroke-linejoin="round"></path> </g></svg>`;
40874
40889
  }
40875
40890
  }
40876
40891
  };
40877
40892
  function initialBranchingSetup(step, pendo) {
40878
- var questions = step.guideElement.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
40879
- pendo._.forEach(questions, function (question) {
40880
- var dataPendoPollId = question.getAttribute('data-pendo-poll-id');
40881
- pendo._.each(step.guideElement.find("#".concat(question.id, " *")), function (element) {
40893
+ const questions = step.guideElement.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
40894
+ pendo._.forEach(questions, (question) => {
40895
+ let dataPendoPollId = question.getAttribute('data-pendo-poll-id');
40896
+ pendo._.each(step.guideElement.find(`#${question.id} *`), (element) => {
40882
40897
  guideMarkdownUtil.removeMarkdownSyntax(element, '{branching/}', '', pendo);
40883
40898
  });
40884
- var pollLabels = step.guideElement.find("label[for*=".concat(dataPendoPollId, "]"));
40885
- pendo._.forEach(pollLabels, function (label) {
40899
+ let pollLabels = step.guideElement.find(`label[for*=${dataPendoPollId}]`);
40900
+ pendo._.forEach(pollLabels, (label) => {
40886
40901
  if (pendo._.isNull(goToRegex.exec(label.textContent))) {
40887
40902
  return;
40888
40903
  }
40889
- var gotoSubstring = goToRegex.exec(label.textContent)[1];
40890
- var gotoIndex = goToRegex.exec(label.textContent)[2];
40904
+ let gotoSubstring = goToRegex.exec(label.textContent)[1];
40905
+ let gotoIndex = goToRegex.exec(label.textContent)[2];
40891
40906
  label.setAttribute('goToStep', gotoIndex);
40892
40907
  guideMarkdownUtil.removeMarkdownSyntax(label, gotoSubstring, '', pendo);
40893
40908
  });
40894
- var pollChoiceContainer = step.guideElement.find("[data-pendo-poll-id=".concat(dataPendoPollId, "]._pendo-multi-choice-poll-select-border"));
40909
+ let pollChoiceContainer = step.guideElement.find(`[data-pendo-poll-id=${dataPendoPollId}]._pendo-multi-choice-poll-select-border`);
40895
40910
  if (pollChoiceContainer && pollChoiceContainer.length) {
40896
40911
  pollChoiceContainer[0].setAttribute('branching', '');
40897
40912
  }
@@ -40900,24 +40915,24 @@ function initialBranchingSetup(step, pendo) {
40900
40915
  }
40901
40916
  function branchingGoToStep(event, step, guide, pendo) {
40902
40917
  var _a;
40903
- var checkedPollInputId = (_a = step.guideElement.find('[branching] input.pendo-radio[data-pendo-poll-id]:checked')[0]) === null || _a === void 0 ? void 0 : _a.id;
40904
- var checkedPollLabel = step.guideElement.find("label[for=\"".concat(checkedPollInputId, "\"]"))[0];
40905
- var checkedPollLabelStepIndex = checkedPollLabel === null || checkedPollLabel === void 0 ? void 0 : checkedPollLabel.getAttribute('goToStep');
40906
- var pollStepIndex = checkedPollLabelStepIndex - 1;
40918
+ let checkedPollInputId = (_a = step.guideElement.find('[branching] input.pendo-radio[data-pendo-poll-id]:checked')[0]) === null || _a === void 0 ? void 0 : _a.id;
40919
+ let checkedPollLabel = step.guideElement.find(`label[for="${checkedPollInputId}"]`)[0];
40920
+ let checkedPollLabelStepIndex = checkedPollLabel === null || checkedPollLabel === void 0 ? void 0 : checkedPollLabel.getAttribute('goToStep');
40921
+ let pollStepIndex = checkedPollLabelStepIndex - 1;
40907
40922
  if (pollStepIndex < 0)
40908
40923
  return;
40909
- var destinationObject = {
40924
+ const destinationObject = {
40910
40925
  destinationStepId: guide.steps[pollStepIndex].id,
40911
- step: step
40926
+ step
40912
40927
  };
40913
40928
  pendo.goToStep(destinationObject);
40914
40929
  event.cancel = true;
40915
40930
  }
40916
40931
 
40917
- var MetadataSubstitution = {
40932
+ const MetadataSubstitution = {
40918
40933
  name: 'MetadataSubstitution',
40919
- script: function (step, guide, pendo) {
40920
- var placeholderData = findSubstitutableElements(pendo);
40934
+ script(step, guide, pendo) {
40935
+ const placeholderData = findSubstitutableElements(pendo);
40921
40936
  if (step.domJson) {
40922
40937
  findSubstitutableUrlsInJson(step.domJson, placeholderData, pendo);
40923
40938
  }
@@ -40925,22 +40940,22 @@ var MetadataSubstitution = {
40925
40940
  pendo._.each(placeholderData, function (placeholder) {
40926
40941
  processPlaceholder(placeholder, pendo);
40927
40942
  });
40928
- var containerId = "pendo-g-".concat(step.id);
40929
- var context_1 = step.guideElement;
40930
- updateGuideContainer(containerId, context_1, pendo);
40943
+ const containerId = `pendo-g-${step.id}`;
40944
+ const context = step.guideElement;
40945
+ updateGuideContainer(containerId, context, pendo);
40931
40946
  }
40932
40947
  },
40933
- designerListener: function (pendo) {
40934
- var target = pendo.dom.getBody();
40948
+ designerListener(pendo) {
40949
+ const target = pendo.dom.getBody();
40935
40950
  if (pendo.designerv2) {
40936
40951
  pendo.designerv2.runMetadataSubstitutionForDesignerPreview = function runMetadataSubstitutionForDesignerPreview() {
40937
40952
  var _a;
40938
40953
  if (!document.querySelector(guideMarkdownUtil.containerSelector))
40939
40954
  return;
40940
- var step = (_a = pendo.designerv2.currentlyPreviewedGuide) === null || _a === void 0 ? void 0 : _a.steps[0];
40955
+ const step = (_a = pendo.designerv2.currentlyPreviewedGuide) === null || _a === void 0 ? void 0 : _a.steps[0];
40941
40956
  if (!step)
40942
40957
  return;
40943
- var placeholderData = findSubstitutableElements(pendo);
40958
+ const placeholderData = findSubstitutableElements(pendo);
40944
40959
  if (step.buildingBlocks) {
40945
40960
  findSubstitutableUrlsInJson(step.buildingBlocks, placeholderData, pendo);
40946
40961
  }
@@ -40950,32 +40965,32 @@ var MetadataSubstitution = {
40950
40965
  return;
40951
40966
  processPlaceholder(placeholder, pendo);
40952
40967
  });
40953
- var containerId = "pendo-g-".concat(step.id);
40954
- var context_2 = step.guideElement;
40955
- updateGuideContainer(containerId, context_2, pendo);
40968
+ const containerId = `pendo-g-${step.id}`;
40969
+ const context = step.guideElement;
40970
+ updateGuideContainer(containerId, context, pendo);
40956
40971
  }
40957
40972
  };
40958
40973
  }
40959
- var config = {
40974
+ const config = {
40960
40975
  attributeFilter: ['data-layout'],
40961
40976
  attributes: true,
40962
40977
  childList: true,
40963
40978
  characterData: true,
40964
40979
  subtree: true
40965
40980
  };
40966
- var MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
40967
- var observer = new MutationObserver(applySubstitutionIndicators);
40981
+ const MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
40982
+ const observer = new MutationObserver(applySubstitutionIndicators);
40968
40983
  observer.observe(target, config);
40969
40984
  function applySubstitutionIndicators(mutations) {
40970
40985
  pendo._.each(mutations, function (mutation) {
40971
40986
  var _a;
40972
40987
  if (mutation.addedNodes.length) {
40973
40988
  if (document.querySelector(guideMarkdownUtil.containerSelector)) {
40974
- var placeholderData = findSubstitutableElements(pendo);
40975
- var step = (_a = pendo.designerv2.currentlyPreviewedGuide) === null || _a === void 0 ? void 0 : _a.steps[0];
40989
+ const placeholderData = findSubstitutableElements(pendo);
40990
+ const step = (_a = pendo.designerv2.currentlyPreviewedGuide) === null || _a === void 0 ? void 0 : _a.steps[0];
40976
40991
  if (!step)
40977
40992
  return;
40978
- var pendoBlocks = step.buildingBlocks;
40993
+ const pendoBlocks = step.buildingBlocks;
40979
40994
  if (!pendo._.isUndefined(pendoBlocks)) {
40980
40995
  findSubstitutableUrlsInJson(pendoBlocks, placeholderData, pendo);
40981
40996
  }
@@ -40985,9 +41000,9 @@ var MetadataSubstitution = {
40985
41000
  return;
40986
41001
  processPlaceholder(placeholder, pendo);
40987
41002
  });
40988
- var containerId = "pendo-g-".concat(step.id);
40989
- var context_3 = step.guideElement;
40990
- updateGuideContainer(containerId, context_3, pendo);
41003
+ const containerId = `pendo-g-${step.id}`;
41004
+ const context = step.guideElement;
41005
+ updateGuideContainer(containerId, context, pendo);
40991
41006
  }
40992
41007
  }
40993
41008
  }
@@ -40996,18 +41011,18 @@ var MetadataSubstitution = {
40996
41011
  }
40997
41012
  };
40998
41013
  function processPlaceholder(placeholder, pendo) {
40999
- var match;
41000
- var data = placeholder.data, target = placeholder.target;
41001
- var subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
41014
+ let match;
41015
+ const { data, target } = placeholder;
41016
+ const subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
41002
41017
  while ((match = matchPlaceholder(placeholder, subRegex))) {
41003
- var usedArrayPath = Array.isArray(match) && match.length >= 2;
41004
- var currentStr = target === 'textContent'
41018
+ const usedArrayPath = Array.isArray(match) && match.length >= 2;
41019
+ const currentStr = target === 'textContent'
41005
41020
  ? data[target]
41006
41021
  : decodeURI((data.getAttribute && (target === 'href' || target === 'value') ? (data.getAttribute(target) || '') : data[target]));
41007
- var matched = usedArrayPath ? match : subRegex.exec(currentStr);
41022
+ const matched = usedArrayPath ? match : subRegex.exec(currentStr);
41008
41023
  if (!matched)
41009
41024
  continue;
41010
- var mdValue = getSubstituteValue(matched, pendo);
41025
+ const mdValue = getSubstituteValue(matched, pendo);
41011
41026
  substituteMetadataByTarget(data, target, mdValue, matched);
41012
41027
  }
41013
41028
  }
@@ -41016,48 +41031,48 @@ function matchPlaceholder(placeholder, regex) {
41016
41031
  return placeholder.data[placeholder.target].match(regex);
41017
41032
  }
41018
41033
  else {
41019
- var raw = placeholder.data.getAttribute && (placeholder.target === 'href' || placeholder.target === 'value')
41034
+ const raw = placeholder.data.getAttribute && (placeholder.target === 'href' || placeholder.target === 'value')
41020
41035
  ? (placeholder.data.getAttribute(placeholder.target) || '')
41021
41036
  : placeholder.data[placeholder.target];
41022
41037
  return decodeURI(raw).match(regex);
41023
41038
  }
41024
41039
  }
41025
41040
  function getMetadataValueCaseInsensitive(metadata, type, property) {
41026
- var kind = metadata && metadata[type];
41041
+ const kind = metadata && metadata[type];
41027
41042
  if (!kind || typeof kind !== 'object')
41028
41043
  return undefined;
41029
- var direct = Object.prototype.hasOwnProperty.call(kind, property) ? kind[property] : undefined;
41044
+ const direct = Object.prototype.hasOwnProperty.call(kind, property) ? kind[property] : undefined;
41030
41045
  if (direct !== undefined) {
41031
41046
  return direct;
41032
41047
  }
41033
- var propLower = property.toLowerCase();
41034
- var key = Object.keys(kind).find(function (k) { return k.toLowerCase() === propLower; });
41035
- var value = key !== undefined ? kind[key] : undefined;
41048
+ const propLower = property.toLowerCase();
41049
+ const key = Object.keys(kind).find(k => k.toLowerCase() === propLower);
41050
+ const value = key !== undefined ? kind[key] : undefined;
41036
41051
  return value;
41037
41052
  }
41038
41053
  function getSubstituteValue(match, pendo) {
41039
41054
  if (pendo._.isUndefined(match[1]) || pendo._.isUndefined(match[2])) {
41040
41055
  return;
41041
41056
  }
41042
- var type = match[1];
41043
- var property = match[2];
41044
- var defaultValue = match[3];
41057
+ let type = match[1];
41058
+ let property = match[2];
41059
+ let defaultValue = match[3];
41045
41060
  if (pendo._.isUndefined(type) || pendo._.isUndefined(property)) {
41046
41061
  return;
41047
41062
  }
41048
- var metadata = pendo.getSerializedMetadata();
41049
- var mdValue = getMetadataValueCaseInsensitive(metadata, type, property);
41063
+ const metadata = pendo.getSerializedMetadata();
41064
+ let mdValue = getMetadataValueCaseInsensitive(metadata, type, property);
41050
41065
  if (mdValue === undefined || mdValue === null)
41051
41066
  mdValue = defaultValue || '';
41052
41067
  return mdValue;
41053
41068
  }
41054
41069
  function substituteMetadataByTarget(data, target, mdValue, matched) {
41055
- var isElement = data && typeof data.getAttribute === 'function';
41056
- var current = (target === 'href' || target === 'value') && isElement
41070
+ const isElement = data && typeof data.getAttribute === 'function';
41071
+ const current = (target === 'href' || target === 'value') && isElement
41057
41072
  ? (data.getAttribute(target) || '')
41058
41073
  : data[target];
41059
41074
  if (target === 'href' || target === 'value') {
41060
- var safeValue = window.encodeURIComponent(String(mdValue === undefined || mdValue === null ? '' : mdValue));
41075
+ const safeValue = window.encodeURIComponent(String(mdValue === undefined || mdValue === null ? '' : mdValue));
41061
41076
  data[target] = decodeURI(current).replace(matched[0], safeValue);
41062
41077
  }
41063
41078
  else {
@@ -41071,9 +41086,8 @@ function updateGuideContainer(containerId, context, pendo) {
41071
41086
  pendo.flexElement(pendo.dom(guideMarkdownUtil.containerSelector));
41072
41087
  pendo.BuildingBlocks.BuildingBlockGuides.recalculateGuideHeight(containerId, context);
41073
41088
  }
41074
- function findSubstitutableUrlsInJson(originalData, placeholderData, pendo) {
41075
- if (placeholderData === void 0) { placeholderData = []; }
41076
- var subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
41089
+ function findSubstitutableUrlsInJson(originalData, placeholderData = [], pendo) {
41090
+ const subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
41077
41091
  if ((originalData.name === 'url' || originalData.name === 'href') && originalData.value) {
41078
41092
  if (subRegex.test(originalData.value)) {
41079
41093
  placeholderData.push({
@@ -41083,37 +41097,37 @@ function findSubstitutableUrlsInJson(originalData, placeholderData, pendo) {
41083
41097
  }
41084
41098
  }
41085
41099
  if (originalData.properties && originalData.id === 'href_link_block') {
41086
- pendo._.each(originalData.properties, function (prop) {
41100
+ pendo._.each(originalData.properties, (prop) => {
41087
41101
  findSubstitutableUrlsInJson(prop, placeholderData, pendo);
41088
41102
  });
41089
41103
  }
41090
41104
  if (originalData.views) {
41091
- pendo._.each(originalData.views, function (view) {
41105
+ pendo._.each(originalData.views, (view) => {
41092
41106
  findSubstitutableUrlsInJson(view, placeholderData, pendo);
41093
41107
  });
41094
41108
  }
41095
41109
  if (originalData.parameters) {
41096
- pendo._.each(originalData.parameters, function (param) {
41110
+ pendo._.each(originalData.parameters, (param) => {
41097
41111
  findSubstitutableUrlsInJson(param, placeholderData, pendo);
41098
41112
  });
41099
41113
  }
41100
41114
  if (originalData.actions) {
41101
- pendo._.each(originalData.actions, function (action) {
41115
+ pendo._.each(originalData.actions, (action) => {
41102
41116
  findSubstitutableUrlsInJson(action, placeholderData, pendo);
41103
41117
  });
41104
41118
  }
41105
41119
  if (originalData.children) {
41106
- pendo._.each(originalData.children, function (child) {
41120
+ pendo._.each(originalData.children, (child) => {
41107
41121
  findSubstitutableUrlsInJson(child, placeholderData, pendo);
41108
41122
  });
41109
41123
  }
41110
41124
  return placeholderData;
41111
41125
  }
41112
41126
  function findSubstitutableElements(pendo) {
41113
- var elements = pendo.dom("".concat(guideMarkdownUtil.containerSelector, " *:not(.pendo-inline-ui)"));
41127
+ let elements = pendo.dom(`${guideMarkdownUtil.containerSelector} *:not(.pendo-inline-ui)`);
41114
41128
  return pendo._.chain(elements)
41115
41129
  .filter(function (placeholder) {
41116
- var subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
41130
+ const subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
41117
41131
  if (placeholder.localName === 'a') {
41118
41132
  return subRegex.test(decodeURI(placeholder.href)) || subRegex.test(placeholder.textContent);
41119
41133
  }
@@ -41169,25 +41183,51 @@ function findSubstitutableElements(pendo) {
41169
41183
  .value();
41170
41184
  }
41171
41185
  function substitutionIcon(color, size) {
41172
- 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>"));
41173
- }
41174
-
41175
- var requiredElement = '<span class="_pendo-required-indicator" style="color:red; font-style:italic;" title="Question is required"> *</span>';
41176
- var requiredSyntax = '{required/}';
41177
- var RequiredQuestions = {
41186
+ return (`<div title="Metadata Substitution added">
41187
+ <svg id="pendo-ps-substitution-icon" viewBox="0 0 24 24"
41188
+ preserveAspectRatio="xMidYMid meet"
41189
+ height=${size} width=${size} title="Metadata Substitution"
41190
+ style="bottom:5px; right:10px; position: absolute;"
41191
+ fill="none" xmlns="http://www.w3.org/2000/svg" stroke="${color}"
41192
+ transform="matrix(1, 0, 0, 1, 0, 0)rotate(0)">
41193
+ <g stroke-width="0"></g>
41194
+ <g stroke-linecap="round" stroke-linejoin="round"
41195
+ stroke="${color}" stroke-width="0.528"></g>
41196
+ <g><path fill-rule="evenodd" clip-rule="evenodd"
41197
+ d="M5 5.5C4.17157 5.5 3.5 6.17157 3.5 7V10C3.5 10.8284
41198
+ 4.17157 11.5 5 11.5H8C8.82843 11.5 9.5 10.8284 9.5
41199
+ 10V9H17V11C17 11.2761 17.2239 11.5 17.5 11.5C17.7761
41200
+ 11.5 18 11.2761 18 11V8.5C18 8.22386 17.7761 8 17.5
41201
+ 8H9.5V7C9.5 6.17157 8.82843 5.5 8 5.5H5ZM8.5 7C8.5
41202
+ 6.72386 8.27614 6.5 8 6.5H5C4.72386 6.5 4.5 6.72386
41203
+ 4.5 7V10C4.5 10.2761 4.72386 10.5 5 10.5H8C8.27614
41204
+ 10.5 8.5 10.2761 8.5 10V7Z" fill="${color}"></path>
41205
+ <path fill-rule="evenodd" clip-rule="evenodd"
41206
+ d="M7 13C7 12.7239 6.77614 12.5 6.5 12.5C6.22386 12.5
41207
+ 6 12.7239 6 13V15.5C6 15.7761 6.22386 16 6.5
41208
+ 16H14.5V17C14.5 17.8284 15.1716 18.5 16 18.5H19C19.8284
41209
+ 18.5 20.5 17.8284 20.5 17V14C20.5 13.1716 19.8284 12.5
41210
+ 19 12.5H16C15.1716 12.5 14.5 13.1716 14.5
41211
+ 14V15H7V13ZM15.5 17C15.5 17.2761 15.7239 17.5 16
41212
+ 17.5H19C19.2761 17.5 19.5 17.2761 19.5 17V14C19.5
41213
+ 13.7239 19.2761 13.5 19 13.5H16C15.7239 13.5 15.5
41214
+ 13.7239 15.5 14V17Z" fill="${color}"></path> </g></svg></div>`);
41215
+ }
41216
+
41217
+ const requiredElement = '<span class="_pendo-required-indicator" style="color:red; font-style:italic;" title="Question is required"> *</span>';
41218
+ const requiredSyntax = '{required/}';
41219
+ const RequiredQuestions = {
41178
41220
  name: 'RequiredQuestions',
41179
- script: function (step, guide, pendo) {
41221
+ script(step, guide, pendo) {
41180
41222
  var _a;
41181
- var requiredPollIds = [];
41182
- var submitButtons = (_a = guideMarkdownUtil.lookupGuideButtons(step.domJson)) === null || _a === void 0 ? void 0 : _a.filter(function (button) {
41183
- return button.actions.find(function (action) { return action.action === 'submitPoll' || action.action === 'submitPollAndGoToStep'; });
41184
- });
41185
- var requiredQuestions = processRequiredQuestions();
41223
+ let requiredPollIds = [];
41224
+ 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'));
41225
+ const requiredQuestions = processRequiredQuestions();
41186
41226
  if (requiredQuestions) {
41187
- pendo._.forEach(requiredQuestions, function (question) {
41227
+ pendo._.forEach(requiredQuestions, (question) => {
41188
41228
  if (question.classList.contains('_pendo-open-text-poll-question')) {
41189
- var pollId = question.dataset.pendoPollId;
41190
- step.attachEvent(step.guideElement.find("[data-pendo-poll-id=".concat(pollId, "]._pendo-open-text-poll-input"))[0], 'input', function () {
41229
+ let pollId = question.dataset.pendoPollId;
41230
+ step.attachEvent(step.guideElement.find(`[data-pendo-poll-id=${pollId}]._pendo-open-text-poll-input`)[0], 'input', function () {
41191
41231
  evaluateRequiredQuestions(requiredQuestions);
41192
41232
  });
41193
41233
  }
@@ -41199,8 +41239,8 @@ var RequiredQuestions = {
41199
41239
  });
41200
41240
  }
41201
41241
  function getEligibleQuestions() {
41202
- var allQuestions = step.guideElement.find("[class*=-poll-question]:contains(".concat(requiredSyntax, ")"));
41203
- return pendo._.reduce(allQuestions, function (eligibleQuestions, question) {
41242
+ const allQuestions = step.guideElement.find(`[class*=-poll-question]:contains(${requiredSyntax})`);
41243
+ return pendo._.reduce(allQuestions, (eligibleQuestions, question) => {
41204
41244
  if (question.classList.contains('_pendo-yes-no-poll-question'))
41205
41245
  return eligibleQuestions;
41206
41246
  eligibleQuestions.push(question);
@@ -41208,19 +41248,27 @@ var RequiredQuestions = {
41208
41248
  }, []);
41209
41249
  }
41210
41250
  function processRequiredQuestions() {
41211
- var questions = getEligibleQuestions();
41251
+ let questions = getEligibleQuestions();
41212
41252
  if (questions) {
41213
- pendo._.forEach(questions, function (question) {
41214
- var dataPendoPollId = question.getAttribute('data-pendo-poll-id');
41253
+ pendo._.forEach(questions, question => {
41254
+ let dataPendoPollId = question.getAttribute('data-pendo-poll-id');
41215
41255
  requiredPollIds.push(dataPendoPollId);
41216
- pendo._.each(step.guideElement.find("#".concat(question.id, " *, #").concat(question.id)), function (element) {
41256
+ pendo._.each(step.guideElement.find(`#${question.id} *, #${question.id}`), (element) => {
41217
41257
  guideMarkdownUtil.removeMarkdownSyntax(element, requiredSyntax, '', pendo);
41218
41258
  });
41219
- step.guideElement.find("#".concat(question.id, " p")).append(requiredElement);
41259
+ step.guideElement.find(`#${question.id} p`).append(requiredElement);
41220
41260
  });
41221
41261
  }
41222
41262
  if (pendo._.size(requiredPollIds)) {
41223
- 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>";
41263
+ const disabledButtonStyles = `<style type=text/css
41264
+ id=_pendo-guide-required-disabled>
41265
+ ._pendo-button:disabled, ._pendo-buttons[disabled] {
41266
+ border: 1px solid #999999 !important;
41267
+ background-color: #cccccc !important;
41268
+ color: #666666 !important;
41269
+ pointer-events: none !important;
41270
+ }
41271
+ </style>`;
41224
41272
  if (pendo.dom('#_pendo-guide-required-disabled').length === 0) {
41225
41273
  pendo.dom('head').append(disabledButtonStyles);
41226
41274
  }
@@ -41231,11 +41279,15 @@ var RequiredQuestions = {
41231
41279
  function evaluateRequiredQuestions(questions) {
41232
41280
  if (questions.length === 0)
41233
41281
  return;
41234
- var allRequiredComplete = true;
41235
- var responses = [];
41236
- responses = responses.concat(pendo._.map(questions, function (question) {
41237
- var pollId = question.getAttribute('data-pendo-poll-id');
41238
- 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"));
41282
+ let allRequiredComplete = true;
41283
+ let responses = [];
41284
+ responses = responses.concat(pendo._.map(questions, (question) => {
41285
+ let pollId = question.getAttribute('data-pendo-poll-id');
41286
+ let input = step.guideElement.find(`
41287
+ [data-pendo-poll-id=${pollId}] textarea,
41288
+ [data-pendo-poll-id=${pollId}] input:text,
41289
+ [data-pendo-poll-id=${pollId}] select,
41290
+ [data-pendo-poll-id=${pollId}] input:radio:checked`);
41239
41291
  if (input && input.length && input[0].value) {
41240
41292
  return input[0].value;
41241
41293
  }
@@ -41252,48 +41304,48 @@ var RequiredQuestions = {
41252
41304
  }
41253
41305
  function disableEligibleButtons(buttons) {
41254
41306
  pendo._.each(buttons, function (button) {
41255
- if (step.guideElement.find("#".concat(button.props.id))[0]) {
41256
- step.guideElement.find("#".concat(button.props.id))[0].disabled = true;
41257
- step.guideElement.find("#".concat(button.props.id))[0].parentElement.title = 'Please complete all required questions.';
41307
+ if (step.guideElement.find(`#${button.props.id}`)[0]) {
41308
+ step.guideElement.find(`#${button.props.id}`)[0].disabled = true;
41309
+ step.guideElement.find(`#${button.props.id}`)[0].parentElement.title = 'Please complete all required questions.';
41258
41310
  }
41259
41311
  });
41260
41312
  }
41261
41313
  function enableEligibleButtons(buttons) {
41262
41314
  pendo._.each(buttons, function (button) {
41263
- if (step.guideElement.find("#".concat(button.props.id))[0]) {
41264
- step.guideElement.find("#".concat(button.props.id))[0].disabled = false;
41265
- step.guideElement.find("#".concat(button.props.id))[0].parentElement.title = '';
41315
+ if (step.guideElement.find(`#${button.props.id}`)[0]) {
41316
+ step.guideElement.find(`#${button.props.id}`)[0].disabled = false;
41317
+ step.guideElement.find(`#${button.props.id}`)[0].parentElement.title = '';
41266
41318
  }
41267
41319
  });
41268
41320
  }
41269
41321
  },
41270
- test: function (step, guide, pendo) {
41322
+ test(step, guide, pendo) {
41271
41323
  var _a;
41272
- var requiredQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find("[class*=-poll-question]:contains(".concat(requiredSyntax, ")"));
41324
+ let requiredQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find(`[class*=-poll-question]:contains(${requiredSyntax})`);
41273
41325
  return !pendo._.isUndefined(requiredQuestions) && pendo._.size(requiredQuestions);
41274
41326
  },
41275
- designerListener: function (pendo) {
41276
- var requiredQuestions = [];
41277
- var target = pendo.dom.getBody();
41278
- var config = {
41327
+ designerListener(pendo) {
41328
+ const requiredQuestions = [];
41329
+ const target = pendo.dom.getBody();
41330
+ const config = {
41279
41331
  attributeFilter: ['data-layout'],
41280
41332
  attributes: true,
41281
41333
  childList: true,
41282
41334
  characterData: true,
41283
41335
  subtree: true
41284
41336
  };
41285
- var MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
41286
- var observer = new MutationObserver(applyRequiredIndicators);
41337
+ const MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
41338
+ const observer = new MutationObserver(applyRequiredIndicators);
41287
41339
  observer.observe(target, config);
41288
41340
  function applyRequiredIndicators(mutations) {
41289
41341
  pendo._.each(mutations, function (mutation) {
41290
41342
  var _a;
41291
- var nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
41343
+ const nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
41292
41344
  if (mutation.addedNodes.length && nodeHasQuerySelector) {
41293
- var eligiblePolls = mutation.addedNodes[0].querySelectorAll('[class*=-poll-wrapper], [class*=-poll-select-border]');
41345
+ let eligiblePolls = mutation.addedNodes[0].querySelectorAll('[class*=-poll-wrapper], [class*=-poll-select-border]');
41294
41346
  if (eligiblePolls) {
41295
41347
  pendo._.each(eligiblePolls, function (poll) {
41296
- var dataPendoPollId;
41348
+ let dataPendoPollId;
41297
41349
  if (poll.classList.contains('_pendo-open-text-poll-wrapper') ||
41298
41350
  poll.classList.contains('_pendo-number-scale-poll-wrapper')) {
41299
41351
  dataPendoPollId = poll.getAttribute('name');
@@ -41301,27 +41353,27 @@ var RequiredQuestions = {
41301
41353
  else {
41302
41354
  dataPendoPollId = poll.getAttribute('data-pendo-poll-id');
41303
41355
  }
41304
- var questionText;
41305
- var pollQuesiton = pendo.dom("[class*=\"-poll-question\"][data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0];
41356
+ let questionText;
41357
+ const pollQuesiton = pendo.dom(`[class*="-poll-question"][data-pendo-poll-id=${dataPendoPollId}]`)[0];
41306
41358
  if (pollQuesiton) {
41307
- questionText = pendo.dom("[class*=\"-poll-question\"][data-pendo-poll-id=".concat(dataPendoPollId, "]"))[0].textContent;
41359
+ questionText = pendo.dom(`[class*="-poll-question"][data-pendo-poll-id=${dataPendoPollId}]`)[0].textContent;
41308
41360
  }
41309
- var requiredSyntaxIndex = questionText.indexOf(requiredSyntax);
41361
+ const requiredSyntaxIndex = questionText.indexOf(requiredSyntax);
41310
41362
  if (requiredSyntaxIndex > -1) {
41311
- pendo._.each(pendo.dom("[data-pendo-poll-id=".concat(dataPendoPollId, "]:not(.pendo-radio)")), function (element) {
41312
- pendo._.each(pendo.dom("#".concat(element.id, " *:not(\".pendo-radio\"), #").concat(element.id, ":not(\".pendo-radio\")")), function (item) {
41363
+ pendo._.each(pendo.dom(`[data-pendo-poll-id=${dataPendoPollId}]:not(.pendo-radio)`), (element) => {
41364
+ pendo._.each(pendo.dom(`#${element.id} *:not(".pendo-radio"), #${element.id}:not(".pendo-radio")`), (item) => {
41313
41365
  guideMarkdownUtil.removeMarkdownSyntax(item, requiredSyntax, '', pendo);
41314
41366
  });
41315
41367
  });
41316
- 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) {
41317
- pendo.dom(".bb-text[data-pendo-poll-id=".concat(dataPendoPollId, "] p")).append(requiredElement);
41318
- pendo.dom(".bb-text[data-pendo-poll-id=".concat(dataPendoPollId, "] li")).append(requiredElement);
41368
+ 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) {
41369
+ pendo.dom(`.bb-text[data-pendo-poll-id=${dataPendoPollId}] p`).append(requiredElement);
41370
+ pendo.dom(`.bb-text[data-pendo-poll-id=${dataPendoPollId}] li`).append(requiredElement);
41319
41371
  }
41320
41372
  else {
41321
- pendo.dom(".bb-text[data-pendo-poll-id=".concat(dataPendoPollId, "]")).append(requiredElement);
41373
+ pendo.dom(`.bb-text[data-pendo-poll-id=${dataPendoPollId}]`).append(requiredElement);
41322
41374
  }
41323
41375
  if (pendo._.contains(requiredQuestions, dataPendoPollId)) {
41324
- var questionIndex = requiredQuestions.indexOf(dataPendoPollId);
41376
+ let questionIndex = requiredQuestions.indexOf(dataPendoPollId);
41325
41377
  if (questionIndex !== -1) {
41326
41378
  requiredQuestions.splice(questionIndex, 1);
41327
41379
  }
@@ -41332,7 +41384,7 @@ var RequiredQuestions = {
41332
41384
  }
41333
41385
  else {
41334
41386
  if (pendo._.contains(requiredQuestions, dataPendoPollId)) {
41335
- var index = requiredQuestions.indexOf(dataPendoPollId);
41387
+ let index = requiredQuestions.indexOf(dataPendoPollId);
41336
41388
  if (index !== -1) {
41337
41389
  requiredQuestions.splice(index, 1);
41338
41390
  }
@@ -41346,54 +41398,54 @@ var RequiredQuestions = {
41346
41398
  }
41347
41399
  };
41348
41400
 
41349
- var skipStepRegex = new RegExp(guideMarkdownUtil.skipStepString);
41350
- var SkipToEligibleStep = {
41351
- script: function (step, guide, pendo) {
41352
- var isAdvanceIntercepted = false;
41353
- var isPreviousIntercepted = false;
41354
- var guideContainer = step.guideElement.find(guideMarkdownUtil.containerSelector);
41355
- var guideContainerAriaLabel = guideContainer.attr('aria-label');
41356
- var stepNumberOrAuto = skipStepRegex.exec(guideContainerAriaLabel)[1];
41401
+ const skipStepRegex = new RegExp(guideMarkdownUtil.skipStepString);
41402
+ const SkipToEligibleStep = {
41403
+ script(step, guide, pendo) {
41404
+ let isAdvanceIntercepted = false;
41405
+ let isPreviousIntercepted = false;
41406
+ let guideContainer = step.guideElement.find(guideMarkdownUtil.containerSelector);
41407
+ let guideContainerAriaLabel = guideContainer.attr('aria-label');
41408
+ let stepNumberOrAuto = skipStepRegex.exec(guideContainerAriaLabel)[1];
41357
41409
  if (guideContainer) {
41358
41410
  guideContainer.attr({ 'aria-label': guideContainer.attr('aria-label').replace(skipStepRegex, '') });
41359
41411
  }
41360
- this.on('beforeAdvance', function (evt) {
41412
+ this.on('beforeAdvance', (evt) => {
41361
41413
  if (guide.getPositionOfStep(step) === guide.steps.length || pendo._.isUndefined(stepNumberOrAuto))
41362
41414
  return; // exit on the last step of a guide or when we don't have an argument
41363
- var eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'next');
41415
+ let eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'next');
41364
41416
  if (!isAdvanceIntercepted && stepNumberOrAuto) {
41365
41417
  isAdvanceIntercepted = true;
41366
- pendo.goToStep({ destinationStepId: eligibleStep.id, step: step });
41418
+ pendo.goToStep({ destinationStepId: eligibleStep.id, step });
41367
41419
  evt.cancel = true;
41368
41420
  }
41369
41421
  });
41370
- this.on('beforePrevious', function (evt) {
41422
+ this.on('beforePrevious', (evt) => {
41371
41423
  if (pendo._.isUndefined(stepNumberOrAuto))
41372
41424
  return;
41373
- var eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'previous');
41425
+ let eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'previous');
41374
41426
  if (!isPreviousIntercepted && stepNumberOrAuto) {
41375
41427
  isPreviousIntercepted = true;
41376
- pendo.goToStep({ destinationStepId: eligibleStep.id, step: step });
41428
+ pendo.goToStep({ destinationStepId: eligibleStep.id, step });
41377
41429
  evt.cancel = true;
41378
41430
  }
41379
41431
  });
41380
41432
  function findEligibleSkipStep(stepNumber, direction) {
41381
41433
  // Find the next eligible step by using getPosition of step (1 based)
41382
41434
  // getPosition - 2 gives the previous step
41383
- var skipForwardStep = findStepOnPage(guide.getPositionOfStep(step), 'next', stepNumber);
41384
- var skipPreviousStep = findStepOnPage(guide.getPositionOfStep(step) - 2, 'previous', stepNumber);
41435
+ let skipForwardStep = findStepOnPage(guide.getPositionOfStep(step), 'next', stepNumber);
41436
+ let skipPreviousStep = findStepOnPage(guide.getPositionOfStep(step) - 2, 'previous', stepNumber);
41385
41437
  if (skipForwardStep && direction == 'next') {
41386
- pendo.goToStep({ destinationStepId: skipForwardStep, step: step });
41438
+ pendo.goToStep({ destinationStepId: skipForwardStep, step });
41387
41439
  }
41388
41440
  if (skipPreviousStep && direction == 'previous') {
41389
- pendo.goToStep({ destinationStepId: skipPreviousStep, step: step });
41441
+ pendo.goToStep({ destinationStepId: skipPreviousStep, step });
41390
41442
  }
41391
41443
  return direction === 'next' ? skipForwardStep : skipPreviousStep;
41392
41444
  }
41393
41445
  function findStepOnPage(stepIndex, direction, stepNumber) {
41394
41446
  if (pendo._.isNaN(stepIndex))
41395
41447
  return;
41396
- var $step = guide.steps[stepIndex];
41448
+ let $step = guide.steps[stepIndex];
41397
41449
  if ($step && !$step.canShow()) {
41398
41450
  if (stepNumber !== 'auto') {
41399
41451
  return guide.steps[stepNumber - 1];
@@ -41410,34 +41462,34 @@ var SkipToEligibleStep = {
41410
41462
  }
41411
41463
  }
41412
41464
  },
41413
- test: function (step, guide, pendo) {
41465
+ test(step, guide, pendo) {
41414
41466
  var _a;
41415
- var guideContainerAriaLabel = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find(guideMarkdownUtil.containerSelector).attr('aria-label');
41467
+ const guideContainerAriaLabel = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find(guideMarkdownUtil.containerSelector).attr('aria-label');
41416
41468
  return pendo._.isString(guideContainerAriaLabel) && guideContainerAriaLabel.indexOf('{skipStep') !== -1;
41417
41469
  },
41418
- designerListener: function (pendo) {
41419
- var target = pendo.dom.getBody();
41420
- var config = {
41470
+ designerListener(pendo) {
41471
+ const target = pendo.dom.getBody();
41472
+ const config = {
41421
41473
  attributeFilter: ['data-layout'],
41422
41474
  attributes: true,
41423
41475
  childList: true,
41424
41476
  characterData: true,
41425
41477
  subtree: true
41426
41478
  };
41427
- var MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
41428
- var observer = new MutationObserver(applySkipStepIndicator);
41479
+ const MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
41480
+ const observer = new MutationObserver(applySkipStepIndicator);
41429
41481
  observer.observe(target, config);
41430
41482
  // create an observer instance
41431
41483
  function applySkipStepIndicator(mutations) {
41432
41484
  pendo._.each(mutations, function (mutation) {
41433
41485
  var _a, _b;
41434
- var nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
41486
+ const nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
41435
41487
  if (mutation.addedNodes.length && nodeHasQuerySelector) {
41436
- var guideContainer = mutation.addedNodes[0].querySelectorAll(guideMarkdownUtil.containerSelector);
41437
- var guideContainerAriaLabel = (_b = guideContainer[0]) === null || _b === void 0 ? void 0 : _b.getAttribute('aria-label');
41488
+ let guideContainer = mutation.addedNodes[0].querySelectorAll(guideMarkdownUtil.containerSelector);
41489
+ let guideContainerAriaLabel = (_b = guideContainer[0]) === null || _b === void 0 ? void 0 : _b.getAttribute('aria-label');
41438
41490
  if (guideContainerAriaLabel) {
41439
41491
  if (guideContainerAriaLabel.match(skipStepRegex)) {
41440
- var fullSkipStepString = guideContainerAriaLabel.match(skipStepRegex)[0];
41492
+ let fullSkipStepString = guideContainerAriaLabel.match(skipStepRegex)[0];
41441
41493
  guideContainerAriaLabel.replace(fullSkipStepString, '');
41442
41494
  if (!pendo.dom('#_pendoSkipIcon').length) {
41443
41495
  pendo.dom(guideMarkdownUtil.containerSelector).append(skipIcon('#999', '30px').trim());
@@ -41448,30 +41500,48 @@ var SkipToEligibleStep = {
41448
41500
  });
41449
41501
  }
41450
41502
  function skipIcon(color, size) {
41451
- 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 "));
41503
+ return (`<div title="Skip step added"><svg id="_pendoSkipIcon" version="1.0" xmlns="http://www.w3.org/2000/svg"
41504
+ width="${size}" height="${size}" viewBox="0 0 512.000000 512.000000"
41505
+ preserveAspectRatio="xMidYMid meet" style="bottom:5px; right:10px; position: absolute;">
41506
+ <g transform="translate(0.000000,512.000000) scale(0.100000,-0.100000)"
41507
+ fill="${color}" stroke="none">
41508
+ <path d="M2185 4469 c-363 -38 -739 -186 -1034 -407 -95 -71 -273 -243 -357
41509
+ -343 -205 -246 -364 -577 -429 -897 -25 -121 -45 -288 -45 -373 l0 -49 160 0
41510
+ 160 0 0 48 c0 26 5 88 10 137 68 593 417 1103 940 1374 1100 570 2418 -137
41511
+ 2560 -1374 5 -49 10 -111 10 -137 l0 -47 -155 -3 -155 -3 235 -235 235 -236
41512
+ 235 236 235 235 -155 3 -155 3 0 48 c0 27 -5 95 -10 152 -100 989 -878 1767
41513
+ -1869 1868 -117 12 -298 12 -416 0z"/>
41514
+ <path d="M320 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
41515
+ <path d="M960 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
41516
+ <path d="M1600 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
41517
+ <path d="M2240 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
41518
+ <path d="M2880 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
41519
+ <path d="M3840 1440 l0 -160 480 0 480 0 0 160 0 160 -480 0 -480 0 0 -160z"/>
41520
+ </g></svg></div>
41521
+ `);
41452
41522
  }
41453
41523
  }
41454
41524
  };
41455
41525
 
41456
41526
  function GuideMarkdown() {
41457
- var guideMarkdown;
41458
- var pluginApi;
41459
- var globalPendo;
41527
+ let guideMarkdown;
41528
+ let pluginApi;
41529
+ let globalPendo;
41460
41530
  return {
41461
41531
  name: 'GuideMarkdown',
41462
41532
  initialize: init,
41463
- teardown: teardown
41533
+ teardown
41464
41534
  };
41465
41535
  function init(pendo, PluginAPI) {
41466
41536
  globalPendo = pendo;
41467
41537
  pluginApi = PluginAPI;
41468
- var configReader = PluginAPI.ConfigReader;
41469
- var GUIDEMARKDOWN_CONFIG = 'guideMarkdown';
41538
+ const configReader = PluginAPI.ConfigReader;
41539
+ const GUIDEMARKDOWN_CONFIG = 'guideMarkdown';
41470
41540
  configReader.addOption(GUIDEMARKDOWN_CONFIG, [
41471
41541
  configReader.sources.SNIPPET_SRC,
41472
41542
  configReader.sources.PENDO_CONFIG_SRC
41473
41543
  ], false);
41474
- var markdownScriptsEnabled = configReader.get(GUIDEMARKDOWN_CONFIG);
41544
+ const markdownScriptsEnabled = configReader.get(GUIDEMARKDOWN_CONFIG);
41475
41545
  if (!markdownScriptsEnabled)
41476
41546
  return;
41477
41547
  guideMarkdown = [PollBranching, MetadataSubstitution, RequiredQuestions, SkipToEligibleStep];
@@ -42497,8 +42567,8 @@ function Feedback() {
42497
42567
  var widgetLoaded = false;
42498
42568
  var feedbackAllowedProductId = '';
42499
42569
  var initialized = false;
42500
- var PING_COOKIE = 'feedback_ping_sent';
42501
- var PING_COOKIE_EXPIRATION = 1000 * 60 * 60;
42570
+ const PING_COOKIE = 'feedback_ping_sent';
42571
+ const PING_COOKIE_EXPIRATION = 1000 * 60 * 60;
42502
42572
  var overflowMediaQuery = '@media only screen and (max-device-width:1112px){#feedback-widget{overflow-y:scroll}}';
42503
42573
  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%)}}';
42504
42574
  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)}}';
@@ -42518,28 +42588,28 @@ function Feedback() {
42518
42588
  feedbackStyles: 'pendo-feedback-styles',
42519
42589
  feedbackFrameStyles: 'pendo-feedback-visible-buttons-styles'
42520
42590
  };
42521
- var globalPendo;
42522
- var pluginApi;
42591
+ let globalPendo;
42592
+ let pluginApi;
42523
42593
  return {
42524
42594
  name: 'Feedback',
42525
- initialize: initialize,
42526
- teardown: teardown,
42527
- validate: validate
42595
+ initialize,
42596
+ teardown,
42597
+ validate
42528
42598
  };
42529
42599
  function initialize(pendo, PluginAPI) {
42530
42600
  globalPendo = pendo;
42531
42601
  pluginApi = PluginAPI;
42532
42602
  var publicFeedback = {
42533
- ping: ping,
42534
- init: init,
42603
+ ping,
42604
+ init,
42535
42605
  initialized: getInitialized,
42536
- loginAndRedirect: loginAndRedirect,
42537
- openFeedback: openFeedback,
42538
- initializeFeedbackOnce: initializeFeedbackOnce,
42539
- isFeedbackLoaded: isFeedbackLoaded,
42540
- convertPendoToFeedbackOptions: convertPendoToFeedbackOptions,
42606
+ loginAndRedirect,
42607
+ openFeedback,
42608
+ initializeFeedbackOnce,
42609
+ isFeedbackLoaded,
42610
+ convertPendoToFeedbackOptions,
42541
42611
  isUnsupportedIE: pendo._.partial(isUnsupportedIE, PluginAPI),
42542
- removeFeedbackWidget: removeFeedbackWidget
42612
+ removeFeedbackWidget
42543
42613
  };
42544
42614
  pendo.feedback = publicFeedback;
42545
42615
  pendo.getFeedbackSettings = getFeedbackSettings;
@@ -42567,7 +42637,7 @@ function Feedback() {
42567
42637
  */
42568
42638
  PluginAPI.agentStorage.registry.addLocal(PING_COOKIE, { duration: PING_COOKIE_EXPIRATION });
42569
42639
  return {
42570
- validate: validate
42640
+ validate
42571
42641
  };
42572
42642
  }
42573
42643
  function teardown() {
@@ -42587,18 +42657,18 @@ function Feedback() {
42587
42657
  return result;
42588
42658
  }
42589
42659
  function pingOrInitialize() {
42590
- var options = getPendoOptions();
42660
+ const options = getPendoOptions();
42591
42661
  if (initialized) {
42592
- var feedbackOptions = convertPendoToFeedbackOptions(options);
42662
+ const feedbackOptions = convertPendoToFeedbackOptions(options);
42593
42663
  ping(feedbackOptions);
42594
42664
  }
42595
42665
  else if (shouldInitializeFeedback() && !globalPendo._.isEmpty(options)) {
42596
- var settings = pluginApi.ConfigReader.get('feedbackSettings');
42597
- init(options, settings)["catch"](globalPendo._.noop);
42666
+ const settings = pluginApi.ConfigReader.get('feedbackSettings');
42667
+ init(options, settings).catch(globalPendo._.noop);
42598
42668
  }
42599
42669
  }
42600
42670
  function handleIdentityChange(event) {
42601
- var visitorId = globalPendo._.get(event, 'data.0.visitor_id') || globalPendo._.get(event, 'data.0.options.visitor.id');
42671
+ const visitorId = globalPendo._.get(event, 'data.0.visitor_id') || globalPendo._.get(event, 'data.0.options.visitor.id');
42602
42672
  if (globalPendo.isAnonymousVisitor(visitorId)) {
42603
42673
  removeFeedbackWidget();
42604
42674
  return;
@@ -42668,9 +42738,9 @@ function Feedback() {
42668
42738
  if (toSend.data && toSend.data !== '{}' && toSend.data !== 'null') {
42669
42739
  return globalPendo.ajax
42670
42740
  .postJSON(getFullUrl('/widget/pendo_ping'), toSend)
42671
- .then(function (response) {
42741
+ .then((response) => {
42672
42742
  onWidgetPingResponse(response);
42673
- })["catch"](function () { onPingFailure(); });
42743
+ }).catch(() => { onPingFailure(); });
42674
42744
  }
42675
42745
  }
42676
42746
  return pluginApi.q.resolve();
@@ -42804,10 +42874,10 @@ function Feedback() {
42804
42874
  return globalPendo.ajax.postJSON(getFullUrl('/analytics'), toSend);
42805
42875
  }
42806
42876
  function addOverlay() {
42807
- var widget = globalPendo.dom("#".concat(elemIds.feedbackWidget));
42877
+ const widget = globalPendo.dom(`#${elemIds.feedbackWidget}`);
42808
42878
  if (!widget)
42809
42879
  return;
42810
- var overlayStyles = {
42880
+ const overlayStyles = {
42811
42881
  'position': 'fixed',
42812
42882
  'top': '0',
42813
42883
  'right': '0',
@@ -42819,7 +42889,7 @@ function Feedback() {
42819
42889
  'animation': 'pendoFeedbackFadeIn 0.5s 0s 1 alternate both',
42820
42890
  '-webkit-animation': 'pendoFeedbackFadeIn 0.5s 0s 1 alternate both'
42821
42891
  };
42822
- var overlayElement = globalPendo.dom(document.createElement('div'));
42892
+ const overlayElement = globalPendo.dom(document.createElement('div'));
42823
42893
  overlayElement.attr('id', 'feedback-overlay');
42824
42894
  overlayElement.css(overlayStyles);
42825
42895
  overlayElement.appendTo(widget.getParent());
@@ -42924,22 +42994,22 @@ function Feedback() {
42924
42994
  }
42925
42995
  }
42926
42996
  function buildOuterTriggerDiv(positionInfo) {
42927
- var horizontalStyles = getHorizontalPositionStyles(positionInfo);
42928
- var verticalStyles = getVerticalPositionStyles(positionInfo);
42929
- var styles = globalPendo._.extend({
42997
+ const horizontalStyles = getHorizontalPositionStyles(positionInfo);
42998
+ const verticalStyles = getVerticalPositionStyles(positionInfo);
42999
+ const styles = globalPendo._.extend({
42930
43000
  'position': 'fixed',
42931
43001
  'height': '43px',
42932
43002
  'opacity': '1 !important',
42933
43003
  'z-index': '9001'
42934
43004
  }, horizontalStyles, verticalStyles);
42935
- var outerTrigger = globalPendo.dom(document.createElement('div'));
43005
+ const outerTrigger = globalPendo.dom(document.createElement('div'));
42936
43006
  outerTrigger.attr('id', elemIds.feedbackTrigger);
42937
43007
  outerTrigger.css(styles);
42938
43008
  outerTrigger.attr('data-turbolinks-permanent', '');
42939
43009
  return outerTrigger;
42940
43010
  }
42941
43011
  function buildNotification() {
42942
- var styles = {
43012
+ const styles = {
42943
43013
  'background-color': '#D85039',
42944
43014
  'color': '#fff',
42945
43015
  'border-radius': '50%',
@@ -42956,20 +43026,20 @@ function Feedback() {
42956
43026
  'animation-delay': '1s',
42957
43027
  'animation-iteration-count': '1'
42958
43028
  };
42959
- var notification = globalPendo.dom(document.createElement('span'));
43029
+ const notification = globalPendo.dom(document.createElement('span'));
42960
43030
  notification.attr('id', 'feedback-trigger-notification');
42961
43031
  notification.css(styles);
42962
43032
  return notification;
42963
43033
  }
42964
43034
  function buildTriggerButton(settings, positionInfo) {
42965
- var borderRadius;
43035
+ let borderRadius;
42966
43036
  if (positionInfo.horizontalPosition === 'left') {
42967
43037
  borderRadius = '0 0 5px 5px';
42968
43038
  }
42969
43039
  else {
42970
43040
  borderRadius = '3px 3px 0 0';
42971
43041
  }
42972
- var styles = {
43042
+ const styles = {
42973
43043
  'border': 'none',
42974
43044
  'padding': '11px 18px 14px 18px',
42975
43045
  'background-color': settings.triggerColor,
@@ -42980,21 +43050,32 @@ function Feedback() {
42980
43050
  'cursor': 'pointer',
42981
43051
  'text-align': 'left'
42982
43052
  };
42983
- var triggerButton = globalPendo.dom(document.createElement('button'));
43053
+ const triggerButton = globalPendo.dom(document.createElement('button'));
42984
43054
  triggerButton.attr('id', elemIds.feedbackTriggerButton);
42985
43055
  triggerButton.css(styles);
42986
43056
  triggerButton.text(settings.triggerText);
42987
43057
  return triggerButton;
42988
43058
  }
42989
43059
  function addTriggerPseudoStyles() {
42990
- 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 ";
43060
+ const pseudoStyles = `
43061
+ #feedback-trigger button:hover {
43062
+ box-shadow: 0 -5px 20px rgba(0,0,0,.19) !important;
43063
+ outline: none !important;
43064
+ background: #3e566f !important;
43065
+ }
43066
+ #feedback-trigger button:focus {
43067
+ box-shadow: 0 -5px 20px rgba(0,0,0,.19) !important;
43068
+ outline: none !important;
43069
+ background: #3e566f !important;
43070
+ }
43071
+ `;
42991
43072
  pluginApi.util.addInlineStyles('pendo-feedback-trigger-styles', pseudoStyles);
42992
43073
  }
42993
43074
  function createTrigger(settings, positionInfo) {
42994
43075
  addTriggerPseudoStyles();
42995
- var triggerElement = buildOuterTriggerDiv(positionInfo);
42996
- var notificationElement = buildNotification();
42997
- var triggerButtonElement = buildTriggerButton(settings, positionInfo);
43076
+ const triggerElement = buildOuterTriggerDiv(positionInfo);
43077
+ const notificationElement = buildNotification();
43078
+ const triggerButtonElement = buildTriggerButton(settings, positionInfo);
42998
43079
  triggerElement.append(notificationElement);
42999
43080
  triggerElement.append(triggerButtonElement);
43000
43081
  triggerElement.appendTo(globalPendo.dom.getBody());
@@ -43018,7 +43099,7 @@ function Feedback() {
43018
43099
  iframeWrapper.css(getWidgetOriginalStyles());
43019
43100
  iframeWrapper.attr('id', elemIds.feedbackWidget);
43020
43101
  iframeWrapper.attr('data-turbolinks-permanent', 'true');
43021
- iframeWrapper.addClass("buttonIs-".concat(horizontalPosition));
43102
+ iframeWrapper.addClass(`buttonIs-${horizontalPosition}`);
43022
43103
  return iframeWrapper;
43023
43104
  }
43024
43105
  function buildIframeContainer() {
@@ -43035,13 +43116,22 @@ function Feedback() {
43035
43116
  return iframeContainer;
43036
43117
  }
43037
43118
  function addWidgetVisibleButtonStyles(buttonStylePosition) {
43038
- var side = buttonStylePosition === 'left' ? 'left' : 'right'; // just in case something was not left or right for some reason
43039
- 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 ");
43119
+ let side = buttonStylePosition === 'left' ? 'left' : 'right'; // just in case something was not left or right for some reason
43120
+ const styles = `
43121
+ .buttonIs-${side}.visible {
43122
+ ${side}: 0 !important;
43123
+ width: 470px !important;
43124
+ animation-direction: alternate-reverse !important;
43125
+ animation: pendoFeedbackSlideFrom-${side} 0.5s 0s 1 alternate both !important;
43126
+ -webkit-animation: pendoFeedbackSlideFrom-${side} 0.5s 0s 1 alternate both !important;
43127
+ z-index: 9002 !important;
43128
+ }
43129
+ `;
43040
43130
  pluginApi.util.addInlineStyles(elemIds.feedbackFrameStyles, styles);
43041
43131
  }
43042
43132
  function initialiseWidgetFrame(horizontalPosition) {
43043
43133
  addWidgetVisibleButtonStyles(horizontalPosition);
43044
- var iframeElement = buildIframeWrapper(horizontalPosition);
43134
+ const iframeElement = buildIframeWrapper(horizontalPosition);
43045
43135
  iframeElement.append(buildIframeContainer());
43046
43136
  iframeElement.appendTo(globalPendo.dom.getBody());
43047
43137
  subscribeToIframeMessages();
@@ -43065,7 +43155,7 @@ function Feedback() {
43065
43155
  return widgetLoaded;
43066
43156
  }
43067
43157
  function getPendoOptions() {
43068
- var options = pluginApi.ConfigReader.getLocalConfig();
43158
+ let options = pluginApi.ConfigReader.getLocalConfig();
43069
43159
  if (!globalPendo._.isObject(options))
43070
43160
  options = {};
43071
43161
  if (!globalPendo._.isObject(options.visitor))
@@ -43093,7 +43183,7 @@ function Feedback() {
43093
43183
  return true;
43094
43184
  }
43095
43185
  function getQueryParam(url, paramName) {
43096
- var results = new RegExp('[?&]' + paramName + '=([^&#]*)').exec(url);
43186
+ const results = new RegExp('[?&]' + paramName + '=([^&#]*)').exec(url);
43097
43187
  if (results == null) {
43098
43188
  return null;
43099
43189
  }
@@ -43110,13 +43200,13 @@ function Feedback() {
43110
43200
  return pluginApi.q.reject();
43111
43201
  if (!canInitFeedback(pendoOptions))
43112
43202
  return pluginApi.q.reject();
43113
- var feedbackOptions = convertPendoToFeedbackOptions(pendoOptions);
43203
+ const feedbackOptions = convertPendoToFeedbackOptions(pendoOptions);
43114
43204
  try {
43115
- var fdbkDst_1 = getQueryParam(globalPendo.url.get(), 'fdbkDst');
43116
- if (fdbkDst_1 && fdbkDst_1.startsWith('case')) {
43205
+ const fdbkDst = getQueryParam(globalPendo.url.get(), 'fdbkDst');
43206
+ if (fdbkDst && fdbkDst.startsWith('case')) {
43117
43207
  initialized = true;
43118
43208
  getFeedbackLoginUrl().then(function (loginUrl) {
43119
- var destinationUrl = loginUrl + '&fdbkDst=' + fdbkDst_1;
43209
+ const destinationUrl = loginUrl + '&fdbkDst=' + fdbkDst;
43120
43210
  window.location.href = destinationUrl;
43121
43211
  });
43122
43212
  return;
@@ -43165,7 +43255,7 @@ function Feedback() {
43165
43255
  function convertPendoToFeedbackOptions(options) {
43166
43256
  var jwtOptions = pluginApi.agent.getJwtInfoCopy();
43167
43257
  if (globalPendo._.isEmpty(jwtOptions)) {
43168
- var feedbackOptions = {};
43258
+ const feedbackOptions = {};
43169
43259
  feedbackOptions.user = globalPendo._.pick(options.visitor, 'id', 'full_name', 'firstName', 'lastName', 'email', 'tags', 'custom_allowed_products');
43170
43260
  globalPendo._.extend(feedbackOptions.user, { allowed_products: [{ id: feedbackAllowedProductId }] });
43171
43261
  feedbackOptions.account = globalPendo._.pick(options.account, 'id', 'name', 'monthly_value', 'is_paying', 'tags');
@@ -46520,7 +46610,10 @@ function initStyleSheetObserver({ styleSheetRuleCb, mirror: mirror2, stylesheetM
46520
46610
  removes: [{ index: index2 }]
46521
46611
  });
46522
46612
  }
46523
- return target.apply(thisArg, argumentsList);
46613
+ try {
46614
+ return target.apply(thisArg, argumentsList);
46615
+ } catch (e2) {
46616
+ }
46524
46617
  }
46525
46618
  )
46526
46619
  });
@@ -46652,7 +46745,10 @@ function initStyleSheetObserver({ styleSheetRuleCb, mirror: mirror2, stylesheetM
46652
46745
  ]
46653
46746
  });
46654
46747
  }
46655
- return target.apply(thisArg, argumentsList);
46748
+ try {
46749
+ return target.apply(thisArg, argumentsList);
46750
+ } catch (e2) {
46751
+ }
46656
46752
  }
46657
46753
  )
46658
46754
  }
@@ -48658,32 +48754,31 @@ var n;
48658
48754
  }(n || (n = {}));
48659
48755
  return record; }
48660
48756
 
48661
- var SessionRecorderBuffer = /** @class */ (function () {
48662
- function SessionRecorderBuffer(interval, maxCount) {
48663
- if (maxCount === void 0) { maxCount = Infinity; }
48757
+ class SessionRecorderBuffer {
48758
+ constructor(interval, maxCount = Infinity) {
48664
48759
  this.data = [];
48665
48760
  this.sequenceNumber = 0;
48666
48761
  this.interval = interval;
48667
48762
  this.maxCount = maxCount;
48668
48763
  this.doubledMaxCount = maxCount * 2;
48669
48764
  }
48670
- SessionRecorderBuffer.prototype.isEmpty = function () {
48765
+ isEmpty() {
48671
48766
  return this.data.length === 0;
48672
- };
48673
- SessionRecorderBuffer.prototype.count = function () {
48767
+ }
48768
+ count() {
48674
48769
  return this.data.length;
48675
- };
48676
- SessionRecorderBuffer.prototype.clear = function () {
48770
+ }
48771
+ clear() {
48677
48772
  this.data.length = 0;
48678
- };
48679
- SessionRecorderBuffer.prototype.clearSequence = function () {
48773
+ }
48774
+ clearSequence() {
48680
48775
  this.sequenceNumber = 0;
48681
- };
48682
- SessionRecorderBuffer.prototype.push = function (event) {
48776
+ }
48777
+ push(event) {
48683
48778
  this.data.push(event);
48684
48779
  this.checkRateLimit();
48685
- };
48686
- SessionRecorderBuffer.prototype.pack = function (envelope, _) {
48780
+ }
48781
+ pack(envelope, _) {
48687
48782
  var eventsToSend = this.data.splice(0, this.maxCount);
48688
48783
  envelope.recordingPayload = eventsToSend;
48689
48784
  envelope.sequence = this.sequenceNumber;
@@ -48691,8 +48786,8 @@ var SessionRecorderBuffer = /** @class */ (function () {
48691
48786
  if (eventsToSend.length) {
48692
48787
  envelope.browserTime = eventsToSend[0].timestamp;
48693
48788
  }
48694
- envelope.recordingPayloadMetadata = _.map(eventsToSend, function (event) {
48695
- var metadata = _.pick(event, 'type', 'timestamp');
48789
+ envelope.recordingPayloadMetadata = _.map(eventsToSend, event => {
48790
+ const metadata = _.pick(event, 'type', 'timestamp');
48696
48791
  if (event.data) {
48697
48792
  metadata.data = _.pick(event.data, 'source', 'type', 'x', 'y', 'id', 'height', 'width', 'href');
48698
48793
  }
@@ -48700,30 +48795,18 @@ var SessionRecorderBuffer = /** @class */ (function () {
48700
48795
  });
48701
48796
  this.sequenceNumber += eventsToSend.length;
48702
48797
  return envelope;
48703
- };
48704
- SessionRecorderBuffer.prototype.checkRateLimit = function () {
48705
- var length = this.data.length;
48798
+ }
48799
+ checkRateLimit() {
48800
+ const length = this.data.length;
48706
48801
  if (length >= this.doubledMaxCount && length % this.maxCount === 0) {
48707
- var elapsed = this.data[length - 1].timestamp - this.data[length - this.doubledMaxCount].timestamp;
48802
+ const elapsed = this.data[length - 1].timestamp - this.data[length - this.doubledMaxCount].timestamp;
48708
48803
  if (elapsed <= this.interval && this.onRateLimit) {
48709
48804
  this.onRateLimit();
48710
48805
  }
48711
48806
  }
48712
- };
48713
- return SessionRecorderBuffer;
48714
- }());
48807
+ }
48808
+ }
48715
48809
 
48716
- var __assign = function() {
48717
- __assign = Object.assign || function __assign(t) {
48718
- for (var s, i = 1, n = arguments.length; i < n; i++) {
48719
- s = arguments[i];
48720
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
48721
- }
48722
- return t;
48723
- };
48724
- return __assign.apply(this, arguments);
48725
- };
48726
-
48727
48810
  function __rest(s, e) {
48728
48811
  var t = {};
48729
48812
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -48746,52 +48829,24 @@ function __awaiter(thisArg, _arguments, P, generator) {
48746
48829
  });
48747
48830
  }
48748
48831
 
48749
- function __generator(thisArg, body) {
48750
- 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);
48751
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
48752
- function verb(n) { return function (v) { return step([n, v]); }; }
48753
- function step(op) {
48754
- if (f) throw new TypeError("Generator is already executing.");
48755
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
48756
- 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;
48757
- if (y = 0, t) op = [op[0] & 2, t.value];
48758
- switch (op[0]) {
48759
- case 0: case 1: t = op; break;
48760
- case 4: _.label++; return { value: op[1], done: false };
48761
- case 5: _.label++; y = op[1]; op = [0]; continue;
48762
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
48763
- default:
48764
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
48765
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
48766
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
48767
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
48768
- if (t[2]) _.ops.pop();
48769
- _.trys.pop(); continue;
48770
- }
48771
- op = body.call(thisArg, _);
48772
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
48773
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
48774
- }
48775
- }
48776
-
48777
48832
  typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
48778
48833
  var e = new Error(message);
48779
48834
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
48780
48835
  };
48781
48836
 
48782
- var RECORDING_CONFIG_WORKERURL$1 = 'recording.workerUrl';
48783
- var MAX_SIZE = 2000000;
48784
- var RESOURCE_CACHING$1 = 'resourceCaching';
48785
- var Transport = /** @class */ (function () {
48786
- function Transport(WorkerClass, pendo, api) {
48837
+ const RECORDING_CONFIG_WORKERURL$1 = 'recording.workerUrl';
48838
+ const MAX_SIZE = 2000000;
48839
+ const RESOURCE_CACHING$1 = 'resourceCaching';
48840
+ class Transport {
48841
+ constructor(WorkerClass, pendo, api) {
48787
48842
  this.WorkerClass = WorkerClass;
48788
48843
  this.pendo = pendo;
48789
48844
  this.api = api;
48790
48845
  this.maxSize = MAX_SIZE;
48791
- this.lockID = "worker-lock-".concat(this.pendo.randomString(16));
48846
+ this.lockID = `worker-lock-${this.pendo.randomString(16)}`;
48792
48847
  this.isResourceCachingEnabled = this.api.ConfigReader.get(RESOURCE_CACHING$1);
48793
48848
  }
48794
- Transport.prototype.start = function (config) {
48849
+ start(config) {
48795
48850
  if (config.disableWorker)
48796
48851
  return;
48797
48852
  if (!this.worker) {
@@ -48801,7 +48856,7 @@ var Transport = /** @class */ (function () {
48801
48856
  this.worker = config.workerOverride;
48802
48857
  }
48803
48858
  else {
48804
- var workerUrl = this.api.ConfigReader.get(RECORDING_CONFIG_WORKERURL$1);
48859
+ const workerUrl = this.api.ConfigReader.get(RECORDING_CONFIG_WORKERURL$1);
48805
48860
  this.usesSelfHostedWorker = workerUrl != null;
48806
48861
  this.worker = workerUrl ? new Worker(workerUrl) : new this.WorkerClass();
48807
48862
  }
@@ -48815,35 +48870,34 @@ var Transport = /** @class */ (function () {
48815
48870
  this.worker = null;
48816
48871
  }
48817
48872
  }
48818
- };
48819
- Transport.prototype.stop = function () {
48873
+ }
48874
+ stop() {
48820
48875
  if (this.worker) {
48821
48876
  this.worker.terminate();
48822
48877
  delete this.worker;
48823
48878
  }
48824
- };
48825
- Transport.prototype.send = function (envelope, isUnload, failureCount) {
48826
- if (failureCount === void 0) { failureCount = 0; }
48827
- var url = envelope.url;
48828
- var payload = envelope.payload;
48879
+ }
48880
+ send(envelope, isUnload, failureCount = 0) {
48881
+ let { url } = envelope;
48882
+ const { payload } = envelope;
48829
48883
  if (failureCount > 0) {
48830
- url = "".concat(url, "&rt=").concat(failureCount);
48884
+ url = `${url}&rt=${failureCount}`;
48831
48885
  }
48832
48886
  if (this.worker && !isUnload && payload) {
48833
- var deferred_1 = {};
48834
- deferred_1.promise = new Promise$2(function (resolve, reject) {
48835
- deferred_1.resolve = resolve;
48836
- deferred_1.reject = reject;
48887
+ const deferred = {};
48888
+ deferred.promise = new Promise$2((resolve, reject) => {
48889
+ deferred.resolve = resolve;
48890
+ deferred.reject = reject;
48837
48891
  });
48838
- this.workerResponse = deferred_1;
48839
- this.worker.postMessage({ url: url, payload: payload, shouldCacheResources: this.isResourceCachingEnabled });
48840
- return deferred_1.promise;
48892
+ this.workerResponse = deferred;
48893
+ this.worker.postMessage({ url, payload, shouldCacheResources: this.isResourceCachingEnabled });
48894
+ return deferred.promise;
48841
48895
  }
48842
48896
  else {
48843
48897
  if (!envelope.body) {
48844
- var strPayload = JSON.stringify(payload);
48898
+ const strPayload = JSON.stringify(payload);
48845
48899
  if (strPayload.length > this.maxSize) {
48846
- var error = new Error('maximum recording payload size exceeded');
48900
+ const error = new Error('maximum recording payload size exceeded');
48847
48901
  error.reason = 'HEAVY_EVENT';
48848
48902
  error.context = {
48849
48903
  size: strPayload.length,
@@ -48854,14 +48908,14 @@ var Transport = /** @class */ (function () {
48854
48908
  envelope.body = this.pendo.compress(strPayload, 'binary');
48855
48909
  delete envelope.payload;
48856
48910
  }
48857
- url = "".concat(url, "&ct=").concat(new Date().getTime());
48911
+ url = `${url}&ct=${new Date().getTime()}`;
48858
48912
  return this.post(url, {
48859
48913
  keepalive: isUnload,
48860
48914
  body: envelope.body
48861
48915
  });
48862
48916
  }
48863
- };
48864
- Transport.prototype.post = function (url, options) {
48917
+ }
48918
+ post(url, options) {
48865
48919
  options.method = 'POST';
48866
48920
  if (options.keepalive && this.api.transmit.fetchKeepalive.supported()) {
48867
48921
  return this.api.transmit.fetchKeepalive(url, options);
@@ -48873,57 +48927,46 @@ var Transport = /** @class */ (function () {
48873
48927
  else {
48874
48928
  return this.pendo.ajax.post(url, options.body);
48875
48929
  }
48876
- };
48877
- Transport.prototype._onMessage = function (messageEvent) {
48878
- return __awaiter(this, void 0, void 0, function () {
48879
- return __generator(this, function (_a) {
48880
- switch (_a.label) {
48881
- case 0:
48882
- if (!(messageEvent.data && messageEvent.data.ready)) return [3 /*break*/, 2];
48883
- // When the lock is released, we can assume the worker was terminated or closed
48884
- return [4 /*yield*/, navigator.locks.request(this.lockID, function () { })];
48885
- case 1:
48886
- // When the lock is released, we can assume the worker was terminated or closed
48887
- _a.sent();
48888
- this.onWorkerMessage({ type: 'workerDied' });
48889
- _a.label = 2;
48890
- case 2:
48891
- // handle non-POST request responses from worker
48892
- if (messageEvent.data && messageEvent.data.type) {
48893
- this.onWorkerMessage(messageEvent.data);
48894
- return [2 /*return*/];
48895
- }
48896
- // handle POST request response from worker
48897
- if (messageEvent.data && messageEvent.data.error) {
48898
- if ((messageEvent.data.status && messageEvent.data.status < 500) ||
48899
- messageEvent.data.sequence == null) {
48900
- this.api.log.critical('Failed to send recording data from web worker', { error: messageEvent.data.error });
48901
- }
48902
- if (this.workerResponse) {
48903
- this.workerResponse.reject();
48904
- this.workerResponse = null;
48905
- }
48906
- }
48907
- if (this.workerResponse) {
48908
- this.workerResponse.resolve();
48909
- this.workerResponse = null;
48910
- }
48911
- return [2 /*return*/];
48930
+ }
48931
+ _onMessage(messageEvent) {
48932
+ return __awaiter(this, void 0, void 0, function* () {
48933
+ if (messageEvent.data && messageEvent.data.ready) {
48934
+ // When the lock is released, we can assume the worker was terminated or closed
48935
+ yield navigator.locks.request(this.lockID, () => { });
48936
+ this.onWorkerMessage({ type: 'workerDied' });
48937
+ }
48938
+ // handle non-POST request responses from worker
48939
+ if (messageEvent.data && messageEvent.data.type) {
48940
+ this.onWorkerMessage(messageEvent.data);
48941
+ return;
48942
+ }
48943
+ // handle POST request response from worker
48944
+ if (messageEvent.data && messageEvent.data.error) {
48945
+ if ((messageEvent.data.status && messageEvent.data.status < 500) ||
48946
+ messageEvent.data.sequence == null) {
48947
+ this.api.log.critical('Failed to send recording data from web worker', { error: messageEvent.data.error });
48912
48948
  }
48913
- });
48949
+ if (this.workerResponse) {
48950
+ this.workerResponse.reject();
48951
+ this.workerResponse = null;
48952
+ }
48953
+ }
48954
+ if (this.workerResponse) {
48955
+ this.workerResponse.resolve();
48956
+ this.workerResponse = null;
48957
+ }
48914
48958
  });
48915
- };
48916
- Transport.prototype._onError = function () {
48959
+ }
48960
+ _onError() {
48917
48961
  if (this.onError) {
48918
48962
  this.onError();
48919
48963
  }
48920
- };
48921
- return Transport;
48922
- }());
48964
+ }
48965
+ }
48923
48966
 
48924
- var ELEMENT_NODE = 1;
48925
- var INPUT_MASK = '*'.repeat(10);
48926
- var NUMBER_INPUT_MASK = '0'.repeat(10);
48967
+ const ELEMENT_NODE = 1;
48968
+ const INPUT_MASK = '*'.repeat(10);
48969
+ const NUMBER_INPUT_MASK = '0'.repeat(10);
48927
48970
  function isElementNode(node) {
48928
48971
  if (!node)
48929
48972
  return false;
@@ -48932,12 +48975,10 @@ function isElementNode(node) {
48932
48975
  return true;
48933
48976
  }
48934
48977
  function getParent(elem) {
48935
- var isElementShadowRoot = typeof window.ShadowRoot !== 'undefined' && elem instanceof window.ShadowRoot && elem.host;
48978
+ const isElementShadowRoot = typeof window.ShadowRoot !== 'undefined' && elem instanceof window.ShadowRoot && elem.host;
48936
48979
  return isElementShadowRoot ? elem.host : elem.parentNode;
48937
48980
  }
48938
- function distanceToMatch(node, selector, limit, distance) {
48939
- if (limit === void 0) { limit = Infinity; }
48940
- if (distance === void 0) { distance = 0; }
48981
+ function distanceToMatch(node, selector, limit = Infinity, distance = 0) {
48941
48982
  if (distance > limit)
48942
48983
  return -1;
48943
48984
  if (!node)
@@ -48951,13 +48992,13 @@ function distanceToMatch(node, selector, limit, distance) {
48951
48992
  return distanceToMatch(getParent(node), selector, limit, distance + 1);
48952
48993
  }
48953
48994
  function shouldMask(node, options) {
48954
- var maskAllText = options.maskAllText, maskTextSelector = options.maskTextSelector, unmaskTextSelector = options.unmaskTextSelector;
48995
+ const { maskAllText, maskTextSelector, unmaskTextSelector } = options;
48955
48996
  try {
48956
- var el = isElementNode(node) ? node : node.parentElement;
48997
+ const el = isElementNode(node) ? node : node.parentElement;
48957
48998
  if (el === null)
48958
48999
  return false;
48959
- var maskDistance = -1;
48960
- var unmaskDistance = -1;
49000
+ let maskDistance = -1;
49001
+ let unmaskDistance = -1;
48961
49002
  if (maskAllText) {
48962
49003
  unmaskDistance = distanceToMatch(el, unmaskTextSelector);
48963
49004
  if (unmaskDistance < 0) {
@@ -48990,8 +49031,8 @@ function isNumberInput(element) {
48990
49031
  }
48991
49032
  function shouldMaskInput(element, maskInputOptions) {
48992
49033
  if (maskInputOptions && isElementNode(element)) {
48993
- var tagName = (element.tagName || '').toLowerCase();
48994
- var type = (element.type || '').toLowerCase();
49034
+ const tagName = (element.tagName || '').toLowerCase();
49035
+ const type = (element.type || '').toLowerCase();
48995
49036
  if (maskInputOptions[tagName] || maskInputOptions[type]) {
48996
49037
  return true;
48997
49038
  }
@@ -50478,12 +50519,12 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
50478
50519
  }
50479
50520
  }
50480
50521
 
50481
- var ONE_HUNDRED_MB_IN_BYTES = 100 * 1024 * 1024;
50522
+ const ONE_HUNDRED_MB_IN_BYTES = 100 * 1024 * 1024;
50482
50523
  function matchHostedResources(recordingEvent, stringifiedRecordingPayload) {
50483
- var fontURLRegex = /https:\/\/[^"\\\s]+?\.(woff2?|ttf|otf|eot)(\?[^"\\\s]*)?\b/g;
50484
- var matches = stringifiedRecordingPayload.match(fontURLRegex);
50524
+ const fontURLRegex = /https:\/\/[^"\\\s]+?\.(woff2?|ttf|otf|eot)(\?[^"\\\s]*)?\b/g;
50525
+ const matches = stringifiedRecordingPayload.match(fontURLRegex);
50485
50526
  // de-duplicate matches
50486
- var hostedResources = matches ? Array.from(new Set(matches)) : [];
50527
+ const hostedResources = matches ? Array.from(new Set(matches)) : [];
50487
50528
  return {
50488
50529
  type: 'recording',
50489
50530
  visitorId: recordingEvent.visitorId,
@@ -50498,75 +50539,75 @@ var WorkerFactory = /*#__PURE__*/createInlineWorkerFactory(/* rollup-plugin-web-
50498
50539
  recordingPayloadMetadata: [],
50499
50540
  sequence: 0,
50500
50541
  recordingPayloadCount: 0,
50501
- hostedResources: hostedResources
50542
+ hostedResources
50502
50543
  };
50503
50544
  }
50504
50545
  // keep in mind changes here may need addressing in the extension worker proxy as well
50505
50546
  self.onmessage = function (e) {
50506
50547
  try {
50507
50548
  if (e.data.type === 'init' && e.data.lockID) {
50508
- navigator.locks.request(e.data.lockID, function () {
50549
+ navigator.locks.request(e.data.lockID, () => {
50509
50550
  postMessage({ ready: true });
50510
50551
  // This unresolved promise keeps the lock held with the worker until the worker is
50511
50552
  // terminated at which point the lock is released.
50512
- return new Promise$2(function () { });
50553
+ return new Promise$2(() => { });
50513
50554
  });
50514
50555
  return;
50515
50556
  }
50516
50557
  if (e.data.url && e.data.payload) {
50517
- var _a = e.data, url = _a.url, payload = _a.payload, shouldCacheResources = _a.shouldCacheResources;
50558
+ let { url, payload, shouldCacheResources } = e.data;
50518
50559
  if (Object.keys(payload).length === 0) {
50519
50560
  postMessage({
50520
50561
  type: 'emptyPayload'
50521
50562
  });
50522
50563
  }
50523
- var sequence_1 = payload.sequence;
50524
- var stringifiedRecordingPayload = JSON.stringify(payload.recordingPayload);
50564
+ const { sequence } = payload;
50565
+ const stringifiedRecordingPayload = JSON.stringify(payload.recordingPayload);
50525
50566
  // calculate and post back the recording payload size before the payload is compressed
50526
- var recordingPayloadSize = new TextEncoder().encode(stringifiedRecordingPayload).length;
50527
- var exceedsPayloadSizeLimit = recordingPayloadSize >= ONE_HUNDRED_MB_IN_BYTES;
50567
+ const recordingPayloadSize = new TextEncoder().encode(stringifiedRecordingPayload).length;
50568
+ const exceedsPayloadSizeLimit = recordingPayloadSize >= ONE_HUNDRED_MB_IN_BYTES;
50528
50569
  postMessage({
50529
50570
  type: 'recordingPayloadSize',
50530
- recordingPayloadSize: recordingPayloadSize,
50531
- exceedsPayloadSizeLimit: exceedsPayloadSizeLimit
50571
+ recordingPayloadSize,
50572
+ exceedsPayloadSizeLimit
50532
50573
  });
50533
50574
  // don't attempt to send the payload if it exceeds the allowed limit
50534
50575
  if (exceedsPayloadSizeLimit)
50535
50576
  return;
50536
50577
  if (shouldCacheResources) {
50537
- var hostedResourcesEvent = matchHostedResources(payload, stringifiedRecordingPayload);
50578
+ const hostedResourcesEvent = matchHostedResources(payload, stringifiedRecordingPayload);
50538
50579
  if (hostedResourcesEvent.hostedResources.length) {
50539
50580
  postMessage({
50540
50581
  type: 'hostedResources',
50541
- hostedResourcesEvent: hostedResourcesEvent
50582
+ hostedResourcesEvent
50542
50583
  });
50543
50584
  }
50544
50585
  }
50545
50586
  payload.recordingSize = recordingPayloadSize;
50546
- var body = compress(payload, 'binary');
50587
+ const body = compress(payload, 'binary');
50547
50588
  // we want to calculate ct (current time) as close as we can to the actual POST request
50548
50589
  // so that it's as accurate as possible
50549
- url = "".concat(url, "&ct=").concat(new Date().getTime());
50590
+ url = `${url}&ct=${new Date().getTime()}`;
50550
50591
  fetch(url, {
50551
50592
  method: 'POST',
50552
- body: body
50593
+ body
50553
50594
  }).then(function (response) {
50554
50595
  if (response.status < 200 || response.status >= 300) {
50555
50596
  postMessage({
50556
- error: new Error("received status code ".concat(response.status, ": ").concat(response.statusText)),
50597
+ error: new Error(`received status code ${response.status}: ${response.statusText}`),
50557
50598
  status: response.status,
50558
- sequence: sequence_1
50599
+ sequence
50559
50600
  });
50560
50601
  }
50561
50602
  else {
50562
50603
  postMessage({
50563
- sequence: sequence_1
50604
+ sequence
50564
50605
  });
50565
50606
  }
50566
- })["catch"](function (e) {
50607
+ }).catch(function (e) {
50567
50608
  postMessage({
50568
50609
  error: e,
50569
- sequence: sequence_1
50610
+ sequence
50570
50611
  });
50571
50612
  });
50572
50613
  }
@@ -50601,12 +50642,12 @@ function createReplayPlugin() {
50601
50642
  * limit of number of keys in an object
50602
50643
  * if an object contains more keys than this limit, we would call its toString function directly
50603
50644
  */
50604
- var NUM_OF_KEYS_LIMIT = 50;
50645
+ const NUM_OF_KEYS_LIMIT = 50;
50605
50646
  /**
50606
50647
  * limit number of depth in an object
50607
50648
  * if an object is too deep, toString process may cause browser OOM
50608
50649
  */
50609
- var DEPTH_OF_LIMIT = 4;
50650
+ const DEPTH_OF_LIMIT = 4;
50610
50651
  /**
50611
50652
  * serialize an HTML element by creating a shallow clone of it with text content
50612
50653
  * and return the resulting outerHTML string (without the subtree)
@@ -50617,8 +50658,8 @@ function serializeHTML(node) {
50617
50658
  if (!node || node.nodeType !== node.ELEMENT_NODE) {
50618
50659
  return '';
50619
50660
  }
50620
- var nodeClone = node.cloneNode(false);
50621
- var textContent = node.textContent;
50661
+ const nodeClone = node.cloneNode(false);
50662
+ const { textContent } = node;
50622
50663
  if (textContent) {
50623
50664
  nodeClone.textContent = textContent;
50624
50665
  }
@@ -50632,7 +50673,7 @@ function isObject(obj) {
50632
50673
  return false;
50633
50674
  if (typeof obj !== 'object')
50634
50675
  return false;
50635
- var proto = Object.getPrototypeOf(obj);
50676
+ const proto = Object.getPrototypeOf(obj);
50636
50677
  return proto === Object.prototype || proto === null;
50637
50678
  }
50638
50679
  /**
@@ -50641,11 +50682,11 @@ function isObject(obj) {
50641
50682
  function isObjTooDeep(obj, limit) {
50642
50683
  if (limit === 0)
50643
50684
  return true;
50644
- var keys = Object.keys(obj);
50685
+ const keys = Object.keys(obj);
50645
50686
  if (keys.length === 0)
50646
50687
  return false;
50647
- return keys.some(function (key) {
50648
- var value = obj[key];
50688
+ return keys.some(key => {
50689
+ const value = obj[key];
50649
50690
  return isObject(value) && isObjTooDeep(value, limit - 1);
50650
50691
  });
50651
50692
  }
@@ -50661,7 +50702,7 @@ function shouldIgnore(_obj) {
50661
50702
  return false;
50662
50703
  }
50663
50704
  // out of keys limit
50664
- var keys = Object.keys(_obj);
50705
+ const keys = Object.keys(_obj);
50665
50706
  if (keys.length > NUM_OF_KEYS_LIMIT) {
50666
50707
  return true;
50667
50708
  }
@@ -50693,7 +50734,7 @@ function stringify(arg) {
50693
50734
  return value.toString ? value.toString() : '[object Object]';
50694
50735
  }
50695
50736
  if (value instanceof ArrayBuffer)
50696
- return "ArrayBuffer { byteLength: ".concat(value.byteLength, " }");
50737
+ return `ArrayBuffer { byteLength: ${value.byteLength} }`;
50697
50738
  if (value instanceof Error)
50698
50739
  return value.name + ': ' + value.message;
50699
50740
  if (value instanceof Node) {
@@ -50701,10 +50742,10 @@ function stringify(arg) {
50701
50742
  }
50702
50743
  // Handle events
50703
50744
  if (value instanceof Event) {
50704
- var eventResult = {};
50745
+ const eventResult = {};
50705
50746
  // eslint-disable-next-line guard-for-in
50706
- for (var eventKey in value) {
50707
- var eventValue = value[eventKey];
50747
+ for (const eventKey in value) {
50748
+ const eventValue = value[eventKey];
50708
50749
  eventResult[eventKey] = Array.isArray(eventValue) && eventValue[0] instanceof HTMLElement
50709
50750
  ? serializeHTML(eventValue[0])
50710
50751
  : eventValue;
@@ -50715,31 +50756,30 @@ function stringify(arg) {
50715
50756
  });
50716
50757
  }
50717
50758
 
50718
- var StackFrame = /** @class */ (function () {
50719
- function StackFrame(obj) {
50759
+ class StackFrame {
50760
+ constructor(obj) {
50720
50761
  this.fileName = obj.fileName || '';
50721
50762
  this.functionName = obj.functionName || '';
50722
50763
  this.lineNumber = obj.lineNumber;
50723
50764
  this.columnNumber = obj.columnNumber;
50724
50765
  }
50725
- StackFrame.prototype.toString = function () {
50726
- 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;
50766
+ toString() {
50767
+ const { fileName, functionName, lineNumber = '', columnNumber = '' } = this;
50727
50768
  return functionName
50728
- ? "".concat(functionName, " (").concat(fileName, ":").concat(lineNumber, ":").concat(columnNumber, ")")
50729
- : "".concat(fileName, ":").concat(lineNumber, ":").concat(columnNumber);
50730
- };
50731
- return StackFrame;
50732
- }());
50733
- var FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
50734
- var CHROME_EDGE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
50735
- var SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/;
50736
- var LOCATION_REGEXP = /(.+?)(?::(\d+))?(?::(\d+))?$/;
50737
- var DEFAULT_NUM_FRAMES_TO_SKIP = 5;
50738
- var ErrorStackParser = {
50769
+ ? `${functionName} (${fileName}:${lineNumber}:${columnNumber})`
50770
+ : `${fileName}:${lineNumber}:${columnNumber}`;
50771
+ }
50772
+ }
50773
+ const FIREFOX_SAFARI_STACK_REGEXP = /(^|@)\S+:\d+/;
50774
+ const CHROME_EDGE_STACK_REGEXP = /^\s*at .*(\S+:\d+|\(native\))/m;
50775
+ const SAFARI_NATIVE_CODE_REGEXP = /^(eval@)?(\[native code])?$/;
50776
+ const LOCATION_REGEXP = /(.+?)(?::(\d+))?(?::(\d+))?$/;
50777
+ const DEFAULT_NUM_FRAMES_TO_SKIP = 5;
50778
+ const ErrorStackParser = {
50739
50779
  /**
50740
50780
  * Given an Error object, extract the most information from it.
50741
50781
  */
50742
- parse: function (error, maxFramesToSave) {
50782
+ parse(error, maxFramesToSave) {
50743
50783
  if (!(error === null || error === void 0 ? void 0 : error.stack))
50744
50784
  return [];
50745
50785
  // Chrome, Edge, Opera ≥15
@@ -50753,25 +50793,24 @@ var ErrorStackParser = {
50753
50793
  return [];
50754
50794
  },
50755
50795
  // Separate line and column numbers from a string of the form: (URI:Line:Column)
50756
- extractLocation: function (urlLike) {
50796
+ extractLocation(urlLike) {
50757
50797
  // Fail-fast but return locations like "(native)"
50758
50798
  if (urlLike.indexOf(':') === -1) {
50759
50799
  return [urlLike];
50760
50800
  }
50761
- var parts = LOCATION_REGEXP.exec(urlLike.replace(/[()]/g, ''));
50801
+ const parts = LOCATION_REGEXP.exec(urlLike.replace(/[()]/g, ''));
50762
50802
  if (!parts)
50763
- throw new Error("Cannot parse given url: ".concat(urlLike));
50803
+ throw new Error(`Cannot parse given url: ${urlLike}`);
50764
50804
  return [parts[1], parts[2] || undefined, parts[3] || undefined];
50765
50805
  },
50766
- parseHelper: function (_a, error, maxFramesToSave, callback) {
50767
- var regex = _a.regex, includeMatchedLine = _a.includeMatchedLine;
50768
- var lines = error.stack.split('\n');
50769
- var frames = [];
50770
- var validFramesFound = 0;
50771
- for (var i = 0; i < lines.length; i++) {
50772
- var line = lines[i];
50773
- var lineMatchesRegex = regex.test(line);
50774
- var shouldSkipLine = (includeMatchedLine && !lineMatchesRegex) || // if line doesn't match regex and we want matched lines, skip it
50806
+ parseHelper({ regex, includeMatchedLine }, error, maxFramesToSave, callback) {
50807
+ const lines = error.stack.split('\n');
50808
+ const frames = [];
50809
+ let validFramesFound = 0;
50810
+ for (let i = 0; i < lines.length; i++) {
50811
+ const line = lines[i];
50812
+ const lineMatchesRegex = regex.test(line);
50813
+ const shouldSkipLine = (includeMatchedLine && !lineMatchesRegex) || // if line doesn't match regex and we want matched lines, skip it
50775
50814
  (!includeMatchedLine && lineMatchesRegex); // if line does match regex but we don't want matched lines, skip it
50776
50815
  if (shouldSkipLine)
50777
50816
  continue;
@@ -50786,12 +50825,11 @@ var ErrorStackParser = {
50786
50825
  }
50787
50826
  return frames;
50788
50827
  },
50789
- parseChromiumStack: function (error, maxFramesToSave) {
50790
- var _this = this;
50791
- return this.parseHelper({ regex: CHROME_EDGE_STACK_REGEXP, includeMatchedLine: true }, error, maxFramesToSave, function (line, frames) {
50792
- var sanitizedLine;
50828
+ parseChromiumStack(error, maxFramesToSave) {
50829
+ return this.parseHelper({ regex: CHROME_EDGE_STACK_REGEXP, includeMatchedLine: true }, error, maxFramesToSave, (line, frames) => {
50830
+ let sanitizedLine;
50793
50831
  if (line.indexOf('(eval ') > -1) {
50794
- var processedLine = line
50832
+ const processedLine = line
50795
50833
  .replace(/eval code/g, 'eval')
50796
50834
  .replace(/(\(eval at [^()]*)|(\),.*$)/g, '');
50797
50835
  sanitizedLine = processedLine.replace(/^\s+/, '').replace(/\(eval code/g, '(');
@@ -50801,7 +50839,7 @@ var ErrorStackParser = {
50801
50839
  }
50802
50840
  // capture and preserve the parenthesized location "(/foo/my bar.js:12:87)"
50803
50841
  // in case it has spaces in it, as the string is split on \s+ later on
50804
- var location;
50842
+ let location;
50805
50843
  if (sanitizedLine.indexOf('(') > -1 && sanitizedLine.indexOf('):') > -1) {
50806
50844
  location = sanitizedLine.match(/ (\((.+):(\d+):(\d+)\)$)/);
50807
50845
  }
@@ -50809,23 +50847,22 @@ var ErrorStackParser = {
50809
50847
  sanitizedLine = location
50810
50848
  ? sanitizedLine.replace(location[0], '')
50811
50849
  : sanitizedLine;
50812
- var tokens = sanitizedLine.split(/\s+/).slice(1);
50850
+ const tokens = sanitizedLine.split(/\s+/).slice(1);
50813
50851
  // if a location was matched, pass it to extractLocation() otherwise pop the last token
50814
- var locationParts = _this.extractLocation(location ? location[1] : tokens.pop() || '');
50815
- var functionName = tokens.join(' ') || undefined;
50816
- var fileName = (locationParts[0] === 'eval' || locationParts[0] === '<anonymous>') ? undefined : locationParts[0];
50852
+ const locationParts = this.extractLocation(location ? location[1] : tokens.pop() || '');
50853
+ const functionName = tokens.join(' ') || undefined;
50854
+ const fileName = (locationParts[0] === 'eval' || locationParts[0] === '<anonymous>') ? undefined : locationParts[0];
50817
50855
  frames.push(new StackFrame({
50818
- functionName: functionName,
50819
- fileName: fileName,
50856
+ functionName,
50857
+ fileName,
50820
50858
  lineNumber: locationParts[1],
50821
50859
  columnNumber: locationParts[2]
50822
50860
  }));
50823
50861
  });
50824
50862
  },
50825
- parseFirefoxSafariStack: function (error, maxFramesToSave) {
50826
- var _this = this;
50827
- return this.parseHelper({ regex: SAFARI_NATIVE_CODE_REGEXP, includeMatchedLine: false }, error, maxFramesToSave, function (line, frames) {
50828
- var processedLine = line;
50863
+ parseFirefoxSafariStack(error, maxFramesToSave) {
50864
+ return this.parseHelper({ regex: SAFARI_NATIVE_CODE_REGEXP, includeMatchedLine: false }, error, maxFramesToSave, (line, frames) => {
50865
+ let processedLine = line;
50829
50866
  // Throw away eval information until we implement stacktrace.js/stackframe#8
50830
50867
  if (processedLine.indexOf(' > eval') > -1) {
50831
50868
  processedLine = processedLine.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g, ':$1');
@@ -50837,12 +50874,12 @@ var ErrorStackParser = {
50837
50874
  }));
50838
50875
  return;
50839
50876
  }
50840
- var functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/;
50841
- var matches = processedLine.match(functionNameRegex);
50842
- var functionName = matches && matches[1] ? matches[1] : undefined;
50843
- var locationParts = _this.extractLocation(processedLine.replace(functionNameRegex, ''));
50877
+ const functionNameRegex = /((.*".+"[^@]*)?[^@]*)(?:@)/;
50878
+ const matches = processedLine.match(functionNameRegex);
50879
+ const functionName = matches && matches[1] ? matches[1] : undefined;
50880
+ const locationParts = this.extractLocation(processedLine.replace(functionNameRegex, ''));
50844
50881
  frames.push(new StackFrame({
50845
- functionName: functionName,
50882
+ functionName,
50846
50883
  fileName: locationParts[0],
50847
50884
  lineNumber: locationParts[1],
50848
50885
  columnNumber: locationParts[2]
@@ -50877,7 +50914,7 @@ function includes(str, substring) {
50877
50914
  function getResourceType(blockedURI, directive) {
50878
50915
  if (!directive || typeof directive !== 'string')
50879
50916
  return 'resource';
50880
- var d = directive.toLowerCase();
50917
+ const d = directive.toLowerCase();
50881
50918
  if (blockedURI === 'inline') {
50882
50919
  if (includes(d, 'script-src-attr')) {
50883
50920
  return 'inline event handler';
@@ -50936,12 +50973,11 @@ function getResourceType(blockedURI, directive) {
50936
50973
  function getDirective(policy, directiveName) {
50937
50974
  if (!policy || !directiveName)
50938
50975
  return '';
50939
- var needle = directiveName.toLowerCase();
50940
- for (var _i = 0, _a = policy.split(';'); _i < _a.length; _i++) {
50941
- var directive = _a[_i];
50942
- var trimmed = directive.trim();
50943
- var lower = trimmed.toLowerCase();
50944
- if (lower === needle || lower.startsWith("".concat(needle, " "))) {
50976
+ const needle = directiveName.toLowerCase();
50977
+ for (const directive of policy.split(';')) {
50978
+ const trimmed = directive.trim();
50979
+ const lower = trimmed.toLowerCase();
50980
+ if (lower === needle || lower.startsWith(`${needle} `)) {
50945
50981
  return trimmed;
50946
50982
  }
50947
50983
  }
@@ -50963,7 +50999,7 @@ function getDirective(policy, directiveName) {
50963
50999
  function getArticle(phrase) {
50964
51000
  if (!phrase || typeof phrase !== 'string')
50965
51001
  return 'A';
50966
- var c = phrase.trim().charAt(0).toLowerCase();
51002
+ const c = phrase.trim().charAt(0).toLowerCase();
50967
51003
  return includes('aeiou', c) ? 'An' : 'A';
50968
51004
  }
50969
51005
  /**
@@ -51006,47 +51042,46 @@ function createCspViolationMessage(blockedURI, directive, isReportOnly, original
51006
51042
  return 'Content Security Policy: Unknown violation occurred.';
51007
51043
  }
51008
51044
  try {
51009
- var reportOnlyText = isReportOnly ? ' (Report-Only)' : '';
51045
+ const reportOnlyText = isReportOnly ? ' (Report-Only)' : '';
51010
51046
  // special case for frame-ancestors since it doesn't fit our template at all
51011
51047
  if ((directive === null || directive === void 0 ? void 0 : directive.toLowerCase()) === 'frame-ancestors') {
51012
- 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, "\".");
51048
+ 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}".`;
51013
51049
  }
51014
- var resourceType = getResourceType(blockedURI, directive);
51015
- var article = getArticle(resourceType);
51016
- var source = formatBlockedUri(blockedURI);
51017
- var directiveValue = getDirective(originalPolicy, directive);
51018
- var policyDisplay = directiveValue || directive;
51019
- var resourceDescription = "".concat(article, " ").concat(resourceType).concat(source ? " from ".concat(source) : '');
51020
- return "Content Security Policy".concat(reportOnlyText, ": ").concat(resourceDescription, " was blocked by your site's `").concat(policyDisplay, "` policy.\nCurrent CSP: \"").concat(originalPolicy, "\".");
51050
+ const resourceType = getResourceType(blockedURI, directive);
51051
+ const article = getArticle(resourceType);
51052
+ const source = formatBlockedUri(blockedURI);
51053
+ const directiveValue = getDirective(originalPolicy, directive);
51054
+ const policyDisplay = directiveValue || directive;
51055
+ const resourceDescription = `${article} ${resourceType}${source ? ` from ${source}` : ''}`;
51056
+ return `Content Security Policy${reportOnlyText}: ${resourceDescription} was blocked by your site's \`${policyDisplay}\` policy.\nCurrent CSP: "${originalPolicy}".`;
51021
51057
  }
51022
51058
  catch (error) {
51023
- return "Content Security Policy: Error formatting violation message: ".concat(error.message);
51059
+ return `Content Security Policy: Error formatting violation message: ${error.message}`;
51024
51060
  }
51025
51061
  }
51026
51062
 
51027
- var MAX_LENGTH = 1000;
51028
- var PII_PATTERN = {
51063
+ const MAX_LENGTH = 1000;
51064
+ const PII_PATTERN = {
51029
51065
  ip: /\b(?:\d{1,3}\.){3}\d{1,3}\b/g,
51030
51066
  ssn: /\b\d{3}-\d{2}-\d{4}\b/g,
51031
51067
  creditCard: /\b(?:\d[ -]?){12,18}\d\b/g,
51032
51068
  httpsUrls: /https:\/\/[^\s]+/g,
51033
51069
  email: /[\w._+-]+@[\w.-]+\.\w+/g
51034
51070
  };
51035
- var PII_REPLACEMENT = '*'.repeat(10);
51036
- var JSON_PII_KEYS = ['password', 'email', 'key', 'token', 'auth', 'authentication', 'phone', 'address', 'ssn'];
51037
- var UNABLE_TO_DISPLAY_BODY = '[Unable to display body: detected PII could not be redacted]';
51038
- var joinedKeys = JSON_PII_KEYS.join('|');
51039
- var keyPattern = "\"([^\"]*(?:".concat(joinedKeys, ")[^\"]*)\"");
51071
+ const PII_REPLACEMENT = '*'.repeat(10);
51072
+ const JSON_PII_KEYS = ['password', 'email', 'key', 'token', 'auth', 'authentication', 'phone', 'address', 'ssn'];
51073
+ const UNABLE_TO_DISPLAY_BODY = '[Unable to display body: detected PII could not be redacted]';
51074
+ const joinedKeys = JSON_PII_KEYS.join('|');
51075
+ const keyPattern = `"([^"]*(?:${joinedKeys})[^"]*)"`;
51040
51076
  // only scrub strings, numbers, and booleans
51041
- var acceptedValues = '("([^"\\\\]*(?:\\\\.[^"\\\\]*)*")|(\\d+)|(true|false))';
51077
+ const acceptedValues = '("([^"\\\\]*(?:\\\\.[^"\\\\]*)*")|(\\d+)|(true|false))';
51042
51078
  /**
51043
51079
  * Truncates a string to the max length
51044
51080
  * @access private
51045
51081
  * @param {String} string
51046
51082
  * @returns {String}
51047
51083
  */
51048
- function truncate(string, includeEllipsis) {
51049
- if (includeEllipsis === void 0) { includeEllipsis = false; }
51084
+ function truncate(string, includeEllipsis = false) {
51050
51085
  if (string.length <= MAX_LENGTH)
51051
51086
  return string;
51052
51087
  if (includeEllipsis) {
@@ -51063,7 +51098,7 @@ function truncate(string, includeEllipsis) {
51063
51098
  * @returns {String}
51064
51099
  */
51065
51100
  function generateLogKey(methodName, message, stackTrace) {
51066
- return "".concat(methodName, "|").concat(message, "|").concat(stackTrace);
51101
+ return `${methodName}|${message}|${stackTrace}`;
51067
51102
  }
51068
51103
  /**
51069
51104
  * Checks if a string has 2 or more digits, a https URL, or an email address
@@ -51080,13 +51115,12 @@ function mightContainPII(string) {
51080
51115
  * @param {String} string
51081
51116
  * @returns {String}
51082
51117
  */
51083
- function scrubPII(_a) {
51084
- var string = _a.string, _ = _a._;
51118
+ function scrubPII({ string, _ }) {
51085
51119
  if (!string || typeof string !== 'string')
51086
51120
  return string;
51087
51121
  if (!mightContainPII(string))
51088
51122
  return string;
51089
- return _.reduce(_.values(PII_PATTERN), function (str, pattern) { return str.replace(pattern, PII_REPLACEMENT); }, string);
51123
+ return _.reduce(_.values(PII_PATTERN), (str, pattern) => str.replace(pattern, PII_REPLACEMENT), string);
51090
51124
  }
51091
51125
  /**
51092
51126
  * Scrub PII from a stringified JSON object
@@ -51095,14 +51129,12 @@ function scrubPII(_a) {
51095
51129
  * @returns {String}
51096
51130
  */
51097
51131
  function scrubJsonPII(string) {
51098
- var fullScrubRegex = new RegExp("".concat(keyPattern, "\\s*:\\s*[\\{\\[]"), 'i');
51132
+ const fullScrubRegex = new RegExp(`${keyPattern}\\s*:\\s*[\\{\\[]`, 'i');
51099
51133
  if (fullScrubRegex.test(string)) {
51100
51134
  return UNABLE_TO_DISPLAY_BODY;
51101
51135
  }
51102
- var keyValueScrubRegex = new RegExp("".concat(keyPattern, "\\s*:\\s*").concat(acceptedValues), 'gi');
51103
- return string.replace(keyValueScrubRegex, function (match, key) {
51104
- return "\"".concat(key, "\":\"").concat(PII_REPLACEMENT, "\"");
51105
- });
51136
+ const keyValueScrubRegex = new RegExp(`${keyPattern}\\s*:\\s*${acceptedValues}`, 'gi');
51137
+ return string.replace(keyValueScrubRegex, (match, key) => `"${key}":"${PII_REPLACEMENT}"`);
51106
51138
  }
51107
51139
  /**
51108
51140
  * Checks if a string is a JSON object
@@ -51114,7 +51146,7 @@ function scrubJsonPII(string) {
51114
51146
  function mightContainJson(string, contentType) {
51115
51147
  if (!string || typeof string !== 'string')
51116
51148
  return false;
51117
- var firstChar = string.charAt(0);
51149
+ const firstChar = string.charAt(0);
51118
51150
  if (contentType && contentType.indexOf('application/json') !== -1) {
51119
51151
  return true;
51120
51152
  }
@@ -51127,20 +51159,19 @@ function mightContainJson(string, contentType) {
51127
51159
  * @param {String} contentType
51128
51160
  * @returns {String}
51129
51161
  */
51130
- function maskSensitiveFields(_a) {
51131
- var string = _a.string, contentType = _a.contentType, _ = _a._;
51162
+ function maskSensitiveFields({ string, contentType, _ }) {
51132
51163
  if (!string || typeof string !== 'string')
51133
51164
  return string;
51134
51165
  if (mightContainJson(string, contentType)) {
51135
51166
  string = scrubJsonPII(string);
51136
51167
  }
51137
51168
  if (mightContainPII(string)) {
51138
- string = scrubPII({ string: string, _: _ });
51169
+ string = scrubPII({ string, _ });
51139
51170
  }
51140
51171
  return string;
51141
51172
  }
51142
51173
 
51143
- var DEV_LOG_TYPE = 'devlog';
51174
+ const DEV_LOG_TYPE = 'devlog';
51144
51175
  function createDevLogEnvelope(pluginAPI, globalPendo) {
51145
51176
  return {
51146
51177
  browser_time: pluginAPI.util.getNow(),
@@ -51151,12 +51182,12 @@ function createDevLogEnvelope(pluginAPI, globalPendo) {
51151
51182
  };
51152
51183
  }
51153
51184
 
51154
- var TOKEN_MAX_SIZE = 100;
51155
- var TOKEN_REFILL_RATE = 10;
51156
- var TOKEN_REFRESH_INTERVAL = 1000;
51157
- var MAX_UNCOMPRESSED_SIZE = 125000; // 125KB
51158
- var DevlogBuffer = /** @class */ (function () {
51159
- function DevlogBuffer(pendo, pluginAPI) {
51185
+ const TOKEN_MAX_SIZE = 100;
51186
+ const TOKEN_REFILL_RATE = 10;
51187
+ const TOKEN_REFRESH_INTERVAL = 1000;
51188
+ const MAX_UNCOMPRESSED_SIZE = 125000; // 125KB
51189
+ class DevlogBuffer {
51190
+ constructor(pendo, pluginAPI) {
51160
51191
  this.pendo = pendo;
51161
51192
  this.pluginAPI = pluginAPI;
51162
51193
  this.events = [];
@@ -51167,36 +51198,36 @@ var DevlogBuffer = /** @class */ (function () {
51167
51198
  this.lastRefillTime = this.pluginAPI.util.getNow();
51168
51199
  this.nextRefillTime = this.lastRefillTime + TOKEN_REFRESH_INTERVAL;
51169
51200
  }
51170
- DevlogBuffer.prototype.isEmpty = function () {
51201
+ isEmpty() {
51171
51202
  return this.events.length === 0 && this.payloads.length === 0;
51172
- };
51173
- DevlogBuffer.prototype.refillTokens = function () {
51174
- var now = this.pluginAPI.util.getNow();
51203
+ }
51204
+ refillTokens() {
51205
+ const now = this.pluginAPI.util.getNow();
51175
51206
  if (now >= this.nextRefillTime) {
51176
- var timeSinceLastRefill = now - this.lastRefillTime;
51177
- var secondsSinceLastRefill = Math.floor(timeSinceLastRefill / TOKEN_REFRESH_INTERVAL);
51178
- var tokensToRefill = secondsSinceLastRefill * TOKEN_REFILL_RATE;
51207
+ const timeSinceLastRefill = now - this.lastRefillTime;
51208
+ const secondsSinceLastRefill = Math.floor(timeSinceLastRefill / TOKEN_REFRESH_INTERVAL);
51209
+ const tokensToRefill = secondsSinceLastRefill * TOKEN_REFILL_RATE;
51179
51210
  this.tokens = Math.min(this.tokens + tokensToRefill, TOKEN_MAX_SIZE);
51180
51211
  this.lastRefillTime = now;
51181
51212
  this.nextRefillTime = now + TOKEN_REFRESH_INTERVAL;
51182
51213
  }
51183
- };
51184
- DevlogBuffer.prototype.clear = function () {
51214
+ }
51215
+ clear() {
51185
51216
  this.events = [];
51186
51217
  this.lastEvent = null;
51187
51218
  this.uncompressedSize = 0;
51188
- };
51189
- DevlogBuffer.prototype.hasTokenAvailable = function () {
51219
+ }
51220
+ hasTokenAvailable() {
51190
51221
  this.refillTokens();
51191
51222
  return this.tokens > 0;
51192
- };
51193
- DevlogBuffer.prototype.estimateEventSize = function (event) {
51223
+ }
51224
+ estimateEventSize(event) {
51194
51225
  return JSON.stringify(event).length;
51195
- };
51196
- DevlogBuffer.prototype.push = function (event) {
51226
+ }
51227
+ push(event) {
51197
51228
  if (!this.hasTokenAvailable())
51198
51229
  return false;
51199
- var eventSize = this.estimateEventSize(event);
51230
+ const eventSize = this.estimateEventSize(event);
51200
51231
  if (this.uncompressedSize + eventSize > MAX_UNCOMPRESSED_SIZE) {
51201
51232
  this.compressCurrentChunk();
51202
51233
  }
@@ -51205,55 +51236,54 @@ var DevlogBuffer = /** @class */ (function () {
51205
51236
  this.events.push(event);
51206
51237
  this.tokens = Math.max(this.tokens - 1, 0);
51207
51238
  return true;
51208
- };
51209
- DevlogBuffer.prototype.compressCurrentChunk = function () {
51239
+ }
51240
+ compressCurrentChunk() {
51210
51241
  if (this.events.length === 0)
51211
51242
  return;
51212
- var jzb = this.pendo.compress(this.events);
51243
+ const jzb = this.pendo.compress(this.events);
51213
51244
  this.payloads.push(jzb);
51214
51245
  this.clear();
51215
- };
51216
- DevlogBuffer.prototype.generateUrl = function () {
51217
- var queryParams = {
51246
+ }
51247
+ generateUrl() {
51248
+ const queryParams = {
51218
51249
  v: this.pendo.VERSION,
51219
51250
  ct: this.pluginAPI.util.getNow()
51220
51251
  };
51221
51252
  return this.pluginAPI.transmit.buildBaseDataUrl(DEV_LOG_TYPE, this.pendo.apiKey, queryParams);
51222
- };
51223
- DevlogBuffer.prototype.pack = function () {
51253
+ }
51254
+ pack() {
51224
51255
  if (this.isEmpty())
51225
51256
  return;
51226
- var url = this.generateUrl();
51257
+ const url = this.generateUrl();
51227
51258
  this.compressCurrentChunk();
51228
- var payloads = this.pendo._.map(this.payloads, function (jzb) { return ({
51229
- jzb: jzb,
51230
- url: url
51231
- }); });
51259
+ const payloads = this.pendo._.map(this.payloads, (jzb) => ({
51260
+ jzb,
51261
+ url
51262
+ }));
51232
51263
  this.payloads = [];
51233
51264
  return payloads;
51234
- };
51235
- return DevlogBuffer;
51236
- }());
51265
+ }
51266
+ }
51237
51267
 
51238
- var DevlogTransport = /** @class */ (function () {
51239
- function DevlogTransport(globalPendo, pluginAPI) {
51268
+ class DevlogTransport {
51269
+ constructor(globalPendo, pluginAPI) {
51240
51270
  this.pendo = globalPendo;
51241
51271
  this.pluginAPI = pluginAPI;
51242
51272
  }
51243
- DevlogTransport.prototype.buildGetUrl = function (baseUrl, jzb) {
51244
- var params = {};
51273
+ buildGetUrl(baseUrl, jzb) {
51274
+ const params = {};
51245
51275
  if (this.pluginAPI.agent.treatAsAdoptPartner()) {
51246
51276
  this.pluginAPI.agent.addAccountIdParams(params, this.pendo.get_account_id(), this.pluginAPI.ConfigReader.get('oemAccountId'));
51247
51277
  }
51248
- var jwtOptions = this.pluginAPI.agent.getJwtInfoCopy();
51278
+ const jwtOptions = this.pluginAPI.agent.getJwtInfoCopy();
51249
51279
  if (!this.pendo._.isEmpty(jwtOptions)) {
51250
51280
  this.pendo._.extend(params, jwtOptions);
51251
51281
  }
51252
51282
  params.jzb = jzb;
51253
- var queryString = this.pendo._.map(params, function (value, key) { return "".concat(key, "=").concat(value); }).join('&');
51254
- return "".concat(baseUrl).concat(baseUrl.indexOf('?') !== -1 ? '&' : '?').concat(queryString);
51255
- };
51256
- DevlogTransport.prototype.get = function (url, options) {
51283
+ const queryString = this.pendo._.map(params, (value, key) => `${key}=${value}`).join('&');
51284
+ return `${baseUrl}${baseUrl.indexOf('?') !== -1 ? '&' : '?'}${queryString}`;
51285
+ }
51286
+ get(url, options) {
51257
51287
  options.method = 'GET';
51258
51288
  if (this.pluginAPI.transmit.fetchKeepalive.supported()) {
51259
51289
  return this.pluginAPI.transmit.fetchKeepalive(url, options);
@@ -51261,90 +51291,86 @@ var DevlogTransport = /** @class */ (function () {
51261
51291
  else {
51262
51292
  return this.pendo.ajax.get(url);
51263
51293
  }
51264
- };
51265
- DevlogTransport.prototype.sendRequestWithGet = function (_a) {
51266
- var url = _a.url, jzb = _a.jzb;
51267
- var getUrl = this.buildGetUrl(url, jzb);
51294
+ }
51295
+ sendRequestWithGet({ url, jzb }) {
51296
+ const getUrl = this.buildGetUrl(url, jzb);
51268
51297
  return this.get(getUrl, {
51269
51298
  headers: {
51270
51299
  'Content-Type': 'application/octet-stream'
51271
51300
  }
51272
51301
  });
51273
- };
51274
- DevlogTransport.prototype.post = function (url, options) {
51302
+ }
51303
+ post(url, options) {
51275
51304
  options.method = 'POST';
51276
51305
  if (options.keepalive && this.pluginAPI.transmit.fetchKeepalive.supported()) {
51277
51306
  return this.pluginAPI.transmit.fetchKeepalive(url, options);
51278
51307
  }
51279
51308
  else if (options.keepalive && this.pluginAPI.transmit.sendBeacon.supported()) {
51280
- var result = this.pluginAPI.transmit.sendBeacon(url, new Blob([options.body]));
51309
+ const result = this.pluginAPI.transmit.sendBeacon(url, new Blob([options.body]));
51281
51310
  return result ? Promise$2.resolve() : Promise$2.reject(new Error('sendBeacon failed to send devlog data'));
51282
51311
  }
51283
51312
  else {
51284
51313
  return this.pendo.ajax.post(url, options.body);
51285
51314
  }
51286
- };
51287
- DevlogTransport.prototype.sendRequestWithPost = function (_a, isUnload) {
51288
- var url = _a.url, jzb = _a.jzb;
51289
- var jwtOptions = this.pluginAPI.agent.getJwtInfoCopy();
51290
- var bodyPayload = {
51315
+ }
51316
+ sendRequestWithPost({ url, jzb }, isUnload) {
51317
+ const jwtOptions = this.pluginAPI.agent.getJwtInfoCopy();
51318
+ const bodyPayload = {
51291
51319
  events: jzb,
51292
51320
  browser_time: this.pluginAPI.util.getNow()
51293
51321
  };
51294
51322
  if (this.pluginAPI.agent.treatAsAdoptPartner()) {
51295
51323
  this.pluginAPI.agent.addAccountIdParams(bodyPayload, this.pendo.get_account_id(), this.pluginAPI.ConfigReader.get('oemAccountId'));
51296
51324
  }
51297
- var body = JSON.stringify(this.pendo._.extend(bodyPayload, jwtOptions));
51325
+ const body = JSON.stringify(this.pendo._.extend(bodyPayload, jwtOptions));
51298
51326
  return this.post(url, {
51299
- body: body,
51327
+ body,
51300
51328
  headers: {
51301
51329
  'Content-Type': 'application/json'
51302
51330
  },
51303
51331
  keepalive: isUnload
51304
51332
  });
51305
- };
51306
- DevlogTransport.prototype.sendRequest = function (_a, isUnload) {
51307
- var url = _a.url, jzb = _a.jzb;
51308
- var compressedLength = jzb.length;
51333
+ }
51334
+ sendRequest({ url, jzb }, isUnload) {
51335
+ const compressedLength = jzb.length;
51309
51336
  if (compressedLength <= this.pluginAPI.constants.ENCODED_EVENT_MAX_LENGTH && !this.pluginAPI.ConfigReader.get('sendEventsWithPostOnly')) {
51310
- return this.sendRequestWithGet({ url: url, jzb: jzb });
51337
+ return this.sendRequestWithGet({ url, jzb });
51311
51338
  }
51312
- return this.sendRequestWithPost({ url: url, jzb: jzb }, isUnload);
51313
- };
51314
- return DevlogTransport;
51315
- }());
51339
+ return this.sendRequestWithPost({ url, jzb }, isUnload);
51340
+ }
51341
+ }
51316
51342
 
51317
51343
  function ConsoleCapture() {
51318
- var pluginAPI;
51319
- var _;
51320
- var globalPendo;
51321
- var buffer;
51322
- var sendQueue;
51323
- var sendInterval;
51324
- var transport;
51325
- var isPtmPaused;
51326
- var isCapturingConsoleLogs = false;
51327
- var CAPTURE_CONSOLE_CONFIG = 'captureConsoleLogs';
51328
- var CONSOLE_METHODS = ['log', 'warn', 'error', 'info'];
51329
- var DEV_LOG_SUB_TYPE = 'console';
51344
+ let pluginAPI;
51345
+ let _;
51346
+ let globalPendo;
51347
+ let buffer;
51348
+ let sendQueue;
51349
+ let sendInterval;
51350
+ let transport;
51351
+ let isPtmPaused;
51352
+ let isCapturingConsoleLogs = false;
51353
+ const CAPTURE_CONSOLE_CONFIG = 'captureConsoleLogs';
51354
+ const CONSOLE_METHODS = ['log', 'warn', 'error', 'info'];
51355
+ const DEV_LOG_SUB_TYPE = 'console';
51330
51356
  // deduplicate logs
51331
- var lastLogKey = '';
51357
+ let lastLogKey = '';
51332
51358
  return {
51333
51359
  name: 'ConsoleCapture',
51334
- initialize: initialize,
51335
- teardown: teardown,
51336
- addIntercepts: addIntercepts,
51337
- createConsoleEvent: createConsoleEvent,
51338
- captureStackTrace: captureStackTrace,
51339
- send: send,
51340
- setCaptureState: setCaptureState,
51341
- recordingStarted: recordingStarted,
51342
- recordingStopped: recordingStopped,
51343
- onAppHidden: onAppHidden,
51344
- onAppUnloaded: onAppUnloaded,
51345
- onPtmPaused: onPtmPaused,
51346
- onPtmUnpaused: onPtmUnpaused,
51347
- securityPolicyViolationFn: securityPolicyViolationFn,
51360
+ initialize,
51361
+ teardown,
51362
+ addIntercepts,
51363
+ createConsoleEvent,
51364
+ captureStackTrace,
51365
+ send,
51366
+ setCaptureState,
51367
+ recordingStarted,
51368
+ recordingStopped,
51369
+ onAppHidden,
51370
+ onAppUnloaded,
51371
+ onPtmPaused,
51372
+ onPtmUnpaused,
51373
+ securityPolicyViolationFn,
51348
51374
  get isCapturingConsoleLogs() {
51349
51375
  return isCapturingConsoleLogs;
51350
51376
  },
@@ -51361,16 +51387,16 @@ function ConsoleCapture() {
51361
51387
  function initialize(pendo, PluginAPI) {
51362
51388
  _ = pendo._;
51363
51389
  pluginAPI = PluginAPI;
51364
- var ConfigReader = pluginAPI.ConfigReader;
51390
+ const { ConfigReader } = pluginAPI;
51365
51391
  ConfigReader.addOption(CAPTURE_CONSOLE_CONFIG, [ConfigReader.sources.PENDO_CONFIG_SRC], false);
51366
- var captureConsoleEnabled = ConfigReader.get(CAPTURE_CONSOLE_CONFIG);
51392
+ const captureConsoleEnabled = ConfigReader.get(CAPTURE_CONSOLE_CONFIG);
51367
51393
  if (!captureConsoleEnabled)
51368
51394
  return;
51369
51395
  globalPendo = pendo;
51370
51396
  buffer = new DevlogBuffer(pendo, pluginAPI);
51371
51397
  transport = new DevlogTransport(pendo, pluginAPI);
51372
51398
  sendQueue = new pluginAPI.SendQueue(transport.sendRequest.bind(transport));
51373
- sendInterval = setInterval(function () {
51399
+ sendInterval = setInterval(() => {
51374
51400
  if (!sendQueue.failed()) {
51375
51401
  send();
51376
51402
  }
@@ -51396,19 +51422,17 @@ function ConsoleCapture() {
51396
51422
  function onPtmUnpaused() {
51397
51423
  isPtmPaused = false;
51398
51424
  if (!buffer.isEmpty()) {
51399
- for (var _i = 0, _a = buffer.events; _i < _a.length; _i++) {
51400
- var event_1 = _a[_i];
51401
- pluginAPI.Events.eventCaptured.trigger(event_1);
51425
+ for (const event of buffer.events) {
51426
+ pluginAPI.Events.eventCaptured.trigger(event);
51402
51427
  }
51403
51428
  send();
51404
51429
  }
51405
51430
  }
51406
- function setCaptureState(_a) {
51407
- var _b = _a === void 0 ? {} : _a, _c = _b.shouldCapture, shouldCapture = _c === void 0 ? false : _c, _d = _b.reason, reason = _d === void 0 ? '' : _d;
51431
+ function setCaptureState({ shouldCapture = false, reason = '' } = {}) {
51408
51432
  if (shouldCapture === isCapturingConsoleLogs)
51409
51433
  return;
51410
51434
  isCapturingConsoleLogs = shouldCapture;
51411
- pluginAPI.log.info("[ConsoleCapture] Console log capture ".concat(shouldCapture ? 'started' : 'stopped').concat(reason ? ": ".concat(reason) : ''));
51435
+ pluginAPI.log.info(`[ConsoleCapture] Console log capture ${shouldCapture ? 'started' : 'stopped'}${reason ? `: ${reason}` : ''}`);
51412
51436
  }
51413
51437
  function recordingStarted() {
51414
51438
  setCaptureState({ shouldCapture: true, reason: 'recording started' });
@@ -51422,12 +51446,12 @@ function ConsoleCapture() {
51422
51446
  }
51423
51447
  function addIntercepts() {
51424
51448
  _.each(CONSOLE_METHODS, function (methodName) {
51425
- var originalMethod = console[methodName];
51449
+ const originalMethod = console[methodName];
51426
51450
  if (!originalMethod)
51427
51451
  return;
51428
51452
  console[methodName] = _.wrap(originalMethod, function (originalFn) {
51429
51453
  // slice 1 to omit originalFn
51430
- var args = _.toArray(arguments).slice(1);
51454
+ const args = _.toArray(arguments).slice(1);
51431
51455
  originalFn.apply(console, args);
51432
51456
  createConsoleEvent(args, methodName);
51433
51457
  });
@@ -51439,10 +51463,10 @@ function ConsoleCapture() {
51439
51463
  function securityPolicyViolationFn(evt) {
51440
51464
  if (!evt || typeof evt !== 'object')
51441
51465
  return;
51442
- var blockedURI = evt.blockedURI, violatedDirective = evt.violatedDirective, effectiveDirective = evt.effectiveDirective, disposition = evt.disposition, originalPolicy = evt.originalPolicy;
51443
- var directive = violatedDirective || effectiveDirective;
51444
- var isReportOnly = disposition === 'report';
51445
- var message = createCspViolationMessage(blockedURI, directive, isReportOnly, originalPolicy);
51466
+ const { blockedURI, violatedDirective, effectiveDirective, disposition, originalPolicy } = evt;
51467
+ const directive = violatedDirective || effectiveDirective;
51468
+ const isReportOnly = disposition === 'report';
51469
+ const message = createCspViolationMessage(blockedURI, directive, isReportOnly, originalPolicy);
51446
51470
  if (isReportOnly) {
51447
51471
  createConsoleEvent([message], 'warn', { skipStackTrace: true, skipScrubPII: true });
51448
51472
  }
@@ -51450,13 +51474,12 @@ function ConsoleCapture() {
51450
51474
  createConsoleEvent([message], 'error', { skipStackTrace: true, skipScrubPII: true });
51451
51475
  }
51452
51476
  }
51453
- function createConsoleEvent(args, methodName, _a) {
51454
- var _b = _a === void 0 ? {} : _a, _c = _b.skipStackTrace, skipStackTrace = _c === void 0 ? false : _c, _d = _b.skipScrubPII, skipScrubPII = _d === void 0 ? false : _d;
51477
+ function createConsoleEvent(args, methodName, { skipStackTrace = false, skipScrubPII = false } = {}) {
51455
51478
  if (!isCapturingConsoleLogs || !args || args.length === 0 || !_.contains(CONSOLE_METHODS, methodName))
51456
51479
  return;
51457
51480
  // stringify args
51458
- var message = _.compact(_.map(args, function (arg) {
51459
- var stringifiedArg;
51481
+ let message = _.compact(_.map(args, arg => {
51482
+ let stringifiedArg;
51460
51483
  try {
51461
51484
  stringifiedArg = stringify(arg);
51462
51485
  }
@@ -51468,22 +51491,22 @@ function ConsoleCapture() {
51468
51491
  if (!message)
51469
51492
  return;
51470
51493
  // capture stack trace
51471
- var stackTrace = '';
51494
+ let stackTrace = '';
51472
51495
  if (!skipStackTrace) {
51473
- var maxStackFrames = methodName === 'error' ? 4 : 1;
51496
+ const maxStackFrames = methodName === 'error' ? 4 : 1;
51474
51497
  stackTrace = captureStackTrace(maxStackFrames);
51475
51498
  }
51476
51499
  // truncate message and stack trace
51477
51500
  message = truncate(message);
51478
51501
  stackTrace = truncate(stackTrace);
51479
51502
  // de-duplicate log
51480
- var logKey = generateLogKey(methodName, message, stackTrace);
51503
+ const logKey = generateLogKey(methodName, message, stackTrace);
51481
51504
  if (isExistingDuplicateLog(logKey)) {
51482
51505
  buffer.lastEvent.devLogCount++;
51483
51506
  return;
51484
51507
  }
51485
- var devLogEnvelope = createDevLogEnvelope(pluginAPI, globalPendo);
51486
- 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 });
51508
+ const devLogEnvelope = createDevLogEnvelope(pluginAPI, globalPendo);
51509
+ 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 });
51487
51510
  if (!buffer.hasTokenAvailable())
51488
51511
  return consoleEvent;
51489
51512
  if (!isPtmPaused) {
@@ -51495,8 +51518,8 @@ function ConsoleCapture() {
51495
51518
  }
51496
51519
  function captureStackTrace(maxStackFrames) {
51497
51520
  try {
51498
- var stackFrames = ErrorStackParser.parse(new Error(), maxStackFrames);
51499
- return _.map(stackFrames, function (frame) { return frame.toString(); }).join('\n');
51521
+ const stackFrames = ErrorStackParser.parse(new Error(), maxStackFrames);
51522
+ return _.map(stackFrames, frame => frame.toString()).join('\n');
51500
51523
  }
51501
51524
  catch (error) {
51502
51525
  return '';
@@ -51508,22 +51531,21 @@ function ConsoleCapture() {
51508
51531
  function updateLastLog(logKey) {
51509
51532
  lastLogKey = logKey;
51510
51533
  }
51511
- function send(_a) {
51512
- var _b = _a === void 0 ? {} : _a, _c = _b.unload, unload = _c === void 0 ? false : _c, _d = _b.hidden, hidden = _d === void 0 ? false : _d;
51534
+ function send({ unload = false, hidden = false } = {}) {
51513
51535
  if (!buffer || buffer.isEmpty())
51514
51536
  return;
51515
51537
  if (!globalPendo.isSendingEvents()) {
51516
51538
  buffer.clear();
51517
51539
  return;
51518
51540
  }
51519
- var payloads = buffer.pack();
51541
+ const payloads = buffer.pack();
51520
51542
  if (!payloads || payloads.length === 0)
51521
51543
  return;
51522
51544
  if (unload || hidden) {
51523
51545
  sendQueue.drain(payloads, unload);
51524
51546
  }
51525
51547
  else {
51526
- sendQueue.push.apply(sendQueue, payloads);
51548
+ sendQueue.push(...payloads);
51527
51549
  }
51528
51550
  }
51529
51551
  function teardown() {
@@ -51547,7 +51569,7 @@ function ConsoleCapture() {
51547
51569
  _.each(CONSOLE_METHODS, function (methodName) {
51548
51570
  if (!console[methodName])
51549
51571
  return _.noop;
51550
- var unwrap = console[methodName]._pendoUnwrap;
51572
+ const unwrap = console[methodName]._pendoUnwrap;
51551
51573
  if (_.isFunction(unwrap)) {
51552
51574
  unwrap();
51553
51575
  }
@@ -51953,20 +51975,18 @@ function NetworkCapture() {
51953
51975
  }
51954
51976
  }
51955
51977
 
51956
- var PREDICT_STEP_REGEX = /\$\$predict\$\$/;
51957
- var DRAG_THRESHOLD = 5;
51958
- var STYLE_ID = 'pendo-predict-plugin-styles';
51959
- var PREDICT_BASE_URL = 'https://predict.pendo.io';
51960
- var GUIDE_BUTTON_IDENTIFIER = 'button:contains("token")';
51961
- var pluginVersion = '1.0.1';
51962
- var $ = function (id) { return document.getElementById(id); };
51963
- var createElement = function (tag, attrs, parent) {
51964
- if (attrs === void 0) { attrs = {}; }
51965
- if (parent === void 0) { parent = null; }
51966
- var el = document.createElement(tag);
51967
- var entries = Object.entries(attrs);
51968
- for (var i = 0; i < entries.length; i++) {
51969
- var _a = entries[i], key = _a[0], value = _a[1];
51978
+ const PREDICT_STEP_REGEX = /\$\$predict\$\$/;
51979
+ const DRAG_THRESHOLD = 5;
51980
+ const STYLE_ID = 'pendo-predict-plugin-styles';
51981
+ const PREDICT_BASE_URL = 'https://predict.pendo.io';
51982
+ const GUIDE_BUTTON_IDENTIFIER = 'button:contains("token")';
51983
+ const pluginVersion = '1.0.1';
51984
+ const $ = (id) => document.getElementById(id);
51985
+ const createElement = (tag, attrs = {}, parent = null) => {
51986
+ const el = document.createElement(tag);
51987
+ const entries = Object.entries(attrs);
51988
+ for (let i = 0; i < entries.length; i++) {
51989
+ const [key, value] = entries[i];
51970
51990
  if (key === 'className')
51971
51991
  el.className = value;
51972
51992
  else if (key === 'innerHTML')
@@ -51978,28 +51998,69 @@ var createElement = function (tag, attrs, parent) {
51978
51998
  parent.appendChild(el);
51979
51999
  return el;
51980
52000
  };
51981
- var injectStyles = function (pendoContainerId, log) {
51982
- if (log === void 0) { log = function () { }; }
51983
- var styleId = "".concat(STYLE_ID, "-").concat(pendoContainerId);
52001
+ const injectStyles = (pendoContainerId, log = () => { }) => {
52002
+ const styleId = `${STYLE_ID}-${pendoContainerId}`;
51984
52003
  if ($(styleId)) {
51985
- log("[predict] style already exists, skipping: ".concat(styleId));
52004
+ log(`[predict] style already exists, skipping: ${styleId}`);
51986
52005
  return;
51987
52006
  }
51988
- log("[predict] injecting styles: ".concat(styleId));
52007
+ log(`[predict] injecting styles: ${styleId}`);
51989
52008
  createElement('style', {
51990
52009
  id: styleId,
51991
- 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 ")
52010
+ textContent: `
52011
+ #${pendoContainerId} {
52012
+ display: none !important;
52013
+ }
52014
+ .frame-explanation {
52015
+ aspect-ratio: 16/9; overflow: hidden; min-height: 300px;
52016
+ width: 100vw; height: 100vh; background: transparent;
52017
+ position: fixed; bottom: 0; right: 0; z-index: 999999; border: none;
52018
+ visibility: hidden; opacity: 0; pointer-events: none;
52019
+ transition: opacity 0.1s ease-out, visibility 0s linear 0.1s;
52020
+ display: none;
52021
+ }
52022
+ .frame-explanation.is-visible {
52023
+ visibility: visible; opacity: 1; pointer-events: auto;
52024
+ transition: opacity 0.1s ease-out, visibility 0s linear 0s;
52025
+ }
52026
+ .frame-explanation.is-exists {
52027
+ display: block !important;
52028
+ }
52029
+ .floating-modal-container {
52030
+ position: fixed; top: 20px; right: 20px; z-index: 500000;
52031
+ visibility: hidden; opacity: 0; pointer-events: none;
52032
+ transition: opacity 0.1s ease-out, visibility 0s linear 0.1s;
52033
+ border-radius: 8px; box-shadow: 0px 4px 12px 0px rgba(0,0,0,0.15);
52034
+ overflow: hidden; width: 384px; height: 176px;
52035
+ }
52036
+ .floating-modal-container.is-visible {
52037
+ visibility: visible; opacity: 1; pointer-events: auto;
52038
+ transition: opacity 0.1s ease-out, visibility 0s linear 0s;
52039
+ }
52040
+ .floating-modal-container.is-dragging { will-change: left, top; }
52041
+ .floating-modal-drag-handle {
52042
+ position: absolute; left: 50%; transform: translateX(-50%);
52043
+ top: 5px; width: calc(100% - 46px); min-width: 166px; height: 17px;
52044
+ z-index: 9999; transition: left 0.2s ease, right 0.2s ease;
52045
+ display: flex; justify-content: center; align-items: center;
52046
+ }
52047
+ .floating-modal-drag-handle svg g { fill: #A0A0A0; }
52048
+ .floating-modal-drag-handle:hover { cursor: grab; }
52049
+ .floating-modal-drag-handle:hover svg g { fill: #1f2937; }
52050
+ .floating-modal-drag-handle.is-dragging { cursor: grabbing; }
52051
+ .floating-modal-drag-handle.is-collapsed { top: 0px; }
52052
+ .frame-floating-modal { width: 100%; height: 100%; background: white; border: none; display: block; }
52053
+ `
51992
52054
  }, document.head);
51993
52055
  };
51994
- var getRecordIdFromUrl = function (recordRegex, log) {
52056
+ const getRecordIdFromUrl = (recordRegex, log = () => { }) => {
51995
52057
  var _a;
51996
- if (log === void 0) { log = function () { }; }
51997
- var match = window.location.href.match(recordRegex);
51998
- var recordId = (_a = match === null || match === void 0 ? void 0 : match[1]) !== null && _a !== void 0 ? _a : null;
51999
- log("[predict] recordId found: ".concat(recordId));
52058
+ const match = window.location.href.match(recordRegex);
52059
+ const recordId = (_a = match === null || match === void 0 ? void 0 : match[1]) !== null && _a !== void 0 ? _a : null;
52060
+ log(`[predict] recordId found: ${recordId}`);
52000
52061
  return recordId;
52001
52062
  };
52002
- var safeStringify = function (value, fallback) {
52063
+ const safeStringify = (value, fallback) => {
52003
52064
  try {
52004
52065
  return JSON.stringify(value);
52005
52066
  }
@@ -52007,22 +52068,21 @@ var safeStringify = function (value, fallback) {
52007
52068
  return fallback !== null && fallback !== void 0 ? fallback : '';
52008
52069
  }
52009
52070
  };
52010
- var safeParse = function (value, fallback, log) {
52011
- if (log === void 0) { log = function () { }; }
52071
+ const safeParse = (value, fallback, log = () => { }) => {
52012
52072
  try {
52013
52073
  return JSON.parse(value);
52014
52074
  }
52015
52075
  catch (error) {
52016
- log("[predict] JSON parse error: ".concat(error));
52076
+ log(`[predict] JSON parse error: ${error}`);
52017
52077
  return fallback;
52018
52078
  }
52019
52079
  };
52020
- var buildQueryParams = function (params) {
52021
- var urlParams = new URLSearchParams();
52022
- var entries = Object.entries(params);
52080
+ const buildQueryParams = (params) => {
52081
+ const urlParams = new URLSearchParams();
52082
+ const entries = Object.entries(params);
52023
52083
  urlParams.set('pluginVersion', pluginVersion);
52024
- for (var i = 0; i < entries.length; i++) {
52025
- var _a = entries[i], key = _a[0], value = _a[1];
52084
+ for (let i = 0; i < entries.length; i++) {
52085
+ const [key, value] = entries[i];
52026
52086
  if (value != null) {
52027
52087
  urlParams.set(key, typeof value === 'object' ? safeStringify(value) : String(value));
52028
52088
  }
@@ -52030,17 +52090,17 @@ var buildQueryParams = function (params) {
52030
52090
  return urlParams.toString();
52031
52091
  };
52032
52092
  // ----- Drag & Drop -----
52033
- var setupDragAndDrop = function (handle, container) {
52034
- var isDragging = false;
52035
- var hasMoved = false;
52036
- var isCollapsed = false;
52037
- var startX = 0;
52038
- var startY = 0;
52039
- var initialLeft = 0;
52040
- var initialTop = 0;
52041
- var rafId = null;
52042
- var iframe = container.querySelector('iframe');
52043
- var onMouseDown = function (e) {
52093
+ const setupDragAndDrop = (handle, container) => {
52094
+ let isDragging = false;
52095
+ let hasMoved = false;
52096
+ let isCollapsed = false;
52097
+ let startX = 0;
52098
+ let startY = 0;
52099
+ let initialLeft = 0;
52100
+ let initialTop = 0;
52101
+ let rafId = null;
52102
+ const iframe = container.querySelector('iframe');
52103
+ const onMouseDown = (e) => {
52044
52104
  if (e.button !== 0)
52045
52105
  return;
52046
52106
  e.preventDefault();
@@ -52050,35 +52110,35 @@ var setupDragAndDrop = function (handle, container) {
52050
52110
  container.classList.add('is-dragging');
52051
52111
  if (iframe)
52052
52112
  iframe.style.pointerEvents = 'none';
52053
- var rect = container.getBoundingClientRect();
52113
+ const rect = container.getBoundingClientRect();
52054
52114
  initialLeft = rect.left;
52055
52115
  initialTop = rect.top;
52056
- container.style.left = "".concat(initialLeft, "px");
52116
+ container.style.left = `${initialLeft}px`;
52057
52117
  container.style.right = 'auto';
52058
52118
  startX = e.clientX;
52059
52119
  startY = e.clientY;
52060
52120
  document.addEventListener('mousemove', onMouseMove);
52061
52121
  document.addEventListener('mouseup', onMouseUp);
52062
52122
  };
52063
- var onMouseMove = function (e) {
52123
+ const onMouseMove = (e) => {
52064
52124
  if (!isDragging)
52065
52125
  return;
52066
- var deltaX = e.clientX - startX;
52067
- var deltaY = e.clientY - startY;
52126
+ const deltaX = e.clientX - startX;
52127
+ const deltaY = e.clientY - startY;
52068
52128
  if (Math.abs(deltaX) > DRAG_THRESHOLD || Math.abs(deltaY) > DRAG_THRESHOLD) {
52069
52129
  hasMoved = true;
52070
52130
  }
52071
52131
  if (rafId)
52072
52132
  cancelAnimationFrame(rafId);
52073
- rafId = requestAnimationFrame(function () {
52074
- var rect = container.getBoundingClientRect();
52075
- var newLeft = Math.max(0, Math.min(initialLeft + deltaX, window.innerWidth - rect.width));
52076
- var newTop = Math.max(0, Math.min(initialTop + deltaY, window.innerHeight - rect.height));
52077
- container.style.left = "".concat(newLeft, "px");
52078
- container.style.top = "".concat(newTop, "px");
52133
+ rafId = requestAnimationFrame(() => {
52134
+ const rect = container.getBoundingClientRect();
52135
+ const newLeft = Math.max(0, Math.min(initialLeft + deltaX, window.innerWidth - rect.width));
52136
+ const newTop = Math.max(0, Math.min(initialTop + deltaY, window.innerHeight - rect.height));
52137
+ container.style.left = `${newLeft}px`;
52138
+ container.style.top = `${newTop}px`;
52079
52139
  });
52080
52140
  };
52081
- var onMouseUp = function (e) {
52141
+ const onMouseUp = (e) => {
52082
52142
  var _a;
52083
52143
  if (!isDragging)
52084
52144
  return;
@@ -52096,12 +52156,12 @@ var setupDragAndDrop = function (handle, container) {
52096
52156
  (_a = iframe === null || iframe === void 0 ? void 0 : iframe.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage({ type: 'TRIGGER_EXPAND' }, PREDICT_BASE_URL);
52097
52157
  }
52098
52158
  };
52099
- handle.setCollapsedState = function (collapsed) {
52159
+ handle.setCollapsedState = (collapsed) => {
52100
52160
  isCollapsed = collapsed;
52101
52161
  handle.classList.toggle('is-collapsed', collapsed);
52102
52162
  };
52103
52163
  handle.addEventListener('mousedown', onMouseDown);
52104
- handle.cleanup = function () {
52164
+ handle.cleanup = () => {
52105
52165
  handle.removeEventListener('mousedown', onMouseDown);
52106
52166
  document.removeEventListener('mousemove', onMouseMove);
52107
52167
  document.removeEventListener('mouseup', onMouseUp);
@@ -52111,13 +52171,12 @@ var setupDragAndDrop = function (handle, container) {
52111
52171
  return handle;
52112
52172
  };
52113
52173
  // ----- Explanation Iframe Creation -----
52114
- var createExplanationIframe = function (_a) {
52115
- var _b;
52116
- var analysisId = _a.analysisId, recordId = _a.recordId, configuration = _a.configuration;
52117
- var frameId = "frameExplanation-".concat(analysisId);
52118
- (_b = $(frameId)) === null || _b === void 0 ? void 0 : _b.remove();
52119
- var base = "".concat(PREDICT_BASE_URL, "/external/analysis/").concat(analysisId, "/prediction/drilldown/").concat(recordId);
52120
- var params = buildQueryParams(configuration);
52174
+ const createExplanationIframe = ({ analysisId, recordId, configuration }) => {
52175
+ var _a;
52176
+ const frameId = `frameExplanation-${analysisId}`;
52177
+ (_a = $(frameId)) === null || _a === void 0 ? void 0 : _a.remove();
52178
+ const base = `${PREDICT_BASE_URL}/external/analysis/${analysisId}/prediction/drilldown/${recordId}`;
52179
+ const params = buildQueryParams(configuration);
52121
52180
  createElement('iframe', {
52122
52181
  id: frameId,
52123
52182
  className: 'frame-explanation',
@@ -52125,24 +52184,28 @@ var createExplanationIframe = function (_a) {
52125
52184
  loading: 'lazy',
52126
52185
  referrerPolicy: 'strict-origin-when-cross-origin',
52127
52186
  allowFullscreen: true,
52128
- src: "".concat(base, "?").concat(params)
52187
+ src: `${base}?${params}`
52129
52188
  }, document.body);
52130
52189
  };
52131
52190
  // ----- Floating Modal Creation -----
52132
- var createFloatingModal = function (_a) {
52133
- var _b;
52134
- var recordId = _a.recordId, configuration = _a.configuration;
52135
- var flatIds = (_b = configuration.analysisIds) === null || _b === void 0 ? void 0 : _b.flat(Infinity);
52136
- for (var i = 0; i < flatIds.length; i++) {
52137
- createExplanationIframe({ analysisId: flatIds[i], recordId: recordId, configuration: configuration });
52138
- }
52139
- var container = createElement('div', { id: 'floatingModalContainer', className: 'floating-modal-container' }, document.body);
52140
- var dragHandle = createElement('div', {
52191
+ const createFloatingModal = ({ recordId, configuration }) => {
52192
+ var _a;
52193
+ const flatIds = (_a = configuration.analysisIds) === null || _a === void 0 ? void 0 : _a.flat(Infinity);
52194
+ for (let i = 0; i < flatIds.length; i++) {
52195
+ createExplanationIframe({ analysisId: flatIds[i], recordId, configuration });
52196
+ }
52197
+ const container = createElement('div', { id: 'floatingModalContainer', className: 'floating-modal-container' }, document.body);
52198
+ const dragHandle = createElement('div', {
52141
52199
  className: 'floating-modal-drag-handle',
52142
- 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>"
52200
+ innerHTML: `<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
52201
+ <g fill="#EBEBEB">
52202
+ <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"/>
52203
+ <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"/>
52204
+ </g>
52205
+ </svg>`
52143
52206
  }, container);
52144
- var baseUrl = "".concat(PREDICT_BASE_URL, "/external/analysis/prediction/summary/").concat(recordId);
52145
- var params = buildQueryParams(configuration);
52207
+ const baseUrl = `${PREDICT_BASE_URL}/external/analysis/prediction/summary/${recordId}`;
52208
+ const params = buildQueryParams(configuration);
52146
52209
  createElement('iframe', {
52147
52210
  id: 'frameFloatingModal',
52148
52211
  className: 'frame-floating-modal',
@@ -52150,136 +52213,133 @@ var createFloatingModal = function (_a) {
52150
52213
  referrerPolicy: 'strict-origin-when-cross-origin',
52151
52214
  allowFullscreen: true,
52152
52215
  title: 'Floating Modal',
52153
- src: "".concat(baseUrl, "?").concat(params)
52216
+ src: `${baseUrl}?${params}`
52154
52217
  }, container);
52155
52218
  container.dragHandle = setupDragAndDrop(dragHandle, container);
52156
- return function () {
52219
+ return () => {
52157
52220
  var _a, _b;
52158
52221
  (_b = (_a = container.dragHandle) === null || _a === void 0 ? void 0 : _a.cleanup) === null || _b === void 0 ? void 0 : _b.call(_a);
52159
52222
  container.remove();
52160
- for (var i = 0; i < flatIds.length; i++) {
52161
- var frame = $("frameExplanation-".concat(flatIds[i]));
52223
+ for (let i = 0; i < flatIds.length; i++) {
52224
+ const frame = $(`frameExplanation-${flatIds[i]}`);
52162
52225
  if (frame)
52163
52226
  frame.remove();
52164
52227
  }
52165
52228
  };
52166
52229
  };
52167
- var setupMessageListener = function (_a) {
52168
- var token = _a.token, forceAccountId = _a.forceAccountId, cleanup = _a.cleanup, pendo = _a.pendo;
52169
- var messageHandler = function (_a) {
52170
- var _b;
52171
- var origin = _a.origin, data = _a.data;
52230
+ const setupMessageListener = ({ token, forceAccountId, cleanup, pendo }) => {
52231
+ const messageHandler = ({ origin, data }) => {
52232
+ var _a;
52172
52233
  if (origin !== PREDICT_BASE_URL || !data || typeof data !== 'object')
52173
52234
  return;
52174
- var _c = data, type = _c.type, analysisId = _c.analysisId, height = _c.height, width = _c.width;
52175
- var explanationFrame = $("frameExplanation-".concat(analysisId));
52176
- var floatingModal = $('floatingModalContainer');
52177
- var setFloatingModalSize = function () {
52235
+ const { type, analysisId, height, width } = data;
52236
+ const explanationFrame = $(`frameExplanation-${analysisId}`);
52237
+ const floatingModal = $('floatingModalContainer');
52238
+ const setFloatingModalSize = () => {
52178
52239
  if (floatingModal) {
52179
- floatingModal.style.height = "".concat(height, "px");
52180
- floatingModal.style.width = "".concat(width, "px");
52240
+ floatingModal.style.height = `${height}px`;
52241
+ floatingModal.style.width = `${width}px`;
52181
52242
  }
52182
52243
  };
52183
- var setFloatingModalCollapsedState = function (collapsed) {
52244
+ const setFloatingModalCollapsedState = (collapsed) => {
52184
52245
  var _a, _b;
52185
52246
  if (floatingModal)
52186
52247
  (_b = (_a = floatingModal.dragHandle) === null || _a === void 0 ? void 0 : _a.setCollapsedState) === null || _b === void 0 ? void 0 : _b.call(_a, collapsed);
52187
52248
  };
52188
- var actions = {
52189
- MODAL_INITIALIZED: function () {
52249
+ const actions = {
52250
+ MODAL_INITIALIZED: () => {
52190
52251
  var _a, _b, _c;
52191
- var iframe = $('frameFloatingModal');
52252
+ const iframe = $('frameFloatingModal');
52192
52253
  if (iframe) {
52193
- var idToken = null;
52194
- var extensionAPIKeys = null;
52195
- var retrieveIDPToken = pendo.getConfigValue('retrieveIDPToken');
52254
+ let idToken = null;
52255
+ let extensionAPIKeys = null;
52256
+ const retrieveIDPToken = pendo.getConfigValue('retrieveIDPToken');
52196
52257
  if (pendo._.isFunction(retrieveIDPToken)) {
52197
- var result = retrieveIDPToken();
52258
+ const result = retrieveIDPToken();
52198
52259
  if (result) {
52199
52260
  idToken = result.idToken;
52200
52261
  extensionAPIKeys = result.extensionAPIKeys;
52201
52262
  }
52202
52263
  }
52203
- var visitorId = (_a = pendo === null || pendo === void 0 ? void 0 : pendo.getVisitorId) === null || _a === void 0 ? void 0 : _a.call(pendo);
52204
- 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);
52205
- (_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);
52264
+ const visitorId = (_a = pendo === null || pendo === void 0 ? void 0 : pendo.getVisitorId) === null || _a === void 0 ? void 0 : _a.call(pendo);
52265
+ 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);
52266
+ (_c = iframe.contentWindow) === null || _c === void 0 ? void 0 : _c.postMessage({ type: 'TOKEN_RECEIVED', token, idToken, extensionAPIKeys, visitorId, accountId }, PREDICT_BASE_URL);
52206
52267
  }
52207
52268
  },
52208
- OPEN_EXPLANATION: function () {
52269
+ OPEN_EXPLANATION: () => {
52209
52270
  var _a;
52210
52271
  explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.add('is-visible');
52211
52272
  (_a = explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.contentWindow) === null || _a === void 0 ? void 0 : _a.postMessage(data, PREDICT_BASE_URL);
52212
52273
  },
52213
- CLOSE_EXPLANATION: function () { return explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.remove('is-visible'); },
52214
- AUTH_ERROR_EXPLANATION: function () {
52274
+ CLOSE_EXPLANATION: () => explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.remove('is-visible'),
52275
+ AUTH_ERROR_EXPLANATION: () => {
52215
52276
  explanationFrame === null || explanationFrame === void 0 ? void 0 : explanationFrame.classList.remove('is-visible');
52216
- var iframe = $('frameFloatingModal');
52277
+ const iframe = $('frameFloatingModal');
52217
52278
  // eslint-disable-next-line no-self-assign
52218
52279
  if (iframe)
52219
52280
  iframe.src = iframe.src;
52220
52281
  },
52221
- DATA_READY: function () {
52282
+ DATA_READY: () => {
52222
52283
  floatingModal === null || floatingModal === void 0 ? void 0 : floatingModal.classList.add('is-visible');
52223
52284
  setFloatingModalSize();
52224
52285
  // Use analysisIds from the message data if available, otherwise use all IDs
52225
- var idsToShow = data.analysisIds || [];
52226
- for (var i = 0; i < idsToShow.length; i++) {
52227
- var frame = $("frameExplanation-".concat(idsToShow[i]));
52286
+ const idsToShow = data.analysisIds || [];
52287
+ for (let i = 0; i < idsToShow.length; i++) {
52288
+ const frame = $(`frameExplanation-${idsToShow[i]}`);
52228
52289
  if (frame)
52229
52290
  frame.classList.add('is-exists');
52230
52291
  }
52231
52292
  },
52232
- AUTH_ERROR: function () {
52293
+ AUTH_ERROR: () => {
52233
52294
  floatingModal === null || floatingModal === void 0 ? void 0 : floatingModal.classList.add('is-visible');
52234
52295
  setFloatingModalSize();
52235
52296
  },
52236
52297
  CLOSE_FLOATING_MODAL: cleanup,
52237
- EXPAND_FLOATING_MODAL: function () {
52298
+ EXPAND_FLOATING_MODAL: () => {
52238
52299
  setFloatingModalSize();
52239
52300
  setFloatingModalCollapsedState(false);
52240
52301
  },
52241
- COLLAPSE_FLOATING_MODAL: function () {
52302
+ COLLAPSE_FLOATING_MODAL: () => {
52242
52303
  setFloatingModalSize();
52243
52304
  setFloatingModalCollapsedState(true);
52244
52305
  }
52245
52306
  };
52246
52307
  if (type && type in actions) {
52247
- (_b = actions === null || actions === void 0 ? void 0 : actions[type]) === null || _b === void 0 ? void 0 : _b.call(actions);
52308
+ (_a = actions === null || actions === void 0 ? void 0 : actions[type]) === null || _a === void 0 ? void 0 : _a.call(actions);
52248
52309
  }
52249
52310
  };
52250
52311
  window.addEventListener('message', messageHandler);
52251
- return function () { return window.removeEventListener('message', messageHandler); };
52312
+ return () => window.removeEventListener('message', messageHandler);
52252
52313
  };
52253
- var predictGuidesScript = function (_a) {
52254
- var _b;
52255
- var step = _a.step, pendo = _a.pendo, cleanupArray = _a.cleanupArray, cleanup = _a.cleanup, log = _a.log;
52314
+ const predictGuidesScript = ({ step, pendo, cleanupArray, cleanup, log }) => {
52315
+ var _a;
52256
52316
  log('[predict] initializing');
52257
52317
  // Before anything else, inject styles so that the guide will be hidden
52258
- var pendoContainerId = step === null || step === void 0 ? void 0 : step.containerId;
52318
+ const pendoContainerId = step === null || step === void 0 ? void 0 : step.containerId;
52259
52319
  injectStyles(pendoContainerId, log);
52260
52320
  if (cleanupArray.length > 0) {
52261
52321
  log('[predict] cleanupArray is not empty');
52262
52322
  return;
52263
52323
  }
52264
52324
  // ----- Extract Configuration -----
52265
- var guideButton = (_b = step.guideElement.find(GUIDE_BUTTON_IDENTIFIER)) === null || _b === void 0 ? void 0 : _b[0];
52325
+ const guideButton = (_a = step.guideElement.find(GUIDE_BUTTON_IDENTIFIER)) === null || _a === void 0 ? void 0 : _a[0];
52266
52326
  if (!guideButton) {
52267
52327
  log('[predict] no guide button found, aborting');
52268
52328
  return;
52269
52329
  }
52270
- var _c = safeParse(guideButton.textContent, {}, log), token = _c.token, configuration = __rest(_c, ["token"]);
52330
+ const _b = safeParse(guideButton.textContent, {}, log), { token } = _b, configuration = __rest(_b, ["token"]);
52271
52331
  if (!configuration || !token) {
52272
52332
  log('[predict] no configuration found, aborting');
52273
52333
  return;
52274
52334
  }
52275
- var recordRegex = new RegExp("/".concat(configuration.recordRegexName, "/([a-zA-Z0-9]+)(?:/|$)"));
52276
- var recordId = getRecordIdFromUrl(recordRegex, log);
52335
+ const recordRegex = new RegExp(`/${configuration.recordRegexName}/([a-zA-Z0-9]+)(?:/|$)`);
52336
+ const recordId = getRecordIdFromUrl(recordRegex, log);
52277
52337
  if (!recordId) {
52278
52338
  log('[predict] no recordId found in URL, aborting');
52279
52339
  return;
52280
52340
  }
52281
- cleanupArray.push(setupMessageListener({ token: token, forceAccountId: configuration === null || configuration === void 0 ? void 0 : configuration.forceAccountId, cleanup: cleanup, pendo: pendo }));
52282
- cleanupArray.push(createFloatingModal({ recordId: recordId, configuration: configuration }));
52341
+ cleanupArray.push(setupMessageListener({ token, forceAccountId: configuration === null || configuration === void 0 ? void 0 : configuration.forceAccountId, cleanup, pendo }));
52342
+ cleanupArray.push(createFloatingModal({ recordId, configuration }));
52283
52343
  };
52284
52344
 
52285
52345
  const PredictGuides = () => {