# Cross-Document Data Match Module

<WebSDK2 />

The Cross-Document Data Match module runs a backend comparison of OCR data across multiple captured documents (e.g., ID + proof-of-address) and flags inconsistencies. Fire-and-forget — completes after a minimum display duration so the user sees a confirmation spinner.

> Follows the [backend-process pattern](doc:web-sdk-2-module-patterns#3-backend-process-modules). See the patterns page for the shared lifecycle.

## Tag

`<incode-cross-document-data-match>` is a standard Web Component. Importing the UI subpath registers the custom element; the module is bundled with `@incodetech/web/flow` (no separate UI subpath import).

```ts
import '@incodetech/web/cross-document-data-match';
```

## Properties

| Property   | Type                           | Required | Description                      |
| ---------- | ------------------------------ | -------- | -------------------------------- |
| `config`   | `CrossDocumentDataMatchConfig` | ❌        | No options                       |
| `onFinish` | `() => void`                   | ❌        | Called when comparison completes |
| `onError`  | `(error: string) => void`      | ❌        | Called when an error occurs      |

## Configuration

The module takes no configuration:

```typescript
type CrossDocumentDataMatchConfig = Record<string, never>;
```

Comparison rules and inconsistency thresholds are configured server-side per tenant.

## State machine

`CrossDocumentDataMatchState` is a discriminated union over `status`:

| Status       | Description                      |
| ------------ | -------------------------------- |
| `idle`       | Initial state.                   |
| `processing` | Backend comparison in progress.  |
| `finished`   | Terminal — comparison completed. |

The module deliberately holds the `processing` state for a minimum display duration so users see a confirmation spinner regardless of how fast the backend responds.

## See also

* [Module Patterns → backend-process](doc:web-sdk-2-module-patterns#3-backend-process-modules)
* [Module: ID OCR](doc:web-sdk-2-module-id-ocr) — provides one of the input data sets
* [Module: Document Capture](doc:web-sdk-2-module-document-capture) — provides POA data
* [Individual Modules](doc:web-sdk-2-individual-modules)
