Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ballerine/web-sdk

Package Overview
Dependencies
Maintainers
3
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ballerine/web-sdk

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.

  • 1.3.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
39
increased by95%
Maintainers
3
Weekly downloads
 
Created
Source

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


Some examples of what you can do with it - Create a custom flow you can use with any identity verification vendor. - Create a custom flow that your customers can receive in an SMS. - Create different types of flows for different types of customers. - And more...

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 ParameterTypeDescription
uiConfigFlowsUIConfigInitilazing flows, preloading needed assets and ui packs
endUserInfoEndUserInfoUse data like ID, name etc..
backendConfigFlowsBackendConfigBackend endpoint the flows should interact with
translationsFlowsTranslationsChange 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 ParameterTypeDescription
uiConfigFlowsUIConfigInitilazing flows, preloading needed assets and ui packs
endUserInfoEndUserInfoUse data like ID, name etc..
backendConfigFlowsBackendConfigBackend endpoint the flows should interact with
translationsFlowsTranslationsChange the config after init function

Running a flow:

BallerineSDK.flows.mount('my-flow', elementId, [CONFIG]);
// or
BallerineSDK.flows.openModal('my-flow', [CONFIG]);
Config ParameterTypeDescription
callbacksFlowsCallbacksConfigAn object contaning callback methods (see below)
FlowsCallbacksConfig:
Config ParameterTypeDescription
onFlowCompleteIFlowCompletePayloadUser completed the flow
onFlowExitIFlowExitPayloadUser quits the flow (back button on the first page or pressed close buttons)
onFlowErrorIFlowErrorPayloadUnexpected errors
onFlowNavigationUpdateIFlowNavigationUpdatePayloadUser moved between steps

UI Configuration

Flows UI can be configured in three levels:

  1. Theme and theme styles
Config ParameterTypeDescription
uiPackstring - Name or URLUi Pack is a complete bundles of styles, assets and translations
theme.generalFlowsGeneralThemeGeneral colors, paddings, fonts..
  1. General components styles (overrides theme)
Config ParameterTypeDescription
theme.layoutFlowsGeneralThemeGlobal layout css
theme.paragraphFlowsGeneralThemeGlobal paragraph css
theme.buttonFlowsGeneralThemeGlobal button css
... See more
  1. Speceifc step component style (overrides theme & general component style)
Config ParameterTypeDescription
theme.flows['FlowName'].stepICSSPropertiesStep inculdes style object and styles for each element
... See more

As the level is lower it will overide the upper ones


Translations
Config ParameterTypeDescription
remoteUrlstring (URL)Get a full translation json from remote url
overridesRecord<string, string>Overide default translations or remote translations

Backend Configuration
Config ParameterTypeDescription
baseUrlstring (URL)Backend base URL
authBEAuthConfigAuth method and Autorization header
endpointsBEEndpointsList of endpoints for each action

Keywords

FAQs

Package last updated on 10 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc