@gusto/embedded-react-sdk 0.57.3 → 0.58.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 +88 -0
- package/dist/components/Common/DataView/DataCards/DataCards.js +98 -66
- package/dist/components/Common/DataView/DataCards/DataCards.js.map +1 -1
- package/dist/components/Common/DataView/DataCards/DataCards.module.scss.js +11 -9
- package/dist/components/Common/DataView/DataCards/DataCards.module.scss.js.map +1 -1
- package/dist/components/Common/DataView/DataTable/DataTable.js +86 -75
- package/dist/components/Common/DataView/DataTable/DataTable.js.map +1 -1
- package/dist/components/Common/DataView/DataView.js.map +1 -1
- package/dist/components/Common/DataView/getSortControls.js +22 -0
- package/dist/components/Common/DataView/getSortControls.js.map +1 -0
- package/dist/components/Common/DataView/useDataView.js +30 -24
- package/dist/components/Common/DataView/useDataView.js.map +1 -1
- package/dist/components/Common/UI/Table/Table.js +65 -25
- package/dist/components/Common/UI/Table/Table.js.map +1 -1
- package/dist/components/Common/UI/Table/Table.module.scss.js +8 -4
- package/dist/components/Common/UI/Table/Table.module.scss.js.map +1 -1
- package/dist/components/Common/UI/Table/TableTypes.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +3 -4
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +3 -4
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +5 -6
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +3 -4
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +3 -4
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +5 -6
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +6 -7
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +3 -4
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +3 -4
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +3 -4
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/PaySchedule.js +30 -45
- package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
- package/dist/components/Company/PaySchedule/PayScheduleComponents.js +11 -12
- package/dist/components/Company/PaySchedule/PayScheduleComponents.js.map +1 -1
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/fields.js.map +1 -1
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/payScheduleSchema.js.map +1 -1
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.js +78 -83
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +3 -4
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +3 -4
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/TaxRateManagement/context.js +3 -4
- package/dist/components/Company/StateTaxes/TaxRateManagement/context.js.map +1 -1
- package/dist/components/Contractor/Compensation/management/CompensationEditForm.js +45 -54
- package/dist/components/Contractor/Compensation/management/CompensationEditForm.js.map +1 -1
- package/dist/components/Contractor/Compensation/shared/useContractorPayForm/contractorPaySchema.js +17 -22
- package/dist/components/Contractor/Compensation/shared/useContractorPayForm/contractorPaySchema.js.map +1 -1
- package/dist/components/Contractor/ContractorList/management/ManagementContractorList.js +1 -0
- package/dist/components/Contractor/ContractorList/management/ManagementContractorList.js.map +1 -1
- package/dist/components/Contractor/ContractorList/management/ManagementContractorListView.js +122 -113
- package/dist/components/Contractor/ContractorList/management/ManagementContractorListView.js.map +1 -1
- package/dist/components/Contractor/ContractorList/shared/useContractorList.js +63 -54
- package/dist/components/Contractor/ContractorList/shared/useContractorList.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/onboarding/PaymentMethod.js +39 -48
- package/dist/components/Contractor/PaymentMethod/onboarding/PaymentMethod.js.map +1 -1
- package/dist/components/Contractor/Profile/onboarding/ContractorProfile.js +76 -69
- package/dist/components/Contractor/Profile/onboarding/ContractorProfile.js.map +1 -1
- package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/contractorDetailsSchema.js +27 -29
- package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/contractorDetailsSchema.js.map +1 -1
- package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/useContractorDetailsForm.js +14 -12
- package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/useContractorDetailsForm.js.map +1 -1
- package/dist/components/Contractor/shared/hourlyRate.js +14 -0
- package/dist/components/Contractor/shared/hourlyRate.js.map +1 -0
- package/dist/components/Employee/Compensation/management/CompensationCard/CompensationCard.js +63 -63
- package/dist/components/Employee/Compensation/management/CompensationCard/CompensationCard.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +3 -4
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/onboarding/ListView.js +65 -74
- package/dist/components/Employee/PaymentMethod/onboarding/ListView.js.map +1 -1
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.js +16 -16
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.js.map +1 -1
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +2 -3
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js +84 -82
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -1
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/getDefaultWithholdingPayPeriod.js +8 -0
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/getDefaultWithholdingPayPeriod.js.map +1 -0
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +91 -88
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +16 -16
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +146 -134
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.module.scss.js +14 -12
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.module.scss.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +34 -33
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields.js +49 -48
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js +0 -4
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollFlow.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js +51 -38
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js +121 -102
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollLanding/PayrollLanding.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollList.js +79 -74
- package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +92 -83
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +23 -27
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
- package/dist/components/Payroll/PrintChecks/PrintChecksForm/PrintChecksForm.js +82 -75
- package/dist/components/Payroll/PrintChecks/PrintChecksForm/PrintChecksForm.js.map +1 -1
- package/dist/components/Payroll/RropPayrollEditEmployee/RropPayrollEditEmployee.js +416 -0
- package/dist/components/Payroll/RropPayrollEditEmployee/RropPayrollEditEmployee.js.map +1 -0
- package/dist/components/Payroll/{UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.module.scss.js → RropPayrollEditEmployee/RropPayrollEditEmployee.module.scss.js} +1 -1
- package/dist/components/Payroll/RropPayrollEditEmployee/RropPayrollEditEmployee.module.scss.js.map +1 -0
- package/dist/components/Payroll/TransitionConfiguration/TransitionConfiguration.js +97 -0
- package/dist/components/Payroll/TransitionConfiguration/TransitionConfiguration.js.map +1 -0
- package/dist/components/Payroll/TransitionConfiguration/TransitionConfigurationPresentation.js +106 -0
- package/dist/components/Payroll/TransitionConfiguration/TransitionConfigurationPresentation.js.map +1 -0
- package/dist/components/Payroll/{TransitionCreation/TransitionCreationPresentation.module.scss.js → TransitionConfiguration/TransitionConfigurationPresentation.module.scss.js} +1 -1
- package/dist/components/Payroll/TransitionConfiguration/TransitionConfigurationPresentation.module.scss.js.map +1 -0
- package/dist/components/Payroll/TransitionConfiguration/TransitionConfigurationTypes.js +10 -0
- package/dist/components/Payroll/TransitionConfiguration/TransitionConfigurationTypes.js.map +1 -0
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.js +86 -64
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.js.map +1 -1
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.js +126 -77
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.js.map +1 -1
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.module.scss.js +8 -0
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.module.scss.js.map +1 -0
- package/dist/components/Payroll/index.js +16 -20
- package/dist/components/Payroll/index.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +2 -3
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/components/Payroll/useUnprocessedTransitionPayPeriods.js +11 -14
- package/dist/components/Payroll/useUnprocessedTransitionPayPeriods.js.map +1 -1
- package/dist/contexts/ApiProvider/ApiProvider.js +18 -17
- package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -1
- package/dist/contexts/ApiProvider/payScheduleCustomNameHook.js +31 -0
- package/dist/contexts/ApiProvider/payScheduleCustomNameHook.js.map +1 -0
- package/dist/contexts/FeaturesProvider/FeaturesProvider.js +14 -0
- package/dist/contexts/FeaturesProvider/FeaturesProvider.js.map +1 -0
- package/dist/contexts/FeaturesProvider/useFeature.js +7 -0
- package/dist/contexts/FeaturesProvider/useFeature.js.map +1 -0
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +32 -30
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/contexts/UnstableFeaturesProvider/useUnstableFeature.js.map +1 -1
- package/dist/i18n/I18n.js +2 -3
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Contractor.Profile.json.js +1 -1
- package/dist/i18n/en/Payroll.PayrollEditEmployee.json.js +29 -23
- package/dist/i18n/en/Payroll.PayrollEditEmployee.json.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollLanding.json.js +1 -1
- package/dist/i18n/en/{Payroll.UNSTABLE_PayrollEditEmployee.json.js → Payroll.RropPayrollEditEmployee.json.js} +42 -38
- package/dist/i18n/en/Payroll.RropPayrollEditEmployee.json.js.map +1 -0
- package/dist/i18n/en/Payroll.TransitionConfiguration.json.js +28 -0
- package/dist/i18n/en/Payroll.TransitionConfiguration.json.js.map +1 -0
- package/dist/i18n/en/Payroll.TransitionPayrollAlert.json.js +16 -12
- package/dist/i18n/en/Payroll.TransitionPayrollAlert.json.js.map +1 -1
- package/dist/i18n/en/common.json.js +1 -1
- package/dist/package.json.js +1 -1
- package/dist/partner-hook-utils/form/composeSubmitHandler.js +55 -48
- package/dist/partner-hook-utils/form/composeSubmitHandler.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/RadioGroupHookField.js +31 -29
- package/dist/partner-hook-utils/form/fields/RadioGroupHookField.js.map +1 -1
- package/dist/shared/constants.js +2 -1
- package/dist/shared/constants.js.map +1 -1
- package/dist/src/components/Common/DataView/DataCards/DataCards.d.ts +3 -1
- package/dist/src/components/Common/DataView/DataTable/DataTable.d.ts +3 -1
- package/dist/src/components/Common/DataView/DataView.d.ts +2 -0
- package/dist/src/components/Common/DataView/getSortControls.d.ts +24 -0
- package/dist/src/components/Common/DataView/useDataView.d.ts +22 -1
- package/dist/src/components/Common/UI/Table/TableTypes.d.ts +71 -2
- package/dist/src/components/Company/PaySchedule/PaySchedule.d.ts +1 -9
- package/dist/src/components/Company/PaySchedule/PayScheduleComponents.d.ts +0 -1
- package/dist/src/components/Company/PaySchedule/shared/usePayScheduleForm/fields.d.ts +1 -1
- package/dist/src/components/Company/PaySchedule/shared/usePayScheduleForm/payScheduleSchema.d.ts +1 -1
- package/dist/src/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.d.ts +3 -14
- package/dist/src/components/Contractor/ContractorList/management/ManagementContractorListView.d.ts +2 -2
- package/dist/src/components/Contractor/ContractorList/shared/index.d.ts +1 -1
- package/dist/src/components/Contractor/ContractorList/shared/useContractorList.d.ts +38 -0
- package/dist/src/components/Contractor/shared/hourlyRate.d.ts +23 -0
- package/dist/src/components/Payroll/OffCycleTaxWithholdingTable/getDefaultWithholdingPayPeriod.d.ts +9 -0
- package/dist/src/components/Payroll/PayrollEditEmployee/TimeOffField.d.ts +3 -1
- package/dist/src/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields.d.ts +2 -0
- package/dist/src/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.d.ts +8 -6
- package/dist/src/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.d.ts +0 -8
- package/dist/src/components/Payroll/PayrollFlow/PayrollFlow.d.ts +5 -3
- package/dist/src/components/Payroll/PayrollFlow/PayrollFlowComponents.d.ts +2 -3
- package/dist/src/components/Payroll/PayrollFlow/payrollStateMachine.d.ts +1 -1
- package/dist/src/components/Payroll/PayrollLanding/PayrollLanding.d.ts +18 -5
- package/dist/src/components/Payroll/PayrollList/PayrollList.d.ts +11 -5
- package/dist/src/components/Payroll/{UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.d.ts → RropPayrollEditEmployee/RropPayrollEditEmployee.d.ts} +9 -5
- package/dist/src/components/Payroll/TransitionConfiguration/TransitionConfiguration.d.ts +55 -0
- package/dist/src/components/Payroll/TransitionConfiguration/TransitionConfigurationPresentation.d.ts +9 -0
- package/dist/src/components/Payroll/TransitionConfiguration/TransitionConfigurationTypes.d.ts +52 -0
- package/dist/src/components/Payroll/TransitionConfiguration/index.d.ts +2 -0
- package/dist/src/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.d.ts +5 -2
- package/dist/src/components/Payroll/index.d.ts +2 -6
- package/dist/src/contexts/ApiProvider/payScheduleCustomNameHook.d.ts +14 -0
- package/dist/src/contexts/ApiProvider/payScheduleCustomNameHook.test.d.ts +1 -0
- package/dist/src/contexts/ComponentAdapter/componentAdapterTypes.d.ts +1 -1
- package/dist/src/contexts/FeaturesProvider/FeaturesProvider.d.ts +21 -0
- package/dist/src/contexts/FeaturesProvider/useFeature.d.ts +53 -0
- package/dist/src/contexts/GustoProvider/GustoProviderCustomUIAdapter.d.ts +3 -0
- package/dist/src/contexts/UnstableFeaturesProvider/useUnstableFeature.d.ts +38 -10
- package/dist/src/contexts/index.d.ts +1 -0
- package/dist/src/i18n/en/common.json.d.ts +5 -1
- package/dist/src/i18n/types.d.ts +113 -66
- package/dist/src/partner-hook-utils/form/fields/RadioGroupHookField.d.ts +9 -7
- package/dist/src/shared/constants.d.ts +4 -2
- package/dist/src/test-utils/renderWithProviders.d.ts +2 -0
- package/dist/style.css +1 -1
- package/docs/guides/endpoint-inventory.json +24 -27
- package/package.json +15 -14
- package/dist/components/Payroll/PayrollFlow/TransitionFlowContextual.js +0 -29
- package/dist/components/Payroll/PayrollFlow/TransitionFlowContextual.js.map +0 -1
- package/dist/components/Payroll/Transition/TransitionFlow.js +0 -60
- package/dist/components/Payroll/Transition/TransitionFlow.js.map +0 -1
- package/dist/components/Payroll/Transition/TransitionFlowComponents.js +0 -31
- package/dist/components/Payroll/Transition/TransitionFlowComponents.js.map +0 -1
- package/dist/components/Payroll/Transition/transitionStateMachine.js +0 -49
- package/dist/components/Payroll/Transition/transitionStateMachine.js.map +0 -1
- package/dist/components/Payroll/TransitionCreation/TransitionCreation.js +0 -100
- package/dist/components/Payroll/TransitionCreation/TransitionCreation.js.map +0 -1
- package/dist/components/Payroll/TransitionCreation/TransitionCreationPresentation.js +0 -110
- package/dist/components/Payroll/TransitionCreation/TransitionCreationPresentation.js.map +0 -1
- package/dist/components/Payroll/TransitionCreation/TransitionCreationPresentation.module.scss.js.map +0 -1
- package/dist/components/Payroll/TransitionCreation/TransitionCreationTypes.js +0 -21
- package/dist/components/Payroll/TransitionCreation/TransitionCreationTypes.js.map +0 -1
- package/dist/components/Payroll/TransitionPayroll/TransitionPayroll.js +0 -48
- package/dist/components/Payroll/TransitionPayroll/TransitionPayroll.js.map +0 -1
- package/dist/components/Payroll/TransitionPayroll/TransitionPayrollComponents.js +0 -35
- package/dist/components/Payroll/TransitionPayroll/TransitionPayrollComponents.js.map +0 -1
- package/dist/components/Payroll/TransitionPayroll/transitionPayrollStateMachine.js +0 -23
- package/dist/components/Payroll/TransitionPayroll/transitionPayrollStateMachine.js.map +0 -1
- package/dist/components/Payroll/TransitionPayroll/useResolveTransitionPayroll.js +0 -29
- package/dist/components/Payroll/TransitionPayroll/useResolveTransitionPayroll.js.map +0 -1
- package/dist/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.js +0 -411
- package/dist/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.js.map +0 -1
- package/dist/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.module.scss.js.map +0 -1
- package/dist/i18n/en/Payroll.Transition.json.js +0 -8
- package/dist/i18n/en/Payroll.Transition.json.js.map +0 -1
- package/dist/i18n/en/Payroll.TransitionCreation.json.js +0 -26
- package/dist/i18n/en/Payroll.TransitionCreation.json.js.map +0 -1
- package/dist/i18n/en/Payroll.UNSTABLE_PayrollEditEmployee.json.js.map +0 -1
- package/dist/src/components/Payroll/PayrollFlow/TransitionFlowContextual.d.ts +0 -7
- package/dist/src/components/Payroll/Transition/TransitionFlow.d.ts +0 -55
- package/dist/src/components/Payroll/Transition/TransitionFlowComponents.d.ts +0 -52
- package/dist/src/components/Payroll/Transition/index.d.ts +0 -2
- package/dist/src/components/Payroll/Transition/transitionStateMachine.d.ts +0 -29
- package/dist/src/components/Payroll/TransitionCreation/TransitionCreation.d.ts +0 -22
- package/dist/src/components/Payroll/TransitionCreation/TransitionCreationPresentation.d.ts +0 -9
- package/dist/src/components/Payroll/TransitionCreation/TransitionCreationTypes.d.ts +0 -57
- package/dist/src/components/Payroll/TransitionCreation/index.d.ts +0 -2
- package/dist/src/components/Payroll/TransitionPayroll/TransitionPayroll.d.ts +0 -55
- package/dist/src/components/Payroll/TransitionPayroll/TransitionPayrollComponents.d.ts +0 -24
- package/dist/src/components/Payroll/TransitionPayroll/TransitionPayrollTypes.d.ts +0 -23
- package/dist/src/components/Payroll/TransitionPayroll/index.d.ts +0 -2
- package/dist/src/components/Payroll/TransitionPayroll/transitionPayrollStateMachine.d.ts +0 -15
- package/dist/src/components/Payroll/TransitionPayroll/useResolveTransitionPayroll.d.ts +0 -28
- /package/dist/src/components/{Payroll/Transition/transitionStateMachine.test.d.ts → Common/DataView/getSortControls.test.d.ts} +0 -0
package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { jsx as E } from "react/jsx-runtime";
|
|
2
|
-
import { MAX_HOURS as
|
|
2
|
+
import { MAX_HOURS as g, MAX_REIMBURSEMENT_AMOUNT as v } from "./payrollEditEmployeeSchema.js";
|
|
3
3
|
import { TextInputField as j } from "../../../../Common/Fields/TextInputField/TextInputField.js";
|
|
4
|
-
import { useFieldErrorMessage as
|
|
5
|
-
import { PayrollCategory as
|
|
6
|
-
import { COMPENSATION_NAME_OVERTIME as
|
|
7
|
-
import { stripLeadingZeros as
|
|
8
|
-
import { RadioGroupHookField as
|
|
4
|
+
import { useFieldErrorMessage as D } from "../../../../../partner-hook-utils/form/useFieldErrorMessage.js";
|
|
5
|
+
import { PayrollCategory as I } from "../../../payrollTypes.js";
|
|
6
|
+
import { COMPENSATION_NAME_OVERTIME as P, COMPENSATION_NAME_DOUBLE_OVERTIME as _ } from "../../../../../shared/constants.js";
|
|
7
|
+
import { stripLeadingZeros as H } from "../../../../../helpers/formattedStrings.js";
|
|
8
|
+
import { RadioGroupHookField as S } from "../../../../../partner-hook-utils/form/fields/RadioGroupHookField.js";
|
|
9
9
|
function J(t) {
|
|
10
10
|
return !Array.isArray(t);
|
|
11
11
|
}
|
|
12
|
-
function
|
|
12
|
+
function f(t, o, r) {
|
|
13
13
|
return function(l) {
|
|
14
|
-
const
|
|
14
|
+
const a = D(
|
|
15
15
|
t,
|
|
16
16
|
o
|
|
17
17
|
);
|
|
@@ -23,53 +23,53 @@ function d(t, o, r) {
|
|
|
23
23
|
type: "number",
|
|
24
24
|
min: 0,
|
|
25
25
|
max: r,
|
|
26
|
-
transform:
|
|
27
|
-
errorMessage:
|
|
26
|
+
transform: H,
|
|
27
|
+
errorMessage: a
|
|
28
28
|
}
|
|
29
29
|
);
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function x() {
|
|
33
33
|
return function(o) {
|
|
34
|
-
return /* @__PURE__ */ E(
|
|
34
|
+
return /* @__PURE__ */ E(S, { ...o, name: "paymentMethod" });
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function C(t) {
|
|
38
38
|
return function(r) {
|
|
39
39
|
return /* @__PURE__ */ E(j, { ...r, name: t });
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
function K(t) {
|
|
43
43
|
return {
|
|
44
|
-
Description:
|
|
45
|
-
Amount:
|
|
44
|
+
Description: C("reimbursementDraft.description"),
|
|
45
|
+
Amount: f("reimbursementDraft.amount", t, v)
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function k(t, o) {
|
|
49
49
|
return t == null ? null : parseFloat(t) - (parseFloat(o ?? "") || 0);
|
|
50
50
|
}
|
|
51
|
-
function U(t, o, r, s, l,
|
|
52
|
-
const
|
|
51
|
+
function U(t, o, r, s, l, a) {
|
|
52
|
+
const d = t.filter(
|
|
53
53
|
(n) => !!n.jobUuid && !!n.name
|
|
54
|
-
),
|
|
54
|
+
), m = (n, i, u) => ({
|
|
55
55
|
key: u ? `${n.jobUuid}:${n.name}:${i}` : `${n.jobUuid}:${n.name}`,
|
|
56
56
|
jobUuid: n.jobUuid,
|
|
57
57
|
name: n.name,
|
|
58
58
|
...u ? { workweekStart: i } : {},
|
|
59
|
-
Field:
|
|
59
|
+
Field: f(
|
|
60
60
|
`${r}.${n.jobUuid}.${n.name}.${i}`,
|
|
61
|
-
|
|
62
|
-
r === "hours" ?
|
|
61
|
+
a,
|
|
62
|
+
r === "hours" ? g : void 0
|
|
63
63
|
)
|
|
64
64
|
});
|
|
65
65
|
if (o.length > 1 && s && l) {
|
|
66
66
|
const n = {};
|
|
67
67
|
for (const i of o)
|
|
68
|
-
n[i.startDate] =
|
|
68
|
+
n[i.startDate] = d.map((u) => m(u, i.startDate, !0));
|
|
69
69
|
return n;
|
|
70
70
|
}
|
|
71
71
|
const c = o[0]?.startDate ?? "";
|
|
72
|
-
return
|
|
72
|
+
return d.map((n) => m(n, c, !1));
|
|
73
73
|
}
|
|
74
74
|
function Q({
|
|
75
75
|
employeeCompensation: t,
|
|
@@ -77,33 +77,33 @@ function Q({
|
|
|
77
77
|
workweeks: r,
|
|
78
78
|
payrollCategory: s,
|
|
79
79
|
hasDirectDepositSetup: l,
|
|
80
|
-
overtimeEarningNames:
|
|
81
|
-
isOvertimeEligible:
|
|
82
|
-
withOvertime:
|
|
80
|
+
overtimeEarningNames: a,
|
|
81
|
+
isOvertimeEligible: d,
|
|
82
|
+
withOvertime: m,
|
|
83
83
|
jobTitlesByUuid: c,
|
|
84
84
|
timeOffAccrualByName: n,
|
|
85
85
|
errorMessages: i
|
|
86
86
|
}) {
|
|
87
87
|
const u = t?.hourlyCompensations ?? [], y = o.filter(
|
|
88
|
-
(e) => e.name != null &&
|
|
88
|
+
(e) => e.name != null && a.has(e.name)
|
|
89
89
|
), O = o.filter(
|
|
90
|
-
(e) => e.name == null || !
|
|
90
|
+
(e) => e.name == null || !a.has(e.name)
|
|
91
91
|
), p = [];
|
|
92
92
|
for (const e of [...u, ...y])
|
|
93
93
|
e.jobUuid && !p.includes(e.jobUuid) && p.push(e.jobUuid);
|
|
94
|
-
const M = (e) => e ===
|
|
94
|
+
const M = (e) => e === P || e === _, h = p.map((e) => {
|
|
95
95
|
const $ = u.filter(
|
|
96
96
|
(b) => b.jobUuid === e
|
|
97
|
-
),
|
|
97
|
+
), B = m ? $ : $.filter((b) => !M(b.name));
|
|
98
98
|
return {
|
|
99
99
|
jobUuid: e,
|
|
100
100
|
title: c.get(e),
|
|
101
101
|
hours: U(
|
|
102
|
-
|
|
102
|
+
B,
|
|
103
103
|
r,
|
|
104
104
|
"hours",
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
d,
|
|
106
|
+
m,
|
|
107
107
|
i
|
|
108
108
|
)
|
|
109
109
|
};
|
|
@@ -111,41 +111,42 @@ function Q({
|
|
|
111
111
|
y,
|
|
112
112
|
r,
|
|
113
113
|
"overtimeIncludedEarnings",
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
d,
|
|
115
|
+
m,
|
|
116
116
|
i
|
|
117
|
-
),
|
|
117
|
+
), N = O.filter(
|
|
118
118
|
(e) => !!e.jobUuid && !!e.name
|
|
119
119
|
).map((e) => ({
|
|
120
120
|
key: `${e.jobUuid}:${e.name}`,
|
|
121
121
|
id: e.name,
|
|
122
|
-
Field:
|
|
122
|
+
Field: f(
|
|
123
123
|
`overtimeExcludedEarnings.${e.jobUuid}.${e.name}`,
|
|
124
124
|
i
|
|
125
125
|
)
|
|
126
|
-
})), F = (t?.paidTimeOff ?? []).filter((e) => e.name),
|
|
126
|
+
})), F = (t?.paidTimeOff ?? []).filter((e) => e.name), R = F.map((e) => ({
|
|
127
127
|
key: `timeOff:${e.name}`,
|
|
128
128
|
name: e.name,
|
|
129
|
-
Field:
|
|
129
|
+
Field: f(`timeOff.${e.name}`, i),
|
|
130
130
|
// Seeded from the initial entered hours; the hook recomputes it live.
|
|
131
|
-
remaining:
|
|
132
|
-
|
|
131
|
+
remaining: k(n.get(e.name), e.hours),
|
|
132
|
+
approvedRequestHours: Number(e.approvedRequestHours || 0)
|
|
133
|
+
})), T = s === I.Dismissal ? F.map((e) => ({
|
|
133
134
|
key: `finalPayout:${e.name}`,
|
|
134
135
|
name: e.name,
|
|
135
|
-
Field:
|
|
136
|
+
Field: f(`finalPayout.${e.name}`, i),
|
|
136
137
|
remaining: null
|
|
137
138
|
})) : void 0;
|
|
138
139
|
return {
|
|
139
140
|
jobs: h,
|
|
140
141
|
overtimeIncludedEarnings: A,
|
|
141
|
-
overtimeExcludedEarnings:
|
|
142
|
-
timeOff:
|
|
143
|
-
finalPayout:
|
|
144
|
-
paymentMethod: l ?
|
|
142
|
+
overtimeExcludedEarnings: N,
|
|
143
|
+
timeOff: R,
|
|
144
|
+
finalPayout: T,
|
|
145
|
+
paymentMethod: l ? x() : void 0
|
|
145
146
|
};
|
|
146
147
|
}
|
|
147
148
|
export {
|
|
148
|
-
|
|
149
|
+
k as computeTimeOffRemaining,
|
|
149
150
|
Q as createPayrollEditEmployeeFields,
|
|
150
151
|
K as createReimbursementDraftFields,
|
|
151
152
|
J as isSplitByWorkweek
|
package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fields.js","sources":["../../../../../../src/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields.tsx"],"sourcesContent":["import type { ComponentType } from 'react'\nimport type { PayrollEmployeeCompensationsType } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype'\nimport type { PayrollUpdatePaymentMethod } from '@gusto/embedded-api/models/components/payrollupdate'\nimport type { NormalizedWorkweek } from './payrollEditEmployeeHelpers'\nimport {\n MAX_HOURS,\n MAX_REIMBURSEMENT_AMOUNT,\n type PayrollEditEmployeeErrorCode,\n} from './payrollEditEmployeeSchema'\nimport { TextInputField } from '@/components/Common/Fields/TextInputField/TextInputField'\nimport { useFieldErrorMessage } from '@/partner-hook-utils/form/useFieldErrorMessage'\nimport { RadioGroupHookField } from '@/partner-hook-utils/form/fields'\nimport type { RadioGroupHookFieldProps } from '@/partner-hook-utils/form/fields/RadioGroupHookField'\nimport type { HookFieldProps, ValidationMessages } from '@/partner-hook-utils/types'\nimport type { TextInputProps } from '@/components/Common/UI/TextInput/TextInputTypes'\nimport { PayrollCategory } from '@/components/Payroll/payrollTypes'\nimport { COMPENSATION_NAME_DOUBLE_OVERTIME, COMPENSATION_NAME_OVERTIME } from '@/shared/constants'\nimport { stripLeadingZeros } from '@/helpers/formattedStrings'\n\n/**\n * Display copy for each validation error code a bound field can surface, so the\n * consumer supplies error text once (keyed by code) rather than reconstructing\n * form paths or hardcoding which rule each field can fail. Partial: a missing\n * code falls back to the raw error code.\n *\n * @public\n */\nexport type PayrollEditEmployeeErrorMessages = Partial<Record<PayrollEditEmployeeErrorCode, string>>\n\n/**\n * Presentation props accepted by a bound numeric field in the payroll editor.\n *\n * @remarks\n * The hook binds the react-hook-form `name`, forces `type=\"number\"`, and\n * resolves the field's own validation message internally; the UI supplies copy\n * and layout props (label, adornments, `shouldVisuallyHideLabel`, required\n * state, `description`).\n *\n * @public\n */\nexport type PayrollEditEmployeeFieldProps = Omit<\n TextInputProps,\n 'name' | 'value' | 'onChange' | 'isInvalid' | 'type' | 'min' | 'errorMessage'\n>\n\n/**\n * A numeric field component pre-bound by the hook to a specific form path.\n *\n * @public\n */\nexport type PayrollEditEmployeeFieldComponent = ComponentType<PayrollEditEmployeeFieldProps>\n\n/**\n * Presentation props accepted by the bound payment-method field.\n *\n * @remarks\n * The hook binds the `name` and publishes the option values on\n * `fieldsMetadata.paymentMethod`; the UI passes `getOptionLabel` to translate\n * each {@link PayrollUpdatePaymentMethod} value, rather than passing `options`.\n *\n * @public\n */\nexport type PayrollEditEmployeePaymentMethodFieldProps = HookFieldProps<\n RadioGroupHookFieldProps<never, PayrollUpdatePaymentMethod>\n>\n\n/**\n * The payment-method radio field component pre-bound by the hook.\n *\n * @public\n */\nexport type PayrollEditEmployeePaymentMethodField =\n ComponentType<PayrollEditEmployeePaymentMethodFieldProps>\n\n/**\n * One hours input within the hours section.\n *\n * @remarks\n * `key` is an opaque, stable React key. `jobUuid`, `name`, and (when the pay\n * period is multi-workweek) `workweekStart` are reach-in handles the UI uses to\n * group and label entries. When the section is a flat array, `workweekStart` is\n * omitted (single-workweek degenerate case); when it is a `Record` keyed by\n * workweek start, each entry carries its `workweekStart`.\n *\n * @public\n */\nexport interface HourEntry {\n /** Opaque, stable React key. */\n key: string\n /** The job this hours line belongs to. */\n jobUuid: string\n /** The compensation name (e.g. the API hours-compensation name). */\n name: string\n /** The workweek start date (`YYYY-MM-DD`) when the section is workweek-keyed. */\n workweekStart?: string\n /** Field component pre-bound to this entry's form path. */\n Field: PayrollEditEmployeeFieldComponent\n}\n\n/**\n * One earning input, used by the additional-earnings section.\n *\n * @remarks\n * Same shape as {@link HourEntry}. Whether an earning feeds the overtime\n * (regular rate of pay) calculation is decided by the hook, which sorts it into\n * the workweek-breakdown additional-earnings section or the flat other\n * section. The UI just renders whichever section an entry appears in.\n *\n * @public\n */\nexport type EarningEntry = HourEntry\n\n/**\n * One time-off or final-payout input.\n *\n * @remarks\n * Time off is never workweek-breakdown, so this section is always a flat array.\n *\n * @public\n */\nexport interface TimeOffEntry {\n /** Opaque, stable React key. */\n key: string\n /** The time-off policy compensation name. */\n name: string\n /** Field component pre-bound to this entry's form path. */\n Field: PayrollEditEmployeeFieldComponent\n /**\n * The policy's remaining balance after the entered hours are subtracted,\n * recomputed live as the user edits. `null` when the policy has no tracked\n * accrual balance (e.g. final-payout rows). Feed it into the field's own\n * `description` to render it as the input's help text.\n */\n remaining: number | null\n}\n\n/**\n * One entry in the flat `overtimeExcludedEarnings` section.\n *\n * @remarks\n * Intentionally opaque: `overtimeExcludedEarnings` collects earnings that are not overtime-affecting\n * and whose input type the partner does not need to reason about. Render each\n * entry's `Field` keyed by `key`; use `id` as a reach-in handle for labeling.\n *\n * @public\n */\nexport interface OtherEntry {\n /** Opaque, stable React key. */\n key: string\n /** Reach-in handle identifying the underlying earning (its compensation name). */\n id: string\n /** Field component pre-bound to this entry's form path. */\n Field: PayrollEditEmployeeFieldComponent\n}\n\n/**\n * A single job's hours section.\n *\n * @remarks\n * An employee can hold multiple jobs, each with its own hourly lines. `hours` is\n * either a flat `Entry[]` (single-workweek, or an overtime-ineligible employee)\n * OR a `Record<workweekStart, Entry[]>` (multi-workweek and overtime-eligible).\n * The value type is the signal — array is flat, object is split by workweek; use\n * {@link isSplitByWorkweek} to discriminate. `title` is the job's display title\n * (entity data, not copy) for rendering a per-job heading. Earnings are not\n * job-scoped: they live in the employee-level `overtimeIncludedEarnings` and\n * `overtimeExcludedEarnings` sections on {@link PayrollEditEmployeeFields}.\n *\n * @public\n */\nexport interface JobFields {\n /** The job identifier. */\n jobUuid: string\n /** The job's display title, when available, for a per-job heading. */\n title?: string\n /**\n * Hours inputs for this job. Excludes Overtime/Double-overtime rows while\n * `data.withOvertime` is `false`.\n */\n hours: HourEntry[] | Record<string, HourEntry[]>\n}\n\n/**\n * Presentation props accepted by a bound reimbursement description (text) field.\n *\n * @remarks\n * The hook binds the react-hook-form `name` internally; the UI supplies copy and\n * layout props (label, placeholder, `shouldVisuallyHideLabel`).\n *\n * @public\n */\nexport type ReimbursementDescriptionFieldProps = Omit<\n TextInputProps,\n 'name' | 'value' | 'onChange' | 'isInvalid' | 'type'\n>\n\n/**\n * The draft \"add reimbursement\" field group exposed on\n * `form.Fields.reimbursementDraft`.\n *\n * @remarks\n * A single in-progress row the UI reveals when the user starts adding a\n * reimbursement. `Description` and `Amount` bind to `reimbursementDraft.description`\n * / `reimbursementDraft.amount`. The UI shows them while `form.reimbursementDraft.isAdding`\n * is `true`, then calls `actions.saveReimbursement` (commits to the list) or\n * `actions.cancelReimbursement` (discards). Committed rows are rendered from\n * `data.reimbursements`, not from bound fields.\n *\n * @public\n */\nexport interface ReimbursementDraftFields {\n /** Description field pre-bound to the draft's form path. */\n Description: ComponentType<ReimbursementDescriptionFieldProps>\n /** Amount field pre-bound to the draft's form path. */\n Amount: PayrollEditEmployeeFieldComponent\n}\n\n/**\n * A committed reimbursement row for display in the consumer's table.\n *\n * @remarks\n * Exposed on `data.reimbursements`, seeded from the employee's existing\n * reimbursements and appended to as the user saves drafts. Display-only: the UI\n * renders `description`, `amount`, and the recurring/one-time `type`, plus a\n * remove control wired to `actions.removeReimbursement(index)`. `index` is the\n * row's position in the underlying form array (the removal handle); `uuid` is\n * present for rows that already exist server-side.\n *\n * @public\n */\nexport interface ReimbursementRow {\n /** Opaque, stable React key. */\n key: string\n /** The row's index in the reimbursements form array; pass to `removeReimbursement`. */\n index: number\n /** The reimbursement's server UUID, when it already exists. */\n uuid?: string\n /** The reimbursement description (may be blank; the UI supplies a fallback). */\n description: string\n /** The reimbursement amount as a decimal string. */\n amount: string\n /** Whether this reimbursement recurs. Recurring rows are managed outside payroll. */\n recurring: boolean\n}\n\n/**\n * The render-ready field collections exposed on `form.Fields`.\n *\n * @remarks\n * Hours are grouped under `jobs`, one entry per job, so multi-job employees\n * render correctly. All earnings and the remaining sections are employee-scoped\n * and stay top-level: `overtimeIncludedEarnings` (overtime-affecting) and\n * `overtimeExcludedEarnings` (non-overtime) each render as a single section spanning every\n * job, alongside time off, final payout, payment method, and reimbursements.\n *\n * @public\n */\nexport interface PayrollEditEmployeeFields {\n /** Per-job hours sections; one entry per job. */\n jobs: JobFields[]\n /**\n * Overtime-affecting earnings across all jobs, as a single employee-level\n * section. Flat `Entry[]` when unsplit, or `Record<workweekStart, Entry[]>`\n * when split by workweek; use {@link isSplitByWorkweek} to discriminate.\n */\n overtimeIncludedEarnings: EarningEntry[] | Record<string, EarningEntry[]>\n /** Non-overtime earnings (e.g. tips), always flat; opaque render entries. */\n overtimeExcludedEarnings: OtherEntry[]\n /** Time-off inputs (never workweek-breakdown). */\n timeOff: TimeOffEntry[]\n /** Final-payout inputs, present only for dismissal payrolls. */\n finalPayout?: TimeOffEntry[]\n /** Payment-method selector, present only when the employee has direct deposit set up. */\n paymentMethod?: PayrollEditEmployeePaymentMethodField\n /**\n * The draft \"add reimbursement\" field group, present only for itemized\n * (non-off-cycle) payrolls. Render while `form.reimbursementDraft.isAdding` is\n * `true`; committed rows come from `data.reimbursements`.\n */\n reimbursementDraft?: ReimbursementDraftFields\n}\n\n/**\n * Discriminates a workweek-breakdown section: `false` for the flat\n * (single-workweek) `Entry[]` form, `true` for the workweek-keyed\n * `Record<workweekStart, Entry[]>` form.\n *\n * @typeParam TEntry - The section's entry type.\n * @param section - A `form.Fields` section that may be flat or workweek-keyed.\n * @returns `true` when the section is keyed by workweek start date.\n * @public\n */\nexport function isSplitByWorkweek<TEntry>(\n section: TEntry[] | Record<string, TEntry[]>,\n): section is Record<string, TEntry[]> {\n return !Array.isArray(section)\n}\n\n// ── Bound field factories ──────────────────────────────────────────────\n\nfunction createNumberField(\n name: string,\n errorMessages?: PayrollEditEmployeeErrorMessages,\n max?: number,\n): PayrollEditEmployeeFieldComponent {\n return function BoundNumberField(props: PayrollEditEmployeeFieldProps) {\n // The field resolves its own validation copy from its bound path, so the\n // consumer supplies error copy once (keyed by code) and never reconstructs\n // form paths or guesses which rule a field can fail. name, type, min, max,\n // transform, and errorMessage are applied after the spread so callers can't\n // override the binding or the numeric contract via custom props.\n const errorMessage = useFieldErrorMessage(\n name,\n errorMessages as ValidationMessages<PayrollEditEmployeeErrorCode> | undefined,\n )\n return (\n <TextInputField\n {...props}\n name={name}\n type=\"number\"\n min={0}\n max={max}\n transform={stripLeadingZeros}\n errorMessage={errorMessage}\n />\n )\n }\n}\n\nfunction createPaymentMethodField(): PayrollEditEmployeePaymentMethodField {\n return function BoundPaymentMethodField(props: PayrollEditEmployeePaymentMethodFieldProps) {\n return (\n <RadioGroupHookField<never, PayrollUpdatePaymentMethod> {...props} name=\"paymentMethod\" />\n )\n }\n}\n\nfunction createTextField(name: string): ComponentType<ReimbursementDescriptionFieldProps> {\n return function BoundTextField(props: ReimbursementDescriptionFieldProps) {\n return <TextInputField {...props} name={name} />\n }\n}\n\n/**\n * Builds the draft \"add reimbursement\" field group, binding its Description and\n * Amount fields to the `reimbursementDraft` form path.\n *\n * @param errorMessages - Copy for each validation error code, baked into the amount field so it self-resolves.\n * @returns The pre-bound draft field group for `form.Fields.reimbursementDraft`.\n * @internal\n */\nexport function createReimbursementDraftFields(\n errorMessages?: PayrollEditEmployeeErrorMessages,\n): ReimbursementDraftFields {\n return {\n Description: createTextField('reimbursementDraft.description'),\n Amount: createNumberField('reimbursementDraft.amount', errorMessages, MAX_REIMBURSEMENT_AMOUNT),\n }\n}\n\n// ── Builders ───────────────────────────────────────────────────────────\n\n/** @internal */\nexport interface CreatePayrollEditEmployeeFieldsOptions {\n employeeCompensation: PayrollEmployeeCompensationsType | undefined\n /**\n * Fixed compensations to render, already merged with blank placeholders for\n * every company earning type (see `resolveEditableFixedCompensations`).\n */\n fixedCompensations: NonNullable<PayrollEmployeeCompensationsType['fixedCompensations']>\n workweeks: NormalizedWorkweek[]\n payrollCategory: PayrollCategory\n hasDirectDepositSetup: boolean\n /** Names of earning types included in the regular-rate-of-pay overtime calculation. */\n overtimeEarningNames: Set<string>\n /** Whether the employee is overtime-eligible (nonexempt family). Gates per-workweek splitting. */\n isOvertimeEligible: boolean\n /**\n * Gates per-workweek splitting\n * alongside `isOvertimeEligible`, and whether Overtime/Double-overtime rows\n * are included in `hours`.\n */\n withOvertime: boolean\n /** Job title lookup by job UUID, for per-job section headings. */\n jobTitlesByUuid: Map<string, string>\n /** Accrual balance by time-off policy name, for the remaining-balance display. */\n timeOffAccrualByName: Map<string, string>\n /** Copy for each validation error code, baked into every bound field so it self-resolves. */\n errorMessages?: PayrollEditEmployeeErrorMessages\n}\n\n/**\n * A time-off policy's remaining balance: its accrual balance minus the entered\n * hours. `null` when the policy has no tracked accrual balance (final-payout\n * rows). Shared by the field builder (seeding the initial value) and the hook\n * (recomputing it live as the user edits).\n *\n * @param accrualBalance - The policy's accrual balance, or `undefined` when untracked.\n * @param enteredHours - The currently entered hours for the policy.\n * @returns The remaining balance, or `null` when untracked.\n * @internal\n */\nexport function computeTimeOffRemaining(\n accrualBalance: string | undefined,\n enteredHours: string | null | undefined,\n): number | null {\n if (accrualBalance == null) return null\n return parseFloat(accrualBalance) - (parseFloat(enteredHours ?? '') || 0)\n}\n\nfunction buildBreakdownSection(\n compensations: Array<{ jobUuid?: string; name?: string }>,\n workweeks: NormalizedWorkweek[],\n pathPrefix: 'hours' | 'overtimeIncludedEarnings',\n isOvertimeEligible: boolean,\n withOvertime: boolean,\n errorMessages: PayrollEditEmployeeErrorMessages | undefined,\n): HourEntry[] | Record<string, HourEntry[]> {\n const rows = compensations.filter(\n (compensation): compensation is { jobUuid: string; name: string } =>\n Boolean(compensation.jobUuid) && Boolean(compensation.name),\n )\n\n const toEntry = (\n row: { jobUuid: string; name: string },\n weekStart: string,\n includeWorkweek: boolean,\n ): HourEntry => ({\n key: includeWorkweek ? `${row.jobUuid}:${row.name}:${weekStart}` : `${row.jobUuid}:${row.name}`,\n jobUuid: row.jobUuid,\n name: row.name,\n ...(includeWorkweek ? { workweekStart: weekStart } : {}),\n Field: createNumberField(\n `${pathPrefix}.${row.jobUuid}.${row.name}.${weekStart}`,\n errorMessages,\n pathPrefix === 'hours' ? MAX_HOURS : undefined,\n ),\n })\n\n // Split into per-workweek columns only for overtime-eligible employees while\n // `withOvertime` is on; workweek breakdowns exist solely to compute overtime\n // premiums, so an ineligible employee renders flat even on a multi-workweek\n // payroll, and an eligible one stays flat until `withOvertime` is set.\n if (workweeks.length > 1 && isOvertimeEligible && withOvertime) {\n const byWeek: Record<string, HourEntry[]> = {}\n for (const workweek of workweeks) {\n byWeek[workweek.startDate] = rows.map(row => toEntry(row, workweek.startDate, true))\n }\n return byWeek\n }\n\n const weekStart = workweeks[0]?.startDate ?? ''\n return rows.map(row => toEntry(row, weekStart, false))\n}\n\n/**\n * Builds the render-ready {@link PayrollEditEmployeeFields} from the prepared\n * compensation.\n *\n * @remarks\n * Hours and overtime-affecting earnings are grouped per job into `jobs` (a job\n * appears if it has hourly lines or overtime-affecting earnings). Fixed\n * compensations are split by whether their earning type is included in the\n * regular-rate-of-pay overtime calculation (`overtimeEarningNames`): included\n * earnings become each job's additional earnings, the rest become the flat,\n * employee-level `overtimeExcludedEarnings` section. Time off comes from the paid-time-off list,\n * final payout is added only for dismissal payrolls, and the payment-method\n * selector appears only when direct deposit is set up.\n *\n * @param options - The prepared compensation, normalized workweeks, payroll category, direct-deposit flag, overtime earning names, eligibility, the `withOvertime` flag, job titles, time-off accrual balances and entered values, and error copy.\n * @returns The populated field collections.\n * @internal\n */\nexport function createPayrollEditEmployeeFields({\n employeeCompensation,\n fixedCompensations,\n workweeks,\n payrollCategory,\n hasDirectDepositSetup,\n overtimeEarningNames,\n isOvertimeEligible,\n withOvertime,\n jobTitlesByUuid,\n timeOffAccrualByName,\n errorMessages,\n}: CreatePayrollEditEmployeeFieldsOptions): PayrollEditEmployeeFields {\n const hourlyCompensations = employeeCompensation?.hourlyCompensations ?? []\n const overtimeAffecting = fixedCompensations.filter(\n compensation => compensation.name != null && overtimeEarningNames.has(compensation.name),\n )\n const nonOvertime = fixedCompensations.filter(\n compensation => compensation.name == null || !overtimeEarningNames.has(compensation.name),\n )\n\n // A job appears if it has hourly lines or overtime-affecting earnings, in first\n // appearance order across those two sources.\n const jobUuids: string[] = []\n for (const compensation of [...hourlyCompensations, ...overtimeAffecting]) {\n if (compensation.jobUuid && !jobUuids.includes(compensation.jobUuid)) {\n jobUuids.push(compensation.jobUuid)\n }\n }\n\n const isOvertimeName = (name: string | null | undefined) =>\n name === COMPENSATION_NAME_OVERTIME || name === COMPENSATION_NAME_DOUBLE_OVERTIME\n\n const jobs: JobFields[] = jobUuids.map(jobUuid => {\n const jobHourlyCompensations = hourlyCompensations.filter(\n compensation => compensation.jobUuid === jobUuid,\n )\n // Overtime/Double-overtime rows stay out of `hours` entirely while\n // `withOvertime` is off — their underlying form values are untouched\n // (still whatever the prepared compensation carried), so hiding the row\n // can't lose or corrupt data. Driven by the single, employee-level flag —\n // no per-job hidden state.\n const visibleHourlyCompensations = withOvertime\n ? jobHourlyCompensations\n : jobHourlyCompensations.filter(compensation => !isOvertimeName(compensation.name))\n\n return {\n jobUuid,\n title: jobTitlesByUuid.get(jobUuid),\n hours: buildBreakdownSection(\n visibleHourlyCompensations,\n workweeks,\n 'hours',\n isOvertimeEligible,\n withOvertime,\n errorMessages,\n ),\n }\n })\n\n // Overtime-affecting earnings render as one employee-level section spanning\n // every job. Each entry keeps its per-job form path\n // (`overtimeIncludedEarnings.<jobUuid>.<name>`), so the flat section still binds and\n // submits per job.\n const overtimeIncludedEarnings = buildBreakdownSection(\n overtimeAffecting,\n workweeks,\n 'overtimeIncludedEarnings',\n isOvertimeEligible,\n withOvertime,\n errorMessages,\n )\n\n const overtimeExcludedEarnings: OtherEntry[] = nonOvertime\n .filter(\n (compensation): compensation is { jobUuid: string; name: string } =>\n Boolean(compensation.jobUuid) && Boolean(compensation.name),\n )\n .map(compensation => ({\n key: `${compensation.jobUuid}:${compensation.name}`,\n id: compensation.name,\n Field: createNumberField(\n `overtimeExcludedEarnings.${compensation.jobUuid}.${compensation.name}`,\n errorMessages,\n ),\n }))\n\n const timeOffRows = (employeeCompensation?.paidTimeOff ?? []).filter(entry => entry.name)\n const timeOff: TimeOffEntry[] = timeOffRows.map(entry => ({\n key: `timeOff:${entry.name!}`,\n name: entry.name!,\n Field: createNumberField(`timeOff.${entry.name!}`, errorMessages),\n // Seeded from the initial entered hours; the hook recomputes it live.\n remaining: computeTimeOffRemaining(timeOffAccrualByName.get(entry.name!), entry.hours),\n }))\n\n // Final-payout rows never show a remaining balance.\n const finalPayout =\n payrollCategory === PayrollCategory.Dismissal\n ? timeOffRows.map(entry => ({\n key: `finalPayout:${entry.name!}`,\n name: entry.name!,\n Field: createNumberField(`finalPayout.${entry.name!}`, errorMessages),\n remaining: null,\n }))\n : undefined\n\n return {\n jobs,\n overtimeIncludedEarnings,\n overtimeExcludedEarnings,\n timeOff,\n finalPayout,\n paymentMethod: hasDirectDepositSetup ? createPaymentMethodField() : undefined,\n }\n}\n"],"names":["isSplitByWorkweek","section","createNumberField","name","errorMessages","max","props","errorMessage","useFieldErrorMessage","jsx","TextInputField","stripLeadingZeros","createPaymentMethodField","RadioGroupHookField","createTextField","createReimbursementDraftFields","MAX_REIMBURSEMENT_AMOUNT","computeTimeOffRemaining","accrualBalance","enteredHours","buildBreakdownSection","compensations","workweeks","pathPrefix","isOvertimeEligible","withOvertime","rows","compensation","toEntry","row","weekStart","includeWorkweek","MAX_HOURS","byWeek","workweek","createPayrollEditEmployeeFields","employeeCompensation","fixedCompensations","payrollCategory","hasDirectDepositSetup","overtimeEarningNames","jobTitlesByUuid","timeOffAccrualByName","hourlyCompensations","overtimeAffecting","nonOvertime","jobUuids","isOvertimeName","COMPENSATION_NAME_OVERTIME","COMPENSATION_NAME_DOUBLE_OVERTIME","jobs","jobUuid","jobHourlyCompensations","visibleHourlyCompensations","overtimeIncludedEarnings","overtimeExcludedEarnings","timeOffRows","entry","timeOff","finalPayout","PayrollCategory"],"mappings":";;;;;;;;AAoSO,SAASA,EACdC,GACqC;AACrC,SAAO,CAAC,MAAM,QAAQA,CAAO;AAC/B;AAIA,SAASC,EACPC,GACAC,GACAC,GACmC;AACnC,SAAO,SAA0BC,GAAsC;AAMrE,UAAMC,IAAeC;AAAA,MACnBL;AAAA,MACAC;AAAA,IAAA;AAEF,WACE,gBAAAK;AAAA,MAACC;AAAA,MAAA;AAAA,QACE,GAAGJ;AAAA,QACJ,MAAAH;AAAA,QACA,MAAK;AAAA,QACL,KAAK;AAAA,QACL,KAAAE;AAAA,QACA,WAAWM;AAAA,QACX,cAAAJ;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEA,SAASK,IAAkE;AACzE,SAAO,SAAiCN,GAAmD;AACzF,WACE,gBAAAG,EAACI,GAAA,EAAwD,GAAGP,GAAO,MAAK,iBAAgB;AAAA,EAE5F;AACF;AAEA,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../../../../../../src/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields.tsx"],"sourcesContent":["import type { ComponentType } from 'react'\nimport type { PayrollEmployeeCompensationsType } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype'\nimport type { PayrollUpdatePaymentMethod } from '@gusto/embedded-api/models/components/payrollupdate'\nimport type { NormalizedWorkweek } from './payrollEditEmployeeHelpers'\nimport {\n MAX_HOURS,\n MAX_REIMBURSEMENT_AMOUNT,\n type PayrollEditEmployeeErrorCode,\n} from './payrollEditEmployeeSchema'\nimport { TextInputField } from '@/components/Common/Fields/TextInputField/TextInputField'\nimport { useFieldErrorMessage } from '@/partner-hook-utils/form/useFieldErrorMessage'\nimport { RadioGroupHookField } from '@/partner-hook-utils/form/fields'\nimport type { RadioGroupHookFieldProps } from '@/partner-hook-utils/form/fields/RadioGroupHookField'\nimport type { HookFieldProps, ValidationMessages } from '@/partner-hook-utils/types'\nimport type { TextInputProps } from '@/components/Common/UI/TextInput/TextInputTypes'\nimport { PayrollCategory } from '@/components/Payroll/payrollTypes'\nimport { COMPENSATION_NAME_DOUBLE_OVERTIME, COMPENSATION_NAME_OVERTIME } from '@/shared/constants'\nimport { stripLeadingZeros } from '@/helpers/formattedStrings'\n\n/**\n * Display copy for each validation error code a bound field can surface, so the\n * consumer supplies error text once (keyed by code) rather than reconstructing\n * form paths or hardcoding which rule each field can fail. Partial: a missing\n * code falls back to the raw error code.\n *\n * @public\n */\nexport type PayrollEditEmployeeErrorMessages = Partial<Record<PayrollEditEmployeeErrorCode, string>>\n\n/**\n * Presentation props accepted by a bound numeric field in the payroll editor.\n *\n * @remarks\n * The hook binds the react-hook-form `name`, forces `type=\"number\"`, and\n * resolves the field's own validation message internally; the UI supplies copy\n * and layout props (label, adornments, `shouldVisuallyHideLabel`, required\n * state, `description`).\n *\n * @public\n */\nexport type PayrollEditEmployeeFieldProps = Omit<\n TextInputProps,\n 'name' | 'value' | 'onChange' | 'isInvalid' | 'type' | 'min' | 'errorMessage'\n>\n\n/**\n * A numeric field component pre-bound by the hook to a specific form path.\n *\n * @public\n */\nexport type PayrollEditEmployeeFieldComponent = ComponentType<PayrollEditEmployeeFieldProps>\n\n/**\n * Presentation props accepted by the bound payment-method field.\n *\n * @remarks\n * The hook binds the `name` and publishes the option values on\n * `fieldsMetadata.paymentMethod`; the UI passes `getOptionLabel` to translate\n * each {@link PayrollUpdatePaymentMethod} value, rather than passing `options`.\n *\n * @public\n */\nexport type PayrollEditEmployeePaymentMethodFieldProps = HookFieldProps<\n RadioGroupHookFieldProps<never, PayrollUpdatePaymentMethod>\n>\n\n/**\n * The payment-method radio field component pre-bound by the hook.\n *\n * @public\n */\nexport type PayrollEditEmployeePaymentMethodField =\n ComponentType<PayrollEditEmployeePaymentMethodFieldProps>\n\n/**\n * One hours input within the hours section.\n *\n * @remarks\n * `key` is an opaque, stable React key. `jobUuid`, `name`, and (when the pay\n * period is multi-workweek) `workweekStart` are reach-in handles the UI uses to\n * group and label entries. When the section is a flat array, `workweekStart` is\n * omitted (single-workweek degenerate case); when it is a `Record` keyed by\n * workweek start, each entry carries its `workweekStart`.\n *\n * @public\n */\nexport interface HourEntry {\n /** Opaque, stable React key. */\n key: string\n /** The job this hours line belongs to. */\n jobUuid: string\n /** The compensation name (e.g. the API hours-compensation name). */\n name: string\n /** The workweek start date (`YYYY-MM-DD`) when the section is workweek-keyed. */\n workweekStart?: string\n /** Field component pre-bound to this entry's form path. */\n Field: PayrollEditEmployeeFieldComponent\n}\n\n/**\n * One earning input, used by the additional-earnings section.\n *\n * @remarks\n * Same shape as {@link HourEntry}. Whether an earning feeds the overtime\n * (regular rate of pay) calculation is decided by the hook, which sorts it into\n * the workweek-breakdown additional-earnings section or the flat other\n * section. The UI just renders whichever section an entry appears in.\n *\n * @public\n */\nexport type EarningEntry = HourEntry\n\n/**\n * One time-off or final-payout input.\n *\n * @remarks\n * Time off is never workweek-breakdown, so this section is always a flat array.\n *\n * @public\n */\nexport interface TimeOffEntry {\n /** Opaque, stable React key. */\n key: string\n /** The time-off policy compensation name. */\n name: string\n /** Field component pre-bound to this entry's form path. */\n Field: PayrollEditEmployeeFieldComponent\n /**\n * The policy's remaining balance after the entered hours are subtracted,\n * recomputed live as the user edits. `null` when the policy has no tracked\n * accrual balance (e.g. final-payout rows). Feed it into the field's own\n * `description` to render it as the input's help text.\n */\n remaining: number | null\n /** Read-only approved request hours for this pay period; absent on final-payout rows. */\n approvedRequestHours?: number\n}\n\n/**\n * One entry in the flat `overtimeExcludedEarnings` section.\n *\n * @remarks\n * Intentionally opaque: `overtimeExcludedEarnings` collects earnings that are not overtime-affecting\n * and whose input type the partner does not need to reason about. Render each\n * entry's `Field` keyed by `key`; use `id` as a reach-in handle for labeling.\n *\n * @public\n */\nexport interface OtherEntry {\n /** Opaque, stable React key. */\n key: string\n /** Reach-in handle identifying the underlying earning (its compensation name). */\n id: string\n /** Field component pre-bound to this entry's form path. */\n Field: PayrollEditEmployeeFieldComponent\n}\n\n/**\n * A single job's hours section.\n *\n * @remarks\n * An employee can hold multiple jobs, each with its own hourly lines. `hours` is\n * either a flat `Entry[]` (single-workweek, or an overtime-ineligible employee)\n * OR a `Record<workweekStart, Entry[]>` (multi-workweek and overtime-eligible).\n * The value type is the signal — array is flat, object is split by workweek; use\n * {@link isSplitByWorkweek} to discriminate. `title` is the job's display title\n * (entity data, not copy) for rendering a per-job heading. Earnings are not\n * job-scoped: they live in the employee-level `overtimeIncludedEarnings` and\n * `overtimeExcludedEarnings` sections on {@link PayrollEditEmployeeFields}.\n *\n * @public\n */\nexport interface JobFields {\n /** The job identifier. */\n jobUuid: string\n /** The job's display title, when available, for a per-job heading. */\n title?: string\n /**\n * Hours inputs for this job. Excludes Overtime/Double-overtime rows while\n * `data.withOvertime` is `false`.\n */\n hours: HourEntry[] | Record<string, HourEntry[]>\n}\n\n/**\n * Presentation props accepted by a bound reimbursement description (text) field.\n *\n * @remarks\n * The hook binds the react-hook-form `name` internally; the UI supplies copy and\n * layout props (label, placeholder, `shouldVisuallyHideLabel`).\n *\n * @public\n */\nexport type ReimbursementDescriptionFieldProps = Omit<\n TextInputProps,\n 'name' | 'value' | 'onChange' | 'isInvalid' | 'type'\n>\n\n/**\n * The draft \"add reimbursement\" field group exposed on\n * `form.Fields.reimbursementDraft`.\n *\n * @remarks\n * A single in-progress row the UI reveals when the user starts adding a\n * reimbursement. `Description` and `Amount` bind to `reimbursementDraft.description`\n * / `reimbursementDraft.amount`. The UI shows them while `form.reimbursementDraft.isAdding`\n * is `true`, then calls `actions.saveReimbursement` (commits to the list) or\n * `actions.cancelReimbursement` (discards). Committed rows are rendered from\n * `data.reimbursements`, not from bound fields.\n *\n * @public\n */\nexport interface ReimbursementDraftFields {\n /** Description field pre-bound to the draft's form path. */\n Description: ComponentType<ReimbursementDescriptionFieldProps>\n /** Amount field pre-bound to the draft's form path. */\n Amount: PayrollEditEmployeeFieldComponent\n}\n\n/**\n * A committed reimbursement row for display in the consumer's table.\n *\n * @remarks\n * Exposed on `data.reimbursements`, seeded from the employee's existing\n * reimbursements and appended to as the user saves drafts. Display-only: the UI\n * renders `description`, `amount`, and the recurring/one-time `type`, plus a\n * remove control wired to `actions.removeReimbursement(index)`. `index` is the\n * row's position in the underlying form array (the removal handle); `uuid` is\n * present for rows that already exist server-side.\n *\n * @public\n */\nexport interface ReimbursementRow {\n /** Opaque, stable React key. */\n key: string\n /** The row's index in the reimbursements form array; pass to `removeReimbursement`. */\n index: number\n /** The reimbursement's server UUID, when it already exists. */\n uuid?: string\n /** The reimbursement description (may be blank; the UI supplies a fallback). */\n description: string\n /** The reimbursement amount as a decimal string. */\n amount: string\n /** Whether this reimbursement recurs. Recurring rows are managed outside payroll. */\n recurring: boolean\n}\n\n/**\n * The render-ready field collections exposed on `form.Fields`.\n *\n * @remarks\n * Hours are grouped under `jobs`, one entry per job, so multi-job employees\n * render correctly. All earnings and the remaining sections are employee-scoped\n * and stay top-level: `overtimeIncludedEarnings` (overtime-affecting) and\n * `overtimeExcludedEarnings` (non-overtime) each render as a single section spanning every\n * job, alongside time off, final payout, payment method, and reimbursements.\n *\n * @public\n */\nexport interface PayrollEditEmployeeFields {\n /** Per-job hours sections; one entry per job. */\n jobs: JobFields[]\n /**\n * Overtime-affecting earnings across all jobs, as a single employee-level\n * section. Flat `Entry[]` when unsplit, or `Record<workweekStart, Entry[]>`\n * when split by workweek; use {@link isSplitByWorkweek} to discriminate.\n */\n overtimeIncludedEarnings: EarningEntry[] | Record<string, EarningEntry[]>\n /** Non-overtime earnings (e.g. tips), always flat; opaque render entries. */\n overtimeExcludedEarnings: OtherEntry[]\n /** Time-off inputs (never workweek-breakdown). */\n timeOff: TimeOffEntry[]\n /** Final-payout inputs, present only for dismissal payrolls. */\n finalPayout?: TimeOffEntry[]\n /** Payment-method selector, present only when the employee has direct deposit set up. */\n paymentMethod?: PayrollEditEmployeePaymentMethodField\n /**\n * The draft \"add reimbursement\" field group, present only for itemized\n * (non-off-cycle) payrolls. Render while `form.reimbursementDraft.isAdding` is\n * `true`; committed rows come from `data.reimbursements`.\n */\n reimbursementDraft?: ReimbursementDraftFields\n}\n\n/**\n * Discriminates a workweek-breakdown section: `false` for the flat\n * (single-workweek) `Entry[]` form, `true` for the workweek-keyed\n * `Record<workweekStart, Entry[]>` form.\n *\n * @typeParam TEntry - The section's entry type.\n * @param section - A `form.Fields` section that may be flat or workweek-keyed.\n * @returns `true` when the section is keyed by workweek start date.\n * @public\n */\nexport function isSplitByWorkweek<TEntry>(\n section: TEntry[] | Record<string, TEntry[]>,\n): section is Record<string, TEntry[]> {\n return !Array.isArray(section)\n}\n\n// ── Bound field factories ──────────────────────────────────────────────\n\nfunction createNumberField(\n name: string,\n errorMessages?: PayrollEditEmployeeErrorMessages,\n max?: number,\n): PayrollEditEmployeeFieldComponent {\n return function BoundNumberField(props: PayrollEditEmployeeFieldProps) {\n // The field resolves its own validation copy from its bound path, so the\n // consumer supplies error copy once (keyed by code) and never reconstructs\n // form paths or guesses which rule a field can fail. name, type, min, max,\n // transform, and errorMessage are applied after the spread so callers can't\n // override the binding or the numeric contract via custom props.\n const errorMessage = useFieldErrorMessage(\n name,\n errorMessages as ValidationMessages<PayrollEditEmployeeErrorCode> | undefined,\n )\n return (\n <TextInputField\n {...props}\n name={name}\n type=\"number\"\n min={0}\n max={max}\n transform={stripLeadingZeros}\n errorMessage={errorMessage}\n />\n )\n }\n}\n\nfunction createPaymentMethodField(): PayrollEditEmployeePaymentMethodField {\n return function BoundPaymentMethodField(props: PayrollEditEmployeePaymentMethodFieldProps) {\n return (\n <RadioGroupHookField<never, PayrollUpdatePaymentMethod> {...props} name=\"paymentMethod\" />\n )\n }\n}\n\nfunction createTextField(name: string): ComponentType<ReimbursementDescriptionFieldProps> {\n return function BoundTextField(props: ReimbursementDescriptionFieldProps) {\n return <TextInputField {...props} name={name} />\n }\n}\n\n/**\n * Builds the draft \"add reimbursement\" field group, binding its Description and\n * Amount fields to the `reimbursementDraft` form path.\n *\n * @param errorMessages - Copy for each validation error code, baked into the amount field so it self-resolves.\n * @returns The pre-bound draft field group for `form.Fields.reimbursementDraft`.\n * @internal\n */\nexport function createReimbursementDraftFields(\n errorMessages?: PayrollEditEmployeeErrorMessages,\n): ReimbursementDraftFields {\n return {\n Description: createTextField('reimbursementDraft.description'),\n Amount: createNumberField('reimbursementDraft.amount', errorMessages, MAX_REIMBURSEMENT_AMOUNT),\n }\n}\n\n// ── Builders ───────────────────────────────────────────────────────────\n\n/** @internal */\nexport interface CreatePayrollEditEmployeeFieldsOptions {\n employeeCompensation: PayrollEmployeeCompensationsType | undefined\n /**\n * Fixed compensations to render, already merged with blank placeholders for\n * every company earning type (see `resolveEditableFixedCompensations`).\n */\n fixedCompensations: NonNullable<PayrollEmployeeCompensationsType['fixedCompensations']>\n workweeks: NormalizedWorkweek[]\n payrollCategory: PayrollCategory\n hasDirectDepositSetup: boolean\n /** Names of earning types included in the regular-rate-of-pay overtime calculation. */\n overtimeEarningNames: Set<string>\n /** Whether the employee is overtime-eligible (nonexempt family). Gates per-workweek splitting. */\n isOvertimeEligible: boolean\n /**\n * Gates per-workweek splitting\n * alongside `isOvertimeEligible`, and whether Overtime/Double-overtime rows\n * are included in `hours`.\n */\n withOvertime: boolean\n /** Job title lookup by job UUID, for per-job section headings. */\n jobTitlesByUuid: Map<string, string>\n /** Accrual balance by time-off policy name, for the remaining-balance display. */\n timeOffAccrualByName: Map<string, string>\n /** Copy for each validation error code, baked into every bound field so it self-resolves. */\n errorMessages?: PayrollEditEmployeeErrorMessages\n}\n\n/**\n * A time-off policy's remaining balance: its accrual balance minus the entered\n * hours. `null` when the policy has no tracked accrual balance (final-payout\n * rows). Shared by the field builder (seeding the initial value) and the hook\n * (recomputing it live as the user edits).\n *\n * @param accrualBalance - The policy's accrual balance, or `undefined` when untracked.\n * @param enteredHours - The currently entered hours for the policy.\n * @returns The remaining balance, or `null` when untracked.\n * @internal\n */\nexport function computeTimeOffRemaining(\n accrualBalance: string | undefined,\n enteredHours: string | null | undefined,\n): number | null {\n if (accrualBalance == null) return null\n return parseFloat(accrualBalance) - (parseFloat(enteredHours ?? '') || 0)\n}\n\nfunction buildBreakdownSection(\n compensations: Array<{ jobUuid?: string; name?: string }>,\n workweeks: NormalizedWorkweek[],\n pathPrefix: 'hours' | 'overtimeIncludedEarnings',\n isOvertimeEligible: boolean,\n withOvertime: boolean,\n errorMessages: PayrollEditEmployeeErrorMessages | undefined,\n): HourEntry[] | Record<string, HourEntry[]> {\n const rows = compensations.filter(\n (compensation): compensation is { jobUuid: string; name: string } =>\n Boolean(compensation.jobUuid) && Boolean(compensation.name),\n )\n\n const toEntry = (\n row: { jobUuid: string; name: string },\n weekStart: string,\n includeWorkweek: boolean,\n ): HourEntry => ({\n key: includeWorkweek ? `${row.jobUuid}:${row.name}:${weekStart}` : `${row.jobUuid}:${row.name}`,\n jobUuid: row.jobUuid,\n name: row.name,\n ...(includeWorkweek ? { workweekStart: weekStart } : {}),\n Field: createNumberField(\n `${pathPrefix}.${row.jobUuid}.${row.name}.${weekStart}`,\n errorMessages,\n pathPrefix === 'hours' ? MAX_HOURS : undefined,\n ),\n })\n\n // Split into per-workweek columns only for overtime-eligible employees while\n // `withOvertime` is on; workweek breakdowns exist solely to compute overtime\n // premiums, so an ineligible employee renders flat even on a multi-workweek\n // payroll, and an eligible one stays flat until `withOvertime` is set.\n if (workweeks.length > 1 && isOvertimeEligible && withOvertime) {\n const byWeek: Record<string, HourEntry[]> = {}\n for (const workweek of workweeks) {\n byWeek[workweek.startDate] = rows.map(row => toEntry(row, workweek.startDate, true))\n }\n return byWeek\n }\n\n const weekStart = workweeks[0]?.startDate ?? ''\n return rows.map(row => toEntry(row, weekStart, false))\n}\n\n/**\n * Builds the render-ready {@link PayrollEditEmployeeFields} from the prepared\n * compensation.\n *\n * @remarks\n * Hours and overtime-affecting earnings are grouped per job into `jobs` (a job\n * appears if it has hourly lines or overtime-affecting earnings). Fixed\n * compensations are split by whether their earning type is included in the\n * regular-rate-of-pay overtime calculation (`overtimeEarningNames`): included\n * earnings become each job's additional earnings, the rest become the flat,\n * employee-level `overtimeExcludedEarnings` section. Time off comes from the paid-time-off list,\n * final payout is added only for dismissal payrolls, and the payment-method\n * selector appears only when direct deposit is set up.\n *\n * @param options - The prepared compensation, normalized workweeks, payroll category, direct-deposit flag, overtime earning names, eligibility, the `withOvertime` flag, job titles, time-off accrual balances and entered values, and error copy.\n * @returns The populated field collections.\n * @internal\n */\nexport function createPayrollEditEmployeeFields({\n employeeCompensation,\n fixedCompensations,\n workweeks,\n payrollCategory,\n hasDirectDepositSetup,\n overtimeEarningNames,\n isOvertimeEligible,\n withOvertime,\n jobTitlesByUuid,\n timeOffAccrualByName,\n errorMessages,\n}: CreatePayrollEditEmployeeFieldsOptions): PayrollEditEmployeeFields {\n const hourlyCompensations = employeeCompensation?.hourlyCompensations ?? []\n const overtimeAffecting = fixedCompensations.filter(\n compensation => compensation.name != null && overtimeEarningNames.has(compensation.name),\n )\n const nonOvertime = fixedCompensations.filter(\n compensation => compensation.name == null || !overtimeEarningNames.has(compensation.name),\n )\n\n // A job appears if it has hourly lines or overtime-affecting earnings, in first\n // appearance order across those two sources.\n const jobUuids: string[] = []\n for (const compensation of [...hourlyCompensations, ...overtimeAffecting]) {\n if (compensation.jobUuid && !jobUuids.includes(compensation.jobUuid)) {\n jobUuids.push(compensation.jobUuid)\n }\n }\n\n const isOvertimeName = (name: string | null | undefined) =>\n name === COMPENSATION_NAME_OVERTIME || name === COMPENSATION_NAME_DOUBLE_OVERTIME\n\n const jobs: JobFields[] = jobUuids.map(jobUuid => {\n const jobHourlyCompensations = hourlyCompensations.filter(\n compensation => compensation.jobUuid === jobUuid,\n )\n // Overtime/Double-overtime rows stay out of `hours` entirely while\n // `withOvertime` is off — their underlying form values are untouched\n // (still whatever the prepared compensation carried), so hiding the row\n // can't lose or corrupt data. Driven by the single, employee-level flag —\n // no per-job hidden state.\n const visibleHourlyCompensations = withOvertime\n ? jobHourlyCompensations\n : jobHourlyCompensations.filter(compensation => !isOvertimeName(compensation.name))\n\n return {\n jobUuid,\n title: jobTitlesByUuid.get(jobUuid),\n hours: buildBreakdownSection(\n visibleHourlyCompensations,\n workweeks,\n 'hours',\n isOvertimeEligible,\n withOvertime,\n errorMessages,\n ),\n }\n })\n\n // Overtime-affecting earnings render as one employee-level section spanning\n // every job. Each entry keeps its per-job form path\n // (`overtimeIncludedEarnings.<jobUuid>.<name>`), so the flat section still binds and\n // submits per job.\n const overtimeIncludedEarnings = buildBreakdownSection(\n overtimeAffecting,\n workweeks,\n 'overtimeIncludedEarnings',\n isOvertimeEligible,\n withOvertime,\n errorMessages,\n )\n\n const overtimeExcludedEarnings: OtherEntry[] = nonOvertime\n .filter(\n (compensation): compensation is { jobUuid: string; name: string } =>\n Boolean(compensation.jobUuid) && Boolean(compensation.name),\n )\n .map(compensation => ({\n key: `${compensation.jobUuid}:${compensation.name}`,\n id: compensation.name,\n Field: createNumberField(\n `overtimeExcludedEarnings.${compensation.jobUuid}.${compensation.name}`,\n errorMessages,\n ),\n }))\n\n const timeOffRows = (employeeCompensation?.paidTimeOff ?? []).filter(entry => entry.name)\n const timeOff: TimeOffEntry[] = timeOffRows.map(entry => ({\n key: `timeOff:${entry.name!}`,\n name: entry.name!,\n Field: createNumberField(`timeOff.${entry.name!}`, errorMessages),\n // Seeded from the initial entered hours; the hook recomputes it live.\n remaining: computeTimeOffRemaining(timeOffAccrualByName.get(entry.name!), entry.hours),\n approvedRequestHours: Number(entry.approvedRequestHours || 0),\n }))\n\n // Final-payout rows never show a remaining balance.\n const finalPayout =\n payrollCategory === PayrollCategory.Dismissal\n ? timeOffRows.map(entry => ({\n key: `finalPayout:${entry.name!}`,\n name: entry.name!,\n Field: createNumberField(`finalPayout.${entry.name!}`, errorMessages),\n remaining: null,\n }))\n : undefined\n\n return {\n jobs,\n overtimeIncludedEarnings,\n overtimeExcludedEarnings,\n timeOff,\n finalPayout,\n paymentMethod: hasDirectDepositSetup ? createPaymentMethodField() : undefined,\n }\n}\n"],"names":["isSplitByWorkweek","section","createNumberField","name","errorMessages","max","props","errorMessage","useFieldErrorMessage","jsx","TextInputField","stripLeadingZeros","createPaymentMethodField","RadioGroupHookField","createTextField","createReimbursementDraftFields","MAX_REIMBURSEMENT_AMOUNT","computeTimeOffRemaining","accrualBalance","enteredHours","buildBreakdownSection","compensations","workweeks","pathPrefix","isOvertimeEligible","withOvertime","rows","compensation","toEntry","row","weekStart","includeWorkweek","MAX_HOURS","byWeek","workweek","createPayrollEditEmployeeFields","employeeCompensation","fixedCompensations","payrollCategory","hasDirectDepositSetup","overtimeEarningNames","jobTitlesByUuid","timeOffAccrualByName","hourlyCompensations","overtimeAffecting","nonOvertime","jobUuids","isOvertimeName","COMPENSATION_NAME_OVERTIME","COMPENSATION_NAME_DOUBLE_OVERTIME","jobs","jobUuid","jobHourlyCompensations","visibleHourlyCompensations","overtimeIncludedEarnings","overtimeExcludedEarnings","timeOffRows","entry","timeOff","finalPayout","PayrollCategory"],"mappings":";;;;;;;;AAsSO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D,CAAa;AAAA;AAAA,IAEhE,WAAWa,EAAwByB,EAAqB,IAAIe,EAAM,IAAK,GAAGA,EAAM,KAAK;AAAA,IACrF,sBAAsB,OAAOA,EAAM,wBAAwB,CAAC;AAAA,EAAA,EAC5D,GAGIE,IACJrB,MAAoBsB,EAAgB,YAChCJ,EAAY,IAAI,CAAAC,OAAU;AAAA,IACxB,KAAK,eAAeA,EAAM,IAAK;AAAA,IAC/B,MAAMA,EAAM;AAAA,IACZ,OAAOvD,EAAkB,eAAeuD,EAAM,IAAK,IAAIrD,CAAa;AAAA,IACpE,WAAW;AAAA,EAAA,EACX,IACF;AAEN,SAAO;AAAA,IACL,MAAA8C;AAAA,IACA,0BAAAI;AAAA,IACA,0BAAAC;AAAA,IACA,SAAAG;AAAA,IACA,aAAAC;AAAA,IACA,eAAepB,IAAwB3B,MAA6B;AAAA,EAAA;AAExE;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayrollExecutionFlow.js","sources":["../../../../src/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { createMachine } from 'robot3'\nimport type { PayrollPayPeriodType } from '@gusto/embedded-api/models/components/payrollpayperiodtype'\nimport type { ConfirmWireDetailsComponentType } from '../ConfirmWireDetails/ConfirmWireDetails'\nimport {\n PayrollConfigurationContextual,\n PayrollOverviewContextual,\n SaveAndExitCta,\n type PayrollFlowContextInterface,\n} from '../PayrollFlow/PayrollFlowComponents'\nimport {\n payrollExecutionMachine,\n getPayrollExecutionBreadcrumbsNodes,\n} from './payrollExecutionMachine'\nimport { Flow } from '@/components/Flow/Flow'\nimport type { FlowBreadcrumb } from '@/components/Common/FlowBreadcrumbs/FlowBreadcrumbsTypes'\nimport { buildBreadcrumbs, updateBreadcrumbs } from '@/helpers/breadcrumbHelpers'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport type { EventType } from '@/shared/constants'\n\nconst EMPTY_BREADCRUMBS: FlowBreadcrumb[] = []\n\n/**\n * Entry point for {@link PayrollExecutionFlow}. Determines which screen the flow renders first.\n *\n * @public\n */\nexport type PayrollExecutionInitialState = 'configuration' | 'overview'\n\n/**\n * Props for {@link PayrollExecutionFlow}.\n *\n * @public\n */\nexport interface PayrollExecutionFlowProps {\n /** The associated company identifier. */\n companyId: string\n /**\n * The identifier of the payroll to execute. The payroll must already exist (e.g. created by a\n * prior creation step or by the standard `PayrollFlow` selection).\n */\n payrollId: string\n /** Event handler that receives the `RUN_PAYROLL_*` events emitted during the flow. */\n onEvent: OnEventType<EventType, unknown>\n /** Optional pay period metadata used to seed breadcrumb labels and date context. */\n initialPayPeriod?: PayrollPayPeriodType\n /**\n * When true, surfaces dismissal-specific copy and breadcrumbs (used by `Payroll.DismissalFlow`).\n * Defaults to `false`.\n */\n isDismissalPayroll?: boolean\n /** Optional flag to show or hide reimbursement fields throughout the flow. Defaults to `true`. */\n withReimbursements?: boolean\n /** Optional custom component to replace the default wire details confirmation UI. */\n ConfirmWireDetailsComponent?: ConfirmWireDetailsComponentType\n /**\n * Where the flow starts. Use `'overview'` when you want to drop the user directly on the review\n * screen (e.g. resuming an already-calculated payroll). Defaults to `'configuration'`.\n */\n initialState?: PayrollExecutionInitialState\n}\n\n/**\n * Props for the flow-internal {@link PayrollExecutionInternalFlow}, which layers flow-injected\n * prefix breadcrumbs on top of the public {@link PayrollExecutionFlowProps}.\n *\n * @internal\n */\nexport interface PayrollExecutionInternalFlowProps extends PayrollExecutionFlowProps {\n /**\n * Breadcrumbs prepended to the flow's own breadcrumb trail. Set by a parent flow (e.g. an\n * off-cycle creation step) so the breadcrumb history remains coherent across the handoff.\n */\n prefixBreadcrumbs?: FlowBreadcrumb[]\n}\n\nconst INITIAL_COMPONENT_MAP = {\n configuration: PayrollConfigurationContextual,\n overview: PayrollOverviewContextual,\n} as const\n\nconst INITIAL_NAMESPACE_MAP = {\n configuration: 'Payroll.PayrollConfiguration' as const,\n overview: 'Payroll.PayrollOverview' as const,\n} as const\n\n/**\n * Guided flow to configure, review, and submit a single payroll.\n *\n * @remarks\n * This is the inner flow that powers the back half of `Payroll.PayrollFlow`, and it is also reused\n * by the off-cycle, dismissal, and transition flows after they have created their respective\n * payrolls. Render it directly when you have built your own payroll-creation step and want to hand\n * the user off to the standard execution experience without re-implementing it. The flow ships\n * with breadcrumb navigation and the standard wire-confirmation UX.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `runPayroll/edit` | Fired when user chooses to edit payroll | — |\n * | `runPayroll/calculated` | Fired when payroll calculation completes | `{ payrollUuid, payPeriod?, alert? }` |\n * | `runPayroll/alreadyProcessed` | Fired when the payroll turns out to already be processed while configuring it; the flow moves to the review screen | `{ payrollId, alert?, payPeriod? }` |\n * | `runPayroll/employee/edit` | Fired when user opens an employee row to edit | `{ payrollId, employeeId, firstName, lastName }` |\n * | `runPayroll/employee/saved` | Fired when employee edits are saved | — |\n * | `runPayroll/employee/cancelled` | Fired when employee edits are cancelled | — |\n * | `runPayroll/submitting` | Fired when payroll submission begins | — |\n * | `runPayroll/submitted` | Fired when payroll is successfully submitted | Response from the Submit payroll endpoint |\n * | `runPayroll/processed` | Fired when payroll processing is completed | — |\n * | `runPayroll/processingFailed` | Fired when payroll processing fails | Error details |\n * | `runPayroll/cancelled` | Fired when a payroll is cancelled | Response from the Cancel payroll endpoint |\n * | `runPayroll/receipt/get` | Fired when user requests payroll receipt | `{ payrollId }` |\n * | `runPayroll/receipt/viewed` | Fired when the receipt screen is viewed | — |\n * | `runPayroll/pdfPaystub/viewed` | Fired when user views employee paystub PDF | `{ employeeId }` |\n * | `runPayroll/blockers/viewAll` | Fired when user opens the full blockers list | — |\n * | `payroll/saveAndExit` | Fired when user uses the save-and-exit CTA | — |\n *\n * @components\n * - {@link PayrollConfiguration}\n * - {@link PayrollOverview}\n * - {@link PayrollEditEmployee}\n * - {@link PayrollReceipts}\n * - {@link PayrollBlockerList}\n *\n * @param input - {@link PayrollExecutionFlowProps}\n * @returns The rendered execution flow.\n * @public\n *\n * @example\n * ```tsx title=\"App.tsx\"\n * import { Payroll, type EventType } from '@gusto/embedded-react-sdk'\n *\n * function MyApp() {\n * return (\n * <Payroll.PayrollExecutionFlow\n * companyId=\"a007e1ab-3595-43c2-ab4b-af7a5af2e365\"\n * payrollId=\"0987fcea-7b59-4907-a301-f232b5aff508\"\n * onEvent={(eventType: EventType) => {\n * if (eventType === 'runPayroll/submitted') {\n * // Payroll submitted — navigate to your next screen\n * }\n * }}\n * />\n * )\n * }\n * ```\n */\nexport function PayrollExecutionFlow(props: PayrollExecutionFlowProps) {\n return <PayrollExecutionInternalFlow {...props} />\n}\n\n/**\n * Flow-internal entry point for {@link PayrollExecutionFlow} that additionally accepts\n * flow-injected `prefixBreadcrumbs`. Partners use {@link PayrollExecutionFlow}; our own parent\n * flows (off-cycle, dismissal, transition, and `PayrollFlow`) render this directly to prepend\n * their own breadcrumb trail.\n *\n * @internal\n */\nexport function PayrollExecutionInternalFlow({\n companyId,\n payrollId,\n onEvent,\n initialPayPeriod,\n isDismissalPayroll: isDismissal = false,\n withReimbursements = true,\n ConfirmWireDetailsComponent,\n prefixBreadcrumbs = EMPTY_BREADCRUMBS,\n initialState = 'configuration',\n}: PayrollExecutionInternalFlowProps) {\n const executionFlowMachine = useMemo(() => {\n const breadcrumbNodes = getPayrollExecutionBreadcrumbsNodes(isDismissal)\n const baseBreadcrumbs = buildBreadcrumbs(breadcrumbNodes)\n const displayOnlyPrefixes = prefixBreadcrumbs.map(({ onNavigate, ...rest }) => rest)\n const breadcrumbs = Object.fromEntries(\n Object.entries(baseBreadcrumbs).map(([stateKey, trail]) => [\n stateKey,\n [...displayOnlyPrefixes, ...trail],\n ]),\n )\n\n const initialBreadcrumbContext = updateBreadcrumbs(\n initialState,\n {\n header: {\n type: 'breadcrumbs' as const,\n breadcrumbs,\n cta: SaveAndExitCta,\n },\n },\n {\n startDate: initialPayPeriod?.startDate ?? '',\n endDate: initialPayPeriod?.endDate ?? '',\n },\n )\n\n return createMachine(\n initialState,\n payrollExecutionMachine,\n (initialContext: PayrollFlowContextInterface) => ({\n ...initialContext,\n ...initialBreadcrumbContext,\n component: INITIAL_COMPONENT_MAP[initialState],\n companyId,\n payrollUuid: payrollId,\n payPeriod: initialPayPeriod,\n withReimbursements,\n ConfirmWireDetailsComponent,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: INITIAL_NAMESPACE_MAP[initialState],\n },\n }),\n )\n }, [\n companyId,\n payrollId,\n isDismissal,\n withReimbursements,\n ConfirmWireDetailsComponent,\n prefixBreadcrumbs,\n initialState,\n ])\n\n return <Flow machine={executionFlowMachine} onEvent={onEvent} />\n}\n"],"names":["EMPTY_BREADCRUMBS","INITIAL_COMPONENT_MAP","PayrollConfigurationContextual","PayrollOverviewContextual","INITIAL_NAMESPACE_MAP","PayrollExecutionFlow","props","jsx","PayrollExecutionInternalFlow","companyId","payrollId","onEvent","initialPayPeriod","isDismissal","withReimbursements","ConfirmWireDetailsComponent","prefixBreadcrumbs","initialState","executionFlowMachine","useMemo","breadcrumbNodes","getPayrollExecutionBreadcrumbsNodes","baseBreadcrumbs","buildBreadcrumbs","displayOnlyPrefixes","onNavigate","rest","breadcrumbs","stateKey","trail","initialBreadcrumbContext","updateBreadcrumbs","SaveAndExitCta","createMachine","payrollExecutionMachine","initialContext","Flow"],"mappings":";;;;;;;AAoBA,MAAMA,IAAsC,CAAA,GAwDtCC,IAAwB;AAAA,EAC5B,eAAeC;AAAA,EACf,UAAUC;AACZ,GAEMC,IAAwB;AAAA,EAC5B,eAAe;AAAA,EACf,UAAU;AACZ;AA8DO,SAASC,EAAqBC,GAAkC;AACrE,SAAO,gBAAAC,EAACC,GAAA,EAA8B,GAAGF,EAAA,CAAO;AAClD;AAUO,SAASE,EAA6B;AAAA,EAC3C,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,oBAAoBC,IAAc;AAAA,EAClC,oBAAAC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E;"}
|
|
1
|
+
{"version":3,"file":"PayrollExecutionFlow.js","sources":["../../../../src/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { createMachine } from 'robot3'\nimport type { PayrollPayPeriodType } from '@gusto/embedded-api/models/components/payrollpayperiodtype'\nimport type { ConfirmWireDetailsComponentType } from '../ConfirmWireDetails/ConfirmWireDetails'\nimport {\n PayrollConfigurationContextual,\n PayrollOverviewContextual,\n SaveAndExitCta,\n type PayrollFlowContextInterface,\n} from '../PayrollFlow/PayrollFlowComponents'\nimport {\n payrollExecutionMachine,\n getPayrollExecutionBreadcrumbsNodes,\n} from './payrollExecutionMachine'\nimport { Flow } from '@/components/Flow/Flow'\nimport type { FlowBreadcrumb } from '@/components/Common/FlowBreadcrumbs/FlowBreadcrumbsTypes'\nimport { buildBreadcrumbs, updateBreadcrumbs } from '@/helpers/breadcrumbHelpers'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport type { EventType } from '@/shared/constants'\n\nconst EMPTY_BREADCRUMBS: FlowBreadcrumb[] = []\n\n/**\n * Entry point for {@link PayrollExecutionFlow}. Determines which screen the flow renders first.\n *\n * @public\n */\nexport type PayrollExecutionInitialState = 'configuration' | 'overview'\n\n/**\n * Props for {@link PayrollExecutionFlow}.\n *\n * @public\n */\nexport interface PayrollExecutionFlowProps {\n /** The associated company identifier. */\n companyId: string\n /**\n * The identifier of the payroll to execute. The payroll must already exist (e.g. created by a\n * prior creation step or by the standard `PayrollFlow` selection). For a transition payroll,\n * render {@link TransitionConfiguration} first and pass the same ID here after it emits\n * `transition/configured`.\n */\n payrollId: string\n /** Event handler that receives the `RUN_PAYROLL_*` events emitted during the flow. */\n onEvent: OnEventType<EventType, unknown>\n /** Optional pay period metadata used to seed breadcrumb labels and date context. */\n initialPayPeriod?: PayrollPayPeriodType\n /**\n * When true, surfaces dismissal-specific copy and breadcrumbs (used by `Payroll.DismissalFlow`).\n * Defaults to `false`.\n */\n isDismissalPayroll?: boolean\n /** Optional flag to show or hide reimbursement fields throughout the flow. Defaults to `true`. */\n withReimbursements?: boolean\n /** Optional custom component to replace the default wire details confirmation UI. */\n ConfirmWireDetailsComponent?: ConfirmWireDetailsComponentType\n /**\n * Where the flow starts. Use `'overview'` when you want to drop the user directly on the review\n * screen (e.g. resuming an already-calculated payroll). Defaults to `'configuration'`.\n */\n initialState?: PayrollExecutionInitialState\n}\n\n/**\n * Props for the flow-internal {@link PayrollExecutionInternalFlow}, which layers flow-injected\n * prefix breadcrumbs on top of the public {@link PayrollExecutionFlowProps}.\n *\n * @internal\n */\nexport interface PayrollExecutionInternalFlowProps extends PayrollExecutionFlowProps {\n /**\n * Breadcrumbs prepended to the flow's own breadcrumb trail. Set by a parent flow (e.g. an\n * off-cycle creation step) so the breadcrumb history remains coherent across the handoff.\n */\n prefixBreadcrumbs?: FlowBreadcrumb[]\n}\n\nconst INITIAL_COMPONENT_MAP = {\n configuration: PayrollConfigurationContextual,\n overview: PayrollOverviewContextual,\n} as const\n\nconst INITIAL_NAMESPACE_MAP = {\n configuration: 'Payroll.PayrollConfiguration' as const,\n overview: 'Payroll.PayrollOverview' as const,\n} as const\n\n/**\n * Guided flow to configure, review, and submit a single payroll.\n *\n * @remarks\n * This is the inner flow that powers the back half of `Payroll.PayrollFlow`, and it is also reused\n * by the off-cycle and dismissal flows after they have created their respective payrolls. Render it\n * directly when you have built your own payroll-creation step and want to hand the user off to the\n * standard execution experience without re-implementing it. The flow ships with breadcrumb\n * navigation and the standard wire-confirmation UX.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `runPayroll/edit` | Fired when user chooses to edit payroll | — |\n * | `runPayroll/calculated` | Fired when payroll calculation completes | `{ payrollUuid, payPeriod?, alert? }` |\n * | `runPayroll/alreadyProcessed` | Fired when the payroll turns out to already be processed while configuring it; the flow moves to the review screen | `{ payrollId, alert?, payPeriod? }` |\n * | `runPayroll/employee/edit` | Fired when user opens an employee row to edit | `{ payrollId, employeeId, firstName, lastName }` |\n * | `runPayroll/employee/saved` | Fired when employee edits are saved | — |\n * | `runPayroll/employee/cancelled` | Fired when employee edits are cancelled | — |\n * | `runPayroll/submitting` | Fired when payroll submission begins | — |\n * | `runPayroll/submitted` | Fired when payroll is successfully submitted | Response from the Submit payroll endpoint |\n * | `runPayroll/processed` | Fired when payroll processing is completed | — |\n * | `runPayroll/processingFailed` | Fired when payroll processing fails | Error details |\n * | `runPayroll/cancelled` | Fired when a payroll is cancelled | Response from the Cancel payroll endpoint |\n * | `runPayroll/receipt/get` | Fired when user requests payroll receipt | `{ payrollId }` |\n * | `runPayroll/receipt/viewed` | Fired when the receipt screen is viewed | — |\n * | `runPayroll/pdfPaystub/viewed` | Fired when user views employee paystub PDF | `{ employeeId }` |\n * | `runPayroll/blockers/viewAll` | Fired when user opens the full blockers list | — |\n * | `payroll/saveAndExit` | Fired when user uses the save-and-exit CTA | — |\n *\n * @components\n * - {@link PayrollConfiguration}\n * - {@link PayrollOverview}\n * - {@link PayrollEditEmployee}\n * - {@link PayrollReceipts}\n * - {@link PayrollBlockerList}\n *\n * @param input - {@link PayrollExecutionFlowProps}\n * @returns The rendered execution flow.\n * @public\n *\n * @example\n * ```tsx title=\"App.tsx\"\n * import { Payroll, type EventType } from '@gusto/embedded-react-sdk'\n *\n * function MyApp() {\n * return (\n * <Payroll.PayrollExecutionFlow\n * companyId=\"a007e1ab-3595-43c2-ab4b-af7a5af2e365\"\n * payrollId=\"0987fcea-7b59-4907-a301-f232b5aff508\"\n * onEvent={(eventType: EventType) => {\n * if (eventType === 'runPayroll/submitted') {\n * // Payroll submitted — navigate to your next screen\n * }\n * }}\n * />\n * )\n * }\n * ```\n */\nexport function PayrollExecutionFlow(props: PayrollExecutionFlowProps) {\n return <PayrollExecutionInternalFlow {...props} />\n}\n\n/**\n * Flow-internal entry point for {@link PayrollExecutionFlow} that additionally accepts\n * flow-injected `prefixBreadcrumbs`. Partners use {@link PayrollExecutionFlow}; our own parent\n * flows (off-cycle, dismissal, and `PayrollFlow`) render this directly to prepend\n * their own breadcrumb trail.\n *\n * @internal\n */\nexport function PayrollExecutionInternalFlow({\n companyId,\n payrollId,\n onEvent,\n initialPayPeriod,\n isDismissalPayroll: isDismissal = false,\n withReimbursements = true,\n ConfirmWireDetailsComponent,\n prefixBreadcrumbs = EMPTY_BREADCRUMBS,\n initialState = 'configuration',\n}: PayrollExecutionInternalFlowProps) {\n const executionFlowMachine = useMemo(() => {\n const breadcrumbNodes = getPayrollExecutionBreadcrumbsNodes(isDismissal)\n const baseBreadcrumbs = buildBreadcrumbs(breadcrumbNodes)\n const displayOnlyPrefixes = prefixBreadcrumbs.map(({ onNavigate, ...rest }) => rest)\n const breadcrumbs = Object.fromEntries(\n Object.entries(baseBreadcrumbs).map(([stateKey, trail]) => [\n stateKey,\n [...displayOnlyPrefixes, ...trail],\n ]),\n )\n\n const initialBreadcrumbContext = updateBreadcrumbs(\n initialState,\n {\n header: {\n type: 'breadcrumbs' as const,\n breadcrumbs,\n cta: SaveAndExitCta,\n },\n },\n {\n startDate: initialPayPeriod?.startDate ?? '',\n endDate: initialPayPeriod?.endDate ?? '',\n },\n )\n\n return createMachine(\n initialState,\n payrollExecutionMachine,\n (initialContext: PayrollFlowContextInterface) => ({\n ...initialContext,\n ...initialBreadcrumbContext,\n component: INITIAL_COMPONENT_MAP[initialState],\n companyId,\n payrollUuid: payrollId,\n payPeriod: initialPayPeriod,\n withReimbursements,\n ConfirmWireDetailsComponent,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: INITIAL_NAMESPACE_MAP[initialState],\n },\n }),\n )\n }, [\n companyId,\n payrollId,\n isDismissal,\n withReimbursements,\n ConfirmWireDetailsComponent,\n prefixBreadcrumbs,\n initialState,\n ])\n\n return <Flow machine={executionFlowMachine} onEvent={onEvent} />\n}\n"],"names":["EMPTY_BREADCRUMBS","INITIAL_COMPONENT_MAP","PayrollConfigurationContextual","PayrollOverviewContextual","INITIAL_NAMESPACE_MAP","PayrollExecutionFlow","props","jsx","PayrollExecutionInternalFlow","companyId","payrollId","onEvent","initialPayPeriod","isDismissal","withReimbursements","ConfirmWireDetailsComponent","prefixBreadcrumbs","initialState","executionFlowMachine","useMemo","breadcrumbNodes","getPayrollExecutionBreadcrumbsNodes","baseBreadcrumbs","buildBreadcrumbs","displayOnlyPrefixes","onNavigate","rest","breadcrumbs","stateKey","trail","initialBreadcrumbContext","updateBreadcrumbs","SaveAndExitCta","createMachine","payrollExecutionMachine","initialContext","Flow"],"mappings":";;;;;;;AAoBA,MAAMA,IAAsC,CAAA,GA0DtCC,IAAwB;AAAA,EAC5B,eAAeC;AAAA,EACf,UAAUC;AACZ,GAEMC,IAAwB;AAAA,EAC5B,eAAe;AAAA,EACf,UAAU;AACZ;AA8DO,SAASC,EAAqBC,GAAkC;AACrE,SAAO,gBAAAC,EAACC,GAAA,EAA8B,GAAGF,EAAA,CAAO;AAClD;AAUO,SAASE,EAA6B;AAAA,EAC3C,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,oBAAoBC,IAAc;AAAA,EAClC,oBAAAC,IAAqB;AAAA,EACrB,6BAAAC;AAAA,EACA,mBAAAC,IAAoBhB;AAAA,EACpB,cAAAiB,IAAe;AACjB,GAAsC;AACpC,QAAMC,IAAuBC,EAAQ,MAAM;AACzC,UAAMC,IAAkBC,EAAoCR,CAAW,GACjES,IAAkBC,EAAiBH,CAAe,GAClDI,IAAsBR,EAAkB,IAAI,CAAC,EAAE,YAAAS,GAAY,GAAGC,EAAA,MAAWA,CAAI,GAC7EC,IAAc,OAAO;AAAA,MACzB,OAAO,QAAQL,CAAe,EAAE,IAAI,CAAC,CAACM,GAAUC,CAAK,MAAM;AAAA,QACzDD;AAAA,QACA,CAAC,GAAGJ,GAAqB,GAAGK,CAAK;AAAA,MAAA,CAClC;AAAA,IAAA,GAGGC,IAA2BC;AAAA,MAC/Bd;AAAA,MACA;AAAA,QACE,QAAQ;AAAA,UACN,MAAM;AAAA,UACN,aAAAU;AAAA,UACA,KAAKK;AAAA,QAAA;AAAA,MACP;AAAA,MAEF;AAAA,QACE,WAAWpB,GAAkB,aAAa;AAAA,QAC1C,SAASA,GAAkB,WAAW;AAAA,MAAA;AAAA,IACxC;AAGF,WAAOqB;AAAA,MACLhB;AAAA,MACAiB;AAAA,MACA,CAACC,OAAiD;AAAA,QAChD,GAAGA;AAAA,QACH,GAAGL;AAAA,QACH,WAAW7B,EAAsBgB,CAAY;AAAA,QAC7C,WAAAR;AAAA,QACA,aAAaC;AAAA,QACb,WAAWE;AAAA,QACX,oBAAAE;AAAA,QACA,6BAAAC;AAAA,QACA,WAAW;AAAA,UACT,UAAU;AAAA,UACV,WAAWX,EAAsBa,CAAY;AAAA,QAAA;AAAA,MAC/C;AAAA,IACF;AAAA,EAEJ,GAAG;AAAA,IACDR;AAAA,IACAC;AAAA,IACAG;AAAA,IACAC;AAAA,IACAC;AAAA,IACAC;AAAA,IACAC;AAAA,EAAA,CACD;AAED,SAAO,gBAAAV,EAAC6B,GAAA,EAAK,SAASlB,GAAsB,SAAAP,EAAA,CAAkB;AAChE;"}
|
|
@@ -220,10 +220,6 @@ const n = v(), I = (e = !1) => ({
|
|
|
220
220
|
blockers: d(n("configuration"))
|
|
221
221
|
};
|
|
222
222
|
export {
|
|
223
|
-
L as alreadyProcessedTransition,
|
|
224
|
-
E as blockersViewAllTransition,
|
|
225
|
-
g as calculatedTransition,
|
|
226
|
-
D as employeeEditTransition,
|
|
227
223
|
I as getPayrollExecutionBreadcrumbsNodes,
|
|
228
224
|
B as payrollExecutionMachine
|
|
229
225
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payrollExecutionMachine.js","sources":["../../../../src/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.ts"],"sourcesContent":["import { transition, reduce, state, guard } from 'robot3'\nimport type { PayrollPayPeriodType } from '@gusto/embedded-api/models/components/payrollpayperiodtype'\nimport type { PayrollFlowAlert } from '../PayrollFlow/PayrollFlowComponents'\nimport {\n PayrollConfigurationContextual,\n PayrollOverviewContextual,\n PayrollEditEmployeeContextual,\n PayrollReceiptsContextual,\n PayrollBlockerContextual,\n type PayrollFlowContextInterface,\n} from '../PayrollFlow/PayrollFlowComponents'\nimport { componentEvents } from '@/shared/constants'\nimport type { MachineEventType, MachineTransition } from '@/types/Helpers'\nimport {\n hideBreadcrumb,\n patchBreadcrumbsHeader,\n updateBreadcrumbs,\n} from '@/helpers/breadcrumbHelpers'\nimport type {\n BreadcrumbNode,\n BreadcrumbNodes,\n} from '@/components/Common/FlowBreadcrumbs/FlowBreadcrumbsTypes'\nimport { createBreadcrumbNavigateTransition } from '@/components/Common/FlowBreadcrumbs/breadcrumbTransitionHelpers'\n\ntype PayrollEventPayloads = {\n [componentEvents.RUN_PAYROLL_EMPLOYEE_EDIT]: {\n payrollId: string\n employeeId: string\n firstName: string\n lastName: string\n }\n [componentEvents.RUN_PAYROLL_CALCULATED]: {\n payrollUuid: string\n alert?: PayrollFlowAlert\n payPeriod?: PayrollPayPeriodType\n }\n [componentEvents.RUN_PAYROLL_ALREADY_PROCESSED]: {\n payrollId: string\n alert?: PayrollFlowAlert\n payPeriod?: PayrollPayPeriodType\n }\n [componentEvents.BREADCRUMB_NAVIGATE]: {\n key: string\n onNavigate: (ctx: PayrollFlowContextInterface) => PayrollFlowContextInterface\n }\n [componentEvents.RUN_PAYROLL_BLOCKERS_VIEW_ALL]: undefined\n [componentEvents.RUN_PAYROLL_EDIT]: undefined\n}\n\nconst breadcrumbNavigateTransition =\n createBreadcrumbNavigateTransition<PayrollFlowContextInterface>()\n\ntype BreadcrumbNodeKeys = 'configuration' | 'overview' | 'editEmployee' | 'receipts' | 'blockers'\n\n/** @internal */\nexport const getPayrollExecutionBreadcrumbsNodes = (\n isDismissal: boolean = false,\n): BreadcrumbNodes => {\n const configLabel = isDismissal ? 'breadcrumbLabelDismissal' : 'breadcrumbLabel'\n\n return {\n configuration: {\n parent: null,\n item: {\n id: 'configuration',\n label: configLabel,\n namespace: 'Payroll.PayrollConfiguration',\n onNavigate: ((ctx: PayrollFlowContextInterface) => ({\n ...updateBreadcrumbs('configuration', ctx, {\n startDate: ctx.payPeriod?.startDate ?? '',\n endDate: ctx.payPeriod?.endDate ?? '',\n }),\n component: PayrollConfigurationContextual,\n alerts: undefined,\n })) as (context: unknown) => unknown,\n },\n },\n overview: {\n parent: 'configuration',\n item: {\n id: 'overview',\n label: 'breadcrumbLabel',\n namespace: 'Payroll.PayrollOverview',\n onNavigate: ((ctx: PayrollFlowContextInterface) => ({\n ...updateBreadcrumbs('overview', ctx, {\n startDate: ctx.payPeriod?.startDate ?? '',\n endDate: ctx.payPeriod?.endDate ?? '',\n }),\n component: PayrollOverviewContextual,\n alerts: undefined,\n })) as (context: unknown) => unknown,\n },\n },\n editEmployee: {\n parent: 'configuration',\n item: {\n id: 'editEmployee',\n label: 'breadcrumbLabel',\n namespace: 'Payroll.PayrollEditEmployee',\n },\n },\n receipts: {\n parent: 'overview',\n item: {\n id: 'receipts',\n label: 'breadcrumbLabel',\n namespace: 'Payroll.PayrollReceipts',\n },\n },\n blockers: {\n parent: 'configuration',\n item: {\n id: 'blockers',\n label: 'breadcrumbLabel',\n namespace: 'Payroll.PayrollBlocker',\n },\n },\n } satisfies Record<BreadcrumbNodeKeys, BreadcrumbNode>\n}\n\n/** @internal */\nexport const calculatedTransition = transition(\n componentEvents.RUN_PAYROLL_CALCULATED,\n 'overview',\n reduce(\n (\n ctx: PayrollFlowContextInterface,\n ev: MachineEventType<PayrollEventPayloads, typeof componentEvents.RUN_PAYROLL_CALCULATED>,\n ): PayrollFlowContextInterface => {\n return {\n ...updateBreadcrumbs('overview', ctx, {\n startDate: ev.payload.payPeriod?.startDate ?? '',\n endDate: ev.payload.payPeriod?.endDate ?? '',\n }),\n component: PayrollOverviewContextual,\n payPeriod: ev.payload.payPeriod ?? ctx.payPeriod,\n alerts: ev.payload.alert\n ? [{ ...ev.payload.alert, alertKey: 'progressSaved' as const }]\n : undefined,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: 'Payroll.PayrollOverview',\n },\n }\n },\n ),\n)\n\n/** @internal */\nexport const alreadyProcessedTransition = transition(\n componentEvents.RUN_PAYROLL_ALREADY_PROCESSED,\n 'overview',\n reduce(\n (\n ctx: PayrollFlowContextInterface,\n ev: MachineEventType<\n PayrollEventPayloads,\n typeof componentEvents.RUN_PAYROLL_ALREADY_PROCESSED\n >,\n ): PayrollFlowContextInterface => {\n const payPeriod = ev.payload.payPeriod ?? ctx.payPeriod\n return {\n ...updateBreadcrumbs('overview', ctx, {\n startDate: payPeriod?.startDate ?? '',\n endDate: payPeriod?.endDate ?? '',\n }),\n component: PayrollOverviewContextual,\n payPeriod,\n alerts: ev.payload.alert\n ? [{ ...ev.payload.alert, alertKey: 'alreadyProcessed' as const }]\n : undefined,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: 'Payroll.PayrollOverview',\n },\n }\n },\n ),\n)\n\n/** @internal */\nexport const employeeEditTransition = transition(\n componentEvents.RUN_PAYROLL_EMPLOYEE_EDIT,\n 'editEmployee',\n reduce(\n (\n ctx: PayrollFlowContextInterface,\n ev: MachineEventType<PayrollEventPayloads, typeof componentEvents.RUN_PAYROLL_EMPLOYEE_EDIT>,\n ): PayrollFlowContextInterface => {\n return {\n ...updateBreadcrumbs('editEmployee', ctx, {\n firstName: ev.payload.firstName,\n lastName: ev.payload.lastName,\n startDate: ctx.payPeriod?.startDate ?? '',\n endDate: ctx.payPeriod?.endDate ?? '',\n }),\n component: PayrollEditEmployeeContextual,\n employeeId: ev.payload.employeeId,\n firstName: ev.payload.firstName,\n lastName: ev.payload.lastName,\n alerts: undefined,\n ctaConfig: null,\n }\n },\n ),\n)\n\n/** @internal */\nexport const blockersViewAllTransition = transition(\n componentEvents.RUN_PAYROLL_BLOCKERS_VIEW_ALL,\n 'blockers',\n reduce((ctx: PayrollFlowContextInterface): PayrollFlowContextInterface => {\n return {\n ...updateBreadcrumbs('blockers', ctx),\n component: PayrollBlockerContextual,\n alerts: undefined,\n }\n }),\n)\n\nconst notSubmitted = (ctx: PayrollFlowContextInterface) => !ctx.hasPayrollSubmissionStarted\n\nconst editPayrollTransition = transition(\n componentEvents.RUN_PAYROLL_EDIT,\n 'configuration',\n guard(notSubmitted),\n reduce((ctx: PayrollFlowContextInterface): PayrollFlowContextInterface => {\n return {\n ...updateBreadcrumbs('configuration', ctx, {\n startDate: ctx.payPeriod?.startDate ?? '',\n endDate: ctx.payPeriod?.endDate ?? '',\n }),\n component: PayrollConfigurationContextual,\n alerts: undefined,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: 'Payroll.PayrollConfiguration',\n },\n }\n }),\n)\n\nconst payrollSubmittingTransition = transition(\n componentEvents.RUN_PAYROLL_SUBMITTING,\n 'overview',\n reduce((ctx: PayrollFlowContextInterface): PayrollFlowContextInterface => ({\n ...hideBreadcrumb('configuration', ctx),\n hasPayrollSubmissionStarted: true,\n })),\n)\n\nconst receiptGetTransition = transition(\n componentEvents.RUN_PAYROLL_RECEIPT_GET,\n 'receipts',\n reduce((ctx: PayrollFlowContextInterface): PayrollFlowContextInterface => ({\n ...updateBreadcrumbs('receipts', ctx, {\n startDate: ctx.payPeriod?.startDate ?? '',\n endDate: ctx.payPeriod?.endDate ?? '',\n }),\n component: PayrollReceiptsContextual,\n alerts: undefined,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: 'Payroll.PayrollReceipts',\n },\n })),\n)\n\nconst employeeSavedTransition = transition(\n componentEvents.RUN_PAYROLL_EMPLOYEE_SAVED,\n 'configuration',\n reduce((ctx: PayrollFlowContextInterface): PayrollFlowContextInterface => ({\n ...patchBreadcrumbsHeader(ctx, { currentBreadcrumbId: 'configuration' }),\n component: PayrollConfigurationContextual,\n alerts: undefined,\n employeeId: undefined,\n firstName: undefined,\n lastName: undefined,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: 'Payroll.PayrollConfiguration',\n },\n })),\n)\n\nconst employeeCancelledTransition = transition(\n componentEvents.RUN_PAYROLL_EMPLOYEE_CANCELLED,\n 'configuration',\n reduce((ctx: PayrollFlowContextInterface): PayrollFlowContextInterface => ({\n ...patchBreadcrumbsHeader(ctx, { currentBreadcrumbId: 'configuration' }),\n component: PayrollConfigurationContextual,\n alerts: undefined,\n employeeId: undefined,\n firstName: undefined,\n lastName: undefined,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: 'Payroll.PayrollConfiguration',\n },\n })),\n)\n\n/** @internal */\nexport const payrollExecutionMachine = {\n configuration: state<MachineTransition>(\n breadcrumbNavigateTransition('configuration'),\n calculatedTransition,\n alreadyProcessedTransition,\n employeeEditTransition,\n blockersViewAllTransition,\n ),\n overview: state<MachineTransition>(\n breadcrumbNavigateTransition('configuration', notSubmitted),\n payrollSubmittingTransition,\n editPayrollTransition,\n receiptGetTransition,\n ),\n editEmployee: state<MachineTransition>(\n breadcrumbNavigateTransition('configuration'),\n employeeSavedTransition,\n employeeCancelledTransition,\n ),\n receipts: state<MachineTransition>(\n breadcrumbNavigateTransition('configuration'),\n breadcrumbNavigateTransition('overview'),\n ),\n blockers: state<MachineTransition>(breadcrumbNavigateTransition('configuration')),\n}\n"],"names":["breadcrumbNavigateTransition","createBreadcrumbNavigateTransition","getPayrollExecutionBreadcrumbsNodes","isDismissal","ctx","updateBreadcrumbs","PayrollConfigurationContextual","PayrollOverviewContextual","calculatedTransition","transition","componentEvents","reduce","ev","alreadyProcessedTransition","payPeriod","employeeEditTransition","PayrollEditEmployeeContextual","blockersViewAllTransition","PayrollBlockerContextual","notSubmitted","editPayrollTransition","guard","payrollSubmittingTransition","hideBreadcrumb","receiptGetTransition","PayrollReceiptsContextual","employeeSavedTransition","patchBreadcrumbsHeader","employeeCancelledTransition","payrollExecutionMachine","state"],"mappings":";;;;;AAiDA,MAAMA,IACJC,EAAA,GAKWC,IAAsC,CACjDC,IAAuB,QAIhB;AAAA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B;AAAA,EACAC,EAAO,CAACP,OAAmE;AAAA,IACzE,GAAGuB,EAAuBvB,GAAK,EAAE,qBAAqB,iBAAiB;AAAA,IACvE,WAAWE;AAAA,IACX,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,UAAU;AAAA,IACV,WAAW;AAAA,MACT,UAAU;AAAA,MACV,WAAW;AAAA,IAAA;AAAA,EACb,EACA;AACJ,GAEMsB,IAA8BnB;AAAA,EAClCC,EAAgB;AAAA,EAChB;AAAA,EACAC,EAAO,CAACP,OAAmE;AAAA,IACzE,GAAGuB,EAAuBvB,GAAK,EAAE,qBAAqB,iBAAiB;AAAA,IACvE,WAAWE;AAAA,IACX,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,UAAU;AAAA,IACV,WAAW;AAAA,MACT,UAAU;AAAA,MACV,WAAW;AAAA,IAAA;AAAA,EACb,EACA;AACJ,GAGauB,IAA0B;AAAA,EACrC,eAAeC;AAAA,IACb9B,EAA6B,eAAe;AAAA,IAC5CQ;AAAA,IACAK;AAAA,IACAE;AAAA,IACAE;AAAA,EAAA;AAAA,EAEF,UAAUa;AAAA,IACR9B,EAA6B,iBAAiBmB,CAAY;AAAA,IAC1DG;AAAA,IACAF;AAAA,IACAI;AAAA,EAAA;AAAA,EAEF,cAAcM;AAAA,IACZ9B,EAA6B,eAAe;AAAA,IAC5C0B;AAAA,IACAE;AAAA,EAAA;AAAA,EAEF,UAAUE;AAAA,IACR9B,EAA6B,eAAe;AAAA,IAC5CA,EAA6B,UAAU;AAAA,EAAA;AAAA,EAEzC,UAAU8B,EAAyB9B,EAA6B,eAAe,CAAC;AAClF;"}
|
|
1
|
+
{"version":3,"file":"payrollExecutionMachine.js","sources":["../../../../src/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.ts"],"sourcesContent":["import { transition, reduce, state, guard } from 'robot3'\nimport type { PayrollPayPeriodType } from '@gusto/embedded-api/models/components/payrollpayperiodtype'\nimport type { PayrollFlowAlert } from '../PayrollFlow/PayrollFlowComponents'\nimport {\n PayrollConfigurationContextual,\n PayrollOverviewContextual,\n PayrollEditEmployeeContextual,\n PayrollReceiptsContextual,\n PayrollBlockerContextual,\n type PayrollFlowContextInterface,\n} from '../PayrollFlow/PayrollFlowComponents'\nimport { componentEvents } from '@/shared/constants'\nimport type { MachineEventType, MachineTransition } from '@/types/Helpers'\nimport {\n hideBreadcrumb,\n patchBreadcrumbsHeader,\n updateBreadcrumbs,\n} from '@/helpers/breadcrumbHelpers'\nimport type {\n BreadcrumbNode,\n BreadcrumbNodes,\n} from '@/components/Common/FlowBreadcrumbs/FlowBreadcrumbsTypes'\nimport { createBreadcrumbNavigateTransition } from '@/components/Common/FlowBreadcrumbs/breadcrumbTransitionHelpers'\n\ntype PayrollEventPayloads = {\n [componentEvents.RUN_PAYROLL_EMPLOYEE_EDIT]: {\n payrollId: string\n employeeId: string\n firstName: string\n lastName: string\n }\n [componentEvents.RUN_PAYROLL_CALCULATED]: {\n payrollUuid: string\n alert?: PayrollFlowAlert\n payPeriod?: PayrollPayPeriodType\n }\n [componentEvents.RUN_PAYROLL_ALREADY_PROCESSED]: {\n payrollId: string\n alert?: PayrollFlowAlert\n payPeriod?: PayrollPayPeriodType\n }\n [componentEvents.BREADCRUMB_NAVIGATE]: {\n key: string\n onNavigate: (ctx: PayrollFlowContextInterface) => PayrollFlowContextInterface\n }\n [componentEvents.RUN_PAYROLL_BLOCKERS_VIEW_ALL]: undefined\n [componentEvents.RUN_PAYROLL_EDIT]: undefined\n}\n\nconst breadcrumbNavigateTransition =\n createBreadcrumbNavigateTransition<PayrollFlowContextInterface>()\n\ntype BreadcrumbNodeKeys = 'configuration' | 'overview' | 'editEmployee' | 'receipts' | 'blockers'\n\n/** @internal */\nexport const getPayrollExecutionBreadcrumbsNodes = (\n isDismissal: boolean = false,\n): BreadcrumbNodes => {\n const configLabel = isDismissal ? 'breadcrumbLabelDismissal' : 'breadcrumbLabel'\n\n return {\n configuration: {\n parent: null,\n item: {\n id: 'configuration',\n label: configLabel,\n namespace: 'Payroll.PayrollConfiguration',\n onNavigate: ((ctx: PayrollFlowContextInterface) => ({\n ...updateBreadcrumbs('configuration', ctx, {\n startDate: ctx.payPeriod?.startDate ?? '',\n endDate: ctx.payPeriod?.endDate ?? '',\n }),\n component: PayrollConfigurationContextual,\n alerts: undefined,\n })) as (context: unknown) => unknown,\n },\n },\n overview: {\n parent: 'configuration',\n item: {\n id: 'overview',\n label: 'breadcrumbLabel',\n namespace: 'Payroll.PayrollOverview',\n onNavigate: ((ctx: PayrollFlowContextInterface) => ({\n ...updateBreadcrumbs('overview', ctx, {\n startDate: ctx.payPeriod?.startDate ?? '',\n endDate: ctx.payPeriod?.endDate ?? '',\n }),\n component: PayrollOverviewContextual,\n alerts: undefined,\n })) as (context: unknown) => unknown,\n },\n },\n editEmployee: {\n parent: 'configuration',\n item: {\n id: 'editEmployee',\n label: 'breadcrumbLabel',\n namespace: 'Payroll.PayrollEditEmployee',\n },\n },\n receipts: {\n parent: 'overview',\n item: {\n id: 'receipts',\n label: 'breadcrumbLabel',\n namespace: 'Payroll.PayrollReceipts',\n },\n },\n blockers: {\n parent: 'configuration',\n item: {\n id: 'blockers',\n label: 'breadcrumbLabel',\n namespace: 'Payroll.PayrollBlocker',\n },\n },\n } satisfies Record<BreadcrumbNodeKeys, BreadcrumbNode>\n}\n\nconst calculatedTransition = transition(\n componentEvents.RUN_PAYROLL_CALCULATED,\n 'overview',\n reduce(\n (\n ctx: PayrollFlowContextInterface,\n ev: MachineEventType<PayrollEventPayloads, typeof componentEvents.RUN_PAYROLL_CALCULATED>,\n ): PayrollFlowContextInterface => {\n return {\n ...updateBreadcrumbs('overview', ctx, {\n startDate: ev.payload.payPeriod?.startDate ?? '',\n endDate: ev.payload.payPeriod?.endDate ?? '',\n }),\n component: PayrollOverviewContextual,\n payPeriod: ev.payload.payPeriod ?? ctx.payPeriod,\n alerts: ev.payload.alert\n ? [{ ...ev.payload.alert, alertKey: 'progressSaved' as const }]\n : undefined,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: 'Payroll.PayrollOverview',\n },\n }\n },\n ),\n)\n\nconst alreadyProcessedTransition = transition(\n componentEvents.RUN_PAYROLL_ALREADY_PROCESSED,\n 'overview',\n reduce(\n (\n ctx: PayrollFlowContextInterface,\n ev: MachineEventType<\n PayrollEventPayloads,\n typeof componentEvents.RUN_PAYROLL_ALREADY_PROCESSED\n >,\n ): PayrollFlowContextInterface => {\n const payPeriod = ev.payload.payPeriod ?? ctx.payPeriod\n return {\n ...updateBreadcrumbs('overview', ctx, {\n startDate: payPeriod?.startDate ?? '',\n endDate: payPeriod?.endDate ?? '',\n }),\n component: PayrollOverviewContextual,\n payPeriod,\n alerts: ev.payload.alert\n ? [{ ...ev.payload.alert, alertKey: 'alreadyProcessed' as const }]\n : undefined,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: 'Payroll.PayrollOverview',\n },\n }\n },\n ),\n)\n\nconst employeeEditTransition = transition(\n componentEvents.RUN_PAYROLL_EMPLOYEE_EDIT,\n 'editEmployee',\n reduce(\n (\n ctx: PayrollFlowContextInterface,\n ev: MachineEventType<PayrollEventPayloads, typeof componentEvents.RUN_PAYROLL_EMPLOYEE_EDIT>,\n ): PayrollFlowContextInterface => {\n return {\n ...updateBreadcrumbs('editEmployee', ctx, {\n firstName: ev.payload.firstName,\n lastName: ev.payload.lastName,\n startDate: ctx.payPeriod?.startDate ?? '',\n endDate: ctx.payPeriod?.endDate ?? '',\n }),\n component: PayrollEditEmployeeContextual,\n employeeId: ev.payload.employeeId,\n firstName: ev.payload.firstName,\n lastName: ev.payload.lastName,\n alerts: undefined,\n ctaConfig: null,\n }\n },\n ),\n)\n\nconst blockersViewAllTransition = transition(\n componentEvents.RUN_PAYROLL_BLOCKERS_VIEW_ALL,\n 'blockers',\n reduce((ctx: PayrollFlowContextInterface): PayrollFlowContextInterface => {\n return {\n ...updateBreadcrumbs('blockers', ctx),\n component: PayrollBlockerContextual,\n alerts: undefined,\n }\n }),\n)\n\nconst notSubmitted = (ctx: PayrollFlowContextInterface) => !ctx.hasPayrollSubmissionStarted\n\nconst editPayrollTransition = transition(\n componentEvents.RUN_PAYROLL_EDIT,\n 'configuration',\n guard(notSubmitted),\n reduce((ctx: PayrollFlowContextInterface): PayrollFlowContextInterface => {\n return {\n ...updateBreadcrumbs('configuration', ctx, {\n startDate: ctx.payPeriod?.startDate ?? '',\n endDate: ctx.payPeriod?.endDate ?? '',\n }),\n component: PayrollConfigurationContextual,\n alerts: undefined,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: 'Payroll.PayrollConfiguration',\n },\n }\n }),\n)\n\nconst payrollSubmittingTransition = transition(\n componentEvents.RUN_PAYROLL_SUBMITTING,\n 'overview',\n reduce((ctx: PayrollFlowContextInterface): PayrollFlowContextInterface => ({\n ...hideBreadcrumb('configuration', ctx),\n hasPayrollSubmissionStarted: true,\n })),\n)\n\nconst receiptGetTransition = transition(\n componentEvents.RUN_PAYROLL_RECEIPT_GET,\n 'receipts',\n reduce((ctx: PayrollFlowContextInterface): PayrollFlowContextInterface => ({\n ...updateBreadcrumbs('receipts', ctx, {\n startDate: ctx.payPeriod?.startDate ?? '',\n endDate: ctx.payPeriod?.endDate ?? '',\n }),\n component: PayrollReceiptsContextual,\n alerts: undefined,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: 'Payroll.PayrollReceipts',\n },\n })),\n)\n\nconst employeeSavedTransition = transition(\n componentEvents.RUN_PAYROLL_EMPLOYEE_SAVED,\n 'configuration',\n reduce((ctx: PayrollFlowContextInterface): PayrollFlowContextInterface => ({\n ...patchBreadcrumbsHeader(ctx, { currentBreadcrumbId: 'configuration' }),\n component: PayrollConfigurationContextual,\n alerts: undefined,\n employeeId: undefined,\n firstName: undefined,\n lastName: undefined,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: 'Payroll.PayrollConfiguration',\n },\n })),\n)\n\nconst employeeCancelledTransition = transition(\n componentEvents.RUN_PAYROLL_EMPLOYEE_CANCELLED,\n 'configuration',\n reduce((ctx: PayrollFlowContextInterface): PayrollFlowContextInterface => ({\n ...patchBreadcrumbsHeader(ctx, { currentBreadcrumbId: 'configuration' }),\n component: PayrollConfigurationContextual,\n alerts: undefined,\n employeeId: undefined,\n firstName: undefined,\n lastName: undefined,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: 'Payroll.PayrollConfiguration',\n },\n })),\n)\n\n/** @internal */\nexport const payrollExecutionMachine = {\n configuration: state<MachineTransition>(\n breadcrumbNavigateTransition('configuration'),\n calculatedTransition,\n alreadyProcessedTransition,\n employeeEditTransition,\n blockersViewAllTransition,\n ),\n overview: state<MachineTransition>(\n breadcrumbNavigateTransition('configuration', notSubmitted),\n payrollSubmittingTransition,\n editPayrollTransition,\n receiptGetTransition,\n ),\n editEmployee: state<MachineTransition>(\n breadcrumbNavigateTransition('configuration'),\n employeeSavedTransition,\n employeeCancelledTransition,\n ),\n receipts: state<MachineTransition>(\n breadcrumbNavigateTransition('configuration'),\n breadcrumbNavigateTransition('overview'),\n ),\n blockers: state<MachineTransition>(breadcrumbNavigateTransition('configuration')),\n}\n"],"names":["breadcrumbNavigateTransition","createBreadcrumbNavigateTransition","getPayrollExecutionBreadcrumbsNodes","isDismissal","ctx","updateBreadcrumbs","PayrollConfigurationContextual","PayrollOverviewContextual","calculatedTransition","transition","componentEvents","reduce","ev","alreadyProcessedTransition","payPeriod","employeeEditTransition","PayrollEditEmployeeContextual","blockersViewAllTransition","PayrollBlockerContextual","notSubmitted","editPayrollTransition","guard","payrollSubmittingTransition","hideBreadcrumb","receiptGetTransition","PayrollReceiptsContextual","employeeSavedTransition","patchBreadcrumbsHeader","employeeCancelledTransition","payrollExecutionMachine","state"],"mappings":";;;;;AAiDA,MAAMA,IACJC,EAAA,GAKWC,IAAsC,CACjDC,IAAuB,QAIhB;AAAA,EACL,eAAe;AAAA,IACb,QAAQ;AAAA,IACR,MAAM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E,GAAGuB,EAAuBvB,GAAK,EAAE,qBAAqB,iBAAiB;AAAA,IACvE,WAAWE;AAAA,IACX,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,UAAU;AAAA,IACV,WAAW;AAAA,MACT,UAAU;AAAA,MACV,WAAW;AAAA,IAAA;AAAA,EACb,EACA;AACJ,GAEMsB,IAA8BnB;AAAA,EAClCC,EAAgB;AAAA,EAChB;AAAA,EACAC,EAAO,CAACP,OAAmE;AAAA,IACzE,GAAGuB,EAAuBvB,GAAK,EAAE,qBAAqB,iBAAiB;AAAA,IACvE,WAAWE;AAAA,IACX,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,UAAU;AAAA,IACV,WAAW;AAAA,MACT,UAAU;AAAA,MACV,WAAW;AAAA,IAAA;AAAA,EACb,EACA;AACJ,GAGauB,IAA0B;AAAA,EACrC,eAAeC;AAAA,IACb9B,EAA6B,eAAe;AAAA,IAC5CQ;AAAA,IACAK;AAAA,IACAE;AAAA,IACAE;AAAA,EAAA;AAAA,EAEF,UAAUa;AAAA,IACR9B,EAA6B,iBAAiBmB,CAAY;AAAA,IAC1DG;AAAA,IACAF;AAAA,IACAI;AAAA,EAAA;AAAA,EAEF,cAAcM;AAAA,IACZ9B,EAA6B,eAAe;AAAA,IAC5C0B;AAAA,IACAE;AAAA,EAAA;AAAA,EAEF,UAAUE;AAAA,IACR9B,EAA6B,eAAe;AAAA,IAC5CA,EAA6B,UAAU;AAAA,EAAA;AAAA,EAEzC,UAAU8B,EAAyB9B,EAA6B,eAAe,CAAC;AAClF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayrollFlow.js","sources":["../../../../src/components/Payroll/PayrollFlow/PayrollFlow.tsx"],"sourcesContent":["import { createMachine } from 'robot3'\nimport { useMemo } from 'react'\nimport { payrollFlowBreadcrumbsNodes, payrollFlowMachine } from './payrollStateMachine'\nimport type { PayrollFlowProps } from './PayrollFlowComponents'\nimport {\n SaveAndExitCta,\n PayrollLandingContextual,\n type PayrollFlowContextInterface,\n} from './PayrollFlowComponents'\nimport { Flow } from '@/components/Flow/Flow'\nimport { buildBreadcrumbs } from '@/helpers/breadcrumbHelpers'\n\n/**\n * Hub for running and managing all payrolls across a company's pay schedules.\n *\n * @remarks\n * Renders the payroll landing page and orchestrates the full run-payroll experience: selecting a payroll, configuring earnings and reimbursements, reviewing totals, submitting, and viewing receipts. Off-cycle, transition, and edit-employee steps are reachable from the same flow.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `runPayroll/selected` | A payroll is selected to run | `{ payrollId: string }` |\n * | `payroll/review` | A calculated payroll is opened for review | `{ payrollId: string }` |\n * | `runPayroll/calculated` | Payroll calculations complete | — |\n * | `runPayroll/edit` | The user returns to configuration to make changes | — |\n * | `runPayroll/employee/edit` | An employee row is opened for editing | `{ payrollId: string, employeeId: string, firstName: string, lastName: string }` |\n * | `runPayroll/employee/saved` | Employee payroll changes are saved | `{ payrollPrepared: object, employee: object }` |\n * | `runPayroll/employee/cancelled` | Employee editing is cancelled | — |\n * | `runPayroll/submitted` | Payroll is successfully submitted | Response from the submit payroll endpoint |\n * | `runPayroll/processed` | Payroll processing completes | — |\n * | `runPayroll/processingFailed` | Payroll processing fails | Error details |\n * | `runPayroll/cancelled` | A submitted payroll is cancelled | `{ payrollId: string, result: object }` |\n * | `runPayroll/notCalculated/backToList` | User returns to the payroll list from a payroll that is no longer calculated | — |\n * | `runPayroll/summary/viewed` | The summary screen is opened | `{ payrollId: string }` |\n * | `runPayroll/receipt/viewed` | The receipt screen is opened | `{ payrollId: string }` |\n * | `runPayroll/offCycle/start` | The user starts an off-cycle payroll | — |\n * | `transition/runPayroll` | The user
|
|
1
|
+
{"version":3,"file":"PayrollFlow.js","sources":["../../../../src/components/Payroll/PayrollFlow/PayrollFlow.tsx"],"sourcesContent":["import { createMachine } from 'robot3'\nimport { useMemo } from 'react'\nimport { payrollFlowBreadcrumbsNodes, payrollFlowMachine } from './payrollStateMachine'\nimport type { PayrollFlowProps } from './PayrollFlowComponents'\nimport {\n SaveAndExitCta,\n PayrollLandingContextual,\n type PayrollFlowContextInterface,\n} from './PayrollFlowComponents'\nimport { Flow } from '@/components/Flow/Flow'\nimport { buildBreadcrumbs } from '@/helpers/breadcrumbHelpers'\n\n/**\n * Hub for running and managing all payrolls across a company's pay schedules.\n *\n * @remarks\n * Renders the payroll landing page and orchestrates the full run-payroll experience: selecting a payroll, configuring earnings and reimbursements, reviewing totals, submitting, and viewing receipts. Off-cycle, transition, and edit-employee steps are reachable from the same flow. Running a transition payroll opens {@link TransitionConfiguration} first. After it saves, the regular payroll steps open for the same payroll.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `runPayroll/selected` | A payroll is selected to run | `{ payrollId: string }` |\n * | `payroll/review` | A calculated payroll is opened for review | `{ payrollId: string }` |\n * | `runPayroll/calculated` | Payroll calculations complete | — |\n * | `runPayroll/edit` | The user returns to configuration to make changes | — |\n * | `runPayroll/employee/edit` | An employee row is opened for editing | `{ payrollId: string, employeeId: string, firstName: string, lastName: string }` |\n * | `runPayroll/employee/saved` | Employee payroll changes are saved | `{ payrollPrepared: object, employee: object }` |\n * | `runPayroll/employee/cancelled` | Employee editing is cancelled | — |\n * | `runPayroll/submitted` | Payroll is successfully submitted | Response from the submit payroll endpoint |\n * | `runPayroll/processed` | Payroll processing completes | — |\n * | `runPayroll/processingFailed` | Payroll processing fails | Error details |\n * | `runPayroll/cancelled` | A submitted payroll is cancelled | `{ payrollId: string, result: object }` |\n * | `runPayroll/notCalculated/backToList` | User returns to the payroll list from a payroll that is no longer calculated | — |\n * | `runPayroll/summary/viewed` | The summary screen is opened | `{ payrollId: string }` |\n * | `runPayroll/receipt/viewed` | The receipt screen is opened | `{ payrollId: string }` |\n * | `runPayroll/offCycle/start` | The user starts an off-cycle payroll | — |\n * | `transition/runPayroll` | The user clicks Run on a transition payroll in the alert | `{ payrollUuid: string, startDate: string, endDate: string, payScheduleUuid: string }` |\n * | `transition/payrollSelected` | The user clicks Run on a transition payroll in the payroll list | `{ payrollUuid: string, payPeriod: object }` |\n * | `transition/configured` | The transition payroll settings are saved | `{ payrollUuid: string, payrollPrepared: object }` |\n * | `payroll/saveAndExit` | The user clicks Save and Exit | — |\n *\n * @components\n * - {@link PayrollLanding}\n * - {@link PayrollExecutionFlow}\n * - {@link OffCycleFlow}\n * - {@link TransitionConfiguration}\n * - {@link PayrollBlockerList}\n * - {@link PayrollOverview}\n * - {@link PayrollReceipts}\n *\n * @param props - {@link PayrollFlowProps} with the company, optional reimbursements toggle, optional wire-details override, and event handler.\n * @returns The composed payroll flow.\n * @public\n *\n * @example\n * ```tsx title=\"App.tsx\"\n * import { Payroll } from '@gusto/embedded-react-sdk'\n *\n * function RunPayrollPage() {\n * return <Payroll.PayrollFlow companyId=\"a007e1ab-3595-43c2-ab4b-af7a5af2e365\" onEvent={() => {}} />\n * }\n * ```\n */\nexport const PayrollFlow = ({\n companyId,\n onEvent,\n withReimbursements = true,\n withOffcyclePayroll = true,\n ConfirmWireDetailsComponent,\n}: PayrollFlowProps) => {\n const payrollFlow = useMemo(\n () =>\n createMachine(\n 'landing',\n payrollFlowMachine,\n (initialContext: PayrollFlowContextInterface) => ({\n ...initialContext,\n component: PayrollLandingContextual,\n companyId,\n header: {\n type: 'breadcrumbs' as const,\n breadcrumbs: buildBreadcrumbs(payrollFlowBreadcrumbsNodes),\n cta: SaveAndExitCta,\n },\n withReimbursements,\n withOffcyclePayroll,\n ConfirmWireDetailsComponent,\n }),\n ),\n [companyId, withReimbursements, withOffcyclePayroll, ConfirmWireDetailsComponent],\n )\n\n return <Flow machine={payrollFlow} onEvent={onEvent} />\n}\n"],"names":["PayrollFlow","companyId","onEvent","withReimbursements","withOffcyclePayroll","ConfirmWireDetailsComponent","payrollFlow","useMemo","createMachine","payrollFlowMachine","initialContext","PayrollLandingContextual","buildBreadcrumbs","payrollFlowBreadcrumbsNodes","SaveAndExitCta","jsx","Flow"],"mappings":";;;;;;;AA+DO,MAAMA,IAAc,CAAC;AAAA,EAC1B,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,oBAAAC,IAAqB;AAAA,EACrB,qBAAAC,IAAsB;AAAA,EACtB,6BAAAC;AACF,MAAwB;AACtB,QAAMC,IAAcC;AAAA,IAClB,MACEC;AAAA,MACE;AAAA,MACAC;AAAA,MACA,CAACC,OAAiD;AAAA,QAChD,GAAGA;AAAA,QACH,WAAWC;AAAA,QACX,WAAAV;AAAA,QACA,QAAQ;AAAA,UACN,MAAM;AAAA,UACN,aAAaW,EAAiBC,CAA2B;AAAA,UACzD,KAAKC;AAAA,QAAA;AAAA,QAEP,oBAAAX;AAAA,QACA,qBAAAC;AAAA,QACA,6BAAAC;AAAA,MAAA;AAAA,IACF;AAAA,IAEJ,CAACJ,GAAWE,GAAoBC,GAAqBC,CAA2B;AAAA,EAAA;AAGlF,SAAO,gBAAAU,EAACC,GAAA,EAAK,SAASV,GAAa,SAAAJ,EAAA,CAAkB;AACvD;"}
|