@gusto/embedded-react-sdk 0.23.1 → 0.24.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 +20 -0
- package/dist/components/Common/PayrollLoading/PayrollLoading.d.ts +2 -0
- package/dist/components/Common/PayrollLoading/PayrollLoading.js +19 -0
- package/dist/components/Common/PayrollLoading/PayrollLoading.js.map +1 -0
- package/dist/components/Common/PayrollLoading/PayrollLoadingTypes.d.ts +5 -0
- package/dist/components/Common/PayrollLoading/index.d.ts +3 -0
- package/dist/components/Common/index.d.ts +1 -0
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +3 -4
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +3 -4
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +5 -6
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +3 -4
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +3 -4
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +3 -4
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +8 -9
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +6 -7
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +3 -4
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +3 -4
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +3 -4
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/usePaySchedule.js +5 -6
- package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +3 -4
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +3 -4
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Contractor/Address/useAddress.js +5 -6
- package/dist/components/Contractor/Address/useAddress.js.map +1 -1
- package/dist/components/Contractor/Profile/useContractorProfile.js +2 -3
- package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +2 -3
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +2 -3
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +2 -3
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +3 -4
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +3 -4
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Employee/EmployeeList/useEmployeeList.js +3 -4
- package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/FederalForm.js +2 -0
- package/dist/components/Employee/FederalTaxes/FederalForm.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +3 -4
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +5 -6
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/useProfile.js +3 -4
- package/dist/components/Employee/Profile/useProfile.js.map +1 -1
- package/dist/components/Employee/StateTaxes/useStateTaxes.js +3 -4
- package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
- package/dist/components/Employee/Taxes/FederalForm.js +6 -4
- package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
- package/dist/components/Employee/Taxes/useTaxes.js +3 -4
- package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.d.ts +4 -4
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.js +26 -21
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/index.d.ts +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/types.d.ts +8 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.d.ts +2 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +56 -54
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +2 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +90 -91
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.d.ts +2 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +33 -31
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.d.ts +2 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +88 -87
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollFlow.d.ts +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollFlow.js +24 -18
- package/dist/components/Payroll/PayrollFlow/PayrollFlow.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.d.ts +5 -0
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js +77 -51
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js.map +1 -1
- package/dist/components/Payroll/PayrollLanding/PayrollLanding.d.ts +4 -1
- package/dist/components/Payroll/PayrollLanding/PayrollLanding.js +29 -21
- package/dist/components/Payroll/PayrollLanding/PayrollLanding.js.map +1 -1
- package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.d.ts +5 -0
- package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js +36 -26
- package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.d.ts +4 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +70 -60
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.d.ts +2 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +239 -234
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceipts.d.ts +2 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceipts.js +25 -15
- package/dist/components/Payroll/PayrollReceipts/PayrollReceipts.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.d.ts +2 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +152 -137
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
- package/dist/components/Payroll/index.d.ts +1 -0
- package/dist/components/Payroll/usePreparedPayrollData.js +5 -6
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/contexts/ApiProvider/ApiProvider.d.ts +3 -1
- package/dist/contexts/ApiProvider/ApiProvider.js +26 -18
- package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -1
- package/dist/contexts/ComponentAdapter/componentAdapterTypes.d.ts +1 -0
- package/dist/contexts/ComponentAdapter/useComponentContext.d.ts +2 -0
- package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
- package/dist/contexts/GustoProvider/GustoProvider.d.ts +2 -0
- package/dist/contexts/GustoProvider/GustoProvider.js +12 -11
- package/dist/contexts/GustoProvider/GustoProvider.js.map +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +24 -14
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/style.css +1 -1
- package/package.json +4 -4
|
@@ -1,75 +1,80 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { useTranslation as
|
|
4
|
-
import
|
|
1
|
+
import { jsx as e, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as I } from "react";
|
|
3
|
+
import { useTranslation as z } from "react-i18next";
|
|
4
|
+
import p from "classnames";
|
|
5
5
|
import i from "./PayrollReceiptsPresentation.module.scss.js";
|
|
6
|
-
import { Flex as
|
|
6
|
+
import { Flex as m } from "../../Common/Flex/Flex.js";
|
|
7
7
|
import "../../../shared/constants.js";
|
|
8
|
-
import { useComponentContext as
|
|
9
|
-
import { formatNumberAsCurrency as
|
|
10
|
-
import { useI18n as
|
|
11
|
-
import { useContainerBreakpoints as
|
|
12
|
-
import
|
|
13
|
-
import { DataTable as
|
|
14
|
-
import { DataView as
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
import { useComponentContext as M } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
9
|
+
import { formatNumberAsCurrency as a } from "../../../helpers/formattedStrings.js";
|
|
10
|
+
import { useI18n as $ } from "../../../i18n/I18n.js";
|
|
11
|
+
import { useContainerBreakpoints as A } from "../../../hooks/useContainerBreakpoints/useContainerBreakpoints.js";
|
|
12
|
+
import B from "../../../assets/icons/receipt-check.svg.js";
|
|
13
|
+
import { DataTable as y } from "../../Common/DataView/DataTable/DataTable.js";
|
|
14
|
+
import { DataView as f } from "../../Common/DataView/DataView.js";
|
|
15
|
+
const Z = ({
|
|
16
|
+
receiptData: o,
|
|
17
|
+
withReimbursements: u = !0
|
|
18
|
+
}) => {
|
|
19
|
+
const { Heading: b, Text: t } = M();
|
|
20
|
+
$("Payroll.PayrollReceipts");
|
|
21
|
+
const { t: l } = z("Payroll.PayrollReceipts"), h = I(null), d = !A({ ref: h }).includes("small"), g = (n) => `${n.employeeFirstName || ""} ${n.employeeLastName || ""}`.trim(), x = () => (o.employeeCompensations || []).reduce(
|
|
22
|
+
(n, s) => n + parseFloat(s.childSupportGarnishment || "0"),
|
|
20
23
|
0
|
|
21
|
-
),
|
|
22
|
-
(
|
|
24
|
+
), k = () => (o.employeeCompensations || []).reduce(
|
|
25
|
+
(n, s) => n + parseFloat(s.totalReimbursement || "0"),
|
|
23
26
|
0
|
|
24
|
-
),
|
|
25
|
-
(
|
|
27
|
+
), w = () => (o.employeeCompensations || []).reduce(
|
|
28
|
+
(n, s) => n + parseFloat(s.netPay || "0"),
|
|
26
29
|
0
|
|
27
|
-
),
|
|
28
|
-
(
|
|
30
|
+
), F = () => (o.employeeCompensations || []).reduce(
|
|
31
|
+
(n, s) => n + parseFloat(s.totalTax || "0"),
|
|
29
32
|
0
|
|
30
|
-
),
|
|
33
|
+
), v = [
|
|
31
34
|
{
|
|
32
|
-
label:
|
|
33
|
-
amount: parseFloat(
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
label: t("breakdown.reimbursements"),
|
|
37
|
-
amount: parseFloat(n.totals?.reimbursementDebit || "0")
|
|
35
|
+
label: l("breakdown.directDeposits"),
|
|
36
|
+
amount: parseFloat(o.totals?.netPayDebit || "0")
|
|
38
37
|
},
|
|
38
|
+
...u ? [
|
|
39
|
+
{
|
|
40
|
+
label: l("breakdown.reimbursements"),
|
|
41
|
+
amount: parseFloat(o.totals?.reimbursementDebit || "0")
|
|
42
|
+
}
|
|
43
|
+
] : [],
|
|
39
44
|
{
|
|
40
|
-
label:
|
|
41
|
-
amount: parseFloat(
|
|
45
|
+
label: l("breakdown.garnishments"),
|
|
46
|
+
amount: parseFloat(o.totals?.childSupportDebit || "0")
|
|
42
47
|
},
|
|
43
|
-
{ label:
|
|
44
|
-
],
|
|
48
|
+
{ label: l("breakdown.taxes"), amount: parseFloat(o.totals?.taxDebit || "0") }
|
|
49
|
+
], N = [
|
|
45
50
|
{
|
|
46
|
-
label:
|
|
47
|
-
value:
|
|
51
|
+
label: l("receipt.receiptId"),
|
|
52
|
+
value: o.payrollUuid || ""
|
|
48
53
|
},
|
|
49
54
|
{
|
|
50
|
-
label:
|
|
51
|
-
value:
|
|
55
|
+
label: l("receipt.from"),
|
|
56
|
+
value: o.nameOfSender || ""
|
|
52
57
|
},
|
|
53
58
|
{
|
|
54
|
-
label:
|
|
55
|
-
value:
|
|
59
|
+
label: l("receipt.to"),
|
|
60
|
+
value: o.nameOfRecipient || "Payroll Recipients"
|
|
56
61
|
},
|
|
57
62
|
{
|
|
58
|
-
label:
|
|
59
|
-
value:
|
|
63
|
+
label: l("receipt.debitDate"),
|
|
64
|
+
value: o.debitDate || ""
|
|
60
65
|
}
|
|
61
|
-
],
|
|
62
|
-
/* @__PURE__ */ m
|
|
63
|
-
/* @__PURE__ */ e("div", { className: i.receiptIcon, children: /* @__PURE__ */ e(
|
|
64
|
-
/* @__PURE__ */ m
|
|
65
|
-
/* @__PURE__ */ e(
|
|
66
|
-
/* @__PURE__ */ e(
|
|
66
|
+
], C = () => /* @__PURE__ */ e("div", { className: p(i.receiptHeader, d && i.receiptHeaderMobile), children: /* @__PURE__ */ c(m, { flexDirection: "column", gap: 24, children: [
|
|
67
|
+
/* @__PURE__ */ c(m, { flexDirection: "column", alignItems: "center", gap: 16, children: [
|
|
68
|
+
/* @__PURE__ */ e("div", { className: i.receiptIcon, children: /* @__PURE__ */ e(B, { className: i.checkmarkIcon }) }),
|
|
69
|
+
/* @__PURE__ */ c(m, { flexDirection: "column", alignItems: "center", gap: 8, children: [
|
|
70
|
+
/* @__PURE__ */ e(t, { size: "sm", variant: "supporting", children: l("receipt.totalLabel") }),
|
|
71
|
+
/* @__PURE__ */ e(b, { as: "h1", styledAs: "h2", className: i.totalAmount, children: a(parseFloat(o.totals?.companyDebit || "0")) })
|
|
67
72
|
] })
|
|
68
73
|
] }),
|
|
69
74
|
/* @__PURE__ */ e("div", { className: i.receiptDetailsTable, children: /* @__PURE__ */ e(
|
|
70
|
-
|
|
75
|
+
f,
|
|
71
76
|
{
|
|
72
|
-
label:
|
|
77
|
+
label: l("receipt.detailsLabel"),
|
|
73
78
|
variant: "minimal",
|
|
74
79
|
breakAt: "small",
|
|
75
80
|
breakpoints: {
|
|
@@ -79,142 +84,152 @@ const Q = ({ receiptData: n }) => {
|
|
|
79
84
|
columns: [
|
|
80
85
|
{
|
|
81
86
|
title: "",
|
|
82
|
-
render: (
|
|
87
|
+
render: (n) => /* @__PURE__ */ e(t, { size: "sm", variant: "supporting", children: n.label })
|
|
83
88
|
},
|
|
84
89
|
{
|
|
85
90
|
title: "",
|
|
86
|
-
render: (
|
|
91
|
+
render: (n) => /* @__PURE__ */ e(t, { size: "sm", children: n.value })
|
|
87
92
|
}
|
|
88
93
|
],
|
|
89
|
-
data:
|
|
94
|
+
data: N
|
|
90
95
|
}
|
|
91
96
|
) }),
|
|
92
|
-
/* @__PURE__ */ m
|
|
97
|
+
/* @__PURE__ */ c(m, { flexDirection: "column", alignItems: "center", gap: 12, children: [
|
|
93
98
|
/* @__PURE__ */ e(
|
|
94
|
-
|
|
99
|
+
t,
|
|
95
100
|
{
|
|
96
101
|
size: "sm",
|
|
97
102
|
variant: "supporting",
|
|
98
|
-
className:
|
|
99
|
-
children:
|
|
103
|
+
className: p(i.disclaimer, d && i.textMobile),
|
|
104
|
+
children: o.recipientNotice
|
|
100
105
|
}
|
|
101
106
|
),
|
|
102
107
|
/* @__PURE__ */ e(
|
|
103
|
-
|
|
108
|
+
t,
|
|
104
109
|
{
|
|
105
110
|
size: "sm",
|
|
106
111
|
variant: "supporting",
|
|
107
|
-
className:
|
|
108
|
-
children:
|
|
112
|
+
className: p(i.companyInfo, d && i.textMobile),
|
|
113
|
+
children: o.license
|
|
109
114
|
}
|
|
110
115
|
),
|
|
111
116
|
/* @__PURE__ */ e(
|
|
112
|
-
|
|
117
|
+
t,
|
|
113
118
|
{
|
|
114
119
|
size: "sm",
|
|
115
120
|
variant: "supporting",
|
|
116
|
-
className:
|
|
117
|
-
children:
|
|
121
|
+
className: p(i.address, d && i.textMobile),
|
|
122
|
+
children: o.licensee && `${o.licensee.address || ""}, ${o.licensee.city || ""}, ${o.licensee.state || ""} ${o.licensee.postalCode || ""}`
|
|
118
123
|
}
|
|
119
124
|
)
|
|
120
125
|
] })
|
|
121
|
-
] }) }),
|
|
122
|
-
|
|
126
|
+
] }) }), P = () => /* @__PURE__ */ e(m, { flexDirection: "column", gap: 16, children: /* @__PURE__ */ e(
|
|
127
|
+
y,
|
|
123
128
|
{
|
|
124
|
-
label:
|
|
129
|
+
label: l("sections.debitedLabel"),
|
|
125
130
|
columns: [
|
|
126
131
|
{
|
|
127
|
-
title:
|
|
128
|
-
render: (
|
|
132
|
+
title: l("sections.debitedLabel"),
|
|
133
|
+
render: (n) => /* @__PURE__ */ e(t, { children: n.label })
|
|
129
134
|
},
|
|
130
135
|
{
|
|
131
|
-
title:
|
|
132
|
-
render: (
|
|
136
|
+
title: l("breakdown.amount"),
|
|
137
|
+
render: (n) => /* @__PURE__ */ e(t, { children: a(n.amount) })
|
|
133
138
|
}
|
|
134
139
|
],
|
|
135
|
-
data:
|
|
140
|
+
data: v,
|
|
136
141
|
footer: () => ({
|
|
137
|
-
"column-0": /* @__PURE__ */ e(
|
|
138
|
-
"column-1": /* @__PURE__ */ e(
|
|
142
|
+
"column-0": /* @__PURE__ */ e(t, { weight: "semibold", children: l("breakdown.totals") }),
|
|
143
|
+
"column-1": /* @__PURE__ */ e(t, { weight: "semibold", children: a(parseFloat(o.totals?.companyDebit || "0")) })
|
|
139
144
|
})
|
|
140
145
|
}
|
|
141
|
-
) }),
|
|
142
|
-
|
|
146
|
+
) }), T = () => /* @__PURE__ */ e(m, { flexDirection: "column", gap: 16, children: /* @__PURE__ */ e(
|
|
147
|
+
y,
|
|
143
148
|
{
|
|
144
|
-
label:
|
|
149
|
+
label: l("sections.taxLabel"),
|
|
145
150
|
columns: [
|
|
146
151
|
{
|
|
147
|
-
title:
|
|
148
|
-
render: (
|
|
152
|
+
title: l("sections.taxLabel"),
|
|
153
|
+
render: (n) => /* @__PURE__ */ e(t, { children: n.name })
|
|
149
154
|
},
|
|
150
155
|
{
|
|
151
|
-
title:
|
|
152
|
-
render: (
|
|
156
|
+
title: l("tax.amount"),
|
|
157
|
+
render: (n) => /* @__PURE__ */ e(t, { children: a(parseFloat(n.amount || "0")) })
|
|
153
158
|
}
|
|
154
159
|
],
|
|
155
|
-
data:
|
|
160
|
+
data: o.taxes || [],
|
|
156
161
|
footer: () => ({
|
|
157
|
-
"column-0": /* @__PURE__ */ e(
|
|
158
|
-
"column-1": /* @__PURE__ */ e(
|
|
162
|
+
"column-0": /* @__PURE__ */ e(t, { weight: "semibold", children: l("breakdown.totals") }),
|
|
163
|
+
"column-1": /* @__PURE__ */ e(t, { weight: "semibold", children: a(parseFloat(o.totals?.taxDebit || "0")) })
|
|
159
164
|
})
|
|
160
165
|
}
|
|
161
|
-
) }),
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
166
|
+
) }), R = () => {
|
|
167
|
+
const s = [
|
|
168
|
+
/* @__PURE__ */ c(m, { flexDirection: "column", gap: 4, children: [
|
|
169
|
+
/* @__PURE__ */ e(t, { weight: "semibold", children: l("breakdown.totals") }),
|
|
170
|
+
/* @__PURE__ */ e(t, { size: "sm", variant: "supporting", children: l("employee.totalEmployees", {
|
|
171
|
+
count: o.employeeCompensations?.length || 0
|
|
172
|
+
}) })
|
|
173
|
+
] }, "totals"),
|
|
174
|
+
/* @__PURE__ */ e(t, { children: " " }, "spacer"),
|
|
175
|
+
/* @__PURE__ */ e(t, { weight: "semibold", children: a(x()) }, "childSupport"),
|
|
176
|
+
...u ? [
|
|
177
|
+
/* @__PURE__ */ e(t, { weight: "semibold", children: a(k()) }, "reimbursements")
|
|
178
|
+
] : [],
|
|
179
|
+
/* @__PURE__ */ e(t, { weight: "semibold", children: a(F()) }, "taxes"),
|
|
180
|
+
/* @__PURE__ */ e(t, { weight: "semibold", children: a(w()) }, "netPay")
|
|
181
|
+
].reduce(
|
|
182
|
+
(r, L, S) => (r[`column-${S}`] = L, r),
|
|
183
|
+
{}
|
|
184
|
+
);
|
|
185
|
+
return /* @__PURE__ */ c(m, { flexDirection: "column", gap: 16, children: [
|
|
186
|
+
d && /* @__PURE__ */ e(b, { as: "h2", children: l("sections.employeesLabel") }),
|
|
187
|
+
/* @__PURE__ */ e(
|
|
188
|
+
f,
|
|
189
|
+
{
|
|
190
|
+
label: l("sections.employeesLabel"),
|
|
191
|
+
columns: [
|
|
192
|
+
{
|
|
193
|
+
title: l("employee.name"),
|
|
194
|
+
render: (r) => /* @__PURE__ */ e(t, { children: g(r) })
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
title: l("employee.paymentMethod"),
|
|
198
|
+
render: (r) => /* @__PURE__ */ e(t, { children: r.paymentMethod || "N/A" })
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
title: l("employee.childSupport"),
|
|
202
|
+
render: (r) => /* @__PURE__ */ e(t, { children: a(parseFloat(r.childSupportGarnishment || "0")) })
|
|
203
|
+
},
|
|
204
|
+
...u ? [
|
|
205
|
+
{
|
|
206
|
+
title: l("employee.reimbursement"),
|
|
207
|
+
render: (r) => /* @__PURE__ */ e(t, { children: a(parseFloat(r.totalReimbursement || "0")) })
|
|
208
|
+
}
|
|
209
|
+
] : [],
|
|
210
|
+
{
|
|
211
|
+
title: l("employee.totalTaxes"),
|
|
212
|
+
render: (r) => /* @__PURE__ */ e(t, { children: a(parseFloat(r.totalTax || "0")) })
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
title: l("employee.netPay"),
|
|
216
|
+
render: (r) => /* @__PURE__ */ e(t, { children: a(parseFloat(r.netPay || "0")) })
|
|
217
|
+
}
|
|
218
|
+
],
|
|
219
|
+
data: o.employeeCompensations || [],
|
|
220
|
+
footer: () => s
|
|
221
|
+
}
|
|
222
|
+
)
|
|
223
|
+
] });
|
|
224
|
+
};
|
|
225
|
+
return /* @__PURE__ */ e("div", { className: i.container, ref: h, children: /* @__PURE__ */ c(m, { flexDirection: "column", gap: 24, children: [
|
|
213
226
|
C(),
|
|
214
|
-
|
|
227
|
+
P(),
|
|
228
|
+
T(),
|
|
229
|
+
R()
|
|
215
230
|
] }) });
|
|
216
231
|
};
|
|
217
232
|
export {
|
|
218
|
-
|
|
233
|
+
Z as PayrollReceiptsPresentation
|
|
219
234
|
};
|
|
220
235
|
//# sourceMappingURL=PayrollReceiptsPresentation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayrollReceiptsPresentation.js","sources":["../../../../src/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.tsx"],"sourcesContent":["import { useRef } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport classNames from 'classnames'\nimport type {\n PayrollReceipt,\n Taxes as TaxBreakdownItem,\n PayrollReceiptEmployeeCompensations as EmployeeBreakdownItem,\n} from '@gusto/embedded-api/models/components/payrollreceipt'\nimport styles from './PayrollReceiptsPresentation.module.scss'\nimport { DataView, DataTable, Flex } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { formatNumberAsCurrency } from '@/helpers/formattedStrings'\nimport { useI18n } from '@/i18n'\nimport { useContainerBreakpoints } from '@/hooks/useContainerBreakpoints/useContainerBreakpoints'\nimport ReceiptCheck from '@/assets/icons/receipt-check.svg?react'\n\ninterface PayrollReceiptsPresentationProps {\n receiptData: PayrollReceipt\n}\n\nexport const PayrollReceiptsPresentation = ({ receiptData }: PayrollReceiptsPresentationProps) => {\n const { Heading, Text } = useComponentContext()\n useI18n('Payroll.PayrollReceipts')\n const { t } = useTranslation('Payroll.PayrollReceipts')\n\n const containerRef = useRef<HTMLDivElement>(null)\n const breakpoints = useContainerBreakpoints({ ref: containerRef })\n const isMobile = !breakpoints.includes('small')\n\n // Helper to get employee full name\n const getEmployeeFullName = (emp: EmployeeBreakdownItem) =>\n `${emp.employeeFirstName || ''} ${emp.employeeLastName || ''}`.trim()\n\n const getTotalChildSupport = () =>\n (receiptData.employeeCompensations || []).reduce(\n (sum, emp) => sum + parseFloat(emp.childSupportGarnishment || '0'),\n 0,\n )\n\n const getTotalReimbursements = () =>\n (receiptData.employeeCompensations || []).reduce(\n (sum, emp) => sum + parseFloat(emp.totalReimbursement || '0'),\n 0,\n )\n\n const getTotalNetPay = () =>\n (receiptData.employeeCompensations || []).reduce(\n (sum, emp) => sum + parseFloat(emp.netPay || '0'),\n 0,\n )\n\n const getTotalTaxes = () =>\n (receiptData.employeeCompensations || []).reduce(\n (sum, emp) => sum + parseFloat(emp.totalTax || '0'),\n 0,\n )\n\n const breakdownData = [\n {\n label: t('breakdown.directDeposits'),\n amount: parseFloat(receiptData.totals?.netPayDebit || '0'),\n },\n {\n label: t('breakdown.reimbursements'),\n amount: parseFloat(receiptData.totals?.reimbursementDebit || '0'),\n },\n {\n label: t('breakdown.garnishments'),\n amount: parseFloat(receiptData.totals?.childSupportDebit || '0'),\n },\n { label: t('breakdown.taxes'), amount: parseFloat(receiptData.totals?.taxDebit || '0') },\n ]\n\n const receiptDetailsConfig = [\n {\n label: t('receipt.receiptId'),\n value: receiptData.payrollUuid || '',\n },\n {\n label: t('receipt.from'),\n value: receiptData.nameOfSender || '',\n },\n {\n label: t('receipt.to'),\n value: receiptData.nameOfRecipient || 'Payroll Recipients',\n },\n {\n label: t('receipt.debitDate'),\n value: receiptData.debitDate || '',\n },\n ]\n\n const renderReceiptHeader = () => (\n <div className={classNames(styles.receiptHeader, isMobile && styles.receiptHeaderMobile)}>\n <Flex flexDirection=\"column\" gap={24}>\n <Flex flexDirection=\"column\" alignItems=\"center\" gap={16}>\n <div className={styles.receiptIcon}>\n <ReceiptCheck className={styles.checkmarkIcon} />\n </div>\n\n <Flex flexDirection=\"column\" alignItems=\"center\" gap={8}>\n <Text size=\"sm\" variant=\"supporting\">\n {t('receipt.totalLabel')}\n </Text>\n <Heading as=\"h1\" styledAs=\"h2\" className={styles.totalAmount}>\n {formatNumberAsCurrency(parseFloat(receiptData.totals?.companyDebit || '0'))}\n </Heading>\n </Flex>\n </Flex>\n\n <div className={styles.receiptDetailsTable}>\n <DataView\n label={t('receipt.detailsLabel')}\n variant=\"minimal\"\n breakAt=\"small\"\n breakpoints={{\n base: '0rem',\n small: '22rem',\n }}\n columns={[\n {\n title: '',\n render: (item: { label: string; value: string }) => (\n <Text size=\"sm\" variant=\"supporting\">\n {item.label}\n </Text>\n ),\n },\n {\n title: '',\n render: (item: { label: string; value: string }) => (\n <Text size=\"sm\">{item.value}</Text>\n ),\n },\n ]}\n data={receiptDetailsConfig}\n />\n </div>\n\n <Flex flexDirection=\"column\" alignItems=\"center\" gap={12}>\n <Text\n size=\"sm\"\n variant=\"supporting\"\n className={classNames(styles.disclaimer, isMobile && styles.textMobile)}\n >\n {receiptData.recipientNotice}\n </Text>\n\n <Text\n size=\"sm\"\n variant=\"supporting\"\n className={classNames(styles.companyInfo, isMobile && styles.textMobile)}\n >\n {receiptData.license}\n </Text>\n\n <Text\n size=\"sm\"\n variant=\"supporting\"\n className={classNames(styles.address, isMobile && styles.textMobile)}\n >\n {receiptData.licensee &&\n `${receiptData.licensee.address || ''}, ${receiptData.licensee.city || ''}, ${receiptData.licensee.state || ''} ${receiptData.licensee.postalCode || ''}`}\n </Text>\n </Flex>\n </Flex>\n </div>\n )\n\n const renderBreakdownSection = () => (\n <Flex flexDirection=\"column\" gap={16}>\n <DataTable\n label={t('sections.debitedLabel')}\n columns={[\n {\n title: t('sections.debitedLabel'),\n render: (item: { label: string; amount: number }) => <Text>{item.label}</Text>,\n },\n {\n title: t('breakdown.amount'),\n render: (item: { label: string; amount: number }) => (\n <Text>{formatNumberAsCurrency(item.amount)}</Text>\n ),\n },\n ]}\n data={breakdownData}\n footer={() => ({\n 'column-0': <Text weight=\"semibold\">{t('breakdown.totals')}</Text>,\n 'column-1': (\n <Text weight=\"semibold\">\n {formatNumberAsCurrency(parseFloat(receiptData.totals?.companyDebit || '0'))}\n </Text>\n ),\n })}\n />\n </Flex>\n )\n\n const renderTaxBreakdown = () => (\n <Flex flexDirection=\"column\" gap={16}>\n <DataTable\n label={t('sections.taxLabel')}\n columns={[\n {\n title: t('sections.taxLabel'),\n render: (tax: TaxBreakdownItem) => <Text>{tax.name}</Text>,\n },\n {\n title: t('tax.amount'),\n render: (tax: TaxBreakdownItem) => (\n <Text>{formatNumberAsCurrency(parseFloat(tax.amount || '0'))}</Text>\n ),\n },\n ]}\n data={receiptData.taxes || []}\n footer={() => ({\n 'column-0': <Text weight=\"semibold\">{t('breakdown.totals')}</Text>,\n 'column-1': (\n <Text weight=\"semibold\">\n {formatNumberAsCurrency(parseFloat(receiptData.totals?.taxDebit || '0'))}\n </Text>\n ),\n })}\n />\n </Flex>\n )\n\n const renderEmployeeBreakdown = () => (\n <Flex flexDirection=\"column\" gap={16}>\n {isMobile && <Heading as=\"h2\">{t('sections.employeesLabel')}</Heading>}\n <DataView\n label={t('sections.employeesLabel')}\n columns={[\n {\n title: t('employee.name'),\n render: (employee: EmployeeBreakdownItem) => (\n <Text>{getEmployeeFullName(employee)}</Text>\n ),\n },\n {\n title: t('employee.paymentMethod'),\n render: (employee: EmployeeBreakdownItem) => (\n <Text>{employee.paymentMethod || 'N/A'}</Text>\n ),\n },\n {\n title: t('employee.childSupport'),\n render: (employee: EmployeeBreakdownItem) => (\n <Text>\n {formatNumberAsCurrency(parseFloat(employee.childSupportGarnishment || '0'))}\n </Text>\n ),\n },\n {\n title: t('employee.reimbursement'),\n render: (employee: EmployeeBreakdownItem) => (\n <Text>{formatNumberAsCurrency(parseFloat(employee.totalReimbursement || '0'))}</Text>\n ),\n },\n {\n title: t('employee.totalTaxes'),\n render: (employee: EmployeeBreakdownItem) => (\n <Text>{formatNumberAsCurrency(parseFloat(employee.totalTax || '0'))}</Text>\n ),\n },\n {\n title: t('employee.netPay'),\n render: (employee: EmployeeBreakdownItem) => (\n <Text>{formatNumberAsCurrency(parseFloat(employee.netPay || '0'))}</Text>\n ),\n },\n ]}\n data={receiptData.employeeCompensations || []}\n footer={() => ({\n 'column-0': (\n <Flex flexDirection=\"column\" gap={4}>\n <Text weight=\"semibold\">{t('breakdown.totals')}</Text>\n <Text size=\"sm\" variant=\"supporting\">\n {t('employee.totalEmployees', {\n count: receiptData.employeeCompensations?.length || 0,\n })}\n </Text>\n </Flex>\n ),\n 'column-1': <Text>{'\\u00A0'}</Text>,\n 'column-2': (\n <Text weight=\"semibold\">{formatNumberAsCurrency(getTotalChildSupport())}</Text>\n ),\n 'column-3': (\n <Text weight=\"semibold\">{formatNumberAsCurrency(getTotalReimbursements())}</Text>\n ),\n 'column-4': <Text weight=\"semibold\">{formatNumberAsCurrency(getTotalTaxes())}</Text>,\n 'column-5': <Text weight=\"semibold\">{formatNumberAsCurrency(getTotalNetPay())}</Text>,\n })}\n />\n </Flex>\n )\n\n return (\n <div className={styles.container} ref={containerRef}>\n <Flex flexDirection=\"column\" gap={24}>\n {renderReceiptHeader()}\n {renderBreakdownSection()}\n {renderTaxBreakdown()}\n {renderEmployeeBreakdown()}\n </Flex>\n </div>\n )\n}\n"],"names":["PayrollReceiptsPresentation","receiptData","Heading","Text","useComponentContext","useI18n","useTranslation","containerRef","useRef","isMobile","useContainerBreakpoints","getEmployeeFullName","emp","getTotalChildSupport","sum","getTotalReimbursements","getTotalNetPay","getTotalTaxes","breakdownData","receiptDetailsConfig","renderReceiptHeader","jsx","classNames","styles","jsxs","Flex","ReceiptCheck","formatNumberAsCurrency","DataView","item","renderBreakdownSection","DataTable","renderTaxBreakdown","tax","renderEmployeeBreakdown","employee"],"mappings":";;;;;;;;;;;;;;AAoBO,MAAMA,IAA8B,CAAC,EAAE,aAAAC,QAAoD;AAChG,QAAM,EAAE,SAAAC,GAAS,MAAAC,EAAA,IAASC,EAAA;AAC1B,EAAAC,EAAQ,yBAAyB;AACjC,QAAM,EAAE,EAAA,IAAMC,EAAe,yBAAyB,GAEhDC,IAAeC,EAAuB,IAAI,GAE1CC,IAAW,CADGC,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AU,EAAA;AAAA,IACAE,EAAA;AAAA,IACAE,EAAA;AAAA,EAAwB,EAAA,CAC3B,EAAA,CACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"PayrollReceiptsPresentation.js","sources":["../../../../src/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.tsx"],"sourcesContent":["import { useRef } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport classNames from 'classnames'\nimport type {\n PayrollReceipt,\n Taxes as TaxBreakdownItem,\n PayrollReceiptEmployeeCompensations as EmployeeBreakdownItem,\n} from '@gusto/embedded-api/models/components/payrollreceipt'\nimport styles from './PayrollReceiptsPresentation.module.scss'\nimport { DataView, DataTable, Flex } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { formatNumberAsCurrency } from '@/helpers/formattedStrings'\nimport { useI18n } from '@/i18n'\nimport { useContainerBreakpoints } from '@/hooks/useContainerBreakpoints/useContainerBreakpoints'\nimport ReceiptCheck from '@/assets/icons/receipt-check.svg?react'\n\ninterface PayrollReceiptsPresentationProps {\n receiptData: PayrollReceipt\n withReimbursements?: boolean\n}\n\nexport const PayrollReceiptsPresentation = ({\n receiptData,\n withReimbursements = true,\n}: PayrollReceiptsPresentationProps) => {\n const { Heading, Text } = useComponentContext()\n useI18n('Payroll.PayrollReceipts')\n const { t } = useTranslation('Payroll.PayrollReceipts')\n\n const containerRef = useRef<HTMLDivElement>(null)\n const breakpoints = useContainerBreakpoints({ ref: containerRef })\n const isMobile = !breakpoints.includes('small')\n\n // Helper to get employee full name\n const getEmployeeFullName = (emp: EmployeeBreakdownItem) =>\n `${emp.employeeFirstName || ''} ${emp.employeeLastName || ''}`.trim()\n\n const getTotalChildSupport = () =>\n (receiptData.employeeCompensations || []).reduce(\n (sum, emp) => sum + parseFloat(emp.childSupportGarnishment || '0'),\n 0,\n )\n\n const getTotalReimbursements = () =>\n (receiptData.employeeCompensations || []).reduce(\n (sum, emp) => sum + parseFloat(emp.totalReimbursement || '0'),\n 0,\n )\n\n const getTotalNetPay = () =>\n (receiptData.employeeCompensations || []).reduce(\n (sum, emp) => sum + parseFloat(emp.netPay || '0'),\n 0,\n )\n\n const getTotalTaxes = () =>\n (receiptData.employeeCompensations || []).reduce(\n (sum, emp) => sum + parseFloat(emp.totalTax || '0'),\n 0,\n )\n\n const breakdownData = [\n {\n label: t('breakdown.directDeposits'),\n amount: parseFloat(receiptData.totals?.netPayDebit || '0'),\n },\n ...(withReimbursements\n ? [\n {\n label: t('breakdown.reimbursements'),\n amount: parseFloat(receiptData.totals?.reimbursementDebit || '0'),\n },\n ]\n : []),\n {\n label: t('breakdown.garnishments'),\n amount: parseFloat(receiptData.totals?.childSupportDebit || '0'),\n },\n { label: t('breakdown.taxes'), amount: parseFloat(receiptData.totals?.taxDebit || '0') },\n ]\n\n const receiptDetailsConfig = [\n {\n label: t('receipt.receiptId'),\n value: receiptData.payrollUuid || '',\n },\n {\n label: t('receipt.from'),\n value: receiptData.nameOfSender || '',\n },\n {\n label: t('receipt.to'),\n value: receiptData.nameOfRecipient || 'Payroll Recipients',\n },\n {\n label: t('receipt.debitDate'),\n value: receiptData.debitDate || '',\n },\n ]\n\n const renderReceiptHeader = () => (\n <div className={classNames(styles.receiptHeader, isMobile && styles.receiptHeaderMobile)}>\n <Flex flexDirection=\"column\" gap={24}>\n <Flex flexDirection=\"column\" alignItems=\"center\" gap={16}>\n <div className={styles.receiptIcon}>\n <ReceiptCheck className={styles.checkmarkIcon} />\n </div>\n\n <Flex flexDirection=\"column\" alignItems=\"center\" gap={8}>\n <Text size=\"sm\" variant=\"supporting\">\n {t('receipt.totalLabel')}\n </Text>\n <Heading as=\"h1\" styledAs=\"h2\" className={styles.totalAmount}>\n {formatNumberAsCurrency(parseFloat(receiptData.totals?.companyDebit || '0'))}\n </Heading>\n </Flex>\n </Flex>\n\n <div className={styles.receiptDetailsTable}>\n <DataView\n label={t('receipt.detailsLabel')}\n variant=\"minimal\"\n breakAt=\"small\"\n breakpoints={{\n base: '0rem',\n small: '22rem',\n }}\n columns={[\n {\n title: '',\n render: (item: { label: string; value: string }) => (\n <Text size=\"sm\" variant=\"supporting\">\n {item.label}\n </Text>\n ),\n },\n {\n title: '',\n render: (item: { label: string; value: string }) => (\n <Text size=\"sm\">{item.value}</Text>\n ),\n },\n ]}\n data={receiptDetailsConfig}\n />\n </div>\n\n <Flex flexDirection=\"column\" alignItems=\"center\" gap={12}>\n <Text\n size=\"sm\"\n variant=\"supporting\"\n className={classNames(styles.disclaimer, isMobile && styles.textMobile)}\n >\n {receiptData.recipientNotice}\n </Text>\n\n <Text\n size=\"sm\"\n variant=\"supporting\"\n className={classNames(styles.companyInfo, isMobile && styles.textMobile)}\n >\n {receiptData.license}\n </Text>\n\n <Text\n size=\"sm\"\n variant=\"supporting\"\n className={classNames(styles.address, isMobile && styles.textMobile)}\n >\n {receiptData.licensee &&\n `${receiptData.licensee.address || ''}, ${receiptData.licensee.city || ''}, ${receiptData.licensee.state || ''} ${receiptData.licensee.postalCode || ''}`}\n </Text>\n </Flex>\n </Flex>\n </div>\n )\n\n const renderBreakdownSection = () => (\n <Flex flexDirection=\"column\" gap={16}>\n <DataTable\n label={t('sections.debitedLabel')}\n columns={[\n {\n title: t('sections.debitedLabel'),\n render: (item: { label: string; amount: number }) => <Text>{item.label}</Text>,\n },\n {\n title: t('breakdown.amount'),\n render: (item: { label: string; amount: number }) => (\n <Text>{formatNumberAsCurrency(item.amount)}</Text>\n ),\n },\n ]}\n data={breakdownData}\n footer={() => ({\n 'column-0': <Text weight=\"semibold\">{t('breakdown.totals')}</Text>,\n 'column-1': (\n <Text weight=\"semibold\">\n {formatNumberAsCurrency(parseFloat(receiptData.totals?.companyDebit || '0'))}\n </Text>\n ),\n })}\n />\n </Flex>\n )\n\n const renderTaxBreakdown = () => (\n <Flex flexDirection=\"column\" gap={16}>\n <DataTable\n label={t('sections.taxLabel')}\n columns={[\n {\n title: t('sections.taxLabel'),\n render: (tax: TaxBreakdownItem) => <Text>{tax.name}</Text>,\n },\n {\n title: t('tax.amount'),\n render: (tax: TaxBreakdownItem) => (\n <Text>{formatNumberAsCurrency(parseFloat(tax.amount || '0'))}</Text>\n ),\n },\n ]}\n data={receiptData.taxes || []}\n footer={() => ({\n 'column-0': <Text weight=\"semibold\">{t('breakdown.totals')}</Text>,\n 'column-1': (\n <Text weight=\"semibold\">\n {formatNumberAsCurrency(parseFloat(receiptData.totals?.taxDebit || '0'))}\n </Text>\n ),\n })}\n />\n </Flex>\n )\n\n const renderEmployeeBreakdown = () => {\n const footerValues = [\n <Flex flexDirection=\"column\" gap={4} key=\"totals\">\n <Text weight=\"semibold\">{t('breakdown.totals')}</Text>\n <Text size=\"sm\" variant=\"supporting\">\n {t('employee.totalEmployees', {\n count: receiptData.employeeCompensations?.length || 0,\n })}\n </Text>\n </Flex>,\n <Text key=\"spacer\">{'\\u00A0'}</Text>,\n <Text weight=\"semibold\" key=\"childSupport\">\n {formatNumberAsCurrency(getTotalChildSupport())}\n </Text>,\n ...(withReimbursements\n ? [\n <Text weight=\"semibold\" key=\"reimbursements\">\n {formatNumberAsCurrency(getTotalReimbursements())}\n </Text>,\n ]\n : []),\n <Text weight=\"semibold\" key=\"taxes\">\n {formatNumberAsCurrency(getTotalTaxes())}\n </Text>,\n <Text weight=\"semibold\" key=\"netPay\">\n {formatNumberAsCurrency(getTotalNetPay())}\n </Text>,\n ]\n\n const footerContent = footerValues.reduce<Record<string, React.ReactNode>>(\n (acc, value, index) => {\n acc[`column-${index}`] = value\n return acc\n },\n {},\n )\n\n return (\n <Flex flexDirection=\"column\" gap={16}>\n {isMobile && <Heading as=\"h2\">{t('sections.employeesLabel')}</Heading>}\n <DataView\n label={t('sections.employeesLabel')}\n columns={[\n {\n title: t('employee.name'),\n render: (employee: EmployeeBreakdownItem) => (\n <Text>{getEmployeeFullName(employee)}</Text>\n ),\n },\n {\n title: t('employee.paymentMethod'),\n render: (employee: EmployeeBreakdownItem) => (\n <Text>{employee.paymentMethod || 'N/A'}</Text>\n ),\n },\n {\n title: t('employee.childSupport'),\n render: (employee: EmployeeBreakdownItem) => (\n <Text>\n {formatNumberAsCurrency(parseFloat(employee.childSupportGarnishment || '0'))}\n </Text>\n ),\n },\n ...(withReimbursements\n ? [\n {\n title: t('employee.reimbursement'),\n render: (employee: EmployeeBreakdownItem) => (\n <Text>\n {formatNumberAsCurrency(parseFloat(employee.totalReimbursement || '0'))}\n </Text>\n ),\n },\n ]\n : []),\n {\n title: t('employee.totalTaxes'),\n render: (employee: EmployeeBreakdownItem) => (\n <Text>{formatNumberAsCurrency(parseFloat(employee.totalTax || '0'))}</Text>\n ),\n },\n {\n title: t('employee.netPay'),\n render: (employee: EmployeeBreakdownItem) => (\n <Text>{formatNumberAsCurrency(parseFloat(employee.netPay || '0'))}</Text>\n ),\n },\n ]}\n data={receiptData.employeeCompensations || []}\n footer={() => footerContent}\n />\n </Flex>\n )\n }\n\n return (\n <div className={styles.container} ref={containerRef}>\n <Flex flexDirection=\"column\" gap={24}>\n {renderReceiptHeader()}\n {renderBreakdownSection()}\n {renderTaxBreakdown()}\n {renderEmployeeBreakdown()}\n </Flex>\n </div>\n )\n}\n"],"names":["PayrollReceiptsPresentation","receiptData","withReimbursements","Heading","Text","useComponentContext","useI18n","t","useTranslation","containerRef","useRef","isMobile","useContainerBreakpoints","getEmployeeFullName","emp","getTotalChildSupport","sum","getTotalReimbursements","getTotalNetPay","getTotalTaxes","breakdownData","receiptDetailsConfig","renderReceiptHeader","jsx","classNames","styles","jsxs","Flex","ReceiptCheck","formatNumberAsCurrency","DataView","item","renderBreakdownSection","DataTable","renderTaxBreakdown","tax","renderEmployeeBreakdown","footerContent","acc","value","index","employee"],"mappings":";;;;;;;;;;;;;;AAqBO,MAAMA,IAA8B,CAAC;AAAA,EAC1C,aAAAC;AAAA,EACA,oBAAAC,IAAqB;AACvB,MAAwC;AACtC,QAAM,EAAE,SAAAC,GAAS,MAAAC,EAAA,IAASC,EAAA;AAC1B,EAAAC,EAAQ,y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AAOlC,EAAE,iBAAiB;AAAA,cAC1B,QAAQ,CAACkC,MACP,gBAAAlB,EAACnB,GAAA,EAAM,UAAAyB,EAAuB,WAAWY,EAAS,UAAU,GAAG,CAAC,EAAA,CAAE;AAAA,YAAA;AAAA,UAEtE;AAAA,UAEF,MAAMxC,EAAY,yBAAyB,CAAA;AAAA,UAC3C,QAAQ,MAAMoC;AAAA,QAAA;AAAA,MAAA;AAAA,IAChB,GACF;AAAA,EAEJ;AAEA,SACE,gBAAAd,EAAC,OAAA,EAAI,WAAWE,EAAO,WAAW,KAAKhB,GACrC,UAAA,gBAAAiB,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAC/B,UAAA;AAAA,IAAAL,EAAA;AAAA,IACAU,EAAA;AAAA,IACAE,EAAA;AAAA,IACAE,EAAA;AAAA,EAAwB,EAAA,CAC3B,EAAA,CACF;AAEJ;"}
|
|
@@ -8,4 +8,5 @@ export { PayrollOverview } from './PayrollOverview/PayrollOverview';
|
|
|
8
8
|
export { PayrollFlow } from './PayrollFlow/PayrollFlow';
|
|
9
9
|
export { PayrollReceipts } from './PayrollReceipts/PayrollReceipts';
|
|
10
10
|
export { ConfirmWireDetails } from './ConfirmWireDetails/ConfirmWireDetails';
|
|
11
|
+
export type { ConfirmWireDetailsProps, ConfirmWireDetailsComponentType } from './ConfirmWireDetails';
|
|
11
12
|
export { PayrollBlocker, type ApiPayrollBlocker } from './PayrollBlocker';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState as
|
|
1
|
+
import { useState as y, useCallback as m, useEffect as S } from "react";
|
|
2
2
|
import { usePayrollsPrepareMutation as h } from "@gusto/embedded-api/react-query/payrollsPrepare";
|
|
3
3
|
import { usePaySchedulesGet as f } from "@gusto/embedded-api/react-query/paySchedulesGet";
|
|
4
4
|
import "react/jsx-runtime";
|
|
@@ -11,15 +11,14 @@ import { useBase as b } from "../Base/useBase.js";
|
|
|
11
11
|
import "../../shared/constants.js";
|
|
12
12
|
import "classnames";
|
|
13
13
|
import "../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
|
-
import "../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
15
14
|
import "dompurify";
|
|
16
|
-
const
|
|
15
|
+
const H = ({
|
|
17
16
|
companyId: e,
|
|
18
17
|
payrollId: t,
|
|
19
18
|
employeeUuids: o,
|
|
20
19
|
sortBy: s
|
|
21
20
|
}) => {
|
|
22
|
-
const { mutateAsync: i, isPending: l } = h(), [r, d] =
|
|
21
|
+
const { mutateAsync: i, isPending: l } = h(), [r, d] = y(), { baseSubmitHandler: p } = b(), { data: u, isLoading: n } = f(
|
|
23
22
|
{
|
|
24
23
|
companyId: e,
|
|
25
24
|
payScheduleId: r?.payPeriod?.payScheduleUuid || ""
|
|
@@ -27,7 +26,7 @@ const M = ({
|
|
|
27
26
|
{
|
|
28
27
|
enabled: !!r?.payPeriod?.payScheduleUuid
|
|
29
28
|
}
|
|
30
|
-
), a =
|
|
29
|
+
), a = m(async () => {
|
|
31
30
|
await p(null, async () => {
|
|
32
31
|
const P = await i({
|
|
33
32
|
request: {
|
|
@@ -54,6 +53,6 @@ const M = ({
|
|
|
54
53
|
};
|
|
55
54
|
};
|
|
56
55
|
export {
|
|
57
|
-
|
|
56
|
+
H as usePreparedPayrollData
|
|
58
57
|
};
|
|
59
58
|
//# sourceMappingURL=usePreparedPayrollData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePreparedPayrollData.js","sources":["../../../src/components/Payroll/usePreparedPayrollData.ts"],"sourcesContent":["import { useState, useEffect, useCallback } from 'react'\nimport { usePayrollsPrepareMutation } from '@gusto/embedded-api/react-query/payrollsPrepare'\nimport { usePaySchedulesGet } from '@gusto/embedded-api/react-query/paySchedulesGet'\nimport type { PayrollPrepared } from '@gusto/embedded-api/models/components/payrollprepared'\nimport type { PayScheduleObject } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport type { PayrollPrepareSortBy } from '@gusto/embedded-api/models/components/payrollpreparesortby'\nimport { useBase } from '../Base'\n\ninterface UsePreparedPayrollDataParams {\n companyId: string\n payrollId: string\n employeeUuids?: string[]\n sortBy?: PayrollPrepareSortBy\n}\n\ninterface UsePreparedPayrollDataReturn {\n handlePreparePayroll: () => Promise<void>\n preparedPayroll: PayrollPrepared | undefined\n paySchedule: PayScheduleObject | undefined\n isLoading: boolean\n}\n\nexport const usePreparedPayrollData = ({\n companyId,\n payrollId,\n employeeUuids,\n sortBy,\n}: UsePreparedPayrollDataParams): UsePreparedPayrollDataReturn => {\n const { mutateAsync: preparePayroll, isPending: isPreparePayrollPending } =\n usePayrollsPrepareMutation()\n const [preparedPayroll, setPreparedPayroll] = useState<PayrollPrepared | undefined>()\n const { baseSubmitHandler } = useBase()\n\n const { data: payScheduleData, isLoading: isPayScheduleLoading } = usePaySchedulesGet(\n {\n companyId,\n payScheduleId: preparedPayroll?.payPeriod?.payScheduleUuid || '',\n },\n {\n enabled: !!preparedPayroll?.payPeriod?.payScheduleUuid,\n },\n )\n\n const handlePreparePayroll = useCallback(async () => {\n await baseSubmitHandler(null, async () => {\n const result = await preparePayroll({\n request: {\n companyId,\n payrollId,\n sortBy,\n requestBody: {\n employeeUuids,\n },\n },\n })\n setPreparedPayroll(result.payrollPrepared)\n })\n }, [companyId, payrollId, preparePayroll, employeeUuids, baseSubmitHandler])\n\n useEffect(() => {\n void handlePreparePayroll()\n }, [handlePreparePayroll])\n\n const isLoading = isPreparePayrollPending || isPayScheduleLoading\n\n return {\n handlePreparePayroll,\n preparedPayroll,\n paySchedule: payScheduleData?.payScheduleObject,\n isLoading,\n }\n}\n"],"names":["usePreparedPayrollData","companyId","payrollId","employeeUuids","sortBy","preparePayroll","isPreparePayrollPending","usePayrollsPrepareMutation","preparedPayroll","setPreparedPayroll","useState","baseSubmitHandler","useBase","payScheduleData","isPayScheduleLoading","usePaySchedulesGet","handlePreparePayroll","useCallback","result","useEffect","isLoading"],"mappings":"
|
|
1
|
+
{"version":3,"file":"usePreparedPayrollData.js","sources":["../../../src/components/Payroll/usePreparedPayrollData.ts"],"sourcesContent":["import { useState, useEffect, useCallback } from 'react'\nimport { usePayrollsPrepareMutation } from '@gusto/embedded-api/react-query/payrollsPrepare'\nimport { usePaySchedulesGet } from '@gusto/embedded-api/react-query/paySchedulesGet'\nimport type { PayrollPrepared } from '@gusto/embedded-api/models/components/payrollprepared'\nimport type { PayScheduleObject } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport type { PayrollPrepareSortBy } from '@gusto/embedded-api/models/components/payrollpreparesortby'\nimport { useBase } from '../Base'\n\ninterface UsePreparedPayrollDataParams {\n companyId: string\n payrollId: string\n employeeUuids?: string[]\n sortBy?: PayrollPrepareSortBy\n}\n\ninterface UsePreparedPayrollDataReturn {\n handlePreparePayroll: () => Promise<void>\n preparedPayroll: PayrollPrepared | undefined\n paySchedule: PayScheduleObject | undefined\n isLoading: boolean\n}\n\nexport const usePreparedPayrollData = ({\n companyId,\n payrollId,\n employeeUuids,\n sortBy,\n}: UsePreparedPayrollDataParams): UsePreparedPayrollDataReturn => {\n const { mutateAsync: preparePayroll, isPending: isPreparePayrollPending } =\n usePayrollsPrepareMutation()\n const [preparedPayroll, setPreparedPayroll] = useState<PayrollPrepared | undefined>()\n const { baseSubmitHandler } = useBase()\n\n const { data: payScheduleData, isLoading: isPayScheduleLoading } = usePaySchedulesGet(\n {\n companyId,\n payScheduleId: preparedPayroll?.payPeriod?.payScheduleUuid || '',\n },\n {\n enabled: !!preparedPayroll?.payPeriod?.payScheduleUuid,\n },\n )\n\n const handlePreparePayroll = useCallback(async () => {\n await baseSubmitHandler(null, async () => {\n const result = await preparePayroll({\n request: {\n companyId,\n payrollId,\n sortBy,\n requestBody: {\n employeeUuids,\n },\n },\n })\n setPreparedPayroll(result.payrollPrepared)\n })\n }, [companyId, payrollId, preparePayroll, employeeUuids, baseSubmitHandler])\n\n useEffect(() => {\n void handlePreparePayroll()\n }, [handlePreparePayroll])\n\n const isLoading = isPreparePayrollPending || isPayScheduleLoading\n\n return {\n handlePreparePayroll,\n preparedPayroll,\n paySchedule: payScheduleData?.payScheduleObject,\n isLoading,\n }\n}\n"],"names":["usePreparedPayrollData","companyId","payrollId","employeeUuids","sortBy","preparePayroll","isPreparePayrollPending","usePayrollsPrepareMutation","preparedPayroll","setPreparedPayroll","useState","baseSubmitHandler","useBase","payScheduleData","isPayScheduleLoading","usePaySchedulesGet","handlePreparePayroll","useCallback","result","useEffect","isLoading"],"mappings":";;;;;;;;;;;;;;AAsBO,MAAMA,IAAyB,CAAC;AAAA,EACrC,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,QAAAC;AACF,MAAkE;AAChE,QAAM,EAAE,aAAaC,GAAgB,WAAWC,EAAA,IAC9CC,EAAA,GACI,CAACC,GAAiBC,CAAkB,IAAIC,EAAA,GACxC,EAAE,mBAAAC,EAAA,IAAsBC,EAAA,GAExB,EAAE,MAAMC,GAAiB,WAAWC,MAAyBC;AAAA,IACjE;AAAA,MACE,WAAAd;AAAA,MACA,eAAeO,GAAiB,WAAW,mBAAmB;AAAA,IAAA;AAAA,IAEhE;AAAA,MACE,SAAS,CAAC,CAACA,GAAiB,WAAW;AAAA,IAAA;AAAA,EACzC,GAGIQ,IAAuBC,EAAY,YAAY;AACnD,UAAMN,EAAkB,MAAM,YAAY;AACxC,YAAMO,IAAS,MAAMb,EAAe;AAAA,QAClC,SAAS;AAAA,UACP,WAAAJ;AAAA,UACA,WAAAC;AAAA,UACA,QAAAE;AAAA,UACA,aAAa;AAAA,YACX,eAAAD;AAAA,UAAA;AAAA,QACF;AAAA,MACF,CACD;AACD,MAAAM,EAAmBS,EAAO,eAAe;AAAA,IAC3C,CAAC;AAAA,EACH,GAAG,CAACjB,GAAWC,GAAWG,GAAgBF,GAAeQ,CAAiB,CAAC;AAE3E,EAAAQ,EAAU,MAAM;AACd,IAAKH,EAAA;AAAA,EACP,GAAG,CAACA,CAAoB,CAAC;AAEzB,QAAMI,IAAYd,KAA2BQ;AAE7C,SAAO;AAAA,IACL,sBAAAE;AAAA,IACA,iBAAAR;AAAA,IACA,aAAaK,GAAiB;AAAA,IAC9B,WAAAO;AAAA,EAAA;AAEJ;"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
1
2
|
import { SDKHooks } from '../../types/hooks';
|
|
2
3
|
export interface ApiProviderProps {
|
|
3
4
|
url: string;
|
|
4
5
|
headers?: HeadersInit;
|
|
5
6
|
hooks?: SDKHooks;
|
|
6
7
|
children: React.ReactNode;
|
|
8
|
+
queryClient?: QueryClient;
|
|
7
9
|
}
|
|
8
|
-
export declare function ApiProvider({ url, headers, hooks, children }: ApiProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function ApiProvider({ url, headers, hooks, children, queryClient: queryClientFromProps, }: ApiProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,18 +1,24 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { QueryClient as
|
|
3
|
-
import { GustoEmbeddedProvider as
|
|
4
|
-
import { GustoEmbeddedCore as
|
|
5
|
-
import { SDKHooks as
|
|
6
|
-
import { useMemo as
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { QueryClient as E, QueryClientProvider as H } from "@tanstack/react-query";
|
|
3
|
+
import { GustoEmbeddedProvider as b } from "@gusto/embedded-api/react-query/_context";
|
|
4
|
+
import { GustoEmbeddedCore as R } from "@gusto/embedded-api/core";
|
|
5
|
+
import { SDKHooks as g } from "@gusto/embedded-api/hooks/hooks";
|
|
6
|
+
import { useMemo as u } from "react";
|
|
7
|
+
function x({
|
|
8
|
+
url: f,
|
|
9
|
+
headers: s,
|
|
10
|
+
hooks: e,
|
|
11
|
+
children: d,
|
|
12
|
+
queryClient: i
|
|
13
|
+
}) {
|
|
14
|
+
const m = u(() => {
|
|
15
|
+
const r = new R({
|
|
16
|
+
serverURL: f
|
|
17
|
+
}), o = r._options.hooks || new g();
|
|
12
18
|
if (s) {
|
|
13
19
|
const t = {
|
|
14
|
-
beforeRequest: (
|
|
15
|
-
|
|
20
|
+
beforeRequest: (q, n) => (new Headers(s).forEach((c, p) => {
|
|
21
|
+
c && n.headers.set(p, c);
|
|
16
22
|
}), n)
|
|
17
23
|
};
|
|
18
24
|
o.registerBeforeRequestHook(t);
|
|
@@ -26,15 +32,17 @@ function Q({ url: i, headers: s, hooks: e, children: u }) {
|
|
|
26
32
|
}), e?.afterError && e.afterError.forEach((t) => {
|
|
27
33
|
o.registerAfterErrorHook(t);
|
|
28
34
|
}), r._options.hooks || (r._options.hooks = o), r;
|
|
29
|
-
}, [
|
|
30
|
-
|
|
35
|
+
}, [f, s, e]), l = u(() => {
|
|
36
|
+
if (i)
|
|
37
|
+
return i;
|
|
38
|
+
const r = new E(), o = async () => {
|
|
31
39
|
await r.invalidateQueries();
|
|
32
40
|
};
|
|
33
41
|
return r.setQueryDefaults(["@gusto/embedded-api"], { retry: !1 }), r.setMutationDefaults(["@gusto/embedded-api"], { onSettled: o, retry: !1 }), r;
|
|
34
|
-
}, []);
|
|
35
|
-
return /* @__PURE__ */
|
|
42
|
+
}, [i]);
|
|
43
|
+
return /* @__PURE__ */ a(H, { client: l, children: /* @__PURE__ */ a(b, { client: m, children: d }) });
|
|
36
44
|
}
|
|
37
45
|
export {
|
|
38
|
-
|
|
46
|
+
x as ApiProvider
|
|
39
47
|
};
|
|
40
48
|
//# sourceMappingURL=ApiProvider.js.map
|