@pendo/agent 2.321.0 → 2.321.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dom.esm.js +1 -1
- package/dist/pendo.module.js +496 -435
- package/dist/pendo.module.min.js +101 -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.2_';
|
|
3971
|
+
let PACKAGE_VERSION = '2.321.2';
|
|
3972
3972
|
let LOADER = 'xhr';
|
|
3973
3973
|
/* eslint-enable web-sdk-eslint-rules/no-gulp-env-references */
|
|
3974
3974
|
/**
|
|
@@ -40770,20 +40770,20 @@ function getZoneSafeMethod(_, method, target) {
|
|
|
40770
40770
|
}
|
|
40771
40771
|
|
|
40772
40772
|
// Does not support submit and go to
|
|
40773
|
-
|
|
40774
|
-
|
|
40773
|
+
const goToRegex = new RegExp(guideMarkdownUtil.goToString);
|
|
40774
|
+
const PollBranching = {
|
|
40775
40775
|
name: 'PollBranching',
|
|
40776
|
-
script
|
|
40777
|
-
|
|
40778
|
-
|
|
40776
|
+
script(step, guide, pendo) {
|
|
40777
|
+
let isAdvanceIntercepted = false;
|
|
40778
|
+
const branchingQuestions = initialBranchingSetup(step, pendo);
|
|
40779
40779
|
if (branchingQuestions) {
|
|
40780
40780
|
// If there are too many branching questions saved, exit and run the guide normally.
|
|
40781
40781
|
if (pendo._.size(branchingQuestions) > 1)
|
|
40782
40782
|
return;
|
|
40783
|
-
this.on('beforeAdvance',
|
|
40784
|
-
|
|
40785
|
-
|
|
40786
|
-
|
|
40783
|
+
this.on('beforeAdvance', (evt) => {
|
|
40784
|
+
const noResponseSelected = step.guideElement.find('[branching] .pendo-radio:checked').length === 0;
|
|
40785
|
+
const responseLabel = step.guideElement.find('[branching] .pendo-radio:checked + label')[0];
|
|
40786
|
+
let noGotoLabel;
|
|
40787
40787
|
if (responseLabel) {
|
|
40788
40788
|
noGotoLabel = pendo._.isNull(responseLabel.getAttribute('goToStep'));
|
|
40789
40789
|
}
|
|
@@ -40794,58 +40794,58 @@ var PollBranching = {
|
|
|
40794
40794
|
});
|
|
40795
40795
|
}
|
|
40796
40796
|
},
|
|
40797
|
-
test
|
|
40797
|
+
test(step, guide, pendo) {
|
|
40798
40798
|
var _a;
|
|
40799
|
-
|
|
40799
|
+
let branchingQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
|
|
40800
40800
|
return !pendo._.isUndefined(branchingQuestions) && pendo._.size(branchingQuestions);
|
|
40801
40801
|
},
|
|
40802
|
-
designerListener
|
|
40803
|
-
|
|
40804
|
-
|
|
40802
|
+
designerListener(pendo) {
|
|
40803
|
+
const target = pendo.dom.getBody();
|
|
40804
|
+
const config = {
|
|
40805
40805
|
attributeFilter: ['data-layout'],
|
|
40806
40806
|
attributes: true,
|
|
40807
40807
|
childList: true,
|
|
40808
40808
|
characterData: true,
|
|
40809
40809
|
subtree: true
|
|
40810
40810
|
};
|
|
40811
|
-
|
|
40812
|
-
|
|
40811
|
+
const MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
|
|
40812
|
+
const observer = new MutationObserver(applyBranchingIndicators);
|
|
40813
40813
|
observer.observe(target, config);
|
|
40814
40814
|
function applyBranchingIndicators(mutations) {
|
|
40815
40815
|
pendo._.each(mutations, function (mutation) {
|
|
40816
40816
|
var _a;
|
|
40817
|
-
|
|
40817
|
+
const nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelector);
|
|
40818
40818
|
if (mutation.addedNodes.length && nodeHasQuerySelector) {
|
|
40819
40819
|
if (mutation.addedNodes[0].querySelector('._pendo-multi-choice-poll-select-border')) {
|
|
40820
40820
|
if (pendo._.size(pendo.dom('._pendo-multi-choice-poll-question:contains("{branching/}")'))) {
|
|
40821
40821
|
pendo
|
|
40822
40822
|
.dom('._pendo-multi-choice-poll-question:contains("{branching/}")')
|
|
40823
|
-
.each(
|
|
40824
|
-
pendo._.each(pendo.dom(
|
|
40823
|
+
.each((question, index) => {
|
|
40824
|
+
pendo._.each(pendo.dom(`#${question.id} *`), (element) => {
|
|
40825
40825
|
guideMarkdownUtil.removeMarkdownSyntax(element, '{branching/}', '', pendo);
|
|
40826
40826
|
});
|
|
40827
40827
|
pendo
|
|
40828
|
-
.dom(
|
|
40828
|
+
.dom(`#${question.id} p`)
|
|
40829
40829
|
.css({ display: 'inline-block !important' })
|
|
40830
40830
|
.append(branchingIcon('#999', '20px'))
|
|
40831
40831
|
.attr({ title: 'Custom Branching Added' });
|
|
40832
|
-
|
|
40833
|
-
if (pendo.dom(
|
|
40832
|
+
let dataPendoPollId = question.getAttribute('data-pendo-poll-id');
|
|
40833
|
+
if (pendo.dom(`._pendo-multi-choice-poll-question[data-pendo-poll-id=${dataPendoPollId}]`)[0]) {
|
|
40834
40834
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
40835
40835
|
pendo
|
|
40836
|
-
.dom(
|
|
40836
|
+
.dom(`._pendo-multi-choice-poll-question[data-pendo-poll-id=${dataPendoPollId}]`)[0]
|
|
40837
40837
|
.textContent.trim();
|
|
40838
40838
|
}
|
|
40839
|
-
|
|
40839
|
+
let pollLabels = pendo.dom(`label[for*=${dataPendoPollId}]`);
|
|
40840
40840
|
if (pendo._.size(pollLabels)) {
|
|
40841
|
-
pendo._.forEach(pollLabels,
|
|
40841
|
+
pendo._.forEach(pollLabels, (label) => {
|
|
40842
40842
|
if (goToRegex.test(label.textContent)) {
|
|
40843
|
-
|
|
40843
|
+
let labelTitle = goToRegex.exec(label.textContent)[2];
|
|
40844
40844
|
guideMarkdownUtil.removeMarkdownSyntax(label, goToRegex, '', pendo);
|
|
40845
40845
|
pendo
|
|
40846
40846
|
.dom(label)
|
|
40847
40847
|
.append(branchingIcon('#999', '14px'))
|
|
40848
|
-
.attr({ title:
|
|
40848
|
+
.attr({ title: `Branching to step ${labelTitle}` });
|
|
40849
40849
|
}
|
|
40850
40850
|
});
|
|
40851
40851
|
}
|
|
@@ -40853,9 +40853,9 @@ var PollBranching = {
|
|
|
40853
40853
|
pendo
|
|
40854
40854
|
.dom(question)
|
|
40855
40855
|
.append(branchingErrorHTML(question.dataset.pendoPollId));
|
|
40856
|
-
pendo.dom(
|
|
40856
|
+
pendo.dom(`#${question.id} #pendo-ps-branching-svg`).remove();
|
|
40857
40857
|
pendo
|
|
40858
|
-
.dom(
|
|
40858
|
+
.dom(`#${question.id} p`)
|
|
40859
40859
|
.css({ display: 'inline-block !important' })
|
|
40860
40860
|
.append(branchingIcon('red', '20px'))
|
|
40861
40861
|
.attr({ title: 'Unsupported Branching configuration' });
|
|
@@ -40867,31 +40867,49 @@ var PollBranching = {
|
|
|
40867
40867
|
});
|
|
40868
40868
|
}
|
|
40869
40869
|
function branchingErrorHTML(dataPendoPollId) {
|
|
40870
|
-
return
|
|
40870
|
+
return `<div style="text-align:lrft; font-size: 14px; color: red;
|
|
40871
|
+
font-style: italic; margin-top: 0px;" class="branching-wrapper"
|
|
40872
|
+
name="${dataPendoPollId}">
|
|
40873
|
+
* Branching Error: Multiple branching polls not supported</div>`;
|
|
40871
40874
|
}
|
|
40872
40875
|
function branchingIcon(color, size) {
|
|
40873
|
-
return
|
|
40876
|
+
return `<svg id="pendo-ps-branching-svg" viewBox="0 0 24 24" fill="none"
|
|
40877
|
+
style="margin-left: 5px;
|
|
40878
|
+
height:${size}; width:${size}; display:inline; vertical-align:middle;" xmlns="http://www.w3.org/2000/svg">
|
|
40879
|
+
<g stroke-width="0"></g>
|
|
40880
|
+
<g stroke-linecap="round" stroke-linejoin="round"></g>
|
|
40881
|
+
<g> <circle cx="4" cy="7" r="2" stroke="${color}"
|
|
40882
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></circle>
|
|
40883
|
+
<circle cx="20" cy="7" r="2" stroke="${color}"
|
|
40884
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></circle>
|
|
40885
|
+
<circle cx="20" cy="17" r="2" stroke="${color}" stroke-width="2"
|
|
40886
|
+
stroke-linecap="round" stroke-linejoin="round"></circle>
|
|
40887
|
+
<path d="M18 7H6" stroke="${color}" stroke-width="2"
|
|
40888
|
+
stroke-linecap="round" stroke-linejoin="round"></path>
|
|
40889
|
+
<path d="M7 7V7C8.65685 7 10 8.34315 10 10V15C10 16.1046 10.8954 17 12 17H18"
|
|
40890
|
+
stroke="${color}" stroke-width="2" stroke-linecap="round"
|
|
40891
|
+
stroke-linejoin="round"></path> </g></svg>`;
|
|
40874
40892
|
}
|
|
40875
40893
|
}
|
|
40876
40894
|
};
|
|
40877
40895
|
function initialBranchingSetup(step, pendo) {
|
|
40878
|
-
|
|
40879
|
-
pendo._.forEach(questions,
|
|
40880
|
-
|
|
40881
|
-
pendo._.each(step.guideElement.find(
|
|
40896
|
+
const questions = step.guideElement.find('._pendo-multi-choice-poll-question:contains("{branching/}")');
|
|
40897
|
+
pendo._.forEach(questions, (question) => {
|
|
40898
|
+
let dataPendoPollId = question.getAttribute('data-pendo-poll-id');
|
|
40899
|
+
pendo._.each(step.guideElement.find(`#${question.id} *`), (element) => {
|
|
40882
40900
|
guideMarkdownUtil.removeMarkdownSyntax(element, '{branching/}', '', pendo);
|
|
40883
40901
|
});
|
|
40884
|
-
|
|
40885
|
-
pendo._.forEach(pollLabels,
|
|
40902
|
+
let pollLabels = step.guideElement.find(`label[for*=${dataPendoPollId}]`);
|
|
40903
|
+
pendo._.forEach(pollLabels, (label) => {
|
|
40886
40904
|
if (pendo._.isNull(goToRegex.exec(label.textContent))) {
|
|
40887
40905
|
return;
|
|
40888
40906
|
}
|
|
40889
|
-
|
|
40890
|
-
|
|
40907
|
+
let gotoSubstring = goToRegex.exec(label.textContent)[1];
|
|
40908
|
+
let gotoIndex = goToRegex.exec(label.textContent)[2];
|
|
40891
40909
|
label.setAttribute('goToStep', gotoIndex);
|
|
40892
40910
|
guideMarkdownUtil.removeMarkdownSyntax(label, gotoSubstring, '', pendo);
|
|
40893
40911
|
});
|
|
40894
|
-
|
|
40912
|
+
let pollChoiceContainer = step.guideElement.find(`[data-pendo-poll-id=${dataPendoPollId}]._pendo-multi-choice-poll-select-border`);
|
|
40895
40913
|
if (pollChoiceContainer && pollChoiceContainer.length) {
|
|
40896
40914
|
pollChoiceContainer[0].setAttribute('branching', '');
|
|
40897
40915
|
}
|
|
@@ -40900,24 +40918,24 @@ function initialBranchingSetup(step, pendo) {
|
|
|
40900
40918
|
}
|
|
40901
40919
|
function branchingGoToStep(event, step, guide, pendo) {
|
|
40902
40920
|
var _a;
|
|
40903
|
-
|
|
40904
|
-
|
|
40905
|
-
|
|
40906
|
-
|
|
40921
|
+
let checkedPollInputId = (_a = step.guideElement.find('[branching] input.pendo-radio[data-pendo-poll-id]:checked')[0]) === null || _a === void 0 ? void 0 : _a.id;
|
|
40922
|
+
let checkedPollLabel = step.guideElement.find(`label[for="${checkedPollInputId}"]`)[0];
|
|
40923
|
+
let checkedPollLabelStepIndex = checkedPollLabel === null || checkedPollLabel === void 0 ? void 0 : checkedPollLabel.getAttribute('goToStep');
|
|
40924
|
+
let pollStepIndex = checkedPollLabelStepIndex - 1;
|
|
40907
40925
|
if (pollStepIndex < 0)
|
|
40908
40926
|
return;
|
|
40909
|
-
|
|
40927
|
+
const destinationObject = {
|
|
40910
40928
|
destinationStepId: guide.steps[pollStepIndex].id,
|
|
40911
|
-
step
|
|
40929
|
+
step
|
|
40912
40930
|
};
|
|
40913
40931
|
pendo.goToStep(destinationObject);
|
|
40914
40932
|
event.cancel = true;
|
|
40915
40933
|
}
|
|
40916
40934
|
|
|
40917
|
-
|
|
40935
|
+
const MetadataSubstitution = {
|
|
40918
40936
|
name: 'MetadataSubstitution',
|
|
40919
|
-
script
|
|
40920
|
-
|
|
40937
|
+
script(step, guide, pendo) {
|
|
40938
|
+
const placeholderData = findSubstitutableElements(pendo);
|
|
40921
40939
|
if (step.domJson) {
|
|
40922
40940
|
findSubstitutableUrlsInJson(step.domJson, placeholderData, pendo);
|
|
40923
40941
|
}
|
|
@@ -40925,22 +40943,22 @@ var MetadataSubstitution = {
|
|
|
40925
40943
|
pendo._.each(placeholderData, function (placeholder) {
|
|
40926
40944
|
processPlaceholder(placeholder, pendo);
|
|
40927
40945
|
});
|
|
40928
|
-
|
|
40929
|
-
|
|
40930
|
-
updateGuideContainer(containerId,
|
|
40946
|
+
const containerId = `pendo-g-${step.id}`;
|
|
40947
|
+
const context = step.guideElement;
|
|
40948
|
+
updateGuideContainer(containerId, context, pendo);
|
|
40931
40949
|
}
|
|
40932
40950
|
},
|
|
40933
|
-
designerListener
|
|
40934
|
-
|
|
40951
|
+
designerListener(pendo) {
|
|
40952
|
+
const target = pendo.dom.getBody();
|
|
40935
40953
|
if (pendo.designerv2) {
|
|
40936
40954
|
pendo.designerv2.runMetadataSubstitutionForDesignerPreview = function runMetadataSubstitutionForDesignerPreview() {
|
|
40937
40955
|
var _a;
|
|
40938
40956
|
if (!document.querySelector(guideMarkdownUtil.containerSelector))
|
|
40939
40957
|
return;
|
|
40940
|
-
|
|
40958
|
+
const step = (_a = pendo.designerv2.currentlyPreviewedGuide) === null || _a === void 0 ? void 0 : _a.steps[0];
|
|
40941
40959
|
if (!step)
|
|
40942
40960
|
return;
|
|
40943
|
-
|
|
40961
|
+
const placeholderData = findSubstitutableElements(pendo);
|
|
40944
40962
|
if (step.buildingBlocks) {
|
|
40945
40963
|
findSubstitutableUrlsInJson(step.buildingBlocks, placeholderData, pendo);
|
|
40946
40964
|
}
|
|
@@ -40950,32 +40968,32 @@ var MetadataSubstitution = {
|
|
|
40950
40968
|
return;
|
|
40951
40969
|
processPlaceholder(placeholder, pendo);
|
|
40952
40970
|
});
|
|
40953
|
-
|
|
40954
|
-
|
|
40955
|
-
updateGuideContainer(containerId,
|
|
40971
|
+
const containerId = `pendo-g-${step.id}`;
|
|
40972
|
+
const context = step.guideElement;
|
|
40973
|
+
updateGuideContainer(containerId, context, pendo);
|
|
40956
40974
|
}
|
|
40957
40975
|
};
|
|
40958
40976
|
}
|
|
40959
|
-
|
|
40977
|
+
const config = {
|
|
40960
40978
|
attributeFilter: ['data-layout'],
|
|
40961
40979
|
attributes: true,
|
|
40962
40980
|
childList: true,
|
|
40963
40981
|
characterData: true,
|
|
40964
40982
|
subtree: true
|
|
40965
40983
|
};
|
|
40966
|
-
|
|
40967
|
-
|
|
40984
|
+
const MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
|
|
40985
|
+
const observer = new MutationObserver(applySubstitutionIndicators);
|
|
40968
40986
|
observer.observe(target, config);
|
|
40969
40987
|
function applySubstitutionIndicators(mutations) {
|
|
40970
40988
|
pendo._.each(mutations, function (mutation) {
|
|
40971
40989
|
var _a;
|
|
40972
40990
|
if (mutation.addedNodes.length) {
|
|
40973
40991
|
if (document.querySelector(guideMarkdownUtil.containerSelector)) {
|
|
40974
|
-
|
|
40975
|
-
|
|
40992
|
+
const placeholderData = findSubstitutableElements(pendo);
|
|
40993
|
+
const step = (_a = pendo.designerv2.currentlyPreviewedGuide) === null || _a === void 0 ? void 0 : _a.steps[0];
|
|
40976
40994
|
if (!step)
|
|
40977
40995
|
return;
|
|
40978
|
-
|
|
40996
|
+
const pendoBlocks = step.buildingBlocks;
|
|
40979
40997
|
if (!pendo._.isUndefined(pendoBlocks)) {
|
|
40980
40998
|
findSubstitutableUrlsInJson(pendoBlocks, placeholderData, pendo);
|
|
40981
40999
|
}
|
|
@@ -40985,9 +41003,9 @@ var MetadataSubstitution = {
|
|
|
40985
41003
|
return;
|
|
40986
41004
|
processPlaceholder(placeholder, pendo);
|
|
40987
41005
|
});
|
|
40988
|
-
|
|
40989
|
-
|
|
40990
|
-
updateGuideContainer(containerId,
|
|
41006
|
+
const containerId = `pendo-g-${step.id}`;
|
|
41007
|
+
const context = step.guideElement;
|
|
41008
|
+
updateGuideContainer(containerId, context, pendo);
|
|
40991
41009
|
}
|
|
40992
41010
|
}
|
|
40993
41011
|
}
|
|
@@ -40996,18 +41014,18 @@ var MetadataSubstitution = {
|
|
|
40996
41014
|
}
|
|
40997
41015
|
};
|
|
40998
41016
|
function processPlaceholder(placeholder, pendo) {
|
|
40999
|
-
|
|
41000
|
-
|
|
41001
|
-
|
|
41017
|
+
let match;
|
|
41018
|
+
const { data, target } = placeholder;
|
|
41019
|
+
const subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
|
|
41002
41020
|
while ((match = matchPlaceholder(placeholder, subRegex))) {
|
|
41003
|
-
|
|
41004
|
-
|
|
41021
|
+
const usedArrayPath = Array.isArray(match) && match.length >= 2;
|
|
41022
|
+
const currentStr = target === 'textContent'
|
|
41005
41023
|
? data[target]
|
|
41006
41024
|
: decodeURI((data.getAttribute && (target === 'href' || target === 'value') ? (data.getAttribute(target) || '') : data[target]));
|
|
41007
|
-
|
|
41025
|
+
const matched = usedArrayPath ? match : subRegex.exec(currentStr);
|
|
41008
41026
|
if (!matched)
|
|
41009
41027
|
continue;
|
|
41010
|
-
|
|
41028
|
+
const mdValue = getSubstituteValue(matched, pendo);
|
|
41011
41029
|
substituteMetadataByTarget(data, target, mdValue, matched);
|
|
41012
41030
|
}
|
|
41013
41031
|
}
|
|
@@ -41016,48 +41034,48 @@ function matchPlaceholder(placeholder, regex) {
|
|
|
41016
41034
|
return placeholder.data[placeholder.target].match(regex);
|
|
41017
41035
|
}
|
|
41018
41036
|
else {
|
|
41019
|
-
|
|
41037
|
+
const raw = placeholder.data.getAttribute && (placeholder.target === 'href' || placeholder.target === 'value')
|
|
41020
41038
|
? (placeholder.data.getAttribute(placeholder.target) || '')
|
|
41021
41039
|
: placeholder.data[placeholder.target];
|
|
41022
41040
|
return decodeURI(raw).match(regex);
|
|
41023
41041
|
}
|
|
41024
41042
|
}
|
|
41025
41043
|
function getMetadataValueCaseInsensitive(metadata, type, property) {
|
|
41026
|
-
|
|
41044
|
+
const kind = metadata && metadata[type];
|
|
41027
41045
|
if (!kind || typeof kind !== 'object')
|
|
41028
41046
|
return undefined;
|
|
41029
|
-
|
|
41047
|
+
const direct = Object.prototype.hasOwnProperty.call(kind, property) ? kind[property] : undefined;
|
|
41030
41048
|
if (direct !== undefined) {
|
|
41031
41049
|
return direct;
|
|
41032
41050
|
}
|
|
41033
|
-
|
|
41034
|
-
|
|
41035
|
-
|
|
41051
|
+
const propLower = property.toLowerCase();
|
|
41052
|
+
const key = Object.keys(kind).find(k => k.toLowerCase() === propLower);
|
|
41053
|
+
const value = key !== undefined ? kind[key] : undefined;
|
|
41036
41054
|
return value;
|
|
41037
41055
|
}
|
|
41038
41056
|
function getSubstituteValue(match, pendo) {
|
|
41039
41057
|
if (pendo._.isUndefined(match[1]) || pendo._.isUndefined(match[2])) {
|
|
41040
41058
|
return;
|
|
41041
41059
|
}
|
|
41042
|
-
|
|
41043
|
-
|
|
41044
|
-
|
|
41060
|
+
let type = match[1];
|
|
41061
|
+
let property = match[2];
|
|
41062
|
+
let defaultValue = match[3];
|
|
41045
41063
|
if (pendo._.isUndefined(type) || pendo._.isUndefined(property)) {
|
|
41046
41064
|
return;
|
|
41047
41065
|
}
|
|
41048
|
-
|
|
41049
|
-
|
|
41066
|
+
const metadata = pendo.getSerializedMetadata();
|
|
41067
|
+
let mdValue = getMetadataValueCaseInsensitive(metadata, type, property);
|
|
41050
41068
|
if (mdValue === undefined || mdValue === null)
|
|
41051
41069
|
mdValue = defaultValue || '';
|
|
41052
41070
|
return mdValue;
|
|
41053
41071
|
}
|
|
41054
41072
|
function substituteMetadataByTarget(data, target, mdValue, matched) {
|
|
41055
|
-
|
|
41056
|
-
|
|
41073
|
+
const isElement = data && typeof data.getAttribute === 'function';
|
|
41074
|
+
const current = (target === 'href' || target === 'value') && isElement
|
|
41057
41075
|
? (data.getAttribute(target) || '')
|
|
41058
41076
|
: data[target];
|
|
41059
41077
|
if (target === 'href' || target === 'value') {
|
|
41060
|
-
|
|
41078
|
+
const safeValue = window.encodeURIComponent(String(mdValue === undefined || mdValue === null ? '' : mdValue));
|
|
41061
41079
|
data[target] = decodeURI(current).replace(matched[0], safeValue);
|
|
41062
41080
|
}
|
|
41063
41081
|
else {
|
|
@@ -41071,9 +41089,8 @@ function updateGuideContainer(containerId, context, pendo) {
|
|
|
41071
41089
|
pendo.flexElement(pendo.dom(guideMarkdownUtil.containerSelector));
|
|
41072
41090
|
pendo.BuildingBlocks.BuildingBlockGuides.recalculateGuideHeight(containerId, context);
|
|
41073
41091
|
}
|
|
41074
|
-
function findSubstitutableUrlsInJson(originalData, placeholderData, pendo) {
|
|
41075
|
-
|
|
41076
|
-
var subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
|
|
41092
|
+
function findSubstitutableUrlsInJson(originalData, placeholderData = [], pendo) {
|
|
41093
|
+
const subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
|
|
41077
41094
|
if ((originalData.name === 'url' || originalData.name === 'href') && originalData.value) {
|
|
41078
41095
|
if (subRegex.test(originalData.value)) {
|
|
41079
41096
|
placeholderData.push({
|
|
@@ -41083,37 +41100,37 @@ function findSubstitutableUrlsInJson(originalData, placeholderData, pendo) {
|
|
|
41083
41100
|
}
|
|
41084
41101
|
}
|
|
41085
41102
|
if (originalData.properties && originalData.id === 'href_link_block') {
|
|
41086
|
-
pendo._.each(originalData.properties,
|
|
41103
|
+
pendo._.each(originalData.properties, (prop) => {
|
|
41087
41104
|
findSubstitutableUrlsInJson(prop, placeholderData, pendo);
|
|
41088
41105
|
});
|
|
41089
41106
|
}
|
|
41090
41107
|
if (originalData.views) {
|
|
41091
|
-
pendo._.each(originalData.views,
|
|
41108
|
+
pendo._.each(originalData.views, (view) => {
|
|
41092
41109
|
findSubstitutableUrlsInJson(view, placeholderData, pendo);
|
|
41093
41110
|
});
|
|
41094
41111
|
}
|
|
41095
41112
|
if (originalData.parameters) {
|
|
41096
|
-
pendo._.each(originalData.parameters,
|
|
41113
|
+
pendo._.each(originalData.parameters, (param) => {
|
|
41097
41114
|
findSubstitutableUrlsInJson(param, placeholderData, pendo);
|
|
41098
41115
|
});
|
|
41099
41116
|
}
|
|
41100
41117
|
if (originalData.actions) {
|
|
41101
|
-
pendo._.each(originalData.actions,
|
|
41118
|
+
pendo._.each(originalData.actions, (action) => {
|
|
41102
41119
|
findSubstitutableUrlsInJson(action, placeholderData, pendo);
|
|
41103
41120
|
});
|
|
41104
41121
|
}
|
|
41105
41122
|
if (originalData.children) {
|
|
41106
|
-
pendo._.each(originalData.children,
|
|
41123
|
+
pendo._.each(originalData.children, (child) => {
|
|
41107
41124
|
findSubstitutableUrlsInJson(child, placeholderData, pendo);
|
|
41108
41125
|
});
|
|
41109
41126
|
}
|
|
41110
41127
|
return placeholderData;
|
|
41111
41128
|
}
|
|
41112
41129
|
function findSubstitutableElements(pendo) {
|
|
41113
|
-
|
|
41130
|
+
let elements = pendo.dom(`${guideMarkdownUtil.containerSelector} *:not(.pendo-inline-ui)`);
|
|
41114
41131
|
return pendo._.chain(elements)
|
|
41115
41132
|
.filter(function (placeholder) {
|
|
41116
|
-
|
|
41133
|
+
const subRegex = new RegExp(guideMarkdownUtil.substitutionRegex);
|
|
41117
41134
|
if (placeholder.localName === 'a') {
|
|
41118
41135
|
return subRegex.test(decodeURI(placeholder.href)) || subRegex.test(placeholder.textContent);
|
|
41119
41136
|
}
|
|
@@ -41169,25 +41186,51 @@ function findSubstitutableElements(pendo) {
|
|
|
41169
41186
|
.value();
|
|
41170
41187
|
}
|
|
41171
41188
|
function substitutionIcon(color, size) {
|
|
41172
|
-
return (
|
|
41173
|
-
|
|
41174
|
-
|
|
41175
|
-
|
|
41176
|
-
|
|
41177
|
-
|
|
41189
|
+
return (`<div title="Metadata Substitution added">
|
|
41190
|
+
<svg id="pendo-ps-substitution-icon" viewBox="0 0 24 24"
|
|
41191
|
+
preserveAspectRatio="xMidYMid meet"
|
|
41192
|
+
height=${size} width=${size} title="Metadata Substitution"
|
|
41193
|
+
style="bottom:5px; right:10px; position: absolute;"
|
|
41194
|
+
fill="none" xmlns="http://www.w3.org/2000/svg" stroke="${color}"
|
|
41195
|
+
transform="matrix(1, 0, 0, 1, 0, 0)rotate(0)">
|
|
41196
|
+
<g stroke-width="0"></g>
|
|
41197
|
+
<g stroke-linecap="round" stroke-linejoin="round"
|
|
41198
|
+
stroke="${color}" stroke-width="0.528"></g>
|
|
41199
|
+
<g><path fill-rule="evenodd" clip-rule="evenodd"
|
|
41200
|
+
d="M5 5.5C4.17157 5.5 3.5 6.17157 3.5 7V10C3.5 10.8284
|
|
41201
|
+
4.17157 11.5 5 11.5H8C8.82843 11.5 9.5 10.8284 9.5
|
|
41202
|
+
10V9H17V11C17 11.2761 17.2239 11.5 17.5 11.5C17.7761
|
|
41203
|
+
11.5 18 11.2761 18 11V8.5C18 8.22386 17.7761 8 17.5
|
|
41204
|
+
8H9.5V7C9.5 6.17157 8.82843 5.5 8 5.5H5ZM8.5 7C8.5
|
|
41205
|
+
6.72386 8.27614 6.5 8 6.5H5C4.72386 6.5 4.5 6.72386
|
|
41206
|
+
4.5 7V10C4.5 10.2761 4.72386 10.5 5 10.5H8C8.27614
|
|
41207
|
+
10.5 8.5 10.2761 8.5 10V7Z" fill="${color}"></path>
|
|
41208
|
+
<path fill-rule="evenodd" clip-rule="evenodd"
|
|
41209
|
+
d="M7 13C7 12.7239 6.77614 12.5 6.5 12.5C6.22386 12.5
|
|
41210
|
+
6 12.7239 6 13V15.5C6 15.7761 6.22386 16 6.5
|
|
41211
|
+
16H14.5V17C14.5 17.8284 15.1716 18.5 16 18.5H19C19.8284
|
|
41212
|
+
18.5 20.5 17.8284 20.5 17V14C20.5 13.1716 19.8284 12.5
|
|
41213
|
+
19 12.5H16C15.1716 12.5 14.5 13.1716 14.5
|
|
41214
|
+
14V15H7V13ZM15.5 17C15.5 17.2761 15.7239 17.5 16
|
|
41215
|
+
17.5H19C19.2761 17.5 19.5 17.2761 19.5 17V14C19.5
|
|
41216
|
+
13.7239 19.2761 13.5 19 13.5H16C15.7239 13.5 15.5
|
|
41217
|
+
13.7239 15.5 14V17Z" fill="${color}"></path> </g></svg></div>`);
|
|
41218
|
+
}
|
|
41219
|
+
|
|
41220
|
+
const requiredElement = '<span class="_pendo-required-indicator" style="color:red; font-style:italic;" title="Question is required"> *</span>';
|
|
41221
|
+
const requiredSyntax = '{required/}';
|
|
41222
|
+
const RequiredQuestions = {
|
|
41178
41223
|
name: 'RequiredQuestions',
|
|
41179
|
-
script
|
|
41224
|
+
script(step, guide, pendo) {
|
|
41180
41225
|
var _a;
|
|
41181
|
-
|
|
41182
|
-
|
|
41183
|
-
|
|
41184
|
-
});
|
|
41185
|
-
var requiredQuestions = processRequiredQuestions();
|
|
41226
|
+
let requiredPollIds = [];
|
|
41227
|
+
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'));
|
|
41228
|
+
const requiredQuestions = processRequiredQuestions();
|
|
41186
41229
|
if (requiredQuestions) {
|
|
41187
|
-
pendo._.forEach(requiredQuestions,
|
|
41230
|
+
pendo._.forEach(requiredQuestions, (question) => {
|
|
41188
41231
|
if (question.classList.contains('_pendo-open-text-poll-question')) {
|
|
41189
|
-
|
|
41190
|
-
step.attachEvent(step.guideElement.find(
|
|
41232
|
+
let pollId = question.dataset.pendoPollId;
|
|
41233
|
+
step.attachEvent(step.guideElement.find(`[data-pendo-poll-id=${pollId}]._pendo-open-text-poll-input`)[0], 'input', function () {
|
|
41191
41234
|
evaluateRequiredQuestions(requiredQuestions);
|
|
41192
41235
|
});
|
|
41193
41236
|
}
|
|
@@ -41199,8 +41242,8 @@ var RequiredQuestions = {
|
|
|
41199
41242
|
});
|
|
41200
41243
|
}
|
|
41201
41244
|
function getEligibleQuestions() {
|
|
41202
|
-
|
|
41203
|
-
return pendo._.reduce(allQuestions,
|
|
41245
|
+
const allQuestions = step.guideElement.find(`[class*=-poll-question]:contains(${requiredSyntax})`);
|
|
41246
|
+
return pendo._.reduce(allQuestions, (eligibleQuestions, question) => {
|
|
41204
41247
|
if (question.classList.contains('_pendo-yes-no-poll-question'))
|
|
41205
41248
|
return eligibleQuestions;
|
|
41206
41249
|
eligibleQuestions.push(question);
|
|
@@ -41208,19 +41251,27 @@ var RequiredQuestions = {
|
|
|
41208
41251
|
}, []);
|
|
41209
41252
|
}
|
|
41210
41253
|
function processRequiredQuestions() {
|
|
41211
|
-
|
|
41254
|
+
let questions = getEligibleQuestions();
|
|
41212
41255
|
if (questions) {
|
|
41213
|
-
pendo._.forEach(questions,
|
|
41214
|
-
|
|
41256
|
+
pendo._.forEach(questions, question => {
|
|
41257
|
+
let dataPendoPollId = question.getAttribute('data-pendo-poll-id');
|
|
41215
41258
|
requiredPollIds.push(dataPendoPollId);
|
|
41216
|
-
pendo._.each(step.guideElement.find(
|
|
41259
|
+
pendo._.each(step.guideElement.find(`#${question.id} *, #${question.id}`), (element) => {
|
|
41217
41260
|
guideMarkdownUtil.removeMarkdownSyntax(element, requiredSyntax, '', pendo);
|
|
41218
41261
|
});
|
|
41219
|
-
step.guideElement.find(
|
|
41262
|
+
step.guideElement.find(`#${question.id} p`).append(requiredElement);
|
|
41220
41263
|
});
|
|
41221
41264
|
}
|
|
41222
41265
|
if (pendo._.size(requiredPollIds)) {
|
|
41223
|
-
|
|
41266
|
+
const disabledButtonStyles = `<style type=text/css
|
|
41267
|
+
id=_pendo-guide-required-disabled>
|
|
41268
|
+
._pendo-button:disabled, ._pendo-buttons[disabled] {
|
|
41269
|
+
border: 1px solid #999999 !important;
|
|
41270
|
+
background-color: #cccccc !important;
|
|
41271
|
+
color: #666666 !important;
|
|
41272
|
+
pointer-events: none !important;
|
|
41273
|
+
}
|
|
41274
|
+
</style>`;
|
|
41224
41275
|
if (pendo.dom('#_pendo-guide-required-disabled').length === 0) {
|
|
41225
41276
|
pendo.dom('head').append(disabledButtonStyles);
|
|
41226
41277
|
}
|
|
@@ -41231,11 +41282,15 @@ var RequiredQuestions = {
|
|
|
41231
41282
|
function evaluateRequiredQuestions(questions) {
|
|
41232
41283
|
if (questions.length === 0)
|
|
41233
41284
|
return;
|
|
41234
|
-
|
|
41235
|
-
|
|
41236
|
-
responses = responses.concat(pendo._.map(questions,
|
|
41237
|
-
|
|
41238
|
-
|
|
41285
|
+
let allRequiredComplete = true;
|
|
41286
|
+
let responses = [];
|
|
41287
|
+
responses = responses.concat(pendo._.map(questions, (question) => {
|
|
41288
|
+
let pollId = question.getAttribute('data-pendo-poll-id');
|
|
41289
|
+
let input = step.guideElement.find(`
|
|
41290
|
+
[data-pendo-poll-id=${pollId}] textarea,
|
|
41291
|
+
[data-pendo-poll-id=${pollId}] input:text,
|
|
41292
|
+
[data-pendo-poll-id=${pollId}] select,
|
|
41293
|
+
[data-pendo-poll-id=${pollId}] input:radio:checked`);
|
|
41239
41294
|
if (input && input.length && input[0].value) {
|
|
41240
41295
|
return input[0].value;
|
|
41241
41296
|
}
|
|
@@ -41252,48 +41307,48 @@ var RequiredQuestions = {
|
|
|
41252
41307
|
}
|
|
41253
41308
|
function disableEligibleButtons(buttons) {
|
|
41254
41309
|
pendo._.each(buttons, function (button) {
|
|
41255
|
-
if (step.guideElement.find(
|
|
41256
|
-
step.guideElement.find(
|
|
41257
|
-
step.guideElement.find(
|
|
41310
|
+
if (step.guideElement.find(`#${button.props.id}`)[0]) {
|
|
41311
|
+
step.guideElement.find(`#${button.props.id}`)[0].disabled = true;
|
|
41312
|
+
step.guideElement.find(`#${button.props.id}`)[0].parentElement.title = 'Please complete all required questions.';
|
|
41258
41313
|
}
|
|
41259
41314
|
});
|
|
41260
41315
|
}
|
|
41261
41316
|
function enableEligibleButtons(buttons) {
|
|
41262
41317
|
pendo._.each(buttons, function (button) {
|
|
41263
|
-
if (step.guideElement.find(
|
|
41264
|
-
step.guideElement.find(
|
|
41265
|
-
step.guideElement.find(
|
|
41318
|
+
if (step.guideElement.find(`#${button.props.id}`)[0]) {
|
|
41319
|
+
step.guideElement.find(`#${button.props.id}`)[0].disabled = false;
|
|
41320
|
+
step.guideElement.find(`#${button.props.id}`)[0].parentElement.title = '';
|
|
41266
41321
|
}
|
|
41267
41322
|
});
|
|
41268
41323
|
}
|
|
41269
41324
|
},
|
|
41270
|
-
test
|
|
41325
|
+
test(step, guide, pendo) {
|
|
41271
41326
|
var _a;
|
|
41272
|
-
|
|
41327
|
+
let requiredQuestions = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find(`[class*=-poll-question]:contains(${requiredSyntax})`);
|
|
41273
41328
|
return !pendo._.isUndefined(requiredQuestions) && pendo._.size(requiredQuestions);
|
|
41274
41329
|
},
|
|
41275
|
-
designerListener
|
|
41276
|
-
|
|
41277
|
-
|
|
41278
|
-
|
|
41330
|
+
designerListener(pendo) {
|
|
41331
|
+
const requiredQuestions = [];
|
|
41332
|
+
const target = pendo.dom.getBody();
|
|
41333
|
+
const config = {
|
|
41279
41334
|
attributeFilter: ['data-layout'],
|
|
41280
41335
|
attributes: true,
|
|
41281
41336
|
childList: true,
|
|
41282
41337
|
characterData: true,
|
|
41283
41338
|
subtree: true
|
|
41284
41339
|
};
|
|
41285
|
-
|
|
41286
|
-
|
|
41340
|
+
const MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
|
|
41341
|
+
const observer = new MutationObserver(applyRequiredIndicators);
|
|
41287
41342
|
observer.observe(target, config);
|
|
41288
41343
|
function applyRequiredIndicators(mutations) {
|
|
41289
41344
|
pendo._.each(mutations, function (mutation) {
|
|
41290
41345
|
var _a;
|
|
41291
|
-
|
|
41346
|
+
const nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
|
|
41292
41347
|
if (mutation.addedNodes.length && nodeHasQuerySelector) {
|
|
41293
|
-
|
|
41348
|
+
let eligiblePolls = mutation.addedNodes[0].querySelectorAll('[class*=-poll-wrapper], [class*=-poll-select-border]');
|
|
41294
41349
|
if (eligiblePolls) {
|
|
41295
41350
|
pendo._.each(eligiblePolls, function (poll) {
|
|
41296
|
-
|
|
41351
|
+
let dataPendoPollId;
|
|
41297
41352
|
if (poll.classList.contains('_pendo-open-text-poll-wrapper') ||
|
|
41298
41353
|
poll.classList.contains('_pendo-number-scale-poll-wrapper')) {
|
|
41299
41354
|
dataPendoPollId = poll.getAttribute('name');
|
|
@@ -41301,27 +41356,27 @@ var RequiredQuestions = {
|
|
|
41301
41356
|
else {
|
|
41302
41357
|
dataPendoPollId = poll.getAttribute('data-pendo-poll-id');
|
|
41303
41358
|
}
|
|
41304
|
-
|
|
41305
|
-
|
|
41359
|
+
let questionText;
|
|
41360
|
+
const pollQuesiton = pendo.dom(`[class*="-poll-question"][data-pendo-poll-id=${dataPendoPollId}]`)[0];
|
|
41306
41361
|
if (pollQuesiton) {
|
|
41307
|
-
questionText = pendo.dom(
|
|
41362
|
+
questionText = pendo.dom(`[class*="-poll-question"][data-pendo-poll-id=${dataPendoPollId}]`)[0].textContent;
|
|
41308
41363
|
}
|
|
41309
|
-
|
|
41364
|
+
const requiredSyntaxIndex = questionText.indexOf(requiredSyntax);
|
|
41310
41365
|
if (requiredSyntaxIndex > -1) {
|
|
41311
|
-
pendo._.each(pendo.dom(
|
|
41312
|
-
pendo._.each(pendo.dom(
|
|
41366
|
+
pendo._.each(pendo.dom(`[data-pendo-poll-id=${dataPendoPollId}]:not(.pendo-radio)`), (element) => {
|
|
41367
|
+
pendo._.each(pendo.dom(`#${element.id} *:not(".pendo-radio"), #${element.id}:not(".pendo-radio")`), (item) => {
|
|
41313
41368
|
guideMarkdownUtil.removeMarkdownSyntax(item, requiredSyntax, '', pendo);
|
|
41314
41369
|
});
|
|
41315
41370
|
});
|
|
41316
|
-
if (pendo.dom(
|
|
41317
|
-
pendo.dom(
|
|
41318
|
-
pendo.dom(
|
|
41371
|
+
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) {
|
|
41372
|
+
pendo.dom(`.bb-text[data-pendo-poll-id=${dataPendoPollId}] p`).append(requiredElement);
|
|
41373
|
+
pendo.dom(`.bb-text[data-pendo-poll-id=${dataPendoPollId}] li`).append(requiredElement);
|
|
41319
41374
|
}
|
|
41320
41375
|
else {
|
|
41321
|
-
pendo.dom(
|
|
41376
|
+
pendo.dom(`.bb-text[data-pendo-poll-id=${dataPendoPollId}]`).append(requiredElement);
|
|
41322
41377
|
}
|
|
41323
41378
|
if (pendo._.contains(requiredQuestions, dataPendoPollId)) {
|
|
41324
|
-
|
|
41379
|
+
let questionIndex = requiredQuestions.indexOf(dataPendoPollId);
|
|
41325
41380
|
if (questionIndex !== -1) {
|
|
41326
41381
|
requiredQuestions.splice(questionIndex, 1);
|
|
41327
41382
|
}
|
|
@@ -41332,7 +41387,7 @@ var RequiredQuestions = {
|
|
|
41332
41387
|
}
|
|
41333
41388
|
else {
|
|
41334
41389
|
if (pendo._.contains(requiredQuestions, dataPendoPollId)) {
|
|
41335
|
-
|
|
41390
|
+
let index = requiredQuestions.indexOf(dataPendoPollId);
|
|
41336
41391
|
if (index !== -1) {
|
|
41337
41392
|
requiredQuestions.splice(index, 1);
|
|
41338
41393
|
}
|
|
@@ -41346,54 +41401,54 @@ var RequiredQuestions = {
|
|
|
41346
41401
|
}
|
|
41347
41402
|
};
|
|
41348
41403
|
|
|
41349
|
-
|
|
41350
|
-
|
|
41351
|
-
script
|
|
41352
|
-
|
|
41353
|
-
|
|
41354
|
-
|
|
41355
|
-
|
|
41356
|
-
|
|
41404
|
+
const skipStepRegex = new RegExp(guideMarkdownUtil.skipStepString);
|
|
41405
|
+
const SkipToEligibleStep = {
|
|
41406
|
+
script(step, guide, pendo) {
|
|
41407
|
+
let isAdvanceIntercepted = false;
|
|
41408
|
+
let isPreviousIntercepted = false;
|
|
41409
|
+
let guideContainer = step.guideElement.find(guideMarkdownUtil.containerSelector);
|
|
41410
|
+
let guideContainerAriaLabel = guideContainer.attr('aria-label');
|
|
41411
|
+
let stepNumberOrAuto = skipStepRegex.exec(guideContainerAriaLabel)[1];
|
|
41357
41412
|
if (guideContainer) {
|
|
41358
41413
|
guideContainer.attr({ 'aria-label': guideContainer.attr('aria-label').replace(skipStepRegex, '') });
|
|
41359
41414
|
}
|
|
41360
|
-
this.on('beforeAdvance',
|
|
41415
|
+
this.on('beforeAdvance', (evt) => {
|
|
41361
41416
|
if (guide.getPositionOfStep(step) === guide.steps.length || pendo._.isUndefined(stepNumberOrAuto))
|
|
41362
41417
|
return; // exit on the last step of a guide or when we don't have an argument
|
|
41363
|
-
|
|
41418
|
+
let eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'next');
|
|
41364
41419
|
if (!isAdvanceIntercepted && stepNumberOrAuto) {
|
|
41365
41420
|
isAdvanceIntercepted = true;
|
|
41366
|
-
pendo.goToStep({ destinationStepId: eligibleStep.id, step
|
|
41421
|
+
pendo.goToStep({ destinationStepId: eligibleStep.id, step });
|
|
41367
41422
|
evt.cancel = true;
|
|
41368
41423
|
}
|
|
41369
41424
|
});
|
|
41370
|
-
this.on('beforePrevious',
|
|
41425
|
+
this.on('beforePrevious', (evt) => {
|
|
41371
41426
|
if (pendo._.isUndefined(stepNumberOrAuto))
|
|
41372
41427
|
return;
|
|
41373
|
-
|
|
41428
|
+
let eligibleStep = findEligibleSkipStep(stepNumberOrAuto, 'previous');
|
|
41374
41429
|
if (!isPreviousIntercepted && stepNumberOrAuto) {
|
|
41375
41430
|
isPreviousIntercepted = true;
|
|
41376
|
-
pendo.goToStep({ destinationStepId: eligibleStep.id, step
|
|
41431
|
+
pendo.goToStep({ destinationStepId: eligibleStep.id, step });
|
|
41377
41432
|
evt.cancel = true;
|
|
41378
41433
|
}
|
|
41379
41434
|
});
|
|
41380
41435
|
function findEligibleSkipStep(stepNumber, direction) {
|
|
41381
41436
|
// Find the next eligible step by using getPosition of step (1 based)
|
|
41382
41437
|
// getPosition - 2 gives the previous step
|
|
41383
|
-
|
|
41384
|
-
|
|
41438
|
+
let skipForwardStep = findStepOnPage(guide.getPositionOfStep(step), 'next', stepNumber);
|
|
41439
|
+
let skipPreviousStep = findStepOnPage(guide.getPositionOfStep(step) - 2, 'previous', stepNumber);
|
|
41385
41440
|
if (skipForwardStep && direction == 'next') {
|
|
41386
|
-
pendo.goToStep({ destinationStepId: skipForwardStep, step
|
|
41441
|
+
pendo.goToStep({ destinationStepId: skipForwardStep, step });
|
|
41387
41442
|
}
|
|
41388
41443
|
if (skipPreviousStep && direction == 'previous') {
|
|
41389
|
-
pendo.goToStep({ destinationStepId: skipPreviousStep, step
|
|
41444
|
+
pendo.goToStep({ destinationStepId: skipPreviousStep, step });
|
|
41390
41445
|
}
|
|
41391
41446
|
return direction === 'next' ? skipForwardStep : skipPreviousStep;
|
|
41392
41447
|
}
|
|
41393
41448
|
function findStepOnPage(stepIndex, direction, stepNumber) {
|
|
41394
41449
|
if (pendo._.isNaN(stepIndex))
|
|
41395
41450
|
return;
|
|
41396
|
-
|
|
41451
|
+
let $step = guide.steps[stepIndex];
|
|
41397
41452
|
if ($step && !$step.canShow()) {
|
|
41398
41453
|
if (stepNumber !== 'auto') {
|
|
41399
41454
|
return guide.steps[stepNumber - 1];
|
|
@@ -41410,34 +41465,34 @@ var SkipToEligibleStep = {
|
|
|
41410
41465
|
}
|
|
41411
41466
|
}
|
|
41412
41467
|
},
|
|
41413
|
-
test
|
|
41468
|
+
test(step, guide, pendo) {
|
|
41414
41469
|
var _a;
|
|
41415
|
-
|
|
41470
|
+
const guideContainerAriaLabel = (_a = step.guideElement) === null || _a === void 0 ? void 0 : _a.find(guideMarkdownUtil.containerSelector).attr('aria-label');
|
|
41416
41471
|
return pendo._.isString(guideContainerAriaLabel) && guideContainerAriaLabel.indexOf('{skipStep') !== -1;
|
|
41417
41472
|
},
|
|
41418
|
-
designerListener
|
|
41419
|
-
|
|
41420
|
-
|
|
41473
|
+
designerListener(pendo) {
|
|
41474
|
+
const target = pendo.dom.getBody();
|
|
41475
|
+
const config = {
|
|
41421
41476
|
attributeFilter: ['data-layout'],
|
|
41422
41477
|
attributes: true,
|
|
41423
41478
|
childList: true,
|
|
41424
41479
|
characterData: true,
|
|
41425
41480
|
subtree: true
|
|
41426
41481
|
};
|
|
41427
|
-
|
|
41428
|
-
|
|
41482
|
+
const MutationObserver = getZoneSafeMethod(pendo._, 'MutationObserver');
|
|
41483
|
+
const observer = new MutationObserver(applySkipStepIndicator);
|
|
41429
41484
|
observer.observe(target, config);
|
|
41430
41485
|
// create an observer instance
|
|
41431
41486
|
function applySkipStepIndicator(mutations) {
|
|
41432
41487
|
pendo._.each(mutations, function (mutation) {
|
|
41433
41488
|
var _a, _b;
|
|
41434
|
-
|
|
41489
|
+
const nodeHasQuerySelector = pendo._.isFunction((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.querySelectorAll);
|
|
41435
41490
|
if (mutation.addedNodes.length && nodeHasQuerySelector) {
|
|
41436
|
-
|
|
41437
|
-
|
|
41491
|
+
let guideContainer = mutation.addedNodes[0].querySelectorAll(guideMarkdownUtil.containerSelector);
|
|
41492
|
+
let guideContainerAriaLabel = (_b = guideContainer[0]) === null || _b === void 0 ? void 0 : _b.getAttribute('aria-label');
|
|
41438
41493
|
if (guideContainerAriaLabel) {
|
|
41439
41494
|
if (guideContainerAriaLabel.match(skipStepRegex)) {
|
|
41440
|
-
|
|
41495
|
+
let fullSkipStepString = guideContainerAriaLabel.match(skipStepRegex)[0];
|
|
41441
41496
|
guideContainerAriaLabel.replace(fullSkipStepString, '');
|
|
41442
41497
|
if (!pendo.dom('#_pendoSkipIcon').length) {
|
|
41443
41498
|
pendo.dom(guideMarkdownUtil.containerSelector).append(skipIcon('#999', '30px').trim());
|
|
@@ -41448,30 +41503,48 @@ var SkipToEligibleStep = {
|
|
|
41448
41503
|
});
|
|
41449
41504
|
}
|
|
41450
41505
|
function skipIcon(color, size) {
|
|
41451
|
-
return (
|
|
41506
|
+
return (`<div title="Skip step added"><svg id="_pendoSkipIcon" version="1.0" xmlns="http://www.w3.org/2000/svg"
|
|
41507
|
+
width="${size}" height="${size}" viewBox="0 0 512.000000 512.000000"
|
|
41508
|
+
preserveAspectRatio="xMidYMid meet" style="bottom:5px; right:10px; position: absolute;">
|
|
41509
|
+
<g transform="translate(0.000000,512.000000) scale(0.100000,-0.100000)"
|
|
41510
|
+
fill="${color}" stroke="none">
|
|
41511
|
+
<path d="M2185 4469 c-363 -38 -739 -186 -1034 -407 -95 -71 -273 -243 -357
|
|
41512
|
+
-343 -205 -246 -364 -577 -429 -897 -25 -121 -45 -288 -45 -373 l0 -49 160 0
|
|
41513
|
+
160 0 0 48 c0 26 5 88 10 137 68 593 417 1103 940 1374 1100 570 2418 -137
|
|
41514
|
+
2560 -1374 5 -49 10 -111 10 -137 l0 -47 -155 -3 -155 -3 235 -235 235 -236
|
|
41515
|
+
235 236 235 235 -155 3 -155 3 0 48 c0 27 -5 95 -10 152 -100 989 -878 1767
|
|
41516
|
+
-1869 1868 -117 12 -298 12 -416 0z"/>
|
|
41517
|
+
<path d="M320 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
|
|
41518
|
+
<path d="M960 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
|
|
41519
|
+
<path d="M1600 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
|
|
41520
|
+
<path d="M2240 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
|
|
41521
|
+
<path d="M2880 1440 l0 -160 160 0 160 0 0 160 0 160 -160 0 -160 0 0 -160z"/>
|
|
41522
|
+
<path d="M3840 1440 l0 -160 480 0 480 0 0 160 0 160 -480 0 -480 0 0 -160z"/>
|
|
41523
|
+
</g></svg></div>
|
|
41524
|
+
`);
|
|
41452
41525
|
}
|
|
41453
41526
|
}
|
|
41454
41527
|
};
|
|
41455
41528
|
|
|
41456
41529
|
function GuideMarkdown() {
|
|
41457
|
-
|
|
41458
|
-
|
|
41459
|
-
|
|
41530
|
+
let guideMarkdown;
|
|
41531
|
+
let pluginApi;
|
|
41532
|
+
let globalPendo;
|
|
41460
41533
|
return {
|
|
41461
41534
|
name: 'GuideMarkdown',
|
|
41462
41535
|
initialize: init,
|
|
41463
|
-
teardown
|
|
41536
|
+
teardown
|
|
41464
41537
|
};
|
|
41465
41538
|
function init(pendo, PluginAPI) {
|
|
41466
41539
|
globalPendo = pendo;
|
|
41467
41540
|
pluginApi = PluginAPI;
|
|
41468
|
-
|
|
41469
|
-
|
|
41541
|
+
const configReader = PluginAPI.ConfigReader;
|
|
41542
|
+
const GUIDEMARKDOWN_CONFIG = 'guideMarkdown';
|
|
41470
41543
|
configReader.addOption(GUIDEMARKDOWN_CONFIG, [
|
|
41471
41544
|
configReader.sources.SNIPPET_SRC,
|
|
41472
41545
|
configReader.sources.PENDO_CONFIG_SRC
|
|
41473
41546
|
], false);
|
|
41474
|
-
|
|
41547
|
+
const markdownScriptsEnabled = configReader.get(GUIDEMARKDOWN_CONFIG);
|
|
41475
41548
|
if (!markdownScriptsEnabled)
|
|
41476
41549
|
return;
|
|
41477
41550
|
guideMarkdown = [PollBranching, MetadataSubstitution, RequiredQuestions, SkipToEligibleStep];
|
|
@@ -42497,8 +42570,8 @@ function Feedback() {
|
|
|
42497
42570
|
var widgetLoaded = false;
|
|
42498
42571
|
var feedbackAllowedProductId = '';
|
|
42499
42572
|
var initialized = false;
|
|
42500
|
-
|
|
42501
|
-
|
|
42573
|
+
const PING_COOKIE = 'feedback_ping_sent';
|
|
42574
|
+
const PING_COOKIE_EXPIRATION = 1000 * 60 * 60;
|
|
42502
42575
|
var overflowMediaQuery = '@media only screen and (max-device-width:1112px){#feedback-widget{overflow-y:scroll}}';
|
|
42503
42576
|
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
42577
|
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 +42591,28 @@ function Feedback() {
|
|
|
42518
42591
|
feedbackStyles: 'pendo-feedback-styles',
|
|
42519
42592
|
feedbackFrameStyles: 'pendo-feedback-visible-buttons-styles'
|
|
42520
42593
|
};
|
|
42521
|
-
|
|
42522
|
-
|
|
42594
|
+
let globalPendo;
|
|
42595
|
+
let pluginApi;
|
|
42523
42596
|
return {
|
|
42524
42597
|
name: 'Feedback',
|
|
42525
|
-
initialize
|
|
42526
|
-
teardown
|
|
42527
|
-
validate
|
|
42598
|
+
initialize,
|
|
42599
|
+
teardown,
|
|
42600
|
+
validate
|
|
42528
42601
|
};
|
|
42529
42602
|
function initialize(pendo, PluginAPI) {
|
|
42530
42603
|
globalPendo = pendo;
|
|
42531
42604
|
pluginApi = PluginAPI;
|
|
42532
42605
|
var publicFeedback = {
|
|
42533
|
-
ping
|
|
42534
|
-
init
|
|
42606
|
+
ping,
|
|
42607
|
+
init,
|
|
42535
42608
|
initialized: getInitialized,
|
|
42536
|
-
loginAndRedirect
|
|
42537
|
-
openFeedback
|
|
42538
|
-
initializeFeedbackOnce
|
|
42539
|
-
isFeedbackLoaded
|
|
42540
|
-
convertPendoToFeedbackOptions
|
|
42609
|
+
loginAndRedirect,
|
|
42610
|
+
openFeedback,
|
|
42611
|
+
initializeFeedbackOnce,
|
|
42612
|
+
isFeedbackLoaded,
|
|
42613
|
+
convertPendoToFeedbackOptions,
|
|
42541
42614
|
isUnsupportedIE: pendo._.partial(isUnsupportedIE, PluginAPI),
|
|
42542
|
-
removeFeedbackWidget
|
|
42615
|
+
removeFeedbackWidget
|
|
42543
42616
|
};
|
|
42544
42617
|
pendo.feedback = publicFeedback;
|
|
42545
42618
|
pendo.getFeedbackSettings = getFeedbackSettings;
|
|
@@ -42567,7 +42640,7 @@ function Feedback() {
|
|
|
42567
42640
|
*/
|
|
42568
42641
|
PluginAPI.agentStorage.registry.addLocal(PING_COOKIE, { duration: PING_COOKIE_EXPIRATION });
|
|
42569
42642
|
return {
|
|
42570
|
-
validate
|
|
42643
|
+
validate
|
|
42571
42644
|
};
|
|
42572
42645
|
}
|
|
42573
42646
|
function teardown() {
|
|
@@ -42587,18 +42660,18 @@ function Feedback() {
|
|
|
42587
42660
|
return result;
|
|
42588
42661
|
}
|
|
42589
42662
|
function pingOrInitialize() {
|
|
42590
|
-
|
|
42663
|
+
const options = getPendoOptions();
|
|
42591
42664
|
if (initialized) {
|
|
42592
|
-
|
|
42665
|
+
const feedbackOptions = convertPendoToFeedbackOptions(options);
|
|
42593
42666
|
ping(feedbackOptions);
|
|
42594
42667
|
}
|
|
42595
42668
|
else if (shouldInitializeFeedback() && !globalPendo._.isEmpty(options)) {
|
|
42596
|
-
|
|
42597
|
-
init(options, settings)
|
|
42669
|
+
const settings = pluginApi.ConfigReader.get('feedbackSettings');
|
|
42670
|
+
init(options, settings).catch(globalPendo._.noop);
|
|
42598
42671
|
}
|
|
42599
42672
|
}
|
|
42600
42673
|
function handleIdentityChange(event) {
|
|
42601
|
-
|
|
42674
|
+
const visitorId = globalPendo._.get(event, 'data.0.visitor_id') || globalPendo._.get(event, 'data.0.options.visitor.id');
|
|
42602
42675
|
if (globalPendo.isAnonymousVisitor(visitorId)) {
|
|
42603
42676
|
removeFeedbackWidget();
|
|
42604
42677
|
return;
|
|
@@ -42668,9 +42741,9 @@ function Feedback() {
|
|
|
42668
42741
|
if (toSend.data && toSend.data !== '{}' && toSend.data !== 'null') {
|
|
42669
42742
|
return globalPendo.ajax
|
|
42670
42743
|
.postJSON(getFullUrl('/widget/pendo_ping'), toSend)
|
|
42671
|
-
.then(
|
|
42744
|
+
.then((response) => {
|
|
42672
42745
|
onWidgetPingResponse(response);
|
|
42673
|
-
})
|
|
42746
|
+
}).catch(() => { onPingFailure(); });
|
|
42674
42747
|
}
|
|
42675
42748
|
}
|
|
42676
42749
|
return pluginApi.q.resolve();
|
|
@@ -42804,10 +42877,10 @@ function Feedback() {
|
|
|
42804
42877
|
return globalPendo.ajax.postJSON(getFullUrl('/analytics'), toSend);
|
|
42805
42878
|
}
|
|
42806
42879
|
function addOverlay() {
|
|
42807
|
-
|
|
42880
|
+
const widget = globalPendo.dom(`#${elemIds.feedbackWidget}`);
|
|
42808
42881
|
if (!widget)
|
|
42809
42882
|
return;
|
|
42810
|
-
|
|
42883
|
+
const overlayStyles = {
|
|
42811
42884
|
'position': 'fixed',
|
|
42812
42885
|
'top': '0',
|
|
42813
42886
|
'right': '0',
|
|
@@ -42819,7 +42892,7 @@ function Feedback() {
|
|
|
42819
42892
|
'animation': 'pendoFeedbackFadeIn 0.5s 0s 1 alternate both',
|
|
42820
42893
|
'-webkit-animation': 'pendoFeedbackFadeIn 0.5s 0s 1 alternate both'
|
|
42821
42894
|
};
|
|
42822
|
-
|
|
42895
|
+
const overlayElement = globalPendo.dom(document.createElement('div'));
|
|
42823
42896
|
overlayElement.attr('id', 'feedback-overlay');
|
|
42824
42897
|
overlayElement.css(overlayStyles);
|
|
42825
42898
|
overlayElement.appendTo(widget.getParent());
|
|
@@ -42924,22 +42997,22 @@ function Feedback() {
|
|
|
42924
42997
|
}
|
|
42925
42998
|
}
|
|
42926
42999
|
function buildOuterTriggerDiv(positionInfo) {
|
|
42927
|
-
|
|
42928
|
-
|
|
42929
|
-
|
|
43000
|
+
const horizontalStyles = getHorizontalPositionStyles(positionInfo);
|
|
43001
|
+
const verticalStyles = getVerticalPositionStyles(positionInfo);
|
|
43002
|
+
const styles = globalPendo._.extend({
|
|
42930
43003
|
'position': 'fixed',
|
|
42931
43004
|
'height': '43px',
|
|
42932
43005
|
'opacity': '1 !important',
|
|
42933
43006
|
'z-index': '9001'
|
|
42934
43007
|
}, horizontalStyles, verticalStyles);
|
|
42935
|
-
|
|
43008
|
+
const outerTrigger = globalPendo.dom(document.createElement('div'));
|
|
42936
43009
|
outerTrigger.attr('id', elemIds.feedbackTrigger);
|
|
42937
43010
|
outerTrigger.css(styles);
|
|
42938
43011
|
outerTrigger.attr('data-turbolinks-permanent', '');
|
|
42939
43012
|
return outerTrigger;
|
|
42940
43013
|
}
|
|
42941
43014
|
function buildNotification() {
|
|
42942
|
-
|
|
43015
|
+
const styles = {
|
|
42943
43016
|
'background-color': '#D85039',
|
|
42944
43017
|
'color': '#fff',
|
|
42945
43018
|
'border-radius': '50%',
|
|
@@ -42956,20 +43029,20 @@ function Feedback() {
|
|
|
42956
43029
|
'animation-delay': '1s',
|
|
42957
43030
|
'animation-iteration-count': '1'
|
|
42958
43031
|
};
|
|
42959
|
-
|
|
43032
|
+
const notification = globalPendo.dom(document.createElement('span'));
|
|
42960
43033
|
notification.attr('id', 'feedback-trigger-notification');
|
|
42961
43034
|
notification.css(styles);
|
|
42962
43035
|
return notification;
|
|
42963
43036
|
}
|
|
42964
43037
|
function buildTriggerButton(settings, positionInfo) {
|
|
42965
|
-
|
|
43038
|
+
let borderRadius;
|
|
42966
43039
|
if (positionInfo.horizontalPosition === 'left') {
|
|
42967
43040
|
borderRadius = '0 0 5px 5px';
|
|
42968
43041
|
}
|
|
42969
43042
|
else {
|
|
42970
43043
|
borderRadius = '3px 3px 0 0';
|
|
42971
43044
|
}
|
|
42972
|
-
|
|
43045
|
+
const styles = {
|
|
42973
43046
|
'border': 'none',
|
|
42974
43047
|
'padding': '11px 18px 14px 18px',
|
|
42975
43048
|
'background-color': settings.triggerColor,
|
|
@@ -42980,21 +43053,32 @@ function Feedback() {
|
|
|
42980
43053
|
'cursor': 'pointer',
|
|
42981
43054
|
'text-align': 'left'
|
|
42982
43055
|
};
|
|
42983
|
-
|
|
43056
|
+
const triggerButton = globalPendo.dom(document.createElement('button'));
|
|
42984
43057
|
triggerButton.attr('id', elemIds.feedbackTriggerButton);
|
|
42985
43058
|
triggerButton.css(styles);
|
|
42986
43059
|
triggerButton.text(settings.triggerText);
|
|
42987
43060
|
return triggerButton;
|
|
42988
43061
|
}
|
|
42989
43062
|
function addTriggerPseudoStyles() {
|
|
42990
|
-
|
|
43063
|
+
const pseudoStyles = `
|
|
43064
|
+
#feedback-trigger button:hover {
|
|
43065
|
+
box-shadow: 0 -5px 20px rgba(0,0,0,.19) !important;
|
|
43066
|
+
outline: none !important;
|
|
43067
|
+
background: #3e566f !important;
|
|
43068
|
+
}
|
|
43069
|
+
#feedback-trigger button:focus {
|
|
43070
|
+
box-shadow: 0 -5px 20px rgba(0,0,0,.19) !important;
|
|
43071
|
+
outline: none !important;
|
|
43072
|
+
background: #3e566f !important;
|
|
43073
|
+
}
|
|
43074
|
+
`;
|
|
42991
43075
|
pluginApi.util.addInlineStyles('pendo-feedback-trigger-styles', pseudoStyles);
|
|
42992
43076
|
}
|
|
42993
43077
|
function createTrigger(settings, positionInfo) {
|
|
42994
43078
|
addTriggerPseudoStyles();
|
|
42995
|
-
|
|
42996
|
-
|
|
42997
|
-
|
|
43079
|
+
const triggerElement = buildOuterTriggerDiv(positionInfo);
|
|
43080
|
+
const notificationElement = buildNotification();
|
|
43081
|
+
const triggerButtonElement = buildTriggerButton(settings, positionInfo);
|
|
42998
43082
|
triggerElement.append(notificationElement);
|
|
42999
43083
|
triggerElement.append(triggerButtonElement);
|
|
43000
43084
|
triggerElement.appendTo(globalPendo.dom.getBody());
|
|
@@ -43018,7 +43102,7 @@ function Feedback() {
|
|
|
43018
43102
|
iframeWrapper.css(getWidgetOriginalStyles());
|
|
43019
43103
|
iframeWrapper.attr('id', elemIds.feedbackWidget);
|
|
43020
43104
|
iframeWrapper.attr('data-turbolinks-permanent', 'true');
|
|
43021
|
-
iframeWrapper.addClass(
|
|
43105
|
+
iframeWrapper.addClass(`buttonIs-${horizontalPosition}`);
|
|
43022
43106
|
return iframeWrapper;
|
|
43023
43107
|
}
|
|
43024
43108
|
function buildIframeContainer() {
|
|
@@ -43035,13 +43119,22 @@ function Feedback() {
|
|
|
43035
43119
|
return iframeContainer;
|
|
43036
43120
|
}
|
|
43037
43121
|
function addWidgetVisibleButtonStyles(buttonStylePosition) {
|
|
43038
|
-
|
|
43039
|
-
|
|
43122
|
+
let side = buttonStylePosition === 'left' ? 'left' : 'right'; // just in case something was not left or right for some reason
|
|
43123
|
+
const styles = `
|
|
43124
|
+
.buttonIs-${side}.visible {
|
|
43125
|
+
${side}: 0 !important;
|
|
43126
|
+
width: 470px !important;
|
|
43127
|
+
animation-direction: alternate-reverse !important;
|
|
43128
|
+
animation: pendoFeedbackSlideFrom-${side} 0.5s 0s 1 alternate both !important;
|
|
43129
|
+
-webkit-animation: pendoFeedbackSlideFrom-${side} 0.5s 0s 1 alternate both !important;
|
|
43130
|
+
z-index: 9002 !important;
|
|
43131
|
+
}
|
|
43132
|
+
`;
|
|
43040
43133
|
pluginApi.util.addInlineStyles(elemIds.feedbackFrameStyles, styles);
|
|
43041
43134
|
}
|
|
43042
43135
|
function initialiseWidgetFrame(horizontalPosition) {
|
|
43043
43136
|
addWidgetVisibleButtonStyles(horizontalPosition);
|
|
43044
|
-
|
|
43137
|
+
const iframeElement = buildIframeWrapper(horizontalPosition);
|
|
43045
43138
|
iframeElement.append(buildIframeContainer());
|
|
43046
43139
|
iframeElement.appendTo(globalPendo.dom.getBody());
|
|
43047
43140
|
subscribeToIframeMessages();
|
|
@@ -43065,7 +43158,7 @@ function Feedback() {
|
|
|
43065
43158
|
return widgetLoaded;
|
|
43066
43159
|
}
|
|
43067
43160
|
function getPendoOptions() {
|
|
43068
|
-
|
|
43161
|
+
let options = pluginApi.ConfigReader.getLocalConfig();
|
|
43069
43162
|
if (!globalPendo._.isObject(options))
|
|
43070
43163
|
options = {};
|
|
43071
43164
|
if (!globalPendo._.isObject(options.visitor))
|
|
@@ -43093,7 +43186,7 @@ function Feedback() {
|
|
|
43093
43186
|
return true;
|
|
43094
43187
|
}
|
|
43095
43188
|
function getQueryParam(url, paramName) {
|
|
43096
|
-
|
|
43189
|
+
const results = new RegExp('[?&]' + paramName + '=([^&#]*)').exec(url);
|
|
43097
43190
|
if (results == null) {
|
|
43098
43191
|
return null;
|
|
43099
43192
|
}
|
|
@@ -43110,13 +43203,13 @@ function Feedback() {
|
|
|
43110
43203
|
return pluginApi.q.reject();
|
|
43111
43204
|
if (!canInitFeedback(pendoOptions))
|
|
43112
43205
|
return pluginApi.q.reject();
|
|
43113
|
-
|
|
43206
|
+
const feedbackOptions = convertPendoToFeedbackOptions(pendoOptions);
|
|
43114
43207
|
try {
|
|
43115
|
-
|
|
43116
|
-
if (
|
|
43208
|
+
const fdbkDst = getQueryParam(globalPendo.url.get(), 'fdbkDst');
|
|
43209
|
+
if (fdbkDst && fdbkDst.startsWith('case')) {
|
|
43117
43210
|
initialized = true;
|
|
43118
43211
|
getFeedbackLoginUrl().then(function (loginUrl) {
|
|
43119
|
-
|
|
43212
|
+
const destinationUrl = loginUrl + '&fdbkDst=' + fdbkDst;
|
|
43120
43213
|
window.location.href = destinationUrl;
|
|
43121
43214
|
});
|
|
43122
43215
|
return;
|
|
@@ -43165,7 +43258,7 @@ function Feedback() {
|
|
|
43165
43258
|
function convertPendoToFeedbackOptions(options) {
|
|
43166
43259
|
var jwtOptions = pluginApi.agent.getJwtInfoCopy();
|
|
43167
43260
|
if (globalPendo._.isEmpty(jwtOptions)) {
|
|
43168
|
-
|
|
43261
|
+
const feedbackOptions = {};
|
|
43169
43262
|
feedbackOptions.user = globalPendo._.pick(options.visitor, 'id', 'full_name', 'firstName', 'lastName', 'email', 'tags', 'custom_allowed_products');
|
|
43170
43263
|
globalPendo._.extend(feedbackOptions.user, { allowed_products: [{ id: feedbackAllowedProductId }] });
|
|
43171
43264
|
feedbackOptions.account = globalPendo._.pick(options.account, 'id', 'name', 'monthly_value', 'is_paying', 'tags');
|
|
@@ -46492,10 +46585,7 @@ function initStyleSheetObserver({ styleSheetRuleCb, mirror: mirror2, stylesheetM
|
|
|
46492
46585
|
adds: [{ rule, index: index2 }]
|
|
46493
46586
|
});
|
|
46494
46587
|
}
|
|
46495
|
-
|
|
46496
|
-
return target.apply(thisArg, argumentsList);
|
|
46497
|
-
} catch (e2) {
|
|
46498
|
-
}
|
|
46588
|
+
return target.apply(thisArg, argumentsList);
|
|
46499
46589
|
}
|
|
46500
46590
|
)
|
|
46501
46591
|
});
|
|
@@ -46624,10 +46714,7 @@ function initStyleSheetObserver({ styleSheetRuleCb, mirror: mirror2, stylesheetM
|
|
|
46624
46714
|
]
|
|
46625
46715
|
});
|
|
46626
46716
|
}
|
|
46627
|
-
|
|
46628
|
-
return target.apply(thisArg, argumentsList);
|
|
46629
|
-
} catch (e2) {
|
|
46630
|
-
}
|
|
46717
|
+
return target.apply(thisArg, argumentsList);
|
|
46631
46718
|
}
|
|
46632
46719
|
)
|
|
46633
46720
|
}
|
|
@@ -48713,17 +48800,6 @@ var SessionRecorderBuffer = /** @class */ (function () {
|
|
|
48713
48800
|
return SessionRecorderBuffer;
|
|
48714
48801
|
}());
|
|
48715
48802
|
|
|
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
48803
|
function __rest(s, e) {
|
|
48728
48804
|
var t = {};
|
|
48729
48805
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -50877,7 +50953,7 @@ function includes(str, substring) {
|
|
|
50877
50953
|
function getResourceType(blockedURI, directive) {
|
|
50878
50954
|
if (!directive || typeof directive !== 'string')
|
|
50879
50955
|
return 'resource';
|
|
50880
|
-
|
|
50956
|
+
const d = directive.toLowerCase();
|
|
50881
50957
|
if (blockedURI === 'inline') {
|
|
50882
50958
|
if (includes(d, 'script-src-attr')) {
|
|
50883
50959
|
return 'inline event handler';
|
|
@@ -50936,12 +51012,11 @@ function getResourceType(blockedURI, directive) {
|
|
|
50936
51012
|
function getDirective(policy, directiveName) {
|
|
50937
51013
|
if (!policy || !directiveName)
|
|
50938
51014
|
return '';
|
|
50939
|
-
|
|
50940
|
-
for (
|
|
50941
|
-
|
|
50942
|
-
|
|
50943
|
-
|
|
50944
|
-
if (lower === needle || lower.startsWith("".concat(needle, " "))) {
|
|
51015
|
+
const needle = directiveName.toLowerCase();
|
|
51016
|
+
for (const directive of policy.split(';')) {
|
|
51017
|
+
const trimmed = directive.trim();
|
|
51018
|
+
const lower = trimmed.toLowerCase();
|
|
51019
|
+
if (lower === needle || lower.startsWith(`${needle} `)) {
|
|
50945
51020
|
return trimmed;
|
|
50946
51021
|
}
|
|
50947
51022
|
}
|
|
@@ -50963,7 +51038,7 @@ function getDirective(policy, directiveName) {
|
|
|
50963
51038
|
function getArticle(phrase) {
|
|
50964
51039
|
if (!phrase || typeof phrase !== 'string')
|
|
50965
51040
|
return 'A';
|
|
50966
|
-
|
|
51041
|
+
const c = phrase.trim().charAt(0).toLowerCase();
|
|
50967
51042
|
return includes('aeiou', c) ? 'An' : 'A';
|
|
50968
51043
|
}
|
|
50969
51044
|
/**
|
|
@@ -51006,47 +51081,46 @@ function createCspViolationMessage(blockedURI, directive, isReportOnly, original
|
|
|
51006
51081
|
return 'Content Security Policy: Unknown violation occurred.';
|
|
51007
51082
|
}
|
|
51008
51083
|
try {
|
|
51009
|
-
|
|
51084
|
+
const reportOnlyText = isReportOnly ? ' (Report-Only)' : '';
|
|
51010
51085
|
// special case for frame-ancestors since it doesn't fit our template at all
|
|
51011
51086
|
if ((directive === null || directive === void 0 ? void 0 : directive.toLowerCase()) === 'frame-ancestors') {
|
|
51012
|
-
return
|
|
51087
|
+
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
51088
|
}
|
|
51014
|
-
|
|
51015
|
-
|
|
51016
|
-
|
|
51017
|
-
|
|
51018
|
-
|
|
51019
|
-
|
|
51020
|
-
return
|
|
51089
|
+
const resourceType = getResourceType(blockedURI, directive);
|
|
51090
|
+
const article = getArticle(resourceType);
|
|
51091
|
+
const source = formatBlockedUri(blockedURI);
|
|
51092
|
+
const directiveValue = getDirective(originalPolicy, directive);
|
|
51093
|
+
const policyDisplay = directiveValue || directive;
|
|
51094
|
+
const resourceDescription = `${article} ${resourceType}${source ? ` from ${source}` : ''}`;
|
|
51095
|
+
return `Content Security Policy${reportOnlyText}: ${resourceDescription} was blocked by your site's \`${policyDisplay}\` policy.\nCurrent CSP: "${originalPolicy}".`;
|
|
51021
51096
|
}
|
|
51022
51097
|
catch (error) {
|
|
51023
|
-
return
|
|
51098
|
+
return `Content Security Policy: Error formatting violation message: ${error.message}`;
|
|
51024
51099
|
}
|
|
51025
51100
|
}
|
|
51026
51101
|
|
|
51027
|
-
|
|
51028
|
-
|
|
51102
|
+
const MAX_LENGTH = 1000;
|
|
51103
|
+
const PII_PATTERN = {
|
|
51029
51104
|
ip: /\b(?:\d{1,3}\.){3}\d{1,3}\b/g,
|
|
51030
51105
|
ssn: /\b\d{3}-\d{2}-\d{4}\b/g,
|
|
51031
51106
|
creditCard: /\b(?:\d[ -]?){12,18}\d\b/g,
|
|
51032
51107
|
httpsUrls: /https:\/\/[^\s]+/g,
|
|
51033
51108
|
email: /[\w._+-]+@[\w.-]+\.\w+/g
|
|
51034
51109
|
};
|
|
51035
|
-
|
|
51036
|
-
|
|
51037
|
-
|
|
51038
|
-
|
|
51039
|
-
|
|
51110
|
+
const PII_REPLACEMENT = '*'.repeat(10);
|
|
51111
|
+
const JSON_PII_KEYS = ['password', 'email', 'key', 'token', 'auth', 'authentication', 'phone', 'address', 'ssn'];
|
|
51112
|
+
const UNABLE_TO_DISPLAY_BODY = '[Unable to display body: detected PII could not be redacted]';
|
|
51113
|
+
const joinedKeys = JSON_PII_KEYS.join('|');
|
|
51114
|
+
const keyPattern = `"([^"]*(?:${joinedKeys})[^"]*)"`;
|
|
51040
51115
|
// only scrub strings, numbers, and booleans
|
|
51041
|
-
|
|
51116
|
+
const acceptedValues = '("([^"\\\\]*(?:\\\\.[^"\\\\]*)*")|(\\d+)|(true|false))';
|
|
51042
51117
|
/**
|
|
51043
51118
|
* Truncates a string to the max length
|
|
51044
51119
|
* @access private
|
|
51045
51120
|
* @param {String} string
|
|
51046
51121
|
* @returns {String}
|
|
51047
51122
|
*/
|
|
51048
|
-
function truncate(string, includeEllipsis) {
|
|
51049
|
-
if (includeEllipsis === void 0) { includeEllipsis = false; }
|
|
51123
|
+
function truncate(string, includeEllipsis = false) {
|
|
51050
51124
|
if (string.length <= MAX_LENGTH)
|
|
51051
51125
|
return string;
|
|
51052
51126
|
if (includeEllipsis) {
|
|
@@ -51063,7 +51137,7 @@ function truncate(string, includeEllipsis) {
|
|
|
51063
51137
|
* @returns {String}
|
|
51064
51138
|
*/
|
|
51065
51139
|
function generateLogKey(methodName, message, stackTrace) {
|
|
51066
|
-
return
|
|
51140
|
+
return `${methodName}|${message}|${stackTrace}`;
|
|
51067
51141
|
}
|
|
51068
51142
|
/**
|
|
51069
51143
|
* Checks if a string has 2 or more digits, a https URL, or an email address
|
|
@@ -51080,13 +51154,12 @@ function mightContainPII(string) {
|
|
|
51080
51154
|
* @param {String} string
|
|
51081
51155
|
* @returns {String}
|
|
51082
51156
|
*/
|
|
51083
|
-
function scrubPII(
|
|
51084
|
-
var string = _a.string, _ = _a._;
|
|
51157
|
+
function scrubPII({ string, _ }) {
|
|
51085
51158
|
if (!string || typeof string !== 'string')
|
|
51086
51159
|
return string;
|
|
51087
51160
|
if (!mightContainPII(string))
|
|
51088
51161
|
return string;
|
|
51089
|
-
return _.reduce(_.values(PII_PATTERN),
|
|
51162
|
+
return _.reduce(_.values(PII_PATTERN), (str, pattern) => str.replace(pattern, PII_REPLACEMENT), string);
|
|
51090
51163
|
}
|
|
51091
51164
|
/**
|
|
51092
51165
|
* Scrub PII from a stringified JSON object
|
|
@@ -51095,14 +51168,12 @@ function scrubPII(_a) {
|
|
|
51095
51168
|
* @returns {String}
|
|
51096
51169
|
*/
|
|
51097
51170
|
function scrubJsonPII(string) {
|
|
51098
|
-
|
|
51171
|
+
const fullScrubRegex = new RegExp(`${keyPattern}\\s*:\\s*[\\{\\[]`, 'i');
|
|
51099
51172
|
if (fullScrubRegex.test(string)) {
|
|
51100
51173
|
return UNABLE_TO_DISPLAY_BODY;
|
|
51101
51174
|
}
|
|
51102
|
-
|
|
51103
|
-
return string.replace(keyValueScrubRegex,
|
|
51104
|
-
return "\"".concat(key, "\":\"").concat(PII_REPLACEMENT, "\"");
|
|
51105
|
-
});
|
|
51175
|
+
const keyValueScrubRegex = new RegExp(`${keyPattern}\\s*:\\s*${acceptedValues}`, 'gi');
|
|
51176
|
+
return string.replace(keyValueScrubRegex, (match, key) => `"${key}":"${PII_REPLACEMENT}"`);
|
|
51106
51177
|
}
|
|
51107
51178
|
/**
|
|
51108
51179
|
* Checks if a string is a JSON object
|
|
@@ -51114,7 +51185,7 @@ function scrubJsonPII(string) {
|
|
|
51114
51185
|
function mightContainJson(string, contentType) {
|
|
51115
51186
|
if (!string || typeof string !== 'string')
|
|
51116
51187
|
return false;
|
|
51117
|
-
|
|
51188
|
+
const firstChar = string.charAt(0);
|
|
51118
51189
|
if (contentType && contentType.indexOf('application/json') !== -1) {
|
|
51119
51190
|
return true;
|
|
51120
51191
|
}
|
|
@@ -51127,20 +51198,19 @@ function mightContainJson(string, contentType) {
|
|
|
51127
51198
|
* @param {String} contentType
|
|
51128
51199
|
* @returns {String}
|
|
51129
51200
|
*/
|
|
51130
|
-
function maskSensitiveFields(
|
|
51131
|
-
var string = _a.string, contentType = _a.contentType, _ = _a._;
|
|
51201
|
+
function maskSensitiveFields({ string, contentType, _ }) {
|
|
51132
51202
|
if (!string || typeof string !== 'string')
|
|
51133
51203
|
return string;
|
|
51134
51204
|
if (mightContainJson(string, contentType)) {
|
|
51135
51205
|
string = scrubJsonPII(string);
|
|
51136
51206
|
}
|
|
51137
51207
|
if (mightContainPII(string)) {
|
|
51138
|
-
string = scrubPII({ string
|
|
51208
|
+
string = scrubPII({ string, _ });
|
|
51139
51209
|
}
|
|
51140
51210
|
return string;
|
|
51141
51211
|
}
|
|
51142
51212
|
|
|
51143
|
-
|
|
51213
|
+
const DEV_LOG_TYPE = 'devlog';
|
|
51144
51214
|
function createDevLogEnvelope(pluginAPI, globalPendo) {
|
|
51145
51215
|
return {
|
|
51146
51216
|
browser_time: pluginAPI.util.getNow(),
|
|
@@ -51151,12 +51221,12 @@ function createDevLogEnvelope(pluginAPI, globalPendo) {
|
|
|
51151
51221
|
};
|
|
51152
51222
|
}
|
|
51153
51223
|
|
|
51154
|
-
|
|
51155
|
-
|
|
51156
|
-
|
|
51157
|
-
|
|
51158
|
-
|
|
51159
|
-
|
|
51224
|
+
const TOKEN_MAX_SIZE = 100;
|
|
51225
|
+
const TOKEN_REFILL_RATE = 10;
|
|
51226
|
+
const TOKEN_REFRESH_INTERVAL = 1000;
|
|
51227
|
+
const MAX_UNCOMPRESSED_SIZE = 125000; // 125KB
|
|
51228
|
+
class DevlogBuffer {
|
|
51229
|
+
constructor(pendo, pluginAPI) {
|
|
51160
51230
|
this.pendo = pendo;
|
|
51161
51231
|
this.pluginAPI = pluginAPI;
|
|
51162
51232
|
this.events = [];
|
|
@@ -51167,36 +51237,36 @@ var DevlogBuffer = /** @class */ (function () {
|
|
|
51167
51237
|
this.lastRefillTime = this.pluginAPI.util.getNow();
|
|
51168
51238
|
this.nextRefillTime = this.lastRefillTime + TOKEN_REFRESH_INTERVAL;
|
|
51169
51239
|
}
|
|
51170
|
-
|
|
51240
|
+
isEmpty() {
|
|
51171
51241
|
return this.events.length === 0 && this.payloads.length === 0;
|
|
51172
|
-
}
|
|
51173
|
-
|
|
51174
|
-
|
|
51242
|
+
}
|
|
51243
|
+
refillTokens() {
|
|
51244
|
+
const now = this.pluginAPI.util.getNow();
|
|
51175
51245
|
if (now >= this.nextRefillTime) {
|
|
51176
|
-
|
|
51177
|
-
|
|
51178
|
-
|
|
51246
|
+
const timeSinceLastRefill = now - this.lastRefillTime;
|
|
51247
|
+
const secondsSinceLastRefill = Math.floor(timeSinceLastRefill / TOKEN_REFRESH_INTERVAL);
|
|
51248
|
+
const tokensToRefill = secondsSinceLastRefill * TOKEN_REFILL_RATE;
|
|
51179
51249
|
this.tokens = Math.min(this.tokens + tokensToRefill, TOKEN_MAX_SIZE);
|
|
51180
51250
|
this.lastRefillTime = now;
|
|
51181
51251
|
this.nextRefillTime = now + TOKEN_REFRESH_INTERVAL;
|
|
51182
51252
|
}
|
|
51183
|
-
}
|
|
51184
|
-
|
|
51253
|
+
}
|
|
51254
|
+
clear() {
|
|
51185
51255
|
this.events = [];
|
|
51186
51256
|
this.lastEvent = null;
|
|
51187
51257
|
this.uncompressedSize = 0;
|
|
51188
|
-
}
|
|
51189
|
-
|
|
51258
|
+
}
|
|
51259
|
+
hasTokenAvailable() {
|
|
51190
51260
|
this.refillTokens();
|
|
51191
51261
|
return this.tokens > 0;
|
|
51192
|
-
}
|
|
51193
|
-
|
|
51262
|
+
}
|
|
51263
|
+
estimateEventSize(event) {
|
|
51194
51264
|
return JSON.stringify(event).length;
|
|
51195
|
-
}
|
|
51196
|
-
|
|
51265
|
+
}
|
|
51266
|
+
push(event) {
|
|
51197
51267
|
if (!this.hasTokenAvailable())
|
|
51198
51268
|
return false;
|
|
51199
|
-
|
|
51269
|
+
const eventSize = this.estimateEventSize(event);
|
|
51200
51270
|
if (this.uncompressedSize + eventSize > MAX_UNCOMPRESSED_SIZE) {
|
|
51201
51271
|
this.compressCurrentChunk();
|
|
51202
51272
|
}
|
|
@@ -51205,55 +51275,54 @@ var DevlogBuffer = /** @class */ (function () {
|
|
|
51205
51275
|
this.events.push(event);
|
|
51206
51276
|
this.tokens = Math.max(this.tokens - 1, 0);
|
|
51207
51277
|
return true;
|
|
51208
|
-
}
|
|
51209
|
-
|
|
51278
|
+
}
|
|
51279
|
+
compressCurrentChunk() {
|
|
51210
51280
|
if (this.events.length === 0)
|
|
51211
51281
|
return;
|
|
51212
|
-
|
|
51282
|
+
const jzb = this.pendo.compress(this.events);
|
|
51213
51283
|
this.payloads.push(jzb);
|
|
51214
51284
|
this.clear();
|
|
51215
|
-
}
|
|
51216
|
-
|
|
51217
|
-
|
|
51285
|
+
}
|
|
51286
|
+
generateUrl() {
|
|
51287
|
+
const queryParams = {
|
|
51218
51288
|
v: this.pendo.VERSION,
|
|
51219
51289
|
ct: this.pluginAPI.util.getNow()
|
|
51220
51290
|
};
|
|
51221
51291
|
return this.pluginAPI.transmit.buildBaseDataUrl(DEV_LOG_TYPE, this.pendo.apiKey, queryParams);
|
|
51222
|
-
}
|
|
51223
|
-
|
|
51292
|
+
}
|
|
51293
|
+
pack() {
|
|
51224
51294
|
if (this.isEmpty())
|
|
51225
51295
|
return;
|
|
51226
|
-
|
|
51296
|
+
const url = this.generateUrl();
|
|
51227
51297
|
this.compressCurrentChunk();
|
|
51228
|
-
|
|
51229
|
-
jzb
|
|
51230
|
-
url
|
|
51231
|
-
})
|
|
51298
|
+
const payloads = this.pendo._.map(this.payloads, (jzb) => ({
|
|
51299
|
+
jzb,
|
|
51300
|
+
url
|
|
51301
|
+
}));
|
|
51232
51302
|
this.payloads = [];
|
|
51233
51303
|
return payloads;
|
|
51234
|
-
}
|
|
51235
|
-
|
|
51236
|
-
}());
|
|
51304
|
+
}
|
|
51305
|
+
}
|
|
51237
51306
|
|
|
51238
|
-
|
|
51239
|
-
|
|
51307
|
+
class DevlogTransport {
|
|
51308
|
+
constructor(globalPendo, pluginAPI) {
|
|
51240
51309
|
this.pendo = globalPendo;
|
|
51241
51310
|
this.pluginAPI = pluginAPI;
|
|
51242
51311
|
}
|
|
51243
|
-
|
|
51244
|
-
|
|
51312
|
+
buildGetUrl(baseUrl, jzb) {
|
|
51313
|
+
const params = {};
|
|
51245
51314
|
if (this.pluginAPI.agent.treatAsAdoptPartner()) {
|
|
51246
51315
|
this.pluginAPI.agent.addAccountIdParams(params, this.pendo.get_account_id(), this.pluginAPI.ConfigReader.get('oemAccountId'));
|
|
51247
51316
|
}
|
|
51248
|
-
|
|
51317
|
+
const jwtOptions = this.pluginAPI.agent.getJwtInfoCopy();
|
|
51249
51318
|
if (!this.pendo._.isEmpty(jwtOptions)) {
|
|
51250
51319
|
this.pendo._.extend(params, jwtOptions);
|
|
51251
51320
|
}
|
|
51252
51321
|
params.jzb = jzb;
|
|
51253
|
-
|
|
51254
|
-
return
|
|
51255
|
-
}
|
|
51256
|
-
|
|
51322
|
+
const queryString = this.pendo._.map(params, (value, key) => `${key}=${value}`).join('&');
|
|
51323
|
+
return `${baseUrl}${baseUrl.indexOf('?') !== -1 ? '&' : '?'}${queryString}`;
|
|
51324
|
+
}
|
|
51325
|
+
get(url, options) {
|
|
51257
51326
|
options.method = 'GET';
|
|
51258
51327
|
if (this.pluginAPI.transmit.fetchKeepalive.supported()) {
|
|
51259
51328
|
return this.pluginAPI.transmit.fetchKeepalive(url, options);
|
|
@@ -51261,90 +51330,86 @@ var DevlogTransport = /** @class */ (function () {
|
|
|
51261
51330
|
else {
|
|
51262
51331
|
return this.pendo.ajax.get(url);
|
|
51263
51332
|
}
|
|
51264
|
-
}
|
|
51265
|
-
|
|
51266
|
-
|
|
51267
|
-
var getUrl = this.buildGetUrl(url, jzb);
|
|
51333
|
+
}
|
|
51334
|
+
sendRequestWithGet({ url, jzb }) {
|
|
51335
|
+
const getUrl = this.buildGetUrl(url, jzb);
|
|
51268
51336
|
return this.get(getUrl, {
|
|
51269
51337
|
headers: {
|
|
51270
51338
|
'Content-Type': 'application/octet-stream'
|
|
51271
51339
|
}
|
|
51272
51340
|
});
|
|
51273
|
-
}
|
|
51274
|
-
|
|
51341
|
+
}
|
|
51342
|
+
post(url, options) {
|
|
51275
51343
|
options.method = 'POST';
|
|
51276
51344
|
if (options.keepalive && this.pluginAPI.transmit.fetchKeepalive.supported()) {
|
|
51277
51345
|
return this.pluginAPI.transmit.fetchKeepalive(url, options);
|
|
51278
51346
|
}
|
|
51279
51347
|
else if (options.keepalive && this.pluginAPI.transmit.sendBeacon.supported()) {
|
|
51280
|
-
|
|
51348
|
+
const result = this.pluginAPI.transmit.sendBeacon(url, new Blob([options.body]));
|
|
51281
51349
|
return result ? Promise$2.resolve() : Promise$2.reject(new Error('sendBeacon failed to send devlog data'));
|
|
51282
51350
|
}
|
|
51283
51351
|
else {
|
|
51284
51352
|
return this.pendo.ajax.post(url, options.body);
|
|
51285
51353
|
}
|
|
51286
|
-
}
|
|
51287
|
-
|
|
51288
|
-
|
|
51289
|
-
|
|
51290
|
-
var bodyPayload = {
|
|
51354
|
+
}
|
|
51355
|
+
sendRequestWithPost({ url, jzb }, isUnload) {
|
|
51356
|
+
const jwtOptions = this.pluginAPI.agent.getJwtInfoCopy();
|
|
51357
|
+
const bodyPayload = {
|
|
51291
51358
|
events: jzb,
|
|
51292
51359
|
browser_time: this.pluginAPI.util.getNow()
|
|
51293
51360
|
};
|
|
51294
51361
|
if (this.pluginAPI.agent.treatAsAdoptPartner()) {
|
|
51295
51362
|
this.pluginAPI.agent.addAccountIdParams(bodyPayload, this.pendo.get_account_id(), this.pluginAPI.ConfigReader.get('oemAccountId'));
|
|
51296
51363
|
}
|
|
51297
|
-
|
|
51364
|
+
const body = JSON.stringify(this.pendo._.extend(bodyPayload, jwtOptions));
|
|
51298
51365
|
return this.post(url, {
|
|
51299
|
-
body
|
|
51366
|
+
body,
|
|
51300
51367
|
headers: {
|
|
51301
51368
|
'Content-Type': 'application/json'
|
|
51302
51369
|
},
|
|
51303
51370
|
keepalive: isUnload
|
|
51304
51371
|
});
|
|
51305
|
-
}
|
|
51306
|
-
|
|
51307
|
-
|
|
51308
|
-
var compressedLength = jzb.length;
|
|
51372
|
+
}
|
|
51373
|
+
sendRequest({ url, jzb }, isUnload) {
|
|
51374
|
+
const compressedLength = jzb.length;
|
|
51309
51375
|
if (compressedLength <= this.pluginAPI.constants.ENCODED_EVENT_MAX_LENGTH && !this.pluginAPI.ConfigReader.get('sendEventsWithPostOnly')) {
|
|
51310
|
-
return this.sendRequestWithGet({ url
|
|
51376
|
+
return this.sendRequestWithGet({ url, jzb });
|
|
51311
51377
|
}
|
|
51312
|
-
return this.sendRequestWithPost({ url
|
|
51313
|
-
}
|
|
51314
|
-
|
|
51315
|
-
}());
|
|
51378
|
+
return this.sendRequestWithPost({ url, jzb }, isUnload);
|
|
51379
|
+
}
|
|
51380
|
+
}
|
|
51316
51381
|
|
|
51317
51382
|
function ConsoleCapture() {
|
|
51318
|
-
|
|
51319
|
-
|
|
51320
|
-
|
|
51321
|
-
|
|
51322
|
-
|
|
51323
|
-
|
|
51324
|
-
|
|
51325
|
-
|
|
51326
|
-
|
|
51327
|
-
|
|
51328
|
-
|
|
51329
|
-
|
|
51383
|
+
let pluginAPI;
|
|
51384
|
+
let _;
|
|
51385
|
+
let globalPendo;
|
|
51386
|
+
let buffer;
|
|
51387
|
+
let sendQueue;
|
|
51388
|
+
let sendInterval;
|
|
51389
|
+
let transport;
|
|
51390
|
+
let isPtmPaused;
|
|
51391
|
+
let isCapturingConsoleLogs = false;
|
|
51392
|
+
const CAPTURE_CONSOLE_CONFIG = 'captureConsoleLogs';
|
|
51393
|
+
const CONSOLE_METHODS = ['log', 'warn', 'error', 'info'];
|
|
51394
|
+
const DEV_LOG_SUB_TYPE = 'console';
|
|
51330
51395
|
// deduplicate logs
|
|
51331
|
-
|
|
51396
|
+
let lastLogKey = '';
|
|
51332
51397
|
return {
|
|
51333
51398
|
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
|
|
51399
|
+
initialize,
|
|
51400
|
+
teardown,
|
|
51401
|
+
addIntercepts,
|
|
51402
|
+
createConsoleEvent,
|
|
51403
|
+
captureStackTrace,
|
|
51404
|
+
send,
|
|
51405
|
+
setCaptureState,
|
|
51406
|
+
recordingStarted,
|
|
51407
|
+
recordingStopped,
|
|
51408
|
+
onAppHidden,
|
|
51409
|
+
onAppUnloaded,
|
|
51410
|
+
onPtmPaused,
|
|
51411
|
+
onPtmUnpaused,
|
|
51412
|
+
securityPolicyViolationFn,
|
|
51348
51413
|
get isCapturingConsoleLogs() {
|
|
51349
51414
|
return isCapturingConsoleLogs;
|
|
51350
51415
|
},
|
|
@@ -51361,16 +51426,16 @@ function ConsoleCapture() {
|
|
|
51361
51426
|
function initialize(pendo, PluginAPI) {
|
|
51362
51427
|
_ = pendo._;
|
|
51363
51428
|
pluginAPI = PluginAPI;
|
|
51364
|
-
|
|
51429
|
+
const { ConfigReader } = pluginAPI;
|
|
51365
51430
|
ConfigReader.addOption(CAPTURE_CONSOLE_CONFIG, [ConfigReader.sources.PENDO_CONFIG_SRC], false);
|
|
51366
|
-
|
|
51431
|
+
const captureConsoleEnabled = ConfigReader.get(CAPTURE_CONSOLE_CONFIG);
|
|
51367
51432
|
if (!captureConsoleEnabled)
|
|
51368
51433
|
return;
|
|
51369
51434
|
globalPendo = pendo;
|
|
51370
51435
|
buffer = new DevlogBuffer(pendo, pluginAPI);
|
|
51371
51436
|
transport = new DevlogTransport(pendo, pluginAPI);
|
|
51372
51437
|
sendQueue = new pluginAPI.SendQueue(transport.sendRequest.bind(transport));
|
|
51373
|
-
sendInterval = setInterval(
|
|
51438
|
+
sendInterval = setInterval(() => {
|
|
51374
51439
|
if (!sendQueue.failed()) {
|
|
51375
51440
|
send();
|
|
51376
51441
|
}
|
|
@@ -51396,19 +51461,17 @@ function ConsoleCapture() {
|
|
|
51396
51461
|
function onPtmUnpaused() {
|
|
51397
51462
|
isPtmPaused = false;
|
|
51398
51463
|
if (!buffer.isEmpty()) {
|
|
51399
|
-
for (
|
|
51400
|
-
|
|
51401
|
-
pluginAPI.Events.eventCaptured.trigger(event_1);
|
|
51464
|
+
for (const event of buffer.events) {
|
|
51465
|
+
pluginAPI.Events.eventCaptured.trigger(event);
|
|
51402
51466
|
}
|
|
51403
51467
|
send();
|
|
51404
51468
|
}
|
|
51405
51469
|
}
|
|
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;
|
|
51470
|
+
function setCaptureState({ shouldCapture = false, reason = '' } = {}) {
|
|
51408
51471
|
if (shouldCapture === isCapturingConsoleLogs)
|
|
51409
51472
|
return;
|
|
51410
51473
|
isCapturingConsoleLogs = shouldCapture;
|
|
51411
|
-
pluginAPI.log.info(
|
|
51474
|
+
pluginAPI.log.info(`[ConsoleCapture] Console log capture ${shouldCapture ? 'started' : 'stopped'}${reason ? `: ${reason}` : ''}`);
|
|
51412
51475
|
}
|
|
51413
51476
|
function recordingStarted() {
|
|
51414
51477
|
setCaptureState({ shouldCapture: true, reason: 'recording started' });
|
|
@@ -51422,12 +51485,12 @@ function ConsoleCapture() {
|
|
|
51422
51485
|
}
|
|
51423
51486
|
function addIntercepts() {
|
|
51424
51487
|
_.each(CONSOLE_METHODS, function (methodName) {
|
|
51425
|
-
|
|
51488
|
+
const originalMethod = console[methodName];
|
|
51426
51489
|
if (!originalMethod)
|
|
51427
51490
|
return;
|
|
51428
51491
|
console[methodName] = _.wrap(originalMethod, function (originalFn) {
|
|
51429
51492
|
// slice 1 to omit originalFn
|
|
51430
|
-
|
|
51493
|
+
const args = _.toArray(arguments).slice(1);
|
|
51431
51494
|
originalFn.apply(console, args);
|
|
51432
51495
|
createConsoleEvent(args, methodName);
|
|
51433
51496
|
});
|
|
@@ -51439,10 +51502,10 @@ function ConsoleCapture() {
|
|
|
51439
51502
|
function securityPolicyViolationFn(evt) {
|
|
51440
51503
|
if (!evt || typeof evt !== 'object')
|
|
51441
51504
|
return;
|
|
51442
|
-
|
|
51443
|
-
|
|
51444
|
-
|
|
51445
|
-
|
|
51505
|
+
const { blockedURI, violatedDirective, effectiveDirective, disposition, originalPolicy } = evt;
|
|
51506
|
+
const directive = violatedDirective || effectiveDirective;
|
|
51507
|
+
const isReportOnly = disposition === 'report';
|
|
51508
|
+
const message = createCspViolationMessage(blockedURI, directive, isReportOnly, originalPolicy);
|
|
51446
51509
|
if (isReportOnly) {
|
|
51447
51510
|
createConsoleEvent([message], 'warn', { skipStackTrace: true, skipScrubPII: true });
|
|
51448
51511
|
}
|
|
@@ -51450,13 +51513,12 @@ function ConsoleCapture() {
|
|
|
51450
51513
|
createConsoleEvent([message], 'error', { skipStackTrace: true, skipScrubPII: true });
|
|
51451
51514
|
}
|
|
51452
51515
|
}
|
|
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;
|
|
51516
|
+
function createConsoleEvent(args, methodName, { skipStackTrace = false, skipScrubPII = false } = {}) {
|
|
51455
51517
|
if (!isCapturingConsoleLogs || !args || args.length === 0 || !_.contains(CONSOLE_METHODS, methodName))
|
|
51456
51518
|
return;
|
|
51457
51519
|
// stringify args
|
|
51458
|
-
|
|
51459
|
-
|
|
51520
|
+
let message = _.compact(_.map(args, arg => {
|
|
51521
|
+
let stringifiedArg;
|
|
51460
51522
|
try {
|
|
51461
51523
|
stringifiedArg = stringify(arg);
|
|
51462
51524
|
}
|
|
@@ -51468,22 +51530,22 @@ function ConsoleCapture() {
|
|
|
51468
51530
|
if (!message)
|
|
51469
51531
|
return;
|
|
51470
51532
|
// capture stack trace
|
|
51471
|
-
|
|
51533
|
+
let stackTrace = '';
|
|
51472
51534
|
if (!skipStackTrace) {
|
|
51473
|
-
|
|
51535
|
+
const maxStackFrames = methodName === 'error' ? 4 : 1;
|
|
51474
51536
|
stackTrace = captureStackTrace(maxStackFrames);
|
|
51475
51537
|
}
|
|
51476
51538
|
// truncate message and stack trace
|
|
51477
51539
|
message = truncate(message);
|
|
51478
51540
|
stackTrace = truncate(stackTrace);
|
|
51479
51541
|
// de-duplicate log
|
|
51480
|
-
|
|
51542
|
+
const logKey = generateLogKey(methodName, message, stackTrace);
|
|
51481
51543
|
if (isExistingDuplicateLog(logKey)) {
|
|
51482
51544
|
buffer.lastEvent.devLogCount++;
|
|
51483
51545
|
return;
|
|
51484
51546
|
}
|
|
51485
|
-
|
|
51486
|
-
|
|
51547
|
+
const devLogEnvelope = createDevLogEnvelope(pluginAPI, globalPendo);
|
|
51548
|
+
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
51549
|
if (!buffer.hasTokenAvailable())
|
|
51488
51550
|
return consoleEvent;
|
|
51489
51551
|
if (!isPtmPaused) {
|
|
@@ -51495,8 +51557,8 @@ function ConsoleCapture() {
|
|
|
51495
51557
|
}
|
|
51496
51558
|
function captureStackTrace(maxStackFrames) {
|
|
51497
51559
|
try {
|
|
51498
|
-
|
|
51499
|
-
return _.map(stackFrames,
|
|
51560
|
+
const stackFrames = ErrorStackParser.parse(new Error(), maxStackFrames);
|
|
51561
|
+
return _.map(stackFrames, frame => frame.toString()).join('\n');
|
|
51500
51562
|
}
|
|
51501
51563
|
catch (error) {
|
|
51502
51564
|
return '';
|
|
@@ -51508,22 +51570,21 @@ function ConsoleCapture() {
|
|
|
51508
51570
|
function updateLastLog(logKey) {
|
|
51509
51571
|
lastLogKey = logKey;
|
|
51510
51572
|
}
|
|
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;
|
|
51573
|
+
function send({ unload = false, hidden = false } = {}) {
|
|
51513
51574
|
if (!buffer || buffer.isEmpty())
|
|
51514
51575
|
return;
|
|
51515
51576
|
if (!globalPendo.isSendingEvents()) {
|
|
51516
51577
|
buffer.clear();
|
|
51517
51578
|
return;
|
|
51518
51579
|
}
|
|
51519
|
-
|
|
51580
|
+
const payloads = buffer.pack();
|
|
51520
51581
|
if (!payloads || payloads.length === 0)
|
|
51521
51582
|
return;
|
|
51522
51583
|
if (unload || hidden) {
|
|
51523
51584
|
sendQueue.drain(payloads, unload);
|
|
51524
51585
|
}
|
|
51525
51586
|
else {
|
|
51526
|
-
sendQueue.push
|
|
51587
|
+
sendQueue.push(...payloads);
|
|
51527
51588
|
}
|
|
51528
51589
|
}
|
|
51529
51590
|
function teardown() {
|
|
@@ -51547,7 +51608,7 @@ function ConsoleCapture() {
|
|
|
51547
51608
|
_.each(CONSOLE_METHODS, function (methodName) {
|
|
51548
51609
|
if (!console[methodName])
|
|
51549
51610
|
return _.noop;
|
|
51550
|
-
|
|
51611
|
+
const unwrap = console[methodName]._pendoUnwrap;
|
|
51551
51612
|
if (_.isFunction(unwrap)) {
|
|
51552
51613
|
unwrap();
|
|
51553
51614
|
}
|