EYN Eagle Id Component
====
The EYN Eagle Id component provides convenient access to the EYN's API from applications written in React-based JavaScript.

A demo of *eagle-id* to verify a person's identity via a (mobile) browser application <a href="https://app.eyn.vision/identitycheck">click here</a>.


Documentation
====
See the <a href="https://www.eyn.vision">EYN's</a> <a href="https://api.eyn.vision/#identity-checks">API docs</a> for more information.


Installation
====
Install the package with:

```
npm install eagle-id --save
# or 
yarn add eagle-id`
```

Usage
====

```
import EagleId from 'eagle-id'

<EagleId />
```

## Resources + Demo

Important, for the use of `eagle-id` you need to copy some resources into your `public` folder of your `React` project. These resources comprise images and animations. The required resources can be downloaded [here](https://github.com/Ayn-AI/eagle-id-front-end/blob/master/resources.zip).

### Demo

A `React` demo project using `eagle-id` can be found [here](https://github.com/Ayn-AI/eagle-id-front-end).

Configuration
====
The package can be initialized with several options as outlined below.

### Props

| prop                      | type     | default      | notes                                                                                   |
| ------------------------- | -------- | ------------ | --------------------------------------------------------------------------------------- |
| config                     | object  | see default config | Configuration of the component to your needs                                          |

The default config is set as follows:

```
{
  "baseUrl": "https://api.eyn.ninja/api/v1/prod/identitycheck",
  "apiSecret": "public-e692d869-c110-4a33-b003-2098a5e04f72",
  "privacy": {
    "show": true,
    "notice": "https://www.eyn.vision/privacynotice",
  },
  "title": "Eagle ID powered by EYN",
  "ui": {
    "documentTitle": "Select Your Document Type",
    "documentSubTitle": "",
  },
  "camera": {
    "imageFormat": "image/jpeg",
    "ui": {
        "idFront": {
            "scanLabel": "Scan the FRONT SIDE of your document",
            "infoLabel": "Place it within the frame and press the camera button",
            "scanNumber": "Scan 1/2"
        },
        "idBack": {
            "scanLabel": "Scan the BACK SIDE of your document",
            "infoLabel": "Place it within the frame and press the camera button",
            "scanNumber": "Scan 2/2"
        },
        "visa": {
            "scanLabel": "Scan your VISA document",
            "infoLabel": "Place it within the frame and press the camera button",
            "scanNumber": ""
        },
        "passport": {
            "scanLabel": "Scan the FRONT PAGE of your PASSPORT document",
            "infoLabel": "Please make sure to only include the main page containing the passport photo",
            "scanNumber": ""
        },
        "other": {
            "scanLabel": "Scan your document",
            "infoLabel": "Place it within the frame and press the camera button",
            "scanNumber": ""
        },
        "selfie": {
            "scanLabel": "Send us a smile",
            "infoLabel": "Place it within the frame and\n press the camera button",
            "scanNumber": ""
        },
    }
  },
  "resources": {
    "images": {
        "logo": "./resources/images/logo.png",
        "logoTitle": "./resources/images/logo-title.png",
        "privacy": "./resources/images/privacy-notice.png",
        "icon_passport": "./resources/images/type_passport.svg",
        "icon_id": "./resources/images/type_identity_card.svg",
        "icon_other": "./resources/images/identity_type_other.svg",
        "icon_camera": "./resources/images/camera.svg",
        "image_selfie": "./resources/images/selfie_instruc.svg",
        "overlay_document_web": "./resources/images/overlay_document.svg",
        "overlay_document_mobile": "./resources/images/overlay_document_mobile.svg",
        "overlay_selfie_web": "./resources/images/overlay_selfie.svg",
        "overlay_selfie_mobile": "./resources/images/overlay_selfie_mobile.svg",
    },
    "animations": {
        "passport": "./resources/animations/scan_passport.json",
        "idfront": "./resources/animations/scan_document_front.json",
        "idback": "./resources/animations/scan_document_back.json",
        "status_good": "./resources/animations/verify_status_good.json",
        "loading": "./resources/animations/loading_coffee.json",
    }
  }
}
```

| prop                      | type     | default      | notes                                                                                   |
| ------------------------- | -------- | ------------ | --------------------------------------------------------------------------------------- |
| baseUrl                     | string  | https://api.eyn.ninja/api/v1/prod/identitycheck | Endpoint URL of EYN's API                                       |
| apiSecret                     | string  | public-e692d869-c110-4a33-b003-2098a5e04f72 | Secret to identify the customer           |
| privacy                     | object  | - | Privacy settings for the npm component           |
| show                     | Boolean  | true | Setting to show the privacy notice           |
| notice                     | string  | https://www.eyn.vision/privacynotice | URL to privacy notice           |
| ui                     | object  | - | User interface configuration           |
| title                     | string  | Eagle ID powered by EYN | Title of component           |
| camera                     | object  | - | Camera configuration          |
| imageFormat                     | string  | image/jpeg | Data type of selfie image           |
| resources                     | object  | - | Resource configuration           |
| images                     | object  | - | Image resources           |
| animations                     | object  | - | Animation resources           |


Support 
====

For any developer feedback please contact us at <a href="dev@eyn.vision">dev@eyn.vision</a>
For inquiries or any other feedback please contact us at <a href="contact@eyn.vision">contact@eyn.vision</a>

Thanks,
EYN
