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

data-fornix-web-dc

v0.0.8

Published

Data Fornix Web Document Capture

Downloads

11

Readme

Data-Fornix-Web Document Capture SDK

Overview

This SDK provides a set of components for JavaScript applications to allow capturing of identity documents (by file upload or capture by camera) for the purpose of identity verification. The SDK offers a number of benefits to help you create the best onboarding / identity verification experience for your customers:

  • Configurable UI to help you to set SDK looks according your current app theme
  • Carefully designed UI to guide your customers through the entire photo-capturing process
  • Direct image upload to the DataFornix service, to simplify integration*

Note: the SDK is only responsible for capturing photos. You still need to access the DataFornix API to manage applicants and checks.

Users will be prompted to upload a file containing an image of their document. On handheld devices they can also use the native camera to take a photo of their document.

Getting started

1. Obtaining an SDK token

In order to start integration, you will need the SDK token.

2. Including/Importing the library

2.1 HTML Script Tag Include

Include it as a regular script tag on your page:

<script src='dist/data-fornix-web-dc.js'></script>

2.2 NPM style import

You can also import it as a module into your own JS build system (tested with Webpack).

$ npm install --save data-fornix-web-dc
// ES6 module import
import DataFornixDC from 'data-fornix-web-dc'

// commonjs style require
var DataFornixDC = require('data-fornix-web-dc')

Notice

The library is Browser only, it does not support the Node Context.

3. Adding basic HTML markup

There is only one element required in your HTML, an empty element for the modal interface to mount itself on:

<!-- At the bottom of your page, you need an empty element where the
verification component will be mounted. -->
<div id='data-fornix'></div>

4. Initialising the SDK

You are now ready to initialise the SDK:

// Create instance of DataFornix Document Capture SDK
// and store it in `dataFornixWeb` for future use
const dataFornixWeb = new DataFornixDC({
    // the SDK token
    token: 'YOUR_SDK_TOKEN',
    // id of the element you want to mount the component on
    containerId: 'data-fornix',
    onComplete: function (data) {
        // onComplete function that return you uploaded documents
        // you can get uploaded documents in `data.frontFile`
        // and `data.backFile` if capturing document back
    }
});

Congratulations! You have successfully started the flow. Carry on reading the next sections to learn how to:

  • Handle callbacks
  • Remove SDK previous state (if using single page application)
  • Customise the SDK UI and use other usefull configuration

Handling callbacks

  • onComplete {Function}

    onComplete callback that fires when the document successfully been uploaded. At this point you can use DataFornix API SDK to capture data from documents. DataFornix API SDK. The onComplete returns uploaded documents object. The data will be formatted as follow:
    {frontFile: FILE_OBJECT, backFile: FILE_OBJECT}.

    Here is an onComplete example:

    const dataFornixWeb = new DataFornixDC({
      token: 'YOUR_SDK_TOKEN',
      containerId: 'data-fornix',
      onComplete: documentCaptureCallback
    });
    
    function documentCaptureCallback(data) {
      const capturedDocument = {
          'front_image': data.frontFile,
          'back_image': data.backFile
      };
    }

Removing SDK

If you are embedding the SDK inside a single page app, you can call the clearState function to remove the SDK complelety from the current webpage. It will reset state and you can safely re-initialise the SDK inside the same webpage later on.

const dataFornixWeb = new DataFornixDC({...})
...
dataFornixWeb.clearState()

Customising SDK

A number of options are available to allow you to customise the SDK UI:

  • token {String} required

    A SDK Token is required in order to authorise. If one isn’t present, an exception will be thrown.

  • containerId {String} optional

    A string of the ID of the container element that the UI will mount to. This needs to be an empty element. The default ID is root.

  • documentBackCapture {Boolean} optional

    Provide option to upload document both side (front and back) upload. The default ID is false.

  • baseUrl {String} optional

    Server baseUrl which is use by sdk from internal api call. If not pass then sdk will use default url that set in sdk config.

  • uiOptions {Object} optional You can updated UI of SDK according your current app theme. It has following options:-

Name | Type | Default | Description | --- | --- | --- | --- | isDraggabel | Boolean | true | Show file drag/drop option | dragAreaWidth | Number | 160 | Set drag area width dragAreaHight | Number | 125 | Set drag area hight documentPreview | Boolean | true | Show document preview in drag area useCamera | Boolean | true | Show option for capture image using native camera firstInputTitle | String | Front of Document | Set title of first input firstInputPlaceholder | String | Drag file here.. | Set placehoder for first input secondInputTitle | String | Back of Document | Set title of second input secondInputPlaceholder | String | Drag file here.. | Set placehoder for second input borderColor | String | #949494 | Set border color | fontSize | String | inherit | Set font size | fontFamily | String | inherit | Set font family | fontColor | String | inherit | Set font color | backgroundColor | String | transparent | Set background color |

Example to use uiOptions

const dataFornixWeb = new DataFornixDC({
   token: 'YOUR_SDK_TOKEN',
   containerId: 'data-fornix',
   onComplete: documentCaptureCallback,
   uiOptions: {
       // drag options
       isDraggabel: true,
       dragAreaHight: 125,
       dragAreaWidth: 250,
       documentPreview: true,

       //input options
       firstInputTitle: 'Front of Licence',
       firstInputPlaceholder: 'Drag front of licence..',
       secondInputTitle: 'Back of Licence',
       secondInputPlaceholder: 'Drag back of licence..',

       //UI options
       borderColor: '#ccc',
       fontSize: 14,
       fontFamily: 'Raleway',
       buttonPrimaryColor: '#4CAF50',
       fontColor: '#333'
   }
 });

More information

Browser compatibility

Chrome | Firefox | IE | Safari --- | --- | --- | --- | Latest ✔ | Latest ✔ | 11+ ✔ | Latest ✔ |

Support

Please open an issue through GitHub. Please be as detailed as you can. Remember not to submit your token in the issue. Also check the closed issues to check whether it has been previously raised and answered.

Previous version of the SDK will be supported for a month after a new major version release. Note that when the support period has expired for an SDK version, no bug fixes will be provided, but the SDK will keep functioning (until further notice).

How is the DataFornix Document Capture SDK licensed?

The DataFornix Document Capture SDK are available under the MIT license.