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

@veriff/incontext-sdk

v2.3.1

Published

In-Context Veriff browser integration

Downloads

105,570

Readme

Installation

npm install @veriff/incontext-sdk

Usage

Before initializing the InContext SDK, you need a valid Veriff session URL. To create a session URL, you can use our JS SDK or our API.

// ES6
import { createVeriffFrame } from '@veriff/incontext-sdk';

// CommonJS
const { createVeriffFrame } = require('@veriff/incontext-sdk');

const veriffFrame = createVeriffFrame({ url: 'SESSION_URL' });

This will render an iframe with a modal that contains Veriff application.

Exposed types

import { EmbeddedOptions, MESSAGES, VeriffFrameOptions } from '@veriff/incontext-sdk';

Listening for events

Pass the onEvent callback function when initializing SDK

import { createVeriffFrame, MESSAGES } from '@veriff/incontext-sdk';

createVeriffFrame({
  url: 'SESSION_URL',
  onEvent: function (msg: MESSAGES) {
    switch (msg) {
      case MESSAGES.STARTED:
        console.log('Verification started');
        break;
      case MESSAGES.SUBMITTED:
        console.log('Verification submitted');
        break;
      case MESSAGES.FINISHED:
        console.log('Verification finished');
        break;
      case MESSAGES.CANCELED:
        console.log('Verification closed');
        break;
      case MESSAGES.RELOAD_REQUEST:
        console.log('Verification reloaded');
        break;
    }
  },
});

Using with inline script

Include a script tag:

<script src="https://cdn.veriff.me/incontext/js/v2.3.1/veriff.js"></script>
window.veriffSDK.createVeriffFrame({ url: 'session url' });

Embedded mode

Before using embedded mode, make sure the incontext_sdk_embedded_allowed feature flag is enabled for your account.

The embedded mode allows you to inject the Veriff flow to a specific part of your website, without a modal. To enable embedded mode, set the embedded option to true.

Note about dimensions

  • Minimum 600x680 width/height
  • Optimal 800x800 width/height

The flow will render regardless of the dimensions, but the user experience might be affected.

Example

const veriffFrame = createVeriffFrame({
  url: 'SESSION_URL',
  embedded: true,
  embeddedOptions: {
    // Specifies the parent DOM element of Veriff’s iframe, using its ID attribute
    rootElementID: 'embedded-container',
  },
});
<div
  style={{ width: '635px', height: '670px', border: '1px solid #ccc' }}
  id="embedded-container"
/>

API

createVeriffFrame([options])

Create modal with Veriff application.

  • [options] - Configuration object (only url is required)

    • url - Veriff session URL
    • lang - Set user interface language ISO 639-1 (https://www.veriff.com/supported-languages)
    • onEvent - Event callback function
    • onReload - Reload request callback. This event can be called when Veriff detects that user has denied camera access and to re-request camera access parent window should be reloaded
    • embedded - Set to true if you want to use embedded mode (see Embedded mode)
    • embeddedOptions - Embedded mode options
      • rootElementID - Specifies the parent DOM element of Veriff’s iframe, using its ID attribute

Returns an object that controls the modal.

.close()

Close Veriff modal. Normally modal will be closed due to user input, but if you want to control it(e.g. timeout), please use this function.

onReload

This is an edge case for Safari iOS to re-request camera permissions

Example:

const url = sessionStorage.getItem('@veriff-session-url') || getSessionUrl();

veriffSDK.createVeriffFrame({
  url,
  onReload: () => {
    // Logic to re-open Veriff SDK after page reload
    // e.g. sessionStorage.setItem('@veriff-session-url', 'session url');
    window.location.reload();
  },
});