@gusto/embedded-react-sdk 0.55.1 → 0.55.3
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 +36 -0
- package/dist/components/Common/FieldLayout/FieldLayout.js +6 -6
- package/dist/components/Common/Fieldset/Fieldset.js +6 -6
- package/dist/components/Common/HorizontalFieldLayout/HorizontalFieldLayout.js +6 -6
- package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/components/Common/UI/FileInput/FileInput.js +1 -1
- package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.js +58 -49
- package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.js.map +1 -1
- package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.module.scss.js +14 -10
- package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.module.scss.js.map +1 -1
- package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBoxTypes.d.ts +4 -0
- package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +6 -3
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +6 -3
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +8 -5
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +6 -3
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.d.ts +4 -0
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/List.js +11 -8
- package/dist/components/Company/DocumentSigner/DocumentList/List.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +6 -3
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +11 -8
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +9 -6
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +6 -3
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +6 -3
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +6 -3
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +6 -3
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +6 -3
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/TaxRateManagement/context.js +6 -3
- package/dist/components/Company/StateTaxes/TaxRateManagement/context.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.js +116 -116
- package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/DocumentList.d.ts +4 -0
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/DocumentList.js +19 -19
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/List.js +16 -13
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/List.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +6 -3
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentSigner.d.ts +4 -0
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentSigner.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/shared/FederalTaxesView.js +1 -1
- package/dist/components/Employee/PaymentMethod/management/PaymentMethodBankForm.js +4 -4
- package/dist/components/Employee/PaymentMethod/onboarding/BankForm.js +4 -4
- package/dist/components/Flow/Flow.js +1 -1
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +3 -2
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js +75 -71
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.d.ts +7 -0
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +202 -165
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.d.ts +1 -0
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +88 -82
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.d.ts +1 -0
- package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js +73 -48
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollFlow.d.ts +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollFlow.js +22 -20
- package/dist/components/Payroll/PayrollFlow/PayrollFlow.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.d.ts +3 -0
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js +22 -20
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js.map +1 -1
- package/dist/components/Payroll/PayrollLanding/PayrollLanding.d.ts +2 -0
- package/dist/components/Payroll/PayrollLanding/PayrollLanding.js +34 -26
- package/dist/components/Payroll/PayrollLanding/PayrollLanding.js.map +1 -1
- package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.d.ts +4 -0
- package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js +51 -43
- package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollList.d.ts +2 -0
- package/dist/components/Payroll/PayrollList/PayrollList.js +48 -47
- package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.d.ts +2 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +44 -43
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.d.ts +15 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +188 -172
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.d.ts +3 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +110 -118
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceipts.js +22 -16
- package/dist/components/Payroll/PayrollReceipts/PayrollReceipts.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +58 -49
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
- package/dist/components/Payroll/PrintChecks/PrintChecks.d.ts +21 -0
- package/dist/components/Payroll/PrintChecks/PrintChecks.js +68 -0
- package/dist/components/Payroll/PrintChecks/PrintChecks.js.map +1 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksBanner/PrintChecksBanner.d.ts +9 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksBanner/PrintChecksBanner.js +34 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksBanner/PrintChecksBanner.js.map +1 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksBanner/index.d.ts +1 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksComponents.d.ts +48 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksComponents.js +26 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksComponents.js.map +1 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksFailure/PrintChecksFailure.d.ts +14 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksFailure/PrintChecksFailure.js +47 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksFailure/PrintChecksFailure.js.map +1 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksFailure/index.d.ts +1 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksForm/PrintChecksForm.d.ts +16 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksForm/PrintChecksForm.js +144 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksForm/PrintChecksForm.js.map +1 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksForm/index.d.ts +1 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksSummary/PrintChecksSummary.d.ts +14 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksSummary/PrintChecksSummary.js +39 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksSummary/PrintChecksSummary.js.map +1 -0
- package/dist/components/Payroll/PrintChecks/PrintChecksSummary/index.d.ts +1 -0
- package/dist/components/Payroll/PrintChecks/index.d.ts +2 -0
- package/dist/components/Payroll/PrintChecks/printChecksStateMachine.d.ts +33 -0
- package/dist/components/Payroll/PrintChecks/printChecksStateMachine.js +93 -0
- package/dist/components/Payroll/PrintChecks/printChecksStateMachine.js.map +1 -0
- package/dist/components/Payroll/PrintChecks/types.d.ts +14 -0
- package/dist/components/Payroll/helpers.d.ts +0 -15
- package/dist/components/Payroll/helpers.js +13 -18
- package/dist/components/Payroll/helpers.js.map +1 -1
- package/dist/components/Payroll/index.d.ts +2 -0
- package/dist/components/Payroll/index.js +26 -24
- package/dist/components/Payroll/index.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +15 -12
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/i18n/I18n.js +4 -0
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Company.DocumentList.json.js +34 -32
- package/dist/i18n/en/Company.DocumentList.json.js.map +1 -1
- package/dist/i18n/en/Employee.DocumentSigner.json.js +24 -22
- package/dist/i18n/en/Employee.DocumentSigner.json.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollConfiguration.json.js +9 -9
- package/dist/i18n/en/Payroll.PayrollOverview.json.js +36 -36
- package/dist/i18n/en/Payroll.PayrollReceipts.json.js +2 -2
- package/dist/i18n/en/Payroll.PrintChecksBanner.json.js +14 -0
- package/dist/i18n/en/Payroll.PrintChecksBanner.json.js.map +1 -0
- package/dist/i18n/en/Payroll.PrintChecksFailure.json.js +12 -0
- package/dist/i18n/en/Payroll.PrintChecksFailure.json.js.map +1 -0
- package/dist/i18n/en/Payroll.PrintChecksForm.json.js +28 -0
- package/dist/i18n/en/Payroll.PrintChecksForm.json.js.map +1 -0
- package/dist/i18n/en/Payroll.PrintChecksSummary.json.js +14 -0
- package/dist/i18n/en/Payroll.PrintChecksSummary.json.js.map +1 -0
- package/dist/i18n/types.d.ts +376 -8
- package/dist/models/external.d.ts +3 -0
- package/dist/partner-hook-utils/form/buildFormSchema.js +60 -54
- package/dist/partner-hook-utils/form/buildFormSchema.js.map +1 -1
- package/dist/shared/constants.d.ts +28 -0
- package/dist/shared/constants.js +61 -50
- package/dist/shared/constants.js.map +1 -1
- package/dist/style.css +1 -1
- package/docs/guides/endpoint-inventory.json +26 -0
- package/package.json +6 -6
|
@@ -1,236 +1,252 @@
|
|
|
1
|
-
import { jsx as l, jsxs as
|
|
2
|
-
import { usePayrollsSubmitMutation as
|
|
3
|
-
import { usePayrollsCancelMutation as
|
|
4
|
-
import { usePayrollsGet as
|
|
5
|
-
import { keepPreviousData as
|
|
6
|
-
import { useTranslation as
|
|
7
|
-
import { useBankAccountsGetSuspense as
|
|
8
|
-
import { useWireInRequestsGet as
|
|
9
|
-
import { useState as
|
|
10
|
-
import { useGustoEmbeddedContext as
|
|
11
|
-
import { payrollsGetPayStub as
|
|
12
|
-
import { useErrorBoundary as
|
|
13
|
-
import { ConfirmWireDetails as
|
|
14
|
-
import { canCancelPayroll as
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
1
|
+
import { jsx as l, jsxs as ye } from "react/jsx-runtime";
|
|
2
|
+
import { usePayrollsSubmitMutation as Pe } from "@gusto/embedded-api/react-query/payrollsSubmit";
|
|
3
|
+
import { usePayrollsCancelMutation as be } from "@gusto/embedded-api/react-query/payrollsCancel";
|
|
4
|
+
import { usePayrollsGet as Re } from "@gusto/embedded-api/react-query/payrollsGet";
|
|
5
|
+
import { keepPreviousData as Se } from "@tanstack/react-query";
|
|
6
|
+
import { useTranslation as we } from "react-i18next";
|
|
7
|
+
import { useBankAccountsGetSuspense as he } from "@gusto/embedded-api/react-query/bankAccountsGet";
|
|
8
|
+
import { useWireInRequestsGet as De } from "@gusto/embedded-api/react-query/wireInRequestsGet";
|
|
9
|
+
import { useState as p, useEffect as _ } from "react";
|
|
10
|
+
import { useGustoEmbeddedContext as ge } from "@gusto/embedded-api/react-query/_context";
|
|
11
|
+
import { payrollsGetPayStub as Le } from "@gusto/embedded-api/funcs/payrollsGetPayStub";
|
|
12
|
+
import { useErrorBoundary as _e } from "react-error-boundary";
|
|
13
|
+
import { ConfirmWireDetails as Oe } from "../ConfirmWireDetails/ConfirmWireDetails.js";
|
|
14
|
+
import { canCancelPayroll as Ce } from "../helpers.js";
|
|
15
|
+
import { PrintChecks as ke } from "../PrintChecks/PrintChecks.js";
|
|
16
|
+
import { PayrollOverviewPresentation as Ue } from "./PayrollOverviewPresentation.js";
|
|
17
|
+
import { PayrollOverviewStatus as d } from "./PayrollOverviewTypes.js";
|
|
18
|
+
import { useCompanyPaymentSpeed as Ae } from "../../../hooks/useCompanyPaymentSpeed.js";
|
|
19
|
+
import { PAYROLL_PROCESSING_STATUS as y, componentEvents as c, PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES as Ee, payrollWireEvents as Te } from "../../../shared/constants.js";
|
|
20
|
+
import { BaseComponent as Be } from "../../Base/Base.js";
|
|
21
|
+
import { useBase as ve } from "../../Base/useBase.js";
|
|
22
|
+
import { useComponentDictionary as qe, useI18n as Ne } from "../../../i18n/I18n.js";
|
|
23
|
+
import { readableStreamToBlob as We } from "../../../helpers/readableStreamToBlob.js";
|
|
24
|
+
import Ie from "../../../hooks/useNumberFormatter.js";
|
|
25
|
+
import { useDateFormatter as Ye } from "../../../hooks/useDateFormatter.js";
|
|
26
|
+
import { useComponentContext as Me } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
27
|
+
import { renderErrorList as Fe } from "../../../helpers/apiErrorToList.js";
|
|
28
|
+
import { Flex as xe } from "../../Common/Flex/Flex.js";
|
|
29
|
+
import { usePagination as Ge } from "../../../hooks/usePagination/usePagination.js";
|
|
29
30
|
import { PayrollLoading as I } from "../../Common/PayrollLoading/PayrollLoading.js";
|
|
30
|
-
const
|
|
31
|
+
const je = (s = []) => s.filter(
|
|
31
32
|
(n) => n.status === "unresolved" && n.unblockOptions && n.unblockOptions.length > 0
|
|
32
|
-
),
|
|
33
|
-
const n =
|
|
33
|
+
), Ve = (s = []) => {
|
|
34
|
+
const n = s.find((o) => o.status === "unresolved");
|
|
34
35
|
return n?.unblockOptions ? n.unblockOptions.find(
|
|
35
|
-
(
|
|
36
|
+
(o) => o.unblockType === "submit_wire"
|
|
36
37
|
)?.metadata.wireInRequestUuid : void 0;
|
|
37
38
|
};
|
|
38
|
-
function
|
|
39
|
-
return /* @__PURE__ */ l(
|
|
39
|
+
function Lt(s) {
|
|
40
|
+
return /* @__PURE__ */ l(Be, { ...s, children: /* @__PURE__ */ l(He, { ...s, children: s.children }) });
|
|
40
41
|
}
|
|
41
|
-
const
|
|
42
|
-
companyId:
|
|
42
|
+
const He = ({
|
|
43
|
+
companyId: s,
|
|
43
44
|
payrollId: n,
|
|
44
|
-
dictionary:
|
|
45
|
-
onEvent:
|
|
46
|
-
alerts:
|
|
47
|
-
withReimbursements:
|
|
48
|
-
ConfirmWireDetailsComponent:
|
|
45
|
+
dictionary: O,
|
|
46
|
+
onEvent: o,
|
|
47
|
+
alerts: Y,
|
|
48
|
+
withReimbursements: M = !0,
|
|
49
|
+
ConfirmWireDetailsComponent: F = Oe,
|
|
50
|
+
readOnly: P = !1
|
|
49
51
|
}) => {
|
|
50
|
-
|
|
51
|
-
const { baseSubmitHandler:
|
|
52
|
-
defaultItemsPerPage:
|
|
53
|
-
}), { data:
|
|
52
|
+
qe("Payroll.PayrollOverview", O), Ne("Payroll.PayrollOverview");
|
|
53
|
+
const { baseSubmitHandler: C } = ve(), { t: i } = we("Payroll.PayrollOverview"), [u, b] = p(!1), [k, h] = p(!1), [x, D] = p(Y || []), [U, G] = p({}), [R, f] = p(!1), { showBoundary: j } = _e(), A = Ie("currency"), m = Ye(), { Button: V, UnorderedList: H, Text: E } = Me(), [T, g] = p(d.Viewing), { currentPage: K, itemsPerPage: z, getPaginationProps: J } = Ge({
|
|
54
|
+
defaultItemsPerPage: 25
|
|
55
|
+
}), { data: S, isFetching: B } = Re(
|
|
54
56
|
{
|
|
55
|
-
companyId:
|
|
57
|
+
companyId: s,
|
|
56
58
|
payrollId: n,
|
|
57
59
|
include: ["taxes", "benefits", "deductions", "totals", "payroll_taxes"],
|
|
58
|
-
page:
|
|
59
|
-
per:
|
|
60
|
+
page: K,
|
|
61
|
+
per: z,
|
|
62
|
+
sortBy: "last_name"
|
|
60
63
|
},
|
|
61
64
|
{
|
|
62
|
-
refetchInterval:
|
|
63
|
-
placeholderData:
|
|
65
|
+
refetchInterval: u ? 5e3 : !1,
|
|
66
|
+
placeholderData: Se,
|
|
64
67
|
// Always refetch on mount so a partner QueryClient with a non-zero `staleTime`
|
|
65
68
|
// can't serve a stale pre-calculation snapshot without refetching. SDK-1018.
|
|
66
69
|
refetchOnMount: "always"
|
|
67
70
|
}
|
|
68
|
-
), e =
|
|
71
|
+
), e = S?.payrollShow, Q = je(e?.submissionBlockers), w = Ve(e?.creditBlockers), { data: X } = De(
|
|
69
72
|
{
|
|
70
|
-
wireInRequestUuid:
|
|
73
|
+
wireInRequestUuid: w || ""
|
|
71
74
|
},
|
|
72
|
-
{ enabled: !!
|
|
73
|
-
),
|
|
74
|
-
|
|
75
|
-
},
|
|
76
|
-
|
|
75
|
+
{ enabled: !!w }
|
|
76
|
+
), v = X?.wireInRequest, q = () => {
|
|
77
|
+
o(c.RUN_PAYROLL_EDIT);
|
|
78
|
+
}, Z = w && /* @__PURE__ */ l(
|
|
79
|
+
F,
|
|
77
80
|
{
|
|
78
|
-
companyId:
|
|
79
|
-
wireInId:
|
|
80
|
-
onEvent: (t,
|
|
81
|
-
t ===
|
|
81
|
+
companyId: s,
|
|
82
|
+
wireInId: w,
|
|
83
|
+
onEvent: (t, r) => {
|
|
84
|
+
t === Te.PAYROLL_WIRE_FORM_DONE && f(!0), o(t, r);
|
|
82
85
|
}
|
|
83
86
|
}
|
|
84
|
-
);
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}, [
|
|
87
|
+
), $ = /* @__PURE__ */ l(ke, { companyId: s, payrollId: n, onEvent: o });
|
|
88
|
+
_(() => {
|
|
89
|
+
v?.status === "pending_review" && !R && f(!0);
|
|
90
|
+
}, [v?.status, R]);
|
|
88
91
|
const L = e?.checkDate;
|
|
89
|
-
|
|
90
|
-
if (L &&
|
|
91
|
-
const t =
|
|
92
|
-
|
|
92
|
+
_(() => {
|
|
93
|
+
if (L && R) {
|
|
94
|
+
const t = m.formatShortWithYear(L);
|
|
95
|
+
D([
|
|
93
96
|
{
|
|
94
97
|
type: "success",
|
|
95
|
-
title:
|
|
96
|
-
content: /* @__PURE__ */ l(E, { children:
|
|
98
|
+
title: i("alerts.wireDetailsSubmittedTitle"),
|
|
99
|
+
content: /* @__PURE__ */ l(E, { children: i("alerts.wireDetailsSubmittedMessage", { checkDate: t }) }),
|
|
97
100
|
onDismiss: () => {
|
|
98
|
-
|
|
101
|
+
f(!1);
|
|
99
102
|
}
|
|
100
103
|
}
|
|
101
104
|
]);
|
|
102
105
|
}
|
|
103
|
-
}, [
|
|
104
|
-
e && (e.processingRequest?.status ===
|
|
106
|
+
}, [R, L, i, m, E]), _(() => {
|
|
107
|
+
e && (e.processingRequest?.status === y.submitting && !u && b(!0), u && (e.processed === !0 || e.processingRequest?.status === y.submit_success) && (o(c.RUN_PAYROLL_PROCESSED, {
|
|
105
108
|
payPeriod: e.payPeriod,
|
|
106
109
|
payrollUuid: n
|
|
107
|
-
}),
|
|
110
|
+
}), D([
|
|
108
111
|
{
|
|
109
112
|
type: "success",
|
|
110
|
-
title:
|
|
111
|
-
content:
|
|
112
|
-
amount:
|
|
113
|
-
date:
|
|
113
|
+
title: i("alerts.payrollProcessedTitle"),
|
|
114
|
+
content: i("alerts.payrollProcessedMessage", {
|
|
115
|
+
amount: A(Number(e.totals?.companyDebit)),
|
|
116
|
+
date: m.formatShortWithYear(
|
|
114
117
|
e.payrollStatusMeta?.expectedDebitTime ?? e.payrollDeadline
|
|
115
118
|
)
|
|
116
119
|
})
|
|
117
120
|
}
|
|
118
|
-
]),
|
|
121
|
+
]), f(!1), b(!1), h(!1)), u && e.processingRequest?.status === y.processing_failed && (o(c.RUN_PAYROLL_PROCESSING_FAILED), D([
|
|
119
122
|
{
|
|
120
123
|
type: "error",
|
|
121
|
-
title:
|
|
122
|
-
content: /* @__PURE__ */
|
|
123
|
-
/* @__PURE__ */ l(
|
|
124
|
-
/* @__PURE__ */ l(
|
|
124
|
+
title: i("alerts.payrollProcessingFailedTitle"),
|
|
125
|
+
content: /* @__PURE__ */ ye(xe, { flexDirection: "column", gap: 16, children: [
|
|
126
|
+
/* @__PURE__ */ l(H, { items: Fe(e.processingRequest.errors ?? []) }),
|
|
127
|
+
!P && /* @__PURE__ */ l(V, { variant: "secondary", onClick: q, children: i("alerts.payrollProcessingFailedCtaLabel") })
|
|
125
128
|
] })
|
|
126
129
|
}
|
|
127
|
-
]),
|
|
130
|
+
]), f(!1), b(!1), h(!1)));
|
|
128
131
|
}, [
|
|
129
132
|
e?.processingRequest?.status,
|
|
130
133
|
e?.processed,
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
u,
|
|
135
|
+
o,
|
|
136
|
+
i,
|
|
137
|
+
m,
|
|
138
|
+
A,
|
|
136
139
|
e?.totals?.companyDebit,
|
|
137
140
|
e?.payrollStatusMeta?.expectedDebitTime,
|
|
138
|
-
e?.payrollDeadline
|
|
141
|
+
e?.payrollDeadline,
|
|
142
|
+
P
|
|
139
143
|
]);
|
|
140
|
-
const { data:
|
|
141
|
-
companyId:
|
|
142
|
-
}),
|
|
144
|
+
const { data: ee } = he({
|
|
145
|
+
companyId: s
|
|
146
|
+
}), te = ee.companyBankAccounts?.[0], { paymentSpeed: re } = Ae(s), { mutateAsync: se, isPending: oe } = Pe(), { mutateAsync: ne } = be(), ie = ge();
|
|
143
147
|
if (!e)
|
|
144
|
-
return /* @__PURE__ */ l(I, { title:
|
|
145
|
-
if (
|
|
146
|
-
if (
|
|
147
|
-
return /* @__PURE__ */ l(I, { title:
|
|
148
|
-
throw new Error(
|
|
148
|
+
return /* @__PURE__ */ l(I, { title: i("dataLoadingTitle") });
|
|
149
|
+
if (T === d.Viewing && !e.calculatedAt) {
|
|
150
|
+
if (B)
|
|
151
|
+
return /* @__PURE__ */ l(I, { title: i("dataLoadingTitle") });
|
|
152
|
+
throw new Error(i("alerts.payrollNotCalculated"));
|
|
149
153
|
}
|
|
150
|
-
const
|
|
151
|
-
(t,
|
|
152
|
-
if (!
|
|
153
|
-
const
|
|
154
|
-
return t[
|
|
155
|
-
employee: (t[
|
|
156
|
-
employer: (t[
|
|
154
|
+
const ae = J(S.httpMeta.response.headers, B), le = e.payrollTaxes?.reduce(
|
|
155
|
+
(t, r) => {
|
|
156
|
+
if (!r.name) return t;
|
|
157
|
+
const a = r.amount ?? 0;
|
|
158
|
+
return t[r.name] = {
|
|
159
|
+
employee: (t[r.name]?.employee ?? 0) + (r.employer ? 0 : a),
|
|
160
|
+
employer: (t[r.name]?.employer ?? 0) + (r.employer ? a : 0)
|
|
157
161
|
}, t;
|
|
158
162
|
},
|
|
159
163
|
{}
|
|
160
|
-
) || {}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
const t = await ee({
|
|
168
|
-
request: {
|
|
169
|
-
companyId: r,
|
|
170
|
-
payrollId: n,
|
|
171
|
-
requestBody: {
|
|
172
|
-
submissionBlockers: Object.entries(C).filter(
|
|
173
|
-
([o]) => ge.includes(o)
|
|
174
|
-
).map(([o, i]) => ({
|
|
175
|
-
blockerType: o,
|
|
176
|
-
selectedOption: i
|
|
177
|
-
}))
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
s(c.RUN_PAYROLL_SUBMITTING), s(c.RUN_PAYROLL_SUBMITTED, t), f(!0), S(!0);
|
|
182
|
-
});
|
|
183
|
-
},
|
|
184
|
-
onCancel: async () => {
|
|
185
|
-
g(m.Cancelling), await D(b, async () => {
|
|
186
|
-
try {
|
|
187
|
-
const t = await oe({
|
|
188
|
-
request: {
|
|
189
|
-
companyId: r,
|
|
190
|
-
payrollId: n
|
|
191
|
-
}
|
|
192
|
-
});
|
|
193
|
-
g(m.Cancelled), s(c.RUN_PAYROLL_CANCELLED, t);
|
|
194
|
-
} catch (t) {
|
|
195
|
-
throw g(m.Viewing), t;
|
|
164
|
+
) || {}, ce = async () => {
|
|
165
|
+
g(d.Cancelling), await C(S, async () => {
|
|
166
|
+
try {
|
|
167
|
+
const t = await ne({
|
|
168
|
+
request: {
|
|
169
|
+
companyId: s,
|
|
170
|
+
payrollId: n
|
|
196
171
|
}
|
|
197
172
|
});
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
173
|
+
g(d.Cancelled), o(c.RUN_PAYROLL_CANCELLED, t);
|
|
174
|
+
} catch (t) {
|
|
175
|
+
throw g(d.Viewing), t;
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
}, ue = () => {
|
|
179
|
+
o(c.RUN_PAYROLL_RECEIPT_GET, { payrollId: n });
|
|
180
|
+
}, me = async (t) => {
|
|
181
|
+
const r = window.open("", "_blank");
|
|
182
|
+
try {
|
|
183
|
+
const a = await Le(ie, { payrollId: n, employeeId: t });
|
|
184
|
+
if (!a.value?.responseStream)
|
|
185
|
+
throw new Error(i("alerts.paystubPdfError"));
|
|
186
|
+
const fe = await We(a.value.responseStream, "application/pdf"), W = URL.createObjectURL(fe);
|
|
187
|
+
r && (r.location.href = W), o(c.RUN_PAYROLL_PDF_PAYSTUB_VIEWED, { employeeId: t }), URL.revokeObjectURL(W);
|
|
188
|
+
} catch (a) {
|
|
189
|
+
r && r.close(), j(a instanceof Error ? a : new Error(String(a)));
|
|
190
|
+
}
|
|
191
|
+
}, pe = async () => {
|
|
192
|
+
await C(S, async () => {
|
|
193
|
+
const t = await se({
|
|
194
|
+
request: {
|
|
195
|
+
companyId: s,
|
|
196
|
+
payrollId: n,
|
|
197
|
+
requestBody: {
|
|
198
|
+
submissionBlockers: Object.entries(U).filter(
|
|
199
|
+
([r]) => Ee.includes(r)
|
|
200
|
+
).map(([r, a]) => ({
|
|
201
|
+
blockerType: r,
|
|
202
|
+
selectedOption: a
|
|
203
|
+
}))
|
|
204
|
+
}
|
|
212
205
|
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
206
|
+
});
|
|
207
|
+
o(c.RUN_PAYROLL_SUBMITTING), o(c.RUN_PAYROLL_SUBMITTED, t), b(!0), h(!0);
|
|
208
|
+
});
|
|
209
|
+
}, N = (() => {
|
|
210
|
+
if (!(k || u) && !(e.processed || e.processingRequest?.status === y.submit_success) && e.checkDate && e.payrollDeadline)
|
|
211
|
+
return {
|
|
212
|
+
type: "info",
|
|
213
|
+
title: i("alerts.directDepositDeadline", {
|
|
214
|
+
payDate: m.formatShortWithWeekday(e.checkDate),
|
|
215
|
+
...m.formatWithTime(e.payrollDeadline)
|
|
216
|
+
}),
|
|
217
|
+
content: i("alerts.directDepositDeadlineText")
|
|
218
|
+
};
|
|
219
|
+
})(), de = [...x, ...N ? [N] : []];
|
|
220
|
+
return /* @__PURE__ */ l(
|
|
221
|
+
Ue,
|
|
222
|
+
{
|
|
223
|
+
onEdit: q,
|
|
224
|
+
onSubmit: pe,
|
|
225
|
+
onCancel: ce,
|
|
226
|
+
onPayrollReceipt: ue,
|
|
227
|
+
onPaystubDownload: me,
|
|
228
|
+
status: oe || k ? d.Submitting : T,
|
|
229
|
+
isProcessed: e.processed === !0 || e.processingRequest?.status === y.submit_success,
|
|
230
|
+
canCancel: Ce(e) && !P,
|
|
231
|
+
canEdit: !P,
|
|
217
232
|
payrollData: e,
|
|
218
|
-
bankAccount:
|
|
219
|
-
taxes:
|
|
220
|
-
alerts:
|
|
221
|
-
submissionBlockers:
|
|
222
|
-
selectedUnblockOptions:
|
|
223
|
-
onUnblockOptionChange: (t,
|
|
224
|
-
|
|
233
|
+
bankAccount: te,
|
|
234
|
+
taxes: le,
|
|
235
|
+
alerts: de,
|
|
236
|
+
submissionBlockers: Q,
|
|
237
|
+
selectedUnblockOptions: U,
|
|
238
|
+
onUnblockOptionChange: (t, r) => {
|
|
239
|
+
G((a) => ({ ...a, [t]: r }));
|
|
225
240
|
},
|
|
226
|
-
wireInConfirmationRequest:
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
241
|
+
wireInConfirmationRequest: Z,
|
|
242
|
+
printChecksBanner: $,
|
|
243
|
+
withReimbursements: M,
|
|
244
|
+
paymentSpeed: re,
|
|
245
|
+
pagination: ae
|
|
230
246
|
}
|
|
231
247
|
);
|
|
232
248
|
};
|
|
233
249
|
export {
|
|
234
|
-
|
|
250
|
+
Lt as PayrollOverview
|
|
235
251
|
};
|
|
236
252
|
//# 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 { 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, 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 { 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 { PayrollOverviewPresentation } from './PayrollOverviewPresentation'\nimport { PayrollOverviewStatus } from './PayrollOverviewTypes'\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 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\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.\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 *\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}: PayrollOverviewProps) => {\n useComponentDictionary('Payroll.PayrollOverview', dictionary)\n useI18n('Payroll.PayrollOverview')\n const { baseSubmitHandler } = useBase()\n const { t } = useTranslation('Payroll.PayrollOverview')\n const [isPolling, setIsPolling] = useState(false)\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: 10,\n })\n const { data, isFetching } = usePayrollsGet(\n {\n companyId,\n payrollId: payrollId,\n include: ['taxes', 'benefits', 'deductions', 'totals', 'payroll_taxes'],\n page: currentPage,\n per: itemsPerPage,\n },\n {\n refetchInterval: isPolling ? 5_000 : false,\n placeholderData: keepPreviousData,\n // Always refetch on mount so a partner QueryClient with a non-zero `staleTime`\n // can't serve a stale pre-calculation snapshot without refetching. SDK-1018.\n refetchOnMount: 'always',\n },\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 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 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 useEffect(() => {\n if (!payrollData) return\n // Start polling when payroll is submitting and not already polling\n if (\n payrollData.processingRequest?.status === PAYROLL_PROCESSING_STATUS.submitting &&\n !isPolling\n ) {\n setIsPolling(true)\n }\n if (\n isPolling &&\n (payrollData.processed === true ||\n payrollData.processingRequest?.status === PAYROLL_PROCESSING_STATUS.submit_success)\n ) {\n onEvent(componentEvents.RUN_PAYROLL_PROCESSED, {\n payPeriod: payrollData.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(payrollData.totals?.companyDebit)),\n date: dateFormatter.formatShortWithYear(\n payrollData.payrollStatusMeta?.expectedDebitTime ?? payrollData.payrollDeadline,\n ),\n }),\n },\n ])\n setShowWireDetailsConfirmation(false)\n setIsPolling(false)\n setHasSubmittedInSession(false)\n }\n // If we are polling and payroll is in failed state, stop polling, and emit failure event\n if (\n isPolling &&\n payrollData.processingRequest?.status === PAYROLL_PROCESSING_STATUS.processing_failed\n ) {\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(payrollData.processingRequest.errors ?? [])} />\n <Button variant=\"secondary\" onClick={onEdit}>\n {t('alerts.payrollProcessingFailedCtaLabel')}\n </Button>\n </Flex>\n ),\n },\n ])\n setShowWireDetailsConfirmation(false)\n setIsPolling(false)\n setHasSubmittedInSession(false)\n }\n }, [\n payrollData?.processingRequest?.status,\n payrollData?.processed,\n isPolling,\n onEvent,\n t,\n dateFormatter,\n formatCurrency,\n payrollData?.totals?.companyDebit,\n payrollData?.payrollStatusMeta?.expectedDebitTime,\n payrollData?.payrollDeadline,\n ])\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 gustoEmbedded = useGustoEmbeddedContext()\n\n if (!payrollData) {\n return <PayrollLoading title={t('dataLoadingTitle')} />\n }\n\n if (status === PayrollOverviewStatus.Viewing && !payrollData.calculatedAt) {\n // A stale snapshot can be served with a null `calculatedAt` while its refetch is\n // in flight; treat that as loading and only throw once the fetch settles. SDK-1018.\n if (isFetching) {\n return <PayrollLoading title={t('dataLoadingTitle')} />\n }\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 // Open a blank window *synchronously* with the click\n const newWindow = window.open('', '_blank')\n\n try {\n // Fetch the PDF from your API\n const response = await payrollsGetPayStub(gustoEmbedded, { payrollId, employeeId })\n if (!response.value?.responseStream) {\n throw new Error(t('alerts.paystubPdfError'))\n }\n const pdfBlob = await readableStreamToBlob(response.value.responseStream, 'application/pdf')\n\n const url = URL.createObjectURL(pdfBlob)\n\n // Load the PDF into the new window\n if (newWindow) {\n newWindow.location.href = url\n }\n onEvent(componentEvents.RUN_PAYROLL_PDF_PAYSTUB_VIEWED, { employeeId })\n URL.revokeObjectURL(url) // Clean up the URL object after use\n } catch (err) {\n if (newWindow) {\n newWindow.close()\n }\n showBoundary(err instanceof Error ? err : new Error(String(err)))\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 setIsPolling(true)\n setHasSubmittedInSession(true)\n })\n }\n\n return (\n <PayrollOverviewPresentation\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)}\n payrollData={payrollData}\n bankAccount={bankAccount}\n taxes={taxes}\n alerts={internalAlerts}\n submissionBlockers={submissionBlockers}\n selectedUnblockOptions={selectedUnblockOptions}\n onUnblockOptionChange={(blockerType, value) => {\n setSelectedUnblockOptions(prev => ({ ...prev, [blockerType]: value }))\n }}\n wireInConfirmationRequest={wireInConfirmationRequest}\n withReimbursements={withReimbursements}\n paymentSpeed={paymentSpeed}\n pagination={pagination}\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","useComponentDictionary","useI18n","baseSubmitHandler","useBase","t","useTranslation","isPolling","setIsPolling","useState","hasSubmittedInSession","setHasSubmittedInSession","internalAlerts","setInternalAlerts","selectedUnblockOptions","setSelectedUnblockOptions","showWireDetailsConfirmation","setShowWireDetailsConfirmation","showBoundary","useErrorBoundary","formatCurrency","useNumberFormatter","dateFormatter","useDateFormatter","Button","UnorderedList","Text","useComponentContext","status","setStatus","PayrollOverviewStatus","currentPage","itemsPerPage","getPaginationProps","usePagination","data","isFetching","usePayrollsGet","keepPreviousData","payrollData","submissionBlockers","wireInId","wireInRequestData","useWireInRequestsGet","wireInRequest","onEdit","componentEvents","wireInConfirmationRequest","type","payrollWireEvents","useEffect","checkDate","formattedCheckDate","PAYROLL_PROCESSING_STATUS","jsxs","Flex","renderErrorList","bankAccountData","useBankAccountsGetSuspense","bankAccount","paymentSpeed","useCompanyPaymentSpeed","submitPayroll","isPending","usePayrollsSubmitMutation","cancelPayroll","usePayrollsCancelMutation","gustoEmbedded","useGustoEmbeddedContext","PayrollLoading","pagination","taxes","acc","tax","amount","PayrollOverviewPresentation","result","blockerType","PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES","selectedOption","error","employeeId","newWindow","response","payrollsGetPayStub","pdfBlob","readableStreamToBlob","url","err","canCancelPayroll","value","prev"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,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;AA+BO,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,KAAO,CAAC;AAAA,EACZ,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,SAAAC;AAAA,EACA,QAAAC;AAAA,EACA,oBAAAC,IAAqB;AA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GAAqBH,EAAS,MAAM,gBAAgB,iBAAiB,GAErFI,IAAM,IAAI,gBAAgBF,EAAO;AAGvC,UAAIH,MACFA,EAAU,SAAS,OAAOK,IAE5B3F,EAAQkD,EAAgB,gCAAgC,EAAE,YAAAmC,EAAA,CAAY,GACtE,IAAI,gBAAgBM,CAAG;AAAA,QACzB,SAASC,GAAK;AACZ,UAAIN,KACFA,EAAU,MAAA,GAEZhE,EAAasE,aAAe,QAAQA,IAAM,IAAI,MAAM,OAAOA,CAAG,CAAC,CAAC;AAAA,QAClE;AAAA,MACF;AAAA,MAiCI,QAAQzB,MAAarD,IAAwBoB,EAAsB,aAAaF;AAAA,MAChF,aACEW,EAAY,cAAc,MAC1BA,EAAY,mBAAmB,WAAWc,EAA0B;AAAA,MAEtE,WAAWoC,GAAiBlD,CAAW;AAAA,MACvC,aAAAA;AAAA,MACA,aAAAoB;AAAA,MACA,OAAAY;AAAA,MACA,QAAQ3D;AAAA,MACR,oBAAA4B;AAAA,MACA,wBAAA1B;AAAA,MACA,uBAAuB,CAAC+D,GAAaa,MAAU;AAC7C,QAAA3E,EAA0B,CAAA4E,OAAS,EAAE,GAAGA,GAAM,CAACd,CAAW,GAAGa,IAAQ;AAAA,MACvE;AAAA,MACA,2BAAA3C;AAAA,MACA,oBAAAjD;AAAA,MACA,cAAA8D;AAAA,MACA,YAAAU;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
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 { 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, 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 { 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 { 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 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}: PayrollOverviewProps) => {\n useComponentDictionary('Payroll.PayrollOverview', dictionary)\n useI18n('Payroll.PayrollOverview')\n const { baseSubmitHandler } = useBase()\n const { t } = useTranslation('Payroll.PayrollOverview')\n const [isPolling, setIsPolling] = useState(false)\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 { data, isFetching } = usePayrollsGet(\n {\n companyId,\n payrollId: payrollId,\n include: ['taxes', 'benefits', 'deductions', 'totals', 'payroll_taxes'],\n page: currentPage,\n per: itemsPerPage,\n sortBy: 'last_name',\n },\n {\n refetchInterval: isPolling ? 5_000 : false,\n placeholderData: keepPreviousData,\n // Always refetch on mount so a partner QueryClient with a non-zero `staleTime`\n // can't serve a stale pre-calculation snapshot without refetching. SDK-1018.\n refetchOnMount: 'always',\n },\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 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 useEffect(() => {\n if (!payrollData) return\n // Start polling when payroll is submitting and not already polling\n if (\n payrollData.processingRequest?.status === PAYROLL_PROCESSING_STATUS.submitting &&\n !isPolling\n ) {\n setIsPolling(true)\n }\n if (\n isPolling &&\n (payrollData.processed === true ||\n payrollData.processingRequest?.status === PAYROLL_PROCESSING_STATUS.submit_success)\n ) {\n onEvent(componentEvents.RUN_PAYROLL_PROCESSED, {\n payPeriod: payrollData.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(payrollData.totals?.companyDebit)),\n date: dateFormatter.formatShortWithYear(\n payrollData.payrollStatusMeta?.expectedDebitTime ?? payrollData.payrollDeadline,\n ),\n }),\n },\n ])\n setShowWireDetailsConfirmation(false)\n setIsPolling(false)\n setHasSubmittedInSession(false)\n }\n // If we are polling and payroll is in failed state, stop polling, and emit failure event\n if (\n isPolling &&\n payrollData.processingRequest?.status === PAYROLL_PROCESSING_STATUS.processing_failed\n ) {\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(payrollData.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 setIsPolling(false)\n setHasSubmittedInSession(false)\n }\n }, [\n payrollData?.processingRequest?.status,\n payrollData?.processed,\n isPolling,\n onEvent,\n t,\n dateFormatter,\n formatCurrency,\n payrollData?.totals?.companyDebit,\n payrollData?.payrollStatusMeta?.expectedDebitTime,\n payrollData?.payrollDeadline,\n readOnly,\n ])\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 gustoEmbedded = useGustoEmbeddedContext()\n\n if (!payrollData) {\n return <PayrollLoading title={t('dataLoadingTitle')} />\n }\n\n if (status === PayrollOverviewStatus.Viewing && !payrollData.calculatedAt) {\n // A stale snapshot can be served with a null `calculatedAt` while its refetch is\n // in flight; treat that as loading and only throw once the fetch settles. SDK-1018.\n if (isFetching) {\n return <PayrollLoading title={t('dataLoadingTitle')} />\n }\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 // Open a blank window *synchronously* with the click\n const newWindow = window.open('', '_blank')\n\n try {\n // Fetch the PDF from your API\n const response = await payrollsGetPayStub(gustoEmbedded, { payrollId, employeeId })\n if (!response.value?.responseStream) {\n throw new Error(t('alerts.paystubPdfError'))\n }\n const pdfBlob = await readableStreamToBlob(response.value.responseStream, 'application/pdf')\n\n const url = URL.createObjectURL(pdfBlob)\n\n // Load the PDF into the new window\n if (newWindow) {\n newWindow.location.href = url\n }\n onEvent(componentEvents.RUN_PAYROLL_PDF_PAYSTUB_VIEWED, { employeeId })\n URL.revokeObjectURL(url) // Clean up the URL object after use\n } catch (err) {\n if (newWindow) {\n newWindow.close()\n }\n showBoundary(err instanceof Error ? err : new Error(String(err)))\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 setIsPolling(true)\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 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 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 />\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","useComponentDictionary","useI18n","baseSubmitHandler","useBase","t","useTranslation","isPolling","setIsPolling","useState","hasSubmittedInSession","setHasSubmittedInSession","internalAlerts","setInternalAlerts","selectedUnblockOptions","setSelectedUnblockOptions","showWireDetailsConfirmation","setShowWireDetailsConfirmation","showBoundary","useErrorBoundary","formatCurrency","useNumberFormatter","dateFormatter","useDateFormatter","Button","UnorderedList","Text","useComponentContext","status","setStatus","PayrollOverviewStatus","currentPage","itemsPerPage","getPaginationProps","usePagination","data","isFetching","usePayrollsGet","keepPreviousData","payrollData","submissionBlockers","wireInId","wireInRequestData","useWireInRequestsGet","wireInRequest","onEdit","componentEvents","wireInConfirmationRequest","type","payrollWireEvents","printChecksBanner","PrintChecks","useEffect","checkDate","formattedCheckDate","PAYROLL_PROCESSING_STATUS","jsxs","Flex","renderErrorList","bankAccountData","useBankAccountsGetSuspense","bankAccount","paymentSpeed","useCompanyPaymentSpeed","submitPayroll","isPending","usePayrollsSubmitMutation","cancelPayroll","usePayrollsCancelMutation","gustoEmbedded","useGustoEmbeddedContext","PayrollLoading","pagination","taxes","acc","tax","amount","onCancel","result","error","onPayrollReceipt","onPaystubDownload","employeeId","newWindow","response","payrollsGetPayStub","pdfBlob","readableStreamToBlob","url","err","onSubmit","blockerType","PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES","selectedOption","deadlineAlert","combinedAlerts","PayrollOverviewPresentation","canCancelPayroll","value","prev"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmEA,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,CA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AAY,cAAc,MAC1BA,EAAY,mBAAmB,WAAWgB,EAA0B;AAAA,MAEtE,WAAW0C,GAAiB1D,CAAW,KAAK,CAACvC;AAAA,MAC7C,SAAS,CAACA;AAAA,MACV,aAAAuC;AAAA,MACA,aAAAsB;AAAA,MACA,OAAAY;AAAA,MACA,QAAQsB;AAAA,MACR,oBAAAvD;AAAA,MACA,wBAAA1B;AAAA,MACA,uBAAuB,CAAC6E,GAAaO,MAAU;AAC7C,QAAAnF,EAA0B,CAAAoF,OAAS,EAAE,GAAGA,GAAM,CAACR,CAAW,GAAGO,IAAQ;AAAA,MACvE;AAAA,MACA,2BAAAnD;AAAA,MACA,mBAAAG;AAAA,MACA,oBAAArD;AAAA,MACA,cAAAiE;AAAA,MACA,YAAAU;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -15,10 +15,12 @@ interface PayrollOverviewProps {
|
|
|
15
15
|
status?: PayrollOverviewStatus;
|
|
16
16
|
isProcessed: boolean;
|
|
17
17
|
canCancel?: boolean;
|
|
18
|
+
canEdit?: boolean;
|
|
18
19
|
alerts?: PayrollFlowAlert[];
|
|
19
20
|
submissionBlockers?: PayrollSubmissionBlockerType[];
|
|
20
21
|
selectedUnblockOptions?: Record<string, string>;
|
|
21
22
|
wireInConfirmationRequest?: React.ReactNode;
|
|
23
|
+
printChecksBanner?: React.ReactNode;
|
|
22
24
|
pagination?: PaginationControlProps;
|
|
23
25
|
onEdit: () => void;
|
|
24
26
|
onSubmit: () => void;
|
|
@@ -30,5 +32,5 @@ interface PayrollOverviewProps {
|
|
|
30
32
|
paymentSpeed?: PaymentSpeed;
|
|
31
33
|
}
|
|
32
34
|
/** @internal */
|
|
33
|
-
export declare const PayrollOverviewPresentation: ({ onEdit, onSubmit, onCancel, onPayrollReceipt, onPaystubDownload, payrollData, bankAccount, taxes, status, isProcessed, canCancel, alerts, submissionBlockers, selectedUnblockOptions, onUnblockOptionChange, wireInConfirmationRequest, withReimbursements, paymentSpeed, pagination, }: PayrollOverviewProps) => import("react").JSX.Element;
|
|
35
|
+
export declare const PayrollOverviewPresentation: ({ onEdit, onSubmit, onCancel, onPayrollReceipt, onPaystubDownload, payrollData, bankAccount, taxes, status, isProcessed, canCancel, canEdit, alerts, submissionBlockers, selectedUnblockOptions, onUnblockOptionChange, wireInConfirmationRequest, printChecksBanner, withReimbursements, paymentSpeed, pagination, }: PayrollOverviewProps) => import("react").JSX.Element;
|
|
34
36
|
export {};
|