@gusto/embedded-react-sdk 0.32.0 → 0.34.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/dist/components/Common/Fields/MultiSelectComboBoxField/MultiSelectComboBoxField.d.ts +5 -0
- package/dist/components/Common/Fields/MultiSelectComboBoxField/MultiSelectComboBoxField.js +34 -0
- package/dist/components/Common/Fields/MultiSelectComboBoxField/MultiSelectComboBoxField.js.map +1 -0
- package/dist/components/Common/Fields/MultiSelectComboBoxField/index.d.ts +2 -0
- package/dist/components/Common/SignatureForm/SignatureForm.d.ts +1 -7
- package/dist/components/Common/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/Common/UI/Menu/Menu.js +2 -3
- package/dist/components/Common/UI/Menu/Menu.js.map +1 -1
- package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.d.ts +2 -0
- package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.js +127 -0
- package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.js.map +1 -0
- package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.module.scss.js +16 -0
- package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.module.scss.js.map +1 -0
- package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBoxTypes.d.ts +17 -0
- package/dist/components/Common/UI/MultiSelectComboBox/index.d.ts +3 -0
- package/dist/components/Common/index.d.ts +1 -0
- package/dist/components/Company/AssignSignatory/CreateSignatory/Schema.d.ts +4 -30
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.d.ts +2 -26
- package/dist/components/Company/BankAccount/BankAccountForm/Form.d.ts +1 -7
- package/dist/components/Company/BankAccount/BankAccountVerify/Form.d.ts +1 -7
- package/dist/components/Company/FederalTaxes/useFederalTaxes.d.ts +7 -13
- package/dist/components/Company/Locations/LocationForm/Form.d.ts +7 -20
- package/dist/components/Company/PaySchedule/usePaySchedule.d.ts +7 -18
- package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +40 -46
- package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
- package/dist/components/Contractor/Address/useAddress.d.ts +1 -13
- package/dist/components/Contractor/ContractorList/useContractorList.js +4 -4
- package/dist/components/Contractor/ContractorList/useContractorList.js.map +1 -1
- package/dist/components/Contractor/NewHireReport/NewHireReport.d.ts +5 -15
- package/dist/components/Contractor/NewHireReport/NewHireReport.js +28 -28
- package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.d.ts +7 -20
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.d.ts +5 -6
- 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 -50
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentFormSchema.d.ts +19 -67
- package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js +27 -26
- package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js +76 -44
- package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.js +1 -1
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.js +1 -1
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummary.d.ts +3 -1
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummary.js +28 -22
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummary.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.d.ts +3 -1
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js +63 -52
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js.map +1 -1
- package/dist/components/Contractor/Profile/useContractorProfile.d.ts +54 -120
- package/dist/components/Contractor/Profile/useContractorProfile.js +47 -47
- package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
- package/dist/components/Employee/Compensation/useCompensation.d.ts +17 -44
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.d.ts +4 -22
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +59 -59
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.d.ts +4 -22
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +33 -33
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.d.ts +5 -27
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +46 -46
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +1 -1
- package/dist/components/Employee/Deductions/useDeductions.d.ts +7 -26
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.d.ts +5 -29
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.js +8 -8
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.d.ts +9 -76
- package/dist/components/Employee/EmployeeDocuments/EmployeeDocumentsPresentation.d.ts +1 -5
- package/dist/components/Employee/FederalTaxes/FederalForm.d.ts +7 -33
- package/dist/components/Employee/PaymentMethod/BankAccount.d.ts +5 -14
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.d.ts +5 -6
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.d.ts +12 -68
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +15 -14
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/AdminPersonalDetails.d.ts +17 -82
- package/dist/components/Employee/Profile/AdminPersonalDetails.js +38 -33
- package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
- package/dist/components/Employee/Profile/HomeAddress.d.ts +11 -66
- package/dist/components/Employee/Profile/PersonalDetailsInputs.d.ts +15 -64
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js +23 -19
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
- package/dist/components/Employee/Profile/Profile.js +2 -5
- package/dist/components/Employee/Profile/Profile.js.map +1 -1
- package/dist/components/Employee/Profile/SelfPersonalDetails.d.ts +8 -37
- package/dist/components/Employee/Profile/SelfPersonalDetails.js +22 -19
- package/dist/components/Employee/Profile/SelfPersonalDetails.js.map +1 -1
- package/dist/components/Employee/StateTaxes/StateForm.d.ts +1 -5
- package/dist/components/Employee/Taxes/FederalForm.d.ts +7 -33
- package/dist/components/Employee/Taxes/StateForm.d.ts +1 -5
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.d.ts +1 -11
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js.map +1 -1
- package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js +6 -9
- package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js +84 -56
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.d.ts +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js +56 -22
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationTypes.d.ts +5 -0
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes.d.ts +2 -22
- 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/PayrollEditEmployee/PayrollEditEmployee.js +5 -5
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.d.ts +2 -12
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +34 -34
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.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/usePreparedPayrollData.js +26 -26
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/contexts/ApiProvider/ApiProvider.js +26 -25
- package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -1
- package/dist/contexts/ApiProvider/apiVersionHook.d.ts +2 -0
- package/dist/contexts/ApiProvider/apiVersionHook.js +7 -0
- package/dist/contexts/ApiProvider/apiVersionHook.js.map +1 -0
- package/dist/contexts/ApiProvider/apiVersionHook.test.d.ts +1 -0
- package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js +60 -58
- package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js.map +1 -1
- package/dist/contexts/ComponentAdapter/useComponentContext.d.ts +2 -0
- package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
- package/dist/contexts/ThemeProvider/ThemeProvider.js +23 -23
- package/dist/contexts/ThemeProvider/ThemeProvider.js.map +1 -1
- package/dist/helpers/validations.d.ts +2 -2
- package/dist/i18n/I18n.js +15 -15
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Contractor.Payments.PaymentSummary.json.js +42 -40
- package/dist/i18n/en/Contractor.Payments.PaymentSummary.json.js.map +1 -1
- package/dist/i18n/en/Contractor.Payments.PaymentsList.json.js +9 -9
- package/dist/i18n/en/Payroll.EmployeeSelection.json.js +10 -0
- package/dist/i18n/en/Payroll.EmployeeSelection.json.js.map +1 -0
- package/dist/i18n/en/Payroll.OffCycleCreation.json.js +10 -8
- package/dist/i18n/en/Payroll.OffCycleCreation.json.js.map +1 -1
- package/dist/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 +14 -1
- package/docs/reference/endpoint-inventory.json +4 -0
- package/package.json +14 -13
|
@@ -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,WAAW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,MAAA,CACpC;AAAA,MACD,WAAWe;AAAA,MACX,iBAAiB;AAAA,MACjB,QAAQ;AAAA,MACR,WAAW;AAAA,QACT,UAAU;AAAA,QACV,WAAW;AAAA,MAAA;AAAA,IACb;AAAA,EACF;AAEJ,GAEMC,IAA0BX;AAAA,EAC9BC,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,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,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,WAAWA,EAAI,WAAW,aAAa;AAAA,UACvC,SAASA,EAAI,WAAW,WAAW;AAAA,QAAA,CACpC;AAAA,QACD,WAAWG;AAAA,QACX,QAAQ;AAAA,MAAA;AAAA,IACV;AAAA,EACF;AAAA,EAEF,cAAc;AAAA,IACZ,QAAQ;AAAA,IACR,MAAM;AAAA,MACJ,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,WAAW;AAAA,IAAA;AAAA,EACb;AAAA,EAEF,UAAU;AAAA,IACR,QAAQ;AAAA,IACR,MAAM;AAAA,MACJ,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,WAAW;AAAA,IAAA;AAAA,EACb;AAAA,EAEF,UAAU;AAAA,IACR,QAAQ;AAAA,IACR,MAAM;AAAA,MACJ,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,WAAW;AAAA,IAAA;AAAA,EACb;AAEJ,GAEMC,IAAuBC;AAAA,EAC3BC,EAAgB;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aiB,IAA0B;AAAA,EACrC,eAAeC;AAAA,IACbvB,EAA6B,eAAe;AAAA,IAC5CO;AAAA,IACAM;AAAA,IACAE;AAAA,EAAA;AAAA,EAEF,UAAUQ;AAAA,IACRvB,EAA6B,eAAe;AAAA,IAC5CiB;AAAA,IACAC;AAAA,EAAA;AAAA,EAEF,cAAcK;AAAA,IACZvB,EAA6B,eAAe;AAAA,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,6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d,gBAAAjB;AAAA,IAACkB;AAAA,IAAA;AAAA,MACC,SAAS,MAAM;AACb,QAAAvB,EAAQ6B,EAAgB,iBAAiB;AAAA,MAC3C;AAAA,MACA,SAAQ;AAAA,MAEP,UAAAF,EAAEL,EAAU,QAAiB;AAAA,IAAA;AAAA,EAAA,IATD;AAYnC;"}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { usePayrollsPrepareMutation as
|
|
3
|
-
import { usePaySchedulesGet as
|
|
1
|
+
import { useState as L, useRef as P, useMemo as D, useCallback as j, useEffect as q } from "react";
|
|
2
|
+
import { usePayrollsPrepareMutation as w } from "@gusto/embedded-api/react-query/payrollsPrepare";
|
|
3
|
+
import { usePaySchedulesGet as M } from "@gusto/embedded-api/react-query/paySchedulesGet";
|
|
4
4
|
import "react/jsx-runtime";
|
|
5
5
|
import "react-error-boundary";
|
|
6
6
|
import "react-i18next";
|
|
7
7
|
import "@gusto/embedded-api/models/errors/gustoembeddederror";
|
|
8
8
|
import "@gusto/embedded-api/models/errors/sdkvalidationerror";
|
|
9
9
|
import "@tanstack/react-query";
|
|
10
|
-
import { useBase as
|
|
10
|
+
import { useBase as R } from "../Base/useBase.js";
|
|
11
11
|
import "../../shared/constants.js";
|
|
12
12
|
import "classnames";
|
|
13
13
|
import "../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
14
|
import "../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
15
15
|
import "dompurify";
|
|
16
16
|
import "../../contexts/LocaleProvider/useLocale.js";
|
|
17
|
-
const
|
|
17
|
+
const N = ({
|
|
18
18
|
companyId: r,
|
|
19
19
|
payrollId: s,
|
|
20
20
|
employeeUuids: a,
|
|
21
|
-
sortBy:
|
|
22
|
-
onDataReady:
|
|
21
|
+
sortBy: n,
|
|
22
|
+
onDataReady: l
|
|
23
23
|
}) => {
|
|
24
|
-
const { mutateAsync: p, isPending: u } =
|
|
24
|
+
const { mutateAsync: p, isPending: u } = w(), [t, m] = L(), e = P(!1), c = P(!1), { baseSubmitHandler: d } = R(), y = D(() => a?.join(",") ?? "", [a]), { data: f, isLoading: h } = M(
|
|
25
25
|
{
|
|
26
26
|
companyId: r,
|
|
27
27
|
payScheduleId: t?.payPeriod?.payScheduleUuid || ""
|
|
@@ -29,43 +29,43 @@ const J = ({
|
|
|
29
29
|
{
|
|
30
30
|
enabled: !!t?.payPeriod?.payScheduleUuid
|
|
31
31
|
}
|
|
32
|
-
),
|
|
33
|
-
await
|
|
34
|
-
const
|
|
32
|
+
), i = j(async () => {
|
|
33
|
+
await d(null, async () => {
|
|
34
|
+
const o = await p({
|
|
35
35
|
request: {
|
|
36
36
|
companyId: r,
|
|
37
37
|
payrollId: s,
|
|
38
|
-
sortBy:
|
|
38
|
+
sortBy: n,
|
|
39
39
|
requestBody: {
|
|
40
40
|
employeeUuids: a
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
|
-
|
|
44
|
+
m(o.payrollPrepared), o.payrollPrepared && (e.current = !0, l?.(o.payrollPrepared));
|
|
45
45
|
});
|
|
46
46
|
}, [
|
|
47
47
|
r,
|
|
48
48
|
s,
|
|
49
49
|
p,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
y,
|
|
51
|
+
d,
|
|
52
|
+
n,
|
|
53
|
+
l
|
|
54
54
|
]);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}, [
|
|
58
|
-
const
|
|
55
|
+
q(() => {
|
|
56
|
+
c.current || (c.current = !0, i());
|
|
57
|
+
}, [i]);
|
|
58
|
+
const S = u && !e.current, g = u && e.current, b = S || h;
|
|
59
59
|
return {
|
|
60
|
-
handlePreparePayroll:
|
|
60
|
+
handlePreparePayroll: i,
|
|
61
61
|
preparedPayroll: t,
|
|
62
|
-
paySchedule:
|
|
63
|
-
isLoading:
|
|
64
|
-
isPaginating:
|
|
62
|
+
paySchedule: f?.payScheduleObject,
|
|
63
|
+
isLoading: b,
|
|
64
|
+
isPaginating: g,
|
|
65
65
|
hasInitialData: e.current
|
|
66
66
|
};
|
|
67
67
|
};
|
|
68
68
|
export {
|
|
69
|
-
|
|
69
|
+
N as usePreparedPayrollData
|
|
70
70
|
};
|
|
71
71
|
//# sourceMappingURL=usePreparedPayrollData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePreparedPayrollData.js","sources":["../../../src/components/Payroll/usePreparedPayrollData.ts"],"sourcesContent":["import { useState, useEffect, useCallback, useRef, useMemo } from 'react'\nimport { usePayrollsPrepareMutation } from '@gusto/embedded-api/react-query/payrollsPrepare'\nimport { usePaySchedulesGet } from '@gusto/embedded-api/react-query/paySchedulesGet'\nimport type { PayrollPrepared } from '@gusto/embedded-api/models/components/payroll'\nimport type { PayScheduleObject } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport type { QueryParamSortBy } from '@gusto/embedded-api/models/operations/putv1companiescompanyidpayrollspayrollidprepare'\nimport { useBase } from '../Base'\n\ninterface UsePreparedPayrollDataParams {\n companyId: string\n payrollId: string\n employeeUuids?: string[]\n sortBy?: QueryParamSortBy\n onDataReady?: (preparedPayroll: PayrollPrepared) => void\n}\n\ninterface UsePreparedPayrollDataReturn {\n handlePreparePayroll: () => Promise<void>\n preparedPayroll: PayrollPrepared | undefined\n paySchedule: PayScheduleObject | undefined\n isLoading: boolean\n isPaginating: boolean\n hasInitialData: boolean\n}\n\nexport const usePreparedPayrollData = ({\n companyId,\n payrollId,\n employeeUuids,\n sortBy,\n onDataReady,\n}: UsePreparedPayrollDataParams): UsePreparedPayrollDataReturn => {\n const { mutateAsync: preparePayroll, isPending: isPreparePayrollPending } =\n usePayrollsPrepareMutation()\n const [preparedPayroll, setPreparedPayroll] = useState<PayrollPrepared | undefined>()\n const hasInitialDataRef = useRef(false)\n const { baseSubmitHandler } = useBase()\n\n const employeeUuidsKey = useMemo(() => employeeUuids?.join(',') ?? '', [employeeUuids])\n\n const { data: payScheduleData, isLoading: isPayScheduleLoading } = usePaySchedulesGet(\n {\n companyId,\n payScheduleId: preparedPayroll?.payPeriod?.payScheduleUuid || '',\n },\n {\n enabled: !!preparedPayroll?.payPeriod?.payScheduleUuid,\n },\n )\n\n const handlePreparePayroll = useCallback(async () => {\n await baseSubmitHandler(null, async () => {\n const result = await preparePayroll({\n request: {\n companyId,\n payrollId,\n sortBy,\n requestBody: {\n employeeUuids,\n },\n },\n })\n setPreparedPayroll(result.payrollPrepared)\n if (result.payrollPrepared) {\n hasInitialDataRef.current = true\n onDataReady?.(result.payrollPrepared)\n }\n })\n }, [\n companyId,\n payrollId,\n preparePayroll,\n employeeUuidsKey,\n baseSubmitHandler,\n sortBy,\n onDataReady,\n ])\n\n useEffect(() => {\n void handlePreparePayroll()\n }, [handlePreparePayroll])\n\n const isInitialLoading = isPreparePayrollPending && !hasInitialDataRef.current\n const isPaginating = isPreparePayrollPending && hasInitialDataRef.current\n const isLoading = isInitialLoading || isPayScheduleLoading\n\n return {\n handlePreparePayroll,\n preparedPayroll,\n paySchedule: payScheduleData?.payScheduleObject,\n isLoading,\n isPaginating,\n hasInitialData: hasInitialDataRef.current,\n }\n}\n"],"names":["usePreparedPayrollData","companyId","payrollId","employeeUuids","sortBy","onDataReady","preparePayroll","isPreparePayrollPending","usePayrollsPrepareMutation","preparedPayroll","setPreparedPayroll","useState","hasInitialDataRef","useRef","baseSubmitHandler","useBase","employeeUuidsKey","useMemo","payScheduleData","isPayScheduleLoading","usePaySchedulesGet","handlePreparePayroll","useCallback","result","useEffect","isInitialLoading","isPaginating","isLoading"],"mappings":";;;;;;;;;;;;;;;;AAyBO,MAAMA,IAAyB,CAAC;AAAA,EACrC,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,QAAAC;AAAA,EACA,aAAAC;AACF,MAAkE;AAChE,QAAM,EAAE,aAAaC,GAAgB,WAAWC,EAAA,IAC9CC,EAAA,GACI,CAACC,GAAiBC,CAAkB,IAAIC,EAAA,GACxCC,IAAoBC,EAAO,EAAK,
|
|
1
|
+
{"version":3,"file":"usePreparedPayrollData.js","sources":["../../../src/components/Payroll/usePreparedPayrollData.ts"],"sourcesContent":["import { useState, useEffect, useCallback, useRef, useMemo } from 'react'\nimport { usePayrollsPrepareMutation } from '@gusto/embedded-api/react-query/payrollsPrepare'\nimport { usePaySchedulesGet } from '@gusto/embedded-api/react-query/paySchedulesGet'\nimport type { PayrollPrepared } from '@gusto/embedded-api/models/components/payroll'\nimport type { PayScheduleObject } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport type { QueryParamSortBy } from '@gusto/embedded-api/models/operations/putv1companiescompanyidpayrollspayrollidprepare'\nimport { useBase } from '../Base'\n\ninterface UsePreparedPayrollDataParams {\n companyId: string\n payrollId: string\n employeeUuids?: string[]\n sortBy?: QueryParamSortBy\n onDataReady?: (preparedPayroll: PayrollPrepared) => void\n}\n\ninterface UsePreparedPayrollDataReturn {\n handlePreparePayroll: () => Promise<void>\n preparedPayroll: PayrollPrepared | undefined\n paySchedule: PayScheduleObject | undefined\n isLoading: boolean\n isPaginating: boolean\n hasInitialData: boolean\n}\n\nexport const usePreparedPayrollData = ({\n companyId,\n payrollId,\n employeeUuids,\n sortBy,\n onDataReady,\n}: UsePreparedPayrollDataParams): UsePreparedPayrollDataReturn => {\n const { mutateAsync: preparePayroll, isPending: isPreparePayrollPending } =\n usePayrollsPrepareMutation()\n const [preparedPayroll, setPreparedPayroll] = useState<PayrollPrepared | undefined>()\n const hasInitialDataRef = useRef(false)\n const hasFiredRef = useRef(false)\n const { baseSubmitHandler } = useBase()\n\n const employeeUuidsKey = useMemo(() => employeeUuids?.join(',') ?? '', [employeeUuids])\n\n const { data: payScheduleData, isLoading: isPayScheduleLoading } = usePaySchedulesGet(\n {\n companyId,\n payScheduleId: preparedPayroll?.payPeriod?.payScheduleUuid || '',\n },\n {\n enabled: !!preparedPayroll?.payPeriod?.payScheduleUuid,\n },\n )\n\n const handlePreparePayroll = useCallback(async () => {\n await baseSubmitHandler(null, async () => {\n const result = await preparePayroll({\n request: {\n companyId,\n payrollId,\n sortBy,\n requestBody: {\n employeeUuids,\n },\n },\n })\n setPreparedPayroll(result.payrollPrepared)\n if (result.payrollPrepared) {\n hasInitialDataRef.current = true\n onDataReady?.(result.payrollPrepared)\n }\n })\n }, [\n companyId,\n payrollId,\n preparePayroll,\n employeeUuidsKey,\n baseSubmitHandler,\n sortBy,\n onDataReady,\n ])\n\n useEffect(() => {\n if (hasFiredRef.current) return\n hasFiredRef.current = true\n void handlePreparePayroll()\n }, [handlePreparePayroll])\n\n const isInitialLoading = isPreparePayrollPending && !hasInitialDataRef.current\n const isPaginating = isPreparePayrollPending && hasInitialDataRef.current\n const isLoading = isInitialLoading || isPayScheduleLoading\n\n return {\n handlePreparePayroll,\n preparedPayroll,\n paySchedule: payScheduleData?.payScheduleObject,\n isLoading,\n isPaginating,\n hasInitialData: hasInitialDataRef.current,\n }\n}\n"],"names":["usePreparedPayrollData","companyId","payrollId","employeeUuids","sortBy","onDataReady","preparePayroll","isPreparePayrollPending","usePayrollsPrepareMutation","preparedPayroll","setPreparedPayroll","useState","hasInitialDataRef","useRef","hasFiredRef","baseSubmitHandler","useBase","employeeUuidsKey","useMemo","payScheduleData","isPayScheduleLoading","usePaySchedulesGet","handlePreparePayroll","useCallback","result","useEffect","isInitialLoading","isPaginating","isLoading"],"mappings":";;;;;;;;;;;;;;;;AAyBO,MAAMA,IAAyB,CAAC;AAAA,EACrC,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,QAAAC;AAAA,EACA,aAAAC;AACF,MAAkE;AAChE,QAAM,EAAE,aAAaC,GAAgB,WAAWC,EAAA,IAC9CC,EAAA,GACI,CAACC,GAAiBC,CAAkB,IAAIC,EAAA,GACxCC,IAAoBC,EAAO,EAAK,GAChCC,IAAcD,EAAO,EAAK,GAC1B,EAAE,mBAAAE,EAAA,IAAsBC,EAAA,GAExBC,IAAmBC,EAAQ,MAAMf,GAAe,KAAK,GAAG,KAAK,IAAI,CAACA,CAAa,CAAC,GAEhF,EAAE,MAAMgB,GAAiB,WAAWC,MAAyBC;AAAA,IACjE;AAAA,MACE,WAAApB;AAAA,MACA,eAAeQ,GAAiB,WAAW,mBAAmB;AAAA,IAAA;AAAA,IAEhE;AAAA,MACE,SAAS,CAAC,CAACA,GAAiB,WAAW;AAAA,IAAA;AAAA,EACzC,GAGIa,IAAuBC,EAAY,YAAY;AACnD,UAAMR,EAAkB,MAAM,YAAY;AACxC,YAAMS,IAAS,MAAMlB,EAAe;AAAA,QAClC,SAAS;AAAA,UACP,WAAAL;AAAA,UACA,WAAAC;AAAA,UACA,QAAAE;AAAA,UACA,aAAa;AAAA,YACX,eAAAD;AAAA,UAAA;AAAA,QACF;AAAA,MACF,CACD;AACD,MAAAO,EAAmBc,EAAO,eAAe,GACrCA,EAAO,oBACTZ,EAAkB,UAAU,IAC5BP,IAAcmB,EAAO,eAAe;AAAA,IAExC,CAAC;AAAA,EACH,GAAG;AAAA,IACDvB;AAAA,IACAC;AAAA,IACAI;AAAA,IACAW;AAAA,IACAF;AAAA,IACAX;AAAA,IACAC;AAAA,EAAA,CACD;AAED,EAAAoB,EAAU,MAAM;AACd,IAAIX,EAAY,YAChBA,EAAY,UAAU,IACjBQ,EAAA;AAAA,EACP,GAAG,CAACA,CAAoB,CAAC;AAEzB,QAAMI,IAAmBnB,KAA2B,CAACK,EAAkB,SACjEe,IAAepB,KAA2BK,EAAkB,SAC5DgB,IAAYF,KAAoBN;AAEtC,SAAO;AAAA,IACL,sBAAAE;AAAA,IACA,iBAAAb;AAAA,IACA,aAAaU,GAAiB;AAAA,IAC9B,WAAAS;AAAA,IACA,cAAAD;AAAA,IACA,gBAAgBf,EAAkB;AAAA,EAAA;AAEtC;"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
-
import { QueryClient as
|
|
3
|
-
import { GustoEmbeddedProvider as
|
|
4
|
-
import { GustoEmbeddedCore as
|
|
2
|
+
import { QueryClient as H, QueryClientProvider as E } from "@tanstack/react-query";
|
|
3
|
+
import { GustoEmbeddedProvider as R } from "@gusto/embedded-api/react-query/_context";
|
|
4
|
+
import { GustoEmbeddedCore as b } from "@gusto/embedded-api/core";
|
|
5
5
|
import { SDKHooks as g } from "@gusto/embedded-api/hooks/hooks";
|
|
6
6
|
import { useMemo as a } from "react";
|
|
7
|
-
|
|
7
|
+
import { apiVersionHook as q } from "./apiVersionHook.js";
|
|
8
|
+
function A({
|
|
8
9
|
url: f,
|
|
9
10
|
headers: s,
|
|
10
11
|
hooks: e,
|
|
@@ -12,37 +13,37 @@ function x({
|
|
|
12
13
|
queryClient: i
|
|
13
14
|
}) {
|
|
14
15
|
const m = a(() => {
|
|
15
|
-
const r = new
|
|
16
|
+
const r = new b({
|
|
16
17
|
serverURL: f
|
|
17
|
-
}),
|
|
18
|
-
if (s) {
|
|
19
|
-
const
|
|
20
|
-
beforeRequest: (
|
|
21
|
-
c && n.headers.set(
|
|
18
|
+
}), t = r._options.hooks || new g();
|
|
19
|
+
if (t.registerBeforeRequestHook(q), s) {
|
|
20
|
+
const o = {
|
|
21
|
+
beforeRequest: (C, n) => (new Headers(s).forEach((c, l) => {
|
|
22
|
+
c && n.headers.set(l, c);
|
|
22
23
|
}), n)
|
|
23
24
|
};
|
|
24
|
-
|
|
25
|
+
t.registerBeforeRequestHook(o);
|
|
25
26
|
}
|
|
26
|
-
return e?.beforeCreateRequest && e.beforeCreateRequest.forEach((
|
|
27
|
-
|
|
28
|
-
}), e?.beforeRequest && e.beforeRequest.forEach((
|
|
29
|
-
|
|
30
|
-
}), e?.afterSuccess && e.afterSuccess.forEach((
|
|
31
|
-
|
|
32
|
-
}), e?.afterError && e.afterError.forEach((
|
|
33
|
-
|
|
34
|
-
}), r._options.hooks || (r._options.hooks =
|
|
35
|
-
}, [f, s, e]),
|
|
27
|
+
return e?.beforeCreateRequest && e.beforeCreateRequest.forEach((o) => {
|
|
28
|
+
t.registerBeforeCreateRequestHook(o);
|
|
29
|
+
}), e?.beforeRequest && e.beforeRequest.forEach((o) => {
|
|
30
|
+
t.registerBeforeRequestHook(o);
|
|
31
|
+
}), e?.afterSuccess && e.afterSuccess.forEach((o) => {
|
|
32
|
+
t.registerAfterSuccessHook(o);
|
|
33
|
+
}), e?.afterError && e.afterError.forEach((o) => {
|
|
34
|
+
t.registerAfterErrorHook(o);
|
|
35
|
+
}), r._options.hooks || (r._options.hooks = t), r;
|
|
36
|
+
}, [f, s, e]), p = a(() => {
|
|
36
37
|
if (i)
|
|
37
38
|
return i;
|
|
38
|
-
const r = new
|
|
39
|
+
const r = new H(), t = async () => {
|
|
39
40
|
await r.invalidateQueries();
|
|
40
41
|
};
|
|
41
|
-
return r.setQueryDefaults(["@gusto/embedded-api"], { retry: !1 }), r.setMutationDefaults(["@gusto/embedded-api"], { onSuccess:
|
|
42
|
+
return r.setQueryDefaults(["@gusto/embedded-api"], { retry: !1 }), r.setMutationDefaults(["@gusto/embedded-api"], { onSuccess: t, retry: !1 }), r;
|
|
42
43
|
}, [i]);
|
|
43
|
-
return /* @__PURE__ */ u(
|
|
44
|
+
return /* @__PURE__ */ u(E, { client: p, children: /* @__PURE__ */ u(R, { client: m, children: d }) });
|
|
44
45
|
}
|
|
45
46
|
export {
|
|
46
|
-
|
|
47
|
+
A as ApiProvider
|
|
47
48
|
};
|
|
48
49
|
//# sourceMappingURL=ApiProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiProvider.js","sources":["../../../src/contexts/ApiProvider/ApiProvider.tsx"],"sourcesContent":["import { QueryClient, QueryClientProvider } from '@tanstack/react-query'\nimport { GustoEmbeddedProvider } from '@gusto/embedded-api/react-query/_context'\nimport { GustoEmbeddedCore } from '@gusto/embedded-api/core'\nimport { SDKHooks as NativeSDKHooks } from '@gusto/embedded-api/hooks/hooks'\nimport { useMemo } from 'react'\nimport type { SDKHooks, BeforeRequestHook } from '@/types/hooks'\n\nexport interface ApiProviderProps {\n url: string\n headers?: HeadersInit\n hooks?: SDKHooks\n children: React.ReactNode\n queryClient?: QueryClient\n}\n\nexport function ApiProvider({\n url,\n headers,\n hooks,\n children,\n queryClient: queryClientFromProps,\n}: ApiProviderProps) {\n const gustoClient = useMemo(() => {\n const client = new GustoEmbeddedCore({\n serverURL: url,\n })\n\n const sdkHooks = client._options.hooks || new NativeSDKHooks()\n\n if (headers) {\n const defaultHeaderHook: BeforeRequestHook = {\n beforeRequest: (context, request) => {\n const headersInstance = new Headers(headers)\n headersInstance.forEach((headerValue, headerName) => {\n if (headerValue) {\n request.headers.set(headerName, headerValue)\n }\n })\n return request\n },\n }\n sdkHooks.registerBeforeRequestHook(defaultHeaderHook)\n }\n\n if (hooks?.beforeCreateRequest) {\n hooks.beforeCreateRequest.forEach(hook => {\n sdkHooks.registerBeforeCreateRequestHook(hook)\n })\n }\n\n if (hooks?.beforeRequest) {\n hooks.beforeRequest.forEach(hook => {\n sdkHooks.registerBeforeRequestHook(hook)\n })\n }\n\n if (hooks?.afterSuccess) {\n hooks.afterSuccess.forEach(hook => {\n sdkHooks.registerAfterSuccessHook(hook)\n })\n }\n\n if (hooks?.afterError) {\n hooks.afterError.forEach(hook => {\n sdkHooks.registerAfterErrorHook(hook)\n })\n }\n\n if (!client._options.hooks) {\n client._options.hooks = sdkHooks\n }\n\n return client\n }, [url, headers, hooks])\n\n const queryClient = useMemo(() => {\n if (queryClientFromProps) {\n return queryClientFromProps\n }\n\n // Create and configure a new QueryClient for internal SDK use\n const client = new QueryClient()\n\n const onSuccess = async () => {\n await client.invalidateQueries()\n }\n client.setQueryDefaults(['@gusto/embedded-api'], { retry: false })\n client.setMutationDefaults(['@gusto/embedded-api'], { onSuccess, retry: false })\n\n return client\n }, [queryClientFromProps])\n\n return (\n <QueryClientProvider client={queryClient}>\n <GustoEmbeddedProvider client={gustoClient}>{children}</GustoEmbeddedProvider>\n </QueryClientProvider>\n )\n}\n"],"names":["ApiProvider","url","headers","hooks","children","queryClientFromProps","gustoClient","useMemo","client","GustoEmbeddedCore","sdkHooks","NativeSDKHooks","defaultHeaderHook","context","request","headerValue","headerName","hook","queryClient","QueryClient","onSuccess","jsx","QueryClientProvider","GustoEmbeddedProvider"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ApiProvider.js","sources":["../../../src/contexts/ApiProvider/ApiProvider.tsx"],"sourcesContent":["import { QueryClient, QueryClientProvider } from '@tanstack/react-query'\nimport { GustoEmbeddedProvider } from '@gusto/embedded-api/react-query/_context'\nimport { GustoEmbeddedCore } from '@gusto/embedded-api/core'\nimport { SDKHooks as NativeSDKHooks } from '@gusto/embedded-api/hooks/hooks'\nimport { useMemo } from 'react'\nimport { apiVersionHook } from './apiVersionHook'\nimport type { SDKHooks, BeforeRequestHook } from '@/types/hooks'\n\nexport interface ApiProviderProps {\n url: string\n headers?: HeadersInit\n hooks?: SDKHooks\n children: React.ReactNode\n queryClient?: QueryClient\n}\n\nexport function ApiProvider({\n url,\n headers,\n hooks,\n children,\n queryClient: queryClientFromProps,\n}: ApiProviderProps) {\n const gustoClient = useMemo(() => {\n const client = new GustoEmbeddedCore({\n serverURL: url,\n })\n\n const sdkHooks = client._options.hooks || new NativeSDKHooks()\n\n sdkHooks.registerBeforeRequestHook(apiVersionHook)\n\n if (headers) {\n const defaultHeaderHook: BeforeRequestHook = {\n beforeRequest: (context, request) => {\n const headersInstance = new Headers(headers)\n headersInstance.forEach((headerValue, headerName) => {\n if (headerValue) {\n request.headers.set(headerName, headerValue)\n }\n })\n return request\n },\n }\n sdkHooks.registerBeforeRequestHook(defaultHeaderHook)\n }\n\n if (hooks?.beforeCreateRequest) {\n hooks.beforeCreateRequest.forEach(hook => {\n sdkHooks.registerBeforeCreateRequestHook(hook)\n })\n }\n\n if (hooks?.beforeRequest) {\n hooks.beforeRequest.forEach(hook => {\n sdkHooks.registerBeforeRequestHook(hook)\n })\n }\n\n if (hooks?.afterSuccess) {\n hooks.afterSuccess.forEach(hook => {\n sdkHooks.registerAfterSuccessHook(hook)\n })\n }\n\n if (hooks?.afterError) {\n hooks.afterError.forEach(hook => {\n sdkHooks.registerAfterErrorHook(hook)\n })\n }\n\n if (!client._options.hooks) {\n client._options.hooks = sdkHooks\n }\n\n return client\n }, [url, headers, hooks])\n\n const queryClient = useMemo(() => {\n if (queryClientFromProps) {\n return queryClientFromProps\n }\n\n // Create and configure a new QueryClient for internal SDK use\n const client = new QueryClient()\n\n const onSuccess = async () => {\n await client.invalidateQueries()\n }\n client.setQueryDefaults(['@gusto/embedded-api'], { retry: false })\n client.setMutationDefaults(['@gusto/embedded-api'], { onSuccess, retry: false })\n\n return client\n }, [queryClientFromProps])\n\n return (\n <QueryClientProvider client={queryClient}>\n <GustoEmbeddedProvider client={gustoClient}>{children}</GustoEmbeddedProvider>\n </QueryClientProvider>\n )\n}\n"],"names":["ApiProvider","url","headers","hooks","children","queryClientFromProps","gustoClient","useMemo","client","GustoEmbeddedCore","sdkHooks","NativeSDKHooks","apiVersionHook","defaultHeaderHook","context","request","headerValue","headerName","hook","queryClient","QueryClient","onSuccess","jsx","QueryClientProvider","GustoEmbeddedProvider"],"mappings":";;;;;;;AAgBO,SAASA,EAAY;AAAA,EAC1B,KAAAC;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAaC;AACf,GAAqB;AACnB,QAAMC,IAAcC,EAAQ,MAAM;AAChC,UAAMC,IAAS,IAAIC,EAAkB;AAAA,MACnC,WAAWR;AAAA,IAAA,CACZ,GAEKS,IAAWF,EAAO,SAAS,SAAS,IAAIG,EAAA;AAI9C,QAFAD,EAAS,0BAA0BE,CAAc,GAE7CV,GAAS;AACX,YAAMW,IAAuC;AAAA,QAC3C,eAAe,CAACC,GAASC,OACC,IAAI,QAAQb,CAAO,EAC3B,QAAQ,CAACc,GAAaC,MAAe;AACnD,UAAID,KACFD,EAAQ,QAAQ,IAAIE,GAAYD,CAAW;AAAA,QAE/C,CAAC,GACMD;AAAA,MACT;AAEF,MAAAL,EAAS,0BAA0BG,CAAiB;AAAA,IACtD;AAEA,WAAIV,GAAO,uBACTA,EAAM,oBAAoB,QAAQ,CAAAe,MAAQ;AACxC,MAAAR,EAAS,gCAAgCQ,CAAI;AAAA,IAC/C,CAAC,GAGCf,GAAO,iBACTA,EAAM,cAAc,QAAQ,CAAAe,MAAQ;AAClC,MAAAR,EAAS,0BAA0BQ,CAAI;AAAA,IACzC,CAAC,GAGCf,GAAO,gBACTA,EAAM,aAAa,QAAQ,CAAAe,MAAQ;AACjC,MAAAR,EAAS,yBAAyBQ,CAAI;AAAA,IACxC,CAAC,GAGCf,GAAO,cACTA,EAAM,WAAW,QAAQ,CAAAe,MAAQ;AAC/B,MAAAR,EAAS,uBAAuBQ,CAAI;AAAA,IACtC,CAAC,GAGEV,EAAO,SAAS,UACnBA,EAAO,SAAS,QAAQE,IAGnBF;AAAA,EACT,GAAG,CAACP,GAAKC,GAASC,CAAK,CAAC,GAElBgB,IAAcZ,EAAQ,MAAM;AAChC,QAAIF;AACF,aAAOA;AAIT,UAAMG,IAAS,IAAIY,EAAA,GAEbC,IAAY,YAAY;AAC5B,YAAMb,EAAO,kBAAA;AAAA,IACf;AACA,WAAAA,EAAO,iBAAiB,CAAC,qBAAqB,GAAG,EAAE,OAAO,IAAO,GACjEA,EAAO,oBAAoB,CAAC,qBAAqB,GAAG,EAAE,WAAAa,GAAW,OAAO,IAAO,GAExEb;AAAA,EACT,GAAG,CAACH,CAAoB,CAAC;AAEzB,SACE,gBAAAiB,EAACC,KAAoB,QAAQJ,GAC3B,4BAACK,GAAA,EAAsB,QAAQlB,GAAc,UAAAF,EAAA,CAAS,EAAA,CACxD;AAEJ;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apiVersionHook.js","sources":["../../../src/contexts/ApiProvider/apiVersionHook.ts"],"sourcesContent":["import type { BeforeRequestHook } from '@/types/hooks'\n\nconst CURRENT_API_VERSION = '2025-06-15'\n\nexport const apiVersionHook: BeforeRequestHook = {\n beforeRequest: (_context, request) => {\n request.headers.set('X-Gusto-API-Version', CURRENT_API_VERSION)\n return request\n },\n}\n"],"names":["CURRENT_API_VERSION","apiVersionHook","_context","request"],"mappings":"AAEA,MAAMA,IAAsB,cAEfC,IAAoC;AAAA,EAC/C,eAAe,CAACC,GAAUC,OACxBA,EAAQ,QAAQ,IAAI,uBAAuBH,CAAmB,GACvDG;AAEX;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|