import { i as ActorRefFrom } from "./spawn-D9jgw9pW.js"; import { t as Manager } from "./Manager-CQQ99QOI.js"; import "./Actor-iTq7YY48.js"; import { i as Screen, t as DynamicFormsConfig } from "./types-BSBzhHRH.js"; //#region src/modules/dynamic-forms/dynamicFormsFields.d.ts /** Map of `questionId` → currently-displayed i18n error key. */ type DynamicFormsValidationErrors = Partial>; //#endregion //#region src/modules/dynamic-forms/dynamicFormsStateMachine.d.ts /** Whether the form completed normally or was skipped due to a screen-loading failure. */ type DynamicFormsResult = 'completed' | 'skipped'; declare const dynamicFormsMachine: any; type DynamicFormsMachine = typeof dynamicFormsMachine; //#endregion //#region src/modules/dynamic-forms/dynamicFormsActor.d.ts type CreateDynamicFormsActorOptions = { config: DynamicFormsConfig; }; type DynamicFormsActor = ActorRefFrom; //#endregion //#region src/modules/dynamic-forms/dynamicFormsManager.d.ts /** Dynamic forms manager is in initial state, waiting for `load()` */ type DynamicFormsIdleState = { status: 'idle'; }; /** Fetching screen configuration from the backend */ type DynamicFormsLoadingState = { status: 'loadingScreens'; }; /** * Ready for user input on the current screen. * @property currentScreen - The screen definition to render * @property screenIndex - 0-based index of the current screen * @property totalScreens - Total number of screens in the form * @property answers - Current answer values keyed by questionId * @property answerValidity - Per-question format validity reported via `setAnswerValidity` (phone, email, CPF, etc.) * @property validationErrors - Errors currently surfaced to the user, keyed by questionId. Entries appear on blur or submit, clear on type. Render as-is — no further UI-side gating. * @property canSubmit - True when no validation errors are currently displayed. Optimistic semantic: enabled on initial empty form; disables only after a submit attempt populates errors. */ type DynamicFormsInputtingState = { status: 'inputting'; currentScreen: Screen; screenIndex: number; totalScreens: number; answers: Record; answerValidity: Record; validationErrors?: DynamicFormsValidationErrors; canSubmit: boolean; /** questionIds that received a prefilled value — show the "from ID" marker. */ prefilledQuestionIds: string[]; /** questionIds prefilled with a non-editable value — render read-only. */ nonEditableQuestionIds: string[]; }; /** * Submitting the current screen's answers to the backend. * The screen data is preserved so the UI can keep the form visible (with * disabled fields and a button spinner) while the request is in-flight. * @property screenIndex - Index of the screen being submitted * @property totalScreens - Total number of screens in the form * @property currentScreen - The screen whose answers are being submitted * @property answers - Frozen answer values at submission time * @property answerValidity - Frozen validity flags at submission time */ type DynamicFormsSubmittingState = { status: 'submitting'; screenIndex: number; totalScreens: number; currentScreen: Screen; answers: Record; answerValidity: Record; validationErrors?: DynamicFormsValidationErrors; /** questionIds that received a prefilled value — show the "from ID" marker. */ prefilledQuestionIds: string[]; /** questionIds prefilled with a non-editable value — render read-only. */ nonEditableQuestionIds: string[]; }; /** * All screens submitted — success screen visible for ~3 s before * transitioning to `finished`. */ type DynamicFormsSuccessState = { status: 'success'; }; /** * All screens completed or skipped. * @property result - `'completed'` when all screens were submitted successfully; * `'skipped'` when screen configuration could not be loaded (fire-and-forget). */ type DynamicFormsFinishedState = { status: 'finished'; result: DynamicFormsResult; }; /** * Neither `screens` nor `flowId` was provided — misconfiguration, not a runtime error. * Call `close()` to dismiss. Fix the config (provide `screens` or `flowId`) instead. */ type DynamicFormsMisconfiguredState = { status: 'misconfigured'; }; /** User dismissed the module */ type DynamicFormsClosedState = { status: 'closed'; }; /** * Login-hint lockout — the backend reported status `4302` ("Login hint attempts * exceeded") on a form-answer rejection. Terminal, non-recoverable screen with * no retry; the module parks here (user must contact their administrator). */ type DynamicFormsAttemptsExhaustedState = { status: 'attemptsExhausted'; }; /** * Union of all possible dynamic forms manager states. */ type DynamicFormsState = DynamicFormsIdleState | DynamicFormsLoadingState | DynamicFormsInputtingState | DynamicFormsSubmittingState | DynamicFormsSuccessState | DynamicFormsFinishedState | DynamicFormsMisconfiguredState | DynamicFormsClosedState | DynamicFormsAttemptsExhaustedState; /** * Creates a dynamic forms manager for headless or UI-driven usage. * * @param options - Configuration options * @param options.config - Dynamic forms configuration (flowId or pre-loaded screens) * * @returns Dynamic forms manager with state, API methods, and subscription */ declare function createDynamicFormsManager(options: CreateDynamicFormsActorOptions): Manager & { /** * Initializes the dynamic forms flow. * Transitions from 'idle' to 'loadingScreens' or 'inputting'. * Must be called before any other method. */ load(): void; /** * Updates the answer value for a single question. * Should be called when state is 'inputting'. * * @param questionId - The question ID from the screen definition * @param value - The raw user input value (formatting is stripped in Core before submission) */ setAnswer(questionId: string, value: string): void; /** * Reports the format validity of a question's current value. * Used for fields with format constraints (PHONE, EMAIL, CPF). * A `false` entry feeds into the `formatViaAnswerValidity` validation rule * and surfaces as a `validationErrors[questionId]` entry once validated. * * @param questionId - The question ID from the screen definition * @param isValid - Whether the current value passes format validation */ setAnswerValidity(questionId: string, isValid: boolean): void; /** * Triggers validation for a single field (e.g., on blur). * Populates or clears `validationErrors[questionId]` accordingly. * * @param questionId - The question ID from the screen definition */ validateField(questionId: string): void; /** * Submits the current screen's answers. * Transitions to 'submitting', then advances to the next screen or 'finished'. * Answer submission failures are fire-and-forget and do not block progression. */ submit(): void; /** * Dismisses the module from 'misconfigured' state. * Fix the config (provide `screens` or `flowId`) rather than calling `reset()`. */ close(): void; }; declare function createDynamicFormsManagerFromActor(actor: DynamicFormsActor): Manager & { /** * Initializes the dynamic forms flow. * Transitions from 'idle' to 'loadingScreens' or 'inputting'. * Must be called before any other method. */ load(): void; /** * Updates the answer value for a single question. * Should be called when state is 'inputting'. * * @param questionId - The question ID from the screen definition * @param value - The raw user input value (formatting is stripped in Core before submission) */ setAnswer(questionId: string, value: string): void; /** * Reports the format validity of a question's current value. * Used for fields with format constraints (PHONE, EMAIL, CPF). * A `false` entry feeds into the `formatViaAnswerValidity` validation rule * and surfaces as a `validationErrors[questionId]` entry once validated. * * @param questionId - The question ID from the screen definition * @param isValid - Whether the current value passes format validation */ setAnswerValidity(questionId: string, isValid: boolean): void; /** * Triggers validation for a single field (e.g., on blur). * Populates or clears `validationErrors[questionId]` accordingly. * * @param questionId - The question ID from the screen definition */ validateField(questionId: string): void; /** * Submits the current screen's answers. * Transitions to 'submitting', then advances to the next screen or 'finished'. * Answer submission failures are fire-and-forget and do not block progression. */ submit(): void; /** * Dismisses the module from 'misconfigured' state. * Fix the config (provide `screens` or `flowId`) rather than calling `reset()`. */ close(): void; }; /** Type representing a dynamic forms manager instance. */ type DynamicFormsManager = ReturnType; //#endregion export { DynamicFormsActor as a, DynamicFormsValidationErrors as c, createDynamicFormsManagerFromActor as i, DynamicFormsState as n, DynamicFormsResult as o, createDynamicFormsManager as r, dynamicFormsMachine as s, DynamicFormsManager as t };