1.5.6 • Published 3 days ago

@ballerine/web-ui-sdk v1.5.6

Weekly downloads
-
License
-
Repository
github
Last release
3 days ago

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 existing 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-ui-sdk
# Yarn
yarn add @ballerine/web-ui-sdk
# PNPM
pnpm add @ballerine/web-ui-sdk

Flows API

Config ParameterTypeDescription
uiConfigFlowsUIConfigInitializing 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 installation)
// 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-ui-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 approach to native apps are all the native functionalities happens inside Ballerine native sdks (Android, iOS) while and the representation layer is still an web app (inside a native webview).

This way we can enjoy both worlds:

  • Web UI: Flexible 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 Initialization:

BallerineSDK.flows.init([CONFIG])
Config ParameterTypeDescription
uiConfigFlowsUIConfigInitializing 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 containing 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. Specific step component style (overrides theme & general component style)
Config ParameterTypeDescription
theme.flows['FlowName'].stepICSSPropertiesStep includes style object and styles for each element

... See more

As the level is lower it will override the upper ones


Translations

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

Backend Configuration

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

1.5.6

3 days ago

1.5.5

17 days ago

1.5.4

21 days ago

1.5.3

24 days ago

1.5.1-11210907c.0

2 months ago

1.5.2

2 months ago

1.5.0

2 months ago

1.4.47

2 months ago

1.4.46

2 months ago

1.4.45

2 months ago

1.4.44

2 months ago

1.4.42

2 months ago

1.4.43

2 months ago

1.4.40

2 months ago

1.4.41

2 months ago

1.4.39

3 months ago

1.4.38

3 months ago

1.4.37

3 months ago

1.4.36

3 months ago

1.4.33

5 months ago

1.4.34

5 months ago

1.4.32

5 months ago

1.4.31

5 months ago

1.4.30

5 months ago

1.4.20

6 months ago

1.4.22

5 months ago

1.4.21

5 months ago

1.4.24

5 months ago

1.4.23

5 months ago

1.4.26

5 months ago

1.4.25

5 months ago

1.4.27

5 months ago

1.4.6

7 months ago

1.4.5

8 months ago

1.4.4

8 months ago

1.4.3

8 months ago

1.4.2

8 months ago

1.4.1

8 months ago

1.4.0

8 months ago

1.3.10

10 months ago

1.3.13

9 months ago

1.3.14

9 months ago

1.3.11

10 months ago

1.3.12

9 months ago

1.3.18

9 months ago

1.3.15

9 months ago

1.4.13-3e08f108.0

6 months ago

1.3.19

9 months ago

1.3.20

9 months ago

1.3.21

9 months ago

1.3.9

10 months ago

1.3.8

10 months ago

1.3.7

10 months ago

1.3.6

10 months ago

1.3.5

10 months ago

1.4.10-3e08f108.1

7 months ago

1.4.10-3e08f108.0

7 months ago

1.4.10-3e08f108.7

7 months ago

1.4.10-3e08f108.6

7 months ago

1.4.10-3e08f108.9

7 months ago

1.4.10-3e08f108.8

7 months ago

1.4.10-3e08f108.3

7 months ago

1.4.10-3e08f108.2

7 months ago

1.4.10-3e08f108.5

7 months ago

1.4.10-3e08f108.4

7 months ago

1.4.9

7 months ago

1.4.11

7 months ago

1.4.8

7 months ago

1.4.7

7 months ago

1.4.13

6 months ago

1.4.12

7 months ago

1.4.14

6 months ago

1.4.17

6 months ago

1.4.16

6 months ago

1.4.19

6 months ago

1.4.18

6 months ago

1.3.4

11 months ago

1.3.3

11 months ago

1.3.2

12 months ago