@gusto/embedded-react-sdk 0.57.1 → 0.57.3
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 +33 -0
- package/dist/components/Base/Base.js +2 -3
- package/dist/components/Base/Base.js.map +1 -1
- package/dist/components/Common/DateRangeFilter/DateRangeFilter.js +32 -32
- package/dist/components/Common/DateRangeFilter/DateRangeFilter.js.map +1 -1
- package/dist/components/Common/OnboardingStatusBadge/index.js.map +1 -1
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +6 -8
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +8 -10
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +3 -6
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +6 -8
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +3 -6
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/TitleSelect.js +10 -11
- package/dist/components/Company/AssignSignatory/TitleSelect.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +5 -8
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +8 -9
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +3 -6
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js +10 -12
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +11 -13
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +5 -7
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +3 -6
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/FederalTaxes/Actions.js +7 -9
- package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +8 -11
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Actions.js +5 -7
- package/dist/components/Company/Industry/Actions.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +6 -9
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Industry/Edit.js +10 -12
- package/dist/components/Company/Industry/Edit.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Actions.js +8 -10
- package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +3 -6
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/Actions.js +6 -8
- package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/List.js +11 -13
- package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +3 -6
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +3 -6
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/PayScheduleForm.js +66 -62
- package/dist/components/Company/PaySchedule/PayScheduleForm.js.map +1 -1
- package/dist/components/Company/PaySchedule/PayScheduleForm.module.scss.js +2 -2
- package/dist/components/Company/PaySchedule/management/AutoPilotDialog/AutoPilotDialog.js.map +1 -1
- package/dist/components/Company/PaySchedule/management/AutoPilotDialog/useAutoPilotDialog.js.map +1 -1
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentCompensationStepPresentation.js +34 -14
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentCompensationStepPresentation.js.map +1 -1
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentDepartmentStepPresentation.js +106 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentDepartmentStepPresentation.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentEmployeeStepPresentation.js +136 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentEmployeeStepPresentation.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentScheduleStepPresentation.js +38 -20
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentScheduleStepPresentation.js.map +1 -1
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentTypeStepPresentation.js +78 -44
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentTypeStepPresentation.js.map +1 -1
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignment.js +45 -37
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignment.js.map +1 -1
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignmentComponents.js +253 -92
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignmentComponents.js.map +1 -1
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/departmentAccess.js +22 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/departmentAccess.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/employeeJob.js +13 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/employeeJob.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/payScheduleAssignmentStateMachine.js +48 -43
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/payScheduleAssignmentStateMachine.js.map +1 -1
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/scheduleLabel.js.map +1 -1
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/useAssignableEmployees.js +57 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/useAssignableEmployees.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleCompensationOverviewPresentation.js +11 -13
- package/dist/components/Company/PaySchedule/management/PayScheduleCompensationOverviewPresentation.js.map +1 -1
- package/dist/components/Company/PaySchedule/management/PayScheduleDepartmentOverviewPresentation.js +83 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleDepartmentOverviewPresentation.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleEmployeeOverviewPresentation.js +84 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleEmployeeOverviewPresentation.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleManagementComponents.js +49 -44
- package/dist/components/Company/PaySchedule/management/PayScheduleManagementComponents.js.map +1 -1
- package/dist/components/Company/PaySchedule/management/PayScheduleOverview.js +109 -39
- package/dist/components/Company/PaySchedule/management/PayScheduleOverview.js.map +1 -1
- package/dist/components/Company/PaySchedule/management/PayScheduleOverviewPresentation.js.map +1 -1
- package/dist/components/Company/PaySchedule/management/payScheduleManagementStateMachine.js.map +1 -1
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +5 -7
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +3 -6
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +6 -8
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +3 -6
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/TaxRateManagement/context.js +3 -6
- package/dist/components/Company/StateTaxes/TaxRateManagement/context.js.map +1 -1
- package/dist/components/Contractor/Address/shared/useContractorAddressForm/useContractorAddressForm.js +5 -5
- package/dist/components/Contractor/Address/shared/useContractorAddressForm/useContractorAddressForm.js.map +1 -1
- package/dist/components/Contractor/Address/shared/useContractorAddressSummary/useContractorAddressSummary.js +1 -1
- package/dist/components/Contractor/Address/shared/useContractorAddressSummary/useContractorAddressSummary.js.map +1 -1
- package/dist/components/Contractor/Compensation/management/CompensationCard/CompensationCard.js +16 -17
- package/dist/components/Contractor/Compensation/management/CompensationCard/CompensationCard.js.map +1 -1
- package/dist/components/Contractor/Compensation/shared/useContractorCompensationSummary/useContractorCompensationSummary.js +4 -4
- package/dist/components/Contractor/Compensation/shared/useContractorCompensationSummary/useContractorCompensationSummary.js.map +1 -1
- package/dist/components/Contractor/Compensation/shared/useContractorPayForm/useContractorPayForm.js +3 -3
- package/dist/components/Contractor/Compensation/shared/useContractorPayForm/useContractorPayForm.js.map +1 -1
- package/dist/components/Contractor/ContractorList/shared/useContractorList.js +6 -6
- package/dist/components/Contractor/ContractorList/shared/useContractorList.js.map +1 -1
- package/dist/components/Contractor/Dashboard/Dashboard.js +20 -20
- package/dist/components/Contractor/Dashboard/Dashboard.js.map +1 -1
- package/dist/components/Contractor/Dismissal/useDismissal/useDismissal.js +10 -10
- package/dist/components/Contractor/Dismissal/useDismissal/useDismissal.js.map +1 -1
- package/dist/components/Contractor/Documents/management/DocumentsCard/DocumentsCard.js +8 -9
- package/dist/components/Contractor/Documents/management/DocumentsCard/DocumentsCard.js.map +1 -1
- package/dist/components/Contractor/Landing/Landing.js +43 -39
- package/dist/components/Contractor/Landing/Landing.js.map +1 -1
- package/dist/components/Contractor/NewHireReport/NewHireReport.js +3 -3
- package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/shared/ContractorBankAccountFormBody/ContractorBankAccountFormBody.js +6 -8
- package/dist/components/Contractor/PaymentMethod/shared/ContractorBankAccountFormBody/ContractorBankAccountFormBody.js.map +1 -1
- package/dist/components/Contractor/Payments/CreateHistoricalPayment/CreateHistoricalPayment.js +1 -1
- package/dist/components/Contractor/Payments/CreateHistoricalPayment/CreateHistoricalPayment.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js +10 -10
- package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js.map +1 -1
- package/dist/components/Contractor/Payments/HistoricalPaymentSummary/HistoricalPaymentSummary.js +4 -4
- package/dist/components/Contractor/Payments/HistoricalPaymentSummary/HistoricalPaymentSummary.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.js +8 -8
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.js +5 -5
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummary.js +3 -3
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummary.js.map +1 -1
- package/dist/components/Contractor/Profile/management/ProfileCard/ProfileCard.js +26 -27
- package/dist/components/Contractor/Profile/management/ProfileCard/ProfileCard.js.map +1 -1
- package/dist/components/Contractor/Profile/management/ProfileEditForm.js +11 -11
- package/dist/components/Contractor/Profile/onboarding/SelfOnboardingContractorProfile.js +1 -1
- package/dist/components/Contractor/Profile/onboarding/SelfOnboardingContractorProfile.js.map +1 -1
- package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/useContractorDetailsForm.js +1 -1
- package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/useContractorDetailsForm.js.map +1 -1
- package/dist/components/Contractor/Profile/shared/useContractorProfileSummary/useContractorProfileSummary.js +1 -1
- package/dist/components/Contractor/Profile/shared/useContractorProfileSummary/useContractorProfileSummary.js.map +1 -1
- package/dist/components/Contractor/SelfOnboardingFlow/SelfOnboardingComponents.js +2 -9
- package/dist/components/Contractor/SelfOnboardingFlow/SelfOnboardingComponents.js.map +1 -1
- package/dist/components/Contractor/Submit/Submit.js +18 -18
- package/dist/components/Contractor/Submit/Submit.js.map +1 -1
- package/dist/components/Contractor/shared/SelectContractors/useSelectContractors.js +6 -6
- package/dist/components/Contractor/shared/SelectContractors/useSelectContractors.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/useCompensationForm/useCompensationForm.js +25 -25
- package/dist/components/Employee/Compensation/shared/useCompensationForm/useCompensationForm.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/useCompensationManagement/useCompensationManagement.js +15 -15
- package/dist/components/Employee/Compensation/shared/useCompensationManagement/useCompensationManagement.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.js +1 -1
- package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.js.map +1 -1
- package/dist/components/Employee/Dashboard/Dashboard.js +25 -25
- package/dist/components/Employee/Dashboard/Dashboard.js.map +1 -1
- package/dist/components/Employee/Deductions/management/DeductionsCard/DeductionsCard.js +12 -13
- package/dist/components/Employee/Deductions/management/DeductionsCard/DeductionsCard.js.map +1 -1
- package/dist/components/Employee/Documents/management/DocumentsCard/DocumentsCard.js +12 -13
- package/dist/components/Employee/Documents/management/DocumentsCard/DocumentsCard.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/Actions.js +6 -8
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +3 -6
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentSigner.js +7 -7
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentSigner.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/EmployeeDocuments/EmployeeDocuments.js +1 -1
- package/dist/components/Employee/Documents/onboarding/EmployeeDocuments/EmployeeDocuments.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/management/FederalTaxesEditForm.js +3 -4
- package/dist/components/Employee/FederalTaxes/management/FederalTaxesEditForm.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/onboarding/FederalTaxes.js +3 -4
- package/dist/components/Employee/FederalTaxes/onboarding/FederalTaxes.js.map +1 -1
- package/dist/components/Employee/HomeAddress/management/useHomeAddressManagement.js +6 -6
- package/dist/components/Employee/HomeAddress/management/useHomeAddressManagement.js.map +1 -1
- package/dist/components/Employee/Landing/Landing.js +37 -33
- package/dist/components/Employee/Landing/Landing.js.map +1 -1
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +27 -27
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/shared/BankFormBody/BankFormBody.js +22 -24
- package/dist/components/Employee/PaymentMethod/shared/BankFormBody/BankFormBody.js.map +1 -1
- package/dist/components/Employee/Paystubs/management/PaystubsCard/PaystubsCard.js +8 -9
- package/dist/components/Employee/Paystubs/management/PaystubsCard/PaystubsCard.js.map +1 -1
- package/dist/components/Employee/Profile/management/ProfileCard/ProfileCard.js +14 -15
- package/dist/components/Employee/Profile/management/ProfileCard/ProfileCard.js.map +1 -1
- package/dist/components/Employee/Profile/management/ProfileEditForm.js +1 -1
- package/dist/components/Employee/Profile/onboarding/EmployeeProfile.js +1 -1
- package/dist/components/Employee/Profile/shared/useEmployeeDetailsForm/useEmployeeDetailsForm.js +6 -6
- package/dist/components/Employee/Profile/shared/useEmployeeDetailsForm/useEmployeeDetailsForm.js.map +1 -1
- package/dist/components/Employee/Profile/shared/useEmployeeProfileSummary/useEmployeeProfileSummary.js +1 -1
- package/dist/components/Employee/Profile/shared/useEmployeeProfileSummary/useEmployeeProfileSummary.js.map +1 -1
- package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingComponents.js +8 -15
- package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingComponents.js.map +1 -1
- package/dist/components/Employee/StateTaxes/management/StateTaxesEditForm.js +7 -8
- package/dist/components/Employee/StateTaxes/management/StateTaxesEditForm.js.map +1 -1
- package/dist/components/Employee/StateTaxes/onboarding/StateTaxes.js +7 -8
- package/dist/components/Employee/StateTaxes/onboarding/StateTaxes.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.js +11 -11
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummary.js +12 -12
- package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummary.js.map +1 -1
- package/dist/components/Employee/WorkAddress/management/useWorkAddressManagement.js +26 -26
- package/dist/components/Employee/WorkAddress/management/useWorkAddressManagement.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js +56 -54
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -1
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js +14 -16
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js.map +1 -1
- package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js +6 -8
- package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js.map +1 -1
- package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js +9 -11
- package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +66 -64
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +1 -1
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +6 -6
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/usePayrollEditEmployeeForm.js +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/usePayrollEditEmployeeForm.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistory.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +75 -89
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +9 -9
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +44 -46
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
- package/dist/components/Payroll/TransitionCreation/TransitionCreation.js +63 -61
- package/dist/components/Payroll/TransitionCreation/TransitionCreation.js.map +1 -1
- package/dist/components/Payroll/TransitionPayroll/useResolveTransitionPayroll.js +14 -13
- package/dist/components/Payroll/TransitionPayroll/useResolveTransitionPayroll.js.map +1 -1
- package/dist/components/Payroll/helpers.js +53 -49
- package/dist/components/Payroll/helpers.js.map +1 -1
- package/dist/components/Payroll/payrollTypes.js +1 -1
- package/dist/components/Payroll/payrollTypes.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +13 -16
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/components/Payroll/useUnprocessedTransitionPayPeriods.js +2 -2
- package/dist/components/Payroll/useUnprocessedTransitionPayPeriods.js.map +1 -1
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetailPresentation.js +2 -4
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetailPresentation.js.map +1 -1
- package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.js +6 -8
- package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.js.map +1 -1
- package/dist/components/TimeOff/shared/PolicyDetailLayout/PolicyDetailLayout.js +28 -30
- package/dist/components/TimeOff/shared/PolicyDetailLayout/PolicyDetailLayout.js.map +1 -1
- package/dist/contexts/ApiProvider/payrollOffCycleReasonEnumHook.js +1 -1
- package/dist/contexts/ApiProvider/payrollOffCycleReasonEnumHook.js.map +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +2 -4
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/helpers/dateFormatting.js +47 -40
- package/dist/helpers/dateFormatting.js.map +1 -1
- package/dist/i18n/en/Company.Management.PaySchedule.json.js +37 -17
- package/dist/i18n/en/Company.Management.PaySchedule.json.js.map +1 -1
- package/dist/i18n/en/Company.Management.PayScheduleAssignment.json.js +20 -10
- package/dist/i18n/en/Company.Management.PayScheduleAssignment.json.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollHistory.json.js +5 -5
- package/dist/i18n/en/Payroll.PayrollList.json.js +5 -5
- package/dist/i18n/en/Payroll.PayrollOverview.json.js +1 -1
- package/dist/package.json.js +1 -1
- package/dist/partner-hook-utils/form/fields/CheckboxHookField.js +8 -10
- package/dist/partner-hook-utils/form/fields/CheckboxHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/NumberInputHookField.js +12 -14
- package/dist/partner-hook-utils/form/fields/NumberInputHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/RadioGroupHookField.js +13 -15
- package/dist/partner-hook-utils/form/fields/RadioGroupHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/SelectHookField.js +10 -12
- package/dist/partner-hook-utils/form/fields/SelectHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/SwitchHookField.js +14 -16
- package/dist/partner-hook-utils/form/fields/SwitchHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/TextInputHookField.js +8 -10
- package/dist/partner-hook-utils/form/fields/TextInputHookField.js.map +1 -1
- package/dist/shared/constants.js +5 -5
- package/dist/shared/constants.js.map +1 -1
- package/dist/src/components/Common/DateRangeFilter/DateRangeFilter.d.ts +2 -2
- package/dist/src/components/Common/OnboardingStatusBadge/index.d.ts +1 -1
- package/dist/src/components/Company/PaySchedule/PayScheduleForm.d.ts +6 -0
- package/dist/src/components/Company/PaySchedule/management/AutoPilotDialog/AutoPilotDialog.d.ts +1 -1
- package/dist/src/components/Company/PaySchedule/management/AutoPilotDialog/useAutoPilotDialog.d.ts +1 -1
- package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentCompensationStepPresentation.d.ts +10 -3
- package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentDepartmentStepPresentation.d.ts +21 -0
- package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentEmployeeStepPresentation.d.ts +34 -0
- package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentScheduleStepPresentation.d.ts +9 -3
- package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentTypeStepPresentation.d.ts +5 -1
- package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignment.d.ts +10 -10
- package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignmentComponents.d.ts +12 -4
- package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/departmentAccess.d.ts +19 -0
- package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/employeeJob.d.ts +17 -0
- package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/scheduleLabel.d.ts +1 -1
- package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/useAssignableEmployees.d.ts +34 -0
- package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/usePayScheduleAssignment.d.ts +16 -3
- package/dist/src/components/Company/PaySchedule/management/PayScheduleCompensationOverviewPresentation.d.ts +1 -1
- package/dist/src/components/Company/PaySchedule/management/PayScheduleDepartmentOverviewPresentation.d.ts +23 -0
- package/dist/src/components/Company/PaySchedule/management/PayScheduleEmployeeOverviewPresentation.d.ts +25 -0
- package/dist/src/components/Company/PaySchedule/management/PayScheduleManagementComponents.d.ts +1 -1
- package/dist/src/components/Company/PaySchedule/management/PayScheduleOverviewPresentation.d.ts +1 -1
- package/dist/src/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.d.ts +1 -1
- package/dist/src/components/Contractor/Landing/Landing.d.ts +5 -2
- package/dist/src/components/Employee/Landing/Landing.d.ts +5 -2
- package/dist/src/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +1 -1
- package/dist/src/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.d.ts +1 -1
- package/dist/src/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.d.ts +1 -1
- package/dist/src/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/usePayrollEditEmployeeForm.d.ts +2 -2
- package/dist/src/components/Payroll/PayrollHistory/PayrollHistoryPresentation.d.ts +1 -1
- package/dist/src/components/Payroll/PayrollList/PayrollListPresentation.d.ts +2 -2
- package/dist/src/components/Payroll/PayrollOverview/PayrollOverviewPresentation.d.ts +1 -1
- package/dist/src/components/Payroll/helpers.d.ts +22 -2
- package/dist/src/components/Payroll/usePreparedPayrollData.d.ts +2 -2
- package/dist/src/helpers/dateFormatting.d.ts +13 -0
- package/dist/src/i18n/types.d.ts +96 -6
- package/dist/src/models/external.d.ts +63 -48
- package/dist/src/shared/constants.d.ts +1 -1
- package/dist/style.css +1 -1
- package/docs/guides/endpoint-inventory.json +33 -13
- package/package.json +21 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePayrollEditEmployeeForm.js","sources":["../../../../../../src/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/usePayrollEditEmployeeForm.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { useFieldArray, useForm, useWatch } from 'react-hook-form'\nimport type { UseFormProps } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useEmployeesGetSuspense } from '@gusto/embedded-api/react-query/employeesGet'\nimport { useEmployeePaymentMethodsGetBankAccountsSuspense } from '@gusto/embedded-api/react-query/employeePaymentMethodsGetBankAccounts'\nimport { useEarningTypesListSuspense } from '@gusto/embedded-api/react-query/earningTypesList'\nimport { usePayrollsGetSuspense } from '@gusto/embedded-api/react-query/payrollsGet'\nimport { usePayrollsPrepareMutation } from '@gusto/embedded-api/react-query/payrollsPrepare'\nimport { usePaySchedulesGet } from '@gusto/embedded-api/react-query/paySchedulesGet'\nimport { usePayrollsUpdateMutation } from '@gusto/embedded-api/react-query/payrollsUpdate'\nimport type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport type { PayrollEmployeeCompensationsType } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype'\nimport type { PayrollPrepared } from '@gusto/embedded-api/models/components/payrollshow'\nimport type { PayScheduleShow } from '@gusto/embedded-api/models/components/payscheduleshow'\nimport { UnprocessableEntityError } from '@gusto/embedded-api/models/errors/unprocessableentityerror'\nimport {\n createPayrollEditEmployeeSchema,\n PAYMENT_METHOD_OPTIONS,\n PAYMENT_METHOD_VALUES,\n PayrollEditEmployeeErrorCodes,\n reimbursementDraftSchema,\n type PayrollEditEmployeeFormData,\n type PayrollEditEmployeeFormOutputs,\n} from './payrollEditEmployeeSchema'\nimport {\n buildPayrollUpdateEmployeeCompensation,\n collectOvertimeEarningNames,\n derivePayrollEditEmployeeDefaults,\n hasBreakdownsMatchingWorkweeks,\n hasExistingOvertimeHours,\n normalizeWorkweeks,\n resolveEditableFixedCompensations,\n zeroFillClearedWorkweekCells,\n type NormalizedWorkweek,\n} from './payrollEditEmployeeHelpers'\nimport {\n computeTimeOffRemaining,\n createPayrollEditEmployeeFields,\n createReimbursementDraftFields,\n type PayrollEditEmployeeErrorMessages,\n type PayrollEditEmployeeFields,\n type ReimbursementDraftFields,\n type ReimbursementRow,\n} from './fields'\nimport { withOptions } from '@/partner-hook-utils/form/withOptions'\nimport {\n derivePayrollCategory,\n isOffCyclePayroll,\n PayrollCategory,\n} from '@/components/Payroll/payrollTypes'\nimport { PREPARE_QUERY_KEY } from '@/components/Payroll/PayrollConfiguration/usePayrollConfigurationData'\nimport { isOvertimeEligibleFlsaStatus } from '@/components/Payroll/helpers'\nimport { retryAsync } from '@/helpers/retryAsync'\nimport { useHookFormInternals } from '@/partner-hook-utils/form/useHookFormInternals'\nimport { createGetFormSubmissionValues } from '@/partner-hook-utils/form/getFormSubmissionValues'\nimport {\n composeErrorHandler,\n type QueryWithRefetch,\n} from '@/partner-hook-utils/composeErrorHandler'\nimport type {\n BaseFormHookReady,\n FieldMetadata,\n FieldMetadataWithOptions,\n HookLoadingResult,\n HookSubmitResult,\n} from '@/partner-hook-utils/types'\nimport { useBaseSubmit } from '@/components/Base/useBaseSubmit'\nimport { SDKInternalError } from '@/types/sdkError'\n\nconst PREPARE_MAX_ATTEMPTS = 4\nconst PREPARE_RETRY_DELAY_MS = 1500\n\nconst isPayrollBeingProcessedError = (error: unknown): boolean =>\n error instanceof UnprocessableEntityError &&\n error.errors.some(issue => issue.category === 'invalid_operation')\n\n/**\n * Options accepted by {@link usePayrollEditEmployeeForm}.\n *\n * @public\n */\nexport interface UsePayrollEditEmployeeFormProps {\n /** The associated employee identifier. */\n employeeId: string\n /** The associated company identifier. */\n companyId: string\n /** The associated payroll identifier. */\n payrollId: string\n /**\n * Whether to expose reimbursement controls (`form.Fields.reimbursements`,\n * `actions.addReimbursement`/`removeReimbursement`, `form.reimbursements`).\n * Defaults to `true`. Controls are omitted for off-cycle payrolls regardless,\n * since those write reimbursements via the legacy fixed-compensation path.\n */\n withReimbursements?: boolean\n /** When validation runs. Passed through to react-hook-form. Defaults to `'onSubmit'`. */\n validationMode?: UseFormProps['mode']\n /** Auto-focus the first invalid field on submit. Defaults to `true`. Set to `false` when composing with other forms. */\n shouldFocusError?: boolean\n /**\n * Display copy for each validation error code, baked into every bound field so\n * it resolves and renders its own message. Supply it once, keyed by\n * {@link PayrollEditEmployeeErrorCodes}; a missing code falls back to the raw\n * code. Omit it to render raw codes.\n */\n errorMessages?: PayrollEditEmployeeErrorMessages\n}\n\n/**\n * Field metadata for {@link usePayrollEditEmployeeForm}, keyed by full form path.\n *\n * @remarks\n * Keys are minted from the prepared payroll's compensations at runtime\n * (`hours.${jobUuid}.${name}.${workweekStart}` and similar), so neither the key\n * set nor which entries carry options is known ahead of time.\n *\n * @public\n */\nexport type PayrollEditEmployeeFieldsMetadata = Record<\n string,\n FieldMetadata | FieldMetadataWithOptions\n>\n\n/**\n * Ready-state return value of {@link usePayrollEditEmployeeForm} — the\n * `isLoading: false` branch of {@link UsePayrollEditEmployeeFormResult}.\n *\n * @public\n */\nexport interface UsePayrollEditEmployeeFormReady extends BaseFormHookReady<\n PayrollEditEmployeeFieldsMetadata,\n PayrollEditEmployeeFormData,\n PayrollEditEmployeeFields\n> {\n /** Loaded entities backing the editor. */\n data: {\n /** The employee being edited. */\n employee: Employee\n /** The employee's prepared compensation for this payroll, if present. */\n employeeCompensation?: PayrollEmployeeCompensationsType\n /** The prepared payroll (server-calculated totals and workweeks). */\n preparedPayroll: PayrollPrepared\n /** The pay schedule for the payroll, if loaded. */\n paySchedule?: PayScheduleShow\n /** Whether the pay period spans more than one workweek. Raw workweeks are on `preparedPayroll.workweeks`. */\n isMultipleWorkweeks: boolean\n /**\n * The pay period's normalized workweeks (`{ startDate, endDate }` strings),\n * in order — one entry, spanning the pay period, when it's a single\n * workweek. The per-workweek split fields are keyed by start date only, so\n * this is the source for each column's date range.\n */\n workweeks: NormalizedWorkweek[]\n /** Whether the employee is overtime-eligible (nonexempt family). Drives whether hours split by workweek. */\n isOvertimeEligible: boolean\n /**\n * The single, form-wide overtime-mode flag. `false` renders one flat\n * column per line with Overtime/Double-overtime rows hidden; `true`\n * splits hours and overtime-affecting earnings into per-workweek columns\n * (for overtime-eligible employees on a multi-workweek payroll) and\n * un-hides those rows. Starts `true` when the employee already has real\n * overtime hours or matching per-workweek breakdowns (see\n * `hasExistingOvertimeHours`, `hasBreakdownsMatchingWorkweeks`), or after\n * `actions.addOvertime` is called; otherwise starts `false`.\n */\n withOvertime: boolean\n /** Whether the employee has a direct-deposit bank account set up. */\n hasDirectDepositSetup: boolean\n /**\n * Committed reimbursement rows to render in a table, present only when\n * reimbursement controls are exposed. Seeded from the employee's existing\n * reimbursements and appended to as drafts are saved. Remove a row via\n * `actions.removeReimbursement(row.index)`.\n */\n reimbursements?: ReimbursementRow[]\n }\n /** Submission status. `mode` is always `'update'` since the payroll already exists. */\n status: { isPending: boolean; mode: 'update' }\n /** Form actions. */\n actions: {\n /** Validates and submits the form, resolving to the updated prepared payroll on success or `undefined` when validation blocked the submit. */\n onSubmit: () => Promise<HookSubmitResult<PayrollPrepared> | undefined>\n /**\n * Sets `data.withOvertime` to `true`, switching the whole form to the\n * workweek split: un-hides Overtime/Double-overtime rows and splits hours\n * and overtime-affecting earnings into per-workweek columns. Populates\n * only the first workweek cell of each line with that line's current\n * total, leaving every other cell blank — no auto distribution — so the\n * per-row validation then requires the user to fill in the rest. One\n * affordance for the whole employee, not one per job. One-directional —\n * there's no corresponding \"remove overtime\" action.\n */\n addOvertime: () => void\n /** Reveals the draft reimbursement row. Present only when reimbursement controls are exposed. */\n beginAddReimbursement?: () => void\n /** Validates the draft and commits it to the reimbursement list, or flags the draft amount if invalid. Present only when reimbursement controls are exposed. */\n saveReimbursement?: () => void\n /** Discards the draft reimbursement row. Present only when reimbursement controls are exposed. */\n cancelReimbursement?: () => void\n /** Removes the committed reimbursement row at `index` (zeroing existing rows so the update clears them). Present only when reimbursement controls are exposed. */\n removeReimbursement?: (index: number) => void\n }\n /** Form internals plus the reimbursement draft state. */\n form: BaseFormHookReady<\n PayrollEditEmployeeFieldsMetadata,\n PayrollEditEmployeeFormData,\n PayrollEditEmployeeFields\n >['form'] & {\n /** Draft reimbursement state, present only when reimbursement controls are exposed. */\n reimbursementDraft?: { isAdding: boolean }\n }\n}\n\n/**\n * Discriminated union returned by {@link usePayrollEditEmployeeForm}. Loading\n * branch carries only `errorHandling`; ready branch carries form data, fields,\n * status, and actions.\n *\n * @public\n */\nexport type UsePayrollEditEmployeeFormResult = HookLoadingResult | UsePayrollEditEmployeeFormReady\n\n/**\n * Headless form hook for editing a single employee's compensation within a\n * payroll run, built for regular-rate-of-pay (RRoP) support.\n *\n * @remarks\n * Prepares the payroll for the target employee, then exposes a workweek-keyed\n * form whose submit builds a `PayrollUpdate`. Single-workweek pay periods send\n * totals without `breakdowns`; multi-workweek pay periods send `breakdowns` per\n * line once that line's every workweek cell is filled. Overtime-eligible\n * (nonexempt) employees split hours and overtime-affecting earnings per\n * workweek while the single `data.withOvertime` flag is on (see\n * `actions.addOvertime`); everyone else, and every line while `withOvertime` is\n * off, edits flat totals.\n *\n * @param props - Hook options.\n * @returns A loading result while data is fetching, or a ready result with data,\n * fields, status, actions, and error handling.\n * @public\n */\nexport function usePayrollEditEmployeeForm({\n employeeId,\n companyId,\n payrollId,\n withReimbursements = true,\n validationMode = 'onSubmit',\n shouldFocusError = true,\n errorMessages,\n}: UsePayrollEditEmployeeFormProps): UsePayrollEditEmployeeFormResult {\n const { data: employeeData } = useEmployeesGetSuspense({ employeeId })\n const { data: bankAccountsList } = useEmployeePaymentMethodsGetBankAccountsSuspense({\n employeeId,\n })\n const { data: earningTypesData } = useEarningTypesListSuspense({ companyId })\n const { data: payrollData } = usePayrollsGetSuspense({ companyId, payrollId })\n const isTransitionPayroll =\n derivePayrollCategory(payrollData.payrollShow ?? {}) === PayrollCategory.Transition\n\n const queryClient = useQueryClient()\n const { mutateAsync: preparePayroll } = usePayrollsPrepareMutation()\n const { mutateAsync: updatePayroll, isPending } = usePayrollsUpdateMutation()\n\n const [preparedPayroll, setPreparedPayroll] = useState<PayrollPrepared | undefined>()\n const [prepareError, setPrepareError] = useState<Error | null>(null)\n const hasFiredRef = useRef(false)\n\n const executePrepare = useCallback(async () => {\n setPrepareError(null)\n try {\n const result = await retryAsync(\n () =>\n preparePayroll({\n request: {\n companyId,\n payrollId,\n requestBody: { employeeUuids: isTransitionPayroll ? undefined : [employeeId] },\n },\n }),\n {\n maxAttempts: PREPARE_MAX_ATTEMPTS,\n delayMs: PREPARE_RETRY_DELAY_MS,\n shouldRetry: isPayrollBeingProcessedError,\n },\n )\n setPreparedPayroll(result.payrollPrepared)\n } catch (error) {\n setPrepareError(error as Error)\n }\n }, [companyId, payrollId, employeeId, preparePayroll, isTransitionPayroll])\n\n useEffect(() => {\n if (hasFiredRef.current) return\n hasFiredRef.current = true\n void executePrepare()\n }, [executePrepare])\n\n const payScheduleQuery = usePaySchedulesGet(\n { companyId, payScheduleId: preparedPayroll?.payPeriod?.payScheduleUuid ?? '' },\n { enabled: !!preparedPayroll?.payPeriod?.payScheduleUuid },\n )\n\n const employee = employeeData.employee\n const employeeCompensation = preparedPayroll?.employeeCompensations?.find(\n comp => comp.employeeUuid === employeeId,\n )\n const payrollCategory = derivePayrollCategory(preparedPayroll ?? {})\n const hasDirectDepositSetup = (bankAccountsList.employeeBankAccounts?.length ?? 0) > 0\n\n // Only normalize once the payroll is prepared: normalizeWorkweeks throws on a\n // payroll with neither workweeks nor a pay period, and before prepare resolves\n // both are legitimately absent (still loading, not malformed).\n const workweeks = useMemo(\n () =>\n preparedPayroll\n ? normalizeWorkweeks(preparedPayroll.workweeks, preparedPayroll.payPeriod)\n : [],\n [preparedPayroll],\n )\n\n const overtimeEarningNames = useMemo(\n () => collectOvertimeEarningNames(earningTypesData.earningTypeList),\n [earningTypesData.earningTypeList],\n )\n\n // Source of truth for the employee's FLSA status: prefer the prepared\n // compensation's hourly lines (the same data the fields are built from, so the\n // gate and the rendered lines always agree), falling back to the employee's\n // primary-job compensation. Unknown status is treated as not overtime-eligible.\n const flsaStatus = useMemo(() => {\n const fromCompensation = employeeCompensation?.hourlyCompensations?.find(\n compensation => compensation.flsaStatus,\n )?.flsaStatus\n if (fromCompensation) return fromCompensation\n const primaryJob = employee?.jobs?.find(job => job.primary)\n return primaryJob?.compensations?.[0]?.flsaStatus\n }, [employeeCompensation, employee])\n const isOvertimeEligible = isOvertimeEligibleFlsaStatus(flsaStatus)\n\n // Starts on when the employee already has real overtime hours, or already has\n // per-workweek breakdowns matching the current pay period's workweeks (nothing\n // to hide either way), otherwise starts off until the user opts in via\n // `actions.addOvertime`. One-directional: there's no \"remove overtime\" action.\n const [withOvertimeSetByUser, setWithOvertimeSetByUser] = useState(false)\n const withOvertime =\n withOvertimeSetByUser ||\n hasExistingOvertimeHours(employeeCompensation?.hourlyCompensations) ||\n hasBreakdownsMatchingWorkweeks(employeeCompensation?.hourlyCompensations, workweeks)\n\n const primaryJobUuid = useMemo(() => employee?.jobs?.find(job => job.primary)?.uuid, [employee])\n\n // Seed a blank input for every payroll fixed-compensation type (like the stable\n // editor), then let the field/defaults builders split them into additional\n // earnings vs `overtimeExcludedEarnings` by overtime inclusion. Without this, an employee whose\n // prepared payroll carries no fixed compensations shows no earnings inputs.\n const resolvedFixedCompensations = useMemo(\n () =>\n resolveEditableFixedCompensations(\n employeeCompensation?.fixedCompensations,\n preparedPayroll?.fixedCompensationTypes,\n primaryJobUuid,\n flsaStatus,\n ),\n [employeeCompensation, preparedPayroll?.fixedCompensationTypes, primaryJobUuid, flsaStatus],\n )\n\n const jobTitlesByUuid = useMemo(() => {\n const titles = new Map<string, string>()\n for (const job of employee?.jobs ?? []) {\n if (job.uuid && job.title) titles.set(job.uuid, job.title)\n }\n return titles\n }, [employee])\n\n // Accrual balance per time-off policy, owned by the hook (rather than looked\n // up in the consumer) so the time-off field can render its own live remaining\n // balance.\n const timeOffAccrualByName = useMemo(() => {\n const balances = new Map<string, string>()\n for (const policy of employee?.eligiblePaidTimeOff ?? []) {\n if (policy.name && policy.accrualBalance != null) {\n balances.set(policy.name, policy.accrualBalance)\n }\n }\n return balances\n }, [employee])\n\n const schema = useMemo(() => createPayrollEditEmployeeSchema(), [])\n\n const resolvedDefaults = useMemo(\n () =>\n derivePayrollEditEmployeeDefaults(\n employeeCompensation,\n workweeks,\n hasDirectDepositSetup,\n overtimeEarningNames,\n isOvertimeEligible,\n withOvertime,\n resolvedFixedCompensations,\n ),\n [\n employeeCompensation,\n workweeks,\n hasDirectDepositSetup,\n overtimeEarningNames,\n isOvertimeEligible,\n withOvertime,\n resolvedFixedCompensations,\n ],\n )\n\n const formMethods = useForm<PayrollEditEmployeeFormData, unknown, PayrollEditEmployeeFormOutputs>(\n {\n resolver: zodResolver(schema),\n mode: validationMode,\n shouldFocusError,\n defaultValues: resolvedDefaults,\n values: resolvedDefaults,\n resetOptions: { keepDirtyValues: true },\n },\n )\n\n // Watched so each `Fields.timeOff[i].remaining` stays live as the user edits\n // hours. The whole form re-renders on keystroke regardless of who owns this\n // watch, so there's no cost to owning it here rather than in a per-row\n // subcomponent.\n const watchedTimeOff = useWatch({ control: formMethods.control, name: 'timeOff' })\n\n // Off-cycle payrolls write reimbursements via the legacy fixed-compensation path\n // (the itemized array is rejected server-side), so itemized reimbursement controls\n // are exposed only for regular payrolls and only when the partner opts in.\n const usesItemizedReimbursements = !isOffCyclePayroll(payrollCategory)\n const showReimbursements = withReimbursements && usesItemizedReimbursements\n\n const {\n fields: reimbursementArrayFields,\n append: appendReimbursement,\n remove: removeReimbursementRow,\n update: updateReimbursementRow,\n } = useFieldArray({\n control: formMethods.control,\n name: 'reimbursements',\n })\n\n const [isAddingReimbursement, setIsAddingReimbursement] = useState(false)\n\n const reimbursementDraftFields = useMemo<ReimbursementDraftFields>(\n () => createReimbursementDraftFields(errorMessages),\n [errorMessages],\n )\n\n // Committed rows for the consumer's table. A removed existing row (one with a\n // uuid) is zeroed rather than dropped so the update still clears it server-side;\n // those zero-amount rows are filtered out of the visible list but remain in the\n // form array for submit.\n const reimbursementRows = useMemo<ReimbursementRow[]>(\n () =>\n reimbursementArrayFields\n .map((field, index) => ({\n key: field.id,\n index,\n uuid: field.uuid ?? undefined,\n description: field.description,\n amount: field.amount,\n recurring: field.recurring ?? false,\n }))\n .filter(row => parseFloat(row.amount || '0') !== 0),\n [reimbursementArrayFields],\n )\n\n const beginAddReimbursement = useCallback(() => {\n setIsAddingReimbursement(true)\n }, [])\n\n const cancelReimbursement = useCallback(() => {\n formMethods.setValue('reimbursementDraft', { description: '', amount: '' })\n formMethods.clearErrors('reimbursementDraft')\n setIsAddingReimbursement(false)\n }, [formMethods])\n\n const saveReimbursement = useCallback(() => {\n const draft = formMethods.getValues('reimbursementDraft')\n const result = reimbursementDraftSchema.safeParse(draft)\n if (!result.success) {\n // The error code is a fallback; the field renders the consumer-supplied\n // `errorMessage` prop when present (see useField), so the copy is theirs to set.\n formMethods.setError('reimbursementDraft.amount', {\n message: PayrollEditEmployeeErrorCodes.REIMBURSEMENT_AMOUNT,\n })\n return\n }\n appendReimbursement({\n uuid: null,\n description: result.data.description.trim(),\n amount: parseFloat(result.data.amount).toFixed(2),\n recurring: false,\n })\n formMethods.setValue('reimbursementDraft', { description: '', amount: '' })\n formMethods.clearErrors('reimbursementDraft')\n setIsAddingReimbursement(false)\n }, [appendReimbursement, formMethods])\n\n const removeReimbursement = useCallback(\n (index: number) => {\n const field = reimbursementArrayFields[index]\n if (!field) return\n if (field.uuid) {\n updateReimbursementRow(index, { ...field, amount: '0' })\n } else {\n removeReimbursementRow(index)\n }\n },\n [reimbursementArrayFields, removeReimbursementRow, updateReimbursementRow],\n )\n\n const fields = useMemo(\n () =>\n createPayrollEditEmployeeFields({\n employeeCompensation,\n fixedCompensations: resolvedFixedCompensations,\n workweeks,\n payrollCategory,\n hasDirectDepositSetup,\n overtimeEarningNames,\n isOvertimeEligible,\n withOvertime,\n jobTitlesByUuid,\n timeOffAccrualByName,\n errorMessages,\n }),\n [\n employeeCompensation,\n resolvedFixedCompensations,\n workweeks,\n payrollCategory,\n hasDirectDepositSetup,\n overtimeEarningNames,\n isOvertimeEligible,\n withOvertime,\n jobTitlesByUuid,\n timeOffAccrualByName,\n errorMessages,\n ],\n )\n\n // Overlay the live remaining balance onto each time-off entry every render, so\n // it tracks the watched entered values without rebuilding (and remounting) the\n // bound field components the `fields` memo owns.\n const timeOffFields = useMemo(\n () =>\n fields.timeOff.map(entry => ({\n ...entry,\n remaining: computeTimeOffRemaining(\n timeOffAccrualByName.get(entry.name),\n watchedTimeOff[entry.name],\n ),\n })),\n [fields.timeOff, timeOffAccrualByName, watchedTimeOff],\n )\n\n // Re-derives with `withOvertime` forced `true` and pushes the result straight\n // into the form: every line's first workweek cell gets that line's current\n // total, every other cell is left blank (never auto-distributed — see\n // `derivePayrollEditEmployeeDefaults`/`buildWeekMap`). The per-row validation\n // then requires the user to fill in the rest before they can submit.\n // `setValue` (not `resetField`) is used so this overwrites even a value the\n // user already typed into the collapsed input. Plain function (not memoized):\n // it only runs on a user click, and its inputs are recomputed each render, so\n // a `useCallback` here would never actually hold a stable reference.\n const addOvertime = () => {\n setWithOvertimeSetByUser(true)\n const revealedDefaults = derivePayrollEditEmployeeDefaults(\n employeeCompensation,\n workweeks,\n hasDirectDepositSetup,\n overtimeEarningNames,\n isOvertimeEligible,\n true,\n resolvedFixedCompensations,\n )\n // Keep the user's edited collapsed value on the first workweek cell rather\n // than the seeded API total.\n const firstWeekStart = workweeks[0]?.startDate ?? ''\n const currentValues = formMethods.getValues()\n const overlayLiveFirstWeek = (\n revealed: PayrollEditEmployeeFormData['hours'],\n live: PayrollEditEmployeeFormData['hours'] | undefined,\n ) => {\n for (const [jobUuid, names] of Object.entries(revealed)) {\n for (const [name, weekMap] of Object.entries(names)) {\n const liveValue = live?.[jobUuid]?.[name]?.[firstWeekStart]\n if (liveValue !== undefined) weekMap[firstWeekStart] = liveValue\n }\n }\n return revealed\n }\n // `shouldDirty` so the form's `values`-prop reset (triggered by flipping\n // `withOvertimeSetByUser`) keeps these via `keepDirtyValues`.\n formMethods.setValue(\n 'hours',\n overlayLiveFirstWeek(revealedDefaults.hours, currentValues.hours),\n { shouldDirty: true },\n )\n formMethods.setValue(\n 'overtimeIncludedEarnings',\n overlayLiveFirstWeek(\n revealedDefaults.overtimeIncludedEarnings,\n currentValues.overtimeIncludedEarnings,\n ),\n { shouldDirty: true },\n )\n }\n const fieldsMetadata = useMemo<PayrollEditEmployeeFieldsMetadata>(\n () => ({\n paymentMethod: withOptions(\n { name: 'paymentMethod' },\n PAYMENT_METHOD_OPTIONS,\n PAYMENT_METHOD_VALUES,\n ),\n }),\n [],\n )\n\n const {\n baseSubmitHandler,\n error: submitError,\n setError: setSubmitError,\n } = useBaseSubmit('PayrollEditEmployeeForm')\n\n const prepareQuerySource: QueryWithRefetch = {\n error: prepareError,\n refetch: (() => executePrepare()) as unknown as QueryWithRefetch['refetch'],\n }\n\n const errorHandling = composeErrorHandler([prepareQuerySource, payScheduleQuery], {\n submitError,\n setSubmitError,\n })\n\n const hookFormInternals = useHookFormInternals(formMethods)\n\n const onSubmit = async (): Promise<HookSubmitResult<PayrollPrepared> | undefined> => {\n let submitResult: HookSubmitResult<PayrollPrepared> | undefined\n\n // A workweek input that loaded with a value and was cleared by the user\n // submits an explicit `0` for that cell. Writing the `0` into form state\n // before validation lets the existing per-row check and submit builder run\n // unchanged: the cell is now filled rather than blank. Cells that were blank\n // at load stay blank (and keep validating as required in a touched row).\n const cleared = zeroFillClearedWorkweekCells(formMethods.getValues(), resolvedDefaults)\n if (cleared.hours) {\n formMethods.setValue('hours', cleared.hours, { shouldDirty: true })\n }\n if (cleared.overtimeIncludedEarnings) {\n formMethods.setValue('overtimeIncludedEarnings', cleared.overtimeIncludedEarnings, {\n shouldDirty: true,\n })\n }\n\n await new Promise<void>(resolve => {\n void formMethods.handleSubmit(\n async data => {\n await baseSubmitHandler(data, async payload => {\n const compensation = buildPayrollUpdateEmployeeCompensation(\n payload,\n employeeCompensation,\n workweeks,\n payrollCategory,\n isOvertimeEligible,\n withOvertime,\n )\n\n const response = await updatePayroll({\n request: {\n companyId,\n payrollId,\n payrollUpdate: { employeeCompensations: [compensation] },\n },\n })\n\n const updated = response.payrollPrepared\n if (!updated) {\n throw new SDKInternalError('Payroll update did not return a prepared payroll')\n }\n\n setPreparedPayroll(updated)\n\n // The payroll configuration surface caches its prepared payroll under a hand-written\n // key, which the global SDK auto-invalidation (namespaced to @gusto/embedded-api\n // queries only) does not touch. Invalidate it explicitly so configuration reflects\n // this edit without a manual refresh.\n await queryClient.invalidateQueries({\n queryKey: [PREPARE_QUERY_KEY, payrollId],\n })\n\n submitResult = { mode: 'update', data: updated }\n })\n resolve()\n },\n () => {\n resolve()\n },\n )()\n })\n\n return submitResult\n }\n\n if (!preparedPayroll || !employee) {\n return { isLoading: true as const, errorHandling }\n }\n\n return {\n isLoading: false as const,\n data: {\n employee,\n employeeCompensation,\n preparedPayroll,\n paySchedule: payScheduleQuery.data?.payScheduleShow,\n isMultipleWorkweeks: workweeks.length > 1,\n workweeks,\n isOvertimeEligible,\n withOvertime,\n hasDirectDepositSetup,\n ...(showReimbursements ? { reimbursements: reimbursementRows } : {}),\n },\n status: { isPending, mode: 'update' as const },\n actions: {\n onSubmit,\n addOvertime,\n ...(showReimbursements\n ? {\n beginAddReimbursement,\n saveReimbursement,\n cancelReimbursement,\n removeReimbursement,\n }\n : {}),\n },\n errorHandling,\n form: {\n Fields: {\n ...fields,\n timeOff: timeOffFields,\n reimbursementDraft: showReimbursements ? reimbursementDraftFields : undefined,\n },\n fieldsMetadata,\n hookFormInternals,\n getFormSubmissionValues: createGetFormSubmissionValues(formMethods, schema),\n ...(showReimbursements ? { reimbursementDraft: { isAdding: isAddingReimbursement } } : {}),\n },\n }\n}\n"],"names":["PREPARE_MAX_ATTEMPTS","PREPARE_RETRY_DELAY_MS","isPayrollBeingProcessedError","error","UnprocessableEntityError","issue","usePayrollEditEmployeeForm","employeeId","companyId","payrollId","withReimbursements","validationMode","shouldFocusError","errorMessages","employeeData","useEmployeesGetSuspense","bankAccountsList","useEmployeePaymentMethodsGetBankAccountsSuspense","earningTypesData","useEarningTypesListSuspense","payrollData","usePayrollsGetSuspense","isTransitionPayroll","derivePayrollCategory","PayrollCategory","queryClient","useQueryClient","preparePayroll","usePayrollsPrepareMutation","updatePayroll","isPending","usePayrollsUpdateMutation","preparedPayroll","setPreparedPayroll","useState","prepareError","setPrepareError","hasFiredRef","useRef","executePrepare","useCallback","result","retryAsync","useEffect","payScheduleQuery","usePaySchedulesGet","employee","employeeCompensation","comp","payrollCategory","hasDirectDepositSetup","workweeks","useMemo","normalizeWorkweeks","overtimeEarningNames","collectOvertimeEarningNames","flsaStatus","fromCompensation","compensation","job","isOvertimeEligible","isOvertimeEligibleFlsaStatus","withOvertimeSetByUser","setWithOvertimeSetByUser","withOvertime","hasExistingOvertimeHours","hasBreakdownsMatchingWorkweeks","primaryJobUuid","resolvedFixedCompensations","resolveEditableFixedCompensations","jobTitlesByUuid","titles","timeOffAccrualByName","balances","policy","schema","createPayrollEditEmployeeSchema","resolvedDefaults","derivePayrollEditEmployeeDefaults","formMethods","useForm","zodResolver","watchedTimeOff","useWatch","usesItemizedReimbursements","isOffCyclePayroll","showReimbursements","reimbursementArrayFields","appendReimbursement","removeReimbursementRow","updateReimbursementRow","useFieldArray","isAddingReimbursement","setIsAddingReimbursement","reimbursementDraftFields","createReimbursementDraftFields","reimbursementRows","field","index","row","beginAddReimbursement","cancelReimbursement","saveReimbursement","draft","reimbursementDraftSchema","PayrollEditEmployeeErrorCodes","removeReimbursement","fields","createPayrollEditEmployeeFields","timeOffFields","entry","computeTimeOffRemaining","addOvertime","revealedDefaults","firstWeekStart","currentValues","overlayLiveFirstWeek","revealed","live","jobUuid","names","name","weekMap","liveValue","fieldsMetadata","withOptions","PAYMENT_METHOD_OPTIONS","PAYMENT_METHOD_VALUES","baseSubmitHandler","submitError","setSubmitError","useBaseSubmit","errorHandling","composeErrorHandler","hookFormInternals","useHookFormInternals","onSubmit","submitResult","cleared","zeroFillClearedWorkweekCells","resolve","data","payload","buildPayrollUpdateEmployeeCompensation","updated","SDKInternalError","PREPARE_QUERY_KEY","createGetFormSubmissionValues"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAuEA,MAAMA,KAAuB,GACvBC,KAAyB,MAEzBC,KAA+B,CAACC,MACpCA,aAAiBC,MACjBD,EAAM,OAAO,KAAK,CAAAE,MAASA,EAAM,aAAa,mBAAmB;AAuK5D,SAASC,GAA2B;AAAA,EACzC,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,oBAAAC,IAAqB;AAAA,EACrB,gBAAAC,IAAiB;AAAA,EACjB,kBAAAC,KAAmB;AAAA,EACnB,eAAAC;AACF,GAAsE;AACpE,QAAM,EAAE,MAAMC,GAAA,IAAiBC,GAAwB,EAAE,YAAAR,GAAY,GAC/D,EAAE,MAAMS,GAAA,IAAqBC,GAAiD;AAAA,IAClF,YAAAV;AAAA,EAAA,CACD,GACK,EAAE,MAAMW,EAAA,IAAqBC,GAA4B,EAAE,WAAAX,GAAW,GACtE,EAAE,MAAMY,GAAA,IAAgBC,GAAuB,EAAE,WAAAb,GAAW,WAAAC,GAAW,GACvEa,IACJC,EAAsBH,GAAY,eAAe,CAAA,CAAE,MAAMI,GAAgB,YAErEC,KAAcC,GAAA,GACd,EAAE,aAAaC,EAAA,IAAmBC,GAAA,GAClC,EAAE,aAAaC,IAAe,WAAAC,GAAA,IAAcC,GAAA,GAE5C,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,QACN,GAAGzB;AAAA,QACH,SAASE;AAAA,QACT,oBAAoBvB,IAAqBQ,KAA2B;AAAA,MAAA;AAAA,MAEtE,gBAAA8B;AAAA,MACA,mBAAAU;AAAA,MACA,yBAAyBa,GAA8BpE,GAAaJ,CAAM;AAAA,MAC1E,GAAIW,IAAqB,EAAE,oBAAoB,EAAE,UAAUM,GAAA,EAAsB,IAAM,CAAA;AAAA,IAAC;AAAA,EAC1F;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"usePayrollEditEmployeeForm.js","sources":["../../../../../../src/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/usePayrollEditEmployeeForm.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { useFieldArray, useForm, useWatch } from 'react-hook-form'\nimport type { UseFormProps } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useEmployeesGetSuspense } from '@gusto/embedded-api/react-query/employeesGet'\nimport { useEmployeePaymentMethodsGetBankAccountsSuspense } from '@gusto/embedded-api/react-query/employeePaymentMethodsGetBankAccounts'\nimport { useEarningTypesListSuspense } from '@gusto/embedded-api/react-query/earningTypesList'\nimport { usePayrollsGetSuspense } from '@gusto/embedded-api/react-query/payrollsGet'\nimport { usePayrollsPrepareMutation } from '@gusto/embedded-api/react-query/payrollsPrepare'\nimport { usePaySchedulesGet } from '@gusto/embedded-api/react-query/paySchedulesGet'\nimport { usePayrollsUpdateMutation } from '@gusto/embedded-api/react-query/payrollsUpdate'\nimport type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport type { PayrollEmployeeCompensationsType } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype'\nimport type { PayrollPrepared } from '@gusto/embedded-api/models/components/unprocessedpayroll'\nimport type { PayScheduleShow } from '@gusto/embedded-api/models/components/payschedulelistitem'\nimport { UnprocessableEntityError } from '@gusto/embedded-api/models/errors/unprocessableentityerror'\nimport {\n createPayrollEditEmployeeSchema,\n PAYMENT_METHOD_OPTIONS,\n PAYMENT_METHOD_VALUES,\n PayrollEditEmployeeErrorCodes,\n reimbursementDraftSchema,\n type PayrollEditEmployeeFormData,\n type PayrollEditEmployeeFormOutputs,\n} from './payrollEditEmployeeSchema'\nimport {\n buildPayrollUpdateEmployeeCompensation,\n collectOvertimeEarningNames,\n derivePayrollEditEmployeeDefaults,\n hasBreakdownsMatchingWorkweeks,\n hasExistingOvertimeHours,\n normalizeWorkweeks,\n resolveEditableFixedCompensations,\n zeroFillClearedWorkweekCells,\n type NormalizedWorkweek,\n} from './payrollEditEmployeeHelpers'\nimport {\n computeTimeOffRemaining,\n createPayrollEditEmployeeFields,\n createReimbursementDraftFields,\n type PayrollEditEmployeeErrorMessages,\n type PayrollEditEmployeeFields,\n type ReimbursementDraftFields,\n type ReimbursementRow,\n} from './fields'\nimport { withOptions } from '@/partner-hook-utils/form/withOptions'\nimport {\n derivePayrollCategory,\n isOffCyclePayroll,\n PayrollCategory,\n} from '@/components/Payroll/payrollTypes'\nimport { PREPARE_QUERY_KEY } from '@/components/Payroll/PayrollConfiguration/usePayrollConfigurationData'\nimport { isOvertimeEligibleFlsaStatus } from '@/components/Payroll/helpers'\nimport { retryAsync } from '@/helpers/retryAsync'\nimport { useHookFormInternals } from '@/partner-hook-utils/form/useHookFormInternals'\nimport { createGetFormSubmissionValues } from '@/partner-hook-utils/form/getFormSubmissionValues'\nimport {\n composeErrorHandler,\n type QueryWithRefetch,\n} from '@/partner-hook-utils/composeErrorHandler'\nimport type {\n BaseFormHookReady,\n FieldMetadata,\n FieldMetadataWithOptions,\n HookLoadingResult,\n HookSubmitResult,\n} from '@/partner-hook-utils/types'\nimport { useBaseSubmit } from '@/components/Base/useBaseSubmit'\nimport { SDKInternalError } from '@/types/sdkError'\n\nconst PREPARE_MAX_ATTEMPTS = 4\nconst PREPARE_RETRY_DELAY_MS = 1500\n\nconst isPayrollBeingProcessedError = (error: unknown): boolean =>\n error instanceof UnprocessableEntityError &&\n error.errors.some(issue => issue.category === 'invalid_operation')\n\n/**\n * Options accepted by {@link usePayrollEditEmployeeForm}.\n *\n * @public\n */\nexport interface UsePayrollEditEmployeeFormProps {\n /** The associated employee identifier. */\n employeeId: string\n /** The associated company identifier. */\n companyId: string\n /** The associated payroll identifier. */\n payrollId: string\n /**\n * Whether to expose reimbursement controls (`form.Fields.reimbursements`,\n * `actions.addReimbursement`/`removeReimbursement`, `form.reimbursements`).\n * Defaults to `true`. Controls are omitted for off-cycle payrolls regardless,\n * since those write reimbursements via the legacy fixed-compensation path.\n */\n withReimbursements?: boolean\n /** When validation runs. Passed through to react-hook-form. Defaults to `'onSubmit'`. */\n validationMode?: UseFormProps['mode']\n /** Auto-focus the first invalid field on submit. Defaults to `true`. Set to `false` when composing with other forms. */\n shouldFocusError?: boolean\n /**\n * Display copy for each validation error code, baked into every bound field so\n * it resolves and renders its own message. Supply it once, keyed by\n * {@link PayrollEditEmployeeErrorCodes}; a missing code falls back to the raw\n * code. Omit it to render raw codes.\n */\n errorMessages?: PayrollEditEmployeeErrorMessages\n}\n\n/**\n * Field metadata for {@link usePayrollEditEmployeeForm}, keyed by full form path.\n *\n * @remarks\n * Keys are minted from the prepared payroll's compensations at runtime\n * (`hours.${jobUuid}.${name}.${workweekStart}` and similar), so neither the key\n * set nor which entries carry options is known ahead of time.\n *\n * @public\n */\nexport type PayrollEditEmployeeFieldsMetadata = Record<\n string,\n FieldMetadata | FieldMetadataWithOptions\n>\n\n/**\n * Ready-state return value of {@link usePayrollEditEmployeeForm} — the\n * `isLoading: false` branch of {@link UsePayrollEditEmployeeFormResult}.\n *\n * @public\n */\nexport interface UsePayrollEditEmployeeFormReady extends BaseFormHookReady<\n PayrollEditEmployeeFieldsMetadata,\n PayrollEditEmployeeFormData,\n PayrollEditEmployeeFields\n> {\n /** Loaded entities backing the editor. */\n data: {\n /** The employee being edited. */\n employee: Employee\n /** The employee's prepared compensation for this payroll, if present. */\n employeeCompensation?: PayrollEmployeeCompensationsType\n /** The prepared payroll (server-calculated totals and workweeks). */\n preparedPayroll: PayrollPrepared\n /** The pay schedule for the payroll, if loaded. */\n paySchedule?: PayScheduleShow\n /** Whether the pay period spans more than one workweek. Raw workweeks are on `preparedPayroll.workweeks`. */\n isMultipleWorkweeks: boolean\n /**\n * The pay period's normalized workweeks (`{ startDate, endDate }` strings),\n * in order — one entry, spanning the pay period, when it's a single\n * workweek. The per-workweek split fields are keyed by start date only, so\n * this is the source for each column's date range.\n */\n workweeks: NormalizedWorkweek[]\n /** Whether the employee is overtime-eligible (nonexempt family). Drives whether hours split by workweek. */\n isOvertimeEligible: boolean\n /**\n * The single, form-wide overtime-mode flag. `false` renders one flat\n * column per line with Overtime/Double-overtime rows hidden; `true`\n * splits hours and overtime-affecting earnings into per-workweek columns\n * (for overtime-eligible employees on a multi-workweek payroll) and\n * un-hides those rows. Starts `true` when the employee already has real\n * overtime hours or matching per-workweek breakdowns (see\n * `hasExistingOvertimeHours`, `hasBreakdownsMatchingWorkweeks`), or after\n * `actions.addOvertime` is called; otherwise starts `false`.\n */\n withOvertime: boolean\n /** Whether the employee has a direct-deposit bank account set up. */\n hasDirectDepositSetup: boolean\n /**\n * Committed reimbursement rows to render in a table, present only when\n * reimbursement controls are exposed. Seeded from the employee's existing\n * reimbursements and appended to as drafts are saved. Remove a row via\n * `actions.removeReimbursement(row.index)`.\n */\n reimbursements?: ReimbursementRow[]\n }\n /** Submission status. `mode` is always `'update'` since the payroll already exists. */\n status: { isPending: boolean; mode: 'update' }\n /** Form actions. */\n actions: {\n /** Validates and submits the form, resolving to the updated prepared payroll on success or `undefined` when validation blocked the submit. */\n onSubmit: () => Promise<HookSubmitResult<PayrollPrepared> | undefined>\n /**\n * Sets `data.withOvertime` to `true`, switching the whole form to the\n * workweek split: un-hides Overtime/Double-overtime rows and splits hours\n * and overtime-affecting earnings into per-workweek columns. Populates\n * only the first workweek cell of each line with that line's current\n * total, leaving every other cell blank — no auto distribution — so the\n * per-row validation then requires the user to fill in the rest. One\n * affordance for the whole employee, not one per job. One-directional —\n * there's no corresponding \"remove overtime\" action.\n */\n addOvertime: () => void\n /** Reveals the draft reimbursement row. Present only when reimbursement controls are exposed. */\n beginAddReimbursement?: () => void\n /** Validates the draft and commits it to the reimbursement list, or flags the draft amount if invalid. Present only when reimbursement controls are exposed. */\n saveReimbursement?: () => void\n /** Discards the draft reimbursement row. Present only when reimbursement controls are exposed. */\n cancelReimbursement?: () => void\n /** Removes the committed reimbursement row at `index` (zeroing existing rows so the update clears them). Present only when reimbursement controls are exposed. */\n removeReimbursement?: (index: number) => void\n }\n /** Form internals plus the reimbursement draft state. */\n form: BaseFormHookReady<\n PayrollEditEmployeeFieldsMetadata,\n PayrollEditEmployeeFormData,\n PayrollEditEmployeeFields\n >['form'] & {\n /** Draft reimbursement state, present only when reimbursement controls are exposed. */\n reimbursementDraft?: { isAdding: boolean }\n }\n}\n\n/**\n * Discriminated union returned by {@link usePayrollEditEmployeeForm}. Loading\n * branch carries only `errorHandling`; ready branch carries form data, fields,\n * status, and actions.\n *\n * @public\n */\nexport type UsePayrollEditEmployeeFormResult = HookLoadingResult | UsePayrollEditEmployeeFormReady\n\n/**\n * Headless form hook for editing a single employee's compensation within a\n * payroll run, built for regular-rate-of-pay (RRoP) support.\n *\n * @remarks\n * Prepares the payroll for the target employee, then exposes a workweek-keyed\n * form whose submit builds a `PayrollUpdate`. Single-workweek pay periods send\n * totals without `breakdowns`; multi-workweek pay periods send `breakdowns` per\n * line once that line's every workweek cell is filled. Overtime-eligible\n * (nonexempt) employees split hours and overtime-affecting earnings per\n * workweek while the single `data.withOvertime` flag is on (see\n * `actions.addOvertime`); everyone else, and every line while `withOvertime` is\n * off, edits flat totals.\n *\n * @param props - Hook options.\n * @returns A loading result while data is fetching, or a ready result with data,\n * fields, status, actions, and error handling.\n * @public\n */\nexport function usePayrollEditEmployeeForm({\n employeeId,\n companyId,\n payrollId,\n withReimbursements = true,\n validationMode = 'onSubmit',\n shouldFocusError = true,\n errorMessages,\n}: UsePayrollEditEmployeeFormProps): UsePayrollEditEmployeeFormResult {\n const { data: employeeData } = useEmployeesGetSuspense({ employeeId })\n const { data: bankAccountsList } = useEmployeePaymentMethodsGetBankAccountsSuspense({\n employeeId,\n })\n const { data: earningTypesData } = useEarningTypesListSuspense({ companyId })\n const { data: payrollData } = usePayrollsGetSuspense({ companyId, payrollId })\n const isTransitionPayroll =\n derivePayrollCategory(payrollData.payrollShow ?? {}) === PayrollCategory.Transition\n\n const queryClient = useQueryClient()\n const { mutateAsync: preparePayroll } = usePayrollsPrepareMutation()\n const { mutateAsync: updatePayroll, isPending } = usePayrollsUpdateMutation()\n\n const [preparedPayroll, setPreparedPayroll] = useState<PayrollPrepared | undefined>()\n const [prepareError, setPrepareError] = useState<Error | null>(null)\n const hasFiredRef = useRef(false)\n\n const executePrepare = useCallback(async () => {\n setPrepareError(null)\n try {\n const result = await retryAsync(\n () =>\n preparePayroll({\n request: {\n companyId,\n payrollId,\n requestBody: { employeeUuids: isTransitionPayroll ? undefined : [employeeId] },\n },\n }),\n {\n maxAttempts: PREPARE_MAX_ATTEMPTS,\n delayMs: PREPARE_RETRY_DELAY_MS,\n shouldRetry: isPayrollBeingProcessedError,\n },\n )\n setPreparedPayroll(result.payrollPrepared)\n } catch (error) {\n setPrepareError(error as Error)\n }\n }, [companyId, payrollId, employeeId, preparePayroll, isTransitionPayroll])\n\n useEffect(() => {\n if (hasFiredRef.current) return\n hasFiredRef.current = true\n void executePrepare()\n }, [executePrepare])\n\n const payScheduleQuery = usePaySchedulesGet(\n { companyId, payScheduleId: preparedPayroll?.payPeriod?.payScheduleUuid ?? '' },\n { enabled: !!preparedPayroll?.payPeriod?.payScheduleUuid },\n )\n\n const employee = employeeData.employeeShow\n const employeeCompensation = preparedPayroll?.employeeCompensations?.find(\n comp => comp.employeeUuid === employeeId,\n )\n const payrollCategory = derivePayrollCategory(preparedPayroll ?? {})\n const hasDirectDepositSetup = (bankAccountsList.employeeBankAccounts?.length ?? 0) > 0\n\n // Only normalize once the payroll is prepared: normalizeWorkweeks throws on a\n // payroll with neither workweeks nor a pay period, and before prepare resolves\n // both are legitimately absent (still loading, not malformed).\n const workweeks = useMemo(\n () =>\n preparedPayroll\n ? normalizeWorkweeks(preparedPayroll.workweeks, preparedPayroll.payPeriod)\n : [],\n [preparedPayroll],\n )\n\n const overtimeEarningNames = useMemo(\n () => collectOvertimeEarningNames(earningTypesData.earningTypeList),\n [earningTypesData.earningTypeList],\n )\n\n // Source of truth for the employee's FLSA status: prefer the prepared\n // compensation's hourly lines (the same data the fields are built from, so the\n // gate and the rendered lines always agree), falling back to the employee's\n // primary-job compensation. Unknown status is treated as not overtime-eligible.\n const flsaStatus = useMemo(() => {\n const fromCompensation = employeeCompensation?.hourlyCompensations?.find(\n compensation => compensation.flsaStatus,\n )?.flsaStatus\n if (fromCompensation) return fromCompensation\n const primaryJob = employee?.jobs?.find(job => job.primary)\n return primaryJob?.compensations?.[0]?.flsaStatus\n }, [employeeCompensation, employee])\n const isOvertimeEligible = isOvertimeEligibleFlsaStatus(flsaStatus)\n\n // Starts on when the employee already has real overtime hours, or already has\n // per-workweek breakdowns matching the current pay period's workweeks (nothing\n // to hide either way), otherwise starts off until the user opts in via\n // `actions.addOvertime`. One-directional: there's no \"remove overtime\" action.\n const [withOvertimeSetByUser, setWithOvertimeSetByUser] = useState(false)\n const withOvertime =\n withOvertimeSetByUser ||\n hasExistingOvertimeHours(employeeCompensation?.hourlyCompensations) ||\n hasBreakdownsMatchingWorkweeks(employeeCompensation?.hourlyCompensations, workweeks)\n\n const primaryJobUuid = useMemo(() => employee?.jobs?.find(job => job.primary)?.uuid, [employee])\n\n // Seed a blank input for every payroll fixed-compensation type (like the stable\n // editor), then let the field/defaults builders split them into additional\n // earnings vs `overtimeExcludedEarnings` by overtime inclusion. Without this, an employee whose\n // prepared payroll carries no fixed compensations shows no earnings inputs.\n const resolvedFixedCompensations = useMemo(\n () =>\n resolveEditableFixedCompensations(\n employeeCompensation?.fixedCompensations,\n preparedPayroll?.fixedCompensationTypes,\n primaryJobUuid,\n flsaStatus,\n ),\n [employeeCompensation, preparedPayroll?.fixedCompensationTypes, primaryJobUuid, flsaStatus],\n )\n\n const jobTitlesByUuid = useMemo(() => {\n const titles = new Map<string, string>()\n for (const job of employee?.jobs ?? []) {\n if (job.uuid && job.title) titles.set(job.uuid, job.title)\n }\n return titles\n }, [employee])\n\n // Accrual balance per time-off policy, owned by the hook (rather than looked\n // up in the consumer) so the time-off field can render its own live remaining\n // balance.\n const timeOffAccrualByName = useMemo(() => {\n const balances = new Map<string, string>()\n for (const policy of employee?.eligiblePaidTimeOff ?? []) {\n if (policy.name && policy.accrualBalance != null) {\n balances.set(policy.name, policy.accrualBalance)\n }\n }\n return balances\n }, [employee])\n\n const schema = useMemo(() => createPayrollEditEmployeeSchema(), [])\n\n const resolvedDefaults = useMemo(\n () =>\n derivePayrollEditEmployeeDefaults(\n employeeCompensation,\n workweeks,\n hasDirectDepositSetup,\n overtimeEarningNames,\n isOvertimeEligible,\n withOvertime,\n resolvedFixedCompensations,\n ),\n [\n employeeCompensation,\n workweeks,\n hasDirectDepositSetup,\n overtimeEarningNames,\n isOvertimeEligible,\n withOvertime,\n resolvedFixedCompensations,\n ],\n )\n\n const formMethods = useForm<PayrollEditEmployeeFormData, unknown, PayrollEditEmployeeFormOutputs>(\n {\n resolver: zodResolver(schema),\n mode: validationMode,\n shouldFocusError,\n defaultValues: resolvedDefaults,\n values: resolvedDefaults,\n resetOptions: { keepDirtyValues: true },\n },\n )\n\n // Watched so each `Fields.timeOff[i].remaining` stays live as the user edits\n // hours. The whole form re-renders on keystroke regardless of who owns this\n // watch, so there's no cost to owning it here rather than in a per-row\n // subcomponent.\n const watchedTimeOff = useWatch({ control: formMethods.control, name: 'timeOff' })\n\n // Off-cycle payrolls write reimbursements via the legacy fixed-compensation path\n // (the itemized array is rejected server-side), so itemized reimbursement controls\n // are exposed only for regular payrolls and only when the partner opts in.\n const usesItemizedReimbursements = !isOffCyclePayroll(payrollCategory)\n const showReimbursements = withReimbursements && usesItemizedReimbursements\n\n const {\n fields: reimbursementArrayFields,\n append: appendReimbursement,\n remove: removeReimbursementRow,\n update: updateReimbursementRow,\n } = useFieldArray({\n control: formMethods.control,\n name: 'reimbursements',\n })\n\n const [isAddingReimbursement, setIsAddingReimbursement] = useState(false)\n\n const reimbursementDraftFields = useMemo<ReimbursementDraftFields>(\n () => createReimbursementDraftFields(errorMessages),\n [errorMessages],\n )\n\n // Committed rows for the consumer's table. A removed existing row (one with a\n // uuid) is zeroed rather than dropped so the update still clears it server-side;\n // those zero-amount rows are filtered out of the visible list but remain in the\n // form array for submit.\n const reimbursementRows = useMemo<ReimbursementRow[]>(\n () =>\n reimbursementArrayFields\n .map((field, index) => ({\n key: field.id,\n index,\n uuid: field.uuid ?? undefined,\n description: field.description,\n amount: field.amount,\n recurring: field.recurring ?? false,\n }))\n .filter(row => parseFloat(row.amount || '0') !== 0),\n [reimbursementArrayFields],\n )\n\n const beginAddReimbursement = useCallback(() => {\n setIsAddingReimbursement(true)\n }, [])\n\n const cancelReimbursement = useCallback(() => {\n formMethods.setValue('reimbursementDraft', { description: '', amount: '' })\n formMethods.clearErrors('reimbursementDraft')\n setIsAddingReimbursement(false)\n }, [formMethods])\n\n const saveReimbursement = useCallback(() => {\n const draft = formMethods.getValues('reimbursementDraft')\n const result = reimbursementDraftSchema.safeParse(draft)\n if (!result.success) {\n // The error code is a fallback; the field renders the consumer-supplied\n // `errorMessage` prop when present (see useField), so the copy is theirs to set.\n formMethods.setError('reimbursementDraft.amount', {\n message: PayrollEditEmployeeErrorCodes.REIMBURSEMENT_AMOUNT,\n })\n return\n }\n appendReimbursement({\n uuid: null,\n description: result.data.description.trim(),\n amount: parseFloat(result.data.amount).toFixed(2),\n recurring: false,\n })\n formMethods.setValue('reimbursementDraft', { description: '', amount: '' })\n formMethods.clearErrors('reimbursementDraft')\n setIsAddingReimbursement(false)\n }, [appendReimbursement, formMethods])\n\n const removeReimbursement = useCallback(\n (index: number) => {\n const field = reimbursementArrayFields[index]\n if (!field) return\n if (field.uuid) {\n updateReimbursementRow(index, { ...field, amount: '0' })\n } else {\n removeReimbursementRow(index)\n }\n },\n [reimbursementArrayFields, removeReimbursementRow, updateReimbursementRow],\n )\n\n const fields = useMemo(\n () =>\n createPayrollEditEmployeeFields({\n employeeCompensation,\n fixedCompensations: resolvedFixedCompensations,\n workweeks,\n payrollCategory,\n hasDirectDepositSetup,\n overtimeEarningNames,\n isOvertimeEligible,\n withOvertime,\n jobTitlesByUuid,\n timeOffAccrualByName,\n errorMessages,\n }),\n [\n employeeCompensation,\n resolvedFixedCompensations,\n workweeks,\n payrollCategory,\n hasDirectDepositSetup,\n overtimeEarningNames,\n isOvertimeEligible,\n withOvertime,\n jobTitlesByUuid,\n timeOffAccrualByName,\n errorMessages,\n ],\n )\n\n // Overlay the live remaining balance onto each time-off entry every render, so\n // it tracks the watched entered values without rebuilding (and remounting) the\n // bound field components the `fields` memo owns.\n const timeOffFields = useMemo(\n () =>\n fields.timeOff.map(entry => ({\n ...entry,\n remaining: computeTimeOffRemaining(\n timeOffAccrualByName.get(entry.name),\n watchedTimeOff[entry.name],\n ),\n })),\n [fields.timeOff, timeOffAccrualByName, watchedTimeOff],\n )\n\n // Re-derives with `withOvertime` forced `true` and pushes the result straight\n // into the form: every line's first workweek cell gets that line's current\n // total, every other cell is left blank (never auto-distributed — see\n // `derivePayrollEditEmployeeDefaults`/`buildWeekMap`). The per-row validation\n // then requires the user to fill in the rest before they can submit.\n // `setValue` (not `resetField`) is used so this overwrites even a value the\n // user already typed into the collapsed input. Plain function (not memoized):\n // it only runs on a user click, and its inputs are recomputed each render, so\n // a `useCallback` here would never actually hold a stable reference.\n const addOvertime = () => {\n setWithOvertimeSetByUser(true)\n const revealedDefaults = derivePayrollEditEmployeeDefaults(\n employeeCompensation,\n workweeks,\n hasDirectDepositSetup,\n overtimeEarningNames,\n isOvertimeEligible,\n true,\n resolvedFixedCompensations,\n )\n // Keep the user's edited collapsed value on the first workweek cell rather\n // than the seeded API total.\n const firstWeekStart = workweeks[0]?.startDate ?? ''\n const currentValues = formMethods.getValues()\n const overlayLiveFirstWeek = (\n revealed: PayrollEditEmployeeFormData['hours'],\n live: PayrollEditEmployeeFormData['hours'] | undefined,\n ) => {\n for (const [jobUuid, names] of Object.entries(revealed)) {\n for (const [name, weekMap] of Object.entries(names)) {\n const liveValue = live?.[jobUuid]?.[name]?.[firstWeekStart]\n if (liveValue !== undefined) weekMap[firstWeekStart] = liveValue\n }\n }\n return revealed\n }\n // `shouldDirty` so the form's `values`-prop reset (triggered by flipping\n // `withOvertimeSetByUser`) keeps these via `keepDirtyValues`.\n formMethods.setValue(\n 'hours',\n overlayLiveFirstWeek(revealedDefaults.hours, currentValues.hours),\n { shouldDirty: true },\n )\n formMethods.setValue(\n 'overtimeIncludedEarnings',\n overlayLiveFirstWeek(\n revealedDefaults.overtimeIncludedEarnings,\n currentValues.overtimeIncludedEarnings,\n ),\n { shouldDirty: true },\n )\n }\n const fieldsMetadata = useMemo<PayrollEditEmployeeFieldsMetadata>(\n () => ({\n paymentMethod: withOptions(\n { name: 'paymentMethod' },\n PAYMENT_METHOD_OPTIONS,\n PAYMENT_METHOD_VALUES,\n ),\n }),\n [],\n )\n\n const {\n baseSubmitHandler,\n error: submitError,\n setError: setSubmitError,\n } = useBaseSubmit('PayrollEditEmployeeForm')\n\n const prepareQuerySource: QueryWithRefetch = {\n error: prepareError,\n refetch: (() => executePrepare()) as unknown as QueryWithRefetch['refetch'],\n }\n\n const errorHandling = composeErrorHandler([prepareQuerySource, payScheduleQuery], {\n submitError,\n setSubmitError,\n })\n\n const hookFormInternals = useHookFormInternals(formMethods)\n\n const onSubmit = async (): Promise<HookSubmitResult<PayrollPrepared> | undefined> => {\n let submitResult: HookSubmitResult<PayrollPrepared> | undefined\n\n // A workweek input that loaded with a value and was cleared by the user\n // submits an explicit `0` for that cell. Writing the `0` into form state\n // before validation lets the existing per-row check and submit builder run\n // unchanged: the cell is now filled rather than blank. Cells that were blank\n // at load stay blank (and keep validating as required in a touched row).\n const cleared = zeroFillClearedWorkweekCells(formMethods.getValues(), resolvedDefaults)\n if (cleared.hours) {\n formMethods.setValue('hours', cleared.hours, { shouldDirty: true })\n }\n if (cleared.overtimeIncludedEarnings) {\n formMethods.setValue('overtimeIncludedEarnings', cleared.overtimeIncludedEarnings, {\n shouldDirty: true,\n })\n }\n\n await new Promise<void>(resolve => {\n void formMethods.handleSubmit(\n async data => {\n await baseSubmitHandler(data, async payload => {\n const compensation = buildPayrollUpdateEmployeeCompensation(\n payload,\n employeeCompensation,\n workweeks,\n payrollCategory,\n isOvertimeEligible,\n withOvertime,\n )\n\n const response = await updatePayroll({\n request: {\n companyId,\n payrollId,\n payrollUpdate: { employeeCompensations: [compensation] },\n },\n })\n\n const updated = response.payrollPrepared\n if (!updated) {\n throw new SDKInternalError('Payroll update did not return a prepared payroll')\n }\n\n setPreparedPayroll(updated)\n\n // The payroll configuration surface caches its prepared payroll under a hand-written\n // key, which the global SDK auto-invalidation (namespaced to @gusto/embedded-api\n // queries only) does not touch. Invalidate it explicitly so configuration reflects\n // this edit without a manual refresh.\n await queryClient.invalidateQueries({\n queryKey: [PREPARE_QUERY_KEY, payrollId],\n })\n\n submitResult = { mode: 'update', data: updated }\n })\n resolve()\n },\n () => {\n resolve()\n },\n )()\n })\n\n return submitResult\n }\n\n if (!preparedPayroll || !employee) {\n return { isLoading: true as const, errorHandling }\n }\n\n return {\n isLoading: false as const,\n data: {\n employee,\n employeeCompensation,\n preparedPayroll,\n paySchedule: payScheduleQuery.data?.payScheduleShow,\n isMultipleWorkweeks: workweeks.length > 1,\n workweeks,\n isOvertimeEligible,\n withOvertime,\n hasDirectDepositSetup,\n ...(showReimbursements ? { reimbursements: reimbursementRows } : {}),\n },\n status: { isPending, mode: 'update' as const },\n actions: {\n onSubmit,\n addOvertime,\n ...(showReimbursements\n ? {\n beginAddReimbursement,\n saveReimbursement,\n cancelReimbursement,\n removeReimbursement,\n }\n : {}),\n },\n errorHandling,\n form: {\n Fields: {\n ...fields,\n timeOff: timeOffFields,\n reimbursementDraft: showReimbursements ? reimbursementDraftFields : undefined,\n },\n fieldsMetadata,\n hookFormInternals,\n getFormSubmissionValues: createGetFormSubmissionValues(formMethods, schema),\n ...(showReimbursements ? { reimbursementDraft: { isAdding: isAddingReimbursement } } : {}),\n },\n }\n}\n"],"names":["PREPARE_MAX_ATTEMPTS","PREPARE_RETRY_DELAY_MS","isPayrollBeingProcessedError","error","UnprocessableEntityError","issue","usePayrollEditEmployeeForm","employeeId","companyId","payrollId","withReimbursements","validationMode","shouldFocusError","errorMessages","employeeData","useEmployeesGetSuspense","bankAccountsList","useEmployeePaymentMethodsGetBankAccountsSuspense","earningTypesData","useEarningTypesListSuspense","payrollData","usePayrollsGetSuspense","isTransitionPayroll","derivePayrollCategory","PayrollCategory","queryClient","useQueryClient","preparePayroll","usePayrollsPrepareMutation","updatePayroll","isPending","usePayrollsUpdateMutation","preparedPayroll","setPreparedPayroll","useState","prepareError","setPrepareError","hasFiredRef","useRef","executePrepare","useCallback","result","retryAsync","useEffect","payScheduleQuery","usePaySchedulesGet","employee","employeeCompensation","comp","payrollCategory","hasDirectDepositSetup","workweeks","useMemo","normalizeWorkweeks","overtimeEarningNames","collectOvertimeEarningNames","flsaStatus","fromCompensation","compensation","job","isOvertimeEligible","isOvertimeEligibleFlsaStatus","withOvertimeSetByUser","setWithOvertimeSetByUser","withOvertime","hasExistingOvertimeHours","hasBreakdownsMatchingWorkweeks","primaryJobUuid","resolvedFixedCompensations","resolveEditableFixedCompensations","jobTitlesByUuid","titles","timeOffAccrualByName","balances","policy","schema","createPayrollEditEmployeeSchema","resolvedDefaults","derivePayrollEditEmployeeDefaults","formMethods","useForm","zodResolver","watchedTimeOff","useWatch","usesItemizedReimbursements","isOffCyclePayroll","showReimbursements","reimbursementArrayFields","appendReimbursement","removeReimbursementRow","updateReimbursementRow","useFieldArray","isAddingReimbursement","setIsAddingReimbursement","reimbursementDraftFields","createReimbursementDraftFields","reimbursementRows","field","index","row","beginAddReimbursement","cancelReimbursement","saveReimbursement","draft","reimbursementDraftSchema","PayrollEditEmployeeErrorCodes","removeReimbursement","fields","createPayrollEditEmployeeFields","timeOffFields","entry","computeTimeOffRemaining","addOvertime","revealedDefaults","firstWeekStart","currentValues","overlayLiveFirstWeek","revealed","live","jobUuid","names","name","weekMap","liveValue","fieldsMetadata","withOptions","PAYMENT_METHOD_OPTIONS","PAYMENT_METHOD_VALUES","baseSubmitHandler","submitError","setSubmitError","useBaseSubmit","errorHandling","composeErrorHandler","hookFormInternals","useHookFormInternals","onSubmit","submitResult","cleared","zeroFillClearedWorkweekCells","resolve","data","payload","buildPayrollUpdateEmployeeCompensation","updated","SDKInternalError","PREPARE_QUERY_KEY","createGetFormSubmissionValues"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAuEA,MAAMA,KAAuB,GACvBC,KAAyB,MAEzBC,KAA+B,CAACC,MACpCA,aAAiBC,MACjBD,EAAM,OAAO,KAAK,CAAAE,MAASA,EAAM,aAAa,mBAAmB;AAuK5D,SAASC,GAA2B;AAAA,EACzC,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,oBAAAC,IAAqB;AAAA,EACrB,gBAAAC,IAAiB;AAAA,EACjB,kBAAAC,KAAmB;AAAA,EACnB,eAAAC;AACF,GAAsE;AACpE,QAAM,EAAE,MAAMC,GAAA,IAAiBC,GAAwB,EAAE,YAAAR,GAAY,GAC/D,EAAE,MAAMS,GAAA,IAAqBC,GAAiD;AAAA,IAClF,YAAAV;AAAA,EAAA,CACD,GACK,EAAE,MAAMW,EAAA,IAAqBC,GAA4B,EAAE,WAAAX,GAAW,GACtE,EAAE,MAAMY,GAAA,IAAgBC,GAAuB,EAAE,WAAAb,GAAW,WAAAC,GAAW,GACvEa,IACJC,EAAsBH,GAAY,eAAe,CAAA,CAAE,MAAMI,GAAgB,YA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AAA,QACA,qBAAAK;AAAA,MAAA,IAEF,CAAA;AAAA,IAAC;AAAA,IAEP,eAAA0B;AAAA,IACA,MAAM;AAAA,MACJ,QAAQ;AAAA,QACN,GAAGzB;AAAA,QACH,SAASE;AAAA,QACT,oBAAoBvB,IAAqBQ,KAA2B;AAAA,MAAA;AAAA,MAEtE,gBAAA8B;AAAA,MACA,mBAAAU;AAAA,MACA,yBAAyBa,GAA8BpE,GAAaJ,CAAM;AAAA,MAC1E,GAAIW,IAAqB,EAAE,oBAAoB,EAAE,UAAUM,GAAA,EAAsB,IAAM,CAAA;AAAA,IAAC;AAAA,EAC1F;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayrollHistory.js","sources":["../../../../src/components/Payroll/PayrollHistory/PayrollHistory.tsx"],"sourcesContent":["import { useState, useCallback } from 'react'\nimport { keepPreviousData } from '@tanstack/react-query'\nimport { usePayrollsList } from '@gusto/embedded-api/react-query/payrollsList'\nimport { usePayrollsCancelMutation } from '@gusto/embedded-api/react-query/payrollsCancel'\nimport { useWireInRequestsListSuspense } from '@gusto/embedded-api/react-query/wireInRequestsList'\nimport {\n ProcessingStatuses,\n QueryParamPayrollTypes,\n QueryParamSortOrder as SortOrder,\n} from '@gusto/embedded-api/models/operations/getv1companiescompanyidpayrolls'\nimport type { Payroll } from '@gusto/embedded-api/models/components/
|
|
1
|
+
{"version":3,"file":"PayrollHistory.js","sources":["../../../../src/components/Payroll/PayrollHistory/PayrollHistory.tsx"],"sourcesContent":["import { useState, useCallback } from 'react'\nimport { keepPreviousData } from '@tanstack/react-query'\nimport { usePayrollsList } from '@gusto/embedded-api/react-query/payrollsList'\nimport { usePayrollsCancelMutation } from '@gusto/embedded-api/react-query/payrollsCancel'\nimport { useWireInRequestsListSuspense } from '@gusto/embedded-api/react-query/wireInRequestsList'\nimport {\n ProcessingStatuses,\n QueryParamPayrollTypes,\n QueryParamSortOrder as SortOrder,\n} from '@gusto/embedded-api/models/operations/getv1companiescompanyidpayrolls'\nimport type { Payroll } from '@gusto/embedded-api/models/components/unprocessedpayroll'\nimport { PayrollHistoryPresentation } from './PayrollHistoryPresentation'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent, BaseLayout } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { usePagination } from '@/hooks/usePagination/usePagination'\nimport { useDateRangeFilter } from '@/hooks/useDateRangeFilter/useDateRangeFilter'\n\n/**\n * Props for the {@link PayrollHistory} component.\n *\n * @public\n */\nexport interface PayrollHistoryProps extends BaseComponentInterface<'Payroll.PayrollHistory'> {\n /** Identifier of the company whose processed payrolls should be listed. */\n companyId: string\n}\n\n/**\n * Displays historical payroll records with filtering and management capabilities.\n *\n * @remarks\n * Lists processed regular, off-cycle, and external payrolls for a company and supports filtering by\n * pay period, viewing payroll summaries and receipts, and cancelling processed payrolls when they\n * remain within the cancellation window. Each row shows the pay period, payroll type, pay date,\n * status, and total pay amount.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `runPayroll/summary/viewed` | User views a payroll summary | `{ payrollId: string; startDate?: string; endDate?: string }` |\n * | `runPayroll/receipt/viewed` | User views a payroll receipt | `{ payrollId: string; startDate?: string; endDate?: string }` |\n * | `runPayroll/cancelled` | A payroll is cancelled | `{ payrollId: string; result: PayrollsCancelResponse }` |\n *\n * @param props - See {@link PayrollHistoryProps}.\n * @returns The rendered payroll history view.\n * @public\n */\nexport function PayrollHistory(props: PayrollHistoryProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst DEFAULT_LOOKBACK_MONTHS = 6\nconst DEFAULT_LOOKAHEAD_MONTHS = 3\n\nconst getDefaultStartDate = (): Date => {\n const date = new Date()\n date.setMonth(date.getMonth() - DEFAULT_LOOKBACK_MONTHS)\n return date\n}\n\nconst getDefaultEndDate = (): Date => {\n const date = new Date()\n date.setMonth(date.getMonth() + DEFAULT_LOOKAHEAD_MONTHS)\n return date\n}\n\nconst Root = ({\n onEvent,\n companyId,\n dictionary,\n LoaderComponent,\n className,\n}: PayrollHistoryProps) => {\n useComponentDictionary('Payroll.PayrollHistory', dictionary)\n useI18n('Payroll.PayrollHistory')\n\n const [cancelDialogItem, setCancelDialogItem] = useState<Payroll | null>(null)\n const { baseSubmitHandler } = useBase()\n const { currentPage, itemsPerPage, getPaginationProps, resetPage } = usePagination()\n\n const dateRangeFilter = useDateRangeFilter({\n initialStartDate: getDefaultStartDate(),\n initialEndDate: getDefaultEndDate(),\n onFilterChange: useCallback(() => {\n resetPage()\n }, [resetPage]),\n })\n const dateFilterParams = dateRangeFilter.getApiDateParams()\n\n const { data: payrollsData, isFetching } = usePayrollsList(\n {\n companyId,\n processingStatuses: [ProcessingStatuses.Processed],\n payrollTypes: [QueryParamPayrollTypes.Regular, QueryParamPayrollTypes.OffCycle],\n includeOffCycle: true,\n include: ['totals', 'payroll_status_meta'],\n sortOrder: SortOrder.Desc,\n startDate: dateFilterParams.startDate,\n endDate: dateFilterParams.endDate,\n page: currentPage,\n per: itemsPerPage,\n },\n { placeholderData: keepPreviousData, throwOnError: true },\n )\n\n const payrollHistory = payrollsData?.payrollList || []\n\n const { data: wireInRequestsData } = useWireInRequestsListSuspense({\n companyUuid: companyId,\n })\n\n const wireInRequests = wireInRequestsData.wireInRequestList ?? []\n\n const { mutateAsync: cancelPayroll, isPending: isCancelling } = usePayrollsCancelMutation()\n\n const handleViewSummary = (payrollId: string, startDate?: string, endDate?: string) => {\n onEvent(componentEvents.RUN_PAYROLL_SUMMARY_VIEWED, { payrollId, startDate, endDate })\n }\n\n const handleViewReceipt = (payrollId: string, startDate?: string, endDate?: string) => {\n onEvent(componentEvents.RUN_PAYROLL_RECEIPT_VIEWED, { payrollId, startDate, endDate })\n }\n\n const handleCancelPayroll = async (item: Payroll) => {\n const payrollId = item.payrollUuid || item.uuid!\n try {\n await baseSubmitHandler(payrollId, async id => {\n const result = await cancelPayroll({\n request: {\n companyId,\n payrollId: id,\n },\n })\n\n onEvent(componentEvents.RUN_PAYROLL_CANCELLED, { payrollId: id, result })\n })\n } finally {\n setCancelDialogItem(null)\n }\n }\n\n if (!payrollsData) {\n return <BaseLayout isLoading LoaderComponent={LoaderComponent} />\n }\n\n const paginationProps = getPaginationProps(payrollsData.httpMeta.response.headers, isFetching)\n\n return (\n <PayrollHistoryPresentation\n className={className}\n payrollHistory={payrollHistory}\n wireInRequests={wireInRequests}\n pagination={paginationProps}\n onViewSummary={handleViewSummary}\n onViewReceipt={handleViewReceipt}\n onCancelPayroll={handleCancelPayroll}\n cancelDialogItem={cancelDialogItem}\n onCancelDialogOpen={setCancelDialogItem}\n onCancelDialogClose={() => {\n setCancelDialogItem(null)\n }}\n isLoading={isCancelling}\n dateRangeFilter={dateRangeFilter}\n />\n )\n}\n"],"names":["PayrollHistory","props","jsx","BaseComponent","Root","DEFAULT_LOOKBACK_MONTHS","DEFAULT_LOOKAHEAD_MONTHS","getDefaultStartDate","date","getDefaultEndDate","onEvent","companyId","dictionary","LoaderComponent","className","useComponentDictionary","useI18n","cancelDialogItem","setCancelDialogItem","useState","baseSubmitHandler","useBase","currentPage","itemsPerPage","getPaginationProps","resetPage","usePagination","dateRangeFilter","useDateRangeFilter","useCallback","dateFilterParams","payrollsData","isFetching","usePayrollsList","ProcessingStatuses","QueryParamPayrollTypes","SortOrder","keepPreviousData","payrollHistory","wireInRequestsData","useWireInRequestsListSuspense","wireInRequests","cancelPayroll","isCancelling","usePayrollsCancelMutation","handleViewSummary","payrollId","startDate","endDate","componentEvents","handleViewReceipt","handleCancelPayroll","item","id","result","BaseLayout","paginationProps","PayrollHistoryPresentation"],"mappings":";;;;;;;;;;;;;;AAkDO,SAASA,GAAeC,GAA4B;AACzD,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAA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AAA,MACA,YAAYe;AAAA,MACZ,eAAeX;AAAA,MACf,eAAeK;AAAA,MACf,iBAAiBC;AAAA,MACjB,kBAAAlC;AAAA,MACA,oBAAoBC;AAAA,MACpB,qBAAqB,MAAM;AACzB,QAAAA,EAAoB,IAAI;AAAA,MAC1B;AAAA,MACA,WAAWyB;AAAA,MACX,iBAAAhB;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1,62 +1,47 @@
|
|
|
1
|
-
import { jsxs as d, jsx as
|
|
2
|
-
import { useTranslation as
|
|
3
|
-
import { getPayPeriodOrCheckDateLabel as
|
|
1
|
+
import { jsxs as d, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation as A } from "react-i18next";
|
|
3
|
+
import { getPayPeriodOrCheckDateLabel as p, getPayrollTypeLabel as w, calculateTotalPayroll as M, getCancelDeadlineValues as T, canCancelPayroll as E } from "../helpers.js";
|
|
4
4
|
import { Flex as c } from "../../Common/Flex/Flex.js";
|
|
5
|
-
import { EmptyData as
|
|
6
|
-
import { HamburgerMenu as
|
|
7
|
-
import { DateRangeFilter as
|
|
8
|
-
import { useComponentContext as
|
|
9
|
-
import { formatNumberAsCurrency as
|
|
10
|
-
import { useI18n as
|
|
11
|
-
import { useDateFormatter as
|
|
12
|
-
import
|
|
13
|
-
import
|
|
5
|
+
import { EmptyData as u } from "../../Common/EmptyData/EmptyData.js";
|
|
6
|
+
import { HamburgerMenu as H } from "../../Common/HamburgerMenu/HamburgerMenu.js";
|
|
7
|
+
import { DateRangeFilter as j } from "../../Common/DateRangeFilter/DateRangeFilter.js";
|
|
8
|
+
import { useComponentContext as O } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
9
|
+
import { formatNumberAsCurrency as U } from "../../../helpers/formattedStrings.js";
|
|
10
|
+
import { useI18n as V } from "../../../i18n/I18n.js";
|
|
11
|
+
import { useDateFormatter as q } from "../../../hooks/useDateFormatter.js";
|
|
12
|
+
import B from "../../../assets/icons/trashcan.svg.js";
|
|
13
|
+
import N from "../../../assets/icons/icon-file-outline.svg.js";
|
|
14
14
|
import W from "../../../assets/icons/icon-receipt-outline.svg.js";
|
|
15
|
-
import { PayrollStatusBadges as
|
|
15
|
+
import { PayrollStatusBadges as Y } from "../PayrollStatusBadges/PayrollStatusBadges.js";
|
|
16
16
|
import { DataView as z } from "../../Common/DataView/DataView.js";
|
|
17
|
-
const
|
|
18
|
-
className:
|
|
19
|
-
payrollHistory:
|
|
20
|
-
wireInRequests:
|
|
17
|
+
const oe = ({
|
|
18
|
+
className: y,
|
|
19
|
+
payrollHistory: D,
|
|
20
|
+
wireInRequests: f,
|
|
21
21
|
pagination: s,
|
|
22
|
-
onViewSummary:
|
|
22
|
+
onViewSummary: h,
|
|
23
23
|
onViewReceipt: C,
|
|
24
|
-
onCancelPayroll:
|
|
25
|
-
cancelDialogItem:
|
|
26
|
-
onCancelDialogOpen:
|
|
24
|
+
onCancelPayroll: P,
|
|
25
|
+
cancelDialogItem: r,
|
|
26
|
+
onCancelDialogOpen: b,
|
|
27
27
|
onCancelDialogClose: g,
|
|
28
|
-
isLoading:
|
|
29
|
-
dateRangeFilter:
|
|
28
|
+
isLoading: S = !1,
|
|
29
|
+
dateRangeFilter: i
|
|
30
30
|
}) => {
|
|
31
|
-
const { Heading: L, Text: m, Dialog: v } =
|
|
32
|
-
|
|
33
|
-
const { t: e } =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
day: "numeric",
|
|
40
|
-
timeZone: p
|
|
41
|
-
}), M = new Intl.DateTimeFormat("en-US", {
|
|
42
|
-
hour: "numeric",
|
|
43
|
-
minute: "2-digit",
|
|
44
|
-
timeZoneName: "short",
|
|
45
|
-
timeZone: p
|
|
46
|
-
}), E = T.format(n);
|
|
47
|
-
return `${M.format(n)} on ${E}`;
|
|
48
|
-
}, x = (t) => {
|
|
49
|
-
S(t);
|
|
50
|
-
}, k = () => {
|
|
51
|
-
a && b(a);
|
|
52
|
-
}, A = (t) => {
|
|
53
|
-
const i = t.payrollUuid || t.uuid, n = [
|
|
31
|
+
const { Heading: L, Text: m, Dialog: v } = O();
|
|
32
|
+
V("Payroll.PayrollHistory");
|
|
33
|
+
const { t: e } = A("Payroll.PayrollHistory"), l = q(), x = (t) => {
|
|
34
|
+
b(t);
|
|
35
|
+
}, F = () => {
|
|
36
|
+
r && P(r);
|
|
37
|
+
}, k = (t) => {
|
|
38
|
+
const o = t.payrollUuid || t.uuid, n = [
|
|
54
39
|
{
|
|
55
40
|
label: e("menu.viewSummary"),
|
|
56
|
-
icon: /* @__PURE__ */
|
|
41
|
+
icon: /* @__PURE__ */ a(N, { "aria-hidden": !0 }),
|
|
57
42
|
onClick: () => {
|
|
58
|
-
|
|
59
|
-
|
|
43
|
+
h(
|
|
44
|
+
o,
|
|
60
45
|
t.payPeriod?.startDate ?? void 0,
|
|
61
46
|
t.payPeriod?.endDate ?? void 0
|
|
62
47
|
);
|
|
@@ -64,62 +49,62 @@ const me = ({
|
|
|
64
49
|
},
|
|
65
50
|
{
|
|
66
51
|
label: e("menu.viewReceipt"),
|
|
67
|
-
icon: /* @__PURE__ */
|
|
52
|
+
icon: /* @__PURE__ */ a(W, { "aria-hidden": !0 }),
|
|
68
53
|
onClick: () => {
|
|
69
54
|
C(
|
|
70
|
-
|
|
55
|
+
o,
|
|
71
56
|
t.payPeriod?.startDate ?? void 0,
|
|
72
57
|
t.payPeriod?.endDate ?? void 0
|
|
73
58
|
);
|
|
74
59
|
}
|
|
75
60
|
}
|
|
76
61
|
];
|
|
77
|
-
return
|
|
62
|
+
return E(t) && n.push({
|
|
78
63
|
label: e("menu.cancelPayroll"),
|
|
79
|
-
icon: /* @__PURE__ */
|
|
64
|
+
icon: /* @__PURE__ */ a(B, { "aria-hidden": !0 }),
|
|
80
65
|
onClick: () => {
|
|
81
66
|
x(t);
|
|
82
67
|
},
|
|
83
68
|
"data-destructive": "true"
|
|
84
69
|
}), n;
|
|
85
70
|
};
|
|
86
|
-
return /* @__PURE__ */ d(c, { className:
|
|
71
|
+
return /* @__PURE__ */ d(c, { className: y, flexDirection: "column", gap: 16, children: [
|
|
87
72
|
/* @__PURE__ */ d(c, { justifyContent: "space-between", alignItems: "center", children: [
|
|
88
|
-
/* @__PURE__ */
|
|
89
|
-
/* @__PURE__ */
|
|
90
|
-
|
|
73
|
+
/* @__PURE__ */ a(L, { as: "h2", children: e("title") }),
|
|
74
|
+
/* @__PURE__ */ a(
|
|
75
|
+
j,
|
|
91
76
|
{
|
|
92
|
-
startDate:
|
|
93
|
-
endDate:
|
|
94
|
-
onStartDateChange:
|
|
95
|
-
onEndDateChange:
|
|
96
|
-
onClear:
|
|
77
|
+
startDate: i.startDate,
|
|
78
|
+
endDate: i.endDate,
|
|
79
|
+
onStartDateChange: i.handleStartDateChange,
|
|
80
|
+
onEndDateChange: i.handleEndDateChange,
|
|
81
|
+
onClear: i.handleClearFilter,
|
|
97
82
|
startDateLabel: e("dateFilter.startDate"),
|
|
98
83
|
endDateLabel: e("dateFilter.endDate"),
|
|
99
84
|
applyLabel: e("dateFilter.apply"),
|
|
100
85
|
cancelLabel: e("dateFilter.cancel"),
|
|
101
86
|
resetLabel: e("dateFilter.reset"),
|
|
102
87
|
selectDatesLabel: e("dateFilter.selectDates"),
|
|
103
|
-
|
|
104
|
-
maxEndDate:
|
|
105
|
-
minStartDate:
|
|
88
|
+
getTriggerLabel: (t) => e("dateFilter.triggerLabel", { selection: t }),
|
|
89
|
+
maxEndDate: i.getMaxEndDate(),
|
|
90
|
+
minStartDate: i.getMinStartDate()
|
|
106
91
|
}
|
|
107
92
|
)
|
|
108
93
|
] }),
|
|
109
|
-
/* @__PURE__ */
|
|
94
|
+
/* @__PURE__ */ a(
|
|
110
95
|
z,
|
|
111
96
|
{
|
|
112
97
|
label: e("dataView.label"),
|
|
113
98
|
pagination: s,
|
|
114
99
|
isFetching: s.isFetching,
|
|
115
|
-
emptyState: () =>
|
|
116
|
-
|
|
100
|
+
emptyState: () => i.isModified ? /* @__PURE__ */ a(
|
|
101
|
+
u,
|
|
117
102
|
{
|
|
118
103
|
title: e("emptyState.filtered.title"),
|
|
119
104
|
description: e("emptyState.filtered.description")
|
|
120
105
|
}
|
|
121
|
-
) : /* @__PURE__ */
|
|
122
|
-
|
|
106
|
+
) : /* @__PURE__ */ a(
|
|
107
|
+
u,
|
|
123
108
|
{
|
|
124
109
|
title: e("emptyState.default.title"),
|
|
125
110
|
description: e("emptyState.default.description")
|
|
@@ -128,11 +113,11 @@ const me = ({
|
|
|
128
113
|
columns: [
|
|
129
114
|
{
|
|
130
115
|
title: e("columns.payPeriod"),
|
|
131
|
-
render: (t) =>
|
|
116
|
+
render: (t) => p(t, l)
|
|
132
117
|
},
|
|
133
118
|
{
|
|
134
119
|
title: e("columns.type"),
|
|
135
|
-
render: (t) =>
|
|
120
|
+
render: (t) => w(t)
|
|
136
121
|
},
|
|
137
122
|
{
|
|
138
123
|
title: e("columns.payDate"),
|
|
@@ -141,46 +126,47 @@ const me = ({
|
|
|
141
126
|
{
|
|
142
127
|
title: e("columns.status"),
|
|
143
128
|
render: (t) => {
|
|
144
|
-
const
|
|
129
|
+
const o = f.find(
|
|
145
130
|
(n) => n.paymentUuid === t.payrollUuid
|
|
146
131
|
);
|
|
147
|
-
return /* @__PURE__ */
|
|
132
|
+
return /* @__PURE__ */ a(Y, { payroll: t, wireInRequest: o });
|
|
148
133
|
}
|
|
149
134
|
},
|
|
150
135
|
{
|
|
151
136
|
title: e("columns.totalPayroll"),
|
|
152
137
|
justify: "end",
|
|
153
|
-
render: (t) =>
|
|
138
|
+
render: (t) => U(M(t))
|
|
154
139
|
}
|
|
155
140
|
],
|
|
156
|
-
data:
|
|
157
|
-
itemMenu: (t) => /* @__PURE__ */
|
|
141
|
+
data: D,
|
|
142
|
+
itemMenu: (t) => /* @__PURE__ */ a(H, { items: k(t) })
|
|
158
143
|
}
|
|
159
144
|
),
|
|
160
|
-
/* @__PURE__ */
|
|
145
|
+
/* @__PURE__ */ a(
|
|
161
146
|
v,
|
|
162
147
|
{
|
|
163
|
-
isOpen: !!
|
|
148
|
+
isOpen: !!r,
|
|
164
149
|
onClose: g,
|
|
165
|
-
onPrimaryActionClick:
|
|
150
|
+
onPrimaryActionClick: F,
|
|
166
151
|
isDestructive: !0,
|
|
167
|
-
isPrimaryActionLoading:
|
|
152
|
+
isPrimaryActionLoading: S,
|
|
168
153
|
primaryActionLabel: e("cancelDialog.primaryAction"),
|
|
169
154
|
closeActionLabel: e("cancelDialog.secondaryAction"),
|
|
170
|
-
title:
|
|
171
|
-
payPeriod:
|
|
155
|
+
title: r ? e("cancelDialog.title", {
|
|
156
|
+
payPeriod: p(r, l)
|
|
172
157
|
}) : "",
|
|
173
|
-
children:
|
|
174
|
-
/* @__PURE__ */
|
|
175
|
-
|
|
176
|
-
deadline
|
|
177
|
-
|
|
158
|
+
children: r && /* @__PURE__ */ d(c, { flexDirection: "column", gap: 16, children: [
|
|
159
|
+
/* @__PURE__ */ a(m, { children: e("cancelDialog.body") }),
|
|
160
|
+
r.payrollDeadline && /* @__PURE__ */ a(m, { children: e(
|
|
161
|
+
"cancelDialog.deadline",
|
|
162
|
+
T(r, l)
|
|
163
|
+
) })
|
|
178
164
|
] })
|
|
179
165
|
}
|
|
180
166
|
)
|
|
181
167
|
] });
|
|
182
168
|
};
|
|
183
169
|
export {
|
|
184
|
-
|
|
170
|
+
oe as PayrollHistoryPresentation
|
|
185
171
|
};
|
|
186
172
|
//# sourceMappingURL=PayrollHistoryPresentation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayrollHistoryPresentation.js","sources":["../../../../src/components/Payroll/PayrollHistory/PayrollHistoryPresentation.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { Payroll } from '@gusto/embedded-api/models/components/payrollshow'\nimport type { WireInRequest } from '@gusto/embedded-api/models/components/wireinrequest'\nimport { PayrollStatusBadges } from '../PayrollStatusBadges'\nimport {\n getPayrollTypeLabel,\n calculateTotalPayroll,\n canCancelPayroll,\n getPayPeriodOrCheckDateLabel,\n} from '../helpers'\nimport type { MenuItem } from '@/components/Common/UI/Menu/MenuTypes'\nimport { DataView, Flex, DateRangeFilter } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport { formatNumberAsCurrency } from '@/helpers/formattedStrings'\nimport { useI18n } from '@/i18n'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport type { PaginationControlProps } from '@/components/Common/PaginationControl/PaginationControlTypes'\nimport type { UseDateRangeFilterResult } from '@/hooks/useDateRangeFilter/useDateRangeFilter'\nimport TrashcanIcon from '@/assets/icons/trashcan.svg?react'\nimport FileIcon from '@/assets/icons/icon-file-outline.svg?react'\nimport ReceiptIcon from '@/assets/icons/icon-receipt-outline.svg?react'\nimport { EmptyData } from '@/components/Common/'\n\ninterface PayrollHistoryPresentationProps {\n /** CSS class name applied to the root element. */\n className?: string\n payrollHistory: Payroll[]\n wireInRequests: WireInRequest[]\n pagination: PaginationControlProps\n onViewSummary: (payrollId: string, startDate?: string, endDate?: string) => void\n onViewReceipt: (payrollId: string, startDate?: string, endDate?: string) => void\n onCancelPayroll: (item: Payroll) => void\n cancelDialogItem: Payroll | null\n onCancelDialogOpen: (item: Payroll) => void\n onCancelDialogClose: () => void\n isLoading?: boolean\n dateRangeFilter: UseDateRangeFilterResult\n}\n\n/** @internal */\nexport const PayrollHistoryPresentation = ({\n className,\n payrollHistory,\n wireInRequests,\n pagination,\n onViewSummary,\n onViewReceipt,\n onCancelPayroll,\n cancelDialogItem,\n onCancelDialogOpen,\n onCancelDialogClose,\n isLoading = false,\n dateRangeFilter,\n}: PayrollHistoryPresentationProps) => {\n const { Heading, Text, Dialog } = useComponentContext()\n useI18n('Payroll.PayrollHistory')\n const { t } = useTranslation('Payroll.PayrollHistory')\n const dateFormatter = useDateFormatter()\n\n const formatDeadlineForDialog = (item: Payroll): string => {\n const deadline = item.payrollDeadline\n if (!deadline) return ''\n\n const deadlineDate = new Date(deadline)\n const timeZone = 'America/New_York'\n\n const formatter = new Intl.DateTimeFormat('en-US', {\n weekday: 'short',\n month: 'short',\n day: 'numeric',\n timeZone,\n })\n\n const timeFormatter = new Intl.DateTimeFormat('en-US', {\n hour: 'numeric',\n minute: '2-digit',\n timeZoneName: 'short',\n timeZone,\n })\n\n const dateStr = formatter.format(deadlineDate)\n const timeStr = timeFormatter.format(deadlineDate)\n\n return `${timeStr} on ${dateStr}`\n }\n\n const handleCancelClick = (item: Payroll) => {\n onCancelDialogOpen(item)\n }\n\n const handleConfirmCancel = () => {\n if (cancelDialogItem) {\n onCancelPayroll(cancelDialogItem)\n }\n }\n\n const getMenuItems = (item: Payroll): MenuItem[] => {\n const payrollId = item.payrollUuid || item.uuid!\n const items: MenuItem[] = [\n {\n label: t('menu.viewSummary'),\n icon: <FileIcon aria-hidden />,\n onClick: () => {\n onViewSummary(\n payrollId,\n item.payPeriod?.startDate ?? undefined,\n item.payPeriod?.endDate ?? undefined,\n )\n },\n },\n {\n label: t('menu.viewReceipt'),\n icon: <ReceiptIcon aria-hidden />,\n onClick: () => {\n onViewReceipt(\n payrollId,\n item.payPeriod?.startDate ?? undefined,\n item.payPeriod?.endDate ?? undefined,\n )\n },\n },\n ]\n\n if (canCancelPayroll(item)) {\n items.push({\n label: t('menu.cancelPayroll'),\n icon: <TrashcanIcon aria-hidden />,\n onClick: () => {\n handleCancelClick(item)\n },\n 'data-destructive': 'true',\n })\n }\n\n return items\n }\n\n return (\n <Flex className={className} flexDirection=\"column\" gap={16}>\n <Flex justifyContent=\"space-between\" alignItems=\"center\">\n <Heading as=\"h2\">{t('title')}</Heading>\n <DateRangeFilter\n startDate={dateRangeFilter.startDate}\n endDate={dateRangeFilter.endDate}\n onStartDateChange={dateRangeFilter.handleStartDateChange}\n onEndDateChange={dateRangeFilter.handleEndDateChange}\n onClear={dateRangeFilter.handleClearFilter}\n startDateLabel={t('dateFilter.startDate')}\n endDateLabel={t('dateFilter.endDate')}\n applyLabel={t('dateFilter.apply')}\n cancelLabel={t('dateFilter.cancel')}\n resetLabel={t('dateFilter.reset')}\n selectDatesLabel={t('dateFilter.selectDates')}\n triggerLabel={t('dateFilter.trigger')}\n maxEndDate={dateRangeFilter.getMaxEndDate()}\n minStartDate={dateRangeFilter.getMinStartDate()}\n />\n </Flex>\n\n <DataView\n label={t('dataView.label')}\n pagination={pagination}\n isFetching={pagination.isFetching}\n emptyState={() =>\n dateRangeFilter.isModified ? (\n <EmptyData\n title={t('emptyState.filtered.title')}\n description={t('emptyState.filtered.description')}\n />\n ) : (\n <EmptyData\n title={t('emptyState.default.title')}\n description={t('emptyState.default.description')}\n />\n )\n }\n columns={[\n {\n title: t('columns.payPeriod'),\n render: (item: Payroll) => getPayPeriodOrCheckDateLabel(item, dateFormatter),\n },\n {\n title: t('columns.type'),\n render: (item: Payroll) => getPayrollTypeLabel(item),\n },\n {\n title: t('columns.payDate'),\n render: (item: Payroll) => dateFormatter.formatShortWithYear(item.checkDate),\n },\n {\n title: t('columns.status'),\n render: (item: Payroll) => {\n const wireInRequest = wireInRequests.find(\n wire => wire.paymentUuid === item.payrollUuid,\n )\n return <PayrollStatusBadges payroll={item} wireInRequest={wireInRequest} />\n },\n },\n {\n title: t('columns.totalPayroll'),\n justify: 'end',\n render: (item: Payroll) => formatNumberAsCurrency(calculateTotalPayroll(item)),\n },\n ]}\n data={payrollHistory}\n itemMenu={(item: Payroll) => <HamburgerMenu items={getMenuItems(item)} />}\n />\n\n <Dialog\n isOpen={!!cancelDialogItem}\n onClose={onCancelDialogClose}\n onPrimaryActionClick={handleConfirmCancel}\n isDestructive\n isPrimaryActionLoading={isLoading}\n primaryActionLabel={t('cancelDialog.primaryAction')}\n closeActionLabel={t('cancelDialog.secondaryAction')}\n title={\n cancelDialogItem\n ? t('cancelDialog.title', {\n payPeriod: getPayPeriodOrCheckDateLabel(cancelDialogItem, dateFormatter),\n })\n : ''\n }\n >\n {cancelDialogItem && (\n <Flex flexDirection=\"column\" gap={16}>\n <Text>{t('cancelDialog.body')}</Text>\n {cancelDialogItem.payrollDeadline && (\n <Text>\n {t('cancelDialog.deadline', {\n deadline: formatDeadlineForDialog(cancelDialogItem),\n })}\n </Text>\n )}\n </Flex>\n )}\n </Dialog>\n </Flex>\n )\n}\n"],"names":["PayrollHistoryPresentation","className","payrollHistory","wireInRequests","pagination","onViewSummary","onViewReceipt","onCancelPayroll","cancelDialogItem","onCancelDialogOpen","onCancelDialogClose","isLoading","dateRangeFilter","Heading","Text","Dialog","useComponentContext","useI18n","t","useTranslation","dateFormatter","useDateFormatter","formatDeadlineForDialog","item","deadline","deadlineDate","timeZone","formatter","timeFormatter","dateStr","handleCancelClick","handleConfirmCancel","getMenuItems","payrollId","items","jsx","FileIcon","ReceiptIcon","canCancelPayroll","TrashcanIcon","Flex","jsxs","DateRangeFilter","DataView","EmptyData","getPayPeriodOrCheckDateLabel","getPayrollTypeLabel","wireInRequest","wire","PayrollStatusBadges","formatNumberAsCurrency","calculateTotalPayroll","HamburgerMenu"],"mappings":";;;;;;;;;;;;;;;;AAyCO,MAAMA,KAA6B,CAAC;AAAA,EACzC,WAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,iBAAAC;AACF,MAAuC;AACrC,QAAM,EAAE,SAAAC,GAAS,MAAAC,GAAM,QAAAC,EAAA,IAAWC,EAAA;AAClC,EAAAC,EAAQ,wBAAwB;AAChC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,wBAAwB,GAC/CC,IAAgBC,EAAA,GAEhBC,IAA0B,CAACC,MAA0B;AACzD,UAAMC,IAAWD,EAAK;AACtB,QAAI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wBpB;AAAA,QACxB,oBAAoBO,EAAE,4BAA4B;AAAA,QAClD,kBAAkBA,EAAE,8BAA8B;AAAA,QAClD,OACEV,IACIU,EAAE,sBAAsB;AAAA,UACtB,WAAW2B,EAA6BrC,GAAkBY,CAAa;AAAA,QAAA,CACxE,IACD;AAAA,QAGL,eACC,gBAAAqB,EAACD,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,UAAA,gBAAAL,EAACrB,GAAA,EAAM,UAAAI,EAAE,mBAAmB,EAAA,CAAE;AAAA,UAC7BV,EAAiB,mBAChB,gBAAA2B,EAACrB,GAAA,EACE,YAAE,yBAAyB;AAAA,YAC1B,UAAUQ,EAAwBd,CAAgB;AAAA,UAAA,CACnD,EAAA,CACH;AAAA,QAAA,EAAA,CAEJ;AAAA,MAAA;AAAA,IAAA;AAAA,EAEJ,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"PayrollHistoryPresentation.js","sources":["../../../../src/components/Payroll/PayrollHistory/PayrollHistoryPresentation.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { Payroll } from '@gusto/embedded-api/models/components/unprocessedpayroll'\nimport type { WireInRequest } from '@gusto/embedded-api/models/components/wireinrequest'\nimport { PayrollStatusBadges } from '../PayrollStatusBadges'\nimport {\n getPayrollTypeLabel,\n calculateTotalPayroll,\n canCancelPayroll,\n getCancelDeadlineValues,\n getPayPeriodOrCheckDateLabel,\n} from '../helpers'\nimport type { MenuItem } from '@/components/Common/UI/Menu/MenuTypes'\nimport { DataView, Flex, DateRangeFilter } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport { formatNumberAsCurrency } from '@/helpers/formattedStrings'\nimport { useI18n } from '@/i18n'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport type { PaginationControlProps } from '@/components/Common/PaginationControl/PaginationControlTypes'\nimport type { UseDateRangeFilterResult } from '@/hooks/useDateRangeFilter/useDateRangeFilter'\nimport TrashcanIcon from '@/assets/icons/trashcan.svg?react'\nimport FileIcon from '@/assets/icons/icon-file-outline.svg?react'\nimport ReceiptIcon from '@/assets/icons/icon-receipt-outline.svg?react'\nimport { EmptyData } from '@/components/Common/'\n\ninterface PayrollHistoryPresentationProps {\n /** CSS class name applied to the root element. */\n className?: string\n payrollHistory: Payroll[]\n wireInRequests: WireInRequest[]\n pagination: PaginationControlProps\n onViewSummary: (payrollId: string, startDate?: string, endDate?: string) => void\n onViewReceipt: (payrollId: string, startDate?: string, endDate?: string) => void\n onCancelPayroll: (item: Payroll) => void\n cancelDialogItem: Payroll | null\n onCancelDialogOpen: (item: Payroll) => void\n onCancelDialogClose: () => void\n isLoading?: boolean\n dateRangeFilter: UseDateRangeFilterResult\n}\n\n/** @internal */\nexport const PayrollHistoryPresentation = ({\n className,\n payrollHistory,\n wireInRequests,\n pagination,\n onViewSummary,\n onViewReceipt,\n onCancelPayroll,\n cancelDialogItem,\n onCancelDialogOpen,\n onCancelDialogClose,\n isLoading = false,\n dateRangeFilter,\n}: PayrollHistoryPresentationProps) => {\n const { Heading, Text, Dialog } = useComponentContext()\n useI18n('Payroll.PayrollHistory')\n const { t } = useTranslation('Payroll.PayrollHistory')\n const dateFormatter = useDateFormatter()\n\n const handleCancelClick = (item: Payroll) => {\n onCancelDialogOpen(item)\n }\n\n const handleConfirmCancel = () => {\n if (cancelDialogItem) {\n onCancelPayroll(cancelDialogItem)\n }\n }\n\n const getMenuItems = (item: Payroll): MenuItem[] => {\n const payrollId = item.payrollUuid || item.uuid!\n const items: MenuItem[] = [\n {\n label: t('menu.viewSummary'),\n icon: <FileIcon aria-hidden />,\n onClick: () => {\n onViewSummary(\n payrollId,\n item.payPeriod?.startDate ?? undefined,\n item.payPeriod?.endDate ?? undefined,\n )\n },\n },\n {\n label: t('menu.viewReceipt'),\n icon: <ReceiptIcon aria-hidden />,\n onClick: () => {\n onViewReceipt(\n payrollId,\n item.payPeriod?.startDate ?? undefined,\n item.payPeriod?.endDate ?? undefined,\n )\n },\n },\n ]\n\n if (canCancelPayroll(item)) {\n items.push({\n label: t('menu.cancelPayroll'),\n icon: <TrashcanIcon aria-hidden />,\n onClick: () => {\n handleCancelClick(item)\n },\n 'data-destructive': 'true',\n })\n }\n\n return items\n }\n\n return (\n <Flex className={className} flexDirection=\"column\" gap={16}>\n <Flex justifyContent=\"space-between\" alignItems=\"center\">\n <Heading as=\"h2\">{t('title')}</Heading>\n <DateRangeFilter\n startDate={dateRangeFilter.startDate}\n endDate={dateRangeFilter.endDate}\n onStartDateChange={dateRangeFilter.handleStartDateChange}\n onEndDateChange={dateRangeFilter.handleEndDateChange}\n onClear={dateRangeFilter.handleClearFilter}\n startDateLabel={t('dateFilter.startDate')}\n endDateLabel={t('dateFilter.endDate')}\n applyLabel={t('dateFilter.apply')}\n cancelLabel={t('dateFilter.cancel')}\n resetLabel={t('dateFilter.reset')}\n selectDatesLabel={t('dateFilter.selectDates')}\n getTriggerLabel={selection => t('dateFilter.triggerLabel', { selection })}\n maxEndDate={dateRangeFilter.getMaxEndDate()}\n minStartDate={dateRangeFilter.getMinStartDate()}\n />\n </Flex>\n\n <DataView\n label={t('dataView.label')}\n pagination={pagination}\n isFetching={pagination.isFetching}\n emptyState={() =>\n dateRangeFilter.isModified ? (\n <EmptyData\n title={t('emptyState.filtered.title')}\n description={t('emptyState.filtered.description')}\n />\n ) : (\n <EmptyData\n title={t('emptyState.default.title')}\n description={t('emptyState.default.description')}\n />\n )\n }\n columns={[\n {\n title: t('columns.payPeriod'),\n render: (item: Payroll) => getPayPeriodOrCheckDateLabel(item, dateFormatter),\n },\n {\n title: t('columns.type'),\n render: (item: Payroll) => getPayrollTypeLabel(item),\n },\n {\n title: t('columns.payDate'),\n render: (item: Payroll) => dateFormatter.formatShortWithYear(item.checkDate),\n },\n {\n title: t('columns.status'),\n render: (item: Payroll) => {\n const wireInRequest = wireInRequests.find(\n wire => wire.paymentUuid === item.payrollUuid,\n )\n return <PayrollStatusBadges payroll={item} wireInRequest={wireInRequest} />\n },\n },\n {\n title: t('columns.totalPayroll'),\n justify: 'end',\n render: (item: Payroll) => formatNumberAsCurrency(calculateTotalPayroll(item)),\n },\n ]}\n data={payrollHistory}\n itemMenu={(item: Payroll) => <HamburgerMenu items={getMenuItems(item)} />}\n />\n\n <Dialog\n isOpen={!!cancelDialogItem}\n onClose={onCancelDialogClose}\n onPrimaryActionClick={handleConfirmCancel}\n isDestructive\n isPrimaryActionLoading={isLoading}\n primaryActionLabel={t('cancelDialog.primaryAction')}\n closeActionLabel={t('cancelDialog.secondaryAction')}\n title={\n cancelDialogItem\n ? t('cancelDialog.title', {\n payPeriod: getPayPeriodOrCheckDateLabel(cancelDialogItem, dateFormatter),\n })\n : ''\n }\n >\n {cancelDialogItem && (\n <Flex flexDirection=\"column\" gap={16}>\n <Text>{t('cancelDialog.body')}</Text>\n {cancelDialogItem.payrollDeadline && (\n <Text>\n {t(\n 'cancelDialog.deadline',\n getCancelDeadlineValues(cancelDialogItem, dateFormatter),\n )}\n </Text>\n )}\n </Flex>\n )}\n </Dialog>\n </Flex>\n )\n}\n"],"names":["PayrollHistoryPresentation","className","payrollHistory","wireInRequests","pagination","onViewSummary","onViewReceipt","onCancelPayroll","cancelDialogItem","onCancelDialogOpen","onCancelDialogClose","isLoading","dateRangeFilter","Heading","Text","Dialog","useComponentContext","useI18n","t","useTranslation","dateFormatter","useDateFormatter","handleCancelClick","item","handleConfirmCancel","getMenuItems","payrollId","items","jsx","FileIcon","ReceiptIcon","canCancelPayroll","TrashcanIcon","Flex","jsxs","DateRangeFilter","selection","DataView","EmptyData","getPayPeriodOrCheckDateLabel","getPayrollTypeLabel","wireInRequest","wire","PayrollStatusBadges","formatNumberAsCurrency","calculateTotalPayroll","HamburgerMenu","getCancelDeadlineValues"],"mappings":";;;;;;;;;;;;;;;;AA0CO,MAAMA,KAA6B,CAAC;AAAA,EACzC,WAAAC;AAAA,EACA,gBAAAC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