@gusto/embedded-react-sdk 0.51.2 → 0.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/dist/components/Common/FlowBreadcrumbs/FlowBreadcrumbsTypes.d.ts +1 -1
- package/dist/components/Common/OnboardingStatusBadge/index.d.ts +1 -1
- package/dist/components/Common/OnboardingStatusBadge/index.js.map +1 -1
- package/dist/components/Common/UI/FormBox/FormBox.d.ts +9 -0
- package/dist/components/Common/UI/FormBox/FormBox.js +13 -0
- package/dist/components/Common/UI/FormBox/FormBox.js.map +1 -0
- package/dist/components/Common/UI/FormBox/FormBox.module.scss.js +14 -0
- package/dist/components/Common/UI/FormBox/FormBox.module.scss.js.map +1 -0
- package/dist/components/Common/UI/FormBox/FormBoxTypes.d.ts +26 -0
- package/dist/components/Common/UI/FormBoxHeader/FormBoxHeader.d.ts +9 -0
- package/dist/components/Common/UI/FormBoxHeader/FormBoxHeader.js +23 -0
- package/dist/components/Common/UI/FormBoxHeader/FormBoxHeader.js.map +1 -0
- package/dist/components/Common/UI/FormBoxHeader/FormBoxHeader.module.scss.js +8 -0
- package/dist/components/Common/UI/FormBoxHeader/FormBoxHeader.module.scss.js.map +1 -0
- package/dist/components/Common/UI/FormBoxHeader/FormBoxHeaderTypes.d.ts +36 -0
- package/dist/components/Common/UI/FormBoxHeader/FormBoxHeaderTypes.js +7 -0
- package/dist/components/Common/UI/FormBoxHeader/FormBoxHeaderTypes.js.map +1 -0
- package/dist/components/Common/UI/FormBoxHeader/index.d.ts +1 -0
- package/dist/components/Common/UI/Input/InputTypes.d.ts +1 -0
- package/dist/components/Common/UI/Input/InputTypes.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.d.ts +1 -2
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.d.ts +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Form.d.ts +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Form.d.ts +1 -1
- package/dist/components/Company/DocumentSigner/shared/useSignCompanyForm/signCompanyFormSchema.d.ts +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.d.ts +1 -1
- package/dist/components/Company/Locations/LocationForm/Form.d.ts +1 -1
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/payScheduleSchema.d.ts +3 -3
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.d.ts +1 -1
- package/dist/components/Company/StateTaxes/StateTaxes.d.ts +10 -1
- package/dist/components/Company/StateTaxes/StateTaxes.js +23 -17
- package/dist/components/Company/StateTaxes/StateTaxes.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesComponents.d.ts +2 -0
- package/dist/components/Company/StateTaxes/StateTaxesComponents.js +17 -10
- package/dist/components/Company/StateTaxes/StateTaxesComponents.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js +26 -26
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.d.ts +9 -0
- package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.js +24 -24
- package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.js.map +1 -1
- package/dist/components/Contractor/Address/Address.d.ts +4 -3
- package/dist/components/Contractor/Address/Address.js.map +1 -1
- package/dist/components/Contractor/Address/shared/useContractorAddressForm/contractorAddressSchema.d.ts +2 -2
- package/dist/components/Contractor/Address/shared/useContractorAddressForm/useContractorAddressForm.d.ts +1 -1
- package/dist/components/Contractor/ContractorList/index.js +95 -92
- package/dist/components/Contractor/ContractorList/index.js.map +1 -1
- package/dist/components/Contractor/Documents/SignatureForm/SignatureForm.js +22 -19
- package/dist/components/Contractor/Documents/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/contractorSignatureFormSchema.d.ts +1 -1
- package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/useContractorSignatureForm.d.ts +1 -1
- package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/w9Fields.d.ts +1 -1
- package/dist/components/Contractor/PaymentMethod/shared/useContractorBankAccountForm/useContractorBankAccountFormSchema.d.ts +1 -1
- package/dist/components/Contractor/PaymentMethod/shared/useContractorPaymentMethodForm/contractorPaymentMethodSchema.d.ts +1 -1
- package/dist/components/Contractor/PaymentMethod/shared/useContractorPaymentMethodForm/contractorPaymentMethodSchema.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/shared/useContractorPaymentMethodForm/useContractorPaymentMethodForm.d.ts +2 -2
- package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.d.ts +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js +2 -2
- package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummary.d.ts +17 -5
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummary.js +32 -31
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummary.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.d.ts +16 -4
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js +33 -29
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +1 -1
- package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/contractorDetailsSchema.d.ts +1 -1
- package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/contractorDetailsSchema.js +6 -6
- package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/contractorDetailsSchema.js.map +1 -1
- package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/useContractorDetailsForm.d.ts +1 -1
- package/dist/components/Employee/Compensation/onboarding/Compensation.d.ts +0 -4
- package/dist/components/Employee/Compensation/onboarding/Compensation.js +38 -42
- package/dist/components/Employee/Compensation/onboarding/Compensation.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/useCompensationForm/compensationSchema.d.ts +2 -2
- package/dist/components/Employee/Compensation/shared/useJobForm/jobSchema.d.ts +1 -1
- package/dist/components/Employee/Dashboard/index.d.ts +1 -1
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/childSupportGarnishmentFormSchema.d.ts +1 -1
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/useChildSupportGarnishmentForm.d.ts +1 -1
- package/dist/components/Employee/Deductions/shared/useDeductionForm/deductionFormSchema.d.ts +2 -2
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.d.ts +2 -2
- package/dist/components/Employee/Documents/onboarding/EmployeeDocuments/EmployeeDocuments.js +1 -4
- package/dist/components/Employee/Documents/onboarding/EmployeeDocuments/EmployeeDocuments.js.map +1 -1
- package/dist/components/Employee/Documents/shared/useSignEmployeeForm/signEmployeeFormSchema.d.ts +2 -2
- package/dist/components/Employee/Documents/shared/useSignEmployeeForm/signEmployeeFormSchema.js +27 -32
- package/dist/components/Employee/Documents/shared/useSignEmployeeForm/signEmployeeFormSchema.js.map +1 -1
- package/dist/components/Employee/EmployeeList/shared/useEmployeeList.js +1 -2
- package/dist/components/Employee/EmployeeList/shared/useEmployeeList.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/shared/useFederalTaxesForm/federalTaxesSchema.d.ts +2 -2
- package/dist/components/Employee/FederalTaxes/shared/useFederalTaxesForm/useFederalTaxesForm.d.ts +1 -1
- package/dist/components/Employee/OnboardingExecutionFlow/onboardingExecutionStateMachine.d.ts +1 -1
- package/dist/components/Employee/OnboardingExecutionFlow/onboardingExecutionStateMachine.js +1 -3
- package/dist/components/Employee/OnboardingExecutionFlow/onboardingExecutionStateMachine.js.map +1 -1
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +55 -49
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/shared/useBankForm/useBankFormSchema.d.ts +1 -1
- package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/useSplitPaymentsFormSchema.d.ts +1 -1
- package/dist/components/Employee/Profile/shared/useEmployeeDetailsForm/employeeDetailsSchema.d.ts +2 -2
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/homeAddressSchema.d.ts +1 -1
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/useHomeAddressForm.d.ts +1 -1
- package/dist/components/Employee/exports/employeeManagement.d.ts +1 -1
- package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.d.ts +4 -5
- package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js +101 -125
- package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js.map +1 -1
- package/dist/components/InformationRequests/InformationRequestsComponents.d.ts +0 -5
- package/dist/components/InformationRequests/InformationRequestsComponents.js +12 -13
- package/dist/components/InformationRequests/InformationRequestsComponents.js.map +1 -1
- package/dist/components/Payroll/Dismissal/DismissalFlowComponents.js +4 -4
- package/dist/components/Payroll/Dismissal/DismissalFlowComponents.js.map +1 -1
- package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.d.ts +1 -1
- package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js +8 -8
- package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js.map +1 -1
- package/dist/components/Payroll/OffCycle/index.d.ts +1 -1
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes.d.ts +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +97 -92
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +2 -3
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.d.ts +2 -2
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +1 -1
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +57 -56
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.d.ts +23 -6
- package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.js +37 -33
- package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js +2 -2
- package/dist/components/Payroll/PayrollFlow/PayrollExecutionFlowContextual.js +6 -6
- package/dist/components/Payroll/PayrollFlow/PayrollExecutionFlowContextual.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistory.js +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistory.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.d.ts +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.d.ts +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.d.ts +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +31 -31
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
- package/dist/components/Payroll/RecoveryCases/RecoveryCases.d.ts +9 -5
- package/dist/components/Payroll/RecoveryCases/RecoveryCases.js.map +1 -1
- package/dist/components/Payroll/Transition/TransitionFlowComponents.d.ts +1 -1
- package/dist/components/Payroll/Transition/TransitionFlowComponents.js +1 -1
- package/dist/components/Payroll/Transition/TransitionFlowComponents.js.map +1 -1
- package/dist/components/Payroll/Transition/index.d.ts +1 -1
- package/dist/components/Payroll/helpers.d.ts +22 -8
- package/dist/components/Payroll/helpers.js +1 -1
- package/dist/components/Payroll/helpers.js.map +1 -1
- package/dist/components/Payroll/index.d.ts +3 -2
- package/dist/components/Payroll/payrollTypes.d.ts +1 -1
- package/dist/components/Payroll/payrollTypes.js +1 -1
- package/dist/components/Payroll/payrollTypes.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.d.ts +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/components/TimeOff/TimeOffFlow/timeOffPolicyTypes.d.ts +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/useSelectEmployeesData.js +19 -19
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/useSelectEmployeesData.js.map +1 -1
- package/dist/contexts/ApiProvider/ApiProvider.d.ts +5 -5
- package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -1
- package/dist/contexts/ApiProvider/apiVersion.d.ts +2 -2
- package/dist/contexts/ApiProvider/apiVersion.js +1 -1
- package/dist/contexts/ApiProvider/apiVersion.js.map +1 -1
- package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js +40 -36
- package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js.map +1 -1
- package/dist/contexts/ComponentAdapter/componentAdapterTypes.d.ts +2 -0
- package/dist/contexts/ComponentAdapter/createComponentsWithDefaults.d.ts +5 -0
- package/dist/contexts/ComponentAdapter/createComponentsWithDefaults.js +18 -16
- package/dist/contexts/ComponentAdapter/createComponentsWithDefaults.js.map +1 -1
- package/dist/contexts/ComponentAdapter/useComponentContext.d.ts +6 -0
- package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
- package/dist/contexts/GustoProvider/GustoProvider.d.ts +4 -5
- package/dist/contexts/GustoProvider/GustoProvider.js +6 -6
- package/dist/contexts/GustoProvider/GustoProvider.js.map +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.d.ts +7 -7
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +8 -8
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/contexts/GustoProvider/index.d.ts +1 -1
- package/dist/contexts/index.d.ts +2 -6
- package/dist/i18n/en/Contractor.ContractorList.json.js +18 -16
- package/dist/i18n/en/Contractor.ContractorList.json.js.map +1 -1
- package/dist/i18n/en/Contractor.SignatureForm.json.js +5 -5
- package/dist/i18n/en/Employee.OnboardingSummary.json.js +24 -20
- package/dist/i18n/en/Employee.OnboardingSummary.json.js.map +1 -1
- package/dist/i18n/types.d.ts +8 -0
- package/dist/index.d.ts +8 -7
- package/dist/index.js +121 -134
- package/dist/index.js.map +1 -1
- package/dist/models/WA_RISK_CODES.d.ts +5 -2
- package/dist/models/WA_RISK_CODES.js.map +1 -1
- package/dist/models/external.d.ts +67 -57
- package/dist/partner-hook-utils/composeErrorHandler.d.ts +9 -4
- package/dist/partner-hook-utils/composeErrorHandler.js.map +1 -1
- package/dist/partner-hook-utils/form/SDKFormProvider.d.ts +10 -2
- package/dist/partner-hook-utils/form/SDKFormProvider.js +7 -1
- package/dist/partner-hook-utils/form/SDKFormProvider.js.map +1 -1
- package/dist/partner-hook-utils/form/composeSubmitHandler.d.ts +7 -4
- package/dist/partner-hook-utils/form/composeSubmitHandler.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/index.d.ts +1 -0
- package/dist/partner-hook-utils/form/index.d.ts +3 -3
- package/dist/partner-hook-utils/form/useHookFieldResolution.js.map +1 -1
- package/dist/partner-hook-utils/index.d.ts +1 -1
- package/dist/partner-hook-utils/types.d.ts +7 -3
- package/dist/shared/constants.d.ts +2 -2
- package/dist/shared/constants.js +4 -4
- package/dist/shared/constants.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/Helpers.d.ts +11 -0
- package/dist/types/hooks.d.ts +1 -1
- package/docs/guides/endpoint-inventory.json +379 -379
- package/package.json +7 -7
|
@@ -20,8 +20,8 @@ export type { Compensation } from '@gusto/embedded-api/models/components/compens
|
|
|
20
20
|
export { PaymentUnit } from '@gusto/embedded-api/models/components/compensation';
|
|
21
21
|
/** `ContractorPaymentMethod1` entity from the Gusto Embedded API. */
|
|
22
22
|
export { ContractorPaymentMethod1 } from '@gusto/embedded-api/models/components/contractor';
|
|
23
|
-
export type { Address, Contractor,
|
|
24
|
-
export {
|
|
23
|
+
export type { Address, Contractor, MemberPortalInvitationStatus, UpcomingEmployment, } from '@gusto/embedded-api/models/components/contractor';
|
|
24
|
+
export { ContractorStatus, ContractorType, ContractorWageType, OnboardingStatus, } from '@gusto/embedded-api/models/components/contractor';
|
|
25
25
|
/** `ContractorAddress` entity from the Gusto Embedded API. */
|
|
26
26
|
export type { ContractorAddress } from '@gusto/embedded-api/models/components/contractoraddress';
|
|
27
27
|
/** `ContractorBankAccount` entity from the Gusto Embedded API. */
|
|
@@ -32,13 +32,13 @@ export { ContractorCreateRequestBodyType, ContractorCreateRequestBodyWageType, }
|
|
|
32
32
|
export type { ContractorPaymentForGroup } from '@gusto/embedded-api/models/components/contractorpaymentforgroup';
|
|
33
33
|
export { ContractorPaymentForGroupPaymentMethod, ContractorPaymentForGroupStatus, ContractorPaymentForGroupWageType, } from '@gusto/embedded-api/models/components/contractorpaymentforgroup';
|
|
34
34
|
export type { ContractorPaymentForGroupPreview } from '@gusto/embedded-api/models/components/contractorpaymentforgrouppreview';
|
|
35
|
-
export { ContractorPaymentForGroupPreviewPaymentMethod, ContractorPaymentForGroupPreviewStatus,
|
|
35
|
+
export { ContractorPaymentForGroupPreviewPaymentMethod, ContractorPaymentForGroupPreviewStatus, WageType, } from '@gusto/embedded-api/models/components/contractorpaymentforgrouppreview';
|
|
36
36
|
/** `ContractorPaymentGroupTotals` entity from the Gusto Embedded API. */
|
|
37
37
|
export type { ContractorPaymentGroupTotals } from '@gusto/embedded-api/models/components/contractorpaymentgroup';
|
|
38
38
|
export type { ContractorPaymentGroup } from '@gusto/embedded-api/models/components/contractorpaymentgroup';
|
|
39
39
|
export { ContractorPaymentGroupStatus } from '@gusto/embedded-api/models/components/contractorpaymentgroup';
|
|
40
|
-
/** `
|
|
41
|
-
export type {
|
|
40
|
+
/** `Totals` entity from the Gusto Embedded API. */
|
|
41
|
+
export type { Totals } from '@gusto/embedded-api/models/components/contractorpaymentgrouppreview';
|
|
42
42
|
export type { ContractorPaymentGroupPreview } from '@gusto/embedded-api/models/components/contractorpaymentgrouppreview';
|
|
43
43
|
export { ContractorPaymentGroupPreviewStatus } from '@gusto/embedded-api/models/components/contractorpaymentgrouppreview';
|
|
44
44
|
/** `ContractorPaymentGroupWithBlockersTotals` entity from the Gusto Embedded API. */
|
|
@@ -53,9 +53,9 @@ export { ContractorPaymentMethodSplitBy } from '@gusto/embedded-api/models/compo
|
|
|
53
53
|
export { ContractorPaymentMethodType } from '@gusto/embedded-api/models/components/contractorpaymentmethod';
|
|
54
54
|
/** `ContractorPaymentReceipt` entity from the Gusto Embedded API. */
|
|
55
55
|
export type { ContractorPaymentReceipt } from '@gusto/embedded-api/models/components/contractorpaymentreceipt';
|
|
56
|
-
/** `
|
|
57
|
-
export type {
|
|
58
|
-
export type {
|
|
56
|
+
/** `ContractorPaymentReceiptContractorPayments` entity from the Gusto Embedded API. */
|
|
57
|
+
export type { ContractorPaymentReceiptContractorPayments } from '@gusto/embedded-api/models/components/contractorpaymentreceipt';
|
|
58
|
+
export type { ContractorPaymentReceiptTotals, Licensee, } from '@gusto/embedded-api/models/components/contractorpaymentreceipt';
|
|
59
59
|
export { ContractorPaymentReceiptPaymentMethod } from '@gusto/embedded-api/models/components/contractorpaymentreceipt';
|
|
60
60
|
export type { ContractorUpdateRequestBody } from '@gusto/embedded-api/models/components/contractorupdaterequestbody';
|
|
61
61
|
export { ContractorUpdateRequestBodyType, ContractorUpdateRequestBodyWageType, } from '@gusto/embedded-api/models/components/contractorupdaterequestbody';
|
|
@@ -66,7 +66,7 @@ export type { Document } from '@gusto/embedded-api/models/components/document';
|
|
|
66
66
|
export type { Fields } from '@gusto/embedded-api/models/components/document';
|
|
67
67
|
/** `Pages` entity from the Gusto Embedded API. */
|
|
68
68
|
export type { Pages } from '@gusto/embedded-api/models/components/document';
|
|
69
|
-
export {
|
|
69
|
+
export { DocumentRecipientType } from '@gusto/embedded-api/models/components/document';
|
|
70
70
|
/** `DocumentSigned` entity from the Gusto Embedded API. */
|
|
71
71
|
export type { DocumentSigned } from '@gusto/embedded-api/models/components/documentsigned';
|
|
72
72
|
/** `DocumentSignedFields` entity from the Gusto Embedded API. */
|
|
@@ -74,11 +74,11 @@ export type { DocumentSignedFields } from '@gusto/embedded-api/models/components
|
|
|
74
74
|
/** `DocumentSignedPages` entity from the Gusto Embedded API. */
|
|
75
75
|
export type { DocumentSignedPages } from '@gusto/embedded-api/models/components/documentsigned';
|
|
76
76
|
export { DocumentSignedRecipientType } from '@gusto/embedded-api/models/components/documentsigned';
|
|
77
|
-
/** `
|
|
78
|
-
export {
|
|
77
|
+
/** `CurrentEmploymentStatus` entity from the Gusto Embedded API. */
|
|
78
|
+
export { CurrentEmploymentStatus } from '@gusto/embedded-api/models/components/employee';
|
|
79
79
|
/** `EmployeeOnboardingStatus1` entity from the Gusto Embedded API. */
|
|
80
80
|
export { EmployeeOnboardingStatus1 } from '@gusto/embedded-api/models/components/employee';
|
|
81
|
-
export type { Employee, EmployeeMemberPortalInvitationStatus,
|
|
81
|
+
export type { Employee, EmployeeMemberPortalInvitationStatus, OnboardingDocumentsConfig, } from '@gusto/embedded-api/models/components/employee';
|
|
82
82
|
export { EmployeePaymentMethod1, EmployeeStatus, } from '@gusto/embedded-api/models/components/employee';
|
|
83
83
|
/** `EmployeeAddress` entity from the Gusto Embedded API. */
|
|
84
84
|
export type { EmployeeAddress } from '@gusto/embedded-api/models/components/employeeaddress';
|
|
@@ -89,9 +89,12 @@ export type { EmployeeCustomField } from '@gusto/embedded-api/models/components/
|
|
|
89
89
|
export type { EmployeeFederalTax } from '@gusto/embedded-api/models/components/employeefederaltax';
|
|
90
90
|
export type { EmployeeFederalTaxPre2020 } from '@gusto/embedded-api/models/components/employeefederaltaxpre2020';
|
|
91
91
|
export type { EmployeeFederalTaxRev2020 } from '@gusto/embedded-api/models/components/employeefederaltaxrev2020';
|
|
92
|
+
/** `Blockers` entity from the Gusto Embedded API. */
|
|
93
|
+
export type { Blockers } from '@gusto/embedded-api/models/components/employeeonboardingstatus';
|
|
92
94
|
/** `EmployeeOnboardingStatusOnboardingStep` entity from the Gusto Embedded API. */
|
|
93
95
|
export type { EmployeeOnboardingStatusOnboardingStep } from '@gusto/embedded-api/models/components/employeeonboardingstatus';
|
|
94
96
|
export type { EmployeeOnboardingStatus } from '@gusto/embedded-api/models/components/employeeonboardingstatus';
|
|
97
|
+
export { EmployeeOnboardingStatusCategory, Field, } from '@gusto/embedded-api/models/components/employeeonboardingstatus';
|
|
95
98
|
/** `EmployeePaymentMethod` entity from the Gusto Embedded API. */
|
|
96
99
|
export type { EmployeePaymentMethod } from '@gusto/embedded-api/models/components/employeepaymentmethod';
|
|
97
100
|
/** `EmployeePaymentMethodSplitBy` entity from the Gusto Embedded API. */
|
|
@@ -111,8 +114,8 @@ export type { Questions } from '@gusto/embedded-api/models/components/employeest
|
|
|
111
114
|
export type { States } from '@gusto/embedded-api/models/components/employeestatetaxesrequest';
|
|
112
115
|
/** `EmployeeStateTaxInputQuestionFormat` entity from the Gusto Embedded API. */
|
|
113
116
|
export type { EmployeeStateTaxInputQuestionFormat } from '@gusto/embedded-api/models/components/employeestatetaxinputquestionformat';
|
|
114
|
-
/** `
|
|
115
|
-
export type {
|
|
117
|
+
/** `EmployeeStateTaxInputQuestionFormatOptions` entity from the Gusto Embedded API. */
|
|
118
|
+
export type { EmployeeStateTaxInputQuestionFormatOptions } from '@gusto/embedded-api/models/components/employeestatetaxinputquestionformat';
|
|
116
119
|
/** `EmployeeStateTaxQuestion` entity from the Gusto Embedded API. */
|
|
117
120
|
export type { EmployeeStateTaxQuestion } from '@gusto/embedded-api/models/components/employeestatetaxquestion';
|
|
118
121
|
/** `EmployeeWorkAddress` entity from the Gusto Embedded API. */
|
|
@@ -179,34 +182,6 @@ export { PaymentSpeed } from '@gusto/embedded-api/models/components/paymentconfi
|
|
|
179
182
|
export type { PaymentMethodBankAccount } from '@gusto/embedded-api/models/components/paymentmethodbankaccount';
|
|
180
183
|
export type { PayPeriod, PayPeriodPayroll } from '@gusto/embedded-api/models/components/payperiod';
|
|
181
184
|
export { PayrollType } from '@gusto/embedded-api/models/components/payperiod';
|
|
182
|
-
/** `EmployeeCompensations` entity from the Gusto Embedded API. */
|
|
183
|
-
export type { EmployeeCompensations } from '@gusto/embedded-api/models/components/payroll';
|
|
184
|
-
/** `OffCycleReasonType` entity from the Gusto Embedded API. */
|
|
185
|
-
export { OffCycleReasonType } from '@gusto/embedded-api/models/components/payroll';
|
|
186
|
-
/** `Payroll` entity from the Gusto Embedded API. */
|
|
187
|
-
export type { Payroll } from '@gusto/embedded-api/models/components/payroll';
|
|
188
|
-
/** `PayrollShow` entity from the Gusto Embedded API. */
|
|
189
|
-
export type { PayrollShow } from '@gusto/embedded-api/models/components/payroll';
|
|
190
|
-
/** `PayrollShowBenefits` entity from the Gusto Embedded API. */
|
|
191
|
-
export type { PayrollShowBenefits } from '@gusto/embedded-api/models/components/payroll';
|
|
192
|
-
/** `PayrollShowDeductions` entity from the Gusto Embedded API. */
|
|
193
|
-
export type { PayrollShowDeductions } from '@gusto/embedded-api/models/components/payroll';
|
|
194
|
-
/** `PayrollShowFixedCompensations` entity from the Gusto Embedded API. */
|
|
195
|
-
export type { PayrollShowFixedCompensations } from '@gusto/embedded-api/models/components/payroll';
|
|
196
|
-
/** `PayrollShowHourlyCompensations` entity from the Gusto Embedded API. */
|
|
197
|
-
export type { PayrollShowHourlyCompensations } from '@gusto/embedded-api/models/components/payroll';
|
|
198
|
-
/** `PayrollShowPaidTimeOff` entity from the Gusto Embedded API. */
|
|
199
|
-
export type { PayrollShowPaidTimeOff } from '@gusto/embedded-api/models/components/payroll';
|
|
200
|
-
/** `PayrollShowPaymentMethod` entity from the Gusto Embedded API. */
|
|
201
|
-
export { PayrollShowPaymentMethod } from '@gusto/embedded-api/models/components/payroll';
|
|
202
|
-
/** `PayrollShowReimbursements` entity from the Gusto Embedded API. */
|
|
203
|
-
export type { PayrollShowReimbursements } from '@gusto/embedded-api/models/components/payroll';
|
|
204
|
-
/** `PayrollShowTaxes` entity from the Gusto Embedded API. */
|
|
205
|
-
export type { PayrollShowTaxes } from '@gusto/embedded-api/models/components/payroll';
|
|
206
|
-
/** `PayrollWithholdingPayPeriodType` entity from the Gusto Embedded API. */
|
|
207
|
-
export { PayrollWithholdingPayPeriodType } from '@gusto/embedded-api/models/components/payroll';
|
|
208
|
-
export type { PayrollPrepared } from '@gusto/embedded-api/models/components/payroll';
|
|
209
|
-
export { PayrollShowAmountType } from '@gusto/embedded-api/models/components/payroll';
|
|
210
185
|
/** `PayrollCompanyTaxesType` entity from the Gusto Embedded API. */
|
|
211
186
|
export type { PayrollCompanyTaxesType } from '@gusto/embedded-api/models/components/payrollcompanytaxestype';
|
|
212
187
|
/** `PayrollCreditBlockerTypeUnblockOptions` entity from the Gusto Embedded API. */
|
|
@@ -227,19 +202,22 @@ export type { PayrollCreditBlockerUnblockOptionWaitForReverseWireMetadata } from
|
|
|
227
202
|
export type { PayrollCreditBlockerUnblockOptionWaitForReverseWire } from '@gusto/embedded-api/models/components/payrollcreditblockerunblockoptionwaitforreversewire';
|
|
228
203
|
/** `Deductions` entity from the Gusto Embedded API. */
|
|
229
204
|
export type { Deductions } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype';
|
|
205
|
+
/** `FixedCompensations` entity from the Gusto Embedded API. */
|
|
206
|
+
export type { FixedCompensations } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype';
|
|
207
|
+
/** `HourlyCompensations` entity from the Gusto Embedded API. */
|
|
208
|
+
export type { HourlyCompensations } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype';
|
|
230
209
|
/** `PayrollEmployeeCompensationsType` entity from the Gusto Embedded API. */
|
|
231
210
|
export type { PayrollEmployeeCompensationsType } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype';
|
|
232
|
-
/** `PayrollEmployeeCompensationsTypeFixedCompensations` entity from the Gusto Embedded API. */
|
|
233
|
-
export type { PayrollEmployeeCompensationsTypeFixedCompensations } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype';
|
|
234
|
-
/** `PayrollEmployeeCompensationsTypeHourlyCompensations` entity from the Gusto Embedded API. */
|
|
235
|
-
export type { PayrollEmployeeCompensationsTypeHourlyCompensations } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype';
|
|
236
211
|
/** `PayrollEmployeeCompensationsTypePaidTimeOff` entity from the Gusto Embedded API. */
|
|
237
212
|
export type { PayrollEmployeeCompensationsTypePaidTimeOff } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype';
|
|
238
213
|
/** `PayrollEmployeeCompensationsTypePaymentMethod` entity from the Gusto Embedded API. */
|
|
239
214
|
export { PayrollEmployeeCompensationsTypePaymentMethod } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype';
|
|
240
|
-
/** `
|
|
241
|
-
export type {
|
|
242
|
-
|
|
215
|
+
/** `Reimbursements` entity from the Gusto Embedded API. */
|
|
216
|
+
export type { Reimbursements } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype';
|
|
217
|
+
/** `State` entity from the Gusto Embedded API. */
|
|
218
|
+
export type { State } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype';
|
|
219
|
+
export type { CustomWithholdings, Federal, } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype';
|
|
220
|
+
export { AmountType, OverrideType, PayrollEmployeeCompensationsTypeAmountType, PayrollEmployeeCompensationsTypeCustomWithholdingsAmountType, PayrollEmployeeCompensationsTypeOverrideType, } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype';
|
|
243
221
|
/** `PayrollFixedCompensationTypesType` entity from the Gusto Embedded API. */
|
|
244
222
|
export type { PayrollFixedCompensationTypesType } from '@gusto/embedded-api/models/components/payrollfixedcompensationtypestype';
|
|
245
223
|
export type { PayrollPaymentSpeedChangedType } from '@gusto/embedded-api/models/components/payrollpaymentspeedchangedtype';
|
|
@@ -255,8 +233,38 @@ export type { PayrollReceipt } from '@gusto/embedded-api/models/components/payro
|
|
|
255
233
|
export type { PayrollReceiptEmployeeCompensations } from '@gusto/embedded-api/models/components/payrollreceipt';
|
|
256
234
|
/** `Taxes` entity from the Gusto Embedded API. */
|
|
257
235
|
export type { Taxes } from '@gusto/embedded-api/models/components/payrollreceipt';
|
|
258
|
-
export type {
|
|
236
|
+
export type { PayrollReceiptLicensee, PayrollReceiptTotals, } from '@gusto/embedded-api/models/components/payrollreceipt';
|
|
259
237
|
export { PayrollReceiptPaymentMethod } from '@gusto/embedded-api/models/components/payrollreceipt';
|
|
238
|
+
/** `EmployeeCompensations` entity from the Gusto Embedded API. */
|
|
239
|
+
export type { EmployeeCompensations } from '@gusto/embedded-api/models/components/payrollshow';
|
|
240
|
+
/** `OffCycleReasonType` entity from the Gusto Embedded API. */
|
|
241
|
+
export { OffCycleReasonType } from '@gusto/embedded-api/models/components/payrollshow';
|
|
242
|
+
/** `Payroll` entity from the Gusto Embedded API. */
|
|
243
|
+
export type { Payroll } from '@gusto/embedded-api/models/components/payrollshow';
|
|
244
|
+
/** `PayrollShow` entity from the Gusto Embedded API. */
|
|
245
|
+
export type { PayrollShow } from '@gusto/embedded-api/models/components/payrollshow';
|
|
246
|
+
/** `PayrollShowBenefits` entity from the Gusto Embedded API. */
|
|
247
|
+
export type { PayrollShowBenefits } from '@gusto/embedded-api/models/components/payrollshow';
|
|
248
|
+
/** `PayrollShowDeductions` entity from the Gusto Embedded API. */
|
|
249
|
+
export type { PayrollShowDeductions } from '@gusto/embedded-api/models/components/payrollshow';
|
|
250
|
+
/** `PayrollShowFixedCompensations` entity from the Gusto Embedded API. */
|
|
251
|
+
export type { PayrollShowFixedCompensations } from '@gusto/embedded-api/models/components/payrollshow';
|
|
252
|
+
/** `PayrollShowHourlyCompensations` entity from the Gusto Embedded API. */
|
|
253
|
+
export type { PayrollShowHourlyCompensations } from '@gusto/embedded-api/models/components/payrollshow';
|
|
254
|
+
/** `PayrollShowPaidTimeOff` entity from the Gusto Embedded API. */
|
|
255
|
+
export type { PayrollShowPaidTimeOff } from '@gusto/embedded-api/models/components/payrollshow';
|
|
256
|
+
/** `PayrollShowPaymentMethod` entity from the Gusto Embedded API. */
|
|
257
|
+
export { PayrollShowPaymentMethod } from '@gusto/embedded-api/models/components/payrollshow';
|
|
258
|
+
/** `PayrollShowReimbursements` entity from the Gusto Embedded API. */
|
|
259
|
+
export type { PayrollShowReimbursements } from '@gusto/embedded-api/models/components/payrollshow';
|
|
260
|
+
/** `PayrollShowState` entity from the Gusto Embedded API. */
|
|
261
|
+
export type { PayrollShowState } from '@gusto/embedded-api/models/components/payrollshow';
|
|
262
|
+
/** `PayrollShowTaxes` entity from the Gusto Embedded API. */
|
|
263
|
+
export type { PayrollShowTaxes } from '@gusto/embedded-api/models/components/payrollshow';
|
|
264
|
+
/** `PayrollWithholdingPayPeriodType` entity from the Gusto Embedded API. */
|
|
265
|
+
export { PayrollWithholdingPayPeriodType } from '@gusto/embedded-api/models/components/payrollshow';
|
|
266
|
+
export type { PayrollPrepared, PayrollShowCustomWithholdings, PayrollShowFederal, } from '@gusto/embedded-api/models/components/payrollshow';
|
|
267
|
+
export { PayrollShowAmountType, PayrollShowEmployeeCompensationsAmountType, PayrollShowEmployeeCompensationsCustomWithholdingsAmountType, PayrollShowEmployeeCompensationsOverrideType, PayrollShowOverrideType, } from '@gusto/embedded-api/models/components/payrollshow';
|
|
260
268
|
/** `UnblockOptions` entity from the Gusto Embedded API. */
|
|
261
269
|
export type { UnblockOptions } from '@gusto/embedded-api/models/components/payrollsubmissionblockertype';
|
|
262
270
|
export type { PayrollSubmissionBlockerType } from '@gusto/embedded-api/models/components/payrollsubmissionblockertype';
|
|
@@ -270,29 +278,31 @@ export type { PayrollUpdateEmployeeCompensations } from '@gusto/embedded-api/mod
|
|
|
270
278
|
export type { PayrollUpdatePaidTimeOff } from '@gusto/embedded-api/models/components/payrollupdate';
|
|
271
279
|
/** `PayrollUpdateReimbursements` entity from the Gusto Embedded API. */
|
|
272
280
|
export type { PayrollUpdateReimbursements } from '@gusto/embedded-api/models/components/payrollupdate';
|
|
273
|
-
|
|
274
|
-
export {
|
|
281
|
+
/** `PayrollUpdateState` entity from the Gusto Embedded API. */
|
|
282
|
+
export type { PayrollUpdateState } from '@gusto/embedded-api/models/components/payrollupdate';
|
|
283
|
+
export type { PayrollUpdateCustomWithholdings, PayrollUpdateDeductions, PayrollUpdateFederal, PayrollUpdateFixedCompensations, PayrollUpdateHourlyCompensations, } from '@gusto/embedded-api/models/components/payrollupdate';
|
|
284
|
+
export { PayrollUpdateAmountType, PayrollUpdateEmployeeCompensationsAmountType, PayrollUpdateEmployeeCompensationsCustomWithholdingsAmountType, PayrollUpdateEmployeeCompensationsOverrideType, PayrollUpdateOverrideType, PayrollUpdatePaymentMethod, } from '@gusto/embedded-api/models/components/payrollupdate';
|
|
275
285
|
export type { PayScheduleAutoPayrollEnablementBlocker, PayScheduleAutoPayrollEnablementBlockerMetadata, } from '@gusto/embedded-api/models/components/payscheduleautopayrollenablementblocker';
|
|
276
286
|
export { PayScheduleFrequency } from '@gusto/embedded-api/models/components/payschedulefrequency';
|
|
277
287
|
export type { PaySchedulePreviewPayPeriod } from '@gusto/embedded-api/models/components/payschedulepreviewpayperiod';
|
|
278
288
|
export type { PayScheduleShow } from '@gusto/embedded-api/models/components/payscheduleshow';
|
|
279
289
|
export type { RecoveryCase } from '@gusto/embedded-api/models/components/recoverycase';
|
|
280
290
|
export { RecoveryCaseStatus } from '@gusto/embedded-api/models/components/recoverycase';
|
|
281
|
-
/** `HomeAddress` entity from the Gusto Embedded API. */
|
|
282
|
-
export type { HomeAddress } from '@gusto/embedded-api/models/components/signatory';
|
|
283
291
|
/** `IdentityVerificationStatus` entity from the Gusto Embedded API. */
|
|
284
292
|
export { IdentityVerificationStatus } from '@gusto/embedded-api/models/components/signatory';
|
|
293
|
+
/** `SignatoryHomeAddress` entity from the Gusto Embedded API. */
|
|
294
|
+
export type { SignatoryHomeAddress } from '@gusto/embedded-api/models/components/signatory';
|
|
285
295
|
export type { Signatory } from '@gusto/embedded-api/models/components/signatory';
|
|
286
296
|
/** `ApplicableIf` entity from the Gusto Embedded API. */
|
|
287
297
|
export type { ApplicableIf } from '@gusto/embedded-api/models/components/taxrequirement';
|
|
288
298
|
/** `TaxRequirement` entity from the Gusto Embedded API. */
|
|
289
299
|
export type { TaxRequirement } from '@gusto/embedded-api/models/components/taxrequirement';
|
|
300
|
+
/** `Options` entity from the Gusto Embedded API. */
|
|
301
|
+
export type { Options } from '@gusto/embedded-api/models/components/taxrequirementmetadata';
|
|
290
302
|
/** `TaxRequirementMetadata` entity from the Gusto Embedded API. */
|
|
291
303
|
export type { TaxRequirementMetadata } from '@gusto/embedded-api/models/components/taxrequirementmetadata';
|
|
292
|
-
/** `TaxRequirementMetadataOptions` entity from the Gusto Embedded API. */
|
|
293
|
-
export type { TaxRequirementMetadataOptions } from '@gusto/embedded-api/models/components/taxrequirementmetadata';
|
|
294
304
|
export type { Validation } from '@gusto/embedded-api/models/components/taxrequirementmetadata';
|
|
295
|
-
export { RateType, TaxRequirementMetadataType,
|
|
305
|
+
export { RateType, TaxRequirementMetadataType, Type, } from '@gusto/embedded-api/models/components/taxrequirementmetadata';
|
|
296
306
|
/** `TaxRequirementSet` entity from the Gusto Embedded API. */
|
|
297
307
|
export type { TaxRequirementSet } from '@gusto/embedded-api/models/components/taxrequirementset';
|
|
298
308
|
/** `TaxRequirementsState` entity from the Gusto Embedded API. */
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
2
|
import { HookErrorHandling } from './types';
|
|
3
3
|
import { SDKError } from '../types/sdkError';
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* The subset of a TanStack Query result — its `error` and `refetch` — that
|
|
6
|
+
* {@link composeErrorHandler} reads from an additional query passed as a source.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export type QueryWithRefetch = Pick<UseQueryResult, 'error' | 'refetch'>;
|
|
5
11
|
/**
|
|
6
12
|
* Submit-side error state to merge into a composed {@link HookErrorHandling}.
|
|
7
13
|
*
|
|
@@ -32,7 +38,7 @@ export type MixedErrorSource = QueryWithRefetch | {
|
|
|
32
38
|
* Merges multiple error sources into a single {@link HookErrorHandling}.
|
|
33
39
|
*
|
|
34
40
|
* @remarks
|
|
35
|
-
* Accepts any mix of `@gusto/embedded-api-v-2026-
|
|
41
|
+
* Accepts any mix of `@gusto/embedded-api-v-2026-06-15` React Query results and SDK hook
|
|
36
42
|
* results that already expose an `errorHandling` object (including the value returned by
|
|
37
43
|
* {@link composeSubmitHandler}). Query errors are normalized to `SDKError`, nested hook
|
|
38
44
|
* errors are flattened in, and an optional submit-state argument adds a submit error to
|
|
@@ -54,7 +60,7 @@ export type MixedErrorSource = QueryWithRefetch | {
|
|
|
54
60
|
* @example
|
|
55
61
|
* ```tsx
|
|
56
62
|
* import { composeErrorHandler, useEmployeeDetailsForm } from '@gusto/embedded-react-sdk'
|
|
57
|
-
* import { useEmployeeFormsList } from '@gusto/embedded-api-v-2026-
|
|
63
|
+
* import { useEmployeeFormsList } from '@gusto/embedded-api-v-2026-06-15/react-query/employeeFormsList'
|
|
58
64
|
*
|
|
59
65
|
* function EmployeeProfileView({ companyId, employeeId }: { companyId: string; employeeId: string }) {
|
|
60
66
|
* const employeeDetails = useEmployeeDetailsForm({ companyId, employeeId })
|
|
@@ -78,4 +84,3 @@ export type MixedErrorSource = QueryWithRefetch | {
|
|
|
78
84
|
* ```
|
|
79
85
|
*/
|
|
80
86
|
export declare function composeErrorHandler(sources: MixedErrorSource[], submitState?: SubmitStateForErrorHandling): HookErrorHandling;
|
|
81
|
-
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeErrorHandler.js","sources":["../../src/partner-hook-utils/composeErrorHandler.ts"],"sourcesContent":["import type { UseQueryResult } from '@tanstack/react-query'\nimport { collectErrors } from './collectErrors'\nimport type { HookErrorHandling } from './types'\nimport type { SDKError } from '@/types/sdkError'\n\
|
|
1
|
+
{"version":3,"file":"composeErrorHandler.js","sources":["../../src/partner-hook-utils/composeErrorHandler.ts"],"sourcesContent":["import type { UseQueryResult } from '@tanstack/react-query'\nimport { collectErrors } from './collectErrors'\nimport type { HookErrorHandling } from './types'\nimport type { SDKError } from '@/types/sdkError'\n\n/**\n * The subset of a TanStack Query result — its `error` and `refetch` — that\n * {@link composeErrorHandler} reads from an additional query passed as a source.\n *\n * @public\n */\nexport type QueryWithRefetch = Pick<UseQueryResult, 'error' | 'refetch'>\n\n/**\n * Submit-side error state to merge into a composed {@link HookErrorHandling}.\n *\n * @remarks\n * Pass to {@link composeErrorHandler} when a screen has its own submit state outside of\n * any SDK form hook, so submit errors appear in the same error surface as query errors\n * and can be cleared together with `clearSubmitError`.\n *\n * @public\n */\nexport type SubmitStateForErrorHandling = {\n /** The current submit error, or `null` when cleared. */\n submitError: SDKError | null\n /** Sets or clears the submit error. */\n setSubmitError: (error: SDKError | null) => void\n}\n\n/**\n * Accepted input shape for {@link composeErrorHandler}: either a React Query result\n * (anything with `error` and `refetch`) or another SDK hook result that exposes\n * an `errorHandling` object.\n *\n * @public\n */\nexport type MixedErrorSource = QueryWithRefetch | { errorHandling: HookErrorHandling }\n\nfunction isHookResultWithErrorHandling(\n source: MixedErrorSource,\n): source is { errorHandling: HookErrorHandling } {\n return 'errorHandling' in source\n}\n\n/**\n * Merges multiple error sources into a single {@link HookErrorHandling}.\n *\n * @remarks\n * Accepts any mix of `@gusto/embedded-api-v-2026-06-15` React Query results and SDK hook\n * results that already expose an `errorHandling` object (including the value returned by\n * {@link composeSubmitHandler}). Query errors are normalized to `SDKError`, nested hook\n * errors are flattened in, and an optional submit-state argument adds a submit error to\n * the same list.\n *\n * The returned `retryQueries` refetches every failed query and delegates into each nested\n * hook so their retries fire too. `clearSubmitError` clears the optional submit state and\n * delegates into each nested hook.\n *\n * Pairs with {@link composeSubmitHandler} by name only — this composes error state and\n * recovery, not a submit callback.\n *\n * @param sources - Error sources to merge. Each entry is either a React Query result or\n * an object with an `errorHandling` property.\n * @param submitState - Optional screen-level submit state to fold into the result.\n * @returns A single `HookErrorHandling` covering every source.\n * @public\n *\n * @example\n * ```tsx\n * import { composeErrorHandler, useEmployeeDetailsForm } from '@gusto/embedded-react-sdk'\n * import { useEmployeeFormsList } from '@gusto/embedded-api-v-2026-06-15/react-query/employeeFormsList'\n *\n * function EmployeeProfileView({ companyId, employeeId }: { companyId: string; employeeId: string }) {\n * const employeeDetails = useEmployeeDetailsForm({ companyId, employeeId })\n * const formsListQuery = useEmployeeFormsList({ employeeId })\n *\n * const errorHandling = composeErrorHandler([employeeDetails, formsListQuery])\n *\n * if (errorHandling.errors.length > 0) {\n * return (\n * <div role=\"alert\">\n * {errorHandling.errors.map((error, i) => (\n * <p key={i}>{error.message}</p>\n * ))}\n * <button onClick={errorHandling.retryQueries}>Retry</button>\n * </div>\n * )\n * }\n *\n * return null\n * }\n * ```\n */\nexport function composeErrorHandler(\n sources: MixedErrorSource[],\n submitState?: SubmitStateForErrorHandling,\n): HookErrorHandling {\n const queries: QueryWithRefetch[] = []\n const errorHandlingsFromNestedHooks: HookErrorHandling[] = []\n\n for (const source of sources) {\n if (isHookResultWithErrorHandling(source)) {\n errorHandlingsFromNestedHooks.push(source.errorHandling)\n } else {\n queries.push(source)\n }\n }\n\n const nestedErrors = errorHandlingsFromNestedHooks.flatMap(handling => handling.errors)\n\n let errors: SDKError[]\n if (errorHandlingsFromNestedHooks.length === 0) {\n errors = collectErrors(queries, submitState?.submitError ?? null)\n } else {\n const standaloneQueryErrors = collectErrors(queries, null)\n errors = [...nestedErrors, ...standaloneQueryErrors]\n if (submitState?.submitError) {\n errors.push(submitState.submitError)\n }\n }\n\n const retryQueries = () => {\n for (const handling of errorHandlingsFromNestedHooks) {\n handling.retryQueries()\n }\n queries.filter(q => q.error != null).forEach(q => void q.refetch())\n }\n\n const clearSubmitError = () => {\n for (const handling of errorHandlingsFromNestedHooks) {\n handling.clearSubmitError()\n }\n submitState?.setSubmitError(null)\n }\n\n return { errors, retryQueries, clearSubmitError }\n}\n"],"names":["isHookResultWithErrorHandling","source","composeErrorHandler","sources","submitState","queries","errorHandlingsFromNestedHooks","nestedErrors","handling","errors","collectErrors","standaloneQueryErrors","q"],"mappings":";AAuCA,SAASA,EACPC,GACgD;AAChD,SAAO,mBAAmBA;AAC5B;AAmDO,SAASC,EACdC,GACAC,GACmB;AACnB,QAAMC,IAA8B,CAAA,GAC9BC,IAAqD,CAAA;AAE3D,aAAWL,KAAUE;AACnB,IAAIH,EAA8BC,CAAM,IACtCK,EAA8B,KAAKL,EAAO,aAAa,IAEvDI,EAAQ,KAAKJ,CAAM;AAIvB,QAAMM,IAAeD,EAA8B,QAAQ,CAAAE,MAAYA,EAAS,MAAM;AAEtF,MAAIC;AACJ,MAAIH,EAA8B,WAAW;AAC3C,IAAAG,IAASC,EAAcL,GAASD,GAAa,eAAe,IAAI;AAAA,OAC3D;AACL,UAAMO,IAAwBD,EAAcL,GAAS,IAAI;AACzD,IAAAI,IAAS,CAAC,GAAGF,GAAc,GAAGI,CAAqB,GAC/CP,GAAa,eACfK,EAAO,KAAKL,EAAY,WAAW;AAAA,EAEvC;AAgBA,SAAO,EAAE,QAAAK,GAAQ,cAdI,MAAM;AACzB,eAAWD,KAAYF;AACrB,MAAAE,EAAS,aAAA;AAEX,IAAAH,EAAQ,OAAO,CAAAO,MAAKA,EAAE,SAAS,IAAI,EAAE,QAAQ,CAAAA,MAAA;AAAK,MAAKA,EAAE,QAAA;AAAA,KAAS;AAAA,EACpE,GAS+B,kBAPN,MAAM;AAC7B,eAAWJ,KAAYF;AACrB,MAAAE,EAAS,iBAAA;AAEX,IAAAJ,GAAa,eAAe,IAAI;AAAA,EAClC,EAE+B;AACjC;"}
|
|
@@ -2,9 +2,17 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { FieldValues } from 'react-hook-form';
|
|
3
3
|
import { FieldMetadata, FieldMetadataWithOptions, HookFormInternals } from '../types';
|
|
4
4
|
import { SDKError } from '../../types/sdkError';
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Props for {@link SDKFormProvider}.
|
|
7
|
+
*
|
|
8
|
+
* @typeParam TFormData - Shape of the form values managed by the wrapped form hook.
|
|
9
|
+
* @typeParam TFieldsMetadata - The form hook's field-metadata map.
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export interface SDKFormProviderProps<TFormData extends FieldValues = FieldValues, TFieldsMetadata extends {
|
|
6
13
|
[K in keyof TFieldsMetadata]: FieldMetadata | FieldMetadataWithOptions;
|
|
7
14
|
} = Record<string, FieldMetadata | FieldMetadataWithOptions>> {
|
|
15
|
+
/** The form hook result whose fields, metadata, and errors are shared with descendant field components. */
|
|
8
16
|
formHookResult: {
|
|
9
17
|
errorHandling: {
|
|
10
18
|
errors: SDKError[];
|
|
@@ -14,6 +22,7 @@ interface SDKFormProviderProps<TFormData extends FieldValues = FieldValues, TFie
|
|
|
14
22
|
hookFormInternals: HookFormInternals<TFormData>;
|
|
15
23
|
};
|
|
16
24
|
};
|
|
25
|
+
/** Field components (or any content) that consume the provided form context. */
|
|
17
26
|
children: ReactNode;
|
|
18
27
|
}
|
|
19
28
|
/**
|
|
@@ -47,4 +56,3 @@ interface SDKFormProviderProps<TFormData extends FieldValues = FieldValues, TFie
|
|
|
47
56
|
export declare function SDKFormProvider<TFormData extends FieldValues = FieldValues, TFieldsMetadata extends {
|
|
48
57
|
[K in keyof TFieldsMetadata]: FieldMetadata | FieldMetadataWithOptions;
|
|
49
58
|
} = Record<string, FieldMetadata | FieldMetadataWithOptions>>({ formHookResult, children }: SDKFormProviderProps<TFormData, TFieldsMetadata>): import("react").JSX.Element;
|
|
50
|
-
export {};
|
|
@@ -20,7 +20,13 @@ function F(o, t) {
|
|
|
20
20
|
}
|
|
21
21
|
function M({ formHookResult: o, children: t }) {
|
|
22
22
|
const { errorHandling: e, form: r } = o, i = e.errors.flatMap((s) => s.fieldErrors);
|
|
23
|
-
return F(i, r), /* @__PURE__ */ n(l, { metadata: r.fieldsMetadata, errors: e.errors, children: /* @__PURE__ */ n(
|
|
23
|
+
return F(i, r), /* @__PURE__ */ n(l, { metadata: r.fieldsMetadata, errors: e.errors, children: /* @__PURE__ */ n(
|
|
24
|
+
f,
|
|
25
|
+
{
|
|
26
|
+
registry: r.hookFormInternals._fieldElementRegistry,
|
|
27
|
+
children: /* @__PURE__ */ n(d, { ...r.hookFormInternals.formMethods, children: t })
|
|
28
|
+
}
|
|
29
|
+
) });
|
|
24
30
|
}
|
|
25
31
|
export {
|
|
26
32
|
M as SDKFormProvider
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SDKFormProvider.js","sources":["../../../src/partner-hook-utils/form/SDKFormProvider.tsx"],"sourcesContent":["import { type ReactNode, useEffect } from 'react'\nimport type { FieldPath, FieldValues } from 'react-hook-form'\nimport { FormProvider } from 'react-hook-form'\nimport type { FieldMetadata, FieldMetadataWithOptions, HookFormInternals } from '../types'\nimport { FormFieldsMetadataProvider } from './FormFieldsMetadataProvider'\nimport { FieldElementRegistryProvider } from '@/components/Common/Fields/hooks/FieldElementRegistryProvider'\nimport { normalizeErrorKeyForForm } from '@/helpers/formattedStrings'\nimport type { SDKError, SDKFieldError } from '@/types/sdkError'\n\nfunction useSyncFieldErrors<\n TFormData extends FieldValues,\n TFieldsMetadata extends {\n [K in keyof TFieldsMetadata]: FieldMetadata | FieldMetadataWithOptions\n },\n>(\n fieldErrors: SDKFieldError[],\n form: {\n fieldsMetadata: TFieldsMetadata\n hookFormInternals: HookFormInternals<TFormData>\n },\n) {\n const { fieldsMetadata } = form\n const { setError } = form.hookFormInternals.formMethods\n\n useEffect(() => {\n if (!fieldErrors.length) return\n const knownFields = new Set(Object.keys(fieldsMetadata))\n for (const fieldError of fieldErrors) {\n const normalizedField = normalizeErrorKeyForForm(fieldError.field)\n if (knownFields.has(normalizedField)) {\n setError(normalizedField as FieldPath<TFormData>, {\n type: 'custom',\n message: fieldError.message,\n })\n }\n }\n }, [fieldErrors, setError, fieldsMetadata])\n}\n\
|
|
1
|
+
{"version":3,"file":"SDKFormProvider.js","sources":["../../../src/partner-hook-utils/form/SDKFormProvider.tsx"],"sourcesContent":["import { type ReactNode, useEffect } from 'react'\nimport type { FieldPath, FieldValues } from 'react-hook-form'\nimport { FormProvider } from 'react-hook-form'\nimport type { FieldMetadata, FieldMetadataWithOptions, HookFormInternals } from '../types'\nimport { FormFieldsMetadataProvider } from './FormFieldsMetadataProvider'\nimport { FieldElementRegistryProvider } from '@/components/Common/Fields/hooks/FieldElementRegistryProvider'\nimport type { FieldElementRegistry } from '@/components/Common/Fields/hooks/fieldElementRegistry'\nimport { normalizeErrorKeyForForm } from '@/helpers/formattedStrings'\nimport type { SDKError, SDKFieldError } from '@/types/sdkError'\n\nfunction useSyncFieldErrors<\n TFormData extends FieldValues,\n TFieldsMetadata extends {\n [K in keyof TFieldsMetadata]: FieldMetadata | FieldMetadataWithOptions\n },\n>(\n fieldErrors: SDKFieldError[],\n form: {\n fieldsMetadata: TFieldsMetadata\n hookFormInternals: HookFormInternals<TFormData>\n },\n) {\n const { fieldsMetadata } = form\n const { setError } = form.hookFormInternals.formMethods\n\n useEffect(() => {\n if (!fieldErrors.length) return\n const knownFields = new Set(Object.keys(fieldsMetadata))\n for (const fieldError of fieldErrors) {\n const normalizedField = normalizeErrorKeyForForm(fieldError.field)\n if (knownFields.has(normalizedField)) {\n setError(normalizedField as FieldPath<TFormData>, {\n type: 'custom',\n message: fieldError.message,\n })\n }\n }\n }, [fieldErrors, setError, fieldsMetadata])\n}\n\n/**\n * Props for {@link SDKFormProvider}.\n *\n * @typeParam TFormData - Shape of the form values managed by the wrapped form hook.\n * @typeParam TFieldsMetadata - The form hook's field-metadata map.\n * @public\n */\nexport interface SDKFormProviderProps<\n TFormData extends FieldValues = FieldValues,\n TFieldsMetadata extends {\n [K in keyof TFieldsMetadata]: FieldMetadata | FieldMetadataWithOptions\n } = Record<string, FieldMetadata | FieldMetadataWithOptions>,\n> {\n /** The form hook result whose fields, metadata, and errors are shared with descendant field components. */\n formHookResult: {\n errorHandling: { errors: SDKError[] }\n form: {\n fieldsMetadata: TFieldsMetadata\n hookFormInternals: HookFormInternals<TFormData>\n }\n }\n /** Field components (or any content) that consume the provided form context. */\n children: ReactNode\n}\n\n/**\n * Provides form context to field components so they can read metadata, control,\n * and error state without an explicit `formHookResult` prop on each field.\n * Server-side field errors are automatically synced onto their corresponding fields.\n *\n * @public\n *\n * @example\n * ```tsx\n * const formHookResult = useEmployeeDetailsForm({ employeeId })\n * const { Fields } = formHookResult.form\n *\n * // SDKFormProvider supplies context only — wire up submission and render the\n * // <form> element yourself.\n * const handleSubmit = () =>\n * formHookResult.actions.onSubmit({ onEmployeeUpdated: (emp) => { ... } })\n *\n * return (\n * <SDKFormProvider formHookResult={formHookResult}>\n * <form onSubmit={handleSubmit}>\n * <Fields.FirstName label=\"First name\" />\n * <Fields.LastName label=\"Last name\" />\n * <button type=\"submit\">Save</button>\n * </form>\n * </SDKFormProvider>\n * )\n * ```\n */\nexport function SDKFormProvider<\n TFormData extends FieldValues = FieldValues,\n TFieldsMetadata extends {\n [K in keyof TFieldsMetadata]: FieldMetadata | FieldMetadataWithOptions\n } = Record<string, FieldMetadata | FieldMetadataWithOptions>,\n>({ formHookResult, children }: SDKFormProviderProps<TFormData, TFieldsMetadata>) {\n const { errorHandling, form } = formHookResult\n const allFieldErrors = errorHandling.errors.flatMap(e => e.fieldErrors)\n useSyncFieldErrors(allFieldErrors, form)\n\n return (\n <FormFieldsMetadataProvider metadata={form.fieldsMetadata} errors={errorHandling.errors}>\n <FieldElementRegistryProvider\n registry={form.hookFormInternals._fieldElementRegistry as FieldElementRegistry | undefined}\n >\n <FormProvider {...form.hookFormInternals.formMethods}>{children}</FormProvider>\n </FieldElementRegistryProvider>\n </FormFieldsMetadataProvider>\n )\n}\n"],"names":["useSyncFieldErrors","fieldErrors","form","fieldsMetadata","setError","useEffect","knownFields","fieldError","normalizedField","normalizeErrorKeyForForm","SDKFormProvider","formHookResult","children","errorHandling","allFieldErrors","e","FormFieldsMetadataProvider","jsx","FieldElementRegistryProvider","FormProvider"],"mappings":";;;;;;AAUA,SAASA,EAMPC,GACAC,GAIA;AACA,QAAM,EAAE,gBAAAC,MAAmBD,GACrB,EAAE,UAAAE,EAAA,IAAaF,EAAK,kBAAkB;AAE5C,EAAAG,EAAU,MAAM;AACd,QAAI,CAACJ,EAAY,OAAQ;AACzB,UAAMK,IAAc,IAAI,IAAI,OAAO,KAAKH,CAAc,CAAC;AACvD,eAAWI,KAAcN,GAAa;AACpC,YAAMO,IAAkBC,EAAyBF,EAAW,KAAK;AACjE,MAAID,EAAY,IAAIE,CAAe,KACjCJ,EAASI,GAAyC;AAAA,QAChD,MAAM;AAAA,QACN,SAASD,EAAW;AAAA,MAAA,CACrB;AAAA,IAEL;AAAA,EACF,GAAG,CAACN,GAAaG,GAAUD,CAAc,CAAC;AAC5C;AAuDO,SAASO,EAKd,EAAE,gBAAAC,GAAgB,UAAAC,KAA8D;AAChF,QAAM,EAAE,eAAAC,GAAe,MAAAX,EAAA,IAASS,GAC1BG,IAAiBD,EAAc,OAAO,QAAQ,CAAAE,MAAKA,EAAE,WAAW;AACtE,SAAAf,EAAmBc,GAAgBZ,CAAI,qBAGpCc,GAAA,EAA2B,UAAUd,EAAK,gBAAgB,QAAQW,EAAc,QAC/E,UAAA,gBAAAI;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,UAAUhB,EAAK,kBAAkB;AAAA,MAEjC,4BAACiB,GAAA,EAAc,GAAGjB,EAAK,kBAAkB,aAAc,UAAAU,EAAA,CAAS;AAAA,IAAA;AAAA,EAAA,GAEpE;AAEJ;"}
|
|
@@ -10,8 +10,11 @@ import { HookErrorHandling, HookFormInternals } from '../types';
|
|
|
10
10
|
* allowing hooks with specific form data generics to be passed without casts.
|
|
11
11
|
* `_fieldElementRegistry` is reused directly since its type doesn't depend on
|
|
12
12
|
* the form's generic.
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
13
15
|
*/
|
|
14
|
-
interface ComposableFormHookResult {
|
|
16
|
+
export interface ComposableFormHookResult {
|
|
17
|
+
/** The form surface: the react-hook-form internals used to validate and focus fields. */
|
|
15
18
|
form: {
|
|
16
19
|
hookFormInternals: Pick<HookFormInternals, '_fieldElementRegistry'> & {
|
|
17
20
|
formMethods: {
|
|
@@ -23,6 +26,7 @@ interface ComposableFormHookResult {
|
|
|
23
26
|
};
|
|
24
27
|
};
|
|
25
28
|
};
|
|
29
|
+
/** The error-handling surface aggregated across the composed forms. */
|
|
26
30
|
errorHandling: HookErrorHandling;
|
|
27
31
|
}
|
|
28
32
|
/**
|
|
@@ -35,7 +39,7 @@ interface ComposableFormHookResult {
|
|
|
35
39
|
* but no `errorHandling` (fields surface their own inline errors via react-hook-form).
|
|
36
40
|
*
|
|
37
41
|
* @typeParam T - The shape of the form values when a raw `UseFormReturn` is passed.
|
|
38
|
-
* @
|
|
42
|
+
* @public
|
|
39
43
|
*/
|
|
40
44
|
export type ComposeSubmitInput<T extends FieldValues = FieldValues> = ComposableFormHookResult | UseFormReturn<T>;
|
|
41
45
|
/**
|
|
@@ -68,7 +72,7 @@ export interface ComposeSubmitHandlerResult {
|
|
|
68
72
|
*
|
|
69
73
|
* The returned `errorHandling` is the same shape every SDK hook returns, so the whole result
|
|
70
74
|
* can be passed back into {@link composeErrorHandler} when you need to add extra
|
|
71
|
-
* `@gusto/embedded-api-v-2026-
|
|
75
|
+
* `@gusto/embedded-api-v-2026-06-15` queries or screen-level submit state.
|
|
72
76
|
*
|
|
73
77
|
* @typeParam TForms - Tuple of form value shapes, one per slot of `forms`.
|
|
74
78
|
* @param forms - Form hook results and/or raw `UseFormReturn` instances to coordinate.
|
|
@@ -95,4 +99,3 @@ export interface ComposeSubmitHandlerResult {
|
|
|
95
99
|
export declare function composeSubmitHandler<TForms extends readonly FieldValues[]>(forms: readonly [...{
|
|
96
100
|
[K in keyof TForms]: ComposeSubmitInput<TForms[K]>;
|
|
97
101
|
}], onAllValid: () => Promise<void>): ComposeSubmitHandlerResult;
|
|
98
|
-
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composeSubmitHandler.js","sources":["../../../src/partner-hook-utils/form/composeSubmitHandler.ts"],"sourcesContent":["import type { SyntheticEvent } from 'react'\nimport type { FieldValues, UseFormReturn } from 'react-hook-form'\nimport { composeErrorHandler } from '../composeErrorHandler'\nimport type { HookErrorHandling, HookFormInternals } from '../types'\n\n/**\n * Minimal shape required for a form hook result to participate in `composeSubmitHandler`.\n * Any hook returning `BaseFormHookReady` satisfies this interface.\n *\n * `formMethods` is declared with method-call syntax (rather than reused from\n * `HookFormInternals`) so TypeScript applies bivariant parameter checking,\n * allowing hooks with specific form data generics to be passed without casts.\n * `_fieldElementRegistry` is reused directly since its type doesn't depend on\n * the form's generic.\n */\ninterface ComposableFormHookResult {\n form: {\n hookFormInternals: Pick<HookFormInternals, '_fieldElementRegistry'> & {\n formMethods: {\n handleSubmit(\n onValid: () => void,\n onInvalid?: (errors: Record<string, unknown>) => void,\n ): () => Promise<void>\n setFocus(name: string): void\n formState: { errors: Record<string, unknown> }\n }\n }\n }\n errorHandling: HookErrorHandling\n}\n\n/**\n * Accepted input for a single slot of `composeSubmitHandler`'s `forms` array.\n *\n * @remarks\n * - SDK form hook results (anything matching `ComposableFormHookResult`) are composed directly.\n * - A raw `react-hook-form` `UseFormReturn<T>` is supported for screen-local auxiliary forms\n * that don't warrant a dedicated SDK hook. Raw forms contribute validation/focus behavior\n * but no `errorHandling` (fields surface their own inline errors via react-hook-form).\n *\n * @typeParam T - The shape of the form values when a raw `UseFormReturn` is passed.\n * @internal\n */\nexport type ComposeSubmitInput<T extends FieldValues = FieldValues> =\n ComposableFormHookResult | UseFormReturn<T>\n\ninterface FormValidationResult {\n input: ComposeSubmitInput\n formMethods: FormMethods\n valid: boolean\n errors: Record<string, unknown>\n}\n\n/**\n * Result returned by {@link composeSubmitHandler}: a single submit handler that\n * coordinates validation across the composed forms, and aggregated error state.\n *\n * @public\n */\nexport interface ComposeSubmitHandlerResult {\n /** Submit handler to pass to a form's `onSubmit`. Validates all composed forms before calling `onAllValid`. */\n handleSubmit: (e: SyntheticEvent) => Promise<void>\n /** Aggregated error state across all composed SDK form hooks. Pass to {@link composeErrorHandler} for screen-level error surfaces. */\n errorHandling: HookErrorHandling\n}\n\ntype FormMethods = ComposableFormHookResult['form']['hookFormInternals']['formMethods']\n\nfunction isRawUseForm<T extends FieldValues>(\n input: ComposeSubmitInput<T>,\n): input is UseFormReturn<T> {\n return 'handleSubmit' in input && typeof input.handleSubmit === 'function'\n}\n\nfunction extractFormMethods<T extends FieldValues>(input: ComposeSubmitInput<T>): FormMethods {\n if (isRawUseForm(input)) return input as unknown as FormMethods\n return input.form.hookFormInternals.formMethods\n}\n\n/**\n * Picks the visually first invalid field across all composed forms using live\n * `getBoundingClientRect()` positions, then focuses its DOM element. Falls back\n * to array-order (first form's first error) when no element can be resolved —\n * raw `UseFormReturn` inputs have no registry, and forms rendered without\n * `SDKFormProvider` or a HookField wrapper won't have their fields registered\n * either, so we let react-hook-form's `setFocus` attempt it instead.\n *\n * Consumes `results` (captured from each form's `onInvalid` callback) rather\n * than reading `formState.errors` — the latter is a proxy that returns `{}`\n * when accessed outside a component subscription.\n */\nfunction focusFirstInvalidAcrossForms(results: FormValidationResult[]): void {\n type Candidate = {\n formMethods: FormMethods\n name: string\n element: HTMLElement\n }\n const candidates: Candidate[] = []\n for (const { input, formMethods, errors } of results) {\n if (isRawUseForm(input)) continue\n const registry = input.form.hookFormInternals._fieldElementRegistry\n if (!registry) continue\n for (const name of Object.keys(errors)) {\n const element = registry.get(name)\n if (element) {\n candidates.push({ formMethods, name, element })\n }\n }\n }\n\n if (candidates.length > 0) {\n candidates.sort((a, b) => {\n const ar = a.element.getBoundingClientRect()\n const br = b.element.getBoundingClientRect()\n return ar.top - br.top || ar.left - br.left\n })\n const winner = candidates[0]!\n // Focus the DOM element directly. Bypasses react-hook-form's `setFocus`,\n // which depends on `_fields[name]._f.ref` and isn't reliably populated\n // when fields are rendered through libraries like react-aria-components.\n winner.element.focus()\n return\n }\n\n for (const { formMethods, errors } of results) {\n const firstErrorField = Object.keys(errors)[0]\n if (firstErrorField) {\n formMethods.setFocus(firstErrorField)\n return\n }\n }\n}\n\n/**\n * Coordinates validation and submission across multiple form hooks on the same page.\n *\n * @remarks\n * Validates all forms simultaneously via `handleSubmit()`, then focuses the visually first\n * invalid field across all forms (sorted by `getBoundingClientRect()`). Only calls\n * `onAllValid` when every form passes.\n *\n * Uses `handleSubmit` rather than `trigger` so that react-hook-form sets\n * `formState.isSubmitted = true`, which enables `reValidateMode` (default: `onChange`).\n * Without this, errors set by manual `trigger()` calls would never clear as the user types.\n *\n * Each hook passed to `forms` should be initialized with `shouldFocusError: false` so that\n * react-hook-form's built-in per-form focus is disabled and `composeSubmitHandler` can manage\n * cross-form focus instead.\n *\n * The returned `errorHandling` is the same shape every SDK hook returns, so the whole result\n * can be passed back into {@link composeErrorHandler} when you need to add extra\n * `@gusto/embedded-api-v-2026-02-01` queries or screen-level submit state.\n *\n * @typeParam TForms - Tuple of form value shapes, one per slot of `forms`.\n * @param forms - Form hook results and/or raw `UseFormReturn` instances to coordinate.\n * @param onAllValid - Async callback invoked once every form has passed validation.\n * @returns A {@link ComposeSubmitHandlerResult} with a unified `handleSubmit` and aggregated `errorHandling`.\n * @public\n *\n * @example\n * ```tsx\n * const detailsForm = useEmployeeDetailsForm({ employeeId, shouldFocusError: false })\n * const addressForm = useHomeAddressForm({ employeeId, shouldFocusError: false })\n *\n * const { handleSubmit, errorHandling } = composeSubmitHandler(\n * [detailsForm, addressForm],\n * async () => {\n * await detailsForm.actions.onSubmit()\n * await addressForm.actions.onSubmit()\n * },\n * )\n *\n * return <form onSubmit={handleSubmit}>...</form>\n * ```\n */\nexport function composeSubmitHandler<TForms extends readonly FieldValues[]>(\n forms: readonly [...{ [K in keyof TForms]: ComposeSubmitInput<TForms[K]> }],\n onAllValid: () => Promise<void>,\n): ComposeSubmitHandlerResult {\n const errorSources = forms.filter((form): form is ComposableFormHookResult => !isRawUseForm(form))\n\n const handleSubmit = async (e: SyntheticEvent) => {\n e.preventDefault()\n\n const validationResults = await Promise.all(\n forms.map(\n input =>\n new Promise<FormValidationResult>(resolve => {\n const formMethods = extractFormMethods(input)\n void formMethods.handleSubmit(\n () => {\n resolve({ input, formMethods, valid: true, errors: {} })\n },\n errors => {\n resolve({ input, formMethods, valid: false, errors })\n },\n )()\n }),\n ),\n )\n\n const allValid = validationResults.every(r => r.valid)\n\n if (!allValid) {\n focusFirstInvalidAcrossForms(validationResults)\n return\n }\n\n await onAllValid()\n }\n\n const errorHandling = composeErrorHandler(errorSources)\n\n return { handleSubmit, errorHandling }\n}\n"],"names":["isRawUseForm","input","extractFormMethods","focusFirstInvalidAcrossForms","results","candidates","formMethods","errors","registry","name","element","a","b","ar","br","firstErrorField","composeSubmitHandler","forms","onAllValid","errorSources","form","handleSubmit","e","validationResults","resolve","r","errorHandling","composeErrorHandler"],"mappings":";AAoEA,SAASA,EACPC,GAC2B;AAC3B,SAAO,kBAAkBA,KAAS,OAAOA,EAAM,gBAAiB;AAClE;AAEA,SAASC,EAA0CD,GAA2C;AAC5F,SAAID,EAAaC,CAAK,IAAUA,IACzBA,EAAM,KAAK,kBAAkB;AACtC;AAcA,SAASE,EAA6BC,GAAuC;AAM3E,QAAMC,IAA0B,CAAA;AAChC,aAAW,EAAE,OAAAJ,GAAO,aAAAK,GAAa,QAAAC,EAAA,KAAYH,GAAS;AACpD,QAAIJ,EAAaC,CAAK,EAAG;AACzB,UAAMO,IAAWP,EAAM,KAAK,kBAAkB;AAC9C,QAAKO;AACL,iBAAWC,KAAQ,OAAO,KAAKF,CAAM,GAAG;AACtC,cAAMG,IAAUF,EAAS,IAAIC,CAAI;AACjC,QAAIC,KACFL,EAAW,KAAK,EAAE,aAAAC,GAAa,MAAAG,GAAM,SAAAC,GAAS;AAAA,MAElD;AAAA,EACF;AAEA,MAAIL,EAAW,SAAS,GAAG;AACzB,IAAAA,EAAW,KAAK,CAACM,GAAGC,MAAM;AACxB,YAAMC,IAAKF,EAAE,QAAQ,sBAAA,GACfG,IAAKF,EAAE,QAAQ,sBAAA;AACrB,aAAOC,EAAG,MAAMC,EAAG,OAAOD,EAAG,OAAOC,EAAG;AAAA,IACzC,CAAC,GACcT,EAAW,CAAC,EAIpB,QAAQ,MAAA;AACf;AAAA,EACF;AAEA,aAAW,EAAE,aAAAC,GAAa,QAAAC,EAAA,KAAYH,GAAS;AAC7C,UAAMW,IAAkB,OAAO,KAAKR,CAAM,EAAE,CAAC;AAC7C,QAAIQ,GAAiB;AACnB,MAAAT,EAAY,SAASS,CAAe;AACpC;AAAA,IACF;AAAA,EACF;AACF;AA4CO,SAASC,EACdC,GACAC,GAC4B;AAC5B,QAAMC,IAAeF,EAAM,OAAO,CAACG,MAA2C,CAACpB,EAAaoB,CAAI,CAAC,GAE3FC,IAAe,OAAOC,MAAsB;AAChD,IAAAA,EAAE,eAAA;AAEF,UAAMC,IAAoB,MAAM,QAAQ;AAAA,MACtCN,EAAM;AAAA,QACJ,CAAAhB,MACE,IAAI,QAA8B,CAAAuB,MAAW;AAC3C,gBAAMlB,IAAcJ,EAAmBD,CAAK;AAC5C,UAAKK,EAAY;AAAA,YACf,MAAM;AACJ,cAAAkB,EAAQ,EAAE,OAAAvB,GAAO,aAAAK,GAAa,OAAO,IAAM,QAAQ,CAAA,GAAI;AAAA,YACzD;AAAA,YACA,CAAAC,MAAU;AACR,cAAAiB,EAAQ,EAAE,OAAAvB,GAAO,aAAAK,GAAa,OAAO,IAAO,QAAAC,GAAQ;AAAA,YACtD;AAAA,UAAA,EACF;AAAA,QACF,CAAC;AAAA,MAAA;AAAA,IACL;AAKF,QAAI,CAFagB,EAAkB,MAAM,CAAAE,MAAKA,EAAE,KAAK,GAEtC;AACb,MAAAtB,EAA6BoB,CAAiB;AAC9C;AAAA,IACF;AAEA,UAAML,EAAA;AAAA,EACR,GAEMQ,IAAgBC,EAAoBR,CAAY;AAEtD,SAAO,EAAE,cAAAE,GAAc,eAAAK,EAAA;AACzB;"}
|
|
1
|
+
{"version":3,"file":"composeSubmitHandler.js","sources":["../../../src/partner-hook-utils/form/composeSubmitHandler.ts"],"sourcesContent":["import type { SyntheticEvent } from 'react'\nimport type { FieldValues, UseFormReturn } from 'react-hook-form'\nimport { composeErrorHandler } from '../composeErrorHandler'\nimport type { HookErrorHandling, HookFormInternals } from '../types'\nimport type { FieldElementRegistry } from '@/components/Common/Fields/hooks/fieldElementRegistry'\n\n/**\n * Minimal shape required for a form hook result to participate in `composeSubmitHandler`.\n * Any hook returning `BaseFormHookReady` satisfies this interface.\n *\n * `formMethods` is declared with method-call syntax (rather than reused from\n * `HookFormInternals`) so TypeScript applies bivariant parameter checking,\n * allowing hooks with specific form data generics to be passed without casts.\n * `_fieldElementRegistry` is reused directly since its type doesn't depend on\n * the form's generic.\n *\n * @public\n */\nexport interface ComposableFormHookResult {\n /** The form surface: the react-hook-form internals used to validate and focus fields. */\n form: {\n hookFormInternals: Pick<HookFormInternals, '_fieldElementRegistry'> & {\n formMethods: {\n handleSubmit(\n onValid: () => void,\n onInvalid?: (errors: Record<string, unknown>) => void,\n ): () => Promise<void>\n setFocus(name: string): void\n formState: { errors: Record<string, unknown> }\n }\n }\n }\n /** The error-handling surface aggregated across the composed forms. */\n errorHandling: HookErrorHandling\n}\n\n/**\n * Accepted input for a single slot of `composeSubmitHandler`'s `forms` array.\n *\n * @remarks\n * - SDK form hook results (anything matching `ComposableFormHookResult`) are composed directly.\n * - A raw `react-hook-form` `UseFormReturn<T>` is supported for screen-local auxiliary forms\n * that don't warrant a dedicated SDK hook. Raw forms contribute validation/focus behavior\n * but no `errorHandling` (fields surface their own inline errors via react-hook-form).\n *\n * @typeParam T - The shape of the form values when a raw `UseFormReturn` is passed.\n * @public\n */\nexport type ComposeSubmitInput<T extends FieldValues = FieldValues> =\n ComposableFormHookResult | UseFormReturn<T>\n\ninterface FormValidationResult {\n input: ComposeSubmitInput\n formMethods: FormMethods\n valid: boolean\n errors: Record<string, unknown>\n}\n\n/**\n * Result returned by {@link composeSubmitHandler}: a single submit handler that\n * coordinates validation across the composed forms, and aggregated error state.\n *\n * @public\n */\nexport interface ComposeSubmitHandlerResult {\n /** Submit handler to pass to a form's `onSubmit`. Validates all composed forms before calling `onAllValid`. */\n handleSubmit: (e: SyntheticEvent) => Promise<void>\n /** Aggregated error state across all composed SDK form hooks. Pass to {@link composeErrorHandler} for screen-level error surfaces. */\n errorHandling: HookErrorHandling\n}\n\ntype FormMethods = ComposableFormHookResult['form']['hookFormInternals']['formMethods']\n\nfunction isRawUseForm<T extends FieldValues>(\n input: ComposeSubmitInput<T>,\n): input is UseFormReturn<T> {\n return 'handleSubmit' in input && typeof input.handleSubmit === 'function'\n}\n\nfunction extractFormMethods<T extends FieldValues>(input: ComposeSubmitInput<T>): FormMethods {\n if (isRawUseForm(input)) return input as unknown as FormMethods\n return input.form.hookFormInternals.formMethods\n}\n\n/**\n * Picks the visually first invalid field across all composed forms using live\n * `getBoundingClientRect()` positions, then focuses its DOM element. Falls back\n * to array-order (first form's first error) when no element can be resolved —\n * raw `UseFormReturn` inputs have no registry, and forms rendered without\n * `SDKFormProvider` or a HookField wrapper won't have their fields registered\n * either, so we let react-hook-form's `setFocus` attempt it instead.\n *\n * Consumes `results` (captured from each form's `onInvalid` callback) rather\n * than reading `formState.errors` — the latter is a proxy that returns `{}`\n * when accessed outside a component subscription.\n */\nfunction focusFirstInvalidAcrossForms(results: FormValidationResult[]): void {\n type Candidate = {\n formMethods: FormMethods\n name: string\n element: HTMLElement\n }\n const candidates: Candidate[] = []\n for (const { input, formMethods, errors } of results) {\n if (isRawUseForm(input)) continue\n const registry = input.form.hookFormInternals._fieldElementRegistry as\n FieldElementRegistry | undefined\n if (!registry) continue\n for (const name of Object.keys(errors)) {\n const element = registry.get(name)\n if (element) {\n candidates.push({ formMethods, name, element })\n }\n }\n }\n\n if (candidates.length > 0) {\n candidates.sort((a, b) => {\n const ar = a.element.getBoundingClientRect()\n const br = b.element.getBoundingClientRect()\n return ar.top - br.top || ar.left - br.left\n })\n const winner = candidates[0]!\n // Focus the DOM element directly. Bypasses react-hook-form's `setFocus`,\n // which depends on `_fields[name]._f.ref` and isn't reliably populated\n // when fields are rendered through libraries like react-aria-components.\n winner.element.focus()\n return\n }\n\n for (const { formMethods, errors } of results) {\n const firstErrorField = Object.keys(errors)[0]\n if (firstErrorField) {\n formMethods.setFocus(firstErrorField)\n return\n }\n }\n}\n\n/**\n * Coordinates validation and submission across multiple form hooks on the same page.\n *\n * @remarks\n * Validates all forms simultaneously via `handleSubmit()`, then focuses the visually first\n * invalid field across all forms (sorted by `getBoundingClientRect()`). Only calls\n * `onAllValid` when every form passes.\n *\n * Uses `handleSubmit` rather than `trigger` so that react-hook-form sets\n * `formState.isSubmitted = true`, which enables `reValidateMode` (default: `onChange`).\n * Without this, errors set by manual `trigger()` calls would never clear as the user types.\n *\n * Each hook passed to `forms` should be initialized with `shouldFocusError: false` so that\n * react-hook-form's built-in per-form focus is disabled and `composeSubmitHandler` can manage\n * cross-form focus instead.\n *\n * The returned `errorHandling` is the same shape every SDK hook returns, so the whole result\n * can be passed back into {@link composeErrorHandler} when you need to add extra\n * `@gusto/embedded-api-v-2026-06-15` queries or screen-level submit state.\n *\n * @typeParam TForms - Tuple of form value shapes, one per slot of `forms`.\n * @param forms - Form hook results and/or raw `UseFormReturn` instances to coordinate.\n * @param onAllValid - Async callback invoked once every form has passed validation.\n * @returns A {@link ComposeSubmitHandlerResult} with a unified `handleSubmit` and aggregated `errorHandling`.\n * @public\n *\n * @example\n * ```tsx\n * const detailsForm = useEmployeeDetailsForm({ employeeId, shouldFocusError: false })\n * const addressForm = useHomeAddressForm({ employeeId, shouldFocusError: false })\n *\n * const { handleSubmit, errorHandling } = composeSubmitHandler(\n * [detailsForm, addressForm],\n * async () => {\n * await detailsForm.actions.onSubmit()\n * await addressForm.actions.onSubmit()\n * },\n * )\n *\n * return <form onSubmit={handleSubmit}>...</form>\n * ```\n */\nexport function composeSubmitHandler<TForms extends readonly FieldValues[]>(\n forms: readonly [...{ [K in keyof TForms]: ComposeSubmitInput<TForms[K]> }],\n onAllValid: () => Promise<void>,\n): ComposeSubmitHandlerResult {\n const errorSources = forms.filter((form): form is ComposableFormHookResult => !isRawUseForm(form))\n\n const handleSubmit = async (e: SyntheticEvent) => {\n e.preventDefault()\n\n const validationResults = await Promise.all(\n forms.map(\n input =>\n new Promise<FormValidationResult>(resolve => {\n const formMethods = extractFormMethods(input)\n void formMethods.handleSubmit(\n () => {\n resolve({ input, formMethods, valid: true, errors: {} })\n },\n errors => {\n resolve({ input, formMethods, valid: false, errors })\n },\n )()\n }),\n ),\n )\n\n const allValid = validationResults.every(r => r.valid)\n\n if (!allValid) {\n focusFirstInvalidAcrossForms(validationResults)\n return\n }\n\n await onAllValid()\n }\n\n const errorHandling = composeErrorHandler(errorSources)\n\n return { handleSubmit, errorHandling }\n}\n"],"names":["isRawUseForm","input","extractFormMethods","focusFirstInvalidAcrossForms","results","candidates","formMethods","errors","registry","name","element","a","b","ar","br","firstErrorField","composeSubmitHandler","forms","onAllValid","errorSources","form","handleSubmit","e","validationResults","resolve","r","errorHandling","composeErrorHandler"],"mappings":";AAyEA,SAASA,EACPC,GAC2B;AAC3B,SAAO,kBAAkBA,KAAS,OAAOA,EAAM,gBAAiB;AAClE;AAEA,SAASC,EAA0CD,GAA2C;AAC5F,SAAID,EAAaC,CAAK,IAAUA,IACzBA,EAAM,KAAK,kBAAkB;AACtC;AAcA,SAASE,EAA6BC,GAAuC;AAM3E,QAAMC,IAA0B,CAAA;AAChC,aAAW,EAAE,OAAAJ,GAAO,aAAAK,GAAa,QAAAC,EAAA,KAAYH,GAAS;AACpD,QAAIJ,EAAaC,CAAK,EAAG;AACzB,UAAMO,IAAWP,EAAM,KAAK,kBAAkB;AAE9C,QAAKO;AACL,iBAAWC,KAAQ,OAAO,KAAKF,CAAM,GAAG;AACtC,cAAMG,IAAUF,EAAS,IAAIC,CAAI;AACjC,QAAIC,KACFL,EAAW,KAAK,EAAE,aAAAC,GAAa,MAAAG,GAAM,SAAAC,GAAS;AAAA,MAElD;AAAA,EACF;AAEA,MAAIL,EAAW,SAAS,GAAG;AACzB,IAAAA,EAAW,KAAK,CAACM,GAAGC,MAAM;AACxB,YAAMC,IAAKF,EAAE,QAAQ,sBAAA,GACfG,IAAKF,EAAE,QAAQ,sBAAA;AACrB,aAAOC,EAAG,MAAMC,EAAG,OAAOD,EAAG,OAAOC,EAAG;AAAA,IACzC,CAAC,GACcT,EAAW,CAAC,EAIpB,QAAQ,MAAA;AACf;AAAA,EACF;AAEA,aAAW,EAAE,aAAAC,GAAa,QAAAC,EAAA,KAAYH,GAAS;AAC7C,UAAMW,IAAkB,OAAO,KAAKR,CAAM,EAAE,CAAC;AAC7C,QAAIQ,GAAiB;AACnB,MAAAT,EAAY,SAASS,CAAe;AACpC;AAAA,IACF;AAAA,EACF;AACF;AA4CO,SAASC,EACdC,GACAC,GAC4B;AAC5B,QAAMC,IAAeF,EAAM,OAAO,CAACG,MAA2C,CAACpB,EAAaoB,CAAI,CAAC,GAE3FC,IAAe,OAAOC,MAAsB;AAChD,IAAAA,EAAE,eAAA;AAEF,UAAMC,IAAoB,MAAM,QAAQ;AAAA,MACtCN,EAAM;AAAA,QACJ,CAAAhB,MACE,IAAI,QAA8B,CAAAuB,MAAW;AAC3C,gBAAMlB,IAAcJ,EAAmBD,CAAK;AAC5C,UAAKK,EAAY;AAAA,YACf,MAAM;AACJ,cAAAkB,EAAQ,EAAE,OAAAvB,GAAO,aAAAK,GAAa,OAAO,IAAM,QAAQ,CAAA,GAAI;AAAA,YACzD;AAAA,YACA,CAAAC,MAAU;AACR,cAAAiB,EAAQ,EAAE,OAAAvB,GAAO,aAAAK,GAAa,OAAO,IAAO,QAAAC,GAAQ;AAAA,YACtD;AAAA,UAAA,EACF;AAAA,QACF,CAAC;AAAA,MAAA;AAAA,IACL;AAKF,QAAI,CAFagB,EAAkB,MAAM,CAAAE,MAAKA,EAAE,KAAK,GAEtC;AACb,MAAAtB,EAA6BoB,CAAiB;AAC9C;AAAA,IACF;AAEA,UAAML,EAAA;AAAA,EACR,GAEMQ,IAAgBC,EAAoBR,CAAY;AAEtD,SAAO,EAAE,cAAAE,GAAc,eAAAK,EAAA;AACzB;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type { InputProps } from '../../../components/Common/UI/Input/InputTypes';
|
|
1
2
|
export { TextInputHookField, type TextInputHookFieldProps } from './TextInputHookField';
|
|
2
3
|
export { SelectHookField, type SelectHookFieldProps } from './SelectHookField';
|
|
3
4
|
export { CheckboxHookField, type CheckboxHookFieldProps } from './CheckboxHookField';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type { FieldMetadata, FieldMetadataWithOptions, FieldsMetadata, ValidationMessages, BaseFieldProps, HookFieldProps, } from '../types';
|
|
2
2
|
export type { FormFieldsMetadataContextValue } from './FormFieldsMetadataContext';
|
|
3
3
|
export { FormFieldsMetadataProvider } from './FormFieldsMetadataProvider';
|
|
4
|
-
export { SDKFormProvider } from './SDKFormProvider';
|
|
5
|
-
export { composeSubmitHandler } from './composeSubmitHandler';
|
|
6
|
-
export { TextInputHookField, type TextInputHookFieldProps, SelectHookField, type SelectHookFieldProps, CheckboxHookField, type CheckboxHookFieldProps, NumberInputHookField, type NumberInputHookFieldProps, DatePickerHookField, type DatePickerHookFieldProps, RadioGroupHookField, type RadioGroupHookFieldProps, type SharedFieldLayoutProps, type SharedHorizontalFieldLayoutProps, type TextInputProps, type SelectProps, type SelectOption, type CheckboxProps, type NumberInputProps, type DatePickerProps, type RadioGroupProps, type RadioGroupOption, SwitchHookField, type SwitchHookFieldProps, type SwitchProps, } from './fields';
|
|
4
|
+
export { SDKFormProvider, type SDKFormProviderProps } from './SDKFormProvider';
|
|
5
|
+
export { composeSubmitHandler, type ComposeSubmitInput, type ComposeSubmitHandlerResult, type ComposableFormHookResult, } from './composeSubmitHandler';
|
|
6
|
+
export { type InputProps, TextInputHookField, type TextInputHookFieldProps, SelectHookField, type SelectHookFieldProps, CheckboxHookField, type CheckboxHookFieldProps, NumberInputHookField, type NumberInputHookFieldProps, DatePickerHookField, type DatePickerHookFieldProps, RadioGroupHookField, type RadioGroupHookFieldProps, type SharedFieldLayoutProps, type SharedHorizontalFieldLayoutProps, type TextInputProps, type SelectProps, type SelectOption, type CheckboxProps, type NumberInputProps, type DatePickerProps, type RadioGroupProps, type RadioGroupOption, SwitchHookField, type SwitchHookFieldProps, type SwitchProps, } from './fields';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useHookFieldResolution.js","sources":["../../../src/partner-hook-utils/form/useHookFieldResolution.ts"],"sourcesContent":["import type { Control } from 'react-hook-form'\nimport { useFormState } from 'react-hook-form'\nimport type { FieldsMetadata, ValidationMessages, FormHookResult } from '../types'\nimport { useFormFieldsMetadataContext } from './FormFieldsMetadataContext'\nimport { resolveFieldError } from './resolveFieldError'\nimport type { FieldElementRegistry } from '@/components/Common/Fields/hooks/fieldElementRegistry'\n\ninterface HookFieldResolution {\n metadata: FieldsMetadata\n control: Control | undefined\n errorMessage: string | undefined\n fieldElementRegistry: FieldElementRegistry | undefined\n}\n\n/**\n * Resolves all data a HookField needs from either a `formHookResult` prop or the standard context providers (FormProvider + FormFieldsMetadataProvider).\n *\n * @remarks\n * When `formHookResult` is provided, metadata/errors/control/registry are read\n * from the prop — no context providers required. When absent, falls back to\n * the existing context-based path.\n *\n * Uses `useFormState` to establish a proper RHF subscription for error updates.\n * When `control` is provided (prop path), useFormState subscribes directly via\n * the control object. When absent (context path), it falls back to useFormContext\n * internally. The `name` parameter scopes the subscription to this field.\n *\n * `fieldElementRegistry` is forwarded so HookFields in the prop-based path can\n * self-publish the registry via `withFieldElementRegistry`. In the\n * `SDKFormProvider` path the wrap is a no-op (no registry on the prop) and the\n * outer provider's registry remains in scope.\n *\n * @typeParam TErrorCode - Required error codes the field can produce.\n * @typeParam TOptionalErrorCode - Optional error codes that only apply in some configurations.\n * @param name - Form-field name to resolve metadata, errors, and control for.\n * @param formHookResult - Form hook result passed via the `formHookResult` prop, or `undefined` to read from context.\n * @param validationMessages - Map of error codes to display strings, forwarded to error resolution.\n * @returns The metadata entry, RHF `control`, resolved error message, and field element registry for this field.\n * @internal\n */\nexport function useHookFieldResolution<\n TErrorCode extends string,\n TOptionalErrorCode extends string = never,\n>(\n name: string,\n formHookResult: FormHookResult | undefined,\n validationMessages?: ValidationMessages<TErrorCode, TOptionalErrorCode>,\n): HookFieldResolution {\n const metadataContext = useFormFieldsMetadataContext()\n\n const metadata = formHookResult?.form.fieldsMetadata ?? metadataContext?.metadata ?? {}\n\n const control = formHookResult?.form.hookFormInternals.formMethods.control as Control | undefined\n\n const { errors: formErrors } = useFormState({ control, name })\n\n const sdkErrors = formHookResult\n ? formHookResult.errorHandling.errors\n : (metadataContext?.errors ?? [])\n\n const errorMessage = resolveFieldError(name, formErrors, sdkErrors, validationMessages)\n\n const fieldElementRegistry = formHookResult?.form.hookFormInternals._fieldElementRegistry\n\n return { metadata, control, errorMessage, fieldElementRegistry }\n}\n"],"names":["useHookFieldResolution","name","formHookResult","validationMessages","metadataContext","useFormFieldsMetadataContext","metadata","control","formErrors","useFormState","sdkErrors","errorMessage","resolveFieldError","fieldElementRegistry"],"mappings":";;;AAwCO,SAASA,EAIdC,GACAC,GACAC,GACqB;AACrB,QAAMC,IAAkBC,EAAA,GAElBC,IAAWJ,GAAgB,KAAK,kBAAkBE,GAAiB,YAAY,CAAA,GAE/EG,IAAUL,GAAgB,KAAK,kBAAkB,YAAY,SAE7D,EAAE,QAAQM,EAAA,IAAeC,EAAa,EAAE,SAAAF,GAAS,MAAAN,GAAM,GAEvDS,IAAYR,IACdA,EAAe,cAAc,SAC5BE,GAAiB,UAAU,CAAA,GAE1BO,IAAeC,EAAkBX,GAAMO,GAAYE,GAAWP,CAAkB,GAEhFU,IAAuBX,GAAgB,KAAK,kBAAkB;
|
|
1
|
+
{"version":3,"file":"useHookFieldResolution.js","sources":["../../../src/partner-hook-utils/form/useHookFieldResolution.ts"],"sourcesContent":["import type { Control } from 'react-hook-form'\nimport { useFormState } from 'react-hook-form'\nimport type { FieldsMetadata, ValidationMessages, FormHookResult } from '../types'\nimport { useFormFieldsMetadataContext } from './FormFieldsMetadataContext'\nimport { resolveFieldError } from './resolveFieldError'\nimport type { FieldElementRegistry } from '@/components/Common/Fields/hooks/fieldElementRegistry'\n\ninterface HookFieldResolution {\n metadata: FieldsMetadata\n control: Control | undefined\n errorMessage: string | undefined\n fieldElementRegistry: FieldElementRegistry | undefined\n}\n\n/**\n * Resolves all data a HookField needs from either a `formHookResult` prop or the standard context providers (FormProvider + FormFieldsMetadataProvider).\n *\n * @remarks\n * When `formHookResult` is provided, metadata/errors/control/registry are read\n * from the prop — no context providers required. When absent, falls back to\n * the existing context-based path.\n *\n * Uses `useFormState` to establish a proper RHF subscription for error updates.\n * When `control` is provided (prop path), useFormState subscribes directly via\n * the control object. When absent (context path), it falls back to useFormContext\n * internally. The `name` parameter scopes the subscription to this field.\n *\n * `fieldElementRegistry` is forwarded so HookFields in the prop-based path can\n * self-publish the registry via `withFieldElementRegistry`. In the\n * `SDKFormProvider` path the wrap is a no-op (no registry on the prop) and the\n * outer provider's registry remains in scope.\n *\n * @typeParam TErrorCode - Required error codes the field can produce.\n * @typeParam TOptionalErrorCode - Optional error codes that only apply in some configurations.\n * @param name - Form-field name to resolve metadata, errors, and control for.\n * @param formHookResult - Form hook result passed via the `formHookResult` prop, or `undefined` to read from context.\n * @param validationMessages - Map of error codes to display strings, forwarded to error resolution.\n * @returns The metadata entry, RHF `control`, resolved error message, and field element registry for this field.\n * @internal\n */\nexport function useHookFieldResolution<\n TErrorCode extends string,\n TOptionalErrorCode extends string = never,\n>(\n name: string,\n formHookResult: FormHookResult | undefined,\n validationMessages?: ValidationMessages<TErrorCode, TOptionalErrorCode>,\n): HookFieldResolution {\n const metadataContext = useFormFieldsMetadataContext()\n\n const metadata = formHookResult?.form.fieldsMetadata ?? metadataContext?.metadata ?? {}\n\n const control = formHookResult?.form.hookFormInternals.formMethods.control as Control | undefined\n\n const { errors: formErrors } = useFormState({ control, name })\n\n const sdkErrors = formHookResult\n ? formHookResult.errorHandling.errors\n : (metadataContext?.errors ?? [])\n\n const errorMessage = resolveFieldError(name, formErrors, sdkErrors, validationMessages)\n\n const fieldElementRegistry = formHookResult?.form.hookFormInternals._fieldElementRegistry as\n FieldElementRegistry | undefined\n\n return { metadata, control, errorMessage, fieldElementRegistry }\n}\n"],"names":["useHookFieldResolution","name","formHookResult","validationMessages","metadataContext","useFormFieldsMetadataContext","metadata","control","formErrors","useFormState","sdkErrors","errorMessage","resolveFieldError","fieldElementRegistry"],"mappings":";;;AAwCO,SAASA,EAIdC,GACAC,GACAC,GACqB;AACrB,QAAMC,IAAkBC,EAAA,GAElBC,IAAWJ,GAAgB,KAAK,kBAAkBE,GAAiB,YAAY,CAAA,GAE/EG,IAAUL,GAAgB,KAAK,kBAAkB,YAAY,SAE7D,EAAE,QAAQM,EAAA,IAAeC,EAAa,EAAE,SAAAF,GAAS,MAAAN,GAAM,GAEvDS,IAAYR,IACdA,EAAe,cAAc,SAC5BE,GAAiB,UAAU,CAAA,GAE1BO,IAAeC,EAAkBX,GAAMO,GAAYE,GAAWP,CAAkB,GAEhFU,IAAuBX,GAAgB,KAAK,kBAAkB;AAGpE,SAAO,EAAE,UAAAI,GAAU,SAAAC,GAAS,cAAAI,GAAc,sBAAAE,EAAA;AAC5C;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export * from './types';
|
|
2
|
-
export { composeErrorHandler, type MixedErrorSource, type SubmitStateForErrorHandling, } from './composeErrorHandler';
|
|
2
|
+
export { composeErrorHandler, type MixedErrorSource, type SubmitStateForErrorHandling, type QueryWithRefetch, } from './composeErrorHandler';
|
|
3
3
|
export { collectErrors } from './collectErrors';
|
|
4
4
|
export * from './form';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { UseFormReturn, FieldValues } from 'react-hook-form';
|
|
3
|
-
import { FieldElementRegistry } from '../components/Common/Fields/hooks/fieldElementRegistry';
|
|
4
3
|
import { SDKError } from '../types/sdkError';
|
|
5
4
|
/**
|
|
6
5
|
* Per-field metadata published by a form hook for the matching field component.
|
|
@@ -121,9 +120,13 @@ export interface HookFormInternals<TFormData extends FieldValues = FieldValues>
|
|
|
121
120
|
* focus the visually first invalid field across multiple composed forms.
|
|
122
121
|
* `SDKFormProvider` and the `withFieldElementRegistry` HookField wrapper
|
|
123
122
|
* publish it via context for `useField` to populate.
|
|
123
|
+
*
|
|
124
|
+
* Typed `unknown` so the internal `FieldElementRegistry` shape never reaches
|
|
125
|
+
* the public API surface; the SDK-internal readers cast it back to the
|
|
126
|
+
* concrete type.
|
|
124
127
|
* @internal
|
|
125
128
|
*/
|
|
126
|
-
_fieldElementRegistry?:
|
|
129
|
+
_fieldElementRegistry?: unknown;
|
|
127
130
|
}
|
|
128
131
|
/**
|
|
129
132
|
* Discriminated union member returned by a hook while async data is being fetched.
|
|
@@ -270,7 +273,8 @@ export type FormHookResult = {
|
|
|
270
273
|
formMethods: {
|
|
271
274
|
control: unknown;
|
|
272
275
|
};
|
|
273
|
-
|
|
276
|
+
/** @internal */
|
|
277
|
+
_fieldElementRegistry?: unknown;
|
|
274
278
|
};
|
|
275
279
|
};
|
|
276
280
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ContractorOnboardingStatus1 } from '@gusto/embedded-api/models/components/contractor';
|
|
1
|
+
import { OnboardingStatus as ContractorOnboardingStatus1 } from '@gusto/embedded-api/models/components/contractor';
|
|
2
2
|
/**
|
|
3
3
|
* Event keys emitted by employee-related components.
|
|
4
4
|
*
|
|
@@ -786,7 +786,7 @@ export declare const EmployeeOnboardingStatus: {
|
|
|
786
786
|
*
|
|
787
787
|
* @public
|
|
788
788
|
*/
|
|
789
|
-
export declare const EmployeeSelfOnboardingStatuses: Set<
|
|
789
|
+
export declare const EmployeeSelfOnboardingStatuses: Set<string>;
|
|
790
790
|
/**
|
|
791
791
|
* Map of contractor onboarding status values returned by the Gusto API.
|
|
792
792
|
*
|