import { n as WasmPipeline } from "./warmup-Dv2alr2-.js"; import { A as StateMachine, _ as MachineContext, c as AnyEventObject, l as AnyStateMachine, p as EventObject, v as MetaObject, y as NonReducibleUnknown } from "./spawn-D9jgw9pW.js"; import "./StateMachine-EDpYWy0i.js"; import { t as Manager } from "./Manager-CQQ99QOI.js"; import { a as ElectronicSignatureConfig } from "./types-DVmXIdzW.js"; import { t as EkycConfig } from "./types-Bk_6dmDa.js"; import { i as FlowModuleConfig, n as Flow, r as FlowModule } from "./types-KPvmag_B.js"; import { t as AuthenticationConfig } from "./types-EELWyWpd.js"; import { r as DocumentCaptureConfig } from "./types-DelMqZLe.js"; import { t as DynamicFormsConfig } from "./types-BSBzhHRH.js"; import { t as EkybConfig } from "./types-BfHiko5D.js"; import { c as IdCaptureConfig } from "./types-Bdf8_LYB2.js"; import { r as MandatoryConsentConfig } from "./types-BX_XkMsQ2.js"; import { t as IdOcrConfig } from "./types-CJ7Yl9K-2.js"; import { t as RedirectToMobileConfig } from "./types-DPIDuhut.js"; import { a as TotalScore, c as getTotalScoreStatus, n as FinishStatus, o as classifyScoreStatus, r as GetFinishStatusFn, t as FinishScreenVariant } from "./flowCompletionService-BlAHsKyv.js"; import { o as FlowEventSubscribable } from "./index-CLMF0QLQ.js"; import { n as ModuleRegistry } from "./types-BfgmV7s72.js"; //#region src/modules/flow/flowUtils.d.ts type NormalizeFlowModulesOptions = { isDesktop?: boolean; authHint?: string; lang?: string; useCPF?: boolean; }; type FlowForNormalization = Pick; declare function enrichFlowModuleConfig(module: FlowModule, flow: Flow): Record; /** * Analyzes a flow configuration and returns the WASM pipelines needed. * Use this to conditionally warmup WASM only when required by the flow. * * Modules with `onDeviceFaceResultsSubmissionEnabled: true` (currently SELFIE * and AUTHENTICATION) select the 6-model `'onDeviceSelfie'` bundle instead of * the default 4-model `'selfie'` bundle. * * @param flow - The flow configuration from /omni/onboarding/flow * @returns Array of WASM pipelines needed (e.g., ['selfie', 'idCapture']) * * @example * ```typescript * const pipelines = getRequiredWasmPipelines(flow); * if (pipelines.length > 0) { * warmupWasm({ ...wasmConfig, pipelines }); * } * ``` */ declare function getRequiredWasmPipelines(flow: Flow): WasmPipeline[]; /** * Normalizes flow modules by expanding TUTORIAL_ID into ID + SECOND_ID * based on configuration flags. Matches legacy flowService behavior. * * - TUTORIAL_ID becomes ID (with same config) * - If secondId: true, adds SECOND_ID module with isSecondId: true * - thirdId is deprecated and ignored; the flow continues to the next step * - Bare ID following TUTORIAL_ID is dropped (already merged) */ declare function normalizeFlowModules(flow: FlowForNormalization, options?: NormalizeFlowModulesOptions): FlowModule[]; //#endregion //#region src/modules/flow/dashboardConfig.d.ts type DeepPartialValue = T extends Record ? DeepPartial : T; type PreserveArray = T extends readonly unknown[] ? T : DeepPartialValue; type DeepPartial = { [K in keyof T]?: PreserveArray; }; declare function mergeDashboardConfig(dashboardConfig: T, localConfig: DeepPartial | undefined): T; //#endregion //#region src/modules/flow/flowServices.d.ts type GetFlowOptions = { isDesktop?: boolean; authHint?: string; lang?: string; useCPF?: boolean; }; type GetFlow = (signal: AbortSignal, options?: GetFlowOptions) => Promise; type DashboardResolvedModuleConfigMap = { ADDRESS: DocumentCaptureConfig; AE_SIGNATURE: Omit; AUTHENTICATION: AuthenticationConfig; DOCUMENT_CAPTURE: DocumentCaptureConfig; DYNAMIC_FORMS: DynamicFormsConfig; EKYB: EkybConfig; EXTERNAL_VERIFICATION: EkycConfig; ID: IdCaptureConfig; ID_OCR: IdOcrConfig; MANDATORY_CONSENT: MandatoryConsentConfig; ML_CONSENT: MandatoryConsentConfig; QE_SIGNATURE: Omit; REDIRECT_TO_MOBILE: RedirectToMobileConfig; SECOND_ID: IdCaptureConfig; TUTORIAL_ID: IdCaptureConfig; }; type ResolvedDashboardModuleConfig = K extends keyof DashboardResolvedModuleConfigMap ? DashboardResolvedModuleConfigMap[K] : FlowModuleConfig[K]; type ResolveDashboardModuleConfigOptions = { moduleKey: K; config?: DeepPartial>; occurrence?: number; signal?: AbortSignal; }; declare function preloadDashboardFlow(signal?: AbortSignal): Promise; declare const getFlow: GetFlow; declare function resolveDashboardModuleConfig(options: ResolveDashboardModuleConfigOptions): Promise>; //#endregion //#region src/modules/flow/noOpFlowModuleMachine.d.ts declare const noOpFlowModuleMachine: StateMachine; //#endregion //#region src/modules/flow/flowActor.d.ts type CreateFlowActorOptions = { getFlow?: GetFlow; }; //#endregion //#region src/modules/flow/flowManager.d.ts /** Flow manager is waiting to be started */ type FlowIdleState = { status: 'idle'; }; /** Flow is being fetched from the server */ type FlowLoadingState = { status: 'loading'; }; /** Flow is loaded and ready for navigation */ type FlowReadyState = { status: 'ready'; /** The complete flow configuration from the server */ flow: Flow; /** Array of module keys in order */ steps: string[]; /** Zero-based index of the current step */ currentStepIndex: number; /** The module key of the current step (e.g., 'SELFIE', 'ID', 'FACE_MATCH') */ currentStep: string | undefined; /** The configuration object for the current module. Type varies by module. */ config: unknown; }; /** All steps have been completed */ type FlowFinishedState = { status: 'finished'; /** The complete flow configuration */ flow: Flow; }; /** An error occurred while loading or processing the flow */ type FlowErrorState = { status: 'error'; /** The error message */ error: string; }; /** Union of all possible flow states */ type FlowState = FlowIdleState | FlowLoadingState | FlowReadyState | FlowFinishedState | FlowErrorState; /** * Creates a flow manager instance for managing onboarding flow state and navigation. * * The flow manager provides: * - State management with statuses: `idle`, `loading`, `ready`, `finished`, `error` * - Step navigation with `nextStep()` and `prevStep()` * - Current step info via `state.currentStep` and `state.config` when in `ready` state * - Module configuration lookup via `getModuleConfig()` * * @param options - Optional configuration for the flow actor * @param options.getFlow - Custom function to fetch flow data. Defaults to `getOnboardingFlow` * @returns A manager instance with state subscription, API methods, and lifecycle controls * * @example * ```ts * const flowManager = createFlowManager(); * * flowManager.subscribe((state) => { * if (state.status === 'ready') { * console.log(state.currentStep, state.config); * } * }); * * flowManager.load({ token: 'session-token' }); * ``` */ declare function createFlowManager(options?: CreateFlowActorOptions): Manager & { /** * Loads the flow from the server. * Transitions the state from `idle` to `loading`, then to `ready` on success or `error` on failure. * Requires setup() to have been called with a token first. */ load(): void; /** * Cancels the current loading operation and returns to `idle` state. * Only effective when in `loading` state. */ cancel(): void; /** * Resets the flow manager to its initial `idle` state. * Can be called from `ready`, `finished`, or `error` states. */ reset(): void; /** * Advances to the next step in the flow. * If on the last step, transitions to `finished` state. * Only effective when in `ready` state. */ nextStep(): void; /** * Goes back to the previous step in the flow. * Does nothing if already on the first step. * Only effective when in `ready` state. */ prevStep(): void; /** * Whether the flow can advance to the next step. * Returns `true` if in `ready` state and not on the last step. */ readonly canNext: boolean; /** * Whether the flow can go back to the previous step. * Returns `true` if in `ready` state and not on the first step. */ readonly canPrev: boolean; /** * Gets the configuration for a specific module by its key. * Useful for accessing config of modules other than the current one. * @param moduleKey - The unique key identifier of the module * @returns The module configuration or `undefined` if not found or not in `ready` state */ getModuleConfig: (moduleKey: string) => T | undefined; /** * Checks if a module is enabled in the current flow. * @param moduleKey - The unique key identifier of the module * @returns `true` if the module exists in the flow, `false` otherwise or if not in `ready` state */ isModuleEnabled: (moduleKey: string) => boolean; } & FlowEventSubscribable; //#endregion //#region src/modules/flow/moduleLoader.d.ts type LazyModule = () => Promise; type ModuleLoaderRegistry = { [key: string]: LazyModule<{ default: unknown; }>; }; interface ModuleLoader { load(moduleKey: string): Promise; prefetch(moduleKey: string): void; isLoaded(moduleKey: string): boolean; } declare function createModuleLoader(registry: ModuleLoaderRegistry): ModuleLoader; //#endregion //#region src/modules/flow/orchestratedFlowStateMachine.d.ts type GetFlowFn = (signal: AbortSignal) => Promise; type LazyModuleRegistry = { [key: string]: (() => Promise) | undefined; }; type OrchestratedFlowInput = { getFlow: GetFlowFn; modules?: ModuleRegistry; lazyModules?: LazyModuleRegistry; getFinishStatus?: GetFinishStatusFn; enableHome?: boolean; }; type OrchestratedFlowEvent = { type: 'LOAD'; } | { type: 'CANCEL'; } | { type: 'RESET'; } | { type: 'MODULE_COMPLETE'; output?: unknown; } | { type: 'COMPLETE_FLOW'; } | { type: 'FINISH_FLOW'; } | { type: 'HOME_CONTINUE'; } | { type: '*'; [key: string]: unknown; } | { type: string; [key: string]: unknown; }; //#endregion //#region src/modules/flow/orchestratedFlowManager.d.ts type OrchestratedFlowHomeScreen = { visible: boolean; isContinueLoading: boolean; }; type OrchestratedFlowPresentation = { isAwaitingReady: boolean; lazyModuleKey: string | undefined; shouldPrefetchHome: boolean; }; type OrchestratedFlowIdleState = { status: 'idle'; homeScreen: OrchestratedFlowHomeScreen; presentation: OrchestratedFlowPresentation; }; type OrchestratedFlowLoadingState = { status: 'loading'; homeScreen: OrchestratedFlowHomeScreen; presentation: OrchestratedFlowPresentation; }; type OrchestratedFlowCompletingState = { status: 'completing'; homeScreen: OrchestratedFlowHomeScreen; presentation: OrchestratedFlowPresentation; }; type OrchestratedFlowReadyState = { status: 'ready'; flow: Flow; steps: string[]; currentStepIndex: number; currentStep: string | undefined; config: unknown; moduleState: unknown; homeScreen: OrchestratedFlowHomeScreen; presentation: OrchestratedFlowPresentation; }; type OrchestratedFlowFinishedState = { status: 'finished'; flow: Flow; finishStatus: { redirectionUrl: string; action: 'approved' | 'rejected' | 'none'; scoreStatus: 'OK' | 'WARN' | 'MANUAL_OK' | 'FAIL' | 'UNKNOWN' | 'MANUAL_FAIL'; endScreenTitle: string | null; endScreenText: string | null; }; homeScreen: OrchestratedFlowHomeScreen; presentation: OrchestratedFlowPresentation; }; type OrchestratedFlowErrorState = { status: 'error'; error: string; errorCode?: number; moduleErrorCode?: string; homeScreen: OrchestratedFlowHomeScreen; presentation: OrchestratedFlowPresentation; }; type OrchestratedFlowState = OrchestratedFlowIdleState | OrchestratedFlowLoadingState | OrchestratedFlowCompletingState | OrchestratedFlowReadyState | OrchestratedFlowFinishedState | OrchestratedFlowErrorState; type CreateOrchestratedFlowActorOptions = { getFlow?: GetFlowFn; modules?: ModuleRegistry; lazyModules?: LazyModuleRegistry; getFinishStatus?: OrchestratedFlowInput['getFinishStatus']; enableHome?: boolean; }; declare function createOrchestratedFlowManager(options: CreateOrchestratedFlowActorOptions): Manager & { /** * Start loading the flow configuration from the backend. */ load(): void; /** * Cancel an in-progress flow load. */ cancel(): void; /** * Reset the flow to its initial idle state. */ reset(): void; /** * Signal that the current module has completed successfully. * Call this from your UI component's `onFinish` callback. * * @example * ```tsx * flowManager.completeModule()} * /> * ``` */ completeModule(output?: unknown): void; /** * Skip all remaining modules and complete the flow now, notifying the * backend (getFinishStatus) on the way to the completion step. */ completeFlow(): void; /** * Finish the flow because the onboarding was already completed externally — * e.g. the REDIRECT_TO_MOBILE handoff finished end-to-end on mobile. Lands * on the completion screen WITHOUT calling getFinishStatus: mobile already * notified the backend, and the desktop never reached its own finish. * Use this (not `completeFlow`) from REDIRECT_TO_MOBILE's `onFinish`. */ finishFlow(): void; /** * Signal that the current module encountered a terminal error, optionally * with its machine-readable `moduleErrorCode`. The flow machine decides what * to do: an advanceable terminal error (e.g. `NONEXISTENT_CUSTOMER`, * `HINT_NOT_PROVIDED`) advances to the next step; any other error transitions * to the terminal error state. Callers always forward the code and let core * classify — no per-module branching in the UI. * * @param error - Error message describing what went wrong * @param moduleErrorCode - Optional machine-readable error code (a * `FaceErrorCode`) used by the flow machine to decide advance vs terminate */ errorModule(error: string, moduleErrorCode?: string): void; /** * Send a raw event to the flow state machine. * Prefer using the typed methods (completeModule, errorModule) when possible. */ send(event: OrchestratedFlowEvent): void; readonly canNext: boolean; getModuleConfig: (moduleKey: string) => T | undefined; isModuleEnabled: (moduleKey: string) => boolean; isAwaitingOrchestratorReady(): boolean; /** * Resolve once the orchestrator has finished loading the flow and the first * module is ready to render. Useful for gating an initialization spinner * alongside other parallel async work (e.g. theme fetching). */ waitForReady(): Promise; getLazyModuleKey(): string | undefined; shouldRenderHomeScreen(): boolean; continueFromHome(): Promise; } & FlowEventSubscribable; //#endregion export { type DeepPartial, type FinishScreenVariant, type FinishStatus, type Flow, type FlowModule, type FlowModuleConfig, type FlowReadyState, type FlowState, type LazyModule, type LazyModuleRegistry, type ModuleLoader, type ModuleLoaderRegistry, type ModuleRegistry, type OrchestratedFlowCompletingState, type OrchestratedFlowFinishedState, type OrchestratedFlowHomeScreen, type OrchestratedFlowInput, type OrchestratedFlowPresentation, type OrchestratedFlowReadyState, type OrchestratedFlowState, type ResolveDashboardModuleConfigOptions, type ResolvedDashboardModuleConfig, type TotalScore, classifyScoreStatus, createFlowManager, createModuleLoader, createOrchestratedFlowManager, enrichFlowModuleConfig, getFlow, getRequiredWasmPipelines, getTotalScoreStatus, mergeDashboardConfig, noOpFlowModuleMachine, normalizeFlowModules, preloadDashboardFlow, resolveDashboardModuleConfig };