diff --git a/modules/customer-invoices/src/web/proformas/update/ui/pages/proforma-update-page.test.tsx b/modules/customer-invoices/src/web/proformas/update/ui/pages/proforma-update-page.test.tsx index 43c20c7d..92da51ca 100644 --- a/modules/customer-invoices/src/web/proformas/update/ui/pages/proforma-update-page.test.tsx +++ b/modules/customer-invoices/src/web/proformas/update/ui/pages/proforma-update-page.test.tsx @@ -1,7 +1,8 @@ import assert from "node:assert/strict"; import { mock, test } from "node:test"; -import { renderToStaticMarkup } from "react-dom/server"; + import type { ReactNode } from "react"; +import { renderToStaticMarkup } from "react-dom/server"; test("conecta la alta rápida directa y la alta rápida desde selector con callbacks distintos", async () => { const openSelectDialog = () => undefined; @@ -161,10 +162,7 @@ test("conecta la alta rápida directa y la alta rápida desde selector con callb assert.equal(capturedEditorProps?.onChangeCustomerClick, openSelectDialog); assert.equal(capturedEditorProps?.onCreateCustomerClick, openQuickCreateDialog); - assert.equal( - capturedSelectDialogProps?.onCreateNewCustomerClick, - openQuickCreateFromSelection - ); + assert.equal(capturedSelectDialogProps?.onCreateNewCustomerClick, openQuickCreateFromSelection); assert.equal(capturedQuickCreateDialogProps?.ctrl, quickCreateCtrl); mock.restoreAll(); diff --git a/modules/customers/src/common/features/customer-selection/controllers/use-customer-selection-flow.test.tsx b/modules/customers/src/common/features/customer-selection/controllers/use-customer-selection-flow.test.tsx index 8f525cf4..3ed36c6c 100644 --- a/modules/customers/src/common/features/customer-selection/controllers/use-customer-selection-flow.test.tsx +++ b/modules/customers/src/common/features/customer-selection/controllers/use-customer-selection-flow.test.tsx @@ -1,5 +1,6 @@ import assert from "node:assert/strict"; import { mock, test } from "node:test"; + import { renderToStaticMarkup } from "react-dom/server"; test("expone apertura directa y apertura desde selector con comportamientos distintos", async () => { @@ -16,9 +17,7 @@ test("expone apertura directa y apertura desde selector con comportamientos dist mock.module("../../quick-create-customer", { namedExports: { QuickCreateCustomerDialog: () => null, - useQuickCreateCustomerFlow: ( - options: NonNullable - ) => { + useQuickCreateCustomerFlow: (options: NonNullable) => { quickCreateOptions = options; return { @@ -54,9 +53,7 @@ test("expone apertura directa y apertura desde selector con comportamientos dist const { useCustomerSelectionFlow } = await import("./use-customer-selection-flow.ts"); const selectedCustomers: Array<{ id: string }> = []; - let flow: - | ReturnType - | undefined; + let flow: ReturnType | undefined; const Harness = () => { flow = useCustomerSelectionFlow({ diff --git a/modules/customers/src/common/features/customer-selection/controllers/use-customer-selection-flow.ts b/modules/customers/src/common/features/customer-selection/controllers/use-customer-selection-flow.ts index ad2acc1c..9d7f343b 100644 --- a/modules/customers/src/common/features/customer-selection/controllers/use-customer-selection-flow.ts +++ b/modules/customers/src/common/features/customer-selection/controllers/use-customer-selection-flow.ts @@ -1,5 +1,5 @@ -import type { CustomerSelectionOption } from "../entities"; import { QuickCreateCustomerDialog, useQuickCreateCustomerFlow } from "../../quick-create-customer"; +import type { CustomerSelectionOption } from "../entities"; import { SelectCustomerDialog } from "../ui"; import { useSelectCustomerDialogController } from "./use-select-customer-dialog-controller"; diff --git a/modules/customers/src/common/features/quick-create-customer/controllers/use-quick-create-customer-dialog-controller.ts b/modules/customers/src/common/features/quick-create-customer/controllers/use-quick-create-customer-dialog-controller.ts index 77946641..eba8043c 100644 --- a/modules/customers/src/common/features/quick-create-customer/controllers/use-quick-create-customer-dialog-controller.ts +++ b/modules/customers/src/common/features/quick-create-customer/controllers/use-quick-create-customer-dialog-controller.ts @@ -14,10 +14,10 @@ import { import { useId, useState } from "react"; import type { FieldErrors } from "react-hook-form"; -import type { CustomerSelectionOption } from "../../customer-selection"; -import { buildCustomerSelectionOption } from "../../customer-selection"; import { useTranslation } from "../../../../web/i18n"; import { useCustomerCreateMutation } from "../../../../web/shared/hooks"; +import type { CustomerSelectionOption } from "../../customer-selection"; +import { buildCustomerSelectionOption } from "../../customer-selection"; import { type QuickCustomerCreateForm, QuickCustomerCreateFormSchema } from "../entities"; import { buildCreateCustomerParamsFromQuickForm, @@ -120,7 +120,7 @@ export const useQuickCreateCustomerDialogController = ( if (isValidationErrorCollection(normalizedError)) { applyValidationErrorCollection(form, normalizedError); - focusFirstInputFormError(form); + focusFirstInputFormError(form.formState.errors, form); showWarningToast( t("create.feedback.validation.title"), @@ -140,7 +140,7 @@ export const useQuickCreateCustomerDialogController = ( (errors: FieldErrors) => { console.error(errors); setSubmitError(null); - focusFirstInputFormError(form); + focusFirstInputFormError(errors, form); showWarningToast( t("common.feedback.validation.title"), diff --git a/modules/customers/src/common/features/quick-create-customer/entities/quick-customer-create-form.schema.ts b/modules/customers/src/common/features/quick-create-customer/entities/quick-customer-create-form.schema.ts index 2da1fffe..349b71e1 100644 --- a/modules/customers/src/common/features/quick-create-customer/entities/quick-customer-create-form.schema.ts +++ b/modules/customers/src/common/features/quick-create-customer/entities/quick-customer-create-form.schema.ts @@ -1,4 +1,4 @@ -import { z } from "zod/v4"; +import type { z } from "zod/v4"; import { CustomerCreateFormSchema } from "../../../../web/create/entities"; diff --git a/modules/customers/src/web/create/controllers/use-customer-create.controller.ts b/modules/customers/src/web/create/controllers/use-customer-create.controller.ts index 3a1fedf6..fbb1e797 100644 --- a/modules/customers/src/web/create/controllers/use-customer-create.controller.ts +++ b/modules/customers/src/web/create/controllers/use-customer-create.controller.ts @@ -110,7 +110,7 @@ export const useCreateCustomerController = (options?: UseCustomerCreateControlle console.log("Errores de validación aplicados al form:", form.formState.errors); - focusFirstInputFormError(form); + focusFirstInputFormError(form.formState.errors, form); if (options?.errorToasts !== false) { showWarningToast( @@ -135,7 +135,7 @@ export const useCreateCustomerController = (options?: UseCustomerCreateControlle }, (errors: FieldErrors) => { console.error(errors); - focusFirstInputFormError(form); + focusFirstInputFormError(errors, form); showWarningToast( t("common.feedback.validation.title"), diff --git a/modules/customers/src/web/update/controllers/use-customer-update.controller.ts b/modules/customers/src/web/update/controllers/use-customer-update.controller.ts index d93fb6cd..6e10c461 100644 --- a/modules/customers/src/web/update/controllers/use-customer-update.controller.ts +++ b/modules/customers/src/web/update/controllers/use-customer-update.controller.ts @@ -173,7 +173,7 @@ export const useCustomerUpdateController = ( console.log("Errores de validación aplicados al form:", form.formState.errors); - focusFirstInputFormError(form); + focusFirstInputFormError(form.formState.errors, form); if (options?.errorToasts !== false) { showWarningToast( @@ -198,7 +198,7 @@ export const useCustomerUpdateController = ( }, (errors: FieldErrors) => { console.error(errors); - focusFirstInputFormError(form); + focusFirstInputFormError(errors, form); showWarningToast( t("common.feedback.validation.title"),