import { T as Actor } from "./spawn-D9jgw9pW.js"; import "./StateMachine-EDpYWy0i.js"; import { t as Manager } from "./Manager-CQQ99QOI.js"; //#region src/modules/face-match/types.d.ts /** * Face match comparison variant. * Determines which images are compared in the face match flow. */ type FaceMatchVariant = 'selfieVsId' | 'selfieVsNfc' | 'idVsNfc' | 'nfc3Way' | 'secondId'; /** * Configuration options for face match module. * * @example Standard face match with animation * ```typescript * const config: FaceMatchConfig = { * matchingType: 'selfieVsId', * disableFaceMatchAnimation: false, * }; * ``` * * @example Auto-skip mode (headless) * ```typescript * const config: FaceMatchConfig = { * matchingType: 'selfieVsId', * disableFaceMatchAnimation: true, * }; * ``` */ type FaceMatchConfig = { /** * Which images to compare in the face match flow. * Backend field name: `matchingType`. * @default 'selfieVsId' */ matchingType?: FaceMatchVariant; /** * When true, skips the animation UI and auto-completes immediately after fetching data. * Useful for headless integrations or silent verification flows. * @default false */ disableFaceMatchAnimation?: boolean; /** * When true, the module completes immediately on mount WITHOUT fetching data * or rendering any match UI. Set by the Flow orchestrator under US Smart * Capture when the ID was captured without a front image ("no front, no * match") — there is no ID face to compare against. Distinct from (and * complementary to) the reactive backend-4084 skip: this avoids mounting the * module and the failing fetch entirely. * @default false */ skipFaceMatch?: boolean; }; /** * Cropped face images fetched from the backend. */ type FaceMatchImages = { /** * Cropped face from ID document. */ idFace: string | null; /** * Cropped selfie image (from face capture). */ selfie: string | null; /** * Cropped face from second ID document (only for 'secondId' variant). */ secondIdFace?: string | null; }; /** * Face match result parsed from score response. */ type FaceMatchResult = { /** * Whether faces matched (OK = true, FAIL = false, null = unknown). */ matched: boolean | null; /** * Whether liveness check passed. */ liveness: boolean | null; }; //#endregion //#region src/modules/face-match/faceMatchActor.d.ts type CreateFaceMatchActorOptions = { config: FaceMatchConfig; }; declare function createFaceMatchActor(options: CreateFaceMatchActorOptions): Actor; type FaceMatchActor = ReturnType; //#endregion //#region src/modules/face-match/faceMatchManager.d.ts /** Face match manager is in initial state, waiting for `load()` to be called */ type FaceMatchIdleState = { status: 'idle'; }; /** Fetching images and score from backend */ type FaceMatchLoadingState = { status: 'loading'; }; /** * Animation is playing - images are animating. * @property images - Cropped face images fetched from backend * @property result - Face match result (matched, liveness) */ type FaceMatchAnimatingState = { status: 'animating'; images: { idFace: string | null; selfie: string | null; secondIdFace?: string | null; }; result: { matched: boolean | null; liveness: boolean | null; }; }; /** * Showing match result - waiting for user to click continue. * @property images - Cropped face images * @property result - Face match result * @property matched - Whether faces matched (true/false/null) */ type FaceMatchResultState = { status: 'result'; images: { idFace: string | null; selfie: string | null; secondIdFace?: string | null; }; result: { matched: boolean | null; liveness: boolean | null; }; matched: boolean | null; }; /** Face match completed successfully */ type FaceMatchFinishedState = { status: 'finished'; matched: boolean | null; }; /** * Fatal error occurred - call `reset()` to start over * @property error - Error message describing what went wrong */ type FaceMatchErrorState = { status: 'error'; error: string; }; /** * Union of all possible face match manager states. * Use discriminated union pattern to narrow the type: * * @example * ```typescript * const state = faceMatchManager.getState(); * if (state.status === 'animating') { * // TypeScript knows state has images and result * console.log(state.images.idFace); * } * ``` */ type FaceMatchState = FaceMatchIdleState | FaceMatchLoadingState | FaceMatchAnimatingState | FaceMatchResultState | FaceMatchFinishedState | FaceMatchErrorState; /** * Creates a face match manager for headless or UI-driven usage. * * The manager provides a state machine-based API for face comparison * with optional animation display. * * @param options - Configuration options * @param options.config - Face match configuration * @param options.config.matchingType - Which images to compare (default: 'selfieVsId') * @param options.config.disableFaceMatchAnimation - Skip animation and auto-complete (default: false) * * @returns Face match manager with state, API methods, and subscription * * @example Headless usage * ```typescript * const manager = createFaceMatchManager({ * config: { matchingType: 'selfieVsId', disableFaceMatchAnimation: true }, * }); * * manager.subscribe((state) => console.log(state.status)); * manager.load(); * // Auto-completes when disableFaceMatchAnimation is true * manager.stop(); * ``` * * @example With React/Preact UI hook * ```tsx * const [state, manager] = useManager(() => createFaceMatchManager({ config })); * * if (state.status === 'animating') { * return ; * } * ``` */ declare function createFaceMatchManager(options: CreateFaceMatchActorOptions): Manager & { /** * Initializes the face match flow. * Transitions from 'idle' to 'loading'. * Must be called before any other method. */ load(): void; /** * Signals that the animation has completed. * Should be called when state is 'animating' and your UI animation finishes. * Transitions to 'result' state. */ animationComplete(): void; /** * User clicked continue button. * Should be called when state is 'result'. * Transitions to 'finished' state. */ continue(): void; /** * Resets the manager to initial state. * Can be called from 'error' state to start over. * Clears all stored data including images and result. */ reset(): void; }; /** * Creates a face-match manager from a pre-built actor. * Use this when overriding the machine via `.provide()` for custom backends * or for story-isolation testing. */ declare function createFaceMatchManagerFromActor(actor: FaceMatchActor): Manager & { /** * Initializes the face match flow. * Transitions from 'idle' to 'loading'. * Must be called before any other method. */ load(): void; /** * Signals that the animation has completed. * Should be called when state is 'animating' and your UI animation finishes. * Transitions to 'result' state. */ animationComplete(): void; /** * User clicked continue button. * Should be called when state is 'result'. * Transitions to 'finished' state. */ continue(): void; /** * Resets the manager to initial state. * Can be called from 'error' state to start over. * Clears all stored data including images and result. */ reset(): void; }; /** * Type representing a face match manager instance. * Includes state access, API methods, and lifecycle management. * * @property getState - Returns the current FaceMatchState * @property subscribe - Subscribes to state changes, returns unsubscribe function * @property stop - Stops the manager and cleans up resources * @property load - Initializes the face match flow * @property animationComplete - Signals animation finished * @property continue - User clicked continue button * @property reset - Resets to initial state */ type FaceMatchManager = ReturnType; //#endregion export { FaceMatchActor as a, FaceMatchResult as c, createFaceMatchManagerFromActor as i, FaceMatchVariant as l, FaceMatchState as n, FaceMatchConfig as o, createFaceMatchManager as r, FaceMatchImages as s, FaceMatchManager as t };