@gusto/embedded-react-sdk 0.21.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +62 -0
- package/README.md +32 -17
- package/dist/assets/icons/eye.svg.js +10 -0
- package/dist/assets/icons/eye.svg.js.map +1 -0
- package/dist/assets/icons/icon-file-outline.svg.js +10 -0
- package/dist/assets/icons/icon-file-outline.svg.js.map +1 -0
- package/dist/assets/icons/icon-receipt-outline.svg.js +10 -0
- package/dist/assets/icons/icon-receipt-outline.svg.js.map +1 -0
- package/dist/components/Base/Base.js.map +1 -1
- package/dist/components/Base/index.d.ts +1 -1
- package/dist/components/Common/Fields/CheckboxField/CheckboxField.js.map +1 -1
- package/dist/components/Common/Fields/CheckboxGroupField/CheckboxGroupField.js.map +1 -1
- package/dist/components/Common/Fields/ComboBoxField/ComboBoxField.js.map +1 -1
- package/dist/components/Common/Fields/DatePickerField/DatePickerField.js.map +1 -1
- package/dist/components/Common/Fields/NumberInputField/NumberInputField.js.map +1 -1
- package/dist/components/Common/Fields/RadioGroupField/RadioGroupField.js.map +1 -1
- package/dist/components/Common/Fields/SelectField/SelectField.js.map +1 -1
- package/dist/components/Common/Fields/SwitchField/SwitchField.js.map +1 -1
- package/dist/components/Common/Fields/TextAreaField/TextAreaField.js.map +1 -1
- package/dist/components/Common/Fields/TextInputField/TextInputField.js.map +1 -1
- package/dist/components/Common/Fieldset/Fieldset.js.map +1 -1
- package/dist/components/Common/FlowBreadcrumbs/breadcrumbTransitionHelpers.d.ts +1 -0
- package/dist/components/Common/FlowBreadcrumbs/breadcrumbTransitionHelpers.js +14 -0
- package/dist/components/Common/FlowBreadcrumbs/breadcrumbTransitionHelpers.js.map +1 -0
- package/dist/components/Common/FlowBreadcrumbs/index.d.ts +1 -0
- package/dist/components/Common/PaginationControl/PaginationControlTypes.d.ts +1 -1
- package/dist/components/Common/ReorderableList/ReorderableItem.d.ts +1 -1
- package/dist/components/Common/ReorderableList/ReorderableItem.js.map +1 -1
- package/dist/components/Common/ReorderableList/ReorderableList.js +7 -7
- package/dist/components/Common/ReorderableList/ReorderableList.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormActions.js +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormFields.js +1 -1
- package/dist/components/Common/UI/Badge/BadgeTypes.js.map +1 -1
- package/dist/components/Common/UI/Banner/BannerTypes.js.map +1 -1
- package/dist/components/Common/UI/Button/ButtonIcon.d.ts +1 -1
- package/dist/components/Common/UI/Button/ButtonIcon.js +10 -7
- package/dist/components/Common/UI/Button/ButtonIcon.js.map +1 -1
- package/dist/components/Common/UI/Button/ButtonTypes.js.map +1 -1
- package/dist/components/Common/UI/Checkbox/CheckboxTypes.js.map +1 -1
- package/dist/components/Common/UI/CheckboxGroup/CheckboxGroupTypes.js.map +1 -1
- package/dist/components/Common/UI/ComboBox/ComboBox.module.scss.js +1 -1
- package/dist/components/Common/UI/DatePicker/DatePicker.module.scss.js +7 -7
- package/dist/components/Common/UI/Input/InputTypes.js.map +1 -1
- package/dist/components/Common/UI/LoadingSpinner/LoadingSpinnerTypes.js.map +1 -1
- package/dist/components/Common/UI/Radio/RadioTypes.js.map +1 -1
- package/dist/components/Common/UI/RadioGroup/RadioGroupTypes.js.map +1 -1
- package/dist/components/Common/UI/Select/Select.module.scss.js +6 -6
- package/dist/components/Common/UI/Switch/SwitchTypes.js.map +1 -1
- package/dist/components/Common/UI/Table/Table.module.scss.js +1 -1
- package/dist/components/Common/UI/Table/TableTypes.js.map +1 -1
- package/dist/components/Common/UI/Tabs/Tabs.module.scss.js +5 -5
- package/dist/components/Common/UI/TextArea/TextAreaTypes.js.map +1 -1
- package/dist/components/Common/UI/TextInput/TextInputTypes.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +6 -5
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +3 -4
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +5 -4
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +3 -4
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +5 -6
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +3 -4
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +3 -4
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +3 -4
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +5 -6
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +6 -7
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Form.js +5 -4
- package/dist/components/Company/Locations/LocationForm/Form.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +3 -4
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +3 -4
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +3 -4
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Edit.js +10 -9
- package/dist/components/Company/PaySchedule/_parts/Edit.js.map +1 -1
- package/dist/components/Company/PaySchedule/usePaySchedule.js +5 -6
- package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +3 -4
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +3 -4
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Company/index.d.ts +2 -0
- package/dist/components/Company/index.js +20 -16
- package/dist/components/Company/index.js.map +1 -1
- package/dist/components/Contractor/Address/Form.js +7 -6
- package/dist/components/Contractor/Address/Form.js.map +1 -1
- package/dist/components/Contractor/Address/useAddress.js +5 -6
- package/dist/components/Contractor/Address/useAddress.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.d.ts +7 -0
- package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js +204 -0
- package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js.map +1 -0
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.d.ts +15 -9
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js +140 -0
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js.map +1 -0
- package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.d.ts +39 -0
- package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js +132 -0
- package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js.map +1 -0
- package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.d.ts +11 -0
- package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js +139 -0
- package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js.map +1 -0
- package/dist/components/Contractor/Payments/CreatePayment/helpers.d.ts +2 -0
- package/dist/components/Contractor/Payments/CreatePayment/helpers.js +6 -0
- package/dist/components/Contractor/Payments/CreatePayment/helpers.js.map +1 -0
- package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlow.d.ts +2 -0
- package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlow.js +26 -0
- package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlow.js.map +1 -0
- package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.d.ts +16 -0
- package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js +31 -0
- package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js.map +1 -0
- package/dist/components/Contractor/Payments/PaymentFlow/index.d.ts +3 -0
- package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.d.ts +7 -0
- package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js +122 -0
- package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js.map +1 -0
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.d.ts +8 -0
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.js +26 -0
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.js.map +1 -0
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.d.ts +17 -15
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js +114 -0
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js.map +1 -0
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.d.ts +9 -0
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js +49 -0
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js.map +1 -0
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.d.ts +12 -0
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +116 -0
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -0
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.module.scss.js +10 -0
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.module.scss.js.map +1 -0
- package/dist/components/Contractor/Payments/types.d.ts +8 -0
- package/dist/components/Contractor/Profile/useContractorProfile.d.ts +26 -26
- package/dist/components/Contractor/Submit/Submit.js.map +1 -1
- package/dist/components/Contractor/index.d.ts +1 -0
- package/dist/components/Contractor/index.js +4 -2
- package/dist/components/Contractor/index.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +2 -3
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.d.ts +0 -3
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +62 -77
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js +83 -50
- package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.d.ts +56 -0
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +159 -0
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +1 -0
- package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.js +3 -2
- package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +3 -4
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +3 -4
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Employee/EmployeeList/useEmployeeList.js +3 -4
- package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/FederalForm.d.ts +22 -7
- package/dist/components/Employee/FederalTaxes/FederalForm.js +86 -32
- package/dist/components/Employee/FederalTaxes/FederalForm.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/FederalTaxes.js +62 -46
- package/dist/components/Employee/FederalTaxes/FederalTaxes.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +3 -4
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountsList.js +25 -23
- package/dist/components/Employee/PaymentMethod/BankAccountsList.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/PaymentMethod.js +116 -106
- package/dist/components/Employee/PaymentMethod/PaymentMethod.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/Split.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +5 -6
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/AdminPersonalDetails.d.ts +6 -6
- package/dist/components/Employee/Profile/HomeAddress.js +9 -8
- package/dist/components/Employee/Profile/HomeAddress.js.map +1 -1
- package/dist/components/Employee/Profile/PersonalDetailsInputs.d.ts +2 -2
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js +9 -8
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
- package/dist/components/Employee/Profile/useProfile.js +3 -4
- package/dist/components/Employee/Profile/useProfile.js.map +1 -1
- package/dist/components/Employee/StateTaxes/useStateTaxes.js +3 -4
- package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
- package/dist/components/Employee/Taxes/FederalForm.d.ts +22 -7
- package/dist/components/Employee/Taxes/FederalForm.js +86 -32
- package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
- package/dist/components/Employee/Taxes/Taxes.js +97 -81
- package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
- package/dist/components/Employee/Taxes/useTaxes.js +3 -4
- package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
- package/dist/components/Flow/Flow.d.ts +3 -3
- package/dist/components/Flow/Flow.js +35 -31
- package/dist/components/Flow/Flow.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.js +46 -39
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.module.scss.js +8 -0
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.module.scss.js.map +1 -0
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsComponents.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +71 -72
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/WireInstructions/WireInstructions.js +21 -22
- package/dist/components/Payroll/ConfirmWireDetails/WireInstructions/WireInstructions.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/confirmWireDetailsStateMachine.d.ts +2 -2
- package/dist/components/Payroll/ConfirmWireDetails/confirmWireDetailsStateMachine.js +19 -19
- package/dist/components/Payroll/ConfirmWireDetails/confirmWireDetailsStateMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +17 -16
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +36 -35
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.d.ts +1 -0
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js +75 -68
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +66 -65
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +127 -103
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +254 -185
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/{FastAchThresholdExceeded.d.ts → FastAchSubmissionBlockerBanner.d.ts} +2 -2
- package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js +55 -0
- package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js.map +1 -0
- package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/index.d.ts +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.module.scss.js +1 -1
- package/dist/components/Payroll/PayrollStatusBadges/payrollStatusConfig.js +1 -1
- package/dist/components/Payroll/PayrollStatusBadges/payrollStatusConfig.js.map +1 -1
- package/dist/components/Payroll/index.d.ts +1 -1
- package/dist/components/Payroll/index.js +8 -6
- package/dist/components/Payroll/index.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +6 -7
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/contexts/ComponentAdapter/componentAdapterTypes.d.ts +4 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +9 -11
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/contexts/LocaleProvider/useLocale.d.ts +6 -3
- package/dist/contexts/LocaleProvider/useLocale.js +12 -9
- package/dist/contexts/LocaleProvider/useLocale.js.map +1 -1
- package/dist/helpers/currencyHelpers.d.ts +2 -0
- package/dist/helpers/currencyHelpers.js +6 -0
- package/dist/helpers/currencyHelpers.js.map +1 -0
- package/dist/helpers/formattedStrings.js +11 -12
- package/dist/helpers/formattedStrings.js.map +1 -1
- package/dist/i18n/I18n.js +10 -10
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Contractor.Payments.CreatePayment.json.js +40 -0
- package/dist/i18n/en/Contractor.Payments.CreatePayment.json.js.map +1 -0
- package/dist/i18n/en/Contractor.Payments.PaymentHistory.json.js +24 -0
- package/dist/i18n/en/Contractor.Payments.PaymentHistory.json.js.map +1 -0
- package/dist/i18n/en/Contractor.Payments.PaymentsList.json.js +36 -0
- package/dist/i18n/en/Contractor.Payments.PaymentsList.json.js.map +1 -0
- package/dist/i18n/en/Employee.Deductions.json.js +58 -46
- package/dist/i18n/en/Employee.Deductions.json.js.map +1 -1
- package/dist/i18n/en/Employee.FederalTaxes.json.js +49 -41
- package/dist/i18n/en/Employee.FederalTaxes.json.js.map +1 -1
- package/dist/i18n/en/Employee.Taxes.json.js +53 -45
- package/dist/i18n/en/Employee.Taxes.json.js.map +1 -1
- package/dist/i18n/en/Payroll.ConfirmWireDetailsForm.json.js +5 -5
- package/dist/i18n/en/Payroll.PayrollConfiguration.json.js +1 -1
- package/dist/i18n/en/Payroll.PayrollList.json.js +5 -5
- package/dist/i18n/en/Payroll.PayrollOverview.json.js +35 -31
- package/dist/i18n/en/Payroll.PayrollOverview.json.js.map +1 -1
- package/dist/shared/constants.d.ts +18 -0
- package/dist/shared/constants.js +73 -59
- package/dist/shared/constants.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/i18next.d.ts +182 -125
- package/package.json +18 -18
- package/dist/components/Contractor/Payments/Detail/DetailPresentation.d.ts +0 -19
- package/dist/components/Contractor/Payments/Overview/OverviewPresentation.d.ts +0 -18
- package/dist/components/Contractor/Payments/PaymentEdit/PaymentEditPresentation.d.ts +0 -6
- package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchThresholdExceeded.js +0 -52
- package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchThresholdExceeded.js.map +0 -1
- package/dist/i18n/en/ContractorPayment.ContractorPaymentCreatePayment.json.js +0 -32
- package/dist/i18n/en/ContractorPayment.ContractorPaymentCreatePayment.json.js.map +0 -1
- package/dist/i18n/en/ContractorPayment.ContractorPaymentDetail.json.js +0 -24
- package/dist/i18n/en/ContractorPayment.ContractorPaymentDetail.json.js.map +0 -1
- package/dist/i18n/en/ContractorPayment.ContractorPaymentOverview.json.js +0 -32
- package/dist/i18n/en/ContractorPayment.ContractorPaymentOverview.json.js.map +0 -1
- package/dist/i18n/en/ContractorPayment.ContractorPaymentPaymentHistory.json.js +0 -32
- package/dist/i18n/en/ContractorPayment.ContractorPaymentPaymentHistory.json.js.map +0 -1
|
@@ -1,49 +1,71 @@
|
|
|
1
|
-
import { jsx as n, jsxs as a } from "react/jsx-runtime";
|
|
2
|
-
import { useTranslation as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useGarnishmentsListSuspense as
|
|
5
|
-
import { useGarnishmentsGetChildSupportDataSuspense as
|
|
1
|
+
import { jsx as n, jsxs as a, Fragment as H } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation as M } from "react-i18next";
|
|
3
|
+
import { useState as u } from "react";
|
|
4
|
+
import { useGarnishmentsListSuspense as Y } from "@gusto/embedded-api/react-query/garnishmentsList";
|
|
5
|
+
import { useGarnishmentsGetChildSupportDataSuspense as B } from "@gusto/embedded-api/react-query/garnishmentsGetChildSupportData";
|
|
6
6
|
import c from "./DeductionsForm.module.scss.js";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
16
|
-
|
|
17
|
-
|
|
7
|
+
import U from "./ChildSupportForm.js";
|
|
8
|
+
import j from "./GarnishmentForm.js";
|
|
9
|
+
import k from "./CustomDeductionForm.js";
|
|
10
|
+
import { BaseComponent as I } from "../../../Base/Base.js";
|
|
11
|
+
import { useBase as V } from "../../../Base/useBase.js";
|
|
12
|
+
import { Grid as q } from "../../../Common/Grid/Grid.js";
|
|
13
|
+
import { useComponentDictionary as w, useI18n as z } from "../../../../i18n/I18n.js";
|
|
14
|
+
import { componentEvents as C } from "../../../../shared/constants.js";
|
|
15
|
+
import { useComponentContext as J } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
16
|
+
import K from "../../../../assets/icons/caret-left.svg.js";
|
|
17
|
+
function ue(s) {
|
|
18
|
+
return /* @__PURE__ */ n(I, { ...s, children: /* @__PURE__ */ n(Q, { ...s, children: s.children }) });
|
|
18
19
|
}
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
const S = [
|
|
21
|
+
"child_support",
|
|
22
|
+
"federal_tax_lien",
|
|
23
|
+
"state_tax_lien",
|
|
24
|
+
"student_loan",
|
|
25
|
+
"creditor_garnishment",
|
|
26
|
+
"federal_loan",
|
|
27
|
+
"other_garnishment"
|
|
28
|
+
];
|
|
29
|
+
function Q({ className: s, employeeId: r, deductionId: p, dictionary: y }) {
|
|
30
|
+
const { onEvent: h } = V(), { t } = M("Employee.Deductions"), i = J();
|
|
31
|
+
w("Employee.Deductions", y), z("Employee.Deductions");
|
|
32
|
+
const { data: g } = Y({ employeeId: r }), { data: d } = B({}), o = p ? g.garnishmentList?.find((e) => e.uuid === p) ?? null : null, E = t(o ? "editDeductionTitle" : "addDeductionTitle"), l = o?.garnishmentType, L = d.childSupportData?.agencies?.map((e) => ({
|
|
24
33
|
label: e.name,
|
|
25
34
|
value: e.state
|
|
26
|
-
})) || [], [
|
|
27
|
-
|
|
28
|
-
),
|
|
29
|
-
|
|
30
|
-
|
|
35
|
+
})) || [], [f, b] = u(
|
|
36
|
+
l && S.includes(l) || !o
|
|
37
|
+
), [m, x] = u(
|
|
38
|
+
l || "child_support"
|
|
39
|
+
), T = {
|
|
40
|
+
child_support: t("childSupportTitle"),
|
|
41
|
+
federal_tax_lien: t("federalTaxLien"),
|
|
42
|
+
state_tax_lien: t("stateTaxLien"),
|
|
43
|
+
student_loan: t("studentLoan"),
|
|
44
|
+
creditor_garnishment: t("creditorGarnishment"),
|
|
45
|
+
federal_loan: t("federalLoan"),
|
|
46
|
+
other_garnishment: t("otherGarnishment")
|
|
47
|
+
}, D = T[m], G = S.map((e) => ({
|
|
48
|
+
value: e,
|
|
49
|
+
label: T[e]
|
|
50
|
+
})), v = o ? l ? "garnishment" : "custom" : "garnishment", [_, N] = u(o?.childSupport?.state || ""), P = (e) => {
|
|
51
|
+
N(e);
|
|
52
|
+
}, A = d.childSupportData?.agencies?.find((e) => e.state === _)?.fipsCodes?.map((e) => ({
|
|
31
53
|
label: e.county?.length ? e.county : t("allCounties"),
|
|
32
54
|
value: e.code
|
|
33
|
-
})) || [],
|
|
34
|
-
(e) => e.state ===
|
|
35
|
-
),
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
|
|
55
|
+
})) || [], O = d.childSupportData?.agencies?.find(
|
|
56
|
+
(e) => e.state === _
|
|
57
|
+
), R = () => {
|
|
58
|
+
g.garnishmentList?.some((e) => e.active) ? h(C.EMPLOYEE_DEDUCTION_CANCEL) : h(C.EMPLOYEE_DEDUCTION_CANCEL_EMPTY);
|
|
59
|
+
}, F = (e) => {
|
|
60
|
+
b(e === "garnishment");
|
|
39
61
|
};
|
|
40
62
|
return /* @__PURE__ */ a("section", { className: s, children: [
|
|
41
|
-
/* @__PURE__ */ a(i.Button, { variant: "secondary", onClick:
|
|
42
|
-
/* @__PURE__ */ n(
|
|
63
|
+
/* @__PURE__ */ a(i.Button, { variant: "secondary", onClick: R, children: [
|
|
64
|
+
/* @__PURE__ */ n(K, { className: c.leftCaretIcon }),
|
|
43
65
|
t("backToDeductionsCta")
|
|
44
66
|
] }),
|
|
45
|
-
/* @__PURE__ */ a(
|
|
46
|
-
/* @__PURE__ */ n(i.Heading, { as: "h2", children:
|
|
67
|
+
/* @__PURE__ */ a(q, { gap: 16, className: c.formHeadingContainer, children: [
|
|
68
|
+
/* @__PURE__ */ n(i.Heading, { as: "h2", children: E }),
|
|
47
69
|
/* @__PURE__ */ a("section", { children: [
|
|
48
70
|
/* @__PURE__ */ n(i.Heading, { as: "h3", children: t("externalPostTaxDeductions") }),
|
|
49
71
|
/* @__PURE__ */ n(i.Text, { variant: "supporting", children: t("externalPostTaxDeductionsDescription") })
|
|
@@ -57,42 +79,53 @@ function k({ className: s, employeeId: r, deductionId: u, dictionary: T }) {
|
|
|
57
79
|
{ value: "garnishment", label: t("garnishmentOption") },
|
|
58
80
|
{ value: "custom", label: t("customDeductionOption") }
|
|
59
81
|
],
|
|
60
|
-
defaultValue:
|
|
61
|
-
onChange:
|
|
82
|
+
defaultValue: v,
|
|
83
|
+
onChange: F,
|
|
62
84
|
isRequired: !0,
|
|
63
85
|
isDisabled: !!o,
|
|
64
86
|
className: c.deductionTypeRadioGroup
|
|
65
87
|
}
|
|
66
88
|
),
|
|
67
|
-
|
|
89
|
+
f && /* @__PURE__ */ a("section", { children: [
|
|
68
90
|
/* @__PURE__ */ n(i.Text, { weight: "bold", className: c.garnishmentTypeLabel, children: t("garnishmentType") }),
|
|
69
91
|
/* @__PURE__ */ n(
|
|
70
92
|
i.Select,
|
|
71
93
|
{
|
|
72
94
|
label: t("garnishmentType"),
|
|
73
|
-
options:
|
|
74
|
-
placeholder:
|
|
95
|
+
options: G,
|
|
96
|
+
placeholder: D,
|
|
75
97
|
shouldVisuallyHideLabel: !0,
|
|
76
|
-
|
|
98
|
+
onChange: (e) => {
|
|
99
|
+
x(e);
|
|
100
|
+
},
|
|
101
|
+
isDisabled: !!o
|
|
77
102
|
}
|
|
78
103
|
)
|
|
79
104
|
] }),
|
|
80
105
|
/* @__PURE__ */ n("hr", {})
|
|
81
106
|
] }),
|
|
82
|
-
|
|
83
|
-
|
|
107
|
+
f ? /* @__PURE__ */ n(H, { children: m === "child_support" ? /* @__PURE__ */ n(
|
|
108
|
+
U,
|
|
84
109
|
{
|
|
85
110
|
deduction: o,
|
|
86
111
|
employeeId: r,
|
|
87
|
-
handleStateAgencySelect:
|
|
88
|
-
stateAgencies:
|
|
89
|
-
counties:
|
|
90
|
-
selectedAgency:
|
|
112
|
+
handleStateAgencySelect: P,
|
|
113
|
+
stateAgencies: L,
|
|
114
|
+
counties: A,
|
|
115
|
+
selectedAgency: O
|
|
91
116
|
}
|
|
92
|
-
) : /* @__PURE__ */ n(
|
|
117
|
+
) : /* @__PURE__ */ n(
|
|
118
|
+
j,
|
|
119
|
+
{
|
|
120
|
+
deduction: o,
|
|
121
|
+
employeeId: r,
|
|
122
|
+
selectedGarnishmentType: m,
|
|
123
|
+
selectedGarnishmentTitle: D
|
|
124
|
+
}
|
|
125
|
+
) }) : /* @__PURE__ */ n(k, { deduction: o, employeeId: r })
|
|
93
126
|
] });
|
|
94
127
|
}
|
|
95
128
|
export {
|
|
96
|
-
|
|
129
|
+
ue as DeductionsForm
|
|
97
130
|
};
|
|
98
131
|
//# 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 { useState } from 'react'\nimport { useGarnishmentsListSuspense } from '@gusto/embedded-api/react-query/garnishmentsList'\nimport { useGarnishmentsGetChildSupportDataSuspense } from '@gusto/embedded-api/react-query/garnishmentsGetChildSupportData'\nimport styles from './DeductionsForm.module.scss'\nimport ChildSupportForm from './ChildSupportForm'\nimport CustomDeductionForm from './CustomDeductionForm'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { Grid } from '@/components/Common/Grid/Grid'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport CaretLeft from '@/assets/icons/caret-left.svg?react'\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\n// deductions can be either custom or a garnishment\n// we currently only support child support garnishment type\nconst SUPPORTED_GARNISHMENT_TYPES = ['child_support']\n\nfunction Root({ className, employeeId, deductionId, dictionary }: DeductionsFormProps) {\n const { onEvent } = 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\n // Fetch child support garnishment metadata\n const { data: childSupportData } = useGarnishmentsGetChildSupportDataSuspense({})\n\n // find existing deduction to determine if in ADD or EDIT mode\n // if deduction exists we are editing, else we are adding\n // edit deductions cannot change the record type, it can only update the existing entries of the record\n const deduction = deductionId\n ? (data.garnishmentList?.find(g => g.uuid === deductionId) ?? null)\n : null\n const title = !deduction ? t('addDeductionTitle') : t('editDeductionTitle')\n const deductionType = deduction?.garnishmentType\n const stateAgencies =\n childSupportData.childSupportData?.agencies?.map(a => ({\n label: a.name as string,\n value: a.state as string,\n })) || []\n\n // if deduction exists check if it has a type, else if does not exist default to garnishment\n const [isGarnishment, setIsGarnishment] = useState<boolean>(\n (deductionType && SUPPORTED_GARNISHMENT_TYPES.includes(deductionType)) || !deduction,\n )\n const defaultDeductionTypeSelection = deduction\n ? deductionType\n ? 'garnishment'\n : 'custom'\n : 'garnishment'\n\n // filter out specific fipsCodes/counties as mapped to selected state agency\n // some states only have 1 fips code/county to cover the entire state,\n // but the API will return a null label so we need to provide a default label\n const [stateAgency, setStateAgency] = useState<string>(deduction?.childSupport?.state || '')\n const handleStateAgencySelect = (stateAgency: string) => {\n setStateAgency(stateAgency)\n }\n const counties =\n childSupportData.childSupportData?.agencies\n ?.find(agency => agency.state === stateAgency)\n ?.fipsCodes?.map(fipsCode => ({\n label: fipsCode.county?.length ? fipsCode.county : t('allCounties'),\n value: fipsCode.code as string,\n })) || []\n\n // get a reference to the currently selected agency to determine which required fields to display/include in submission\n const selectedAgency = childSupportData.childSupportData?.agencies?.find(\n agency => agency.state === stateAgency,\n )\n\n const handleCancel = () => {\n // if any active garnishments return to list view, else return to empty state view\n if (data.garnishmentList?.some(g => g.active)) {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CANCEL)\n } else {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CANCEL_EMPTY)\n }\n }\n\n const handleSelectDeductionType = (selection: string) => {\n setIsGarnishment(selection === 'garnishment')\n }\n\n return (\n <section className={className}>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n <CaretLeft className={styles.leftCaretIcon} />\n {t('backToDeductionsCta')}\n </Components.Button>\n <Grid gap={16} className={styles.formHeadingContainer}>\n <Components.Heading as=\"h2\">{title}</Components.Heading>\n <section>\n <Components.Heading as=\"h3\">{t('externalPostTaxDeductions')}</Components.Heading>\n <Components.Text variant=\"supporting\">\n {t('externalPostTaxDeductionsDescription')}\n </Components.Text>\n </section>\n <Components.RadioGroup\n label={t('deductionTypeLabel')}\n description={t('deductionTypeRadioLabel')}\n options={[\n { value: 'garnishment', label: t('garnishmentOption') },\n { value: 'custom', label: t('customDeductionOption') },\n ]}\n defaultValue={defaultDeductionTypeSelection}\n onChange={handleSelectDeductionType}\n isRequired\n isDisabled={!!deduction}\n className={styles.deductionTypeRadioGroup}\n />\n {isGarnishment && (\n <section>\n <Components.Text weight=\"bold\" className={styles.garnishmentTypeLabel}>\n {t('garnishmentType')}\n </Components.Text>\n {/* we currently only support child support garnishment type */}\n <Components.Select\n label={t('garnishmentType')}\n options={[]}\n placeholder={t('childSupport')}\n shouldVisuallyHideLabel\n isDisabled\n />\n </section>\n )}\n <hr />\n </Grid>\n\n {isGarnishment ? (\n <ChildSupportForm\n deduction={deduction}\n employeeId={employeeId}\n handleStateAgencySelect={handleStateAgencySelect}\n stateAgencies={stateAgencies}\n counties={counties}\n selectedAgency={selectedAgency}\n />\n ) : (\n <CustomDeductionForm deduction={deduction} employeeId={employeeId} />\n )}\n </section>\n )\n}\n"],"names":["DeductionsForm","props","jsx","BaseComponent","Root","SUPPORTED_GARNISHMENT_TYPES","className","employeeId","deductionId","dictionary","onEvent","useBase","useTranslation","Components","useComponentContext","useComponentDictionary","useI18n","data","useGarnishmentsListSuspense","childSupportData","useGarnishmentsGetChildSupportDataSuspense","deduction","g","title","deductionType","stateAgencies","a","isGarnishment","setIsGarnishment","useState","defaultDeductionTypeSelection","stateAgency","setStateAgency","handleStateAgencySelect","counties","agency","fipsCode","selectedAgency","handleCancel","componentEvents","handleSelectDeductionType","selection","jsxs","CaretLeft","styles","Grid","ChildSupportForm","CustomDeductionForm"],"mappings":";;;;;;;;;;;;;;;AAwBO,SAASA,GAAeC,GAAqD;AAClF,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAIA,MAAMI,IAA8B,CAAC,eAAe;AAEpD,SAASD,EAAK,EAAE,WAAAE,GAAW,YAAAC,GAAY,aAAAC,GAAa,YAAAC,KAAmC;AACrF,QAAM,EAAE,SAAAC,EAAA,IAAYC,EAAA,GACd,EAAE,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA;AAEnB,EAAAC,EAAuB,uBAAuBN,CAAU,GACxDO,EAAQ,qBAAqB;AAG7B,QAAM,EAAE,MAAAC,EAAA,IAASC,EAA4B,EAAE,YAAAX,GAAY,GAGrD,EAAE,MAAMY,MAAqBC,EAA2C,CAAA,CAAE,GAK1EC,IAAYb,IACbS,EAAK,iBAAiB,KAAK,OAAKK,EAAE,SAAS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AA,GACN;AAAA,IAECc,IACC,gBAAAzB;AAAA,MAAC4C;AAAA,MAAA;AAAA,QACC,WAAAzB;AAAA,QACA,YAAAd;AAAA,QACA,yBAAA0B;AAAA,QACA,eAAAR;AAAA,QACA,UAAAS;AAAA,QACA,gBAAAG;AAAA,MAAA;AAAA,IAAA,IAGF,gBAAAnC,EAAC6C,GAAA,EAAoB,WAAA1B,GAAsB,YAAAd,EAAA,CAAwB;AAAA,EAAA,GAEvE;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"DeductionsForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/DeductionsForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useState } from 'react'\nimport { useGarnishmentsListSuspense } from '@gusto/embedded-api/react-query/garnishmentsList'\nimport { useGarnishmentsGetChildSupportDataSuspense } from '@gusto/embedded-api/react-query/garnishmentsGetChildSupportData'\nimport type { GarnishmentType } from '@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments'\nimport styles from './DeductionsForm.module.scss'\nimport ChildSupportForm from './ChildSupportForm'\nimport GarnishmentForm from './GarnishmentForm'\nimport CustomDeductionForm from './CustomDeductionForm'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { Grid } from '@/components/Common/Grid/Grid'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport CaretLeft from '@/assets/icons/caret-left.svg?react'\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\n// deductions can be either garnishment (court-ordered) or a custom deduction\nconst SUPPORTED_GARNISHMENT_TYPES: GarnishmentType[] = [\n 'child_support',\n 'federal_tax_lien',\n 'state_tax_lien',\n 'student_loan',\n 'creditor_garnishment',\n 'federal_loan',\n 'other_garnishment',\n]\n\nfunction Root({ className, employeeId, deductionId, dictionary }: DeductionsFormProps) {\n const { onEvent } = 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\n // Fetch child support garnishment metadata\n const { data: childSupportData } = useGarnishmentsGetChildSupportDataSuspense({})\n\n // find existing deduction to determine if in ADD or EDIT mode\n // if deduction exists we are editing, else we are adding\n const deduction = deductionId\n ? (data.garnishmentList?.find(g => g.uuid === deductionId) ?? null)\n : null\n const title = !deduction ? t('addDeductionTitle') : t('editDeductionTitle')\n const deductionType = deduction?.garnishmentType\n const stateAgencies =\n childSupportData.childSupportData?.agencies?.map(a => ({\n label: a.name as string,\n value: a.state as string,\n })) || []\n\n // if deduction exists check if it has a type, else if does not exist default to garnishment\n const [isGarnishment, setIsGarnishment] = useState<boolean>(\n (deductionType && SUPPORTED_GARNISHMENT_TYPES.includes(deductionType)) || !deduction,\n )\n const [selectedGarnishment, setSelectedGarnishment] = useState<GarnishmentType>(\n deductionType || 'child_support',\n )\n const garnishmentLabels: Record<string, string> = {\n child_support: t('childSupportTitle'),\n federal_tax_lien: t('federalTaxLien'),\n state_tax_lien: t('stateTaxLien'),\n student_loan: t('studentLoan'),\n creditor_garnishment: t('creditorGarnishment'),\n federal_loan: t('federalLoan'),\n other_garnishment: t('otherGarnishment'),\n }\n const garnishmentPlaceholder = garnishmentLabels[selectedGarnishment]\n const garnishmentOptions = SUPPORTED_GARNISHMENT_TYPES.map(garnishment => ({\n value: garnishment,\n label: garnishmentLabels[garnishment] as string,\n }))\n\n const defaultDeductionTypeSelection = deduction\n ? deductionType\n ? 'garnishment'\n : 'custom'\n : 'garnishment'\n\n // filter out specific fipsCodes/counties as mapped to selected state agency\n // some states only have 1 fips code/county to cover the entire state,\n // but the API will return a null label so we need to provide a default label\n const [stateAgency, setStateAgency] = useState<string>(deduction?.childSupport?.state || '')\n const handleStateAgencySelect = (stateAgency: string) => {\n setStateAgency(stateAgency)\n }\n const counties =\n childSupportData.childSupportData?.agencies\n ?.find(agency => agency.state === stateAgency)\n ?.fipsCodes?.map(fipsCode => ({\n label: fipsCode.county?.length ? fipsCode.county : t('allCounties'),\n value: fipsCode.code as string,\n })) || []\n\n // get a reference to the currently selected agency to determine which required fields to display/include in submission\n const selectedAgency = childSupportData.childSupportData?.agencies?.find(\n agency => agency.state === stateAgency,\n )\n\n const handleCancel = () => {\n // if any active garnishments return to list view, else return to empty state view\n if (data.garnishmentList?.some(g => g.active)) {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CANCEL)\n } else {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CANCEL_EMPTY)\n }\n }\n\n const handleSelectDeductionType = (selection: string) => {\n setIsGarnishment(selection === 'garnishment')\n }\n\n return (\n <section className={className}>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n <CaretLeft className={styles.leftCaretIcon} />\n {t('backToDeductionsCta')}\n </Components.Button>\n <Grid gap={16} className={styles.formHeadingContainer}>\n <Components.Heading as=\"h2\">{title}</Components.Heading>\n <section>\n <Components.Heading as=\"h3\">{t('externalPostTaxDeductions')}</Components.Heading>\n <Components.Text variant=\"supporting\">\n {t('externalPostTaxDeductionsDescription')}\n </Components.Text>\n </section>\n <Components.RadioGroup\n label={t('deductionTypeLabel')}\n description={t('deductionTypeRadioLabel')}\n options={[\n { value: 'garnishment', label: t('garnishmentOption') },\n { value: 'custom', label: t('customDeductionOption') },\n ]}\n defaultValue={defaultDeductionTypeSelection}\n onChange={handleSelectDeductionType}\n isRequired\n isDisabled={!!deduction}\n className={styles.deductionTypeRadioGroup}\n />\n {isGarnishment && (\n <section>\n <Components.Text weight=\"bold\" className={styles.garnishmentTypeLabel}>\n {t('garnishmentType')}\n </Components.Text>\n <Components.Select\n label={t('garnishmentType')}\n options={garnishmentOptions}\n placeholder={garnishmentPlaceholder}\n shouldVisuallyHideLabel\n onChange={value => {\n setSelectedGarnishment(value as GarnishmentType)\n }}\n isDisabled={!!deduction} // API does not allow to change/edit an existing deduction type\n />\n </section>\n )}\n <hr />\n </Grid>\n\n {isGarnishment ? (\n <>\n {selectedGarnishment === 'child_support' ? (\n <ChildSupportForm\n deduction={deduction}\n employeeId={employeeId}\n handleStateAgencySelect={handleStateAgencySelect}\n stateAgencies={stateAgencies}\n counties={counties}\n selectedAgency={selectedAgency}\n />\n ) : (\n <GarnishmentForm\n deduction={deduction}\n employeeId={employeeId}\n selectedGarnishmentType={selectedGarnishment}\n selectedGarnishmentTitle={garnishmentPlaceholder!}\n />\n )}\n </>\n ) : (\n <CustomDeductionForm deduction={deduction} employeeId={employeeId} />\n )}\n </section>\n )\n}\n"],"names":["DeductionsForm","props","jsx","BaseComponent","Root","SUPPORTED_GARNISHMENT_TYPES","className","employeeId","deductionId","dictionary","onEvent","useBase","useTranslation","Components","useComponentContext","useComponentDictionary","useI18n","data","useGarnishmentsListSuspense","childSupportData","useGarnishmentsGetChildSupportDataSuspense","deduction","g","title","deductionType","stateAgencies","a","isGarnishment","setIsGarnishment","useState","selectedGarnishment","setSelectedGarnishment","garnishmentLabels","garnishmentPlaceholder","garnishmentOptions","garnishment","defaultDeductionTypeSelection","stateAgency","setStateAgency","handleStateAgencySelect","counties","agency","fipsCode","selectedAgency","handleCancel","componentEvents","handleSelectDeductionType","selection","jsxs","CaretLeft","styles","Grid","value","Fragment","ChildSupportForm","GarnishmentForm","CustomDeductionForm"],"mappings":";;;;;;;;;;;;;;;;AA2BO,SAASA,GAAeC,GAAqD;AAClF,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS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A,YAAAd;AAAA,QACA,yBAAAgC;AAAA,QACA,eAAAd;AAAA,QACA,UAAAe;AAAA,QACA,gBAAAG;AAAA,MAAA;AAAA,IAAA,IAGF,gBAAAzC;AAAA,MAACqD;AAAA,MAAA;AAAA,QACC,WAAAlC;AAAA,QACA,YAAAd;AAAA,QACA,yBAAyBuB;AAAA,QACzB,0BAA0BG;AAAA,MAAA;AAAA,IAAA,EAC5B,CAEJ,IAEA,gBAAA/B,EAACsD,GAAA,EAAoB,WAAAnC,GAAsB,YAAAd,EAAA,CAAwB;AAAA,EAAA,GAEvE;AAEJ;"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Garnishment } from '@gusto/embedded-api/models/components/garnishment';
|
|
3
|
+
import { GarnishmentType } from '@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments';
|
|
4
|
+
import { CommonComponentInterface } from '../../../Base';
|
|
5
|
+
export declare const DeductionSchema: z.ZodObject<{
|
|
6
|
+
active: z.ZodBoolean;
|
|
7
|
+
amount: z.ZodEffects<z.ZodNumber, string, number>;
|
|
8
|
+
description: z.ZodString;
|
|
9
|
+
courtOrdered: z.ZodBoolean;
|
|
10
|
+
times: z.ZodNullable<z.ZodNumber>;
|
|
11
|
+
recurring: z.ZodBoolean;
|
|
12
|
+
annualMaximum: z.ZodNullable<z.ZodEffects<z.ZodNumber, string | null, number>>;
|
|
13
|
+
totalAmount: z.ZodNullable<z.ZodEffects<z.ZodNumber, string | null, number>>;
|
|
14
|
+
deductAsPercentage: z.ZodBoolean;
|
|
15
|
+
garnishmentType: z.ZodNativeEnum<{
|
|
16
|
+
readonly ChildSupport: "child_support";
|
|
17
|
+
readonly FederalTaxLien: "federal_tax_lien";
|
|
18
|
+
readonly StateTaxLien: "state_tax_lien";
|
|
19
|
+
readonly StudentLoan: "student_loan";
|
|
20
|
+
readonly CreditorGarnishment: "creditor_garnishment";
|
|
21
|
+
readonly FederalLoan: "federal_loan";
|
|
22
|
+
readonly OtherGarnishment: "other_garnishment";
|
|
23
|
+
}>;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
description: string;
|
|
26
|
+
active: boolean;
|
|
27
|
+
totalAmount: string | null;
|
|
28
|
+
amount: string;
|
|
29
|
+
garnishmentType: "child_support" | "federal_tax_lien" | "state_tax_lien" | "student_loan" | "creditor_garnishment" | "federal_loan" | "other_garnishment";
|
|
30
|
+
recurring: boolean;
|
|
31
|
+
courtOrdered: boolean;
|
|
32
|
+
times: number | null;
|
|
33
|
+
annualMaximum: string | null;
|
|
34
|
+
deductAsPercentage: boolean;
|
|
35
|
+
}, {
|
|
36
|
+
description: string;
|
|
37
|
+
active: boolean;
|
|
38
|
+
totalAmount: number | null;
|
|
39
|
+
amount: number;
|
|
40
|
+
garnishmentType: "child_support" | "federal_tax_lien" | "state_tax_lien" | "student_loan" | "creditor_garnishment" | "federal_loan" | "other_garnishment";
|
|
41
|
+
recurring: boolean;
|
|
42
|
+
courtOrdered: boolean;
|
|
43
|
+
times: number | null;
|
|
44
|
+
annualMaximum: number | null;
|
|
45
|
+
deductAsPercentage: boolean;
|
|
46
|
+
}>;
|
|
47
|
+
export type DeductionInputs = z.input<typeof DeductionSchema>;
|
|
48
|
+
export type DeductionPayload = z.output<typeof DeductionSchema>;
|
|
49
|
+
interface GarnishmentFormProps extends CommonComponentInterface<'Employee.Deductions'> {
|
|
50
|
+
employeeId: string;
|
|
51
|
+
deduction?: Garnishment | null;
|
|
52
|
+
selectedGarnishmentType: GarnishmentType;
|
|
53
|
+
selectedGarnishmentTitle: string;
|
|
54
|
+
}
|
|
55
|
+
declare function GarnishmentForm({ deduction, employeeId, selectedGarnishmentType, selectedGarnishmentTitle, }: GarnishmentFormProps): import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
export default GarnishmentForm;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { jsx as t, jsxs as l, Fragment as b } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation as F } from "react-i18next";
|
|
3
|
+
import { useForm as R, useWatch as g, FormProvider as S } from "react-hook-form";
|
|
4
|
+
import { useMemo as N } from "react";
|
|
5
|
+
import { z as r } from "zod";
|
|
6
|
+
import { zodResolver as I } from "@hookform/resolvers/zod";
|
|
7
|
+
import { GarnishmentType as U } from "@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments";
|
|
8
|
+
import { useGarnishmentsCreateMutation as V } from "@gusto/embedded-api/react-query/garnishmentsCreate";
|
|
9
|
+
import { useGarnishmentsUpdateMutation as _ } from "@gusto/embedded-api/react-query/garnishmentsUpdate";
|
|
10
|
+
import { useComponentContext as w } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
11
|
+
import { Form as B } from "../../../Common/Form/Form.js";
|
|
12
|
+
import { Flex as G } from "../../../Common/Flex/Flex.js";
|
|
13
|
+
import "classnames";
|
|
14
|
+
import { componentEvents as c } from "../../../../shared/constants.js";
|
|
15
|
+
import { RadioGroupField as f } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
16
|
+
import { TextInputField as j } from "../../../Common/Fields/TextInputField/TextInputField.js";
|
|
17
|
+
import { ActionsLayout as Y } from "../../../Common/ActionsLayout/ActionsLayout.js";
|
|
18
|
+
import { NumberInputField as p } 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 "@tanstack/react-query";
|
|
23
|
+
import { useBase as $ } from "../../../Base/useBase.js";
|
|
24
|
+
import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
25
|
+
import "dompurify";
|
|
26
|
+
const z = r.object({
|
|
27
|
+
active: r.boolean(),
|
|
28
|
+
amount: r.number().min(0).transform(String),
|
|
29
|
+
description: r.string().min(1),
|
|
30
|
+
courtOrdered: r.boolean(),
|
|
31
|
+
times: r.number().nullable(),
|
|
32
|
+
recurring: r.boolean(),
|
|
33
|
+
annualMaximum: r.number().min(0).transform((e) => e > 0 ? e.toString() : null).nullable(),
|
|
34
|
+
totalAmount: r.number().min(0).transform((e) => e > 0 ? e.toString() : null).nullable(),
|
|
35
|
+
deductAsPercentage: r.boolean(),
|
|
36
|
+
garnishmentType: r.nativeEnum(U)
|
|
37
|
+
});
|
|
38
|
+
function he({
|
|
39
|
+
deduction: e,
|
|
40
|
+
employeeId: h,
|
|
41
|
+
selectedGarnishmentType: A,
|
|
42
|
+
selectedGarnishmentTitle: D
|
|
43
|
+
}) {
|
|
44
|
+
const { onEvent: a, baseSubmitHandler: E } = $(), { t: n } = F("Employee.Deductions"), m = w(), { mutateAsync: y, isPending: P } = V(), { mutateAsync: x, isPending: C } = _(), T = P || C, M = N(() => ({
|
|
45
|
+
amount: e?.amount ? Number(e.amount) : 0,
|
|
46
|
+
description: e?.description ?? "",
|
|
47
|
+
times: e?.times ?? null,
|
|
48
|
+
recurring: e?.recurring ?? !0,
|
|
49
|
+
annualMaximum: e?.annualMaximum ? Number(e.annualMaximum) : null,
|
|
50
|
+
totalAmount: e?.totalAmount ? Number(e.totalAmount) : null,
|
|
51
|
+
deductAsPercentage: e?.deductAsPercentage ?? !0,
|
|
52
|
+
active: !0,
|
|
53
|
+
courtOrdered: !0,
|
|
54
|
+
garnishmentType: e?.garnishmentType ?? A
|
|
55
|
+
}), [e]), u = R({
|
|
56
|
+
resolver: I(z),
|
|
57
|
+
defaultValues: M
|
|
58
|
+
}), { control: d } = u, v = g({ control: d, name: "recurring" }), o = g({ control: d, name: "deductAsPercentage" }), O = async (q) => {
|
|
59
|
+
await E(q, async (i) => {
|
|
60
|
+
if (e) {
|
|
61
|
+
const { garnishment: s } = await x({
|
|
62
|
+
request: {
|
|
63
|
+
garnishmentId: e.uuid,
|
|
64
|
+
requestBody: {
|
|
65
|
+
...i,
|
|
66
|
+
version: e.version,
|
|
67
|
+
times: i.recurring ? null : 1
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
a(c.EMPLOYEE_DEDUCTION_UPDATED, s);
|
|
72
|
+
} else {
|
|
73
|
+
const { garnishment: s } = await y({
|
|
74
|
+
request: {
|
|
75
|
+
employeeId: h,
|
|
76
|
+
requestBody: { ...i, times: i.recurring ? null : 1 }
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
a(c.EMPLOYEE_DEDUCTION_CREATED, s);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
}, L = () => {
|
|
83
|
+
a(c.EMPLOYEE_DEDUCTION_CANCEL);
|
|
84
|
+
};
|
|
85
|
+
return /* @__PURE__ */ t(S, { ...u, children: /* @__PURE__ */ t(B, { onSubmit: u.handleSubmit(O), children: /* @__PURE__ */ t(G, { flexDirection: "column", gap: 32, children: /* @__PURE__ */ l(b, { children: [
|
|
86
|
+
/* @__PURE__ */ t(m.Heading, { as: "h3", children: D }),
|
|
87
|
+
/* @__PURE__ */ t(j, { name: "description", label: n("descriptionLabelV2"), isRequired: !0 }),
|
|
88
|
+
/* @__PURE__ */ t(
|
|
89
|
+
f,
|
|
90
|
+
{
|
|
91
|
+
name: "recurring",
|
|
92
|
+
label: n("frequencyLabel"),
|
|
93
|
+
isRequired: !0,
|
|
94
|
+
options: [
|
|
95
|
+
{ value: !0, label: n("frequencyRecurringOptionV2") },
|
|
96
|
+
{ value: !1, label: n("frequencyOneTimeOptionV2") }
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
),
|
|
100
|
+
/* @__PURE__ */ t(
|
|
101
|
+
f,
|
|
102
|
+
{
|
|
103
|
+
name: "deductAsPercentage",
|
|
104
|
+
label: n("deductionTypeLabelV2"),
|
|
105
|
+
isRequired: !0,
|
|
106
|
+
options: [
|
|
107
|
+
{ value: !0, label: n("deductionTypePercentageOptionV2") },
|
|
108
|
+
{ value: !1, label: n("deductionTypeFixedAmountOption") }
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
/* @__PURE__ */ t(
|
|
113
|
+
p,
|
|
114
|
+
{
|
|
115
|
+
name: "amount",
|
|
116
|
+
adornmentStart: !o && "$",
|
|
117
|
+
adornmentEnd: o && "%",
|
|
118
|
+
label: n("deductionAmountLabel"),
|
|
119
|
+
isRequired: !0,
|
|
120
|
+
min: 0,
|
|
121
|
+
format: o ? "percent" : "currency",
|
|
122
|
+
description: n(o ? "deductionAmountDescriptionPercentage" : "deductionAmountDescriptionFixed")
|
|
123
|
+
}
|
|
124
|
+
),
|
|
125
|
+
v && /* @__PURE__ */ l(b, { children: [
|
|
126
|
+
/* @__PURE__ */ t(
|
|
127
|
+
p,
|
|
128
|
+
{
|
|
129
|
+
name: "totalAmount",
|
|
130
|
+
adornmentStart: "$",
|
|
131
|
+
format: "currency",
|
|
132
|
+
label: n("totalAmountLabel"),
|
|
133
|
+
description: n("totalAmountDescription"),
|
|
134
|
+
min: 0
|
|
135
|
+
}
|
|
136
|
+
),
|
|
137
|
+
/* @__PURE__ */ t(
|
|
138
|
+
p,
|
|
139
|
+
{
|
|
140
|
+
name: "annualMaximum",
|
|
141
|
+
adornmentStart: "$",
|
|
142
|
+
format: "currency",
|
|
143
|
+
label: n("annualMaxLabel"),
|
|
144
|
+
min: 0,
|
|
145
|
+
description: n("annualMaxDescription")
|
|
146
|
+
}
|
|
147
|
+
)
|
|
148
|
+
] }),
|
|
149
|
+
/* @__PURE__ */ l(Y, { children: [
|
|
150
|
+
/* @__PURE__ */ t(m.Button, { variant: "secondary", onClick: L, children: n("cancelCta") }),
|
|
151
|
+
/* @__PURE__ */ t(m.Button, { type: "submit", isLoading: T, children: n(e ? "continueCta" : "addDeductionCta") })
|
|
152
|
+
] })
|
|
153
|
+
] }) }) }) });
|
|
154
|
+
}
|
|
155
|
+
export {
|
|
156
|
+
z as DeductionSchema,
|
|
157
|
+
he as default
|
|
158
|
+
};
|
|
159
|
+
//# sourceMappingURL=GarnishmentForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GarnishmentForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/GarnishmentForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { useMemo } from 'react'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { GarnishmentType } from '@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments'\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 { NumberInputField, TextInputField, RadioGroupField } 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.boolean(),\n annualMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n totalAmount: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n deductAsPercentage: z.boolean(),\n garnishmentType: z.nativeEnum(GarnishmentType),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ninterface GarnishmentFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n selectedGarnishmentType: GarnishmentType\n selectedGarnishmentTitle: string\n}\n\nfunction GarnishmentForm({\n deduction,\n employeeId,\n selectedGarnishmentType,\n selectedGarnishmentTitle,\n}: GarnishmentFormProps) {\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 ?? true,\n annualMaximum: deduction?.annualMaximum ? Number(deduction.annualMaximum) : null,\n totalAmount: deduction?.totalAmount ? Number(deduction.totalAmount) : null,\n deductAsPercentage: deduction?.deductAsPercentage ?? true,\n active: true,\n courtOrdered: true,\n garnishmentType: deduction?.garnishmentType ?? selectedGarnishmentType,\n }\n }, [deduction])\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n const { control } = formMethods\n const watchedRecurring = useWatch({ control, name: 'recurring' })\n const watchedAmountPercentage = useWatch({ control, name: 'deductAsPercentage' })\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 <Components.Heading as=\"h3\">{selectedGarnishmentTitle}</Components.Heading>\n <TextInputField name=\"description\" label={t('descriptionLabelV2')} isRequired />\n <RadioGroupField\n name=\"recurring\"\n label={t('frequencyLabel')}\n isRequired\n options={[\n { value: true, label: t('frequencyRecurringOptionV2') },\n { value: false, label: t('frequencyOneTimeOptionV2') },\n ]}\n />\n <RadioGroupField\n name=\"deductAsPercentage\"\n label={t('deductionTypeLabelV2')}\n isRequired\n options={[\n { value: true, label: t('deductionTypePercentageOptionV2') },\n { value: false, label: t('deductionTypeFixedAmountOption') },\n ]}\n />\n <NumberInputField\n name=\"amount\"\n adornmentStart={!watchedAmountPercentage && '$'}\n adornmentEnd={watchedAmountPercentage && '%'}\n label={t('deductionAmountLabel')}\n isRequired\n min={0}\n format={watchedAmountPercentage ? 'percent' : 'currency'}\n description={\n watchedAmountPercentage\n ? t('deductionAmountDescriptionPercentage')\n : t('deductionAmountDescriptionFixed')\n }\n />\n {watchedRecurring && (\n <>\n <NumberInputField\n name=\"totalAmount\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('totalAmountLabel')}\n description={t('totalAmountDescription')}\n min={0}\n />\n <NumberInputField\n name=\"annualMaximum\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('annualMaxLabel')}\n min={0}\n description={t('annualMaxDescription')}\n />\n </>\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 GarnishmentForm\n"],"names":["DeductionSchema","z","val","GarnishmentType","GarnishmentForm","deduction","employeeId","selectedGarnishmentType","selectedGarnishmentTitle","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultValues","useMemo","formMethods","useForm","zodResolver","control","watchedRecurring","useWatch","watchedAmountPercentage","onSubmit","data","payload","updateDeductionResponse","componentEvents","createDeductionResponse","handleCancel","FormProvider","jsx","Form","Flex","jsxs","Fragment","TextInputField","RadioGroupField","NumberInputField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAiBO,MAAMA,IAAkBC,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,QAAA;AAAA,EACb,eAAeA,EACZ,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAC,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,aAAaD,EACV,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAC,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,oBAAoBD,EAAE,QAAA;AAAA,EACtB,iBAAiBA,EAAE,WAAWE,CAAe;AAC/C,CAAC;AAYD,SAASC,GAAgB;AAAA,EACvB,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,0BAAAC;AACF,GAAyB;AACvB,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,EAAA,GACjC,EAAE,GAAAC,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA,GAEb,EAAE,aAAaC,GAAi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AA4B;AAAA,MAACO;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,gBAAgB,CAAChB,KAA2B;AAAA,QAC5C,cAAcA,KAA2B;AAAA,QACzC,OAAOnB,EAAE,sBAAsB;AAAA,QAC/B,YAAU;AAAA,QACV,KAAK;AAAA,QACL,QAAQmB,IAA0B,YAAY;AAAA,QAC9C,aAEMnB,EADJmB,IACM,yCACA,iCADsC;AAAA,MACL;AAAA,IAAA;AAAA,IAG1CF,KACC,gBAAAc,EAAAC,GAAA,EACE,UAAA;AAAA,MAAA,gBAAAJ;AAAA,QAACO;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,gBAAe;AAAA,UACf,QAAO;AAAA,UACP,OAAOnC,EAAE,kBAAkB;AAAA,UAC3B,aAAaA,EAAE,wBAAwB;AAAA,UACvC,KAAK;AAAA,QAAA;AAAA,MAAA;AAAA,MAEP,gBAAA4B;AAAA,QAACO;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,gBAAe;AAAA,UACf,QAAO;AAAA,UACP,OAAOnC,EAAE,gBAAgB;AAAA,UACzB,KAAK;AAAA,UACL,aAAaA,EAAE,sBAAsB;AAAA,QAAA;AAAA,MAAA;AAAA,IACvC,GACF;AAAA,sBAEDoC,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAR,EAAC1B,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASwB,GAC7C,UAAA1B,EAAE,WAAW,EAAA,CAChB;AAAA,MACA,gBAAA4B,EAAC1B,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWQ,GACzC,UAAoCV,EAAnCP,IAAqC,gBAAvB,iBAAoC,EAAA,CACtD;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
|
|
@@ -5,6 +5,7 @@ import { BaseComponent as a } from "../../../Base/Base.js";
|
|
|
5
5
|
import { useBase as p } from "../../../Base/useBase.js";
|
|
6
6
|
import { Grid as h } from "../../../Common/Grid/Grid.js";
|
|
7
7
|
import { Flex as C } from "../../../Common/Flex/Flex.js";
|
|
8
|
+
import "classnames";
|
|
8
9
|
import { ActionsLayout as f } from "../../../Common/ActionsLayout/ActionsLayout.js";
|
|
9
10
|
import { useComponentContext as D } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
10
11
|
import "react";
|
|
@@ -12,7 +13,7 @@ import { useComponentDictionary as E, useI18n as g } from "../../../../i18n/I18n
|
|
|
12
13
|
import { componentEvents as s } from "../../../../shared/constants.js";
|
|
13
14
|
import y from "../../../../assets/icons/coins-hand.svg.js";
|
|
14
15
|
import x from "../../../../assets/icons/plus-circle.svg.js";
|
|
15
|
-
function
|
|
16
|
+
function k(o) {
|
|
16
17
|
return /* @__PURE__ */ t(a, { ...o, children: /* @__PURE__ */ t(I, { ...o, children: o.children }) });
|
|
17
18
|
}
|
|
18
19
|
function I({ className: o, dictionary: l }) {
|
|
@@ -48,6 +49,6 @@ function I({ className: o, dictionary: l }) {
|
|
|
48
49
|
] }) });
|
|
49
50
|
}
|
|
50
51
|
export {
|
|
51
|
-
|
|
52
|
+
k as IncludeDeductions
|
|
52
53
|
};
|
|
53
54
|
//# sourceMappingURL=IncludeDeductions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IncludeDeductions.js","sources":["../../../../../src/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport styles from './IncludeDeductions.module.scss'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { Grid } from '@/components/Common/Grid/Grid'\nimport { ActionsLayout, Flex } from '@/components/Common'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport CoinsHandsIcon from '@/assets/icons/coins-hand.svg?react'\nimport PlusCircleIcon from '@/assets/icons/plus-circle.svg?react'\n\ninterface IncludeDeductionsProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n}\n\nexport function IncludeDeductions(props: IncludeDeductionsProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ className, dictionary }: IncludeDeductionsProps) {\n const { onEvent } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n useComponentDictionary('Employee.Deductions', dictionary)\n useI18n('Employee.Deductions')\n\n const handleAdd = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_INCLUDE_YES)\n }\n\n const handleContinue = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_INCLUDE_NO)\n }\n\n return (\n <section className={className}>\n <Grid gridTemplateColumns=\"1fr\">\n <Components.Heading as=\"h2\">{t('pageTitle')}</Components.Heading>\n <Components.Text variant=\"supporting\">\n {t('includeDeductionsDescriptionV2')}\n </Components.Text>\n <Components.Text weight=\"bold\" size=\"lg\">\n {t('includeDeductionsSubtitle')}\n </Components.Text>\n <section className={styles.emptyStateContainer}>\n <Flex flexDirection=\"column\" gap={16} justifyContent=\"center\" alignItems=\"center\">\n <section className={styles.coinHandsIconContainer}>\n <CoinsHandsIcon width={36} height={36} />\n </section>\n <Components.Text weight=\"bold\">{t('includeDeductionsEmptyState')}</Components.Text>\n <Components.Button\n type=\"button\"\n variant=\"secondary\"\n onClick={handleAdd}\n className={styles.addDeductionButton}\n >\n <PlusCircleIcon width={24} height={24} className={styles.plusCircleIcon} />\n {t('addDeductionButtonCta')}\n </Components.Button>\n </Flex>\n </section>\n <ActionsLayout>\n <Components.Button type=\"button\" onClick={handleContinue}>\n {t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </Grid>\n </section>\n )\n}\n"],"names":["IncludeDeductions","props","jsx","BaseComponent","Root","className","dictionary","onEvent","useBase","t","useTranslation","Components","useComponentContext","useComponentDictionary","useI18n","handleAdd","componentEvents","handleContinue","jsxs","Grid","styles","Flex","CoinsHandsIcon","PlusCircleIcon","ActionsLayout"],"mappings":"
|
|
1
|
+
{"version":3,"file":"IncludeDeductions.js","sources":["../../../../../src/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport styles from './IncludeDeductions.module.scss'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { Grid } from '@/components/Common/Grid/Grid'\nimport { ActionsLayout, Flex } from '@/components/Common'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport CoinsHandsIcon from '@/assets/icons/coins-hand.svg?react'\nimport PlusCircleIcon from '@/assets/icons/plus-circle.svg?react'\n\ninterface IncludeDeductionsProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n}\n\nexport function IncludeDeductions(props: IncludeDeductionsProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ className, dictionary }: IncludeDeductionsProps) {\n const { onEvent } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n useComponentDictionary('Employee.Deductions', dictionary)\n useI18n('Employee.Deductions')\n\n const handleAdd = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_INCLUDE_YES)\n }\n\n const handleContinue = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_INCLUDE_NO)\n }\n\n return (\n <section className={className}>\n <Grid gridTemplateColumns=\"1fr\">\n <Components.Heading as=\"h2\">{t('pageTitle')}</Components.Heading>\n <Components.Text variant=\"supporting\">\n {t('includeDeductionsDescriptionV2')}\n </Components.Text>\n <Components.Text weight=\"bold\" size=\"lg\">\n {t('includeDeductionsSubtitle')}\n </Components.Text>\n <section className={styles.emptyStateContainer}>\n <Flex flexDirection=\"column\" gap={16} justifyContent=\"center\" alignItems=\"center\">\n <section className={styles.coinHandsIconContainer}>\n <CoinsHandsIcon width={36} height={36} />\n </section>\n <Components.Text weight=\"bold\">{t('includeDeductionsEmptyState')}</Components.Text>\n <Components.Button\n type=\"button\"\n variant=\"secondary\"\n onClick={handleAdd}\n className={styles.addDeductionButton}\n >\n <PlusCircleIcon width={24} height={24} className={styles.plusCircleIcon} />\n {t('addDeductionButtonCta')}\n </Components.Button>\n </Flex>\n </section>\n <ActionsLayout>\n <Components.Button type=\"button\" onClick={handleContinue}>\n {t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </Grid>\n </section>\n )\n}\n"],"names":["IncludeDeductions","props","jsx","BaseComponent","Root","className","dictionary","onEvent","useBase","t","useTranslation","Components","useComponentContext","useComponentDictionary","useI18n","handleAdd","componentEvents","handleContinue","jsxs","Grid","styles","Flex","CoinsHandsIcon","PlusCircleIcon","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;AAqBO,SAASA,EAAkBC,GAAwD;AACxF,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,SAASG,EAAK,EAAE,WAAAC,GAAW,YAAAC,KAAsC;AAC/D,QAAM,EAAE,SAAAC,EAAA,IAAYC,EAAA,GACd,EAAE,GAAAC,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA;AAEnB,EAAAC,EAAuB,uBAAuBP,CAAU,GACxDQ,EAAQ,qBAAqB;AAE7B,QAAMC,IAAY,MAAM;AACtB,IAAAR,EAAQS,EAAgB,8BAA8B;AAAA,EACxD,GAEMC,IAAiB,MAAM;AAC3B,IAAAV,EAAQS,EAAgB,6BAA6B;AAAA,EACvD;AAEA,2BACG,WAAA,EAAQ,WA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 @@ import "classnames";
|
|
|
11
11
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
12
12
|
import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
13
13
|
import "dompurify";
|
|
14
|
-
import "../../../../contexts/LocaleProvider/useLocale.js";
|
|
15
14
|
import { createCompoundContext as t } from "../../../Base/createCompoundContext.js";
|
|
16
|
-
const [
|
|
15
|
+
const [d, a] = t("DocumentListContext");
|
|
17
16
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
a as DocumentListProvider,
|
|
18
|
+
d as useDocumentList
|
|
20
19
|
};
|
|
21
20
|
//# sourceMappingURL=useDocumentList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDocumentList.js","sources":["../../../../../src/components/Employee/DocumentSigner/DocumentList/useDocumentList.ts"],"sourcesContent":["import type { Form } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype DocumentListContextType = {\n employeeForms: Form[]\n hasSignedAllForms: boolean\n handleContinue: () => void\n handleRequestFormToSign: (form: Form) => void\n documentListError: Error | null\n formToSign?: Form\n}\n\nconst [useDocumentList, DocumentListProvider] =\n createCompoundContext<DocumentListContextType>('DocumentListContext')\nexport { useDocumentList, DocumentListProvider }\n"],"names":["useDocumentList","DocumentListProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useDocumentList.js","sources":["../../../../../src/components/Employee/DocumentSigner/DocumentList/useDocumentList.ts"],"sourcesContent":["import type { Form } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype DocumentListContextType = {\n employeeForms: Form[]\n hasSignedAllForms: boolean\n handleContinue: () => void\n handleRequestFormToSign: (form: Form) => void\n documentListError: Error | null\n formToSign?: Form\n}\n\nconst [useDocumentList, DocumentListProvider] =\n createCompoundContext<DocumentListContextType>('DocumentListContext')\nexport { useDocumentList, DocumentListProvider }\n"],"names":["useDocumentList","DocumentListProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;AAYA,MAAM,CAACA,GAAiBC,CAAoB,IAC1CC,EAA+C,qBAAqB;"}
|
|
@@ -11,11 +11,10 @@ import "classnames";
|
|
|
11
11
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
12
12
|
import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
13
13
|
import "dompurify";
|
|
14
|
-
import "../../../../contexts/LocaleProvider/useLocale.js";
|
|
15
14
|
import { createCompoundContext as o } from "../../../Base/createCompoundContext.js";
|
|
16
|
-
const [
|
|
15
|
+
const [c, d] = o("SignatureFormContext");
|
|
17
16
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
d as SignatureFormProvider,
|
|
18
|
+
c as useSignatureForm
|
|
20
19
|
};
|
|
21
20
|
//# sourceMappingURL=useSignatureForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSignatureForm.js","sources":["../../../../../src/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.ts"],"sourcesContent":["import type { Form } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype SignatureFormContextType = {\n form: Form\n pdfUrl?: string | null\n handleBack: () => void\n isPending: boolean\n}\n\nconst [useSignatureForm, SignatureFormProvider] =\n createCompoundContext<SignatureFormContextType>('SignatureFormContext')\nexport { useSignatureForm, SignatureFormProvider }\n"],"names":["useSignatureForm","SignatureFormProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useSignatureForm.js","sources":["../../../../../src/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.ts"],"sourcesContent":["import type { Form } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype SignatureFormContextType = {\n form: Form\n pdfUrl?: string | null\n handleBack: () => void\n isPending: boolean\n}\n\nconst [useSignatureForm, SignatureFormProvider] =\n createCompoundContext<SignatureFormContextType>('SignatureFormContext')\nexport { useSignatureForm, SignatureFormProvider }\n"],"names":["useSignatureForm","SignatureFormProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;AAUA,MAAM,CAACA,GAAkBC,CAAqB,IAC5CC,EAAgD,sBAAsB;"}
|
|
@@ -11,11 +11,10 @@ import "classnames";
|
|
|
11
11
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
12
12
|
import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
13
13
|
import "dompurify";
|
|
14
|
-
import "../../../contexts/LocaleProvider/useLocale.js";
|
|
15
14
|
import { createCompoundContext as o } from "../../Base/createCompoundContext.js";
|
|
16
|
-
const [
|
|
15
|
+
const [c, d] = o("EmployeeListContext");
|
|
17
16
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
d as EmployeeListProvider,
|
|
18
|
+
c as useEmployeeList
|
|
20
19
|
};
|
|
21
20
|
//# sourceMappingURL=useEmployeeList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEmployeeList.js","sources":["../../../../src/components/Employee/EmployeeList/useEmployeeList.ts"],"sourcesContent":["import type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport type { OnboardingStatus } from '@gusto/embedded-api/models/operations/putv1employeesemployeeidonboardingstatus'\nimport { createCompoundContext } from '@/components/Base'\nimport type { PaginationItemsPerPage } from '@/components/Common/PaginationControl/PaginationControlTypes'\n\n//Interface for context passed down to component slots\ntype EmployeeListContextType = {\n handleEdit: (uuid: string, onboardingStatus?: OnboardingStatus) => void\n handleDelete: (uuid: string) => Promise<void>\n handleCancelSelfOnboarding: (employeeId: string) => Promise<void>\n handleReview: (employeeId: string) => Promise<void>\n handleNew: () => void\n handleSkip: () => void\n handleFirstPage: () => void\n handlePreviousPage: () => void\n handleNextPage: () => void\n handleLastPage: () => void\n handleItemsPerPageChange: (newCount: PaginationItemsPerPage) => void\n currentPage: number\n totalPages: number\n employees: Employee[]\n itemsPerPage: PaginationItemsPerPage\n isFetching: boolean\n}\n\nconst [useEmployeeList, EmployeeListProvider] =\n createCompoundContext<EmployeeListContextType>('EmployeeListContext')\nexport { useEmployeeList, EmployeeListProvider }\n"],"names":["useEmployeeList","EmployeeListProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useEmployeeList.js","sources":["../../../../src/components/Employee/EmployeeList/useEmployeeList.ts"],"sourcesContent":["import type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport type { OnboardingStatus } from '@gusto/embedded-api/models/operations/putv1employeesemployeeidonboardingstatus'\nimport { createCompoundContext } from '@/components/Base'\nimport type { PaginationItemsPerPage } from '@/components/Common/PaginationControl/PaginationControlTypes'\n\n//Interface for context passed down to component slots\ntype EmployeeListContextType = {\n handleEdit: (uuid: string, onboardingStatus?: OnboardingStatus) => void\n handleDelete: (uuid: string) => Promise<void>\n handleCancelSelfOnboarding: (employeeId: string) => Promise<void>\n handleReview: (employeeId: string) => Promise<void>\n handleNew: () => void\n handleSkip: () => void\n handleFirstPage: () => void\n handlePreviousPage: () => void\n handleNextPage: () => void\n handleLastPage: () => void\n handleItemsPerPageChange: (newCount: PaginationItemsPerPage) => void\n currentPage: number\n totalPages: number\n employees: Employee[]\n itemsPerPage: PaginationItemsPerPage\n isFetching: boolean\n}\n\nconst [useEmployeeList, EmployeeListProvider] =\n createCompoundContext<EmployeeListContextType>('EmployeeListContext')\nexport { useEmployeeList, EmployeeListProvider }\n"],"names":["useEmployeeList","EmployeeListProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;AAyBA,MAAM,CAACA,GAAiBC,CAAoB,IAC1CC,EAA+C,qBAAqB;"}
|