@gusto/embedded-react-sdk 0.55.0 → 0.55.2
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/TaxInputs/TaxInputs.js +65 -64
- package/dist/components/Common/TaxInputs/TaxInputs.js.map +1 -1
- package/dist/components/Common/UI/Select/Select.module.scss.js +5 -5
- package/dist/components/Contractor/Payments/CreateHistoricalPayment/CreateHistoricalPayment.d.ts +4 -2
- package/dist/components/Contractor/Payments/CreateHistoricalPayment/CreateHistoricalPayment.js +148 -117
- package/dist/components/Contractor/Payments/CreateHistoricalPayment/CreateHistoricalPayment.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js +56 -55
- package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePaymentFlow/CreatePaymentFlow.d.ts +1 -1
- package/dist/components/Contractor/Payments/CreatePaymentFlow/CreatePaymentFlow.js +15 -12
- package/dist/components/Contractor/Payments/CreatePaymentFlow/CreatePaymentFlow.js.map +1 -1
- package/dist/components/Contractor/Payments/HistoricalPaymentFlow/HistoricalPaymentFlow.d.ts +69 -0
- package/dist/components/Contractor/Payments/HistoricalPaymentFlow/HistoricalPaymentFlow.js +48 -0
- package/dist/components/Contractor/Payments/HistoricalPaymentFlow/HistoricalPaymentFlow.js.map +1 -0
- package/dist/components/Contractor/Payments/HistoricalPaymentFlow/HistoricalPaymentFlowComponents.d.ts +20 -0
- package/dist/components/Contractor/Payments/HistoricalPaymentFlow/HistoricalPaymentFlowComponents.js +25 -0
- package/dist/components/Contractor/Payments/HistoricalPaymentFlow/HistoricalPaymentFlowComponents.js.map +1 -0
- package/dist/components/Contractor/Payments/HistoricalPaymentFlow/historicalPaymentMachine.d.ts +20 -0
- package/dist/components/Contractor/Payments/HistoricalPaymentFlow/historicalPaymentMachine.js +24 -0
- package/dist/components/Contractor/Payments/HistoricalPaymentFlow/historicalPaymentMachine.js.map +1 -0
- package/dist/components/Contractor/Payments/HistoricalPaymentFlow/index.d.ts +2 -0
- package/dist/components/Contractor/Payments/HistoricalPaymentSummary/HistoricalPaymentSummary.js +16 -15
- package/dist/components/Contractor/Payments/HistoricalPaymentSummary/HistoricalPaymentSummary.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.d.ts +2 -0
- package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js +36 -23
- package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.d.ts +10 -8
- package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js +46 -25
- package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js +53 -52
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js +37 -47
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js +47 -44
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.d.ts +2 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +65 -53
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.module.scss.js +6 -4
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.module.scss.js.map +1 -1
- package/dist/components/Contractor/Payments/ViewPaymentFlow/ViewPaymentFlow.d.ts +1 -1
- package/dist/components/Contractor/Payments/ViewPaymentFlow/ViewPaymentFlow.js +22 -19
- package/dist/components/Contractor/Payments/ViewPaymentFlow/ViewPaymentFlow.js.map +1 -1
- package/dist/components/Contractor/Payments/shared/PaymentSummaryBlock/PaymentSummaryBlock.d.ts +2 -8
- package/dist/components/Contractor/Payments/shared/PaymentSummaryBlock/PaymentSummaryBlock.js +43 -42
- package/dist/components/Contractor/Payments/shared/PaymentSummaryBlock/PaymentSummaryBlock.js.map +1 -1
- package/dist/components/Contractor/Payments/shared/paymentAmounts.d.ts +32 -0
- package/dist/components/Contractor/Payments/shared/paymentAmounts.js +11 -0
- package/dist/components/Contractor/Payments/shared/paymentAmounts.js.map +1 -0
- package/dist/components/Contractor/Payments/shared/paymentAmounts.test.d.ts +1 -0
- package/dist/components/Contractor/Payments/shared/usePaymentAmountsEditor.d.ts +13 -4
- package/dist/components/Contractor/Payments/shared/usePaymentAmountsEditor.js +43 -38
- package/dist/components/Contractor/Payments/shared/usePaymentAmountsEditor.js.map +1 -1
- package/dist/components/Contractor/exports/contractorManagement.d.ts +1 -0
- package/dist/components/Contractor/exports/contractorManagement.js +34 -32
- package/dist/components/Contractor/exports/contractorManagement.js.map +1 -1
- package/dist/components/Contractor/shared/SelectContractors/SelectContractors.d.ts +6 -1
- package/dist/components/Contractor/shared/SelectContractors/SelectContractors.js +13 -12
- package/dist/components/Contractor/shared/SelectContractors/SelectContractors.js.map +1 -1
- package/dist/components/Contractor/shared/SelectContractors/useSelectContractors.d.ts +5 -1
- package/dist/components/Contractor/shared/SelectContractors/useSelectContractors.js +34 -32
- package/dist/components/Contractor/shared/SelectContractors/useSelectContractors.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.d.ts +7 -0
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +191 -153
- 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 +87 -81
- 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 +7 -0
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +115 -112
- 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 +94 -103
- 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/index.d.ts +2 -0
- package/dist/components/Payroll/index.js +26 -24
- package/dist/components/Payroll/index.js.map +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.d.ts +6 -0
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +36 -34
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/contexts/UnstableFeaturesProvider/UnstableFeaturesProvider.d.ts +22 -0
- package/dist/contexts/UnstableFeaturesProvider/UnstableFeaturesProvider.js +14 -0
- package/dist/contexts/UnstableFeaturesProvider/UnstableFeaturesProvider.js.map +1 -0
- package/dist/contexts/UnstableFeaturesProvider/WithUnstableFeature.d.ts +19 -0
- package/dist/contexts/UnstableFeaturesProvider/WithUnstableFeature.js +8 -0
- package/dist/contexts/UnstableFeaturesProvider/WithUnstableFeature.js.map +1 -0
- package/dist/contexts/UnstableFeaturesProvider/useUnstableFeature.d.ts +41 -0
- package/dist/contexts/UnstableFeaturesProvider/useUnstableFeature.js +14 -0
- package/dist/contexts/UnstableFeaturesProvider/useUnstableFeature.js.map +1 -0
- package/dist/contexts/index.d.ts +1 -0
- package/dist/i18n/I18n.js +4 -0
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Contractor.Payments.CreateHistoricalPayment.json.js +34 -32
- package/dist/i18n/en/Contractor.Payments.CreateHistoricalPayment.json.js.map +1 -1
- package/dist/i18n/en/Contractor.Payments.PaymentsList.json.js +20 -18
- package/dist/i18n/en/Contractor.Payments.PaymentsList.json.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollConfiguration.json.js +9 -9
- package/dist/i18n/en/Payroll.PayrollOverview.json.js +38 -38
- 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/en/common.json.d.ts +0 -21
- package/dist/i18n/types.d.ts +75 -9
- 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 +30 -0
- package/dist/shared/constants.js +62 -50
- package/dist/shared/constants.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/test-utils/renderWithProviders.d.ts +4 -1
- package/dist/test-utils/tableQueries.d.ts +9 -0
- package/docs/guides/endpoint-inventory.json +33 -0
- package/package.json +18 -18
|
@@ -1,56 +1,57 @@
|
|
|
1
|
-
import { jsxs as m, jsx as
|
|
2
|
-
import { useTranslation as
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import { getContractorDisplayName as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { jsxs as m, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation as j } from "react-i18next";
|
|
3
|
+
import { useMemo as v } from "react";
|
|
4
|
+
import { getContractorDisplayName as P } from "../../shared/helpers.js";
|
|
5
|
+
import { getContractorPaymentTotalAmount as f } from "../shared/paymentAmounts.js";
|
|
6
|
+
import { FastAchSubmissionBlockerBanner as R } from "./FastAchSubmissionBlockerBanner.js";
|
|
7
|
+
import { GenericBlocker as L } from "./GenericBlocker.js";
|
|
7
8
|
import { Flex as u } from "../../../Common/Flex/Flex.js";
|
|
8
|
-
import { useComponentContext as
|
|
9
|
-
import { useI18n as
|
|
10
|
-
import { formatHoursDisplay as
|
|
11
|
-
import
|
|
12
|
-
import { PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES as
|
|
9
|
+
import { useComponentContext as _ } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
10
|
+
import { useI18n as E } from "../../../../i18n/I18n.js";
|
|
11
|
+
import { formatHoursDisplay as F } from "../../../Payroll/helpers.js";
|
|
12
|
+
import I from "../../../../hooks/useNumberFormatter.js";
|
|
13
|
+
import { PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES as p } from "../../../../shared/constants.js";
|
|
13
14
|
import { DataView as T } from "../../../Common/DataView/DataView.js";
|
|
14
|
-
const
|
|
15
|
+
const M = "0.000", ee = ({
|
|
15
16
|
contractorPaymentGroup: n,
|
|
16
|
-
contractors:
|
|
17
|
-
onBackToEdit:
|
|
18
|
-
onSubmit:
|
|
17
|
+
contractors: h,
|
|
18
|
+
onBackToEdit: A,
|
|
19
|
+
onSubmit: D,
|
|
19
20
|
isLoading: l,
|
|
20
|
-
bankAccount:
|
|
21
|
+
bankAccount: g,
|
|
21
22
|
selectedUnblockOptions: d = {},
|
|
22
23
|
onUnblockOptionChange: b,
|
|
23
|
-
paymentSpeed:
|
|
24
|
+
paymentSpeed: H
|
|
24
25
|
}) => {
|
|
25
|
-
const { Button: c, Text: w, Heading: y, Alert:
|
|
26
|
-
|
|
27
|
-
const { t } =
|
|
26
|
+
const { Button: c, Text: w, Heading: y, Alert: N } = _();
|
|
27
|
+
E("Contractor.Payments.CreatePayment");
|
|
28
|
+
const { t } = j("Contractor.Payments.CreatePayment", {
|
|
28
29
|
keyPrefix: "previewPresentation"
|
|
29
|
-
}),
|
|
30
|
+
}), o = I(), B = (e) => e.wageType === "Hourly" && e.hourlyRate ? `${o(Number(e.hourlyRate || "0"))}${t("perHour")}` : e.wageType, i = v(
|
|
30
31
|
() => n.contractorPayments?.reduce(
|
|
31
|
-
(e, r) => (e.wageAmount += Number(r.wage || "0"), e.bonusAmount += Number(r.bonus || "0"), e.reimbursementAmount += Number(r.reimbursement || "0"), e.totalAmount +=
|
|
32
|
+
(e, r) => (e.wageAmount += Number(r.wage || "0"), e.bonusAmount += Number(r.bonus || "0"), e.reimbursementAmount += Number(r.reimbursement || "0"), e.totalAmount += f(r), e),
|
|
32
33
|
{ wageAmount: 0, bonusAmount: 0, reimbursementAmount: 0, totalAmount: 0 }
|
|
33
34
|
),
|
|
34
35
|
[n.contractorPayments]
|
|
35
|
-
),
|
|
36
|
+
), C = n.contractorPayments || [], s = (n.submissionBlockers || []).filter(
|
|
36
37
|
(e) => e.status === "unresolved"
|
|
37
38
|
), S = s.some(
|
|
38
|
-
(e) => !
|
|
39
|
+
(e) => !p.includes(e.blockerType || "")
|
|
39
40
|
), k = s.some(
|
|
40
41
|
(e) => !d[e.blockerType || ""]
|
|
41
42
|
), x = l || s.length > 0 && (S || k);
|
|
42
43
|
return /* @__PURE__ */ m(u, { flexDirection: "column", gap: 32, children: [
|
|
43
44
|
/* @__PURE__ */ m(u, { justifyContent: "flex-end", gap: 16, children: [
|
|
44
45
|
/* @__PURE__ */ m(u, { flexDirection: "column", gap: 2, children: [
|
|
45
|
-
/* @__PURE__ */
|
|
46
|
-
/* @__PURE__ */
|
|
46
|
+
/* @__PURE__ */ a(y, { as: "h2", children: t("reviewAndSubmitTitle") }),
|
|
47
|
+
/* @__PURE__ */ a(w, { variant: "supporting", children: t("reviewSubtitle", { debitDate: n.debitDate }) })
|
|
47
48
|
] }),
|
|
48
49
|
/* @__PURE__ */ m(u, { justifyContent: "flex-end", gap: 16, children: [
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
/* @__PURE__ */
|
|
50
|
+
/* @__PURE__ */ a(c, { onClick: A, variant: "secondary", children: t("editButton") }),
|
|
51
|
+
/* @__PURE__ */ a(
|
|
51
52
|
c,
|
|
52
53
|
{
|
|
53
|
-
onClick:
|
|
54
|
+
onClick: D,
|
|
54
55
|
variant: "primary",
|
|
55
56
|
isLoading: l,
|
|
56
57
|
isDisabled: x,
|
|
@@ -59,8 +60,8 @@ const I = "0.000", X = ({
|
|
|
59
60
|
)
|
|
60
61
|
] })
|
|
61
62
|
] }),
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
|
|
63
|
+
/* @__PURE__ */ a(
|
|
64
|
+
N,
|
|
64
65
|
{
|
|
65
66
|
status: "info",
|
|
66
67
|
label: t("alerts.submitPaymentsDeadline", {
|
|
@@ -71,33 +72,33 @@ const I = "0.000", X = ({
|
|
|
71
72
|
),
|
|
72
73
|
s.length > 0 && b && s.map((e) => {
|
|
73
74
|
const r = e.blockerType || "";
|
|
74
|
-
return
|
|
75
|
-
|
|
75
|
+
return p.includes(r) ? /* @__PURE__ */ a(
|
|
76
|
+
R,
|
|
76
77
|
{
|
|
77
78
|
blocker: e,
|
|
78
79
|
selectedValue: d[r],
|
|
79
80
|
onUnblockOptionChange: b,
|
|
80
|
-
paymentSpeed:
|
|
81
|
+
paymentSpeed: H
|
|
81
82
|
},
|
|
82
83
|
r
|
|
83
|
-
) : /* @__PURE__ */
|
|
84
|
+
) : /* @__PURE__ */ a(L, { blocker: e }, r);
|
|
84
85
|
}),
|
|
85
|
-
/* @__PURE__ */
|
|
86
|
-
/* @__PURE__ */
|
|
86
|
+
/* @__PURE__ */ a(y, { as: "h3", children: t("paymentSummaryTitle") }),
|
|
87
|
+
/* @__PURE__ */ a(
|
|
87
88
|
T,
|
|
88
89
|
{
|
|
89
90
|
columns: [
|
|
90
91
|
{
|
|
91
92
|
title: t("summaryTableHeaders.totalAmount"),
|
|
92
|
-
render: () =>
|
|
93
|
+
render: () => o(Number(n.totals?.amount || "0"))
|
|
93
94
|
},
|
|
94
95
|
{
|
|
95
96
|
title: t("summaryTableHeaders.debitAmount"),
|
|
96
|
-
render: () =>
|
|
97
|
+
render: () => o(Number(n.totals?.debitAmount || "0"))
|
|
97
98
|
},
|
|
98
99
|
{
|
|
99
100
|
title: t("summaryTableHeaders.debitAccount"),
|
|
100
|
-
render: () =>
|
|
101
|
+
render: () => g?.hiddenAccountNumber ?? t("naDebitAccount")
|
|
101
102
|
},
|
|
102
103
|
{
|
|
103
104
|
title: t("summaryTableHeaders.debitDate"),
|
|
@@ -112,21 +113,21 @@ const I = "0.000", X = ({
|
|
|
112
113
|
label: "Payment Summary"
|
|
113
114
|
}
|
|
114
115
|
),
|
|
115
|
-
/* @__PURE__ */
|
|
116
|
+
/* @__PURE__ */ a(
|
|
116
117
|
T,
|
|
117
118
|
{
|
|
118
119
|
columns: [
|
|
119
120
|
{
|
|
120
121
|
title: t("contractorTableHeaders.contractor"),
|
|
121
|
-
render: (e) =>
|
|
122
|
-
|
|
122
|
+
render: (e) => P(
|
|
123
|
+
h.find(
|
|
123
124
|
(r) => r.uuid === e.contractorUuid
|
|
124
125
|
)
|
|
125
126
|
)
|
|
126
127
|
},
|
|
127
128
|
{
|
|
128
129
|
title: t("contractorTableHeaders.wageType"),
|
|
129
|
-
render: (e) =>
|
|
130
|
+
render: (e) => B(e)
|
|
130
131
|
},
|
|
131
132
|
{
|
|
132
133
|
title: t("contractorTableHeaders.paymentMethod"),
|
|
@@ -138,37 +139,37 @@ const I = "0.000", X = ({
|
|
|
138
139
|
render: (e) => {
|
|
139
140
|
if (e.wageType === "Fixed") return t("na");
|
|
140
141
|
const r = Number(e.hours || "0");
|
|
141
|
-
return r ?
|
|
142
|
+
return r ? F(r) : M;
|
|
142
143
|
}
|
|
143
144
|
},
|
|
144
145
|
{
|
|
145
146
|
title: t("contractorTableHeaders.wage"),
|
|
146
147
|
justify: "end",
|
|
147
|
-
render: (e) => e.wageType === "Hourly" ? t("na") :
|
|
148
|
+
render: (e) => e.wageType === "Hourly" ? t("na") : o(Number(e.wage || "0"))
|
|
148
149
|
},
|
|
149
150
|
{
|
|
150
151
|
title: t("contractorTableHeaders.bonus"),
|
|
151
152
|
justify: "end",
|
|
152
|
-
render: (e) =>
|
|
153
|
+
render: (e) => o(Number(e.bonus || "0"))
|
|
153
154
|
},
|
|
154
155
|
{
|
|
155
156
|
title: t("contractorTableHeaders.reimbursement"),
|
|
156
157
|
justify: "end",
|
|
157
|
-
render: (e) =>
|
|
158
|
+
render: (e) => o(Number(e.reimbursement || "0"))
|
|
158
159
|
},
|
|
159
160
|
{
|
|
160
161
|
title: t("contractorTableHeaders.total"),
|
|
161
162
|
justify: "end",
|
|
162
|
-
render: (e) =>
|
|
163
|
+
render: (e) => o(f(e))
|
|
163
164
|
}
|
|
164
165
|
],
|
|
165
|
-
data:
|
|
166
|
+
data: C,
|
|
166
167
|
footer: () => ({
|
|
167
168
|
"column-0": t("totalsLabel"),
|
|
168
|
-
"column-4":
|
|
169
|
-
"column-5":
|
|
170
|
-
"column-6":
|
|
171
|
-
"column-7":
|
|
169
|
+
"column-4": o(i?.wageAmount ?? 0),
|
|
170
|
+
"column-5": o(i?.bonusAmount ?? 0),
|
|
171
|
+
"column-6": o(i?.reimbursementAmount ?? 0),
|
|
172
|
+
"column-7": o(i?.totalAmount ?? 0)
|
|
172
173
|
}),
|
|
173
174
|
label: t("whatYourCompanyPays")
|
|
174
175
|
}
|
|
@@ -176,6 +177,6 @@ const I = "0.000", X = ({
|
|
|
176
177
|
] });
|
|
177
178
|
};
|
|
178
179
|
export {
|
|
179
|
-
|
|
180
|
+
ee as PreviewPresentation
|
|
180
181
|
};
|
|
181
182
|
//# sourceMappingURL=PreviewPresentation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreviewPresentation.js","sources":["../../../../../src/components/Contractor/Payments/CreatePayment/PreviewPresentation.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { ContractorPaymentGroupPreview } from '@gusto/embedded-api/models/components/contractorpaymentgrouppreview'\nimport type { ContractorPaymentForGroupPreview } from '@gusto/embedded-api/models/components/contractorpaymentforgrouppreview'\nimport { useMemo } from 'react'\nimport type { Contractor } from '@gusto/embedded-api/models/components/contractor'\nimport type { CompanyBankAccount } from '@gusto/embedded-api/models/components/companybankaccount'\nimport type { PaymentSpeed } from '@gusto/embedded-api/models/components/paymentconfigs'\nimport { getContractorDisplayName } from '../../shared/helpers'\nimport { FastAchSubmissionBlockerBanner } from './FastAchSubmissionBlockerBanner'\nimport { GenericBlocker } from './GenericBlocker'\nimport { DataView, Flex } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { formatHoursDisplay } from '@/components/Payroll/helpers'\nimport useNumberFormatter from '@/hooks/useNumberFormatter'\nimport { PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES } from '@/shared/constants'\n\nconst ZERO_HOURS_DISPLAY = '0.000'\n\ninterface PreviewPresentationProps {\n contractorPaymentGroup: ContractorPaymentGroupPreview\n contractors: Contractor[]\n onBackToEdit: () => void\n onSubmit: () => void\n isLoading: boolean\n bankAccount?: CompanyBankAccount\n selectedUnblockOptions?: Record<string, string>\n onUnblockOptionChange?: (blockerType: string, value: string) => void\n paymentSpeed?: PaymentSpeed\n}\n\n/** @internal */\nexport const PreviewPresentation = ({\n contractorPaymentGroup,\n contractors,\n onBackToEdit,\n onSubmit,\n isLoading,\n bankAccount,\n selectedUnblockOptions = {},\n onUnblockOptionChange,\n paymentSpeed,\n}: PreviewPresentationProps) => {\n const { Button, Text, Heading, Alert } = useComponentContext()\n useI18n('Contractor.Payments.CreatePayment')\n const { t } = useTranslation('Contractor.Payments.CreatePayment', {\n keyPrefix: 'previewPresentation',\n })\n const currencyFormatter = useNumberFormatter()\n\n const formatWageType = (contractor: ContractorPaymentForGroupPreview) => {\n if (contractor.wageType === 'Hourly' && contractor.hourlyRate) {\n return `${currencyFormatter(Number(contractor.hourlyRate || '0'))}${t('perHour')}`\n }\n return contractor.wageType\n }\n\n const totals = useMemo(\n () =>\n contractorPaymentGroup.contractorPayments?.reduce(\n (acc, contractor) => {\n acc.wageAmount += Number(contractor.wage || '0')\n acc.bonusAmount += Number(contractor.bonus || '0')\n acc.reimbursementAmount += Number(contractor.reimbursement || '0')\n acc.totalAmount += Number(contractor.wageTotal || '0')\n return acc\n },\n { wageAmount: 0, bonusAmount: 0, reimbursementAmount: 0, totalAmount: 0 },\n ),\n [contractorPaymentGroup.contractorPayments],\n )\n\n const contractorPayments = contractorPaymentGroup.contractorPayments || []\n\n const submissionBlockers = (contractorPaymentGroup.submissionBlockers || []).filter(\n blocker => blocker.status === 'unresolved',\n )\n\n const hasUnresolvableBlockers = submissionBlockers.some(\n blocker => !PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES.includes(blocker.blockerType || ''),\n )\n\n const hasUnselectedBlockers = submissionBlockers.some(\n blocker => !selectedUnblockOptions[blocker.blockerType || ''],\n )\n\n const isSubmitDisabled =\n isLoading ||\n (submissionBlockers.length > 0 && (hasUnresolvableBlockers || hasUnselectedBlockers))\n\n return (\n <Flex flexDirection=\"column\" gap={32}>\n <Flex justifyContent=\"flex-end\" gap={16}>\n <Flex flexDirection=\"column\" gap={2}>\n <Heading as=\"h2\">{t('reviewAndSubmitTitle')}</Heading>\n <Text variant=\"supporting\">\n {t('reviewSubtitle', { debitDate: contractorPaymentGroup.debitDate })}\n </Text>\n </Flex>\n <Flex justifyContent=\"flex-end\" gap={16}>\n <Button onClick={onBackToEdit} variant=\"secondary\">\n {t('editButton')}\n </Button>\n <Button\n onClick={onSubmit}\n variant=\"primary\"\n isLoading={isLoading}\n isDisabled={isSubmitDisabled}\n >\n {t('submitButton')}\n </Button>\n </Flex>\n </Flex>\n\n <Alert\n status=\"info\"\n label={t('alerts.submitPaymentsDeadline', {\n checkDate: contractorPaymentGroup.checkDate,\n debitDate: contractorPaymentGroup.debitDate,\n })}\n />\n\n {submissionBlockers.length > 0 &&\n onUnblockOptionChange &&\n submissionBlockers.map(blocker => {\n const blockerType = blocker.blockerType || ''\n\n if (PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES.includes(blockerType)) {\n return (\n <FastAchSubmissionBlockerBanner\n key={blockerType}\n blocker={blocker}\n selectedValue={selectedUnblockOptions[blockerType]}\n onUnblockOptionChange={onUnblockOptionChange}\n paymentSpeed={paymentSpeed}\n />\n )\n }\n\n return <GenericBlocker key={blockerType} blocker={blocker} />\n })}\n\n {/* Payment Summary */}\n <Heading as=\"h3\">{t('paymentSummaryTitle')}</Heading>\n <DataView\n columns={[\n {\n title: t('summaryTableHeaders.totalAmount'),\n render: () => currencyFormatter(Number(contractorPaymentGroup.totals?.amount || '0')),\n },\n {\n title: t('summaryTableHeaders.debitAmount'),\n render: () =>\n currencyFormatter(Number(contractorPaymentGroup.totals?.debitAmount || '0')),\n },\n {\n title: t('summaryTableHeaders.debitAccount'),\n render: () => bankAccount?.hiddenAccountNumber ?? t('naDebitAccount'),\n },\n {\n title: t('summaryTableHeaders.debitDate'),\n render: () => contractorPaymentGroup.debitDate || 'debitDate',\n },\n {\n title: t('summaryTableHeaders.contractorPayDate'),\n render: () => contractorPaymentGroup.checkDate || 'contractorPayDate',\n },\n ]}\n data={[contractorPaymentGroup]}\n label=\"Payment Summary\"\n />\n\n {/* Contractor Payments Table */}\n <DataView\n columns={[\n {\n title: t('contractorTableHeaders.contractor'),\n render: contractorPayment =>\n getContractorDisplayName(\n contractors.find(\n contractor => contractor.uuid === contractorPayment.contractorUuid,\n ),\n ),\n },\n {\n title: t('contractorTableHeaders.wageType'),\n render: contractorPayment => formatWageType(contractorPayment),\n },\n {\n title: t('contractorTableHeaders.paymentMethod'),\n render: contractorPayment => contractorPayment.paymentMethod || 'N/A',\n },\n {\n title: t('contractorTableHeaders.hours'),\n justify: 'end',\n render: contractorPayment => {\n if (contractorPayment.wageType === 'Fixed') return t('na')\n const hours = Number(contractorPayment.hours || '0')\n return hours ? formatHoursDisplay(hours) : ZERO_HOURS_DISPLAY\n },\n },\n {\n title: t('contractorTableHeaders.wage'),\n justify: 'end',\n render: contractorPayment => {\n if (contractorPayment.wageType === 'Hourly') return t('na')\n return currencyFormatter(Number(contractorPayment.wage || '0'))\n },\n },\n {\n title: t('contractorTableHeaders.bonus'),\n justify: 'end',\n render: contractorPayment => currencyFormatter(Number(contractorPayment.bonus || '0')),\n },\n {\n title: t('contractorTableHeaders.reimbursement'),\n justify: 'end',\n render: contractorPayment =>\n currencyFormatter(Number(contractorPayment.reimbursement || '0')),\n },\n {\n title: t('contractorTableHeaders.total'),\n justify: 'end',\n render: contractorPayment =>\n currencyFormatter(Number(contractorPayment.wageTotal || '0')),\n },\n ]}\n data={contractorPayments}\n footer={() => ({\n 'column-0': t('totalsLabel'),\n 'column-4': currencyFormatter(totals?.wageAmount ?? 0),\n 'column-5': currencyFormatter(totals?.bonusAmount ?? 0),\n 'column-6': currencyFormatter(totals?.reimbursementAmount ?? 0),\n 'column-7': currencyFormatter(totals?.totalAmount ?? 0),\n })}\n label={t('whatYourCompanyPays')}\n />\n </Flex>\n )\n}\n"],"names":["ZERO_HOURS_DISPLAY","PreviewPresentation","contractorPaymentGroup","contractors","onBackToEdit","onSubmit","isLoading","bankAccount","selectedUnblockOptions","onUnblockOptionChange","paymentSpeed","Button","Text","Heading","Alert","useComponentContext","useI18n","useTranslation","currencyFormatter","useNumberFormatter","formatWageType","contractor","totals","useMemo","acc","contractorPayments","submissionBlockers","blocker","hasUnresolvableBlockers","PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES","hasUnselectedBlockers","isSubmitDisabled","jsxs","Flex","jsx","blockerType","FastAchSubmissionBlockerBanner","GenericBlocker","DataView","contractorPayment","getContractorDisplayName","hours","formatHoursDisplay"],"mappings":";;;;;;;;;;;;;AAiBA,MAAMA,IAAqB,SAedC,IAAsB,CAAC;AAAA,EAClC,wBAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,wBAAAC,IAAyB,CAAA;AAAA,EACzB,uBAAAC;AAAA,EACA,cAAAC;AACF,MAAgC;AAC9B,QAAM,EAAE,QAAAC,GAAQ,MAAAC,GAAM,SAAAC,GAAS,OAAAC,EAAA,IAAUC,EAAA;AACzC,EAAAC,EAAQ,mCAAmC;AAC3C,QAAM,EAAE,EAAA,IAAMC,EAAe,qCAAqC;AAAA,IAChE,WAAW;AAAA,EAAA,CACZ,GACKC,IAAoBC,EAAA,GAEpBC,IAAiB,CAACC,MAClBA,EAAW,aAAa,YAAYA,EAAW,aAC1C,GAAGH,EAAkB,OAAOG,EAAW,cAAc,GAAG,CAAC,CAAC,GAAG,EAAE,SAAS,CAAC,KAE3EA,EAAW,UAGdC,IAASC;AAAA,IACb,MACErB,EAAuB,oBAAoB;AAAA,MACzC,CAACsB,GAAKH,OACJG,EAAI,cAAc,OAAOH,EAAW,QAAQ,GAAG,GAC/CG,EAAI,eAAe,OAAOH,EAAW,SAAS,GAAG,GACjDG,EAAI,uBAAuB,OAAOH,EAAW,iBAAiB,GAAG,GACjEG,EAAI,eAAe,OAAOH,EAAW,aAAa,GAAG,GAC9CG;AAAA,MAET,EAAE,YAAY,GAAG,aAAa,GAAG,qBAAqB,GAAG,aAAa,EAAA;AAAA,IAAE;AAAA,IAE5E,CAACtB,EAAuB,kBAAkB;AAAA,EAAA,GAGtCuB,IAAqBvB,EAAuB,sBAAsB,CAAA,GAElEwB,KAAsBxB,EAAuB,sBAAsB,CAAA,GAAI;AA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;AAAA,YACvC,SAAS;AAAA,YACT,QAAQ,CAAAA,MACNrB,EAAkB,OAAOqB,EAAkB,aAAa,GAAG,CAAC;AAAA,UAAA;AAAA,QAChE;AAAA,QAEF,MAAMd;AAAA,QACN,QAAQ,OAAO;AAAA,UACb,YAAY,EAAE,aAAa;AAAA,UAC3B,YAAYP,EAAkBI,GAAQ,cAAc,CAAC;AAAA,UACrD,YAAYJ,EAAkBI,GAAQ,eAAe,CAAC;AAAA,UACtD,YAAYJ,EAAkBI,GAAQ,uBAAuB,CAAC;AAAA,UAC9D,YAAYJ,EAAkBI,GAAQ,eAAe,CAAC;AAAA,QAAA;AAAA,QAExD,OAAO,EAAE,qBAAqB;AAAA,MAAA;AAAA,IAAA;AAAA,EAChC,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"PreviewPresentation.js","sources":["../../../../../src/components/Contractor/Payments/CreatePayment/PreviewPresentation.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { ContractorPaymentGroupPreview } from '@gusto/embedded-api/models/components/contractorpaymentgrouppreview'\nimport type { ContractorPaymentForGroupPreview } from '@gusto/embedded-api/models/components/contractorpaymentforgrouppreview'\nimport { useMemo } from 'react'\nimport type { Contractor } from '@gusto/embedded-api/models/components/contractor'\nimport type { CompanyBankAccount } from '@gusto/embedded-api/models/components/companybankaccount'\nimport type { PaymentSpeed } from '@gusto/embedded-api/models/components/paymentconfigs'\nimport { getContractorDisplayName } from '../../shared/helpers'\nimport { getContractorPaymentTotalAmount } from '../shared/paymentAmounts'\nimport { FastAchSubmissionBlockerBanner } from './FastAchSubmissionBlockerBanner'\nimport { GenericBlocker } from './GenericBlocker'\nimport { DataView, Flex } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { formatHoursDisplay } from '@/components/Payroll/helpers'\nimport useNumberFormatter from '@/hooks/useNumberFormatter'\nimport { PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES } from '@/shared/constants'\n\nconst ZERO_HOURS_DISPLAY = '0.000'\n\ninterface PreviewPresentationProps {\n contractorPaymentGroup: ContractorPaymentGroupPreview\n contractors: Contractor[]\n onBackToEdit: () => void\n onSubmit: () => void\n isLoading: boolean\n bankAccount?: CompanyBankAccount\n selectedUnblockOptions?: Record<string, string>\n onUnblockOptionChange?: (blockerType: string, value: string) => void\n paymentSpeed?: PaymentSpeed\n}\n\n/** @internal */\nexport const PreviewPresentation = ({\n contractorPaymentGroup,\n contractors,\n onBackToEdit,\n onSubmit,\n isLoading,\n bankAccount,\n selectedUnblockOptions = {},\n onUnblockOptionChange,\n paymentSpeed,\n}: PreviewPresentationProps) => {\n const { Button, Text, Heading, Alert } = useComponentContext()\n useI18n('Contractor.Payments.CreatePayment')\n const { t } = useTranslation('Contractor.Payments.CreatePayment', {\n keyPrefix: 'previewPresentation',\n })\n const currencyFormatter = useNumberFormatter()\n\n const formatWageType = (contractor: ContractorPaymentForGroupPreview) => {\n if (contractor.wageType === 'Hourly' && contractor.hourlyRate) {\n return `${currencyFormatter(Number(contractor.hourlyRate || '0'))}${t('perHour')}`\n }\n return contractor.wageType\n }\n\n const totals = useMemo(\n () =>\n contractorPaymentGroup.contractorPayments?.reduce(\n (acc, contractor) => {\n acc.wageAmount += Number(contractor.wage || '0')\n acc.bonusAmount += Number(contractor.bonus || '0')\n acc.reimbursementAmount += Number(contractor.reimbursement || '0')\n acc.totalAmount += getContractorPaymentTotalAmount(contractor)\n return acc\n },\n { wageAmount: 0, bonusAmount: 0, reimbursementAmount: 0, totalAmount: 0 },\n ),\n [contractorPaymentGroup.contractorPayments],\n )\n\n const contractorPayments = contractorPaymentGroup.contractorPayments || []\n\n const submissionBlockers = (contractorPaymentGroup.submissionBlockers || []).filter(\n blocker => blocker.status === 'unresolved',\n )\n\n const hasUnresolvableBlockers = submissionBlockers.some(\n blocker => !PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES.includes(blocker.blockerType || ''),\n )\n\n const hasUnselectedBlockers = submissionBlockers.some(\n blocker => !selectedUnblockOptions[blocker.blockerType || ''],\n )\n\n const isSubmitDisabled =\n isLoading ||\n (submissionBlockers.length > 0 && (hasUnresolvableBlockers || hasUnselectedBlockers))\n\n return (\n <Flex flexDirection=\"column\" gap={32}>\n <Flex justifyContent=\"flex-end\" gap={16}>\n <Flex flexDirection=\"column\" gap={2}>\n <Heading as=\"h2\">{t('reviewAndSubmitTitle')}</Heading>\n <Text variant=\"supporting\">\n {t('reviewSubtitle', { debitDate: contractorPaymentGroup.debitDate })}\n </Text>\n </Flex>\n <Flex justifyContent=\"flex-end\" gap={16}>\n <Button onClick={onBackToEdit} variant=\"secondary\">\n {t('editButton')}\n </Button>\n <Button\n onClick={onSubmit}\n variant=\"primary\"\n isLoading={isLoading}\n isDisabled={isSubmitDisabled}\n >\n {t('submitButton')}\n </Button>\n </Flex>\n </Flex>\n\n <Alert\n status=\"info\"\n label={t('alerts.submitPaymentsDeadline', {\n checkDate: contractorPaymentGroup.checkDate,\n debitDate: contractorPaymentGroup.debitDate,\n })}\n />\n\n {submissionBlockers.length > 0 &&\n onUnblockOptionChange &&\n submissionBlockers.map(blocker => {\n const blockerType = blocker.blockerType || ''\n\n if (PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES.includes(blockerType)) {\n return (\n <FastAchSubmissionBlockerBanner\n key={blockerType}\n blocker={blocker}\n selectedValue={selectedUnblockOptions[blockerType]}\n onUnblockOptionChange={onUnblockOptionChange}\n paymentSpeed={paymentSpeed}\n />\n )\n }\n\n return <GenericBlocker key={blockerType} blocker={blocker} />\n })}\n\n {/* Payment Summary */}\n <Heading as=\"h3\">{t('paymentSummaryTitle')}</Heading>\n <DataView\n columns={[\n {\n title: t('summaryTableHeaders.totalAmount'),\n render: () => currencyFormatter(Number(contractorPaymentGroup.totals?.amount || '0')),\n },\n {\n title: t('summaryTableHeaders.debitAmount'),\n render: () =>\n currencyFormatter(Number(contractorPaymentGroup.totals?.debitAmount || '0')),\n },\n {\n title: t('summaryTableHeaders.debitAccount'),\n render: () => bankAccount?.hiddenAccountNumber ?? t('naDebitAccount'),\n },\n {\n title: t('summaryTableHeaders.debitDate'),\n render: () => contractorPaymentGroup.debitDate || 'debitDate',\n },\n {\n title: t('summaryTableHeaders.contractorPayDate'),\n render: () => contractorPaymentGroup.checkDate || 'contractorPayDate',\n },\n ]}\n data={[contractorPaymentGroup]}\n label=\"Payment Summary\"\n />\n\n {/* Contractor Payments Table */}\n <DataView\n columns={[\n {\n title: t('contractorTableHeaders.contractor'),\n render: contractorPayment =>\n getContractorDisplayName(\n contractors.find(\n contractor => contractor.uuid === contractorPayment.contractorUuid,\n ),\n ),\n },\n {\n title: t('contractorTableHeaders.wageType'),\n render: contractorPayment => formatWageType(contractorPayment),\n },\n {\n title: t('contractorTableHeaders.paymentMethod'),\n render: contractorPayment => contractorPayment.paymentMethod || 'N/A',\n },\n {\n title: t('contractorTableHeaders.hours'),\n justify: 'end',\n render: contractorPayment => {\n if (contractorPayment.wageType === 'Fixed') return t('na')\n const hours = Number(contractorPayment.hours || '0')\n return hours ? formatHoursDisplay(hours) : ZERO_HOURS_DISPLAY\n },\n },\n {\n title: t('contractorTableHeaders.wage'),\n justify: 'end',\n render: contractorPayment => {\n if (contractorPayment.wageType === 'Hourly') return t('na')\n return currencyFormatter(Number(contractorPayment.wage || '0'))\n },\n },\n {\n title: t('contractorTableHeaders.bonus'),\n justify: 'end',\n render: contractorPayment => currencyFormatter(Number(contractorPayment.bonus || '0')),\n },\n {\n title: t('contractorTableHeaders.reimbursement'),\n justify: 'end',\n render: contractorPayment =>\n currencyFormatter(Number(contractorPayment.reimbursement || '0')),\n },\n {\n title: t('contractorTableHeaders.total'),\n justify: 'end',\n render: contractorPayment =>\n currencyFormatter(getContractorPaymentTotalAmount(contractorPayment)),\n },\n ]}\n data={contractorPayments}\n footer={() => ({\n 'column-0': t('totalsLabel'),\n 'column-4': currencyFormatter(totals?.wageAmount ?? 0),\n 'column-5': currencyFormatter(totals?.bonusAmount ?? 0),\n 'column-6': currencyFormatter(totals?.reimbursementAmount ?? 0),\n 'column-7': currencyFormatter(totals?.totalAmount ?? 0),\n })}\n label={t('whatYourCompanyPays')}\n />\n </Flex>\n )\n}\n"],"names":["ZERO_HOURS_DISPLAY","PreviewPresentation","contractorPaymentGroup","contractors","onBackToEdit","onSubmit","isLoading","bankAccount","selectedUnblockOptions","onUnblockOptionChange","paymentSpeed","Button","Text","Heading","Alert","useComponentContext","useI18n","useTranslation","currencyFormatter","useNumberFormatter","formatWageType","contractor","totals","useMemo","acc","getContractorPaymentTotalAmount","contractorPayments","submissionBlockers","blocker","hasUnresolvableBlockers","PAYROLL_RESOLVABLE_SUBMISSION_BLOCKER_TYPES","hasUnselectedBlockers","isSubmitDisabled","jsxs","Flex","jsx","blockerType","FastAchSubmissionBlockerBanner","GenericBlocker","DataView","contractorPayment","getContractorDisplayName","hours","formatHoursDisplay"],"mappings":";;;;;;;;;;;;;;AAkBA,MAAMA,IAAqB,SAedC,KAAsB,CAAC;AAAA,EAClC,wBAAAC;AAAA,EACA,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,wBAAAC,IAAyB,CAAA;AAAA,EACzB,uBAAAC;AAAA,EACA,cAAAC;AACF,MAAgC;AAC9B,QAAM,EAAE,QAAAC,GAAQ,MAAAC,GAAM,SAAAC,GAAS,OAAAC,EAAA,IAAUC,EAAA;AACzC,EAAAC,EAAQ,mCAAmC;AAC3C,QAAM,EAAE,EAAA,IAAMC,EAAe,qCAAqC;AAAA,IAChE,WAAW;AAAA,EAAA,CACZ,GACKC,IAAoBC,EAAA,GAEpBC,IAAiB,CAACC,MAClBA,EAAW,aAAa,YAAYA,EAAW,aAC1C,GAAGH,EAAkB,OAAOG,EAAW,cAAc,GAAG,CAAC,CAAC,GAAG,EAAE,SAAS,CAAC,KAE3EA,EAAW,UAGdC,IAASC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T,QAAQ,CAAAwC,MACFA,EAAkB,aAAa,WAAiB,EAAE,IAAI,IACnDtB,EAAkB,OAAOsB,EAAkB,QAAQ,GAAG,CAAC;AAAA,UAChE;AAAA,UAEF;AAAA,YACE,OAAO,EAAE,8BAA8B;AAAA,YACvC,SAAS;AAAA,YACT,QAAQ,CAAAA,MAAqBtB,EAAkB,OAAOsB,EAAkB,SAAS,GAAG,CAAC;AAAA,UAAA;AAAA,UAEvF;AAAA,YACE,OAAO,EAAE,sCAAsC;AAAA,YAC/C,SAAS;AAAA,YACT,QAAQ,CAAAA,MACNtB,EAAkB,OAAOsB,EAAkB,iBAAiB,GAAG,CAAC;AAAA,UAAA;AAAA,UAEpE;AAAA,YACE,OAAO,EAAE,8BAA8B;AAAA,YACvC,SAAS;AAAA,YACT,QAAQ,CAAAA,MACNtB,EAAkBO,EAAgCe,CAAiB,CAAC;AAAA,UAAA;AAAA,QACxE;AAAA,QAEF,MAAMd;AAAA,QACN,QAAQ,OAAO;AAAA,UACb,YAAY,EAAE,aAAa;AAAA,UAC3B,YAAYR,EAAkBI,GAAQ,cAAc,CAAC;AAAA,UACrD,YAAYJ,EAAkBI,GAAQ,eAAe,CAAC;AAAA,UACtD,YAAYJ,EAAkBI,GAAQ,uBAAuB,CAAC;AAAA,UAC9D,YAAYJ,EAAkBI,GAAQ,eAAe,CAAC;AAAA,QAAA;AAAA,QAExD,OAAO,EAAE,qBAAqB;AAAA,MAAA;AAAA,IAAA;AAAA,EAChC,GACF;AAEJ;"}
|
|
@@ -60,4 +60,4 @@ export declare function CreatePaymentFlow(props: CreatePaymentFlowProps): import
|
|
|
60
60
|
*
|
|
61
61
|
* @internal
|
|
62
62
|
*/
|
|
63
|
-
export declare function CreatePaymentInternalFlow(
|
|
63
|
+
export declare function CreatePaymentInternalFlow(props: CreatePaymentInternalFlowProps): import("react").JSX.Element;
|
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { createMachine as
|
|
2
|
+
import { createMachine as s } from "robot3";
|
|
3
3
|
import { useState as b } from "react";
|
|
4
|
-
import {
|
|
5
|
-
import { CreatePaymentContextual as
|
|
4
|
+
import { createPaymentBreadcrumbsNodes as d, createPaymentMachine as f } from "./createPaymentMachine.js";
|
|
5
|
+
import { CreatePaymentContextual as p } from "./CreatePaymentFlowComponents.js";
|
|
6
6
|
import { Flow as y } from "../../../Flow/Flow.js";
|
|
7
7
|
import { buildBreadcrumbs as P, updateBreadcrumbs as l } from "../../../../helpers/breadcrumbHelpers.js";
|
|
8
8
|
const B = [];
|
|
9
9
|
function O(e) {
|
|
10
10
|
return /* @__PURE__ */ r(C, { ...e });
|
|
11
11
|
}
|
|
12
|
-
function C({
|
|
12
|
+
function C(e) {
|
|
13
|
+
return /* @__PURE__ */ r(h, { ...e }, e.companyId);
|
|
14
|
+
}
|
|
15
|
+
function h({
|
|
13
16
|
companyId: e,
|
|
14
17
|
onEvent: a,
|
|
15
|
-
prefixBreadcrumbs:
|
|
18
|
+
prefixBreadcrumbs: n = B
|
|
16
19
|
}) {
|
|
17
|
-
const [
|
|
20
|
+
const [m] = b(() => {
|
|
18
21
|
const o = P(d), c = Object.fromEntries(
|
|
19
|
-
Object.entries(o).map(([t,
|
|
22
|
+
Object.entries(o).map(([t, u]) => [
|
|
20
23
|
t,
|
|
21
|
-
[...
|
|
24
|
+
[...n, ...u]
|
|
22
25
|
])
|
|
23
26
|
), i = l("createPayment", {
|
|
24
27
|
header: {
|
|
@@ -26,18 +29,18 @@ function C({
|
|
|
26
29
|
breadcrumbs: c
|
|
27
30
|
}
|
|
28
31
|
});
|
|
29
|
-
return
|
|
32
|
+
return s(
|
|
30
33
|
"createPayment",
|
|
31
|
-
|
|
34
|
+
f,
|
|
32
35
|
(t) => ({
|
|
33
36
|
...t,
|
|
34
37
|
...i,
|
|
35
|
-
component:
|
|
38
|
+
component: p,
|
|
36
39
|
companyId: e
|
|
37
40
|
})
|
|
38
41
|
);
|
|
39
42
|
});
|
|
40
|
-
return /* @__PURE__ */ r(y, { machine:
|
|
43
|
+
return /* @__PURE__ */ r(y, { machine: m, onEvent: a });
|
|
41
44
|
}
|
|
42
45
|
export {
|
|
43
46
|
O as CreatePaymentFlow,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreatePaymentFlow.js","sources":["../../../../../src/components/Contractor/Payments/CreatePaymentFlow/CreatePaymentFlow.tsx"],"sourcesContent":["import { createMachine } from 'robot3'\nimport { useState } from 'react'\nimport { createPaymentBreadcrumbsNodes, createPaymentMachine } from './createPaymentMachine'\nimport {\n CreatePaymentContextual,\n type CreatePaymentFlowContextInterface,\n type CreatePaymentFlowProps,\n} from './CreatePaymentFlowComponents'\nimport { Flow } from '@/components/Flow/Flow'\nimport type { FlowBreadcrumb } from '@/components/Common/FlowBreadcrumbs/FlowBreadcrumbsTypes'\nimport { buildBreadcrumbs, updateBreadcrumbs } from '@/helpers/breadcrumbHelpers'\n\nconst EMPTY_BREADCRUMBS: FlowBreadcrumb[] = []\n\n/**\n * Props for the flow-internal {@link CreatePaymentInternalFlow}, which layers a parent flow's\n * prefix breadcrumbs on top of the public {@link CreatePaymentFlowProps}.\n *\n * @internal\n */\nexport interface CreatePaymentInternalFlowProps extends CreatePaymentFlowProps {\n /**\n * Breadcrumbs prepended to the flow's own breadcrumb trail. Set by a parent flow (e.g.\n * `PaymentFlow`) so the breadcrumb history remains coherent across the handoff.\n */\n prefixBreadcrumbs?: FlowBreadcrumb[]\n}\n\n/**\n * Guided flow to create a contractor payment and review the resulting summary.\n *\n * @remarks\n * This is the inner flow that powers the create-payment spoke of `ContractorManagement.PaymentFlow`.\n * Render it directly when you have built your own payments landing page and want to hand the user\n * off to the standard create-payment experience without re-implementing it. The flow ships with\n * breadcrumb navigation and handles Fast ACH blockers and wire transfer requirements inline.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `contractor/payments/created` | Fired when a payment group is successfully created | The created `ContractorPaymentGroup` |\n * | `contractor/payments/exit` | Fired when the user completes the payment flow | `{ uuid?: string \\| null }` |\n * | `payroll/wire/form/done` | Fired when wire transfer details are submitted | `{ wireInRequest: WireInRequest, confirmationAlert: { title: string, content?: string } }` |\n * | `breadcrumb/navigate` | Fired when the user clicks a breadcrumb to navigate back | `{ key: string, onNavigate: (ctx) => ctx }` |\n *\n * @components\n * - {@link CreatePayment}\n * - {@link PaymentSummary}\n *\n * @param props - See {@link CreatePaymentFlowProps}.\n * @returns The composed create-payment flow.\n * @alpha\n *\n * @example\n * ```tsx title=\"App.tsx\"\n * import { ContractorManagement } from '@gusto/embedded-react-sdk'\n *\n * function MyApp() {\n * return (\n * <ContractorManagement.CreatePaymentFlow\n * companyId=\"a007e1ab-3595-43c2-ab4b-af7a5af2e365\"\n * onEvent={() => {}}\n * />\n * )\n * }\n * ```\n */\nexport function CreatePaymentFlow(props: CreatePaymentFlowProps) {\n return <CreatePaymentInternalFlow {...props} />\n}\n\n/**\n * Flow-internal entry point for {@link CreatePaymentFlow} that additionally accepts\n * flow-injected `prefixBreadcrumbs`. Partners use {@link CreatePaymentFlow}; `PaymentFlow` renders\n * this directly to prepend its own breadcrumb trail.\n *\n * @internal\n */\nexport function CreatePaymentInternalFlow({\n companyId,\n onEvent,\n prefixBreadcrumbs = EMPTY_BREADCRUMBS,\n}: CreatePaymentInternalFlowProps) {\n // Built once via a lazy useState initializer
|
|
1
|
+
{"version":3,"file":"CreatePaymentFlow.js","sources":["../../../../../src/components/Contractor/Payments/CreatePaymentFlow/CreatePaymentFlow.tsx"],"sourcesContent":["import { createMachine } from 'robot3'\nimport { useState } from 'react'\nimport { createPaymentBreadcrumbsNodes, createPaymentMachine } from './createPaymentMachine'\nimport {\n CreatePaymentContextual,\n type CreatePaymentFlowContextInterface,\n type CreatePaymentFlowProps,\n} from './CreatePaymentFlowComponents'\nimport { Flow } from '@/components/Flow/Flow'\nimport type { FlowBreadcrumb } from '@/components/Common/FlowBreadcrumbs/FlowBreadcrumbsTypes'\nimport { buildBreadcrumbs, updateBreadcrumbs } from '@/helpers/breadcrumbHelpers'\n\nconst EMPTY_BREADCRUMBS: FlowBreadcrumb[] = []\n\n/**\n * Props for the flow-internal {@link CreatePaymentInternalFlow}, which layers a parent flow's\n * prefix breadcrumbs on top of the public {@link CreatePaymentFlowProps}.\n *\n * @internal\n */\nexport interface CreatePaymentInternalFlowProps extends CreatePaymentFlowProps {\n /**\n * Breadcrumbs prepended to the flow's own breadcrumb trail. Set by a parent flow (e.g.\n * `PaymentFlow`) so the breadcrumb history remains coherent across the handoff.\n */\n prefixBreadcrumbs?: FlowBreadcrumb[]\n}\n\n/**\n * Guided flow to create a contractor payment and review the resulting summary.\n *\n * @remarks\n * This is the inner flow that powers the create-payment spoke of `ContractorManagement.PaymentFlow`.\n * Render it directly when you have built your own payments landing page and want to hand the user\n * off to the standard create-payment experience without re-implementing it. The flow ships with\n * breadcrumb navigation and handles Fast ACH blockers and wire transfer requirements inline.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `contractor/payments/created` | Fired when a payment group is successfully created | The created `ContractorPaymentGroup` |\n * | `contractor/payments/exit` | Fired when the user completes the payment flow | `{ uuid?: string \\| null }` |\n * | `payroll/wire/form/done` | Fired when wire transfer details are submitted | `{ wireInRequest: WireInRequest, confirmationAlert: { title: string, content?: string } }` |\n * | `breadcrumb/navigate` | Fired when the user clicks a breadcrumb to navigate back | `{ key: string, onNavigate: (ctx) => ctx }` |\n *\n * @components\n * - {@link CreatePayment}\n * - {@link PaymentSummary}\n *\n * @param props - See {@link CreatePaymentFlowProps}.\n * @returns The composed create-payment flow.\n * @alpha\n *\n * @example\n * ```tsx title=\"App.tsx\"\n * import { ContractorManagement } from '@gusto/embedded-react-sdk'\n *\n * function MyApp() {\n * return (\n * <ContractorManagement.CreatePaymentFlow\n * companyId=\"a007e1ab-3595-43c2-ab4b-af7a5af2e365\"\n * onEvent={() => {}}\n * />\n * )\n * }\n * ```\n */\nexport function CreatePaymentFlow(props: CreatePaymentFlowProps) {\n return <CreatePaymentInternalFlow {...props} />\n}\n\n/**\n * Flow-internal entry point for {@link CreatePaymentFlow} that additionally accepts\n * flow-injected `prefixBreadcrumbs`. Partners use {@link CreatePaymentFlow}; `PaymentFlow` renders\n * this directly to prepend its own breadcrumb trail.\n *\n * @internal\n */\nexport function CreatePaymentInternalFlow(props: CreatePaymentInternalFlowProps) {\n // Remount and reset all state if companyId ever changes\n return <CreatePaymentFlowMachine key={props.companyId} {...props} />\n}\n\nfunction CreatePaymentFlowMachine({\n companyId,\n onEvent,\n prefixBreadcrumbs = EMPTY_BREADCRUMBS,\n}: CreatePaymentInternalFlowProps) {\n // Built once via a lazy useState initializer. If the companyId ever changes,\n // remount the entire component to reset all state, not just the state machine.\n const [createPaymentFlow] = useState(() => {\n const baseBreadcrumbs = buildBreadcrumbs(createPaymentBreadcrumbsNodes)\n const breadcrumbs = Object.fromEntries(\n Object.entries(baseBreadcrumbs).map(([stateKey, trail]) => [\n stateKey,\n [...prefixBreadcrumbs, ...trail],\n ]),\n )\n\n const initialBreadcrumbContext = updateBreadcrumbs('createPayment', {\n header: {\n type: 'breadcrumbs' as const,\n breadcrumbs,\n },\n })\n\n return createMachine(\n 'createPayment',\n createPaymentMachine,\n (initialContext: CreatePaymentFlowContextInterface) => ({\n ...initialContext,\n ...initialBreadcrumbContext,\n component: CreatePaymentContextual,\n companyId,\n }),\n )\n })\n\n return <Flow machine={createPaymentFlow} onEvent={onEvent} />\n}\n"],"names":["EMPTY_BREADCRUMBS","CreatePaymentFlow","props","jsx","CreatePaymentInternalFlow","CreatePaymentFlowMachine","companyId","onEvent","prefixBreadcrumbs","createPaymentFlow","useState","baseBreadcrumbs","buildBreadcrumbs","createPaymentBreadcrumbsNodes","breadcrumbs","stateKey","trail","initialBreadcrumbContext","updateBreadcrumbs","createMachine","createPaymentMachine","initialContext","CreatePaymentContextual","Flow"],"mappings":";;;;;;;AAYA,MAAMA,IAAsC,CAAA;AAuDrC,SAASC,EAAkBC,GAA+B;AAC/D,SAAO,gBAAAC,EAACC,GAAA,EAA2B,GAAGF,EAAA,CAAO;AAC/C;AASO,SAASE,EAA0BF,GAAuC;AAE/E,SAAO,gBAAAC,EAACE,GAAA,EAAgD,GAAGH,EAAA,GAArBA,EAAM,SAAsB;AACpE;AAEA,SAASG,EAAyB;AAAA,EAChC,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,mBAAAC,IAAoBR;AACtB,GAAmC;AAGjC,QAAM,CAACS,CAAiB,IAAIC,EAAS,MAAM;AACzC,UAAMC,IAAkBC,EAAiBC,CAA6B,GAChEC,IAAc,OAAO;AAAA,MACzB,OAAO,QAAQH,CAAe,EAAE,IAAI,CAAC,CAACI,GAAUC,CAAK,MAAM;AAAA,QACzDD;AAAA,QACA,CAAC,GAAGP,GAAmB,GAAGQ,CAAK;AAAA,MAAA,CAChC;AAAA,IAAA,GAGGC,IAA2BC,EAAkB,iBAAiB;AAAA,MAClE,QAAQ;AAAA,QACN,MAAM;AAAA,QACN,aAAAJ;AAAA,MAAA;AAAA,IACF,CACD;AAED,WAAOK;AAAA,MACL;AAAA,MACAC;AAAA,MACA,CAACC,OAAuD;AAAA,QACtD,GAAGA;AAAA,QACH,GAAGJ;AAAA,QACH,WAAWK;AAAA,QACX,WAAAhB;AAAA,MAAA;AAAA,IACF;AAAA,EAEJ,CAAC;AAED,SAAO,gBAAAH,EAACoB,GAAA,EAAK,SAASd,GAAmB,SAAAF,EAAA,CAAkB;AAC7D;"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { HistoricalPaymentFlowProps } from './HistoricalPaymentFlowComponents';
|
|
2
|
+
import { FlowBreadcrumb } from '../../../Common/FlowBreadcrumbs/FlowBreadcrumbsTypes';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the flow-internal {@link HistoricalPaymentInternalFlow}, which layers a parent flow's
|
|
5
|
+
* prefix breadcrumbs on top of the public {@link HistoricalPaymentFlowProps}.
|
|
6
|
+
*
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
export interface HistoricalPaymentInternalFlowProps extends HistoricalPaymentFlowProps {
|
|
10
|
+
/**
|
|
11
|
+
* Breadcrumbs prepended to this flow's trail. Set by a parent flow (e.g. `PaymentFlow`) so a
|
|
12
|
+
* user can navigate out of this flow entirely -- this flow contributes no breadcrumb items of
|
|
13
|
+
* its own (each of its own screens has its own Back button instead), so the trail is just
|
|
14
|
+
* `prefixBreadcrumbs` passed straight through.
|
|
15
|
+
*/
|
|
16
|
+
prefixBreadcrumbs?: FlowBreadcrumb[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Guided flow to record a historical contractor payment and review the resulting summary.
|
|
20
|
+
*
|
|
21
|
+
* @remarks
|
|
22
|
+
* This is the inner flow that powers the historical-payment spoke of `ContractorManagement.PaymentFlow`.
|
|
23
|
+
* Render it directly when you have built your own payments landing page and want to hand the user
|
|
24
|
+
* off to the standard historical-payment experience without re-implementing it. A historical payment
|
|
25
|
+
* already happened outside Gusto and does not move money, so unlike `CreatePaymentFlow` there is no
|
|
26
|
+
* Fast ACH blocker or wire-transfer step.
|
|
27
|
+
*
|
|
28
|
+
* @events
|
|
29
|
+
* | Event | Description | Data |
|
|
30
|
+
* | ----- | ----------- | ---- |
|
|
31
|
+
* | `contractor/historicalPayments/edit` | The edit modal was opened for a contractor | — |
|
|
32
|
+
* | `contractor/historicalPayments/update` | A contractor's payment values were updated locally | The updated form values (hours, wage, bonus, reimbursement, payment method, etc.) |
|
|
33
|
+
* | `contractor/historicalPayments/preview` | The preview API call succeeded | The contractor payment group preview response |
|
|
34
|
+
* | `contractor/historicalPayments/backToEdit` | The user returned from preview to continue editing | — |
|
|
35
|
+
* | `contractor/historicalPayments/created` | The payment group was successfully created | The created `ContractorPaymentGroup` |
|
|
36
|
+
* | `contractor/historicalPayments/exit` | User is done reviewing the summary | — |
|
|
37
|
+
* | `breadcrumb/navigate` | Fired when the user clicks a breadcrumb injected via `prefixBreadcrumbs` | `{ key: string, onNavigate: (ctx) => ctx }` |
|
|
38
|
+
*
|
|
39
|
+
* @components
|
|
40
|
+
* - {@link CreateHistoricalPayment}
|
|
41
|
+
* - {@link HistoricalPaymentSummary}
|
|
42
|
+
*
|
|
43
|
+
* @param props - See {@link HistoricalPaymentFlowProps}.
|
|
44
|
+
* @returns The composed historical-payment flow.
|
|
45
|
+
* @alpha
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```tsx title="App.tsx"
|
|
49
|
+
* import { ContractorManagement } from '@gusto/embedded-react-sdk'
|
|
50
|
+
*
|
|
51
|
+
* function MyApp() {
|
|
52
|
+
* return (
|
|
53
|
+
* <ContractorManagement.HistoricalPaymentFlow
|
|
54
|
+
* companyId="a007e1ab-3595-43c2-ab4b-af7a5af2e365"
|
|
55
|
+
* onEvent={() => {}}
|
|
56
|
+
* />
|
|
57
|
+
* )
|
|
58
|
+
* }
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export declare function HistoricalPaymentFlow(props: HistoricalPaymentFlowProps): import("react").JSX.Element;
|
|
62
|
+
/**
|
|
63
|
+
* Flow-internal entry point for {@link HistoricalPaymentFlow} that additionally accepts
|
|
64
|
+
* flow-injected `prefixBreadcrumbs`. Partners use {@link HistoricalPaymentFlow}; `PaymentFlow`
|
|
65
|
+
* renders this directly to give the user a way back to the payments landing screen.
|
|
66
|
+
*
|
|
67
|
+
* @internal
|
|
68
|
+
*/
|
|
69
|
+
export declare function HistoricalPaymentInternalFlow(props: HistoricalPaymentInternalFlowProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { createMachine as m } from "robot3";
|
|
3
|
+
import { useState as c } from "react";
|
|
4
|
+
import { historicalPaymentMachine as l } from "./historicalPaymentMachine.js";
|
|
5
|
+
import { CreateHistoricalPaymentContextual as s } from "./HistoricalPaymentFlowComponents.js";
|
|
6
|
+
import { Flow as u } from "../../../Flow/Flow.js";
|
|
7
|
+
import { updateBreadcrumbs as y } from "../../../../helpers/breadcrumbHelpers.js";
|
|
8
|
+
import { useUnstableFeature as P } from "../../../../contexts/UnstableFeaturesProvider/useUnstableFeature.js";
|
|
9
|
+
const f = [];
|
|
10
|
+
function B(t) {
|
|
11
|
+
return /* @__PURE__ */ r(h, { ...t });
|
|
12
|
+
}
|
|
13
|
+
function h(t) {
|
|
14
|
+
return P("historicalPayments", { throwIfDisabled: !0 }), /* @__PURE__ */ r(p, { ...t }, t.companyId);
|
|
15
|
+
}
|
|
16
|
+
function p({
|
|
17
|
+
companyId: t,
|
|
18
|
+
onEvent: a,
|
|
19
|
+
prefixBreadcrumbs: e = f
|
|
20
|
+
}) {
|
|
21
|
+
const [o] = c(() => {
|
|
22
|
+
const i = y("createHistoricalPayment", {
|
|
23
|
+
header: {
|
|
24
|
+
type: "breadcrumbs",
|
|
25
|
+
breadcrumbs: {
|
|
26
|
+
createHistoricalPayment: e,
|
|
27
|
+
historicalPaymentSummary: e
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
return m(
|
|
32
|
+
"createHistoricalPayment",
|
|
33
|
+
l,
|
|
34
|
+
(n) => ({
|
|
35
|
+
...n,
|
|
36
|
+
...i,
|
|
37
|
+
component: s,
|
|
38
|
+
companyId: t
|
|
39
|
+
})
|
|
40
|
+
);
|
|
41
|
+
});
|
|
42
|
+
return /* @__PURE__ */ r(u, { machine: o, onEvent: a });
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
B as HistoricalPaymentFlow,
|
|
46
|
+
h as HistoricalPaymentInternalFlow
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=HistoricalPaymentFlow.js.map
|
package/dist/components/Contractor/Payments/HistoricalPaymentFlow/HistoricalPaymentFlow.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HistoricalPaymentFlow.js","sources":["../../../../../src/components/Contractor/Payments/HistoricalPaymentFlow/HistoricalPaymentFlow.tsx"],"sourcesContent":["import { createMachine } from 'robot3'\nimport { useState } from 'react'\nimport { historicalPaymentMachine } from './historicalPaymentMachine'\nimport {\n CreateHistoricalPaymentContextual,\n type HistoricalPaymentFlowContextInterface,\n type HistoricalPaymentFlowProps,\n} from './HistoricalPaymentFlowComponents'\nimport { Flow } from '@/components/Flow/Flow'\nimport type { FlowBreadcrumb } from '@/components/Common/FlowBreadcrumbs/FlowBreadcrumbsTypes'\nimport { updateBreadcrumbs } from '@/helpers/breadcrumbHelpers'\nimport { useUnstableFeature } from '@/contexts/UnstableFeaturesProvider/useUnstableFeature'\n\nconst EMPTY_BREADCRUMBS: FlowBreadcrumb[] = []\n\n/**\n * Props for the flow-internal {@link HistoricalPaymentInternalFlow}, which layers a parent flow's\n * prefix breadcrumbs on top of the public {@link HistoricalPaymentFlowProps}.\n *\n * @internal\n */\nexport interface HistoricalPaymentInternalFlowProps extends HistoricalPaymentFlowProps {\n /**\n * Breadcrumbs prepended to this flow's trail. Set by a parent flow (e.g. `PaymentFlow`) so a\n * user can navigate out of this flow entirely -- this flow contributes no breadcrumb items of\n * its own (each of its own screens has its own Back button instead), so the trail is just\n * `prefixBreadcrumbs` passed straight through.\n */\n prefixBreadcrumbs?: FlowBreadcrumb[]\n}\n\n/**\n * Guided flow to record a historical contractor payment and review the resulting summary.\n *\n * @remarks\n * This is the inner flow that powers the historical-payment spoke of `ContractorManagement.PaymentFlow`.\n * Render it directly when you have built your own payments landing page and want to hand the user\n * off to the standard historical-payment experience without re-implementing it. A historical payment\n * already happened outside Gusto and does not move money, so unlike `CreatePaymentFlow` there is no\n * Fast ACH blocker or wire-transfer step.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `contractor/historicalPayments/edit` | The edit modal was opened for a contractor | — |\n * | `contractor/historicalPayments/update` | A contractor's payment values were updated locally | The updated form values (hours, wage, bonus, reimbursement, payment method, etc.) |\n * | `contractor/historicalPayments/preview` | The preview API call succeeded | The contractor payment group preview response |\n * | `contractor/historicalPayments/backToEdit` | The user returned from preview to continue editing | — |\n * | `contractor/historicalPayments/created` | The payment group was successfully created | The created `ContractorPaymentGroup` |\n * | `contractor/historicalPayments/exit` | User is done reviewing the summary | — |\n * | `breadcrumb/navigate` | Fired when the user clicks a breadcrumb injected via `prefixBreadcrumbs` | `{ key: string, onNavigate: (ctx) => ctx }` |\n *\n * @components\n * - {@link CreateHistoricalPayment}\n * - {@link HistoricalPaymentSummary}\n *\n * @param props - See {@link HistoricalPaymentFlowProps}.\n * @returns The composed historical-payment flow.\n * @alpha\n *\n * @example\n * ```tsx title=\"App.tsx\"\n * import { ContractorManagement } from '@gusto/embedded-react-sdk'\n *\n * function MyApp() {\n * return (\n * <ContractorManagement.HistoricalPaymentFlow\n * companyId=\"a007e1ab-3595-43c2-ab4b-af7a5af2e365\"\n * onEvent={() => {}}\n * />\n * )\n * }\n * ```\n */\nexport function HistoricalPaymentFlow(props: HistoricalPaymentFlowProps) {\n return <HistoricalPaymentInternalFlow {...props} />\n}\n\n/**\n * Flow-internal entry point for {@link HistoricalPaymentFlow} that additionally accepts\n * flow-injected `prefixBreadcrumbs`. Partners use {@link HistoricalPaymentFlow}; `PaymentFlow`\n * renders this directly to give the user a way back to the payments landing screen.\n *\n * @internal\n */\nexport function HistoricalPaymentInternalFlow(props: HistoricalPaymentInternalFlowProps) {\n useUnstableFeature('historicalPayments', { throwIfDisabled: true })\n\n // Remount and reset all state if companyId ever changes\n return <HistoricalPaymentFlowMachine key={props.companyId} {...props} />\n}\n\nfunction HistoricalPaymentFlowMachine({\n companyId,\n onEvent,\n prefixBreadcrumbs = EMPTY_BREADCRUMBS,\n}: HistoricalPaymentInternalFlowProps) {\n // Built once via a lazy useState initializer. If the companyId ever changes,\n // remount the entire component to reset all state, not just the state machine.\n const [historicalPaymentFlow] = useState(() => {\n const initialBreadcrumbContext = updateBreadcrumbs('createHistoricalPayment', {\n header: {\n type: 'breadcrumbs' as const,\n breadcrumbs: {\n createHistoricalPayment: prefixBreadcrumbs,\n historicalPaymentSummary: prefixBreadcrumbs,\n },\n },\n })\n\n return createMachine(\n 'createHistoricalPayment',\n historicalPaymentMachine,\n (initialContext: HistoricalPaymentFlowContextInterface) => ({\n ...initialContext,\n ...initialBreadcrumbContext,\n component: CreateHistoricalPaymentContextual,\n companyId,\n }),\n )\n })\n\n return <Flow machine={historicalPaymentFlow} onEvent={onEvent} />\n}\n"],"names":["EMPTY_BREADCRUMBS","HistoricalPaymentFlow","props","jsx","HistoricalPaymentInternalFlow","useUnstableFeature","HistoricalPaymentFlowMachine","companyId","onEvent","prefixBreadcrumbs","historicalPaymentFlow","useState","initialBreadcrumbContext","updateBreadcrumbs","createMachine","historicalPaymentMachine","initialContext","CreateHistoricalPaymentContextual","Flow"],"mappings":";;;;;;;;AAaA,MAAMA,IAAsC,CAAA;AA6DrC,SAASC,EAAsBC,GAAmC;AACvE,SAAO,gBAAAC,EAACC,GAAA,EAA+B,GAAGF,EAAA,CAAO;AACnD;AASO,SAASE,EAA8BF,GAA2C;AACvF,SAAAG,EAAmB,sBAAsB,EAAE,iBAAiB,GAAA,CAAM,GAG3D,gBAAAF,EAACG,GAAA,EAAoD,GAAGJ,EAAA,GAArBA,EAAM,SAAsB;AACxE;AAEA,SAASI,EAA6B;AAAA,EACpC,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,mBAAAC,IAAoBT;AACtB,GAAuC;AAGrC,QAAM,CAACU,CAAqB,IAAIC,EAAS,MAAM;AAC7C,UAAMC,IAA2BC,EAAkB,2BAA2B;AAAA,MAC5E,QAAQ;AAAA,QACN,MAAM;AAAA,QACN,aAAa;AAAA,UACX,yBAAyBJ;AAAA,UACzB,0BAA0BA;AAAA,QAAA;AAAA,MAC5B;AAAA,IACF,CACD;AAED,WAAOK;AAAA,MACL;AAAA,MACAC;AAAA,MACA,CAACC,OAA2D;AAAA,QAC1D,GAAGA;AAAA,QACH,GAAGJ;AAAA,QACH,WAAWK;AAAA,QACX,WAAAV;AAAA,MAAA;AAAA,IACF;AAAA,EAEJ,CAAC;AAED,SAAO,gBAAAJ,EAACe,GAAA,EAAK,SAASR,GAAuB,SAAAF,EAAA,CAAkB;AACjE;"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FlowContextInterface } from '../../../Flow/useFlow';
|
|
2
|
+
import { BaseComponentInterface } from '../../../Base';
|
|
3
|
+
/**
|
|
4
|
+
* Props for {@link HistoricalPaymentFlow}.
|
|
5
|
+
*
|
|
6
|
+
* @alpha
|
|
7
|
+
*/
|
|
8
|
+
export interface HistoricalPaymentFlowProps extends BaseComponentInterface<never> {
|
|
9
|
+
/** The associated company identifier. */
|
|
10
|
+
companyId: string;
|
|
11
|
+
}
|
|
12
|
+
/** @internal */
|
|
13
|
+
export interface HistoricalPaymentFlowContextInterface extends FlowContextInterface {
|
|
14
|
+
companyId: string;
|
|
15
|
+
createdPaymentGroupId?: string;
|
|
16
|
+
}
|
|
17
|
+
/** @internal */
|
|
18
|
+
export declare function CreateHistoricalPaymentContextual(): import("react").JSX.Element;
|
|
19
|
+
/** @internal */
|
|
20
|
+
export declare function HistoricalPaymentSummaryContextual(): import("react").JSX.Element;
|
package/dist/components/Contractor/Payments/HistoricalPaymentFlow/HistoricalPaymentFlowComponents.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { CreateHistoricalPayment as a } from "../CreateHistoricalPayment/CreateHistoricalPayment.js";
|
|
3
|
+
import { HistoricalPaymentSummary as i } from "../HistoricalPaymentSummary/HistoricalPaymentSummary.js";
|
|
4
|
+
import { useFlow as e } from "../../../Flow/useFlow.js";
|
|
5
|
+
import { ensureRequired as r } from "../../../../helpers/ensureRequired.js";
|
|
6
|
+
function d() {
|
|
7
|
+
const { companyId: t, onEvent: o } = e();
|
|
8
|
+
return /* @__PURE__ */ n(a, { onEvent: o, companyId: r(t) });
|
|
9
|
+
}
|
|
10
|
+
function f() {
|
|
11
|
+
const { createdPaymentGroupId: t, companyId: o, onEvent: m } = e();
|
|
12
|
+
return /* @__PURE__ */ n(
|
|
13
|
+
i,
|
|
14
|
+
{
|
|
15
|
+
onEvent: m,
|
|
16
|
+
paymentGroupId: r(t),
|
|
17
|
+
companyId: r(o)
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
d as CreateHistoricalPaymentContextual,
|
|
23
|
+
f as HistoricalPaymentSummaryContextual
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=HistoricalPaymentFlowComponents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HistoricalPaymentFlowComponents.js","sources":["../../../../../src/components/Contractor/Payments/HistoricalPaymentFlow/HistoricalPaymentFlowComponents.tsx"],"sourcesContent":["import { CreateHistoricalPayment } from '../CreateHistoricalPayment/CreateHistoricalPayment'\nimport { HistoricalPaymentSummary } from '../HistoricalPaymentSummary/HistoricalPaymentSummary'\nimport { useFlow, type FlowContextInterface } from '@/components/Flow/useFlow'\nimport type { BaseComponentInterface } from '@/components/Base'\nimport { ensureRequired } from '@/helpers/ensureRequired'\n\n/**\n * Props for {@link HistoricalPaymentFlow}.\n *\n * @alpha\n */\nexport interface HistoricalPaymentFlowProps extends BaseComponentInterface<never> {\n /** The associated company identifier. */\n companyId: string\n}\n\n/** @internal */\nexport interface HistoricalPaymentFlowContextInterface extends FlowContextInterface {\n companyId: string\n createdPaymentGroupId?: string\n}\n\n/** @internal */\nexport function CreateHistoricalPaymentContextual() {\n const { companyId, onEvent } = useFlow<HistoricalPaymentFlowContextInterface>()\n return <CreateHistoricalPayment onEvent={onEvent} companyId={ensureRequired(companyId)} />\n}\n\n/** @internal */\nexport function HistoricalPaymentSummaryContextual() {\n const { createdPaymentGroupId, companyId, onEvent } =\n useFlow<HistoricalPaymentFlowContextInterface>()\n\n return (\n <HistoricalPaymentSummary\n onEvent={onEvent}\n paymentGroupId={ensureRequired(createdPaymentGroupId)}\n companyId={ensureRequired(companyId)}\n />\n )\n}\n"],"names":["CreateHistoricalPaymentContextual","companyId","onEvent","useFlow","CreateHistoricalPayment","ensureRequired","HistoricalPaymentSummaryContextual","createdPaymentGroupId","jsx","HistoricalPaymentSummary"],"mappings":";;;;;AAuBO,SAASA,IAAoC;AAClD,QAAM,EAAE,WAAAC,GAAW,SAAAC,EAAA,IAAYC,EAAA;AAC/B,2BAAQC,GAAA,EAAwB,SAAAF,GAAkB,WAAWG,EAAeJ,CAAS,GAAG;AAC1F;AAGO,SAASK,IAAqC;AACnD,QAAM,EAAE,uBAAAC,GAAuB,WAAAN,GAAW,SAAAC,EAAA,IACxCC,EAAA;AAEF,SACE,gBAAAK;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,SAAAP;AAAA,MACA,gBAAgBG,EAAeE,CAAqB;AAAA,MACpD,WAAWF,EAAeJ,CAAS;AAAA,IAAA;AAAA,EAAA;AAGzC;"}
|
package/dist/components/Contractor/Payments/HistoricalPaymentFlow/historicalPaymentMachine.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Flow machine for {@link HistoricalPaymentFlow}.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* `historicalPaymentSummary` is a plain zero-transition state, not a robot3 `final()` state:
|
|
6
|
+
* `HistoricalPaymentFlow` can be mounted directly by a partner, so `contractor/historicalPayments/exit`
|
|
7
|
+
* bubbles up via `onEvent` without a local transition, keeping the summary screen interactive if the
|
|
8
|
+
* host doesn't unmount the component immediately (see SDK-1169).
|
|
9
|
+
*
|
|
10
|
+
* Unlike `createPaymentMachine`, neither state contributes its own breadcrumb item -- each of this
|
|
11
|
+
* flow's own screens has its own Back button instead. `updateBreadcrumbs` here only keeps
|
|
12
|
+
* `currentBreadcrumbId` in sync so a parent flow's injected `prefixBreadcrumbs` (see
|
|
13
|
+
* `HistoricalPaymentInternalFlow`) stays visible as the active trail across both states.
|
|
14
|
+
*
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export declare const historicalPaymentMachine: {
|
|
18
|
+
createHistoricalPayment: import('robot3').MachineState<any>;
|
|
19
|
+
historicalPaymentSummary: import('robot3').MachineState<any>;
|
|
20
|
+
};
|