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

@ballerine/web-sdk

v1.3.2

Published

Ballerine is an open-source infrastructure for user identity and risk management. Compose verification processes for any vertical and geography using modular building blocks, components, and 3rd party integrations.

Downloads

111

Readme

Web SDK Flows

Description

Web SDK Flows can generate custom made, branded flows to collect KYC/KYB documents and user information. The SDK UI is embeddable inside exsiting apps or deployed as an webapp.

Why you should use Ballerine's flows:

  • Pre-made KYC/KYB templates.
  • Customizable UI and flow to fit your desired experience and brand.
  • Ability to use different vendors in the backend over the same flow with.
  • Multi platform support (Desktop, mobile web, mobile native).
  • All camera and different devices edge cases covered and tested.
  • Small and fast, built with Svelte (less than 50kb gzipped).

Live examples: KYC 1, KYC 2, KYB

Demo project: View in jsfiddle



Getting Started

Installation

CDN:

Add this code to your index.html header

<script
  async
  src="https://cdn.ballerine.io/1.1.22/ballerine-sdk.umd.min.js"
  integrity="sha384-cHxaE8mk7COVrdyKoDw4cdPC6PLoMItItHZ+LwA18bDaiWJLxV2f2zyVf6Q9Vtww"
  crossorigin="anonymous"
  type="module"
></script>

Package Managers:

# NPM
npm install --save @ballerine/web-sdk
# Yarn
yarn add @ballerine/web-sdk
# PNPM
pnpm add @ballerine/web-sdk

Flows API

| Config Parameter | Type | Description| | - | - | - | | uiConfig | FlowsUIConfig |Initilazing flows, preloading needed assets and ui packs| | endUserInfo | EndUserInfo| Use data like ID, name etc.. | | backendConfig | FlowsBackendConfig |Backend endpoint the flows should interact with| | translations | FlowsTranslations | Change the config after init function|

Embedded Flows

CDN: Add this code to your index.html header

// 1. Add script (see installtion)
// 2. Initialize SDK & flows (see configuration)
BallerineSDK.flows.init({...}).then(() => {
	console.log('flows ready');
	// 3. Mount selected flow on an element
	BallerineSDK.flows.mount('my-kyc-flow', 'flow-host-element', {});
});
// 4. Listen to finish event (see events)
BallerineSDK.flows.on('finish', doSomethingFn)

example folder

Package Manager:

import { flows as ballerineFlows } from '@ballerine/web-sdk';

await ballerineFlows.init({...}).then(() => console.log('flows ready'));
// 3. Mount selected flow on an element
ballerineFlows.mount('my-kyc-flow', 'flow-host-element', {});
// 4. Listen to finish event (see events)
ballerineFlows.on('finish', doSomethingFn)

example folder

Standalone/Iframe Flows

Code example:

<script
  src="https://cdn.ballerine.io/1.1.22/ballerine-sdk.umd.min.js"
  integrity="sha384-cHxaE8mk7COVrdyKoDw4cdPC6PLoMItItHZ+LwA18bDaiWJLxV2f2zyVf6Q9Vtww"
  crossorigin="anonymous"
  type="module"
></script>
<script>
	const initConfig = {
		"flows": { "my-kyc-flow": {
		    "steps": [
			{"name": "welcome", "id": "welcome" },
			{ "name": "document-selection", "id": "document-selection",
			    "documentOptions": ["id_card", "drivers_license", "passport"]},
			{ "name": "document-photo", "id": "identity-document-shot" },
			{ "name": "check-document", "id": "identity-document-user-check" },
			{ "name": "document-photo-back-start", "id": "document-photo-back-start"},
			{ "name": "selfie", "id": "selfie"},
			{ "name": "check-selfie", "id": "check-selfie" },
			{ "name": "loading", "id": "custom-loader" }
		    ]}
		}
	}
	BallerineSDK.flows.init(initConfig).then(() => {
		BallerineSDK.flows.mount('my-kyc-flow', 'flow-host-element', {});
	});	
}
</script>

Native Mobile apps

The approch to native apps are all the native funcationalties happens inside Ballerine native sdks (Android, iOS) while and the represenation layer is still an web app (inside a native webview).

This way we can enjoy both worlds:

  • Web UI: Flexable UI that can be changes instantly from the server (no app deployments or store submissions).
  • Native API's: Native camera, deep behavioral analysis, ekyc and more..

See Android and iOS repositories for guidance:

Android SDK | iOS SDK


Customization

Customize the UI, the flow's steps and the backend.

Flows Configuration

Flow Initilzation:

BallerineSDK.flows.init([CONFIG])

| Config Parameter | Type | Description| | - | - | - | | uiConfig | FlowsUIConfig |Initilazing flows, preloading needed assets and ui packs| | endUserInfo | EndUserInfo| Use data like ID, name etc.. | | backendConfig | FlowsBackendConfig |Backend endpoint the flows should interact with| | translations | FlowsTranslations | Change the config after init function|

Running a flow:

BallerineSDK.flows.mount('my-flow', elementId, [CONFIG]);
// or
BallerineSDK.flows.openModal('my-flow', [CONFIG]);

| Config Parameter | Type | Description| | - | - | - | | callbacks | FlowsCallbacksConfig |An object contaning callback methods (see below)|

FlowsCallbacksConfig:

| Config Parameter | Type | Description| | - | - | - | | onFlowComplete | IFlowCompletePayload |User completed the flow| | onFlowExit | IFlowExitPayload |User quits the flow (back button on the first page or pressed close buttons)| | onFlowError | IFlowErrorPayload |Unexpected errors| | onFlowNavigationUpdate | IFlowNavigationUpdatePayload |User moved between steps|


UI Configuration

Flows UI can be configured in three levels:

  1. Theme and theme styles

| Config Parameter | Type | Description| | - | - | - | | uiPack | string - Name or URL |Ui Pack is a complete bundles of styles, assets and translations| | theme.general | FlowsGeneralTheme |General colors, paddings, fonts..|

  1. General components styles (overrides theme)

| Config Parameter | Type | Description| | - | - | - | | theme.layout | FlowsGeneralTheme |Global layout css | theme.paragraph | FlowsGeneralTheme |Global paragraph css | theme.button | FlowsGeneralTheme |Global button css ... See more

  1. Speceifc step component style (overrides theme & general component style)

| Config Parameter | Type | Description| | - | - | - | | theme.flows['FlowName'].step | ICSSProperties | Step inculdes style object and styles for each element ... See more

As the level is lower it will overide the upper ones


Translations

| Config Parameter | Type | Description| | - | - | - | | remoteUrl | string (URL) | Get a full translation json from remote url | overrides | Record<string, string> |Overide default translations or remote translations


Backend Configuration

| Config Parameter | Type | Description| | - | - | - | | baseUrl | string (URL) | Backend base URL | auth | BEAuthConfig | Auth method and Autorization header | endpoints | BEEndpoints | List of endpoints for each action