@gusto/embedded-react-sdk 0.16.0 → 0.18.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 +54 -0
- package/dist/components/Base/Base.js +50 -65
- package/dist/components/Base/Base.js.map +1 -1
- package/dist/components/Base/useBase.d.ts +2 -5
- package/dist/components/Base/useBase.js.map +1 -1
- package/dist/components/Common/EmptyData/EmptyData.js +10 -10
- package/dist/components/Common/EmptyData/EmptyData.js.map +1 -1
- package/dist/components/Common/EmptyData/EmptyData.module.scss.js +5 -3
- package/dist/components/Common/EmptyData/EmptyData.module.scss.js.map +1 -1
- package/dist/components/Common/FieldDescription/FieldDescription.module.scss.js +1 -1
- package/dist/components/Common/FlowBreadcrumbs/FlowBreadcrumbs.js +41 -33
- package/dist/components/Common/FlowBreadcrumbs/FlowBreadcrumbs.js.map +1 -1
- package/dist/components/Common/HamburgerMenu/HamburgerMenu.js +1 -1
- package/dist/components/Common/HamburgerMenu/HamburgerMenu.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureForm.js +4 -6
- package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormActions.js +10 -12
- package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormFields.js +6 -8
- package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
- package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +32 -18
- package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js.map +1 -1
- package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.module.scss.js +12 -12
- package/dist/components/Common/UI/Breadcrumbs/BreadcrumbsTypes.d.ts +14 -0
- package/dist/components/Common/UI/Breadcrumbs/BreadcrumbsTypes.js +8 -0
- package/dist/components/Common/UI/Breadcrumbs/BreadcrumbsTypes.js.map +1 -0
- package/dist/components/Common/UI/DatePicker/DatePicker.module.scss.js +8 -8
- package/dist/components/Common/UI/DescriptionList/DescriptionList.d.ts +2 -0
- package/dist/components/Common/UI/DescriptionList/DescriptionList.js +16 -0
- package/dist/components/Common/UI/DescriptionList/DescriptionList.js.map +1 -0
- package/dist/components/Common/UI/DescriptionList/DescriptionList.module.scss.js +10 -0
- package/dist/components/Common/UI/DescriptionList/DescriptionList.module.scss.js.map +1 -0
- package/dist/components/Common/UI/DescriptionList/DescriptionListTypes.d.ts +10 -0
- package/dist/components/Common/UI/DescriptionList/DescriptionListTypes.js +5 -0
- package/dist/components/Common/UI/DescriptionList/DescriptionListTypes.js.map +1 -0
- package/dist/components/Common/UI/DescriptionList/index.d.ts +3 -0
- package/dist/components/Common/UI/Dialog/Dialog.js +50 -76
- package/dist/components/Common/UI/Dialog/Dialog.js.map +1 -1
- package/dist/components/Common/UI/Dialog/Dialog.module.scss.js +8 -14
- package/dist/components/Common/UI/Dialog/Dialog.module.scss.js.map +1 -1
- package/dist/components/Common/UI/Link/LinkTypes.d.ts +7 -6
- package/dist/components/Common/UI/Modal/Modal.d.ts +2 -0
- package/dist/components/Common/UI/Modal/Modal.js +90 -0
- package/dist/components/Common/UI/Modal/Modal.js.map +1 -0
- package/dist/components/Common/UI/Modal/Modal.module.scss.js +26 -0
- package/dist/components/Common/UI/Modal/Modal.module.scss.js.map +1 -0
- package/dist/components/Common/UI/Modal/ModalTypes.d.ts +34 -0
- package/dist/components/Common/UI/Modal/ModalTypes.js +8 -0
- package/dist/components/Common/UI/Modal/ModalTypes.js.map +1 -0
- package/dist/components/Common/UI/Modal/index.d.ts +3 -0
- package/dist/components/Common/UI/Tabs/Tabs.d.ts +0 -5
- package/dist/components/Common/UI/Tabs/Tabs.js +45 -16
- package/dist/components/Common/UI/Tabs/Tabs.js.map +1 -1
- package/dist/components/Common/UI/Tabs/Tabs.module.scss.js +8 -4
- package/dist/components/Common/UI/Tabs/Tabs.module.scss.js.map +1 -1
- package/dist/components/Common/UI/Tabs/TabsTypes.d.ts +7 -0
- package/dist/components/Common/index.d.ts +0 -1
- package/dist/components/Company/AssignSignatory/AssignSignatory.js +6 -8
- package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +6 -7
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +8 -9
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +2 -3
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +2 -3
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +4 -6
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +6 -7
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +5 -6
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +9 -10
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +4 -6
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/TitleSelect.js +7 -8
- package/dist/components/Company/AssignSignatory/TitleSelect.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +6 -8
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +2 -3
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Form.js +7 -8
- package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +4 -6
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/AccountView.js +22 -17
- package/dist/components/Company/BankAccount/BankAccountList/AccountView.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js +6 -7
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +7 -8
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +4 -5
- package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +5 -6
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +11 -13
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +4 -6
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +6 -8
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +4 -6
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Company/FederalTaxes/Actions.js +6 -7
- package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
- package/dist/components/Company/FederalTaxes/FederalTaxes.js +15 -17
- package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
- package/dist/components/Company/FederalTaxes/Form.js +2 -3
- package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +9 -11
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Actions.js +5 -6
- package/dist/components/Company/Industry/Actions.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +7 -9
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Industry/Edit.js +10 -11
- package/dist/components/Company/Industry/Edit.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Actions.js +2 -3
- package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Form.js +4 -5
- package/dist/components/Company/Locations/LocationForm/Form.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/LocationForm.js +9 -11
- package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +4 -6
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/Actions.js +2 -3
- package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/List.js +2 -3
- package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/LocationsList.js +12 -14
- package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +4 -6
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/Completed.js +5 -6
- package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/MissingRequirements.js +2 -3
- package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +2 -4
- package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +4 -6
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/PaySchedule.js +39 -41
- package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Actions.js +10 -11
- package/dist/components/Company/PaySchedule/_parts/Actions.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Edit.js +35 -37
- package/dist/components/Company/PaySchedule/_parts/Edit.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Head.js +18 -19
- package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/List.js +5 -6
- package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
- package/dist/components/Company/PaySchedule/usePaySchedule.js +6 -8
- package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +5 -6
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +4 -6
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +6 -7
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js +5 -6
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +4 -6
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Contractor/Address/Address.js +3 -5
- package/dist/components/Contractor/Address/Address.js.map +1 -1
- package/dist/components/Contractor/Address/Form.js +2 -3
- package/dist/components/Contractor/Address/Form.js.map +1 -1
- package/dist/components/Contractor/Address/useAddress.js +6 -8
- package/dist/components/Contractor/Address/useAddress.js.map +1 -1
- package/dist/components/Contractor/ContractorList/index.js +15 -16
- package/dist/components/Contractor/ContractorList/index.js.map +1 -1
- package/dist/components/Contractor/NewHireReport/NewHireReport.js +13 -14
- package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +2 -3
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +2 -3
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +2 -3
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js.map +1 -1
- package/dist/components/Contractor/Profile/useContractorProfile.js +3 -4
- package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
- package/dist/components/Contractor/Submit/Submit.js +2 -3
- package/dist/components/Contractor/Submit/Submit.js.map +1 -1
- package/dist/components/Employee/Compensation/Actions.js +4 -5
- package/dist/components/Employee/Compensation/Actions.js.map +1 -1
- package/dist/components/Employee/Compensation/Edit.js +10 -9
- package/dist/components/Employee/Compensation/Edit.js.map +1 -1
- package/dist/components/Employee/Compensation/List.js +5 -6
- 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/CustomDeductionForm.d.ts +6 -6
- package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.d.ts +2 -2
- package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js +2 -3
- package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +44 -40
- package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js.map +1 -1
- package/dist/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.js +2 -3
- package/dist/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.js.map +1 -1
- package/dist/components/Employee/Deductions/useDeductions.d.ts +2 -2
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +4 -5
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +9 -11
- package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/List.js +2 -3
- package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +4 -6
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +11 -13
- package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +4 -6
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Employee/EmployeeList/Actions.js +4 -5
- package/dist/components/Employee/EmployeeList/Actions.js.map +1 -1
- package/dist/components/Employee/EmployeeList/Head.js +2 -3
- package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
- package/dist/components/Employee/EmployeeList/List.js +9 -10
- package/dist/components/Employee/EmployeeList/List.js.map +1 -1
- package/dist/components/Employee/EmployeeList/useEmployeeList.js +4 -6
- package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/Actions.js +2 -3
- package/dist/components/Employee/FederalTaxes/Actions.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/FederalForm.js +5 -6
- package/dist/components/Employee/FederalTaxes/FederalForm.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/FederalTaxes.js +8 -8
- package/dist/components/Employee/FederalTaxes/FederalTaxes.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/Head.js +6 -6
- package/dist/components/Employee/FederalTaxes/Head.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +4 -6
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Employee/Landing/Landing.js +6 -7
- package/dist/components/Employee/Landing/Landing.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/Actions.js +5 -6
- package/dist/components/Employee/PaymentMethod/Actions.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +4 -5
- package/dist/components/Employee/PaymentMethod/BankAccountEdit.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountsList.js +3 -4
- package/dist/components/Employee/PaymentMethod/BankAccountsList.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/PaymentMethod.d.ts +1 -0
- package/dist/components/Employee/PaymentMethod/PaymentMethod.js +79 -78
- package/dist/components/Employee/PaymentMethod/PaymentMethod.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +12 -13
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/Split.js +2 -3
- package/dist/components/Employee/PaymentMethod/Split.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.d.ts +1 -0
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +6 -8
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/Actions.js +6 -7
- package/dist/components/Employee/Profile/Actions.js.map +1 -1
- package/dist/components/Employee/Profile/AdminPersonalDetails.js +38 -35
- package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
- package/dist/components/Employee/Profile/HomeAddress.d.ts +52 -0
- package/dist/components/Employee/Profile/HomeAddress.js +63 -44
- package/dist/components/Employee/Profile/HomeAddress.js.map +1 -1
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js +20 -21
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
- package/dist/components/Employee/Profile/Profile.js +150 -143
- package/dist/components/Employee/Profile/Profile.js.map +1 -1
- package/dist/components/Employee/Profile/useProfile.d.ts +1 -0
- package/dist/components/Employee/Profile/useProfile.js +4 -6
- package/dist/components/Employee/Profile/useProfile.js.map +1 -1
- package/dist/components/Employee/StateTaxes/Actions.js +6 -7
- package/dist/components/Employee/StateTaxes/Actions.js.map +1 -1
- package/dist/components/Employee/StateTaxes/StateTaxes.js +4 -4
- package/dist/components/Employee/StateTaxes/StateTaxes.js.map +1 -1
- package/dist/components/Employee/StateTaxes/useStateTaxes.js +4 -6
- package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
- package/dist/components/Employee/Taxes/Actions.js +7 -8
- package/dist/components/Employee/Taxes/Actions.js.map +1 -1
- package/dist/components/Employee/Taxes/FederalForm.js +5 -6
- package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
- package/dist/components/Employee/Taxes/FederalHead.js +6 -6
- package/dist/components/Employee/Taxes/FederalHead.js.map +1 -1
- package/dist/components/Employee/Taxes/Taxes.js +5 -5
- package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
- package/dist/components/Employee/Taxes/useTaxes.js +4 -6
- package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
- package/dist/components/Flow/Flow.js +9 -10
- package/dist/components/Flow/Flow.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js +9 -10
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +101 -90
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +5 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +135 -133
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.module.scss.js +5 -3
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.module.scss.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +127 -119
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +5 -6
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.d.ts +3 -1
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js +22 -22
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js +40 -27
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistory.js +50 -72
- package/dist/components/Payroll/PayrollHistory/PayrollHistory.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +2 -3
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.d.ts +1 -1
- package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js +4 -4
- package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js.map +1 -1
- package/dist/components/Payroll/PayrollLanding/payrollLandingStateMachine.js +20 -20
- package/dist/components/Payroll/PayrollLanding/payrollLandingStateMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollList.js +24 -21
- package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.d.ts +3 -9
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +117 -128
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.module.scss.js +6 -6
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +89 -78
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +195 -214
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.module.scss.js +8 -0
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.module.scss.js.map +1 -0
- package/dist/components/Payroll/usePreparedPayrollData.js +8 -10
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js +49 -45
- package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js.map +1 -1
- package/dist/contexts/ComponentAdapter/componentAdapterTypes.d.ts +2 -0
- package/dist/contexts/ComponentAdapter/useComponentContext.d.ts +4 -0
- package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +5 -7
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/helpers/apiErrorToList.d.ts +7 -0
- package/dist/helpers/apiErrorToList.js +23 -0
- package/dist/helpers/apiErrorToList.js.map +1 -0
- package/dist/helpers/breadcrumbHelpers.js +30 -30
- package/dist/helpers/breadcrumbHelpers.js.map +1 -1
- package/dist/helpers/dateFormatting.d.ts +18 -6
- package/dist/helpers/dateFormatting.js +93 -24
- package/dist/helpers/dateFormatting.js.map +1 -1
- package/dist/helpers/formattedStrings.js +11 -12
- package/dist/helpers/formattedStrings.js.map +1 -1
- package/dist/hooks/useAsyncError.js.map +1 -0
- package/dist/hooks/useDateFormatter.d.ts +19 -0
- package/dist/hooks/useDateFormatter.js +24 -0
- package/dist/hooks/useDateFormatter.js.map +1 -0
- package/dist/hooks/useMenu.js.map +1 -0
- package/dist/{components/Common/hooks → hooks}/useNumberFormatter.js +1 -1
- package/dist/hooks/useNumberFormatter.js.map +1 -0
- package/dist/hooks/useOverflowDetection/index.d.ts +3 -0
- package/dist/hooks/useOverflowDetection/useOverflowDetection.d.ts +7 -0
- package/dist/hooks/useOverflowDetection/useOverflowDetection.js +28 -0
- package/dist/hooks/useOverflowDetection/useOverflowDetection.js.map +1 -0
- package/dist/i18n/en/Company.PaySchedule.json.js +9 -9
- package/dist/i18n/en/Employee.Compensation.json.js +15 -15
- package/dist/i18n/en/Employee.Deductions.json.js +131 -105
- package/dist/i18n/en/Employee.Deductions.json.js.map +1 -1
- package/dist/i18n/en/Employee.FederalTaxes.json.js +9 -9
- package/dist/i18n/en/Employee.HomeAddress.json.js +1 -1
- package/dist/i18n/en/Employee.PaymentMethod.json.js +70 -66
- package/dist/i18n/en/Employee.PaymentMethod.json.js.map +1 -1
- package/dist/i18n/en/Employee.Taxes.json.js +25 -27
- package/dist/i18n/en/Employee.Taxes.json.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollConfiguration.json.js +17 -17
- package/dist/i18n/en/Payroll.PayrollOverview.json.js +23 -23
- package/dist/i18n/en/common.json.d.ts +2 -1
- package/dist/i18n/en/common.json.js +4 -4
- package/dist/style.css +1 -1
- package/dist/types/i18next.d.ts +20 -1
- package/package.json +10 -10
- package/dist/components/Common/hooks/useAsyncError.js.map +0 -1
- package/dist/components/Common/hooks/useMenu.js.map +0 -1
- package/dist/components/Common/hooks/useNumberFormatter.js.map +0 -1
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +0 -221
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +0 -1
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.module.scss.js +0 -8
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.module.scss.js.map +0 -1
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +0 -132
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +0 -1
- package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.module.scss.js +0 -14
- package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.module.scss.js.map +0 -1
- package/dist/components/Employee/Deductions/DeductionsForm/UNSTABLE_DeductionsForm.js +0 -98
- package/dist/components/Employee/Deductions/DeductionsForm/UNSTABLE_DeductionsForm.js.map +0 -1
- /package/dist/{components/Common/hooks → hooks}/useAsyncError.d.ts +0 -0
- /package/dist/{components/Common/hooks → hooks}/useAsyncError.js +0 -0
- /package/dist/{components/Common/hooks → hooks}/useMenu.d.ts +0 -0
- /package/dist/{components/Common/hooks → hooks}/useMenu.js +0 -0
- /package/dist/{components/Common/hooks → hooks}/useNumberFormatter.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Edit.js","sources":["../../../../src/components/Employee/Compensation/Edit.tsx"],"sourcesContent":["import { useEffect, useMemo } from 'react'\nimport { useFormContext, useWatch } from 'react-hook-form'\nimport { Trans, useTranslation } from 'react-i18next'\nimport {\n type CompensationInputs,\n useCompensation,\n rateMinimumError,\n rateExemptThresholdError,\n} from './useCompensation'\nimport { FLSA_OVERTIME_SALARY_LIMIT, FlsaStatus, PAY_PERIODS } from '@/shared/constants'\nimport useNumberFormatter from '@/components/Common/hooks/useNumberFormatter'\nimport {\n NumberInputField,\n SelectField,\n TextInputField,\n SwitchField,\n RadioGroupField,\n ComboBoxField,\n CheckboxField,\n} from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { WA_RISK_CLASS_CODES } from '@/models/WA_RISK_CODES'\n\nexport interface SelectCategory {\n id: string\n name: string\n}\n\nexport const Edit = () => {\n const { t } = useTranslation('Employee.Compensation')\n const format = useNumberFormatter('currency')\n const Components = useComponentContext()\n\n const stateWcRiskOptions = useMemo(\n () => WA_RISK_CLASS_CODES.map(({ code, description }) => ({ value: code, label: description })),\n [],\n )\n\n const {\n control,\n register,\n setValue,\n formState: { errors, defaultValues },\n } = useFormContext<CompensationInputs>()\n\n const watchedFlsaStatus = useWatch({ control, name: 'flsaStatus' })\n const watchedStateWcCovered = useWatch({ control, name: 'stateWcCovered' })\n const { currentJob, mode, minimumWages, handleFlsaChange, state, showTwoPercentStakeholder } =\n useCompensation()\n\n /**Correctly set payment unit selected option and rate based on flsa status, falling back to default */\n useEffect(() => {\n if (watchedFlsaStatus === FlsaStatus.OWNER) {\n setValue('paymentUnit', 'Paycheck')\n } else if (\n watchedFlsaStatus === FlsaStatus.COMMISSION_ONLY_NONEXEMPT ||\n watchedFlsaStatus === FlsaStatus.COMMISSION_ONLY_EXEMPT\n ) {\n setValue('paymentUnit', 'Year')\n setValue('rate', 0)\n } else if (defaultValues?.paymentUnit) {\n setValue('paymentUnit', defaultValues.paymentUnit)\n }\n }, [watchedFlsaStatus, setValue, defaultValues?.paymentUnit])\n\n if (\n !(\n mode === 'ADD_INITIAL_JOB' ||\n mode === 'ADD_ADDITIONAL_JOB' ||\n mode === 'EDIT_INITIAL_JOB' ||\n mode === 'EDIT_ADDITIONAL_JOB'\n )\n )\n return\n\n const classificationOptions = (Object.keys(FlsaStatus) as Array<keyof typeof FlsaStatus>).map(\n key => ({\n value: FlsaStatus[key],\n label: t(`flsaStatusLabels.${FlsaStatus[key]}`),\n }),\n )\n\n const paymentUnitOptions = [\n { value: PAY_PERIODS.HOUR, label: t('paymentUnitOptions.Hour') },\n { value: PAY_PERIODS.WEEK, label: t('paymentUnitOptions.Week') },\n { value: PAY_PERIODS.MONTH, label: t('paymentUnitOptions.Month') },\n { value: PAY_PERIODS.YEAR, label: t('paymentUnitOptions.Year') },\n { value: PAY_PERIODS.PAYCHECK, label: t('paymentUnitOptions.Paycheck') },\n ]\n\n const isFlsaSelectionEnabled =\n watchedFlsaStatus !== FlsaStatus.NONEXEMPT || currentJob?.primary || mode === 'ADD_INITIAL_JOB'\n\n const isAdjustMinimumWageEnabled =\n watchedFlsaStatus === FlsaStatus.NONEXEMPT && minimumWages.length > 0\n\n let rateErrorMessage = t('validations.rate')\n if (errors.rate?.message === rateMinimumError) {\n rateErrorMessage = t('validations.nonZeroRate')\n } else if (errors.rate?.message === rateExemptThresholdError) {\n rateErrorMessage = t('validations.rateExemptThreshold', {\n limit: format(FLSA_OVERTIME_SALARY_LIMIT),\n })\n }\n\n return (\n <>\n <TextInputField\n name=\"jobTitle\"\n label={t('jobTitle')}\n isRequired\n errorMessage={t('validations.title')}\n />\n {/* hiding flsa selection for secondary jobs */}\n {!isFlsaSelectionEnabled && <input type=\"hidden\" {...register('flsaStatus')} />}\n {isFlsaSelectionEnabled && (\n <SelectField\n name=\"flsaStatus\"\n label={t('employeeClassification')}\n description={\n <Trans\n t={t}\n i18nKey=\"classificationCTA\"\n components={{ classificationCta: <Components.Link /> }}\n />\n }\n errorMessage={t('validations.exemptThreshold', {\n limit: format(FLSA_OVERTIME_SALARY_LIMIT),\n })}\n options={classificationOptions}\n isRequired\n isDisabled={!isFlsaSelectionEnabled}\n onChange={handleFlsaChange}\n />\n )}\n <NumberInputField\n name=\"rate\"\n label={t('amount')}\n format=\"currency\"\n min={0}\n errorMessage={rateErrorMessage}\n isRequired\n isDisabled={\n watchedFlsaStatus === FlsaStatus.COMMISSION_ONLY_NONEXEMPT ||\n watchedFlsaStatus === FlsaStatus.COMMISSION_ONLY_EXEMPT\n }\n />\n {isAdjustMinimumWageEnabled && (\n <>\n <SwitchField\n name=\"adjustForMinimumWage\"\n label={t('adjustForMinimumWage')}\n description={t('adjustForMinimumWageDescription')}\n />\n <SelectField\n name=\"minimumWageId\"\n label={t('minimumWageLabel')}\n description={t('minimumWageDescription')}\n options={minimumWages.map(wage => ({\n value: wage.uuid,\n label: `${format(Number(wage.wage))} - ${wage.authority}: ${wage.notes ?? ''}`,\n }))}\n errorMessage={t('validations.minimumWage')}\n />\n </>\n )}\n <SelectField\n name=\"paymentUnit\"\n label={t('paymentUnitLabel')}\n description={t('paymentUnitDescription')}\n options={paymentUnitOptions}\n errorMessage={t('validations.paymentUnit')}\n isRequired\n isDisabled={\n watchedFlsaStatus === FlsaStatus.OWNER ||\n watchedFlsaStatus === FlsaStatus.COMMISSION_ONLY_NONEXEMPT ||\n watchedFlsaStatus === FlsaStatus.COMMISSION_ONLY_EXEMPT\n }\n />\n {showTwoPercentStakeholder && (\n <CheckboxField label={t('twoPercentStakeholderLabel')} name=\"twoPercentShareholder\" />\n )}\n {state === 'WA' && (\n <>\n <RadioGroupField\n name=\"stateWcCovered\"\n label={t('stateWcCoveredLabel')}\n description={\n <Trans\n t={t}\n i18nKey=\"stateWcCoveredDescription\"\n components={{\n wcLink: (\n <Components.Link\n href=\"https://www.lni.wa.gov/insurance/rates-risk-classes/risk-classes-for-workers-compensation/risk-class-lookup#/\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n />\n ),\n }}\n />\n }\n options={[\n { label: t('stateWcCoveredOptions.yes'), value: true },\n { label: t('stateWcCoveredOptions.no'), value: false },\n ]}\n />\n {watchedStateWcCovered && (\n <ComboBoxField\n name=\"stateWcClassCode\"\n label={t('stateWcClassCodeLabel')}\n options={stateWcRiskOptions}\n errorMessage={t('validations.stateWcClassCode')}\n placeholder={t('stateWcClassCodeLabel')}\n />\n )}\n </>\n )}\n </>\n )\n}\n"],"names":["Edit","t","useTranslation","format","useNumberFormatter","Components","useComponentContext","stateWcRiskOptions","useMemo","WA_RISK_CLASS_CODES","code","description","control","register","setValue","errors","defaultValues","useFormContext","watchedFlsaStatus","useWatch","watchedStateWcCovered","currentJob","mode","minimumWages","handleFlsaChange","state","showTwoPercentStakeholder","useCompensation","useEffect","FlsaStatus","classificationOptions","key","paymentUnitOptions","PAY_PERIODS","isFlsaSelectionEnabled","isAdjustMinimumWageEnabled","rateErrorMessage","rateMinimumError","rateExemptThresholdError","FLSA_OVERTIME_SALARY_LIMIT","jsxs","Fragment","jsx","TextInputField","SelectField","Trans","NumberInputField","Switch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A,QACvC,SAAS+B;AAAA,QACT,cAAc/B,EAAE,yBAAyB;AAAA,QACzC,YAAU;AAAA,QACV,YACEiB,MAAsBW,EAAW,SACjCX,MAAsBW,EAAW,6BACjCX,MAAsBW,EAAW;AAAA,MAAA;AAAA,IAAA;AAAA,IAGpCH,uBACEuB,GAAA,EAAc,OAAOhD,EAAE,4BAA4B,GAAG,MAAK,yBAAwB;AAAA,IAErFwB,MAAU,QACT,gBAAAe,EAAAC,GAAA,EACE,UAAA;AAAA,MAAA,gBAAAC;AAAA,QAACQ;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,OAAOjD,EAAE,qBAAqB;AAAA,UAC9B,aACE,gBAAAyC;AAAA,YAACG;AAAA,YAAA;AAAA,cACC,GAAA5C;AAAA,cACA,SAAQ;AAAA,cACR,YAAY;AAAA,gBACV,QACE,gBAAAyC;AAAA,kBAACrC,EAAW;AAAA,kBAAX;AAAA,oBACC,MAAK;AAAA,oBACL,QAAO;AAAA,oBACP,KAAI;AAAA,kBAAA;AAAA,gBAAA;AAAA,cACN;AAAA,YAEJ;AAAA,UAAA;AAAA,UAGJ,SAAS;AAAA,YACP,EAAE,OAAOJ,EAAE,2BAA2B,GAAG,OAAO,GAAA;AAAA,YAChD,EAAE,OAAOA,EAAE,0BAA0B,GAAG,OAAO,GAAA;AAAA,UAAM;AAAA,QACvD;AAAA,MAAA;AAAA,MAEDmB,KACC,gBAAAsB;AAAA,QAACS;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,OAAOlD,EAAE,uBAAuB;AAAA,UAChC,SAASM;AAAA,UACT,cAAcN,EAAE,8BAA8B;AAAA,UAC9C,aAAaA,EAAE,uBAAuB;AAAA,QAAA;AAAA,MAAA;AAAA,IACxC,EAAA,CAEJ;AAAA,EAAA,GAEJ;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"Edit.js","sources":["../../../../src/components/Employee/Compensation/Edit.tsx"],"sourcesContent":["import { useEffect, useMemo } from 'react'\nimport { useFormContext, useWatch } from 'react-hook-form'\nimport { Trans, useTranslation } from 'react-i18next'\nimport {\n type CompensationInputs,\n useCompensation,\n rateMinimumError,\n rateExemptThresholdError,\n} from './useCompensation'\nimport { FLSA_OVERTIME_SALARY_LIMIT, FlsaStatus, PAY_PERIODS } from '@/shared/constants'\nimport useNumberFormatter from '@/hooks/useNumberFormatter'\nimport {\n NumberInputField,\n SelectField,\n TextInputField,\n SwitchField,\n RadioGroupField,\n ComboBoxField,\n CheckboxField,\n} from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { WA_RISK_CLASS_CODES } from '@/models/WA_RISK_CODES'\n\nexport interface SelectCategory {\n id: string\n name: string\n}\n\nexport const Edit = () => {\n const { t } = useTranslation('Employee.Compensation')\n const format = useNumberFormatter('currency')\n const Components = useComponentContext()\n\n const stateWcRiskOptions = useMemo(\n () => WA_RISK_CLASS_CODES.map(({ code, description }) => ({ value: code, label: description })),\n [],\n )\n\n const {\n control,\n register,\n setValue,\n formState: { errors, defaultValues },\n } = useFormContext<CompensationInputs>()\n\n const watchedFlsaStatus = useWatch({ control, name: 'flsaStatus' })\n const watchedStateWcCovered = useWatch({ control, name: 'stateWcCovered' })\n const { currentJob, mode, minimumWages, handleFlsaChange, state, showTwoPercentStakeholder } =\n useCompensation()\n\n /**Correctly set payment unit selected option and rate based on flsa status, falling back to default */\n useEffect(() => {\n if (watchedFlsaStatus === FlsaStatus.OWNER) {\n setValue('paymentUnit', 'Paycheck')\n } else if (\n watchedFlsaStatus === FlsaStatus.COMMISSION_ONLY_NONEXEMPT ||\n watchedFlsaStatus === FlsaStatus.COMMISSION_ONLY_EXEMPT\n ) {\n setValue('paymentUnit', 'Year')\n setValue('rate', 0)\n } else if (defaultValues?.paymentUnit) {\n setValue('paymentUnit', defaultValues.paymentUnit)\n }\n }, [watchedFlsaStatus, setValue, defaultValues?.paymentUnit])\n\n if (\n !(\n mode === 'ADD_INITIAL_JOB' ||\n mode === 'ADD_ADDITIONAL_JOB' ||\n mode === 'EDIT_INITIAL_JOB' ||\n mode === 'EDIT_ADDITIONAL_JOB'\n )\n )\n return\n\n const classificationOptions = (Object.keys(FlsaStatus) as Array<keyof typeof FlsaStatus>).map(\n key => ({\n value: FlsaStatus[key],\n label: t(`flsaStatusLabels.${FlsaStatus[key]}`),\n }),\n )\n\n const paymentUnitOptions = [\n { value: PAY_PERIODS.HOUR, label: t('paymentUnitOptions.Hour') },\n { value: PAY_PERIODS.WEEK, label: t('paymentUnitOptions.Week') },\n { value: PAY_PERIODS.MONTH, label: t('paymentUnitOptions.Month') },\n { value: PAY_PERIODS.YEAR, label: t('paymentUnitOptions.Year') },\n { value: PAY_PERIODS.PAYCHECK, label: t('paymentUnitOptions.Paycheck') },\n ]\n\n const isFlsaSelectionEnabled =\n watchedFlsaStatus !== FlsaStatus.NONEXEMPT || currentJob?.primary || mode === 'ADD_INITIAL_JOB'\n\n const isAdjustMinimumWageEnabled =\n watchedFlsaStatus === FlsaStatus.NONEXEMPT && minimumWages.length > 0\n\n let rateErrorMessage = t('validations.rate')\n if (errors.rate?.message === rateMinimumError) {\n rateErrorMessage = t('validations.nonZeroRate')\n } else if (errors.rate?.message === rateExemptThresholdError) {\n rateErrorMessage = t('validations.rateExemptThreshold', {\n limit: format(FLSA_OVERTIME_SALARY_LIMIT),\n })\n }\n\n return (\n <>\n <TextInputField\n name=\"jobTitle\"\n label={t('jobTitle')}\n isRequired\n errorMessage={t('validations.title')}\n />\n {/* hiding flsa selection for secondary jobs */}\n {!isFlsaSelectionEnabled && <input type=\"hidden\" {...register('flsaStatus')} />}\n {isFlsaSelectionEnabled && (\n <SelectField\n name=\"flsaStatus\"\n label={t('employeeClassification')}\n description={\n <Trans\n t={t}\n i18nKey=\"classificationCTA\"\n components={{\n ClassificationLink: <Components.Link />,\n }}\n />\n }\n errorMessage={t('validations.exemptThreshold', {\n limit: format(FLSA_OVERTIME_SALARY_LIMIT),\n })}\n options={classificationOptions}\n isRequired\n isDisabled={!isFlsaSelectionEnabled}\n onChange={handleFlsaChange}\n />\n )}\n <NumberInputField\n name=\"rate\"\n label={t('amount')}\n format=\"currency\"\n min={0}\n errorMessage={rateErrorMessage}\n isRequired\n isDisabled={\n watchedFlsaStatus === FlsaStatus.COMMISSION_ONLY_NONEXEMPT ||\n watchedFlsaStatus === FlsaStatus.COMMISSION_ONLY_EXEMPT\n }\n />\n {isAdjustMinimumWageEnabled && (\n <>\n <SwitchField\n name=\"adjustForMinimumWage\"\n label={t('adjustForMinimumWage')}\n description={t('adjustForMinimumWageDescription')}\n />\n <SelectField\n name=\"minimumWageId\"\n label={t('minimumWageLabel')}\n description={t('minimumWageDescription')}\n options={minimumWages.map(wage => ({\n value: wage.uuid,\n label: `${format(Number(wage.wage))} - ${wage.authority}: ${wage.notes ?? ''}`,\n }))}\n errorMessage={t('validations.minimumWage')}\n />\n </>\n )}\n <SelectField\n name=\"paymentUnit\"\n label={t('paymentUnitLabel')}\n description={t('paymentUnitDescription')}\n options={paymentUnitOptions}\n errorMessage={t('validations.paymentUnit')}\n isRequired\n isDisabled={\n watchedFlsaStatus === FlsaStatus.OWNER ||\n watchedFlsaStatus === FlsaStatus.COMMISSION_ONLY_NONEXEMPT ||\n watchedFlsaStatus === FlsaStatus.COMMISSION_ONLY_EXEMPT\n }\n />\n {showTwoPercentStakeholder && (\n <CheckboxField label={t('twoPercentStakeholderLabel')} name=\"twoPercentShareholder\" />\n )}\n {state === 'WA' && (\n <>\n <RadioGroupField\n name=\"stateWcCovered\"\n label={t('stateWcCoveredLabel')}\n description={\n <Trans\n t={t}\n i18nKey=\"stateWcCoveredDescription\"\n components={{\n wcLink: (\n <Components.Link\n href=\"https://www.lni.wa.gov/insurance/rates-risk-classes/risk-classes-for-workers-compensation/risk-class-lookup#/\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n />\n ),\n }}\n />\n }\n options={[\n { label: t('stateWcCoveredOptions.yes'), value: true },\n { label: t('stateWcCoveredOptions.no'), value: false },\n ]}\n />\n {watchedStateWcCovered && (\n <ComboBoxField\n name=\"stateWcClassCode\"\n label={t('stateWcClassCodeLabel')}\n options={stateWcRiskOptions}\n errorMessage={t('validations.stateWcClassCode')}\n placeholder={t('stateWcClassCodeLabel')}\n />\n )}\n </>\n )}\n </>\n )\n}\n"],"names":["Edit","t","useTranslation","format","useNumberFormatter","Components","useComponentContext","stateWcRiskOptions","useMemo","WA_RISK_CLASS_CODES","code","description","control","register","setValue","errors","defaultValues","useFormContext","watchedFlsaStatus","useWatch","watchedStateWcCovered","currentJob","mode","minimumWages","handleFlsaChange","state","showTwoPercentStakeholder","useCompensation","useEffect","FlsaStatus","classificationOptions","key","paymentUnitOptions","PAY_PERIODS","isFlsaSelectionEnabled","isAdjustMinimumWageEnabled","rateErrorMessage","rateMinimumError","rateExemptThresholdError","FLSA_OVERTIME_SALARY_LIMIT","jsxs","Fragment","jsx","TextInputField","SelectField","Trans","NumberInputField","SwitchField","wage","CheckboxField","RadioGroupField","ComboBoxField"],"mappings":";;;;;;;;;;;;;;;;AA4BO,MAAMA,KAAO,MAAM;AACxB,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,uBAAuB,GAC9CC,IAASC,EAAmB,UAAU,GACtCC,IAAaC,EAAA,GAEbC,IAAqBC;AAAA,IACzB,MAAMC,EAAoB,IAAI,CAAC,EAAE,MAAAC,GAAM,aAAAC,EAAA,OAAmB,EAAE,OAAOD,GAAM,OAAOC,IAAc;AAAA,IAC9F,CAAA;AAAA,EAAC,GAGG;AAAA,IACJ,SAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAW,EAAE,QAAAC,GAAQ,eAAAC,EAAA;AAAA,EAAc,IACjCC,EAAA,GAEEC,IAAoBC,EAAS,EAAE,SAAAP,GAAS,MAAM,cAAc,GAC5DQ,IAAwBD,EAAS,EAAE,SAAAP,GAAS,MAAM,kBAAkB,GACpE,EAAE,YAAAS,GAAY,MAAAC,GAAM,cAAAC,GAAc,kB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AAAA,kBAAA;AAAA,gBAAA;AAAA,cACN;AAAA,YAEJ;AAAA,UAAA;AAAA,UAGJ,SAAS;AAAA,YACP,EAAE,OAAOJ,EAAE,2BAA2B,GAAG,OAAO,GAAA;AAAA,YAChD,EAAE,OAAOA,EAAE,0BAA0B,GAAG,OAAO,GAAA;AAAA,UAAM;AAAA,QACvD;AAAA,MAAA;AAAA,MAEDmB,KACC,gBAAAsB;AAAA,QAACS;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,OAAOlD,EAAE,uBAAuB;AAAA,UAChC,SAASM;AAAA,UACT,cAAcN,EAAE,8BAA8B;AAAA,UAC9C,aAAaA,EAAE,uBAAuB;AAAA,QAAA;AAAA,MAAA;AAAA,IACxC,EAAA,CAEJ;AAAA,EAAA,GAEJ;AAEJ;"}
|
|
@@ -3,12 +3,11 @@ import { useTranslation as p } from "react-i18next";
|
|
|
3
3
|
import { useCompensation as d } from "./useCompensation.js";
|
|
4
4
|
import C from "../../../assets/icons/pencil.svg.js";
|
|
5
5
|
import c from "../../../assets/icons/trashcan.svg.js";
|
|
6
|
-
import "classnames";
|
|
7
6
|
import { HamburgerMenu as f } from "../../Common/HamburgerMenu/HamburgerMenu.js";
|
|
8
7
|
import { useDataView as y } from "../../Common/DataView/useDataView.js";
|
|
9
8
|
import { DataView as g } from "../../Common/DataView/DataView.js";
|
|
10
|
-
const
|
|
11
|
-
const { employeeJobs: i, mode: o, isPending:
|
|
9
|
+
const D = () => {
|
|
10
|
+
const { employeeJobs: i, mode: o, isPending: l, handleEdit: r, handleDelete: s } = d(), { t } = p("Employee.Compensation"), { ...m } = y({
|
|
12
11
|
data: i,
|
|
13
12
|
columns: [
|
|
14
13
|
{
|
|
@@ -46,7 +45,7 @@ const P = () => {
|
|
|
46
45
|
label: t("allCompensations.editCta"),
|
|
47
46
|
icon: /* @__PURE__ */ a(C, { "aria-hidden": !0 }),
|
|
48
47
|
onClick: () => {
|
|
49
|
-
|
|
48
|
+
r(e.uuid);
|
|
50
49
|
}
|
|
51
50
|
},
|
|
52
51
|
...e.primary ? [] : [
|
|
@@ -59,7 +58,7 @@ const P = () => {
|
|
|
59
58
|
}
|
|
60
59
|
]
|
|
61
60
|
],
|
|
62
|
-
isLoading:
|
|
61
|
+
isLoading: l
|
|
63
62
|
}
|
|
64
63
|
)
|
|
65
64
|
});
|
|
@@ -67,6 +66,6 @@ const P = () => {
|
|
|
67
66
|
return /* @__PURE__ */ a(g, { "data-testid": "data-view", label: t("allCompensations.tableLabel"), ...m });
|
|
68
67
|
};
|
|
69
68
|
export {
|
|
70
|
-
|
|
69
|
+
D as List
|
|
71
70
|
};
|
|
72
71
|
//# sourceMappingURL=List.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.js","sources":["../../../../src/components/Employee/Compensation/List.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { type Job } from '@gusto/embedded-api/models/components/job'\nimport { useCompensation } from './useCompensation'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\nimport { DataView, useDataView } from '@/components/Common'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\n\nexport const List = () => {\n const { employeeJobs, mode, isPending, handleEdit, handleDelete } = useCompensation()\n const { t } = useTranslation('Employee.Compensation')\n\n const { ...dataViewProps } = useDataView({\n data: employeeJobs,\n columns: [\n {\n key: 'title',\n title: t('allCompensations.jobColumn'),\n render: (job: Job) => job.title || '',\n },\n {\n key: 'flsaStatus',\n title: t('allCompensations.typeColumn'),\n render: (job: Job) => {\n const flsaStatus = job.compensations?.find(\n comp => comp.uuid === job.currentCompensationUuid,\n )?.flsaStatus\n return flsaStatus !== undefined ? t(`flsaStatusLabels.${flsaStatus}`) : null\n },\n },\n {\n key: 'rate',\n title: t('allCompensations.amountColumn'),\n render: (job: Job) => job.rate?.toString() || '',\n },\n {\n key: 'paymentUnit',\n title: t('allCompensations.perColumn'),\n render: (job: Job) => job.paymentUnit || '',\n },\n ],\n itemMenu: (job: Job) => (\n <HamburgerMenu\n triggerLabel={t('hamburgerTitle')}\n items={[\n {\n label: t('allCompensations.editCta'),\n icon: <PencilSvg aria-hidden />,\n onClick: () => {\n handleEdit(job.uuid)\n },\n },\n ...(!job.primary\n ? [\n {\n label: t('allCompensations.deleteCta'),\n icon: <TrashCanSvg aria-hidden />,\n onClick: () => {\n handleDelete(job.uuid)\n },\n },\n ]\n : []),\n ]}\n isLoading={isPending}\n />\n ),\n })\n\n if (mode !== 'LIST') {\n return\n }\n\n return (\n <DataView data-testid=\"data-view\" label={t('allCompensations.tableLabel')} {...dataViewProps} />\n )\n}\n"],"names":["List","employeeJobs","mode","isPending","handleEdit","handleDelete","useCompensation","useTranslation","dataViewProps","useDataView","job","flsaStatus","comp","jsx","HamburgerMenu","PencilSvg","TrashCanSvg","DataView"],"mappings":"
|
|
1
|
+
{"version":3,"file":"List.js","sources":["../../../../src/components/Employee/Compensation/List.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { type Job } from '@gusto/embedded-api/models/components/job'\nimport { useCompensation } from './useCompensation'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\nimport { DataView, useDataView } from '@/components/Common'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\n\nexport const List = () => {\n const { employeeJobs, mode, isPending, handleEdit, handleDelete } = useCompensation()\n const { t } = useTranslation('Employee.Compensation')\n\n const { ...dataViewProps } = useDataView({\n data: employeeJobs,\n columns: [\n {\n key: 'title',\n title: t('allCompensations.jobColumn'),\n render: (job: Job) => job.title || '',\n },\n {\n key: 'flsaStatus',\n title: t('allCompensations.typeColumn'),\n render: (job: Job) => {\n const flsaStatus = job.compensations?.find(\n comp => comp.uuid === job.currentCompensationUuid,\n )?.flsaStatus\n return flsaStatus !== undefined ? t(`flsaStatusLabels.${flsaStatus}`) : null\n },\n },\n {\n key: 'rate',\n title: t('allCompensations.amountColumn'),\n render: (job: Job) => job.rate?.toString() || '',\n },\n {\n key: 'paymentUnit',\n title: t('allCompensations.perColumn'),\n render: (job: Job) => job.paymentUnit || '',\n },\n ],\n itemMenu: (job: Job) => (\n <HamburgerMenu\n triggerLabel={t('hamburgerTitle')}\n items={[\n {\n label: t('allCompensations.editCta'),\n icon: <PencilSvg aria-hidden />,\n onClick: () => {\n handleEdit(job.uuid)\n },\n },\n ...(!job.primary\n ? [\n {\n label: t('allCompensations.deleteCta'),\n icon: <TrashCanSvg aria-hidden />,\n onClick: () => {\n handleDelete(job.uuid)\n },\n },\n ]\n : []),\n ]}\n isLoading={isPending}\n />\n ),\n })\n\n if (mode !== 'LIST') {\n return\n }\n\n return (\n <DataView data-testid=\"data-view\" label={t('allCompensations.tableLabel')} {...dataViewProps} />\n )\n}\n"],"names":["List","employeeJobs","mode","isPending","handleEdit","handleDelete","useCompensation","useTranslation","dataViewProps","useDataView","job","flsaStatus","comp","jsx","HamburgerMenu","PencilSvg","TrashCanSvg","DataView"],"mappings":";;;;;;;;AAQO,MAAMA,IAAO,MAAM;AACxB,QAAM,EAAE,cAAAC,GAAc,MAAAC,GAAM,WAAAC,GAAW,YAAAC,GAAY,cAAAC,EAAA,IAAiBC,EAAA,GAC9D,EAAE,EAAA,IAAMC,EAAe,uBAAuB,GAE9C,EAAE,GAAGC,EAAA,IAAkBC,EAAY;AAAA,IACvC,MAAMR;AAAA,IACN,SAAS;AAAA,MACP;AAAA,QACE,KAAK;AAAA,QACL,OAAO,EAAE,4BAA4B;AAAA,QACrC,QAAQ,CAACS,MAAaA,EAAI,SAAS;AAAA,MAAA;AAAA,MAErC;AAAA,QACE,KAAK;AAAA,QACL,OAAO,EAAE,6BAA6B;AAAA,QACtC,QAAQ,CAACA,MAAa;AACpB,gBAAMC,IAAaD,EAAI,eAAe;AAAA,YACpC,CAAAE,MAAQA,EAAK,SAASF,EAAI;AAAA,UAAA,GACzB;AACH,iBAAOC,MAAe,SAAY,EAAE,oBAAoBA,CAAU,EAAE,IAAI;AAAA,QAC1E;AAAA,MAAA;AAAA,MAEF;AAAA,QACE,KAAK;AAAA,QACL,OAAO,EAAE,+BAA+B;AAAA,QACxC,QAAQ,CAACD,MAAaA,EAAI,MAAM,cAAc;AAAA,MAAA;AAAA,MAEhD;AAAA,QACE,KAAK;AAAA,QACL,OAAO,EAAE,4BAA4B;AAAA,QACrC,QAAQ,CAACA,MAAaA,EAAI,eAAe;AAAA,MAAA;AAAA,IAC3C;AAAA,IAEF,UAAU,CAACA,MACT,gBAAAG;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,cAAc,EAAE,gBAAgB;AAAA,QAChC,OAAO;AAAA,UACL;AAAA,YACE,OAAO,EAAE,0BAA0B;AAAA,YACnC,MAAM,gBAAAD,EAACE,GAAA,EAAU,eAAW,GAAA,CAAC;AAAA,YAC7B,SAAS,MAAM;AACb,cAAAX,EAAWM,EAAI,IAAI;AAAA,YACrB;AAAA,UAAA;AAAA,UAEF,GAAKA,EAAI,UAUL,CAAA,IATA;AAAA,YACE;AAAA,cACE,OAAO,EAAE,4BAA4B;AAAA,cACrC,MAAM,gBAAAG,EAACG,GAAA,EAAY,eAAW,GAAA,CAAC;AAAA,cAC/B,SAAS,MAAM;AACb,gBAAAX,EAAaK,EAAI,IAAI;AAAA,cACvB;AAAA,YAAA;AAAA,UACF;AAAA,QAED;AAAA,QAEP,WAAWP;AAAA,MAAA;AAAA,IAAA;AAAA,EACb,CAEH;AAED,MAAID,MAAS;AAIb,WACE,gBAAAW,EAACI,KAAS,eAAY,aAAY,OAAO,EAAE,6BAA6B,GAAI,GAAGT,GAAe;AAElG;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { IncludeDeductionsForm as m } from "./IncludeDeductionsForm/IncludeDeductionsForm.js";
|
|
3
3
|
import { DeductionsList as d } from "./DeductionsList/DeductionsList.js";
|
|
4
|
-
import {
|
|
4
|
+
import { DeductionsForm as i } from "./DeductionsForm/DeductionsForm.js";
|
|
5
5
|
import { useFlow as n } from "../../Flow/useFlow.js";
|
|
6
6
|
import { ensureRequired as r } from "../../../helpers/ensureRequired.js";
|
|
7
7
|
function D() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeductionsComponents.js","sources":["../../../../src/components/Employee/Deductions/DeductionsComponents.tsx"],"sourcesContent":["import type { Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { IncludeDeductionsForm } from './IncludeDeductionsForm/IncludeDeductionsForm'\nimport { DeductionsList } from './DeductionsList/DeductionsList'\nimport {
|
|
1
|
+
{"version":3,"file":"DeductionsComponents.js","sources":["../../../../src/components/Employee/Deductions/DeductionsComponents.tsx"],"sourcesContent":["import type { Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { IncludeDeductionsForm } from './IncludeDeductionsForm/IncludeDeductionsForm'\nimport { DeductionsList } from './DeductionsList/DeductionsList'\nimport { DeductionsForm } from './DeductionsForm/DeductionsForm'\nimport { useFlow, type FlowContextInterface } from '@/components/Flow/useFlow'\nimport type { componentEvents } from '@/shared/constants'\nimport { ensureRequired } from '@/helpers/ensureRequired'\n\nexport type EventPayloads = {\n [componentEvents.EMPLOYEE_DEDUCTION_INCLUDE_YES]: undefined\n [componentEvents.EMPLOYEE_DEDUCTION_INCLUDE_NO]: undefined\n [componentEvents.EMPLOYEE_DEDUCTION_ADD]: undefined\n [componentEvents.EMPLOYEE_DEDUCTION_CREATED]: Garnishment\n [componentEvents.EMPLOYEE_DEDUCTION_UPDATED]: Garnishment\n [componentEvents.EMPLOYEE_DEDUCTION_DELETED]: Garnishment\n [componentEvents.EMPLOYEE_DEDUCTION_EDIT]: Garnishment\n [componentEvents.EMPLOYEE_DEDUCTION_CANCEL]: undefined\n [componentEvents.EMPLOYEE_DEDUCTION_DONE]: undefined\n [componentEvents.CANCEL]: undefined\n}\n\nexport interface DeductionsContextInterface extends FlowContextInterface {\n employeeId: string\n currentDeductionId?: string | null\n hasExistingDeductions?: boolean\n}\n\nexport function IncludeDeductionsFormContextual() {\n const { employeeId, onEvent } = useFlow<DeductionsContextInterface>()\n return <IncludeDeductionsForm onEvent={onEvent} employeeId={ensureRequired(employeeId)} />\n}\n\nexport function DeductionsListContextual() {\n const { employeeId, onEvent } = useFlow<DeductionsContextInterface>()\n return <DeductionsList onEvent={onEvent} employeeId={ensureRequired(employeeId)} />\n}\n\nexport function DeductionFormContextual() {\n const { employeeId, onEvent, currentDeductionId } = useFlow<DeductionsContextInterface>()\n\n return (\n <DeductionsForm\n onEvent={onEvent}\n employeeId={ensureRequired(employeeId)}\n deductionId={currentDeductionId}\n />\n )\n}\n"],"names":["IncludeDeductionsFormContextual","employeeId","onEvent","useFlow","IncludeDeductionsForm","ensureRequired","DeductionsListContextual","DeductionsList","DeductionFormContextual","currentDeductionId","jsx","DeductionsForm"],"mappings":";;;;;;AA2BO,SAASA,IAAkC;AAChD,QAAM,EAAE,YAAAC,GAAY,SAAAC,EAAA,IAAYC,EAAA;AAChC,2BAAQC,GAAA,EAAsB,SAAAF,GAAkB,YAAYG,EAAeJ,CAAU,GAAG;AAC1F;AAEO,SAASK,IAA2B;AACzC,QAAM,EAAE,YAAAL,GAAY,SAAAC,EAAA,IAAYC,EAAA;AAChC,2BAAQI,GAAA,EAAe,SAAAL,GAAkB,YAAYG,EAAeJ,CAAU,GAAG;AACnF;AAEO,SAASO,IAA0B;AACxC,QAAM,EAAE,YAAAP,GAAY,SAAAC,GAAS,oBAAAO,EAAA,IAAuBN,EAAA;AAEpD,SACE,gBAAAO;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,SAAAT;AAAA,MACA,YAAYG,EAAeJ,CAAU;AAAA,MACrC,aAAaQ;AAAA,IAAA;AAAA,EAAA;AAGnB;"}
|
|
@@ -7,30 +7,30 @@ export declare const DeductionSchema: z.ZodObject<{
|
|
|
7
7
|
description: z.ZodString;
|
|
8
8
|
courtOrdered: z.ZodBoolean;
|
|
9
9
|
times: z.ZodNullable<z.ZodNumber>;
|
|
10
|
-
recurring: z.
|
|
10
|
+
recurring: z.ZodBoolean;
|
|
11
11
|
annualMaximum: z.ZodNullable<z.ZodEffects<z.ZodNumber, string | null, number>>;
|
|
12
12
|
payPeriodMaximum: z.ZodNullable<z.ZodEffects<z.ZodNumber, string | null, number>>;
|
|
13
|
-
deductAsPercentage: z.
|
|
13
|
+
deductAsPercentage: z.ZodBoolean;
|
|
14
14
|
}, "strip", z.ZodTypeAny, {
|
|
15
15
|
description: string;
|
|
16
16
|
active: boolean;
|
|
17
17
|
amount: string;
|
|
18
|
+
payPeriodMaximum: string | null;
|
|
18
19
|
recurring: boolean;
|
|
19
20
|
courtOrdered: boolean;
|
|
20
21
|
times: number | null;
|
|
21
22
|
annualMaximum: string | null;
|
|
22
|
-
payPeriodMaximum: string | null;
|
|
23
23
|
deductAsPercentage: boolean;
|
|
24
24
|
}, {
|
|
25
25
|
description: string;
|
|
26
26
|
active: boolean;
|
|
27
27
|
amount: number;
|
|
28
|
-
|
|
28
|
+
payPeriodMaximum: number | null;
|
|
29
|
+
recurring: boolean;
|
|
29
30
|
courtOrdered: boolean;
|
|
30
31
|
times: number | null;
|
|
31
32
|
annualMaximum: number | null;
|
|
32
|
-
|
|
33
|
-
deductAsPercentage: string;
|
|
33
|
+
deductAsPercentage: boolean;
|
|
34
34
|
}>;
|
|
35
35
|
export type DeductionInputs = z.input<typeof DeductionSchema>;
|
|
36
36
|
export type DeductionPayload = z.output<typeof DeductionSchema>;
|
|
@@ -14,21 +14,21 @@ export declare const DeductionSchema: z.ZodObject<{
|
|
|
14
14
|
description: string;
|
|
15
15
|
active: boolean;
|
|
16
16
|
amount: string;
|
|
17
|
+
payPeriodMaximum: string | null;
|
|
17
18
|
recurring: boolean;
|
|
18
19
|
courtOrdered: boolean;
|
|
19
20
|
times: number | null;
|
|
20
21
|
annualMaximum: string | null;
|
|
21
|
-
payPeriodMaximum: string | null;
|
|
22
22
|
deductAsPercentage: boolean;
|
|
23
23
|
}, {
|
|
24
24
|
description: string;
|
|
25
25
|
active: boolean;
|
|
26
26
|
amount: number;
|
|
27
|
+
payPeriodMaximum: number | null;
|
|
27
28
|
recurring: string;
|
|
28
29
|
courtOrdered: boolean;
|
|
29
30
|
times: number | null;
|
|
30
31
|
annualMaximum: number | null;
|
|
31
|
-
payPeriodMaximum: number | null;
|
|
32
32
|
deductAsPercentage: string;
|
|
33
33
|
}>;
|
|
34
34
|
export type DeductionInputs = z.input<typeof DeductionSchema>;
|
|
@@ -11,7 +11,6 @@ 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 "classnames";
|
|
15
14
|
import { ActionsLayout as J } from "../../../Common/ActionsLayout/ActionsLayout.js";
|
|
16
15
|
import { useComponentDictionary as K, useI18n as Q } from "../../../../i18n/I18n.js";
|
|
17
16
|
import { componentEvents as p } from "../../../../shared/constants.js";
|
|
@@ -31,7 +30,7 @@ const ee = i.object({
|
|
|
31
30
|
payPeriodMaximum: i.number().min(0).transform((t) => t > 0 ? t.toString() : null).nullable(),
|
|
32
31
|
deductAsPercentage: i.string().transform((t) => t === "true")
|
|
33
32
|
});
|
|
34
|
-
function
|
|
33
|
+
function Ce(t) {
|
|
35
34
|
return /* @__PURE__ */ n(z, { ...t, children: /* @__PURE__ */ n(ne, { ...t, children: t.children }) });
|
|
36
35
|
}
|
|
37
36
|
function ne({ className: t, children: b, employeeId: g, deductionId: h, dictionary: y }) {
|
|
@@ -130,6 +129,6 @@ function ne({ className: t, children: b, employeeId: g, deductionId: h, dictiona
|
|
|
130
129
|
}
|
|
131
130
|
export {
|
|
132
131
|
ee as DeductionSchema,
|
|
133
|
-
|
|
132
|
+
Ce as DeductionsForm
|
|
134
133
|
};
|
|
135
134
|
//# 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"],"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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AA,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,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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,30 +1,29 @@
|
|
|
1
|
-
import { jsx as n, jsxs as
|
|
2
|
-
import { useTranslation as
|
|
3
|
-
import { useGarnishmentsListSuspense as
|
|
4
|
-
import { useGarnishmentsUpdateMutation as
|
|
5
|
-
import { BaseComponent as
|
|
6
|
-
import { useBase as
|
|
7
|
-
import { Flex as
|
|
8
|
-
import "classnames";
|
|
1
|
+
import { jsx as n, jsxs as m, Fragment as P } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation as A } from "react-i18next";
|
|
3
|
+
import { useGarnishmentsListSuspense as O } from "@gusto/embedded-api/react-query/garnishmentsList";
|
|
4
|
+
import { useGarnishmentsUpdateMutation as w } from "@gusto/embedded-api/react-query/garnishmentsUpdate";
|
|
5
|
+
import { BaseComponent as N } from "../../../Base/Base.js";
|
|
6
|
+
import { useBase as _ } from "../../../Base/useBase.js";
|
|
7
|
+
import { Flex as k } from "../../../Common/Flex/Flex.js";
|
|
9
8
|
import { ActionsLayout as I } from "../../../Common/ActionsLayout/ActionsLayout.js";
|
|
10
|
-
import u from "
|
|
9
|
+
import u from "../../../../hooks/useNumberFormatter.js";
|
|
11
10
|
import M from "../../../../assets/icons/pencil.svg.js";
|
|
12
11
|
import U from "../../../../assets/icons/trashcan.svg.js";
|
|
13
12
|
import { useComponentDictionary as B, useI18n as S } from "../../../../i18n/I18n.js";
|
|
14
|
-
import { componentEvents as
|
|
15
|
-
import { useComponentContext as
|
|
16
|
-
import { HamburgerMenu as
|
|
17
|
-
import { useDataView as
|
|
18
|
-
import { DataView as
|
|
19
|
-
function
|
|
20
|
-
return /* @__PURE__ */ n(
|
|
13
|
+
import { componentEvents as c } from "../../../../shared/constants.js";
|
|
14
|
+
import { useComponentContext as V } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
15
|
+
import { HamburgerMenu as Y } from "../../../Common/HamburgerMenu/HamburgerMenu.js";
|
|
16
|
+
import { useDataView as q } from "../../../Common/DataView/useDataView.js";
|
|
17
|
+
import { DataView as F } from "../../../Common/DataView/DataView.js";
|
|
18
|
+
function ce(r) {
|
|
19
|
+
return /* @__PURE__ */ n(N, { ...r, children: /* @__PURE__ */ n(H, { ...r, children: r.children }) });
|
|
21
20
|
}
|
|
22
|
-
function
|
|
23
|
-
const { onEvent:
|
|
21
|
+
function H({ className: r, children: s, employeeId: d, dictionary: l }) {
|
|
22
|
+
const { onEvent: a, baseSubmitHandler: p } = _(), { t } = A("Employee.Deductions"), i = V(), D = u("currency"), h = u("percent");
|
|
24
23
|
B("Employee.Deductions", l), S("Employee.Deductions");
|
|
25
|
-
const { data:
|
|
24
|
+
const { data: E } = O({ employeeId: d }), f = E.garnishmentList.filter((e) => e.active), { mutateAsync: g, isPending: C } = w(), y = async (e) => {
|
|
26
25
|
await p(e, async (o) => {
|
|
27
|
-
const { garnishment:
|
|
26
|
+
const { garnishment: x } = await g({
|
|
28
27
|
request: {
|
|
29
28
|
garnishmentId: o.uuid,
|
|
30
29
|
requestBody: {
|
|
@@ -35,18 +34,21 @@ function V({ className: r, children: s, employeeId: d, dictionary: l }) {
|
|
|
35
34
|
}
|
|
36
35
|
}
|
|
37
36
|
});
|
|
38
|
-
|
|
37
|
+
a(c.EMPLOYEE_DEDUCTION_DELETED, x);
|
|
39
38
|
});
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
}, T = () => {
|
|
43
|
-
i(a.EMPLOYEE_DEDUCTION_ADD);
|
|
39
|
+
}, T = (e) => {
|
|
40
|
+
a(c.EMPLOYEE_DEDUCTION_EDIT, e);
|
|
44
41
|
}, b = () => {
|
|
45
|
-
|
|
46
|
-
},
|
|
47
|
-
|
|
42
|
+
a(c.EMPLOYEE_DEDUCTION_ADD);
|
|
43
|
+
}, v = () => {
|
|
44
|
+
a(c.EMPLOYEE_DEDUCTION_DONE);
|
|
45
|
+
}, { ...L } = q({
|
|
46
|
+
data: f,
|
|
48
47
|
columns: [
|
|
49
|
-
{
|
|
48
|
+
{
|
|
49
|
+
key: "description",
|
|
50
|
+
title: t("nameColumn")
|
|
51
|
+
},
|
|
50
52
|
{
|
|
51
53
|
key: "recurring",
|
|
52
54
|
title: t("frequencyColumn"),
|
|
@@ -56,20 +58,20 @@ function V({ className: r, children: s, employeeId: d, dictionary: l }) {
|
|
|
56
58
|
key: "amount",
|
|
57
59
|
title: t("withheldColumn"),
|
|
58
60
|
render: (e) => {
|
|
59
|
-
const o = e.deductAsPercentage ?
|
|
61
|
+
const o = e.deductAsPercentage ? h(Number(e.amount)) : D(Number(e.amount));
|
|
60
62
|
return e.recurring ? t("recurringAmount", { value: o }) : o;
|
|
61
63
|
}
|
|
62
64
|
}
|
|
63
65
|
],
|
|
64
66
|
itemMenu: (e) => /* @__PURE__ */ n(
|
|
65
|
-
|
|
67
|
+
Y,
|
|
66
68
|
{
|
|
67
|
-
isLoading:
|
|
69
|
+
isLoading: C,
|
|
68
70
|
items: [
|
|
69
71
|
{
|
|
70
72
|
label: t("editCta"),
|
|
71
73
|
onClick: () => {
|
|
72
|
-
|
|
74
|
+
T(e);
|
|
73
75
|
},
|
|
74
76
|
icon: /* @__PURE__ */ n(M, { "aria-hidden": !0 })
|
|
75
77
|
},
|
|
@@ -84,16 +86,18 @@ function V({ className: r, children: s, employeeId: d, dictionary: l }) {
|
|
|
84
86
|
}
|
|
85
87
|
)
|
|
86
88
|
});
|
|
87
|
-
return /* @__PURE__ */ n("section", { className: r, children: /* @__PURE__ */ n(
|
|
88
|
-
/* @__PURE__ */ n(
|
|
89
|
-
/* @__PURE__ */ n(
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
return /* @__PURE__ */ n("section", { className: r, children: /* @__PURE__ */ n(k, { flexDirection: "column", gap: 32, children: s || /* @__PURE__ */ m(P, { children: [
|
|
90
|
+
/* @__PURE__ */ n(i.Heading, { as: "h2", children: t("pageTitle") }),
|
|
91
|
+
/* @__PURE__ */ n(i.Text, { variant: "supporting", children: t("includeDeductionsDescriptionV2") }),
|
|
92
|
+
/* @__PURE__ */ n(i.Text, { weight: "bold", size: "lg", children: t("includeDeductionsSubtitle") }),
|
|
93
|
+
/* @__PURE__ */ n(F, { label: t("deductionsTableLabel"), ...L }),
|
|
94
|
+
/* @__PURE__ */ m(I, { children: [
|
|
95
|
+
/* @__PURE__ */ n(i.Button, { variant: "secondary", onClick: b, children: t("addDeductionCta") }),
|
|
96
|
+
/* @__PURE__ */ n(i.Button, { onClick: v, children: t("continueCta") })
|
|
93
97
|
] })
|
|
94
98
|
] }) }) });
|
|
95
99
|
}
|
|
96
100
|
export {
|
|
97
|
-
|
|
101
|
+
ce as DeductionsList
|
|
98
102
|
};
|
|
99
103
|
//# sourceMappingURL=DeductionsList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeductionsList.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsList/DeductionsList.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useGarnishmentsListSuspense } from '@gusto/embedded-api/react-query/garnishmentsList'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { useDataView, DataView } from '@/components/Common'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport useNumberFormatter from '@/
|
|
1
|
+
{"version":3,"file":"DeductionsList.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsList/DeductionsList.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useGarnishmentsListSuspense } from '@gusto/embedded-api/react-query/garnishmentsList'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { useDataView, DataView } from '@/components/Common'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport useNumberFormatter from '@/hooks/useNumberFormatter'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\ninterface DeductionsListProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n}\n\nexport function DeductionsList(props: DeductionsListProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ className, children, employeeId, dictionary }: DeductionsListProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n const formatCurrency = useNumberFormatter('currency')\n const formatPercent = useNumberFormatter('percent')\n\n useComponentDictionary('Employee.Deductions', dictionary)\n useI18n('Employee.Deductions')\n\n const { data } = useGarnishmentsListSuspense({ employeeId })\n const deductions = data.garnishmentList!\n const activeDeductions = deductions.filter(deduction => deduction.active)\n\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n\n const handleDelete = async (deduction: Garnishment) => {\n await baseSubmitHandler(deduction, async payload => {\n const { garnishment } = await updateDeduction({\n request: {\n garnishmentId: payload.uuid,\n requestBody: {\n ...payload,\n totalAmount: payload.totalAmount ?? undefined,\n active: false,\n version: payload.version as string,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DELETED, garnishment)\n })\n }\n\n const handleEdit = (deduction: Garnishment) => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_EDIT, deduction)\n }\n\n const handleAdd = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_ADD)\n }\n\n const handleContinue = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DONE)\n }\n\n const { ...dataViewProps } = useDataView({\n data: activeDeductions,\n columns: [\n {\n key: 'description',\n title: t('nameColumn'),\n },\n {\n key: 'recurring',\n title: t('frequencyColumn'),\n render: deduction => {\n return deduction.recurring ? t('recurringText') : t('nonRecurringText')\n },\n },\n {\n key: 'amount',\n title: t('withheldColumn'),\n render: deduction => {\n const formattedAmount = deduction.deductAsPercentage\n ? formatPercent(Number(deduction.amount))\n : formatCurrency(Number(deduction.amount))\n return deduction.recurring\n ? t('recurringAmount', { value: formattedAmount })\n : formattedAmount\n },\n },\n ],\n itemMenu: deduction => {\n return (\n <HamburgerMenu\n isLoading={isPendingUpdate}\n items={[\n {\n label: t('editCta'),\n onClick: () => {\n handleEdit(deduction)\n },\n icon: <PencilSvg aria-hidden />,\n },\n {\n label: t('deleteCta'),\n onClick: async () => {\n await handleDelete(deduction)\n },\n icon: <TrashCanSvg aria-hidden />,\n },\n ]}\n />\n )\n },\n })\n\n return (\n <section className={className}>\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\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 <DataView label={t('deductionsTableLabel')} {...dataViewProps} />\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleAdd}>\n {t('addDeductionCta')}\n </Components.Button>\n <Components.Button onClick={handleContinue}>{t('continueCta')}</Components.Button>\n </ActionsLayout>\n </>\n )}\n </Flex>\n </section>\n )\n}\n"],"names":["DeductionsList","props","jsx","BaseComponent","Root","className","children","employeeId","dictionary","onEvent","baseSubmitHandler","useBase","useTranslation","Components","useComponentContext","formatCurrency","useNumberFormatter","formatPercent","useComponentDictionary","useI18n","data","useGarnishmentsListSuspense","activeDeductions","deduction","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","handleDelete","payload","garnishment","componentEvents","handleEdit","handleAdd","handleContinue","dataViewProps","useDataView","formattedAmount","HamburgerMenu","PencilSvg","TrashCanSvg","Flex","jsxs","Fragment","DataView","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;AA0BO,SAASA,GAAeC,GAAqD;AAClF,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,UAAAC,GAAU,YAAAC,GAAY,YAAAC,KAAmC;AAClF,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,EAAA,GACjC,EAAE,EAAA,IAAMC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E,2BAA2B,EAAA,CAChC;AAAA,sBACC8B,GAAA,EAAS,OAAO,EAAE,sBAAsB,GAAI,GAAGT,GAAe;AAAA,sBAC9DU,GAAA,EACC,UAAA;AAAA,MAAA,gBAAA1C,EAACW,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASmB,GAC7C,UAAA,EAAE,iBAAiB,EAAA,CACtB;AAAA,MACA,gBAAA9B,EAACW,EAAW,QAAX,EAAkB,SAASoB,GAAiB,UAAA,EAAE,aAAa,EAAA,CAAE;AAAA,IAAA,EAAA,CAChE;AAAA,EAAA,EAAA,CACF,GAEJ,GACF;AAEJ;"}
|
|
@@ -6,14 +6,13 @@ import { zodResolver as h } from "@hookform/resolvers/zod";
|
|
|
6
6
|
import { BaseComponent as C } from "../../../Base/Base.js";
|
|
7
7
|
import { useBase as b } from "../../../Base/useBase.js";
|
|
8
8
|
import { Form as N } from "../../../Common/Form/Form.js";
|
|
9
|
-
import "classnames";
|
|
10
9
|
import { ActionsLayout as v } from "../../../Common/ActionsLayout/ActionsLayout.js";
|
|
11
10
|
import { useComponentDictionary as F, useI18n as I } from "../../../../i18n/I18n.js";
|
|
12
11
|
import { componentEvents as s } from "../../../../shared/constants.js";
|
|
13
12
|
import { useComponentContext as Y } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
13
|
import { RadioGroupField as y } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
15
14
|
const L = m.object({ includeDeductions: m.enum(["Yes", "No"]) });
|
|
16
|
-
function
|
|
15
|
+
function A(n) {
|
|
17
16
|
return /* @__PURE__ */ e(C, { ...n, children: /* @__PURE__ */ e(_, { ...n, children: n.children }) });
|
|
18
17
|
}
|
|
19
18
|
function _({ className: n, children: t, dictionary: u }) {
|
|
@@ -44,6 +43,6 @@ function _({ className: n, children: t, dictionary: u }) {
|
|
|
44
43
|
] }) }) }) });
|
|
45
44
|
}
|
|
46
45
|
export {
|
|
47
|
-
|
|
46
|
+
A as IncludeDeductionsForm
|
|
48
47
|
};
|
|
49
48
|
//# sourceMappingURL=IncludeDeductionsForm.js.map
|
package/dist/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IncludeDeductionsForm.js","sources":["../../../../../src/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { FormProvider, useForm, type SubmitHandler } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { Form } from '@/components/Common/Form'\nimport { RadioGroupField } from '@/components/Common'\nimport { ActionsLayout } from '@/components/Common'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\nconst IncludeDeductionsSchema = z.object({ includeDeductions: z.enum(['Yes', 'No']) })\nexport type IncludeDeductionsPayload = z.output<typeof IncludeDeductionsSchema>\n\ninterface IncludeDeductionsFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n}\n\nexport function IncludeDeductionsForm(props: IncludeDeductionsFormProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ className, children, dictionary }: IncludeDeductionsFormProps) {\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 formMethods = useForm<IncludeDeductionsPayload>({\n resolver: zodResolver(IncludeDeductionsSchema),\n defaultValues: { includeDeductions: 'No' },\n })\n\n const onSubmit: SubmitHandler<IncludeDeductionsPayload> = data => {\n if (data.includeDeductions === 'Yes') {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_INCLUDE_YES)\n } else {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_INCLUDE_NO)\n }\n }\n\n return (\n <section className={className}>\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n {children ? (\n children\n ) : (\n <>\n <Components.Heading as=\"h2\">{t('pageTitle')}</Components.Heading>\n <RadioGroupField\n name=\"includeDeductions\"\n isRequired\n label={t('includeDeductionsFormLabel')}\n description={t('includeDeductionsDescription')}\n options={[\n { value: 'Yes', label: t('includeDeductionsYes') },\n { value: 'No', label: t('includeDeductionsNo') },\n ]}\n />\n <ActionsLayout>\n <Components.Button type=\"submit\">{t('continueCta')}</Components.Button>\n </ActionsLayout>\n </>\n )}\n </Form>\n </FormProvider>\n </section>\n )\n}\n"],"names":["IncludeDeductionsSchema","z","IncludeDeductionsForm","props","jsx","BaseComponent","Root","className","children","dictionary","onEvent","useBase","t","useTranslation","Components","useComponentContext","useComponentDictionary","useI18n","formMethods","useForm","zodResolver","onSubmit","data","componentEvents","FormProvider","Form","jsxs","Fragment","RadioGroupField","ActionsLayout"],"mappings":"
|
|
1
|
+
{"version":3,"file":"IncludeDeductionsForm.js","sources":["../../../../../src/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { FormProvider, useForm, type SubmitHandler } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { Form } from '@/components/Common/Form'\nimport { RadioGroupField } from '@/components/Common'\nimport { ActionsLayout } from '@/components/Common'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\nconst IncludeDeductionsSchema = z.object({ includeDeductions: z.enum(['Yes', 'No']) })\nexport type IncludeDeductionsPayload = z.output<typeof IncludeDeductionsSchema>\n\ninterface IncludeDeductionsFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n}\n\nexport function IncludeDeductionsForm(props: IncludeDeductionsFormProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ className, children, dictionary }: IncludeDeductionsFormProps) {\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 formMethods = useForm<IncludeDeductionsPayload>({\n resolver: zodResolver(IncludeDeductionsSchema),\n defaultValues: { includeDeductions: 'No' },\n })\n\n const onSubmit: SubmitHandler<IncludeDeductionsPayload> = data => {\n if (data.includeDeductions === 'Yes') {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_INCLUDE_YES)\n } else {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_INCLUDE_NO)\n }\n }\n\n return (\n <section className={className}>\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n {children ? (\n children\n ) : (\n <>\n <Components.Heading as=\"h2\">{t('pageTitle')}</Components.Heading>\n <RadioGroupField\n name=\"includeDeductions\"\n isRequired\n label={t('includeDeductionsFormLabel')}\n description={t('includeDeductionsDescription')}\n options={[\n { value: 'Yes', label: t('includeDeductionsYes') },\n { value: 'No', label: t('includeDeductionsNo') },\n ]}\n />\n <ActionsLayout>\n <Components.Button type=\"submit\">{t('continueCta')}</Components.Button>\n </ActionsLayout>\n </>\n )}\n </Form>\n </FormProvider>\n </section>\n )\n}\n"],"names":["IncludeDeductionsSchema","z","IncludeDeductionsForm","props","jsx","BaseComponent","Root","className","children","dictionary","onEvent","useBase","t","useTranslation","Components","useComponentContext","useComponentDictionary","useI18n","formMethods","useForm","zodResol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AA4B;AAAA,QACrC,aAAaA,EAAE,8BAA8B;AAAA,QAC7C,SAAS;AAAA,UACP,EAAE,OAAO,OAAO,OAAOA,EAAE,sBAAsB,EAAA;AAAA,UAC/C,EAAE,OAAO,MAAM,OAAOA,EAAE,qBAAqB,EAAA;AAAA,QAAE;AAAA,MACjD;AAAA,IAAA;AAAA,IAEF,gBAAAR,EAACyB,GAAA,EACC,UAAA,gBAAAzB,EAACU,EAAW,QAAX,EAAkB,MAAK,UAAU,UAAAF,EAAE,aAAa,EAAA,CAAE,EAAA,CACrD;AAAA,EAAA,GACF,EAAA,CAEJ,GACF,GACF;AAEJ;"}
|
|
@@ -15,21 +15,21 @@ export declare const DeductionSchema: z.ZodObject<{
|
|
|
15
15
|
description: string;
|
|
16
16
|
active: boolean;
|
|
17
17
|
amount: string;
|
|
18
|
+
payPeriodMaximum: string | null;
|
|
18
19
|
recurring: boolean;
|
|
19
20
|
courtOrdered: boolean;
|
|
20
21
|
times: number | null;
|
|
21
22
|
annualMaximum: string | null;
|
|
22
|
-
payPeriodMaximum: string | null;
|
|
23
23
|
deductAsPercentage: boolean;
|
|
24
24
|
}, {
|
|
25
25
|
description: string;
|
|
26
26
|
active: boolean;
|
|
27
27
|
amount: number;
|
|
28
|
+
payPeriodMaximum: number | null;
|
|
28
29
|
recurring: string;
|
|
29
30
|
courtOrdered: boolean;
|
|
30
31
|
times: number | null;
|
|
31
32
|
annualMaximum: number | null;
|
|
32
|
-
payPeriodMaximum: number | null;
|
|
33
33
|
deductAsPercentage: string;
|
|
34
34
|
}>;
|
|
35
35
|
export type DeductionInputs = z.input<typeof DeductionSchema>;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation as r } from "react-i18next";
|
|
3
3
|
import { useDocumentList as s } from "./useDocumentList.js";
|
|
4
|
-
import "classnames";
|
|
5
4
|
import { ActionsLayout as m } from "../../../Common/ActionsLayout/ActionsLayout.js";
|
|
6
5
|
import { useComponentContext as c } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
7
|
-
function
|
|
8
|
-
const { t: n } = r("Employee.DocumentSigner"), { handleContinue: t, hasSignedAllForms:
|
|
9
|
-
return /* @__PURE__ */ o(m, { children: /* @__PURE__ */ o(
|
|
6
|
+
function d() {
|
|
7
|
+
const { t: n } = r("Employee.DocumentSigner"), { handleContinue: t, hasSignedAllForms: e } = s(), i = c();
|
|
8
|
+
return /* @__PURE__ */ o(m, { children: /* @__PURE__ */ o(i.Button, { onClick: t, isLoading: !1, isDisabled: !e, children: n("continueCta") }) });
|
|
10
9
|
}
|
|
11
10
|
export {
|
|
12
|
-
|
|
11
|
+
d as Actions
|
|
13
12
|
};
|
|
14
13
|
//# sourceMappingURL=Actions.js.map
|