@gusto/embedded-react-sdk 0.55.7 → 0.56.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 +63 -0
- package/dist/components/Common/FadeIn/FadeIn.module.scss.js +4 -4
- package/dist/components/Common/FieldCaption/FieldCaption.js +22 -18
- package/dist/components/Common/FieldCaption/FieldCaption.js.map +1 -1
- package/dist/components/Common/Flex/Flex.js +17 -15
- package/dist/components/Common/Flex/Flex.js.map +1 -1
- package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/components/Common/UI/FileInput/FileInput.js +1 -1
- package/dist/components/Common/UI/Heading/Heading.module.scss.js +7 -7
- package/dist/components/Common/UI/Menu/MenuTypes.js.map +1 -1
- package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.js +43 -42
- package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.js.map +1 -1
- package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +5 -3
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +5 -3
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +7 -5
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +5 -3
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +5 -3
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +27 -27
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +10 -8
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +8 -6
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +5 -3
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +5 -3
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +5 -3
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/PaySchedule.js +45 -30
- package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
- package/dist/components/Company/PaySchedule/PayScheduleComponents.js +12 -11
- package/dist/components/Company/PaySchedule/PayScheduleComponents.js.map +1 -1
- package/dist/components/Company/PaySchedule/PayScheduleForm.js +72 -55
- package/dist/components/Company/PaySchedule/PayScheduleForm.js.map +1 -1
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/fields.js +24 -20
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/fields.js.map +1 -1
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/payScheduleSchema.js +33 -29
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/payScheduleSchema.js.map +1 -1
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.js +131 -115
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +5 -3
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +5 -3
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/TaxRateManagement/context.js +5 -3
- package/dist/components/Company/StateTaxes/TaxRateManagement/context.js.map +1 -1
- package/dist/components/Contractor/ContractorList/management/ManagementContractorList.js +31 -29
- package/dist/components/Contractor/ContractorList/management/ManagementContractorList.js.map +1 -1
- package/dist/components/Contractor/ContractorList/management/ManagementContractorListView.js +110 -109
- package/dist/components/Contractor/ContractorList/management/ManagementContractorListView.js.map +1 -1
- package/dist/components/Contractor/ContractorList/onboarding/ContractorList.js +21 -19
- package/dist/components/Contractor/ContractorList/onboarding/ContractorList.js.map +1 -1
- package/dist/components/Contractor/ContractorList/onboarding/ContractorListView.js +56 -55
- package/dist/components/Contractor/ContractorList/onboarding/ContractorListView.js.map +1 -1
- package/dist/components/Contractor/Dashboard/Dashboard.js +34 -33
- package/dist/components/Contractor/Dashboard/Dashboard.js.map +1 -1
- package/dist/components/Contractor/Payments/CreateHistoricalPayment/CreateHistoricalPayment.js +117 -115
- package/dist/components/Contractor/Payments/CreateHistoricalPayment/CreateHistoricalPayment.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js +77 -75
- package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js +44 -43
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js +40 -39
- package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/HistoricalPaymentSummary/HistoricalPaymentSummary.js +35 -29
- package/dist/components/Contractor/Payments/HistoricalPaymentSummary/HistoricalPaymentSummary.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.js +21 -20
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js +41 -40
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.js +21 -20
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js +33 -32
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js +80 -78
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +44 -43
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -1
- package/dist/components/Contractor/Submit/Submit.js +113 -105
- package/dist/components/Contractor/Submit/Submit.js.map +1 -1
- package/dist/components/Contractor/Submit/SubmitDone.js +11 -11
- package/dist/components/Contractor/Submit/SubmitDone.js.map +1 -1
- package/dist/components/Employee/Compensation/management/CompensationAddJobForm/CompensationAddJobForm.js +20 -18
- package/dist/components/Employee/Compensation/management/CompensationAddJobForm/CompensationAddJobForm.js.map +1 -1
- package/dist/components/Employee/Compensation/management/CompensationEditForm/CompensationEditForm.js +18 -15
- package/dist/components/Employee/Compensation/management/CompensationEditForm/CompensationEditForm.js.map +1 -1
- package/dist/components/Employee/Dashboard/Dashboard.js +33 -32
- package/dist/components/Employee/Dashboard/Dashboard.js.map +1 -1
- package/dist/components/Employee/Deductions/management/DeductionsEditForm/DeductionsEditForm.js +21 -19
- package/dist/components/Employee/Deductions/management/DeductionsEditForm/DeductionsEditForm.js.map +1 -1
- package/dist/components/Employee/Documents/management/DocumentManager.js +34 -26
- package/dist/components/Employee/Documents/management/DocumentManager.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +5 -3
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibility.js +30 -29
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibility.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js +54 -53
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/EmployeeDocuments/EmployeeDocuments.js +29 -28
- package/dist/components/Employee/Documents/onboarding/EmployeeDocuments/EmployeeDocuments.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/EmployeeDocuments/EmployeeDocumentsPresentation.js +16 -15
- package/dist/components/Employee/Documents/onboarding/EmployeeDocuments/EmployeeDocumentsPresentation.js.map +1 -1
- package/dist/components/Employee/EmployeeList/management/ManagementEmployeeList.js +27 -25
- package/dist/components/Employee/EmployeeList/management/ManagementEmployeeList.js.map +1 -1
- package/dist/components/Employee/EmployeeList/management/ManagementEmployeeListView.js +121 -111
- package/dist/components/Employee/EmployeeList/management/ManagementEmployeeListView.js.map +1 -1
- package/dist/components/Employee/EmployeeList/onboarding/EmployeeList.js +22 -20
- package/dist/components/Employee/EmployeeList/onboarding/EmployeeList.js.map +1 -1
- package/dist/components/Employee/EmployeeList/onboarding/EmployeeListView.js +24 -23
- package/dist/components/Employee/EmployeeList/onboarding/EmployeeListView.js.map +1 -1
- package/dist/components/Employee/EmployeeList/shared/useEmployeeList.js +52 -43
- package/dist/components/Employee/EmployeeList/shared/useEmployeeList.js.map +1 -1
- package/dist/components/Employee/EmployeeListFlow/employeeListStateMachine.js +29 -26
- package/dist/components/Employee/EmployeeListFlow/employeeListStateMachine.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/shared/FederalTaxesView.js +1 -1
- package/dist/components/Employee/HomeAddress/management/HomeAddressEditForm.js +19 -17
- package/dist/components/Employee/HomeAddress/management/HomeAddressEditForm.js.map +1 -1
- package/dist/components/Employee/HomeAddress/management/HomeAddressView.js +79 -78
- package/dist/components/Employee/HomeAddress/management/HomeAddressView.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/management/PaymentMethodBankForm.js +4 -4
- package/dist/components/Employee/PaymentMethod/onboarding/BankForm.js +4 -4
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.js +40 -39
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.js +31 -30
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummary.js +43 -41
- package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummary.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummaryPresentation.js +20 -19
- package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummaryPresentation.js.map +1 -1
- package/dist/components/Employee/WorkAddress/management/WorkAddressEditForm.js +19 -17
- package/dist/components/Employee/WorkAddress/management/WorkAddressEditForm.js.map +1 -1
- package/dist/components/Employee/WorkAddress/management/WorkAddressView.js +49 -48
- package/dist/components/Employee/WorkAddress/management/WorkAddressView.js.map +1 -1
- package/dist/components/Flow/Flow.js +1 -1
- package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js +28 -28
- package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.js +37 -36
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.js +36 -35
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.js.map +1 -1
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.js +35 -28
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.js.map +1 -1
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelectionPresentation.js +23 -22
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelectionPresentation.js.map +1 -1
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +48 -45
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js +85 -77
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js +63 -59
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js.map +1 -1
- package/dist/components/Payroll/OffCycleDeductionsSetting/OffCycleDeductionsSetting.js +23 -21
- package/dist/components/Payroll/OffCycleDeductionsSetting/OffCycleDeductionsSetting.js.map +1 -1
- package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelection.js +26 -19
- package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelection.js.map +1 -1
- package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js +14 -12
- package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +184 -162
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +67 -65
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/useCalculationPoll.js +48 -34
- package/dist/components/Payroll/PayrollConfiguration/useCalculationPoll.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +43 -41
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +225 -223
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields.js +78 -75
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeHelpers.js +27 -27
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeHelpers.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeSchema.js +19 -19
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeSchema.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/usePayrollEditEmployeeForm.js +51 -48
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/usePayrollEditEmployeeForm.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistory.js +58 -48
- package/dist/components/Payroll/PayrollHistory/PayrollHistory.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +58 -57
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js +83 -69
- package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollList.js +62 -60
- package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +119 -117
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +187 -171
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +120 -110
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/useSubmissionPoll.js +45 -34
- package/dist/components/Payroll/PayrollOverview/useSubmissionPoll.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceipts.js +20 -14
- package/dist/components/Payroll/PayrollReceipts/PayrollReceipts.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +62 -61
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.module.scss.js +14 -14
- package/dist/components/Payroll/PrintChecks/PrintChecksBanner/PrintChecksBanner.js +24 -17
- package/dist/components/Payroll/PrintChecks/PrintChecksBanner/PrintChecksBanner.js.map +1 -1
- package/dist/components/Payroll/PrintChecks/PrintChecksFailure/PrintChecksFailure.js +22 -22
- package/dist/components/Payroll/PrintChecks/PrintChecksFailure/PrintChecksFailure.js.map +1 -1
- package/dist/components/Payroll/PrintChecks/PrintChecksForm/PrintChecksForm.js +88 -80
- package/dist/components/Payroll/PrintChecks/PrintChecksForm/PrintChecksForm.js.map +1 -1
- package/dist/components/Payroll/PrintChecks/PrintChecksForm/useGenerationPoll.js +52 -37
- package/dist/components/Payroll/PrintChecks/PrintChecksForm/useGenerationPoll.js.map +1 -1
- package/dist/components/Payroll/PrintChecks/PrintChecksSummary/PrintChecksSummary.js +26 -26
- package/dist/components/Payroll/PrintChecks/PrintChecksSummary/PrintChecksSummary.js.map +1 -1
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js +32 -32
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js.map +1 -1
- package/dist/components/Payroll/TransitionCreation/TransitionCreation.js +50 -48
- package/dist/components/Payroll/TransitionCreation/TransitionCreation.js.map +1 -1
- package/dist/components/Payroll/TransitionCreation/TransitionCreationPresentation.js +34 -33
- package/dist/components/Payroll/TransitionCreation/TransitionCreationPresentation.js.map +1 -1
- package/dist/components/Payroll/TransitionCreation/TransitionCreationTypes.js.map +1 -1
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.js +28 -24
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.js.map +1 -1
- package/dist/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.js +255 -228
- package/dist/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.js.map +1 -1
- package/dist/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.module.scss.js +8 -4
- package/dist/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.module.scss.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +10 -8
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/components/TimeOff/AddEmployeesHoliday/AddEmployeesHoliday.js +5 -5
- package/dist/components/TimeOff/AddEmployeesHoliday/AddEmployeesHoliday.js.map +1 -1
- package/dist/components/TimeOff/AddEmployeesToPolicy/AddEmployeesToPolicy.js +8 -7
- package/dist/components/TimeOff/AddEmployeesToPolicy/AddEmployeesToPolicy.js.map +1 -1
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetail.js +51 -50
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetail.js.map +1 -1
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetailPresentation.js +20 -18
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetailPresentation.js.map +1 -1
- package/dist/components/TimeOff/HolidaySelectionForm/HolidaySelectionForm.js +51 -49
- package/dist/components/TimeOff/HolidaySelectionForm/HolidaySelectionForm.js.map +1 -1
- package/dist/components/TimeOff/HolidaySelectionForm/HolidaySelectionFormPresentation.js +20 -20
- package/dist/components/TimeOff/HolidaySelectionForm/HolidaySelectionFormPresentation.js.map +1 -1
- package/dist/components/TimeOff/PolicyList/PolicyList.js +50 -49
- package/dist/components/TimeOff/PolicyList/PolicyList.js.map +1 -1
- package/dist/components/TimeOff/PolicyList/PolicyListPresentation.js +34 -33
- package/dist/components/TimeOff/PolicyList/PolicyListPresentation.js.map +1 -1
- package/dist/components/TimeOff/PolicySettings/PolicySettings.js +46 -45
- package/dist/components/TimeOff/PolicySettings/PolicySettings.js.map +1 -1
- package/dist/components/TimeOff/PolicySettings/PolicySettingsPresentation.js +152 -143
- package/dist/components/TimeOff/PolicySettings/PolicySettingsPresentation.js.map +1 -1
- package/dist/components/TimeOff/PolicyTypeSelector/PolicyTypeSelector.js +14 -13
- package/dist/components/TimeOff/PolicyTypeSelector/PolicyTypeSelector.js.map +1 -1
- package/dist/components/TimeOff/PolicyTypeSelector/PolicyTypeSelectorPresentation.js +44 -35
- package/dist/components/TimeOff/PolicyTypeSelector/PolicyTypeSelectorPresentation.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationForm.js +88 -71
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationForm.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormPresentation.js +164 -155
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormPresentation.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday.js +57 -55
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.js +25 -24
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.js +94 -92
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.js.map +1 -1
- package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetail.js +156 -155
- package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetail.js.map +1 -1
- package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetailPresentation.js +21 -19
- package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetailPresentation.js.map +1 -1
- package/dist/components/TimeOff/shared/PolicyDetailLayout/PolicyDetailLayout.js +28 -26
- package/dist/components/TimeOff/shared/PolicyDetailLayout/PolicyDetailLayout.js.map +1 -1
- package/dist/contexts/ApiProvider/ApiProvider.js +29 -28
- package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -1
- package/dist/contexts/ApiProvider/apiVersionMismatchHook.js +15 -0
- package/dist/contexts/ApiProvider/apiVersionMismatchHook.js.map +1 -0
- package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/contexts/ThemeProvider/ThemeProvider.js +32 -26
- package/dist/contexts/ThemeProvider/ThemeProvider.js.map +1 -1
- package/dist/contexts/UnstableFeaturesProvider/useUnstableFeature.js.map +1 -1
- package/dist/hooks/usePollingTask/usePollingTask.js +53 -41
- package/dist/hooks/usePollingTask/usePollingTask.js.map +1 -1
- package/dist/i18n/en/Company.PaySchedule.json.js +22 -20
- package/dist/i18n/en/Company.PaySchedule.json.js.map +1 -1
- package/dist/i18n/en/Employee.ManagementEmployeeList.json.js +28 -24
- package/dist/i18n/en/Employee.ManagementEmployeeList.json.js.map +1 -1
- package/dist/i18n/en/Payroll.GrossUpModal.json.js +12 -10
- package/dist/i18n/en/Payroll.GrossUpModal.json.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollConfiguration.json.js +8 -8
- package/dist/i18n/en/Payroll.PayrollOverview.json.js +15 -15
- package/dist/i18n/en/Payroll.UNSTABLE_PayrollEditEmployee.json.js +62 -58
- package/dist/i18n/en/Payroll.UNSTABLE_PayrollEditEmployee.json.js.map +1 -1
- package/dist/package.json.js +1 -1
- package/dist/src/components/Common/FieldCaption/FieldCaption.d.ts +2 -16
- package/dist/src/components/Common/FieldCaption/FieldCaptionTypes.d.ts +22 -0
- package/dist/src/components/Common/FieldCaption/index.d.ts +1 -0
- package/dist/src/components/Common/Flex/Flex.d.ts +3 -1
- package/dist/src/components/Common/UI/ComboBox/ComboBoxTypes.d.ts +1 -1
- package/dist/src/components/Common/UI/DatePicker/DatePickerTypes.d.ts +2 -1
- package/dist/src/components/Common/UI/Menu/MenuTypes.d.ts +1 -1
- package/dist/src/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.d.ts +1 -1
- package/dist/src/components/Common/UI/MultiSelectComboBox/MultiSelectComboBoxTypes.d.ts +5 -0
- package/dist/src/components/Common/UI/Select/SelectTypes.d.ts +2 -1
- package/dist/src/components/Company/PaySchedule/PaySchedule.d.ts +10 -2
- package/dist/src/components/Company/PaySchedule/PayScheduleComponents.d.ts +1 -0
- package/dist/src/components/Company/PaySchedule/shared/usePayScheduleForm/fields.d.ts +9 -1
- package/dist/src/components/Company/PaySchedule/shared/usePayScheduleForm/index.d.ts +2 -2
- package/dist/src/components/Company/PaySchedule/shared/usePayScheduleForm/payScheduleSchema.d.ts +21 -5
- package/dist/src/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.d.ts +21 -3
- package/dist/src/components/Contractor/ContractorList/management/ManagementContractorListView.d.ts +3 -1
- package/dist/src/components/Contractor/ContractorList/onboarding/ContractorListView.d.ts +3 -1
- package/dist/src/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.d.ts +3 -1
- package/dist/src/components/Contractor/Payments/CreatePayment/PreviewPresentation.d.ts +3 -1
- package/dist/src/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.d.ts +3 -1
- package/dist/src/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.d.ts +3 -1
- package/dist/src/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.d.ts +3 -1
- package/dist/src/components/Contractor/Submit/SubmitDone.d.ts +3 -1
- package/dist/src/components/Employee/Compensation/management/CompensationEditForm/CompensationEditForm.d.ts +1 -1
- package/dist/src/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.d.ts +3 -1
- package/dist/src/components/Employee/Documents/onboarding/EmployeeDocuments/EmployeeDocumentsPresentation.d.ts +3 -1
- package/dist/src/components/Employee/EmployeeList/management/ManagementEmployeeListView.d.ts +3 -1
- package/dist/src/components/Employee/EmployeeList/onboarding/EmployeeListView.d.ts +3 -1
- package/dist/src/components/Employee/EmployeeList/shared/useEmployeeList.d.ts +11 -2
- package/dist/src/components/Employee/EmployeeListFlow/employeeListStateMachine.test.d.ts +1 -0
- package/dist/src/components/Employee/HomeAddress/management/HomeAddressView.d.ts +3 -1
- package/dist/src/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.d.ts +3 -1
- package/dist/src/components/Employee/Terminations/TerminationSummary/TerminationSummaryPresentation.d.ts +3 -1
- package/dist/src/components/Employee/WorkAddress/management/WorkAddressView.d.ts +3 -1
- package/dist/src/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelectionPresentation.d.ts +3 -1
- package/dist/src/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.d.ts +1 -1
- package/dist/src/components/Payroll/OffCycleCreation/OffCycleCreationTypes.d.ts +8 -0
- package/dist/src/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.d.ts +3 -1
- package/dist/src/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +3 -1
- package/dist/src/components/Payroll/PayrollConfiguration/useCalculationPoll.d.ts +6 -1
- package/dist/src/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.d.ts +3 -1
- package/dist/src/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields.d.ts +9 -9
- package/dist/src/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeHelpers.d.ts +2 -2
- package/dist/src/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeSchema.d.ts +4 -4
- package/dist/src/components/Payroll/PayrollHistory/PayrollHistoryPresentation.d.ts +3 -1
- package/dist/src/components/Payroll/PayrollList/PayrollListPresentation.d.ts +3 -1
- package/dist/src/components/Payroll/PayrollOverview/PayrollOverviewPresentation.d.ts +2 -1
- package/dist/src/components/Payroll/PayrollOverview/useSubmissionPoll.d.ts +10 -1
- package/dist/src/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.d.ts +2 -1
- package/dist/src/components/Payroll/TransitionCreation/TransitionCreationPresentation.d.ts +1 -1
- package/dist/src/components/Payroll/TransitionCreation/TransitionCreationTypes.d.ts +2 -0
- package/dist/src/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.d.ts +3 -1
- package/dist/src/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.d.ts +1 -1
- package/dist/src/components/TimeOff/AddEmployeesHoliday/AddEmployeesHoliday.d.ts +1 -1
- package/dist/src/components/TimeOff/AddEmployeesToPolicy/AddEmployeesToPolicy.d.ts +1 -1
- package/dist/src/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetailPresentation.d.ts +1 -1
- package/dist/src/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetailTypes.d.ts +2 -0
- package/dist/src/components/TimeOff/HolidaySelectionForm/HolidaySelectionFormTypes.d.ts +2 -0
- package/dist/src/components/TimeOff/PolicyList/PolicyListPresentation.d.ts +1 -1
- package/dist/src/components/TimeOff/PolicyList/PolicyListTypes.d.ts +2 -0
- package/dist/src/components/TimeOff/PolicySettings/PolicySettingsPresentation.d.ts +1 -1
- package/dist/src/components/TimeOff/PolicySettings/PolicySettingsTypes.d.ts +2 -0
- package/dist/src/components/TimeOff/PolicyTypeSelector/PolicyTypeSelectorPresentation.d.ts +1 -1
- package/dist/src/components/TimeOff/PolicyTypeSelector/PolicyTypeSelectorTypes.d.ts +2 -0
- package/dist/src/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormPresentation.d.ts +1 -1
- package/dist/src/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormTypes.d.ts +2 -0
- package/dist/src/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday.d.ts +2 -0
- package/dist/src/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.d.ts +1 -1
- package/dist/src/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentationTypes.d.ts +2 -0
- package/dist/src/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.d.ts +2 -0
- package/dist/src/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetailPresentation.d.ts +1 -1
- package/dist/src/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetailTypes.d.ts +3 -0
- package/dist/src/components/TimeOff/shared/PolicyDetailLayout/PolicyDetailLayout.d.ts +1 -1
- package/dist/src/components/TimeOff/shared/PolicyDetailLayout/PolicyDetailLayoutTypes.d.ts +2 -0
- package/dist/src/contexts/ApiProvider/ApiProvider.d.ts +5 -3
- package/dist/src/contexts/ApiProvider/apiVersionMismatchHook.d.ts +3 -0
- package/dist/src/contexts/ApiProvider/apiVersionMismatchHook.test.d.ts +1 -0
- package/dist/src/contexts/ComponentAdapter/componentAdapterTypes.d.ts +1 -0
- package/dist/src/contexts/ComponentAdapter/useComponentContext.d.ts +4 -1
- package/dist/src/contexts/GustoProvider/GustoProviderCustomUIAdapter.d.ts +9 -1
- package/dist/src/contexts/ThemeProvider/ThemeProvider.d.ts +8 -3
- package/dist/src/contexts/UnstableFeaturesProvider/useUnstableFeature.d.ts +4 -1
- package/dist/src/hooks/usePollingTask/usePollingTask.d.ts +55 -14
- package/dist/src/i18n/types.d.ts +42 -2
- package/dist/src/index.d.ts +1 -1
- package/dist/src/models/external.d.ts +1 -0
- package/dist/style.css +1 -1
- package/docs/guides/endpoint-inventory.json +5 -0
- package/package.json +20 -19
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayScheduleComponents.js","sources":["../../../../src/components/Company/PaySchedule/PayScheduleComponents.tsx"],"sourcesContent":["import type { PayScheduleDefaultValues } from './PaySchedule'\nimport { PayScheduleList } from './PayScheduleList'\nimport { PayScheduleForm } from './PayScheduleForm'\nimport { useFlow, type FlowContextInterface } from '@/components/Flow/useFlow'\nimport { ensureRequired } from '@/helpers/ensureRequired'\n\n/** @internal */\nexport interface PayScheduleContextInterface extends FlowContextInterface {\n companyId: string\n payScheduleId?: string\n defaultValues?: PayScheduleDefaultValues\n component: React.ComponentType | null\n}\n\n/** @internal */\nexport function PayScheduleListContextual() {\n const { companyId, onEvent } = useFlow<PayScheduleContextInterface>()\n return <PayScheduleList onEvent={onEvent} companyId={ensureRequired(companyId)} />\n}\n\n/** @internal */\nexport function PayScheduleFormContextual() {\n const { companyId, payScheduleId, defaultValues, onEvent } =\n useFlow<PayScheduleContextInterface>()\n\n return (\n <PayScheduleForm\n companyId={ensureRequired(companyId)}\n payScheduleId={payScheduleId}\n defaultValues={defaultValues}\n onEvent={onEvent}\n />\n )\n}\n"],"names":["PayScheduleListContextual","companyId","onEvent","useFlow","PayScheduleList","ensureRequired","PayScheduleFormContextual","payScheduleId","defaultValues","jsx","PayScheduleForm"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"PayScheduleComponents.js","sources":["../../../../src/components/Company/PaySchedule/PayScheduleComponents.tsx"],"sourcesContent":["import type { PayScheduleDefaultValues } from './PaySchedule'\nimport { PayScheduleList } from './PayScheduleList'\nimport { PayScheduleForm } from './PayScheduleForm'\nimport { useFlow, type FlowContextInterface } from '@/components/Flow/useFlow'\nimport { ensureRequired } from '@/helpers/ensureRequired'\n\n/** @internal */\nexport interface PayScheduleContextInterface extends FlowContextInterface {\n companyId: string\n payScheduleId?: string\n defaultValues?: PayScheduleDefaultValues\n disableWorkweekStartDayEditing?: boolean\n component: React.ComponentType | null\n}\n\n/** @internal */\nexport function PayScheduleListContextual() {\n const { companyId, onEvent } = useFlow<PayScheduleContextInterface>()\n return <PayScheduleList onEvent={onEvent} companyId={ensureRequired(companyId)} />\n}\n\n/** @internal */\nexport function PayScheduleFormContextual() {\n const { companyId, payScheduleId, defaultValues, disableWorkweekStartDayEditing, onEvent } =\n useFlow<PayScheduleContextInterface>()\n\n return (\n <PayScheduleForm\n companyId={ensureRequired(companyId)}\n payScheduleId={payScheduleId}\n defaultValues={defaultValues}\n disableWorkweekStartDayEditing={disableWorkweekStartDayEditing}\n onEvent={onEvent}\n />\n )\n}\n"],"names":["PayScheduleListContextual","companyId","onEvent","useFlow","PayScheduleList","ensureRequired","PayScheduleFormContextual","payScheduleId","defaultValues","disableWorkweekStartDayEditing","jsx","PayScheduleForm"],"mappings":";;;;;AAgBO,SAASA,IAA4B;AAC1C,QAAM,EAAE,WAAAC,GAAW,SAAAC,EAAA,IAAYC,EAAA;AAC/B,2BAAQC,GAAA,EAAgB,SAAAF,GAAkB,WAAWG,EAAeJ,CAAS,GAAG;AAClF;AAGO,SAASK,IAA4B;AAC1C,QAAM,EAAE,WAAAL,GAAW,eAAAM,GAAe,eAAAC,GAAe,gCAAAC,GAAgC,SAAAP,EAAA,IAC/EC,EAAA;AAEF,SACE,gBAAAO;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,WAAWN,EAAeJ,CAAS;AAAA,MACnC,eAAAM;AAAA,MACA,eAAAC;AAAA,MACA,gCAAAC;AAAA,MACA,SAAAP;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1,55 +1,63 @@
|
|
|
1
1
|
import { jsx as a, jsxs as c } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
3
|
-
import { useTranslation as
|
|
4
|
-
import { usePayScheduleForm as
|
|
5
|
-
import
|
|
6
|
-
import { BaseBoundaries as
|
|
2
|
+
import { useState as R } from "react";
|
|
3
|
+
import { useTranslation as C } from "react-i18next";
|
|
4
|
+
import { usePayScheduleForm as O } from "./shared/usePayScheduleForm/usePayScheduleForm.js";
|
|
5
|
+
import m from "./PayScheduleForm.module.scss.js";
|
|
6
|
+
import { BaseBoundaries as M, BaseLayout as f } from "../../Base/Base.js";
|
|
7
7
|
import "../../Base/useBase.js";
|
|
8
|
-
import { SDKFormProvider as
|
|
9
|
-
import { Form as
|
|
10
|
-
import { Flex as
|
|
8
|
+
import { SDKFormProvider as q } from "../../../partner-hook-utils/form/SDKFormProvider.js";
|
|
9
|
+
import { Form as A } from "../../Common/Form/Form.js";
|
|
10
|
+
import { Flex as u } from "../../Common/Flex/Flex.js";
|
|
11
11
|
import { Grid as L } from "../../Common/Grid/Grid.js";
|
|
12
12
|
import { ActionsLayout as T } from "../../Common/ActionsLayout/ActionsLayout.js";
|
|
13
|
-
import { useComponentContext as
|
|
14
|
-
import { useDateFormatter as
|
|
15
|
-
import { componentEvents as
|
|
13
|
+
import { useComponentContext as F } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
|
+
import { useDateFormatter as x } from "../../../hooks/useDateFormatter.js";
|
|
15
|
+
import { componentEvents as D } from "../../../shared/constants.js";
|
|
16
16
|
import { normalizeToDate as N } from "../../../helpers/dateFormatting.js";
|
|
17
|
-
const
|
|
18
|
-
function
|
|
19
|
-
return /* @__PURE__ */ a(
|
|
17
|
+
const p = (l) => N(l.toString());
|
|
18
|
+
function ee({ onEvent: l, LoaderComponent: d, ...h }) {
|
|
19
|
+
return /* @__PURE__ */ a(M, { componentName: "Company.PayScheduleForm", LoaderComponent: d, children: /* @__PURE__ */ a(I, { onEvent: l, LoaderComponent: d, ...h }) });
|
|
20
20
|
}
|
|
21
|
-
function I({ onEvent:
|
|
22
|
-
const { t: e } =
|
|
23
|
-
if (
|
|
21
|
+
function I({ onEvent: l, LoaderComponent: d, ...h }) {
|
|
22
|
+
const { t: e } = C("Company.PaySchedule"), i = F(), P = x(), o = O(h), [n, w] = R(0);
|
|
23
|
+
if (o.isLoading)
|
|
24
24
|
return /* @__PURE__ */ a(
|
|
25
|
-
|
|
25
|
+
f,
|
|
26
26
|
{
|
|
27
27
|
isLoading: !0,
|
|
28
|
-
error:
|
|
28
|
+
error: o.errorHandling.errors,
|
|
29
29
|
LoaderComponent: d
|
|
30
30
|
}
|
|
31
31
|
);
|
|
32
|
-
const
|
|
33
|
-
const t = await
|
|
34
|
-
t &&
|
|
35
|
-
t.mode === "create" ?
|
|
32
|
+
const v = async () => {
|
|
33
|
+
const t = await o.actions.onSubmit();
|
|
34
|
+
t && l(
|
|
35
|
+
t.mode === "create" ? D.PAY_SCHEDULE_CREATED : D.PAY_SCHEDULE_UPDATED,
|
|
36
36
|
{ paySchedule: t.data }
|
|
37
37
|
);
|
|
38
|
-
}, { Fields: r } =
|
|
38
|
+
}, { Fields: r } = o.form, { paymentSpeedDays: S, payPreviewLoading: g } = o.data, s = o.data.payPeriodPreview, b = {
|
|
39
39
|
"Every week": e("frequencies.everyWeek"),
|
|
40
40
|
"Every other week": e("frequencies.everyOtherWeek"),
|
|
41
41
|
"Twice per month": e("frequencies.twicePerMonth"),
|
|
42
42
|
Monthly: e("frequencies.monthly")
|
|
43
|
-
},
|
|
43
|
+
}, k = {
|
|
44
44
|
"1st15th": e("frequencyOptions.15thAndLast"),
|
|
45
45
|
custom: e("frequencyOptions.custom")
|
|
46
|
+
}, E = {
|
|
47
|
+
Sunday: e("workweekStartDayOptions.sunday"),
|
|
48
|
+
Monday: e("workweekStartDayOptions.monday"),
|
|
49
|
+
Tuesday: e("workweekStartDayOptions.tuesday"),
|
|
50
|
+
Wednesday: e("workweekStartDayOptions.wednesday"),
|
|
51
|
+
Thursday: e("workweekStartDayOptions.thursday"),
|
|
52
|
+
Friday: e("workweekStartDayOptions.friday"),
|
|
53
|
+
Saturday: e("workweekStartDayOptions.saturday")
|
|
46
54
|
};
|
|
47
|
-
return /* @__PURE__ */ a(
|
|
48
|
-
|
|
49
|
-
}, children: /* @__PURE__ */ c(
|
|
50
|
-
/* @__PURE__ */ a(
|
|
51
|
-
/* @__PURE__ */ a("div", { className:
|
|
52
|
-
/* @__PURE__ */ a("div", { className:
|
|
55
|
+
return /* @__PURE__ */ a(f, { error: o.errorHandling.errors, LoaderComponent: d, children: /* @__PURE__ */ a(q, { formHookResult: o, children: /* @__PURE__ */ a(A, { onSubmit: () => {
|
|
56
|
+
v();
|
|
57
|
+
}, children: /* @__PURE__ */ c(u, { flexDirection: "column", children: [
|
|
58
|
+
/* @__PURE__ */ a(u, { justifyContent: "space-between", flexDirection: "column", gap: 4, children: /* @__PURE__ */ a("header", { children: /* @__PURE__ */ a(i.Heading, { as: "h2", children: o.status.mode === "create" ? e("headings.addPaySchedule") : e("headings.editPaySchedule") }) }) }),
|
|
59
|
+
/* @__PURE__ */ a("div", { className: m.payScheduleContainer, children: /* @__PURE__ */ c(L, { gap: 32, gridTemplateColumns: { base: "1fr", small: "1fr 1fr" }, children: [
|
|
60
|
+
/* @__PURE__ */ a("div", { className: m.payScheduleForm, children: /* @__PURE__ */ c(u, { flexDirection: "column", children: [
|
|
53
61
|
/* @__PURE__ */ a(
|
|
54
62
|
r.CustomName,
|
|
55
63
|
{
|
|
@@ -62,7 +70,7 @@ function I({ onEvent: s, LoaderComponent: d, ...p }) {
|
|
|
62
70
|
{
|
|
63
71
|
label: e("labels.frequency"),
|
|
64
72
|
placeholder: e("labels.frequencyPlaceholder"),
|
|
65
|
-
getOptionLabel: (t) =>
|
|
73
|
+
getOptionLabel: (t) => b[t],
|
|
66
74
|
validationMessages: { REQUIRED: e("validations.frequency") }
|
|
67
75
|
}
|
|
68
76
|
),
|
|
@@ -71,7 +79,7 @@ function I({ onEvent: s, LoaderComponent: d, ...p }) {
|
|
|
71
79
|
{
|
|
72
80
|
label: e("labels.frequencyOptions"),
|
|
73
81
|
description: e("descriptions.frequencyOptionsDescription"),
|
|
74
|
-
getOptionLabel: (t) =>
|
|
82
|
+
getOptionLabel: (t) => k[t] ?? t,
|
|
75
83
|
validationMessages: { REQUIRED: e("validations.frequencyOptions") }
|
|
76
84
|
}
|
|
77
85
|
),
|
|
@@ -80,7 +88,7 @@ function I({ onEvent: s, LoaderComponent: d, ...p }) {
|
|
|
80
88
|
{
|
|
81
89
|
label: e("labels.firstPayDate"),
|
|
82
90
|
description: e("descriptions.anchorPayDateDescription", {
|
|
83
|
-
count:
|
|
91
|
+
count: S
|
|
84
92
|
}),
|
|
85
93
|
validationMessages: { REQUIRED: e("validations.firstPayDate") },
|
|
86
94
|
minDate: /* @__PURE__ */ new Date()
|
|
@@ -113,46 +121,55 @@ function I({ onEvent: s, LoaderComponent: d, ...p }) {
|
|
|
113
121
|
DAY_RANGE: e("validations.dayRange")
|
|
114
122
|
}
|
|
115
123
|
}
|
|
124
|
+
),
|
|
125
|
+
r.WorkweekStartDay && /* @__PURE__ */ a(
|
|
126
|
+
r.WorkweekStartDay,
|
|
127
|
+
{
|
|
128
|
+
label: e("labels.workweekStartDay"),
|
|
129
|
+
placeholder: e("labels.workweekStartDayPlaceholder"),
|
|
130
|
+
description: e("descriptions.workweekStartDayDescription"),
|
|
131
|
+
getOptionLabel: (t) => E[t]
|
|
132
|
+
}
|
|
116
133
|
)
|
|
117
134
|
] }) }),
|
|
118
|
-
/* @__PURE__ */ a(
|
|
119
|
-
!
|
|
120
|
-
|
|
135
|
+
/* @__PURE__ */ a(u, { flexDirection: "column", gap: 4, justifyContent: "center", alignItems: "center", children: s && s[n] ? /* @__PURE__ */ c("div", { className: m.calendarContainer, children: [
|
|
136
|
+
!g && /* @__PURE__ */ a(
|
|
137
|
+
i.Select,
|
|
121
138
|
{
|
|
122
139
|
label: e("labels.preview"),
|
|
123
140
|
placeholder: "",
|
|
124
141
|
isRequired: !0,
|
|
125
|
-
options:
|
|
126
|
-
value: String(
|
|
127
|
-
label:
|
|
142
|
+
options: s.map((t, y) => ({
|
|
143
|
+
value: String(y),
|
|
144
|
+
label: P.formatPayPeriodRange(
|
|
128
145
|
t.startDate.toString(),
|
|
129
146
|
t.endDate.toString()
|
|
130
147
|
)
|
|
131
148
|
})),
|
|
132
149
|
value: String(n),
|
|
133
150
|
onChange: (t) => {
|
|
134
|
-
const
|
|
135
|
-
isNaN(
|
|
151
|
+
const y = Number(t);
|
|
152
|
+
isNaN(y) || w(y);
|
|
136
153
|
}
|
|
137
154
|
}
|
|
138
155
|
),
|
|
139
156
|
/* @__PURE__ */ a(
|
|
140
|
-
|
|
157
|
+
i.CalendarPreview,
|
|
141
158
|
{
|
|
142
159
|
dateRange: {
|
|
143
|
-
start:
|
|
144
|
-
end:
|
|
160
|
+
start: p(s[n].startDate),
|
|
161
|
+
end: p(s[n].endDate),
|
|
145
162
|
label: e("payPreview.payPeriod") || "Pay Period"
|
|
146
163
|
},
|
|
147
164
|
highlightDates: [
|
|
148
165
|
{
|
|
149
|
-
date:
|
|
166
|
+
date: p(s[n].checkDate),
|
|
150
167
|
highlightColor: "primary",
|
|
151
168
|
label: e("payPreview.payday") || "Payday"
|
|
152
169
|
},
|
|
153
170
|
{
|
|
154
|
-
date:
|
|
155
|
-
|
|
171
|
+
date: p(
|
|
172
|
+
s[n].runPayrollBy
|
|
156
173
|
),
|
|
157
174
|
highlightColor: "secondary",
|
|
158
175
|
label: e("payPreview.payrollDeadline") || "Payroll Deadline"
|
|
@@ -161,12 +178,12 @@ function I({ onEvent: s, LoaderComponent: d, ...p }) {
|
|
|
161
178
|
},
|
|
162
179
|
n
|
|
163
180
|
)
|
|
164
|
-
] }) : /* @__PURE__ */ a("div", { className:
|
|
165
|
-
|
|
181
|
+
] }) : /* @__PURE__ */ a("div", { className: m.calendarContainer, children: /* @__PURE__ */ a(
|
|
182
|
+
i.Alert,
|
|
166
183
|
{
|
|
167
184
|
status: "info",
|
|
168
185
|
label: e("previewAlert.title", "Pay Schedule Preview"),
|
|
169
|
-
children: /* @__PURE__ */ a(
|
|
186
|
+
children: /* @__PURE__ */ a(i.Text, { children: e(
|
|
170
187
|
"previewAlert.description",
|
|
171
188
|
"Complete all the required fields on the left to see a preview of your pay schedule."
|
|
172
189
|
) })
|
|
@@ -175,20 +192,20 @@ function I({ onEvent: s, LoaderComponent: d, ...p }) {
|
|
|
175
192
|
] }) }),
|
|
176
193
|
/* @__PURE__ */ c(T, { children: [
|
|
177
194
|
/* @__PURE__ */ a(
|
|
178
|
-
|
|
195
|
+
i.Button,
|
|
179
196
|
{
|
|
180
197
|
variant: "secondary",
|
|
181
198
|
onClick: () => {
|
|
182
|
-
|
|
199
|
+
l(D.CANCEL);
|
|
183
200
|
},
|
|
184
201
|
children: e("actions.cancel")
|
|
185
202
|
}
|
|
186
203
|
),
|
|
187
|
-
/* @__PURE__ */ a(
|
|
204
|
+
/* @__PURE__ */ a(i.Button, { type: "submit", isLoading: o.status.isPending, children: e("actions.save") })
|
|
188
205
|
] })
|
|
189
206
|
] }) }) }) });
|
|
190
207
|
}
|
|
191
208
|
export {
|
|
192
|
-
|
|
209
|
+
ee as PayScheduleForm
|
|
193
210
|
};
|
|
194
211
|
//# sourceMappingURL=PayScheduleForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayScheduleForm.js","sources":["../../../../src/components/Company/PaySchedule/PayScheduleForm.tsx"],"sourcesContent":["import { useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { usePayScheduleForm } from './shared/usePayScheduleForm'\nimport type { UsePayScheduleFormProps, PayScheduleFrequency } from './shared/usePayScheduleForm'\nimport style from './PayScheduleForm.module.scss'\nimport { BaseBoundaries, BaseLayout } from '@/components/Base'\nimport { SDKFormProvider } from '@/partner-hook-utils/form/SDKFormProvider'\nimport { Form } from '@/components/Common/Form'\nimport { Flex, Grid, ActionsLayout } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport { componentEvents, type EventType } from '@/shared/constants'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport { normalizeToDate } from '@/helpers/dateFormatting'\nimport type { LoaderComponentType } from '@/components/Base'\n\ninterface PayScheduleFormProps extends UsePayScheduleFormProps {\n onEvent: OnEventType<EventType, unknown>\n /** Custom loading indicator rendered while this component's async data is fetching. Overrides the indicator configured on `GustoProvider` for this instance only. */\n LoaderComponent?: LoaderComponentType\n}\n\n// Pay period preview dates are RFCDate (`YYYY-MM-DD`) instances; normalizeToDate parses\n// them as local midnight instead of new Date's UTC midnight, which CalendarPreview would\n// otherwise roll back a day for timezones behind UTC. The format is always valid here.\nconst toLocalDate = (rfcDate: { toString(): string }): Date => normalizeToDate(rfcDate.toString())!\n\n/** @internal */\nexport function PayScheduleForm({ onEvent, LoaderComponent, ...hookProps }: PayScheduleFormProps) {\n return (\n <BaseBoundaries componentName=\"Company.PayScheduleForm\" LoaderComponent={LoaderComponent}>\n <PayScheduleFormRoot onEvent={onEvent} LoaderComponent={LoaderComponent} {...hookProps} />\n </BaseBoundaries>\n )\n}\n\nfunction PayScheduleFormRoot({ onEvent, LoaderComponent, ...hookProps }: PayScheduleFormProps) {\n const { t } = useTranslation('Company.PaySchedule')\n const Components = useComponentContext()\n const dateFormatter = useDateFormatter()\n const paySchedule = usePayScheduleForm(hookProps)\n const [selectedPayPeriodIndex, setSelectedPayPeriodIndex] = useState(0)\n\n if (paySchedule.isLoading) {\n return (\n <BaseLayout\n isLoading\n error={paySchedule.errorHandling.errors}\n LoaderComponent={LoaderComponent}\n />\n )\n }\n\n const handleSubmit = async () => {\n const result = await paySchedule.actions.onSubmit()\n if (result) {\n onEvent(\n result.mode === 'create'\n ? componentEvents.PAY_SCHEDULE_CREATED\n : componentEvents.PAY_SCHEDULE_UPDATED,\n { paySchedule: result.data },\n )\n }\n }\n\n const { Fields } = paySchedule.form\n const { paymentSpeedDays, payPreviewLoading } = paySchedule.data\n const payPeriodPreview = paySchedule.data.payPeriodPreview\n\n const frequencyLabels: Record<PayScheduleFrequency, string> = {\n 'Every week': t('frequencies.everyWeek'),\n 'Every other week': t('frequencies.everyOtherWeek'),\n 'Twice per month': t('frequencies.twicePerMonth'),\n Monthly: t('frequencies.monthly'),\n }\n\n const twicePerMonthLabels: Record<string, string> = {\n '1st15th': t('frequencyOptions.15thAndLast'),\n custom: t('frequencyOptions.custom'),\n }\n\n return (\n <BaseLayout error={paySchedule.errorHandling.errors} LoaderComponent={LoaderComponent}>\n <SDKFormProvider formHookResult={paySchedule}>\n <Form onSubmit={() => void handleSubmit()}>\n <Flex flexDirection=\"column\">\n <Flex justifyContent=\"space-between\" flexDirection=\"column\" gap={4}>\n <header>\n <Components.Heading as=\"h2\">\n {paySchedule.status.mode === 'create'\n ? t('headings.addPaySchedule')\n : t('headings.editPaySchedule')}\n </Components.Heading>\n </header>\n </Flex>\n <div className={style.payScheduleContainer}>\n <Grid gap={32} gridTemplateColumns={{ base: '1fr', small: '1fr 1fr' }}>\n <div className={style.payScheduleForm}>\n <Flex flexDirection=\"column\">\n <Fields.CustomName\n label={t('labels.name')}\n validationMessages={{ REQUIRED: t('validations.name') }}\n />\n <Fields.Frequency\n label={t('labels.frequency')}\n placeholder={t('labels.frequencyPlaceholder')}\n getOptionLabel={(entry: PayScheduleFrequency) => frequencyLabels[entry]}\n validationMessages={{ REQUIRED: t('validations.frequency') }}\n />\n {Fields.CustomTwicePerMonth && (\n <Fields.CustomTwicePerMonth\n label={t('labels.frequencyOptions')}\n description={t('descriptions.frequencyOptionsDescription')}\n getOptionLabel={(entry: string) => twicePerMonthLabels[entry] ?? entry}\n validationMessages={{ REQUIRED: t('validations.frequencyOptions') }}\n />\n )}\n <Fields.AnchorPayDate\n label={t('labels.firstPayDate')}\n description={t('descriptions.anchorPayDateDescription', {\n count: paymentSpeedDays,\n })}\n validationMessages={{ REQUIRED: t('validations.firstPayDate') }}\n minDate={new Date()}\n />\n <Fields.AnchorEndOfPayPeriod\n label={t('labels.firstPayPeriodEndDate')}\n description={t('descriptions.anchorEndOfPayPeriodDescription')}\n validationMessages={{ REQUIRED: t('validations.firstPayPeriodEndDate') }}\n />\n {Fields.Day1 && (\n <Fields.Day1\n label={t('labels.firstPayDayOfTheMonth')}\n validationMessages={{\n REQUIRED: t('validations.firstPayDayOfTheMonth'),\n DAY_RANGE: t('validations.dayRange'),\n }}\n />\n )}\n {Fields.Day2 && (\n <Fields.Day2\n label={t('labels.lastPayDayOfTheMonth')}\n validationMessages={{\n REQUIRED: t('validations.lastPayDayOfTheMonth'),\n DAY_RANGE: t('validations.dayRange'),\n }}\n />\n )}\n </Flex>\n </div>\n <Flex flexDirection=\"column\" gap={4} justifyContent=\"center\" alignItems=\"center\">\n {payPeriodPreview && payPeriodPreview[selectedPayPeriodIndex] ? (\n <div className={style.calendarContainer}>\n {!payPreviewLoading && (\n <Components.Select\n label={t('labels.preview')}\n placeholder=\"\"\n isRequired\n options={payPeriodPreview.map((period, index) => ({\n value: String(index),\n label: dateFormatter.formatPayPeriodRange(\n period.startDate.toString(),\n period.endDate.toString(),\n ),\n }))}\n value={String(selectedPayPeriodIndex)}\n onChange={(value: string) => {\n const numericValue = Number(value)\n if (!isNaN(numericValue)) {\n setSelectedPayPeriodIndex(numericValue)\n }\n }}\n />\n )}\n <Components.CalendarPreview\n key={selectedPayPeriodIndex}\n dateRange={{\n start: toLocalDate(payPeriodPreview[selectedPayPeriodIndex].startDate),\n end: toLocalDate(payPeriodPreview[selectedPayPeriodIndex].endDate),\n label: t('payPreview.payPeriod') || 'Pay Period',\n }}\n highlightDates={[\n {\n date: toLocalDate(payPeriodPreview[selectedPayPeriodIndex].checkDate),\n highlightColor: 'primary',\n label: t('payPreview.payday') || 'Payday',\n },\n {\n date: toLocalDate(\n payPeriodPreview[selectedPayPeriodIndex].runPayrollBy,\n ),\n highlightColor: 'secondary',\n label: t('payPreview.payrollDeadline') || 'Payroll Deadline',\n },\n ]}\n />\n </div>\n ) : (\n <div className={style.calendarContainer}>\n <Components.Alert\n status=\"info\"\n label={t('previewAlert.title', 'Pay Schedule Preview')}\n >\n <Components.Text>\n {t(\n 'previewAlert.description',\n 'Complete all the required fields on the left to see a preview of your pay schedule.',\n )}\n </Components.Text>\n </Components.Alert>\n </div>\n )}\n </Flex>\n </Grid>\n </div>\n <ActionsLayout>\n <Components.Button\n variant=\"secondary\"\n onClick={() => {\n onEvent(componentEvents.CANCEL)\n }}\n >\n {t('actions.cancel')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={paySchedule.status.isPending}>\n {t('actions.save')}\n </Components.Button>\n </ActionsLayout>\n </Flex>\n </Form>\n </SDKFormProvider>\n </BaseLayout>\n )\n}\n"],"names":["toLocalDate","rfcDate","normalizeToDate","PayScheduleForm","onEvent","LoaderComponent","hookProps","jsx","BaseBoundaries","PayScheduleFormRoot","t","useTranslation","Components","useComponentContext","dateFormatter","useDateFormatter","paySchedule","usePayScheduleForm","selectedPayPeriodIndex","setSelectedPayPeriodIndex","useState","BaseLayout","handleSubmit","result","componentEvents","Fields","paymentSpeedDays","payPreviewLoading","payPeriodPreview","frequencyLabels","twicePerMonthLabels","SDKFormProvider","Form","jsxs","Flex","style","Grid","entry","period","index","value","numericValue","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;AAyBA,MAAMA,IAAc,CAACC,MAA0CC,EAAgBD,EAAQ,UAAU;AAG1F,SAASE,EAAgB,EAAE,SAAAC,GAAS,iBAAAC,GAAiB,GAAGC,KAAmC;AAChG,SACE,gBAAAC,EAACC,GAAA,EAAe,eAAc,2BAA0B,iBAAAH,GACtD,UAAA,gBAAAE,EAACE,GAAA,EAAoB,SAAAL,GAAkB,iBAAAC,GAAmC,GAAGC,EAAA,CAAW,EAAA,CAC1F;AAEJ;AAEA,SAASG,EAAoB,EAAE,SAAAL,GAAS,iBAAAC,GAAiB,GAAGC,KAAmC;AAC7F,QAAM,EAAE,GAAAI,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA,GACbC,IAAgBC,EAAA,GAChBC,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AQ;AAAA,UACR,SAAS,MAAM;AACb,YAAAR,EAAQoB,EAAgB,MAAM;AAAA,UAChC;AAAA,UAEC,YAAE,gBAAgB;AAAA,QAAA;AAAA,MAAA;AAAA,MAErB,gBAAAjB,EAACK,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWI,EAAY,OAAO,WAC5D,UAAAN,EAAE,cAAc,EAAA,CACnB;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"PayScheduleForm.js","sources":["../../../../src/components/Company/PaySchedule/PayScheduleForm.tsx"],"sourcesContent":["import { useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { usePayScheduleForm } from './shared/usePayScheduleForm'\nimport type {\n UsePayScheduleFormProps,\n PayScheduleFrequency,\n PayScheduleWorkweekStartDay,\n} from './shared/usePayScheduleForm'\nimport style from './PayScheduleForm.module.scss'\nimport { BaseBoundaries, BaseLayout } from '@/components/Base'\nimport { SDKFormProvider } from '@/partner-hook-utils/form/SDKFormProvider'\nimport { Form } from '@/components/Common/Form'\nimport { Flex, Grid, ActionsLayout } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport { componentEvents, type EventType } from '@/shared/constants'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport { normalizeToDate } from '@/helpers/dateFormatting'\nimport type { LoaderComponentType } from '@/components/Base'\n\ninterface PayScheduleFormProps extends UsePayScheduleFormProps {\n onEvent: OnEventType<EventType, unknown>\n /** Custom loading indicator rendered while this component's async data is fetching. Overrides the indicator configured on `GustoProvider` for this instance only. */\n LoaderComponent?: LoaderComponentType\n}\n\n// Pay period preview dates are RFCDate (`YYYY-MM-DD`) instances; normalizeToDate parses\n// them as local midnight instead of new Date's UTC midnight, which CalendarPreview would\n// otherwise roll back a day for timezones behind UTC. The format is always valid here.\nconst toLocalDate = (rfcDate: { toString(): string }): Date => normalizeToDate(rfcDate.toString())!\n\n/** @internal */\nexport function PayScheduleForm({ onEvent, LoaderComponent, ...hookProps }: PayScheduleFormProps) {\n return (\n <BaseBoundaries componentName=\"Company.PayScheduleForm\" LoaderComponent={LoaderComponent}>\n <PayScheduleFormRoot onEvent={onEvent} LoaderComponent={LoaderComponent} {...hookProps} />\n </BaseBoundaries>\n )\n}\n\nfunction PayScheduleFormRoot({ onEvent, LoaderComponent, ...hookProps }: PayScheduleFormProps) {\n const { t } = useTranslation('Company.PaySchedule')\n const Components = useComponentContext()\n const dateFormatter = useDateFormatter()\n const paySchedule = usePayScheduleForm(hookProps)\n const [selectedPayPeriodIndex, setSelectedPayPeriodIndex] = useState(0)\n\n if (paySchedule.isLoading) {\n return (\n <BaseLayout\n isLoading\n error={paySchedule.errorHandling.errors}\n LoaderComponent={LoaderComponent}\n />\n )\n }\n\n const handleSubmit = async () => {\n const result = await paySchedule.actions.onSubmit()\n if (result) {\n onEvent(\n result.mode === 'create'\n ? componentEvents.PAY_SCHEDULE_CREATED\n : componentEvents.PAY_SCHEDULE_UPDATED,\n { paySchedule: result.data },\n )\n }\n }\n\n const { Fields } = paySchedule.form\n const { paymentSpeedDays, payPreviewLoading } = paySchedule.data\n const payPeriodPreview = paySchedule.data.payPeriodPreview\n\n const frequencyLabels: Record<PayScheduleFrequency, string> = {\n 'Every week': t('frequencies.everyWeek'),\n 'Every other week': t('frequencies.everyOtherWeek'),\n 'Twice per month': t('frequencies.twicePerMonth'),\n Monthly: t('frequencies.monthly'),\n }\n\n const twicePerMonthLabels: Record<string, string> = {\n '1st15th': t('frequencyOptions.15thAndLast'),\n custom: t('frequencyOptions.custom'),\n }\n\n const workweekStartDayLabels: Record<PayScheduleWorkweekStartDay, string> = {\n Sunday: t('workweekStartDayOptions.sunday'),\n Monday: t('workweekStartDayOptions.monday'),\n Tuesday: t('workweekStartDayOptions.tuesday'),\n Wednesday: t('workweekStartDayOptions.wednesday'),\n Thursday: t('workweekStartDayOptions.thursday'),\n Friday: t('workweekStartDayOptions.friday'),\n Saturday: t('workweekStartDayOptions.saturday'),\n }\n\n return (\n <BaseLayout error={paySchedule.errorHandling.errors} LoaderComponent={LoaderComponent}>\n <SDKFormProvider formHookResult={paySchedule}>\n <Form onSubmit={() => void handleSubmit()}>\n <Flex flexDirection=\"column\">\n <Flex justifyContent=\"space-between\" flexDirection=\"column\" gap={4}>\n <header>\n <Components.Heading as=\"h2\">\n {paySchedule.status.mode === 'create'\n ? t('headings.addPaySchedule')\n : t('headings.editPaySchedule')}\n </Components.Heading>\n </header>\n </Flex>\n <div className={style.payScheduleContainer}>\n <Grid gap={32} gridTemplateColumns={{ base: '1fr', small: '1fr 1fr' }}>\n <div className={style.payScheduleForm}>\n <Flex flexDirection=\"column\">\n <Fields.CustomName\n label={t('labels.name')}\n validationMessages={{ REQUIRED: t('validations.name') }}\n />\n <Fields.Frequency\n label={t('labels.frequency')}\n placeholder={t('labels.frequencyPlaceholder')}\n getOptionLabel={(entry: PayScheduleFrequency) => frequencyLabels[entry]}\n validationMessages={{ REQUIRED: t('validations.frequency') }}\n />\n {Fields.CustomTwicePerMonth && (\n <Fields.CustomTwicePerMonth\n label={t('labels.frequencyOptions')}\n description={t('descriptions.frequencyOptionsDescription')}\n getOptionLabel={(entry: string) => twicePerMonthLabels[entry] ?? entry}\n validationMessages={{ REQUIRED: t('validations.frequencyOptions') }}\n />\n )}\n <Fields.AnchorPayDate\n label={t('labels.firstPayDate')}\n description={t('descriptions.anchorPayDateDescription', {\n count: paymentSpeedDays,\n })}\n validationMessages={{ REQUIRED: t('validations.firstPayDate') }}\n minDate={new Date()}\n />\n <Fields.AnchorEndOfPayPeriod\n label={t('labels.firstPayPeriodEndDate')}\n description={t('descriptions.anchorEndOfPayPeriodDescription')}\n validationMessages={{ REQUIRED: t('validations.firstPayPeriodEndDate') }}\n />\n {Fields.Day1 && (\n <Fields.Day1\n label={t('labels.firstPayDayOfTheMonth')}\n validationMessages={{\n REQUIRED: t('validations.firstPayDayOfTheMonth'),\n DAY_RANGE: t('validations.dayRange'),\n }}\n />\n )}\n {Fields.Day2 && (\n <Fields.Day2\n label={t('labels.lastPayDayOfTheMonth')}\n validationMessages={{\n REQUIRED: t('validations.lastPayDayOfTheMonth'),\n DAY_RANGE: t('validations.dayRange'),\n }}\n />\n )}\n {Fields.WorkweekStartDay && (\n <Fields.WorkweekStartDay\n label={t('labels.workweekStartDay')}\n placeholder={t('labels.workweekStartDayPlaceholder')}\n description={t('descriptions.workweekStartDayDescription')}\n getOptionLabel={(entry: PayScheduleWorkweekStartDay) =>\n workweekStartDayLabels[entry]\n }\n />\n )}\n </Flex>\n </div>\n <Flex flexDirection=\"column\" gap={4} justifyContent=\"center\" alignItems=\"center\">\n {payPeriodPreview && payPeriodPreview[selectedPayPeriodIndex] ? (\n <div className={style.calendarContainer}>\n {!payPreviewLoading && (\n <Components.Select\n label={t('labels.preview')}\n placeholder=\"\"\n isRequired\n options={payPeriodPreview.map((period, index) => ({\n value: String(index),\n label: dateFormatter.formatPayPeriodRange(\n period.startDate.toString(),\n period.endDate.toString(),\n ),\n }))}\n value={String(selectedPayPeriodIndex)}\n onChange={(value: string) => {\n const numericValue = Number(value)\n if (!isNaN(numericValue)) {\n setSelectedPayPeriodIndex(numericValue)\n }\n }}\n />\n )}\n <Components.CalendarPreview\n key={selectedPayPeriodIndex}\n dateRange={{\n start: toLocalDate(payPeriodPreview[selectedPayPeriodIndex].startDate),\n end: toLocalDate(payPeriodPreview[selectedPayPeriodIndex].endDate),\n label: t('payPreview.payPeriod') || 'Pay Period',\n }}\n highlightDates={[\n {\n date: toLocalDate(payPeriodPreview[selectedPayPeriodIndex].checkDate),\n highlightColor: 'primary',\n label: t('payPreview.payday') || 'Payday',\n },\n {\n date: toLocalDate(\n payPeriodPreview[selectedPayPeriodIndex].runPayrollBy,\n ),\n highlightColor: 'secondary',\n label: t('payPreview.payrollDeadline') || 'Payroll Deadline',\n },\n ]}\n />\n </div>\n ) : (\n <div className={style.calendarContainer}>\n <Components.Alert\n status=\"info\"\n label={t('previewAlert.title', 'Pay Schedule Preview')}\n >\n <Components.Text>\n {t(\n 'previewAlert.description',\n 'Complete all the required fields on the left to see a preview of your pay schedule.',\n )}\n </Components.Text>\n </Components.Alert>\n </div>\n )}\n </Flex>\n </Grid>\n </div>\n <ActionsLayout>\n <Components.Button\n variant=\"secondary\"\n onClick={() => {\n onEvent(componentEvents.CANCEL)\n }}\n >\n {t('actions.cancel')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={paySchedule.status.isPending}>\n {t('actions.save')}\n </Components.Button>\n </ActionsLayout>\n </Flex>\n </Form>\n </SDKFormProvider>\n </BaseLayout>\n )\n}\n"],"names":["toLocalDate","rfcDate","normalizeToDate","PayScheduleForm","onEvent","LoaderComponent","hookProps","jsx","BaseBoundaries","PayScheduleFormRoot","t","useTranslation","Components","useComponentContext","dateFormatter","useDateFormatter","paySchedule","usePayScheduleForm","selectedPayPeriodIndex","setSelectedPayPeriodIndex","useState","BaseLayout","handleSubmit","result","componentEvents","Fields","paymentSpeedDays","payPreviewLoading","payPeriodPreview","frequencyLabels","twicePerMonthLabels","workweekStartDayLabels","SDKFormProvider","Form","jsxs","Flex","style","Grid","entry","period","index","value","numericValue","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;AA6BA,MAAMA,IAAc,CAACC,MAA0CC,EAAgBD,EAAQ,UAAU;AAG1F,SAASE,GAAgB,EAAE,SAAAC,GAAS,iBAAAC,GAAiB,GAAGC,KAAmC;AAChG,SACE,gBAAAC,EAACC,GAAA,EAAe,eAAc,2BAA0B,iBAAAH,GACtD,UAAA,gBAAAE,EAACE,GAAA,EAAoB,SAAAL,GAAkB,iBAAAC,GAAmC,GAAGC,EAAA,CAAW,EAAA,CAC1F;AAEJ;AAEA,SAASG,EAAoB,EAAE,SAAAL,GAAS,iBAAAC,GAAiB,GAAGC,KAAmC;AAC7F,QAAM,EAAE,GAAAI,EAAA,IAAMC,EAAe,qBA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E3C,gBAAgB;AAAA,gBAChB,OAAOR,EAAE,4BAA4B,KAAK;AAAA,cAAA;AAAA,YAC5C;AAAA,UACF;AAAA,UAnBKQ;AAAA,QAAA;AAAA,MAoBP,GACF,IAEA,gBAAAX,EAAC,OAAA,EAAI,WAAW6B,EAAM,mBACpB,UAAA,gBAAA7B;AAAA,QAACK,EAAW;AAAA,QAAX;AAAA,UACC,QAAO;AAAA,UACP,OAAOF,EAAE,sBAAsB,sBAAsB;AAAA,UAErD,UAAA,gBAAAH,EAACK,EAAW,MAAX,EACE,UAAAF;AAAA,YACC;AAAA,YACA;AAAA,UAAA,EACF,CACF;AAAA,QAAA;AAAA,MAAA,GAEJ,EAAA,CAEJ;AAAA,IAAA,EAAA,CACF,EAAA,CACF;AAAA,sBACCiC,GAAA,EACC,UAAA;AAAA,MAAA,gBAAApC;AAAA,QAACK,EAAW;AAAA,QAAX;AAAA,UACC,SAAQ;AAAA,UACR,SAAS,MAAM;AACb,YAAAR,EAAQoB,EAAgB,MAAM;AAAA,UAChC;AAAA,UAEC,YAAE,gBAAgB;AAAA,QAAA;AAAA,MAAA;AAAA,MAErB,gBAAAjB,EAACK,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWI,EAAY,OAAO,WAC5D,UAAAN,EAAE,cAAc,EAAA,CACnB;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
|
|
@@ -1,37 +1,41 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { SelectHookField as n } from "../../../../../partner-hook-utils/form/fields/SelectHookField.js";
|
|
3
|
+
import { NumberInputHookField as r } from "../../../../../partner-hook-utils/form/fields/NumberInputHookField.js";
|
|
4
|
+
import { DatePickerHookField as t } from "../../../../../partner-hook-utils/form/fields/DatePickerHookField.js";
|
|
5
|
+
import { RadioGroupHookField as i } from "../../../../../partner-hook-utils/form/fields/RadioGroupHookField.js";
|
|
6
6
|
import { TextInputHookField as m } from "../../../../../partner-hook-utils/form/fields/TextInputHookField.js";
|
|
7
7
|
function F(e) {
|
|
8
8
|
return /* @__PURE__ */ o(m, { ...e, name: "customName" });
|
|
9
9
|
}
|
|
10
|
-
function p(e) {
|
|
11
|
-
return /* @__PURE__ */ o(i, { ...e, name: "frequency" });
|
|
12
|
-
}
|
|
13
10
|
function y(e) {
|
|
14
|
-
return /* @__PURE__ */ o(
|
|
11
|
+
return /* @__PURE__ */ o(n, { ...e, name: "frequency" });
|
|
12
|
+
}
|
|
13
|
+
function k(e) {
|
|
14
|
+
return /* @__PURE__ */ o(i, { ...e, name: "customTwicePerMonth" });
|
|
15
|
+
}
|
|
16
|
+
function p(e) {
|
|
17
|
+
return /* @__PURE__ */ o(t, { ...e, name: "anchorPayDate" });
|
|
15
18
|
}
|
|
16
19
|
function P(e) {
|
|
17
|
-
return /* @__PURE__ */ o(
|
|
20
|
+
return /* @__PURE__ */ o(t, { ...e, name: "anchorEndOfPayPeriod" });
|
|
18
21
|
}
|
|
19
|
-
function
|
|
20
|
-
return /* @__PURE__ */ o(r, { ...e, name: "
|
|
22
|
+
function D(e) {
|
|
23
|
+
return /* @__PURE__ */ o(r, { ...e, name: "day1", min: 1, max: 31 });
|
|
21
24
|
}
|
|
22
|
-
function
|
|
23
|
-
return /* @__PURE__ */ o(
|
|
25
|
+
function h(e) {
|
|
26
|
+
return /* @__PURE__ */ o(r, { ...e, name: "day2", min: 1, max: 31 });
|
|
24
27
|
}
|
|
25
28
|
function s(e) {
|
|
26
|
-
return /* @__PURE__ */ o(n, { ...e, name: "
|
|
29
|
+
return /* @__PURE__ */ o(n, { ...e, name: "workweekStartDay" });
|
|
27
30
|
}
|
|
28
31
|
export {
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
P as AnchorEndOfPayPeriodField,
|
|
33
|
+
p as AnchorPayDateField,
|
|
31
34
|
F as CustomNameField,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
k as CustomTwicePerMonthField,
|
|
36
|
+
D as Day1Field,
|
|
37
|
+
h as Day2Field,
|
|
38
|
+
y as FrequencyField,
|
|
39
|
+
s as WorkweekStartDayField
|
|
36
40
|
};
|
|
37
41
|
//# sourceMappingURL=fields.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fields.js","sources":["../../../../../../src/components/Company/PaySchedule/shared/usePayScheduleForm/fields.tsx"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"fields.js","sources":["../../../../../../src/components/Company/PaySchedule/shared/usePayScheduleForm/fields.tsx"],"sourcesContent":["import type {\n PayScheduleErrorCodes,\n PayScheduleFrequency,\n PayScheduleWorkweekStartDay,\n} from './payScheduleSchema'\nimport type { TextInputHookFieldProps } from '@/partner-hook-utils/form/fields/TextInputHookField'\nimport type { SelectHookFieldProps } from '@/partner-hook-utils/form/fields/SelectHookField'\nimport type { RadioGroupHookFieldProps } from '@/partner-hook-utils/form/fields/RadioGroupHookField'\nimport type { DatePickerHookFieldProps } from '@/partner-hook-utils/form/fields/DatePickerHookField'\nimport type { NumberInputHookFieldProps } from '@/partner-hook-utils/form/fields/NumberInputHookField'\nimport {\n TextInputHookField,\n SelectHookField,\n RadioGroupHookField,\n DatePickerHookField,\n NumberInputHookField,\n} from '@/partner-hook-utils/form/fields'\nimport type { HookFieldProps } from '@/partner-hook-utils/types'\n\n/**\n * The required-field error code produced by {@link usePayScheduleForm} fields that only emit `REQUIRED`.\n *\n * @remarks\n * Used as the `validationMessages` key for the custom name, frequency, anchor\n * pay date, and anchor end-of-pay-period fields. See {@link PayScheduleErrorCodes}.\n *\n * @public\n */\nexport type RequiredValidation = typeof PayScheduleErrorCodes.REQUIRED\n\n/**\n * Validation error codes emitted by the `day1` and `day2` fields of {@link usePayScheduleForm}.\n *\n * @remarks\n * Use these as keys in `validationMessages` on `Fields.Day1` and `Fields.Day2`.\n * See {@link PayScheduleErrorCodes}.\n *\n * @public\n */\nexport type DayValidation = (typeof PayScheduleErrorCodes)['REQUIRED' | 'DAY_RANGE']\n\n/**\n * Props accepted by {@link usePayScheduleForm}'s `Fields.CustomName` component.\n *\n * @public\n */\nexport type CustomNameFieldProps = HookFieldProps<TextInputHookFieldProps<RequiredValidation>>\n\n/** @internal */\nexport function CustomNameField(props: CustomNameFieldProps) {\n return <TextInputHookField {...props} name=\"customName\" />\n}\n\n/**\n * Props accepted by {@link usePayScheduleForm}'s `Fields.Frequency` component.\n *\n * @public\n */\nexport type FrequencyFieldProps = HookFieldProps<\n SelectHookFieldProps<RequiredValidation, PayScheduleFrequency>\n>\n\n/** @internal */\nexport function FrequencyField(props: FrequencyFieldProps) {\n return <SelectHookField {...props} name=\"frequency\" />\n}\n\n/**\n * Props accepted by {@link usePayScheduleForm}'s `Fields.CustomTwicePerMonth` component.\n *\n * @public\n */\nexport type CustomTwicePerMonthFieldProps = HookFieldProps<\n RadioGroupHookFieldProps<RequiredValidation, string>\n>\n\n/** @internal */\nexport function CustomTwicePerMonthField(props: CustomTwicePerMonthFieldProps) {\n return <RadioGroupHookField {...props} name=\"customTwicePerMonth\" />\n}\n\n/**\n * Props accepted by {@link usePayScheduleForm}'s `Fields.AnchorPayDate` component.\n *\n * @public\n */\nexport type AnchorPayDateFieldProps = HookFieldProps<DatePickerHookFieldProps<RequiredValidation>>\n\n/** @internal */\nexport function AnchorPayDateField(props: AnchorPayDateFieldProps) {\n return <DatePickerHookField {...props} name=\"anchorPayDate\" />\n}\n\n/**\n * Props accepted by {@link usePayScheduleForm}'s `Fields.AnchorEndOfPayPeriod` component.\n *\n * @public\n */\nexport type AnchorEndOfPayPeriodFieldProps = HookFieldProps<\n DatePickerHookFieldProps<RequiredValidation>\n>\n\n/** @internal */\nexport function AnchorEndOfPayPeriodField(props: AnchorEndOfPayPeriodFieldProps) {\n return <DatePickerHookField {...props} name=\"anchorEndOfPayPeriod\" />\n}\n\n/**\n * Props accepted by {@link usePayScheduleForm}'s `Fields.Day1` component.\n *\n * @public\n */\nexport type Day1FieldProps = HookFieldProps<NumberInputHookFieldProps<DayValidation>>\n\n/** @internal */\nexport function Day1Field(props: Day1FieldProps) {\n return <NumberInputHookField {...props} name=\"day1\" min={1} max={31} />\n}\n\n/**\n * Props accepted by {@link usePayScheduleForm}'s `Fields.Day2` component.\n *\n * @public\n */\nexport type Day2FieldProps = HookFieldProps<NumberInputHookFieldProps<DayValidation>>\n\n/** @internal */\nexport function Day2Field(props: Day2FieldProps) {\n return <NumberInputHookField {...props} name=\"day2\" min={1} max={31} />\n}\n\n/**\n * Props accepted by {@link usePayScheduleForm}'s `Fields.WorkweekStartDay` component.\n *\n * @alpha\n */\nexport type WorkweekStartDayFieldProps = HookFieldProps<\n SelectHookFieldProps<never, PayScheduleWorkweekStartDay>\n>\n\n/** @internal */\nexport function WorkweekStartDayField(props: WorkweekStartDayFieldProps) {\n return <SelectHookField {...props} name=\"workweekStartDay\" />\n}\n"],"names":["CustomNameField","props","jsx","TextInputHookField","FrequencyField","SelectHookField","CustomTwicePerMonthField","RadioGroupHookField","AnchorPayDateField","DatePickerHookField","AnchorEndOfPayPeriodField","Day1Field","NumberInputHookField","Day2Field","WorkweekStartDayField"],"mappings":";;;;;;AAiDO,SAASA,EAAgBC,GAA6B;AAC3D,SAAO,gBAAAC,EAACC,GAAA,EAAoB,GAAGF,GAAO,MAAK,cAAa;AAC1D;AAYO,SAASG,EAAeH,GAA4B;AACzD,SAAO,gBAAAC,EAACG,GAAA,EAAiB,GAAGJ,GAAO,MAAK,aAAY;AACtD;AAYO,SAASK,EAAyBL,GAAsC;AAC7E,SAAO,gBAAAC,EAACK,GAAA,EAAqB,GAAGN,GAAO,MAAK,uBAAsB;AACpE;AAUO,SAASO,EAAmBP,GAAgC;AACjE,SAAO,gBAAAC,EAACO,GAAA,EAAqB,GAAGR,GAAO,MAAK,iBAAgB;AAC9D;AAYO,SAASS,EAA0BT,GAAuC;AAC/E,SAAO,gBAAAC,EAACO,GAAA,EAAqB,GAAGR,GAAO,MAAK,wBAAuB;AACrE;AAUO,SAASU,EAAUV,GAAuB;AAC/C,SAAO,gBAAAC,EAACU,KAAsB,GAAGX,GAAO,MAAK,QAAO,KAAK,GAAG,KAAK,GAAA,CAAI;AACvE;AAUO,SAASY,EAAUZ,GAAuB;AAC/C,SAAO,gBAAAC,EAACU,KAAsB,GAAGX,GAAO,MAAK,QAAO,KAAK,GAAG,KAAK,GAAA,CAAI;AACvE;AAYO,SAASa,EAAsBb,GAAmC;AACvE,SAAO,gBAAAC,EAACG,GAAA,EAAiB,GAAGJ,GAAO,MAAK,oBAAmB;AAC7D;"}
|
|
@@ -1,57 +1,61 @@
|
|
|
1
1
|
import { z as o } from "zod";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import { WorkweekStartDay as m } from "@gusto/embedded-api/models/components/payschedulecreaterequest";
|
|
3
|
+
import { buildFormSchema as a } from "../../../../../partner-hook-utils/form/buildFormSchema.js";
|
|
4
|
+
import { coerceNaN as c, coerceToISODate as s } from "../../../../../partner-hook-utils/form/preprocessors.js";
|
|
5
|
+
const t = {
|
|
5
6
|
REQUIRED: "REQUIRED",
|
|
6
7
|
DAY_RANGE: "DAY_RANGE"
|
|
7
|
-
},
|
|
8
|
+
}, d = ["Every week", "Every other week", "Twice per month", "Monthly"], y = {
|
|
8
9
|
customName: o.string(),
|
|
9
|
-
frequency: o.enum(
|
|
10
|
+
frequency: o.enum(d),
|
|
10
11
|
customTwicePerMonth: o.string(),
|
|
11
|
-
anchorPayDate: o.preprocess(
|
|
12
|
-
anchorEndOfPayPeriod: o.preprocess(
|
|
13
|
-
day1: o.preprocess(
|
|
14
|
-
day2: o.preprocess(
|
|
12
|
+
anchorPayDate: o.preprocess(s, o.iso.date().nullable()),
|
|
13
|
+
anchorEndOfPayPeriod: o.preprocess(s, o.iso.date().nullable()),
|
|
14
|
+
day1: o.preprocess(c(0), o.number()),
|
|
15
|
+
day2: o.preprocess(c(0), o.number()),
|
|
16
|
+
workweekStartDay: o.enum(m).nullable()
|
|
15
17
|
};
|
|
16
|
-
function
|
|
18
|
+
function E(e) {
|
|
17
19
|
return e.frequency === "Twice per month";
|
|
18
20
|
}
|
|
19
21
|
function u(e) {
|
|
20
|
-
const r = e.frequency,
|
|
21
|
-
return r === "Monthly" || r === "Twice per month" &&
|
|
22
|
+
const r = e.frequency, n = e.customTwicePerMonth;
|
|
23
|
+
return r === "Monthly" || r === "Twice per month" && n === "custom";
|
|
22
24
|
}
|
|
23
25
|
function i(e) {
|
|
24
|
-
const r = e.frequency,
|
|
25
|
-
return r === "Twice per month" &&
|
|
26
|
+
const r = e.frequency, n = e.customTwicePerMonth;
|
|
27
|
+
return r === "Twice per month" && n === "custom";
|
|
26
28
|
}
|
|
27
|
-
const
|
|
28
|
-
customTwicePerMonth:
|
|
29
|
+
const f = {
|
|
30
|
+
customTwicePerMonth: E,
|
|
29
31
|
day1: u,
|
|
30
|
-
day2: i
|
|
32
|
+
day2: i,
|
|
33
|
+
// Optional by default: legacy pay schedules have no value to force.
|
|
34
|
+
workweekStartDay: "never"
|
|
31
35
|
};
|
|
32
|
-
function
|
|
36
|
+
function p(e, r) {
|
|
33
37
|
u(e) && (e.day1 < 1 || e.day1 > 31) && r.addIssue({
|
|
34
38
|
code: o.ZodIssueCode.custom,
|
|
35
39
|
path: ["day1"],
|
|
36
|
-
message: e.day1 < 1 ?
|
|
40
|
+
message: e.day1 < 1 ? t.REQUIRED : t.DAY_RANGE
|
|
37
41
|
}), i(e) && (e.day2 < 1 || e.day2 > 31) && r.addIssue({
|
|
38
42
|
code: o.ZodIssueCode.custom,
|
|
39
43
|
path: ["day2"],
|
|
40
|
-
message: e.day2 < 1 ?
|
|
44
|
+
message: e.day2 < 1 ? t.REQUIRED : t.DAY_RANGE
|
|
41
45
|
});
|
|
42
46
|
}
|
|
43
|
-
function
|
|
44
|
-
const { mode: r = "create", optionalFieldsToRequire:
|
|
45
|
-
return
|
|
46
|
-
requiredFieldsConfig:
|
|
47
|
-
requiredErrorCode:
|
|
47
|
+
function w(e = {}) {
|
|
48
|
+
const { mode: r = "create", optionalFieldsToRequire: n } = e;
|
|
49
|
+
return a(y, {
|
|
50
|
+
requiredFieldsConfig: f,
|
|
51
|
+
requiredErrorCode: t.REQUIRED,
|
|
48
52
|
mode: r,
|
|
49
|
-
optionalFieldsToRequire:
|
|
50
|
-
superRefine:
|
|
53
|
+
optionalFieldsToRequire: n,
|
|
54
|
+
superRefine: p
|
|
51
55
|
});
|
|
52
56
|
}
|
|
53
57
|
export {
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
t as PayScheduleErrorCodes,
|
|
59
|
+
w as createPayScheduleSchema
|
|
56
60
|
};
|
|
57
61
|
//# sourceMappingURL=payScheduleSchema.js.map
|
package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/payScheduleSchema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payScheduleSchema.js","sources":["../../../../../../src/components/Company/PaySchedule/shared/usePayScheduleForm/payScheduleSchema.ts"],"sourcesContent":["import { z } from 'zod'\nimport {\n buildFormSchema,\n type RequiredFieldConfig,\n type OptionalFieldsToRequire,\n} from '@/partner-hook-utils/form/buildFormSchema'\nimport { coerceNaN, coerceToISODate } from '@/partner-hook-utils/form/preprocessors'\n\n// ── Error codes ────────────────────────────────────────────────────────\n\n/**\n * Validation error codes emitted by {@link usePayScheduleForm} fields.\n *\n * @remarks\n * Use these as `validationMessages` keys on the corresponding `Fields.*` components.\n *\n * @public\n */\nexport const PayScheduleErrorCodes = {\n REQUIRED: 'REQUIRED',\n DAY_RANGE: 'DAY_RANGE',\n} as const\n\n/**\n * Union of validation error code strings emitted by the pay schedule form.\n *\n * @public\n */\nexport type PayScheduleErrorCode =\n (typeof PayScheduleErrorCodes)[keyof typeof PayScheduleErrorCodes]\n\n// ── Field validators ───────────────────────────────────────────────────\n\nconst FREQUENCY_VALUES = ['Every week', 'Every other week', 'Twice per month', 'Monthly'] as const\n/**\n * Pay schedule frequency values accepted by {@link usePayScheduleForm}.\n *\n * @public\n */\nexport type PayScheduleFrequency = (typeof FREQUENCY_VALUES)[number]\n\nconst fieldValidators = {\n customName: z.string(),\n frequency: z.enum(FREQUENCY_VALUES),\n customTwicePerMonth: z.string(),\n anchorPayDate: z.preprocess(coerceToISODate, z.iso.date().nullable()),\n anchorEndOfPayPeriod: z.preprocess(coerceToISODate, z.iso.date().nullable()),\n day1: z.preprocess(coerceNaN(0), z.number()),\n day2: z.preprocess(coerceNaN(0), z.number()),\n}\n\n/**\n * Union of field names managed by the pay schedule form.\n *\n * @public\n */\nexport type PayScheduleField = keyof typeof fieldValidators\n\n/**\n * Shape of the values managed by the pay schedule form.\n *\n * @public\n * @interface\n */\nexport type PayScheduleFormData = {\n [K in keyof typeof fieldValidators]: z.infer<(typeof fieldValidators)[K]>\n}\n/** @internal */\nexport type PayScheduleFormOutputs = PayScheduleFormData\n\n// ── Required fields config ─────────────────────────────────────────────\n\nfunction needsCustomTwicePerMonth(data: PayScheduleFormData): boolean {\n return data.frequency === 'Twice per month'\n}\n\nfunction needsDay1(data: PayScheduleFormData): boolean {\n const freq = data.frequency\n const custom = data.customTwicePerMonth\n return freq === 'Monthly' || (freq === 'Twice per month' && custom === 'custom')\n}\n\nfunction needsDay2(data: PayScheduleFormData): boolean {\n const freq = data.frequency\n const custom = data.customTwicePerMonth\n return freq === 'Twice per month' && custom === 'custom'\n}\n\nconst requiredFieldsConfig = {\n customTwicePerMonth: needsCustomTwicePerMonth,\n day1: needsDay1,\n day2: needsDay2,\n} satisfies RequiredFieldConfig<typeof fieldValidators>\n\n/**\n * coerceNaN(0) maps empty inputs to 0, which `isEmpty` does not catch\n * (it only recognizes undefined/null/blank-string). This superRefine\n * enforces the 1–31 range when the field is applicable, which also\n * rejects the 0 sentinel from empty inputs.\n */\nfunction validateDayRanges(data: PayScheduleFormData, ctx: z.RefinementCtx) {\n if (needsDay1(data) && (data.day1 < 1 || data.day1 > 31)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['day1'],\n message: data.day1 < 1 ? PayScheduleErrorCodes.REQUIRED : PayScheduleErrorCodes.DAY_RANGE,\n })\n }\n if (needsDay2(data) && (data.day2 < 1 || data.day2 > 31)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['day2'],\n message: data.day2 < 1 ? PayScheduleErrorCodes.REQUIRED : PayScheduleErrorCodes.DAY_RANGE,\n })\n }\n}\n\n// ── Schema factory ─────────────────────────────────────────────────────\n\n/**\n * Configuration for promoting optional pay schedule fields to required in a given mode.\n *\n * @remarks\n * Only fields that are optional by default can be promoted
|
|
1
|
+
{"version":3,"file":"payScheduleSchema.js","sources":["../../../../../../src/components/Company/PaySchedule/shared/usePayScheduleForm/payScheduleSchema.ts"],"sourcesContent":["import { z } from 'zod'\nimport { WorkweekStartDay } from '@gusto/embedded-api/models/components/payschedulecreaterequest'\nimport {\n buildFormSchema,\n type RequiredFieldConfig,\n type OptionalFieldsToRequire,\n} from '@/partner-hook-utils/form/buildFormSchema'\nimport { coerceNaN, coerceToISODate } from '@/partner-hook-utils/form/preprocessors'\n\n// ── Error codes ────────────────────────────────────────────────────────\n\n/**\n * Validation error codes emitted by {@link usePayScheduleForm} fields.\n *\n * @remarks\n * Use these as `validationMessages` keys on the corresponding `Fields.*` components.\n *\n * @public\n */\nexport const PayScheduleErrorCodes = {\n REQUIRED: 'REQUIRED',\n DAY_RANGE: 'DAY_RANGE',\n} as const\n\n/**\n * Union of validation error code strings emitted by the pay schedule form.\n *\n * @public\n */\nexport type PayScheduleErrorCode =\n (typeof PayScheduleErrorCodes)[keyof typeof PayScheduleErrorCodes]\n\n// ── Field validators ───────────────────────────────────────────────────\n\nconst FREQUENCY_VALUES = ['Every week', 'Every other week', 'Twice per month', 'Monthly'] as const\n/**\n * Pay schedule frequency values accepted by {@link usePayScheduleForm}.\n *\n * @public\n */\nexport type PayScheduleFrequency = (typeof FREQUENCY_VALUES)[number]\n\n/**\n * Pay schedule workweek start day values accepted by {@link usePayScheduleForm}.\n *\n * @alpha\n */\nexport type PayScheduleWorkweekStartDay = WorkweekStartDay\n\nconst fieldValidators = {\n customName: z.string(),\n frequency: z.enum(FREQUENCY_VALUES),\n customTwicePerMonth: z.string(),\n anchorPayDate: z.preprocess(coerceToISODate, z.iso.date().nullable()),\n anchorEndOfPayPeriod: z.preprocess(coerceToISODate, z.iso.date().nullable()),\n day1: z.preprocess(coerceNaN(0), z.number()),\n day2: z.preprocess(coerceNaN(0), z.number()),\n workweekStartDay: z.enum(WorkweekStartDay).nullable(),\n}\n\n/**\n * Union of field names managed by the pay schedule form.\n *\n * @public\n */\nexport type PayScheduleField = keyof typeof fieldValidators\n\n/**\n * Shape of the values managed by the pay schedule form.\n *\n * @public\n * @interface\n */\nexport type PayScheduleFormData = {\n [K in keyof typeof fieldValidators]: z.infer<(typeof fieldValidators)[K]>\n}\n/** @internal */\nexport type PayScheduleFormOutputs = PayScheduleFormData\n\n// ── Required fields config ─────────────────────────────────────────────\n\nfunction needsCustomTwicePerMonth(data: PayScheduleFormData): boolean {\n return data.frequency === 'Twice per month'\n}\n\nfunction needsDay1(data: PayScheduleFormData): boolean {\n const freq = data.frequency\n const custom = data.customTwicePerMonth\n return freq === 'Monthly' || (freq === 'Twice per month' && custom === 'custom')\n}\n\nfunction needsDay2(data: PayScheduleFormData): boolean {\n const freq = data.frequency\n const custom = data.customTwicePerMonth\n return freq === 'Twice per month' && custom === 'custom'\n}\n\nconst requiredFieldsConfig = {\n customTwicePerMonth: needsCustomTwicePerMonth,\n day1: needsDay1,\n day2: needsDay2,\n // Optional by default: legacy pay schedules have no value to force.\n workweekStartDay: 'never',\n} satisfies RequiredFieldConfig<typeof fieldValidators>\n\n/**\n * coerceNaN(0) maps empty inputs to 0, which `isEmpty` does not catch\n * (it only recognizes undefined/null/blank-string). This superRefine\n * enforces the 1–31 range when the field is applicable, which also\n * rejects the 0 sentinel from empty inputs.\n */\nfunction validateDayRanges(data: PayScheduleFormData, ctx: z.RefinementCtx) {\n if (needsDay1(data) && (data.day1 < 1 || data.day1 > 31)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['day1'],\n message: data.day1 < 1 ? PayScheduleErrorCodes.REQUIRED : PayScheduleErrorCodes.DAY_RANGE,\n })\n }\n if (needsDay2(data) && (data.day2 < 1 || data.day2 > 31)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['day2'],\n message: data.day2 < 1 ? PayScheduleErrorCodes.REQUIRED : PayScheduleErrorCodes.DAY_RANGE,\n })\n }\n}\n\n// ── Schema factory ─────────────────────────────────────────────────────\n\n/**\n * Configuration for promoting optional pay schedule fields to required in a given mode.\n *\n * @remarks\n * Only fields that are optional by default can be promoted:\n * `customTwicePerMonth`, `day1`, `day2`, and `workweekStartDay`.\n *\n * @public\n */\nexport type PayScheduleOptionalFieldsToRequire = OptionalFieldsToRequire<\n typeof requiredFieldsConfig\n>\n\n/** @internal */\ninterface PayScheduleSchemaOptions {\n mode?: 'create' | 'update'\n optionalFieldsToRequire?: PayScheduleOptionalFieldsToRequire\n}\n\n/** @internal */\nexport function createPayScheduleSchema(options: PayScheduleSchemaOptions = {}) {\n const { mode = 'create', optionalFieldsToRequire } = options\n\n return buildFormSchema(fieldValidators, {\n requiredFieldsConfig,\n requiredErrorCode: PayScheduleErrorCodes.REQUIRED,\n mode,\n optionalFieldsToRequire,\n superRefine: validateDayRanges,\n })\n}\n"],"names":["PayScheduleErrorCodes","FREQUENCY_VALUES","fieldValidators","z","coerceToISODate","coerceNaN","WorkweekStartDay","needsCustomTwicePerMonth","data","needsDay1","freq","custom","needsDay2","requiredFieldsConfig","validateDayRanges","ctx","createPayScheduleSchema","options","mode","optionalFieldsToRequire","buildFormSchema"],"mappings":";;;;AAmBO,MAAMA,IAAwB;AAAA,EACnC,UAAU;AAAA,EACV,WAAW;AACb,GAYMC,IAAmB,CAAC,c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