@gusto/embedded-react-sdk 0.32.0 → 0.33.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 +27 -0
- package/dist/components/Common/MultiSelectComboBox/MultiSelectComboBox.d.ts +2 -0
- package/dist/components/Common/MultiSelectComboBox/MultiSelectComboBoxTypes.d.ts +16 -0
- package/dist/components/Common/MultiSelectComboBox/index.d.ts +3 -0
- package/dist/components/Common/SignatureForm/SignatureForm.js +11 -12
- package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormActions.js +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormFields.js +2 -2
- package/dist/components/Common/UI/Badge/Badge.js +39 -8
- package/dist/components/Common/UI/Badge/Badge.js.map +1 -1
- package/dist/components/Common/UI/Badge/Badge.module.scss.js +8 -4
- package/dist/components/Common/UI/Badge/Badge.module.scss.js.map +1 -1
- package/dist/components/Common/UI/Badge/BadgeTypes.d.ts +12 -0
- package/dist/components/Common/UI/Badge/BadgeTypes.js.map +1 -1
- package/dist/components/Company/AssignSignatory/AssignSignatory.js +1 -1
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +17 -16
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.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/InviteSignatory.js +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +6 -5
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.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/Form.js +5 -6
- package/dist/components/Company/BankAccount/BankAccountForm/Form.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/BankAccount/BankAccountVerify/Form.js +5 -6
- package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +2 -2
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +3 -4
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +2 -2
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +3 -4
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Company/FederalTaxes/FederalTaxes.js +2 -2
- package/dist/components/Company/FederalTaxes/Form.js +3 -4
- package/dist/components/Company/FederalTaxes/Form.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/Form.js +6 -5
- package/dist/components/Company/Locations/LocationForm/Form.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/LocationForm.js +2 -2
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +3 -4
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/LocationsList.js +2 -2
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +3 -4
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/Completed.js +2 -3
- package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/MissingRequirements.js +5 -6
- package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +2 -2
- package/dist/components/Company/OnboardingOverview/context.js +3 -4
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/PaySchedule.js +2 -2
- package/dist/components/Company/PaySchedule/_parts/Edit.js +24 -23
- package/dist/components/Company/PaySchedule/_parts/Edit.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Head.js +8 -9
- package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/List.js +11 -12
- package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
- package/dist/components/Company/PaySchedule/usePaySchedule.js +5 -6
- package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +40 -46
- package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.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/Contractor/Address/Address.js +2 -2
- package/dist/components/Contractor/Address/Form.js +8 -7
- package/dist/components/Contractor/Address/Form.js.map +1 -1
- package/dist/components/Contractor/Address/useAddress.js +5 -6
- package/dist/components/Contractor/Address/useAddress.js.map +1 -1
- package/dist/components/Contractor/ContractorList/index.js +17 -17
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +2 -2
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js +108 -100
- package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.d.ts +4 -1
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js +54 -51
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js +13 -12
- package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js +17 -18
- package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js +1 -1
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js +2 -3
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js +6 -7
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js +2 -3
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +2 -3
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -1
- package/dist/components/Contractor/Profile/ContractorProfileForm.js +15 -15
- package/dist/components/Contractor/Profile/useContractorProfile.js +2 -3
- package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
- package/dist/components/Contractor/Submit/Submit.js +1 -1
- package/dist/components/Employee/Compensation/Edit.js +14 -14
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +10 -11
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +11 -12
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +11 -12
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +1 -1
- package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.js +3 -2
- package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/List.js +2 -3
- package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +3 -4
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js +20 -21
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.js +7 -7
- package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +3 -4
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Employee/EmployeeDocuments/EmployeeDocumentsPresentation.js +2 -3
- package/dist/components/Employee/EmployeeDocuments/EmployeeDocumentsPresentation.js.map +1 -1
- package/dist/components/Employee/EmployeeList/EmployeeList.js +3 -4
- package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
- package/dist/components/Employee/EmployeeList/Head.js +2 -3
- package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
- package/dist/components/Employee/EmployeeList/useEmployeeList.js +3 -4
- package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/FederalForm.js +7 -7
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +3 -4
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Employee/Landing/Landing.js +8 -8
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +7 -7
- package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +2 -2
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +1 -1
- package/dist/components/Employee/PaymentMethod/Split.js +8 -8
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +5 -6
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/AdminPersonalDetails.js +1 -1
- package/dist/components/Employee/Profile/HomeAddress.js +10 -9
- package/dist/components/Employee/Profile/HomeAddress.js.map +1 -1
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js +11 -10
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
- package/dist/components/Employee/Profile/useProfile.js +3 -4
- package/dist/components/Employee/Profile/useProfile.js.map +1 -1
- package/dist/components/Employee/StateTaxes/useStateTaxes.js +3 -4
- package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
- package/dist/components/Employee/Taxes/FederalForm.js +7 -7
- package/dist/components/Employee/Taxes/useTaxes.js +3 -4
- package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
- package/dist/components/Flow/Flow.js +2 -3
- package/dist/components/Flow/Flow.js.map +1 -1
- package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js +16 -16
- package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js.map +1 -1
- package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js +4 -4
- package/dist/components/InformationRequests/InformationRequests.js +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +9 -9
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js +6 -7
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js.map +1 -1
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js +1 -1
- package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js +1 -1
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js +2 -3
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +12 -12
- package/dist/components/Payroll/PayrollBlocker/payrollHelpers.js +22 -18
- package/dist/components/Payroll/PayrollBlocker/payrollHelpers.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/payrollHelpers.test.d.ts +1 -0
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +12 -8
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +39 -38
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +39 -38
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +17 -18
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js +38 -35
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.d.ts +1 -0
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +2 -3
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +2 -3
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +3 -2
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js +7 -8
- package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +2 -3
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js +1 -1
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js +6 -6
- package/dist/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.js +2 -3
- package/dist/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +2 -3
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/i18n/en/common.json.d.ts +4 -1
- package/dist/i18n/en/common.json.js +5 -5
- package/dist/style.css +1 -1
- package/dist/types/i18next.d.ts +3 -0
- package/package.json +5 -5
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { state as
|
|
2
|
-
import { PayrollOverviewContextual as
|
|
1
|
+
import { state as l, transition as r, reduce as t } from "robot3";
|
|
2
|
+
import { PayrollOverviewContextual as d, PayrollConfigurationContextual as s, PayrollReceiptsContextual as c, PayrollEditEmployeeContextual as y, PayrollBlockerContextual as m } from "../PayrollFlow/PayrollFlowComponents.js";
|
|
3
3
|
import { componentEvents as i } from "../../../shared/constants.js";
|
|
4
4
|
import { updateBreadcrumbs as o } from "../../../helpers/breadcrumbHelpers.js";
|
|
5
|
-
import { createBreadcrumbNavigateTransition as
|
|
6
|
-
const
|
|
5
|
+
import { createBreadcrumbNavigateTransition as u } from "../../Common/FlowBreadcrumbs/breadcrumbTransitionHelpers.js";
|
|
6
|
+
const n = u(), w = {
|
|
7
7
|
configuration: {
|
|
8
8
|
parent: null,
|
|
9
9
|
item: {
|
|
@@ -15,7 +15,7 @@ const l = y(), R = {
|
|
|
15
15
|
startDate: e.payPeriod?.startDate ?? "",
|
|
16
16
|
endDate: e.payPeriod?.endDate ?? ""
|
|
17
17
|
}),
|
|
18
|
-
component:
|
|
18
|
+
component: s,
|
|
19
19
|
alerts: void 0
|
|
20
20
|
}))
|
|
21
21
|
}
|
|
@@ -31,7 +31,7 @@ const l = y(), R = {
|
|
|
31
31
|
startDate: e.payPeriod?.startDate ?? "",
|
|
32
32
|
endDate: e.payPeriod?.endDate ?? ""
|
|
33
33
|
}),
|
|
34
|
-
component:
|
|
34
|
+
component: d,
|
|
35
35
|
alerts: void 0
|
|
36
36
|
}))
|
|
37
37
|
}
|
|
@@ -60,7 +60,7 @@ const l = y(), R = {
|
|
|
60
60
|
namespace: "Payroll.PayrollBlocker"
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
},
|
|
63
|
+
}, P = r(
|
|
64
64
|
i.RUN_PAYROLL_CALCULATED,
|
|
65
65
|
"overview",
|
|
66
66
|
t(
|
|
@@ -69,16 +69,19 @@ const l = y(), R = {
|
|
|
69
69
|
startDate: a.payload.payPeriod?.startDate ?? "",
|
|
70
70
|
endDate: a.payload.payPeriod?.endDate ?? ""
|
|
71
71
|
}),
|
|
72
|
-
component:
|
|
72
|
+
component: d,
|
|
73
73
|
payPeriod: a.payload.payPeriod ?? e.payPeriod,
|
|
74
|
-
alerts: a.payload.alert ? [
|
|
74
|
+
alerts: a.payload.alert ? [
|
|
75
|
+
...(e.alerts ?? []).filter((p) => p.alertKey !== "progressSaved"),
|
|
76
|
+
{ ...a.payload.alert, alertKey: "progressSaved" }
|
|
77
|
+
] : e.alerts,
|
|
75
78
|
ctaConfig: {
|
|
76
79
|
labelKey: "exitFlowCta",
|
|
77
80
|
namespace: "Payroll.PayrollOverview"
|
|
78
81
|
}
|
|
79
82
|
})
|
|
80
83
|
)
|
|
81
|
-
),
|
|
84
|
+
), b = r(
|
|
82
85
|
i.RUN_PAYROLL_EMPLOYEE_EDIT,
|
|
83
86
|
"editEmployee",
|
|
84
87
|
t(
|
|
@@ -90,21 +93,21 @@ const l = y(), R = {
|
|
|
90
93
|
endDate: e.payPeriod?.endDate ?? ""
|
|
91
94
|
}),
|
|
92
95
|
progressBarType: "breadcrumbs",
|
|
93
|
-
component:
|
|
96
|
+
component: y,
|
|
94
97
|
employeeId: a.payload.employeeId,
|
|
95
98
|
firstName: a.payload.firstName,
|
|
96
99
|
lastName: a.payload.lastName,
|
|
97
100
|
ctaConfig: null
|
|
98
101
|
})
|
|
99
102
|
)
|
|
100
|
-
),
|
|
103
|
+
), f = r(
|
|
101
104
|
i.RUN_PAYROLL_BLOCKERS_VIEW_ALL,
|
|
102
105
|
"blockers",
|
|
103
106
|
t((e) => ({
|
|
104
107
|
...o("blockers", e),
|
|
105
108
|
component: m
|
|
106
109
|
}))
|
|
107
|
-
),
|
|
110
|
+
), g = r(
|
|
108
111
|
i.RUN_PAYROLL_EDIT,
|
|
109
112
|
"configuration",
|
|
110
113
|
t((e) => ({
|
|
@@ -112,14 +115,14 @@ const l = y(), R = {
|
|
|
112
115
|
startDate: e.payPeriod?.startDate ?? "",
|
|
113
116
|
endDate: e.payPeriod?.endDate ?? ""
|
|
114
117
|
}),
|
|
115
|
-
component:
|
|
118
|
+
component: s,
|
|
116
119
|
alerts: void 0,
|
|
117
120
|
ctaConfig: {
|
|
118
121
|
labelKey: "exitFlowCta",
|
|
119
122
|
namespace: "Payroll.PayrollConfiguration"
|
|
120
123
|
}
|
|
121
124
|
}))
|
|
122
|
-
),
|
|
125
|
+
), E = r(
|
|
123
126
|
i.RUN_PAYROLL_RECEIPT_GET,
|
|
124
127
|
"receipts",
|
|
125
128
|
t(
|
|
@@ -128,7 +131,7 @@ const l = y(), R = {
|
|
|
128
131
|
startDate: e.payPeriod?.startDate ?? "",
|
|
129
132
|
endDate: e.payPeriod?.endDate ?? ""
|
|
130
133
|
}),
|
|
131
|
-
component:
|
|
134
|
+
component: c,
|
|
132
135
|
progressBarType: "breadcrumbs",
|
|
133
136
|
alerts: void 0,
|
|
134
137
|
ctaConfig: {
|
|
@@ -137,14 +140,14 @@ const l = y(), R = {
|
|
|
137
140
|
}
|
|
138
141
|
})
|
|
139
142
|
)
|
|
140
|
-
),
|
|
143
|
+
), v = r(
|
|
141
144
|
i.RUN_PAYROLL_EMPLOYEE_SAVED,
|
|
142
145
|
"configuration",
|
|
143
146
|
t(
|
|
144
147
|
(e) => ({
|
|
145
148
|
...e,
|
|
146
149
|
currentBreadcrumbId: "configuration",
|
|
147
|
-
component:
|
|
150
|
+
component: s,
|
|
148
151
|
employeeId: void 0,
|
|
149
152
|
firstName: void 0,
|
|
150
153
|
lastName: void 0,
|
|
@@ -161,7 +164,7 @@ const l = y(), R = {
|
|
|
161
164
|
(e) => ({
|
|
162
165
|
...e,
|
|
163
166
|
currentBreadcrumbId: "configuration",
|
|
164
|
-
component:
|
|
167
|
+
component: s,
|
|
165
168
|
employeeId: void 0,
|
|
166
169
|
firstName: void 0,
|
|
167
170
|
lastName: void 0,
|
|
@@ -171,28 +174,28 @@ const l = y(), R = {
|
|
|
171
174
|
}
|
|
172
175
|
})
|
|
173
176
|
)
|
|
174
|
-
),
|
|
175
|
-
configuration:
|
|
176
|
-
|
|
177
|
-
u,
|
|
177
|
+
), T = {
|
|
178
|
+
configuration: l(
|
|
179
|
+
n("configuration"),
|
|
178
180
|
P,
|
|
179
|
-
b
|
|
181
|
+
b,
|
|
182
|
+
f
|
|
180
183
|
),
|
|
181
|
-
overview:
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
184
|
+
overview: l(
|
|
185
|
+
n("configuration"),
|
|
186
|
+
g,
|
|
187
|
+
E
|
|
185
188
|
),
|
|
186
|
-
editEmployee:
|
|
187
|
-
|
|
188
|
-
|
|
189
|
+
editEmployee: l(
|
|
190
|
+
n("configuration"),
|
|
191
|
+
v,
|
|
189
192
|
D
|
|
190
193
|
),
|
|
191
|
-
receipts: n(
|
|
192
|
-
blockers: n(
|
|
194
|
+
receipts: l(n("configuration")),
|
|
195
|
+
blockers: l(n("configuration"))
|
|
193
196
|
};
|
|
194
197
|
export {
|
|
195
|
-
|
|
196
|
-
|
|
198
|
+
w as payrollExecutionBreadcrumbsNodes,
|
|
199
|
+
T as payrollExecutionMachine
|
|
197
200
|
};
|
|
198
201
|
//# sourceMappingURL=payrollExecutionMachine.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payrollExecutionMachine.js","sources":["../../../../src/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.ts"],"sourcesContent":["import { transition, reduce, state } 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 { updateBreadcrumbs } 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 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.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\nexport const payrollExecutionBreadcrumbsNodes: BreadcrumbNodes = {\n configuration: {\n parent: null,\n item: {\n id: 'configuration',\n label: 'breadcrumbLabel',\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\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 ? [...(ctx.alerts ?? []), ev.payload.alert] : ctx.alerts,\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 progressBarType: 'breadcrumbs',\n component: PayrollEditEmployeeContextual,\n employeeId: ev.payload.employeeId,\n firstName: ev.payload.firstName,\n lastName: ev.payload.lastName,\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 }\n }),\n)\n\nconst editPayrollTransition = transition(\n componentEvents.RUN_PAYROLL_EDIT,\n 'configuration',\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 receiptGetTransition = transition(\n componentEvents.RUN_PAYROLL_RECEIPT_GET,\n 'receipts',\n reduce(\n (ctx: PayrollFlowContextInterface): PayrollFlowContextInterface => ({\n ...updateBreadcrumbs('receipts', ctx, {\n startDate: ctx.payPeriod?.startDate ?? '',\n endDate: ctx.payPeriod?.endDate ?? '',\n }),\n component: PayrollReceiptsContextual,\n progressBarType: 'breadcrumbs',\n alerts: undefined,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: 'Payroll.PayrollReceipts',\n },\n }),\n ),\n)\n\nconst employeeSavedTransition = transition(\n componentEvents.RUN_PAYROLL_EMPLOYEE_SAVED,\n 'configuration',\n reduce(\n (ctx: PayrollFlowContextInterface): PayrollFlowContextInterface => ({\n ...ctx,\n currentBreadcrumbId: 'configuration',\n component: PayrollConfigurationContextual,\n employeeId: undefined,\n firstName: undefined,\n lastName: undefined,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: 'Payroll.PayrollConfiguration',\n },\n }),\n ),\n)\n\nconst employeeCancelledTransition = transition(\n componentEvents.RUN_PAYROLL_EMPLOYEE_CANCELLED,\n 'configuration',\n reduce(\n (ctx: PayrollFlowContextInterface): PayrollFlowContextInterface => ({\n ...ctx,\n currentBreadcrumbId: 'configuration',\n component: PayrollConfigurationContextual,\n employeeId: undefined,\n firstName: undefined,\n lastName: undefined,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: 'Payroll.PayrollConfiguration',\n },\n }),\n ),\n)\n\nexport const payrollExecutionMachine = {\n configuration: state<MachineTransition>(\n breadcrumbNavigateTransition('configuration'),\n calculatedTransition,\n employeeEditTransition,\n blockersViewAllTransition,\n ),\n overview: state<MachineTransition>(\n breadcrumbNavigateTransition('configuration'),\n editPayrollTransition,\n receiptGetTransition,\n ),\n editEmployee: state<MachineTransition>(\n breadcrumbNavigateTransition('configuration'),\n employeeSavedTransition,\n employeeCancelledTransition,\n ),\n receipts: state<MachineTransition>(breadcrumbNavigateTransition('configuration')),\n blockers: state<MachineTransition>(breadcrumbNavigateTransition('configuration')),\n}\n"],"names":["breadcrumbNavigateTransition","createBreadcrumbNavigateTransition","payrollExecutionBreadcrumbsNodes","ctx","updateBreadcrumbs","PayrollConfigurationContextual","PayrollOverviewContextual","calculatedTransition","transition","componentEvents","reduce","ev","employeeEditTransition","PayrollEditEmployeeContextual","blockersViewAllTransition","PayrollBlockerContextual","editPayrollTransition","receiptGetTransition","PayrollReceiptsContextual","employeeSavedTransition","employeeCancelledTransition","payrollExecutionMachine","state"],"mappings":";;;;;AAuCA,MAAMA,IACJC,EAAA,GAIWC,IAAoD;AAAA,EAC/D,eAAe;AAAA,IACb,QAAQ;AAAA,IACR,MAAM;AAAA,MACJ,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,WAAW;AAAA,MACX,aAAa,CAACC,OAAsC;AAAA,QAClD,GAAGC,EAAkB,iBAAiBD,GAAK;AAAA,UACzC,WAAWA,EAAI,WAAW,aAAa;AAAA,UACvC,SAASA,EAAI,WAAW,WAAW;AAAA,QAAA,CACpC;AAAA,QACD,WAAWE;AAAA,QACX,QAAQ;AAAA,MAAA;AAAA,IACV;AAAA,EACF;AAAA,EAEF,UAAU;AAAA,IACR,QAAQ;AAAA,IACR,MAAM;AAAA,MACJ,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,WAAW;AAAA,MACX,aAAa,CAACF,OAAsC;AAAA,QAClD,GAAGC,EAAkB,YAAYD,GAAK;AAAA,UACpC,WA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E;AAAA,MAClE,GAAGA;AAAA,MACH,qBAAqB;AAAA,MACrB,WAAWE;AAAA,MACX,YAAY;AAAA,MACZ,WAAW;AAAA,MACX,UAAU;AAAA,MACV,WAAW;AAAA,QACT,UAAU;AAAA,QACV,WAAW;AAAA,MAAA;AAAA,IACb;AAAA,EACF;AAEJ,GAEMe,IAA8BZ;AAAA,EAClCC,EAAgB;AAAA,EAChB;AAAA,EACAC;AAAA,IACE,CAACP,OAAmE;AAAA,MAClE,GAAGA;AAAA,MACH,qBAAqB;AAAA,MACrB,WAAWE;AAAA,MACX,YAAY;AAAA,MACZ,WAAW;AAAA,MACX,UAAU;AAAA,MACV,WAAW;AAAA,QACT,UAAU;AAAA,QACV,WAAW;AAAA,MAAA;AAAA,IACb;AAAA,EACF;AAEJ,GAEagB,IAA0B;AAAA,EACrC,eAAeC;AAAA,IACbtB,EAA6B,eAAe;AAAA,IAC5CO;AAAA,IACAK;AAAA,IACAE;AAAA,EAAA;AAAA,EAEF,UAAUQ;AAAA,IACRtB,EAA6B,eAAe;AAAA,IAC5CgB;AAAA,IACAC;AAAA,EAAA;AAAA,EAEF,cAAcK;AAAA,IACZtB,EAA6B,eAAe;AAAA,IAC5CmB;AAAA,IACAC;AAAA,EAAA;AAAA,EAEF,UAAUE,EAAyBtB,EAA6B,eAAe,CAAC;AAAA,EAChF,UAAUsB,EAAyBtB,EAA6B,eAAe,CAAC;AAClF;"}
|
|
1
|
+
{"version":3,"file":"payrollExecutionMachine.js","sources":["../../../../src/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.ts"],"sourcesContent":["import { transition, reduce, state } 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 { updateBreadcrumbs } 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 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.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\nexport const payrollExecutionBreadcrumbsNodes: BreadcrumbNodes = {\n configuration: {\n parent: null,\n item: {\n id: 'configuration',\n label: 'breadcrumbLabel',\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\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 ? [\n ...(ctx.alerts ?? []).filter(a => a.alertKey !== 'progressSaved'),\n { ...ev.payload.alert, alertKey: 'progressSaved' as const },\n ]\n : ctx.alerts,\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 progressBarType: 'breadcrumbs',\n component: PayrollEditEmployeeContextual,\n employeeId: ev.payload.employeeId,\n firstName: ev.payload.firstName,\n lastName: ev.payload.lastName,\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 }\n }),\n)\n\nconst editPayrollTransition = transition(\n componentEvents.RUN_PAYROLL_EDIT,\n 'configuration',\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 receiptGetTransition = transition(\n componentEvents.RUN_PAYROLL_RECEIPT_GET,\n 'receipts',\n reduce(\n (ctx: PayrollFlowContextInterface): PayrollFlowContextInterface => ({\n ...updateBreadcrumbs('receipts', ctx, {\n startDate: ctx.payPeriod?.startDate ?? '',\n endDate: ctx.payPeriod?.endDate ?? '',\n }),\n component: PayrollReceiptsContextual,\n progressBarType: 'breadcrumbs',\n alerts: undefined,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: 'Payroll.PayrollReceipts',\n },\n }),\n ),\n)\n\nconst employeeSavedTransition = transition(\n componentEvents.RUN_PAYROLL_EMPLOYEE_SAVED,\n 'configuration',\n reduce(\n (ctx: PayrollFlowContextInterface): PayrollFlowContextInterface => ({\n ...ctx,\n currentBreadcrumbId: 'configuration',\n component: PayrollConfigurationContextual,\n employeeId: undefined,\n firstName: undefined,\n lastName: undefined,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: 'Payroll.PayrollConfiguration',\n },\n }),\n ),\n)\n\nconst employeeCancelledTransition = transition(\n componentEvents.RUN_PAYROLL_EMPLOYEE_CANCELLED,\n 'configuration',\n reduce(\n (ctx: PayrollFlowContextInterface): PayrollFlowContextInterface => ({\n ...ctx,\n currentBreadcrumbId: 'configuration',\n component: PayrollConfigurationContextual,\n employeeId: undefined,\n firstName: undefined,\n lastName: undefined,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: 'Payroll.PayrollConfiguration',\n },\n }),\n ),\n)\n\nexport const payrollExecutionMachine = {\n configuration: state<MachineTransition>(\n breadcrumbNavigateTransition('configuration'),\n calculatedTransition,\n employeeEditTransition,\n blockersViewAllTransition,\n ),\n overview: state<MachineTransition>(\n breadcrumbNavigateTransition('configuration'),\n editPayrollTransition,\n receiptGetTransition,\n ),\n editEmployee: state<MachineTransition>(\n breadcrumbNavigateTransition('configuration'),\n employeeSavedTransition,\n employeeCancelledTransition,\n ),\n receipts: state<MachineTransition>(breadcrumbNavigateTransition('configuration')),\n blockers: state<MachineTransition>(breadcrumbNavigateTransition('configuration')),\n}\n"],"names":["breadcrumbNavigateTransition","createBreadcrumbNavigateTransition","payrollExecutionBreadcrumbsNodes","ctx","updateBreadcrumbs","PayrollConfigurationContextual","PayrollOverviewContextual","calculatedTransition","transition","componentEvents","reduce","ev","a","employeeEditTransition","PayrollEditEmployeeContextual","blockersViewAllTransition","PayrollBlockerContextual","editPayrollTransition","receiptGetTransition","PayrollReceiptsContextual","employeeSavedTransition","employeeCancelledTransition","payrollExecutionMachine","state"],"mappings":";;;;;AAuCA,MAAMA,IACJC,EAAA,GAIWC,IAAoD;AAAA,EAC/D,eAAe;AAAA,IACb,QAAQ;AAAA,IACR,MAAM;AAAA,MACJ,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,WAAW;AAAA,MACX,aAA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A,IAC5CoB;AAAA,IACAC;AAAA,EAAA;AAAA,EAEF,UAAUE,EAAyBvB,EAA6B,eAAe,CAAC;AAAA,EAChF,UAAUuB,EAAyBvB,EAA6B,eAAe,CAAC;AAClF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayrollFlowComponents.js","sources":["../../../../src/components/Payroll/PayrollFlow/PayrollFlowComponents.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport type { PayrollPayPeriodType } from '@gusto/embedded-api/models/components/payrollpayperiodtype'\nimport { PayrollLanding } from '../PayrollLanding/PayrollLanding'\nimport { PayrollConfiguration } from '../PayrollConfiguration/PayrollConfiguration'\nimport { PayrollOverview } from '../PayrollOverview/PayrollOverview'\nimport { PayrollEditEmployee } from '../PayrollEditEmployee/PayrollEditEmployee'\nimport { PayrollReceipts } from '../PayrollReceipts/PayrollReceipts'\nimport { PayrollBlockerList } from '../PayrollBlocker'\nimport type { ConfirmWireDetailsComponentType } from '../ConfirmWireDetails/ConfirmWireDetails'\nimport { useFlow, type FlowContextInterface } from '@/components/Flow/useFlow'\nimport type { BaseComponentInterface } from '@/components/Base'\nimport { ensureRequired } from '@/helpers/ensureRequired'\nimport type { BreadcrumbTrail } from '@/components/Common/FlowBreadcrumbs/FlowBreadcrumbsTypes'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\n\nexport interface PayrollFlowProps extends BaseComponentInterface {\n companyId: string\n withReimbursements?: boolean\n ConfirmWireDetailsComponent?: ConfirmWireDetailsComponentType\n}\n\nexport type PayrollFlowAlert = {\n type: 'error' | 'info' | 'success'\n title: string\n content?: ReactNode\n onDismiss?: () => void\n}\n\nexport interface PayrollFlowContextInterface extends FlowContextInterface {\n companyId: string\n payrollUuid?: string\n employeeId?: string\n firstName?: string\n lastName?: string\n alerts?: PayrollFlowAlert[]\n breadcrumbs?: BreadcrumbTrail\n payPeriod?: PayrollPayPeriodType\n withReimbursements: boolean\n ConfirmWireDetailsComponent?: ConfirmWireDetailsComponentType\n showPayrollCancelledAlert?: boolean\n executionInitialState?: 'configuration' | 'overview'\n}\n\nexport function PayrollLandingContextual() {\n const {\n companyId,\n onEvent,\n withReimbursements,\n ConfirmWireDetailsComponent,\n showPayrollCancelledAlert,\n } = useFlow<PayrollFlowContextInterface>()\n return (\n <PayrollLanding\n onEvent={onEvent}\n companyId={ensureRequired(companyId)}\n withReimbursements={withReimbursements}\n ConfirmWireDetailsComponent={ConfirmWireDetailsComponent}\n showPayrollCancelledAlert={showPayrollCancelledAlert}\n />\n )\n}\n\nexport function PayrollConfigurationContextual() {\n const { companyId, payrollUuid, onEvent, withReimbursements } =\n useFlow<PayrollFlowContextInterface>()\n return (\n <PayrollConfiguration\n onEvent={onEvent}\n companyId={ensureRequired(companyId)}\n payrollId={ensureRequired(payrollUuid)}\n withReimbursements={withReimbursements}\n />\n )\n}\n\nexport function PayrollOverviewContextual() {\n const {\n companyId,\n payrollUuid,\n onEvent,\n alerts,\n withReimbursements,\n ConfirmWireDetailsComponent,\n } = useFlow<PayrollFlowContextInterface>()\n return (\n <PayrollOverview\n onEvent={onEvent}\n companyId={ensureRequired(companyId)}\n payrollId={ensureRequired(payrollUuid)}\n alerts={alerts}\n withReimbursements={withReimbursements}\n ConfirmWireDetailsComponent={ConfirmWireDetailsComponent}\n />\n )\n}\n\nexport function PayrollEditEmployeeContextual() {\n const { companyId, payrollUuid, employeeId, onEvent, withReimbursements } =\n useFlow<PayrollFlowContextInterface>()\n return (\n <PayrollEditEmployee\n onEvent={onEvent}\n companyId={ensureRequired(companyId)}\n payrollId={ensureRequired(payrollUuid)}\n employeeId={ensureRequired(employeeId)}\n withReimbursements={withReimbursements}\n />\n )\n}\n\nexport function PayrollReceiptsContextual() {\n const { payrollUuid, onEvent, withReimbursements } = useFlow<PayrollFlowContextInterface>()\n return (\n <PayrollReceipts\n onEvent={onEvent}\n payrollId={ensureRequired(payrollUuid)}\n withReimbursements={withReimbursements}\n />\n )\n}\n\nexport function PayrollBlockerContextual() {\n const { companyId, onEvent } = useFlow<PayrollFlowContextInterface>()\n return <PayrollBlockerList onEvent={onEvent} companyId={ensureRequired(companyId)} />\n}\n\nexport function SaveAndExitCta() {\n const { onEvent, ctaConfig } = useFlow<PayrollFlowContextInterface>()\n const { Button } = useComponentContext()\n const namespace = ctaConfig?.namespace || 'common'\n useI18n([namespace])\n const { t } = useTranslation(namespace)\n\n if (!ctaConfig?.labelKey) return null\n\n return (\n <Button\n onClick={() => {\n onEvent(componentEvents.PAYROLL_EXIT_FLOW)\n }}\n variant=\"secondary\"\n >\n {t(ctaConfig.labelKey as never)}\n </Button>\n )\n}\n"],"names":["PayrollLandingContextual","companyId","onEvent","withReimbursements","ConfirmWireDetailsComponent","showPayrollCancelledAlert","useFlow","jsx","PayrollLanding","ensureRequired","PayrollConfigurationContextual","payrollUuid","PayrollConfiguration","PayrollOverviewContextual","alerts","PayrollOverview","PayrollEditEmployeeContextual","employeeId","PayrollEditEmployee","PayrollReceiptsContextual","PayrollReceipts","PayrollBlockerContextual","PayrollBlockerList","SaveAndExitCta","ctaConfig","Button","useComponentContext","namespace","useI18n","t","useTranslation","componentEvents"],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"PayrollFlowComponents.js","sources":["../../../../src/components/Payroll/PayrollFlow/PayrollFlowComponents.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport type { PayrollPayPeriodType } from '@gusto/embedded-api/models/components/payrollpayperiodtype'\nimport { PayrollLanding } from '../PayrollLanding/PayrollLanding'\nimport { PayrollConfiguration } from '../PayrollConfiguration/PayrollConfiguration'\nimport { PayrollOverview } from '../PayrollOverview/PayrollOverview'\nimport { PayrollEditEmployee } from '../PayrollEditEmployee/PayrollEditEmployee'\nimport { PayrollReceipts } from '../PayrollReceipts/PayrollReceipts'\nimport { PayrollBlockerList } from '../PayrollBlocker'\nimport type { ConfirmWireDetailsComponentType } from '../ConfirmWireDetails/ConfirmWireDetails'\nimport { useFlow, type FlowContextInterface } from '@/components/Flow/useFlow'\nimport type { BaseComponentInterface } from '@/components/Base'\nimport { ensureRequired } from '@/helpers/ensureRequired'\nimport type { BreadcrumbTrail } from '@/components/Common/FlowBreadcrumbs/FlowBreadcrumbsTypes'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\n\nexport interface PayrollFlowProps extends BaseComponentInterface {\n companyId: string\n withReimbursements?: boolean\n ConfirmWireDetailsComponent?: ConfirmWireDetailsComponentType\n}\n\nexport type PayrollFlowAlert = {\n type: 'error' | 'info' | 'success'\n title: string\n content?: ReactNode\n onDismiss?: () => void\n alertKey?: string\n}\n\nexport interface PayrollFlowContextInterface extends FlowContextInterface {\n companyId: string\n payrollUuid?: string\n employeeId?: string\n firstName?: string\n lastName?: string\n alerts?: PayrollFlowAlert[]\n breadcrumbs?: BreadcrumbTrail\n payPeriod?: PayrollPayPeriodType\n withReimbursements: boolean\n ConfirmWireDetailsComponent?: ConfirmWireDetailsComponentType\n showPayrollCancelledAlert?: boolean\n executionInitialState?: 'configuration' | 'overview'\n}\n\nexport function PayrollLandingContextual() {\n const {\n companyId,\n onEvent,\n withReimbursements,\n ConfirmWireDetailsComponent,\n showPayrollCancelledAlert,\n } = useFlow<PayrollFlowContextInterface>()\n return (\n <PayrollLanding\n onEvent={onEvent}\n companyId={ensureRequired(companyId)}\n withReimbursements={withReimbursements}\n ConfirmWireDetailsComponent={ConfirmWireDetailsComponent}\n showPayrollCancelledAlert={showPayrollCancelledAlert}\n />\n )\n}\n\nexport function PayrollConfigurationContextual() {\n const { companyId, payrollUuid, onEvent, withReimbursements } =\n useFlow<PayrollFlowContextInterface>()\n return (\n <PayrollConfiguration\n onEvent={onEvent}\n companyId={ensureRequired(companyId)}\n payrollId={ensureRequired(payrollUuid)}\n withReimbursements={withReimbursements}\n />\n )\n}\n\nexport function PayrollOverviewContextual() {\n const {\n companyId,\n payrollUuid,\n onEvent,\n alerts,\n withReimbursements,\n ConfirmWireDetailsComponent,\n } = useFlow<PayrollFlowContextInterface>()\n return (\n <PayrollOverview\n onEvent={onEvent}\n companyId={ensureRequired(companyId)}\n payrollId={ensureRequired(payrollUuid)}\n alerts={alerts}\n withReimbursements={withReimbursements}\n ConfirmWireDetailsComponent={ConfirmWireDetailsComponent}\n />\n )\n}\n\nexport function PayrollEditEmployeeContextual() {\n const { companyId, payrollUuid, employeeId, onEvent, withReimbursements } =\n useFlow<PayrollFlowContextInterface>()\n return (\n <PayrollEditEmployee\n onEvent={onEvent}\n companyId={ensureRequired(companyId)}\n payrollId={ensureRequired(payrollUuid)}\n employeeId={ensureRequired(employeeId)}\n withReimbursements={withReimbursements}\n />\n )\n}\n\nexport function PayrollReceiptsContextual() {\n const { payrollUuid, onEvent, withReimbursements } = useFlow<PayrollFlowContextInterface>()\n return (\n <PayrollReceipts\n onEvent={onEvent}\n payrollId={ensureRequired(payrollUuid)}\n withReimbursements={withReimbursements}\n />\n )\n}\n\nexport function PayrollBlockerContextual() {\n const { companyId, onEvent } = useFlow<PayrollFlowContextInterface>()\n return <PayrollBlockerList onEvent={onEvent} companyId={ensureRequired(companyId)} />\n}\n\nexport function SaveAndExitCta() {\n const { onEvent, ctaConfig } = useFlow<PayrollFlowContextInterface>()\n const { Button } = useComponentContext()\n const namespace = ctaConfig?.namespace || 'common'\n useI18n([namespace])\n const { t } = useTranslation(namespace)\n\n if (!ctaConfig?.labelKey) return null\n\n return (\n <Button\n onClick={() => {\n onEvent(componentEvents.PAYROLL_EXIT_FLOW)\n }}\n variant=\"secondary\"\n >\n {t(ctaConfig.labelKey as never)}\n </Button>\n )\n}\n"],"names":["PayrollLandingContextual","companyId","onEvent","withReimbursements","ConfirmWireDetailsComponent","showPayrollCancelledAlert","useFlow","jsx","PayrollLanding","ensureRequired","PayrollConfigurationContextual","payrollUuid","PayrollConfiguration","PayrollOverviewContextual","alerts","PayrollOverview","PayrollEditEmployeeContextual","employeeId","PayrollEditEmployee","PayrollReceiptsContextual","PayrollReceipts","PayrollBlockerContextual","PayrollBlockerList","SaveAndExitCta","ctaConfig","Button","useComponentContext","namespace","useI18n","t","useTranslation","componentEvents"],"mappings":";;;;;;;;;;;;;AA+CO,SAASA,IAA2B;AACzC,QAAM;AAAA,IACJ,WAAAC;AAAA,IACA,SAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,6BAAAC;AAAA,IACA,2BAAAC;AAAA,EAAA,IACEC,EAAA;AACJ,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,SAAAN;AAAA,MACA,WAAWO,EAAeR,CAAS;AAAA,MACnC,oBAAAE;AAAA,MACA,6BAAAC;AAAA,MACA,2BAAAC;AAAA,IAAA;AAAA,EAAA;AAGN;AAEO,SAASK,IAAiC;AAC/C,QAAM,EAAE,WAAAT,GAAW,aAAAU,GAAa,SAAAT,GAAS,oBAAAC,EAAA,IACvCG,EAAA;AACF,SACE,gBAAAC;AAAA,IAACK;AAAA,IAAA;AAAA,MACC,SAAAV;AAAA,MACA,WAAWO,EAAeR,CAAS;AAAA,MACnC,WAAWQ,EAAeE,CAAW;AAAA,MACrC,oBAAAR;AAAA,IAAA;AAAA,EAAA;AAGN;AAEO,SAASU,IAA4B;AAC1C,QAAM;AAAA,IACJ,WAAAZ;AAAA,IACA,aAAAU;AAAA,IACA,SAAAT;AAAA,IACA,QAAAY;AAAA,IACA,oBAAAX;AAAA,IACA,6BAAAC;AAAA,EAAA,IACEE,EAAA;AACJ,SACE,gBAAAC;AAAA,IAACQ;AAAA,IAAA;AAAA,MACC,SAAAb;AAAA,MACA,WAAWO,EAAeR,CAAS;AAAA,MACnC,WAAWQ,EAAeE,CAAW;AAAA,MACrC,QAAAG;AAAA,MACA,oBAAAX;AAAA,MACA,6BAAAC;AAAA,IAAA;AAAA,EAAA;AAG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L, calculateTotalPayroll as N, canCancelPayroll as O
|
|
|
4
4
|
import j from "./PayrollHistoryPresentation.module.scss.js";
|
|
5
5
|
import { Flex as n } from "../../Common/Flex/Flex.js";
|
|
6
6
|
import "classnames";
|
|
7
|
-
import "../../../shared/constants.js";
|
|
8
7
|
import { HamburgerMenu as M } from "../../Common/HamburgerMenu/HamburgerMenu.js";
|
|
9
8
|
import { useComponentContext as V } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
10
9
|
import { formatNumberAsCurrency as q } from "../../../helpers/formattedStrings.js";
|
|
@@ -15,7 +14,7 @@ import $ from "../../../assets/icons/icon-file-outline.svg.js";
|
|
|
15
14
|
import B from "../../../assets/icons/icon-receipt-outline.svg.js";
|
|
16
15
|
import { PayrollStatusBadges as W } from "../PayrollStatusBadges/PayrollStatusBadges.js";
|
|
17
16
|
import { DataView as _ } from "../../Common/DataView/DataView.js";
|
|
18
|
-
const
|
|
17
|
+
const ce = ({
|
|
19
18
|
payrollHistory: c,
|
|
20
19
|
wireInRequests: p,
|
|
21
20
|
selectedTimeFilter: y,
|
|
@@ -173,6 +172,6 @@ const de = ({
|
|
|
173
172
|
] });
|
|
174
173
|
};
|
|
175
174
|
export {
|
|
176
|
-
|
|
175
|
+
ce as PayrollHistoryPresentation
|
|
177
176
|
};
|
|
178
177
|
//# sourceMappingURL=PayrollHistoryPresentation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayrollHistoryPresentation.js","sources":["../../../../src/components/Payroll/PayrollHistory/PayrollHistoryPresentation.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { Payroll } from '@gusto/embedded-api/models/components/payroll'\nimport type { WireInRequest } from '@gusto/embedded-api/models/components/wireinrequest'\nimport { PayrollStatusBadges } from '../PayrollStatusBadges'\nimport { getPayrollType, calculateTotalPayroll, canCancelPayroll } from '../helpers'\nimport type { TimeFilterOption } from './PayrollHistory'\nimport styles from './PayrollHistoryPresentation.module.scss'\nimport type { MenuItem } from '@/components/Common/UI/Menu/MenuTypes'\nimport { DataView, Flex } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport { formatNumberAsCurrency } from '@/helpers/formattedStrings'\nimport { useI18n } from '@/i18n'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport TrashcanIcon from '@/assets/icons/trashcan.svg?react'\nimport FileIcon from '@/assets/icons/icon-file-outline.svg?react'\nimport ReceiptIcon from '@/assets/icons/icon-receipt-outline.svg?react'\n\ninterface PayrollHistoryPresentationProps {\n payrollHistory: Payroll[]\n wireInRequests: WireInRequest[]\n selectedTimeFilter: TimeFilterOption\n onTimeFilterChange: (value: TimeFilterOption) => void\n onViewSummary: (payrollId: string, startDate?: string, endDate?: string) => void\n onViewReceipt: (payrollId: string, startDate?: string, endDate?: string) => void\n onCancelPayroll: (item: Payroll) => void\n cancelDialogItem: Payroll | null\n onCancelDialogOpen: (item: Payroll) => void\n onCancelDialogClose: () => void\n isLoading?: boolean\n}\n\nexport const PayrollHistoryPresentation = ({\n payrollHistory,\n wireInRequests,\n selectedTimeFilter,\n onTimeFilterChange,\n onViewSummary,\n onViewReceipt,\n onCancelPayroll,\n cancelDialogItem,\n onCancelDialogOpen,\n onCancelDialogClose,\n isLoading = false,\n}: PayrollHistoryPresentationProps) => {\n const { Heading, Text, Select, Dialog } = useComponentContext()\n useI18n('Payroll.PayrollHistory')\n const { t } = useTranslation('Payroll.PayrollHistory')\n const dateFormatter = useDateFormatter()\n\n const timeFilterOptions = [\n { value: '3months', label: t('timeFilter.options.3months') },\n { value: '6months', label: t('timeFilter.options.6months') },\n { value: 'year', label: t('timeFilter.options.year') },\n ]\n\n const formatDeadlineForDialog = (item: Payroll): string => {\n const deadline = item.payrollDeadline\n if (!deadline) return ''\n\n const deadlineDate = new Date(deadline)\n const timeZone = 'America/New_York'\n\n const formatter = new Intl.DateTimeFormat('en-US', {\n weekday: 'short',\n month: 'short',\n day: 'numeric',\n timeZone,\n })\n\n const timeFormatter = new Intl.DateTimeFormat('en-US', {\n hour: 'numeric',\n minute: '2-digit',\n timeZoneName: 'short',\n timeZone,\n })\n\n const dateStr = formatter.format(deadlineDate)\n const timeStr = timeFormatter.format(deadlineDate)\n\n return `${timeStr} on ${dateStr}`\n }\n\n const handleCancelClick = (item: Payroll) => {\n onCancelDialogOpen(item)\n }\n\n const handleConfirmCancel = () => {\n if (cancelDialogItem) {\n onCancelPayroll(cancelDialogItem)\n }\n }\n\n const getMenuItems = (item: Payroll): MenuItem[] => {\n const payrollId = item.payrollUuid || item.uuid!\n const items: MenuItem[] = [\n {\n label: t('menu.viewSummary'),\n icon: <FileIcon aria-hidden />,\n onClick: () => {\n onViewSummary(payrollId, item.payPeriod?.startDate, item.payPeriod?.endDate)\n },\n },\n {\n label: t('menu.viewReceipt'),\n icon: <ReceiptIcon aria-hidden />,\n onClick: () => {\n onViewReceipt(payrollId, item.payPeriod?.startDate, item.payPeriod?.endDate)\n },\n },\n ]\n\n if (canCancelPayroll(item)) {\n items.push({\n label: t('menu.cancelPayroll'),\n icon: <TrashcanIcon aria-hidden />,\n onClick: () => {\n handleCancelClick(item)\n },\n 'data-destructive': 'true',\n })\n }\n\n return items\n }\n\n if (payrollHistory.length === 0) {\n return (\n <Flex flexDirection=\"column\" alignItems=\"center\" gap={24}>\n <Heading as=\"h3\">{t('emptyState.title')}</Heading>\n <Text>{t('emptyState.description')}</Text>\n </Flex>\n )\n }\n\n return (\n <Flex flexDirection=\"column\" gap={16}>\n <Flex\n flexDirection={{ base: 'column', medium: 'row' }}\n justifyContent=\"space-between\"\n alignItems=\"flex-start\"\n gap={{ base: 12, medium: 24 }}\n >\n <Flex>\n <Heading as=\"h2\">{t('title')}</Heading>\n </Flex>\n <div className={styles.timeFilterContainer}>\n <Select\n value={selectedTimeFilter}\n onChange={(value: string) => {\n onTimeFilterChange(value as TimeFilterOption)\n }}\n options={timeFilterOptions}\n label={t('timeFilter.placeholder')}\n shouldVisuallyHideLabel\n isRequired\n />\n </div>\n </Flex>\n\n <DataView\n label={t('dataView.label')}\n columns={[\n {\n title: t('columns.payPeriod'),\n render: (item: Payroll) =>\n dateFormatter.formatPayPeriodRange(\n item.payPeriod?.startDate,\n item.payPeriod?.endDate,\n ),\n },\n {\n title: t('columns.type'),\n render: (item: Payroll) => getPayrollType(item),\n },\n {\n title: t('columns.payDate'),\n render: (item: Payroll) => dateFormatter.formatShortWithYear(item.checkDate),\n },\n {\n title: t('columns.status'),\n render: (item: Payroll) => {\n const wireInRequest = wireInRequests.find(\n wire => wire.paymentUuid === item.payrollUuid,\n )\n return <PayrollStatusBadges payroll={item} wireInRequest={wireInRequest} />\n },\n },\n {\n title: t('columns.totalPayroll'),\n render: (item: Payroll) => formatNumberAsCurrency(calculateTotalPayroll(item)),\n },\n ]}\n data={payrollHistory}\n itemMenu={(item: Payroll) => <HamburgerMenu items={getMenuItems(item)} />}\n />\n\n <Dialog\n isOpen={!!cancelDialogItem}\n onClose={onCancelDialogClose}\n onPrimaryActionClick={handleConfirmCancel}\n isDestructive\n isPrimaryActionLoading={isLoading}\n primaryActionLabel={t('cancelDialog.primaryAction')}\n closeActionLabel={t('cancelDialog.secondaryAction')}\n title={\n cancelDialogItem\n ? t('cancelDialog.title', {\n payPeriod: dateFormatter.formatPayPeriodRange(\n cancelDialogItem.payPeriod?.startDate,\n cancelDialogItem.payPeriod?.endDate,\n ),\n })\n : ''\n }\n >\n {cancelDialogItem && (\n <Flex flexDirection=\"column\" gap={16}>\n <Text>{t('cancelDialog.body')}</Text>\n {cancelDialogItem.payrollDeadline && (\n <Text>\n {t('cancelDialog.deadline', {\n deadline: formatDeadlineForDialog(cancelDialogItem),\n })}\n </Text>\n )}\n </Flex>\n )}\n </Dialog>\n </Flex>\n )\n}\n"],"names":["PayrollHistoryPresentation","payrollHistory","wireInRequests","selectedTimeFilter","onTimeFilterChange","onViewSummary","onViewReceipt","onCancelPayroll","cancelDialogItem","onCancelDialogOpen","onCancelDialogClose","isLoading","Heading","Text","Select","Dialog","useComponentContext","useI18n","useTranslation","dateFormatter","useDateFormatter","timeFilterOptions","formatDeadlineForDialog","item","deadline","deadlineDate","timeZone","formatter","timeFormatter","dateStr","handleCancelClick","handleConfirmCancel","getMenuItems","payrollId","items","jsx","FileIcon","ReceiptIcon","canCancelPayroll","TrashcanIcon","Flex","jsxs","styles","value","DataView","getPayrollType","wireInRequest","wire","PayrollStatusBadges","formatNumberAsCurrency","calculateTotalPayroll","HamburgerMenu"],"mappings":";;;;;;;;;;;;;;;;;AAgCO,MAAMA,KAA6B,CAAC;AAAA,EACzC,gBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,WAAAC,IAAY;AACd,MAAuC;AACrC,QAAM,EAAE,SAAAC,GAAS,MAAAC,GAAM,QAAAC,GAAQ,QAAAC,EAAA,IAAWC,EAAA;AAC1C,EAAAC,EAAQ,wBAAwB;AAChC,QAAM,EAAE,EAAA,IAAMC,EAAe,wBAAwB,GAC/CC,IAAgBC,EAAA,GAEhBC,IAAoB;AAAA,IACxB,EAAE,OAAO,WAAW,OAAO,EAAE,4BAA4B,EAAA;AAAA,IACzD,EAAE,OAAO,WAAW,OAAO,EAAE,4BAA4B,EAAA;AAAA,IACzD,EAAE,OAAO,QAAQ,OAAO,EAAE,yBAAyB,EAAA;AAAA,EAAE,GAGjDC,IAA0B,CAACC,MAA0B;AACzD,UAAMC,IAAWD,EAAK;AACtB,QAAI,CAACC,EAAU,QAAO;AAEtB,UAAMC,IAAe,IAAI,KAAKD,CAAQ,GAChCE,IAAW,oBAEXC,IAAY,IAAI,KAAK,eAAe,SAAS;AAAA,MACjD,SAAS;AAAA,MACT,OAAO;AAAA,MACP,K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EAAM,UAAA,EAAE,mBAAmB,EAAA,CAAE;AAAA,UAC7BL,EAAiB,mBAChB,gBAAA2B,EAACtB,GAAA,EACE,YAAE,yBAAyB;AAAA,YAC1B,UAAUS,EAAwBd,CAAgB;AAAA,UAAA,CACnD,EAAA,CACH;AAAA,QAAA,EAAA,CAEJ;AAAA,MAAA;AAAA,IAAA;AAAA,EAEJ,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"PayrollHistoryPresentation.js","sources":["../../../../src/components/Payroll/PayrollHistory/PayrollHistoryPresentation.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { Payroll } from '@gusto/embedded-api/models/components/payroll'\nimport type { WireInRequest } from '@gusto/embedded-api/models/components/wireinrequest'\nimport { PayrollStatusBadges } from '../PayrollStatusBadges'\nimport { getPayrollType, calculateTotalPayroll, canCancelPayroll } from '../helpers'\nimport type { TimeFilterOption } from './PayrollHistory'\nimport styles from './PayrollHistoryPresentation.module.scss'\nimport type { MenuItem } from '@/components/Common/UI/Menu/MenuTypes'\nimport { DataView, Flex } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport { formatNumberAsCurrency } from '@/helpers/formattedStrings'\nimport { useI18n } from '@/i18n'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport TrashcanIcon from '@/assets/icons/trashcan.svg?react'\nimport FileIcon from '@/assets/icons/icon-file-outline.svg?react'\nimport ReceiptIcon from '@/assets/icons/icon-receipt-outline.svg?react'\n\ninterface PayrollHistoryPresentationProps {\n payrollHistory: Payroll[]\n wireInRequests: WireInRequest[]\n selectedTimeFilter: TimeFilterOption\n onTimeFilterChange: (value: TimeFilterOption) => void\n onViewSummary: (payrollId: string, startDate?: string, endDate?: string) => void\n onViewReceipt: (payrollId: string, startDate?: string, endDate?: string) => void\n onCancelPayroll: (item: Payroll) => void\n cancelDialogItem: Payroll | null\n onCancelDialogOpen: (item: Payroll) => void\n onCancelDialogClose: () => void\n isLoading?: boolean\n}\n\nexport const PayrollHistoryPresentation = ({\n payrollHistory,\n wireInRequests,\n selectedTimeFilter,\n onTimeFilterChange,\n onViewSummary,\n onViewReceipt,\n onCancelPayroll,\n cancelDialogItem,\n onCancelDialogOpen,\n onCancelDialogClose,\n isLoading = false,\n}: PayrollHistoryPresentationProps) => {\n const { Heading, Text, Select, Dialog } = useComponentContext()\n useI18n('Payroll.PayrollHistory')\n const { t } = useTranslation('Payroll.PayrollHistory')\n const dateFormatter = useDateFormatter()\n\n const timeFilterOptions = [\n { value: '3months', label: t('timeFilter.options.3months') },\n { value: '6months', label: t('timeFilter.options.6months') },\n { value: 'year', label: t('timeFilter.options.year') },\n ]\n\n const formatDeadlineForDialog = (item: Payroll): string => {\n const deadline = item.payrollDeadline\n if (!deadline) return ''\n\n const deadlineDate = new Date(deadline)\n const timeZone = 'America/New_York'\n\n const formatter = new Intl.DateTimeFormat('en-US', {\n weekday: 'short',\n month: 'short',\n day: 'numeric',\n timeZone,\n })\n\n const timeFormatter = new Intl.DateTimeFormat('en-US', {\n hour: 'numeric',\n minute: '2-digit',\n timeZoneName: 'short',\n timeZone,\n })\n\n const dateStr = formatter.format(deadlineDate)\n const timeStr = timeFormatter.format(deadlineDate)\n\n return `${timeStr} on ${dateStr}`\n }\n\n const handleCancelClick = (item: Payroll) => {\n onCancelDialogOpen(item)\n }\n\n const handleConfirmCancel = () => {\n if (cancelDialogItem) {\n onCancelPayroll(cancelDialogItem)\n }\n }\n\n const getMenuItems = (item: Payroll): MenuItem[] => {\n const payrollId = item.payrollUuid || item.uuid!\n const items: MenuItem[] = [\n {\n label: t('menu.viewSummary'),\n icon: <FileIcon aria-hidden />,\n onClick: () => {\n onViewSummary(payrollId, item.payPeriod?.startDate, item.payPeriod?.endDate)\n },\n },\n {\n label: t('menu.viewReceipt'),\n icon: <ReceiptIcon aria-hidden />,\n onClick: () => {\n onViewReceipt(payrollId, item.payPeriod?.startDate, item.payPeriod?.endDate)\n },\n },\n ]\n\n if (canCancelPayroll(item)) {\n items.push({\n label: t('menu.cancelPayroll'),\n icon: <TrashcanIcon aria-hidden />,\n onClick: () => {\n handleCancelClick(item)\n },\n 'data-destructive': 'true',\n })\n }\n\n return items\n }\n\n if (payrollHistory.length === 0) {\n return (\n <Flex flexDirection=\"column\" alignItems=\"center\" gap={24}>\n <Heading as=\"h3\">{t('emptyState.title')}</Heading>\n <Text>{t('emptyState.description')}</Text>\n </Flex>\n )\n }\n\n return (\n <Flex flexDirection=\"column\" gap={16}>\n <Flex\n flexDirection={{ base: 'column', medium: 'row' }}\n justifyContent=\"space-between\"\n alignItems=\"flex-start\"\n gap={{ base: 12, medium: 24 }}\n >\n <Flex>\n <Heading as=\"h2\">{t('title')}</Heading>\n </Flex>\n <div className={styles.timeFilterContainer}>\n <Select\n value={selectedTimeFilter}\n onChange={(value: string) => {\n onTimeFilterChange(value as TimeFilterOption)\n }}\n options={timeFilterOptions}\n label={t('timeFilter.placeholder')}\n shouldVisuallyHideLabel\n isRequired\n />\n </div>\n </Flex>\n\n <DataView\n label={t('dataView.label')}\n columns={[\n {\n title: t('columns.payPeriod'),\n render: (item: Payroll) =>\n dateFormatter.formatPayPeriodRange(\n item.payPeriod?.startDate,\n item.payPeriod?.endDate,\n ),\n },\n {\n title: t('columns.type'),\n render: (item: Payroll) => getPayrollType(item),\n },\n {\n title: t('columns.payDate'),\n render: (item: Payroll) => dateFormatter.formatShortWithYear(item.checkDate),\n },\n {\n title: t('columns.status'),\n render: (item: Payroll) => {\n const wireInRequest = wireInRequests.find(\n wire => wire.paymentUuid === item.payrollUuid,\n )\n return <PayrollStatusBadges payroll={item} wireInRequest={wireInRequest} />\n },\n },\n {\n title: t('columns.totalPayroll'),\n render: (item: Payroll) => formatNumberAsCurrency(calculateTotalPayroll(item)),\n },\n ]}\n data={payrollHistory}\n itemMenu={(item: Payroll) => <HamburgerMenu items={getMenuItems(item)} />}\n />\n\n <Dialog\n isOpen={!!cancelDialogItem}\n onClose={onCancelDialogClose}\n onPrimaryActionClick={handleConfirmCancel}\n isDestructive\n isPrimaryActionLoading={isLoading}\n primaryActionLabel={t('cancelDialog.primaryAction')}\n closeActionLabel={t('cancelDialog.secondaryAction')}\n title={\n cancelDialogItem\n ? t('cancelDialog.title', {\n payPeriod: dateFormatter.formatPayPeriodRange(\n cancelDialogItem.payPeriod?.startDate,\n cancelDialogItem.payPeriod?.endDate,\n ),\n })\n : ''\n }\n >\n {cancelDialogItem && (\n <Flex flexDirection=\"column\" gap={16}>\n <Text>{t('cancelDialog.body')}</Text>\n {cancelDialogItem.payrollDeadline && (\n <Text>\n {t('cancelDialog.deadline', {\n deadline: formatDeadlineForDialog(cancelDialogItem),\n })}\n </Text>\n )}\n </Flex>\n )}\n </Dialog>\n </Flex>\n )\n}\n"],"names":["PayrollHistoryPresentation","payrollHistory","wireInRequests","selectedTimeFilter","onTimeFilterChange","onViewSummary","onViewReceipt","onCancelPayroll","cancelDialogItem","onCancelDialogOpen","onCancelDialogClose","isLoading","Heading","Text","Select","Dialog","useComponentContext","useI18n","useTranslation","dateFormatter","useDateFormatter","timeFilterOptions","formatDeadlineForDialog","item","deadline","deadlineDate","timeZone","formatter","timeFormatter","dateStr","handleCancelClick","handleConfirmCancel","getMenuItems","payrollId","items","jsx","FileIcon","ReceiptIcon","canCancelPayroll","TrashcanIcon","Flex","jsxs","styles","value","DataView","getPayrollType","wireInRequest","wire","PayrollStatusBadges","formatNumberAsCurrency","calculateTotalPayroll","HamburgerMenu"],"mappings":";;;;;;;;;;;;;;;;AAgCO,MAAMA,KAA6B,CAAC;AAAA,EACzC,gBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,WAAAC,IAAY;AACd,MAAuC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AEF,MAAMtB;AAAA,QACN,UAAU,CAACsB,MAAkB,gBAAAY,EAACgB,KAAc,OAAOnB,EAAaT,CAAI,EAAA,CAAG;AAAA,MAAA;AAAA,IAAA;AAAA,IAGzE,gBAAAY;AAAA,MAACpB;AAAA,MAAA;AAAA,QACC,QAAQ,CAAC,CAACP;AAAA,QACV,SAASE;AAAA,QACT,sBAAsBqB;AAAA,QACtB,eAAa;AAAA,QACb,wBAAwBpB;AAAA,QACxB,oBAAoB,EAAE,4BAA4B;AAAA,QAClD,kBAAkB,EAAE,8BAA8B;AAAA,QAClD,OACEH,IACI,EAAE,sBAAsB;AAAA,UACtB,WAAWW,EAAc;AAAA,YACvBX,EAAiB,WAAW;AAAA,YAC5BA,EAAiB,WAAW;AAAA,UAAA;AAAA,QAC9B,CACD,IACD;AAAA,QAGL,eACC,gBAAAiC,EAACD,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,UAAA,gBAAAL,EAACtB,GAAA,EAAM,UAAA,EAAE,mBAAmB,EAAA,CAAE;AAAA,UAC7BL,EAAiB,mBAChB,gBAAA2B,EAACtB,GAAA,EACE,YAAE,yBAAyB;AAAA,YAC1B,UAAUS,EAAwBd,CAAgB;AAAA,UAAA,CACnD,EAAA,CACH;AAAA,QAAA,EAAA,CAEJ;AAAA,MAAA;AAAA,IAAA;AAAA,EAEJ,GACF;AAEJ;"}
|
|
@@ -5,7 +5,6 @@ import { getPayrollType as V } from "../helpers.js";
|
|
|
5
5
|
import m from "./PayrollListPresentation.module.scss.js";
|
|
6
6
|
import { Flex as i } from "../../Common/Flex/Flex.js";
|
|
7
7
|
import "classnames";
|
|
8
|
-
import "../../../shared/constants.js";
|
|
9
8
|
import { HamburgerMenu as $ } from "../../Common/HamburgerMenu/HamburgerMenu.js";
|
|
10
9
|
import { useComponentContext as G } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
11
10
|
import { useI18n as J } from "../../../i18n/I18n.js";
|
|
@@ -15,7 +14,7 @@ import X from "../../../assets/icons/feature-icon-check.svg.js";
|
|
|
15
14
|
import Z from "../../../hooks/useContainerBreakpoints/useContainerBreakpoints.js";
|
|
16
15
|
import { PayrollStatusBadges as _ } from "../PayrollStatusBadges/PayrollStatusBadges.js";
|
|
17
16
|
import { DataView as ee } from "../../Common/DataView/DataView.js";
|
|
18
|
-
const
|
|
17
|
+
const he = ({
|
|
19
18
|
onRunPayroll: I,
|
|
20
19
|
onSubmitPayroll: w,
|
|
21
20
|
onSkipPayroll: H,
|
|
@@ -204,6 +203,6 @@ const De = ({
|
|
|
204
203
|
] }) });
|
|
205
204
|
};
|
|
206
205
|
export {
|
|
207
|
-
|
|
206
|
+
he as PayrollListPresentation
|
|
208
207
|
};
|
|
209
208
|
//# sourceMappingURL=PayrollListPresentation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayrollListPresentation.js","sources":["../../../../src/components/Payroll/PayrollList/PayrollListPresentation.tsx"],"sourcesContent":["import type { Payroll } from '@gusto/embedded-api/models/components/payroll'\nimport type { PayScheduleList } from '@gusto/embedded-api/models/components/payschedulelist'\nimport type { WireInRequest } from '@gusto/embedded-api/models/components/wireinrequest'\nimport { useState, useRef } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport type { ApiPayrollBlocker } from '../PayrollBlocker/payrollHelpers'\nimport { PayrollStatusBadges } from '../PayrollStatusBadges'\nimport { getPayrollType } from '../helpers'\nimport styles from './PayrollListPresentation.module.scss'\nimport { DataView, Flex, HamburgerMenu } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { formatDateToStringDate } from '@/helpers/dateFormatting'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport FeatureIconCheck from '@/assets/icons/feature-icon-check.svg?react'\nimport useContainerBreakpoints from '@/hooks/useContainerBreakpoints/useContainerBreakpoints'\n\ninterface PayrollListPresentationProps {\n onRunPayroll: ({ payrollUuid, payPeriod }: Pick<Payroll, 'payrollUuid' | 'payPeriod'>) => void\n onSubmitPayroll: ({ payrollUuid, payPeriod }: Pick<Payroll, 'payrollUuid' | 'payPeriod'>) => void\n onSkipPayroll: ({ payrollUuid }: Pick<Payroll, 'payrollUuid'>) => void\n payrolls: Payroll[]\n paySchedules: PayScheduleList[]\n showSkipSuccessAlert: boolean\n onDismissSkipSuccessAlert: () => void\n skippingPayrollId: string | null\n blockers: ApiPayrollBlocker[]\n wireInRequests: WireInRequest[]\n}\n\nexport const PayrollListPresentation = ({\n onRunPayroll,\n onSubmitPayroll,\n onSkipPayroll,\n payrolls,\n paySchedules,\n showSkipSuccessAlert,\n onDismissSkipSuccessAlert,\n skippingPayrollId,\n blockers,\n wireInRequests,\n}: PayrollListPresentationProps) => {\n const { Button, Dialog, Heading, Text, Alert } = useComponentContext()\n useI18n('Payroll.PayrollList')\n const { t } = useTranslation('Payroll.PayrollList')\n const dateFormatter = useDateFormatter()\n const containerRef = useRef<HTMLDivElement>(null)\n const breakpoints = useContainerBreakpoints({ ref: containerRef })\n const isDesktop = breakpoints.includes('large')\n const [skipPayrollDialogState, setSkipPayrollDialogState] = useState<{\n isOpen: boolean\n payrollId: string | null\n payPeriod: string | null\n }>({\n isOpen: false,\n payrollId: null,\n payPeriod: null,\n })\n\n const handleOpenSkipDialog = (payrollId: string, payPeriod: string) => {\n setSkipPayrollDialogState({\n isOpen: true,\n payrollId,\n payPeriod,\n })\n }\n\n const handleCloseSkipDialog = () => {\n setSkipPayrollDialogState({\n isOpen: false,\n payrollId: null,\n payPeriod: null,\n })\n }\n\n const handleConfirmSkipPayroll = () => {\n if (skipPayrollDialogState.payrollId) {\n onSkipPayroll({ payrollUuid: skipPayrollDialogState.payrollId })\n handleCloseSkipDialog()\n }\n }\n\n const formatPayPeriod = (startDate: string | undefined, endDate: string | undefined) => {\n const formattedStartDate = dateFormatter.formatShort(startDate)\n const formattedEndDate = dateFormatter.formatShortWithYear(endDate)\n\n return {\n startDate: formattedStartDate,\n endDate: formattedEndDate,\n fullPeriod: dateFormatter.formatPayPeriodRange(startDate, endDate, { useShortMonth: true }),\n }\n }\n\n const renderActionButton = (payroll: Payroll) => {\n const { payrollUuid, calculatedAt, processed, payPeriod } = payroll\n\n if (processed) {\n return null\n }\n\n const isProcessingSkipPayroll = skippingPayrollId === payrollUuid\n\n return calculatedAt ? (\n <Button\n isLoading={isProcessingSkipPayroll}\n onClick={() => {\n onSubmitPayroll({ payrollUuid, payPeriod })\n }}\n title={t('submitPayrollCta')}\n variant=\"secondary\"\n >\n {t('submitPayrollCta')}\n </Button>\n ) : (\n <Button\n isLoading={isProcessingSkipPayroll}\n onClick={() => {\n onRunPayroll({ payrollUuid, payPeriod })\n }}\n title={t('runPayrollTitle')}\n variant=\"secondary\"\n >\n {t('runPayrollTitle')}\n </Button>\n )\n }\n\n return (\n <div ref={containerRef} className={styles.container}>\n <Flex flexDirection=\"column\" gap={16}>\n {showSkipSuccessAlert && (\n <div className={styles.alertContainer}>\n <Alert\n status=\"info\"\n label={t('skipSuccessAlert')}\n onDismiss={onDismissSkipSuccessAlert}\n />\n </div>\n )}\n <Flex\n flexDirection={{ base: 'column', medium: 'row' }}\n justifyContent=\"space-between\"\n alignItems=\"flex-start\"\n gap={{ base: 12, medium: 24 }}\n >\n <Flex>\n <Heading as=\"h2\">{t('title')}</Heading>\n </Flex>\n </Flex>\n\n <DataView\n breakAt=\"large\"\n emptyState={() => (\n <Flex flexDirection=\"column\" alignItems=\"center\" gap={24}>\n <FeatureIconCheck />\n <Text>{t('emptyState')}</Text>\n </Flex>\n )}\n data={payrolls}\n columns={[\n {\n render: ({ payPeriod }) => {\n const { startDate, endDate } = formatPayPeriod(\n payPeriod?.startDate,\n payPeriod?.endDate,\n )\n\n return (\n <div className={styles.payPeriodCell}>\n {startDate} - {endDate}\n <Text variant=\"supporting\" size=\"sm\">\n {paySchedules.find(schedule => schedule.uuid === payPeriod?.payScheduleUuid)\n ?.name ||\n paySchedules.find(schedule => schedule.uuid === payPeriod?.payScheduleUuid)\n ?.customName}\n </Text>\n </div>\n )\n },\n title: t('tableHeaders.0'),\n },\n {\n render: payroll => <Text>{t(`type.${getPayrollType(payroll)}`)}</Text>,\n title: t('tableHeaders.1'),\n },\n {\n render: ({ checkDate }) => dateFormatter.formatShortWithWeekdayAndYear(checkDate),\n title: t('tableHeaders.2'),\n },\n {\n title: t('tableHeaders.3'),\n render: ({ payrollDeadline }) =>\n dateFormatter.formatShortWithWeekdayAndYear(payrollDeadline),\n },\n {\n title: t('tableHeaders.4'),\n render: payroll => {\n const wireInRequest = wireInRequests.find(\n wire => wire.paymentUuid === payroll.payrollUuid,\n )\n return <PayrollStatusBadges payroll={payroll} wireInRequest={wireInRequest} />\n },\n },\n ...(!isDesktop\n ? [\n {\n title: '',\n render: (payroll: Payroll) => {\n const button = renderActionButton(payroll)\n if (!button) return null\n return (\n <Flex flexDirection=\"column\" alignItems=\"stretch\" gap={12}>\n {button}\n </Flex>\n )\n },\n },\n ]\n : []),\n ]}\n label={t('payrollsListLabel')}\n itemMenu={payroll => {\n const { payrollUuid, processed, payPeriod } = payroll\n\n if (processed) {\n return null\n }\n\n const isProcessingSkipPayroll = skippingPayrollId === payrollUuid\n\n const { fullPeriod: payPeriodString } = formatPayPeriod(\n payPeriod?.startDate,\n payPeriod?.endDate,\n )\n\n const todayDateString = formatDateToStringDate(new Date())\n const todayAtMidnight = todayDateString ? new Date(todayDateString) : null\n const payPeriodStartDate = payPeriod?.startDate ? new Date(payPeriod.startDate) : null\n\n const canSkipPayroll =\n blockers.length === 0 &&\n todayAtMidnight &&\n payPeriodStartDate &&\n todayAtMidnight >= payPeriodStartDate\n\n const button = isDesktop ? renderActionButton(payroll) : null\n\n const hamburgerMenu = canSkipPayroll ? (\n <HamburgerMenu\n isLoading={isProcessingSkipPayroll}\n menuLabel={t('payrollMenuLabel')}\n items={[\n {\n label: t('skipPayrollCta'),\n onClick: () => {\n handleOpenSkipDialog(payrollUuid!, payPeriodString)\n },\n },\n ]}\n />\n ) : null\n\n if (!button && !hamburgerMenu) {\n return null\n }\n\n return (\n <div className={styles.actionsContainer}>\n {button}\n {hamburgerMenu}\n </div>\n )\n }}\n />\n <Dialog\n isOpen={skipPayrollDialogState.isOpen}\n onClose={handleCloseSkipDialog}\n onPrimaryActionClick={handleConfirmSkipPayroll}\n isDestructive={true}\n title={t('skipPayrollDialog.title', { payPeriod: skipPayrollDialogState.payPeriod })}\n primaryActionLabel={t('skipPayrollDialog.confirmCta')}\n closeActionLabel={t('skipPayrollDialog.cancelCta')}\n >\n {t('skipPayrollDialog.body')}\n </Dialog>\n </Flex>\n </div>\n )\n}\n"],"names":["PayrollListPresentation","onRunPayroll","onSubmitPayroll","onSkipPayroll","payrolls","paySchedules","showSkipSuccessAlert","onDismissSkipSuccessAlert","skippingPayrollId","blockers","wireInRequests","Button","Dialog","Heading","Text","Alert","useComponentContext","useI18n","useTranslation","dateFormatter","useDateFormatter","containerRef","useRef","isDesktop","useContainerBreakpoints","skipPayrollDialogState","setSkipPayrollDialogState","useState","handleOpenSkipDialog","payrollId","payPeriod","handleCloseSkipDialog","handleConfirmSkipPayroll","formatPayPeriod","startDate","endDate","formattedStartDate","formattedEndDate","renderActionButton","payroll","payrollUuid","calculatedAt","processed","isProcessingSkipPayroll","jsx","styles","jsxs","Flex","DataView","FeatureIconCheck","schedule","getPayrollType","checkDate","payrollDeadline","wireInRequest","wire","PayrollStatusBadges","button","payPeriodString","todayDateString","formatDateToStringDate","todayAtMidnight","payPeriodStartDate","canSkipPayroll","hamburgerMenu","HamburgerMenu"],"mappings":";;;;;;;;;;;;;;;;;AA8BO,MAAMA,KAA0B,CAAC;AAAA,EACtC,cAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,UAAAC;AAAA,EACA,cAAAC;AAAA,EACA,sBAAAC;AAAA,EACA,2BAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,gBAAAC;AACF,MAAoC;AAClC,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OAAO,EAAE,gBAAgB;AAAA,kBACzB,SAAS,MAAM;AACb,oBAAAf,EAAqBY,GAAckB,CAAe;AAAA,kBACpD;AAAA,gBAAA;AAAA,cACF;AAAA,YACF;AAAA,UAAA,IAEA;AAEJ,iBAAI,CAACD,KAAU,CAACO,IACP,OAIP,gBAAAlB,EAAC,OAAA,EAAI,WAAWD,EAAO,kBACpB,UAAA;AAAA,YAAAY;AAAA,YACAO;AAAA,UAAA,GACH;AAAA,QAEJ;AAAA,MAAA;AAAA,IAAA;AAAA,IAEF,gBAAApB;AAAA,MAAChC;AAAA,MAAA;AAAA,QACC,QAAQa,EAAuB;AAAA,QAC/B,SAASM;AAAA,QACT,sBAAsBC;AAAA,QACtB,eAAe;AAAA,QACf,OAAO,EAAE,2BAA2B,EAAE,WAAWP,EAAuB,WAAW;AAAA,QACnF,oBAAoB,EAAE,8BAA8B;AAAA,QACpD,kBAAkB,EAAE,6BAA6B;AAAA,QAEhD,YAAE,wBAAwB;AAAA,MAAA;AAAA,IAAA;AAAA,EAC7B,EAAA,CACF,EAAA,CACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"PayrollListPresentation.js","sources":["../../../../src/components/Payroll/PayrollList/PayrollListPresentation.tsx"],"sourcesContent":["import type { Payroll } from '@gusto/embedded-api/models/components/payroll'\nimport type { PayScheduleList } from '@gusto/embedded-api/models/components/payschedulelist'\nimport type { WireInRequest } from '@gusto/embedded-api/models/components/wireinrequest'\nimport { useState, useRef } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport type { ApiPayrollBlocker } from '../PayrollBlocker/payrollHelpers'\nimport { PayrollStatusBadges } from '../PayrollStatusBadges'\nimport { getPayrollType } from '../helpers'\nimport styles from './PayrollListPresentation.module.scss'\nimport { DataView, Flex, HamburgerMenu } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { formatDateToStringDate } from '@/helpers/dateFormatting'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport FeatureIconCheck from '@/assets/icons/feature-icon-check.svg?react'\nimport useContainerBreakpoints from '@/hooks/useContainerBreakpoints/useContainerBreakpoints'\n\ninterface PayrollListPresentationProps {\n onRunPayroll: ({ payrollUuid, payPeriod }: Pick<Payroll, 'payrollUuid' | 'payPeriod'>) => void\n onSubmitPayroll: ({ payrollUuid, payPeriod }: Pick<Payroll, 'payrollUuid' | 'payPeriod'>) => void\n onSkipPayroll: ({ payrollUuid }: Pick<Payroll, 'payrollUuid'>) => void\n payrolls: Payroll[]\n paySchedules: PayScheduleList[]\n showSkipSuccessAlert: boolean\n onDismissSkipSuccessAlert: () => void\n skippingPayrollId: string | null\n blockers: ApiPayrollBlocker[]\n wireInRequests: WireInRequest[]\n}\n\nexport const PayrollListPresentation = ({\n onRunPayroll,\n onSubmitPayroll,\n onSkipPayroll,\n payrolls,\n paySchedules,\n showSkipSuccessAlert,\n onDismissSkipSuccessAlert,\n skippingPayrollId,\n blockers,\n wireInRequests,\n}: PayrollListPresentationProps) => {\n const { Button, Dialog, Heading, Text, Alert } = useComponentContext()\n useI18n('Payroll.PayrollList')\n const { t } = useTranslation('Payroll.PayrollList')\n const dateFormatter = useDateFormatter()\n const containerRef = useRef<HTMLDivElement>(null)\n const breakpoints = useContainerBreakpoints({ ref: containerRef })\n const isDesktop = breakpoints.includes('large')\n const [skipPayrollDialogState, setSkipPayrollDialogState] = useState<{\n isOpen: boolean\n payrollId: string | null\n payPeriod: string | null\n }>({\n isOpen: false,\n payrollId: null,\n payPeriod: null,\n })\n\n const handleOpenSkipDialog = (payrollId: string, payPeriod: string) => {\n setSkipPayrollDialogState({\n isOpen: true,\n payrollId,\n payPeriod,\n })\n }\n\n const handleCloseSkipDialog = () => {\n setSkipPayrollDialogState({\n isOpen: false,\n payrollId: null,\n payPeriod: null,\n })\n }\n\n const handleConfirmSkipPayroll = () => {\n if (skipPayrollDialogState.payrollId) {\n onSkipPayroll({ payrollUuid: skipPayrollDialogState.payrollId })\n handleCloseSkipDialog()\n }\n }\n\n const formatPayPeriod = (startDate: string | undefined, endDate: string | undefined) => {\n const formattedStartDate = dateFormatter.formatShort(startDate)\n const formattedEndDate = dateFormatter.formatShortWithYear(endDate)\n\n return {\n startDate: formattedStartDate,\n endDate: formattedEndDate,\n fullPeriod: dateFormatter.formatPayPeriodRange(startDate, endDate, { useShortMonth: true }),\n }\n }\n\n const renderActionButton = (payroll: Payroll) => {\n const { payrollUuid, calculatedAt, processed, payPeriod } = payroll\n\n if (processed) {\n return null\n }\n\n const isProcessingSkipPayroll = skippingPayrollId === payrollUuid\n\n return calculatedAt ? (\n <Button\n isLoading={isProcessingSkipPayroll}\n onClick={() => {\n onSubmitPayroll({ payrollUuid, payPeriod })\n }}\n title={t('submitPayrollCta')}\n variant=\"secondary\"\n >\n {t('submitPayrollCta')}\n </Button>\n ) : (\n <Button\n isLoading={isProcessingSkipPayroll}\n onClick={() => {\n onRunPayroll({ payrollUuid, payPeriod })\n }}\n title={t('runPayrollTitle')}\n variant=\"secondary\"\n >\n {t('runPayrollTitle')}\n </Button>\n )\n }\n\n return (\n <div ref={containerRef} className={styles.container}>\n <Flex flexDirection=\"column\" gap={16}>\n {showSkipSuccessAlert && (\n <div className={styles.alertContainer}>\n <Alert\n status=\"info\"\n label={t('skipSuccessAlert')}\n onDismiss={onDismissSkipSuccessAlert}\n />\n </div>\n )}\n <Flex\n flexDirection={{ base: 'column', medium: 'row' }}\n justifyContent=\"space-between\"\n alignItems=\"flex-start\"\n gap={{ base: 12, medium: 24 }}\n >\n <Flex>\n <Heading as=\"h2\">{t('title')}</Heading>\n </Flex>\n </Flex>\n\n <DataView\n breakAt=\"large\"\n emptyState={() => (\n <Flex flexDirection=\"column\" alignItems=\"center\" gap={24}>\n <FeatureIconCheck />\n <Text>{t('emptyState')}</Text>\n </Flex>\n )}\n data={payrolls}\n columns={[\n {\n render: ({ payPeriod }) => {\n const { startDate, endDate } = formatPayPeriod(\n payPeriod?.startDate,\n payPeriod?.endDate,\n )\n\n return (\n <div className={styles.payPeriodCell}>\n {startDate} - {endDate}\n <Text variant=\"supporting\" size=\"sm\">\n {paySchedules.find(schedule => schedule.uuid === payPeriod?.payScheduleUuid)\n ?.name ||\n paySchedules.find(schedule => schedule.uuid === payPeriod?.payScheduleUuid)\n ?.customName}\n </Text>\n </div>\n )\n },\n title: t('tableHeaders.0'),\n },\n {\n render: payroll => <Text>{t(`type.${getPayrollType(payroll)}`)}</Text>,\n title: t('tableHeaders.1'),\n },\n {\n render: ({ checkDate }) => dateFormatter.formatShortWithWeekdayAndYear(checkDate),\n title: t('tableHeaders.2'),\n },\n {\n title: t('tableHeaders.3'),\n render: ({ payrollDeadline }) =>\n dateFormatter.formatShortWithWeekdayAndYear(payrollDeadline),\n },\n {\n title: t('tableHeaders.4'),\n render: payroll => {\n const wireInRequest = wireInRequests.find(\n wire => wire.paymentUuid === payroll.payrollUuid,\n )\n return <PayrollStatusBadges payroll={payroll} wireInRequest={wireInRequest} />\n },\n },\n ...(!isDesktop\n ? [\n {\n title: '',\n render: (payroll: Payroll) => {\n const button = renderActionButton(payroll)\n if (!button) return null\n return (\n <Flex flexDirection=\"column\" alignItems=\"stretch\" gap={12}>\n {button}\n </Flex>\n )\n },\n },\n ]\n : []),\n ]}\n label={t('payrollsListLabel')}\n itemMenu={payroll => {\n const { payrollUuid, processed, payPeriod } = payroll\n\n if (processed) {\n return null\n }\n\n const isProcessingSkipPayroll = skippingPayrollId === payrollUuid\n\n const { fullPeriod: payPeriodString } = formatPayPeriod(\n payPeriod?.startDate,\n payPeriod?.endDate,\n )\n\n const todayDateString = formatDateToStringDate(new Date())\n const todayAtMidnight = todayDateString ? new Date(todayDateString) : null\n const payPeriodStartDate = payPeriod?.startDate ? new Date(payPeriod.startDate) : null\n\n const canSkipPayroll =\n blockers.length === 0 &&\n todayAtMidnight &&\n payPeriodStartDate &&\n todayAtMidnight >= payPeriodStartDate\n\n const button = isDesktop ? renderActionButton(payroll) : null\n\n const hamburgerMenu = canSkipPayroll ? (\n <HamburgerMenu\n isLoading={isProcessingSkipPayroll}\n menuLabel={t('payrollMenuLabel')}\n items={[\n {\n label: t('skipPayrollCta'),\n onClick: () => {\n handleOpenSkipDialog(payrollUuid!, payPeriodString)\n },\n },\n ]}\n />\n ) : null\n\n if (!button && !hamburgerMenu) {\n return null\n }\n\n return (\n <div className={styles.actionsContainer}>\n {button}\n {hamburgerMenu}\n </div>\n )\n }}\n />\n <Dialog\n isOpen={skipPayrollDialogState.isOpen}\n onClose={handleCloseSkipDialog}\n onPrimaryActionClick={handleConfirmSkipPayroll}\n isDestructive={true}\n title={t('skipPayrollDialog.title', { payPeriod: skipPayrollDialogState.payPeriod })}\n primaryActionLabel={t('skipPayrollDialog.confirmCta')}\n closeActionLabel={t('skipPayrollDialog.cancelCta')}\n >\n {t('skipPayrollDialog.body')}\n </Dialog>\n </Flex>\n </div>\n )\n}\n"],"names":["PayrollListPresentation","onRunPayroll","onSubmitPayroll","onSkipPayroll","payrolls","paySchedules","showSkipSuccessAlert","onDismissSkipSuccessAlert","skippingPayrollId","blockers","wireInRequests","Button","Dialog","Heading","Text","Alert","useComponentContext","useI18n","useTranslation","dateFormatter","useDateFormatter","containerRef","useRef","isDesktop","useContainerBreakpoints","skipPayrollDialogState","setSkipPayrollDialogState","useState","handleOpenSkipDialog","payrollId","payPeriod","handleCloseSkipDialog","handleConfirmSkipPayroll","formatPayPeriod","startDate","endDate","formattedStartDate","formattedEndDate","renderActionButton","payroll","payrollUuid","calculatedAt","processed","isProcessingSkipPayroll","jsx","styles","jsxs","Flex","DataView","FeatureIconCheck","schedule","getPayrollType","checkDate","payrollDeadline","wireInRequest","wire","PayrollStatusBadges","button","payPeriodString","todayDateString","formatDateToStringDate","todayAtMidnight","payPeriodStartDate","canSkipPayroll","hamburgerMenu","HamburgerMenu"],"mappings":";;;;;;;;;;;;;;;;AA8BO,MAAMA,KAA0B,CAAC;AAAA,EACtC,cAAAC;AAAA,EACA,iBAAAC;AAAA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AO,IAAI,MAEnDyB,IAAgBD,IACpB,gBAAAnB;AAAA,YAACqB;AAAA,YAAA;AAAA,cACC,WAAWtB;AAAA,cACX,WAAW,EAAE,kBAAkB;AAAA,cAC/B,OAAO;AAAA,gBACL;AAAA,kBACE,OAAO,EAAE,gBAAgB;AAAA,kBACzB,SAAS,MAAM;AACb,oBAAAf,EAAqBY,GAAckB,CAAe;AAAA,kBACpD;AAAA,gBAAA;AAAA,cACF;AAAA,YACF;AAAA,UAAA,IAEA;AAEJ,iBAAI,CAACD,KAAU,CAACO,IACP,OAIP,gBAAAlB,EAAC,OAAA,EAAI,WAAWD,EAAO,kBACpB,UAAA;AAAA,YAAAY;AAAA,YACAO;AAAA,UAAA,GACH;AAAA,QAEJ;AAAA,MAAA;AAAA,IAAA;AAAA,IAEF,gBAAApB;AAAA,MAAChC;AAAA,MAAA;AAAA,QACC,QAAQa,EAAuB;AAAA,QAC/B,SAASM;AAAA,QACT,sBAAsBC;AAAA,QACtB,eAAe;AAAA,QACf,OAAO,EAAE,2BAA2B,EAAE,WAAWP,EAAuB,WAAW;AAAA,QACnF,oBAAoB,EAAE,8BAA8B;AAAA,QACpD,kBAAkB,EAAE,6BAA6B;AAAA,QAEhD,YAAE,wBAAwB;AAAA,MAAA;AAAA,IAAA;AAAA,EAC7B,EAAA,CACF,EAAA,CACF;AAEJ;"}
|
|
@@ -6,6 +6,7 @@ import { PayrollOverviewStatus as h } from "./PayrollOverviewTypes.js";
|
|
|
6
6
|
import re from "./PayrollOverviewPresentation.module.scss.js";
|
|
7
7
|
import { Flex as d } from "../../Common/Flex/Flex.js";
|
|
8
8
|
import { Grid as Ne } from "../../Common/Grid/Grid.js";
|
|
9
|
+
import "classnames";
|
|
9
10
|
import { useComponentContext as Se } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
10
11
|
import we from "../../../hooks/useContainerBreakpoints/useContainerBreakpoints.js";
|
|
11
12
|
import { useI18n as _e } from "../../../i18n/I18n.js";
|
|
@@ -18,7 +19,7 @@ import { PayrollLoading as oe } from "../../Common/PayrollLoading/PayrollLoading
|
|
|
18
19
|
import { FastAchSubmissionBlockerBanner as Oe } from "./SubmissionBlockers/FastAchSubmissionBlockerBanner.js";
|
|
19
20
|
import { GenericBlocker as Ae } from "./SubmissionBlockers/GenericBlocker.js";
|
|
20
21
|
import { DataView as c } from "../../Common/DataView/DataView.js";
|
|
21
|
-
const Me = (p, w) => p?.startDate && p.endDate ? w.formatPayPeriod(p.startDate, p.endDate) : { startDate: "", endDate: "" },
|
|
22
|
+
const Me = (p, w) => p?.startDate && p.endDate ? w.formatPayPeriod(p.startDate, p.endDate) : { startDate: "", endDate: "" }, nt = ({
|
|
22
23
|
onEdit: p,
|
|
23
24
|
onSubmit: w,
|
|
24
25
|
onCancel: se,
|
|
@@ -568,6 +569,6 @@ const Me = (p, w) => p?.startDate && p.endDate ? w.formatPayPeriod(p.startDate,
|
|
|
568
569
|
] }) });
|
|
569
570
|
};
|
|
570
571
|
export {
|
|
571
|
-
|
|
572
|
+
nt as PayrollOverviewPresentation
|
|
572
573
|
};
|
|
573
574
|
//# sourceMappingURL=PayrollOverviewPresentation.js.map
|