@gusto/embedded-react-sdk 0.30.0 → 0.31.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 +37 -0
- package/dist/components/Common/Fields/ComboBoxField/ComboBoxField.d.ts +2 -1
- package/dist/components/Common/Fields/ComboBoxField/ComboBoxField.js +48 -36
- package/dist/components/Common/Fields/ComboBoxField/ComboBoxField.js.map +1 -1
- 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 +2 -2
- package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/components/Common/UI/ComboBox/ComboBox.d.ts +1 -1
- package/dist/components/Common/UI/ComboBox/ComboBox.js +73 -66
- package/dist/components/Common/UI/ComboBox/ComboBox.js.map +1 -1
- package/dist/components/Common/UI/ComboBox/ComboBoxTypes.d.ts +5 -0
- package/dist/components/Common/UI/FileInput/FileInput.js +1 -1
- package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
- package/dist/components/Company/AssignSignatory/AssignSignatory.js +1 -1
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +16 -17
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js.map +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/InviteSignatoryForm.js +5 -6
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js.map +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 +6 -5
- 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 +6 -5
- 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 +4 -3
- package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +6 -5
- 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/Industry/Industry.js +1 -1
- package/dist/components/Company/Industry/Industry.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Form.js +5 -6
- package/dist/components/Company/Locations/LocationForm/Form.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/LocationForm.js +14 -14
- package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
- 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/LocationsList.js +31 -31
- package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
- 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/Edit.js +23 -24
- package/dist/components/Company/PaySchedule/_parts/Edit.js.map +1 -1
- 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/Form.js +7 -8
- package/dist/components/Contractor/Address/Form.js.map +1 -1
- 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 +17 -17
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +2 -2
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js +102 -99
- package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.d.ts +3 -1
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js +35 -31
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js +22 -23
- package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js +8 -7
- package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js +51 -48
- package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js +58 -66
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js +7 -6
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js +3 -2
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +3 -2
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -1
- package/dist/components/Contractor/Profile/ContractorProfileForm.js +15 -15
- 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/Contractor/index.d.ts +5 -0
- package/dist/components/Contractor/index.js +21 -11
- package/dist/components/Contractor/index.js.map +1 -1
- package/dist/components/Employee/Compensation/Edit.js +14 -14
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +11 -10
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +12 -11
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +12 -11
- 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/Deductions/IncludeDeductions/IncludeDeductions.js +2 -3
- package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +7 -7
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +24 -24
- package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +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.d.ts +0 -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/DocumentSigner.d.ts +2 -1
- package/dist/components/Employee/DocumentSigner/DocumentSigner.js +42 -21
- package/dist/components/Employee/DocumentSigner/DocumentSigner.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibility.d.ts +5 -0
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibility.js +65 -0
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibility.js.map +1 -0
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.d.ts +10 -0
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js +120 -0
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js.map +1 -0
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.d.ts +43 -0
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.js +51 -0
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.js.map +1 -0
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.test.d.ts +1 -0
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/countries.d.ts +4 -0
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/countries.js +199 -0
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/countries.js.map +1 -0
- package/dist/components/Employee/{EmploymentEligibility → DocumentSigner/EmploymentEligibility}/index.d.ts +0 -1
- package/dist/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.d.ts +107 -0
- package/dist/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.js +284 -0
- package/dist/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.js.map +1 -0
- package/dist/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.module.scss.js +10 -0
- package/dist/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.module.scss.js.map +1 -0
- 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/DocumentSigner/documentSignerStateMachine.d.ts +6 -0
- package/dist/components/Employee/DocumentSigner/documentSignerStateMachine.js +33 -14
- package/dist/components/Employee/DocumentSigner/documentSignerStateMachine.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/stateMachine.d.ts +1 -0
- package/dist/components/Employee/DocumentSigner/stateMachine.js +41 -23
- package/dist/components/Employee/DocumentSigner/stateMachine.js.map +1 -1
- package/dist/components/Employee/EmployeeDocuments/EmployeeDocuments.d.ts +10 -0
- package/dist/components/Employee/EmployeeDocuments/EmployeeDocuments.js +55 -0
- package/dist/components/Employee/EmployeeDocuments/EmployeeDocuments.js.map +1 -0
- package/dist/components/Employee/EmployeeDocuments/EmployeeDocumentsPresentation.d.ts +18 -0
- package/dist/components/Employee/EmployeeDocuments/EmployeeDocumentsPresentation.js +116 -0
- package/dist/components/Employee/EmployeeDocuments/EmployeeDocumentsPresentation.js.map +1 -0
- package/dist/components/Employee/EmployeeDocuments/index.d.ts +2 -0
- package/dist/components/Employee/EmployeeList/EmployeeList.js +4 -3
- package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
- package/dist/components/Employee/EmployeeList/Head.js +3 -2
- package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
- package/dist/components/Employee/EmployeeList/useEmployeeList.js +4 -3
- package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/FederalForm.js +7 -7
- 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 +31 -26
- package/dist/components/Employee/Landing/Landing.js.map +1 -1
- package/dist/components/Employee/OnboardingFlow/OnboardingFlow.d.ts +2 -1
- package/dist/components/Employee/OnboardingFlow/OnboardingFlow.js +23 -21
- package/dist/components/Employee/OnboardingFlow/OnboardingFlow.js.map +1 -1
- package/dist/components/Employee/OnboardingFlow/OnboardingFlowComponents.d.ts +1 -0
- package/dist/components/Employee/OnboardingFlow/OnboardingFlowComponents.js.map +1 -1
- package/dist/components/Employee/OnboardingFlow/onboardingStateMachine.d.ts +1 -0
- package/dist/components/Employee/OnboardingFlow/onboardingStateMachine.js +68 -49
- package/dist/components/Employee/OnboardingFlow/onboardingStateMachine.js.map +1 -1
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +7 -7
- package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +2 -2
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +1 -1
- package/dist/components/Employee/PaymentMethod/Split.js +8 -8
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +6 -5
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/AdminPersonalDetails.js +1 -1
- package/dist/components/Employee/Profile/HomeAddress.js +9 -10
- package/dist/components/Employee/Profile/HomeAddress.js.map +1 -1
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js +10 -11
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
- package/dist/components/Employee/Profile/Profile.js +11 -11
- package/dist/components/Employee/Profile/Profile.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/SelfOnboardingFlow/SelfOnboardingComponents.d.ts +3 -0
- package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingComponents.js +43 -30
- package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingComponents.js.map +1 -1
- package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingFlow.d.ts +1 -1
- package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingFlow.js +23 -17
- package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingFlow.js.map +1 -1
- package/dist/components/Employee/SelfOnboardingFlow/selfOnboardingMachine.js +36 -46
- package/dist/components/Employee/SelfOnboardingFlow/selfOnboardingMachine.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/FederalForm.js +7 -7
- package/dist/components/Employee/Taxes/useTaxes.js +4 -3
- package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
- package/dist/components/Employee/index.d.ts +3 -0
- package/dist/components/Employee/index.js +20 -16
- package/dist/components/Employee/index.js.map +1 -1
- package/dist/components/Flow/Flow.js +3 -2
- package/dist/components/Flow/Flow.js.map +1 -1
- package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js +63 -52
- package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js.map +1 -1
- package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js +4 -4
- package/dist/components/InformationRequests/InformationRequests.js +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +9 -9
- package/dist/components/Payroll/OffCycle/OffCycleFlow.d.ts +2 -0
- package/dist/components/Payroll/OffCycle/OffCycleFlow.js +29 -0
- package/dist/components/Payroll/OffCycle/OffCycleFlow.js.map +1 -0
- package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.d.ts +13 -0
- package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js +45 -0
- package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js.map +1 -0
- package/dist/components/Payroll/OffCycle/index.d.ts +3 -0
- package/dist/components/Payroll/OffCycle/offCycleStateMachine.d.ts +6 -0
- package/dist/components/Payroll/OffCycle/offCycleStateMachine.js +58 -0
- package/dist/components/Payroll/OffCycle/offCycleStateMachine.js.map +1 -0
- package/dist/components/Payroll/OffCycle/offCycleStateMachine.test.d.ts +1 -0
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.d.ts +2 -0
- package/dist/components/Payroll/{PayPeriodDateForm/PayPeriodDateFormTypes.d.ts → OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes.d.ts} +5 -19
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/index.d.ts +2 -0
- package/dist/components/Payroll/{PayPeriodDateForm/usePayPeriodDateValidation.d.ts → OffCyclePayPeriodDateForm/useOffCyclePayPeriodDateValidation.d.ts} +1 -1
- package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js +2 -1
- package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js +3 -2
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +12 -12
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +51 -49
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +2 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +93 -90
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.d.ts +1 -0
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +26 -25
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +38 -39
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +18 -17
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +3 -2
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +3 -2
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +23 -21
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
- 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/RecoveryCasesList/RecoveryCasesList.js +1 -1
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js +6 -6
- package/dist/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.js +3 -2
- package/dist/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.js.map +1 -1
- package/dist/components/Payroll/helpers.d.ts +5 -0
- package/dist/components/Payroll/helpers.js +41 -40
- package/dist/components/Payroll/helpers.js.map +1 -1
- package/dist/components/Payroll/index.d.ts +3 -2
- package/dist/components/Payroll/index.js +16 -16
- package/dist/components/Payroll/usePreparedPayrollData.d.ts +2 -2
- package/dist/components/Payroll/usePreparedPayrollData.js +3 -2
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/contexts/ApiProvider/ApiProvider.js +6 -6
- package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -1
- package/dist/i18n/I18n.js +5 -5
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Contractor.Payments.CreatePayment.json.js +1 -1
- package/dist/i18n/en/Employee.EmployeeDocuments.json.js +12 -0
- package/dist/i18n/en/Employee.EmployeeDocuments.json.js.map +1 -0
- package/dist/i18n/en/Employee.EmploymentEligibility.json.js +15 -19
- package/dist/i18n/en/Employee.EmploymentEligibility.json.js.map +1 -1
- package/dist/i18n/en/Employee.I9SignatureForm.json.js +78 -0
- package/dist/i18n/en/Employee.I9SignatureForm.json.js.map +1 -0
- package/dist/i18n/en/Payroll.OffCycle.json.js +8 -0
- package/dist/i18n/en/Payroll.OffCycle.json.js.map +1 -0
- package/dist/i18n/en/Payroll.OffCyclePayPeriodDateForm.json.js +18 -0
- package/dist/i18n/en/Payroll.OffCyclePayPeriodDateForm.json.js.map +1 -0
- package/dist/i18n/en/Payroll.PayrollConfiguration.json.js +1 -1
- package/dist/i18n/en/Payroll.PayrollOverview.json.js +1 -1
- package/dist/shared/constants.d.ts +9 -0
- package/dist/shared/constants.js +60 -53
- package/dist/shared/constants.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/i18next.d.ts +110 -41
- package/package.json +14 -14
- package/dist/components/Employee/EmploymentEligibility/EmploymentEligibility.d.ts +0 -3
- package/dist/components/Employee/EmploymentEligibility/EmploymentEligibilityPresentation.d.ts +0 -37
- package/dist/components/Payroll/PayPeriodDateForm/PayPeriodDateForm.d.ts +0 -2
- package/dist/components/Payroll/PayPeriodDateForm/PayPeriodDateForm.js +0 -35
- package/dist/components/Payroll/PayPeriodDateForm/PayPeriodDateForm.js.map +0 -1
- package/dist/components/Payroll/PayPeriodDateForm/PayPeriodDateFormPresentation.d.ts +0 -2
- package/dist/components/Payroll/PayPeriodDateForm/PayPeriodDateFormPresentation.js +0 -65
- package/dist/components/Payroll/PayPeriodDateForm/PayPeriodDateFormPresentation.js.map +0 -1
- package/dist/components/Payroll/PayPeriodDateForm/PayPeriodDateFormPresentation.module.scss.js +0 -18
- package/dist/components/Payroll/PayPeriodDateForm/PayPeriodDateFormPresentation.module.scss.js.map +0 -1
- package/dist/components/Payroll/PayPeriodDateForm/index.d.ts +0 -3
- package/dist/i18n/en/Payroll.PayPeriodDateForm.json.js +0 -32
- package/dist/i18n/en/Payroll.PayPeriodDateForm.json.js.map +0 -1
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
import { jsx as r, jsxs as o, Fragment 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 u, FlexItem as
|
|
9
|
-
import { Grid as
|
|
10
|
-
import "
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
employeeCompensations: i,
|
|
1
|
+
import { jsx as r, jsxs as o, Fragment as S } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as A } from "react";
|
|
3
|
+
import { useTranslation as V, Trans as _ } from "react-i18next";
|
|
4
|
+
import { useFormatEmployeePayRate as z, getPayrollTypeLabel as K, getRegularHours as O, getOvertimeHours as W, formatHoursDisplay as M, getTotalPtoHours as X, getAdditionalEarnings as q, getReimbursements as J, calculateGrossPay as Q } from "../helpers.js";
|
|
5
|
+
import { PayrollBlockerAlerts as Y } from "../PayrollBlocker/components/PayrollBlockerAlerts.js";
|
|
6
|
+
import Z from "./PayrollConfigurationPresentation.module.scss.js";
|
|
7
|
+
import { useI18n as $ } from "../../../i18n/I18n.js";
|
|
8
|
+
import { Flex as u, FlexItem as y } from "../../Common/Flex/Flex.js";
|
|
9
|
+
import { Grid as ee } from "../../Common/Grid/Grid.js";
|
|
10
|
+
import { HamburgerMenu as te } from "../../Common/HamburgerMenu/HamburgerMenu.js";
|
|
11
|
+
import { useComponentContext as re } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
12
|
+
import ne from "../../../assets/icons/pencil.svg.js";
|
|
13
|
+
import oe from "../../../assets/icons/x-circle.svg.js";
|
|
14
|
+
import le from "../../../assets/icons/plus-circle.svg.js";
|
|
15
|
+
import { formatNumberAsCurrency as h, firstLastName as ie } from "../../../helpers/formattedStrings.js";
|
|
16
|
+
import { useDateFormatter as ae } from "../../../hooks/useDateFormatter.js";
|
|
17
|
+
import { useContainerBreakpoints as se } from "../../../hooks/useContainerBreakpoints/useContainerBreakpoints.js";
|
|
18
|
+
import { PayrollLoading as me } from "../../Common/PayrollLoading/PayrollLoading.js";
|
|
19
|
+
import { DataView as ce } from "../../Common/DataView/DataView.js";
|
|
20
|
+
const ue = (l, p) => l?.startDate && l.endDate ? p.formatPayPeriod(l.startDate, l.endDate) : { startDate: "", endDate: "" }, Ne = ({
|
|
21
|
+
employeeCompensations: l,
|
|
23
22
|
employeeDetails: p,
|
|
24
|
-
payPeriod:
|
|
25
|
-
paySchedule:
|
|
26
|
-
onEdit:
|
|
27
|
-
onToggleExclude:
|
|
23
|
+
payPeriod: f,
|
|
24
|
+
paySchedule: w,
|
|
25
|
+
onEdit: H,
|
|
26
|
+
onToggleExclude: E,
|
|
28
27
|
onCalculatePayroll: b,
|
|
29
|
-
onViewBlockers:
|
|
30
|
-
isOffCycle:
|
|
31
|
-
|
|
28
|
+
onViewBlockers: R,
|
|
29
|
+
isOffCycle: D = !1,
|
|
30
|
+
offCycleReason: F,
|
|
31
|
+
alerts: C,
|
|
32
32
|
payrollAlert: m,
|
|
33
|
-
isPending:
|
|
34
|
-
isCalculating:
|
|
35
|
-
payrollBlockers:
|
|
36
|
-
pagination:
|
|
37
|
-
withReimbursements:
|
|
38
|
-
isCalculateDisabled:
|
|
33
|
+
isPending: g,
|
|
34
|
+
isCalculating: i,
|
|
35
|
+
payrollBlockers: P = [],
|
|
36
|
+
pagination: N,
|
|
37
|
+
withReimbursements: U = !0,
|
|
38
|
+
isCalculateDisabled: x = !1
|
|
39
39
|
}) => {
|
|
40
|
-
const { Button:
|
|
41
|
-
|
|
42
|
-
const { t } =
|
|
40
|
+
const { Button: T, Heading: k, Text: d, Badge: j, Alert: B } = re();
|
|
41
|
+
$("Payroll.PayrollConfiguration");
|
|
42
|
+
const { t } = V("Payroll.PayrollConfiguration"), G = ae(), I = z(), v = A(null), a = se({ ref: v }).includes("small"), c = new Map(p.map((e) => [e.uuid, e])), L = (e) => {
|
|
43
43
|
const n = c.get(e);
|
|
44
|
-
return n ?
|
|
44
|
+
return n ? ie({ first_name: n.firstName, last_name: n.lastName }) : null;
|
|
45
45
|
};
|
|
46
|
-
return /* @__PURE__ */ r("div", { ref:
|
|
46
|
+
return /* @__PURE__ */ r("div", { ref: v, className: Z.container, children: /* @__PURE__ */ o(u, { flexDirection: "column", gap: 32, children: [
|
|
47
47
|
/* @__PURE__ */ o(
|
|
48
48
|
u,
|
|
49
49
|
{
|
|
@@ -52,146 +52,149 @@ const me = (i, p) => i?.startDate && i.endDate ? p.formatPayPeriod(i.startDate,
|
|
|
52
52
|
alignItems: a ? "center" : "stretch",
|
|
53
53
|
gap: a ? 0 : 16,
|
|
54
54
|
children: [
|
|
55
|
-
/* @__PURE__ */ o(
|
|
55
|
+
/* @__PURE__ */ o(y, { children: [
|
|
56
56
|
/* @__PURE__ */ r(k, { as: "h1", children: t("pageTitle") }),
|
|
57
|
-
/* @__PURE__ */ r(d, { variant: "supporting", children: /* @__PURE__ */ r(
|
|
58
|
-
|
|
57
|
+
f && /* @__PURE__ */ r(d, { variant: "supporting", children: /* @__PURE__ */ r(
|
|
58
|
+
_,
|
|
59
59
|
{
|
|
60
60
|
i18nKey: "description",
|
|
61
61
|
t,
|
|
62
62
|
components: { dateWrapper: /* @__PURE__ */ r(d, { weight: "bold", as: "span" }) },
|
|
63
|
-
values:
|
|
63
|
+
values: {
|
|
64
|
+
...ue(f, G),
|
|
65
|
+
payrollType: K({ offCycle: D, offCycleReason: F })
|
|
66
|
+
}
|
|
64
67
|
}
|
|
65
68
|
) })
|
|
66
69
|
] }),
|
|
67
|
-
/* @__PURE__ */ r(
|
|
68
|
-
|
|
70
|
+
/* @__PURE__ */ r(y, { flexGrow: 0, children: a ? /* @__PURE__ */ r(
|
|
71
|
+
T,
|
|
69
72
|
{
|
|
70
73
|
title: t("calculatePayrollTitle"),
|
|
71
74
|
onClick: b,
|
|
72
|
-
isDisabled:
|
|
73
|
-
children: t(
|
|
75
|
+
isDisabled: x || g || i,
|
|
76
|
+
children: t(i ? "calculatingPayroll" : "calculatePayroll")
|
|
74
77
|
}
|
|
75
78
|
) : /* @__PURE__ */ r(u, { flexDirection: "column", justifyContent: "normal", alignItems: "stretch", gap: 12, children: /* @__PURE__ */ r(
|
|
76
|
-
|
|
79
|
+
T,
|
|
77
80
|
{
|
|
78
81
|
title: t("calculatePayrollTitle"),
|
|
79
82
|
onClick: b,
|
|
80
|
-
isDisabled:
|
|
81
|
-
children: t(
|
|
83
|
+
isDisabled: x || g || i,
|
|
84
|
+
children: t(i ? "calculatingPayroll" : "calculatePayroll")
|
|
82
85
|
}
|
|
83
86
|
) }) })
|
|
84
87
|
]
|
|
85
88
|
}
|
|
86
89
|
),
|
|
87
|
-
(
|
|
88
|
-
m && /* @__PURE__ */ r(
|
|
89
|
-
|
|
90
|
+
(C || m) && /* @__PURE__ */ o(ee, { gap: 16, gridTemplateColumns: "1fr", children: [
|
|
91
|
+
m && /* @__PURE__ */ r(B, { label: m.label, status: m.variant, children: m.content }),
|
|
92
|
+
C
|
|
90
93
|
] }),
|
|
91
|
-
|
|
92
|
-
|
|
94
|
+
g ? /* @__PURE__ */ r(
|
|
95
|
+
me,
|
|
93
96
|
{
|
|
94
|
-
title: t(
|
|
95
|
-
description: t(
|
|
97
|
+
title: t(i ? "calculatingTitle" : "loadingTitle"),
|
|
98
|
+
description: t(i ? "calculatingDescription" : "loadingDescription")
|
|
96
99
|
}
|
|
97
|
-
) : /* @__PURE__ */ o(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
+
) : /* @__PURE__ */ o(S, { children: [
|
|
101
|
+
P.length > 0 && /* @__PURE__ */ r(
|
|
102
|
+
Y,
|
|
100
103
|
{
|
|
101
|
-
blockers:
|
|
102
|
-
onMultipleViewClick:
|
|
104
|
+
blockers: P,
|
|
105
|
+
onMultipleViewClick: R
|
|
103
106
|
}
|
|
104
107
|
),
|
|
105
108
|
/* @__PURE__ */ o(u, { flexDirection: "column", gap: 20, children: [
|
|
106
|
-
/* @__PURE__ */ o(
|
|
109
|
+
/* @__PURE__ */ o(y, { children: [
|
|
107
110
|
/* @__PURE__ */ r(k, { as: "h3", children: t("hoursAndEarningsTitle") }),
|
|
108
111
|
/* @__PURE__ */ r(d, { variant: "supporting", children: t("hoursAndEarningsDescription") })
|
|
109
112
|
] }),
|
|
110
113
|
/* @__PURE__ */ r(
|
|
111
|
-
|
|
114
|
+
ce,
|
|
112
115
|
{
|
|
113
116
|
label: t("employeeCompensationsTitle"),
|
|
114
117
|
columns: [
|
|
115
118
|
{
|
|
116
119
|
title: t("tableColumns.employees"),
|
|
117
120
|
render: (e) => {
|
|
118
|
-
const n = c.get(e.employeeUuid || ""), s =
|
|
121
|
+
const n = c.get(e.employeeUuid || ""), s = I(n);
|
|
119
122
|
return /* @__PURE__ */ o(u, { flexDirection: "column", gap: 0, children: [
|
|
120
|
-
|
|
123
|
+
L(e.employeeUuid || ""),
|
|
121
124
|
s && /* @__PURE__ */ r(d, { size: "xs", variant: "supporting", children: s }),
|
|
122
|
-
e.excluded && /* @__PURE__ */ r(
|
|
125
|
+
e.excluded && /* @__PURE__ */ r(j, { status: "warning", children: t("skippedBadge") })
|
|
123
126
|
] });
|
|
124
127
|
}
|
|
125
128
|
},
|
|
126
129
|
{
|
|
127
130
|
title: t("tableColumns.hours"),
|
|
128
131
|
render: (e) => {
|
|
129
|
-
const n =
|
|
130
|
-
return
|
|
132
|
+
const n = O(e), s = W(e);
|
|
133
|
+
return M(n + s);
|
|
131
134
|
}
|
|
132
135
|
},
|
|
133
136
|
{
|
|
134
137
|
title: t("tableColumns.timeOff"),
|
|
135
138
|
render: (e) => {
|
|
136
|
-
const n =
|
|
137
|
-
return
|
|
139
|
+
const n = X(e);
|
|
140
|
+
return M(n);
|
|
138
141
|
}
|
|
139
142
|
},
|
|
140
143
|
{
|
|
141
144
|
title: t("tableColumns.additionalEarnings"),
|
|
142
145
|
render: (e) => {
|
|
143
|
-
const n =
|
|
144
|
-
return
|
|
146
|
+
const n = q(e);
|
|
147
|
+
return h(n);
|
|
145
148
|
}
|
|
146
149
|
},
|
|
147
|
-
...
|
|
150
|
+
...U ? [
|
|
148
151
|
{
|
|
149
152
|
title: t("tableColumns.reimbursements"),
|
|
150
153
|
render: (e) => {
|
|
151
|
-
const n =
|
|
152
|
-
return
|
|
154
|
+
const n = J(e);
|
|
155
|
+
return h(n);
|
|
153
156
|
}
|
|
154
157
|
}
|
|
155
158
|
] : [],
|
|
156
159
|
{
|
|
157
160
|
title: t("tableColumns.totalPay"),
|
|
158
161
|
render: (e) => {
|
|
159
|
-
const n = c.get(e.employeeUuid || ""), s = n ?
|
|
162
|
+
const n = c.get(e.employeeUuid || ""), s = n ? Q(
|
|
160
163
|
e,
|
|
161
164
|
n,
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
+
f?.startDate,
|
|
166
|
+
w,
|
|
167
|
+
D
|
|
165
168
|
) : 0;
|
|
166
|
-
return
|
|
169
|
+
return h(s);
|
|
167
170
|
}
|
|
168
171
|
}
|
|
169
172
|
],
|
|
170
|
-
data:
|
|
173
|
+
data: l,
|
|
171
174
|
itemMenu: (e) => /* @__PURE__ */ r(
|
|
172
|
-
|
|
175
|
+
te,
|
|
173
176
|
{
|
|
174
177
|
items: [
|
|
175
178
|
{
|
|
176
179
|
label: t("editMenu.edit"),
|
|
177
|
-
icon: /* @__PURE__ */ r(
|
|
180
|
+
icon: /* @__PURE__ */ r(ne, { "aria-hidden": !0 }),
|
|
178
181
|
onClick: () => {
|
|
179
182
|
const n = c.get(e.employeeUuid || "");
|
|
180
|
-
n &&
|
|
183
|
+
n && H(n);
|
|
181
184
|
}
|
|
182
185
|
},
|
|
183
186
|
{
|
|
184
187
|
label: t(e.excluded ? "editMenu.unskip" : "editMenu.skip"),
|
|
185
|
-
icon: e.excluded ? /* @__PURE__ */ r(
|
|
188
|
+
icon: e.excluded ? /* @__PURE__ */ r(le, { "aria-hidden": !0 }) : /* @__PURE__ */ r(oe, { "aria-hidden": !0 }),
|
|
186
189
|
onClick: () => {
|
|
187
|
-
c.get(e.employeeUuid || "") &&
|
|
190
|
+
c.get(e.employeeUuid || "") && E(e);
|
|
188
191
|
}
|
|
189
192
|
}
|
|
190
193
|
],
|
|
191
194
|
triggerLabel: t("editMenu.edit")
|
|
192
195
|
}
|
|
193
196
|
),
|
|
194
|
-
pagination:
|
|
197
|
+
pagination: N
|
|
195
198
|
}
|
|
196
199
|
)
|
|
197
200
|
] })
|
|
@@ -199,6 +202,6 @@ const me = (i, p) => i?.startDate && i.endDate ? p.formatPayPeriod(i.startDate,
|
|
|
199
202
|
] }) });
|
|
200
203
|
};
|
|
201
204
|
export {
|
|
202
|
-
|
|
205
|
+
Ne as PayrollConfigurationPresentation
|
|
203
206
|
};
|
|
204
207
|
//# 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/payroll'\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={32}>\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 variant=\"supporting\">\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 <Flex flexDirection=\"column\" gap={20}>\n <FlexItem>\n <Heading as=\"h3\">{t('hoursAndEarningsTitle')}</Heading>\n <Text variant=\"supporting\">{t('hoursAndEarningsDescription')}</Text>\n </FlexItem>\n\n <DataView\n label={t('employeeCompensationsTitle')}\n columns={[\n {\n title: t('tableColumns.employees'),\n render: (item: EmployeeCompensations) => {\n const employee = employeeMap.get(item.employeeUuid || '')\n const payRateDisplay = formatEmployeePayRate(employee)\n return (\n <Flex flexDirection=\"column\" gap={0}>\n {getEmployeeName(item.employeeUuid || '')}\n {payRateDisplay && (\n <Text size=\"xs\" variant=\"supporting\">\n {payRateDisplay}\n </Text>\n )}\n {item.excluded && <Badge status=\"warning\">{t('skippedBadge')}</Badge>}\n </Flex>\n )\n },\n },\n {\n title: t('tableColumns.hours'),\n render: (item: EmployeeCompensations) => {\n const hours = getRegularHours(item)\n const overtimeHours = getOvertimeHours(item)\n return formatHoursDisplay(hours + overtimeHours)\n },\n },\n {\n title: t('tableColumns.timeOff'),\n render: (item: EmployeeCompensations) => {\n const ptoHours = getTotalPtoHours(item)\n return formatHoursDisplay(ptoHours)\n },\n },\n {\n title: t('tableColumns.additionalEarnings'),\n render: (item: EmployeeCompensations) => {\n const earnings = getAdditionalEarnings(item)\n return formatNumberAsCurrency(earnings)\n },\n },\n ...(withReimbursements\n ? [\n {\n title: t('tableColumns.reimbursements'),\n render: (item: EmployeeCompensations) => {\n const reimbursements = getReimbursements(item)\n return formatNumberAsCurrency(reimbursements)\n },\n },\n ]\n : []),\n {\n title: t('tableColumns.totalPay'),\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 formatNumberAsCurrency(calculatedGrossPay)\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 </Flex>\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","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,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,cAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,iBAAAC,IAAkB,CAAA;AAAA,EAClB,YAAAC;AAAA,EACA,oBAAAC,IAAqB;AAAA,EACrB,qBAAAC,IAAsB;AACxB,MAA6C;AAC3C,QAAM,EAAE,QAAAC,GAAQ,SAAAC,GAAS,MAAAC,GAAM,OAAAC,GAAO,OAAAC,EAAA,IAAUC,GAAA;AAChD,EAAAC,EAAQ,8BAA8B;AACtC,QAAM,EAAE,EAAA,IAAMC,EAAe,8BAA8B,GACrDzB,IAAgB0B,GAAA,GAChBC,IAAwBC,EAAA,GACxBC,IAAeC,EAAuB,IAAI,GAE1CC,IADcC,GAAwB,EAAE,KAAKH,GAAc,EACnC,SAAS,OAAO,GAExCI,IAAc,IAAI,IAAI9B,EAAgB,IAAI,CAAA+B,MAAY,CAAC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A,IAAA,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/payroll'\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 getPayrollTypeLabel,\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 offCycleReason?: string | null\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 offCycleReason,\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={32}>\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 {payPeriod && (\n <Text variant=\"supporting\">\n <Trans\n i18nKey=\"description\"\n t={t}\n components={{ dateWrapper: <Text weight=\"bold\" as=\"span\" /> }}\n values={{\n ...getPayrollConfigurationTitle(payPeriod, dateFormatter),\n payrollType: getPayrollTypeLabel({ offCycle: isOffCycle, offCycleReason }),\n }}\n />\n </Text>\n )}\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 <Flex flexDirection=\"column\" gap={20}>\n <FlexItem>\n <Heading as=\"h3\">{t('hoursAndEarningsTitle')}</Heading>\n <Text variant=\"supporting\">{t('hoursAndEarningsDescription')}</Text>\n </FlexItem>\n\n <DataView\n label={t('employeeCompensationsTitle')}\n columns={[\n {\n title: t('tableColumns.employees'),\n render: (item: EmployeeCompensations) => {\n const employee = employeeMap.get(item.employeeUuid || '')\n const payRateDisplay = formatEmployeePayRate(employee)\n return (\n <Flex flexDirection=\"column\" gap={0}>\n {getEmployeeName(item.employeeUuid || '')}\n {payRateDisplay && (\n <Text size=\"xs\" variant=\"supporting\">\n {payRateDisplay}\n </Text>\n )}\n {item.excluded && <Badge status=\"warning\">{t('skippedBadge')}</Badge>}\n </Flex>\n )\n },\n },\n {\n title: t('tableColumns.hours'),\n render: (item: EmployeeCompensations) => {\n const hours = getRegularHours(item)\n const overtimeHours = getOvertimeHours(item)\n return formatHoursDisplay(hours + overtimeHours)\n },\n },\n {\n title: t('tableColumns.timeOff'),\n render: (item: EmployeeCompensations) => {\n const ptoHours = getTotalPtoHours(item)\n return formatHoursDisplay(ptoHours)\n },\n },\n {\n title: t('tableColumns.additionalEarnings'),\n render: (item: EmployeeCompensations) => {\n const earnings = getAdditionalEarnings(item)\n return formatNumberAsCurrency(earnings)\n },\n },\n ...(withReimbursements\n ? [\n {\n title: t('tableColumns.reimbursements'),\n render: (item: EmployeeCompensations) => {\n const reimbursements = getReimbursements(item)\n return formatNumberAsCurrency(reimbursements)\n },\n },\n ]\n : []),\n {\n title: t('tableColumns.totalPay'),\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 formatNumberAsCurrency(calculatedGrossPay)\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 </Flex>\n </>\n )}\n </Flex>\n </div>\n )\n}\n"],"names":["getPayrollConfigurationTitle","payPeriod","dateFormatter","PayrollConfigurationPresentation","employeeCompensations","employeeDetails","paySchedule","onEdit","onToggleExclude","onCalculatePayroll","onViewBlockers","isOffCycle","offCycleReason","alerts","payrollAlert","isPending","isCalculating","payrollBlockers","pagination","withReimbursements","isCalculateDisabled","Button","Heading","Text","Badge","Alert","useComponentContext","useI18n","useTranslation","useDateFormatter","formatEmployeePayRate","useFormatEmployeePayRate","containerRef","useRef","isDesktop","useContainerBreakpoints","employeeMap","employee","getEmployeeName","employeeUuid","firstLastName","jsx","styles","jsxs","Flex","FlexItem","Trans","getPayrollTypeLabel","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":";;;;;;;;;;;;;;;;;;;AA2DA,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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AAA,YAEF,MAAM/D;AAAA,YACN,UAAU,CAACiD,MACT,gBAAAZ;AAAA,cAAC4B;AAAA,cAAA;AAAA,gBACC,OAAO;AAAA,kBACL;AAAA,oBACE,OAAO,EAAE,eAAe;AAAA,oBACxB,MAAM,gBAAA5B,EAAC6B,IAAA,EAAU,eAAW,GAAA,CAAC;AAAA,oBAC7B,SAAS,MAAM;AACb,4BAAMjC,IAAWD,EAAY,IAAIiB,EAAK,gBAAgB,EAAE;AACxD,sBAAIhB,KACF9B,EAAO8B,CAAQ;AAAA,oBAEnB;AAAA,kBAAA;AAAA,kBAEF;AAAA,oBACE,OAAO,EAAEgB,EAAK,WAAW,oBAAoB,eAAe;AAAA,oBAC5D,MAAMA,EAAK,WAAW,gBAAAZ,EAAC8B,IAAA,EAAW,eAAW,GAAA,CAAC,IAAK,gBAAA9B,EAAC+B,IAAA,EAAQ,eAAW,GAAA,CAAC;AAAA,oBACxE,SAAS,MAAM;AAEb,sBADiBpC,EAAY,IAAIiB,EAAK,gBAAgB,EAAE,KAEtD7C,EAAgB6C,CAAI;AAAA,oBAExB;AAAA,kBAAA;AAAA,gBACF;AAAA,gBAEF,cAAc,EAAE,eAAe;AAAA,cAAA;AAAA,YAAA;AAAA,YAGnC,YAAAnC;AAAA,UAAA;AAAA,QAAA;AAAA,MACF,EAAA,CACF;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,EAAA,CAEJ,EAAA,CACF;AAEJ;"}
|
|
@@ -13,6 +13,7 @@ interface UsePayrollConfigurationDataReturn {
|
|
|
13
13
|
payPeriod: PayrollPayPeriodType | undefined;
|
|
14
14
|
paySchedule: PayScheduleObject | undefined;
|
|
15
15
|
isOffCycle: boolean;
|
|
16
|
+
offCycleReason: string | null;
|
|
16
17
|
pagination: PaginationControlProps;
|
|
17
18
|
isLoading: boolean;
|
|
18
19
|
refetch: () => Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState as d, useRef as
|
|
1
|
+
import { useState as d, useRef as f, useMemo as h, useCallback as g, useEffect as G } from "react";
|
|
2
2
|
import { useEmployeesList as O } from "@gusto/embedded-api/react-query/employeesList";
|
|
3
3
|
import { useQueryClient as T, keepPreviousData as P, useQuery as Y } from "@tanstack/react-query";
|
|
4
4
|
import { usePaySchedulesGet as A } from "@gusto/embedded-api/react-query/paySchedulesGet";
|
|
@@ -10,27 +10,27 @@ function se({
|
|
|
10
10
|
companyId: i,
|
|
11
11
|
payrollId: s
|
|
12
12
|
}) {
|
|
13
|
-
const D = H(),
|
|
13
|
+
const D = H(), p = T(), { currentPage: C, itemsPerPage: S, getPaginationProps: w } = V({
|
|
14
14
|
defaultItemsPerPage: 10
|
|
15
|
-
}), [U,
|
|
15
|
+
}), [U, R] = d([]), [F, r] = d(!1), l = f(!1), { data: a, isFetching: c } = O(
|
|
16
16
|
{
|
|
17
17
|
companyId: i,
|
|
18
18
|
payrollUuid: s,
|
|
19
|
-
per:
|
|
20
|
-
page:
|
|
19
|
+
per: S,
|
|
20
|
+
page: C,
|
|
21
21
|
sortBy: "name"
|
|
22
22
|
},
|
|
23
23
|
{ placeholderData: P }
|
|
24
|
-
), u =
|
|
24
|
+
), u = f(a);
|
|
25
25
|
u.current = a;
|
|
26
|
-
const n =
|
|
27
|
-
data:
|
|
26
|
+
const n = h(() => a?.showEmployees?.map((t) => t.uuid) || [], [a?.showEmployees]), L = h(() => n.join(","), [n]), {
|
|
27
|
+
data: e,
|
|
28
28
|
isLoading: b,
|
|
29
29
|
isFetching: q
|
|
30
30
|
} = Y({
|
|
31
|
-
queryKey: [E, s,
|
|
31
|
+
queryKey: [E, s, L],
|
|
32
32
|
queryFn: async () => {
|
|
33
|
-
const
|
|
33
|
+
const t = await N(D, {
|
|
34
34
|
companyId: i,
|
|
35
35
|
payrollId: s,
|
|
36
36
|
sortBy: "last_name",
|
|
@@ -38,44 +38,45 @@ function se({
|
|
|
38
38
|
employeeUuids: n
|
|
39
39
|
}
|
|
40
40
|
});
|
|
41
|
-
if (!
|
|
42
|
-
throw
|
|
43
|
-
return
|
|
41
|
+
if (!t.ok)
|
|
42
|
+
throw t.error;
|
|
43
|
+
return t.value.payrollPrepared;
|
|
44
44
|
},
|
|
45
45
|
enabled: n.length > 0,
|
|
46
46
|
staleTime: z,
|
|
47
47
|
placeholderData: P
|
|
48
48
|
}), y = g(() => {
|
|
49
|
-
const
|
|
50
|
-
if (!
|
|
49
|
+
const t = u.current;
|
|
50
|
+
if (!t?.showEmployees || !e?.employeeCompensations) {
|
|
51
51
|
r(!1);
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
const m =
|
|
55
|
-
m.length > 0 && m.every((o) => x.has(o)) ? (
|
|
56
|
-
}, [
|
|
54
|
+
const m = t.showEmployees.map((o) => o.uuid), x = new Set(e.employeeCompensations.map((o) => o.employeeUuid));
|
|
55
|
+
m.length > 0 && m.every((o) => x.has(o)) ? (R(t.showEmployees), r(!0), l.current = !0) : r(!1);
|
|
56
|
+
}, [e?.employeeCompensations]);
|
|
57
57
|
G(() => {
|
|
58
58
|
y();
|
|
59
59
|
}, [y]);
|
|
60
60
|
const { data: v, isLoading: K } = A(
|
|
61
61
|
{
|
|
62
62
|
companyId: i,
|
|
63
|
-
payScheduleId:
|
|
63
|
+
payScheduleId: e?.payPeriod?.payScheduleUuid || ""
|
|
64
64
|
},
|
|
65
65
|
{
|
|
66
|
-
enabled: !!
|
|
66
|
+
enabled: !!e?.payPeriod?.payScheduleUuid
|
|
67
67
|
}
|
|
68
68
|
), Q = g(async () => {
|
|
69
|
-
await
|
|
69
|
+
await p.invalidateQueries({
|
|
70
70
|
queryKey: [E, s]
|
|
71
71
|
});
|
|
72
|
-
}, [
|
|
72
|
+
}, [p, s]), _ = b && !l.current, k = q && l.current, B = c || k || !F, I = _ || K || !a && c, M = a?.httpMeta.response.headers ?? new Headers(), j = w(M, B);
|
|
73
73
|
return {
|
|
74
|
-
employeeCompensations:
|
|
74
|
+
employeeCompensations: e?.employeeCompensations || [],
|
|
75
75
|
employeeDetails: U,
|
|
76
|
-
payPeriod:
|
|
76
|
+
payPeriod: e?.payPeriod,
|
|
77
77
|
paySchedule: v?.payScheduleObject,
|
|
78
|
-
isOffCycle:
|
|
78
|
+
isOffCycle: e?.offCycle ?? !1,
|
|
79
|
+
offCycleReason: e?.offCycleReason ?? null,
|
|
79
80
|
pagination: j,
|
|
80
81
|
isLoading: I,
|
|
81
82
|
refetch: Q
|
|
@@ -1 +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/payroll'\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 { PaginationControlProps } from '@/components/Common/PaginationControl/PaginationControlTypes'\nimport { usePagination } from '@/hooks/usePagination/usePagination'\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\n const { currentPage, itemsPerPage, getPaginationProps } = usePagination({\n defaultItemsPerPage: 10,\n })\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 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 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 headers = employeeData?.httpMeta.response.headers ?? new Headers()\n const pagination: PaginationControlProps = getPaginationProps(headers, isPaginationFetching)\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","currentPage","itemsPerPage","getPaginationProps","usePagination","displayedEmployees","setDisplayedEmployees","useState","isDataInSync","setIsDataInSync","hasInitialDataRef","useRef","employeeData","isFetchingEmployeeData","useEmployeesList","keepPreviousData","employeeDataRef","employeeUuids","useMemo","employeeUuidsKey","prepareData","isPrepareLoading","isPrepareFetching","useQuery","result","payrollsPrepare","syncData","useCallback","currentEmployeeData","currentUuids","
|
|
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/payroll'\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 { PaginationControlProps } from '@/components/Common/PaginationControl/PaginationControlTypes'\nimport { usePagination } from '@/hooks/usePagination/usePagination'\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 offCycleReason: string | null\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\n const { currentPage, itemsPerPage, getPaginationProps } = usePagination({\n defaultItemsPerPage: 10,\n })\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 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 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 headers = employeeData?.httpMeta.response.headers ?? new Headers()\n const pagination: PaginationControlProps = getPaginationProps(headers, isPaginationFetching)\n\n return {\n employeeCompensations: prepareData?.employeeCompensations || [],\n employeeDetails: displayedEmployees,\n payPeriod: prepareData?.payPeriod,\n paySchedule: payScheduleData?.payScheduleObject,\n isOffCycle: prepareData?.offCycle ?? false,\n offCycleReason: prepareData?.offCycleReason ?? null,\n pagination,\n isLoading,\n refetch: handleRefetch,\n }\n}\n"],"names":["PREPARE_QUERY_KEY","FIVE_MINUTES","usePayrollConfigurationData","companyId","payrollId","gustoClient","useGustoEmbeddedContext","queryClient","useQueryClient","currentPage","itemsPerPage","getPaginationProps","usePagination","displayedEmployees","setDisplayedEmployees","useState","isDataInSync","setIsDataInSync","hasInitialDataRef","useRef","employeeData","isFetchingEmployeeData","useEmployeesList","keepPreviousData","employeeDataRef","employeeUuids","useMemo","e","employeeUuidsKey","prepareData","isPrepareLoading","isPrepareFetching","useQuery","result","payrollsPrepare","syncData","useCallback","currentEmployeeData","currentUuids","preparedUuids","c","uuid","useEffect","payScheduleData","isPayScheduleLoading","usePaySchedulesGet","handleRefetch","isInitialLoading","isPaginating","isPaginationFetching","isLoading","headers","pagination"],"mappings":";;;;;;;AA8BA,MAAMA,IAAoB,mBACpBC,IAAe,MAAS;AAEvB,SAASC,GAA4B;AAAA,EAC1C,WAAAC;AAAA,EACA,WAAAC;AACF,GAAyE;AACvE,QAAMC,IAAcC,EAAA,GACdC,IAAcC,EAAA,GAEd,EAAE,aAAAC,GAAa,cAAAC,GAAc,oBAAAC,EAAA,IAAuBC,EAAc;AAAA,IACtE,qBAAqB;AAAA,EAAA,CACtB,GACK,CAACC,GAAo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