import { t as Manager } from "./Manager-CQQ99QOI.js"; import "./Actor-iTq7YY48.js"; //#region src/modules/custom-fields/types.d.ts type CustomFieldType = 'INTEGER' | 'DOUBLE' | 'BOOLEAN' | 'STRING' | 'DATE'; type CustomField = { name: string; alias: string; type: CustomFieldType; }; type CustomFieldsConfig = { title: string; customFields: CustomField[]; }; //#endregion //#region src/modules/custom-fields/customFieldsStateMachine.d.ts type CustomFieldsResult = 'success' | 'failed'; declare const customFieldsMachine: any; //#endregion //#region src/modules/custom-fields/customFieldsActor.d.ts type CreateCustomFieldsActorOptions = { config: CustomFieldsConfig; }; //#endregion //#region src/modules/custom-fields/customFieldsManager.d.ts /** * A `CustomField` enriched with a computed `label` for display. * Label is derived from `alias` when present, otherwise auto-formatted from `name`. */ type MappedCustomField = CustomField & { label: string; }; /** Custom fields manager is in initial state, waiting for `load()` to be called */ type CustomFieldsIdleState = { status: 'idle'; }; /** * Ready for field input — use `setField()` and `submit()` * @property title - Form title from configuration * @property customFields - Field definitions with computed display labels * @property canSubmit - True when all non-boolean fields have a non-empty value */ type CustomFieldsInputtingState = { status: 'inputting'; title: string; customFields: MappedCustomField[]; canSubmit: boolean; }; /** Fields are being submitted to the backend */ type CustomFieldsSubmittingState = { status: 'submitting'; title: string; }; /** API call succeeded — success page is visible for ~3 s before finishing */ type CustomFieldsSuccessState = { status: 'success'; }; /** Custom fields flow complete. `result` indicates whether the API call succeeded or failed. */ type CustomFieldsFinishedState = { status: 'finished'; result: CustomFieldsResult | null; }; /** * Union of all possible custom fields manager states. */ type CustomFieldsState = CustomFieldsIdleState | CustomFieldsInputtingState | CustomFieldsSubmittingState | CustomFieldsSuccessState | CustomFieldsFinishedState; /** * Creates a custom fields manager for headless or UI-driven usage. * * @param options - Configuration options * @param options.config - Custom fields configuration (title + field definitions) * * @returns Custom fields manager with state, API methods, and subscription * * @example Headless usage * ```typescript * const manager = createCustomFieldsManager({ * config: { * title: 'Additional Information', * customFields: [{ name: 'company', alias: 'Company', type: 'STRING' }], * }, * }); * * manager.subscribe((state) => console.log(state.status)); * manager.load(); * manager.setField('company', 'Incode'); * manager.submit(); * manager.stop(); * ``` */ declare function createCustomFieldsManager(options: CreateCustomFieldsActorOptions): Manager & { /** * Initializes the custom fields flow. * Transitions from 'idle' to 'inputting'. * Must be called before any other method. */ load(): void; /** * Updates the value of a single field. * Should be called when state is 'inputting'. * * @param name - The field name (matches CustomField.name) * @param value - The field value (string, number, or boolean) */ setField(name: string, value: string | number | boolean): void; /** * Submits all custom field values to the backend. * Transitions to 'submitting', then 'finished' regardless of outcome. */ submit(): void; }; /** Type representing a custom fields manager instance. */ type CustomFieldsManager = ReturnType; //#endregion export { type CustomField, type CustomFieldType, type CustomFieldsConfig, type CustomFieldsManager, type CustomFieldsState, type MappedCustomField, createCustomFieldsManager, customFieldsMachine };