@gusto/embedded-react-sdk 0.55.8 → 0.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/dist/components/Common/UI/Menu/MenuTypes.js.map +1 -1
- package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.js +43 -42
- package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +4 -3
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +4 -3
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +6 -5
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +4 -3
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +4 -3
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +6 -5
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +7 -6
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +4 -3
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +4 -3
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +4 -3
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +4 -3
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +4 -3
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/TaxRateManagement/context.js +4 -3
- package/dist/components/Company/StateTaxes/TaxRateManagement/context.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +4 -3
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/EmployeeList/management/ManagementEmployeeListView.js +70 -69
- package/dist/components/Employee/EmployeeList/management/ManagementEmployeeListView.js.map +1 -1
- package/dist/components/Employee/EmployeeList/onboarding/EmployeeListView.js +2 -2
- package/dist/components/Employee/EmployeeList/onboarding/EmployeeListView.js.map +1 -1
- package/dist/components/Employee/EmployeeList/shared/useEmployeeList.js +51 -42
- package/dist/components/Employee/EmployeeList/shared/useEmployeeList.js.map +1 -1
- package/dist/components/Employee/EmployeeListFlow/employeeListStateMachine.js +29 -26
- package/dist/components/Employee/EmployeeListFlow/employeeListStateMachine.js.map +1 -1
- package/dist/components/Employee/HomeAddress/management/HomeAddressView.js +2 -2
- package/dist/components/Employee/HomeAddress/management/HomeAddressView.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.js +11 -11
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummaryPresentation.js +3 -3
- package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummaryPresentation.js.map +1 -1
- package/dist/components/Employee/WorkAddress/management/WorkAddressView.js +76 -79
- package/dist/components/Employee/WorkAddress/management/WorkAddressView.js.map +1 -1
- package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js +2 -2
- package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.js +2 -2
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.js.map +1 -1
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelectionPresentation.js +10 -10
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelectionPresentation.js.map +1 -1
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +49 -45
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js +83 -76
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js +63 -60
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +184 -165
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/useCalculationPoll.js +48 -34
- package/dist/components/Payroll/PayrollConfiguration/useCalculationPoll.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +185 -171
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/useSubmissionPoll.js +45 -34
- package/dist/components/Payroll/PayrollOverview/useSubmissionPoll.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +44 -44
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.module.scss.js +14 -14
- package/dist/components/Payroll/PrintChecks/PrintChecksFailure/PrintChecksFailure.js +16 -16
- package/dist/components/Payroll/PrintChecks/PrintChecksFailure/PrintChecksFailure.js.map +1 -1
- package/dist/components/Payroll/PrintChecks/PrintChecksForm/useGenerationPoll.js +52 -37
- package/dist/components/Payroll/PrintChecks/PrintChecksForm/useGenerationPoll.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +9 -8
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/contexts/ApiProvider/ApiProvider.js +29 -28
- package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -1
- package/dist/contexts/ApiProvider/apiVersionMismatchHook.js +15 -0
- package/dist/contexts/ApiProvider/apiVersionMismatchHook.js.map +1 -0
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/contexts/ThemeProvider/ThemeProvider.js +32 -26
- package/dist/contexts/ThemeProvider/ThemeProvider.js.map +1 -1
- package/dist/hooks/usePollingTask/usePollingTask.js +53 -41
- package/dist/hooks/usePollingTask/usePollingTask.js.map +1 -1
- package/dist/i18n/en/Employee.ManagementEmployeeList.json.js +28 -24
- package/dist/i18n/en/Employee.ManagementEmployeeList.json.js.map +1 -1
- package/dist/i18n/en/Payroll.GrossUpModal.json.js +12 -10
- package/dist/i18n/en/Payroll.GrossUpModal.json.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollConfiguration.json.js +8 -8
- package/dist/i18n/en/Payroll.PayrollOverview.json.js +15 -15
- package/dist/package.json.js +1 -1
- package/dist/src/components/Common/UI/ComboBox/ComboBoxTypes.d.ts +1 -1
- package/dist/src/components/Common/UI/DatePicker/DatePickerTypes.d.ts +2 -1
- package/dist/src/components/Common/UI/Menu/MenuTypes.d.ts +1 -1
- package/dist/src/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.d.ts +1 -1
- package/dist/src/components/Common/UI/MultiSelectComboBox/MultiSelectComboBoxTypes.d.ts +5 -0
- package/dist/src/components/Common/UI/Select/SelectTypes.d.ts +2 -1
- package/dist/src/components/Employee/EmployeeList/shared/useEmployeeList.d.ts +7 -2
- package/dist/src/components/Employee/EmployeeListFlow/employeeListStateMachine.test.d.ts +1 -0
- package/dist/src/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.d.ts +1 -1
- package/dist/src/components/Payroll/OffCycleCreation/OffCycleCreationTypes.d.ts +6 -0
- package/dist/src/components/Payroll/PayrollConfiguration/useCalculationPoll.d.ts +6 -1
- package/dist/src/components/Payroll/PayrollOverview/useSubmissionPoll.d.ts +10 -1
- package/dist/src/contexts/ApiProvider/ApiProvider.d.ts +5 -3
- package/dist/src/contexts/ApiProvider/apiVersionMismatchHook.d.ts +3 -0
- package/dist/src/contexts/ApiProvider/apiVersionMismatchHook.test.d.ts +1 -0
- package/dist/src/contexts/GustoProvider/GustoProviderCustomUIAdapter.d.ts +9 -1
- package/dist/src/contexts/ThemeProvider/ThemeProvider.d.ts +8 -3
- package/dist/src/hooks/usePollingTask/usePollingTask.d.ts +55 -14
- package/dist/src/i18n/types.d.ts +14 -0
- package/dist/style.css +1 -1
- package/docs/guides/endpoint-inventory.json +5 -0
- package/package.json +6 -6
|
@@ -1,276 +1,290 @@
|
|
|
1
|
-
import { jsx as l, jsxs as
|
|
2
|
-
import { usePayrollsSubmitMutation as
|
|
3
|
-
import { usePayrollsCancelMutation as
|
|
4
|
-
import { usePayrollsGet as
|
|
5
|
-
import { useEmployeesList as
|
|
6
|
-
import { keepPreviousData as
|
|
7
|
-
import { useTranslation as
|
|
8
|
-
import { useBankAccountsGetSuspense as
|
|
9
|
-
import { useWireInRequestsGet as
|
|
10
|
-
import { useState as m, useMemo as
|
|
11
|
-
import { useGustoEmbeddedContext as
|
|
12
|
-
import { payrollsGetPayStub as
|
|
13
|
-
import { useErrorBoundary as
|
|
14
|
-
import { ConfirmWireDetails as
|
|
15
|
-
import { canCancelPayroll as
|
|
16
|
-
import { PrintChecks as
|
|
17
|
-
import { PayrollOverviewPresentation as
|
|
1
|
+
import { jsx as l, jsxs as _e } from "react/jsx-runtime";
|
|
2
|
+
import { usePayrollsSubmitMutation as Oe } from "@gusto/embedded-api/react-query/payrollsSubmit";
|
|
3
|
+
import { usePayrollsCancelMutation as Ce } from "@gusto/embedded-api/react-query/payrollsCancel";
|
|
4
|
+
import { usePayrollsGet as ke } from "@gusto/embedded-api/react-query/payrollsGet";
|
|
5
|
+
import { useEmployeesList as Ae } from "@gusto/embedded-api/react-query/employeesList";
|
|
6
|
+
import { keepPreviousData as Ue } from "@tanstack/react-query";
|
|
7
|
+
import { useTranslation as Be } from "react-i18next";
|
|
8
|
+
import { useBankAccountsGetSuspense as Te } from "@gusto/embedded-api/react-query/bankAccountsGet";
|
|
9
|
+
import { useWireInRequestsGet as ve } from "@gusto/embedded-api/react-query/wireInRequestsGet";
|
|
10
|
+
import { useState as m, useMemo as Ne, useEffect as E } from "react";
|
|
11
|
+
import { useGustoEmbeddedContext as qe } from "@gusto/embedded-api/react-query/_context";
|
|
12
|
+
import { payrollsGetPayStub as We } from "@gusto/embedded-api/funcs/payrollsGetPayStub";
|
|
13
|
+
import { useErrorBoundary as Fe } from "react-error-boundary";
|
|
14
|
+
import { ConfirmWireDetails as Ye } from "../ConfirmWireDetails/ConfirmWireDetails.js";
|
|
15
|
+
import { canCancelPayroll as Me } from "../helpers.js";
|
|
16
|
+
import { PrintChecks as Ie } from "../PrintChecks/PrintChecks.js";
|
|
17
|
+
import { PayrollOverviewPresentation as xe } from "./PayrollOverviewPresentation.js";
|
|
18
18
|
import { PayrollOverviewStatus as d } from "./PayrollOverviewTypes.js";
|
|
19
|
-
import { useSubmissionPoll as
|
|
20
|
-
import { useCompanyPaymentSpeed as
|
|
21
|
-
import { PAYROLL_PROCESSING_STATUS as
|
|
22
|
-
import { BaseComponent as
|
|
23
|
-
import { useBase as
|
|
24
|
-
import { useComponentDictionary as
|
|
25
|
-
import { readableStreamToBlob as
|
|
26
|
-
import { openPdfInNewTab as
|
|
27
|
-
import
|
|
28
|
-
import { useDateFormatter as
|
|
29
|
-
import { useComponentContext as
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
|
|
19
|
+
import { useSubmissionPoll as Ge } from "./useSubmissionPoll.js";
|
|
20
|
+
import { useCompanyPaymentSpeed as Ve } from "../../../hooks/useCompanyPaymentSpeed.js";
|
|
21
|
+
import { PAYROLL_PROCESSING_STATUS as M, componentEvents as c, PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES as je, payrollWireEvents as He } from "../../../shared/constants.js";
|
|
22
|
+
import { BaseComponent as Ke } from "../../Base/Base.js";
|
|
23
|
+
import { useBase as ze } from "../../Base/useBase.js";
|
|
24
|
+
import { useComponentDictionary as Je, useI18n as Qe } from "../../../i18n/I18n.js";
|
|
25
|
+
import { readableStreamToBlob as Xe } from "../../../helpers/readableStreamToBlob.js";
|
|
26
|
+
import { openPdfInNewTab as Ze } from "../../../helpers/openPdfInNewTab.js";
|
|
27
|
+
import $e from "../../../hooks/useNumberFormatter.js";
|
|
28
|
+
import { useDateFormatter as et } from "../../../hooks/useDateFormatter.js";
|
|
29
|
+
import { useComponentContext as tt } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
30
|
+
import { isNonRetryablePollError as ot } from "../../../hooks/usePollingTask/usePollingTask.js";
|
|
31
|
+
import { renderErrorList as rt } from "../../../helpers/apiErrorToList.js";
|
|
32
|
+
import { Flex as st } from "../../Common/Flex/Flex.js";
|
|
33
|
+
import { usePagination as nt } from "../../../hooks/usePagination/usePagination.js";
|
|
34
|
+
import { useNonce as it } from "../../../contexts/NonceProvider/useNonce.js";
|
|
35
|
+
import { PayrollLoading as at } from "../../Common/PayrollLoading/PayrollLoading.js";
|
|
36
|
+
const lt = (s = []) => s.filter(
|
|
36
37
|
(n) => n.status === "unresolved" && n.unblockOptions && n.unblockOptions.length > 0
|
|
37
|
-
),
|
|
38
|
-
const n =
|
|
38
|
+
), ct = (s = []) => {
|
|
39
|
+
const n = s.find((a) => a.status === "unresolved");
|
|
39
40
|
return n?.unblockOptions ? n.unblockOptions.find(
|
|
40
|
-
(
|
|
41
|
+
(a) => a.unblockType === "submit_wire"
|
|
41
42
|
)?.metadata.wireInRequestUuid : void 0;
|
|
42
43
|
};
|
|
43
|
-
function
|
|
44
|
-
return /* @__PURE__ */ l(
|
|
44
|
+
function Kt(s) {
|
|
45
|
+
return /* @__PURE__ */ l(Ke, { ...s, children: /* @__PURE__ */ l(ut, { ...s, children: s.children }) });
|
|
45
46
|
}
|
|
46
|
-
const
|
|
47
|
-
companyId:
|
|
47
|
+
const ut = ({
|
|
48
|
+
companyId: s,
|
|
48
49
|
payrollId: n,
|
|
49
|
-
dictionary:
|
|
50
|
-
onEvent:
|
|
51
|
-
alerts:
|
|
52
|
-
withReimbursements:
|
|
53
|
-
ConfirmWireDetailsComponent:
|
|
50
|
+
dictionary: L,
|
|
51
|
+
onEvent: a,
|
|
52
|
+
alerts: I,
|
|
53
|
+
withReimbursements: x = !0,
|
|
54
|
+
ConfirmWireDetailsComponent: G = Ye,
|
|
54
55
|
readOnly: b = !1,
|
|
55
|
-
className:
|
|
56
|
+
className: V
|
|
56
57
|
}) => {
|
|
57
|
-
|
|
58
|
-
const { baseSubmitHandler:
|
|
58
|
+
Je("Payroll.PayrollOverview", L), Qe("Payroll.PayrollOverview");
|
|
59
|
+
const { baseSubmitHandler: _ } = ze(), { t: i } = Be("Payroll.PayrollOverview"), [O, S] = m(!1), [j, h] = m(I || []), [C, H] = m({}), [P, p] = m(!1), { showBoundary: K } = Fe(), z = $e("currency"), f = et(), { Button: J, UnorderedList: Q, Text: k } = tt(), [A, g] = m(d.Viewing), { currentPage: U, itemsPerPage: B, getPaginationProps: X } = nt({
|
|
59
60
|
defaultItemsPerPage: 25
|
|
60
|
-
}),
|
|
61
|
+
}), Z = qe(), $ = Ne(
|
|
61
62
|
() => ({
|
|
62
|
-
companyId:
|
|
63
|
+
companyId: s,
|
|
63
64
|
payrollId: n,
|
|
64
65
|
include: ["taxes", "benefits", "deductions", "totals", "payroll_taxes"],
|
|
65
66
|
page: U,
|
|
66
67
|
per: B,
|
|
67
68
|
sortBy: "last_name"
|
|
68
69
|
}),
|
|
69
|
-
[
|
|
70
|
+
[s, n, U, B]
|
|
70
71
|
), {
|
|
71
72
|
data: y,
|
|
72
|
-
isFetching:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
73
|
+
isFetching: ee,
|
|
74
|
+
isError: T,
|
|
75
|
+
error: te,
|
|
76
|
+
refetch: oe
|
|
77
|
+
} = ke($, {
|
|
78
|
+
placeholderData: Ue
|
|
79
|
+
}), o = y?.payrollShow, re = lt(o?.submissionBlockers), w = ct(o?.creditBlockers), { data: se } = ve(
|
|
77
80
|
{
|
|
78
|
-
wireInRequestUuid:
|
|
81
|
+
wireInRequestUuid: w || ""
|
|
79
82
|
},
|
|
80
|
-
{ enabled: !!
|
|
81
|
-
),
|
|
82
|
-
{ companyId:
|
|
83
|
-
{ enabled:
|
|
84
|
-
),
|
|
85
|
-
|
|
86
|
-
},
|
|
87
|
-
|
|
83
|
+
{ enabled: !!w }
|
|
84
|
+
), v = se?.wireInRequest, N = (o?.employeeCompensations ?? []).map((e) => e.employeeUuid).filter((e) => !!e), { data: ne } = Ae(
|
|
85
|
+
{ companyId: s, uuids: N },
|
|
86
|
+
{ enabled: N.length > 0 }
|
|
87
|
+
), ie = (ne?.showEmployees ?? []).reduce((e, t) => (e[t.uuid] = t.flsaStatus, e), {}), q = () => {
|
|
88
|
+
a(c.RUN_PAYROLL_EDIT);
|
|
89
|
+
}, ae = w && /* @__PURE__ */ l(
|
|
90
|
+
G,
|
|
88
91
|
{
|
|
89
|
-
companyId:
|
|
90
|
-
wireInId:
|
|
92
|
+
companyId: s,
|
|
93
|
+
wireInId: w,
|
|
91
94
|
onEvent: (e, t) => {
|
|
92
|
-
e ===
|
|
95
|
+
e === He.PAYROLL_WIRE_FORM_DONE && p(!0), a(e, t);
|
|
93
96
|
}
|
|
94
97
|
}
|
|
95
|
-
),
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
}, [
|
|
99
|
-
const R =
|
|
100
|
-
|
|
98
|
+
), le = /* @__PURE__ */ l(Ie, { companyId: s, payrollId: n, onEvent: a });
|
|
99
|
+
E(() => {
|
|
100
|
+
v?.status === "pending_review" && !P && p(!0);
|
|
101
|
+
}, [v?.status, P]);
|
|
102
|
+
const R = o?.checkDate;
|
|
103
|
+
E(() => {
|
|
101
104
|
if (R && P) {
|
|
102
105
|
const e = f.formatShortWithYear(R);
|
|
103
106
|
h([
|
|
104
107
|
{
|
|
105
108
|
type: "success",
|
|
106
|
-
title:
|
|
107
|
-
content: /* @__PURE__ */ l(k, { children:
|
|
109
|
+
title: i("alerts.wireDetailsSubmittedTitle"),
|
|
110
|
+
content: /* @__PURE__ */ l(k, { children: i("alerts.wireDetailsSubmittedMessage", { checkDate: e }) }),
|
|
108
111
|
onDismiss: () => {
|
|
109
112
|
p(!1);
|
|
110
113
|
}
|
|
111
114
|
}
|
|
112
115
|
]);
|
|
113
116
|
}
|
|
114
|
-
}, [P, R,
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
+
}, [P, R, i, f, k]);
|
|
118
|
+
const ce = (e) => {
|
|
119
|
+
a(c.RUN_PAYROLL_PROCESSED, {
|
|
117
120
|
payPeriod: e?.payPeriod,
|
|
118
121
|
payrollUuid: n
|
|
119
122
|
}), h([
|
|
120
123
|
{
|
|
121
124
|
type: "success",
|
|
122
|
-
title:
|
|
123
|
-
content:
|
|
124
|
-
amount:
|
|
125
|
+
title: i("alerts.payrollProcessedTitle"),
|
|
126
|
+
content: i("alerts.payrollProcessedMessage", {
|
|
127
|
+
amount: z(Number(e?.totals?.companyDebit)),
|
|
125
128
|
date: f.formatShortWithYear(
|
|
126
129
|
e?.payrollStatusMeta?.expectedDebitTime ?? e?.payrollDeadline
|
|
127
130
|
)
|
|
128
131
|
})
|
|
129
132
|
}
|
|
130
|
-
]), p(!1),
|
|
131
|
-
},
|
|
132
|
-
|
|
133
|
+
]), p(!1), S(!1);
|
|
134
|
+
}, W = (e) => {
|
|
135
|
+
a(c.RUN_PAYROLL_PROCESSING_FAILED), h([
|
|
133
136
|
{
|
|
134
137
|
type: "error",
|
|
135
|
-
title:
|
|
136
|
-
content: /* @__PURE__ */
|
|
137
|
-
/* @__PURE__ */ l(
|
|
138
|
-
!b && /* @__PURE__ */ l(
|
|
138
|
+
title: i("alerts.payrollProcessingFailedTitle"),
|
|
139
|
+
content: /* @__PURE__ */ _e(st, { flexDirection: "column", gap: 16, children: [
|
|
140
|
+
/* @__PURE__ */ l(Q, { items: rt(e?.processingRequest?.errors ?? []) }),
|
|
141
|
+
!b && /* @__PURE__ */ l(J, { variant: "secondary", onClick: q, children: i("alerts.payrollProcessingFailedCtaLabel") })
|
|
139
142
|
] })
|
|
140
143
|
}
|
|
141
|
-
]), p(!1),
|
|
142
|
-
}, { start: D, isPolling:
|
|
143
|
-
refetch:
|
|
144
|
-
onProcessed:
|
|
145
|
-
onProcessingFailed:
|
|
144
|
+
]), p(!1), S(!1);
|
|
145
|
+
}, { start: D, isPolling: ue } = Ge({
|
|
146
|
+
refetch: oe,
|
|
147
|
+
onProcessed: ce,
|
|
148
|
+
onProcessingFailed: W,
|
|
149
|
+
// Unlike the calculation poll, a second Submit click here is safe even if this fires on a
|
|
150
|
+
// payroll that actually did process successfully — payrollsSubmit only operates on an
|
|
151
|
+
// unprocessed payroll, so the API itself rejects a resubmit rather than double-running it.
|
|
152
|
+
onError: () => {
|
|
153
|
+
W(void 0);
|
|
154
|
+
}
|
|
146
155
|
});
|
|
147
|
-
|
|
156
|
+
E(() => {
|
|
148
157
|
D({ baseline: null, sawSubmitting: !1 });
|
|
149
158
|
}, [D]);
|
|
150
|
-
const { data:
|
|
151
|
-
companyId:
|
|
152
|
-
}),
|
|
159
|
+
const { data: me } = Te({
|
|
160
|
+
companyId: s
|
|
161
|
+
}), de = me.companyBankAccounts?.[0], { paymentSpeed: pe } = Ve(s), { mutateAsync: fe, isPending: Pe } = Oe(), { mutateAsync: ye } = Ce(), we = it(), [be, F] = m(
|
|
153
162
|
() => /* @__PURE__ */ new Set()
|
|
154
163
|
);
|
|
155
|
-
if (!
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
164
|
+
if (!o) {
|
|
165
|
+
if (T)
|
|
166
|
+
throw new Error(i("alerts.payrollLoadFailed"));
|
|
167
|
+
return /* @__PURE__ */ l(at, { title: i("dataLoadingTitle") });
|
|
168
|
+
}
|
|
169
|
+
if (T && ot(te))
|
|
170
|
+
throw new Error(i("alerts.payrollLoadFailed"));
|
|
171
|
+
if (A === d.Viewing && !o.calculatedAt)
|
|
172
|
+
throw new Error(i("alerts.payrollNotCalculated"));
|
|
173
|
+
const Se = X(y.httpMeta.response.headers, ee), he = o.payrollTaxes?.reduce(
|
|
160
174
|
(e, t) => {
|
|
161
175
|
if (!t.name) return e;
|
|
162
|
-
const
|
|
176
|
+
const r = t.amount ?? 0;
|
|
163
177
|
return e[t.name] = {
|
|
164
|
-
employee: (e[t.name]?.employee ?? 0) + (t.employer ? 0 :
|
|
165
|
-
employer: (e[t.name]?.employer ?? 0) + (t.employer ?
|
|
178
|
+
employee: (e[t.name]?.employee ?? 0) + (t.employer ? 0 : r),
|
|
179
|
+
employer: (e[t.name]?.employer ?? 0) + (t.employer ? r : 0)
|
|
166
180
|
}, e;
|
|
167
181
|
},
|
|
168
182
|
{}
|
|
169
|
-
) || {},
|
|
170
|
-
g(d.Cancelling), await
|
|
183
|
+
) || {}, ge = async () => {
|
|
184
|
+
g(d.Cancelling), await _(y, async () => {
|
|
171
185
|
try {
|
|
172
|
-
const e = await
|
|
186
|
+
const e = await ye({
|
|
173
187
|
request: {
|
|
174
|
-
companyId:
|
|
188
|
+
companyId: s,
|
|
175
189
|
payrollId: n
|
|
176
190
|
}
|
|
177
191
|
});
|
|
178
|
-
g(d.Cancelled),
|
|
192
|
+
g(d.Cancelled), a(c.RUN_PAYROLL_CANCELLED, e);
|
|
179
193
|
} catch (e) {
|
|
180
194
|
throw g(d.Viewing), e;
|
|
181
195
|
}
|
|
182
196
|
});
|
|
183
|
-
},
|
|
184
|
-
|
|
185
|
-
},
|
|
186
|
-
const t =
|
|
187
|
-
|
|
188
|
-
const u = new Set(
|
|
197
|
+
}, Re = () => {
|
|
198
|
+
a(c.RUN_PAYROLL_RECEIPT_GET, { payrollId: n });
|
|
199
|
+
}, De = async (e) => {
|
|
200
|
+
const t = Ze({ loadingMessage: i("downloadLoadingMessage"), nonce: we });
|
|
201
|
+
F((r) => {
|
|
202
|
+
const u = new Set(r);
|
|
189
203
|
return u.add(e), u;
|
|
190
204
|
});
|
|
191
205
|
try {
|
|
192
|
-
const
|
|
193
|
-
if (!
|
|
194
|
-
throw t.close(), new Error(
|
|
195
|
-
const u = await
|
|
196
|
-
t.navigate(u),
|
|
197
|
-
} catch (
|
|
198
|
-
t.close(),
|
|
206
|
+
const r = await We(Z, { payrollId: n, employeeId: e });
|
|
207
|
+
if (!r.value?.responseStream)
|
|
208
|
+
throw t.close(), new Error(i("alerts.paystubPdfError"));
|
|
209
|
+
const u = await Xe(r.value.responseStream, "application/pdf");
|
|
210
|
+
t.navigate(u), a(c.RUN_PAYROLL_PDF_PAYSTUB_VIEWED, { employeeId: e });
|
|
211
|
+
} catch (r) {
|
|
212
|
+
t.close(), K(r instanceof Error ? r : new Error(String(r)));
|
|
199
213
|
} finally {
|
|
200
|
-
|
|
201
|
-
if (!
|
|
202
|
-
const u = new Set(
|
|
214
|
+
F((r) => {
|
|
215
|
+
if (!r.has(e)) return r;
|
|
216
|
+
const u = new Set(r);
|
|
203
217
|
return u.delete(e), u;
|
|
204
218
|
});
|
|
205
219
|
}
|
|
206
|
-
},
|
|
207
|
-
await
|
|
208
|
-
const e = await
|
|
220
|
+
}, Ee = async () => {
|
|
221
|
+
await _(y, async () => {
|
|
222
|
+
const e = await fe({
|
|
209
223
|
request: {
|
|
210
|
-
companyId:
|
|
224
|
+
companyId: s,
|
|
211
225
|
payrollId: n,
|
|
212
226
|
requestBody: {
|
|
213
|
-
submissionBlockers: Object.entries(
|
|
214
|
-
([t]) =>
|
|
215
|
-
).map(([t,
|
|
227
|
+
submissionBlockers: Object.entries(C).filter(
|
|
228
|
+
([t]) => je.includes(t)
|
|
229
|
+
).map(([t, r]) => ({
|
|
216
230
|
blockerType: t,
|
|
217
|
-
selectedOption:
|
|
231
|
+
selectedOption: r
|
|
218
232
|
}))
|
|
219
233
|
}
|
|
220
234
|
}
|
|
221
235
|
});
|
|
222
|
-
|
|
236
|
+
a(c.RUN_PAYROLL_SUBMITTING), a(c.RUN_PAYROLL_SUBMITTED, e), D({
|
|
223
237
|
baseline: {
|
|
224
|
-
processed:
|
|
225
|
-
status:
|
|
238
|
+
processed: o.processed ?? !1,
|
|
239
|
+
status: o.processingRequest?.status
|
|
226
240
|
},
|
|
227
241
|
sawSubmitting: !1
|
|
228
|
-
}),
|
|
242
|
+
}), S(!0);
|
|
229
243
|
});
|
|
230
|
-
},
|
|
231
|
-
if (!(
|
|
244
|
+
}, Y = (() => {
|
|
245
|
+
if (!(O || ue) && !(o.processed || o.processingRequest?.status === M.submit_success) && o.checkDate && o.payrollDeadline)
|
|
232
246
|
return {
|
|
233
247
|
type: "info",
|
|
234
|
-
title:
|
|
235
|
-
payDate: f.formatShortWithWeekday(
|
|
236
|
-
...f.formatWithTime(
|
|
248
|
+
title: i("alerts.directDepositDeadline", {
|
|
249
|
+
payDate: f.formatShortWithWeekday(o.checkDate),
|
|
250
|
+
...f.formatWithTime(o.payrollDeadline)
|
|
237
251
|
}),
|
|
238
|
-
content:
|
|
252
|
+
content: i("alerts.directDepositDeadlineText")
|
|
239
253
|
};
|
|
240
|
-
})(),
|
|
254
|
+
})(), Le = [...j, ...Y ? [Y] : []];
|
|
241
255
|
return /* @__PURE__ */ l(
|
|
242
|
-
|
|
256
|
+
xe,
|
|
243
257
|
{
|
|
244
|
-
className:
|
|
245
|
-
onEdit:
|
|
246
|
-
onSubmit:
|
|
247
|
-
onCancel:
|
|
248
|
-
onPayrollReceipt:
|
|
249
|
-
onPaystubDownload:
|
|
250
|
-
status:
|
|
251
|
-
isProcessed:
|
|
252
|
-
canCancel:
|
|
258
|
+
className: V,
|
|
259
|
+
onEdit: q,
|
|
260
|
+
onSubmit: Ee,
|
|
261
|
+
onCancel: ge,
|
|
262
|
+
onPayrollReceipt: Re,
|
|
263
|
+
onPaystubDownload: De,
|
|
264
|
+
status: Pe || O ? d.Submitting : A,
|
|
265
|
+
isProcessed: o.processed === !0 || o.processingRequest?.status === M.submit_success,
|
|
266
|
+
canCancel: Me(o) && !b,
|
|
253
267
|
canEdit: !b,
|
|
254
|
-
payrollData:
|
|
255
|
-
employeeFlsaStatusByUuid:
|
|
256
|
-
bankAccount:
|
|
257
|
-
taxes:
|
|
258
|
-
alerts:
|
|
259
|
-
submissionBlockers:
|
|
260
|
-
selectedUnblockOptions:
|
|
268
|
+
payrollData: o,
|
|
269
|
+
employeeFlsaStatusByUuid: ie,
|
|
270
|
+
bankAccount: de,
|
|
271
|
+
taxes: he,
|
|
272
|
+
alerts: Le,
|
|
273
|
+
submissionBlockers: re,
|
|
274
|
+
selectedUnblockOptions: C,
|
|
261
275
|
onUnblockOptionChange: (e, t) => {
|
|
262
|
-
|
|
276
|
+
H((r) => ({ ...r, [e]: t }));
|
|
263
277
|
},
|
|
264
|
-
wireInConfirmationRequest:
|
|
265
|
-
printChecksBanner:
|
|
266
|
-
withReimbursements:
|
|
267
|
-
paymentSpeed:
|
|
278
|
+
wireInConfirmationRequest: ae,
|
|
279
|
+
printChecksBanner: le,
|
|
280
|
+
withReimbursements: x,
|
|
281
|
+
paymentSpeed: pe,
|
|
268
282
|
pagination: Se,
|
|
269
|
-
downloadingEmployeeIds:
|
|
283
|
+
downloadingEmployeeIds: be
|
|
270
284
|
}
|
|
271
285
|
);
|
|
272
286
|
};
|
|
273
287
|
export {
|
|
274
|
-
|
|
288
|
+
Kt as PayrollOverview
|
|
275
289
|
};
|
|
276
290
|
//# sourceMappingURL=PayrollOverview.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayrollOverview.js","sources":["../../../../src/components/Payroll/PayrollOverview/PayrollOverview.tsx"],"sourcesContent":["import { usePayrollsSubmitMutation } from '@gusto/embedded-api/react-query/payrollsSubmit'\nimport { usePayrollsCancelMutation } from '@gusto/embedded-api/react-query/payrollsCancel'\nimport { usePayrollsGet } from '@gusto/embedded-api/react-query/payrollsGet'\nimport { useEmployeesList } from '@gusto/embedded-api/react-query/employeesList'\nimport { keepPreviousData } from '@tanstack/react-query'\nimport { useTranslation } from 'react-i18next'\nimport { useBankAccountsGetSuspense } from '@gusto/embedded-api/react-query/bankAccountsGet'\nimport { useWireInRequestsGet } from '@gusto/embedded-api/react-query/wireInRequestsGet'\nimport { useEffect, useMemo, useState } from 'react'\nimport { useGustoEmbeddedContext } from '@gusto/embedded-api/react-query/_context'\nimport { payrollsGetPayStub } from '@gusto/embedded-api/funcs/payrollsGetPayStub'\nimport { useErrorBoundary } from 'react-error-boundary'\nimport type { GetV1CompaniesCompanyIdPayrollsPayrollIdRequest } from '@gusto/embedded-api/models/operations/getv1companiescompanyidpayrollspayrollid'\nimport type { PayrollSubmissionBlockerType } from '@gusto/embedded-api/models/components/payrollsubmissionblockertype'\nimport type {\n PayrollCreditBlockerType,\n PayrollCreditBlockerTypeUnblockOptions,\n} from '@gusto/embedded-api/models/components/payrollcreditblockertype'\nimport type { PayrollFlowAlert } from '../PayrollFlow/PayrollFlowComponents'\nimport {\n ConfirmWireDetails,\n type ConfirmWireDetailsComponentType,\n} from '../ConfirmWireDetails/ConfirmWireDetails'\nimport { canCancelPayroll } from '../helpers'\nimport { PrintChecks } from '../PrintChecks/PrintChecks'\nimport { PayrollOverviewPresentation } from './PayrollOverviewPresentation'\nimport { PayrollOverviewStatus } from './PayrollOverviewTypes'\nimport { useSubmissionPoll, type PayrollShow } from './useSubmissionPoll'\nimport { useCompanyPaymentSpeed } from '@/hooks/useCompanyPaymentSpeed'\nimport {\n componentEvents,\n payrollWireEvents,\n PAYROLL_PROCESSING_STATUS,\n PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES,\n type EventType,\n} from '@/shared/constants'\nimport { BaseComponent, useBase, type BaseComponentInterface } from '@/components/Base'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { readableStreamToBlob } from '@/helpers/readableStreamToBlob'\nimport { openPdfInNewTab } from '@/helpers/openPdfInNewTab'\nimport { useNonce } from '@/contexts/NonceProvider'\nimport useNumberFormatter from '@/hooks/useNumberFormatter'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { renderErrorList } from '@/helpers/apiErrorToList'\nimport { Flex, PayrollLoading } from '@/components/Common'\nimport { usePagination } from '@/hooks/usePagination/usePagination'\n\n/**\n * Props for {@link PayrollOverview}.\n *\n * @public\n */\nexport interface PayrollOverviewProps extends BaseComponentInterface<'Payroll.PayrollOverview'> {\n /** Identifier of the company that owns the payroll. */\n companyId: string\n /** Identifier of the payroll being reviewed. The payroll must already be calculated. */\n payrollId: string\n /** Alert banners to display above the payroll summary. */\n alerts?: PayrollFlowAlert[]\n /** Whether reimbursement fields are shown in the totals and per-employee tables. Defaults to `true`. */\n withReimbursements?: boolean\n /** Custom component to replace the default wire details confirmation UI. */\n ConfirmWireDetailsComponent?: ConfirmWireDetailsComponentType\n /**\n * Hides the edit and cancel actions, leaving submit and receipt/paystub actions available.\n * Use for a deep link to a specific payroll where editing shouldn't be offered. Defaults to\n * `false`.\n */\n readOnly?: boolean\n}\n\nconst findUnresolvedBlockersWithOptions = (\n blockers: PayrollSubmissionBlockerType[] = [],\n): PayrollSubmissionBlockerType[] => {\n return blockers.filter(\n blocker =>\n blocker.status === 'unresolved' &&\n blocker.unblockOptions &&\n blocker.unblockOptions.length > 0,\n )\n}\n\nconst findWireInRequestUuid = (\n creditBlockers: PayrollCreditBlockerType[] = [],\n): string | undefined => {\n const unresolvedCreditBlocker = creditBlockers.find(blocker => blocker.status === 'unresolved')\n\n if (!unresolvedCreditBlocker?.unblockOptions) {\n return undefined\n }\n\n const wireUnblockOption = unresolvedCreditBlocker.unblockOptions.find(\n (option: PayrollCreditBlockerTypeUnblockOptions) => option.unblockType === 'submit_wire',\n )\n\n return wireUnblockOption?.metadata.wireInRequestUuid\n}\n\n/**\n * Final review screen for a calculated payroll before submission, with submit, cancel,\n * and edit controls. After submission, tracks processing status and surfaces the receipt\n * and per-employee paystub downloads once complete.\n *\n * @remarks\n * The payroll referenced by `payrollId` must already be calculated; rendering with an\n * uncalculated payroll throws. Unresolved submission blockers (e.g. fast-ACH threshold,\n * wire-in funding) are surfaced inline and the submit action stays disabled until each\n * blocker has a selected unblock option. While the payroll is processing, the component\n * polls until success or failure and emits the corresponding event. Pass `readOnly` to hide\n * the edit and cancel actions while keeping submit available.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `runPayroll/edit` | User chose to edit the payroll before submitting | — |\n * | `runPayroll/submitting` | Submit request was sent to the API | — |\n * | `runPayroll/submitted` | Payroll was successfully submitted | Submit payroll response |\n * | `runPayroll/processed` | Payroll finished processing successfully | `{ payPeriod, payrollUuid }` |\n * | `runPayroll/processingFailed` | Payroll processing failed | — |\n * | `runPayroll/cancelled` | Payroll was cancelled | Cancel payroll response |\n * | `runPayroll/receipt/get` | User requested the payroll receipt | `{ payrollId }` |\n * | `runPayroll/pdfPaystub/viewed` | User opened an employee's paystub PDF | `{ employeeId }` |\n * | `payroll/wire/form/done` | Wire-in details were confirmed via the embedded wire form | Submit wire-in response |\n * | `payroll/printChecks/start` | User opened the print-checks modal from the embedded print-checks banner | — |\n * | `payroll/printChecks/generate/start` | User submitted the print-checks form | — |\n * | `payroll/printChecks/generate/succeeded` | Printable checks finished generating | `{ documentUrl }` |\n * | `payroll/printChecks/generate/failed` | The print-checks request was rejected or generation failed | `{ errorMessage }` |\n * | `payroll/printChecks/retry` | User retried after a failed check generation | — |\n * | `payroll/printChecks/cancel` | User cancelled the print-checks form | — |\n * | `payroll/printChecks/close` | User closed the print-checks failure or summary screen | — |\n *\n * @param props - See {@link PayrollOverviewProps}.\n * @returns The payroll overview surface.\n * @public\n */\nexport function PayrollOverview(props: PayrollOverviewProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst Root = ({\n companyId,\n payrollId,\n dictionary,\n onEvent,\n alerts,\n withReimbursements = true,\n ConfirmWireDetailsComponent = ConfirmWireDetails,\n readOnly = false,\n className,\n}: PayrollOverviewProps) => {\n useComponentDictionary('Payroll.PayrollOverview', dictionary)\n useI18n('Payroll.PayrollOverview')\n const { baseSubmitHandler } = useBase()\n const { t } = useTranslation('Payroll.PayrollOverview')\n const [hasSubmittedInSession, setHasSubmittedInSession] = useState(false)\n const [internalAlerts, setInternalAlerts] = useState(alerts || [])\n const [selectedUnblockOptions, setSelectedUnblockOptions] = useState<Record<string, string>>({})\n const [showWireDetailsConfirmation, setShowWireDetailsConfirmation] = useState(false)\n const { showBoundary } = useErrorBoundary()\n const formatCurrency = useNumberFormatter('currency')\n const dateFormatter = useDateFormatter()\n const { Button, UnorderedList, Text } = useComponentContext()\n const [status, setStatus] = useState(PayrollOverviewStatus.Viewing)\n const { currentPage, itemsPerPage, getPaginationProps } = usePagination({\n defaultItemsPerPage: 25,\n })\n const gustoEmbedded = useGustoEmbeddedContext()\n\n const payrollRequest = useMemo<GetV1CompaniesCompanyIdPayrollsPayrollIdRequest>(\n () => ({\n companyId,\n payrollId,\n include: ['taxes', 'benefits', 'deductions', 'totals', 'payroll_taxes'],\n page: currentPage,\n per: itemsPerPage,\n sortBy: 'last_name',\n }),\n [companyId, payrollId, currentPage, itemsPerPage],\n )\n\n const {\n data,\n isFetching,\n refetch: refetchPayroll,\n } = usePayrollsGet(payrollRequest, {\n placeholderData: keepPreviousData,\n })\n const payrollData = data?.payrollShow\n const submissionBlockers = findUnresolvedBlockersWithOptions(payrollData?.submissionBlockers)\n const wireInId = findWireInRequestUuid(payrollData?.creditBlockers)\n\n const { data: wireInRequestData } = useWireInRequestsGet(\n {\n wireInRequestUuid: wireInId || '',\n },\n { enabled: !!wireInId },\n )\n const wireInRequest = wireInRequestData?.wireInRequest\n\n // Scoped to the current page's employees so this stays bounded regardless of company size,\n // since `flsaStatus` (compensation type) isn't available on employeeCompensations for\n // employees without an hourlyCompensations line item (e.g. salaried employees).\n const employeeUuids = (payrollData?.employeeCompensations ?? [])\n .map(employeeCompensation => employeeCompensation.employeeUuid)\n .filter((uuid): uuid is string => !!uuid)\n\n const { data: employeesData } = useEmployeesList(\n { companyId, uuids: employeeUuids },\n { enabled: employeeUuids.length > 0 },\n )\n const employeeFlsaStatusByUuid = (employeesData?.showEmployees ?? []).reduce<\n Record<string, string | undefined>\n >((acc, employee) => {\n acc[employee.uuid] = employee.flsaStatus\n return acc\n }, {})\n\n const onEdit = () => {\n onEvent(componentEvents.RUN_PAYROLL_EDIT)\n }\n\n const handleWireEvent = (type: EventType, data?: unknown) => {\n if (type === payrollWireEvents.PAYROLL_WIRE_FORM_DONE) {\n setShowWireDetailsConfirmation(true)\n }\n onEvent(type, data)\n }\n\n const wireInConfirmationRequest = wireInId && (\n <ConfirmWireDetailsComponent\n companyId={companyId}\n wireInId={wireInId}\n onEvent={handleWireEvent}\n />\n )\n\n const printChecksBanner = (\n <PrintChecks companyId={companyId} payrollId={payrollId} onEvent={onEvent} />\n )\n\n useEffect(() => {\n if (wireInRequest?.status === 'pending_review' && !showWireDetailsConfirmation) {\n setShowWireDetailsConfirmation(true)\n }\n }, [wireInRequest?.status, showWireDetailsConfirmation])\n\n const checkDate = payrollData?.checkDate\n useEffect(() => {\n if (checkDate && showWireDetailsConfirmation) {\n const formattedCheckDate = dateFormatter.formatShortWithYear(checkDate)\n\n setInternalAlerts([\n {\n type: 'success',\n title: t('alerts.wireDetailsSubmittedTitle'),\n content: (\n <Text>\n {t('alerts.wireDetailsSubmittedMessage', { checkDate: formattedCheckDate })}\n </Text>\n ),\n onDismiss: () => {\n setShowWireDetailsConfirmation(false)\n },\n },\n ])\n }\n }, [showWireDetailsConfirmation, checkDate, t, dateFormatter, Text])\n\n const emitProcessed = (payroll: PayrollShow | undefined) => {\n onEvent(componentEvents.RUN_PAYROLL_PROCESSED, {\n payPeriod: payroll?.payPeriod,\n payrollUuid: payrollId,\n })\n setInternalAlerts([\n {\n type: 'success',\n title: t('alerts.payrollProcessedTitle'),\n content: t('alerts.payrollProcessedMessage', {\n amount: formatCurrency(Number(payroll?.totals?.companyDebit)),\n date: dateFormatter.formatShortWithYear(\n payroll?.payrollStatusMeta?.expectedDebitTime ?? payroll?.payrollDeadline,\n ),\n }),\n },\n ])\n setShowWireDetailsConfirmation(false)\n setHasSubmittedInSession(false)\n }\n\n const emitProcessingFailed = (payroll: PayrollShow | undefined) => {\n onEvent(componentEvents.RUN_PAYROLL_PROCESSING_FAILED)\n setInternalAlerts([\n {\n type: 'error',\n title: t('alerts.payrollProcessingFailedTitle'),\n content: (\n <Flex flexDirection=\"column\" gap={16}>\n <UnorderedList items={renderErrorList(payroll?.processingRequest?.errors ?? [])} />\n {!readOnly && (\n <Button variant=\"secondary\" onClick={onEdit}>\n {t('alerts.payrollProcessingFailedCtaLabel')}\n </Button>\n )}\n </Flex>\n ),\n },\n ])\n setShowWireDetailsConfirmation(false)\n setHasSubmittedInSession(false)\n }\n\n const { start: startPayrollPoll, isPolling } = useSubmissionPoll({\n refetch: refetchPayroll,\n onProcessed: emitProcessed,\n onProcessingFailed: emitProcessingFailed,\n })\n\n // Always poll from mount, not just after Submit: the initial read is a non-suspense query, so\n // if its notification never arrives the component is stuck on `!payrollData` forever with no\n // other render source. This also doubles as picking up a submission already in flight\n // (another tab, another admin) — the poll's own evaluate rules keep the loop going for as long\n // as it reads `submitting`, regardless of why the loop started.\n useEffect(() => {\n startPayrollPoll({ baseline: null, sawSubmitting: false })\n }, [startPayrollPoll])\n\n const { data: bankAccountData } = useBankAccountsGetSuspense({\n companyId,\n })\n const bankAccount = bankAccountData.companyBankAccounts?.[0]\n\n const { paymentSpeed } = useCompanyPaymentSpeed(companyId)\n\n const { mutateAsync: submitPayroll, isPending } = usePayrollsSubmitMutation()\n\n const { mutateAsync: cancelPayroll } = usePayrollsCancelMutation()\n\n const nonce = useNonce()\n\n const [downloadingEmployeeIds, setDownloadingEmployeeIds] = useState<ReadonlySet<string>>(\n () => new Set(),\n )\n\n if (!payrollData) {\n return <PayrollLoading title={t('dataLoadingTitle')} />\n }\n\n if (status === PayrollOverviewStatus.Viewing && !payrollData.calculatedAt) {\n throw new Error(t('alerts.payrollNotCalculated'))\n }\n\n const pagination = getPaginationProps(data.httpMeta.response.headers, isFetching)\n\n // Per-tax totals come from the payroll-level `payrollTaxes` aggregate so they stay\n // correct when `employeeCompensations` is paginated (only a single page is loaded).\n const taxes =\n payrollData.payrollTaxes?.reduce(\n (acc, tax) => {\n if (!tax.name) return acc\n const amount = tax.amount ?? 0\n acc[tax.name] = {\n employee: (acc[tax.name]?.employee ?? 0) + (tax.employer ? 0 : amount),\n employer: (acc[tax.name]?.employer ?? 0) + (tax.employer ? amount : 0),\n }\n return acc\n },\n {} as Record<string, { employee: number; employer: number }>,\n ) || {}\n\n const onCancel = async () => {\n setStatus(PayrollOverviewStatus.Cancelling)\n await baseSubmitHandler(data, async () => {\n try {\n const result = await cancelPayroll({\n request: {\n companyId,\n payrollId,\n },\n })\n setStatus(PayrollOverviewStatus.Cancelled)\n onEvent(componentEvents.RUN_PAYROLL_CANCELLED, result)\n } catch (error) {\n setStatus(PayrollOverviewStatus.Viewing)\n throw error\n }\n })\n }\n const onPayrollReceipt = () => {\n onEvent(componentEvents.RUN_PAYROLL_RECEIPT_GET, { payrollId })\n }\n\n const onPaystubDownload = async (employeeId: string) => {\n const tab = openPdfInNewTab({ loadingMessage: t('downloadLoadingMessage'), nonce })\n setDownloadingEmployeeIds(prev => {\n const next = new Set(prev)\n next.add(employeeId)\n return next\n })\n try {\n const response = await payrollsGetPayStub(gustoEmbedded, { payrollId, employeeId })\n if (!response.value?.responseStream) {\n tab.close()\n throw new Error(t('alerts.paystubPdfError'))\n }\n const pdfBlob = await readableStreamToBlob(response.value.responseStream, 'application/pdf')\n tab.navigate(pdfBlob)\n onEvent(componentEvents.RUN_PAYROLL_PDF_PAYSTUB_VIEWED, { employeeId })\n } catch (err) {\n tab.close()\n showBoundary(err instanceof Error ? err : new Error(String(err)))\n } finally {\n setDownloadingEmployeeIds(prev => {\n if (!prev.has(employeeId)) return prev\n const next = new Set(prev)\n next.delete(employeeId)\n return next\n })\n }\n }\n const onSubmit = async () => {\n await baseSubmitHandler(data, async () => {\n const result = await submitPayroll({\n request: {\n companyId,\n payrollId,\n requestBody: {\n submissionBlockers: Object.entries(selectedUnblockOptions)\n .filter(([blockerType]) =>\n PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES.includes(blockerType),\n )\n .map(([blockerType, selectedOption]) => ({\n blockerType,\n selectedOption,\n })),\n },\n },\n })\n onEvent(componentEvents.RUN_PAYROLL_SUBMITTING)\n onEvent(componentEvents.RUN_PAYROLL_SUBMITTED, result)\n startPayrollPoll({\n baseline: {\n processed: payrollData.processed ?? false,\n status: payrollData.processingRequest?.status,\n },\n sawSubmitting: false,\n })\n setHasSubmittedInSession(true)\n })\n }\n\n const deadlineAlert: PayrollFlowAlert | undefined = (() => {\n if (hasSubmittedInSession || isPolling) return undefined\n if (\n payrollData.processed ||\n payrollData.processingRequest?.status === PAYROLL_PROCESSING_STATUS.submit_success\n )\n return undefined\n\n if (payrollData.checkDate && payrollData.payrollDeadline) {\n return {\n type: 'info' as const,\n title: t('alerts.directDepositDeadline', {\n payDate: dateFormatter.formatShortWithWeekday(payrollData.checkDate),\n ...dateFormatter.formatWithTime(payrollData.payrollDeadline),\n }),\n content: t('alerts.directDepositDeadlineText'),\n }\n }\n return undefined\n })()\n\n const combinedAlerts = [...internalAlerts, ...(deadlineAlert ? [deadlineAlert] : [])]\n\n return (\n <PayrollOverviewPresentation\n className={className}\n onEdit={onEdit}\n onSubmit={onSubmit}\n onCancel={onCancel}\n onPayrollReceipt={onPayrollReceipt}\n onPaystubDownload={onPaystubDownload}\n status={isPending || hasSubmittedInSession ? PayrollOverviewStatus.Submitting : status}\n isProcessed={\n payrollData.processed === true ||\n payrollData.processingRequest?.status === PAYROLL_PROCESSING_STATUS.submit_success\n }\n canCancel={canCancelPayroll(payrollData) && !readOnly}\n canEdit={!readOnly}\n payrollData={payrollData}\n employeeFlsaStatusByUuid={employeeFlsaStatusByUuid}\n bankAccount={bankAccount}\n taxes={taxes}\n alerts={combinedAlerts}\n submissionBlockers={submissionBlockers}\n selectedUnblockOptions={selectedUnblockOptions}\n onUnblockOptionChange={(blockerType, value) => {\n setSelectedUnblockOptions(prev => ({ ...prev, [blockerType]: value }))\n }}\n wireInConfirmationRequest={wireInConfirmationRequest}\n printChecksBanner={printChecksBanner}\n withReimbursements={withReimbursements}\n paymentSpeed={paymentSpeed}\n pagination={pagination}\n downloadingEmployeeIds={downloadingEmployeeIds}\n />\n )\n}\n"],"names":["findUnresolvedBlockersWithOptions","blockers","blocker","findWireInRequestUuid","creditBlockers","unresolvedCreditBlocker","option","PayrollOverview","props","jsx","BaseComponent","Root","companyId","payrollId","dictionary","onEvent","alerts","withReimbursements","ConfirmWireDetailsComponent","ConfirmWireDetails","readOnly","className","useComponentDictionary","useI18n","baseSubmitHandler","useBase","t","useTranslation","hasSubmittedInSession","setHasSubmittedInSession","useState","internalAlerts","setInternalAlerts","selectedUnblockOptions","setSelectedUnblockOptions","showWireDetailsConfirmation","setShowWireDetailsConfirmation","showBoundary","useErrorBoundary","formatCurrency","useNumberFormatter","dateFormatter","useDateFormatter","Button","UnorderedList","Text","useComponentContext","status","setStatus","PayrollOverviewStatus","currentPage","itemsPerPage","getPaginationProps","usePagination","gustoEmbedded","useGustoEmbeddedContext","payrollRequest","useMemo","data","isFetching","refetchPayroll","usePayrollsGet","keepPreviousData","payrollData","submissionBlockers","wireInId","wireInRequestData","useWireInRequestsGet","wireInRequest","employeeUuids","employeeCompensation","uuid","employeesData","useEmployeesList","employeeFlsaStatusByUuid","acc","employee","onEdit","componentEvents","wireInConfirmationRequest","type","payrollWireEvents","printChecksBanner","PrintChecks","useEffect","checkDate","formattedCheckDate","emitProcessed","payroll","emitProcessingFailed","jsxs","Flex","renderErrorList","startPayrollPoll","isPolling","useSubmissionPoll","bankAccountData","useBankAccountsGetSuspense","bankAccount","paymentSpeed","useCompanyPaymentSpeed","submitPayroll","isPending","usePayrollsSubmitMutation","cancelPayroll","usePayrollsCancelMutation","nonce","useNonce","downloadingEmployeeIds","setDownloadingEmployeeIds","PayrollLoading","pagination","taxes","tax","amount","onCancel","result","error","onPayrollReceipt","onPaystubDownload","employeeId","tab","openPdfInNewTab","prev","next","response","payrollsGetPayStub","pdfBlob","readableStreamToBlob","err","onSubmit","blockerType","PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES","selectedOption","deadlineAlert","PAYROLL_PROCESSING_STATUS","combinedAlerts","PayrollOverviewPresentation","canCancelPayroll","value"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwEA,MAAMA,KAAoC,CACxCC,IAA2C,OAEpCA,EAAS;AAAA,EACd,CAAAC,MACEA,EAAQ,WAAW,gBACnBA,EAAQ,kBACRA,EAAQ,eAAe,SAAS;AAAA,GAIhCC,KAAwB,CAC5BC,IAA6C,OACtB;AACvB,QAAMC,IAA0BD,EAAe,KAAK,CAAAF,MAAWA,EAAQ,WAAW,YAAY;AAE9F,SAAKG,GAAyB,iBAIJA,EAAwB,eAAe;AAAA,IAC/D,CAACC,MAAmDA,EAAO,gBAAgB;AAAA,EAAA,GAGnD,SAAS,oBAPjC;AAQJ;AAuCO,SAASC,GAAgBC,GAA6B;AAC3D,SACE,gBAAAC,EAACC,IAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,MAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,MAAMG,KAA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
1
|
+
{"version":3,"file":"PayrollOverview.js","sources":["../../../../src/components/Payroll/PayrollOverview/PayrollOverview.tsx"],"sourcesContent":["import { usePayrollsSubmitMutation } from '@gusto/embedded-api/react-query/payrollsSubmit'\nimport { usePayrollsCancelMutation } from '@gusto/embedded-api/react-query/payrollsCancel'\nimport { usePayrollsGet } from '@gusto/embedded-api/react-query/payrollsGet'\nimport { useEmployeesList } from '@gusto/embedded-api/react-query/employeesList'\nimport { keepPreviousData } from '@tanstack/react-query'\nimport { useTranslation } from 'react-i18next'\nimport { useBankAccountsGetSuspense } from '@gusto/embedded-api/react-query/bankAccountsGet'\nimport { useWireInRequestsGet } from '@gusto/embedded-api/react-query/wireInRequestsGet'\nimport { useEffect, useMemo, useState } from 'react'\nimport { useGustoEmbeddedContext } from '@gusto/embedded-api/react-query/_context'\nimport { payrollsGetPayStub } from '@gusto/embedded-api/funcs/payrollsGetPayStub'\nimport { useErrorBoundary } from 'react-error-boundary'\nimport type { GetV1CompaniesCompanyIdPayrollsPayrollIdRequest } from '@gusto/embedded-api/models/operations/getv1companiescompanyidpayrollspayrollid'\nimport type { PayrollSubmissionBlockerType } from '@gusto/embedded-api/models/components/payrollsubmissionblockertype'\nimport type {\n PayrollCreditBlockerType,\n PayrollCreditBlockerTypeUnblockOptions,\n} from '@gusto/embedded-api/models/components/payrollcreditblockertype'\nimport type { PayrollFlowAlert } from '../PayrollFlow/PayrollFlowComponents'\nimport {\n ConfirmWireDetails,\n type ConfirmWireDetailsComponentType,\n} from '../ConfirmWireDetails/ConfirmWireDetails'\nimport { canCancelPayroll } from '../helpers'\nimport { PrintChecks } from '../PrintChecks/PrintChecks'\nimport { PayrollOverviewPresentation } from './PayrollOverviewPresentation'\nimport { PayrollOverviewStatus } from './PayrollOverviewTypes'\nimport { useSubmissionPoll, type PayrollShow } from './useSubmissionPoll'\nimport { useCompanyPaymentSpeed } from '@/hooks/useCompanyPaymentSpeed'\nimport {\n componentEvents,\n payrollWireEvents,\n PAYROLL_PROCESSING_STATUS,\n PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES,\n type EventType,\n} from '@/shared/constants'\nimport { BaseComponent, useBase, type BaseComponentInterface } from '@/components/Base'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { readableStreamToBlob } from '@/helpers/readableStreamToBlob'\nimport { openPdfInNewTab } from '@/helpers/openPdfInNewTab'\nimport { useNonce } from '@/contexts/NonceProvider'\nimport useNumberFormatter from '@/hooks/useNumberFormatter'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { isNonRetryablePollError } from '@/hooks/usePollingTask/usePollingTask'\nimport { renderErrorList } from '@/helpers/apiErrorToList'\nimport { Flex, PayrollLoading } from '@/components/Common'\nimport { usePagination } from '@/hooks/usePagination/usePagination'\n\n/**\n * Props for {@link PayrollOverview}.\n *\n * @public\n */\nexport interface PayrollOverviewProps extends BaseComponentInterface<'Payroll.PayrollOverview'> {\n /** Identifier of the company that owns the payroll. */\n companyId: string\n /** Identifier of the payroll being reviewed. The payroll must already be calculated. */\n payrollId: string\n /** Alert banners to display above the payroll summary. */\n alerts?: PayrollFlowAlert[]\n /** Whether reimbursement fields are shown in the totals and per-employee tables. Defaults to `true`. */\n withReimbursements?: boolean\n /** Custom component to replace the default wire details confirmation UI. */\n ConfirmWireDetailsComponent?: ConfirmWireDetailsComponentType\n /**\n * Hides the edit and cancel actions, leaving submit and receipt/paystub actions available.\n * Use for a deep link to a specific payroll where editing shouldn't be offered. Defaults to\n * `false`.\n */\n readOnly?: boolean\n}\n\nconst findUnresolvedBlockersWithOptions = (\n blockers: PayrollSubmissionBlockerType[] = [],\n): PayrollSubmissionBlockerType[] => {\n return blockers.filter(\n blocker =>\n blocker.status === 'unresolved' &&\n blocker.unblockOptions &&\n blocker.unblockOptions.length > 0,\n )\n}\n\nconst findWireInRequestUuid = (\n creditBlockers: PayrollCreditBlockerType[] = [],\n): string | undefined => {\n const unresolvedCreditBlocker = creditBlockers.find(blocker => blocker.status === 'unresolved')\n\n if (!unresolvedCreditBlocker?.unblockOptions) {\n return undefined\n }\n\n const wireUnblockOption = unresolvedCreditBlocker.unblockOptions.find(\n (option: PayrollCreditBlockerTypeUnblockOptions) => option.unblockType === 'submit_wire',\n )\n\n return wireUnblockOption?.metadata.wireInRequestUuid\n}\n\n/**\n * Final review screen for a calculated payroll before submission, with submit, cancel,\n * and edit controls. After submission, tracks processing status and surfaces the receipt\n * and per-employee paystub downloads once complete.\n *\n * @remarks\n * The payroll referenced by `payrollId` must already be calculated; rendering with an\n * uncalculated payroll throws. Unresolved submission blockers (e.g. fast-ACH threshold,\n * wire-in funding) are surfaced inline and the submit action stays disabled until each\n * blocker has a selected unblock option. While the payroll is processing, the component\n * polls until success or failure and emits the corresponding event. Pass `readOnly` to hide\n * the edit and cancel actions while keeping submit available.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `runPayroll/edit` | User chose to edit the payroll before submitting | — |\n * | `runPayroll/submitting` | Submit request was sent to the API | — |\n * | `runPayroll/submitted` | Payroll was successfully submitted | Submit payroll response |\n * | `runPayroll/processed` | Payroll finished processing successfully | `{ payPeriod, payrollUuid }` |\n * | `runPayroll/processingFailed` | Payroll processing failed | — |\n * | `runPayroll/cancelled` | Payroll was cancelled | Cancel payroll response |\n * | `runPayroll/receipt/get` | User requested the payroll receipt | `{ payrollId }` |\n * | `runPayroll/pdfPaystub/viewed` | User opened an employee's paystub PDF | `{ employeeId }` |\n * | `payroll/wire/form/done` | Wire-in details were confirmed via the embedded wire form | Submit wire-in response |\n * | `payroll/printChecks/start` | User opened the print-checks modal from the embedded print-checks banner | — |\n * | `payroll/printChecks/generate/start` | User submitted the print-checks form | — |\n * | `payroll/printChecks/generate/succeeded` | Printable checks finished generating | `{ documentUrl }` |\n * | `payroll/printChecks/generate/failed` | The print-checks request was rejected or generation failed | `{ errorMessage }` |\n * | `payroll/printChecks/retry` | User retried after a failed check generation | — |\n * | `payroll/printChecks/cancel` | User cancelled the print-checks form | — |\n * | `payroll/printChecks/close` | User closed the print-checks failure or summary screen | — |\n *\n * @param props - See {@link PayrollOverviewProps}.\n * @returns The payroll overview surface.\n * @public\n */\nexport function PayrollOverview(props: PayrollOverviewProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst Root = ({\n companyId,\n payrollId,\n dictionary,\n onEvent,\n alerts,\n withReimbursements = true,\n ConfirmWireDetailsComponent = ConfirmWireDetails,\n readOnly = false,\n className,\n}: PayrollOverviewProps) => {\n useComponentDictionary('Payroll.PayrollOverview', dictionary)\n useI18n('Payroll.PayrollOverview')\n const { baseSubmitHandler } = useBase()\n const { t } = useTranslation('Payroll.PayrollOverview')\n const [hasSubmittedInSession, setHasSubmittedInSession] = useState(false)\n const [internalAlerts, setInternalAlerts] = useState(alerts || [])\n const [selectedUnblockOptions, setSelectedUnblockOptions] = useState<Record<string, string>>({})\n const [showWireDetailsConfirmation, setShowWireDetailsConfirmation] = useState(false)\n const { showBoundary } = useErrorBoundary()\n const formatCurrency = useNumberFormatter('currency')\n const dateFormatter = useDateFormatter()\n const { Button, UnorderedList, Text } = useComponentContext()\n const [status, setStatus] = useState(PayrollOverviewStatus.Viewing)\n const { currentPage, itemsPerPage, getPaginationProps } = usePagination({\n defaultItemsPerPage: 25,\n })\n const gustoEmbedded = useGustoEmbeddedContext()\n\n const payrollRequest = useMemo<GetV1CompaniesCompanyIdPayrollsPayrollIdRequest>(\n () => ({\n companyId,\n payrollId,\n include: ['taxes', 'benefits', 'deductions', 'totals', 'payroll_taxes'],\n page: currentPage,\n per: itemsPerPage,\n sortBy: 'last_name',\n }),\n [companyId, payrollId, currentPage, itemsPerPage],\n )\n\n const {\n data,\n isFetching,\n isError,\n error,\n refetch: refetchPayroll,\n } = usePayrollsGet(payrollRequest, {\n placeholderData: keepPreviousData,\n })\n const payrollData = data?.payrollShow\n const submissionBlockers = findUnresolvedBlockersWithOptions(payrollData?.submissionBlockers)\n const wireInId = findWireInRequestUuid(payrollData?.creditBlockers)\n\n const { data: wireInRequestData } = useWireInRequestsGet(\n {\n wireInRequestUuid: wireInId || '',\n },\n { enabled: !!wireInId },\n )\n const wireInRequest = wireInRequestData?.wireInRequest\n\n // Scoped to the current page's employees so this stays bounded regardless of company size,\n // since `flsaStatus` (compensation type) isn't available on employeeCompensations for\n // employees without an hourlyCompensations line item (e.g. salaried employees).\n const employeeUuids = (payrollData?.employeeCompensations ?? [])\n .map(employeeCompensation => employeeCompensation.employeeUuid)\n .filter((uuid): uuid is string => !!uuid)\n\n const { data: employeesData } = useEmployeesList(\n { companyId, uuids: employeeUuids },\n { enabled: employeeUuids.length > 0 },\n )\n const employeeFlsaStatusByUuid = (employeesData?.showEmployees ?? []).reduce<\n Record<string, string | undefined>\n >((acc, employee) => {\n acc[employee.uuid] = employee.flsaStatus\n return acc\n }, {})\n\n const onEdit = () => {\n onEvent(componentEvents.RUN_PAYROLL_EDIT)\n }\n\n const handleWireEvent = (type: EventType, data?: unknown) => {\n if (type === payrollWireEvents.PAYROLL_WIRE_FORM_DONE) {\n setShowWireDetailsConfirmation(true)\n }\n onEvent(type, data)\n }\n\n const wireInConfirmationRequest = wireInId && (\n <ConfirmWireDetailsComponent\n companyId={companyId}\n wireInId={wireInId}\n onEvent={handleWireEvent}\n />\n )\n\n const printChecksBanner = (\n <PrintChecks companyId={companyId} payrollId={payrollId} onEvent={onEvent} />\n )\n\n useEffect(() => {\n if (wireInRequest?.status === 'pending_review' && !showWireDetailsConfirmation) {\n setShowWireDetailsConfirmation(true)\n }\n }, [wireInRequest?.status, showWireDetailsConfirmation])\n\n const checkDate = payrollData?.checkDate\n useEffect(() => {\n if (checkDate && showWireDetailsConfirmation) {\n const formattedCheckDate = dateFormatter.formatShortWithYear(checkDate)\n\n setInternalAlerts([\n {\n type: 'success',\n title: t('alerts.wireDetailsSubmittedTitle'),\n content: (\n <Text>\n {t('alerts.wireDetailsSubmittedMessage', { checkDate: formattedCheckDate })}\n </Text>\n ),\n onDismiss: () => {\n setShowWireDetailsConfirmation(false)\n },\n },\n ])\n }\n }, [showWireDetailsConfirmation, checkDate, t, dateFormatter, Text])\n\n const emitProcessed = (payroll: PayrollShow | undefined) => {\n onEvent(componentEvents.RUN_PAYROLL_PROCESSED, {\n payPeriod: payroll?.payPeriod,\n payrollUuid: payrollId,\n })\n setInternalAlerts([\n {\n type: 'success',\n title: t('alerts.payrollProcessedTitle'),\n content: t('alerts.payrollProcessedMessage', {\n amount: formatCurrency(Number(payroll?.totals?.companyDebit)),\n date: dateFormatter.formatShortWithYear(\n payroll?.payrollStatusMeta?.expectedDebitTime ?? payroll?.payrollDeadline,\n ),\n }),\n },\n ])\n setShowWireDetailsConfirmation(false)\n setHasSubmittedInSession(false)\n }\n\n const emitProcessingFailed = (payroll: PayrollShow | undefined) => {\n onEvent(componentEvents.RUN_PAYROLL_PROCESSING_FAILED)\n setInternalAlerts([\n {\n type: 'error',\n title: t('alerts.payrollProcessingFailedTitle'),\n content: (\n <Flex flexDirection=\"column\" gap={16}>\n <UnorderedList items={renderErrorList(payroll?.processingRequest?.errors ?? [])} />\n {!readOnly && (\n <Button variant=\"secondary\" onClick={onEdit}>\n {t('alerts.payrollProcessingFailedCtaLabel')}\n </Button>\n )}\n </Flex>\n ),\n },\n ])\n setShowWireDetailsConfirmation(false)\n setHasSubmittedInSession(false)\n }\n\n const { start: startPayrollPoll, isPolling } = useSubmissionPoll({\n refetch: refetchPayroll,\n onProcessed: emitProcessed,\n onProcessingFailed: emitProcessingFailed,\n // Unlike the calculation poll, a second Submit click here is safe even if this fires on a\n // payroll that actually did process successfully — payrollsSubmit only operates on an\n // unprocessed payroll, so the API itself rejects a resubmit rather than double-running it.\n onError: () => {\n emitProcessingFailed(undefined)\n },\n })\n\n // The initial read is a non-suspense query; if its notification never arrives, the component\n // is stuck on `!payrollData` forever with no other render source. This one read forces that\n // render -- it only keeps tracking to completion if it happens to land on `submitting`, not as\n // a durable watcher for a submission started elsewhere.\n useEffect(() => {\n startPayrollPoll({ baseline: null, sawSubmitting: false })\n }, [startPayrollPoll])\n\n const { data: bankAccountData } = useBankAccountsGetSuspense({\n companyId,\n })\n const bankAccount = bankAccountData.companyBankAccounts?.[0]\n\n const { paymentSpeed } = useCompanyPaymentSpeed(companyId)\n\n const { mutateAsync: submitPayroll, isPending } = usePayrollsSubmitMutation()\n\n const { mutateAsync: cancelPayroll } = usePayrollsCancelMutation()\n\n const nonce = useNonce()\n\n const [downloadingEmployeeIds, setDownloadingEmployeeIds] = useState<ReadonlySet<string>>(\n () => new Set(),\n )\n\n if (!payrollData) {\n if (isError) {\n throw new Error(t('alerts.payrollLoadFailed'))\n }\n return <PayrollLoading title={t('dataLoadingTitle')} />\n }\n\n // `keepPreviousData` can leave stale data in place while the query is erroring in the\n // background. A retryable error (network blip, transient 5xx) is fine to ride out on stale\n // data, but a non-retryable one (expired session, schema mismatch) never recovers on its own --\n // continuing to render stale data would hide that from the partner indefinitely.\n if (isError && isNonRetryablePollError(error)) {\n throw new Error(t('alerts.payrollLoadFailed'))\n }\n\n if (status === PayrollOverviewStatus.Viewing && !payrollData.calculatedAt) {\n throw new Error(t('alerts.payrollNotCalculated'))\n }\n\n const pagination = getPaginationProps(data.httpMeta.response.headers, isFetching)\n\n // Per-tax totals come from the payroll-level `payrollTaxes` aggregate so they stay\n // correct when `employeeCompensations` is paginated (only a single page is loaded).\n const taxes =\n payrollData.payrollTaxes?.reduce(\n (acc, tax) => {\n if (!tax.name) return acc\n const amount = tax.amount ?? 0\n acc[tax.name] = {\n employee: (acc[tax.name]?.employee ?? 0) + (tax.employer ? 0 : amount),\n employer: (acc[tax.name]?.employer ?? 0) + (tax.employer ? amount : 0),\n }\n return acc\n },\n {} as Record<string, { employee: number; employer: number }>,\n ) || {}\n\n const onCancel = async () => {\n setStatus(PayrollOverviewStatus.Cancelling)\n await baseSubmitHandler(data, async () => {\n try {\n const result = await cancelPayroll({\n request: {\n companyId,\n payrollId,\n },\n })\n setStatus(PayrollOverviewStatus.Cancelled)\n onEvent(componentEvents.RUN_PAYROLL_CANCELLED, result)\n } catch (error) {\n setStatus(PayrollOverviewStatus.Viewing)\n throw error\n }\n })\n }\n const onPayrollReceipt = () => {\n onEvent(componentEvents.RUN_PAYROLL_RECEIPT_GET, { payrollId })\n }\n\n const onPaystubDownload = async (employeeId: string) => {\n const tab = openPdfInNewTab({ loadingMessage: t('downloadLoadingMessage'), nonce })\n setDownloadingEmployeeIds(prev => {\n const next = new Set(prev)\n next.add(employeeId)\n return next\n })\n try {\n const response = await payrollsGetPayStub(gustoEmbedded, { payrollId, employeeId })\n if (!response.value?.responseStream) {\n tab.close()\n throw new Error(t('alerts.paystubPdfError'))\n }\n const pdfBlob = await readableStreamToBlob(response.value.responseStream, 'application/pdf')\n tab.navigate(pdfBlob)\n onEvent(componentEvents.RUN_PAYROLL_PDF_PAYSTUB_VIEWED, { employeeId })\n } catch (err) {\n tab.close()\n showBoundary(err instanceof Error ? err : new Error(String(err)))\n } finally {\n setDownloadingEmployeeIds(prev => {\n if (!prev.has(employeeId)) return prev\n const next = new Set(prev)\n next.delete(employeeId)\n return next\n })\n }\n }\n const onSubmit = async () => {\n await baseSubmitHandler(data, async () => {\n const result = await submitPayroll({\n request: {\n companyId,\n payrollId,\n requestBody: {\n submissionBlockers: Object.entries(selectedUnblockOptions)\n .filter(([blockerType]) =>\n PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES.includes(blockerType),\n )\n .map(([blockerType, selectedOption]) => ({\n blockerType,\n selectedOption,\n })),\n },\n },\n })\n onEvent(componentEvents.RUN_PAYROLL_SUBMITTING)\n onEvent(componentEvents.RUN_PAYROLL_SUBMITTED, result)\n startPayrollPoll({\n baseline: {\n processed: payrollData.processed ?? false,\n status: payrollData.processingRequest?.status,\n },\n sawSubmitting: false,\n })\n setHasSubmittedInSession(true)\n })\n }\n\n const deadlineAlert: PayrollFlowAlert | undefined = (() => {\n if (hasSubmittedInSession || isPolling) return undefined\n if (\n payrollData.processed ||\n payrollData.processingRequest?.status === PAYROLL_PROCESSING_STATUS.submit_success\n )\n return undefined\n\n if (payrollData.checkDate && payrollData.payrollDeadline) {\n return {\n type: 'info' as const,\n title: t('alerts.directDepositDeadline', {\n payDate: dateFormatter.formatShortWithWeekday(payrollData.checkDate),\n ...dateFormatter.formatWithTime(payrollData.payrollDeadline),\n }),\n content: t('alerts.directDepositDeadlineText'),\n }\n }\n return undefined\n })()\n\n const combinedAlerts = [...internalAlerts, ...(deadlineAlert ? [deadlineAlert] : [])]\n\n return (\n <PayrollOverviewPresentation\n className={className}\n onEdit={onEdit}\n onSubmit={onSubmit}\n onCancel={onCancel}\n onPayrollReceipt={onPayrollReceipt}\n onPaystubDownload={onPaystubDownload}\n status={isPending || hasSubmittedInSession ? PayrollOverviewStatus.Submitting : status}\n isProcessed={\n payrollData.processed === true ||\n payrollData.processingRequest?.status === PAYROLL_PROCESSING_STATUS.submit_success\n }\n canCancel={canCancelPayroll(payrollData) && !readOnly}\n canEdit={!readOnly}\n payrollData={payrollData}\n employeeFlsaStatusByUuid={employeeFlsaStatusByUuid}\n bankAccount={bankAccount}\n taxes={taxes}\n alerts={combinedAlerts}\n submissionBlockers={submissionBlockers}\n selectedUnblockOptions={selectedUnblockOptions}\n onUnblockOptionChange={(blockerType, value) => {\n setSelectedUnblockOptions(prev => ({ ...prev, [blockerType]: value }))\n }}\n wireInConfirmationRequest={wireInConfirmationRequest}\n printChecksBanner={printChecksBanner}\n withReimbursements={withReimbursements}\n paymentSpeed={paymentSpeed}\n pagination={pagination}\n downloadingEmployeeIds={downloadingEmployeeIds}\n />\n )\n}\n"],"names":["findUnresolvedBlockersWithOptions","blockers","blocker","findWireInRequestUuid","creditBlockers","unresolvedCreditBlocker","option","PayrollOverview","props","jsx","BaseComponent","Root","companyId","payrollId","dictionary","onEvent","alerts","withReimbursements","ConfirmWireDetailsComponent","ConfirmWireDetails","readOnly","className","useComponentDictionary","useI18n","baseSubmitHandler","useBase","t","useTranslation","hasSubmittedInSession","setHasSubmittedInSession","useState","internalAlerts","setInternalAlerts","selectedUnblockOptions","setSelectedUnblockOptions","showWireDetailsConfirmation","setShowWireDetailsConfirmation","showBoundary","useErrorBoundary","formatCurrency","useNumberFormatter","dateFormatter","useDateFormatter","Button","UnorderedList","Text","useComponentContext","status","setStatus","PayrollOverviewStatus","currentPage","itemsPerPage","getPaginationProps","usePagination","gustoEmbedded","useGustoEmbeddedContext","payrollRequest","useMemo","data","isFetching","isError","error","refetchPayroll","usePayrollsGet","keepPreviousData","payrollData","submissionBlockers","wireInId","wireInRequestData","useWireInRequestsGet","wireInRequest","employeeUuids","employeeCompensation","uuid","employeesData","useEmployeesList","employeeFlsaStatusByUuid","acc","employee","onEdit","componentEvents","wireInConfirmationRequest","type","payrollWireEvents","printChecksBanner","PrintChecks","useEffect","checkDate","formattedCheckDate","emitProcessed","payroll","emitProcessingFailed","jsxs","Flex","renderErrorList","startPayrollPoll","isPolling","useSubmissionPoll","bankAccountData","useBankAccountsGetSuspense","bankAccount","paymentSpeed","useCompanyPaymentSpeed","submitPayroll","isPending","usePayrollsSubmitMutation","cancelPayroll","usePayrollsCancelMutation","nonce","useNonce","downloadingEmployeeIds","setDownloadingEmployeeIds","PayrollLoading","isNonRetryablePollError","pagination","taxes","tax","amount","onCancel","result","onPayrollReceipt","onPaystubDownload","employeeId","tab","openPdfInNewTab","prev","next","response","payrollsGetPayStub","pdfBlob","readableStreamToBlob","err","onSubmit","blockerType","PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES","selectedOption","deadlineAlert","PAYROLL_PROCESSING_STATUS","combinedAlerts","PayrollOverviewPresentation","canCancelPayroll","value"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyEA,MAAMA,KAAoC,CACxCC,IAA2C,OAEpCA,EAAS;AAAA,EACd,CAAAC,MACEA,EAAQ,WAAW,gBACnBA,EAAQ,kBACRA,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