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