@gusto/embedded-react-sdk 0.9.0 → 0.10.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 +82 -2
- package/dist/components/Common/OnboardingStatusBadge/index.d.ts +21 -0
- package/dist/components/Common/OnboardingStatusBadge/index.js +17 -0
- package/dist/components/Common/OnboardingStatusBadge/index.js.map +1 -0
- package/dist/components/Common/SignatureForm/SignatureFormActions.js +8 -7
- package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormFields.js +5 -4
- package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
- package/dist/components/Common/TaxInputs/TaxInputs.js +42 -36
- package/dist/components/Common/TaxInputs/TaxInputs.js.map +1 -1
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +7 -6
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +9 -8
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +7 -6
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +3 -2
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js +7 -6
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +8 -7
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +6 -5
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Company/FederalTaxes/Actions.js +7 -6
- package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
- package/dist/components/Company/Industry/Actions.js +6 -5
- package/dist/components/Company/Industry/Actions.js.map +1 -1
- package/dist/components/Company/Industry/Edit.js +11 -10
- package/dist/components/Company/Industry/Edit.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Actions.js +3 -2
- package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/Actions.js +3 -2
- package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/List.js +7 -6
- package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Actions.js +11 -10
- package/dist/components/Company/PaySchedule/_parts/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +6 -5
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +7 -6
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js +6 -5
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
- package/dist/components/Contractor/Address/Form.js +4 -4
- package/dist/components/Contractor/List/index.d.ts +25 -0
- package/dist/components/Contractor/List/index.js +84 -0
- package/dist/components/Contractor/List/index.js.map +1 -0
- package/dist/components/Contractor/List/useContractorList.d.ts +20 -0
- package/dist/components/Contractor/List/useContractorList.js +31 -0
- package/dist/components/Contractor/List/useContractorList.js.map +1 -0
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.d.ts +2 -0
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +53 -0
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -0
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.d.ts +31 -0
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +108 -0
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -0
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.d.ts +11 -0
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +35 -0
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js.map +1 -0
- package/dist/components/Contractor/PaymentMethod/types.d.ts +8 -0
- package/dist/components/Contractor/index.d.ts +2 -0
- package/dist/components/Contractor/index.js +6 -2
- package/dist/components/Contractor/index.js.map +1 -1
- package/dist/components/Employee/Compensation/Actions.js +1 -1
- package/dist/components/Employee/Compensation/Edit.js +59 -56
- package/dist/components/Employee/Compensation/Edit.js.map +1 -1
- package/dist/components/Employee/Compensation/List.js +6 -5
- package/dist/components/Employee/Compensation/List.js.map +1 -1
- package/dist/components/Employee/Compensation/useCompensation.d.ts +2 -0
- package/dist/components/Employee/Compensation/useCompensation.js +16 -14
- package/dist/components/Employee/Compensation/useCompensation.js.map +1 -1
- package/dist/components/Employee/Deductions/Actions.js +9 -8
- package/dist/components/Employee/Deductions/Actions.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionForm.js +14 -5
- package/dist/components/Employee/Deductions/DeductionForm.js.map +1 -1
- package/dist/components/Employee/Deductions/Deductions.js +25 -25
- package/dist/components/Employee/Deductions/Deductions.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsList.js +3 -2
- package/dist/components/Employee/Deductions/DeductionsList.js.map +1 -1
- package/dist/components/Employee/Deductions/IncludeDeductionsForm.js +3 -2
- package/dist/components/Employee/Deductions/IncludeDeductionsForm.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +5 -4
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Employee/EmployeeList/Actions.js +5 -4
- package/dist/components/Employee/EmployeeList/Actions.js.map +1 -1
- package/dist/components/Employee/EmployeeList/List.js +58 -53
- package/dist/components/Employee/EmployeeList/List.js.map +1 -1
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +48 -43
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/Actions.js +6 -5
- package/dist/components/Employee/PaymentMethod/Actions.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountEdit.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountsList.js +3 -2
- package/dist/components/Employee/PaymentMethod/BankAccountsList.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/PaymentMethod.js +3 -4
- package/dist/components/Employee/PaymentMethod/PaymentMethod.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +1 -1
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/Split.js +88 -76
- package/dist/components/Employee/PaymentMethod/Split.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.d.ts +2 -2
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +29 -25
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/Actions.js +7 -6
- package/dist/components/Employee/Profile/Actions.js.map +1 -1
- package/dist/components/Employee/Profile/AdminPersonalDetails.d.ts +49 -20
- package/dist/components/Employee/Profile/AdminPersonalDetails.js +27 -25
- package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js +10 -9
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
- package/dist/components/Employee/Profile/Profile.js +124 -120
- package/dist/components/Employee/Profile/Profile.js.map +1 -1
- package/dist/components/Employee/Taxes/Actions.js +8 -7
- package/dist/components/Employee/Taxes/Actions.js.map +1 -1
- package/dist/components/Employee/Taxes/FederalForm.js +5 -4
- package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
- package/dist/components/Employee/Taxes/StateForm.d.ts +1 -1
- package/dist/components/Employee/Taxes/StateForm.js +27 -25
- package/dist/components/Employee/Taxes/StateForm.js.map +1 -1
- package/dist/components/Employee/Taxes/Taxes.d.ts +1 -1
- package/dist/components/Employee/Taxes/Taxes.js +77 -73
- package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +8 -7
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/i18n/I18n.js +15 -15
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Contractor.ContractorList.json.js +25 -0
- package/dist/i18n/en/Contractor.ContractorList.json.js.map +1 -0
- package/dist/i18n/en/Contractor.PaymentMethod.json.js +35 -0
- package/dist/i18n/en/Contractor.PaymentMethod.json.js.map +1 -0
- package/dist/i18n/en/Employee.Compensation.json.js +22 -20
- package/dist/i18n/en/Employee.Compensation.json.js.map +1 -1
- package/dist/i18n/en/Employee.PaymentMethod.json.js +18 -17
- package/dist/i18n/en/Employee.PaymentMethod.json.js.map +1 -1
- package/dist/i18n/en/common.json.d.ts +21 -9
- package/dist/i18n/en/common.json.js +35 -23
- package/dist/i18n/en/common.json.js.map +1 -1
- package/dist/index.js +4 -4
- package/dist/shared/constants.d.ts +14 -0
- package/dist/shared/constants.js +26 -15
- package/dist/shared/constants.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/i18next.d.ts +52 -1
- package/package.json +4 -3
- package/dist/components/Employee/PaymentMethod/Constants.d.ts +0 -8
- package/dist/components/Employee/PaymentMethod/Constants.js +0 -6
- package/dist/components/Employee/PaymentMethod/Constants.js.map +0 -1
|
@@ -1,150 +1,162 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useFormContext as
|
|
3
|
-
import { useTranslation as g, Trans as
|
|
4
|
-
import { ErrorMessage as
|
|
5
|
-
import
|
|
1
|
+
import { jsxs as x, Fragment as E, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useFormContext as B } from "react-hook-form";
|
|
3
|
+
import { useTranslation as g, Trans as V } from "react-i18next";
|
|
4
|
+
import { ErrorMessage as z } from "@hookform/error-message";
|
|
5
|
+
import y from "dompurify";
|
|
6
6
|
import { useMemo as j, useEffect as D } from "react";
|
|
7
7
|
import { usePaymentMethod as N } from "./usePaymentMethod.js";
|
|
8
|
-
import { SPLIT_BY as
|
|
8
|
+
import { SPLIT_BY as h } from "../../../shared/constants.js";
|
|
9
9
|
import { useLocale as q } from "../../../contexts/LocaleProvider/useLocale.js";
|
|
10
10
|
import { useComponentContext as w } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
11
11
|
import { ReorderableList as I } from "../../Common/ReorderableList/ReorderableList.js";
|
|
12
|
-
import { RadioGroupField as
|
|
12
|
+
import { RadioGroupField as W } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
13
13
|
import { NumberInputField as F } from "../../Common/Fields/NumberInputField/NumberInputField.js";
|
|
14
14
|
function oe() {
|
|
15
|
-
const { paymentMethod:
|
|
16
|
-
control:
|
|
15
|
+
const { paymentMethod: r, bankAccounts: m, mode: c } = N(), {
|
|
16
|
+
control: s,
|
|
17
17
|
setValue: o,
|
|
18
18
|
resetField: S,
|
|
19
19
|
watch: A,
|
|
20
|
-
formState: { errors:
|
|
21
|
-
} =
|
|
22
|
-
(e, [
|
|
20
|
+
formState: { errors: v }
|
|
21
|
+
} = B(), { t: u } = g("Employee.PaymentMethod"), d = A("splitBy"), L = A("priority"), a = j(() => r.splits ?? [], [r.splits]), l = Object.entries(L).reduce(
|
|
22
|
+
(e, [t, i]) => !e || (L[e] ?? 0) < i ? t : e,
|
|
23
23
|
""
|
|
24
|
-
), { currency:
|
|
24
|
+
), { currency: $ } = q();
|
|
25
25
|
D(() => {
|
|
26
|
-
if (
|
|
27
|
-
if (
|
|
28
|
-
const e =
|
|
26
|
+
if (a.length)
|
|
27
|
+
if (d === h.amount) {
|
|
28
|
+
const e = a.reduce((t, i) => (t[i.uuid] = i.uuid === l ? null : 0, t), {});
|
|
29
29
|
o("splitAmount", e);
|
|
30
30
|
} else {
|
|
31
|
-
const e =
|
|
31
|
+
const e = a.reduce((t, i, p) => (t[i.uuid] = p === 0 ? 100 : 0, t), {});
|
|
32
32
|
o("splitAmount", e);
|
|
33
33
|
}
|
|
34
|
-
}, [
|
|
35
|
-
const
|
|
36
|
-
if (c !== "SPLIT" || m.length < 2 ||
|
|
34
|
+
}, [d, a, l, o]);
|
|
35
|
+
const f = w();
|
|
36
|
+
if (c !== "SPLIT" || m.length < 2 || r.splits === null) return null;
|
|
37
37
|
o("isSplit", !0);
|
|
38
|
-
const
|
|
39
|
-
o(`splitAmount.${e}`,
|
|
38
|
+
const b = (e, t) => {
|
|
39
|
+
o(`splitAmount.${e}`, t);
|
|
40
40
|
}, C = (e) => {
|
|
41
|
-
const
|
|
42
|
-
(M,
|
|
43
|
-
const P =
|
|
44
|
-
return P ? { ...M, [P.uuid]:
|
|
41
|
+
const t = e.reduce(
|
|
42
|
+
(M, T, _) => {
|
|
43
|
+
const P = a[T];
|
|
44
|
+
return P ? { ...M, [P.uuid]: _ + 1 } : M;
|
|
45
45
|
},
|
|
46
46
|
{}
|
|
47
47
|
), i = e[e.length - 1];
|
|
48
48
|
if (i === void 0) return;
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
}, R = () =>
|
|
49
|
+
const p = a[i];
|
|
50
|
+
p && (o("priority", t), l && l !== p.uuid && (S(`splitAmount.${l}`), b(l, 0)), b(p.uuid, null));
|
|
51
|
+
}, R = () => d === h.amount ? /* @__PURE__ */ n(
|
|
52
52
|
I,
|
|
53
53
|
{
|
|
54
|
-
label:
|
|
55
|
-
items:
|
|
54
|
+
label: u("draggableListLabel"),
|
|
55
|
+
items: a.map((e) => ({
|
|
56
56
|
label: e.name,
|
|
57
|
-
content: /* @__PURE__ */
|
|
58
|
-
|
|
57
|
+
content: /* @__PURE__ */ n(
|
|
58
|
+
k,
|
|
59
59
|
{
|
|
60
60
|
split: e,
|
|
61
|
-
onChange: (
|
|
62
|
-
|
|
61
|
+
onChange: (t) => {
|
|
62
|
+
b(e.uuid, t);
|
|
63
63
|
},
|
|
64
|
-
remainderId:
|
|
64
|
+
remainderId: l
|
|
65
65
|
},
|
|
66
66
|
`amount-${e.uuid}`
|
|
67
67
|
)
|
|
68
68
|
})),
|
|
69
69
|
onReorder: C
|
|
70
70
|
},
|
|
71
|
-
`reorderable-amount-list-${
|
|
72
|
-
) :
|
|
73
|
-
|
|
71
|
+
`reorderable-amount-list-${d}`
|
|
72
|
+
) : a.map((e) => /* @__PURE__ */ n(
|
|
73
|
+
G,
|
|
74
74
|
{
|
|
75
75
|
split: e,
|
|
76
|
-
control:
|
|
77
|
-
onChange: (
|
|
78
|
-
|
|
76
|
+
control: s,
|
|
77
|
+
onChange: (t) => {
|
|
78
|
+
b(e.uuid, t);
|
|
79
79
|
},
|
|
80
|
-
currency:
|
|
80
|
+
currency: $
|
|
81
81
|
},
|
|
82
82
|
`percentage-${e.uuid}`
|
|
83
83
|
));
|
|
84
|
-
return /* @__PURE__ */
|
|
85
|
-
/* @__PURE__ */
|
|
86
|
-
|
|
84
|
+
return /* @__PURE__ */ x(E, { children: [
|
|
85
|
+
/* @__PURE__ */ n(
|
|
86
|
+
z,
|
|
87
87
|
{
|
|
88
|
-
errors:
|
|
89
|
-
name: "
|
|
90
|
-
render: (
|
|
88
|
+
errors: v,
|
|
89
|
+
name: "splitAmount.root",
|
|
90
|
+
render: ({ message: e }) => {
|
|
91
|
+
if (e && e.startsWith("percentage_split_total_error:")) {
|
|
92
|
+
const t = e.split(":")[1] || "0";
|
|
93
|
+
return /* @__PURE__ */ n(
|
|
94
|
+
f.Alert,
|
|
95
|
+
{
|
|
96
|
+
status: "error",
|
|
97
|
+
label: u("validations.percentageErrorWithTotal", { total: t })
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
return /* @__PURE__ */ n(f.Alert, { status: "error", label: u("validations.percentageError") });
|
|
102
|
+
}
|
|
91
103
|
}
|
|
92
104
|
),
|
|
93
|
-
/* @__PURE__ */
|
|
94
|
-
/* @__PURE__ */
|
|
95
|
-
/* @__PURE__ */
|
|
96
|
-
|
|
105
|
+
/* @__PURE__ */ n(f.Heading, { as: "h2", children: u("title") }),
|
|
106
|
+
/* @__PURE__ */ n(V, { t: u, i18nKey: "splitDescription", components: { p: /* @__PURE__ */ n(f.Text, {}) } }),
|
|
107
|
+
/* @__PURE__ */ n(
|
|
108
|
+
W,
|
|
97
109
|
{
|
|
98
110
|
name: "splitBy",
|
|
99
|
-
label:
|
|
111
|
+
label: u("splitByLabel"),
|
|
100
112
|
options: [
|
|
101
|
-
{ value:
|
|
102
|
-
{ value:
|
|
113
|
+
{ value: h.percentage, label: u("percentageLabel") },
|
|
114
|
+
{ value: h.amount, label: u("amountLabel") }
|
|
103
115
|
]
|
|
104
116
|
}
|
|
105
117
|
),
|
|
106
|
-
|
|
118
|
+
r.splits && R()
|
|
107
119
|
] });
|
|
108
120
|
}
|
|
109
|
-
function
|
|
110
|
-
split:
|
|
121
|
+
function k({
|
|
122
|
+
split: r,
|
|
111
123
|
remainderId: m,
|
|
112
124
|
onChange: c
|
|
113
125
|
}) {
|
|
114
|
-
const { t:
|
|
115
|
-
return /* @__PURE__ */
|
|
126
|
+
const { t: s } = g("Employee.PaymentMethod");
|
|
127
|
+
return /* @__PURE__ */ n(
|
|
116
128
|
F,
|
|
117
129
|
{
|
|
118
|
-
name: `splitAmount.${
|
|
119
|
-
label:
|
|
120
|
-
name:
|
|
121
|
-
account_number:
|
|
130
|
+
name: `splitAmount.${r.uuid}`,
|
|
131
|
+
label: s("splitAmountLabel", {
|
|
132
|
+
name: y.sanitize(r.name ?? ""),
|
|
133
|
+
account_number: y.sanitize(r.hiddenAccountNumber ?? ""),
|
|
122
134
|
interpolation: { escapeValue: !1 }
|
|
123
135
|
}),
|
|
124
136
|
format: "currency",
|
|
125
137
|
min: 0,
|
|
126
138
|
isRequired: !0,
|
|
127
|
-
errorMessage:
|
|
128
|
-
placeholder: m ===
|
|
129
|
-
isDisabled: m ===
|
|
139
|
+
errorMessage: s("validations.amountError"),
|
|
140
|
+
placeholder: m === r.uuid ? s("remainderLabel") : "",
|
|
141
|
+
isDisabled: m === r.uuid,
|
|
130
142
|
onChange: c
|
|
131
143
|
}
|
|
132
144
|
);
|
|
133
145
|
}
|
|
134
|
-
function
|
|
135
|
-
split:
|
|
146
|
+
function G({
|
|
147
|
+
split: r,
|
|
136
148
|
control: m,
|
|
137
149
|
onChange: c,
|
|
138
|
-
currency:
|
|
150
|
+
currency: s
|
|
139
151
|
}) {
|
|
140
152
|
const { t: o } = g("Employee.PaymentMethod");
|
|
141
|
-
return /* @__PURE__ */
|
|
153
|
+
return /* @__PURE__ */ n(E, { children: /* @__PURE__ */ n(
|
|
142
154
|
F,
|
|
143
155
|
{
|
|
144
|
-
name: `splitAmount.${
|
|
156
|
+
name: `splitAmount.${r.uuid}`,
|
|
145
157
|
label: o("splitAmountLabel", {
|
|
146
|
-
name:
|
|
147
|
-
account_number:
|
|
158
|
+
name: y.sanitize(r.name ?? ""),
|
|
159
|
+
account_number: y.sanitize(r.hiddenAccountNumber ?? ""),
|
|
148
160
|
interpolation: { escapeValue: !1 }
|
|
149
161
|
}),
|
|
150
162
|
format: "percent",
|
|
@@ -153,7 +165,7 @@ function H({
|
|
|
153
165
|
errorMessage: o("validations.amountError"),
|
|
154
166
|
onChange: c
|
|
155
167
|
}
|
|
156
|
-
) },
|
|
168
|
+
) }, r.uuid);
|
|
157
169
|
}
|
|
158
170
|
export {
|
|
159
171
|
oe as Split
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Split.js","sources":["../../../../src/components/Employee/PaymentMethod/Split.tsx"],"sourcesContent":["import type { Control } from 'react-hook-form'\nimport { useFormContext } from 'react-hook-form'\nimport { Trans, useTranslation } from 'react-i18next'\nimport { type EmployeePaymentMethod } from '@gusto/embedded-api/models/components/employeepaymentmethod'\nimport { ErrorMessage } from '@hookform/error-message'\nimport { Fragment } from 'react/jsx-runtime'\nimport DOMPurify from 'dompurify'\nimport { useEffect, useMemo } from 'react'\nimport { usePaymentMethod, type CombinedSchemaInputs } from './usePaymentMethod'\nimport { SPLIT_BY } from './Constants'\nimport { NumberInputField, RadioGroupField } from '@/components/Common'\nimport { useLocale } from '@/contexts/LocaleProvider'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { ReorderableList } from '@/components/Common/ReorderableList'\n\ntype Split = NonNullable<EmployeePaymentMethod['splits']>[number]\n\nexport function Split() {\n const { paymentMethod, bankAccounts, mode } = usePaymentMethod()\n const {\n control,\n setValue,\n resetField,\n watch,\n formState: { errors },\n } = useFormContext<CombinedSchemaInputs>()\n const { t } = useTranslation('Employee.PaymentMethod')\n const splitBy = watch('splitBy')\n const priorities = watch('priority')\n\n const splits = useMemo(() => paymentMethod.splits ?? [], [paymentMethod.splits])\n\n const remainderId = Object.entries(priorities).reduce(\n (maxId, [uuid, priority]) => (!maxId || (priorities[maxId] ?? 0) < priority ? uuid : maxId),\n '',\n )\n\n const { currency } = useLocale()\n\n // Handle splitBy value changes\n useEffect(() => {\n // Only run cleanup if splits exist\n if (!splits.length) return\n\n // Clean up when switching modes\n if (splitBy === SPLIT_BY.amount) {\n // When switching to amount mode, set the last item as remainder (null) and others to 0\n const newAmountValues = splits.reduce<Record<string, number | null>>((acc, curr) => {\n acc[curr.uuid] = curr.uuid === remainderId ? null : 0\n return acc\n }, {})\n setValue('splitAmount', newAmountValues)\n } else {\n // When switching to percentage mode, set the first item to 100% and others to 0\n const newPercentageValues = splits.reduce<Record<string, number>>((acc, curr, index) => {\n acc[curr.uuid] = index === 0 ? 100 : 0\n return acc\n }, {})\n setValue('splitAmount', newPercentageValues)\n }\n }, [splitBy, splits, remainderId, setValue])\n\n const Components = useComponentContext()\n\n if (mode !== 'SPLIT' || bankAccounts.length < 2 || paymentMethod.splits === null) return null\n //Used by form schema to determine variant\n setValue('isSplit', true)\n\n const updateSplitAmount = (uuid: string, value: number | null) => {\n setValue(`splitAmount.${uuid}`, value)\n }\n\n const handleReorder = (newOrder: number[]) => {\n // Calculate new priorities based on new order\n const newPriorities = newOrder.reduce(\n (acc: Record<string, number>, curr: number, currIndex: number) => {\n const split = splits[curr]\n return split ? { ...acc, [split.uuid]: currIndex + 1 } : acc\n },\n {},\n )\n\n // Get the last split in the new order\n const lastSplitIndex = newOrder[newOrder.length - 1]\n if (lastSplitIndex === undefined) return\n\n const lastSplit = splits[lastSplitIndex]\n if (!lastSplit) return\n\n // Update priorities\n setValue('priority', newPriorities)\n\n // Clear the previous remainder if different from the new one\n if (remainderId && remainderId !== lastSplit.uuid) {\n resetField(`splitAmount.${remainderId}`)\n updateSplitAmount(remainderId, 0)\n }\n\n // Set the new last item to null (remainder)\n updateSplitAmount(lastSplit.uuid, null)\n }\n\n const renderFieldsList = () => {\n if (splitBy === SPLIT_BY.amount) {\n return (\n <ReorderableList\n key={`reorderable-amount-list-${splitBy}`}\n label={t('draggableListLabel')}\n items={splits.map(split => ({\n label: split.name as string,\n content: (\n <AmountField\n key={`amount-${split.uuid}`}\n split={split}\n onChange={value => {\n updateSplitAmount(split.uuid, value)\n }}\n remainderId={remainderId}\n />\n ),\n }))}\n onReorder={handleReorder}\n />\n )\n }\n\n return splits.map(split => (\n <PercentageField\n key={`percentage-${split.uuid}`}\n split={split}\n control={control}\n onChange={value => {\n updateSplitAmount(split.uuid, value)\n }}\n currency={currency}\n />\n ))\n }\n\n return (\n <>\n <ErrorMessage\n errors={errors}\n name=\"split_amount.root\"\n render={() => <Components.Alert status=\"error\" label={t('validations.percentageError')} />}\n />\n <Components.Heading as=\"h2\">{t('title')}</Components.Heading>\n <Trans t={t} i18nKey=\"splitDescription\" components={{ p: <Components.Text /> }} />\n <RadioGroupField\n name=\"splitBy\"\n label={t('splitByLabel')}\n options={[\n { value: SPLIT_BY.percentage, label: t('percentageLabel') },\n { value: SPLIT_BY.amount, label: t('amountLabel') },\n ]}\n />\n {paymentMethod.splits && renderFieldsList()}\n </>\n )\n}\n\nfunction AmountField({\n split,\n remainderId,\n onChange,\n}: {\n split: Split\n remainderId: string\n onChange: (value: number | null) => void\n}) {\n const { t } = useTranslation('Employee.PaymentMethod')\n return (\n <NumberInputField\n name={`splitAmount.${split.uuid}`}\n label={t('splitAmountLabel', {\n name: DOMPurify.sanitize(split.name ?? ''),\n account_number: DOMPurify.sanitize(split.hiddenAccountNumber ?? ''),\n interpolation: { escapeValue: false },\n })}\n format=\"currency\"\n min={0}\n isRequired\n errorMessage={t('validations.amountError')}\n placeholder={remainderId === split.uuid ? t('remainderLabel') : ''}\n isDisabled={remainderId === split.uuid}\n onChange={onChange}\n />\n )\n}\n\nfunction PercentageField({\n split,\n control,\n onChange,\n currency,\n}: {\n split: Split\n control: Control<CombinedSchemaInputs>\n onChange: (value: number) => void\n currency: string\n}) {\n const { t } = useTranslation('Employee.PaymentMethod')\n return (\n <Fragment key={split.uuid}>\n <NumberInputField\n name={`splitAmount.${split.uuid}`}\n label={t('splitAmountLabel', {\n name: DOMPurify.sanitize(split.name ?? ''),\n account_number: DOMPurify.sanitize(split.hiddenAccountNumber ?? ''),\n interpolation: { escapeValue: false },\n })}\n format=\"percent\"\n min={0}\n isRequired\n errorMessage={t('validations.amountError')}\n onChange={onChange}\n />\n </Fragment>\n )\n}\n"],"names":["Split","paymentMethod","bankAccounts","mode","usePaymentMethod","control","setValue","resetField","watch","errors","useFormContext","t","useTranslation","splitBy","priorities","splits","useMemo","remainderId","maxId","uuid","priority","currency","useLocale","useEffect","SPLIT_BY","newAmountValues","acc","curr","newPercentageValues","index","Components","useComponentContext","updateSplitAmount","value","handleReorder","newOrder","newPriorities","currIndex","split","lastSplitIndex","lastSplit","renderFieldsList","jsx","ReorderableList","AmountField","PercentageField","jsxs","Fragment","ErrorMessage","Trans","RadioGroupField","onChange","NumberInputField","DOMPurify"],"mappings":";;;;;;;;;;;;;AAiBO,SAASA,KAAQ;AACtB,QAAM,EAAE,eAAAC,GAAe,cAA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f,EAAM,QAAQ,EAAE;AAAA,QACzC,gBAAgBe,EAAU,SAASf,EAAM,uBAAuB,EAAE;AAAA,QAClE,eAAe,EAAE,aAAa,GAAM;AAAA,MAAA,CACrC;AAAA,MACD,QAAO;AAAA,MACP,KAAK;AAAA,MACL,YAAU;AAAA,MACV,cAAc3B,EAAE,yBAAyB;AAAA,MACzC,aAAaM,MAAgBqB,EAAM,OAAO3B,EAAE,gBAAgB,IAAI;AAAA,MAChE,YAAYM,MAAgBqB,EAAM;AAAA,MAClC,UAAAa;AAAA,IAAA;AAAA,EACF;AAEJ;AAEA,SAASN,EAAgB;AAAA,EACvB,OAAAP;AAAA,EACA,SAAAjC;AAAA,EACA,UAAA8C;AAAA,EACA,UAAA9B;AACF,GAKG;AACD,QAAM,EAAE,GAAAV,EAAA,IAAMC,EAAe,wBAAwB;AAEnD,SAAA,gBAAA8B,EAACK,GAAA,EACC,UAAA,gBAAAL;AAAA,IAACU;AAAA,IAAA;AAAA,MACC,MAAM,eAAed,EAAM,IAAI;AAAA,MAC/B,OAAO3B,EAAE,oBAAoB;AAAA,QAC3B,MAAM0C,EAAU,SAASf,EAAM,QAAQ,EAAE;AAAA,QACzC,gBAAgBe,EAAU,SAASf,EAAM,uBAAuB,EAAE;AAAA,QAClE,eAAe,EAAE,aAAa,GAAM;AAAA,MAAA,CACrC;AAAA,MACD,QAAO;AAAA,MACP,KAAK;AAAA,MACL,YAAU;AAAA,MACV,cAAc3B,EAAE,yBAAyB;AAAA,MACzC,UAAAwC;AAAA,IAAA;AAAA,EAAA,EACF,GAbab,EAAM,IAcrB;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"Split.js","sources":["../../../../src/components/Employee/PaymentMethod/Split.tsx"],"sourcesContent":["import type { Control } from 'react-hook-form'\nimport { useFormContext } from 'react-hook-form'\nimport { Trans, useTranslation } from 'react-i18next'\nimport { type EmployeePaymentMethod } from '@gusto/embedded-api/models/components/employeepaymentmethod'\nimport { ErrorMessage } from '@hookform/error-message'\nimport { Fragment } from 'react/jsx-runtime'\nimport DOMPurify from 'dompurify'\nimport { useEffect, useMemo } from 'react'\nimport { usePaymentMethod, type CombinedSchemaInputs } from './usePaymentMethod'\nimport { NumberInputField, RadioGroupField } from '@/components/Common'\nimport { useLocale } from '@/contexts/LocaleProvider'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { ReorderableList } from '@/components/Common/ReorderableList'\nimport { SPLIT_BY } from '@/shared/constants'\n\ntype Split = NonNullable<EmployeePaymentMethod['splits']>[number]\n\nexport function Split() {\n const { paymentMethod, bankAccounts, mode } = usePaymentMethod()\n const {\n control,\n setValue,\n resetField,\n watch,\n formState: { errors },\n } = useFormContext<CombinedSchemaInputs>()\n const { t } = useTranslation('Employee.PaymentMethod')\n const splitBy = watch('splitBy')\n const priorities = watch('priority')\n\n const splits = useMemo(() => paymentMethod.splits ?? [], [paymentMethod.splits])\n\n const remainderId = Object.entries(priorities).reduce(\n (maxId, [uuid, priority]) => (!maxId || (priorities[maxId] ?? 0) < priority ? uuid : maxId),\n '',\n )\n\n const { currency } = useLocale()\n\n // Handle splitBy value changes\n useEffect(() => {\n // Only run cleanup if splits exist\n if (!splits.length) return\n\n // Clean up when switching modes\n if (splitBy === SPLIT_BY.amount) {\n // When switching to amount mode, set the last item as remainder (null) and others to 0\n const newAmountValues = splits.reduce<Record<string, number | null>>((acc, curr) => {\n acc[curr.uuid] = curr.uuid === remainderId ? null : 0\n return acc\n }, {})\n setValue('splitAmount', newAmountValues)\n } else {\n // When switching to percentage mode, set the first item to 100% and others to 0\n const newPercentageValues = splits.reduce<Record<string, number>>((acc, curr, index) => {\n acc[curr.uuid] = index === 0 ? 100 : 0\n return acc\n }, {})\n setValue('splitAmount', newPercentageValues)\n }\n }, [splitBy, splits, remainderId, setValue])\n\n const Components = useComponentContext()\n\n if (mode !== 'SPLIT' || bankAccounts.length < 2 || paymentMethod.splits === null) return null\n //Used by form schema to determine variant\n setValue('isSplit', true)\n\n const updateSplitAmount = (uuid: string, value: number | null) => {\n setValue(`splitAmount.${uuid}`, value)\n }\n\n const handleReorder = (newOrder: number[]) => {\n // Calculate new priorities based on new order\n const newPriorities = newOrder.reduce(\n (acc: Record<string, number>, curr: number, currIndex: number) => {\n const split = splits[curr]\n return split ? { ...acc, [split.uuid]: currIndex + 1 } : acc\n },\n {},\n )\n\n // Get the last split in the new order\n const lastSplitIndex = newOrder[newOrder.length - 1]\n if (lastSplitIndex === undefined) return\n\n const lastSplit = splits[lastSplitIndex]\n if (!lastSplit) return\n\n // Update priorities\n setValue('priority', newPriorities)\n\n // Clear the previous remainder if different from the new one\n if (remainderId && remainderId !== lastSplit.uuid) {\n resetField(`splitAmount.${remainderId}`)\n updateSplitAmount(remainderId, 0)\n }\n\n // Set the new last item to null (remainder)\n updateSplitAmount(lastSplit.uuid, null)\n }\n\n const renderFieldsList = () => {\n if (splitBy === SPLIT_BY.amount) {\n return (\n <ReorderableList\n key={`reorderable-amount-list-${splitBy}`}\n label={t('draggableListLabel')}\n items={splits.map(split => ({\n label: split.name as string,\n content: (\n <AmountField\n key={`amount-${split.uuid}`}\n split={split}\n onChange={value => {\n updateSplitAmount(split.uuid, value)\n }}\n remainderId={remainderId}\n />\n ),\n }))}\n onReorder={handleReorder}\n />\n )\n }\n\n return splits.map(split => (\n <PercentageField\n key={`percentage-${split.uuid}`}\n split={split}\n control={control}\n onChange={value => {\n updateSplitAmount(split.uuid, value)\n }}\n currency={currency}\n />\n ))\n }\n\n return (\n <>\n <ErrorMessage\n errors={errors}\n name=\"splitAmount.root\"\n render={({ message }) => {\n // Handle enhanced error messages with current total\n if (message && message.startsWith('percentage_split_total_error:')) {\n const total = message.split(':')[1] || '0'\n return (\n <Components.Alert\n status=\"error\"\n label={t('validations.percentageErrorWithTotal', { total })}\n />\n )\n }\n // Fallback to original error message\n return <Components.Alert status=\"error\" label={t('validations.percentageError')} />\n }}\n />\n <Components.Heading as=\"h2\">{t('title')}</Components.Heading>\n <Trans t={t} i18nKey=\"splitDescription\" components={{ p: <Components.Text /> }} />\n <RadioGroupField\n name=\"splitBy\"\n label={t('splitByLabel')}\n options={[\n { value: SPLIT_BY.percentage, label: t('percentageLabel') },\n { value: SPLIT_BY.amount, label: t('amountLabel') },\n ]}\n />\n {paymentMethod.splits && renderFieldsList()}\n </>\n )\n}\n\nfunction AmountField({\n split,\n remainderId,\n onChange,\n}: {\n split: Split\n remainderId: string\n onChange: (value: number | null) => void\n}) {\n const { t } = useTranslation('Employee.PaymentMethod')\n return (\n <NumberInputField\n name={`splitAmount.${split.uuid}`}\n label={t('splitAmountLabel', {\n name: DOMPurify.sanitize(split.name ?? ''),\n account_number: DOMPurify.sanitize(split.hiddenAccountNumber ?? ''),\n interpolation: { escapeValue: false },\n })}\n format=\"currency\"\n min={0}\n isRequired\n errorMessage={t('validations.amountError')}\n placeholder={remainderId === split.uuid ? t('remainderLabel') : ''}\n isDisabled={remainderId === split.uuid}\n onChange={onChange}\n />\n )\n}\n\nfunction PercentageField({\n split,\n control,\n onChange,\n currency,\n}: {\n split: Split\n control: Control<CombinedSchemaInputs>\n onChange: (value: number) => void\n currency: string\n}) {\n const { t } = useTranslation('Employee.PaymentMethod')\n return (\n <Fragment key={split.uuid}>\n <NumberInputField\n name={`splitAmount.${split.uuid}`}\n label={t('splitAmountLabel', {\n name: DOMPurify.sanitize(split.name ?? ''),\n account_number: DOMPurify.sanitize(split.hiddenAccountNumber ?? ''),\n interpolation: { escapeValue: false },\n })}\n format=\"percent\"\n min={0}\n isRequired\n errorMessage={t('validations.amountError')}\n onChange={onChange}\n />\n </Fragment>\n )\n}\n"],"names":["Split","paymentMethod","bankAccounts","mode","usePaymentMethod","control","setValue","resetField","watch","errors","useFormContext","t","useTranslation","splitBy","priorities","splits","useMemo","remainderId","maxId","uuid","priority","currency","useLocale","useEffect","SPLIT_BY","newAmountValues","acc","curr","newPercentageValues","index","Components","useComponentContext","updateSplitAmount","value","handleReorder","newOrder","newPriorities","currIndex","split","lastSplitIndex","lastSplit","renderFieldsList","jsx","ReorderableList","AmountField","PercentageField","jsxs","Fragment","ErrorMessage","message","total","Trans","RadioGroupField","onChange","NumberInputField","DOMPurify"],"mappings":";;;;;;;;;;;;;AAiBO,SAASA,KAAQ;AACtB,QAAM,EAAE,eAAAC,GAAe,cAAAC,GAAc,MAAAC,EAAA,IAASC,EAAiB,GACzD;AAAA,IACJ,SAAAC;AAAA,IACA,UAAAC;AAAA,IACA,YAAAC;AAAA,IACA,OAAAC;AAAA,IACA,WAAW,EAAE,QAAAC,EAAO;AAAA,MAClBC,EAAqC,GACnC,EAAE,GAAAC,EAAA,IAAMC,EAAe,wBAAwB,GAC/CC,IAAUL,EAAM,SAAS,GACzBM,IAAaN,EAAM,UAAU,GAE7BO,IAASC,EAAQ,MAAMf,EAAc,UAAU,IAAI,CAACA,EAAc,MAAM,CAAC,GAEzEgB,IAAc,OAAO,QAAQH,CAAU,EAAE;AAAA,IAC7C,CAACI,GAAO,CAACC,GAAMC,CAAQ,MAAO,CAACF,MAAUJ,EAAWI,CAAK,KAAK,KAAKE,IAAWD,IAAOD;AAAA,IACrF;AAAA,EACF,GAEM,EAAE,UAAAG,EAAS,IAAIC,EAAU;AAG/B,EAAAC,EAAU,MAAM;AAEV,QAACR,EAAO;AAGR,UAAAF,MAAYW,EAAS,QAAQ;AAE/B,cAAMC,IAAkBV,EAAO,OAAsC,CAACW,GAAKC,OACzED,EAAIC,EAAK,IAAI,IAAIA,EAAK,SAASV,IAAc,OAAO,GAC7CS,IACN,EAAE;AACL,QAAApB,EAAS,eAAemB,CAAe;AAAA,MAAA,OAClC;AAEL,cAAMG,IAAsBb,EAAO,OAA+B,CAACW,GAAKC,GAAME,OAC5EH,EAAIC,EAAK,IAAI,IAAIE,MAAU,IAAI,MAAM,GAC9BH,IACN,EAAE;AACL,QAAApB,EAAS,eAAesB,CAAmB;AAAA,MAAA;AAAA,KAE5C,CAACf,GAASE,GAAQE,GAAaX,CAAQ,CAAC;AAE3C,QAAMwB,IAAa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ACzC,gBAAgBiB,EAAU,SAASjB,EAAM,uBAAuB,EAAE;AAAA,QAClE,eAAe,EAAE,aAAa,GAAM;AAAA,MAAA,CACrC;AAAA,MACD,QAAO;AAAA,MACP,KAAK;AAAA,MACL,YAAU;AAAA,MACV,cAAc3B,EAAE,yBAAyB;AAAA,MACzC,UAAA0C;AAAA,IAAA;AAAA,EAAA,EACF,GAbaf,EAAM,IAcrB;AAEJ;"}
|
|
@@ -44,7 +44,7 @@ export declare const CombinedSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
44
44
|
type: "Check";
|
|
45
45
|
}, {
|
|
46
46
|
type: "Check";
|
|
47
|
-
}>, z.ZodObject<{
|
|
47
|
+
}>, z.ZodDiscriminatedUnion<"splitBy", [z.ZodObject<{
|
|
48
48
|
type: z.ZodLiteral<"Direct Deposit">;
|
|
49
49
|
isSplit: z.ZodLiteral<true>;
|
|
50
50
|
hasBankPayload: z.ZodLiteral<false>;
|
|
@@ -89,7 +89,7 @@ export declare const CombinedSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
89
89
|
splitBy: "Amount";
|
|
90
90
|
splitAmount: Record<string, number | null>;
|
|
91
91
|
remainder: string;
|
|
92
|
-
}>]>;
|
|
92
|
+
}>]>]>;
|
|
93
93
|
export type CombinedSchemaInputs = z.input<typeof CombinedSchema>;
|
|
94
94
|
export type CombinedSchemaOutputs = z.output<typeof CombinedSchema>;
|
|
95
95
|
type PaymentMethodContextType = {
|
|
@@ -25,33 +25,37 @@ const j = t.union([
|
|
|
25
25
|
t.object({
|
|
26
26
|
type: t.literal("Check")
|
|
27
27
|
}),
|
|
28
|
-
t.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
isSplit: t.literal(!0),
|
|
42
|
-
hasBankPayload: t.literal(!1),
|
|
43
|
-
splitBy: t.literal("Amount"),
|
|
44
|
-
priority: t.record(t.string(), t.number()).refine((r) => {
|
|
45
|
-
const e = Object.values(r);
|
|
46
|
-
return e.filter((i, o) => e.indexOf(i) !== o).length === 0;
|
|
28
|
+
t.discriminatedUnion("splitBy", [
|
|
29
|
+
t.object({
|
|
30
|
+
type: t.literal("Direct Deposit"),
|
|
31
|
+
isSplit: t.literal(!0),
|
|
32
|
+
hasBankPayload: t.literal(!1),
|
|
33
|
+
splitBy: t.literal("Percentage"),
|
|
34
|
+
splitAmount: t.record(t.string(), t.number().max(100).min(0)).refine(
|
|
35
|
+
(e) => Object.values(e).reduce((r, i) => r + i, 0) === 100,
|
|
36
|
+
(e) => ({
|
|
37
|
+
message: `percentage_split_total_error:${Object.values(e).reduce((i, o) => i + o, 0)}`
|
|
38
|
+
})
|
|
39
|
+
),
|
|
40
|
+
priority: t.record(t.string(), t.number())
|
|
47
41
|
}),
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
t.object({
|
|
43
|
+
type: t.literal("Direct Deposit"),
|
|
44
|
+
isSplit: t.literal(!0),
|
|
45
|
+
hasBankPayload: t.literal(!1),
|
|
46
|
+
splitBy: t.literal("Amount"),
|
|
47
|
+
priority: t.record(t.string(), t.number()).refine((e) => {
|
|
48
|
+
const r = Object.values(e);
|
|
49
|
+
return r.filter((i, o) => r.indexOf(i) !== o).length === 0;
|
|
50
|
+
}),
|
|
51
|
+
splitAmount: t.record(t.string(), t.number().min(0).nullable()),
|
|
52
|
+
remainder: t.string()
|
|
53
|
+
})
|
|
54
|
+
])
|
|
55
|
+
]), [B, x] = a("PaymentMethodContext");
|
|
52
56
|
export {
|
|
53
57
|
j as CombinedSchema,
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
x as PaymentMethodProvider,
|
|
59
|
+
B as usePaymentMethod
|
|
56
60
|
};
|
|
57
61
|
//# sourceMappingURL=usePaymentMethod.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePaymentMethod.js","sources":["../../../../src/components/Employee/PaymentMethod/usePaymentMethod.ts"],"sourcesContent":["import type { EmployeeBankAccount } from '@gusto/embedded-api/models/components/employeebankaccount'\nimport type { EmployeePaymentMethod } from '@gusto/embedded-api/models/components/employeepaymentmethod'\nimport { z } from 'zod'\nimport { BankAccountSchema } from './BankAccount'\nimport { createCompoundContext } from '@/components/Base'\n\nexport const CombinedSchema = z.union([\n BankAccountSchema.extend({\n type: z.literal('Direct Deposit'),\n isSplit: z.literal(false),\n }),\n z.object({\n type: z.literal('Direct Deposit'),\n isSplit: z.literal(false),\n hasBankPayload: z.literal(false),\n }),\n z.object({\n type: z.literal('Check'),\n }),\n z.object({\n
|
|
1
|
+
{"version":3,"file":"usePaymentMethod.js","sources":["../../../../src/components/Employee/PaymentMethod/usePaymentMethod.ts"],"sourcesContent":["import type { EmployeeBankAccount } from '@gusto/embedded-api/models/components/employeebankaccount'\nimport type { EmployeePaymentMethod } from '@gusto/embedded-api/models/components/employeepaymentmethod'\nimport { z } from 'zod'\nimport { BankAccountSchema } from './BankAccount'\nimport { createCompoundContext } from '@/components/Base'\n\nexport const CombinedSchema = z.union([\n BankAccountSchema.extend({\n type: z.literal('Direct Deposit'),\n isSplit: z.literal(false),\n }),\n z.object({\n type: z.literal('Direct Deposit'),\n isSplit: z.literal(false),\n hasBankPayload: z.literal(false),\n }),\n z.object({\n type: z.literal('Check'),\n }),\n z.discriminatedUnion('splitBy', [\n z.object({\n type: z.literal('Direct Deposit'),\n isSplit: z.literal(true),\n hasBankPayload: z.literal(false),\n splitBy: z.literal('Percentage'),\n splitAmount: z.record(z.string(), z.number().max(100).min(0)).refine(\n input => Object.values(input).reduce((acc, curr) => acc + curr, 0) === 100,\n input => {\n const total = Object.values(input).reduce((acc, curr) => acc + curr, 0)\n return {\n message: `percentage_split_total_error:${total}`,\n }\n },\n ),\n priority: z.record(z.string(), z.number()),\n }),\n z.object({\n type: z.literal('Direct Deposit'),\n isSplit: z.literal(true),\n hasBankPayload: z.literal(false),\n splitBy: z.literal('Amount'),\n priority: z.record(z.string(), z.number()).refine(input => {\n const arr = Object.values(input)\n return arr.filter((item, index) => arr.indexOf(item) !== index).length === 0\n }),\n splitAmount: z.record(z.string(), z.number().min(0).nullable()),\n remainder: z.string(),\n }),\n ]),\n])\n\nexport type CombinedSchemaInputs = z.input<typeof CombinedSchema>\nexport type CombinedSchemaOutputs = z.output<typeof CombinedSchema>\n\ntype PaymentMethodContextType = {\n bankAccounts: EmployeeBankAccount[]\n isPending: boolean\n watchedType?: string\n mode: MODE\n paymentMethod: EmployeePaymentMethod\n handleAdd: () => void\n handleSplit: () => void\n handleCancel: () => void\n handleDelete: (uuid: string) => void\n}\n\nexport type MODE = 'ADD' | 'LIST' | 'SPLIT' | 'INITIAL'\n\nconst [usePaymentMethod, PaymentMethodProvider] =\n createCompoundContext<PaymentMethodContextType>('PaymentMethodContext')\nexport { usePaymentMethod, PaymentMethodProvider }\n"],"names":["CombinedSchema","z","BankAccountSchema","input","acc","curr","arr","item","index","usePaymentMethod","PaymentMethodProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;AAMa,MAAAA,IAAiBC,EAAE,MAAM;AAAA,EACpCC,EAAkB,OAAO;AAAA,IACvB,MAAMD,EAAE,QAAQ,gBAAgB;AAAA,IAChC,SAASA,EAAE,QAAQ,EAAK;AAAA,EAAA,CACzB;AAAA,EACDA,EAAE,OAAO;AAAA,IACP,MAAMA,EAAE,QAAQ,gBAAgB;AAAA,IAChC,SAASA,EAAE,QAAQ,EAAK;AAAA,IACxB,gBAAgBA,EAAE,QAAQ,EAAK;AAAA,EAAA,CAChC;AAAA,EACDA,EAAE,OAAO;AAAA,IACP,MAAMA,EAAE,QAAQ,OAAO;AAAA,EAAA,CACxB;AAAA,EACDA,EAAE,mBAAmB,WAAW;AAAA,IAC9BA,EAAE,OAAO;AAAA,MACP,MAAMA,EAAE,QAAQ,gBAAgB;AAAA,MAChC,SAASA,EAAE,Q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1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation as r } from "react-i18next";
|
|
3
3
|
import { useProfile as e } from "./useProfile.js";
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import "../../../shared/constants.js";
|
|
5
|
+
import { ActionsLayout as m } from "../../Common/ActionsLayout/ActionsLayout.js";
|
|
6
|
+
import { useComponentContext as s } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
7
|
+
const d = () => {
|
|
8
|
+
const { t } = r("Employee.Profile"), { isPending: n } = e(), i = s();
|
|
9
|
+
return /* @__PURE__ */ o(m, { children: /* @__PURE__ */ o(i.Button, { type: "submit", isLoading: n, children: t("submitCta") }) });
|
|
9
10
|
};
|
|
10
11
|
export {
|
|
11
|
-
|
|
12
|
+
d as Actions
|
|
12
13
|
};
|
|
13
14
|
//# sourceMappingURL=Actions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Actions.js","sources":["../../../../src/components/Employee/Profile/Actions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useProfile } from './useProfile'\nimport { ActionsLayout } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport const Actions = () => {\n const { t } = useTranslation('Employee.Profile')\n const { isPending } = useProfile()\n const Components = useComponentContext()\n\n return (\n <ActionsLayout>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('submitCta')}\n </Components.Button>\n </ActionsLayout>\n )\n}\n"],"names":["Actions","useTranslation","isPending","useProfile","Components","useComponentContext","jsx","ActionsLayout"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Actions.js","sources":["../../../../src/components/Employee/Profile/Actions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useProfile } from './useProfile'\nimport { ActionsLayout } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport const Actions = () => {\n const { t } = useTranslation('Employee.Profile')\n const { isPending } = useProfile()\n const Components = useComponentContext()\n\n return (\n <ActionsLayout>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('submitCta')}\n </Components.Button>\n </ActionsLayout>\n )\n}\n"],"names":["Actions","useTranslation","isPending","useProfile","Components","useComponentContext","jsx","ActionsLayout"],"mappings":";;;;;;AAKO,MAAMA,IAAU,MAAM;AAC3B,QAAM,EAAE,EAAA,IAAMC,EAAe,kBAAkB,GACzC,EAAE,WAAAC,EAAU,IAAIC,EAAW,GAC3BC,IAAaC,EAAoB;AAEvC,SACG,gBAAAC,EAAAC,GAAA,EACC,UAAC,gBAAAD,EAAAF,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWF,GACzC,UAAE,EAAA,WAAW,EAChB,CAAA,GACF;AAEJ;"}
|
|
@@ -1,69 +1,98 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const AdminSelfOnboardingPersonalDetailsSchema: z.ZodObject<{
|
|
3
|
+
workAddress: z.ZodString;
|
|
4
|
+
startDate: z.ZodEffects<z.ZodDate, string | undefined, Date>;
|
|
5
|
+
email: z.ZodString;
|
|
6
|
+
} & {
|
|
3
7
|
firstName: z.ZodString;
|
|
4
8
|
middleInitial: z.ZodOptional<z.ZodString>;
|
|
5
9
|
lastName: z.ZodString;
|
|
6
10
|
} & {
|
|
11
|
+
selfOnboarding: z.ZodBoolean;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
email: string;
|
|
14
|
+
firstName: string;
|
|
15
|
+
lastName: string;
|
|
16
|
+
workAddress: string;
|
|
17
|
+
selfOnboarding: boolean;
|
|
18
|
+
middleInitial?: string | undefined;
|
|
19
|
+
startDate?: string | undefined;
|
|
20
|
+
}, {
|
|
21
|
+
email: string;
|
|
22
|
+
firstName: string;
|
|
23
|
+
lastName: string;
|
|
24
|
+
workAddress: string;
|
|
25
|
+
startDate: Date;
|
|
26
|
+
selfOnboarding: boolean;
|
|
27
|
+
middleInitial?: string | undefined;
|
|
28
|
+
}>;
|
|
29
|
+
export declare const AdminPersonalDetailsSchema: z.ZodDiscriminatedUnion<"enableSsn", [z.ZodObject<{
|
|
7
30
|
workAddress: z.ZodString;
|
|
8
31
|
startDate: z.ZodEffects<z.ZodDate, string | undefined, Date>;
|
|
9
32
|
email: z.ZodString;
|
|
33
|
+
firstName: z.ZodString;
|
|
34
|
+
middleInitial: z.ZodOptional<z.ZodString>;
|
|
35
|
+
lastName: z.ZodString;
|
|
36
|
+
selfOnboarding: z.ZodBoolean;
|
|
37
|
+
ssn: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
|
|
38
|
+
dateOfBirth: z.ZodEffects<z.ZodDate, string | undefined, Date>;
|
|
10
39
|
} & {
|
|
11
|
-
|
|
12
|
-
enableSsn: z.ZodOptional<z.ZodBoolean>;
|
|
40
|
+
enableSsn: z.ZodLiteral<true>;
|
|
13
41
|
}, "strip", z.ZodTypeAny, {
|
|
14
42
|
email: string;
|
|
43
|
+
ssn: string;
|
|
15
44
|
firstName: string;
|
|
16
45
|
lastName: string;
|
|
17
46
|
workAddress: string;
|
|
18
|
-
|
|
47
|
+
enableSsn: true;
|
|
48
|
+
selfOnboarding: boolean;
|
|
19
49
|
middleInitial?: string | undefined;
|
|
20
50
|
startDate?: string | undefined;
|
|
21
|
-
|
|
51
|
+
dateOfBirth?: string | undefined;
|
|
22
52
|
}, {
|
|
23
53
|
email: string;
|
|
54
|
+
ssn: string;
|
|
24
55
|
firstName: string;
|
|
25
56
|
lastName: string;
|
|
26
57
|
workAddress: string;
|
|
27
58
|
startDate: Date;
|
|
28
|
-
|
|
59
|
+
enableSsn: true;
|
|
60
|
+
dateOfBirth: Date;
|
|
61
|
+
selfOnboarding: boolean;
|
|
29
62
|
middleInitial?: string | undefined;
|
|
30
|
-
enableSsn?: boolean | undefined;
|
|
31
63
|
}>, z.ZodObject<{
|
|
32
|
-
firstName: z.ZodString;
|
|
33
|
-
middleInitial: z.ZodOptional<z.ZodString>;
|
|
34
|
-
lastName: z.ZodString;
|
|
35
|
-
} & {
|
|
36
64
|
workAddress: z.ZodString;
|
|
37
65
|
startDate: z.ZodEffects<z.ZodDate, string | undefined, Date>;
|
|
38
66
|
email: z.ZodString;
|
|
39
67
|
} & {
|
|
40
|
-
|
|
41
|
-
|
|
68
|
+
firstName: z.ZodString;
|
|
69
|
+
middleInitial: z.ZodOptional<z.ZodString>;
|
|
70
|
+
lastName: z.ZodString;
|
|
71
|
+
} & {
|
|
72
|
+
selfOnboarding: z.ZodBoolean;
|
|
42
73
|
} & {
|
|
43
74
|
dateOfBirth: z.ZodEffects<z.ZodDate, string | undefined, Date>;
|
|
44
75
|
} & {
|
|
45
|
-
|
|
76
|
+
enableSsn: z.ZodLiteral<false>;
|
|
46
77
|
}, "strip", z.ZodTypeAny, {
|
|
47
78
|
email: string;
|
|
48
|
-
ssn: string;
|
|
49
79
|
firstName: string;
|
|
50
80
|
lastName: string;
|
|
51
81
|
workAddress: string;
|
|
52
|
-
enableSsn:
|
|
53
|
-
selfOnboarding:
|
|
82
|
+
enableSsn: false;
|
|
83
|
+
selfOnboarding: boolean;
|
|
54
84
|
middleInitial?: string | undefined;
|
|
55
85
|
startDate?: string | undefined;
|
|
56
86
|
dateOfBirth?: string | undefined;
|
|
57
87
|
}, {
|
|
58
88
|
email: string;
|
|
59
|
-
ssn: string;
|
|
60
89
|
firstName: string;
|
|
61
90
|
lastName: string;
|
|
62
91
|
workAddress: string;
|
|
63
92
|
startDate: Date;
|
|
64
|
-
enableSsn:
|
|
93
|
+
enableSsn: false;
|
|
65
94
|
dateOfBirth: Date;
|
|
66
|
-
selfOnboarding:
|
|
95
|
+
selfOnboarding: boolean;
|
|
67
96
|
middleInitial?: string | undefined;
|
|
68
97
|
}>]>;
|
|
69
98
|
export declare const AdminPersonalDetails: () => import("react/jsx-runtime").JSX.Element | null;
|