@gusto/embedded-react-sdk 0.24.1 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +69 -0
- package/dist/assets/icons/slash-circle.svg.js +10 -0
- package/dist/assets/icons/slash-circle.svg.js.map +1 -0
- package/dist/components/Base/Base.d.ts +1 -1
- package/dist/components/Base/Base.js.map +1 -1
- package/dist/components/Common/Fields/FileInputField/FileInputField.d.ts +5 -0
- package/dist/components/Common/Fields/FileInputField/FileInputField.js +34 -0
- package/dist/components/Common/Fields/FileInputField/FileInputField.js.map +1 -0
- package/dist/components/Common/Fields/FileInputField/index.d.ts +2 -0
- package/dist/components/Common/PaginationControl/PaginationControl.js +41 -40
- package/dist/components/Common/PaginationControl/PaginationControl.js.map +1 -1
- package/dist/components/Common/PaginationControl/PaginationControlTypes.d.ts +1 -0
- package/dist/components/Common/SignatureForm/SignatureForm.js +12 -11
- package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormActions.js +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormFields.js +1 -1
- package/dist/components/Common/UI/FileInput/FileInput.d.ts +2 -0
- package/dist/components/Common/UI/FileInput/FileInput.js +151 -0
- package/dist/components/Common/UI/FileInput/FileInput.js.map +1 -0
- package/dist/components/Common/UI/FileInput/FileInput.module.scss.js +34 -0
- package/dist/components/Common/UI/FileInput/FileInput.module.scss.js.map +1 -0
- package/dist/components/Common/UI/FileInput/FileInputTypes.d.ts +45 -0
- package/dist/components/Common/UI/FileInput/FileInputTypes.js +8 -0
- package/dist/components/Common/UI/FileInput/FileInputTypes.js.map +1 -0
- package/dist/components/Common/UI/FileInput/index.d.ts +4 -0
- package/dist/components/Common/UI/TextInput/TextInput.js +27 -23
- package/dist/components/Common/UI/TextInput/TextInput.js.map +1 -1
- package/dist/components/Common/UI/TextInput/TextInputTypes.d.ts +1 -1
- package/dist/components/Common/UI/TextInput/TextInputTypes.js.map +1 -1
- package/dist/components/Company/AssignSignatory/AssignSignatory.js +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +4 -3
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +4 -3
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +6 -5
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Form.js +5 -4
- package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +4 -3
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +5 -4
- package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +2 -2
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +4 -3
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +2 -2
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +4 -3
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Company/FederalTaxes/FederalTaxes.js +2 -2
- package/dist/components/Company/FederalTaxes/Form.js +3 -2
- package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +9 -8
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +7 -6
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/LocationForm.js +2 -2
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +4 -3
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/List.js +35 -33
- package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/LocationsList.js +30 -29
- package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.d.ts +1 -0
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +4 -3
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/Completed.js +3 -2
- package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/MissingRequirements.js +3 -2
- package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +2 -2
- package/dist/components/Company/OnboardingOverview/context.js +4 -3
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/PaySchedule.js +2 -2
- package/dist/components/Company/PaySchedule/_parts/Head.js +9 -8
- package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/List.js +12 -11
- package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
- package/dist/components/Company/PaySchedule/usePaySchedule.js +6 -5
- package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +4 -3
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +4 -3
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Contractor/Address/Address.js +2 -2
- package/dist/components/Contractor/Address/useAddress.js +6 -5
- package/dist/components/Contractor/Address/useAddress.js.map +1 -1
- package/dist/components/Contractor/ContractorList/index.js +31 -30
- package/dist/components/Contractor/ContractorList/index.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js +61 -59
- package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js +34 -31
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js +29 -10
- package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.d.ts +3 -1
- package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js +33 -31
- package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.d.ts +2 -0
- package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js +25 -19
- package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.d.ts +1 -0
- package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js +86 -56
- package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.d.ts +1 -2
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.js +46 -21
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.d.ts +6 -15
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js +116 -99
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.module.scss.js +8 -0
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.module.scss.js.map +1 -0
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.d.ts +8 -0
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.js +51 -0
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.js.map +1 -0
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.d.ts +11 -0
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js +157 -0
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js.map +1 -0
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.module.scss.js +22 -0
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.module.scss.js.map +1 -0
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +46 -48
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -1
- package/dist/components/Contractor/Profile/useContractorProfile.js +3 -2
- package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
- package/dist/components/Contractor/Submit/Submit.js +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +4 -3
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +4 -3
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +4 -3
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/List.js +3 -2
- package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +4 -3
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +4 -3
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Employee/EmployeeList/EmployeeList.js +58 -56
- package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
- package/dist/components/Employee/EmployeeList/Head.js +3 -2
- package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
- package/dist/components/Employee/EmployeeList/List.js +34 -32
- package/dist/components/Employee/EmployeeList/List.js.map +1 -1
- package/dist/components/Employee/EmployeeList/useEmployeeList.d.ts +1 -0
- package/dist/components/Employee/EmployeeList/useEmployeeList.js +4 -3
- package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +4 -3
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Employee/Landing/Landing.js +8 -8
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +7 -7
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +6 -5
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/useProfile.js +4 -3
- package/dist/components/Employee/Profile/useProfile.js.map +1 -1
- package/dist/components/Employee/StateTaxes/useStateTaxes.js +4 -3
- package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
- package/dist/components/Employee/Taxes/useTaxes.js +4 -3
- package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
- package/dist/components/Flow/Flow.js +3 -2
- package/dist/components/Flow/Flow.js.map +1 -1
- package/dist/components/Payroll/InformationRequests/InformationRequestForm/InformationRequestForm.d.ts +15 -0
- package/dist/components/Payroll/InformationRequests/InformationRequestForm/InformationRequestForm.js +142 -0
- package/dist/components/Payroll/InformationRequests/InformationRequestForm/InformationRequestForm.js.map +1 -0
- package/dist/components/Payroll/InformationRequests/InformationRequestForm/InformationRequestForm.module.scss.js +18 -0
- package/dist/components/Payroll/InformationRequests/InformationRequestForm/InformationRequestForm.module.scss.js.map +1 -0
- package/dist/components/Payroll/InformationRequests/InformationRequestForm/index.d.ts +2 -0
- package/dist/components/Payroll/InformationRequests/InformationRequestList/InformationRequestList.d.ts +7 -0
- package/dist/components/Payroll/InformationRequests/InformationRequestList/InformationRequestList.js +88 -0
- package/dist/components/Payroll/InformationRequests/InformationRequestList/InformationRequestList.js.map +1 -0
- package/dist/components/Payroll/InformationRequests/InformationRequestList/index.d.ts +2 -0
- package/dist/components/Payroll/InformationRequests/InformationRequests.d.ts +6 -0
- package/dist/components/Payroll/InformationRequests/InformationRequests.js +55 -0
- package/dist/components/Payroll/InformationRequests/InformationRequests.js.map +1 -0
- package/dist/components/Payroll/InformationRequests/InformationRequestsComponents.d.ts +19 -0
- package/dist/components/Payroll/InformationRequests/InformationRequestsComponents.js +20 -0
- package/dist/components/Payroll/InformationRequests/InformationRequestsComponents.js.map +1 -0
- package/dist/components/Payroll/InformationRequests/index.d.ts +3 -0
- package/dist/components/Payroll/InformationRequests/informationRequestsStateMachine.d.ts +13 -0
- package/dist/components/Payroll/InformationRequests/informationRequestsStateMachine.js +47 -0
- package/dist/components/Payroll/InformationRequests/informationRequestsStateMachine.js.map +1 -0
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js +7 -6
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +3 -2
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +116 -130
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +5 -2
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +107 -99
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.module.scss.js +2 -4
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.module.scss.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.d.ts +21 -0
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +105 -0
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -0
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +41 -37
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.d.ts +5 -4
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +151 -145
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +14 -12
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.d.ts +2 -0
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js +174 -106
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistory.js +28 -28
- package/dist/components/Payroll/PayrollHistory/PayrollHistory.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.d.ts +2 -2
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +84 -102
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollLanding/PayrollLanding.js +24 -20
- package/dist/components/Payroll/PayrollLanding/PayrollLanding.js.map +1 -1
- package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.d.ts +2 -0
- package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js +51 -46
- package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js.map +1 -1
- package/dist/components/Payroll/PayrollLanding/payrollLandingStateMachine.d.ts +2 -0
- package/dist/components/Payroll/PayrollLanding/payrollLandingStateMachine.js +111 -45
- package/dist/components/Payroll/PayrollLanding/payrollLandingStateMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +137 -125
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.module.scss.js +8 -4
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.module.scss.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +117 -110
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.d.ts +4 -2
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +282 -278
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewTypes.d.ts +6 -0
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewTypes.js +5 -0
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewTypes.js.map +1 -0
- package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js +3 -2
- package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +3 -2
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
- package/dist/components/Payroll/RecoveryCases/RecoveryCases.d.ts +6 -0
- package/dist/components/Payroll/RecoveryCases/RecoveryCases.js +55 -0
- package/dist/components/Payroll/RecoveryCases/RecoveryCases.js.map +1 -0
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesComponents.d.ts +19 -0
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesComponents.js +19 -0
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesComponents.js.map +1 -0
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.d.ts +7 -0
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js +73 -0
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js.map +1 -0
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.module.scss.js +10 -0
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.module.scss.js.map +1 -0
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/index.d.ts +2 -0
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.d.ts +14 -0
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js +46 -0
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js.map +1 -0
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/index.d.ts +2 -0
- package/dist/components/Payroll/RecoveryCases/index.d.ts +3 -0
- package/dist/components/Payroll/RecoveryCases/recoveryCasesStateMachine.d.ts +13 -0
- package/dist/components/Payroll/RecoveryCases/recoveryCasesStateMachine.js +47 -0
- package/dist/components/Payroll/RecoveryCases/recoveryCasesStateMachine.js.map +1 -0
- package/dist/components/Payroll/helpers.d.ts +12 -0
- package/dist/components/Payroll/helpers.js +129 -117
- package/dist/components/Payroll/helpers.js.map +1 -1
- package/dist/components/Payroll/index.d.ts +2 -0
- package/dist/components/Payroll/index.js +18 -14
- package/dist/components/Payroll/index.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.d.ts +4 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +43 -31
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js +27 -25
- package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js.map +1 -1
- package/dist/contexts/ComponentAdapter/componentAdapterTypes.d.ts +1 -0
- package/dist/contexts/ComponentAdapter/createComponentsWithDefaults.d.ts +5 -0
- package/dist/contexts/ComponentAdapter/createComponentsWithDefaults.js +17 -15
- package/dist/contexts/ComponentAdapter/createComponentsWithDefaults.js.map +1 -1
- package/dist/contexts/ComponentAdapter/useComponentContext.d.ts +2 -0
- package/dist/contexts/ComponentAdapter/useComponentContext.js +3 -3
- package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
- package/dist/helpers/dateFormatting.d.ts +1 -0
- package/dist/helpers/dateFormatting.js +1 -0
- package/dist/helpers/dateFormatting.js.map +1 -1
- package/dist/helpers/formattedStrings.d.ts +1 -0
- package/dist/helpers/formattedStrings.js +23 -18
- package/dist/helpers/formattedStrings.js.map +1 -1
- package/dist/helpers/responsive.js +1 -1
- package/dist/helpers/responsive.js.map +1 -1
- package/dist/i18n/I18n.js +3 -3
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Contractor.Payments.CreatePayment.json.js +36 -32
- package/dist/i18n/en/Contractor.Payments.CreatePayment.json.js.map +1 -1
- package/dist/i18n/en/Contractor.Payments.PaymentHistory.json.js +11 -11
- package/dist/i18n/en/Contractor.Payments.PaymentStatement.json.js +28 -0
- package/dist/i18n/en/Contractor.Payments.PaymentStatement.json.js.map +1 -0
- package/dist/i18n/en/Contractor.Payments.PaymentsList.json.js +14 -14
- package/dist/i18n/en/Payroll.InformationRequestForm.json.js +18 -0
- package/dist/i18n/en/Payroll.InformationRequestForm.json.js.map +1 -0
- package/dist/i18n/en/Payroll.InformationRequestList.json.js +18 -0
- package/dist/i18n/en/Payroll.InformationRequestList.json.js.map +1 -0
- package/dist/i18n/en/Payroll.PayrollConfiguration.json.js +27 -21
- package/dist/i18n/en/Payroll.PayrollConfiguration.json.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollHistory.json.js +6 -6
- package/dist/i18n/en/Payroll.PayrollLanding.json.js +5 -3
- package/dist/i18n/en/Payroll.PayrollLanding.json.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollOverview.json.js +32 -28
- package/dist/i18n/en/Payroll.PayrollOverview.json.js.map +1 -1
- package/dist/i18n/en/Payroll.RecoveryCasesList.json.js +14 -0
- package/dist/i18n/en/Payroll.RecoveryCasesList.json.js.map +1 -0
- package/dist/i18n/en/Payroll.RecoveryCasesResubmit.json.js +8 -0
- package/dist/i18n/en/Payroll.RecoveryCasesResubmit.json.js.map +1 -0
- package/dist/i18n/en/common.json.d.ts +5 -0
- package/dist/i18n/en/common.json.js +4 -2
- package/dist/i18n/en/common.json.js.map +1 -1
- package/dist/shared/constants.d.ts +24 -0
- package/dist/shared/constants.js +70 -54
- package/dist/shared/constants.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/i18next.d.ts +119 -3
- package/package.json +31 -20
|
@@ -1,194 +1,202 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { useTranslation as
|
|
4
|
-
import { useFormatEmployeePayRate as
|
|
5
|
-
import { PayrollBlockerAlerts as
|
|
6
|
-
import
|
|
7
|
-
import { useI18n as
|
|
8
|
-
import { Flex as
|
|
9
|
-
import { Grid as
|
|
1
|
+
import { jsx as e, jsxs as i, Fragment as L } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as S } from "react";
|
|
3
|
+
import { useTranslation as A, Trans as O } from "react-i18next";
|
|
4
|
+
import { useFormatEmployeePayRate as V, getRegularHours as _, getOvertimeHours as K, formatHoursDisplay as T, getTotalPtoHours as W, getAdditionalEarnings as X, getReimbursements as q, calculateGrossPay as z } from "../helpers.js";
|
|
5
|
+
import { PayrollBlockerAlerts as J } from "../PayrollBlocker/components/PayrollBlockerAlerts.js";
|
|
6
|
+
import Q from "./PayrollConfigurationPresentation.module.scss.js";
|
|
7
|
+
import { useI18n as Y } from "../../../i18n/I18n.js";
|
|
8
|
+
import { Flex as u, FlexItem as h } from "../../Common/Flex/Flex.js";
|
|
9
|
+
import { Grid as Z } from "../../Common/Grid/Grid.js";
|
|
10
10
|
import "classnames";
|
|
11
|
-
import { HamburgerMenu as
|
|
12
|
-
import { useComponentContext as
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import { formatNumberAsCurrency as
|
|
17
|
-
import { useDateFormatter as
|
|
18
|
-
import { useContainerBreakpoints as
|
|
19
|
-
import { PayrollLoading as
|
|
20
|
-
import { DataView as
|
|
21
|
-
const
|
|
22
|
-
employeeCompensations:
|
|
23
|
-
employeeDetails:
|
|
24
|
-
payPeriod:
|
|
25
|
-
paySchedule:
|
|
26
|
-
onEdit:
|
|
27
|
-
onToggleExclude:
|
|
28
|
-
onCalculatePayroll:
|
|
29
|
-
onViewBlockers:
|
|
30
|
-
isOffCycle:
|
|
31
|
-
alerts:
|
|
32
|
-
|
|
33
|
-
isPending:
|
|
11
|
+
import { HamburgerMenu as $ } from "../../Common/HamburgerMenu/HamburgerMenu.js";
|
|
12
|
+
import { useComponentContext as ee } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
13
|
+
import te from "../../../assets/icons/pencil.svg.js";
|
|
14
|
+
import re from "../../../assets/icons/x-circle.svg.js";
|
|
15
|
+
import ne from "../../../assets/icons/plus-circle.svg.js";
|
|
16
|
+
import { formatNumberAsCurrency as f, firstLastName as oe } from "../../../helpers/formattedStrings.js";
|
|
17
|
+
import { useDateFormatter as ie } from "../../../hooks/useDateFormatter.js";
|
|
18
|
+
import { useContainerBreakpoints as le } from "../../../hooks/useContainerBreakpoints/useContainerBreakpoints.js";
|
|
19
|
+
import { PayrollLoading as ae } from "../../Common/PayrollLoading/PayrollLoading.js";
|
|
20
|
+
import { DataView as se } from "../../Common/DataView/DataView.js";
|
|
21
|
+
const ce = (l, p) => l?.startDate && l.endDate ? p.formatPayPeriod(l.startDate, l.endDate) : { startDate: "", endDate: "" }, Fe = ({
|
|
22
|
+
employeeCompensations: l,
|
|
23
|
+
employeeDetails: p,
|
|
24
|
+
payPeriod: y,
|
|
25
|
+
paySchedule: v,
|
|
26
|
+
onEdit: M,
|
|
27
|
+
onToggleExclude: H,
|
|
28
|
+
onCalculatePayroll: b,
|
|
29
|
+
onViewBlockers: E,
|
|
30
|
+
isOffCycle: R = !1,
|
|
31
|
+
alerts: D,
|
|
32
|
+
payrollAlert: m,
|
|
33
|
+
isPending: g,
|
|
34
|
+
isCalculating: a,
|
|
34
35
|
payrollBlockers: C = [],
|
|
35
|
-
pagination:
|
|
36
|
-
withReimbursements:
|
|
36
|
+
pagination: F,
|
|
37
|
+
withReimbursements: N = !0,
|
|
38
|
+
isCalculateDisabled: P = !1
|
|
37
39
|
}) => {
|
|
38
|
-
const { Button:
|
|
39
|
-
|
|
40
|
-
const { t: r } =
|
|
41
|
-
const n =
|
|
42
|
-
return n ?
|
|
40
|
+
const { Button: w, Heading: x, Text: o, Badge: U, Alert: j } = ee();
|
|
41
|
+
Y("Payroll.PayrollConfiguration");
|
|
42
|
+
const { t: r } = A("Payroll.PayrollConfiguration"), B = ie(), G = V(), k = S(null), s = le({ ref: k }).includes("small"), d = new Map(p.map((t) => [t.uuid, t])), I = (t) => {
|
|
43
|
+
const n = d.get(t);
|
|
44
|
+
return n ? oe({ first_name: n.firstName, last_name: n.lastName }) : null;
|
|
43
45
|
};
|
|
44
|
-
return /* @__PURE__ */ e("div", { ref:
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
|
|
46
|
+
return /* @__PURE__ */ e("div", { ref: k, className: Q.container, children: /* @__PURE__ */ i(u, { flexDirection: "column", gap: 16, children: [
|
|
47
|
+
/* @__PURE__ */ i(
|
|
48
|
+
u,
|
|
47
49
|
{
|
|
48
|
-
flexDirection:
|
|
49
|
-
justifyContent:
|
|
50
|
-
alignItems:
|
|
51
|
-
gap:
|
|
50
|
+
flexDirection: s ? "row" : "column",
|
|
51
|
+
justifyContent: s ? "space-between" : "normal",
|
|
52
|
+
alignItems: s ? "center" : "stretch",
|
|
53
|
+
gap: s ? 0 : 16,
|
|
52
54
|
children: [
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
/* @__PURE__ */ e(
|
|
55
|
+
/* @__PURE__ */ i(h, { children: [
|
|
56
|
+
/* @__PURE__ */ e(x, { as: "h1", children: r("pageTitle") }),
|
|
55
57
|
/* @__PURE__ */ e(o, { children: /* @__PURE__ */ e(
|
|
56
|
-
|
|
58
|
+
O,
|
|
57
59
|
{
|
|
58
60
|
i18nKey: "description",
|
|
59
61
|
t: r,
|
|
60
62
|
components: { dateWrapper: /* @__PURE__ */ e(o, { weight: "bold", as: "span" }) },
|
|
61
|
-
values:
|
|
63
|
+
values: ce(y, B)
|
|
62
64
|
}
|
|
63
65
|
) })
|
|
64
66
|
] }),
|
|
65
|
-
/* @__PURE__ */ e(
|
|
66
|
-
|
|
67
|
+
/* @__PURE__ */ e(h, { flexGrow: 0, children: s ? /* @__PURE__ */ e(
|
|
68
|
+
w,
|
|
67
69
|
{
|
|
68
70
|
title: r("calculatePayrollTitle"),
|
|
69
|
-
onClick:
|
|
70
|
-
isDisabled:
|
|
71
|
-
children: r("calculatePayroll")
|
|
71
|
+
onClick: b,
|
|
72
|
+
isDisabled: P || g || a,
|
|
73
|
+
children: r(a ? "calculatingPayroll" : "calculatePayroll")
|
|
72
74
|
}
|
|
73
|
-
) : /* @__PURE__ */ e(
|
|
74
|
-
|
|
75
|
+
) : /* @__PURE__ */ e(u, { flexDirection: "column", justifyContent: "normal", alignItems: "stretch", gap: 12, children: /* @__PURE__ */ e(
|
|
76
|
+
w,
|
|
75
77
|
{
|
|
76
78
|
title: r("calculatePayrollTitle"),
|
|
77
|
-
onClick:
|
|
78
|
-
isDisabled:
|
|
79
|
-
children: r("calculatePayroll")
|
|
79
|
+
onClick: b,
|
|
80
|
+
isDisabled: P || g || a,
|
|
81
|
+
children: r(a ? "calculatingPayroll" : "calculatePayroll")
|
|
80
82
|
}
|
|
81
83
|
) }) })
|
|
82
84
|
]
|
|
83
85
|
}
|
|
84
86
|
),
|
|
85
|
-
(
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
(D || m) && /* @__PURE__ */ i(Z, { gap: 16, gridTemplateColumns: "1fr", children: [
|
|
88
|
+
m && /* @__PURE__ */ e(j, { label: m.label, status: m.variant, children: m.content }),
|
|
89
|
+
D
|
|
88
90
|
] }),
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
91
|
+
g ? /* @__PURE__ */ e(
|
|
92
|
+
ae,
|
|
93
|
+
{
|
|
94
|
+
title: r(a ? "calculatingTitle" : "loadingTitle"),
|
|
95
|
+
description: r(a ? "calculatingDescription" : "loadingDescription")
|
|
96
|
+
}
|
|
97
|
+
) : /* @__PURE__ */ i(L, { children: [
|
|
98
|
+
C.length > 0 && /* @__PURE__ */ e(
|
|
99
|
+
J,
|
|
92
100
|
{
|
|
93
101
|
blockers: C,
|
|
94
|
-
onMultipleViewClick:
|
|
102
|
+
onMultipleViewClick: E
|
|
95
103
|
}
|
|
96
|
-
)
|
|
97
|
-
/* @__PURE__ */
|
|
98
|
-
/* @__PURE__ */ e(
|
|
104
|
+
),
|
|
105
|
+
/* @__PURE__ */ i(h, { children: [
|
|
106
|
+
/* @__PURE__ */ e(x, { as: "h3", children: r("hoursAndEarningsTitle") }),
|
|
99
107
|
/* @__PURE__ */ e(o, { children: r("hoursAndEarningsDescription") })
|
|
100
108
|
] }),
|
|
101
109
|
/* @__PURE__ */ e(
|
|
102
|
-
|
|
110
|
+
se,
|
|
103
111
|
{
|
|
104
112
|
label: r("employeeCompensationsTitle"),
|
|
105
113
|
columns: [
|
|
106
114
|
{
|
|
107
115
|
title: /* @__PURE__ */ e(o, { weight: "semibold", children: r("tableColumns.employees") }),
|
|
108
116
|
render: (t) => {
|
|
109
|
-
const n =
|
|
110
|
-
return /* @__PURE__ */
|
|
111
|
-
/* @__PURE__ */ e(o, { weight: "semibold", children:
|
|
112
|
-
|
|
113
|
-
t.excluded && /* @__PURE__ */ e(
|
|
117
|
+
const n = d.get(t.employeeUuid || ""), c = G(n);
|
|
118
|
+
return /* @__PURE__ */ i(u, { flexDirection: "column", gap: 8, children: [
|
|
119
|
+
/* @__PURE__ */ e(o, { weight: "semibold", children: I(t.employeeUuid || "") }),
|
|
120
|
+
c && /* @__PURE__ */ e(o, { variant: "supporting", children: c }),
|
|
121
|
+
t.excluded && /* @__PURE__ */ e(U, { status: "warning", children: r("skippedBadge") })
|
|
114
122
|
] });
|
|
115
123
|
}
|
|
116
124
|
},
|
|
117
125
|
{
|
|
118
126
|
title: /* @__PURE__ */ e(o, { weight: "semibold", children: r("tableColumns.hours") }),
|
|
119
127
|
render: (t) => {
|
|
120
|
-
const n =
|
|
121
|
-
return /* @__PURE__ */ e(o, { children:
|
|
128
|
+
const n = _(t), c = K(t);
|
|
129
|
+
return /* @__PURE__ */ e(o, { children: T(n + c) });
|
|
122
130
|
}
|
|
123
131
|
},
|
|
124
132
|
{
|
|
125
133
|
title: /* @__PURE__ */ e(o, { weight: "semibold", children: r("tableColumns.timeOff") }),
|
|
126
134
|
render: (t) => {
|
|
127
|
-
const n =
|
|
128
|
-
return /* @__PURE__ */ e(o, { children:
|
|
135
|
+
const n = W(t);
|
|
136
|
+
return /* @__PURE__ */ e(o, { children: T(n) });
|
|
129
137
|
}
|
|
130
138
|
},
|
|
131
139
|
{
|
|
132
140
|
title: /* @__PURE__ */ e(o, { weight: "semibold", children: r("tableColumns.additionalEarnings") }),
|
|
133
141
|
render: (t) => {
|
|
134
|
-
const n =
|
|
135
|
-
return /* @__PURE__ */ e(o, { children:
|
|
142
|
+
const n = X(t);
|
|
143
|
+
return /* @__PURE__ */ e(o, { children: f(n) });
|
|
136
144
|
}
|
|
137
145
|
},
|
|
138
|
-
...
|
|
146
|
+
...N ? [
|
|
139
147
|
{
|
|
140
148
|
title: /* @__PURE__ */ e(o, { weight: "semibold", children: r("tableColumns.reimbursements") }),
|
|
141
149
|
render: (t) => {
|
|
142
|
-
const n =
|
|
143
|
-
return /* @__PURE__ */ e(o, { children:
|
|
150
|
+
const n = q(t);
|
|
151
|
+
return /* @__PURE__ */ e(o, { children: f(n) });
|
|
144
152
|
}
|
|
145
153
|
}
|
|
146
154
|
] : [],
|
|
147
155
|
{
|
|
148
156
|
title: /* @__PURE__ */ e(o, { weight: "semibold", children: r("tableColumns.totalPay") }),
|
|
149
157
|
render: (t) => {
|
|
150
|
-
const n =
|
|
158
|
+
const n = d.get(t.employeeUuid || ""), c = n ? z(
|
|
151
159
|
t,
|
|
152
160
|
n,
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
161
|
+
y?.startDate,
|
|
162
|
+
v,
|
|
163
|
+
R
|
|
156
164
|
) : 0;
|
|
157
|
-
return /* @__PURE__ */ e(o, { children:
|
|
165
|
+
return /* @__PURE__ */ e(o, { children: f(c) });
|
|
158
166
|
}
|
|
159
167
|
}
|
|
160
168
|
],
|
|
161
|
-
data:
|
|
169
|
+
data: l,
|
|
162
170
|
itemMenu: (t) => /* @__PURE__ */ e(
|
|
163
|
-
|
|
171
|
+
$,
|
|
164
172
|
{
|
|
165
173
|
items: [
|
|
166
174
|
{
|
|
167
175
|
label: r("editMenu.edit"),
|
|
168
|
-
icon: /* @__PURE__ */ e(
|
|
176
|
+
icon: /* @__PURE__ */ e(te, { "aria-hidden": !0 }),
|
|
169
177
|
onClick: () => {
|
|
170
|
-
const n =
|
|
171
|
-
n &&
|
|
178
|
+
const n = d.get(t.employeeUuid || "");
|
|
179
|
+
n && M(n);
|
|
172
180
|
}
|
|
173
181
|
},
|
|
174
182
|
{
|
|
175
183
|
label: r(t.excluded ? "editMenu.unskip" : "editMenu.skip"),
|
|
176
|
-
icon: t.excluded ? /* @__PURE__ */ e(
|
|
184
|
+
icon: t.excluded ? /* @__PURE__ */ e(ne, { "aria-hidden": !0 }) : /* @__PURE__ */ e(re, { "aria-hidden": !0 }),
|
|
177
185
|
onClick: () => {
|
|
178
|
-
|
|
186
|
+
d.get(t.employeeUuid || "") && H(t);
|
|
179
187
|
}
|
|
180
188
|
}
|
|
181
189
|
],
|
|
182
190
|
triggerLabel: r("editMenu.edit")
|
|
183
191
|
}
|
|
184
192
|
),
|
|
185
|
-
pagination:
|
|
193
|
+
pagination: F
|
|
186
194
|
}
|
|
187
195
|
)
|
|
188
196
|
] })
|
|
189
197
|
] }) });
|
|
190
198
|
};
|
|
191
199
|
export {
|
|
192
|
-
|
|
200
|
+
Fe as PayrollConfigurationPresentation
|
|
193
201
|
};
|
|
194
202
|
//# sourceMappingURL=PayrollConfigurationPresentation.js.map
|
package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayrollConfigurationPresentation.js","sources":["../../../../src/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useRef } from 'react'\nimport type { EmployeeCompensations } from '@gusto/embedded-api/models/components/payrollshow'\nimport type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport type { PayrollPayPeriodType } from '@gusto/embedded-api/models/components/payrollpayperiodtype'\nimport type { PayScheduleObject } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport { Trans, useTranslation } from 'react-i18next'\nimport type { PayrollEmployeeCompensationsType } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype'\nimport {\n useFormatEmployeePayRate,\n getRegularHours,\n getOvertimeHours,\n getTotalPtoHours,\n getAdditionalEarnings,\n getReimbursements,\n formatHoursDisplay,\n calculateGrossPay,\n} from '../helpers'\nimport type { ApiPayrollBlocker } from '../PayrollBlocker/payrollHelpers'\nimport { PayrollBlockerAlerts } from '../PayrollBlocker/components/PayrollBlockerAlerts'\nimport styles from './PayrollConfigurationPresentation.module.scss'\nimport { useI18n } from '@/i18n'\nimport { DataView, Flex, FlexItem, Grid, PayrollLoading } from '@/components/Common'\nimport type { PaginationControlProps } from '@/components/Common/PaginationControl/PaginationControlTypes'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport XCircle from '@/assets/icons/x-circle.svg?react'\nimport PlusCircle from '@/assets/icons/plus-circle.svg?react'\nimport { firstLastName, formatNumberAsCurrency } from '@/helpers/formattedStrings'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport useContainerBreakpoints from '@/hooks/useContainerBreakpoints/useContainerBreakpoints'\n\ninterface PayrollConfigurationPresentationProps {\n employeeCompensations: EmployeeCompensations[]\n employeeDetails: Employee[]\n payPeriod?: PayrollPayPeriodType\n paySchedule?: PayScheduleObject\n onCalculatePayroll: () => void\n onEdit: (employee: Employee) => void\n onToggleExclude: (employeeCompensation: PayrollEmployeeCompensationsType) => void\n onViewBlockers: () => void\n isOffCycle?: boolean\n alerts?: ReactNode\n payrollDeadlineNotice?: {\n label: string\n content?: ReactNode\n }\n isPending?: boolean\n payrollBlockers?: ApiPayrollBlocker[]\n pagination?: PaginationControlProps\n withReimbursements?: boolean\n}\n\nconst getPayrollConfigurationTitle = (\n payPeriod: PayrollPayPeriodType | undefined,\n dateFormatter: ReturnType<typeof useDateFormatter>,\n) => {\n if (payPeriod?.startDate && payPeriod.endDate) {\n return dateFormatter.formatPayPeriod(payPeriod.startDate, payPeriod.endDate)\n }\n return { startDate: '', endDate: '' }\n}\n\nexport const PayrollConfigurationPresentation = ({\n employeeCompensations,\n employeeDetails,\n payPeriod,\n paySchedule,\n onEdit,\n onToggleExclude,\n onCalculatePayroll,\n onViewBlockers,\n isOffCycle = false,\n alerts,\n payrollDeadlineNotice,\n isPending,\n payrollBlockers = [],\n pagination,\n withReimbursements = true,\n}: PayrollConfigurationPresentationProps) => {\n const { Button, Heading, Text, Badge, Alert } = useComponentContext()\n useI18n('Payroll.PayrollConfiguration')\n const { t } = useTranslation('Payroll.PayrollConfiguration')\n const dateFormatter = useDateFormatter()\n const formatEmployeePayRate = useFormatEmployeePayRate()\n const containerRef = useRef<HTMLDivElement>(null)\n const breakpoints = useContainerBreakpoints({ ref: containerRef })\n const isDesktop = breakpoints.includes('small')\n\n const employeeMap = new Map(employeeDetails.map(employee => [employee.uuid, employee]))\n\n const getEmployeeName = (employeeUuid: string) => {\n const employee = employeeMap.get(employeeUuid)\n return employee\n ? firstLastName({ first_name: employee.firstName, last_name: employee.lastName })\n : null\n }\n\n return (\n <div ref={containerRef} className={styles.container}>\n <Flex flexDirection=\"column\" gap={16}>\n <Flex\n flexDirection={isDesktop ? 'row' : 'column'}\n justifyContent={isDesktop ? 'space-between' : 'normal'}\n alignItems={isDesktop ? 'center' : 'stretch'}\n gap={isDesktop ? 0 : 16}\n >\n <FlexItem>\n <Heading as=\"h1\">{t('pageTitle')}</Heading>\n <Text>\n <Trans\n i18nKey=\"description\"\n t={t}\n components={{ dateWrapper: <Text weight=\"bold\" as=\"span\" /> }}\n values={getPayrollConfigurationTitle(payPeriod, dateFormatter)}\n />\n </Text>\n </FlexItem>\n <FlexItem flexGrow={isDesktop ? 0 : 0}>\n {isDesktop ? (\n <Button\n title={t('calculatePayrollTitle')}\n onClick={onCalculatePayroll}\n isDisabled={isPending}\n >\n {t('calculatePayroll')}\n </Button>\n ) : (\n <Flex flexDirection=\"column\" justifyContent=\"normal\" alignItems=\"stretch\" gap={12}>\n <Button\n title={t('calculatePayrollTitle')}\n onClick={onCalculatePayroll}\n isDisabled={isPending}\n >\n {t('calculatePayroll')}\n </Button>\n </Flex>\n )}\n </FlexItem>\n </Flex>\n\n {(alerts || payrollDeadlineNotice) && (\n <Grid gap={16} gridTemplateColumns=\"1fr\">\n {payrollDeadlineNotice && (\n <Alert status=\"info\" label={payrollDeadlineNotice.label}>\n {payrollDeadlineNotice.content}\n </Alert>\n )}\n {alerts}\n </Grid>\n )}\n\n {isPending ? (\n <PayrollLoading title={t('loadingTitle')} description={t('loadingDescription')} />\n ) : (\n <>\n <div className={styles.payrollBlockerContainer}>\n {payrollBlockers.length > 0 && (\n <PayrollBlockerAlerts\n blockers={payrollBlockers}\n onMultipleViewClick={onViewBlockers}\n />\n )}\n </div>\n <FlexItem>\n <Heading as=\"h3\">{t('hoursAndEarningsTitle')}</Heading>\n <Text>{t('hoursAndEarningsDescription')}</Text>\n </FlexItem>\n\n <DataView\n label={t('employeeCompensationsTitle')}\n columns={[\n {\n title: <Text weight=\"semibold\">{t('tableColumns.employees')}</Text>,\n render: (item: EmployeeCompensations) => {\n const employee = employeeMap.get(item.employeeUuid || '')\n const payRateDisplay = formatEmployeePayRate(employee)\n return (\n <Flex flexDirection=\"column\" gap={8 as const}>\n <Text weight=\"semibold\">{getEmployeeName(item.employeeUuid || '')}</Text>\n {payRateDisplay && <Text variant=\"supporting\">{payRateDisplay}</Text>}\n {item.excluded && <Badge status=\"warning\">{t('skippedBadge')}</Badge>}\n </Flex>\n )\n },\n },\n {\n title: <Text weight=\"semibold\">{t('tableColumns.hours')}</Text>,\n render: (item: EmployeeCompensations) => {\n const hours = getRegularHours(item)\n const overtimeHours = getOvertimeHours(item)\n return <Text>{formatHoursDisplay(hours + overtimeHours)}</Text>\n },\n },\n {\n title: <Text weight=\"semibold\">{t('tableColumns.timeOff')}</Text>,\n render: (item: EmployeeCompensations) => {\n const ptoHours = getTotalPtoHours(item)\n return <Text>{formatHoursDisplay(ptoHours)}</Text>\n },\n },\n {\n title: <Text weight=\"semibold\">{t('tableColumns.additionalEarnings')}</Text>,\n render: (item: EmployeeCompensations) => {\n const earnings = getAdditionalEarnings(item)\n return <Text>{formatNumberAsCurrency(earnings)}</Text>\n },\n },\n ...(withReimbursements\n ? [\n {\n title: <Text weight=\"semibold\">{t('tableColumns.reimbursements')}</Text>,\n render: (item: EmployeeCompensations) => {\n const reimbursements = getReimbursements(item)\n return <Text>{formatNumberAsCurrency(reimbursements)}</Text>\n },\n },\n ]\n : []),\n {\n title: <Text weight=\"semibold\">{t('tableColumns.totalPay')}</Text>,\n render: (item: PayrollEmployeeCompensationsType) => {\n const employee = employeeMap.get(item.employeeUuid || '')\n const calculatedGrossPay = employee\n ? calculateGrossPay(\n item,\n employee,\n payPeriod?.startDate,\n paySchedule,\n isOffCycle,\n )\n : 0\n return <Text>{formatNumberAsCurrency(calculatedGrossPay)}</Text>\n },\n },\n ]}\n data={employeeCompensations}\n itemMenu={(item: EmployeeCompensations) => (\n <HamburgerMenu\n items={[\n {\n label: t('editMenu.edit'),\n icon: <PencilSvg aria-hidden />,\n onClick: () => {\n const employee = employeeMap.get(item.employeeUuid || '')\n if (employee) {\n onEdit(employee)\n }\n },\n },\n {\n label: t(item.excluded ? 'editMenu.unskip' : 'editMenu.skip'),\n icon: item.excluded ? <PlusCircle aria-hidden /> : <XCircle aria-hidden />,\n onClick: () => {\n const employee = employeeMap.get(item.employeeUuid || '')\n if (employee) {\n onToggleExclude(item)\n }\n },\n },\n ]}\n triggerLabel={t('editMenu.edit')}\n />\n )}\n pagination={pagination}\n />\n </>\n )}\n </Flex>\n </div>\n )\n}\n"],"names":["getPayrollConfigurationTitle","payPeriod","dateFormatter","PayrollConfigurationPresentation","employeeCompensations","employeeDetails","paySchedule","onEdit","onToggleExclude","onCalculatePayroll","onViewBlockers","isOffCycle","alerts","payrollDeadlineNotice","isPending","payrollBlockers","pagination","withReimbursements","Button","Heading","Text","Badge","Alert","useComponentContext","useI18n","t","useTranslation","useDateFormatter","formatEmployeePayRate","useFormatEmployeePayRate","containerRef","useRef","isDesktop","useContainerBreakpoints","employeeMap","employee","getEmployeeName","employeeUuid","firstLastName","jsx","styles","jsxs","Flex","FlexItem","Trans","Grid","PayrollLoading","Fragment","PayrollBlockerAlerts","DataView","item","payRateDisplay","hours","getRegularHours","overtimeHours","getOvertimeHours","formatHoursDisplay","ptoHours","getTotalPtoHours","earnings","getAdditionalEarnings","formatNumberAsCurrency","reimbursements","getReimbursements","calculatedGrossPay","calculateGrossPay","HamburgerMenu","PencilSvg","PlusCircle","XCircle"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsDA,MAAMA,KAA+B,CACnCC,GACAC,MAEID,GAAW,aAAaA,EAAU,UAC7BC,EAAc,gBAAgBD,EAAU,WAAWA,EAAU,OAAO,IAEtE,EAAE,WAAW,IAAI,SAAS,GAAA,GAGtBE,KAAmC,CAAC;AAAA,EAC/C,uBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,WAAAJ;AAAA,EACA,aAAAK;AAAA,EACA,QAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,YAAAC,IAAa;AAAA,EACb,QAAAC;AAAA,EACA,uBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,iBAAAC,IAAkB,CAAA;AAAA,EAClB,YAAAC;AAAA,EACA,oBAAAC,IAAqB;AACvB,MAA6C;AAC3C,QAAM,EAAE,QAAAC,GAAQ,SAAAC,GAAS,MAAAC,GAAM,OAAAC,GAAO,OAAAC,EAAA,IAAUC,EAAA;AAChD,EAAAC,EAAQ,8BAA8B;AACtC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,8BAA8B,GACrDxB,IAAgByB,GAAA,GAChBC,IAAwBC,EAAA,GACxBC,IAAeC,EAAuB,IAAI,GAE1CC,IADcC,GAAwB,EAAE,KAAKH,GAAc,EACnC,SAAS,OAAO,GAExCI,IAAc,IAAI,IAAI7B,EAAgB,IAAI,CAAA8B,MAAY,CAACA,EAAS,MAAMA,CAAQ,CAAC,CAAC,GAEhFC,IAAkB,CAACC,MAAyB;AAChD,UAAMF,IAAWD,EAAY,IAAIG,CAAY;AAC7C,WAAOF,IACHG,GAAc,EAAE,YAAYH,EAAS,WAAW,WAA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AgB0C,CAAI;AAAA,kBAExB;AAAA,gBAAA;AAAA,cACF;AAAA,cAEF,cAAczB,EAAE,eAAe;AAAA,YAAA;AAAA,UAAA;AAAA,UAGnC,YAAAT;AAAA,QAAA;AAAA,MAAA;AAAA,IACF,EAAA,CACF;AAAA,EAAA,EAAA,CAEJ,EAAA,CACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"PayrollConfigurationPresentation.js","sources":["../../../../src/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useRef } from 'react'\nimport type { EmployeeCompensations } from '@gusto/embedded-api/models/components/payrollshow'\nimport type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport type { PayrollPayPeriodType } from '@gusto/embedded-api/models/components/payrollpayperiodtype'\nimport type { PayScheduleObject } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport { Trans, useTranslation } from 'react-i18next'\nimport type { PayrollEmployeeCompensationsType } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype'\nimport {\n useFormatEmployeePayRate,\n getRegularHours,\n getOvertimeHours,\n getTotalPtoHours,\n getAdditionalEarnings,\n getReimbursements,\n formatHoursDisplay,\n calculateGrossPay,\n} from '../helpers'\nimport type { ApiPayrollBlocker } from '../PayrollBlocker/payrollHelpers'\nimport { PayrollBlockerAlerts } from '../PayrollBlocker/components/PayrollBlockerAlerts'\nimport styles from './PayrollConfigurationPresentation.module.scss'\nimport { useI18n } from '@/i18n'\nimport { DataView, Flex, FlexItem, Grid, PayrollLoading } from '@/components/Common'\nimport type { PaginationControlProps } from '@/components/Common/PaginationControl/PaginationControlTypes'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport XCircle from '@/assets/icons/x-circle.svg?react'\nimport PlusCircle from '@/assets/icons/plus-circle.svg?react'\nimport { firstLastName, formatNumberAsCurrency } from '@/helpers/formattedStrings'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport useContainerBreakpoints from '@/hooks/useContainerBreakpoints/useContainerBreakpoints'\n\ninterface PayrollConfigurationPresentationProps {\n employeeCompensations: EmployeeCompensations[]\n employeeDetails: Employee[]\n payPeriod?: PayrollPayPeriodType\n paySchedule?: PayScheduleObject\n onCalculatePayroll: () => void\n onEdit: (employee: Employee) => void\n onToggleExclude: (employeeCompensation: PayrollEmployeeCompensationsType) => void\n onViewBlockers: () => void\n isOffCycle?: boolean\n alerts?: ReactNode\n payrollAlert?: {\n label: string\n content?: ReactNode\n variant: 'info' | 'warning'\n }\n isPending?: boolean\n isCalculating?: boolean\n payrollBlockers?: ApiPayrollBlocker[]\n pagination?: PaginationControlProps\n withReimbursements?: boolean\n isCalculateDisabled?: boolean\n}\n\nconst getPayrollConfigurationTitle = (\n payPeriod: PayrollPayPeriodType | undefined,\n dateFormatter: ReturnType<typeof useDateFormatter>,\n) => {\n if (payPeriod?.startDate && payPeriod.endDate) {\n return dateFormatter.formatPayPeriod(payPeriod.startDate, payPeriod.endDate)\n }\n return { startDate: '', endDate: '' }\n}\n\nexport const PayrollConfigurationPresentation = ({\n employeeCompensations,\n employeeDetails,\n payPeriod,\n paySchedule,\n onEdit,\n onToggleExclude,\n onCalculatePayroll,\n onViewBlockers,\n isOffCycle = false,\n alerts,\n payrollAlert,\n isPending,\n isCalculating,\n payrollBlockers = [],\n pagination,\n withReimbursements = true,\n isCalculateDisabled = false,\n}: PayrollConfigurationPresentationProps) => {\n const { Button, Heading, Text, Badge, Alert } = useComponentContext()\n useI18n('Payroll.PayrollConfiguration')\n const { t } = useTranslation('Payroll.PayrollConfiguration')\n const dateFormatter = useDateFormatter()\n const formatEmployeePayRate = useFormatEmployeePayRate()\n const containerRef = useRef<HTMLDivElement>(null)\n const breakpoints = useContainerBreakpoints({ ref: containerRef })\n const isDesktop = breakpoints.includes('small')\n\n const employeeMap = new Map(employeeDetails.map(employee => [employee.uuid, employee]))\n\n const getEmployeeName = (employeeUuid: string) => {\n const employee = employeeMap.get(employeeUuid)\n return employee\n ? firstLastName({ first_name: employee.firstName, last_name: employee.lastName })\n : null\n }\n\n return (\n <div ref={containerRef} className={styles.container}>\n <Flex flexDirection=\"column\" gap={16}>\n <Flex\n flexDirection={isDesktop ? 'row' : 'column'}\n justifyContent={isDesktop ? 'space-between' : 'normal'}\n alignItems={isDesktop ? 'center' : 'stretch'}\n gap={isDesktop ? 0 : 16}\n >\n <FlexItem>\n <Heading as=\"h1\">{t('pageTitle')}</Heading>\n <Text>\n <Trans\n i18nKey=\"description\"\n t={t}\n components={{ dateWrapper: <Text weight=\"bold\" as=\"span\" /> }}\n values={getPayrollConfigurationTitle(payPeriod, dateFormatter)}\n />\n </Text>\n </FlexItem>\n <FlexItem flexGrow={isDesktop ? 0 : 0}>\n {isDesktop ? (\n <Button\n title={t('calculatePayrollTitle')}\n onClick={onCalculatePayroll}\n isDisabled={isCalculateDisabled || isPending || isCalculating}\n >\n {isCalculating ? t('calculatingPayroll') : t('calculatePayroll')}\n </Button>\n ) : (\n <Flex flexDirection=\"column\" justifyContent=\"normal\" alignItems=\"stretch\" gap={12}>\n <Button\n title={t('calculatePayrollTitle')}\n onClick={onCalculatePayroll}\n isDisabled={isCalculateDisabled || isPending || isCalculating}\n >\n {isCalculating ? t('calculatingPayroll') : t('calculatePayroll')}\n </Button>\n </Flex>\n )}\n </FlexItem>\n </Flex>\n\n {(alerts || payrollAlert) && (\n <Grid gap={16} gridTemplateColumns=\"1fr\">\n {payrollAlert && (\n <Alert label={payrollAlert.label} status={payrollAlert.variant}>\n {payrollAlert.content}\n </Alert>\n )}\n {alerts}\n </Grid>\n )}\n\n {isPending ? (\n <PayrollLoading\n title={isCalculating ? t('calculatingTitle') : t('loadingTitle')}\n description={isCalculating ? t('calculatingDescription') : t('loadingDescription')}\n />\n ) : (\n <>\n {payrollBlockers.length > 0 && (\n <PayrollBlockerAlerts\n blockers={payrollBlockers}\n onMultipleViewClick={onViewBlockers}\n />\n )}\n <FlexItem>\n <Heading as=\"h3\">{t('hoursAndEarningsTitle')}</Heading>\n <Text>{t('hoursAndEarningsDescription')}</Text>\n </FlexItem>\n\n <DataView\n label={t('employeeCompensationsTitle')}\n columns={[\n {\n title: <Text weight=\"semibold\">{t('tableColumns.employees')}</Text>,\n render: (item: EmployeeCompensations) => {\n const employee = employeeMap.get(item.employeeUuid || '')\n const payRateDisplay = formatEmployeePayRate(employee)\n return (\n <Flex flexDirection=\"column\" gap={8 as const}>\n <Text weight=\"semibold\">{getEmployeeName(item.employeeUuid || '')}</Text>\n {payRateDisplay && <Text variant=\"supporting\">{payRateDisplay}</Text>}\n {item.excluded && <Badge status=\"warning\">{t('skippedBadge')}</Badge>}\n </Flex>\n )\n },\n },\n {\n title: <Text weight=\"semibold\">{t('tableColumns.hours')}</Text>,\n render: (item: EmployeeCompensations) => {\n const hours = getRegularHours(item)\n const overtimeHours = getOvertimeHours(item)\n return <Text>{formatHoursDisplay(hours + overtimeHours)}</Text>\n },\n },\n {\n title: <Text weight=\"semibold\">{t('tableColumns.timeOff')}</Text>,\n render: (item: EmployeeCompensations) => {\n const ptoHours = getTotalPtoHours(item)\n return <Text>{formatHoursDisplay(ptoHours)}</Text>\n },\n },\n {\n title: <Text weight=\"semibold\">{t('tableColumns.additionalEarnings')}</Text>,\n render: (item: EmployeeCompensations) => {\n const earnings = getAdditionalEarnings(item)\n return <Text>{formatNumberAsCurrency(earnings)}</Text>\n },\n },\n ...(withReimbursements\n ? [\n {\n title: <Text weight=\"semibold\">{t('tableColumns.reimbursements')}</Text>,\n render: (item: EmployeeCompensations) => {\n const reimbursements = getReimbursements(item)\n return <Text>{formatNumberAsCurrency(reimbursements)}</Text>\n },\n },\n ]\n : []),\n {\n title: <Text weight=\"semibold\">{t('tableColumns.totalPay')}</Text>,\n render: (item: PayrollEmployeeCompensationsType) => {\n const employee = employeeMap.get(item.employeeUuid || '')\n const calculatedGrossPay = employee\n ? calculateGrossPay(\n item,\n employee,\n payPeriod?.startDate,\n paySchedule,\n isOffCycle,\n )\n : 0\n return <Text>{formatNumberAsCurrency(calculatedGrossPay)}</Text>\n },\n },\n ]}\n data={employeeCompensations}\n itemMenu={(item: EmployeeCompensations) => (\n <HamburgerMenu\n items={[\n {\n label: t('editMenu.edit'),\n icon: <PencilSvg aria-hidden />,\n onClick: () => {\n const employee = employeeMap.get(item.employeeUuid || '')\n if (employee) {\n onEdit(employee)\n }\n },\n },\n {\n label: t(item.excluded ? 'editMenu.unskip' : 'editMenu.skip'),\n icon: item.excluded ? <PlusCircle aria-hidden /> : <XCircle aria-hidden />,\n onClick: () => {\n const employee = employeeMap.get(item.employeeUuid || '')\n if (employee) {\n onToggleExclude(item)\n }\n },\n },\n ]}\n triggerLabel={t('editMenu.edit')}\n />\n )}\n pagination={pagination}\n />\n </>\n )}\n </Flex>\n </div>\n )\n}\n"],"names":["getPayrollConfigurationTitle","payPeriod","dateFormatter","PayrollConfigurationPresentation","employeeCompensations","employeeDetails","paySchedule","onEdit","onToggleExclude","onCalculatePayroll","onViewBlockers","isOffCycle","alerts","payrollAlert","isPending","isCalculating","payrollBlockers","pagination","withReimbursements","isCalculateDisabled","Button","Heading","Text","Badge","Alert","useComponentContext","useI18n","t","useTranslation","useDateFormatter","formatEmployeePayRate","useFormatEmployeePayRate","containerRef","useRef","isDesktop","useContainerBreakpoints","employeeMap","employee","getEmployeeName","employeeUuid","firstLastName","jsx","styles","jsxs","Flex","FlexItem","Trans","Grid","PayrollLoading","Fragment","PayrollBlockerAlerts","DataView","item","payRateDisplay","hours","getRegularHours","overtimeHours","getOvertimeHours","formatHoursDisplay","ptoHours","getTotalPtoHours","earnings","getAdditionalEarnings","formatNumberAsCurrency","reimbursements","getReimbursements","calculatedGrossPay","calculateGrossPay","HamburgerMenu","PencilSvg","PlusCircle","XCircle"],"mappings":";;;;;;;;;;;;;;;;;;;;AAyDA,MAAMA,KAA+B,CACnCC,GACAC,MAEID,GAAW,a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YAAA;AAAA,UAAA;AAAA,UAGnC,YAAAV;AAAA,QAAA;AAAA,MAAA;AAAA,IACF,EAAA,CACF;AAAA,EAAA,EAAA,CAEJ,EAAA,CACF;AAEJ;"}
|
package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.module.scss.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
const
|
|
2
|
-
payrollBlockerContainer: o,
|
|
1
|
+
const n = "_container_7bh7e_5", t = {
|
|
3
2
|
container: n
|
|
4
3
|
};
|
|
5
4
|
export {
|
|
6
5
|
n as container,
|
|
7
|
-
|
|
8
|
-
o as payrollBlockerContainer
|
|
6
|
+
t as default
|
|
9
7
|
};
|
|
10
8
|
//# sourceMappingURL=PayrollConfigurationPresentation.module.scss.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayrollConfigurationPresentation.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PayrollConfigurationPresentation.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { EmployeeCompensations } from '@gusto/embedded-api/models/components/payrollshow';
|
|
2
|
+
import { Employee } from '@gusto/embedded-api/models/components/employee';
|
|
3
|
+
import { PayrollPayPeriodType } from '@gusto/embedded-api/models/components/payrollpayperiodtype';
|
|
4
|
+
import { PayScheduleObject } from '@gusto/embedded-api/models/components/payscheduleobject';
|
|
5
|
+
import { PaginationControlProps } from '../../Common/PaginationControl/PaginationControlTypes';
|
|
6
|
+
interface UsePayrollConfigurationDataParams {
|
|
7
|
+
companyId: string;
|
|
8
|
+
payrollId: string;
|
|
9
|
+
}
|
|
10
|
+
interface UsePayrollConfigurationDataReturn {
|
|
11
|
+
employeeCompensations: EmployeeCompensations[];
|
|
12
|
+
employeeDetails: Employee[];
|
|
13
|
+
payPeriod: PayrollPayPeriodType | undefined;
|
|
14
|
+
paySchedule: PayScheduleObject | undefined;
|
|
15
|
+
isOffCycle: boolean;
|
|
16
|
+
pagination: PaginationControlProps;
|
|
17
|
+
isLoading: boolean;
|
|
18
|
+
refetch: () => Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export declare function usePayrollConfigurationData({ companyId, payrollId, }: UsePayrollConfigurationDataParams): UsePayrollConfigurationDataReturn;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { useState as i, useRef as E, useMemo as C, useCallback as D, useEffect as H } from "react";
|
|
2
|
+
import { useEmployeesList as J } from "@gusto/embedded-api/react-query/employeesList";
|
|
3
|
+
import { useQueryClient as W, keepPreviousData as S, useQuery as X } from "@tanstack/react-query";
|
|
4
|
+
import { usePaySchedulesGet as Z } from "@gusto/embedded-api/react-query/paySchedulesGet";
|
|
5
|
+
import { useGustoEmbeddedContext as $ } from "@gusto/embedded-api/react-query/_context";
|
|
6
|
+
import { payrollsPrepare as ee } from "@gusto/embedded-api/funcs/payrollsPrepare";
|
|
7
|
+
const U = "payroll-prepare", te = 300 * 1e3;
|
|
8
|
+
function le({
|
|
9
|
+
companyId: c,
|
|
10
|
+
payrollId: s
|
|
11
|
+
}) {
|
|
12
|
+
const w = $(), y = W(), F = 10, [m, n] = i(1), [d, L] = i(F), [b, R] = i([]), [x, l] = i(!1), p = E(!1), { data: a, isFetching: h } = J(
|
|
13
|
+
{
|
|
14
|
+
companyId: c,
|
|
15
|
+
payrollUuid: s,
|
|
16
|
+
per: d,
|
|
17
|
+
page: m,
|
|
18
|
+
sortBy: "name"
|
|
19
|
+
},
|
|
20
|
+
{ placeholderData: S }
|
|
21
|
+
), g = E(a);
|
|
22
|
+
g.current = a;
|
|
23
|
+
const r = C(() => a?.showEmployees?.map((e) => e.uuid) || [], [a?.showEmployees]), u = Number(a?.httpMeta.response.headers.get("x-total-pages") ?? 1), M = Number(a?.httpMeta.response.headers.get("x-total-count") ?? 0), q = C(() => r.join(","), [r]), {
|
|
24
|
+
data: t,
|
|
25
|
+
isLoading: v,
|
|
26
|
+
isFetching: I
|
|
27
|
+
} = X({
|
|
28
|
+
queryKey: [U, s, q],
|
|
29
|
+
queryFn: async () => {
|
|
30
|
+
const e = await ee(w, {
|
|
31
|
+
companyId: c,
|
|
32
|
+
payrollId: s,
|
|
33
|
+
sortBy: "last_name",
|
|
34
|
+
requestBody: {
|
|
35
|
+
employeeUuids: r
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
if (!e.ok)
|
|
39
|
+
throw e.error;
|
|
40
|
+
return e.value.payrollPrepared;
|
|
41
|
+
},
|
|
42
|
+
enabled: r.length > 0,
|
|
43
|
+
staleTime: te,
|
|
44
|
+
placeholderData: S
|
|
45
|
+
}), P = D(() => {
|
|
46
|
+
const e = g.current;
|
|
47
|
+
if (!e?.showEmployees || !t?.employeeCompensations) {
|
|
48
|
+
l(!1);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const f = e.showEmployees.map((o) => o.uuid), z = new Set(t.employeeCompensations.map((o) => o.employeeUuid));
|
|
52
|
+
f.length > 0 && f.every((o) => z.has(o)) ? (R(e.showEmployees), l(!0), p.current = !0) : l(!1);
|
|
53
|
+
}, [t?.employeeCompensations]);
|
|
54
|
+
H(() => {
|
|
55
|
+
P();
|
|
56
|
+
}, [P]);
|
|
57
|
+
const { data: K, isLoading: N } = Z(
|
|
58
|
+
{
|
|
59
|
+
companyId: c,
|
|
60
|
+
payScheduleId: t?.payPeriod?.payScheduleUuid || ""
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
enabled: !!t?.payPeriod?.payScheduleUuid
|
|
64
|
+
}
|
|
65
|
+
), Q = (e) => {
|
|
66
|
+
L(e);
|
|
67
|
+
}, _ = () => {
|
|
68
|
+
n(1);
|
|
69
|
+
}, k = () => {
|
|
70
|
+
n((e) => Math.max(e - 1, 1));
|
|
71
|
+
}, B = () => {
|
|
72
|
+
n((e) => Math.min(e + 1, u));
|
|
73
|
+
}, j = () => {
|
|
74
|
+
n(u);
|
|
75
|
+
}, G = D(async () => {
|
|
76
|
+
await y.invalidateQueries({
|
|
77
|
+
queryKey: [U, s]
|
|
78
|
+
});
|
|
79
|
+
}, [y, s]), O = v && !p.current, T = I && p.current, Y = h || T || !x, A = O || N || !a && h, V = {
|
|
80
|
+
currentPage: m,
|
|
81
|
+
handleFirstPage: _,
|
|
82
|
+
handlePreviousPage: k,
|
|
83
|
+
handleNextPage: B,
|
|
84
|
+
handleLastPage: j,
|
|
85
|
+
handleItemsPerPageChange: Q,
|
|
86
|
+
totalPages: u,
|
|
87
|
+
totalCount: M,
|
|
88
|
+
isFetching: Y,
|
|
89
|
+
itemsPerPage: d
|
|
90
|
+
};
|
|
91
|
+
return {
|
|
92
|
+
employeeCompensations: t?.employeeCompensations || [],
|
|
93
|
+
employeeDetails: b,
|
|
94
|
+
payPeriod: t?.payPeriod,
|
|
95
|
+
paySchedule: K?.payScheduleObject,
|
|
96
|
+
isOffCycle: t?.offCycle ?? !1,
|
|
97
|
+
pagination: V,
|
|
98
|
+
isLoading: A,
|
|
99
|
+
refetch: G
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
export {
|
|
103
|
+
le as usePayrollConfigurationData
|
|
104
|
+
};
|
|
105
|
+
//# sourceMappingURL=usePayrollConfigurationData.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePayrollConfigurationData.js","sources":["../../../../src/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.ts"],"sourcesContent":["import { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { useEmployeesList } from '@gusto/embedded-api/react-query/employeesList'\nimport { keepPreviousData, useQuery, useQueryClient } from '@tanstack/react-query'\nimport { usePaySchedulesGet } from '@gusto/embedded-api/react-query/paySchedulesGet'\nimport { useGustoEmbeddedContext } from '@gusto/embedded-api/react-query/_context'\nimport { payrollsPrepare } from '@gusto/embedded-api/funcs/payrollsPrepare'\nimport type { EmployeeCompensations } from '@gusto/embedded-api/models/components/payrollshow'\nimport type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport type { PayrollPayPeriodType } from '@gusto/embedded-api/models/components/payrollpayperiodtype'\nimport type { PayScheduleObject } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport type {\n PaginationControlProps,\n PaginationItemsPerPage,\n} from '@/components/Common/PaginationControl/PaginationControlTypes'\n\ninterface UsePayrollConfigurationDataParams {\n companyId: string\n payrollId: string\n}\n\ninterface UsePayrollConfigurationDataReturn {\n employeeCompensations: EmployeeCompensations[]\n employeeDetails: Employee[]\n payPeriod: PayrollPayPeriodType | undefined\n paySchedule: PayScheduleObject | undefined\n isOffCycle: boolean\n pagination: PaginationControlProps\n isLoading: boolean\n refetch: () => Promise<void>\n}\n\nconst PREPARE_QUERY_KEY = 'payroll-prepare'\nconst FIVE_MINUTES = 5 * 60 * 1000\n\nexport function usePayrollConfigurationData({\n companyId,\n payrollId,\n}: UsePayrollConfigurationDataParams): UsePayrollConfigurationDataReturn {\n const gustoClient = useGustoEmbeddedContext()\n const queryClient = useQueryClient()\n const defaultItemsPerPage = 10\n\n const [currentPage, setCurrentPage] = useState(1)\n const [itemsPerPage, setItemsPerPage] = useState<PaginationItemsPerPage>(defaultItemsPerPage)\n const [displayedEmployees, setDisplayedEmployees] = useState<Employee[]>([])\n const [isDataInSync, setIsDataInSync] = useState(false)\n const hasInitialDataRef = useRef(false)\n\n const { data: employeeData, isFetching: isFetchingEmployeeData } = useEmployeesList(\n {\n companyId,\n payrollUuid: payrollId,\n per: itemsPerPage,\n page: currentPage,\n sortBy: 'name',\n },\n { placeholderData: keepPreviousData },\n )\n\n const employeeDataRef = useRef(employeeData)\n employeeDataRef.current = employeeData\n\n const employeeUuids = useMemo(() => {\n return employeeData?.showEmployees?.map(e => e.uuid) || []\n }, [employeeData?.showEmployees])\n\n const totalPages = Number(employeeData?.httpMeta.response.headers.get('x-total-pages') ?? 1)\n const totalCount = Number(employeeData?.httpMeta.response.headers.get('x-total-count') ?? 0)\n\n const employeeUuidsKey = useMemo(() => employeeUuids.join(','), [employeeUuids])\n\n const {\n data: prepareData,\n isLoading: isPrepareLoading,\n isFetching: isPrepareFetching,\n } = useQuery({\n queryKey: [PREPARE_QUERY_KEY, payrollId, employeeUuidsKey],\n queryFn: async () => {\n const result = await payrollsPrepare(gustoClient, {\n companyId,\n payrollId,\n sortBy: 'last_name',\n requestBody: {\n employeeUuids,\n },\n })\n\n if (!result.ok) {\n throw result.error\n }\n\n return result.value.payrollPrepared\n },\n enabled: employeeUuids.length > 0,\n staleTime: FIVE_MINUTES,\n placeholderData: keepPreviousData,\n })\n\n const syncData = useCallback(() => {\n const currentEmployeeData = employeeDataRef.current\n if (!currentEmployeeData?.showEmployees || !prepareData?.employeeCompensations) {\n setIsDataInSync(false)\n return\n }\n\n const currentUuids = currentEmployeeData.showEmployees.map(e => e.uuid)\n const preparedUuids = new Set(prepareData.employeeCompensations.map(c => c.employeeUuid))\n const inSync = currentUuids.length > 0 && currentUuids.every(uuid => preparedUuids.has(uuid))\n\n if (inSync) {\n setDisplayedEmployees(currentEmployeeData.showEmployees)\n setIsDataInSync(true)\n hasInitialDataRef.current = true\n } else {\n setIsDataInSync(false)\n }\n }, [prepareData?.employeeCompensations])\n\n useEffect(() => {\n syncData()\n }, [syncData])\n\n const { data: payScheduleData, isLoading: isPayScheduleLoading } = usePaySchedulesGet(\n {\n companyId,\n payScheduleId: prepareData?.payPeriod?.payScheduleUuid || '',\n },\n {\n enabled: !!prepareData?.payPeriod?.payScheduleUuid,\n },\n )\n\n const handleItemsPerPageChange = (newCount: PaginationItemsPerPage) => {\n setItemsPerPage(newCount)\n }\n\n const handleFirstPage = () => {\n setCurrentPage(1)\n }\n\n const handlePreviousPage = () => {\n setCurrentPage(prevPage => Math.max(prevPage - 1, 1))\n }\n\n const handleNextPage = () => {\n setCurrentPage(prevPage => Math.min(prevPage + 1, totalPages))\n }\n\n const handleLastPage = () => {\n setCurrentPage(totalPages)\n }\n\n const handleRefetch = useCallback(async () => {\n await queryClient.invalidateQueries({\n queryKey: [PREPARE_QUERY_KEY, payrollId],\n })\n }, [queryClient, payrollId])\n\n const isInitialLoading = isPrepareLoading && !hasInitialDataRef.current\n const isPaginating = isPrepareFetching && hasInitialDataRef.current\n const isPaginationFetching = isFetchingEmployeeData || isPaginating || !isDataInSync\n const isLoading =\n isInitialLoading || isPayScheduleLoading || (!employeeData && isFetchingEmployeeData)\n\n const pagination: PaginationControlProps = {\n currentPage,\n handleFirstPage,\n handlePreviousPage,\n handleNextPage,\n handleLastPage,\n handleItemsPerPageChange,\n totalPages,\n totalCount,\n isFetching: isPaginationFetching,\n itemsPerPage,\n }\n\n return {\n employeeCompensations: prepareData?.employeeCompensations || [],\n employeeDetails: displayedEmployees,\n payPeriod: prepareData?.payPeriod,\n paySchedule: payScheduleData?.payScheduleObject,\n isOffCycle: prepareData?.offCycle ?? false,\n pagination,\n isLoading,\n refetch: handleRefetch,\n }\n}\n"],"names":["PREPARE_QUERY_KEY","FIVE_MINUTES","usePayrollConfigurationData","companyId","payrollId","gustoClient","useGustoEmbeddedContext","queryClient","useQueryClient","defaultItemsPerPage","currentPage","setCurrentPage","useState","itemsPerPage","setItemsPerPage","displayedEmployees","setDisplayedEmployees","isDataInSync","setIsDataInSync","hasInitialDataRef","useRef","employeeData","isFetchingEmployeeData","useEmployeesList","keepPreviousData","employeeDataRef","employeeUuids","useMemo","totalPages","totalCount","employeeUuidsKey","prepareData","isPrepareLoading","isPrepareFetching","useQuery","result","payrollsPrepare","syncData","useCallback","currentEmployeeData","currentUuids","e","preparedUuids","c","uuid","useEffect","payScheduleData","isPayScheduleLoading","usePaySchedulesGet","handleItemsPerPageChange","newCount","handleFirstPage","handlePreviousPage","prevPage","handleNextPage","handleLastPage","handleRefetch","isInitialLoading","isPaginating","isPaginationFetching","isLoading","pagination"],"mappings":";;;;;;AA+BA,MAAMA,IAAoB,mBACpBC,KAAe,MAAS;AAEvB,SAASC,GAA4B;AAAA,EAC1C,WAAAC;A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