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