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