@gusto/embedded-react-sdk 0.44.1 → 0.45.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 +63 -0
- package/dist/components/Common/DetailViewLayout/DetailViewLayout.js +7 -7
- package/dist/components/Common/DetailViewLayout/DetailViewLayout.js.map +1 -1
- package/dist/components/Common/UI/Alert/Alert.js +24 -23
- package/dist/components/Common/UI/Alert/Alert.js.map +1 -1
- package/dist/components/Common/UI/Alert/Alert.module.scss.js +16 -14
- package/dist/components/Common/UI/Alert/Alert.module.scss.js.map +1 -1
- package/dist/components/Common/UI/Alert/AlertTypes.d.ts +8 -0
- package/dist/components/Common/UI/Alert/AlertTypes.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +38 -38
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +4 -20
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/Head.js +12 -9
- package/dist/components/Company/AssignSignatory/Head.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +25 -25
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +4 -20
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +6 -22
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Head.js +11 -8
- package/dist/components/Company/BankAccount/BankAccountForm/Head.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +4 -20
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/Head.js +44 -39
- package/dist/components/Company/BankAccount/BankAccountList/Head.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +4 -20
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +28 -28
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Company/FederalTaxes/FederalTaxes.js +9 -9
- package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
- package/dist/components/Company/FederalTaxes/Head.js +7 -6
- package/dist/components/Company/FederalTaxes/Head.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +12 -28
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +7 -23
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Industry/Head.js +10 -9
- package/dist/components/Company/Industry/Head.js.map +1 -1
- package/dist/components/Company/Industry/IndustrySelect.js +22 -19
- package/dist/components/Company/Industry/IndustrySelect.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Head.js +9 -8
- package/dist/components/Company/Locations/LocationForm/Head.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +4 -20
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/Head.js +11 -10
- package/dist/components/Company/Locations/LocationsList/Head.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/LocationsList.js +11 -11
- package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +4 -20
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +4 -20
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/PayScheduleList.js +18 -18
- package/dist/components/Company/PaySchedule/PayScheduleList.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +4 -20
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +4 -20
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Contractor/Address/useAddress.js +6 -22
- package/dist/components/Contractor/Address/useAddress.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js +7 -7
- package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +2 -2
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -1
- package/dist/components/Contractor/Profile/useContractorProfile.js +42 -52
- package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
- package/dist/components/Employee/Compensation/index.d.ts +1 -1
- package/dist/components/Employee/Compensation/{Compensation.d.ts → onboarding/Compensation.d.ts} +3 -3
- package/dist/components/Employee/Compensation/onboarding/Compensation.js +88 -0
- package/dist/components/Employee/Compensation/onboarding/Compensation.js.map +1 -0
- package/dist/components/Employee/Compensation/{CompensationFlowComponents.d.ts → onboarding/CompensationFlowComponents.d.ts} +3 -3
- package/dist/components/Employee/Compensation/onboarding/CompensationFlowComponents.js +59 -0
- package/dist/components/Employee/Compensation/onboarding/CompensationFlowComponents.js.map +1 -0
- package/dist/components/Employee/Compensation/onboarding/EditCompensation/EditCompensation.d.ts +21 -0
- package/dist/components/Employee/Compensation/onboarding/EditCompensation/EditCompensation.js +249 -0
- package/dist/components/Employee/Compensation/onboarding/EditCompensation/EditCompensation.js.map +1 -0
- package/dist/components/Employee/Compensation/onboarding/EditCompensation/EditCompensation.module.scss.js +8 -0
- package/dist/components/Employee/Compensation/onboarding/EditCompensation/EditCompensation.module.scss.js.map +1 -0
- package/dist/components/Employee/Compensation/onboarding/EditCompensation/index.d.ts +3 -0
- package/dist/components/Employee/Compensation/{JobsList → onboarding/JobsList}/JobsList.d.ts +1 -1
- package/dist/components/Employee/Compensation/onboarding/JobsList/JobsList.js +43 -0
- package/dist/components/Employee/Compensation/onboarding/JobsList/JobsList.js.map +1 -0
- package/dist/components/Employee/Compensation/{JobsList → onboarding/JobsList}/JobsListPresentation.js +10 -10
- package/dist/components/Employee/Compensation/onboarding/JobsList/JobsListPresentation.js.map +1 -0
- package/dist/components/Employee/Compensation/{compensationStateMachine.js → onboarding/compensationStateMachine.js} +1 -1
- package/dist/components/Employee/Compensation/onboarding/compensationStateMachine.js.map +1 -0
- package/dist/components/Employee/Compensation/onboarding/index.d.ts +2 -0
- package/dist/components/Employee/Compensation/shared/derivePrimaryFlsaStatus.d.ts +9 -0
- package/dist/components/Employee/Compensation/shared/derivePrimaryFlsaStatus.js +10 -0
- package/dist/components/Employee/Compensation/shared/derivePrimaryFlsaStatus.js.map +1 -0
- package/dist/components/Employee/Compensation/shared/useCompensationForm/compensationSchema.d.ts +7 -0
- package/dist/components/Employee/Compensation/shared/useCompensationForm/compensationSchema.js +41 -35
- package/dist/components/Employee/Compensation/shared/useCompensationForm/compensationSchema.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/useCompensationForm/index.d.ts +0 -2
- package/dist/components/Employee/Compensation/shared/useCompensationForm/useCompensationForm.d.ts +24 -3
- package/dist/components/Employee/Compensation/shared/useCompensationForm/useCompensationForm.js +193 -181
- package/dist/components/Employee/Compensation/shared/useCompensationForm/useCompensationForm.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/useJobForm/index.d.ts +0 -2
- package/dist/components/Employee/Compensation/shared/useJobForm/jobSchema.d.ts +8 -0
- package/dist/components/Employee/Compensation/shared/useJobForm/jobSchema.js +14 -13
- package/dist/components/Employee/Compensation/shared/useJobForm/jobSchema.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.d.ts +19 -2
- package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.js +133 -130
- package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.js.map +1 -1
- package/dist/components/Employee/Dashboard/BasicDetailsView.d.ts +13 -0
- package/dist/components/Employee/Dashboard/BasicDetailsView.js +87 -65
- package/dist/components/Employee/Dashboard/BasicDetailsView.js.map +1 -1
- package/dist/components/Employee/Dashboard/CompensationCard.d.ts +13 -0
- package/dist/components/Employee/Dashboard/Dashboard.js +89 -109
- package/dist/components/Employee/Dashboard/Dashboard.js.map +1 -1
- package/dist/components/Employee/Dashboard/DashboardComponents.d.ts +15 -0
- package/dist/components/Employee/Dashboard/DashboardComponents.js +120 -25
- package/dist/components/Employee/Dashboard/DashboardComponents.js.map +1 -1
- package/dist/components/Employee/Dashboard/DocumentsView.d.ts +11 -0
- package/dist/components/Employee/Dashboard/DocumentsView.js +24 -17
- package/dist/components/Employee/Dashboard/DocumentsView.js.map +1 -1
- package/dist/components/Employee/Dashboard/JobAndPayView.d.ts +9 -17
- package/dist/components/Employee/Dashboard/JobAndPayView.js +495 -114
- package/dist/components/Employee/Dashboard/JobAndPayView.js.map +1 -1
- package/dist/components/Employee/Dashboard/PendingChangesReviewModal.d.ts +10 -0
- package/dist/components/Employee/Dashboard/PendingChangesReviewModal.js +64 -0
- package/dist/components/Employee/Dashboard/PendingChangesReviewModal.js.map +1 -0
- package/dist/components/Employee/Dashboard/TaxesView.d.ts +13 -0
- package/dist/components/Employee/Dashboard/TaxesView.js +82 -60
- package/dist/components/Employee/Dashboard/TaxesView.js.map +1 -1
- package/dist/components/Employee/Dashboard/dashboardStateMachine.d.ts +7 -0
- package/dist/components/Employee/Dashboard/dashboardStateMachine.js +227 -40
- package/dist/components/Employee/Dashboard/dashboardStateMachine.js.map +1 -1
- package/dist/components/Employee/Dashboard/getPendingCompensationChanges.d.ts +50 -0
- package/dist/components/Employee/Dashboard/getPendingCompensationChanges.js +57 -0
- package/dist/components/Employee/Dashboard/getPendingCompensationChanges.js.map +1 -0
- package/dist/components/Employee/Dashboard/getPendingCompensationChanges.test.d.ts +1 -0
- package/dist/components/Employee/Dashboard/hooks/useEmployeeBasicDetails.js +7 -4
- package/dist/components/Employee/Dashboard/hooks/useEmployeeBasicDetails.js.map +1 -1
- package/dist/components/Employee/Dashboard/hooks/useEmployeeCompensation.d.ts +14 -8
- package/dist/components/Employee/Dashboard/hooks/useEmployeeCompensation.js +60 -36
- package/dist/components/Employee/Dashboard/hooks/useEmployeeCompensation.js.map +1 -1
- package/dist/components/Employee/Dashboard/usePendingChangeDetailRenderer.d.ts +8 -0
- package/dist/components/Employee/Dashboard/usePendingChangeDetailRenderer.js +61 -0
- package/dist/components/Employee/Dashboard/usePendingChangeDetailRenderer.js.map +1 -0
- package/dist/components/Employee/Deductions/Deductions.d.ts +2 -8
- package/dist/components/Employee/Deductions/Deductions.js +25 -52
- package/dist/components/Employee/Deductions/Deductions.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportFormView.d.ts +9 -0
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportFormView.js +137 -0
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportFormView.js.map +1 -0
- package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.d.ts +9 -5
- package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js +97 -94
- package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/StandardDeductionForm.d.ts +18 -0
- package/dist/components/Employee/Deductions/DeductionsForm/StandardDeductionForm.js +137 -0
- package/dist/components/Employee/Deductions/DeductionsForm/StandardDeductionForm.js.map +1 -0
- package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.d.ts +10 -5
- package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +57 -77
- package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js.map +1 -1
- package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.d.ts +5 -5
- package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.js +29 -39
- package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.js.map +1 -1
- package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.module.scss.js +8 -6
- package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.module.scss.js.map +1 -1
- package/dist/components/Employee/Deductions/{DeductionsComponents.d.ts → deductionsContextualComponents.d.ts} +7 -8
- package/dist/components/Employee/Deductions/deductionsContextualComponents.js +74 -0
- package/dist/components/Employee/Deductions/deductionsContextualComponents.js.map +1 -0
- package/dist/components/Employee/Deductions/shared/DeleteDeductionDialog.d.ts +7 -0
- package/dist/components/Employee/Deductions/shared/DeleteDeductionDialog.js +31 -0
- package/dist/components/Employee/Deductions/shared/DeleteDeductionDialog.js.map +1 -0
- package/dist/components/Employee/Deductions/shared/formatDeductionAmount.d.ts +7 -0
- package/dist/components/Employee/Deductions/shared/formatDeductionAmount.js +10 -0
- package/dist/components/Employee/Deductions/shared/formatDeductionAmount.js.map +1 -0
- package/dist/components/Employee/Deductions/shared/formatDeductionAmount.test.d.ts +1 -0
- package/dist/components/Employee/Deductions/shared/index.d.ts +7 -0
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/childSupportGarnishmentFormSchema.d.ts +63 -0
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/childSupportGarnishmentFormSchema.js +64 -0
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/childSupportGarnishmentFormSchema.js.map +1 -0
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/fields.d.ts +36 -0
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/fields.js +39 -0
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/fields.js.map +1 -0
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/index.d.ts +4 -0
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/useChildSupportGarnishmentForm.d.ts +62 -0
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/useChildSupportGarnishmentForm.js +208 -0
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/useChildSupportGarnishmentForm.js.map +1 -0
- package/dist/components/Employee/Deductions/shared/useDeductionForm/deductionFormSchema.d.ts +63 -0
- package/dist/components/Employee/Deductions/shared/useDeductionForm/deductionFormSchema.js +52 -0
- package/dist/components/Employee/Deductions/shared/useDeductionForm/deductionFormSchema.js.map +1 -0
- package/dist/components/Employee/Deductions/shared/useDeductionForm/fields.d.ts +25 -0
- package/dist/components/Employee/Deductions/shared/useDeductionForm/fields.js +36 -0
- package/dist/components/Employee/Deductions/shared/useDeductionForm/fields.js.map +1 -0
- package/dist/components/Employee/Deductions/shared/useDeductionForm/index.d.ts +4 -0
- package/dist/components/Employee/Deductions/shared/useDeductionForm/useDeductionForm.d.ts +64 -0
- package/dist/components/Employee/Deductions/shared/useDeductionForm/useDeductionForm.js +203 -0
- package/dist/components/Employee/Deductions/shared/useDeductionForm/useDeductionForm.js.map +1 -0
- package/dist/components/Employee/Deductions/shared/useDeductionsList.d.ts +22 -0
- package/dist/components/Employee/Deductions/shared/useDeductionsList.js +50 -0
- package/dist/components/Employee/Deductions/shared/useDeductionsList.js.map +1 -0
- package/dist/components/Employee/Deductions/shared/useDeleteDeduction.d.ts +13 -0
- package/dist/components/Employee/Deductions/shared/useDeleteDeduction.js +17 -0
- package/dist/components/Employee/Deductions/shared/useDeleteDeduction.js.map +1 -0
- package/dist/components/Employee/Deductions/stateMachine.d.ts +4 -5
- package/dist/components/Employee/Deductions/stateMachine.js +67 -89
- package/dist/components/Employee/Deductions/stateMachine.js.map +1 -1
- package/dist/components/Employee/Documents/management/DocumentManager.d.ts +6 -0
- package/dist/components/Employee/Documents/management/DocumentManager.js +60 -0
- package/dist/components/Employee/Documents/management/DocumentManager.js.map +1 -0
- package/dist/components/Employee/Documents/management/index.d.ts +3 -0
- package/dist/components/Employee/{DocumentSigner → Documents/onboarding/DocumentSigner}/DocumentList/Actions.js +3 -3
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/Actions.js.map +1 -0
- package/dist/components/Employee/{DocumentSigner → Documents/onboarding/DocumentSigner}/DocumentList/DocumentList.d.ts +1 -1
- package/dist/components/Employee/{DocumentSigner → Documents/onboarding/DocumentSigner}/DocumentList/DocumentList.js +5 -5
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/DocumentList.js.map +1 -0
- package/dist/components/Employee/{DocumentSigner → Documents/onboarding/DocumentSigner}/DocumentList/Head.js +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/Head.js.map +1 -0
- package/dist/components/Employee/{DocumentSigner → Documents/onboarding/DocumentSigner}/DocumentList/List.js +3 -3
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/List.js.map +1 -0
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +8 -0
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -0
- package/dist/components/Employee/{DocumentSigner → Documents/onboarding/DocumentSigner}/DocumentSigner.d.ts +1 -1
- package/dist/components/Employee/{DocumentSigner → Documents/onboarding/DocumentSigner}/DocumentSigner.js +5 -5
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentSigner.js.map +1 -0
- package/dist/components/Employee/{DocumentSigner → Documents/onboarding/DocumentSigner}/EmploymentEligibility/EmploymentEligibility.d.ts +1 -1
- package/dist/components/Employee/{DocumentSigner → Documents/onboarding/DocumentSigner}/EmploymentEligibility/EmploymentEligibility.js +4 -4
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibility.js.map +1 -0
- package/dist/components/Employee/{DocumentSigner → Documents/onboarding/DocumentSigner}/EmploymentEligibility/EmploymentEligibilityPresentation.js +11 -11
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js.map +1 -0
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.js.map +1 -0
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.test.d.ts +1 -0
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/countries.js.map +1 -0
- package/dist/components/Employee/{DocumentSigner → Documents/onboarding/DocumentSigner}/I9SignatureForm/I9SignatureForm.d.ts +1 -1
- package/dist/components/Employee/{DocumentSigner → Documents/onboarding/DocumentSigner}/I9SignatureForm/I9SignatureForm.js +11 -11
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/I9SignatureForm/I9SignatureForm.js.map +1 -0
- package/dist/components/Employee/{DocumentSigner → Documents/onboarding/DocumentSigner}/documentSignerStateMachine.d.ts +2 -2
- package/dist/components/Employee/{DocumentSigner → Documents/onboarding/DocumentSigner}/documentSignerStateMachine.js +8 -8
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/documentSignerStateMachine.js.map +1 -0
- package/dist/components/Employee/{DocumentSigner → Documents/onboarding/DocumentSigner}/stateMachine.js +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/stateMachine.js.map +1 -0
- package/dist/components/Employee/{EmployeeDocuments → Documents/onboarding/EmployeeDocuments}/EmployeeDocuments.d.ts +3 -3
- package/dist/components/Employee/{EmployeeDocuments → Documents/onboarding/EmployeeDocuments}/EmployeeDocuments.js +6 -6
- package/dist/components/Employee/Documents/onboarding/EmployeeDocuments/EmployeeDocuments.js.map +1 -0
- package/dist/components/Employee/Documents/onboarding/EmployeeDocuments/EmployeeDocumentsPresentation.js +117 -0
- package/dist/components/Employee/Documents/onboarding/EmployeeDocuments/EmployeeDocumentsPresentation.js.map +1 -0
- package/dist/components/Employee/{DocumentSigner → Documents/shared}/SignatureForm/SignatureForm.d.ts +1 -1
- package/dist/components/Employee/{DocumentSigner → Documents/shared}/SignatureForm/SignatureForm.js +11 -11
- package/dist/components/Employee/Documents/shared/SignatureForm/SignatureForm.js.map +1 -0
- package/dist/components/Employee/Documents/shared/useSignEmployeeForm/fields.js.map +1 -0
- package/dist/components/Employee/Documents/shared/useSignEmployeeForm/signEmployeeFormSchema.js.map +1 -0
- package/dist/components/Employee/Documents/shared/useSignEmployeeForm/useSignEmployeeForm.js.map +1 -0
- package/dist/components/Employee/FederalTaxes/shared/FederalTaxesView.js +89 -82
- package/dist/components/Employee/FederalTaxes/shared/FederalTaxesView.js.map +1 -1
- package/dist/components/Employee/HomeAddress/management/HomeAddressView.js +37 -35
- package/dist/components/Employee/HomeAddress/management/HomeAddressView.js.map +1 -1
- package/dist/components/Employee/OnboardingFlow/OnboardingFlowComponents.d.ts +1 -0
- package/dist/components/Employee/OnboardingFlow/OnboardingFlowComponents.js +14 -8
- package/dist/components/Employee/OnboardingFlow/OnboardingFlowComponents.js.map +1 -1
- package/dist/components/Employee/OnboardingFlow/onboardingStateMachine.js +38 -39
- package/dist/components/Employee/OnboardingFlow/onboardingStateMachine.js.map +1 -1
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +29 -27
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/index.d.ts +1 -1
- package/dist/components/Employee/PaymentMethod/management/ListView.d.ts +8 -0
- package/dist/components/Employee/PaymentMethod/management/ListView.js +138 -0
- package/dist/components/Employee/PaymentMethod/management/ListView.js.map +1 -0
- package/dist/components/Employee/PaymentMethod/management/PaymentMethod.d.ts +11 -0
- package/dist/components/Employee/PaymentMethod/management/PaymentMethod.js +49 -0
- package/dist/components/Employee/PaymentMethod/management/PaymentMethod.js.map +1 -0
- package/dist/components/Employee/PaymentMethod/management/PaymentMethodComponents.d.ts +8 -0
- package/dist/components/Employee/PaymentMethod/management/PaymentMethodComponents.js +23 -0
- package/dist/components/Employee/PaymentMethod/management/PaymentMethodComponents.js.map +1 -0
- package/dist/components/Employee/PaymentMethod/management/index.d.ts +4 -0
- package/dist/components/Employee/PaymentMethod/management/paymentMethodStateMachine.d.ts +5 -0
- package/dist/components/Employee/PaymentMethod/management/paymentMethodStateMachine.js +75 -0
- package/dist/components/Employee/PaymentMethod/management/paymentMethodStateMachine.js.map +1 -0
- package/dist/components/Employee/PaymentMethod/onboarding/BankForm.d.ts +8 -0
- package/dist/components/Employee/PaymentMethod/onboarding/BankForm.js +66 -0
- package/dist/components/Employee/PaymentMethod/onboarding/BankForm.js.map +1 -0
- package/dist/components/Employee/PaymentMethod/onboarding/ListView.d.ts +9 -0
- package/dist/components/Employee/PaymentMethod/onboarding/ListView.js +168 -0
- package/dist/components/Employee/PaymentMethod/onboarding/ListView.js.map +1 -0
- package/dist/components/Employee/PaymentMethod/onboarding/PaymentMethod.d.ts +11 -0
- package/dist/components/Employee/PaymentMethod/onboarding/PaymentMethod.js +44 -0
- package/dist/components/Employee/PaymentMethod/onboarding/PaymentMethod.js.map +1 -0
- package/dist/components/Employee/PaymentMethod/onboarding/PaymentMethodComponents.d.ts +8 -0
- package/dist/components/Employee/PaymentMethod/onboarding/PaymentMethodComponents.js +23 -0
- package/dist/components/Employee/PaymentMethod/onboarding/PaymentMethodComponents.js.map +1 -0
- package/dist/components/Employee/PaymentMethod/onboarding/SplitView.d.ts +8 -0
- package/dist/components/Employee/PaymentMethod/onboarding/SplitView.js +97 -0
- package/dist/components/Employee/PaymentMethod/onboarding/SplitView.js.map +1 -0
- package/dist/components/Employee/PaymentMethod/onboarding/index.d.ts +2 -0
- package/dist/components/Employee/PaymentMethod/onboarding/paymentMethodStateMachine.d.ts +5 -0
- package/dist/components/Employee/PaymentMethod/onboarding/paymentMethodStateMachine.js +75 -0
- package/dist/components/Employee/PaymentMethod/onboarding/paymentMethodStateMachine.js.map +1 -0
- package/dist/components/Employee/PaymentMethod/shared/DeleteBankAccountDialog.d.ts +9 -0
- package/dist/components/Employee/PaymentMethod/shared/DeleteBankAccountDialog.js +31 -0
- package/dist/components/Employee/PaymentMethod/shared/DeleteBankAccountDialog.js.map +1 -0
- package/dist/components/Employee/PaymentMethod/shared/index.d.ts +7 -0
- package/dist/components/Employee/PaymentMethod/shared/useBankForm/fields.d.ts +15 -0
- package/dist/components/Employee/PaymentMethod/shared/useBankForm/fields.js +22 -0
- package/dist/components/Employee/PaymentMethod/shared/useBankForm/fields.js.map +1 -0
- package/dist/components/Employee/PaymentMethod/shared/useBankForm/index.d.ts +5 -0
- package/dist/components/Employee/PaymentMethod/shared/useBankForm/useBankForm.d.ts +37 -0
- package/dist/components/Employee/PaymentMethod/shared/useBankForm/useBankForm.js +105 -0
- package/dist/components/Employee/PaymentMethod/shared/useBankForm/useBankForm.js.map +1 -0
- package/dist/components/Employee/PaymentMethod/shared/useBankForm/useBankFormSchema.d.ts +39 -0
- package/dist/components/Employee/PaymentMethod/shared/useBankForm/useBankFormSchema.js +26 -0
- package/dist/components/Employee/PaymentMethod/shared/useBankForm/useBankFormSchema.js.map +1 -0
- package/dist/components/Employee/PaymentMethod/shared/useDeleteBankAccount.d.ts +13 -0
- package/dist/components/Employee/PaymentMethod/shared/useDeleteBankAccount.js +19 -0
- package/dist/components/Employee/PaymentMethod/shared/useDeleteBankAccount.js.map +1 -0
- package/dist/components/Employee/PaymentMethod/shared/usePaymentMethodForm/fields.d.ts +6 -0
- package/dist/components/Employee/PaymentMethod/shared/usePaymentMethodForm/fields.js +9 -0
- package/dist/components/Employee/PaymentMethod/shared/usePaymentMethodForm/fields.js.map +1 -0
- package/dist/components/Employee/PaymentMethod/shared/usePaymentMethodForm/index.d.ts +5 -0
- package/dist/components/Employee/PaymentMethod/shared/usePaymentMethodForm/usePaymentMethodForm.d.ts +31 -0
- package/dist/components/Employee/PaymentMethod/shared/usePaymentMethodForm/usePaymentMethodForm.js +94 -0
- package/dist/components/Employee/PaymentMethod/shared/usePaymentMethodForm/usePaymentMethodForm.js.map +1 -0
- package/dist/components/Employee/PaymentMethod/shared/usePaymentMethodForm/usePaymentMethodFormSchema.d.ts +31 -0
- package/dist/components/Employee/PaymentMethod/shared/usePaymentMethodForm/usePaymentMethodFormSchema.js +22 -0
- package/dist/components/Employee/PaymentMethod/shared/usePaymentMethodForm/usePaymentMethodFormSchema.js.map +1 -0
- package/dist/components/Employee/PaymentMethod/shared/usePaymentMethodList.d.ts +20 -0
- package/dist/components/Employee/PaymentMethod/shared/usePaymentMethodList.js +68 -0
- package/dist/components/Employee/PaymentMethod/shared/usePaymentMethodList.js.map +1 -0
- package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/fields.d.ts +6 -0
- package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/fields.js +9 -0
- package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/fields.js.map +1 -0
- package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/index.d.ts +6 -0
- package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/splitFieldFactory.d.ts +48 -0
- package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/splitFieldFactory.js +46 -0
- package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/splitFieldFactory.js.map +1 -0
- package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/useSplitPaymentsForm.d.ts +65 -0
- package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/useSplitPaymentsForm.js +209 -0
- package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/useSplitPaymentsForm.js.map +1 -0
- package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/useSplitPaymentsFormSchema.d.ts +53 -0
- package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/useSplitPaymentsFormSchema.js +93 -0
- package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/useSplitPaymentsFormSchema.js.map +1 -0
- package/dist/components/Employee/Profile/onboarding/AdminProfile.js +88 -87
- package/dist/components/Employee/Profile/onboarding/AdminProfile.js.map +1 -1
- package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingComponents.js +2 -2
- package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingComponents.js.map +1 -1
- package/dist/components/Employee/StateTaxes/shared/EmployeeStateTaxesView.js +19 -17
- package/dist/components/Employee/StateTaxes/shared/EmployeeStateTaxesView.js.map +1 -1
- package/dist/components/Employee/StateTaxes/shared/EmployeeStateTaxesView.module.scss.js +8 -0
- package/dist/components/Employee/StateTaxes/shared/EmployeeStateTaxesView.module.scss.js.map +1 -0
- package/dist/components/Employee/Taxes/FederalForm.js +27 -26
- package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
- package/dist/components/Employee/Taxes/FederalHead.js +13 -10
- package/dist/components/Employee/Taxes/FederalHead.js.map +1 -1
- package/dist/components/Employee/Taxes/StateForm.js +17 -14
- package/dist/components/Employee/Taxes/StateForm.js.map +1 -1
- package/dist/components/Employee/Taxes/Taxes.js +75 -69
- package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
- package/dist/components/Employee/Taxes/useTaxes.js +4 -20
- package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
- package/dist/components/Employee/WorkAddress/management/WorkAddressView.js +26 -26
- package/dist/components/Employee/WorkAddress/management/WorkAddressView.js.map +1 -1
- package/dist/components/Employee/exports/employeeManagement.d.ts +4 -1
- package/dist/components/Employee/exports/employeeManagement.js +22 -18
- package/dist/components/Employee/exports/employeeManagement.js.map +1 -1
- package/dist/components/Employee/exports/employeeOnboarding.d.ts +3 -3
- package/dist/components/Employee/exports/employeeOnboarding.js +4 -4
- package/dist/components/Employee/index.d.ts +4 -4
- package/dist/components/Employee/index.js +5 -5
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +26 -34
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +35 -35
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.d.ts +1 -1
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.js +71 -54
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.js.map +1 -1
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.d.ts +1 -1
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +22 -36
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetail.js +84 -82
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetail.js.map +1 -1
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetailPresentation.d.ts +1 -1
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetailPresentation.js +49 -48
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetailPresentation.js.map +1 -1
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetailTypes.d.ts +1 -0
- package/dist/components/TimeOff/HolidaySelectionForm/HolidaySelectionForm.js +39 -37
- package/dist/components/TimeOff/HolidaySelectionForm/HolidaySelectionForm.js.map +1 -1
- package/dist/components/TimeOff/HolidaySelectionForm/HolidaySelectionFormPresentation.js +31 -31
- package/dist/components/TimeOff/HolidaySelectionForm/HolidaySelectionFormPresentation.js.map +1 -1
- package/dist/components/TimeOff/HolidaySelectionForm/HolidaySelectionFormTypes.d.ts +1 -0
- package/dist/components/TimeOff/PolicyList/PolicyList.js +27 -27
- package/dist/components/TimeOff/PolicyList/PolicyList.js.map +1 -1
- package/dist/components/TimeOff/PolicyList/PolicyListPresentation.js +50 -50
- package/dist/components/TimeOff/PolicyList/PolicyListPresentation.js.map +1 -1
- package/dist/components/TimeOff/PolicySettings/PolicySettings.d.ts +1 -0
- package/dist/components/TimeOff/PolicySettings/PolicySettings.js +66 -41
- package/dist/components/TimeOff/PolicySettings/PolicySettings.js.map +1 -1
- package/dist/components/TimeOff/PolicySettings/PolicySettingsPresentation.d.ts +1 -1
- package/dist/components/TimeOff/PolicySettings/PolicySettingsPresentation.js +59 -48
- package/dist/components/TimeOff/PolicySettings/PolicySettingsPresentation.js.map +1 -1
- package/dist/components/TimeOff/PolicySettings/PolicySettingsTypes.d.ts +3 -0
- package/dist/components/TimeOff/PolicyTypeSelector/PolicyTypeSelectorPresentation.js +34 -33
- package/dist/components/TimeOff/PolicyTypeSelector/PolicyTypeSelectorPresentation.js.map +1 -1
- package/dist/components/TimeOff/TimeOffFlow/TimeOffFlowComponents.d.ts +3 -0
- package/dist/components/TimeOff/TimeOffFlow/TimeOffFlowComponents.js +69 -61
- package/dist/components/TimeOff/TimeOffFlow/TimeOffFlowComponents.js.map +1 -1
- package/dist/components/TimeOff/TimeOffFlow/timeOffStateMachine.js +119 -75
- package/dist/components/TimeOff/TimeOffFlow/timeOffStateMachine.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationForm.js +72 -61
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationForm.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormPresentation.d.ts +1 -1
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormPresentation.js +103 -84
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormPresentation.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormTypes.d.ts +2 -0
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday.js +51 -49
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.d.ts +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.js +78 -59
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.module.scss.js +8 -0
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.module.scss.js.map +1 -0
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentationTypes.d.ts +6 -2
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.js +209 -154
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.js.map +1 -1
- package/dist/components/TimeOff/TimeOffPolicyDetail/EditEmployeeBalanceModal.d.ts +3 -1
- package/dist/components/TimeOff/TimeOffPolicyDetail/EditEmployeeBalanceModal.js +36 -34
- package/dist/components/TimeOff/TimeOffPolicyDetail/EditEmployeeBalanceModal.js.map +1 -1
- package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetail.js +136 -134
- package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetail.js.map +1 -1
- package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetail.module.scss.js +6 -6
- package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetailPresentation.d.ts +1 -1
- package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetailPresentation.js +63 -65
- package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetailPresentation.js.map +1 -1
- package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetailTypes.d.ts +1 -0
- package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.js +50 -49
- package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.js.map +1 -1
- package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.module.scss.js +4 -4
- package/dist/components/TimeOff/shared/PolicyDetailLayout/PolicyDetailLayout.d.ts +1 -1
- package/dist/components/TimeOff/shared/PolicyDetailLayout/PolicyDetailLayout.js +66 -55
- package/dist/components/TimeOff/shared/PolicyDetailLayout/PolicyDetailLayout.js.map +1 -1
- package/dist/components/TimeOff/shared/PolicyDetailLayout/PolicyDetailLayoutTypes.d.ts +1 -0
- package/dist/contexts/ApiProvider/ApiProvider.js +33 -39
- package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -1
- package/dist/contexts/ApiProvider/createSdkQueryClient.d.ts +17 -0
- package/dist/contexts/ApiProvider/createSdkQueryClient.js +14 -0
- package/dist/contexts/ApiProvider/createSdkQueryClient.js.map +1 -0
- package/dist/helpers/dateFormatting.js +52 -56
- package/dist/helpers/dateFormatting.js.map +1 -1
- package/dist/helpers/formattedStrings.d.ts +12 -0
- package/dist/helpers/formattedStrings.js +55 -33
- package/dist/helpers/formattedStrings.js.map +1 -1
- package/dist/hooks/useClientPagination/useClientPagination.d.ts +44 -0
- package/dist/hooks/useClientPagination/useClientPagination.js +69 -0
- package/dist/hooks/useClientPagination/useClientPagination.js.map +1 -0
- package/dist/hooks/useClientPagination/useClientPagination.test.d.ts +1 -0
- package/dist/i18n/I18n.js +6 -5
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Company.PaySchedule.json.js +22 -20
- package/dist/i18n/en/Company.PaySchedule.json.js.map +1 -1
- package/dist/i18n/en/Company.TimeOff.CreateTimeOffPolicy.json.js +8 -6
- package/dist/i18n/en/Company.TimeOff.CreateTimeOffPolicy.json.js.map +1 -1
- package/dist/i18n/en/Company.TimeOff.HolidayPolicy.json.js +9 -9
- package/dist/i18n/en/Company.TimeOff.PolicyDetail.json.js +6 -4
- package/dist/i18n/en/Company.TimeOff.PolicyDetail.json.js.map +1 -1
- package/dist/i18n/en/Company.TimeOff.SelectEmployees.json.js +17 -15
- package/dist/i18n/en/Company.TimeOff.SelectEmployees.json.js.map +1 -1
- package/dist/i18n/en/Company.TimeOff.SelectPolicyType.json.js +10 -8
- package/dist/i18n/en/Company.TimeOff.SelectPolicyType.json.js.map +1 -1
- package/dist/i18n/en/Employee.Dashboard.json.js +16 -12
- package/dist/i18n/en/Employee.Dashboard.json.js.map +1 -1
- package/dist/i18n/en/Employee.Deductions.json.js +104 -76
- package/dist/i18n/en/Employee.Deductions.json.js.map +1 -1
- package/dist/i18n/en/Employee.DocumentManager.json.js +12 -0
- package/dist/i18n/en/Employee.DocumentManager.json.js.map +1 -0
- package/dist/i18n/en/Employee.PaymentMethod.json.js +76 -64
- package/dist/i18n/en/Employee.PaymentMethod.json.js.map +1 -1
- package/dist/i18n/en/common.json.d.ts +7 -0
- package/dist/i18n/en/common.json.js +19 -17
- package/dist/i18n/en/common.json.js.map +1 -1
- package/dist/index.d.ts +16 -6
- package/dist/index.js +138 -112
- package/dist/index.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/NumberInputHookField.d.ts +2 -1
- package/dist/partner-hook-utils/form/fields/NumberInputHookField.js +20 -18
- package/dist/partner-hook-utils/form/fields/NumberInputHookField.js.map +1 -1
- package/dist/shared/constants.d.ts +8 -2
- package/dist/shared/constants.js +11 -8
- package/dist/shared/constants.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/test-utils/assertions.d.ts +20 -0
- package/dist/types/i18next.d.ts +140 -4
- package/dist/types/sdkError.js +58 -47
- package/dist/types/sdkError.js.map +1 -1
- package/docs/reference/endpoint-inventory.json +980 -1170
- package/package.json +33 -22
- package/dist/components/Employee/Compensation/Compensation.js +0 -87
- package/dist/components/Employee/Compensation/Compensation.js.map +0 -1
- package/dist/components/Employee/Compensation/CompensationFlowComponents.js +0 -61
- package/dist/components/Employee/Compensation/CompensationFlowComponents.js.map +0 -1
- package/dist/components/Employee/Compensation/EditCompensation/EditCompensation.d.ts +0 -14
- package/dist/components/Employee/Compensation/EditCompensation/EditCompensation.js +0 -128
- package/dist/components/Employee/Compensation/EditCompensation/EditCompensation.js.map +0 -1
- package/dist/components/Employee/Compensation/EditCompensation/EditCompensationPresentation.d.ts +0 -17
- package/dist/components/Employee/Compensation/EditCompensation/EditCompensationPresentation.js +0 -224
- package/dist/components/Employee/Compensation/EditCompensation/EditCompensationPresentation.js.map +0 -1
- package/dist/components/Employee/Compensation/EditCompensation/index.d.ts +0 -5
- package/dist/components/Employee/Compensation/JobsList/JobsList.js +0 -47
- package/dist/components/Employee/Compensation/JobsList/JobsList.js.map +0 -1
- package/dist/components/Employee/Compensation/JobsList/JobsListPresentation.js.map +0 -1
- package/dist/components/Employee/Compensation/compensationSchema.d.ts +0 -29
- package/dist/components/Employee/Compensation/compensationSchema.js +0 -63
- package/dist/components/Employee/Compensation/compensationSchema.js.map +0 -1
- package/dist/components/Employee/Compensation/compensationStateMachine.js.map +0 -1
- package/dist/components/Employee/Compensation/shared/useCompensationForm/useCurrentCompensationForm.d.ts +0 -15
- package/dist/components/Employee/Compensation/shared/useCompensationForm/useCurrentCompensationForm.js +0 -27
- package/dist/components/Employee/Compensation/shared/useCompensationForm/useCurrentCompensationForm.js.map +0 -1
- package/dist/components/Employee/Compensation/shared/useJobForm/useCurrentJobForm.d.ts +0 -13
- package/dist/components/Employee/Compensation/shared/useJobForm/useCurrentJobForm.js +0 -26
- package/dist/components/Employee/Compensation/shared/useJobForm/useCurrentJobForm.js.map +0 -1
- package/dist/components/Employee/Deductions/Actions.d.ts +0 -1
- package/dist/components/Employee/Deductions/DeductionsComponents.js +0 -31
- package/dist/components/Employee/Deductions/DeductionsComponents.js.map +0 -1
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.d.ts +0 -39
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +0 -237
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +0 -1
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.d.ts +0 -22
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +0 -162
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +0 -1
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.d.ts +0 -34
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +0 -168
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +0 -1
- package/dist/components/Employee/Deductions/Head.d.ts +0 -1
- package/dist/components/Employee/Deductions/useDeductions.d.ts +0 -30
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +0 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +0 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/Head.js.map +0 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +0 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +0 -24
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +0 -1
- package/dist/components/Employee/DocumentSigner/DocumentSigner.js.map +0 -1
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibility.js.map +0 -1
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js.map +0 -1
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.js.map +0 -1
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/countries.js.map +0 -1
- package/dist/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.js.map +0 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +0 -1
- package/dist/components/Employee/DocumentSigner/documentSignerStateMachine.js.map +0 -1
- package/dist/components/Employee/DocumentSigner/shared/useSignEmployeeForm/fields.js.map +0 -1
- package/dist/components/Employee/DocumentSigner/shared/useSignEmployeeForm/signEmployeeFormSchema.js.map +0 -1
- package/dist/components/Employee/DocumentSigner/shared/useSignEmployeeForm/useSignEmployeeForm.js.map +0 -1
- package/dist/components/Employee/DocumentSigner/stateMachine.js.map +0 -1
- package/dist/components/Employee/EmployeeDocuments/EmployeeDocuments.js.map +0 -1
- package/dist/components/Employee/EmployeeDocuments/EmployeeDocumentsPresentation.js +0 -115
- package/dist/components/Employee/EmployeeDocuments/EmployeeDocumentsPresentation.js.map +0 -1
- package/dist/components/Employee/PaymentMethod/Actions.d.ts +0 -1
- package/dist/components/Employee/PaymentMethod/Actions.js +0 -20
- package/dist/components/Employee/PaymentMethod/Actions.js.map +0 -1
- package/dist/components/Employee/PaymentMethod/BankAccount.d.ts +0 -13
- package/dist/components/Employee/PaymentMethod/BankAccount.js +0 -13
- package/dist/components/Employee/PaymentMethod/BankAccount.js.map +0 -1
- package/dist/components/Employee/PaymentMethod/BankAccountEdit.d.ts +0 -1
- package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +0 -58
- package/dist/components/Employee/PaymentMethod/BankAccountEdit.js.map +0 -1
- package/dist/components/Employee/PaymentMethod/BankAccountsList.d.ts +0 -1
- package/dist/components/Employee/PaymentMethod/BankAccountsList.js +0 -51
- package/dist/components/Employee/PaymentMethod/BankAccountsList.js.map +0 -1
- package/dist/components/Employee/PaymentMethod/Head.d.ts +0 -1
- package/dist/components/Employee/PaymentMethod/Head.js +0 -13
- package/dist/components/Employee/PaymentMethod/Head.js.map +0 -1
- package/dist/components/Employee/PaymentMethod/PaymentMethod.d.ts +0 -9
- package/dist/components/Employee/PaymentMethod/PaymentMethod.js +0 -183
- package/dist/components/Employee/PaymentMethod/PaymentMethod.js.map +0 -1
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.d.ts +0 -10
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +0 -38
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +0 -1
- package/dist/components/Employee/PaymentMethod/Split.d.ts +0 -1
- package/dist/components/Employee/PaymentMethod/Split.js +0 -175
- package/dist/components/Employee/PaymentMethod/Split.js.map +0 -1
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.d.ts +0 -54
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +0 -68
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +0 -1
- /package/dist/components/Employee/Compensation/{JobsList → onboarding/JobsList}/JobsListPresentation.d.ts +0 -0
- /package/dist/components/Employee/Compensation/{JobsList → onboarding/JobsList}/index.d.ts +0 -0
- /package/dist/components/Employee/Compensation/{compensationStateMachine.d.ts → onboarding/compensationStateMachine.d.ts} +0 -0
- /package/dist/components/Employee/{DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.test.d.ts → Compensation/shared/derivePrimaryFlsaStatus.test.d.ts} +0 -0
- /package/dist/components/Employee/{DocumentSigner → Documents/onboarding/DocumentSigner}/DocumentList/Actions.d.ts +0 -0
- /package/dist/components/Employee/{DocumentSigner → Documents/onboarding/DocumentSigner}/DocumentList/Head.d.ts +0 -0
- /package/dist/components/Employee/{DocumentSigner → Documents/onboarding/DocumentSigner}/DocumentList/List.d.ts +0 -0
- /package/dist/components/Employee/{DocumentSigner → Documents/onboarding/DocumentSigner}/DocumentList/useDocumentList.d.ts +0 -0
- /package/dist/components/Employee/{DocumentSigner → Documents/onboarding/DocumentSigner}/EmploymentEligibility/EmploymentEligibilityPresentation.d.ts +0 -0
- /package/dist/components/Employee/{DocumentSigner → Documents/onboarding/DocumentSigner}/EmploymentEligibility/EmploymentEligibilitySchema.d.ts +0 -0
- /package/dist/components/Employee/{DocumentSigner → Documents/onboarding/DocumentSigner}/EmploymentEligibility/EmploymentEligibilitySchema.js +0 -0
- /package/dist/components/Employee/{DocumentSigner → Documents/onboarding/DocumentSigner}/EmploymentEligibility/countries.d.ts +0 -0
- /package/dist/components/Employee/{DocumentSigner → Documents/onboarding/DocumentSigner}/EmploymentEligibility/countries.js +0 -0
- /package/dist/components/Employee/{DocumentSigner → Documents/onboarding/DocumentSigner}/EmploymentEligibility/index.d.ts +0 -0
- /package/dist/components/Employee/{DocumentSigner → Documents/onboarding/DocumentSigner}/I9SignatureForm/I9SignatureForm.module.scss.js +0 -0
- /package/dist/components/Employee/{DocumentSigner → Documents/onboarding/DocumentSigner}/I9SignatureForm/I9SignatureForm.module.scss.js.map +0 -0
- /package/dist/components/Employee/{DocumentSigner → Documents/onboarding/DocumentSigner}/index.d.ts +0 -0
- /package/dist/components/Employee/{DocumentSigner → Documents/onboarding/DocumentSigner}/stateMachine.d.ts +0 -0
- /package/dist/components/Employee/{EmployeeDocuments → Documents/onboarding/EmployeeDocuments}/EmployeeDocumentsPresentation.d.ts +0 -0
- /package/dist/components/Employee/{EmployeeDocuments → Documents/onboarding/EmployeeDocuments}/index.d.ts +0 -0
- /package/dist/components/Employee/{DocumentSigner → Documents}/shared/useSignEmployeeForm/fields.d.ts +0 -0
- /package/dist/components/Employee/{DocumentSigner → Documents}/shared/useSignEmployeeForm/fields.js +0 -0
- /package/dist/components/Employee/{DocumentSigner → Documents}/shared/useSignEmployeeForm/index.d.ts +0 -0
- /package/dist/components/Employee/{DocumentSigner → Documents}/shared/useSignEmployeeForm/signEmployeeFormSchema.d.ts +0 -0
- /package/dist/components/Employee/{DocumentSigner → Documents}/shared/useSignEmployeeForm/signEmployeeFormSchema.js +0 -0
- /package/dist/components/Employee/{DocumentSigner → Documents}/shared/useSignEmployeeForm/useSignEmployeeForm.d.ts +0 -0
- /package/dist/components/Employee/{DocumentSigner → Documents}/shared/useSignEmployeeForm/useSignEmployeeForm.js +0 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { z as e } from "zod";
|
|
2
|
+
import { GarnishmentType as a } from "@gusto/embedded-api/models/components/garnishment";
|
|
3
|
+
import { buildFormSchema as c } from "../../../../../partner-hook-utils/form/buildFormSchema.js";
|
|
4
|
+
import { coerceNaN as o, coerceStringBoolean as n } from "../../../../../partner-hook-utils/form/preprocessors.js";
|
|
5
|
+
const r = {
|
|
6
|
+
REQUIRED: "REQUIRED",
|
|
7
|
+
NEGATIVE_AMOUNT: "NEGATIVE_AMOUNT"
|
|
8
|
+
}, u = {
|
|
9
|
+
description: e.string(),
|
|
10
|
+
// Radio groups deliver `'true'`/`'false'` strings; coerce to boolean for the
|
|
11
|
+
// submit payload. Matches the useJobForm pattern.
|
|
12
|
+
recurring: e.preprocess(n, e.boolean()),
|
|
13
|
+
deductAsPercentage: e.preprocess(n, e.boolean()),
|
|
14
|
+
// Currency / percent input. NumberInputField writes `number | undefined`;
|
|
15
|
+
// coerce to a numeric so .min(0) runs reliably. The number-to-string
|
|
16
|
+
// conversion the garnishment API expects happens inside the hook's onSubmit,
|
|
17
|
+
// so the form value stays a number end-to-end (input === output).
|
|
18
|
+
amount: e.preprocess(
|
|
19
|
+
o(0),
|
|
20
|
+
e.number().min(0, { message: r.NEGATIVE_AMOUNT })
|
|
21
|
+
),
|
|
22
|
+
// Optional caps. The hook drops them to `null` on the wire when 0 — matches
|
|
23
|
+
// the legacy DeductionSchema's "0 means no cap" behavior.
|
|
24
|
+
totalAmount: e.preprocess(
|
|
25
|
+
o(0),
|
|
26
|
+
e.number().min(0, { message: r.NEGATIVE_AMOUNT })
|
|
27
|
+
),
|
|
28
|
+
annualMaximum: e.preprocess(
|
|
29
|
+
o(0),
|
|
30
|
+
e.number().min(0, { message: r.NEGATIVE_AMOUNT })
|
|
31
|
+
),
|
|
32
|
+
// Only used when `courtOrdered: true` — see `excludeFields` below.
|
|
33
|
+
garnishmentType: e.enum(a)
|
|
34
|
+
}, p = {
|
|
35
|
+
totalAmount: "never",
|
|
36
|
+
annualMaximum: "never"
|
|
37
|
+
};
|
|
38
|
+
function A(m) {
|
|
39
|
+
const { mode: t = "create", courtOrdered: i, optionalFieldsToRequire: s } = m;
|
|
40
|
+
return c(u, {
|
|
41
|
+
requiredFieldsConfig: p,
|
|
42
|
+
requiredErrorCode: r.REQUIRED,
|
|
43
|
+
mode: t,
|
|
44
|
+
optionalFieldsToRequire: s,
|
|
45
|
+
excludeFields: i ? [] : ["garnishmentType"]
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
r as DeductionFormErrorCodes,
|
|
50
|
+
A as createDeductionFormSchema
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=deductionFormSchema.js.map
|
package/dist/components/Employee/Deductions/shared/useDeductionForm/deductionFormSchema.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deductionFormSchema.js","sources":["../../../../../../src/components/Employee/Deductions/shared/useDeductionForm/deductionFormSchema.ts"],"sourcesContent":["import { z } from 'zod'\nimport { GarnishmentType } from '@gusto/embedded-api/models/components/garnishment'\nimport {\n buildFormSchema,\n type RequiredFieldConfig,\n type OptionalFieldsToRequire,\n} from '@/partner-hook-utils/form/buildFormSchema'\nimport { coerceNaN, coerceStringBoolean } from '@/partner-hook-utils/form/preprocessors'\n\n// ── Error codes ────────────────────────────────────────────────────────\n\nexport const DeductionFormErrorCodes = {\n REQUIRED: 'REQUIRED',\n NEGATIVE_AMOUNT: 'NEGATIVE_AMOUNT',\n} as const\n\nexport type DeductionFormErrorCode =\n (typeof DeductionFormErrorCodes)[keyof typeof DeductionFormErrorCodes]\n\n// ── Field validators ───────────────────────────────────────────────────\n\nconst fieldValidators = {\n description: z.string(),\n // Radio groups deliver `'true'`/`'false'` strings; coerce to boolean for the\n // submit payload. Matches the useJobForm pattern.\n recurring: z.preprocess(coerceStringBoolean, z.boolean()),\n deductAsPercentage: z.preprocess(coerceStringBoolean, z.boolean()),\n // Currency / percent input. NumberInputField writes `number | undefined`;\n // coerce to a numeric so .min(0) runs reliably. The number-to-string\n // conversion the garnishment API expects happens inside the hook's onSubmit,\n // so the form value stays a number end-to-end (input === output).\n amount: z.preprocess(\n coerceNaN(0),\n z.number().min(0, { message: DeductionFormErrorCodes.NEGATIVE_AMOUNT }),\n ),\n // Optional caps. The hook drops them to `null` on the wire when 0 — matches\n // the legacy DeductionSchema's \"0 means no cap\" behavior.\n totalAmount: z.preprocess(\n coerceNaN(0),\n z.number().min(0, { message: DeductionFormErrorCodes.NEGATIVE_AMOUNT }),\n ),\n annualMaximum: z.preprocess(\n coerceNaN(0),\n z.number().min(0, { message: DeductionFormErrorCodes.NEGATIVE_AMOUNT }),\n ),\n // Only used when `courtOrdered: true` — see `excludeFields` below.\n garnishmentType: z.enum(GarnishmentType),\n}\n\nexport type DeductionFormField = keyof typeof fieldValidators\n\nexport type DeductionFormData = {\n [K in keyof typeof fieldValidators]: z.infer<(typeof fieldValidators)[K]>\n}\n\nexport type DeductionFormOutputs = DeductionFormData\n\n// ── Required fields config ─────────────────────────────────────────────\n//\n// `description`, `recurring`, `deductAsPercentage`, `amount` are required by\n// default. `garnishmentType` is required only when present in the shape\n// (court-ordered branch). `totalAmount` and `annualMaximum` are caps the\n// partner can leave blank.\n\nconst requiredFieldsConfig = {\n totalAmount: 'never',\n annualMaximum: 'never',\n} satisfies RequiredFieldConfig<typeof fieldValidators>\n\nexport type DeductionFormOptionalFieldsToRequire = OptionalFieldsToRequire<\n typeof requiredFieldsConfig\n>\n\ninterface DeductionFormSchemaOptions {\n mode?: 'create' | 'update'\n /**\n * Court-ordered garnishments require `garnishmentType` (Federal Tax Lien,\n * Student Loan, etc.). Non-court-ordered \"custom\" deductions don't carry a\n * type — the field is excluded from the schema entirely, matching the legacy\n * GarnishmentForm vs CustomDeductionForm split.\n */\n courtOrdered: boolean\n optionalFieldsToRequire?: DeductionFormOptionalFieldsToRequire\n}\n\nexport function createDeductionFormSchema(options: DeductionFormSchemaOptions) {\n const { mode = 'create', courtOrdered, optionalFieldsToRequire } = options\n\n return buildFormSchema(fieldValidators, {\n requiredFieldsConfig,\n requiredErrorCode: DeductionFormErrorCodes.REQUIRED,\n mode,\n optionalFieldsToRequire,\n excludeFields: courtOrdered ? [] : ['garnishmentType'],\n })\n}\n"],"names":["DeductionFormErrorCodes","fieldValidators","z","coerceStringBoolean","coerceNaN","GarnishmentType","requiredFieldsConfig","createDeductionFormSchema","options","mode","courtOrdered","optionalFieldsToRequire","buildFormSchema"],"mappings":";;;;AAWO,MAAMA,IAA0B;AAAA,EACrC,UAAU;AAAA,EACV,iBAAiB;AACnB,GAOMC,IAAkB;AAAA,EACtB,aAAaC,EAAE,OAAA;AAAA;AAAA;AAAA,EAGf,WAAWA,EAAE,WAAWC,GAAqBD,EAAE,SAAS;AAAA,EACxD,oBAAoBA,EAAE,WAAWC,GAAqBD,EAAE,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,EAKjE,QAAQA,EAAE;AAAA,IACRE,EAAU,CAAC;AAAA,IACXF,EAAE,SAAS,IAAI,GAAG,EAAE,SAASF,EAAwB,gBAAA,CAAiB;AAAA,EAAA;AAAA;AAAA;AAAA,EAIxE,aAAaE,EAAE;AAAA,IACbE,EAAU,CAAC;AAAA,IACXF,EAAE,SAAS,IAAI,GAAG,EAAE,SAASF,EAAwB,gBAAA,CAAiB;AAAA,EAAA;AAAA,EAExE,eAAeE,EAAE;AAAA,IACfE,EAAU,CAAC;AAAA,IACXF,EAAE,SAAS,IAAI,GAAG,EAAE,SAASF,EAAwB,gBAAA,CAAiB;AAAA,EAAA;AAAA;AAAA,EAGxE,iBAAiBE,EAAE,KAAKG,CAAe;AACzC,GAiBMC,IAAuB;AAAA,EAC3B,aAAa;AAAA,EACb,eAAe;AACjB;AAkBO,SAASC,EAA0BC,GAAqC;AAC7E,QAAM,EAAE,MAAAC,IAAO,UAAU,cAAAC,GAAc,yBAAAC,MAA4BH;AAEnE,SAAOI,EAAgBX,GAAiB;AAAA,IACtC,sBAAAK;AAAA,IACA,mBAAmBN,EAAwB;AAAA,IAC3C,MAAAS;AAAA,IACA,yBAAAE;AAAA,IACA,eAAeD,IAAe,CAAA,IAAK,CAAC,iBAAiB;AAAA,EAAA,CACtD;AACH;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { GarnishmentType } from '@gusto/embedded-api/models/components/garnishment';
|
|
2
|
+
import { DeductionFormErrorCodes } from './deductionFormSchema';
|
|
3
|
+
import { TextInputHookFieldProps } from '../../../../../partner-hook-utils/form/fields/TextInputHookField';
|
|
4
|
+
import { NumberInputHookFieldProps } from '../../../../../partner-hook-utils/form/fields/NumberInputHookField';
|
|
5
|
+
import { RadioGroupHookFieldProps } from '../../../../../partner-hook-utils/form/fields/RadioGroupHookField';
|
|
6
|
+
import { SelectHookFieldProps } from '../../../../../partner-hook-utils/form/fields/SelectHookField';
|
|
7
|
+
import { HookFieldProps } from '../../../../../partner-hook-utils/types';
|
|
8
|
+
export type RequiredValidation = typeof DeductionFormErrorCodes.REQUIRED;
|
|
9
|
+
export type NegativeAmountValidation = typeof DeductionFormErrorCodes.NEGATIVE_AMOUNT;
|
|
10
|
+
export type AmountValidation = RequiredValidation | NegativeAmountValidation;
|
|
11
|
+
export type CapValidation = NegativeAmountValidation;
|
|
12
|
+
export type DescriptionFieldProps = HookFieldProps<TextInputHookFieldProps<RequiredValidation>>;
|
|
13
|
+
export declare function DescriptionField(props: DescriptionFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export type RecurringFieldProps = HookFieldProps<RadioGroupHookFieldProps<RequiredValidation, boolean>>;
|
|
15
|
+
export declare function RecurringField(props: RecurringFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export type DeductAsPercentageFieldProps = HookFieldProps<RadioGroupHookFieldProps<RequiredValidation, boolean>>;
|
|
17
|
+
export declare function DeductAsPercentageField(props: DeductAsPercentageFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export type AmountFieldProps = HookFieldProps<NumberInputHookFieldProps<AmountValidation>>;
|
|
19
|
+
export declare function AmountField(props: AmountFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export type TotalAmountFieldProps = HookFieldProps<NumberInputHookFieldProps<CapValidation>>;
|
|
21
|
+
export declare function TotalAmountField(props: TotalAmountFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export type AnnualMaximumFieldProps = HookFieldProps<NumberInputHookFieldProps<CapValidation>>;
|
|
23
|
+
export declare function AnnualMaximumField(props: AnnualMaximumFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export type GarnishmentTypeFieldProps = HookFieldProps<SelectHookFieldProps<RequiredValidation, GarnishmentType>>;
|
|
25
|
+
export declare function GarnishmentTypeField(props: GarnishmentTypeFieldProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { SelectHookField as o } from "../../../../../partner-hook-utils/form/fields/SelectHookField.js";
|
|
3
|
+
import { NumberInputHookField as t } from "../../../../../partner-hook-utils/form/fields/NumberInputHookField.js";
|
|
4
|
+
import { RadioGroupHookField as r } from "../../../../../partner-hook-utils/form/fields/RadioGroupHookField.js";
|
|
5
|
+
import { TextInputHookField as i } from "../../../../../partner-hook-utils/form/fields/TextInputHookField.js";
|
|
6
|
+
function l(n) {
|
|
7
|
+
return /* @__PURE__ */ e(i, { ...n, name: "description" });
|
|
8
|
+
}
|
|
9
|
+
function p(n) {
|
|
10
|
+
return /* @__PURE__ */ e(r, { ...n, name: "recurring" });
|
|
11
|
+
}
|
|
12
|
+
function f(n) {
|
|
13
|
+
return /* @__PURE__ */ e(r, { ...n, name: "deductAsPercentage" });
|
|
14
|
+
}
|
|
15
|
+
function F(n) {
|
|
16
|
+
return /* @__PURE__ */ e(t, { ...n, name: "amount" });
|
|
17
|
+
}
|
|
18
|
+
function s(n) {
|
|
19
|
+
return /* @__PURE__ */ e(t, { ...n, name: "totalAmount" });
|
|
20
|
+
}
|
|
21
|
+
function A(n) {
|
|
22
|
+
return /* @__PURE__ */ e(t, { ...n, name: "annualMaximum" });
|
|
23
|
+
}
|
|
24
|
+
function g(n) {
|
|
25
|
+
return /* @__PURE__ */ e(o, { ...n, name: "garnishmentType" });
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
F as AmountField,
|
|
29
|
+
A as AnnualMaximumField,
|
|
30
|
+
f as DeductAsPercentageField,
|
|
31
|
+
l as DescriptionField,
|
|
32
|
+
g as GarnishmentTypeField,
|
|
33
|
+
p as RecurringField,
|
|
34
|
+
s as TotalAmountField
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.js","sources":["../../../../../../src/components/Employee/Deductions/shared/useDeductionForm/fields.tsx"],"sourcesContent":["import type { GarnishmentType } from '@gusto/embedded-api/models/components/garnishment'\nimport type { DeductionFormErrorCodes } from './deductionFormSchema'\nimport type { TextInputHookFieldProps } from '@/partner-hook-utils/form/fields/TextInputHookField'\nimport type { NumberInputHookFieldProps } from '@/partner-hook-utils/form/fields/NumberInputHookField'\nimport type { RadioGroupHookFieldProps } from '@/partner-hook-utils/form/fields/RadioGroupHookField'\nimport type { SelectHookFieldProps } from '@/partner-hook-utils/form/fields/SelectHookField'\nimport {\n TextInputHookField,\n NumberInputHookField,\n RadioGroupHookField,\n SelectHookField,\n} from '@/partner-hook-utils/form/fields'\nimport type { HookFieldProps } from '@/partner-hook-utils/types'\n\nexport type RequiredValidation = typeof DeductionFormErrorCodes.REQUIRED\nexport type NegativeAmountValidation = typeof DeductionFormErrorCodes.NEGATIVE_AMOUNT\n\nexport type AmountValidation = RequiredValidation | NegativeAmountValidation\nexport type CapValidation = NegativeAmountValidation\n\n// ── Description ────────────────────────────────────────────────────────\n\nexport type DescriptionFieldProps = HookFieldProps<TextInputHookFieldProps<RequiredValidation>>\n\nexport function DescriptionField(props: DescriptionFieldProps) {\n return <TextInputHookField {...props} name=\"description\" />\n}\n\n// ── Recurring (radio: boolean) ─────────────────────────────────────────\n\nexport type RecurringFieldProps = HookFieldProps<\n RadioGroupHookFieldProps<RequiredValidation, boolean>\n>\n\nexport function RecurringField(props: RecurringFieldProps) {\n return <RadioGroupHookField {...props} name=\"recurring\" />\n}\n\n// ── DeductAsPercentage (radio: boolean) ────────────────────────────────\n\nexport type DeductAsPercentageFieldProps = HookFieldProps<\n RadioGroupHookFieldProps<RequiredValidation, boolean>\n>\n\nexport function DeductAsPercentageField(props: DeductAsPercentageFieldProps) {\n return <RadioGroupHookField {...props} name=\"deductAsPercentage\" />\n}\n\n// ── Amount (currency or percent depending on deductAsPercentage) ───────\n\nexport type AmountFieldProps = HookFieldProps<NumberInputHookFieldProps<AmountValidation>>\n\nexport function AmountField(props: AmountFieldProps) {\n return <NumberInputHookField {...props} name=\"amount\" />\n}\n\n// ── TotalAmount (optional cap — only meaningful when recurring) ────────\n\nexport type TotalAmountFieldProps = HookFieldProps<NumberInputHookFieldProps<CapValidation>>\n\nexport function TotalAmountField(props: TotalAmountFieldProps) {\n return <NumberInputHookField {...props} name=\"totalAmount\" />\n}\n\n// ── AnnualMaximum (optional annual cap — only meaningful when recurring) ─\n\nexport type AnnualMaximumFieldProps = HookFieldProps<NumberInputHookFieldProps<CapValidation>>\n\nexport function AnnualMaximumField(props: AnnualMaximumFieldProps) {\n return <NumberInputHookField {...props} name=\"annualMaximum\" />\n}\n\n// ── GarnishmentType (court-ordered only) ───────────────────────────────\n\nexport type GarnishmentTypeFieldProps = HookFieldProps<\n SelectHookFieldProps<RequiredValidation, GarnishmentType>\n>\n\nexport function GarnishmentTypeField(props: GarnishmentTypeFieldProps) {\n return <SelectHookField {...props} name=\"garnishmentType\" />\n}\n"],"names":["DescriptionField","props","jsx","TextInputHookField","RecurringField","RadioGroupHookField","DeductAsPercentageField","AmountField","NumberInputHookField","TotalAmountField","AnnualMaximumField","GarnishmentTypeField","SelectHookField"],"mappings":";;;;;AAwBO,SAASA,EAAiBC,GAA8B;AAC7D,SAAO,gBAAAC,EAACC,GAAA,EAAoB,GAAGF,GAAO,MAAK,eAAc;AAC3D;AAQO,SAASG,EAAeH,GAA4B;AACzD,SAAO,gBAAAC,EAACG,GAAA,EAAqB,GAAGJ,GAAO,MAAK,aAAY;AAC1D;AAQO,SAASK,EAAwBL,GAAqC;AAC3E,SAAO,gBAAAC,EAACG,GAAA,EAAqB,GAAGJ,GAAO,MAAK,sBAAqB;AACnE;AAMO,SAASM,EAAYN,GAAyB;AACnD,SAAO,gBAAAC,EAACM,GAAA,EAAsB,GAAGP,GAAO,MAAK,UAAS;AACxD;AAMO,SAASQ,EAAiBR,GAA8B;AAC7D,SAAO,gBAAAC,EAACM,GAAA,EAAsB,GAAGP,GAAO,MAAK,eAAc;AAC7D;AAMO,SAASS,EAAmBT,GAAgC;AACjE,SAAO,gBAAAC,EAACM,GAAA,EAAsB,GAAGP,GAAO,MAAK,iBAAgB;AAC/D;AAQO,SAASU,EAAqBV,GAAkC;AACrE,SAAO,gBAAAC,EAACU,GAAA,EAAiB,GAAGX,GAAO,MAAK,mBAAkB;AAC5D;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import "./types/i18next.d.ts"
|
|
2
|
+
export { useDeductionForm, type UseDeductionFormProps, type UseDeductionFormResult, type UseDeductionFormReady, type DeductionFormFields, type DeductionFormFieldsMetadata, type DeductionFormFieldsType, type DeductionFormOptionalFieldsToRequire, } from './useDeductionForm';
|
|
3
|
+
export { createDeductionFormSchema, DeductionFormErrorCodes, type DeductionFormErrorCode, type DeductionFormData, type DeductionFormOutputs, type DeductionFormField, } from './deductionFormSchema';
|
|
4
|
+
export type { RequiredValidation as DeductionFormRequiredValidation, NegativeAmountValidation as DeductionFormNegativeAmountValidation, AmountValidation as DeductionFormAmountValidation, CapValidation as DeductionFormCapValidation, DescriptionFieldProps, RecurringFieldProps, DeductAsPercentageFieldProps, AmountFieldProps, TotalAmountFieldProps, AnnualMaximumFieldProps, GarnishmentTypeFieldProps, } from './fields';
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { UseFormProps } from 'react-hook-form';
|
|
2
|
+
import { Garnishment } from '@gusto/embedded-api/models/components/garnishment';
|
|
3
|
+
import { DeductionFormData, DeductionFormOptionalFieldsToRequire } from './deductionFormSchema';
|
|
4
|
+
import { DescriptionField, RecurringField, DeductAsPercentageField, AmountField, TotalAmountField, AnnualMaximumField, GarnishmentTypeField } from './fields';
|
|
5
|
+
import { BaseFormHookReady, FieldsMetadata, HookLoadingResult, HookSubmitResult } from '../../../../../partner-hook-utils/types';
|
|
6
|
+
export type { DeductionFormOptionalFieldsToRequire } from './deductionFormSchema';
|
|
7
|
+
export interface UseDeductionFormProps {
|
|
8
|
+
employeeId: string;
|
|
9
|
+
/**
|
|
10
|
+
* When set, loads that garnishment via the list query and updates it (PUT).
|
|
11
|
+
* When omitted, the form is in create mode (POST).
|
|
12
|
+
*/
|
|
13
|
+
garnishmentId?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Court-ordered deductions are stored as garnishments with `courtOrdered:
|
|
16
|
+
* true` and require a `garnishmentType` (Federal Tax Lien, Student Loan,
|
|
17
|
+
* etc.). When `false`, the form is for a "custom" post-tax deduction —
|
|
18
|
+
* `garnishmentType` is excluded from the schema and submit payload.
|
|
19
|
+
*
|
|
20
|
+
* Note: this hook does NOT handle `garnishmentType: 'child_support'`. Use
|
|
21
|
+
* `useChildSupportGarnishmentForm` for child-support agency-keyed payloads.
|
|
22
|
+
*/
|
|
23
|
+
courtOrdered: boolean;
|
|
24
|
+
optionalFieldsToRequire?: DeductionFormOptionalFieldsToRequire;
|
|
25
|
+
defaultValues?: Partial<DeductionFormData>;
|
|
26
|
+
validationMode?: UseFormProps['mode'];
|
|
27
|
+
shouldFocusError?: boolean;
|
|
28
|
+
}
|
|
29
|
+
export interface DeductionFormFields {
|
|
30
|
+
Description: typeof DescriptionField;
|
|
31
|
+
Recurring: typeof RecurringField;
|
|
32
|
+
DeductAsPercentage: typeof DeductAsPercentageField;
|
|
33
|
+
Amount: typeof AmountField;
|
|
34
|
+
/** Only available when `status.isRecurring` is true. */
|
|
35
|
+
TotalAmount: typeof TotalAmountField | undefined;
|
|
36
|
+
/** Only available when `status.isRecurring` is true. */
|
|
37
|
+
AnnualMaximum: typeof AnnualMaximumField | undefined;
|
|
38
|
+
/** Only available when `courtOrdered: true`. */
|
|
39
|
+
GarnishmentType: typeof GarnishmentTypeField | undefined;
|
|
40
|
+
}
|
|
41
|
+
export interface UseDeductionFormReady extends BaseFormHookReady<FieldsMetadata, DeductionFormData, DeductionFormFields> {
|
|
42
|
+
data: {
|
|
43
|
+
/** The garnishment loaded for update; `null` in create mode. */
|
|
44
|
+
deduction: Garnishment | null;
|
|
45
|
+
};
|
|
46
|
+
status: {
|
|
47
|
+
isPending: boolean;
|
|
48
|
+
mode: 'create' | 'update';
|
|
49
|
+
/**
|
|
50
|
+
* Mirrors the watched `recurring` value. Cap fields (`TotalAmount`,
|
|
51
|
+
* `AnnualMaximum`) are only included on `Fields` when this is true — the
|
|
52
|
+
* consumer can render them unconditionally and the gating happens in the
|
|
53
|
+
* hook.
|
|
54
|
+
*/
|
|
55
|
+
isRecurring: boolean;
|
|
56
|
+
};
|
|
57
|
+
actions: {
|
|
58
|
+
onSubmit: () => Promise<HookSubmitResult<Garnishment> | undefined>;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
export type UseDeductionFormResult = HookLoadingResult | UseDeductionFormReady;
|
|
62
|
+
export declare function useDeductionForm({ employeeId, garnishmentId, courtOrdered, optionalFieldsToRequire, defaultValues: partnerDefaults, validationMode, shouldFocusError, }: UseDeductionFormProps): UseDeductionFormResult;
|
|
63
|
+
export type DeductionFormFieldsMetadata = UseDeductionFormReady['form']['fieldsMetadata'];
|
|
64
|
+
export type DeductionFormFieldsType = UseDeductionFormReady['form']['Fields'];
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { useMemo as g } from "react";
|
|
2
|
+
import { useForm as B, useWatch as K } from "react-hook-form";
|
|
3
|
+
import { zodResolver as Q } from "@hookform/resolvers/zod";
|
|
4
|
+
import { useGarnishmentsCreateMutation as U } from "@gusto/embedded-api/react-query/garnishmentsCreate";
|
|
5
|
+
import { useGarnishmentsUpdateMutation as W } from "@gusto/embedded-api/react-query/garnishmentsUpdate";
|
|
6
|
+
import { useGarnishmentsList as Y } from "@gusto/embedded-api/react-query/garnishmentsList";
|
|
7
|
+
import { createDeductionFormSchema as j } from "./deductionFormSchema.js";
|
|
8
|
+
import { GarnishmentTypeField as J, AnnualMaximumField as X, TotalAmountField as Z, AmountField as $, DeductAsPercentageField as O, RecurringField as ee, DescriptionField as te } from "./fields.js";
|
|
9
|
+
import { useDeriveFieldsMetadata as ne } from "../../../../../partner-hook-utils/form/useDeriveFieldsMetadata.js";
|
|
10
|
+
import { useHookFormInternals as re } from "../../../../../partner-hook-utils/form/useHookFormInternals.js";
|
|
11
|
+
import { createGetFormSubmissionValues as ie } from "../../../../../partner-hook-utils/form/getFormSubmissionValues.js";
|
|
12
|
+
import { withOptions as h } from "../../../../../partner-hook-utils/form/withOptions.js";
|
|
13
|
+
import { composeErrorHandler as ae } from "../../../../../partner-hook-utils/composeErrorHandler.js";
|
|
14
|
+
import { useBaseSubmit as oe } from "../../../../Base/useBaseSubmit.js";
|
|
15
|
+
import { SDKInternalError as G } from "../../../../../types/sdkError.js";
|
|
16
|
+
const _ = [
|
|
17
|
+
"federal_tax_lien",
|
|
18
|
+
"state_tax_lien",
|
|
19
|
+
"student_loan",
|
|
20
|
+
"creditor_garnishment",
|
|
21
|
+
"federal_loan",
|
|
22
|
+
"other_garnishment"
|
|
23
|
+
];
|
|
24
|
+
function Te({
|
|
25
|
+
employeeId: m,
|
|
26
|
+
garnishmentId: s,
|
|
27
|
+
courtOrdered: n,
|
|
28
|
+
optionalFieldsToRequire: f,
|
|
29
|
+
defaultValues: i,
|
|
30
|
+
validationMode: L = "onSubmit",
|
|
31
|
+
shouldFocusError: E = !0
|
|
32
|
+
}) {
|
|
33
|
+
const r = !s, p = r ? "create" : "update", c = se({
|
|
34
|
+
employeeId: m,
|
|
35
|
+
enabled: !r
|
|
36
|
+
}), e = g(() => r ? null : c.data?.find((o) => o.uuid === s) ?? null, [r, s, c.data]), [A, R] = g(
|
|
37
|
+
() => j({
|
|
38
|
+
mode: p,
|
|
39
|
+
courtOrdered: n,
|
|
40
|
+
optionalFieldsToRequire: f
|
|
41
|
+
}),
|
|
42
|
+
[p, n, f]
|
|
43
|
+
), M = g(
|
|
44
|
+
() => ({
|
|
45
|
+
description: e?.description ?? i?.description ?? "",
|
|
46
|
+
recurring: e?.recurring ?? i?.recurring ?? !0,
|
|
47
|
+
deductAsPercentage: e?.deductAsPercentage ?? i?.deductAsPercentage ?? !0,
|
|
48
|
+
amount: e?.amount ? Number(e.amount) : i?.amount ?? 0,
|
|
49
|
+
// Caps stay as numbers in the form (0 means "no cap"); the hook drops
|
|
50
|
+
// them to null on the wire in onSubmit.
|
|
51
|
+
totalAmount: e?.totalAmount ? Number(e.totalAmount) : i?.totalAmount ?? 0,
|
|
52
|
+
annualMaximum: e?.annualMaximum ? Number(e.annualMaximum) : i?.annualMaximum ?? 0,
|
|
53
|
+
garnishmentType: e?.garnishmentType ?? i?.garnishmentType ?? // First non-child-support type — partners typically pick via the
|
|
54
|
+
// GarnishmentType select before saving.
|
|
55
|
+
"federal_tax_lien"
|
|
56
|
+
}),
|
|
57
|
+
[e, i]
|
|
58
|
+
), u = B({
|
|
59
|
+
resolver: Q(A),
|
|
60
|
+
mode: L,
|
|
61
|
+
shouldFocusError: E,
|
|
62
|
+
defaultValues: M,
|
|
63
|
+
values: M,
|
|
64
|
+
resetOptions: { keepDirtyValues: !0 }
|
|
65
|
+
}), l = K({ control: u.control, name: "recurring" }), b = U(), v = W(), y = b.isPending || v.isPending, {
|
|
66
|
+
baseSubmitHandler: D,
|
|
67
|
+
error: q,
|
|
68
|
+
setError: H
|
|
69
|
+
} = oe("DeductionForm"), F = ae(r ? [] : [c], { submitError: q, setSubmitError: H }), N = _.map((o) => ({ value: o, label: o })), a = ne(R, u.control), V = {
|
|
70
|
+
description: a.description,
|
|
71
|
+
recurring: h(
|
|
72
|
+
a.recurring,
|
|
73
|
+
[
|
|
74
|
+
{ value: "true", label: "true" },
|
|
75
|
+
{ value: "false", label: "false" }
|
|
76
|
+
],
|
|
77
|
+
[!0, !1]
|
|
78
|
+
),
|
|
79
|
+
deductAsPercentage: h(
|
|
80
|
+
a.deductAsPercentage,
|
|
81
|
+
[
|
|
82
|
+
{ value: "true", label: "true" },
|
|
83
|
+
{ value: "false", label: "false" }
|
|
84
|
+
],
|
|
85
|
+
[!0, !1]
|
|
86
|
+
),
|
|
87
|
+
amount: a.amount,
|
|
88
|
+
totalAmount: a.totalAmount,
|
|
89
|
+
annualMaximum: a.annualMaximum,
|
|
90
|
+
garnishmentType: n ? h(a.garnishmentType, N, _) : a.garnishmentType
|
|
91
|
+
}, k = async () => {
|
|
92
|
+
let o;
|
|
93
|
+
return await new Promise((S) => {
|
|
94
|
+
u.handleSubmit(
|
|
95
|
+
async (I) => {
|
|
96
|
+
await D(I, async (t) => {
|
|
97
|
+
const x = t.recurring ? null : 1, P = String(t.amount), T = t.totalAmount > 0 ? String(t.totalAmount) : void 0, w = t.annualMaximum > 0 ? String(t.annualMaximum) : void 0;
|
|
98
|
+
let d;
|
|
99
|
+
if (r)
|
|
100
|
+
d = (await b.mutateAsync({
|
|
101
|
+
request: {
|
|
102
|
+
employeeId: m,
|
|
103
|
+
garnishmentRequest: {
|
|
104
|
+
active: !0,
|
|
105
|
+
description: t.description,
|
|
106
|
+
recurring: t.recurring,
|
|
107
|
+
deductAsPercentage: t.deductAsPercentage,
|
|
108
|
+
amount: P,
|
|
109
|
+
totalAmount: T,
|
|
110
|
+
annualMaximum: w,
|
|
111
|
+
courtOrdered: n,
|
|
112
|
+
garnishmentType: n ? t.garnishmentType : void 0,
|
|
113
|
+
times: x
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
})).garnishment;
|
|
117
|
+
else {
|
|
118
|
+
if (!e)
|
|
119
|
+
throw new G(
|
|
120
|
+
"Cannot update deduction: no matching garnishment on file"
|
|
121
|
+
);
|
|
122
|
+
d = (await v.mutateAsync({
|
|
123
|
+
request: {
|
|
124
|
+
garnishmentId: e.uuid,
|
|
125
|
+
updateGarnishmentRequest: {
|
|
126
|
+
version: e.version,
|
|
127
|
+
active: !0,
|
|
128
|
+
description: t.description,
|
|
129
|
+
recurring: t.recurring,
|
|
130
|
+
deductAsPercentage: t.deductAsPercentage,
|
|
131
|
+
amount: P,
|
|
132
|
+
totalAmount: T,
|
|
133
|
+
annualMaximum: w,
|
|
134
|
+
courtOrdered: n,
|
|
135
|
+
// The API rejects garnishment_type changes on update — only
|
|
136
|
+
// include when court-ordered AND when matching the loaded
|
|
137
|
+
// row's type (no-op pass-through).
|
|
138
|
+
garnishmentType: n ? t.garnishmentType : void 0,
|
|
139
|
+
times: x
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
})).garnishment;
|
|
143
|
+
}
|
|
144
|
+
if (!d)
|
|
145
|
+
throw new G(
|
|
146
|
+
r ? "Deduction creation failed" : "Deduction update failed"
|
|
147
|
+
);
|
|
148
|
+
o = {
|
|
149
|
+
mode: r ? "create" : "update",
|
|
150
|
+
data: d
|
|
151
|
+
};
|
|
152
|
+
}), S();
|
|
153
|
+
},
|
|
154
|
+
() => {
|
|
155
|
+
S();
|
|
156
|
+
}
|
|
157
|
+
)();
|
|
158
|
+
}), o;
|
|
159
|
+
}, C = re(u);
|
|
160
|
+
return !r && c.isLoading ? { isLoading: !0, errorHandling: F } : {
|
|
161
|
+
isLoading: !1,
|
|
162
|
+
data: {
|
|
163
|
+
deduction: e
|
|
164
|
+
},
|
|
165
|
+
status: {
|
|
166
|
+
isPending: y,
|
|
167
|
+
mode: r ? "create" : "update",
|
|
168
|
+
isRecurring: l
|
|
169
|
+
},
|
|
170
|
+
actions: { onSubmit: k },
|
|
171
|
+
errorHandling: F,
|
|
172
|
+
form: {
|
|
173
|
+
Fields: {
|
|
174
|
+
Description: te,
|
|
175
|
+
Recurring: ee,
|
|
176
|
+
DeductAsPercentage: O,
|
|
177
|
+
Amount: $,
|
|
178
|
+
TotalAmount: l ? Z : void 0,
|
|
179
|
+
AnnualMaximum: l ? X : void 0,
|
|
180
|
+
GarnishmentType: n ? J : void 0
|
|
181
|
+
},
|
|
182
|
+
fieldsMetadata: V,
|
|
183
|
+
hookFormInternals: C,
|
|
184
|
+
getFormSubmissionValues: ie(u, A)
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
function se({
|
|
189
|
+
employeeId: m,
|
|
190
|
+
enabled: s
|
|
191
|
+
}) {
|
|
192
|
+
const n = Y({ employeeId: m }, { enabled: s });
|
|
193
|
+
return {
|
|
194
|
+
data: n.data?.garnishments,
|
|
195
|
+
isLoading: n.isLoading,
|
|
196
|
+
error: n.error,
|
|
197
|
+
refetch: n.refetch
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
export {
|
|
201
|
+
Te as useDeductionForm
|
|
202
|
+
};
|
|
203
|
+
//# sourceMappingURL=useDeductionForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDeductionForm.js","sources":["../../../../../../src/components/Employee/Deductions/shared/useDeductionForm/useDeductionForm.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { useForm, useWatch } from 'react-hook-form'\nimport type { UseFormProps } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport {\n type Garnishment,\n type GarnishmentType,\n} from '@gusto/embedded-api/models/components/garnishment'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { useGarnishmentsList } from '@gusto/embedded-api/react-query/garnishmentsList'\nimport {\n createDeductionFormSchema,\n type DeductionFormData,\n type DeductionFormOutputs,\n type DeductionFormOptionalFieldsToRequire,\n} from './deductionFormSchema'\nimport {\n DescriptionField,\n RecurringField,\n DeductAsPercentageField,\n AmountField,\n TotalAmountField,\n AnnualMaximumField,\n GarnishmentTypeField,\n} from './fields'\nimport { useDeriveFieldsMetadata } from '@/partner-hook-utils/form/useDeriveFieldsMetadata'\nimport { useHookFormInternals } from '@/partner-hook-utils/form/useHookFormInternals'\nimport { createGetFormSubmissionValues } from '@/partner-hook-utils/form/getFormSubmissionValues'\nimport { withOptions } from '@/partner-hook-utils/form/withOptions'\nimport { composeErrorHandler } from '@/partner-hook-utils/composeErrorHandler'\nimport type {\n BaseFormHookReady,\n FieldsMetadata,\n HookLoadingResult,\n HookSubmitResult,\n} from '@/partner-hook-utils/types'\nimport { useBaseSubmit } from '@/components/Base/useBaseSubmit'\nimport { SDKInternalError } from '@/types/sdkError'\n\nexport type { DeductionFormOptionalFieldsToRequire } from './deductionFormSchema'\n\n// GarnishmentType is a runtime enum; the schema gates which values are valid.\n// The hook's `withOptions` entries below carry the raw enum values so the\n// consumer can supply translated labels via `getOptionLabel` on the field.\n//\n// `'child_support'` is intentionally omitted — child-support garnishments\n// require agency-keyed required attributes (case number, order number,\n// remittance number, county) that this hook doesn't model. Use\n// `useChildSupportGarnishmentForm` for those.\nconst GARNISHMENT_TYPES: readonly GarnishmentType[] = [\n 'federal_tax_lien',\n 'state_tax_lien',\n 'student_loan',\n 'creditor_garnishment',\n 'federal_loan',\n 'other_garnishment',\n] as const\n\nexport interface UseDeductionFormProps {\n employeeId: string\n /**\n * When set, loads that garnishment via the list query and updates it (PUT).\n * When omitted, the form is in create mode (POST).\n */\n garnishmentId?: string\n /**\n * Court-ordered deductions are stored as garnishments with `courtOrdered:\n * true` and require a `garnishmentType` (Federal Tax Lien, Student Loan,\n * etc.). When `false`, the form is for a \"custom\" post-tax deduction —\n * `garnishmentType` is excluded from the schema and submit payload.\n *\n * Note: this hook does NOT handle `garnishmentType: 'child_support'`. Use\n * `useChildSupportGarnishmentForm` for child-support agency-keyed payloads.\n */\n courtOrdered: boolean\n optionalFieldsToRequire?: DeductionFormOptionalFieldsToRequire\n defaultValues?: Partial<DeductionFormData>\n validationMode?: UseFormProps['mode']\n shouldFocusError?: boolean\n}\n\nexport interface DeductionFormFields {\n Description: typeof DescriptionField\n Recurring: typeof RecurringField\n DeductAsPercentage: typeof DeductAsPercentageField\n Amount: typeof AmountField\n /** Only available when `status.isRecurring` is true. */\n TotalAmount: typeof TotalAmountField | undefined\n /** Only available when `status.isRecurring` is true. */\n AnnualMaximum: typeof AnnualMaximumField | undefined\n /** Only available when `courtOrdered: true`. */\n GarnishmentType: typeof GarnishmentTypeField | undefined\n}\n\nexport interface UseDeductionFormReady extends BaseFormHookReady<\n FieldsMetadata,\n DeductionFormData,\n DeductionFormFields\n> {\n data: {\n /** The garnishment loaded for update; `null` in create mode. */\n deduction: Garnishment | null\n }\n status: {\n isPending: boolean\n mode: 'create' | 'update'\n /**\n * Mirrors the watched `recurring` value. Cap fields (`TotalAmount`,\n * `AnnualMaximum`) are only included on `Fields` when this is true — the\n * consumer can render them unconditionally and the gating happens in the\n * hook.\n */\n isRecurring: boolean\n }\n actions: {\n onSubmit: () => Promise<HookSubmitResult<Garnishment> | undefined>\n }\n}\n\nexport type UseDeductionFormResult = HookLoadingResult | UseDeductionFormReady\n\nexport function useDeductionForm({\n employeeId,\n garnishmentId,\n courtOrdered,\n optionalFieldsToRequire,\n defaultValues: partnerDefaults,\n validationMode = 'onSubmit',\n shouldFocusError = true,\n}: UseDeductionFormProps): UseDeductionFormResult {\n const isCreateMode = !garnishmentId\n const schemaMode = isCreateMode ? 'create' : 'update'\n\n // The garnishments API has no single-row GET — the list endpoint is the only\n // way to retrieve an existing garnishment. We use the (non-suspense) list\n // query and pick the matching row by uuid.\n const garnishmentsListQuery = useGarnishmentsListMutationLikeLoader({\n employeeId,\n enabled: !isCreateMode,\n })\n\n const fetchedDeduction = useMemo(() => {\n if (isCreateMode) return null\n return garnishmentsListQuery.data?.find(g => g.uuid === garnishmentId) ?? null\n }, [isCreateMode, garnishmentId, garnishmentsListQuery.data])\n\n const [schema, metadataConfig] = useMemo(\n () =>\n createDeductionFormSchema({\n mode: schemaMode,\n courtOrdered,\n optionalFieldsToRequire,\n }),\n [schemaMode, courtOrdered, optionalFieldsToRequire],\n )\n\n const resolvedDefaults: DeductionFormData = useMemo(\n () => ({\n description: fetchedDeduction?.description ?? partnerDefaults?.description ?? '',\n recurring: fetchedDeduction?.recurring ?? partnerDefaults?.recurring ?? true,\n deductAsPercentage:\n fetchedDeduction?.deductAsPercentage ?? partnerDefaults?.deductAsPercentage ?? true,\n amount: fetchedDeduction?.amount\n ? Number(fetchedDeduction.amount)\n : (partnerDefaults?.amount ?? 0),\n // Caps stay as numbers in the form (0 means \"no cap\"); the hook drops\n // them to null on the wire in onSubmit.\n totalAmount: fetchedDeduction?.totalAmount\n ? Number(fetchedDeduction.totalAmount)\n : (partnerDefaults?.totalAmount ?? 0),\n annualMaximum: fetchedDeduction?.annualMaximum\n ? Number(fetchedDeduction.annualMaximum)\n : (partnerDefaults?.annualMaximum ?? 0),\n garnishmentType:\n fetchedDeduction?.garnishmentType ??\n partnerDefaults?.garnishmentType ??\n // First non-child-support type — partners typically pick via the\n // GarnishmentType select before saving.\n 'federal_tax_lien',\n }),\n [fetchedDeduction, partnerDefaults],\n )\n\n const formMethods = useForm<DeductionFormData, unknown, DeductionFormOutputs>({\n resolver: zodResolver(schema),\n mode: validationMode,\n shouldFocusError,\n defaultValues: resolvedDefaults,\n values: resolvedDefaults,\n resetOptions: { keepDirtyValues: true },\n })\n\n // The cap fields only appear when the deduction is recurring. Watching here\n // (inside the hook) keeps the consumer from having to reach into\n // hookFormInternals — the conditional Fields below flip to `undefined`.\n const watchedRecurring = useWatch({ control: formMethods.control, name: 'recurring' })\n const isRecurring = watchedRecurring\n\n const createGarnishmentMutation = useGarnishmentsCreateMutation()\n const updateGarnishmentMutation = useGarnishmentsUpdateMutation()\n const isPending = createGarnishmentMutation.isPending || updateGarnishmentMutation.isPending\n\n const {\n baseSubmitHandler,\n error: submitError,\n setError: setSubmitError,\n } = useBaseSubmit('DeductionForm')\n\n const queriesForErrors = !isCreateMode ? [garnishmentsListQuery] : []\n const errorHandling = composeErrorHandler(queriesForErrors, { submitError, setSubmitError })\n\n const garnishmentTypeOptions = GARNISHMENT_TYPES.map(value => ({ value, label: value }))\n\n const baseMetadata = useDeriveFieldsMetadata(metadataConfig, formMethods.control)\n const fieldsMetadata = {\n description: baseMetadata.description,\n recurring: withOptions<boolean>(\n baseMetadata.recurring,\n [\n { value: 'true', label: 'true' },\n { value: 'false', label: 'false' },\n ],\n [true, false],\n ),\n deductAsPercentage: withOptions<boolean>(\n baseMetadata.deductAsPercentage,\n [\n { value: 'true', label: 'true' },\n { value: 'false', label: 'false' },\n ],\n [true, false],\n ),\n amount: baseMetadata.amount,\n totalAmount: baseMetadata.totalAmount,\n annualMaximum: baseMetadata.annualMaximum,\n garnishmentType: courtOrdered\n ? withOptions(baseMetadata.garnishmentType, garnishmentTypeOptions, GARNISHMENT_TYPES)\n : baseMetadata.garnishmentType,\n }\n\n const onSubmit = async (): Promise<HookSubmitResult<Garnishment> | undefined> => {\n let submitResult: HookSubmitResult<Garnishment> | undefined\n\n await new Promise<void>(resolve => {\n void formMethods.handleSubmit(\n async (data: DeductionFormOutputs) => {\n await baseSubmitHandler(data, async payload => {\n // The API's `times` column is \"number of remaining occurrences\" —\n // for one-time deductions we set it to 1, for recurring we null it\n // out. Matches the legacy GarnishmentForm/CustomDeductionForm.\n const times = payload.recurring ? null : 1\n // Wire conversions: amount is always a string; the optional caps\n // collapse to undefined when the partner left them at zero.\n const amountStr = String(payload.amount)\n const totalAmountStr = payload.totalAmount > 0 ? String(payload.totalAmount) : undefined\n const annualMaximumStr =\n payload.annualMaximum > 0 ? String(payload.annualMaximum) : undefined\n\n let updated: Garnishment | undefined\n\n if (isCreateMode) {\n const result = await createGarnishmentMutation.mutateAsync({\n request: {\n employeeId,\n garnishmentRequest: {\n active: true,\n description: payload.description,\n recurring: payload.recurring,\n deductAsPercentage: payload.deductAsPercentage,\n amount: amountStr,\n totalAmount: totalAmountStr,\n annualMaximum: annualMaximumStr,\n courtOrdered,\n garnishmentType: courtOrdered ? payload.garnishmentType : undefined,\n times,\n },\n },\n })\n updated = result.garnishment\n } else {\n if (!fetchedDeduction) {\n throw new SDKInternalError(\n 'Cannot update deduction: no matching garnishment on file',\n )\n }\n const result = await updateGarnishmentMutation.mutateAsync({\n request: {\n garnishmentId: fetchedDeduction.uuid,\n updateGarnishmentRequest: {\n version: fetchedDeduction.version as string,\n active: true,\n description: payload.description,\n recurring: payload.recurring,\n deductAsPercentage: payload.deductAsPercentage,\n amount: amountStr,\n totalAmount: totalAmountStr,\n annualMaximum: annualMaximumStr,\n courtOrdered,\n // The API rejects garnishment_type changes on update — only\n // include when court-ordered AND when matching the loaded\n // row's type (no-op pass-through).\n garnishmentType: courtOrdered ? payload.garnishmentType : undefined,\n times,\n },\n },\n })\n updated = result.garnishment\n }\n\n if (!updated) {\n throw new SDKInternalError(\n isCreateMode ? 'Deduction creation failed' : 'Deduction update failed',\n )\n }\n\n submitResult = {\n mode: isCreateMode ? 'create' : 'update',\n data: updated,\n }\n })\n resolve()\n },\n () => {\n resolve()\n },\n )()\n })\n\n return submitResult\n }\n\n const hookFormInternals = useHookFormInternals(formMethods)\n\n if (!isCreateMode && garnishmentsListQuery.isLoading) {\n return { isLoading: true as const, errorHandling }\n }\n\n return {\n isLoading: false as const,\n data: {\n deduction: fetchedDeduction,\n },\n status: {\n isPending,\n mode: isCreateMode ? 'create' : 'update',\n isRecurring,\n },\n actions: { onSubmit },\n errorHandling,\n form: {\n Fields: {\n Description: DescriptionField,\n Recurring: RecurringField,\n DeductAsPercentage: DeductAsPercentageField,\n Amount: AmountField,\n TotalAmount: isRecurring ? TotalAmountField : undefined,\n AnnualMaximum: isRecurring ? AnnualMaximumField : undefined,\n GarnishmentType: courtOrdered ? GarnishmentTypeField : undefined,\n },\n fieldsMetadata,\n hookFormInternals,\n getFormSubmissionValues: createGetFormSubmissionValues(formMethods, schema),\n },\n }\n}\n\nexport type DeductionFormFieldsMetadata = UseDeductionFormReady['form']['fieldsMetadata']\nexport type DeductionFormFieldsType = UseDeductionFormReady['form']['Fields']\n\n// ── Internal loader ─────────────────────────────────────────────────────\n//\n// `useGarnishmentsList` is the only way to retrieve an existing garnishment\n// row — the API has no single-row GET. We expose a tiny wrapper that returns\n// the array directly so the hook above can `.find()` by uuid. Skips the fetch\n// entirely in create mode via `enabled: false`.\n\nfunction useGarnishmentsListMutationLikeLoader({\n employeeId,\n enabled,\n}: {\n employeeId: string\n enabled: boolean\n}) {\n const query = useGarnishmentsList({ employeeId }, { enabled })\n return {\n data: query.data?.garnishments,\n isLoading: query.isLoading,\n error: query.error,\n refetch: query.refetch,\n }\n}\n"],"names":["GARNISHMENT_TYPES","useDeductionForm","employeeId","garnishmentId","courtOrdered","optionalFieldsToRequire","partnerDefaults","validationMode","shouldFocusError","isCreateMode","schemaMode","garnishmentsListQuery","useGarnishmentsListMutationLikeLoader","fetchedDeduction","useMemo","g","schema","metadataConfig","createDeductionFormSchema","resolvedDefaults","formMethods","useForm","zodResolver","isRecurring","useWatch","createGarnishmentMutation","useGarnishmentsCreateMutation","updateGarnishmentMutation","useGarnishmentsUpdateMutation","isPending","baseSubmitHandler","submitError","setSubmitError","useBaseSubmit","errorHandling","composeErrorHandler","garnishmentTypeOptions","value","baseMetadata","useDeriveFieldsMetadata","fieldsMetadata","withOptions","onSubmit","submitResult","resolve","data","payload","times","amountStr","totalAmountStr","annualMaximumStr","updated","SDKInternalError","hookFormInternals","useHookFormInternals","DescriptionField","RecurringField","DeductAsPercentageField","AmountField","TotalAmountField","AnnualMaximumField","GarnishmentTypeField","createGetFormSubmissionValues","enabled","query","useGarnishmentsList"],"mappings":";;;;;;;;;;;;;;;AAkDA,MAAMA,IAAgD;AAAA,EACpD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAiEO,SAASC,GAAiB;AAAA,EAC/B,YAAAC;AAAA,EACA,eAAAC;AAAA,EACA,cAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,eAAeC;AAAA,EACf,gBAAAC,IAAiB;AAAA,EACjB,kBAAAC,IAAmB;AACrB,GAAkD;AAChD,QAAMC,IAAe,CAACN,GAChBO,IAAaD,IAAe,WAAW,UAKvCE,IAAwBC,GAAsC;AAAA,IAClE,YAAAV;AAAA,IACA,SAAS,CAACO;AAAA,EAAA,CACX,GAEKI,IAAmBC,EAAQ,MAC3BL,IAAqB,OAClBE,EAAsB,MAAM,KAAK,OAAKI,EAAE,SAASZ,CAAa,KAAK,MACzE,CAACM,GAAcN,GAAeQ,EAAsB,IAAI,CAAC,GAEtD,CAACK,GAAQC,CAAc,IAAIH;AAAA,IAC/B,MACEI,EAA0B;AAAA,MACxB,MAAMR;AAAA,MACN,cAAAN;AAAA,MACA,yBAAAC;AAAA,IAAA,CACD;AAAA,IACH,CAACK,GAAYN,GAAcC,CAAuB;AAAA,EAAA,GAG9Cc,IAAsCL;AAAA,IAC1C,OAAO;AAAA,MACL,aAAaD,GAAkB,eAAeP,GAAiB,eAAe;AAAA,MAC9E,WAAWO,GAAkB,aAAaP,GAAiB,aAAa;AAAA,MACxE,oBACEO,GAAkB,sBAAsBP,GAAiB,sBAAsB;AAAA,MACjF,QAAQO,GAAkB,SACtB,OAAOA,EAAiB,MAAM,IAC7BP,GAAiB,UAAU;AAAA;AAAA;AAAA,MAGhC,aAAaO,GAAkB,cAC3B,OAAOA,EAAiB,WAAW,IAClCP,GAAiB,eAAe;AAAA,MACrC,eAAeO,GAAkB,gBAC7B,OAAOA,EAAiB,aAAa,IACpCP,GAAiB,iBAAiB;AAAA,MACvC,iBACEO,GAAkB,mBAClBP,GAAiB;AAAA;AAAA,MAGjB;AAAA,IAAA;AAAA,IAEJ,CAACO,GAAkBP,CAAe;AAAA,EAAA,GAG9Bc,IAAcC,EAA0D;AAAA,IAC5E,UAAUC,EAAYN,CAAM;AAAA,IAC5B,MAAMT;AAAA,IACN,kBAAAC;AAAA,IACA,eAAeW;AAAA,IACf,QAAQA;AAAA,IACR,cAAc,EAAE,iBAAiB,GAAA;AAAA,EAAK,CACvC,GAMKI,IADmBC,EAAS,EAAE,SAASJ,EAAY,SAAS,MAAM,aAAa,GAG/EK,IAA4BC,EAAA,GAC5BC,IAA4BC,EAAA,GAC5BC,IAAYJ,EAA0B,aAAaE,EAA0B,WAE7E;AAAA,IACJ,mBAAAG;AAAA,IACA,OAAOC;AAAA,IACP,UAAUC;AAAA,EAAA,IACRC,GAAc,eAAe,GAG3BC,IAAgBC,GADI1B,IAAyC,CAAA,IAA1B,CAACE,CAAqB,GACH,EAAE,aAAAoB,GAAa,gBAAAC,GAAgB,GAErFI,IAAyBpC,EAAkB,IAAI,CAAAqC,OAAU,EAAE,OAAAA,GAAO,OAAOA,IAAQ,GAEjFC,IAAeC,GAAwBtB,GAAgBG,EAAY,OAAO,GAC1EoB,IAAiB;AAAA,IACrB,aAAaF,EAAa;AAAA,IAC1B,WAAWG;AAAA,MACTH,EAAa;AAAA,MACb;AAAA,QACE,EAAE,OAAO,QAAQ,OAAO,OAAA;AAAA,QACxB,EAAE,OAAO,SAAS,OAAO,QAAA;AAAA,MAAQ;AAAA,MAEnC,CAAC,IAAM,EAAK;AAAA,IAAA;AAAA,IAEd,oBAAoBG;AAAA,MAClBH,EAAa;AAAA,MACb;AAAA,QACE,EAAE,OAAO,QAAQ,OAAO,OAAA;AAAA,QACxB,EAAE,OAAO,SAAS,OAAO,QAAA;AAAA,MAAQ;AAAA,MAEnC,CAAC,IAAM,EAAK;AAAA,IAAA;AAAA,IAEd,QAAQA,EAAa;AAAA,IACrB,aAAaA,EAAa;AAAA,IAC1B,eAAeA,EAAa;AAAA,IAC5B,iBAAiBlC,IACbqC,EAAYH,EAAa,iBAAiBF,GAAwBpC,CAAiB,IACnFsC,EAAa;AAAA,EAAA,GAGbI,IAAW,YAAgE;AAC/E,QAAIC;AAEJ,iBAAM,IAAI,QAAc,CAAAC,MAAW;AACjC,MAAKxB,EAAY;AAAA,QACf,OAAOyB,MAA+B;AACpC,gBAAMf,EAAkBe,GAAM,OAAMC,MAAW;AAI7C,kBAAMC,IAAQD,EAAQ,YAAY,OAAO,GAGnCE,IAAY,OAAOF,EAAQ,MAAM,GACjCG,IAAiBH,EAAQ,cAAc,IAAI,OAAOA,EAAQ,WAAW,IAAI,QACzEI,IACJJ,EAAQ,gBAAgB,IAAI,OAAOA,EAAQ,aAAa,IAAI;AAE9D,gBAAIK;AAEJ,gBAAI1C;AAkBF,cAAA0C,KAjBe,MAAM1B,EAA0B,YAAY;AAAA,gBACzD,SAAS;AAAA,kBACP,YAAAvB;AAAA,kBACA,oBAAoB;AAAA,oBAClB,QAAQ;AAAA,oBACR,aAAa4C,EAAQ;AAAA,oBACrB,WAAWA,EAAQ;AAAA,oBACnB,oBAAoBA,EAAQ;AAAA,oBAC5B,QAAQE;AAAA,oBACR,aAAaC;AAAA,oBACb,eAAeC;AAAA,oBACf,cAAA9C;AAAA,oBACA,iBAAiBA,IAAe0C,EAAQ,kBAAkB;AAAA,oBAC1D,OAAAC;AAAA,kBAAA;AAAA,gBACF;AAAA,cACF,CACD,GACgB;AAAA,iBACZ;AACL,kBAAI,CAAClC;AACH,sBAAM,IAAIuC;AAAA,kBACR;AAAA,gBAAA;AAwBJ,cAAAD,KArBe,MAAMxB,EAA0B,YAAY;AAAA,gBACzD,SAAS;AAAA,kBACP,eAAed,EAAiB;AAAA,kBAChC,0BAA0B;AAAA,oBACxB,SAASA,EAAiB;AAAA,oBAC1B,QAAQ;AAAA,oBACR,aAAaiC,EAAQ;AAAA,oBACrB,WAAWA,EAAQ;AAAA,oBACnB,oBAAoBA,EAAQ;AAAA,oBAC5B,QAAQE;AAAA,oBACR,aAAaC;AAAA,oBACb,eAAeC;AAAA,oBACf,cAAA9C;AAAA;AAAA;AAAA;AAAA,oBAIA,iBAAiBA,IAAe0C,EAAQ,kBAAkB;AAAA,oBAC1D,OAAAC;AAAA,kBAAA;AAAA,gBACF;AAAA,cACF,CACD,GACgB;AAAA,YACnB;AAEA,gBAAI,CAACI;AACH,oBAAM,IAAIC;AAAA,gBACR3C,IAAe,8BAA8B;AAAA,cAAA;AAIjD,YAAAkC,IAAe;AAAA,cACb,MAAMlC,IAAe,WAAW;AAAA,cAChC,MAAM0C;AAAA,YAAA;AAAA,UAEV,CAAC,GACDP,EAAA;AAAA,QACF;AAAA,QACA,MAAM;AACJ,UAAAA,EAAA;AAAA,QACF;AAAA,MAAA,EACF;AAAA,IACF,CAAC,GAEMD;AAAA,EACT,GAEMU,IAAoBC,GAAqBlC,CAAW;AAE1D,SAAI,CAACX,KAAgBE,EAAsB,YAClC,EAAE,WAAW,IAAe,eAAAuB,EAAA,IAG9B;AAAA,IACL,WAAW;AAAA,IACX,MAAM;AAAA,MACJ,WAAWrB;AAAA,IAAA;AAAA,IAEb,QAAQ;AAAA,MACN,WAAAgB;AAAA,MACA,MAAMpB,IAAe,WAAW;AAAA,MAChC,aAAAc;AAAA,IAAA;AAAA,IAEF,SAAS,EAAE,UAAAmB,EAAA;AAAA,IACX,eAAAR;AAAA,IACA,MAAM;AAAA,MACJ,QAAQ;AAAA,QACN,aAAaqB;AAAA,QACb,WAAWC;AAAA,QACX,oBAAoBC;AAAA,QACpB,QAAQC;AAAA,QACR,aAAanC,IAAcoC,IAAmB;AAAA,QAC9C,eAAepC,IAAcqC,IAAqB;AAAA,QAClD,iBAAiBxD,IAAeyD,IAAuB;AAAA,MAAA;AAAA,MAEzD,gBAAArB;AAAA,MACA,mBAAAa;AAAA,MACA,yBAAyBS,GAA8B1C,GAAaJ,CAAM;AAAA,IAAA;AAAA,EAC5E;AAEJ;AAYA,SAASJ,GAAsC;AAAA,EAC7C,YAAAV;AAAA,EACA,SAAA6D;AACF,GAGG;AACD,QAAMC,IAAQC,EAAoB,EAAE,YAAA/D,KAAc,EAAE,SAAA6D,GAAS;AAC7D,SAAO;AAAA,IACL,MAAMC,EAAM,MAAM;AAAA,IAClB,WAAWA,EAAM;AAAA,IACjB,OAAOA,EAAM;AAAA,IACb,SAASA,EAAM;AAAA,EAAA;AAEnB;"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Garnishment } from '@gusto/embedded-api/models/components/garnishment';
|
|
2
|
+
import { BaseHookReady, HookLoadingResult, HookSubmitResult } from '../../../../partner-hook-utils/types';
|
|
3
|
+
export interface UseDeductionsListProps {
|
|
4
|
+
employeeId: string;
|
|
5
|
+
}
|
|
6
|
+
export interface DeductionsListDeleteResult {
|
|
7
|
+
garnishment: Garnishment;
|
|
8
|
+
remainingActiveCount: number;
|
|
9
|
+
}
|
|
10
|
+
export interface UseDeductionsListReady extends BaseHookReady<{
|
|
11
|
+
deductions: Garnishment[];
|
|
12
|
+
}, {
|
|
13
|
+
isFetching: boolean;
|
|
14
|
+
isPending: boolean;
|
|
15
|
+
deletingGarnishmentUuid?: string;
|
|
16
|
+
}> {
|
|
17
|
+
actions: {
|
|
18
|
+
onDelete: (garnishment: Garnishment) => Promise<HookSubmitResult<DeductionsListDeleteResult> | undefined>;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export type UseDeductionsListResult = HookLoadingResult | UseDeductionsListReady;
|
|
22
|
+
export declare function useDeductionsList({ employeeId }: UseDeductionsListProps): UseDeductionsListResult;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useGarnishmentsList as p } from "@gusto/embedded-api/react-query/garnishmentsList";
|
|
2
|
+
import { useGarnishmentsUpdateMutation as v } from "@gusto/embedded-api/react-query/garnishmentsUpdate";
|
|
3
|
+
import { useBaseSubmit as b } from "../../../Base/useBaseSubmit.js";
|
|
4
|
+
import { composeErrorHandler as D } from "../../../../partner-hook-utils/composeErrorHandler.js";
|
|
5
|
+
function S({ employeeId: d }) {
|
|
6
|
+
const t = p({ employeeId: d }), n = v(), {
|
|
7
|
+
baseSubmitHandler: c,
|
|
8
|
+
error: m,
|
|
9
|
+
setError: g
|
|
10
|
+
} = b("DeductionsList"), i = D([t], {
|
|
11
|
+
submitError: m,
|
|
12
|
+
setSubmitError: g
|
|
13
|
+
}), h = async (s) => {
|
|
14
|
+
let o;
|
|
15
|
+
return await c(s, async (e) => {
|
|
16
|
+
const a = (await n.mutateAsync({
|
|
17
|
+
request: {
|
|
18
|
+
garnishmentId: e.uuid,
|
|
19
|
+
updateGarnishmentRequest: {
|
|
20
|
+
...e,
|
|
21
|
+
totalAmount: e.totalAmount ?? void 0,
|
|
22
|
+
active: !1,
|
|
23
|
+
version: e.version
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
})).garnishment ?? e, f = (t.data?.garnishments ?? []).filter(
|
|
27
|
+
(u) => u.active && u.uuid !== a.uuid
|
|
28
|
+
).length;
|
|
29
|
+
o = {
|
|
30
|
+
mode: "update",
|
|
31
|
+
data: { garnishment: a, remainingActiveCount: f }
|
|
32
|
+
};
|
|
33
|
+
}), o;
|
|
34
|
+
}, l = n.isPending ? n.variables.request.garnishmentId : void 0, r = t.data?.garnishments;
|
|
35
|
+
return t.isLoading || !r ? { isLoading: !0, errorHandling: i } : {
|
|
36
|
+
isLoading: !1,
|
|
37
|
+
data: { deductions: r.filter((s) => s.active) },
|
|
38
|
+
status: {
|
|
39
|
+
isFetching: t.isFetching,
|
|
40
|
+
isPending: n.isPending,
|
|
41
|
+
deletingGarnishmentUuid: l
|
|
42
|
+
},
|
|
43
|
+
actions: { onDelete: h },
|
|
44
|
+
errorHandling: i
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
S as useDeductionsList
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=useDeductionsList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDeductionsList.js","sources":["../../../../../src/components/Employee/Deductions/shared/useDeductionsList.tsx"],"sourcesContent":["import { useGarnishmentsList } from '@gusto/embedded-api/react-query/garnishmentsList'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport type { Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { useBaseSubmit } from '@/components/Base/useBaseSubmit'\nimport { composeErrorHandler } from '@/partner-hook-utils/composeErrorHandler'\nimport type { BaseHookReady, HookLoadingResult, HookSubmitResult } from '@/partner-hook-utils/types'\n\nexport interface UseDeductionsListProps {\n employeeId: string\n}\n\nexport interface DeductionsListDeleteResult {\n garnishment: Garnishment\n remainingActiveCount: number\n}\n\nexport interface UseDeductionsListReady extends BaseHookReady<\n { deductions: Garnishment[] },\n { isFetching: boolean; isPending: boolean; deletingGarnishmentUuid?: string }\n> {\n actions: {\n onDelete: (\n garnishment: Garnishment,\n ) => Promise<HookSubmitResult<DeductionsListDeleteResult> | undefined>\n }\n}\n\nexport type UseDeductionsListResult = HookLoadingResult | UseDeductionsListReady\n\nexport function useDeductionsList({ employeeId }: UseDeductionsListProps): UseDeductionsListResult {\n const garnishmentsQuery = useGarnishmentsList({ employeeId })\n const updateMutation = useGarnishmentsUpdateMutation()\n\n const {\n baseSubmitHandler,\n error: submitError,\n setError: setSubmitError,\n } = useBaseSubmit('DeductionsList')\n\n const errorHandling = composeErrorHandler([garnishmentsQuery], {\n submitError,\n setSubmitError,\n })\n\n const onDelete = async (\n garnishment: Garnishment,\n ): Promise<HookSubmitResult<DeductionsListDeleteResult> | undefined> => {\n let result: HookSubmitResult<DeductionsListDeleteResult> | undefined\n await baseSubmitHandler(garnishment, async payload => {\n const response = await updateMutation.mutateAsync({\n request: {\n garnishmentId: payload.uuid as string,\n updateGarnishmentRequest: {\n ...payload,\n totalAmount: payload.totalAmount ?? undefined,\n active: false,\n version: payload.version as string,\n },\n },\n })\n const updated = (response.garnishment ?? payload) as Garnishment\n const currentDeductions = garnishmentsQuery.data?.garnishments ?? []\n const remainingActiveCount = currentDeductions.filter(\n g => g.active && g.uuid !== updated.uuid,\n ).length\n result = {\n mode: 'update',\n data: { garnishment: updated, remainingActiveCount },\n }\n })\n return result\n }\n\n const deletingGarnishmentUuid = updateMutation.isPending\n ? updateMutation.variables.request.garnishmentId\n : undefined\n\n const allDeductions = garnishmentsQuery.data?.garnishments\n\n if (garnishmentsQuery.isLoading || !allDeductions) {\n return { isLoading: true, errorHandling }\n }\n\n const deductions = allDeductions.filter(g => g.active)\n\n return {\n isLoading: false,\n data: { deductions },\n status: {\n isFetching: garnishmentsQuery.isFetching,\n isPending: updateMutation.isPending,\n deletingGarnishmentUuid,\n },\n actions: { onDelete },\n errorHandling,\n }\n}\n"],"names":["useDeductionsList","employeeId","garnishmentsQuery","useGarnishmentsList","updateMutation","useGarnishmentsUpdateMutation","baseSubmitHandler","submitError","setSubmitError","useBaseSubmit","errorHandling","composeErrorHandler","onDelete","garnishment","result","payload","updated","remainingActiveCount","g","deletingGarnishmentUuid","allDeductions"],"mappings":";;;;AA6BO,SAASA,EAAkB,EAAE,YAAAC,KAA+D;AACjG,QAAMC,IAAoBC,EAAoB,EAAE,YAAAF,GAAY,GACtDG,IAAiBC,EAAA,GAEjB;AAAA,IACJ,mBAAAC;AAAA,IACA,OAAOC;AAAA,IACP,UAAUC;AAAA,EAAA,IACRC,EAAc,gBAAgB,GAE5BC,IAAgBC,EAAoB,CAACT,CAAiB,GAAG;AAAA,IAC7D,aAAAK;AAAA,IACA,gBAAAC;AAAA,EAAA,CACD,GAEKI,IAAW,OACfC,MACsE;AACtE,QAAIC;AACJ,iBAAMR,EAAkBO,GAAa,OAAME,MAAW;AAYpD,YAAMC,KAXW,MAAMZ,EAAe,YAAY;AAAA,QAChD,SAAS;AAAA,UACP,eAAeW,EAAQ;AAAA,UACvB,0BAA0B;AAAA,YACxB,GAAGA;AAAA,YACH,aAAaA,EAAQ,eAAe;AAAA,YACpC,QAAQ;AAAA,YACR,SAASA,EAAQ;AAAA,UAAA;AAAA,QACnB;AAAA,MACF,CACD,GACyB,eAAeA,GAEnCE,KADoBf,EAAkB,MAAM,gBAAgB,CAAA,GACnB;AAAA,QAC7C,CAAAgB,MAAKA,EAAE,UAAUA,EAAE,SAASF,EAAQ;AAAA,MAAA,EACpC;AACF,MAAAF,IAAS;AAAA,QACP,MAAM;AAAA,QACN,MAAM,EAAE,aAAaE,GAAS,sBAAAC,EAAA;AAAA,MAAqB;AAAA,IAEvD,CAAC,GACMH;AAAA,EACT,GAEMK,IAA0Bf,EAAe,YAC3CA,EAAe,UAAU,QAAQ,gBACjC,QAEEgB,IAAgBlB,EAAkB,MAAM;AAE9C,SAAIA,EAAkB,aAAa,CAACkB,IAC3B,EAAE,WAAW,IAAM,eAAAV,EAAA,IAKrB;AAAA,IACL,WAAW;AAAA,IACX,MAAM,EAAE,YAJSU,EAAc,OAAO,CAAAF,MAAKA,EAAE,MAAM,EAI3C;AAAA,IACR,QAAQ;AAAA,MACN,YAAYhB,EAAkB;AAAA,MAC9B,WAAWE,EAAe;AAAA,MAC1B,yBAAAe;AAAA,IAAA;AAAA,IAEF,SAAS,EAAE,UAAAP,EAAA;AAAA,IACX,eAAAF;AAAA,EAAA;AAEJ;"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Garnishment } from '@gusto/embedded-api/models/components/garnishment';
|
|
2
|
+
/**
|
|
3
|
+
* Pending-state + confirm-handler companion for `DeleteDeductionDialog`.
|
|
4
|
+
* Mirrors `useDeleteBankAccount` — the contract is: a row's menu calls
|
|
5
|
+
* `setPendingDeleteDeduction(...)` to open the dialog, and the dialog's
|
|
6
|
+
* confirm calls `handleConfirmDelete`, which in turn invokes the
|
|
7
|
+
* caller-supplied `handleDelete(garnishment)`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useDeleteDeduction(handleDelete: (garnishment: Garnishment) => Promise<void>): {
|
|
10
|
+
pendingDeleteDeduction: Garnishment | null;
|
|
11
|
+
setPendingDeleteDeduction: import('react').Dispatch<import('react').SetStateAction<Garnishment | null>>;
|
|
12
|
+
handleConfirmDelete: () => Promise<void>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useState as i } from "react";
|
|
2
|
+
function u(n) {
|
|
3
|
+
const [e, t] = i(null);
|
|
4
|
+
return {
|
|
5
|
+
pendingDeleteDeduction: e,
|
|
6
|
+
setPendingDeleteDeduction: t,
|
|
7
|
+
handleConfirmDelete: async () => {
|
|
8
|
+
if (!e) return;
|
|
9
|
+
const o = e;
|
|
10
|
+
t(null), await n(o);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
u as useDeleteDeduction
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=useDeleteDeduction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useDeleteDeduction.js","sources":["../../../../../src/components/Employee/Deductions/shared/useDeleteDeduction.ts"],"sourcesContent":["import { useState } from 'react'\nimport type { Garnishment } from '@gusto/embedded-api/models/components/garnishment'\n\n/**\n * Pending-state + confirm-handler companion for `DeleteDeductionDialog`.\n * Mirrors `useDeleteBankAccount` — the contract is: a row's menu calls\n * `setPendingDeleteDeduction(...)` to open the dialog, and the dialog's\n * confirm calls `handleConfirmDelete`, which in turn invokes the\n * caller-supplied `handleDelete(garnishment)`.\n */\nexport function useDeleteDeduction(handleDelete: (garnishment: Garnishment) => Promise<void>) {\n const [pendingDeleteDeduction, setPendingDeleteDeduction] = useState<Garnishment | null>(null)\n\n const handleConfirmDelete = async () => {\n if (!pendingDeleteDeduction) return\n const target = pendingDeleteDeduction\n setPendingDeleteDeduction(null)\n await handleDelete(target)\n }\n\n return {\n pendingDeleteDeduction,\n setPendingDeleteDeduction,\n handleConfirmDelete,\n }\n}\n"],"names":["useDeleteDeduction","handleDelete","pendingDeleteDeduction","setPendingDeleteDeduction","useState","target"],"mappings":";AAUO,SAASA,EAAmBC,GAA2D;AAC5F,QAAM,CAACC,GAAwBC,CAAyB,IAAIC,EAA6B,IAAI;AAS7F,SAAO;AAAA,IACL,wBAAAF;AAAA,IACA,2BAAAC;AAAA,IACA,qBAV0B,YAAY;AACtC,UAAI,CAACD,EAAwB;AAC7B,YAAMG,IAASH;AACf,MAAAC,EAA0B,IAAI,GAC9B,MAAMF,EAAaI,CAAM;AAAA,IAC3B;AAAA,EAKE;AAEJ;"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
editDeduction: import('robot3').MachineState<any>;
|
|
1
|
+
export declare const deductionsMachine: {
|
|
2
|
+
include: import('robot3').MachineState<any>;
|
|
3
|
+
list: import('robot3').MachineState<any>;
|
|
4
|
+
form: import('robot3').MachineState<any>;
|
|
6
5
|
done: import('robot3').MachineState<any>;
|
|
7
6
|
};
|