@gusto/embedded-react-sdk 0.13.2 → 0.13.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/dist/assets/icons/close.svg.js +5 -5
- package/dist/assets/icons/close.svg.js.map +1 -1
- package/dist/assets/icons/download-cloud.svg.js +10 -0
- package/dist/assets/icons/download-cloud.svg.js.map +1 -0
- package/dist/assets/icons/hamburger.svg.js +5 -5
- package/dist/assets/icons/hamburger.svg.js.map +1 -1
- package/dist/assets/icons/receipt-check.svg.js +10 -0
- package/dist/assets/icons/receipt-check.svg.js.map +1 -0
- package/dist/components/Base/Base.js +3 -2
- package/dist/components/Base/Base.js.map +1 -1
- package/dist/components/Common/DataView/DataCards/DataCards.js +24 -24
- package/dist/components/Common/DataView/DataCards/DataCards.js.map +1 -1
- package/dist/components/Common/DataView/DataCards/DataCards.module.scss.js +6 -4
- package/dist/components/Common/DataView/DataCards/DataCards.module.scss.js.map +1 -1
- package/dist/components/Common/DataView/DataTable/DataTable.d.ts +3 -1
- package/dist/components/Common/DataView/DataTable/DataTable.js +38 -35
- package/dist/components/Common/DataView/DataTable/DataTable.js.map +1 -1
- package/dist/components/Common/DataView/DataView.d.ts +6 -3
- package/dist/components/Common/DataView/DataView.js +19 -16
- package/dist/components/Common/DataView/DataView.js.map +1 -1
- package/dist/components/Common/DocumentViewer/DocumentViewer.d.ts +1 -1
- package/dist/components/Common/DocumentViewer/DocumentViewer.js +9 -9
- package/dist/components/Common/DocumentViewer/DocumentViewer.js.map +1 -1
- package/dist/components/Common/Fields/CheckboxField/CheckboxField.d.ts +1 -1
- package/dist/components/Common/Fields/CheckboxField/CheckboxField.js +15 -9
- package/dist/components/Common/Fields/CheckboxField/CheckboxField.js.map +1 -1
- package/dist/components/Common/Fields/CheckboxGroupField/CheckboxGroupField.d.ts +2 -2
- package/dist/components/Common/Fields/CheckboxGroupField/CheckboxGroupField.js +21 -15
- package/dist/components/Common/Fields/CheckboxGroupField/CheckboxGroupField.js.map +1 -1
- package/dist/components/Common/Fields/ComboBoxField/ComboBoxField.d.ts +2 -2
- package/dist/components/Common/Fields/ComboBoxField/ComboBoxField.js +19 -13
- package/dist/components/Common/Fields/ComboBoxField/ComboBoxField.js.map +1 -1
- package/dist/components/Common/Fields/DatePickerField/DatePickerField.d.ts +1 -1
- package/dist/components/Common/Fields/DatePickerField/DatePickerField.js +24 -18
- package/dist/components/Common/Fields/DatePickerField/DatePickerField.js.map +1 -1
- package/dist/components/Common/Fields/NumberInputField/NumberInputField.d.ts +1 -1
- package/dist/components/Common/Fields/NumberInputField/NumberInputField.js +18 -12
- package/dist/components/Common/Fields/NumberInputField/NumberInputField.js.map +1 -1
- package/dist/components/Common/Fields/RadioGroupField/RadioGroupField.d.ts +2 -2
- package/dist/components/Common/Fields/RadioGroupField/RadioGroupField.js +19 -13
- package/dist/components/Common/Fields/RadioGroupField/RadioGroupField.js.map +1 -1
- package/dist/components/Common/Fields/SelectField/SelectField.d.ts +2 -2
- package/dist/components/Common/Fields/SelectField/SelectField.js +19 -13
- package/dist/components/Common/Fields/SelectField/SelectField.js.map +1 -1
- package/dist/components/Common/Fields/SwitchField/SwitchField.d.ts +1 -1
- package/dist/components/Common/Fields/SwitchField/SwitchField.js +15 -9
- package/dist/components/Common/Fields/SwitchField/SwitchField.js.map +1 -1
- package/dist/components/Common/Fields/TextInputField/TextInputField.d.ts +1 -1
- package/dist/components/Common/Fields/TextInputField/TextInputField.js +15 -9
- package/dist/components/Common/Fields/TextInputField/TextInputField.js.map +1 -1
- package/dist/components/Common/Fields/hooks/useField.d.ts +8 -7
- package/dist/components/Common/Fields/hooks/useField.js +33 -27
- package/dist/components/Common/Fields/hooks/useField.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureForm.js +6 -4
- package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormActions.js +12 -10
- package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormFields.js +8 -6
- package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
- package/dist/components/Common/UI/Alert/Alert.js +15 -15
- package/dist/components/Common/UI/Alert/Alert.js.map +1 -1
- package/dist/components/Common/UI/Alert/Alert.module.scss.js +14 -12
- package/dist/components/Common/UI/Alert/Alert.module.scss.js.map +1 -1
- package/dist/components/Common/UI/Card/Card.module.scss.js +1 -1
- package/dist/components/Common/UI/Checkbox/CheckboxTypes.d.ts +5 -1
- package/dist/components/Common/UI/Checkbox/CheckboxTypes.js.map +1 -1
- package/dist/components/Common/UI/ComboBox/ComboBoxTypes.d.ts +2 -2
- package/dist/components/Common/UI/DatePicker/DatePickerTypes.d.ts +2 -2
- package/dist/components/Common/UI/Dialog/Dialog.d.ts +2 -0
- package/dist/components/Common/UI/Dialog/Dialog.js +84 -0
- package/dist/components/Common/UI/Dialog/Dialog.js.map +1 -0
- package/dist/components/Common/UI/Dialog/Dialog.module.scss.js +18 -0
- package/dist/components/Common/UI/Dialog/Dialog.module.scss.js.map +1 -0
- package/dist/components/Common/UI/Dialog/DialogTypes.d.ts +52 -0
- package/dist/components/Common/UI/Dialog/DialogTypes.js +10 -0
- package/dist/components/Common/UI/Dialog/DialogTypes.js.map +1 -0
- package/dist/components/Common/UI/Dialog/index.d.ts +4 -0
- package/dist/components/Common/UI/Menu/Menu.module.scss.js +1 -1
- package/dist/components/Common/UI/NumberInput/NumberInputTypes.d.ts +2 -2
- package/dist/components/Common/UI/RadioGroup/RadioGroup.js +33 -31
- package/dist/components/Common/UI/RadioGroup/RadioGroup.js.map +1 -1
- package/dist/components/Common/UI/RadioGroup/RadioGroupTypes.d.ts +4 -0
- package/dist/components/Common/UI/RadioGroup/RadioGroupTypes.js.map +1 -1
- package/dist/components/Common/UI/Select/SelectTypes.d.ts +2 -2
- package/dist/components/Common/UI/Switch/SwitchTypes.d.ts +2 -2
- package/dist/components/Common/UI/Switch/SwitchTypes.js.map +1 -1
- package/dist/components/Common/UI/Table/Table.d.ts +1 -1
- package/dist/components/Common/UI/Table/Table.js +23 -11
- package/dist/components/Common/UI/Table/Table.js.map +1 -1
- package/dist/components/Common/UI/Table/Table.module.scss.js +1 -1
- package/dist/components/Common/UI/Table/TableTypes.d.ts +15 -0
- package/dist/components/Common/UI/Table/TableTypes.js +8 -0
- package/dist/components/Common/UI/Table/TableTypes.js.map +1 -0
- package/dist/components/Common/UI/Text/Text.js +9 -8
- package/dist/components/Common/UI/Text/Text.js.map +1 -1
- package/dist/components/Common/UI/Text/Text.module.scss.js +15 -14
- package/dist/components/Common/UI/Text/Text.module.scss.js.map +1 -1
- package/dist/components/Common/UI/Text/TextTypes.d.ts +2 -2
- package/dist/components/Common/UI/Text/TextTypes.js.map +1 -1
- package/dist/components/Common/UI/TextInput/TextInput.js +35 -33
- package/dist/components/Common/UI/TextInput/TextInput.js.map +1 -1
- package/dist/components/Common/UI/TextInput/TextInputTypes.d.ts +5 -1
- package/dist/components/Common/UI/TextInput/TextInputTypes.js.map +1 -1
- package/dist/components/Common/UI/hooks/useFieldIds.d.ts +2 -1
- package/dist/components/Common/UI/hooks/useFieldIds.js +11 -6
- package/dist/components/Common/UI/hooks/useFieldIds.js.map +1 -1
- package/dist/components/Company/AssignSignatory/AssignSignatory.js +3 -2
- package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +8 -6
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +10 -8
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +11 -11
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +5 -3
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +8 -6
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +5 -3
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/TitleSelect.js +8 -7
- package/dist/components/Company/AssignSignatory/TitleSelect.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +7 -5
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccount.js +25 -21
- package/dist/components/Company/BankAccount/BankAccount.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +9 -8
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Form.js +11 -9
- package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +5 -3
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js +12 -10
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +13 -11
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +6 -4
- package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
- package/dist/components/Company/BankAccount/stateMachine.d.ts +4 -4
- package/dist/components/Company/BankAccount/stateMachine.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +7 -5
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +33 -32
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +5 -3
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +3 -2
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +5 -3
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Company/DocumentSigner/assignSignatoryState.d.ts +1 -1
- package/dist/components/Company/DocumentSigner/assignSignatoryState.js.map +1 -1
- package/dist/components/Company/DocumentSigner/stateMachine.d.ts +5 -5
- package/dist/components/Company/DocumentSigner/stateMachine.js.map +1 -1
- package/dist/components/Company/FederalTaxes/Actions.js +9 -7
- package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
- package/dist/components/Company/FederalTaxes/FederalTaxes.js +7 -6
- package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
- package/dist/components/Company/FederalTaxes/Form.js +5 -3
- package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +10 -8
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Actions.js +7 -5
- package/dist/components/Company/Industry/Actions.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +8 -6
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Industry/Edit.js +12 -10
- package/dist/components/Company/Industry/Edit.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Actions.js +8 -6
- package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Form.js +1 -1
- package/dist/components/Company/Locations/LocationForm/LocationForm.js +4 -3
- package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +5 -3
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/Locations.js +21 -17
- package/dist/components/Company/Locations/Locations.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/Actions.js +8 -6
- package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/List.js +17 -16
- package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/LocationsList.js +9 -8
- package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +5 -3
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/Locations/stateMachine.d.ts +3 -3
- package/dist/components/Company/Locations/stateMachine.js.map +1 -1
- package/dist/components/Company/OnboardingFlow/OnboardingFlow.js +21 -17
- package/dist/components/Company/OnboardingFlow/OnboardingFlow.js.map +1 -1
- package/dist/components/Company/OnboardingFlow/onboardingStateMachine.d.ts +10 -10
- package/dist/components/Company/OnboardingFlow/onboardingStateMachine.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/Completed.js +14 -12
- package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/MissingRequirements.js +8 -6
- package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +3 -2
- package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +5 -3
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/PaySchedule.js +4 -3
- package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Actions.js +12 -10
- package/dist/components/Company/PaySchedule/_parts/Actions.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Edit.js +14 -14
- package/dist/components/Company/PaySchedule/_parts/Head.js +8 -6
- package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/List.js +15 -13
- package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
- package/dist/components/Company/PaySchedule/usePaySchedule.js +7 -5
- package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxes.js +20 -16
- package/dist/components/Company/StateTaxes/StateTaxes.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +7 -5
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +5 -3
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +8 -6
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js +7 -5
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +5 -3
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/stateTaxesStateMachine.d.ts +3 -3
- package/dist/components/Company/StateTaxes/stateTaxesStateMachine.js.map +1 -1
- package/dist/components/Contractor/Address/Address.js +5 -4
- package/dist/components/Contractor/Address/Address.js.map +1 -1
- package/dist/components/Contractor/Address/Form.js +1 -1
- package/dist/components/Contractor/Address/useAddress.js +7 -5
- package/dist/components/Contractor/Address/useAddress.js.map +1 -1
- package/dist/components/Contractor/ContractorList/index.js +25 -24
- package/dist/components/Contractor/ContractorList/index.js.map +1 -1
- package/dist/components/Contractor/NewHireReport/NewHireReport.js +14 -13
- package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
- package/dist/components/Contractor/OnboardingFlow/OnboardingFlow.js +25 -21
- package/dist/components/Contractor/OnboardingFlow/OnboardingFlow.js.map +1 -1
- package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.d.ts +7 -7
- package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +7 -5
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +3 -2
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +3 -2
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js.map +1 -1
- package/dist/components/Contractor/Profile/ContractorProfileForm.d.ts +1 -1
- package/dist/components/Contractor/Profile/ContractorProfileForm.js +58 -55
- package/dist/components/Contractor/Profile/ContractorProfileForm.js.map +1 -1
- package/dist/components/Contractor/Profile/ContractorProfileForm.module.scss.js +8 -0
- package/dist/components/Contractor/Profile/ContractorProfileForm.module.scss.js.map +1 -0
- package/dist/components/Contractor/Profile/useContractorProfile.d.ts +2 -0
- package/dist/components/Contractor/Profile/useContractorProfile.js +97 -94
- package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
- package/dist/components/Contractor/Submit/Submit.js +4 -3
- package/dist/components/Contractor/Submit/Submit.js.map +1 -1
- package/dist/components/Employee/Compensation/Actions.js +6 -5
- package/dist/components/Employee/Compensation/Actions.js.map +1 -1
- package/dist/components/Employee/Compensation/Edit.js +15 -14
- package/dist/components/Employee/Compensation/Edit.js.map +1 -1
- package/dist/components/Employee/Compensation/List.js +25 -23
- package/dist/components/Employee/Compensation/List.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsComponents.js +1 -1
- package/dist/components/Employee/Deductions/DeductionsComponents.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.d.ts +55 -0
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +221 -0
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -0
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.module.scss.js +8 -0
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.module.scss.js.map +1 -0
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.d.ts +42 -0
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +132 -0
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -0
- package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js +11 -10
- package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.module.scss.js +14 -0
- package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.module.scss.js.map +1 -0
- package/dist/components/Employee/Deductions/DeductionsForm/UNSTABLE_DeductionsForm.d.ts +7 -0
- package/dist/components/Employee/Deductions/DeductionsForm/UNSTABLE_DeductionsForm.js +98 -0
- package/dist/components/Employee/Deductions/DeductionsForm/UNSTABLE_DeductionsForm.js.map +1 -0
- package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +8 -7
- package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js.map +1 -1
- package/dist/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.js +11 -10
- package/dist/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.js.map +1 -1
- package/dist/components/Employee/Deductions/stateMachine.d.ts +5 -5
- package/dist/components/Employee/Deductions/stateMachine.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +8 -6
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +7 -6
- package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/List.js +4 -2
- package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +5 -3
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentSigner.js +19 -15
- package/dist/components/Employee/DocumentSigner/DocumentSigner.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +8 -7
- package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +5 -3
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/stateMachine.d.ts +3 -3
- package/dist/components/Employee/DocumentSigner/stateMachine.js.map +1 -1
- package/dist/components/Employee/EmployeeList/Actions.js +6 -4
- package/dist/components/Employee/EmployeeList/Actions.js.map +1 -1
- package/dist/components/Employee/EmployeeList/EmployeeList.js +4 -3
- package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
- package/dist/components/Employee/EmployeeList/Head.js +7 -5
- package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
- package/dist/components/Employee/EmployeeList/List.js +15 -14
- package/dist/components/Employee/EmployeeList/List.js.map +1 -1
- package/dist/components/Employee/EmployeeList/useEmployeeList.js +5 -3
- package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/Actions.js +8 -6
- package/dist/components/Employee/FederalTaxes/Actions.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/FederalForm.js +13 -11
- package/dist/components/Employee/FederalTaxes/FederalForm.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +5 -3
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Employee/Landing/Landing.js +13 -12
- package/dist/components/Employee/Landing/Landing.js.map +1 -1
- package/dist/components/Employee/OnboardingFlow/OnboardingFlow.js +24 -20
- package/dist/components/Employee/OnboardingFlow/OnboardingFlow.js.map +1 -1
- package/dist/components/Employee/OnboardingFlow/onboardingStateMachine.d.ts +9 -9
- package/dist/components/Employee/OnboardingFlow/onboardingStateMachine.js.map +1 -1
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +7 -7
- package/dist/components/Employee/PaymentMethod/Actions.js +9 -7
- package/dist/components/Employee/PaymentMethod/Actions.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +6 -5
- package/dist/components/Employee/PaymentMethod/BankAccountEdit.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountsList.js +10 -8
- package/dist/components/Employee/PaymentMethod/BankAccountsList.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +3 -2
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/Split.js +11 -10
- package/dist/components/Employee/PaymentMethod/Split.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +7 -5
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/Actions.js +9 -7
- package/dist/components/Employee/Profile/Actions.js.map +1 -1
- package/dist/components/Employee/Profile/AdminPersonalDetails.js +32 -29
- package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
- package/dist/components/Employee/Profile/AdminPersonalDetails.module.scss.js +8 -0
- package/dist/components/Employee/Profile/AdminPersonalDetails.module.scss.js.map +1 -0
- package/dist/components/Employee/Profile/HomeAddress.js +1 -1
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js +2 -2
- package/dist/components/Employee/Profile/Profile.d.ts +1 -0
- package/dist/components/Employee/Profile/Profile.js +78 -75
- package/dist/components/Employee/Profile/Profile.js.map +1 -1
- package/dist/components/Employee/Profile/useProfile.js +5 -3
- package/dist/components/Employee/Profile/useProfile.js.map +1 -1
- package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingFlow.js +17 -13
- package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingFlow.js.map +1 -1
- package/dist/components/Employee/SelfOnboardingFlow/selfOnboardingMachine.d.ts +5 -5
- package/dist/components/Employee/SelfOnboardingFlow/selfOnboardingMachine.js.map +1 -1
- package/dist/components/Employee/StateTaxes/Actions.js +10 -8
- package/dist/components/Employee/StateTaxes/Actions.js.map +1 -1
- package/dist/components/Employee/StateTaxes/useStateTaxes.js +5 -3
- package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
- package/dist/components/Employee/Taxes/Actions.js +10 -8
- package/dist/components/Employee/Taxes/Actions.js.map +1 -1
- package/dist/components/Employee/Taxes/FederalForm.js +14 -12
- package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
- package/dist/components/Employee/Taxes/useTaxes.js +5 -3
- package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/PayrollBlockerAlerts.d.ts +7 -0
- package/dist/components/Payroll/PayrollBlocker/PayrollBlockerList.d.ts +6 -0
- package/dist/components/Payroll/PayrollBlocker/PayrollBlockerTypes.d.ts +101 -0
- package/dist/components/Payroll/PayrollBlocker/index.d.ts +4 -0
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +64 -56
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +36 -36
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +41 -45
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.d.ts +20 -2
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +308 -101
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.module.scss.js +16 -0
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.module.scss.js.map +1 -0
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.d.ts +7 -0
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +59 -0
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -0
- package/dist/components/Payroll/PayrollEditEmployee/index.d.ts +4 -0
- package/dist/components/Payroll/PayrollFlow/PayrollFlow.d.ts +2 -0
- package/dist/components/Payroll/PayrollFlow/PayrollFlow.js +26 -0
- package/dist/components/Payroll/PayrollFlow/PayrollFlow.js.map +1 -0
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.d.ts +25 -0
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js +59 -0
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js.map +1 -0
- package/dist/components/Payroll/PayrollFlow/index.d.ts +3 -0
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.d.ts +7 -0
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js +116 -0
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js.map +1 -0
- package/dist/components/Payroll/PayrollHistory/PayrollHistory.d.ts +19 -0
- package/dist/components/Payroll/PayrollHistory/PayrollHistory.js +114 -0
- package/dist/components/Payroll/PayrollHistory/PayrollHistory.js.map +1 -0
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.d.ts +8 -11
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +194 -0
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -0
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.module.scss.js +8 -0
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.module.scss.js.map +1 -0
- package/dist/components/Payroll/PayrollLanding/PayrollLanding.d.ts +7 -0
- package/dist/components/Payroll/PayrollLanding/PayrollLanding.js +41 -0
- package/dist/components/Payroll/PayrollLanding/PayrollLanding.js.map +1 -0
- package/dist/components/Payroll/PayrollList/PayrollList.js +19 -21
- package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +87 -79
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.d.ts +3 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +102 -42
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.d.ts +12 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +274 -133
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceipts.d.ts +7 -0
- package/dist/components/Payroll/PayrollReceipts/PayrollReceipts.js +21 -0
- package/dist/components/Payroll/PayrollReceipts/PayrollReceipts.js.map +1 -0
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.d.ts +6 -0
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +220 -0
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -0
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.module.scss.js +28 -0
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.module.scss.js.map +1 -0
- package/dist/components/Payroll/RunPayrollFlow/RunPayroll.d.ts +2 -2
- package/dist/components/Payroll/RunPayrollFlow/RunPayroll.js +58 -43
- package/dist/components/Payroll/RunPayrollFlow/RunPayroll.js.map +1 -1
- package/dist/components/Payroll/RunPayrollFlow/RunPayrollFlow.js +11 -11
- package/dist/components/Payroll/RunPayrollFlow/RunPayrollFlow.js.map +1 -1
- package/dist/components/Payroll/helpers.d.ts +21 -1
- package/dist/components/Payroll/helpers.js +166 -123
- package/dist/components/Payroll/helpers.js.map +1 -1
- package/dist/components/Payroll/index.d.ts +4 -0
- package/dist/components/Payroll/index.js +14 -6
- package/dist/components/Payroll/index.js.map +1 -1
- package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js +21 -19
- package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js.map +1 -1
- package/dist/contexts/ComponentAdapter/componentAdapterTypes.d.ts +1 -0
- package/dist/contexts/ComponentAdapter/createComponentsWithDefaults.d.ts +10 -0
- package/dist/contexts/ComponentAdapter/createComponentsWithDefaults.js +35 -31
- package/dist/contexts/ComponentAdapter/createComponentsWithDefaults.js.map +1 -1
- package/dist/contexts/ComponentAdapter/useComponentContext.d.ts +2 -0
- package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +8 -5
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/contexts/ThemeProvider/theme.d.ts +3 -0
- package/dist/contexts/ThemeProvider/theme.js +12 -9
- package/dist/contexts/ThemeProvider/theme.js.map +1 -1
- package/dist/helpers/formattedStrings.js +12 -11
- package/dist/helpers/formattedStrings.js.map +1 -1
- package/dist/helpers/readableStreamToBlob.d.ts +1 -0
- package/dist/helpers/readableStreamToBlob.js +17 -0
- package/dist/helpers/readableStreamToBlob.js.map +1 -0
- package/dist/hooks/useContainerBreakpoints/useContainerBreakpoints.d.ts +2 -4
- package/dist/hooks/useContainerBreakpoints/useContainerBreakpoints.js.map +1 -1
- package/dist/i18n/I18n.js +9 -9
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Employee.Deductions.json.js +126 -66
- package/dist/i18n/en/Employee.Deductions.json.js.map +1 -1
- package/dist/i18n/en/Employee.Profile.json.js +32 -30
- package/dist/i18n/en/Employee.Profile.json.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollConfiguration.json.js +15 -15
- package/dist/i18n/en/Payroll.PayrollEditEmployee.json.js +34 -14
- package/dist/i18n/en/Payroll.PayrollEditEmployee.json.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollHistory.json.js +22 -0
- package/dist/i18n/en/Payroll.PayrollHistory.json.js.map +1 -0
- package/dist/i18n/en/Payroll.PayrollLanding.json.js +12 -0
- package/dist/i18n/en/Payroll.PayrollLanding.json.js.map +1 -0
- package/dist/i18n/en/Payroll.PayrollList.json.js +16 -12
- package/dist/i18n/en/Payroll.PayrollList.json.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollOverview.json.js +50 -22
- package/dist/i18n/en/Payroll.PayrollOverview.json.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollReceipts.json.js +16 -0
- package/dist/i18n/en/Payroll.PayrollReceipts.json.js.map +1 -0
- package/dist/i18n/en/PayrollBlocker.json.js +18 -0
- package/dist/i18n/en/PayrollBlocker.json.js.map +1 -0
- package/dist/node_modules/redux/es/redux.js +2 -2
- package/dist/node_modules/redux/es/redux.js.map +1 -1
- package/dist/shared/constants.d.ts +41 -4
- package/dist/shared/constants.js +85 -57
- package/dist/shared/constants.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/Helpers.d.ts +7 -0
- package/dist/types/i18next.d.ts +187 -44
- package/package.json +18 -18
- package/dist/i18n/en/Payroll.PayrollHistoryList.json.js +0 -16
- package/dist/i18n/en/Payroll.PayrollHistoryList.json.js.map +0 -1
- package/dist/i18n/en/payroll.payrollhistory.json.js +0 -20
- package/dist/i18n/en/payroll.payrollhistory.json.js.map +0 -1
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { jsx as n, jsxs as c, Fragment as O } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation as U } from "react-i18next";
|
|
3
|
+
import { useForm as k, useWatch as Y, FormProvider as B } from "react-hook-form";
|
|
4
|
+
import { useMemo as L, useEffect as E } from "react";
|
|
5
|
+
import { z as o } from "zod";
|
|
6
|
+
import { zodResolver as W } from "@hookform/resolvers/zod";
|
|
7
|
+
import { PaymentPeriod as G } from "@gusto/embedded-api/models/components/garnishmentchildsupport";
|
|
8
|
+
import { useGarnishmentsCreateMutation as j } from "@gusto/embedded-api/react-query/garnishmentsCreate";
|
|
9
|
+
import { useGarnishmentsUpdateMutation as K } from "@gusto/embedded-api/react-query/garnishmentsUpdate";
|
|
10
|
+
import V from "./ChildSupportForm.module.scss.js";
|
|
11
|
+
import { useComponentContext as z } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
12
|
+
import { Form as X } from "../../../Common/Form/Form.js";
|
|
13
|
+
import { Flex as $ } from "../../../Common/Flex/Flex.js";
|
|
14
|
+
import "classnames";
|
|
15
|
+
import { componentEvents as C } from "../../../../shared/constants.js";
|
|
16
|
+
import { TextInputField as J } from "../../../Common/Fields/TextInputField/TextInputField.js";
|
|
17
|
+
import { ActionsLayout as Q } from "../../../Common/ActionsLayout/ActionsLayout.js";
|
|
18
|
+
import { NumberInputField as g } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
|
|
19
|
+
import "react-error-boundary";
|
|
20
|
+
import "@gusto/embedded-api/models/errors/apierror";
|
|
21
|
+
import "@gusto/embedded-api/models/errors/sdkvalidationerror";
|
|
22
|
+
import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
23
|
+
import "@tanstack/react-query";
|
|
24
|
+
import { useBase as Z } from "../../../Base/useBase.js";
|
|
25
|
+
import "dompurify";
|
|
26
|
+
import "../../../../contexts/LocaleProvider/useLocale.js";
|
|
27
|
+
import { SelectField as d } from "../../../Common/Fields/SelectField/SelectField.js";
|
|
28
|
+
const ee = 0, re = 0, te = 100, ne = o.nativeEnum(G), oe = o.object({
|
|
29
|
+
state: o.string(),
|
|
30
|
+
fipsCode: o.string(),
|
|
31
|
+
caseNumber: o.string().nullable(),
|
|
32
|
+
orderNumber: o.string().nullable(),
|
|
33
|
+
remittanceNumber: o.string().nullable(),
|
|
34
|
+
amount: o.number().min(0).transform(String),
|
|
35
|
+
payPeriodMaximum: o.number().min(0).transform((r) => r > 0 ? r.toString() : null).nullable(),
|
|
36
|
+
paymentPeriod: ne
|
|
37
|
+
});
|
|
38
|
+
function De({
|
|
39
|
+
deduction: r,
|
|
40
|
+
handleStateAgencySelect: M,
|
|
41
|
+
stateAgencies: S,
|
|
42
|
+
counties: x,
|
|
43
|
+
employeeId: T,
|
|
44
|
+
selectedAgency: b
|
|
45
|
+
}) {
|
|
46
|
+
const { onEvent: h, baseSubmitHandler: A } = Z(), { t: e } = U("Employee.Deductions"), u = z(), y = {
|
|
47
|
+
case_number: {
|
|
48
|
+
name: "caseNumber",
|
|
49
|
+
description: e("caseNumberHelperText")
|
|
50
|
+
},
|
|
51
|
+
order_number: {
|
|
52
|
+
name: "orderNumber",
|
|
53
|
+
description: e("orderNumberHelperText")
|
|
54
|
+
},
|
|
55
|
+
remittance_number: {
|
|
56
|
+
name: "remittanceNumber",
|
|
57
|
+
description: e("remittanceNumberHelperText")
|
|
58
|
+
}
|
|
59
|
+
}, _ = b?.requiredAttributes?.map((t) => ({
|
|
60
|
+
name: y[t.key].name,
|
|
61
|
+
label: t.label,
|
|
62
|
+
description: y[t.key].description
|
|
63
|
+
})) || [], { mutateAsync: R, isPending: v } = j(), { mutateAsync: q, isPending: D } = K(), F = v || D, s = L(() => ({
|
|
64
|
+
amount: r?.amount ? Number(r.amount) : 0,
|
|
65
|
+
payPeriodMaximum: r?.payPeriodMaximum ? Number(r.payPeriodMaximum) : null,
|
|
66
|
+
state: r?.childSupport?.state || "",
|
|
67
|
+
fipsCode: r?.childSupport?.fipsCode || "",
|
|
68
|
+
caseNumber: r?.childSupport?.caseNumber || null,
|
|
69
|
+
orderNumber: r?.childSupport?.orderNumber || null,
|
|
70
|
+
remittanceNumber: r?.childSupport?.remittanceNumber || null,
|
|
71
|
+
paymentPeriod: r?.childSupport?.paymentPeriod
|
|
72
|
+
}), [r]), l = k({
|
|
73
|
+
resolver: W(oe),
|
|
74
|
+
defaultValues: s
|
|
75
|
+
}), { reset: P, setValue: i, control: I } = l, N = Y({ control: I, name: "state" });
|
|
76
|
+
E(() => {
|
|
77
|
+
P(s);
|
|
78
|
+
}, [r, s, P]), E(() => {
|
|
79
|
+
i("caseNumber", null), i("orderNumber", null), i("remittanceNumber", null);
|
|
80
|
+
}, [N, i]);
|
|
81
|
+
const H = async (t) => {
|
|
82
|
+
const m = {
|
|
83
|
+
state: t.state,
|
|
84
|
+
paymentPeriod: t.paymentPeriod,
|
|
85
|
+
fipsCode: t.fipsCode,
|
|
86
|
+
caseNumber: t.caseNumber,
|
|
87
|
+
orderNumber: t.orderNumber,
|
|
88
|
+
remittanceNumber: t.remittanceNumber
|
|
89
|
+
};
|
|
90
|
+
await A(t, async (a) => {
|
|
91
|
+
const f = {
|
|
92
|
+
active: !0,
|
|
93
|
+
amount: a.amount,
|
|
94
|
+
description: `Child Support - ${m.caseNumber}`,
|
|
95
|
+
// child support description follows prefix type + case number convention
|
|
96
|
+
courtOrdered: !0,
|
|
97
|
+
garnishmentType: "child_support",
|
|
98
|
+
times: null,
|
|
99
|
+
deductAsPercentage: !0,
|
|
100
|
+
// child support must always deduct as percentage up to a pay period maximum limit and is recurring until cancelled
|
|
101
|
+
payPeriodMaximum: a.payPeriodMaximum,
|
|
102
|
+
recurring: !0,
|
|
103
|
+
childSupport: m
|
|
104
|
+
};
|
|
105
|
+
if (r) {
|
|
106
|
+
const { garnishment: p } = await q({
|
|
107
|
+
request: {
|
|
108
|
+
garnishmentId: r.uuid,
|
|
109
|
+
requestBody: {
|
|
110
|
+
...f,
|
|
111
|
+
version: r.version
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
h(C.EMPLOYEE_DEDUCTION_UPDATED, p);
|
|
116
|
+
} else {
|
|
117
|
+
const { garnishment: p } = await R({
|
|
118
|
+
request: {
|
|
119
|
+
employeeId: T,
|
|
120
|
+
requestBody: f
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
h(C.EMPLOYEE_DEDUCTION_CREATED, p);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}, w = b?.manualPaymentRequired;
|
|
127
|
+
return /* @__PURE__ */ n(B, { ...l, children: /* @__PURE__ */ n(X, { onSubmit: l.handleSubmit(H), children: /* @__PURE__ */ c($, { flexDirection: "column", gap: 32, children: [
|
|
128
|
+
/* @__PURE__ */ n(
|
|
129
|
+
d,
|
|
130
|
+
{
|
|
131
|
+
name: "state",
|
|
132
|
+
label: e("agency"),
|
|
133
|
+
description: e("agencyHelperText"),
|
|
134
|
+
options: S,
|
|
135
|
+
onChange: M,
|
|
136
|
+
isRequired: !0
|
|
137
|
+
}
|
|
138
|
+
),
|
|
139
|
+
N && /* @__PURE__ */ c(O, { children: [
|
|
140
|
+
/* @__PURE__ */ n(
|
|
141
|
+
d,
|
|
142
|
+
{
|
|
143
|
+
name: "fipsCode",
|
|
144
|
+
label: e("county"),
|
|
145
|
+
description: e("countyHelperText"),
|
|
146
|
+
options: x,
|
|
147
|
+
isRequired: !0
|
|
148
|
+
}
|
|
149
|
+
),
|
|
150
|
+
_.map(({ name: t, label: m, description: a }) => /* @__PURE__ */ n(
|
|
151
|
+
J,
|
|
152
|
+
{
|
|
153
|
+
name: t,
|
|
154
|
+
label: m,
|
|
155
|
+
description: a,
|
|
156
|
+
isRequired: !0
|
|
157
|
+
},
|
|
158
|
+
t
|
|
159
|
+
)),
|
|
160
|
+
/* @__PURE__ */ n(
|
|
161
|
+
g,
|
|
162
|
+
{
|
|
163
|
+
name: "payPeriodMaximum",
|
|
164
|
+
label: e("totalAmountWithheld"),
|
|
165
|
+
description: e("totalAmountWithheldHelperText"),
|
|
166
|
+
min: ee,
|
|
167
|
+
adornmentStart: "$",
|
|
168
|
+
isRequired: !0
|
|
169
|
+
}
|
|
170
|
+
),
|
|
171
|
+
/* @__PURE__ */ n(
|
|
172
|
+
g,
|
|
173
|
+
{
|
|
174
|
+
name: "amount",
|
|
175
|
+
label: e("maxPaycheckPercentage"),
|
|
176
|
+
description: e("maxPaycheckPercentageHelperText"),
|
|
177
|
+
isRequired: !0,
|
|
178
|
+
min: re,
|
|
179
|
+
max: te,
|
|
180
|
+
adornmentStart: "%"
|
|
181
|
+
}
|
|
182
|
+
),
|
|
183
|
+
/* @__PURE__ */ n(
|
|
184
|
+
d,
|
|
185
|
+
{
|
|
186
|
+
name: "paymentPeriod",
|
|
187
|
+
label: e("per"),
|
|
188
|
+
description: e("perHelperText"),
|
|
189
|
+
options: [
|
|
190
|
+
{
|
|
191
|
+
label: e("everyWeek"),
|
|
192
|
+
value: "Every week"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
label: e("everyOtherWeek"),
|
|
196
|
+
value: "Every other week"
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
label: e("twicePerMonth"),
|
|
200
|
+
value: "Twice per month"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
label: e("monthly"),
|
|
204
|
+
value: "Monthly"
|
|
205
|
+
}
|
|
206
|
+
],
|
|
207
|
+
isRequired: !0
|
|
208
|
+
}
|
|
209
|
+
),
|
|
210
|
+
w && /* @__PURE__ */ c("section", { className: V.manualPaymentReminderBanner, children: [
|
|
211
|
+
/* @__PURE__ */ n(u.Text, { weight: "bold", children: e("manualPaymentRequired") }),
|
|
212
|
+
/* @__PURE__ */ n(u.Text, { children: e("manualPaymentRequiredDescription") })
|
|
213
|
+
] }),
|
|
214
|
+
/* @__PURE__ */ n(Q, { children: /* @__PURE__ */ n(u.Button, { type: "submit", isLoading: F, children: e("saveCta") }) })
|
|
215
|
+
] })
|
|
216
|
+
] }) }) });
|
|
217
|
+
}
|
|
218
|
+
export {
|
|
219
|
+
De as default
|
|
220
|
+
};
|
|
221
|
+
//# sourceMappingURL=ChildSupportForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChildSupportForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/ChildSupportForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { useEffect, useMemo } from 'react'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { PaymentPeriod } from '@gusto/embedded-api/models/components/garnishmentchildsupport'\nimport type { GarnishmentType } from '@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments'\nimport { type Garnishment } 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 { type Agencies } from '@gusto/embedded-api/models/components/childsupportdata'\nimport styles from './ChildSupportForm.module.scss'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { NumberInputField, TextInputField, SelectField } from '@/components/Common'\nimport { type CommonComponentInterface, useBase } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\n\nconst MINIMUM_PAY_PERIOD_AMOUNT = 0\nconst MINIMUM_PAYCHECK_PERCENTAGE = 0\nconst MAXIMUM_PAYCHECK_PERCENTAGE = 100\n\nconst ChildSupportPaymentPeriodSchema = z.nativeEnum(PaymentPeriod)\nconst ChildSupportSchema = z.object({\n state: z.string(),\n fipsCode: z.string(),\n caseNumber: z.string().nullable(),\n orderNumber: z.string().nullable(),\n remittanceNumber: z.string().nullable(),\n amount: z.number().min(0).transform(String),\n payPeriodMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n paymentPeriod: ChildSupportPaymentPeriodSchema,\n})\n\nexport type ChildSupportInputs = z.input<typeof ChildSupportSchema>\nexport type ChildSupportPayload = z.output<typeof ChildSupportSchema>\n\ninterface ChildSupportFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n handleStateAgencySelect: (stateAgency: string) => void\n stateAgencies: { label: string; value: string }[]\n counties: { label: string; value: string }[]\n selectedAgency?: Agencies\n}\n\nfunction ChildSupportForm({\n deduction,\n handleStateAgencySelect,\n stateAgencies,\n counties,\n employeeId,\n selectedAgency,\n}: ChildSupportFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n const ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER = {\n case_number: {\n name: 'caseNumber',\n description: t('caseNumberHelperText'),\n },\n order_number: {\n name: 'orderNumber',\n description: t('orderNumberHelperText'),\n },\n remittance_number: {\n name: 'remittanceNumber',\n description: t('remittanceNumberHelperText'),\n },\n }\n const requiredSelectedAgencyAttributes =\n selectedAgency?.requiredAttributes?.map(attr => {\n return {\n name: ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER[attr.key!].name,\n label: attr.label as string,\n description: ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER[attr.key!].description,\n }\n }) || []\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n const isPending = isPendingCreate || isPendingUpdate\n\n const defaultChildSupportValues: ChildSupportInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n payPeriodMaximum: deduction?.payPeriodMaximum ? Number(deduction.payPeriodMaximum) : null,\n state: deduction?.childSupport?.state || '',\n fipsCode: deduction?.childSupport?.fipsCode || '',\n caseNumber: deduction?.childSupport?.caseNumber || null,\n orderNumber: deduction?.childSupport?.orderNumber || null,\n remittanceNumber: deduction?.childSupport?.remittanceNumber || null,\n paymentPeriod: deduction?.childSupport?.paymentPeriod as PaymentPeriod,\n }\n }, [deduction])\n\n const childSupportFormMethods = useForm<ChildSupportInputs, unknown, ChildSupportPayload>({\n resolver: zodResolver(ChildSupportSchema),\n defaultValues: defaultChildSupportValues,\n })\n const { reset: resetChildSupportForm, setValue, control } = childSupportFormMethods\n const watchedStateAgency = useWatch({ control, name: 'state' })\n\n useEffect(() => {\n resetChildSupportForm(defaultChildSupportValues)\n }, [deduction, defaultChildSupportValues, resetChildSupportForm])\n\n // if in edit mode and user elects to change state agency, reset the required attribute values\n // as new selected agency might require different payload inputs, e.g. OH requires case number + order number\n useEffect(() => {\n setValue('caseNumber', null)\n setValue('orderNumber', null)\n setValue('remittanceNumber', null)\n }, [watchedStateAgency, setValue])\n\n const onChildSupportSubmit: SubmitHandler<ChildSupportPayload> = async data => {\n const childSupport = {\n state: data.state,\n paymentPeriod: data.paymentPeriod,\n fipsCode: data.fipsCode,\n caseNumber: data.caseNumber,\n orderNumber: data.orderNumber,\n remittanceNumber: data.remittanceNumber,\n }\n\n await baseSubmitHandler(data, async payload => {\n const requestBody = {\n active: true,\n amount: payload.amount,\n description: `Child Support - ${childSupport.caseNumber}`, // child support description follows prefix type + case number convention\n courtOrdered: true,\n garnishmentType: 'child_support' as GarnishmentType,\n times: null,\n deductAsPercentage: true, // child support must always deduct as percentage up to a pay period maximum limit and is recurring until cancelled\n payPeriodMaximum: payload.payPeriodMaximum,\n recurring: true,\n childSupport,\n }\n\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId,\n requestBody,\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...requestBody,\n version: deduction.version as string,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const isManualPaymentRequired = selectedAgency?.manualPaymentRequired\n\n return (\n <FormProvider {...childSupportFormMethods}>\n <Form onSubmit={childSupportFormMethods.handleSubmit(onChildSupportSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n <SelectField\n name=\"state\"\n label={t('agency')}\n description={t('agencyHelperText')}\n options={stateAgencies}\n onChange={handleStateAgencySelect}\n isRequired\n />\n {watchedStateAgency && (\n <>\n <SelectField\n name=\"fipsCode\"\n label={t('county')}\n description={t('countyHelperText')}\n options={counties}\n isRequired\n />\n {/* render required inputs for respective agency, e.g. OH requires case number + order number */}\n {requiredSelectedAgencyAttributes.map(({ name, label, description }) => (\n <TextInputField\n key={name}\n name={name}\n label={label}\n description={description}\n isRequired\n />\n ))}\n <NumberInputField\n name=\"payPeriodMaximum\"\n label={t('totalAmountWithheld')}\n description={t('totalAmountWithheldHelperText')}\n min={MINIMUM_PAY_PERIOD_AMOUNT}\n adornmentStart=\"$\"\n isRequired\n />\n <NumberInputField\n name=\"amount\"\n label={t('maxPaycheckPercentage')}\n description={t('maxPaycheckPercentageHelperText')}\n isRequired\n min={MINIMUM_PAYCHECK_PERCENTAGE}\n max={MAXIMUM_PAYCHECK_PERCENTAGE}\n adornmentStart=\"%\"\n />\n <SelectField\n name=\"paymentPeriod\"\n label={t('per')}\n description={t('perHelperText')}\n options={[\n {\n label: t('everyWeek'),\n value: 'Every week',\n },\n {\n label: t('everyOtherWeek'),\n value: 'Every other week',\n },\n {\n label: t('twicePerMonth'),\n value: 'Twice per month',\n },\n {\n label: t('monthly'),\n value: 'Monthly',\n },\n ]}\n isRequired\n />\n {isManualPaymentRequired && (\n <section className={styles.manualPaymentReminderBanner}>\n <Components.Text weight=\"bold\">{t('manualPaymentRequired')}</Components.Text>\n <Components.Text>{t('manualPaymentRequiredDescription')}</Components.Text>\n </section>\n )}\n <ActionsLayout>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('saveCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n )}\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n\nexport default ChildSupportForm\n"],"names":["MINIMUM_PAY_PERIOD_AMOUNT","MINIMUM_PAYCHECK_PERCENTAGE","MAXIMUM_PAYCHECK_PERCENTAGE","ChildSupportPaymentPeriodSchema","z","PaymentPeriod","ChildSupportSchema","val","ChildSupportForm","deduction","handleStateAgencySelect","stateAgencies","counties","employeeId","selectedAgency","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER","requiredSelectedAgencyAttributes","attr","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultChildSupportValues","useMemo","childSupportFormMethods","useForm","zodResolver","resetChildSupportForm","setValue","control","watchedStateAgency","useWatch","useEffect","onChildSupportSubmit","data","childSupport","payload","requestBody","updateDeductionResponse","componentEvents","createDeductionResponse","isManualPaymentRequired","FormProvider","jsx","Form","jsxs","Flex","SelectField","Fragment","name","label","description","TextInputField","NumberInputField","styles","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAMA,KAA4B,GAC5BC,KAA8B,GAC9BC,KAA8B,KAE9BC,KAAkCC,EAAE,WAAWC,CAAa,GAC5DC,KAAqBF,EAAE,OAAO;AAAA,EAClC,OAAOA,EAAE,OAAA;AAAA,EACT,UAAUA,EAAE,OAAA;AAAA,EACZ,YAAYA,EAAE,OAAA,EAAS,SAAA;AAAA,EACvB,aAAaA,EAAE,OAAA,EAAS,SAAA;AAAA,EACxB,kBAAkBA,EAAE,OAAA,EAAS,SAAA;AAAA,EAC7B,QAAQA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,UAAU,MAAM;AAAA,EAC1C,kBAAkBA,EACf,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAG,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,eAAeJ;AACjB,CAAC;AAcD,SAASK,GAAiB;AAAA,EACxB,WAAAC;AAAA,EACA,yBAAAC;AAAA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,EAAA,EAAA,CAEJ,GACF,GACF;AAEJ;"}
|
package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.module.scss.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChildSupportForm.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Garnishment } from '@gusto/embedded-api/models/components/garnishment';
|
|
3
|
+
import { CommonComponentInterface } from '../../../Base';
|
|
4
|
+
export declare const DeductionSchema: z.ZodObject<{
|
|
5
|
+
active: z.ZodBoolean;
|
|
6
|
+
amount: z.ZodEffects<z.ZodNumber, string, number>;
|
|
7
|
+
description: z.ZodString;
|
|
8
|
+
courtOrdered: z.ZodBoolean;
|
|
9
|
+
times: z.ZodNullable<z.ZodNumber>;
|
|
10
|
+
recurring: z.ZodEffects<z.ZodString, boolean, string>;
|
|
11
|
+
annualMaximum: z.ZodNullable<z.ZodEffects<z.ZodNumber, string | null, number>>;
|
|
12
|
+
payPeriodMaximum: z.ZodNullable<z.ZodEffects<z.ZodNumber, string | null, number>>;
|
|
13
|
+
deductAsPercentage: z.ZodEffects<z.ZodString, boolean, string>;
|
|
14
|
+
}, "strip", z.ZodTypeAny, {
|
|
15
|
+
description: string;
|
|
16
|
+
active: boolean;
|
|
17
|
+
amount: string;
|
|
18
|
+
recurring: boolean;
|
|
19
|
+
courtOrdered: boolean;
|
|
20
|
+
times: number | null;
|
|
21
|
+
annualMaximum: string | null;
|
|
22
|
+
payPeriodMaximum: string | null;
|
|
23
|
+
deductAsPercentage: boolean;
|
|
24
|
+
}, {
|
|
25
|
+
description: string;
|
|
26
|
+
active: boolean;
|
|
27
|
+
amount: number;
|
|
28
|
+
recurring: string;
|
|
29
|
+
courtOrdered: boolean;
|
|
30
|
+
times: number | null;
|
|
31
|
+
annualMaximum: number | null;
|
|
32
|
+
payPeriodMaximum: number | null;
|
|
33
|
+
deductAsPercentage: string;
|
|
34
|
+
}>;
|
|
35
|
+
export type DeductionInputs = z.input<typeof DeductionSchema>;
|
|
36
|
+
export type DeductionPayload = z.output<typeof DeductionSchema>;
|
|
37
|
+
interface ChildSupportFormProps extends CommonComponentInterface<'Employee.Deductions'> {
|
|
38
|
+
employeeId: string;
|
|
39
|
+
deduction?: Garnishment | null;
|
|
40
|
+
}
|
|
41
|
+
declare function CustomDeductionForm({ deduction, employeeId }: ChildSupportFormProps): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
export default CustomDeductionForm;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { jsx as n, jsxs as s, Fragment as b } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation as F } from "react-i18next";
|
|
3
|
+
import { useForm as L, useWatch as q, FormProvider as R } from "react-hook-form";
|
|
4
|
+
import { useMemo as T, useEffect as S } from "react";
|
|
5
|
+
import { z as t } from "zod";
|
|
6
|
+
import { zodResolver as N } from "@hookform/resolvers/zod";
|
|
7
|
+
import { useGarnishmentsCreateMutation as I } from "@gusto/embedded-api/react-query/garnishmentsCreate";
|
|
8
|
+
import { useGarnishmentsUpdateMutation as U } from "@gusto/embedded-api/react-query/garnishmentsUpdate";
|
|
9
|
+
import { useComponentContext as _ } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
10
|
+
import { Form as B } from "../../../Common/Form/Form.js";
|
|
11
|
+
import { Flex as w } from "../../../Common/Flex/Flex.js";
|
|
12
|
+
import "classnames";
|
|
13
|
+
import { componentEvents as l } from "../../../../shared/constants.js";
|
|
14
|
+
import { RadioGroupField as f } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
15
|
+
import { TextInputField as j } from "../../../Common/Fields/TextInputField/TextInputField.js";
|
|
16
|
+
import { ActionsLayout as G } from "../../../Common/ActionsLayout/ActionsLayout.js";
|
|
17
|
+
import { NumberInputField as c } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
|
|
18
|
+
import "react-error-boundary";
|
|
19
|
+
import "@gusto/embedded-api/models/errors/apierror";
|
|
20
|
+
import "@gusto/embedded-api/models/errors/sdkvalidationerror";
|
|
21
|
+
import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
|
|
22
|
+
import "@tanstack/react-query";
|
|
23
|
+
import { useBase as Y } from "../../../Base/useBase.js";
|
|
24
|
+
import "dompurify";
|
|
25
|
+
import "../../../../contexts/LocaleProvider/useLocale.js";
|
|
26
|
+
import { CheckboxField as k } from "../../../Common/Fields/CheckboxField/CheckboxField.js";
|
|
27
|
+
const z = t.object({
|
|
28
|
+
active: t.boolean(),
|
|
29
|
+
amount: t.number().min(0).transform(String),
|
|
30
|
+
description: t.string().min(1),
|
|
31
|
+
courtOrdered: t.boolean(),
|
|
32
|
+
times: t.number().nullable(),
|
|
33
|
+
recurring: t.string().transform((e) => e === "true"),
|
|
34
|
+
annualMaximum: t.number().min(0).transform((e) => e > 0 ? e.toString() : null).nullable(),
|
|
35
|
+
payPeriodMaximum: t.number().min(0).transform((e) => e > 0 ? e.toString() : null).nullable(),
|
|
36
|
+
deductAsPercentage: t.string().transform((e) => e === "true")
|
|
37
|
+
});
|
|
38
|
+
function xe({ deduction: e, employeeId: g }) {
|
|
39
|
+
const { onEvent: o, baseSubmitHandler: x } = Y(), { t: r } = F("Employee.Deductions"), p = _(), { mutateAsync: P, isPending: h } = I(), { mutateAsync: E, isPending: y } = U(), D = h || y, m = T(() => ({
|
|
40
|
+
amount: e?.amount ? Number(e.amount) : 0,
|
|
41
|
+
description: e?.description ?? "",
|
|
42
|
+
times: e?.times ?? null,
|
|
43
|
+
recurring: e?.recurring?.toString() ?? "true",
|
|
44
|
+
annualMaximum: e?.annualMaximum ? Number(e.annualMaximum) : null,
|
|
45
|
+
payPeriodMaximum: e?.payPeriodMaximum ? Number(e.payPeriodMaximum) : null,
|
|
46
|
+
deductAsPercentage: e?.deductAsPercentage?.toString() ?? "true",
|
|
47
|
+
active: !0,
|
|
48
|
+
courtOrdered: e?.courtOrdered ?? !1
|
|
49
|
+
}), [e]), a = L({
|
|
50
|
+
resolver: N(z),
|
|
51
|
+
defaultValues: m
|
|
52
|
+
}), { reset: d, control: C } = a;
|
|
53
|
+
S(() => {
|
|
54
|
+
d(m);
|
|
55
|
+
}, [e, m, d]);
|
|
56
|
+
const M = q({ control: C, name: "recurring" }), O = async (A) => {
|
|
57
|
+
await x(A, async (i) => {
|
|
58
|
+
if (e) {
|
|
59
|
+
const { garnishment: u } = await E({
|
|
60
|
+
request: {
|
|
61
|
+
garnishmentId: e.uuid,
|
|
62
|
+
requestBody: {
|
|
63
|
+
...i,
|
|
64
|
+
version: e.version,
|
|
65
|
+
times: i.recurring ? null : 1
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
o(l.EMPLOYEE_DEDUCTION_UPDATED, u);
|
|
70
|
+
} else {
|
|
71
|
+
const { garnishment: u } = await P({
|
|
72
|
+
request: {
|
|
73
|
+
employeeId: g,
|
|
74
|
+
requestBody: { ...i, times: i.recurring ? null : 1 }
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
o(l.EMPLOYEE_DEDUCTION_CREATED, u);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}, v = () => {
|
|
81
|
+
o(l.EMPLOYEE_DEDUCTION_CANCEL);
|
|
82
|
+
};
|
|
83
|
+
return /* @__PURE__ */ n(R, { ...a, children: /* @__PURE__ */ n(B, { onSubmit: a.handleSubmit(O), children: /* @__PURE__ */ n(w, { flexDirection: "column", gap: 32, children: /* @__PURE__ */ s(b, { children: [
|
|
84
|
+
/* @__PURE__ */ n(j, { name: "description", label: r("descriptionLabel"), isRequired: !0 }),
|
|
85
|
+
/* @__PURE__ */ n(
|
|
86
|
+
f,
|
|
87
|
+
{
|
|
88
|
+
name: "deductAsPercentage",
|
|
89
|
+
label: r("deductionTypeLabel"),
|
|
90
|
+
isRequired: !0,
|
|
91
|
+
options: [
|
|
92
|
+
{ value: "true", label: r("deductionTypePercentageOption") },
|
|
93
|
+
{ value: "false", label: r("deductionTypeFixedAmountOption") }
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
),
|
|
97
|
+
/* @__PURE__ */ n(c, { name: "amount", label: r("deductionAmountLabel"), isRequired: !0, min: 0 }),
|
|
98
|
+
/* @__PURE__ */ n(
|
|
99
|
+
f,
|
|
100
|
+
{
|
|
101
|
+
name: "recurring",
|
|
102
|
+
label: r("frequencyLabel"),
|
|
103
|
+
isRequired: !0,
|
|
104
|
+
options: [
|
|
105
|
+
{ value: "true", label: r("frequencyRecurringOption") },
|
|
106
|
+
{ value: "false", label: r("frequencyOneTimeOption") }
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
),
|
|
110
|
+
M === "true" && /* @__PURE__ */ s(b, { children: [
|
|
111
|
+
/* @__PURE__ */ n(c, { name: "annualMaximum", label: r("annualMaxLabel"), min: 0 }),
|
|
112
|
+
/* @__PURE__ */ n(c, { name: "payPeriodMaximum", label: "Pay period maximum", min: 0 })
|
|
113
|
+
] }),
|
|
114
|
+
/* @__PURE__ */ n(
|
|
115
|
+
k,
|
|
116
|
+
{
|
|
117
|
+
name: "courtOrdered",
|
|
118
|
+
label: r("courtOrderedLabel"),
|
|
119
|
+
isDisabled: !!e
|
|
120
|
+
}
|
|
121
|
+
),
|
|
122
|
+
/* @__PURE__ */ s(G, { children: [
|
|
123
|
+
/* @__PURE__ */ n(p.Button, { variant: "secondary", onClick: v, children: r("cancelCta") }),
|
|
124
|
+
/* @__PURE__ */ n(p.Button, { type: "submit", isLoading: D, children: r(e ? "continueCta" : "addDeductionCta") })
|
|
125
|
+
] })
|
|
126
|
+
] }) }) }) });
|
|
127
|
+
}
|
|
128
|
+
export {
|
|
129
|
+
z as DeductionSchema,
|
|
130
|
+
xe as default
|
|
131
|
+
};
|
|
132
|
+
//# sourceMappingURL=CustomDeductionForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomDeductionForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { useEffect, useMemo } from 'react'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { type Garnishment } 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 { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport {\n NumberInputField,\n TextInputField,\n RadioGroupField,\n CheckboxField,\n} from '@/components/Common'\nimport { type CommonComponentInterface, useBase } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\n\nexport const DeductionSchema = z.object({\n active: z.boolean(),\n amount: z.number().min(0).transform(String),\n description: z.string().min(1),\n courtOrdered: z.boolean(),\n times: z.number().nullable(),\n recurring: z.string().transform(val => val === 'true'),\n annualMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n payPeriodMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n deductAsPercentage: z.string().transform(val => val === 'true'),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ninterface ChildSupportFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n}\n\nfunction CustomDeductionForm({ deduction, employeeId }: ChildSupportFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n const isPending = isPendingCreate || isPendingUpdate\n\n const defaultValues: DeductionInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n description: deduction?.description ?? '',\n times: deduction?.times ?? null,\n recurring: deduction?.recurring?.toString() ?? 'true',\n annualMaximum: deduction?.annualMaximum ? Number(deduction.annualMaximum) : null,\n payPeriodMaximum: deduction?.payPeriodMaximum ? Number(deduction.payPeriodMaximum) : null,\n deductAsPercentage: deduction?.deductAsPercentage?.toString() ?? 'true',\n active: true,\n courtOrdered: deduction?.courtOrdered ?? false,\n } as DeductionInputs\n }, [deduction])\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n const { reset: resetForm, control } = formMethods\n\n useEffect(() => {\n resetForm(defaultValues)\n }, [deduction, defaultValues, resetForm])\n\n const watchedRecurring = useWatch({ control, name: 'recurring' })\n\n const onSubmit: SubmitHandler<DeductionPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, times: payload.recurring ? null : 1 },\n },\n })\n\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...payload,\n version: deduction.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CANCEL)\n }\n\n return (\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n <>\n <TextInputField name=\"description\" label={t('descriptionLabel')} isRequired />\n <RadioGroupField\n name=\"deductAsPercentage\"\n label={t('deductionTypeLabel')}\n isRequired\n options={[\n { value: 'true', label: t('deductionTypePercentageOption') },\n { value: 'false', label: t('deductionTypeFixedAmountOption') },\n ]}\n />\n <NumberInputField name=\"amount\" label={t('deductionAmountLabel')} isRequired min={0} />\n <RadioGroupField\n name=\"recurring\"\n label={t('frequencyLabel')}\n isRequired\n options={[\n { value: 'true', label: t('frequencyRecurringOption') },\n { value: 'false', label: t('frequencyOneTimeOption') },\n ]}\n />\n {watchedRecurring === 'true' && (\n <>\n <NumberInputField name=\"annualMaximum\" label={t('annualMaxLabel')} min={0} />\n <NumberInputField name=\"payPeriodMaximum\" label=\"Pay period maximum\" min={0} />\n </>\n )}\n <CheckboxField\n name=\"courtOrdered\"\n label={t('courtOrderedLabel')}\n isDisabled={!!deduction}\n />\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {!deduction ? t('addDeductionCta') : t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n\nexport default CustomDeductionForm\n"],"names":["DeductionSchema","z","val","CustomDeductionForm","deduction","employeeId","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultValues","useMemo","formMethods","useForm","zodResolver","resetForm","control","useEffect","watchedRecurring","useWatch","onSubmit","data","payload","updateDeductionResponse","componentEvents","createDeductionResponse","handleCancel","FormProvider","jsx","Form","Flex","jsxs","Fragment","TextInputField","RadioGroupField","NumberInputField","CheckboxField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAqBO,MAAMA,IAAkBC,EAAE,OAAO;AAAA,EACtC,QAAQA,EAAE,QAA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;AAAA,QACL,OAAOrC,EAAE,mBAAmB;AAAA,QAC5B,YAAY,CAAC,CAACL;AAAA,MAAA;AAAA,IAAA;AAAA,sBAEf2C,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAT,EAAC3B,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASyB,GAC7C,UAAA3B,EAAE,WAAW,EAAA,CAChB;AAAA,MACA,gBAAA6B,EAAC3B,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWQ,GACzC,UAAoCV,EAAnCL,IAAqC,gBAAvB,iBAAoC,EAAA,CACtD;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
|
|
@@ -11,13 +11,14 @@ import { BaseComponent as z } from "../../../Base/Base.js";
|
|
|
11
11
|
import { useBase as H } from "../../../Base/useBase.js";
|
|
12
12
|
import { Form as V } from "../../../Common/Form/Form.js";
|
|
13
13
|
import { Flex as W } from "../../../Common/Flex/Flex.js";
|
|
14
|
-
import
|
|
15
|
-
import { useComponentDictionary as K, useI18n as Q } from "../../../../i18n/I18n.js";
|
|
14
|
+
import "classnames";
|
|
16
15
|
import { componentEvents as p } from "../../../../shared/constants.js";
|
|
17
|
-
import { useComponentContext as X } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
18
|
-
import { TextInputField as Z } from "../../../Common/Fields/TextInputField/TextInputField.js";
|
|
19
16
|
import { RadioGroupField as x } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
17
|
+
import { TextInputField as J } from "../../../Common/Fields/TextInputField/TextInputField.js";
|
|
18
|
+
import { ActionsLayout as K } from "../../../Common/ActionsLayout/ActionsLayout.js";
|
|
20
19
|
import { NumberInputField as f } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
|
|
20
|
+
import { useComponentDictionary as Q, useI18n as X } from "../../../../i18n/I18n.js";
|
|
21
|
+
import { useComponentContext as Z } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
21
22
|
import { CheckboxField as $ } from "../../../Common/Fields/CheckboxField/CheckboxField.js";
|
|
22
23
|
const ee = i.object({
|
|
23
24
|
active: i.boolean(),
|
|
@@ -30,12 +31,12 @@ const ee = i.object({
|
|
|
30
31
|
payPeriodMaximum: i.number().min(0).transform((t) => t > 0 ? t.toString() : null).nullable(),
|
|
31
32
|
deductAsPercentage: i.string().transform((t) => t === "true")
|
|
32
33
|
});
|
|
33
|
-
function
|
|
34
|
+
function Me(t) {
|
|
34
35
|
return /* @__PURE__ */ n(z, { ...t, children: /* @__PURE__ */ n(ne, { ...t, children: t.children }) });
|
|
35
36
|
}
|
|
36
37
|
function ne({ className: t, children: b, employeeId: g, deductionId: h, dictionary: y }) {
|
|
37
|
-
const { onEvent: u, baseSubmitHandler: P } = H(), { t: r } = N("Employee.Deductions"), m =
|
|
38
|
-
|
|
38
|
+
const { onEvent: u, baseSubmitHandler: P } = H(), { t: r } = N("Employee.Deductions"), m = Z();
|
|
39
|
+
Q("Employee.Deductions", y), X("Employee.Deductions");
|
|
39
40
|
const { data: C } = k({ employeeId: g }), e = h ? C.garnishmentList?.find((c) => c.uuid === h) ?? null : null, { mutateAsync: M, isPending: O } = j(), { mutateAsync: L, isPending: T } = Y(), a = B(() => ({
|
|
40
41
|
amount: e?.amount ? Number(e.amount) : 0,
|
|
41
42
|
description: e?.description ?? "",
|
|
@@ -82,7 +83,7 @@ function ne({ className: t, children: b, employeeId: g, deductionId: h, dictiona
|
|
|
82
83
|
}, S = r(e ? "editDeductionTitle" : "addDeductionTitle");
|
|
83
84
|
return /* @__PURE__ */ n("section", { className: t, children: /* @__PURE__ */ n(w, { ...s, children: /* @__PURE__ */ n(V, { onSubmit: s.handleSubmit(R), children: /* @__PURE__ */ n(W, { flexDirection: "column", gap: 32, children: b || /* @__PURE__ */ d(E, { children: [
|
|
84
85
|
/* @__PURE__ */ n(m.Heading, { as: "h2", children: S }),
|
|
85
|
-
/* @__PURE__ */ n(
|
|
86
|
+
/* @__PURE__ */ n(J, { name: "description", label: r("descriptionLabel"), isRequired: !0 }),
|
|
86
87
|
/* @__PURE__ */ n(
|
|
87
88
|
x,
|
|
88
89
|
{
|
|
@@ -121,7 +122,7 @@ function ne({ className: t, children: b, employeeId: g, deductionId: h, dictiona
|
|
|
121
122
|
/* @__PURE__ */ n(f, { name: "payPeriodMaximum", label: "Pay period maximum", min: 0 })
|
|
122
123
|
] }),
|
|
123
124
|
/* @__PURE__ */ n($, { name: "courtOrdered", label: r("courtOrderedLabel") }),
|
|
124
|
-
/* @__PURE__ */ d(
|
|
125
|
+
/* @__PURE__ */ d(K, { children: [
|
|
125
126
|
/* @__PURE__ */ n(m.Button, { variant: "secondary", onClick: q, children: r("cancelCta") }),
|
|
126
127
|
/* @__PURE__ */ n(m.Button, { type: "submit", isLoading: F, children: r(e ? "continueCta" : "addDeductionCta") })
|
|
127
128
|
] })
|
|
@@ -129,6 +130,6 @@ function ne({ className: t, children: b, employeeId: g, deductionId: h, dictiona
|
|
|
129
130
|
}
|
|
130
131
|
export {
|
|
131
132
|
ee as DeductionSchema,
|
|
132
|
-
|
|
133
|
+
Me as DeductionsForm
|
|
133
134
|
};
|
|
134
135
|
//# sourceMappingURL=DeductionsForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeductionsForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/DeductionsForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useEffect, useMemo } from 'react'\nimport { z } from 'zod'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { useGarnishmentsListSuspense } from '@gusto/embedded-api/react-query/garnishmentsList'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport {\n CheckboxField,\n NumberInputField,\n RadioGroupField,\n TextInputField,\n} from '@/components/Common'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\nexport const DeductionSchema = z.object({\n active: z.boolean(),\n amount: z.number().min(0).transform(String),\n description: z.string().min(1),\n courtOrdered: z.boolean(),\n times: z.number().nullable(),\n recurring: z.string().transform(val => val === 'true'),\n annualMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n payPeriodMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n deductAsPercentage: z.string().transform(val => val === 'true'),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ninterface DeductionsFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deductionId?: string | null\n}\n\nexport function DeductionsForm(props: DeductionsFormProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ className, children, employeeId, deductionId, dictionary }: DeductionsFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n useComponentDictionary('Employee.Deductions', dictionary)\n useI18n('Employee.Deductions')\n\n // Fetch all garnishments to find the specific one by ID\n const { data } = useGarnishmentsListSuspense({ employeeId })\n const deduction = deductionId\n ? (data.garnishmentList?.find(g => g.uuid === deductionId) ?? null)\n : null\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n\n const defaultValues: DeductionInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n description: deduction?.description ?? '',\n times: deduction?.times ?? null,\n recurring: deduction?.recurring?.toString() ?? 'true',\n annualMaximum: deduction?.annualMaximum ? Number(deduction.annualMaximum) : null,\n payPeriodMaximum: deduction?.payPeriodMaximum ? Number(deduction.payPeriodMaximum) : null,\n deductAsPercentage: deduction?.deductAsPercentage?.toString() ?? 'true',\n active: true,\n courtOrdered: deduction?.courtOrdered ?? false,\n } as DeductionInputs\n }, [deduction])\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n\n const { reset: resetForm, control } = formMethods\n\n useEffect(() => {\n resetForm(defaultValues)\n }, [deduction, defaultValues, resetForm])\n\n const watchedRecurring = useWatch({ control, name: 'recurring' })\n\n const isPending = isPendingCreate || isPendingUpdate\n\n const onSubmit: SubmitHandler<DeductionPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, times: payload.recurring ? null : 1 },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...payload,\n version: deduction.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CANCEL)\n }\n\n const title = !deduction ? t('addDeductionTitle') : t('editDeductionTitle')\n\n return (\n <section className={className}>\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Components.Heading as=\"h2\">{title}</Components.Heading>\n <TextInputField name=\"description\" label={t('descriptionLabel')} isRequired />\n <RadioGroupField\n name=\"deductAsPercentage\"\n label={t('deductionTypeLabel')}\n isRequired\n options={[\n { value: 'true', label: t('deductionTypePercentageOption') },\n { value: 'false', label: t('deductionTypeFixedAmountOption') },\n ]}\n />\n <NumberInputField\n name=\"amount\"\n label={t('deductionAmountLabel')}\n isRequired\n min={0}\n />\n <RadioGroupField\n name=\"recurring\"\n label={t('frequencyLabel')}\n isRequired\n options={[\n { value: 'true', label: t('frequencyRecurringOption') },\n { value: 'false', label: t('frequencyOneTimeOption') },\n ]}\n />\n {watchedRecurring === 'true' && (\n <>\n <NumberInputField name=\"annualMaximum\" label={t('annualMaxLabel')} min={0} />\n <NumberInputField name=\"payPeriodMaximum\" label=\"Pay period maximum\" min={0} />\n </>\n )}\n <CheckboxField name=\"courtOrdered\" label={t('courtOrderedLabel')} />\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {!deduction ? t('addDeductionCta') : t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n )}\n </Flex>\n </Form>\n </FormProvider>\n </section>\n )\n}\n"],"names":["DeductionSchema","z","val","DeductionsForm","props","jsx","BaseComponent","Root","className","children","employeeId","deductionId","dictionary","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","useComponentDictionary","useI18n","data","useGarnishmentsListSuspense","deduction","g","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","defaultValues","useMemo","formMethods","useForm","zodResolver","resetForm","control","useEffect","watchedRecurring","useWatch","isPending","onSubmit","payload","updateDeductionResponse","componentEvents","createDeductionResponse","handleCancel","title","FormProvider","Form","Flex","jsxs","Fragment","TextInputField","RadioGroupField","NumberInputField","CheckboxField","ActionsLayout"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A,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOzC,EAAE,sBAAsB;AAAA,QAC/B,YAAU;AAAA,QACV,KAAK;AAAA,MAAA;AAAA,IAAA;AAAA,IAEP,gBAAAX;AAAA,MAACmD;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOxC,EAAE,gBAAgB;AAAA,QACzB,YAAU;AAAA,QACV,SAAS;AAAA,UACP,EAAE,OAAO,QAAQ,OAAOA,EAAE,0BAA0B,EAAA;AAAA,UACpD,EAAE,OAAO,SAAS,OAAOA,EAAE,wBAAwB,EAAA;AAAA,QAAE;AAAA,MACvD;AAAA,IAAA;AAAA,IAEDwB,MAAqB,UACpB,gBAAAa,EAAAC,GAAA,EACE,UAAA;AAAA,MAAA,gBAAAjD,EAACoD,GAAA,EAAiB,MAAK,iBAAgB,OAAOzC,EAAE,gBAAgB,GAAG,KAAK,GAAG;AAAA,wBAC1EyC,GAAA,EAAiB,MAAK,oBAAmB,OAAM,sBAAqB,KAAK,EAAA,CAAG;AAAA,IAAA,GAC/E;AAAA,sBAEDC,GAAA,EAAc,MAAK,gBAAe,OAAO1C,EAAE,mBAAmB,GAAG;AAAA,sBACjE2C,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAtD,EAACa,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAAS8B,GAC7C,UAAAhC,EAAE,WAAW,EAAA,CAChB;AAAA,MACA,gBAAAX,EAACa,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWwB,GACzC,UAAoC1B,EAAnCQ,IAAqC,gBAAvB,iBAAoC,EAAA,CACtD;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,EAAA,CACF,EAAA,CAEJ,GACF,EAAA,CACF,EAAA,CACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"DeductionsForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/DeductionsForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useEffect, useMemo } from 'react'\nimport { z } from 'zod'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { useGarnishmentsListSuspense } from '@gusto/embedded-api/react-query/garnishmentsList'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport {\n CheckboxField,\n NumberInputField,\n RadioGroupField,\n TextInputField,\n} from '@/components/Common'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\nexport const DeductionSchema = z.object({\n active: z.boolean(),\n amount: z.number().min(0).transform(String),\n description: z.string().min(1),\n courtOrdered: z.boolean(),\n times: z.number().nullable(),\n recurring: z.string().transform(val => val === 'true'),\n annualMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n payPeriodMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n deductAsPercentage: z.string().transform(val => val === 'true'),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ninterface DeductionsFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deductionId?: string | null\n}\n\nexport function DeductionsForm(props: DeductionsFormProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ className, children, employeeId, deductionId, dictionary }: DeductionsFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n useComponentDictionary('Employee.Deductions', dictionary)\n useI18n('Employee.Deductions')\n\n // Fetch all garnishments to find the specific one by ID\n const { data } = useGarnishmentsListSuspense({ employeeId })\n const deduction = deductionId\n ? (data.garnishmentList?.find(g => g.uuid === deductionId) ?? null)\n : null\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n\n const defaultValues: DeductionInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n description: deduction?.description ?? '',\n times: deduction?.times ?? null,\n recurring: deduction?.recurring?.toString() ?? 'true',\n annualMaximum: deduction?.annualMaximum ? Number(deduction.annualMaximum) : null,\n payPeriodMaximum: deduction?.payPeriodMaximum ? Number(deduction.payPeriodMaximum) : null,\n deductAsPercentage: deduction?.deductAsPercentage?.toString() ?? 'true',\n active: true,\n courtOrdered: deduction?.courtOrdered ?? false,\n } as DeductionInputs\n }, [deduction])\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n\n const { reset: resetForm, control } = formMethods\n\n useEffect(() => {\n resetForm(defaultValues)\n }, [deduction, defaultValues, resetForm])\n\n const watchedRecurring = useWatch({ control, name: 'recurring' })\n\n const isPending = isPendingCreate || isPendingUpdate\n\n const onSubmit: SubmitHandler<DeductionPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, times: payload.recurring ? null : 1 },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...payload,\n version: deduction.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CANCEL)\n }\n\n const title = !deduction ? t('addDeductionTitle') : t('editDeductionTitle')\n\n return (\n <section className={className}>\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Components.Heading as=\"h2\">{title}</Components.Heading>\n <TextInputField name=\"description\" label={t('descriptionLabel')} isRequired />\n <RadioGroupField\n name=\"deductAsPercentage\"\n label={t('deductionTypeLabel')}\n isRequired\n options={[\n { value: 'true', label: t('deductionTypePercentageOption') },\n { value: 'false', label: t('deductionTypeFixedAmountOption') },\n ]}\n />\n <NumberInputField\n name=\"amount\"\n label={t('deductionAmountLabel')}\n isRequired\n min={0}\n />\n <RadioGroupField\n name=\"recurring\"\n label={t('frequencyLabel')}\n isRequired\n options={[\n { value: 'true', label: t('frequencyRecurringOption') },\n { value: 'false', label: t('frequencyOneTimeOption') },\n ]}\n />\n {watchedRecurring === 'true' && (\n <>\n <NumberInputField name=\"annualMaximum\" label={t('annualMaxLabel')} min={0} />\n <NumberInputField name=\"payPeriodMaximum\" label=\"Pay period maximum\" min={0} />\n </>\n )}\n <CheckboxField name=\"courtOrdered\" label={t('courtOrderedLabel')} />\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {!deduction ? t('addDeductionCta') : t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n )}\n </Flex>\n </Form>\n </FormProvider>\n </section>\n )\n}\n"],"names":["DeductionSchema","z","val","DeductionsForm","props","jsx","BaseComponent","Root","className","children","employeeId","deductionId","dictionary","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","useComponentDictionary","useI18n","data","useGarnishmentsListSuspense","deduction","g","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","defaultValues","useMemo","formMethods","useForm","zodResolver","resetForm","control","useEffect","watchedRecurring","useWatch","isPending","onSubmit","payload","updateDeductionResponse","componentEvents","createDeductionResponse","handleCancel","title","FormProvider","Form","Flex","jsxs","Fragment","TextInputField","RadioGroupField","NumberInputField","CheckboxField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA4BO,MAAMA,KAAkBC,EAAE,OAAO;AAAA,EACtC,QAAQA,EAAE,QAAA;AAAA,EACV,QAAQA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,UAAU,MAAM;AAAA,EAC1C,aAAaA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC7B,cAAcA,EAAE,QAAA;AAAA,EAChB,OAAOA,EAAE,OAAA,EAAS,SAAA;AAAA,EAClB,WAAWA,EAAE,OAAA,EAAS,UAAU,CAAAC,MAAOA,MAAQ,MAAM;AAAA,EACrD,eAAeD,EACZ,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAC,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,kBAAkBD,EACf,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAC,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,oBAAoBD,EAAE,OAAA,EAAS,UAAU,CAAAC,MAAOA,MAAQ,MAAM;AAChE,CAAC;AAUM,SAASC,GAAeC,GAAqD;AAClF,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,MAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,SAASG,GAAK,EAAE,WAAAC,GAAW,UAAAC,GAAU,YAAAC,GAAY,aAAAC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AS,WAAWwB,GACzC,UAAoC1B,EAAnCQ,IAAqC,gBAAvB,iBAAoC,EAAA,CACtD;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,EAAA,CACF,EAAA,CAEJ,GACF,EAAA,CACF,EAAA,CACF;AAEJ;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const e = "_leftCaretIcon_cfkf8_6", n = "_formHeadingContainer_cfkf8_10", o = "_deductionTypeRadioGroup_cfkf8_14", t = "_garnishmentTypeLabel_cfkf8_18", a = {
|
|
2
|
+
leftCaretIcon: e,
|
|
3
|
+
formHeadingContainer: n,
|
|
4
|
+
deductionTypeRadioGroup: o,
|
|
5
|
+
garnishmentTypeLabel: t
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
o as deductionTypeRadioGroup,
|
|
9
|
+
a as default,
|
|
10
|
+
n as formHeadingContainer,
|
|
11
|
+
t as garnishmentTypeLabel,
|
|
12
|
+
e as leftCaretIcon
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=DeductionsForm.module.scss.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeductionsForm.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { BaseComponentInterface, CommonComponentInterface } from '../../../Base';
|
|
2
|
+
interface DeductionsFormProps extends CommonComponentInterface<'Employee.Deductions'> {
|
|
3
|
+
employeeId: string;
|
|
4
|
+
deductionId?: string | null;
|
|
5
|
+
}
|
|
6
|
+
export declare function UNSTABLEDeductionsForm(props: DeductionsFormProps & BaseComponentInterface): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|