@gusto/embedded-react-sdk 0.33.0 → 0.34.0-rc.1
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 +25 -0
- package/dist/components/Common/Fields/MultiSelectComboBoxField/MultiSelectComboBoxField.d.ts +5 -0
- package/dist/components/Common/Fields/MultiSelectComboBoxField/MultiSelectComboBoxField.js +34 -0
- package/dist/components/Common/Fields/MultiSelectComboBoxField/MultiSelectComboBoxField.js.map +1 -0
- package/dist/components/Common/Fields/MultiSelectComboBoxField/index.d.ts +2 -0
- package/dist/components/Common/SignatureForm/SignatureForm.d.ts +1 -7
- 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/Menu/Menu.js +2 -3
- package/dist/components/Common/UI/Menu/Menu.js.map +1 -1
- package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.d.ts +2 -0
- package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.js +127 -0
- package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.js.map +1 -0
- package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.module.scss.js +16 -0
- package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.module.scss.js.map +1 -0
- package/dist/components/Common/{MultiSelectComboBox → UI/MultiSelectComboBox}/MultiSelectComboBoxTypes.d.ts +6 -5
- package/dist/components/Common/index.d.ts +1 -0
- 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/Schema.d.ts +4 -30
- 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.d.ts +2 -26
- 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.d.ts +1 -7
- 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.d.ts +1 -7
- 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.d.ts +7 -13
- 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/Locations/LocationForm/Form.d.ts +7 -20
- 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 +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/LocationsList.js +2 -2
- 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 +6 -5
- 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.d.ts +7 -18
- 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/StateTaxesForm.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.d.ts +1 -13
- 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/ContractorList/useContractorList.js +4 -4
- package/dist/components/Contractor/ContractorList/useContractorList.js.map +1 -1
- package/dist/components/Contractor/NewHireReport/NewHireReport.d.ts +5 -15
- package/dist/components/Contractor/NewHireReport/NewHireReport.js +28 -28
- package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +2 -2
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.d.ts +7 -20
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.d.ts +5 -6
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js +3 -3
- package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js +3 -2
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentFormSchema.d.ts +19 -67
- package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js +12 -13
- package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js +18 -17
- package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js +1 -1
- package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js +27 -26
- package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js +76 -44
- package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.js +1 -1
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js +3 -2
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.js +1 -1
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.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/PaymentSummary.d.ts +3 -1
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummary.js +28 -22
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummary.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.d.ts +3 -1
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js +66 -54
- 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.d.ts +54 -120
- package/dist/components/Contractor/Profile/useContractorProfile.js +50 -49
- package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
- package/dist/components/Contractor/Submit/Submit.js +1 -1
- package/dist/components/Employee/Compensation/Edit.js +14 -14
- package/dist/components/Employee/Compensation/useCompensation.d.ts +17 -44
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.d.ts +4 -22
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +62 -61
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.d.ts +4 -22
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +36 -35
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.d.ts +5 -27
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +48 -47
- 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/Deductions/useDeductions.d.ts +7 -26
- 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/EmploymentEligibility/EmploymentEligibilityPresentation.js +21 -20
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.d.ts +5 -29
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.js +8 -8
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.d.ts +9 -76
- package/dist/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.js +7 -7
- 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/EmployeeDocuments/EmployeeDocumentsPresentation.d.ts +1 -5
- package/dist/components/Employee/EmployeeDocuments/EmployeeDocumentsPresentation.js +3 -2
- package/dist/components/Employee/EmployeeDocuments/EmployeeDocumentsPresentation.js.map +1 -1
- 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.d.ts +7 -33
- 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 +8 -8
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +7 -7
- package/dist/components/Employee/PaymentMethod/BankAccount.d.ts +5 -14
- package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +2 -2
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.d.ts +5 -6
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +1 -1
- package/dist/components/Employee/PaymentMethod/Split.js +8 -8
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.d.ts +12 -68
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +19 -17
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/AdminPersonalDetails.d.ts +17 -82
- package/dist/components/Employee/Profile/AdminPersonalDetails.js +38 -33
- package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
- package/dist/components/Employee/Profile/HomeAddress.d.ts +11 -66
- 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.d.ts +15 -64
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js +32 -29
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
- package/dist/components/Employee/Profile/Profile.js +2 -5
- package/dist/components/Employee/Profile/Profile.js.map +1 -1
- package/dist/components/Employee/Profile/SelfPersonalDetails.d.ts +8 -37
- package/dist/components/Employee/Profile/SelfPersonalDetails.js +22 -19
- package/dist/components/Employee/Profile/SelfPersonalDetails.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/StateForm.d.ts +1 -5
- 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.d.ts +7 -33
- package/dist/components/Employee/Taxes/FederalForm.js +7 -7
- package/dist/components/Employee/Taxes/StateForm.d.ts +1 -5
- 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/InformationRequests/InformationRequestForm/InformationRequestForm.js +16 -16
- 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.d.ts +1 -11
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +10 -10
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js.map +1 -1
- package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js +6 -9
- package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js +84 -56
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.d.ts +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js +57 -22
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationTypes.d.ts +5 -0
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js +1 -1
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes.d.ts +2 -22
- package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js +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/PayrollConfigurationPresentation.js +38 -39
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +5 -5
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.d.ts +2 -12
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +66 -67
- 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 +2 -3
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js +8 -7
- 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/usePreparedPayrollData.js +27 -26
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/contexts/ApiProvider/ApiProvider.js +26 -25
- package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -1
- package/dist/contexts/ApiProvider/apiVersionHook.d.ts +2 -0
- package/dist/contexts/ApiProvider/apiVersionHook.js +7 -0
- package/dist/contexts/ApiProvider/apiVersionHook.js.map +1 -0
- package/dist/contexts/ApiProvider/apiVersionHook.test.d.ts +1 -0
- package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js +60 -58
- package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js.map +1 -1
- package/dist/contexts/ComponentAdapter/useComponentContext.d.ts +2 -0
- package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
- package/dist/contexts/ThemeProvider/ThemeProvider.js +23 -23
- package/dist/contexts/ThemeProvider/ThemeProvider.js.map +1 -1
- package/dist/helpers/validations.d.ts +2 -2
- package/dist/i18n/I18n.js +15 -15
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Contractor.Payments.PaymentSummary.json.js +42 -40
- package/dist/i18n/en/Contractor.Payments.PaymentSummary.json.js.map +1 -1
- package/dist/i18n/en/Contractor.Payments.PaymentsList.json.js +9 -9
- package/dist/i18n/en/Payroll.EmployeeSelection.json.js +10 -0
- package/dist/i18n/en/Payroll.EmployeeSelection.json.js.map +1 -0
- package/dist/i18n/en/Payroll.OffCycleCreation.json.js +10 -8
- package/dist/i18n/en/Payroll.OffCycleCreation.json.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/i18next.d.ts +11 -1
- package/docs/reference/endpoint-inventory.json +4 -0
- package/package.json +11 -10
- package/dist/components/Common/MultiSelectComboBox/MultiSelectComboBox.d.ts +0 -2
- /package/dist/components/Common/{MultiSelectComboBox → UI/MultiSelectComboBox}/index.d.ts +0 -0
|
@@ -2,25 +2,22 @@ import { jsx as t } from "react/jsx-runtime";
|
|
|
2
2
|
import { useMemo as m, Suspense as s } from "react";
|
|
3
3
|
import { usePayrollsGetSuspense as p } from "@gusto/embedded-api/react-query/payrollsGet";
|
|
4
4
|
import { PayrollExecutionFlow as y } from "../PayrollExecutionFlow/PayrollExecutionFlow.js";
|
|
5
|
-
import { useFlow as
|
|
5
|
+
import { useFlow as a } from "../../Flow/useFlow.js";
|
|
6
6
|
import { ensureRequired as i } from "../../../helpers/ensureRequired.js";
|
|
7
7
|
import { OffCycleCreation as d } from "../OffCycleCreation/OffCycleCreation.js";
|
|
8
8
|
function h() {
|
|
9
|
-
const { companyId: o, onEvent: e } =
|
|
9
|
+
const { companyId: o, onEvent: e } = a();
|
|
10
10
|
return /* @__PURE__ */ t(d, { companyId: i(o), onEvent: e });
|
|
11
11
|
}
|
|
12
12
|
function w() {
|
|
13
|
-
const { companyId: o, payrollUuid: e, onEvent: n, breadcrumbs:
|
|
14
|
-
const a = r?.createOffCyclePayroll?.[0];
|
|
15
|
-
return a ? [a] : void 0;
|
|
16
|
-
}, [r]), f = i(o), u = i(e);
|
|
13
|
+
const { companyId: o, payrollUuid: e, onEvent: n, breadcrumbs: c } = a(), r = c?.createOffCyclePayroll?.[0], l = m(() => r ? [r] : void 0, [r]), f = i(o), u = i(e);
|
|
17
14
|
return /* @__PURE__ */ t(s, { children: /* @__PURE__ */ t(
|
|
18
15
|
C,
|
|
19
16
|
{
|
|
20
17
|
companyId: f,
|
|
21
18
|
payrollId: u,
|
|
22
19
|
onEvent: n,
|
|
23
|
-
prefixBreadcrumbs:
|
|
20
|
+
prefixBreadcrumbs: l
|
|
24
21
|
}
|
|
25
22
|
) });
|
|
26
23
|
}
|
|
@@ -29,13 +26,13 @@ function C({
|
|
|
29
26
|
payrollId: e,
|
|
30
27
|
...n
|
|
31
28
|
}) {
|
|
32
|
-
const { data:
|
|
29
|
+
const { data: c } = p({ companyId: o, payrollId: e }), r = c.payrollShow?.payPeriod;
|
|
33
30
|
return /* @__PURE__ */ t(
|
|
34
31
|
y,
|
|
35
32
|
{
|
|
36
33
|
companyId: o,
|
|
37
34
|
payrollId: e,
|
|
38
|
-
initialPayPeriod:
|
|
35
|
+
initialPayPeriod: r,
|
|
39
36
|
...n
|
|
40
37
|
}
|
|
41
38
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OffCycleFlowComponents.js","sources":["../../../../src/components/Payroll/OffCycle/OffCycleFlowComponents.tsx"],"sourcesContent":["import { Suspense, useMemo } from 'react'\nimport { usePayrollsGetSuspense } from '@gusto/embedded-api/react-query/payrollsGet'\nimport { OffCycleCreation } from '../OffCycleCreation'\nimport {\n PayrollExecutionFlow,\n type PayrollExecutionFlowProps,\n} from '../PayrollExecutionFlow/PayrollExecutionFlow'\nimport { useFlow, type FlowContextInterface } from '@/components/Flow/useFlow'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport type { EventType } from '@/shared/constants'\nimport { ensureRequired } from '@/helpers/ensureRequired'\n\nexport interface OffCycleFlowContextInterface extends FlowContextInterface {\n companyId: string\n payrollUuid?: string\n}\n\nexport interface OffCycleFlowProps {\n companyId: string\n onEvent: OnEventType<EventType, unknown>\n}\n\nexport function OffCycleCreationContextual() {\n const { companyId, onEvent } = useFlow<OffCycleFlowContextInterface>()\n return <OffCycleCreation companyId={ensureRequired(companyId)} onEvent={onEvent} />\n}\n\nexport function OffCycleExecutionContextual() {\n const { companyId, payrollUuid, onEvent, breadcrumbs } = useFlow<OffCycleFlowContextInterface>()\n\n const
|
|
1
|
+
{"version":3,"file":"OffCycleFlowComponents.js","sources":["../../../../src/components/Payroll/OffCycle/OffCycleFlowComponents.tsx"],"sourcesContent":["import { Suspense, useMemo } from 'react'\nimport { usePayrollsGetSuspense } from '@gusto/embedded-api/react-query/payrollsGet'\nimport { OffCycleCreation } from '../OffCycleCreation'\nimport {\n PayrollExecutionFlow,\n type PayrollExecutionFlowProps,\n} from '../PayrollExecutionFlow/PayrollExecutionFlow'\nimport { useFlow, type FlowContextInterface } from '@/components/Flow/useFlow'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport type { EventType } from '@/shared/constants'\nimport { ensureRequired } from '@/helpers/ensureRequired'\n\nexport interface OffCycleFlowContextInterface extends FlowContextInterface {\n companyId: string\n payrollUuid?: string\n}\n\nexport interface OffCycleFlowProps {\n companyId: string\n onEvent: OnEventType<EventType, unknown>\n}\n\nexport function OffCycleCreationContextual() {\n const { companyId, onEvent } = useFlow<OffCycleFlowContextInterface>()\n return <OffCycleCreation companyId={ensureRequired(companyId)} onEvent={onEvent} />\n}\n\nexport function OffCycleExecutionContextual() {\n const { companyId, payrollUuid, onEvent, breadcrumbs } = useFlow<OffCycleFlowContextInterface>()\n\n const offCycleCreationBreadcrumb = breadcrumbs?.['createOffCyclePayroll']?.[0]\n const prefixBreadcrumbs = useMemo(() => {\n return offCycleCreationBreadcrumb ? [offCycleCreationBreadcrumb] : undefined\n }, [offCycleCreationBreadcrumb])\n\n const resolvedCompanyId = ensureRequired(companyId)\n const resolvedPayrollId = ensureRequired(payrollUuid)\n\n return (\n <Suspense>\n <OffCycleExecutionWithData\n companyId={resolvedCompanyId}\n payrollId={resolvedPayrollId}\n onEvent={onEvent}\n prefixBreadcrumbs={prefixBreadcrumbs}\n />\n </Suspense>\n )\n}\n\ntype OffCycleExecutionWithDataProps = Pick<\n PayrollExecutionFlowProps,\n 'companyId' | 'payrollId' | 'onEvent' | 'prefixBreadcrumbs'\n>\n\nfunction OffCycleExecutionWithData({\n companyId,\n payrollId,\n ...rest\n}: OffCycleExecutionWithDataProps) {\n const { data } = usePayrollsGetSuspense({ companyId, payrollId })\n const initialPayPeriod = data.payrollShow?.payPeriod\n\n return (\n <PayrollExecutionFlow\n companyId={companyId}\n payrollId={payrollId}\n initialPayPeriod={initialPayPeriod}\n {...rest}\n />\n )\n}\n"],"names":["OffCycleCreationContextual","companyId","onEvent","useFlow","OffCycleCreation","ensureRequired","OffCycleExecutionContextual","payrollUuid","breadcrumbs","offCycleCreationBreadcrumb","prefixBreadcrumbs","useMemo","resolvedCompanyId","resolvedPayrollId","Suspense","jsx","OffCycleExecutionWithData","payrollId","rest","data","usePayrollsGetSuspense","initialPayPeriod","PayrollExecutionFlow"],"mappings":";;;;;;;AAsBO,SAASA,IAA6B;AAC3C,QAAM,EAAE,WAAAC,GAAW,SAAAC,EAAA,IAAYC,EAAA;AAC/B,2BAAQC,GAAA,EAAiB,WAAWC,EAAeJ,CAAS,GAAG,SAAAC,GAAkB;AACnF;AAEO,SAASI,IAA8B;AAC5C,QAAM,EAAE,WAAAL,GAAW,aAAAM,GAAa,SAAAL,GAAS,aAAAM,EAAA,IAAgBL,EAAA,GAEnDM,IAA6BD,GAAc,wBAA2B,CAAC,GACvEE,IAAoBC,EAAQ,MACzBF,IAA6B,CAACA,CAA0B,IAAI,QAClE,CAACA,CAA0B,CAAC,GAEzBG,IAAoBP,EAAeJ,CAAS,GAC5CY,IAAoBR,EAAeE,CAAW;AAEpD,2BACGO,GAAA,EACC,UAAA,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,WAAWJ;AAAA,MACX,WAAWC;AAAA,MACX,SAAAX;AAAA,MACA,mBAAAQ;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;AAOA,SAASM,EAA0B;AAAA,EACjC,WAAAf;AAAA,EACA,WAAAgB;AAAA,EACA,GAAGC;AACL,GAAmC;AACjC,QAAM,EAAE,MAAAC,EAAA,IAASC,EAAuB,EAAE,WAAAnB,GAAW,WAAAgB,GAAW,GAC1DI,IAAmBF,EAAK,aAAa;AAE3C,SACE,gBAAAJ;AAAA,IAACO;AAAA,IAAA;AAAA,MACC,WAAArB;AAAA,MACA,WAAAgB;AAAA,MACA,kBAAAI;AAAA,MACC,GAAGH;AAAA,IAAA;AAAA,EAAA;AAGV;"}
|
|
@@ -1,79 +1,107 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useEffect as
|
|
3
|
-
import { useForm as
|
|
4
|
-
import { zodResolver as
|
|
5
|
-
import { z as
|
|
6
|
-
import { useTranslation as
|
|
7
|
-
import { usePayrollsCreateOffCycleMutation as
|
|
8
|
-
import { OffCycleReason as
|
|
9
|
-
import { RFCDate as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as B, useEffect as I } from "react";
|
|
3
|
+
import { useForm as T, FormProvider as V } from "react-hook-form";
|
|
4
|
+
import { zodResolver as j } from "@hookform/resolvers/zod";
|
|
5
|
+
import { z as t } from "zod";
|
|
6
|
+
import { useTranslation as O } from "react-i18next";
|
|
7
|
+
import { usePayrollsCreateOffCycleMutation as q } from "@gusto/embedded-api/react-query/payrollsCreateOffCycle";
|
|
8
|
+
import { OffCycleReason as E } from "@gusto/embedded-api/models/operations/postv1companiescompanyidpayrolls";
|
|
9
|
+
import { RFCDate as f } from "@gusto/embedded-api/types/rfcdate";
|
|
10
|
+
import { useEmployeesListSuspense as x } from "@gusto/embedded-api/react-query/employeesList";
|
|
11
|
+
import { createOffCyclePayPeriodDateFormSchema as z } from "../OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes.js";
|
|
12
|
+
import { useOffCyclePayPeriodDateValidation as M } from "../OffCyclePayPeriodDateForm/useOffCyclePayPeriodDateValidation.js";
|
|
13
|
+
import { OffCycleCreationPresentation as Y } from "./OffCycleCreationPresentation.js";
|
|
14
|
+
import { BaseComponent as H } from "../../Base/Base.js";
|
|
15
|
+
import { useBase as Z } from "../../Base/useBase.js";
|
|
16
|
+
import { useComponentDictionary as G, useI18n as n } from "../../../i18n/I18n.js";
|
|
17
|
+
import { componentEvents as J } from "../../../shared/constants.js";
|
|
18
|
+
import { Form as K } from "../../Common/Form/Form.js";
|
|
19
|
+
import { OFF_CYCLE_REASON_DEFAULTS as k } from "../OffCycleReasonSelection/types.js";
|
|
20
|
+
const Q = {
|
|
21
|
+
bonus: E.Bonus,
|
|
22
|
+
correction: E.Correction
|
|
22
23
|
};
|
|
23
|
-
function
|
|
24
|
-
return /* @__PURE__ */
|
|
24
|
+
function Pe(i) {
|
|
25
|
+
return /* @__PURE__ */ l(H, { ...i, children: /* @__PURE__ */ l(W, { ...i }) });
|
|
25
26
|
}
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
const { t:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
function W({ dictionary: i, companyId: d, payrollType: m = "bonus" }) {
|
|
28
|
+
G("Payroll.OffCycleCreation", i), n("Payroll.OffCycleCreation"), n("Payroll.OffCycleReasonSelection"), n("Payroll.OffCyclePayPeriodDateForm"), n("Payroll.OffCycleDeductionsSetting"), n("Payroll.EmployeeSelection");
|
|
29
|
+
const { t: R } = O("Payroll.OffCyclePayPeriodDateForm"), { t: p } = O("Payroll.OffCycleCreation"), { onEvent: g, baseSubmitHandler: S } = Z(), { minCheckDate: b, today: A } = M(), { mutateAsync: F, isPending: v } = q(), { data: C, isLoading: w } = x({
|
|
30
|
+
companyId: d,
|
|
31
|
+
onboardedActive: !0
|
|
32
|
+
}), L = B(() => (C.showEmployees ?? []).map((o) => ({
|
|
33
|
+
label: [o.firstName, o.lastName].filter(Boolean).join(" "),
|
|
34
|
+
value: o.uuid
|
|
35
|
+
})), [C]), U = (e) => R(e), s = T({
|
|
36
|
+
resolver: (e, o, r) => {
|
|
37
|
+
const u = e.reason, y = e.isCheckOnly, c = z(
|
|
38
|
+
U,
|
|
39
|
+
u === "correction" ? "correction" : m,
|
|
40
|
+
y ? A : b
|
|
41
|
+
), a = t.object({
|
|
42
|
+
reason: t.enum(["bonus", "correction"]),
|
|
43
|
+
skipRegularDeductions: t.boolean(),
|
|
44
|
+
includeAllEmployees: t.boolean(),
|
|
45
|
+
selectedEmployeeUuids: t.array(t.string())
|
|
46
|
+
}).and(c).superRefine((h, N) => {
|
|
47
|
+
!h.includeAllEmployees && h.selectedEmployeeUuids.length === 0 && N.addIssue({
|
|
48
|
+
code: t.ZodIssueCode.custom,
|
|
49
|
+
path: ["selectedEmployeeUuids"],
|
|
50
|
+
message: p("errors.noEmployeesSelected")
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
return j(a)(e, o, r);
|
|
36
54
|
},
|
|
37
55
|
defaultValues: {
|
|
38
|
-
reason:
|
|
56
|
+
reason: m,
|
|
39
57
|
isCheckOnly: !1,
|
|
40
58
|
startDate: null,
|
|
41
59
|
endDate: null,
|
|
42
60
|
checkDate: null,
|
|
43
|
-
skipRegularDeductions:
|
|
61
|
+
skipRegularDeductions: k[m].skipDeductions,
|
|
62
|
+
includeAllEmployees: !0,
|
|
63
|
+
selectedEmployeeUuids: []
|
|
44
64
|
}
|
|
45
|
-
}),
|
|
46
|
-
|
|
47
|
-
|
|
65
|
+
}), D = s.watch("reason");
|
|
66
|
+
I(() => {
|
|
67
|
+
s.setValue(
|
|
48
68
|
"skipRegularDeductions",
|
|
49
|
-
D
|
|
69
|
+
k[D].skipDeductions
|
|
50
70
|
);
|
|
51
|
-
}, [
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
await
|
|
55
|
-
const
|
|
71
|
+
}, [D, s]);
|
|
72
|
+
const _ = async (e) => {
|
|
73
|
+
const o = e.reason, r = e.checkDate, u = e.isCheckOnly ? r : e.startDate, y = e.isCheckOnly ? r : e.endDate, P = !e.includeAllEmployees && e.selectedEmployeeUuids.length > 0 ? e.selectedEmployeeUuids : void 0;
|
|
74
|
+
await S(e, async () => {
|
|
75
|
+
const c = await F({
|
|
56
76
|
request: {
|
|
57
|
-
companyId:
|
|
77
|
+
companyId: d,
|
|
58
78
|
requestBody: {
|
|
59
79
|
offCycle: !0,
|
|
60
|
-
offCycleReason:
|
|
61
|
-
startDate: new u
|
|
62
|
-
endDate: new
|
|
63
|
-
checkDate: new
|
|
80
|
+
offCycleReason: Q[o],
|
|
81
|
+
startDate: new f(u),
|
|
82
|
+
endDate: new f(y),
|
|
83
|
+
checkDate: new f(r),
|
|
64
84
|
skipRegularDeductions: e.skipRegularDeductions,
|
|
65
|
-
isCheckOnlyPayroll: e.isCheckOnly
|
|
85
|
+
isCheckOnlyPayroll: e.isCheckOnly,
|
|
86
|
+
employeeUuids: P
|
|
66
87
|
}
|
|
67
88
|
}
|
|
68
|
-
}),
|
|
69
|
-
if (!
|
|
70
|
-
throw new Error(
|
|
71
|
-
|
|
89
|
+
}), a = c.payrollPrepared?.payrollUuid ?? c.payrollPrepared?.uuid;
|
|
90
|
+
if (!a)
|
|
91
|
+
throw new Error(p("errors.missingPayrollId"));
|
|
92
|
+
g(J.OFF_CYCLE_CREATED, { payrollUuid: a });
|
|
72
93
|
});
|
|
73
94
|
};
|
|
74
|
-
return /* @__PURE__ */
|
|
95
|
+
return /* @__PURE__ */ l(V, { ...s, children: /* @__PURE__ */ l(K, { onSubmit: s.handleSubmit(_), children: /* @__PURE__ */ l(
|
|
96
|
+
Y,
|
|
97
|
+
{
|
|
98
|
+
employees: L,
|
|
99
|
+
isLoadingEmployees: w,
|
|
100
|
+
isPending: v
|
|
101
|
+
}
|
|
102
|
+
) }) });
|
|
75
103
|
}
|
|
76
104
|
export {
|
|
77
|
-
|
|
105
|
+
Pe as OffCycleCreation
|
|
78
106
|
};
|
|
79
107
|
//# sourceMappingURL=OffCycleCreation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OffCycleCreation.js","sources":["../../../../src/components/Payroll/OffCycleCreation/OffCycleCreation.tsx"],"sourcesContent":["import { useEffect } from 'react'\nimport { FormProvider, useForm, type Resolver } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { z } from 'zod'\nimport { useTranslation } from 'react-i18next'\nimport { usePayrollsCreateOffCycleMutation } from '@gusto/embedded-api/react-query/payrollsCreateOffCycle'\nimport { OffCycleReason as ApiOffCycleReason } from '@gusto/embedded-api/models/operations/postv1companiescompanyidpayrolls'\nimport { RFCDate } from '@gusto/embedded-api/types/rfcdate'\nimport { OFF_CYCLE_REASON_DEFAULTS, type OffCycleReason } from '../OffCycleReasonSelection'\nimport {\n createOffCyclePayPeriodDateFormSchema,\n type OffCyclePayrollDateType,\n} from '../OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes'\nimport { useOffCyclePayPeriodDateValidation } from '../OffCyclePayPeriodDateForm/useOffCyclePayPeriodDateValidation'\nimport type { OffCycleCreationFormData, OffCycleCreationProps } from './OffCycleCreationTypes'\nimport { OffCycleCreationPresentation } from './OffCycleCreationPresentation'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { Form } from '@/components/Common/Form'\n\nconst LOCAL_TO_API_REASON: Record<OffCycleReason, ApiOffCycleReason> = {\n bonus: ApiOffCycleReason.Bonus,\n correction: ApiOffCycleReason.Correction,\n}\n\nexport function OffCycleCreation(props: OffCycleCreationProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nfunction Root({ dictionary, companyId, payrollType = 'bonus' }: OffCycleCreationProps) {\n useComponentDictionary('Payroll.OffCycleCreation', dictionary)\n useI18n('Payroll.OffCycleCreation')\n useI18n('Payroll.OffCycleReasonSelection')\n useI18n('Payroll.OffCyclePayPeriodDateForm')\n useI18n('Payroll.OffCycleDeductionsSetting')\n\n const { t } = useTranslation('Payroll.OffCyclePayPeriodDateForm')\n const { t: tCreation } = useTranslation('Payroll.OffCycleCreation')\n const { onEvent, baseSubmitHandler } = useBase()\n\n const { minCheckDate, today } = useOffCyclePayPeriodDateValidation()\n const { mutateAsync: createOffCyclePayroll, isPending } = usePayrollsCreateOffCycleMutation()\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const translateValidation = (key: string): string => t(key as any) as string\n\n const dynamicResolver: Resolver<OffCycleCreationFormData> = (values, context, options) => {\n const reason = values.reason\n const isCheckOnly = values.isCheckOnly\n const resolvedPayrollType: OffCyclePayrollDateType =\n reason === 'correction' ? 'correction' : payrollType\n\n const dateSchema = createOffCyclePayPeriodDateFormSchema(\n translateValidation,\n resolvedPayrollType,\n isCheckOnly ? today : minCheckDate,\n )\n const schema = z\n .object({ reason: z.enum(['bonus', 'correction']), skipRegularDeductions: z.boolean() })\n .and(dateSchema)\n\n return zodResolver(schema)(values, context, options)\n }\n\n const methods = useForm<OffCycleCreationFormData>({\n resolver: dynamicResolver,\n defaultValues: {\n reason: payrollType,\n isCheckOnly: false,\n startDate: null,\n endDate: null,\n checkDate: null,\n skipRegularDeductions: OFF_CYCLE_REASON_DEFAULTS[payrollType].skipDeductions,\n },\n })\n\n const watchedReason = methods.watch('reason')\n\n useEffect(() => {\n methods.setValue(\n 'skipRegularDeductions',\n OFF_CYCLE_REASON_DEFAULTS[watchedReason].skipDeductions,\n )\n }, [watchedReason, methods])\n\n const onSubmit = async (data: OffCycleCreationFormData) => {\n const reason = data.reason\n const checkDate = data.checkDate!\n const startDate = data.isCheckOnly ? checkDate : data.startDate!\n const endDate = data.isCheckOnly ? checkDate : data.endDate!\n\n await baseSubmitHandler(data, async () => {\n const response = await createOffCyclePayroll({\n request: {\n companyId,\n requestBody: {\n offCycle: true,\n offCycleReason: LOCAL_TO_API_REASON[reason],\n startDate: new RFCDate(startDate),\n endDate: new RFCDate(endDate),\n checkDate: new RFCDate(checkDate),\n skipRegularDeductions: data.skipRegularDeductions,\n isCheckOnlyPayroll: data.isCheckOnly,\n },\n },\n })\n\n const payrollUuid = response.payrollPrepared?.payrollUuid ?? response.payrollPrepared?.uuid\n\n if (!payrollUuid) {\n throw new Error(tCreation('errors.missingPayrollId'))\n }\n\n onEvent(componentEvents.OFF_CYCLE_CREATED, { payrollUuid })\n })\n }\n\n return (\n <FormProvider {...methods}>\n <Form onSubmit={methods.handleSubmit(onSubmit)}>\n <OffCycleCreationPresentation isPending={isPending} />\n </Form>\n </FormProvider>\n )\n}\n"],"names":["LOCAL_TO_API_REASON","ApiOffCycleReason","OffCycleCreation","props","jsx","BaseComponent","Root","dictionary","companyId","payrollType","useComponentDictionary","useI18n","t","useTranslation","tCreation","onEvent","baseSubmitHandler","useBase","minCheckDate","today","useOffCyclePayPeriodDateValidation","createOffCyclePayroll","isPending","usePayrollsCreateOffCycleMutation","translateValidation","key","methods","useForm","values","context","options","reason","isCheckOnly","dateSchema","createOffCyclePayPeriodDateFormSchema","schema","z","zodResolver","OFF_CYCLE_REASON_DEFAULTS","watchedReason","useEffect","onSubmit","data","checkDate","startDate","endDate","response","RFCDate","payrollUuid","componentEvents","FormProvider","Form","OffCycleCreationPresentation"],"mappings":";;;;;;;;;;;;;;;;;;AAsBA,MAAMA,IAAiE;AAAA,EACrE,OAAOC,EAAkB;AAAA,EACzB,YAAYA,EAAkB;AAChC;AAEO,SAASC,GAAiBC,GAA8B;AAC7D,SACE,gBAAAC,EAACC,KAAe,GAAGF,GACjB,4BAACG,GAAA,EAAM,GAAGH,GAAO,EAAA,CACnB;AAEJ;AAEA,SAASG,EAAK,EAAE,YAAAC,GAAY,WAAAC,GAAW,aAAAC,IAAc,WAAkC;AACrF,EAAAC,EAAuB,4BAA4BH,CAAU,GAC7DI,EAAQ,0BAA0B,GAClCA,EAAQ,iCAAiC,GACzCA,EAAQ,mCAAmC,GAC3CA,EAAQ,mCAAmC;AAE3C,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,mCAAmC,GAC1D,EAAE,GAAGC,MAAcD,EAAe,0BAA0B,GAC5D,EAAE,SAAAE,GAAS,mBAAAC,EAAA,IAAsBC,EAAA,GA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,YACV,gBAAgBR,EAAoB+B,CAAM;AAAA,YAC1C,WAAW,IAAIgB,EAAQH,CAAS;AAAA,YAChC,SAAS,IAAIG,EAAQF,CAAO;AAAA,YAC5B,WAAW,IAAIE,EAAQJ,CAAS;AAAA,YAChC,uBAAuBD,EAAK;AAAA,YAC5B,oBAAoBA,EAAK;AAAA,UAAA;AAAA,QAC3B;AAAA,MACF,CACD,GAEKM,IAAcF,EAAS,iBAAiB,eAAeA,EAAS,iBAAiB;AAEvF,UAAI,CAACE;AACH,cAAM,IAAI,MAAMlC,EAAU,yBAAyB,CAAC;AAGtD,MAAAC,EAAQkC,EAAgB,mBAAmB,EAAE,aAAAD,EAAA,CAAa;AAAA,IAC5D,CAAC;AAAA,EACH;AAEA,SACE,gBAAA5C,EAAC8C,GAAA,EAAc,GAAGxB,GAChB,4BAACyB,GAAA,EAAK,UAAUzB,EAAQ,aAAae,CAAQ,GAC3C,UAAA,gBAAArC,EAACgD,GAAA,EAA6B,WAAA9B,EAAA,CAAsB,GACtD,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"OffCycleCreation.js","sources":["../../../../src/components/Payroll/OffCycleCreation/OffCycleCreation.tsx"],"sourcesContent":["import { useEffect, useMemo } from 'react'\nimport { FormProvider, useForm, type Resolver } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { z } from 'zod'\nimport { useTranslation } from 'react-i18next'\nimport { usePayrollsCreateOffCycleMutation } from '@gusto/embedded-api/react-query/payrollsCreateOffCycle'\nimport { OffCycleReason as ApiOffCycleReason } from '@gusto/embedded-api/models/operations/postv1companiescompanyidpayrolls'\nimport { RFCDate } from '@gusto/embedded-api/types/rfcdate'\nimport { useEmployeesListSuspense } from '@gusto/embedded-api/react-query/employeesList'\nimport { OFF_CYCLE_REASON_DEFAULTS, type OffCycleReason } from '../OffCycleReasonSelection'\nimport {\n createOffCyclePayPeriodDateFormSchema,\n type OffCyclePayrollDateType,\n} from '../OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes'\nimport { useOffCyclePayPeriodDateValidation } from '../OffCyclePayPeriodDateForm/useOffCyclePayPeriodDateValidation'\nimport type { OffCycleCreationFormData, OffCycleCreationProps } from './OffCycleCreationTypes'\nimport { OffCycleCreationPresentation } from './OffCycleCreationPresentation'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { Form } from '@/components/Common/Form'\nimport type { MultiSelectComboBoxOption } from '@/components/Common/UI/MultiSelectComboBox/MultiSelectComboBoxTypes'\n\nconst LOCAL_TO_API_REASON: Record<OffCycleReason, ApiOffCycleReason> = {\n bonus: ApiOffCycleReason.Bonus,\n correction: ApiOffCycleReason.Correction,\n}\n\nexport function OffCycleCreation(props: OffCycleCreationProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nfunction Root({ dictionary, companyId, payrollType = 'bonus' }: OffCycleCreationProps) {\n useComponentDictionary('Payroll.OffCycleCreation', dictionary)\n useI18n('Payroll.OffCycleCreation')\n useI18n('Payroll.OffCycleReasonSelection')\n useI18n('Payroll.OffCyclePayPeriodDateForm')\n useI18n('Payroll.OffCycleDeductionsSetting')\n useI18n('Payroll.EmployeeSelection')\n\n const { t } = useTranslation('Payroll.OffCyclePayPeriodDateForm')\n const { t: tCreation } = useTranslation('Payroll.OffCycleCreation')\n const { onEvent, baseSubmitHandler } = useBase()\n\n const { minCheckDate, today } = useOffCyclePayPeriodDateValidation()\n const { mutateAsync: createOffCyclePayroll, isPending } = usePayrollsCreateOffCycleMutation()\n\n const { data: employeesData, isLoading: isLoadingEmployees } = useEmployeesListSuspense({\n companyId,\n onboardedActive: true,\n })\n\n const employees: MultiSelectComboBoxOption[] = useMemo(() => {\n const employeeList = employeesData.showEmployees ?? []\n return employeeList.map(employee => {\n const fullName = [employee.firstName, employee.lastName].filter(Boolean).join(' ')\n return {\n label: fullName,\n value: employee.uuid,\n }\n })\n }, [employeesData])\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const translateValidation = (key: string): string => t(key as any) as string\n\n const dynamicResolver: Resolver<OffCycleCreationFormData> = (values, context, options) => {\n const reason = values.reason\n const isCheckOnly = values.isCheckOnly\n const resolvedPayrollType: OffCyclePayrollDateType =\n reason === 'correction' ? 'correction' : payrollType\n\n const dateSchema = createOffCyclePayPeriodDateFormSchema(\n translateValidation,\n resolvedPayrollType,\n isCheckOnly ? today : minCheckDate,\n )\n const schema = z\n .object({\n reason: z.enum(['bonus', 'correction']),\n skipRegularDeductions: z.boolean(),\n includeAllEmployees: z.boolean(),\n selectedEmployeeUuids: z.array(z.string()),\n })\n .and(dateSchema)\n .superRefine((data, ctx) => {\n if (!data.includeAllEmployees && data.selectedEmployeeUuids.length === 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['selectedEmployeeUuids'],\n message: tCreation('errors.noEmployeesSelected'),\n })\n }\n })\n\n return zodResolver(schema)(values, context, options)\n }\n\n const methods = useForm<OffCycleCreationFormData>({\n resolver: dynamicResolver,\n defaultValues: {\n reason: payrollType,\n isCheckOnly: false,\n startDate: null,\n endDate: null,\n checkDate: null,\n skipRegularDeductions: OFF_CYCLE_REASON_DEFAULTS[payrollType].skipDeductions,\n includeAllEmployees: true,\n selectedEmployeeUuids: [],\n },\n })\n\n const watchedReason = methods.watch('reason')\n\n useEffect(() => {\n methods.setValue(\n 'skipRegularDeductions',\n OFF_CYCLE_REASON_DEFAULTS[watchedReason].skipDeductions,\n )\n }, [watchedReason, methods])\n\n const onSubmit = async (data: OffCycleCreationFormData) => {\n const reason = data.reason\n const checkDate = data.checkDate!\n const startDate = data.isCheckOnly ? checkDate : data.startDate!\n const endDate = data.isCheckOnly ? checkDate : data.endDate!\n const employeeUuids =\n !data.includeAllEmployees && data.selectedEmployeeUuids.length > 0\n ? data.selectedEmployeeUuids\n : undefined\n\n await baseSubmitHandler(data, async () => {\n const response = await createOffCyclePayroll({\n request: {\n companyId,\n requestBody: {\n offCycle: true,\n offCycleReason: LOCAL_TO_API_REASON[reason],\n startDate: new RFCDate(startDate),\n endDate: new RFCDate(endDate),\n checkDate: new RFCDate(checkDate),\n skipRegularDeductions: data.skipRegularDeductions,\n isCheckOnlyPayroll: data.isCheckOnly,\n employeeUuids,\n },\n },\n })\n\n const payrollUuid = response.payrollPrepared?.payrollUuid ?? response.payrollPrepared?.uuid\n\n if (!payrollUuid) {\n throw new Error(tCreation('errors.missingPayrollId'))\n }\n\n onEvent(componentEvents.OFF_CYCLE_CREATED, { payrollUuid })\n })\n }\n\n return (\n <FormProvider {...methods}>\n <Form onSubmit={methods.handleSubmit(onSubmit)}>\n <OffCycleCreationPresentation\n employees={employees}\n isLoadingEmployees={isLoadingEmployees}\n isPending={isPending}\n />\n </Form>\n </FormProvider>\n )\n}\n"],"names":["LOCAL_TO_API_REASON","ApiOffCycleReason","OffCycleCreation","props","jsx","BaseComponent","Root","dictionary","companyId","payrollType","useComponentDictionary","useI18n","t","useTranslation","tCreation","onEvent","baseSubmitHandler","useBase","minCheckDate","today","useOffCyclePayPeriodDateValidation","createOffCyclePayroll","isPending","usePayrollsCreateOffCycleMutation","employeesData","isLoadingEmployees","useEmployeesListSuspense","employees","useMemo","employee","translateValidation","key","methods","useForm","values","context","options","reason","isCheckOnly","dateSchema","createOffCyclePayPeriodDateFormSchema","schema","z","data","ctx","zodResolver","OFF_CYCLE_REASON_DEFAULTS","watchedReason","useEffect","onSubmit","checkDate","startDate","endDate","employeeUuids","response","RFCDate","payrollUuid","componentEvents","FormProvider","Form","OffCycleCreationPresentation"],"mappings":";;;;;;;;;;;;;;;;;;;AAwBA,MAAMA,IAAiE;AAAA,EACrE,OAAOC,EAAkB;AAAA,EACzB,YAAYA,EAAkB;AAChC;AAEO,SAASC,GAAiBC,GAA8B;AAC7D,SACE,gBAAAC,EAACC,KAAe,GAAGF,GACjB,4BAACG,GAAA,EAAM,GAA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,YACV,gBAAgBR,EAAoBqC,CAAM;AAAA,YAC1C,WAAW,IAAIkB,EAAQJ,CAAS;AAAA,YAChC,SAAS,IAAII,EAAQH,CAAO;AAAA,YAC5B,WAAW,IAAIG,EAAQL,CAAS;AAAA,YAChC,uBAAuBP,EAAK;AAAA,YAC5B,oBAAoBA,EAAK;AAAA,YACzB,eAAAU;AAAA,UAAA;AAAA,QACF;AAAA,MACF,CACD,GAEKG,IAAcF,EAAS,iBAAiB,eAAeA,EAAS,iBAAiB;AAEvF,UAAI,CAACE;AACH,cAAM,IAAI,MAAM1C,EAAU,yBAAyB,CAAC;AAGtD,MAAAC,EAAQ0C,EAAgB,mBAAmB,EAAE,aAAAD,EAAA,CAAa;AAAA,IAC5D,CAAC;AAAA,EACH;AAEA,SACE,gBAAApD,EAACsD,GAAA,EAAc,GAAG1B,GAChB,UAAA,gBAAA5B,EAACuD,KAAK,UAAU3B,EAAQ,aAAaiB,CAAQ,GAC3C,UAAA,gBAAA7C;AAAA,IAACwD;AAAA,IAAA;AAAA,MACC,WAAAjC;AAAA,MACA,oBAAAF;AAAA,MACA,WAAAH;AAAA,IAAA;AAAA,EAAA,GAEJ,EAAA,CACF;AAEJ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { OffCycleCreationPresentationProps } from './OffCycleCreationTypes';
|
|
2
|
-
export declare function OffCycleCreationPresentation({ isPending }: OffCycleCreationPresentationProps): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function OffCycleCreationPresentation({ employees, isLoadingEmployees, isPending, }: OffCycleCreationPresentationProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,46 +1,81 @@
|
|
|
1
1
|
import { jsxs as r, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useCallback as b } from "react";
|
|
3
|
+
import { useFormContext as D } from "react-hook-form";
|
|
4
|
+
import { useTranslation as c } from "react-i18next";
|
|
5
|
+
import { OffCyclePayPeriodDateFormPresentation as P } from "../OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js";
|
|
4
6
|
import { useI18n as a } from "../../../i18n/I18n.js";
|
|
5
|
-
import { useComponentContext as
|
|
7
|
+
import { useComponentContext as E } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
6
8
|
import { Flex as o } from "../../Common/Flex/Flex.js";
|
|
7
9
|
import "classnames";
|
|
8
|
-
import "
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
import "../../../shared/constants.js";
|
|
11
|
+
import { RadioGroupField as S } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
12
|
+
import { SwitchField as O } from "../../Common/Fields/SwitchField/SwitchField.js";
|
|
13
|
+
import { OffCycleReasonSelectionPresentation as T } from "../OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js";
|
|
14
|
+
import { MultiSelectComboBoxField as F } from "../../Common/Fields/MultiSelectComboBoxField/MultiSelectComboBoxField.js";
|
|
15
|
+
function q({
|
|
16
|
+
employees: d,
|
|
17
|
+
isLoadingEmployees: u,
|
|
18
|
+
isPending: s
|
|
19
|
+
}) {
|
|
20
|
+
a("Payroll.OffCycleCreation"), a("Payroll.OffCycleDeductionsSetting"), a("Payroll.EmployeeSelection");
|
|
21
|
+
const { t: l } = c("Payroll.OffCycleCreation"), { t: i } = c("Payroll.OffCycleDeductionsSetting"), { t } = c("Payroll.EmployeeSelection"), { Heading: m, Text: f, Button: y } = E(), { setValue: p, watch: h } = D(), g = h("includeAllEmployees"), C = b(
|
|
22
|
+
(n) => {
|
|
23
|
+
n && p("selectedEmployeeUuids", []);
|
|
24
|
+
},
|
|
25
|
+
[p]
|
|
26
|
+
), x = [
|
|
14
27
|
{
|
|
15
28
|
value: !1,
|
|
16
|
-
label:
|
|
29
|
+
label: i("options.include.label")
|
|
17
30
|
},
|
|
18
31
|
{
|
|
19
32
|
value: !0,
|
|
20
|
-
label:
|
|
33
|
+
label: i("options.skip.label")
|
|
21
34
|
}
|
|
22
35
|
];
|
|
23
36
|
return /* @__PURE__ */ r(o, { flexDirection: "column", gap: 32, children: [
|
|
24
37
|
/* @__PURE__ */ r(o, { flexDirection: "column", gap: 4, children: [
|
|
25
|
-
/* @__PURE__ */ e(
|
|
26
|
-
/* @__PURE__ */ e(
|
|
38
|
+
/* @__PURE__ */ e(m, { as: "h2", children: l("pageTitle") }),
|
|
39
|
+
/* @__PURE__ */ e(f, { variant: "supporting", children: l("pageDescription") })
|
|
40
|
+
] }),
|
|
41
|
+
/* @__PURE__ */ e(o, { flexDirection: "column", gap: 20, children: /* @__PURE__ */ e(P, {}) }),
|
|
42
|
+
/* @__PURE__ */ e(o, { flexDirection: "column", gap: 20, children: /* @__PURE__ */ e(T, { name: "reason" }) }),
|
|
43
|
+
/* @__PURE__ */ r(o, { flexDirection: "column", gap: 12, children: [
|
|
44
|
+
/* @__PURE__ */ e(m, { as: "h3", children: t("sectionTitle") }),
|
|
45
|
+
/* @__PURE__ */ e(
|
|
46
|
+
O,
|
|
47
|
+
{
|
|
48
|
+
name: "includeAllEmployees",
|
|
49
|
+
label: l("includeAllEmployeesLabel"),
|
|
50
|
+
onChange: C
|
|
51
|
+
}
|
|
52
|
+
),
|
|
53
|
+
!g && /* @__PURE__ */ e(
|
|
54
|
+
F,
|
|
55
|
+
{
|
|
56
|
+
name: "selectedEmployeeUuids",
|
|
57
|
+
label: t("sectionTitle"),
|
|
58
|
+
shouldVisuallyHideLabel: !0,
|
|
59
|
+
placeholder: t("searchPlaceholder"),
|
|
60
|
+
options: d,
|
|
61
|
+
isLoading: u
|
|
62
|
+
}
|
|
63
|
+
)
|
|
27
64
|
] }),
|
|
28
|
-
/* @__PURE__ */ e(o, { flexDirection: "column", gap: 20, children: /* @__PURE__ */ e(u, {}) }),
|
|
29
|
-
/* @__PURE__ */ e(o, { flexDirection: "column", gap: 20, children: /* @__PURE__ */ e(g, { name: "reason" }) }),
|
|
30
65
|
/* @__PURE__ */ e(o, { flexDirection: "column", gap: 20, children: /* @__PURE__ */ e(
|
|
31
|
-
|
|
66
|
+
S,
|
|
32
67
|
{
|
|
33
68
|
name: "skipRegularDeductions",
|
|
34
|
-
label:
|
|
35
|
-
description:
|
|
36
|
-
options:
|
|
37
|
-
convertValueToString: (
|
|
69
|
+
label: i("title"),
|
|
70
|
+
description: i("description"),
|
|
71
|
+
options: x,
|
|
72
|
+
convertValueToString: (n) => String(n)
|
|
38
73
|
}
|
|
39
74
|
) }),
|
|
40
|
-
/* @__PURE__ */ e(o, { justifyContent: "flex-end", gap: 12, children: /* @__PURE__ */ e(
|
|
75
|
+
/* @__PURE__ */ e(o, { justifyContent: "flex-end", gap: 12, children: /* @__PURE__ */ e(y, { type: "submit", isLoading: s, isDisabled: s, children: l("continueCta") }) })
|
|
41
76
|
] });
|
|
42
77
|
}
|
|
43
78
|
export {
|
|
44
|
-
|
|
79
|
+
q as OffCycleCreationPresentation
|
|
45
80
|
};
|
|
46
81
|
//# sourceMappingURL=OffCycleCreationPresentation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OffCycleCreationPresentation.js","sources":["../../../../src/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { OffCycleReasonSelectionPresentation } from '../OffCycleReasonSelection'\nimport { OffCyclePayPeriodDateFormPresentation } from '../OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation'\nimport type {
|
|
1
|
+
{"version":3,"file":"OffCycleCreationPresentation.js","sources":["../../../../src/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.tsx"],"sourcesContent":["import { useCallback } from 'react'\nimport { useFormContext } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { OffCycleReasonSelectionPresentation } from '../OffCycleReasonSelection'\nimport { OffCyclePayPeriodDateFormPresentation } from '../OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation'\nimport type {\n OffCycleCreationFormData,\n OffCycleCreationPresentationProps,\n} from './OffCycleCreationTypes'\nimport { useI18n } from '@/i18n'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Flex, RadioGroupField, SwitchField, MultiSelectComboBoxField } from '@/components/Common'\n\nexport function OffCycleCreationPresentation({\n employees,\n isLoadingEmployees,\n isPending,\n}: OffCycleCreationPresentationProps) {\n useI18n('Payroll.OffCycleCreation')\n useI18n('Payroll.OffCycleDeductionsSetting')\n useI18n('Payroll.EmployeeSelection')\n const { t } = useTranslation('Payroll.OffCycleCreation')\n const { t: tDeductions } = useTranslation('Payroll.OffCycleDeductionsSetting')\n const { t: tEmployees } = useTranslation('Payroll.EmployeeSelection')\n const { Heading, Text, Button } = useComponentContext()\n\n const { setValue, watch } = useFormContext<OffCycleCreationFormData>()\n const includeAllEmployees = watch('includeAllEmployees')\n\n const handleToggleIncludeAll = useCallback(\n (checked: boolean) => {\n if (checked) {\n setValue('selectedEmployeeUuids', [])\n }\n },\n [setValue],\n )\n\n const deductionsOptions = [\n {\n value: false,\n label: tDeductions('options.include.label'),\n },\n {\n value: true,\n label: tDeductions('options.skip.label'),\n },\n ]\n\n return (\n <Flex flexDirection=\"column\" gap={32}>\n <Flex flexDirection=\"column\" gap={4}>\n <Heading as=\"h2\">{t('pageTitle')}</Heading>\n <Text variant=\"supporting\">{t('pageDescription')}</Text>\n </Flex>\n\n <Flex flexDirection=\"column\" gap={20}>\n <OffCyclePayPeriodDateFormPresentation />\n </Flex>\n\n <Flex flexDirection=\"column\" gap={20}>\n <OffCycleReasonSelectionPresentation name=\"reason\" />\n </Flex>\n\n <Flex flexDirection=\"column\" gap={12}>\n <Heading as=\"h3\">{tEmployees('sectionTitle')}</Heading>\n <SwitchField\n name=\"includeAllEmployees\"\n label={t('includeAllEmployeesLabel')}\n onChange={handleToggleIncludeAll}\n />\n {!includeAllEmployees && (\n <MultiSelectComboBoxField\n name=\"selectedEmployeeUuids\"\n label={tEmployees('sectionTitle')}\n shouldVisuallyHideLabel\n placeholder={tEmployees('searchPlaceholder')}\n options={employees}\n isLoading={isLoadingEmployees}\n />\n )}\n </Flex>\n\n <Flex flexDirection=\"column\" gap={20}>\n <RadioGroupField<boolean>\n name=\"skipRegularDeductions\"\n label={tDeductions('title')}\n description={tDeductions('description')}\n options={deductionsOptions}\n convertValueToString={value => String(value)}\n />\n </Flex>\n\n <Flex justifyContent=\"flex-end\" gap={12}>\n <Button type=\"submit\" isLoading={isPending} isDisabled={isPending}>\n {t('continueCta')}\n </Button>\n </Flex>\n </Flex>\n )\n}\n"],"names":["OffCycleCreationPresentation","employees","isLoadingEmployees","isPending","useI18n","t","useTranslation","tDeductions","tEmployees","Heading","Text","Button","useComponentContext","setValue","watch","useFormContext","includeAllEmployees","handleToggleIncludeAll","useCallback","checked","deductionsOptions","jsxs","Flex","jsx","OffCyclePayPeriodDateFormPresentation","OffCycleReasonSelectionPresentation","SwitchField","MultiSelectComboBoxField","RadioGroupField","value"],"mappings":";;;;;;;;;;;;;;AAaO,SAASA,EAA6B;AAAA,EAC3C,WAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,WAAAC;AACF,GAAsC;AACpC,EAAAC,EAAQ,0BAA0B,GAClCA,EAAQ,mCAAmC,GAC3CA,EAAQ,2BAA2B;AACnC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,0BAA0B,GACjD,EAAE,GAAGC,MAAgBD,EAAe,mCAAmC,GACvE,EAAEE,MAAkBF,EAAe,2BAA2B,GAC9D,EAAE,SAAAG,GAAS,MAAAC,GAAM,QAAAC,EAAA,IAAWC,EAAA,GAE5B,EAAE,UAAAC,GAAU,OAAAC,EAAA,IAAUC,EAAA,GACtBC,IAAsBF,EAAM,qBAAqB,GAEjDG,IAAyBC;AAAA,IAC7B,CAACC,MAAqB;AACpB,MAAIA,KACFN,EAAS,yBAAyB,EAAE;AAAA,IAExC;AAAA,IACA,CAACA,CAAQ;AAAA,EAAA,GAGLO,IA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AAAqB,EAACD,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA,gBAAAC;AAAA,MAACK;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOrB,EAAY,OAAO;AAAA,QAC1B,aAAaA,EAAY,aAAa;AAAA,QACtC,SAASa;AAAA,QACT,sBAAsB,CAAAS,MAAS,OAAOA,CAAK;AAAA,MAAA;AAAA,IAAA,GAE/C;AAAA,sBAECP,GAAA,EAAK,gBAAe,YAAW,KAAK,IACnC,UAAA,gBAAAC,EAACZ,GAAA,EAAO,MAAK,UAAS,WAAWR,GAAW,YAAYA,GACrD,UAAAE,EAAE,aAAa,GAClB,EAAA,CACF;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { OffCycleReason } from '../OffCycleReasonSelection';
|
|
2
2
|
import { OffCyclePayPeriodDateFormData, OffCyclePayrollDateType } from '../OffCyclePayPeriodDateForm';
|
|
3
|
+
import { MultiSelectComboBoxOption } from '../../Common/UI/MultiSelectComboBox/MultiSelectComboBoxTypes';
|
|
3
4
|
import { BaseComponentInterface } from '../../Base/Base';
|
|
4
5
|
export interface OffCycleCreationProps extends BaseComponentInterface<'Payroll.OffCycleCreation'> {
|
|
5
6
|
companyId: string;
|
|
@@ -8,7 +9,11 @@ export interface OffCycleCreationProps extends BaseComponentInterface<'Payroll.O
|
|
|
8
9
|
export interface OffCycleCreationFormData extends OffCyclePayPeriodDateFormData {
|
|
9
10
|
reason: OffCycleReason;
|
|
10
11
|
skipRegularDeductions: boolean;
|
|
12
|
+
includeAllEmployees: boolean;
|
|
13
|
+
selectedEmployeeUuids: string[];
|
|
11
14
|
}
|
|
12
15
|
export interface OffCycleCreationPresentationProps {
|
|
16
|
+
employees: MultiSelectComboBoxOption[];
|
|
17
|
+
isLoadingEmployees: boolean;
|
|
13
18
|
isPending?: boolean;
|
|
14
19
|
}
|
package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js
CHANGED
|
@@ -5,10 +5,10 @@ import a from "./OffCyclePayPeriodDateFormPresentation.module.scss.js";
|
|
|
5
5
|
import { useI18n as f } from "../../../i18n/I18n.js";
|
|
6
6
|
import "../../../shared/constants.js";
|
|
7
7
|
import "classnames";
|
|
8
|
+
import { DatePickerField as r } from "../../Common/Fields/DatePickerField/DatePickerField.js";
|
|
8
9
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
9
10
|
import "react";
|
|
10
11
|
import { CheckboxField as u } from "../../Common/Fields/CheckboxField/CheckboxField.js";
|
|
11
|
-
import { DatePickerField as r } from "../../Common/Fields/DatePickerField/DatePickerField.js";
|
|
12
12
|
function q() {
|
|
13
13
|
f("Payroll.OffCyclePayPeriodDateForm");
|
|
14
14
|
const { t: e } = h("Payroll.OffCyclePayPeriodDateForm"), { control: i, setValue: l } = m(), n = d({ control: i, name: "isCheckOnly" }), c = (s) => {
|
package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes.d.ts
CHANGED
|
@@ -6,30 +6,10 @@ export interface OffCyclePayPeriodDateFormData {
|
|
|
6
6
|
endDate: Date | null;
|
|
7
7
|
checkDate: Date | null;
|
|
8
8
|
}
|
|
9
|
-
export declare const createOffCyclePayPeriodDateFormSchema: (t: (key: string) => string, payrollType: OffCyclePayrollDateType, minCheckDate: Date) => z.
|
|
9
|
+
export declare const createOffCyclePayPeriodDateFormSchema: (t: (key: string) => string, payrollType: OffCyclePayrollDateType, minCheckDate: Date) => z.ZodObject<{
|
|
10
10
|
isCheckOnly: z.ZodBoolean;
|
|
11
11
|
startDate: z.ZodNullable<z.ZodDate>;
|
|
12
12
|
endDate: z.ZodNullable<z.ZodDate>;
|
|
13
13
|
checkDate: z.ZodNullable<z.ZodDate>;
|
|
14
|
-
},
|
|
15
|
-
startDate: Date | null;
|
|
16
|
-
endDate: Date | null;
|
|
17
|
-
checkDate: Date | null;
|
|
18
|
-
isCheckOnly: boolean;
|
|
19
|
-
}, {
|
|
20
|
-
startDate: Date | null;
|
|
21
|
-
endDate: Date | null;
|
|
22
|
-
checkDate: Date | null;
|
|
23
|
-
isCheckOnly: boolean;
|
|
24
|
-
}>, {
|
|
25
|
-
startDate: Date | null;
|
|
26
|
-
endDate: Date | null;
|
|
27
|
-
checkDate: Date | null;
|
|
28
|
-
isCheckOnly: boolean;
|
|
29
|
-
}, {
|
|
30
|
-
startDate: Date | null;
|
|
31
|
-
endDate: Date | null;
|
|
32
|
-
checkDate: Date | null;
|
|
33
|
-
isCheckOnly: boolean;
|
|
34
|
-
}>;
|
|
14
|
+
}, z.core.$strip>;
|
|
35
15
|
export type OffCyclePayPeriodDateFormSchema = ReturnType<typeof createOffCyclePayPeriodDateFormSchema>;
|
package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js
CHANGED
|
@@ -3,8 +3,8 @@ import { useMemo as n } from "react";
|
|
|
3
3
|
import { useTranslation as s } from "react-i18next";
|
|
4
4
|
import "../../../shared/constants.js";
|
|
5
5
|
import "classnames";
|
|
6
|
-
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
7
6
|
import { RadioGroupField as l } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
7
|
+
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
8
8
|
function d({
|
|
9
9
|
name: e,
|
|
10
10
|
onChange: i
|
|
@@ -4,9 +4,10 @@ import { hasActionableBlockers as K, getBlockerTranslationKeys as P, isActionabl
|
|
|
4
4
|
import { useComponentContext as C } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
5
5
|
import { Flex as B } from "../../../Common/Flex/Flex.js";
|
|
6
6
|
import "classnames";
|
|
7
|
+
import "../../../../shared/constants.js";
|
|
7
8
|
import "react";
|
|
8
9
|
import { useI18n as I } from "../../../../i18n/I18n.js";
|
|
9
|
-
function
|
|
10
|
+
function q({
|
|
10
11
|
blockers: o,
|
|
11
12
|
onViewBlockersClick: n,
|
|
12
13
|
viewBlockersLabel: y,
|
|
@@ -50,6 +51,6 @@ function U({
|
|
|
50
51
|
);
|
|
51
52
|
}
|
|
52
53
|
export {
|
|
53
|
-
|
|
54
|
+
q as PayrollBlockerAlerts
|
|
54
55
|
};
|
|
55
56
|
//# sourceMappingURL=PayrollBlockerAlerts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayrollBlockerAlerts.js","sources":["../../../../../src/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport {\n type ApiPayrollBlocker,\n getBlockerTranslationKeys,\n hasActionableBlockers,\n isActionableBlocker,\n} from '../payrollHelpers'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Flex } from '@/components/Common'\nimport { useI18n } from '@/i18n'\n\ninterface PayrollBlockerAlertsProps {\n blockers: ApiPayrollBlocker[]\n className?: string\n onViewBlockersClick?: () => void\n viewBlockersLabel?: string\n}\n\nexport function PayrollBlockerAlerts({\n blockers,\n onViewBlockersClick,\n viewBlockersLabel,\n className,\n}: PayrollBlockerAlertsProps) {\n useI18n('Payroll.PayrollBlocker')\n const { t } = useTranslation('Payroll.PayrollBlocker')\n const { Alert, Button, Text, UnorderedList } = useComponentContext()\n\n if (blockers.length === 0) {\n return null\n }\n\n const hasMultipleBlockers = blockers.length > 1\n const showViewBlockersCta =\n Boolean(onViewBlockersClick) && (hasMultipleBlockers || hasActionableBlockers(blockers))\n\n const enrichedBlockers = blockers.map(blocker => {\n const translationKeys = getBlockerTranslationKeys(blocker.key)\n\n const title = t(translationKeys.titleKey, {\n defaultValue: t('defaultBlockerDescription'),\n })\n const description = t(translationKeys.descriptionKey, {\n defaultValue: blocker.message || t('defaultBlockerDescription'),\n })\n const helpText = isActionableBlocker(blocker.key)\n ? undefined\n : t(translationKeys.helpTextKey, { defaultValue: t('defaultBlockerHelp') })\n\n return {\n ...blocker,\n title,\n description,\n helpText,\n }\n })\n\n const ctaLabel = viewBlockersLabel || t(hasMultipleBlockers ? 'viewAllBlockers' : 'viewBlocker')\n\n const singleBlocker = enrichedBlockers[0]\n\n if (!hasMultipleBlockers && singleBlocker) {\n return (\n <Alert status=\"error\" label={singleBlocker.title} className={className}>\n <Flex flexDirection=\"column\" gap={8}>\n <Text>{singleBlocker.description}</Text>\n {singleBlocker.helpText && singleBlocker.helpText !== singleBlocker.description && (\n <Text variant=\"supporting\" size=\"sm\">\n {singleBlocker.helpText}\n </Text>\n )}\n {showViewBlockersCta && (\n <div>\n <Button variant=\"secondary\" onClick={onViewBlockersClick} title={ctaLabel}>\n {ctaLabel}\n </Button>\n </div>\n )}\n </Flex>\n </Alert>\n )\n }\n\n const listItems = enrichedBlockers.map(blocker => blocker.title)\n\n return (\n <Alert\n status=\"error\"\n label={t('multipleIssuesTitle', { count: blockers.length })}\n className={className}\n >\n <Flex flexDirection=\"column\" gap={16}>\n <UnorderedList items={listItems} />\n {showViewBlockersCta && (\n <div>\n <Button variant=\"secondary\" onClick={onViewBlockersClick} title={ctaLabel}>\n {ctaLabel}\n </Button>\n </div>\n )}\n </Flex>\n </Alert>\n )\n}\n"],"names":["PayrollBlockerAlerts","blockers","onViewBlockersClick","viewBlockersLabel","className","useI18n","useTranslation","Alert","Button","Text","UnorderedList","useComponentContext","hasMultipleBlockers","showViewBlockersCta","hasActionableBlockers","enrichedBlockers","blocker","translationKeys","getBlockerTranslationKeys","title","description","helpText","isActionableBlocker","ctaLabel","singleBlocker","jsx","jsxs","Flex","listItems"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PayrollBlockerAlerts.js","sources":["../../../../../src/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport {\n type ApiPayrollBlocker,\n getBlockerTranslationKeys,\n hasActionableBlockers,\n isActionableBlocker,\n} from '../payrollHelpers'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Flex } from '@/components/Common'\nimport { useI18n } from '@/i18n'\n\ninterface PayrollBlockerAlertsProps {\n blockers: ApiPayrollBlocker[]\n className?: string\n onViewBlockersClick?: () => void\n viewBlockersLabel?: string\n}\n\nexport function PayrollBlockerAlerts({\n blockers,\n onViewBlockersClick,\n viewBlockersLabel,\n className,\n}: PayrollBlockerAlertsProps) {\n useI18n('Payroll.PayrollBlocker')\n const { t } = useTranslation('Payroll.PayrollBlocker')\n const { Alert, Button, Text, UnorderedList } = useComponentContext()\n\n if (blockers.length === 0) {\n return null\n }\n\n const hasMultipleBlockers = blockers.length > 1\n const showViewBlockersCta =\n Boolean(onViewBlockersClick) && (hasMultipleBlockers || hasActionableBlockers(blockers))\n\n const enrichedBlockers = blockers.map(blocker => {\n const translationKeys = getBlockerTranslationKeys(blocker.key)\n\n const title = t(translationKeys.titleKey, {\n defaultValue: t('defaultBlockerDescription'),\n })\n const description = t(translationKeys.descriptionKey, {\n defaultValue: blocker.message || t('defaultBlockerDescription'),\n })\n const helpText = isActionableBlocker(blocker.key)\n ? undefined\n : t(translationKeys.helpTextKey, { defaultValue: t('defaultBlockerHelp') })\n\n return {\n ...blocker,\n title,\n description,\n helpText,\n }\n })\n\n const ctaLabel = viewBlockersLabel || t(hasMultipleBlockers ? 'viewAllBlockers' : 'viewBlocker')\n\n const singleBlocker = enrichedBlockers[0]\n\n if (!hasMultipleBlockers && singleBlocker) {\n return (\n <Alert status=\"error\" label={singleBlocker.title} className={className}>\n <Flex flexDirection=\"column\" gap={8}>\n <Text>{singleBlocker.description}</Text>\n {singleBlocker.helpText && singleBlocker.helpText !== singleBlocker.description && (\n <Text variant=\"supporting\" size=\"sm\">\n {singleBlocker.helpText}\n </Text>\n )}\n {showViewBlockersCta && (\n <div>\n <Button variant=\"secondary\" onClick={onViewBlockersClick} title={ctaLabel}>\n {ctaLabel}\n </Button>\n </div>\n )}\n </Flex>\n </Alert>\n )\n }\n\n const listItems = enrichedBlockers.map(blocker => blocker.title)\n\n return (\n <Alert\n status=\"error\"\n label={t('multipleIssuesTitle', { count: blockers.length })}\n className={className}\n >\n <Flex flexDirection=\"column\" gap={16}>\n <UnorderedList items={listItems} />\n {showViewBlockersCta && (\n <div>\n <Button variant=\"secondary\" onClick={onViewBlockersClick} title={ctaLabel}>\n {ctaLabel}\n </Button>\n </div>\n )}\n </Flex>\n </Alert>\n )\n}\n"],"names":["PayrollBlockerAlerts","blockers","onViewBlockersClick","viewBlockersLabel","className","useI18n","useTranslation","Alert","Button","Text","UnorderedList","useComponentContext","hasMultipleBlockers","showViewBlockersCta","hasActionableBlockers","enrichedBlockers","blocker","translationKeys","getBlockerTranslationKeys","title","description","helpText","isActionableBlocker","ctaLabel","singleBlocker","jsx","jsxs","Flex","listItems"],"mappings":";;;;;;;;;AAkBO,SAASA,EAAqB;AAAA,EACnC,UAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,WAAAC;AACF,GAA8B;AAC5B,EAAAC,EAAQ,wBAAwB;AAChC,QAAM,EAAE,EAAA,IAAMC,EAAe,wBAAwB,GAC/C,EAAE,OAAAC,GAAO,QAAAC,GAAQ,MAAAC,GAAM,eAAAC,EAAA,IAAkBC,EAAA;AAE/C,MAAIV,EAAS,WAAW;AACtB,WAAO;AAGT,QAAMW,IAAsBX,EAAS,SAAS,GACxCY,IACJ,EAAQX,MAAyBU,KAAuBE,EAAsBb,CAAQ,IAElFc,IAAmBd,EAAS,IAAI,CAAAe,MAAW;AAC/C,UAAMC,IAAkBC,EAA0BF,EAAQ,GAAG,GAEvDG,IAAQ,EAAEF,EAAgB,UAAU;AAAA,MACxC,cAAc,EAAE,2BAA2B;AAAA,IAAA,CAC5C,GACKG,IAAc,EAAEH,EAAgB,gBAAgB;AAAA,MACpD,cAAcD,EAAQ,WAAW,EAAE,2BAA2B;AAAA,IAAA,CAC/D,GACKK,IAAWC,EAAoBN,EAAQ,GAAG,IAC5C,SACA,EAAEC,EAAgB,aAAa,EAAE,cAAc,EAAE,oBA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