JavaScript UI SDK¶
The UI SDK includes a complete graphical interface for seamless integration with end users.
Installation¶
We use Cloudsmith as our private package registry.
NPM¶
npm install \
--registry=https://npm.cloudsmith.io/biometrid/web/ \
'@biometrid/full-web-sdk@3.X.X'
HTML Script Tag¶
<!-- Add all SDK files to the same folder -->
<script src="./sdk/index.js"></script>
Getting Started¶
import "@biometrid/full-web-sdk";
const biometridFull = await BiometridFull.initialize({
// One of the following is required:
container: document.getElementById("app"), // optional if containerId is provided
containerId: "app", // optional if container is provided
// Required parameters:
url: "https://api.biometrid.com",
credential: "your-credential-uuid",
app: "your-application-uuid",
// Optional:
appUrl: "https://app.biometrid.com",
sentry: "",
gtm: "",
language: {
default: "pt-PT", // default: 'en-GB'
i18n: {
"pt-PT": {
welcome: {
title: "PT Title",
description: "PT Description",
button: "PT Button",
},
},
"en-GB": {
welcome: {
title: "EN Title",
description: "EN Description",
button: "EN Button",
},
},
},
},
customHeaders: {},
device: {
source: "browser", // browser || ios || android
},
deviceType: "desktop", // desktop || mobile
enablePageTitle: false,
hybridDeviceAsMobile: false,
phone: "+351930000000",
customization: {},
rootFolder: "./",
ignoreBrowserVersion: false,
hideSidebarMobile: false,
autocapture: {
forceLandscape: true,
overlay: true,
documentUrl: "",
faceUrl: "",
},
eventCallback: (type, data) => console.log(type, data),
});
Event Callback¶
The eventCallback option receives a function that is called whenever a significant event occurs during the SDK lifecycle.
eventCallback: (type, data) => {
console.log(type, data);
};
Event Types¶
| Event | data |
Description |
|---|---|---|
app:started |
— | Fired when the SDK application initializes and is ready. |
process:created |
processId |
Fired when a new verification process is created. |
process:updated |
{processId, stepId, action} |
Fired when an existing process is updated (step is completed). |
process:finished |
processId |
Fired when a process reaches its final state. |
app:closed |
— | Fired when the SDK UI is closed by the user or programmatically. |
Core Methods¶
BiometridFull.getVersion()BiometridFull.start(processId?)BiometridFull.stop()