Prepare

The prepare component can be found under the Sybrin.Biometrics namespace and is called PrepareComponent.

Full name: Sybrin.Biometrics.PrepareComponent.

It is a component that provides an initial preparation screen, providing an easy way to view a customizable privacy policy and usage guidelines.

With default styling, the prepare component appears as follows:

Upon clicking "View Our Privacy Policy", the onViewPrivacyPolicy event will fire. Hooking onto this event allows you to react to the button click and show your privacy policy.

Upon clicking "View Guidelines", the component will automatically open a new window and display guidelines for taking a selfie. The onViewGuidelines event will also fire, allowing you to run additional code if needed.

Upon clicking "Next", the onProceed event will fire.

Initialization

The prepare component can be initialized using the following code:

<div id='prepare'></div>

The Sybrin Web SDK provides the option to either pass down the ID of the element you wish to use for component initialization, or to pass the element directly.

Please note that 'prepare' is just an example in this context and the ID may be changed as desired as long as it matches the value passed down during component initialization in JavaScript.

During initialization, the prepare component allows for a number of configuration options that may be passed down using an object literal. The parameters that may be used on the object include the following:

Required:

  • id (string): ID of the element you wish to use for component initialization. Not required if element is passed.

  • element (HTMLElement): Element you wish to use for component initialization. Not required if id is passed.

Optional:

  • flowDirection (number): This property is used to control the flow direction of the guidelines window. 0 is left to right. 1 is right to left. Default 0

  • translations ({ [key: string]: string }): An object literal representing a dictionary lookup that will be used for translating the component. Please see the translations section on this page for a list of all translatable text, as well as the localization page for a detailed description on how to implement localization.

Warning: Initialization will fail if the intended host element does not exist yet.

Always ensure that the initialize function is only called after the DOM is loaded.

Destruction

The prepare component may be removed from the UI by calling the destroy() function on it.

Example:

component.destroy();

Functions

Initialize

initialize(): void

Initializes the component's DOM and events.

Destroy

destroy(): void

Destroys the component's DOM and events.

Set Translations

setTranslations(translations?: { [key: string]: string; }): void

Changes the component's translations to the provided values and updates the DOM accordingly.

Set Flow Direction

setFlowDirection(flowDirection: FlowDirection): void

Changes the component's flow direction.

Events

The prepare component offers multiple events. To hook onto an event, simply assign a function to it.

The following options are available:

  • onProceed()

  • onViewPrivacyPolicy()

  • onViewGuidelines()

On Proceed

This function is called when the "Next" button is clicked. To hook onto the event, you may use the following code:

component.onProceed = function() {
    console.log('Proceed clicked!');
}

No parameter is passed to this function call.

On View Privacy Policy

This function is called when the "View Our Privacy Policy" button is clicked. To hook onto the event, you may use the following code:

component.onViewPrivacyPolicy = function() {
    console.log('Privacy Policy clicked!');
}

No parameter is passed to this function call.

On View Guidelines

This function is called when the "View Guidelines" button is clicked. To hook onto the event, you may use the following code:

component.onViewGuidelines = function() {
    console.log('View Guidelines clicked!');
}

No parameter is passed to this function call.

Styling

The prepare component is structured a follows:

<div class="sybrin-biometrics-container">
    <div class="sybrin-biometrics-halves">
        <div class="sybrin-biometrics-half">
            <div class="sybrin-biometrics-block sybrin-biometrics-privacy-block">
                <div class="sybrin-biometrics-block-icon">
                </div>
                <div class="sybrin-biometrics-block-prompt sy-b-translation-1">
                    Your selfie <b>will be encrypted</b> and stored in our digital vault.
                </div>
                <button class="sybrin-biometrics-block-button sybrin-biometrics-privacy-button sy-b-translation-2">
                    View Our <b>Privacy Policy</b> 
                </button>
            </div>
        </div>
        <div class="sybrin-biometrics-half">
            <div class="sybrin-biometrics-block sybrin-biometrics-guidelines-block">
                <div class="sybrin-biometrics-block-icon">
                </div>
                <div class="sybrin-biometrics-block-prompt sy-b-translation-3">
                    Take the <b>perfect selfie</b>.
                </div>
                <button class="sybrin-biometrics-block-button sybrin-biometrics-guidelines-button sy-b-translation-4">
                    View <b>Guidelines</b> 
                </button>
            </div>
        </div>
    </div>
    <div class="sybrin-biometrics-button-section">
        <button class="sybrin-biometrics-next sybrin-biometrics-flow-button sy-b-translation-5">Next</button>
    </div>
</div>

The classes and elements specified above may be used to freely style the prepare component as desired. To do so, simply create a stylesheet and include it in the project, then style according to the above classes and elements.

Styling implementation example:

index.html
<html>
<head>
    <link rel="stylesheet" type="text/css" href="styles.css" media="screen"/>
</head>
<body>
    <div id='component'></div>
</body>
</html>

Translations

This component is affected by the following translation keys:

Translation KeyDescriptionDefault/Source

sy-b-translation-1

Prompt text with explanation regarding selfie

Your selfie will be encrypted and stored in our digital vault.

sy-b-translation-2

Caption of the button that triggers the event to view privacy policy

View Our Privacy Policy

sy-b-translation-3

Prompt text above button to view guidelines

Take the perfect selfie.

sy-b-translation-4

Caption of the button that shows guidelines

View Guidelines

sy-b-translation-5

Caption of the button that proceeds to the next step

Next

Additionally, the component may be used to invoke an internally defined set of guidelines, displayed in a separate window. This window's content can also be translated. The following keys are available:

Translation KeyDescriptionDefault

sy-b-translation-19

Title displayed in the tab of the guidelines window

Guidelines

sy-b-translation-6

Title displayed within the guidelines page

Take selfie

sy-b-translation-7

Subtitle displayed within the guidelines page

Guidelines to the perfect selfie

sy-b-translation-8

Camera access guideline

Allow camera access when prompted

sy-b-translation-9

Lighting conditions guideline

Ensure good lighting with no bright lights in background

sy-b-translation-10

Accessories guideline

Remove hats, sunglasses and headsets

sy-b-translation-11

Alignment guideline

Ensure correct alignment

sy-b-translation-12

Positioning guideline

Position face in frame

sy-b-translation-13

Multiple faces guideline

Only one face must be in frame

sy-b-translation-14

Instructions guideline

Follow on-screen instructions

Last updated