Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Basic usage

Basic SDK Web integration example.

The following guide shows an integration example in a TypeScript + VITE environment. The same process can be carried out in current frameworks, with any differences required by the environment (syntax, component definition, etc.).

This example is based on a basic integration. The flow’s behavior can be changed using the required configurations or changes.

This integration uses the SDK Provider, SelphID Widget, Selphi Widget, and Tracking components (included in SDK Provider).


Installing the component

Install the SDK Web library:

npm install @facephi/sdk-web-wc@latest

Remember to prepare the file .npmrc with the credentials needed to download it.

Define the custom elements:

// main.ts
import '@facephi/sdk-web-wc';
import { defineCustomElements as defineFacephiSDKCustomElements } from '@facephi/sdk-web-wc/loader';

defineFacephiSDKCustomElements(window);

Integrating and configuring the SDK Provider

Integrate and configure the SDK Provider:

App.tsx
import { Language, TrackingSteps, TypeFamily } from '@facephi/sdk-web-wc';

<section className="facephi-sdk-provider">
  <facephi-sdk-provider
    apikey={import.meta.env.VITE_LICENSE_KEY}
    steps={`${TrackingSteps.start},${TrackingSteps.selphidWidget},${TrackingSteps.selphiWidget},${TrackingSteps.finish}`}
    type={TypeFamily.onboarding}
    customerId={customerId}
    language={Language.en}
  />
</section>

SDK Provider logic:

SelphID Widget logic:

Selphi Widget logic

This is just an example. Different types of integration or syntax can be used.

In this example, only the happy path, has been considered, so the remaining events must also be integrated in real implementations.


Integration and configuration of the component flow

This example is an integration of the Happy Path for an Onboarding performed using SelphID and Selphi.

First, when the SDK Provider is instantiated, the internal logic for initializing all services (Loading, Licensing, Tracking Initialization, etc.) will run.

When the Provider emits the event emitData, the first Widget (SelphID) will be loaded using the logic in initSelphidWidget(sdkProvider).

Once the user has completed the capture process, the SelphID Widget will close and emit the event extractionFinish. The data can be processed as needed in this event, and the next component (Selphi) will be loaded using the method initSelphiWidget(sdkProvider);.

Finally, when the user has finished capturing the facial pattern, the resulting data can be processed as needed, and the flow will end by continuing with the desired logic.

Flow between components

In more comprehensive environments, such as modern frameworks, you can use components, routers, stores, and all kinds of tools to implement this flow.

The Facephi team recommends using components and routers for a more modular, straightforward, and faster integration in the framework of your choice.


Behavioral testing

Once the integration is complete, it is highly recommended that you test the application in its development environment to verify that it works as expected, taking into account the possible configurations and scenarios that may arise in the end users’ flow.


Last updated