How to make use of a pendo function in Angular 12+

633 Views Asked by At

I have a guide setup in pendo, but I need to include a function that will continue the guide when the user clicks on a different element than the target pendo element.

I found this function:

module.exports = (function wireGuideAdvance(dom, step) {
if (!step) return;
var nextStep = guide.steps[guide.getPositionOfStep(step)];

var advanceOnce = pendo._.once(pendo.onGuideAdvanced);

function checkForElementAndAdvance(e) {
    var checkForNextElement = setInterval(function () {
        if (dom(nextStep.elementPathRule).length) {
            advanceOnce();
            clearInterval(checkForNextElement);
        }
    }, 1000);
}

pendo.attachEvent(document, 'click', checkForElementAndAdvance);

// step wrappable method to clear all event listeners
step.after('teardown', function () {
    pendo.detachEvent(document, 'click', checkForElementAndAdvance);
});

})(pendo.dom, step);

but I do not know how to use this within the Angular app.

0

There are 0 best solutions below