Git Product home page Git Product logo

crossframe-pendo's Introduction

crossframe-pendo

NOTICE: This code is now obsolete. The latest Pendo agent natively supports guides with steps targeting elements across multiple iframes. This library should no longer be used, and should be removed from any installations using the latest Pendo agent as it now causes conflicts.

This library works alongside the standard Pendo client library to add support for walkthroughs that need to display guides in multiple iframes.

The minified build is just 13KB, and requires very little configuration, so it should be easy to get it added to your project!

Installation

The simplest way to get crossframe-pendo is with Bower. Just run bower install crossframe-pendo to add it to your project. Be sure to include the script on all pages of your application, across all iframes. Any configuration of iframes should be supported (parent-child, deeply nested, siblings with shared parent, etc.), so long as crossframe-pendo is initialized in every window.

Configuration

Initialization

The crossframe-pendo module will be accessible via window.crossframePendo. Use the initialize() method to have it bootstrap itself. Do this in each iframe, and you'll be ready to go!

The initialize() method returns a promise, which will resolve once the Pendo client library loads and crossframe-pendo has completed setup.

Options

You may optionally supply a configuration object when initializing crossframe-pendo, with one or more of the following options:

errorCallback

This function will be executed when crossframe-pendo is unable to launch or advance a guide in any available iframe. An error object will be passed in as the first argument.

Example:

window.crossframePendo.initialize({
  errorCallback: function (error) {
  	// handle error
  }
});

The error object will have an errorType property of either "GUIDE.LAUNCH" or "STEP.ADVANCE", as well as guideId and stepId properties, as appropriate for the error type.

stepAdvanceCallback

This function will be executed after the user advances each step in any walkthrough. The Pendo step object corresponding to the just-advanced guide will be passed in as the first argument.

Example:

window.crossframePendo.initialize({
  stepAdvanceCallback: function (step) {
    var guide = step.getGuide();
    // the world's your oyster...
  }
});

timeout

The amount of time, in milliseconds, that crossframe-pendo should wait before assuming that attempts to advance a guide in another window has failed, at which point the errorCallback will be executed. Defaults to 10000 (10 seconds) unless overridden in your configuration.

Example:

window.crossframePendo.initialize({
  timeout: 5000
});

Asynchronous Guide Lookup

Included in crossframe-pendo are some useful helper functions which allow for looking up Pendo guides asynchronously. Each of these functions return a promise, greatly simplifying the process of programmatically acccessing Pendo guides when the load state of the client library cannot be guaranteed.

findGuideById

window.crossframePendo.findGuideById("24601").then(function (guide) {
  // here's your guide
});

findGuideByName

window.crossframePendo.findGuideByName("Jean Valjean").then(function (guide) {
  // here's your guide
});

getGuides

window.crossframePendo.getGuides().then(function (guides) {
  // here's an array of all available guides
});

reloadGuides

window.crossframePendo.reloadGuides()
.then(function () {
  return window.crossframePendo.findGuideById("1234");
})
.then(function (guide) {
  // here's your guide (freshness guaranteed!)
});

Contributing

Pull requests are welcome! Just clone the repo and use npm install to get all the devDependencies. All the source files are in /src. Running grunt will build everything to /dist, and will continue to monitor for changes to automatically update the build as you work.

crossframe-pendo's People

Contributors

inindevevangelists avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.