# Document Reader IDV Module

The **idv-document** module is an npm package plugin designed to work with **DocreaderSDK** via a Web Component:  
https://www.npmjs.com/package/@regulaforensics/vp-frontend-document-components

It is delivered as part of the **IDV Capturing** solution and has a version synchronized with **idv-capture-web**. Currently, compatibility is guaranteed at the **major.minor** version level.

## What the Module Is

The module is an **npm package** that **exports a Web Component**, inside which the **Lit** framework (LitJS) is used for rendering and component logic.

## DocreaderSDK Versioning

This module declares a **peerDependency** on:  
https://www.npmjs.com/package/@regulaforensics/vp-frontend-document-components  
to ensure compatibility with specific versions of DocreaderSDK.

- If the root project already has a version of `vp-frontend-document-components` installed and it matches the allowed versions in `peerDependencies`, that version will be used.
- If the installed version does **not** match, then starting from **npm v7+**, npm will automatically install a suitable version.
- In earlier versions of npm, the application developer must manually install the required compatible version.

## How It Works

The module receives typed configuration data following the unified interface used by all **idv-capture-web** modules.  
The type definitions for the Docreader IDV module configuration are located inside this package.

The Web Component then interacts with `vp-frontend-document-components`, which communicates with the **DocreaderSDK service**.

## Module Output

The result of execution can be either:

- **Data** for submission to the platform, or  
- A typed **BaseError**, which contains detailed information explaining why the module failed.


## Important Note: Licensing

Licensing for this module is **domain-based**.  
However, you may also provide a **development license (`devLicense`)**, encoded in **Base64**.

### Providing a devLicense in Ready for Production mode

When running in a production environment, you can pass a development license to the module via `moduleProps` in the parent component service of **idv-capture-web**.

### Providing a devLicense for Development

If the module is used **for development purposes**, the license can be supplied using:

```ts
modulesConfig: {
    docreader: {
        devLicense: string;
    };
}
```

