npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@blueink360/blueink-embed-js

v1.2.2

Published

Embedded eSignatures with BlueInk

Downloads

27

Readme

BlueInk Embed JS Library

A Javascript library to create embedded signing sessions with the BlueInk API.

Installation

From NPM:

npm install @blueink360/blueink-embed-js

Or if you prefer yarn:

yarn add @blueink360/blueink-embed-js

From CDN:

<script src="https://cdn.jsdelivr.net/npm/@blueink360/blueink-embed-js/dist/blueink-embed.min.js"></script>

If including this library directly with a script tag, the BlueInkEmbed class will be added to the global namespace.

Usage

To use the library, you will need a public API key from your BlueInk account. If you do not have a BlueInk account, you can create one here. You can send unlimited test Bundles for free while developing your eSignature integration.

Quickstart

import BlueInkEmbed from 'blueink-embed-js';
const embedUrl = 'EMBED-URL-RETURNED-BY-THE-SERVER';
const embed = new BlueInkEmbed('YOUR-PUBLIC-API-KEY');

// Mount the embedded signing iFrame in a div with ID 'iframe-container'
embed.mount(embedUrl, '#iframe-container');

// Optionally, unmount the signing iFrame when done
embed.unmount();

Fuller Example, with Error and Event Handling

This example shows fetching the embedUrl from the server via axios, and handling errors.

import BlueInkEmbed from 'blueink-embed-js';

const exampleRequestData = {
    signerName: 'Frank Ricard',
    signerEmail: '[email protected]'
};

// This assumes that your server-side App can receive requests
// at /get-embed-url and will create a new Bundle and return
// an embedded signing URL. See the BlueInk API docs for examples.

axios.post('/get-embed-url', exampleRequestData)
    .then(response => {
        try {
            const embedUrl = response.data.embedUrl;
            const embed = new BlueInkEmbed('YOUR-BLUEINK-PUBLIC-API-KEY');
            
            // Setup event listeners to respond to events emitted
            // by the embedded signing iFrame
            embed.on(BlueInkEmbed.EVENT.COMPLETE, () => {
                console.log('signing complete!');
            });

            embed.on(BlueInkEmbed.EVENT.ERROR, (eventData) => {
                console.log('Signing error occurred.');
                console.log(eventData.message);
            });

            embed.mount(embedUrl, '#iframe-container');
        } catch(error) {
            // An error could be thrown if the public API key is invalid, 
            // or if no element was found with id 'iframe-container' 
            console.log(error.message);
        }
    })
    .catch(error => {
        // This catch block would handle if the /get-embed-url
        // request returned a 5XX or 4XX error.
        const message = error.response.data.error || error.message;
        console.log(message);
    });

More Resources

Getting Help / Contributing

If you have a BlueInk Account and need help integrating this library into your API project, please contact our support team from your BlueInk account dashboard.

If you find issues in this codebase, or have any suggestions for improvement please create an issue here on github.

We welcome contributions and will consider any pull requests.

If you are making modifications to the library, or running the project, locally the following commands should come in handy. We use yarn internally, but all of the commands below should work with there npm equivalents.

# Run the tests
$ yarn test
$ yarn test:coverage

# Build a production, minified version of the library
$ yarn run build

# Build a development, unminified version of the library
$ yarn run build:dev

# Run webpack-dev-server, so that the library will be accessible
# at http://localhost:8080/blueink-embed.js
$ yarn run devserver
 
# Build the docs
$ yarn run build:docs

License

MIT