@gusto/embedded-react-sdk 0.56.3 → 0.56.5
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 +19 -0
- package/dist/components/Common/DocumentEmbed/DocumentEmbed.js +18 -0
- package/dist/components/Common/DocumentEmbed/DocumentEmbed.js.map +1 -0
- package/dist/components/Common/DocumentViewer/DocumentViewer.js +35 -29
- package/dist/components/Common/DocumentViewer/DocumentViewer.js.map +1 -1
- package/dist/components/Common/FieldCaption/FieldCaption.js +21 -18
- package/dist/components/Common/FieldCaption/FieldCaption.js.map +1 -1
- package/dist/components/Common/FieldCaption/FieldCaption.module.scss.js +5 -3
- package/dist/components/Common/FieldCaption/FieldCaption.module.scss.js.map +1 -1
- package/dist/components/Contractor/ContractorList/management/ManagementContractorList.js +64 -61
- package/dist/components/Contractor/ContractorList/management/ManagementContractorList.js.map +1 -1
- package/dist/components/Contractor/ContractorList/management/ManagementContractorListView.js +133 -134
- package/dist/components/Contractor/ContractorList/management/ManagementContractorListView.js.map +1 -1
- package/dist/components/Contractor/ContractorListFlow/ContractorListFlow.js.map +1 -1
- package/dist/components/Contractor/ContractorListFlow/ContractorListFlowComponents.js +22 -9
- package/dist/components/Contractor/ContractorListFlow/ContractorListFlowComponents.js.map +1 -1
- package/dist/components/Contractor/ContractorListFlow/contractorListStateMachine.js +51 -20
- package/dist/components/Contractor/ContractorListFlow/contractorListStateMachine.js.map +1 -1
- package/dist/components/Contractor/Dismissal/Dismissal.js +77 -0
- package/dist/components/Contractor/Dismissal/Dismissal.js.map +1 -0
- package/dist/components/Contractor/Dismissal/DismissalPresentation.js +57 -0
- package/dist/components/Contractor/Dismissal/DismissalPresentation.js.map +1 -0
- package/dist/components/Contractor/Dismissal/useDismissal/useDismissal.js +44 -0
- package/dist/components/Contractor/Dismissal/useDismissal/useDismissal.js.map +1 -0
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js +45 -41
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js.map +1 -1
- package/dist/components/Contractor/exports/contractorManagement.js +56 -54
- package/dist/components/Contractor/exports/contractorManagement.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +201 -196
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields.js +55 -52
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeSchema.js +38 -29
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeSchema.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js +17 -14
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js.map +1 -1
- package/dist/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.js +72 -68
- package/dist/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.js.map +1 -1
- package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
- package/dist/i18n/I18n.js +1 -0
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Contractor.Dismissal.json.js +20 -0
- package/dist/i18n/en/Contractor.Dismissal.json.js.map +1 -0
- package/dist/i18n/en/Contractor.Payments.PaymentStatement.json.js +2 -2
- package/dist/i18n/en/Payroll.PayrollEditEmployee.json.js +38 -38
- package/dist/i18n/en/Payroll.UNSTABLE_PayrollEditEmployee.json.js +31 -31
- package/dist/i18n/en/common.json.js +37 -35
- package/dist/i18n/en/common.json.js.map +1 -1
- package/dist/package.json.js +1 -1
- package/dist/shared/constants.js +1 -0
- package/dist/shared/constants.js.map +1 -1
- package/dist/src/components/Common/DocumentEmbed/DocumentEmbed.d.ts +3 -0
- package/dist/src/components/Common/DocumentEmbed/DocumentEmbedTypes.d.ts +25 -0
- package/dist/src/components/Common/DocumentEmbed/index.d.ts +2 -0
- package/dist/src/components/Contractor/ContractorList/management/ManagementContractorList.d.ts +2 -0
- package/dist/src/components/Contractor/ContractorList/management/ManagementContractorListView.d.ts +3 -1
- package/dist/src/components/Contractor/ContractorListFlow/ContractorListFlow.d.ts +6 -4
- package/dist/src/components/Contractor/ContractorListFlow/ContractorListFlowComponents.d.ts +2 -0
- package/dist/src/components/Contractor/ContractorListFlow/contractorListStateMachine.d.ts +1 -0
- package/dist/src/components/Contractor/ContractorListFlow/contractorListStateMachine.test.d.ts +1 -0
- package/dist/src/components/Contractor/Dismissal/Dismissal.d.ts +45 -0
- package/dist/src/components/Contractor/Dismissal/DismissalPresentation.d.ts +17 -0
- package/dist/src/components/Contractor/Dismissal/useDismissal/useDismissal.d.ts +41 -0
- package/dist/src/components/Contractor/Dismissal/useDismissal/useDismissal.test.d.ts +1 -0
- package/dist/src/components/Contractor/exports/contractorManagement.d.ts +1 -0
- package/dist/src/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeSchema.d.ts +19 -0
- package/dist/src/contexts/ComponentAdapter/componentAdapterTypes.d.ts +1 -0
- package/dist/src/contexts/ComponentAdapter/useComponentContext.d.ts +5 -2
- package/dist/src/i18n/en/common.json.d.ts +3 -0
- package/dist/src/i18n/types.d.ts +47 -0
- package/dist/src/shared/constants.d.ts +2 -0
- package/dist/style.css +1 -1
- package/docs/guides/endpoint-inventory.json +18 -0
- package/package.json +1 -1
package/dist/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { jsx as t, jsxs as m, Fragment as
|
|
1
|
+
import { jsx as t, jsxs as m, Fragment as X } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as fe, useMemo as Ee, Fragment as ge } from "react";
|
|
3
3
|
import { useTranslation as ee } from "react-i18next";
|
|
4
4
|
import { PayrollUpdatePaymentMethod as ye } from "@gusto/embedded-api/models/components/payrollupdate";
|
|
5
|
-
import { isSplitByWorkweek as
|
|
6
|
-
import { PayrollEditEmployeeErrorCodes as
|
|
5
|
+
import { isSplitByWorkweek as U } from "../PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields.js";
|
|
6
|
+
import { PayrollEditEmployeeErrorCodes as T } from "../PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeSchema.js";
|
|
7
7
|
import E from "./UNSTABLE_PayrollEditEmployee.module.scss.js";
|
|
8
|
-
import { componentEvents as
|
|
9
|
-
import { BaseBoundaries as
|
|
8
|
+
import { componentEvents as J, COMPENSATION_NAME_REIMBURSEMENT as Ce, COMPENSATION_NAME_PAYCHECK_TIPS as Ne, COMPENSATION_NAME_CASH_TIPS as ve, COMPENSATION_NAME_CORRECTION_PAYMENT as Ae, COMPENSATION_NAME_COMMISSION as Oe, COMPENSATION_NAME_BONUS as Te, COMPENSATION_NAME_DOUBLE_OVERTIME as Me, COMPENSATION_NAME_OVERTIME as Pe, COMPENSATION_NAME_REGULAR_HOURS as Re } from "../../../shared/constants.js";
|
|
9
|
+
import { BaseBoundaries as Se, BaseLayout as Q } from "../../Base/Base.js";
|
|
10
10
|
import "../../Base/useBase.js";
|
|
11
|
-
import { useComponentDictionary as
|
|
11
|
+
import { useComponentDictionary as _e, useI18n as Le } from "../../../i18n/I18n.js";
|
|
12
12
|
import { useComponentContext as te } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
13
13
|
import { Flex as u } from "../../Common/Flex/Flex.js";
|
|
14
14
|
import { Grid as ke } from "../../Common/Grid/Grid.js";
|
|
15
|
-
import { EmptyData as
|
|
16
|
-
import { SDKFormProvider as
|
|
15
|
+
import { EmptyData as xe } from "../../Common/EmptyData/EmptyData.js";
|
|
16
|
+
import { SDKFormProvider as we } from "../../../partner-hook-utils/form/SDKFormProvider.js";
|
|
17
17
|
import { firstLastName as De, formatNumberAsCurrency as Ie } from "../../../helpers/formattedStrings.js";
|
|
18
|
-
import { useDateFormatter as
|
|
19
|
-
import
|
|
18
|
+
import { useDateFormatter as Ue } from "../../../hooks/useDateFormatter.js";
|
|
19
|
+
import Be from "../../../hooks/useContainerBreakpoints/useContainerBreakpoints.js";
|
|
20
20
|
import Z from "../../../assets/icons/plus-circle.svg.js";
|
|
21
|
-
import
|
|
21
|
+
import Fe from "../../../assets/icons/trashcan.svg.js";
|
|
22
22
|
import { usePayrollEditEmployeeForm as He } from "../PayrollEditEmployee/shared/usePayrollEditEmployeeForm/usePayrollEditEmployeeForm.js";
|
|
23
|
-
import { DataView as
|
|
23
|
+
import { DataView as _ } from "../../Common/DataView/DataView.js";
|
|
24
24
|
import { useDataView as Ve } from "../../Common/DataView/useDataView.js";
|
|
25
25
|
function ft({
|
|
26
26
|
FallbackComponent: h,
|
|
@@ -28,7 +28,7 @@ function ft({
|
|
|
28
28
|
...N
|
|
29
29
|
}) {
|
|
30
30
|
return /* @__PURE__ */ t(
|
|
31
|
-
|
|
31
|
+
Se,
|
|
32
32
|
{
|
|
33
33
|
componentName: "Payroll.UNSTABLE_PayrollEditEmployee",
|
|
34
34
|
FallbackComponent: h,
|
|
@@ -41,12 +41,12 @@ const je = ({
|
|
|
41
41
|
rows: h,
|
|
42
42
|
isAdding: b,
|
|
43
43
|
draftFields: N,
|
|
44
|
-
onBeginAdd:
|
|
44
|
+
onBeginAdd: M,
|
|
45
45
|
onSave: P,
|
|
46
46
|
onCancel: L,
|
|
47
|
-
onRemove:
|
|
47
|
+
onRemove: R
|
|
48
48
|
}) => {
|
|
49
|
-
const { t: e } = ee("Payroll.UNSTABLE_PayrollEditEmployee"), { Button: g, ButtonIcon: S, Heading: y } = te(), { Description: C, Amount: v } = N,
|
|
49
|
+
const { t: e } = ee("Payroll.UNSTABLE_PayrollEditEmployee"), { Button: g, ButtonIcon: S, Heading: y } = te(), { Description: C, Amount: v } = N, A = Ve({
|
|
50
50
|
data: h,
|
|
51
51
|
columns: [
|
|
52
52
|
{
|
|
@@ -68,24 +68,24 @@ const je = ({
|
|
|
68
68
|
],
|
|
69
69
|
itemMenu: (d) => {
|
|
70
70
|
if (d.recurring) return null;
|
|
71
|
-
const
|
|
71
|
+
const O = d.description.trim() || e("reimbursementUnnamedFallback");
|
|
72
72
|
return /* @__PURE__ */ t(
|
|
73
73
|
S,
|
|
74
74
|
{
|
|
75
75
|
variant: "tertiary",
|
|
76
76
|
onClick: () => {
|
|
77
|
-
|
|
77
|
+
R(d.index);
|
|
78
78
|
},
|
|
79
|
-
"aria-label": e("removeReimbursementLabel", { description:
|
|
80
|
-
children: /* @__PURE__ */ t(
|
|
79
|
+
"aria-label": e("removeReimbursementLabel", { description: O }),
|
|
80
|
+
children: /* @__PURE__ */ t(Fe, { "aria-hidden": !0 })
|
|
81
81
|
}
|
|
82
82
|
);
|
|
83
83
|
},
|
|
84
|
-
emptyState: () => /* @__PURE__ */ t(
|
|
84
|
+
emptyState: () => /* @__PURE__ */ t(xe, { title: e("reimbursementEmptyTitle"), children: /* @__PURE__ */ t(g, { variant: "secondary", onClick: M, icon: /* @__PURE__ */ t(Z, { "aria-hidden": !0 }), children: e("addReimbursementCta") }) })
|
|
85
85
|
});
|
|
86
86
|
return /* @__PURE__ */ m(u, { flexDirection: "column", gap: 12, children: [
|
|
87
87
|
/* @__PURE__ */ t(y, { as: "h3", styledAs: "h4", children: e("reimbursementTitle") }),
|
|
88
|
-
!(h.length === 0 && b) && /* @__PURE__ */ t(
|
|
88
|
+
!(h.length === 0 && b) && /* @__PURE__ */ t(_, { label: e("reimbursementsTableLabel"), ...A }),
|
|
89
89
|
b ? /* @__PURE__ */ m(u, { flexDirection: "column", gap: 12, children: [
|
|
90
90
|
/* @__PURE__ */ m(ke, { gridTemplateColumns: { base: "1fr", small: [320, 320] }, gap: 20, children: [
|
|
91
91
|
/* @__PURE__ */ t(
|
|
@@ -105,7 +105,7 @@ const je = ({
|
|
|
105
105
|
g,
|
|
106
106
|
{
|
|
107
107
|
variant: "secondary",
|
|
108
|
-
onClick:
|
|
108
|
+
onClick: M,
|
|
109
109
|
title: e("addReimbursementLink"),
|
|
110
110
|
icon: /* @__PURE__ */ t(Z, { "aria-hidden": !0 }),
|
|
111
111
|
children: e("addReimbursementLink")
|
|
@@ -116,49 +116,53 @@ const je = ({
|
|
|
116
116
|
employeeId: h,
|
|
117
117
|
companyId: b,
|
|
118
118
|
payrollId: N,
|
|
119
|
-
withReimbursements:
|
|
119
|
+
withReimbursements: M = !0,
|
|
120
120
|
onEvent: P,
|
|
121
121
|
dictionary: L,
|
|
122
|
-
LoaderComponent:
|
|
122
|
+
LoaderComponent: R
|
|
123
123
|
}) => {
|
|
124
|
-
|
|
125
|
-
const { t: e } = ee("Payroll.UNSTABLE_PayrollEditEmployee"), g =
|
|
124
|
+
_e("Payroll.UNSTABLE_PayrollEditEmployee", L), Le("Payroll.UNSTABLE_PayrollEditEmployee");
|
|
125
|
+
const { t: e } = ee("Payroll.UNSTABLE_PayrollEditEmployee"), g = Ue(), { Alert: S, Box: y, BoxHeader: C, Button: v, Heading: A, Text: d } = te(), O = fe(null), f = Be({ ref: O }).includes("small"), ne = Ee(
|
|
126
126
|
() => ({
|
|
127
|
-
[
|
|
128
|
-
[
|
|
129
|
-
[
|
|
127
|
+
[T.NEGATIVE_AMOUNT]: e("validations.negativeAmount"),
|
|
128
|
+
[T.MAX_HOURS]: e("validations.maxHours"),
|
|
129
|
+
[T.REQUIRED_WORKWEEK]: e("validations.requiredWorkweek"),
|
|
130
|
+
[T.REIMBURSEMENT_AMOUNT]: e("validations.reimbursementAmount"),
|
|
131
|
+
[T.MAX_REIMBURSEMENT_AMOUNT]: e(
|
|
132
|
+
"validations.maxReimbursementAmount"
|
|
133
|
+
)
|
|
130
134
|
}),
|
|
131
135
|
[e]
|
|
132
136
|
), r = He({
|
|
133
137
|
employeeId: h,
|
|
134
138
|
companyId: b,
|
|
135
139
|
payrollId: N,
|
|
136
|
-
withReimbursements:
|
|
140
|
+
withReimbursements: M,
|
|
137
141
|
errorMessages: ne
|
|
138
142
|
});
|
|
139
143
|
if (r.isLoading)
|
|
140
|
-
return /* @__PURE__ */ t("div", { ref:
|
|
141
|
-
const { employee:
|
|
142
|
-
first_name:
|
|
143
|
-
last_name:
|
|
144
|
+
return /* @__PURE__ */ t("div", { ref: O, className: E.container, children: /* @__PURE__ */ t(Q, { isLoading: !0, error: r.errorHandling.errors, LoaderComponent: R }) });
|
|
145
|
+
const { employee: k } = r.data, c = r.form.Fields, B = De({
|
|
146
|
+
first_name: k.firstName,
|
|
147
|
+
last_name: k.lastName
|
|
144
148
|
}), re = (n) => {
|
|
145
149
|
switch (n) {
|
|
146
|
-
case
|
|
150
|
+
case Re:
|
|
147
151
|
return e("compensationNames.regularHours");
|
|
148
|
-
case Me:
|
|
149
|
-
return e("compensationNames.overtime");
|
|
150
152
|
case Pe:
|
|
153
|
+
return e("compensationNames.overtime");
|
|
154
|
+
case Me:
|
|
151
155
|
return e("compensationNames.doubleOvertime");
|
|
152
156
|
default:
|
|
153
157
|
return n;
|
|
154
158
|
}
|
|
155
|
-
},
|
|
159
|
+
}, x = (n) => {
|
|
156
160
|
switch (n) {
|
|
157
161
|
case Te:
|
|
158
162
|
return e("fixedCompensationNames.bonus");
|
|
159
|
-
case Ae:
|
|
160
|
-
return e("fixedCompensationNames.commission");
|
|
161
163
|
case Oe:
|
|
164
|
+
return e("fixedCompensationNames.commission");
|
|
165
|
+
case Ae:
|
|
162
166
|
return e("fixedCompensationNames.correctionPayment");
|
|
163
167
|
case ve:
|
|
164
168
|
return e("fixedCompensationNames.cashTips");
|
|
@@ -169,11 +173,11 @@ const je = ({
|
|
|
169
173
|
default:
|
|
170
174
|
return n;
|
|
171
175
|
}
|
|
172
|
-
}, w = (n) =>
|
|
173
|
-
const { label: o, rowHeader: a, valueColumnLabel: l, labelFor: s, adornmentStart: me, adornmentEnd: de } = i, ce =
|
|
176
|
+
}, w = (n) => U(n) ? n[r.data.workweeks[0]?.startDate ?? ""] ?? [] : n, F = (n, i) => {
|
|
177
|
+
const { label: o, rowHeader: a, valueColumnLabel: l, labelFor: s, adornmentStart: me, adornmentEnd: de } = i, ce = U(n), ue = w(n), $ = (p, D) => /* @__PURE__ */ t("div", { className: E.inputContainer, children: /* @__PURE__ */ t(
|
|
174
178
|
p.Field,
|
|
175
179
|
{
|
|
176
|
-
label:
|
|
180
|
+
label: D,
|
|
177
181
|
shouldVisuallyHideLabel: !0,
|
|
178
182
|
adornmentStart: me,
|
|
179
183
|
adornmentEnd: de
|
|
@@ -183,18 +187,18 @@ const je = ({
|
|
|
183
187
|
justify: "end",
|
|
184
188
|
render: (p) => $(p, s(p.name))
|
|
185
189
|
}, he = r.data.workweeks.map(
|
|
186
|
-
({ startDate: p, endDate:
|
|
187
|
-
const K = g.formatPayPeriodRange(p,
|
|
190
|
+
({ startDate: p, endDate: D }) => {
|
|
191
|
+
const K = g.formatPayPeriodRange(p, D, {
|
|
188
192
|
useShortMonth: !0
|
|
189
193
|
});
|
|
190
194
|
return {
|
|
191
195
|
title: K,
|
|
192
196
|
justify: "end",
|
|
193
|
-
render: (
|
|
197
|
+
render: (I) => {
|
|
194
198
|
const q = n[p]?.find(
|
|
195
|
-
(z) => z.jobUuid ===
|
|
199
|
+
(z) => z.jobUuid === I.jobUuid && z.name === I.name
|
|
196
200
|
);
|
|
197
|
-
return q ? $(q, `${s(
|
|
201
|
+
return q ? $(q, `${s(I.name)} ${K}`) : null;
|
|
198
202
|
}
|
|
199
203
|
};
|
|
200
204
|
}
|
|
@@ -202,10 +206,10 @@ const je = ({
|
|
|
202
206
|
{ title: a, render: (p) => s(p.name) },
|
|
203
207
|
...ce ? he : [pe]
|
|
204
208
|
];
|
|
205
|
-
return /* @__PURE__ */ t(
|
|
209
|
+
return /* @__PURE__ */ t(_, { label: o, isWithinBox: !0, columns: be, data: ue });
|
|
206
210
|
}, ie = (n, i) => {
|
|
207
211
|
const { title: o, footer: a, ...l } = i;
|
|
208
|
-
return w(n).length === 0 && !a ? null : /* @__PURE__ */ t(y, { header: /* @__PURE__ */ t(C, { title: o }), withPadding: !1, footer: a, children:
|
|
212
|
+
return w(n).length === 0 && !a ? null : /* @__PURE__ */ t(y, { header: /* @__PURE__ */ t(C, { title: o }), withPadding: !1, footer: a, children: F(n, l) });
|
|
209
213
|
}, H = (n, i) => {
|
|
210
214
|
if (n.length === 0) return null;
|
|
211
215
|
const { title: o, description: a } = i, l = [
|
|
@@ -227,7 +231,7 @@ const je = ({
|
|
|
227
231
|
) })
|
|
228
232
|
}
|
|
229
233
|
];
|
|
230
|
-
return /* @__PURE__ */ t(y, { header: /* @__PURE__ */ t(C, { title: o, description: a }), withPadding: !1, children: /* @__PURE__ */ t(
|
|
234
|
+
return /* @__PURE__ */ t(y, { header: /* @__PURE__ */ t(C, { title: o, description: a }), withPadding: !1, children: /* @__PURE__ */ t(_, { label: o, isWithinBox: !0, columns: l, data: n }) });
|
|
231
235
|
}, V = (n, i) => {
|
|
232
236
|
const o = [
|
|
233
237
|
{ title: e("typeColumn"), render: (a) => a.label },
|
|
@@ -237,29 +241,29 @@ const je = ({
|
|
|
237
241
|
render: (a) => /* @__PURE__ */ t("div", { className: E.inputContainer, children: /* @__PURE__ */ t(a.Field, { label: a.label, shouldVisuallyHideLabel: !0, adornmentStart: "$" }) })
|
|
238
242
|
}
|
|
239
243
|
];
|
|
240
|
-
return /* @__PURE__ */ t(
|
|
244
|
+
return /* @__PURE__ */ t(_, { label: i, isWithinBox: !0, columns: o, data: n });
|
|
241
245
|
}, j = (n) => /* @__PURE__ */ t("div", { className: E.earningsGroupLabel, children: /* @__PURE__ */ t(d, { size: "sm", weight: "semibold", children: n }) }), ae = () => {
|
|
242
246
|
const n = c.overtimeIncludedEarnings, i = c.overtimeExcludedEarnings.map((l) => ({
|
|
243
|
-
label:
|
|
247
|
+
label: x(l.id),
|
|
244
248
|
Field: l.Field
|
|
245
249
|
})), o = w(n).length > 0;
|
|
246
250
|
if (!o && i.length === 0) return null;
|
|
247
|
-
const a =
|
|
251
|
+
const a = F(n, {
|
|
248
252
|
label: e("additionalEarningsTitle"),
|
|
249
253
|
rowHeader: e("typeColumn"),
|
|
250
254
|
valueColumnLabel: e("amountColumn"),
|
|
251
|
-
labelFor:
|
|
255
|
+
labelFor: x,
|
|
252
256
|
adornmentStart: "$"
|
|
253
257
|
});
|
|
254
|
-
if (!
|
|
258
|
+
if (!U(n)) {
|
|
255
259
|
const l = [
|
|
256
|
-
...n.map((s) => ({ label:
|
|
260
|
+
...n.map((s) => ({ label: x(s.name), Field: s.Field })),
|
|
257
261
|
...i
|
|
258
262
|
];
|
|
259
263
|
return /* @__PURE__ */ t(y, { header: /* @__PURE__ */ t(C, { title: e("additionalEarningsTitle") }), withPadding: !1, children: V(l, e("additionalEarningsTitle")) });
|
|
260
264
|
}
|
|
261
265
|
return /* @__PURE__ */ m(y, { header: /* @__PURE__ */ t(C, { title: e("additionalEarningsTitle") }), withPadding: !1, children: [
|
|
262
|
-
o ? /* @__PURE__ */ m(
|
|
266
|
+
o ? /* @__PURE__ */ m(X, { children: [
|
|
263
267
|
/* @__PURE__ */ t("div", { className: E.earningsAlert, children: /* @__PURE__ */ t(
|
|
264
268
|
S,
|
|
265
269
|
{
|
|
@@ -272,16 +276,16 @@ const je = ({
|
|
|
272
276
|
j(e("overtimeIncludedEarningsGroupLabel")),
|
|
273
277
|
a
|
|
274
278
|
] }) : null,
|
|
275
|
-
i.length > 0 ? /* @__PURE__ */ m(
|
|
279
|
+
i.length > 0 ? /* @__PURE__ */ m(X, { children: [
|
|
276
280
|
j(e("overtimeExcludedEarningsGroupLabel")),
|
|
277
281
|
V(i, e("overtimeExcludedEarningsGroupLabel"))
|
|
278
282
|
] }) : null
|
|
279
283
|
] });
|
|
280
284
|
}, W = c.paymentMethod, G = c.reimbursementDraft, le = r.data.reimbursements, oe = r.form.reimbursementDraft?.isAdding ?? !1, se = async () => {
|
|
281
285
|
const n = await r.actions.onSubmit();
|
|
282
|
-
n && P(
|
|
286
|
+
n && P(J.RUN_PAYROLL_EMPLOYEE_SAVED, {
|
|
283
287
|
payrollPrepared: n.data,
|
|
284
|
-
employee:
|
|
288
|
+
employee: k
|
|
285
289
|
});
|
|
286
290
|
}, Y = /* @__PURE__ */ m(
|
|
287
291
|
u,
|
|
@@ -292,7 +296,7 @@ const je = ({
|
|
|
292
296
|
gap: 12,
|
|
293
297
|
children: [
|
|
294
298
|
/* @__PURE__ */ t(v, { variant: "secondary", onClick: () => {
|
|
295
|
-
P(
|
|
299
|
+
P(J.RUN_PAYROLL_EMPLOYEE_CANCELLED);
|
|
296
300
|
}, title: e("cancelCta"), children: e("cancelCta") }),
|
|
297
301
|
/* @__PURE__ */ t(
|
|
298
302
|
v,
|
|
@@ -308,7 +312,7 @@ const je = ({
|
|
|
308
312
|
]
|
|
309
313
|
}
|
|
310
314
|
);
|
|
311
|
-
return /* @__PURE__ */ t("div", { ref:
|
|
315
|
+
return /* @__PURE__ */ t("div", { ref: O, className: E.container, children: /* @__PURE__ */ t(Q, { error: r.errorHandling.errors, LoaderComponent: R, children: /* @__PURE__ */ t(we, { formHookResult: r, children: /* @__PURE__ */ m(u, { flexDirection: "column", gap: 24, children: [
|
|
312
316
|
/* @__PURE__ */ m(
|
|
313
317
|
u,
|
|
314
318
|
{
|
|
@@ -317,7 +321,7 @@ const je = ({
|
|
|
317
321
|
alignItems: f ? "flex-start" : "stretch",
|
|
318
322
|
gap: 12,
|
|
319
323
|
children: [
|
|
320
|
-
/* @__PURE__ */ t(u, { flexDirection: "column", alignItems: "stretch", gap: 8, children: /* @__PURE__ */ t(
|
|
324
|
+
/* @__PURE__ */ t(u, { flexDirection: "column", alignItems: "stretch", gap: 8, children: /* @__PURE__ */ t(A, { as: "h1", styledAs: "h2", children: e("pageTitle", { employeeName: B }) }) }),
|
|
321
325
|
f && Y
|
|
322
326
|
]
|
|
323
327
|
}
|
|
@@ -326,12 +330,12 @@ const je = ({
|
|
|
326
330
|
(() => {
|
|
327
331
|
const n = c.jobs.length > 1, i = r.data.isOvertimeEligible ? e("regularHoursTitle") : e("regularHoursTitleWithoutOvertime"), o = !r.data.withOvertime && r.data.isOvertimeEligible, a = r.data.withOvertime && r.data.isOvertimeEligible;
|
|
328
332
|
return /* @__PURE__ */ m(u, { flexDirection: "column", gap: 16, children: [
|
|
329
|
-
n ? /* @__PURE__ */ t(
|
|
333
|
+
n ? /* @__PURE__ */ t(A, { as: "h3", children: i }) : null,
|
|
330
334
|
a ? /* @__PURE__ */ t(
|
|
331
335
|
S,
|
|
332
336
|
{
|
|
333
337
|
status: "info",
|
|
334
|
-
label: e("overtimeWorkweekAlert", { employeeName:
|
|
338
|
+
label: e("overtimeWorkweekAlert", { employeeName: B }),
|
|
335
339
|
disableScrollIntoView: !0
|
|
336
340
|
}
|
|
337
341
|
) : null,
|
|
@@ -378,7 +382,7 @@ const je = ({
|
|
|
378
382
|
}
|
|
379
383
|
) : null,
|
|
380
384
|
/* @__PURE__ */ m(u, { flexDirection: "column", gap: 12, children: [
|
|
381
|
-
/* @__PURE__ */ t(
|
|
385
|
+
/* @__PURE__ */ t(A, { as: "h3", styledAs: "h4", children: e("paymentMethodTitle") }),
|
|
382
386
|
/* @__PURE__ */ t(
|
|
383
387
|
W,
|
|
384
388
|
{
|
package/dist/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UNSTABLE_PayrollEditEmployee.js","sources":["../../../../src/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.tsx"],"sourcesContent":["import { Fragment, useMemo, useRef } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { PayrollUpdatePaymentMethod } from '@gusto/embedded-api/models/components/payrollupdate'\nimport type { PayrollEditEmployeeProps } from '../PayrollEditEmployee/PayrollEditEmployee'\nimport { usePayrollEditEmployeeForm } from '../PayrollEditEmployee/shared/usePayrollEditEmployeeForm'\nimport {\n isSplitByWorkweek,\n type HourEntry,\n type TimeOffEntry,\n type ReimbursementRow,\n type ReimbursementDraftFields,\n} from '../PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields'\nimport { PayrollEditEmployeeErrorCodes } from '../PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeSchema'\nimport styles from './UNSTABLE_PayrollEditEmployee.module.scss'\nimport {\n componentEvents,\n COMPENSATION_NAME_REGULAR_HOURS,\n COMPENSATION_NAME_OVERTIME,\n COMPENSATION_NAME_DOUBLE_OVERTIME,\n COMPENSATION_NAME_BONUS,\n COMPENSATION_NAME_COMMISSION,\n COMPENSATION_NAME_CORRECTION_PAYMENT,\n COMPENSATION_NAME_CASH_TIPS,\n COMPENSATION_NAME_PAYCHECK_TIPS,\n COMPENSATION_NAME_REIMBURSEMENT,\n} from '@/shared/constants'\nimport { BaseBoundaries, BaseLayout } from '@/components/Base'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Flex, Grid, DataView, useDataView, EmptyData } from '@/components/Common'\nimport type { useDataViewPropReturn } from '@/components/Common/DataView/useDataView'\nimport { SDKFormProvider } from '@/partner-hook-utils/form/SDKFormProvider'\nimport { firstLastName, formatNumberAsCurrency } from '@/helpers/formattedStrings'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport useContainerBreakpoints from '@/hooks/useContainerBreakpoints/useContainerBreakpoints'\nimport PlusCircleIcon from '@/assets/icons/plus-circle.svg?react'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\n\n/**\n * In-development regular-rate-of-pay rebuild of {@link PayrollEditEmployee}.\n *\n * @remarks\n * Gated behind the `payrollRegularRateOfPay` unstable feature flag and not part of the public\n * SDK surface. `PayrollEditEmployee` renders this in place of the stable editor when the flag is\n * enabled. Consumes {@link usePayrollEditEmployeeForm} and renders the header, the hours /\n * additional-earnings / time-off / payment-method sections, and the\n * `Cancel`/`Save` controls, performing a real payroll update on save. For an overtime-eligible\n * employee on a multi-workweek payroll, Overtime/Double-overtime rows start hidden behind a single,\n * employee-level \"Add overtime\" control (`form.data.withOvertime` / `form.actions.addOvertime`)\n * unless the employee already has real overtime hours or matching per-workweek breakdowns; adding\n * overtime also switches hours and overtime-affecting earnings to per-workweek columns and surfaces\n * the per-row \"fill in every workweek\" validation. `Cancel` and `Save` emit the same events as the\n * stable component so the surrounding flow behaves identically.\n *\n * @internal\n */\nexport function UNSTABLE_PayrollEditEmployee({\n FallbackComponent,\n LoaderComponent,\n ...props\n}: PayrollEditEmployeeProps) {\n return (\n <BaseBoundaries\n componentName=\"Payroll.UNSTABLE_PayrollEditEmployee\"\n FallbackComponent={FallbackComponent}\n LoaderComponent={LoaderComponent}\n >\n <Root LoaderComponent={LoaderComponent} {...props} />\n </BaseBoundaries>\n )\n}\n\ninterface ReimbursementsSectionProps {\n rows: ReimbursementRow[]\n isAdding: boolean\n draftFields: ReimbursementDraftFields\n onBeginAdd: () => void\n onSave: () => void\n onCancel: () => void\n onRemove: (index: number) => void\n}\n\n// Reimbursement UI duplicated from the stable PayrollEditEmployeePresentation for\n// visual parity while the RRoP editor is developed alongside legacy. Powered by\n// usePayrollEditEmployeeForm rather than a local field array/draft form.\nconst ReimbursementsSection = ({\n rows,\n isAdding,\n draftFields,\n onBeginAdd,\n onSave,\n onCancel,\n onRemove,\n}: ReimbursementsSectionProps) => {\n const { t } = useTranslation('Payroll.UNSTABLE_PayrollEditEmployee')\n const { Button, ButtonIcon, Heading } = useComponentContext()\n const { Description, Amount } = draftFields\n\n const reimbursementDataViewProps = useDataView<ReimbursementRow>({\n data: rows,\n columns: [\n {\n key: 'description',\n title: t('reimbursementDescriptionColumn'),\n render: row => row.description.trim() || t('reimbursementUnnamedFallback'),\n },\n {\n key: 'amount',\n title: t('reimbursementAmountColumn'),\n justify: 'end',\n render: row => formatNumberAsCurrency(parseFloat(row.amount || '0')),\n },\n {\n key: 'recurring',\n title: t('reimbursementTypeColumn'),\n render: row =>\n row.recurring ? t('reimbursementTypeRecurring') : t('reimbursementTypeOneTime'),\n },\n ],\n itemMenu: row => {\n if (row.recurring) return null\n const displayDescription = row.description.trim() || t('reimbursementUnnamedFallback')\n return (\n <ButtonIcon\n variant=\"tertiary\"\n onClick={() => {\n onRemove(row.index)\n }}\n aria-label={t('removeReimbursementLabel', { description: displayDescription })}\n >\n <TrashCanSvg aria-hidden />\n </ButtonIcon>\n )\n },\n emptyState: () => (\n <EmptyData title={t('reimbursementEmptyTitle')}>\n <Button variant=\"secondary\" onClick={onBeginAdd} icon={<PlusCircleIcon aria-hidden />}>\n {t('addReimbursementCta')}\n </Button>\n </EmptyData>\n ),\n })\n\n return (\n <Flex flexDirection=\"column\" gap={12}>\n <Heading as=\"h3\" styledAs=\"h4\">\n {t('reimbursementTitle')}\n </Heading>\n {!(rows.length === 0 && isAdding) && (\n <DataView label={t('reimbursementsTableLabel')} {...reimbursementDataViewProps} />\n )}\n {isAdding ? (\n <Flex flexDirection=\"column\" gap={12}>\n <Grid gridTemplateColumns={{ base: '1fr', small: [320, 320] }} gap={20}>\n <Description\n label={t('reimbursementDescriptionLabel')}\n placeholder={t('reimbursementDescriptionPlaceholder')}\n />\n <Amount label={t('reimbursementAmountLabel')} adornmentStart=\"$\" isRequired />\n </Grid>\n <Flex gap={12}>\n <Button onClick={onSave} title={t('saveReimbursementCta')}>\n {t('saveReimbursementCta')}\n </Button>\n <Button variant=\"secondary\" onClick={onCancel} title={t('cancelReimbursementCta')}>\n {t('cancelReimbursementCta')}\n </Button>\n </Flex>\n </Flex>\n ) : (\n rows.length > 0 && (\n <div>\n <Button\n variant=\"secondary\"\n onClick={onBeginAdd}\n title={t('addReimbursementLink')}\n icon={<PlusCircleIcon aria-hidden />}\n >\n {t('addReimbursementLink')}\n </Button>\n </div>\n )\n )}\n </Flex>\n )\n}\n\nconst Root = ({\n employeeId,\n companyId,\n payrollId,\n withReimbursements = true,\n onEvent,\n dictionary,\n LoaderComponent,\n}: PayrollEditEmployeeProps) => {\n useComponentDictionary('Payroll.UNSTABLE_PayrollEditEmployee', dictionary)\n useI18n('Payroll.UNSTABLE_PayrollEditEmployee')\n const { t } = useTranslation('Payroll.UNSTABLE_PayrollEditEmployee')\n const dateFormatter = useDateFormatter()\n\n const { Alert, Box, BoxHeader, Button, Heading, Text } = useComponentContext()\n\n const containerRef = useRef<HTMLDivElement>(null)\n const breakpoints = useContainerBreakpoints({ ref: containerRef })\n const isSmallOrGreater = breakpoints.includes('small')\n\n // Error copy keyed by code, supplied to the hook once. Every bound field\n // resolves and renders its own message from this — the consumer never\n // reconstructs form paths or picks which rule a field can fail. Memoized so\n // the hook's fields aren't rebuilt each render.\n const errorMessages = useMemo(\n () => ({\n [PayrollEditEmployeeErrorCodes.NEGATIVE_AMOUNT]: t('validations.negativeAmount'),\n [PayrollEditEmployeeErrorCodes.REQUIRED_WORKWEEK]: t('validations.requiredWorkweek'),\n [PayrollEditEmployeeErrorCodes.REIMBURSEMENT_AMOUNT]: t('validations.reimbursementAmount'),\n }),\n [t],\n )\n\n const form = usePayrollEditEmployeeForm({\n employeeId,\n companyId,\n payrollId,\n withReimbursements,\n errorMessages,\n })\n\n if (form.isLoading) {\n return (\n <div ref={containerRef} className={styles.container}>\n <BaseLayout isLoading error={form.errorHandling.errors} LoaderComponent={LoaderComponent} />\n </div>\n )\n }\n\n const { employee } = form.data\n const Fields = form.form.Fields\n\n const employeeName = firstLastName({\n first_name: employee.firstName,\n last_name: employee.lastName,\n })\n\n const hoursLabel = (name: string) => {\n switch (name) {\n case COMPENSATION_NAME_REGULAR_HOURS:\n return t('compensationNames.regularHours')\n case COMPENSATION_NAME_OVERTIME:\n return t('compensationNames.overtime')\n case COMPENSATION_NAME_DOUBLE_OVERTIME:\n return t('compensationNames.doubleOvertime')\n default:\n return name\n }\n }\n\n const earningLabel = (name: string) => {\n switch (name) {\n case COMPENSATION_NAME_BONUS:\n return t('fixedCompensationNames.bonus')\n case COMPENSATION_NAME_COMMISSION:\n return t('fixedCompensationNames.commission')\n case COMPENSATION_NAME_CORRECTION_PAYMENT:\n return t('fixedCompensationNames.correctionPayment')\n case COMPENSATION_NAME_CASH_TIPS:\n return t('fixedCompensationNames.cashTips')\n case COMPENSATION_NAME_PAYCHECK_TIPS:\n return t('fixedCompensationNames.paycheckTips')\n case COMPENSATION_NAME_REIMBURSEMENT:\n return t('fixedCompensationNames.reimbursement')\n default:\n return name\n }\n }\n\n // The visible rows for a section: the first workweek's rows drive the row set\n // (workweek columns fan out from there), or the flat list when not split.\n const getSectionRows = (section: HourEntry[] | Record<string, HourEntry[]>) =>\n isSplitByWorkweek(section) ? (section[form.data.workweeks[0]?.startDate ?? ''] ?? []) : section\n\n const buildBreakdownDataView = (\n section: HourEntry[] | Record<string, HourEntry[]>,\n options: {\n label: string\n rowHeader: string\n valueColumnLabel: string\n labelFor: (name: string) => string\n adornmentStart?: string\n adornmentEnd?: string\n },\n ) => {\n const { label, rowHeader, valueColumnLabel, labelFor, adornmentStart, adornmentEnd } = options\n const split = isSplitByWorkweek(section)\n const rows = getSectionRows(section)\n\n const renderField = (entry: HourEntry, fieldLabel: string) => (\n <div className={styles.inputContainer}>\n <entry.Field\n label={fieldLabel}\n shouldVisuallyHideLabel\n adornmentStart={adornmentStart}\n adornmentEnd={adornmentEnd}\n />\n </div>\n )\n\n const valueColumn: useDataViewPropReturn<HourEntry>['columns'][number] = {\n title: valueColumnLabel,\n justify: 'end',\n render: row => renderField(row, labelFor(row.name)),\n }\n\n // Columns come straight from the hook's normalized workweeks, so each header\n // has both boundary dates without re-deriving them from the raw payroll.\n const workweekColumns: useDataViewPropReturn<HourEntry>['columns'] = form.data.workweeks.map(\n ({ startDate, endDate }) => {\n const rangeLabel = dateFormatter.formatPayPeriodRange(startDate, endDate, {\n useShortMonth: true,\n })\n return {\n title: rangeLabel,\n justify: 'end',\n render: row => {\n const cell = (section as Record<string, HourEntry[]>)[startDate]?.find(\n entry => entry.jobUuid === row.jobUuid && entry.name === row.name,\n )\n return cell ? renderField(cell, `${labelFor(row.name)} ${rangeLabel}`) : null\n },\n }\n },\n )\n\n const columns: useDataViewPropReturn<HourEntry>['columns'] = [\n { title: rowHeader, render: row => labelFor(row.name) },\n ...(split ? workweekColumns : [valueColumn]),\n ]\n\n return <DataView label={label} isWithinBox columns={columns} data={rows} />\n }\n\n const renderBreakdownSection = (\n section: HourEntry[] | Record<string, HourEntry[]>,\n options: {\n title: string\n label: string\n rowHeader: string\n valueColumnLabel: string\n labelFor: (name: string) => string\n adornmentStart?: string\n adornmentEnd?: string\n footer?: React.ReactNode\n },\n ) => {\n const { title, footer, ...viewOptions } = options\n if (getSectionRows(section).length === 0 && !footer) return null\n\n return (\n <Box header={<BoxHeader title={title} />} withPadding={false} footer={footer}>\n {buildBreakdownDataView(section, viewOptions)}\n </Box>\n )\n }\n\n const renderTimeOffSection = (\n entries: TimeOffEntry[],\n options: { title: string; description?: string },\n ) => {\n if (entries.length === 0) return null\n const { title, description } = options\n\n const columns: useDataViewPropReturn<TimeOffEntry>['columns'] = [\n {\n title: t('typeColumn'),\n render: entry => entry.name,\n },\n {\n title: t('hoursColumn'),\n justify: 'end',\n render: entry => (\n <div className={styles.inputContainer}>\n <entry.Field\n label={entry.name}\n shouldVisuallyHideLabel\n adornmentEnd={t('hoursUnit')}\n description={\n entry.remaining !== null\n ? t('timeOffBalance.remaining', { balance: entry.remaining })\n : undefined\n }\n />\n </div>\n ),\n },\n ]\n\n return (\n <Box header={<BoxHeader title={title} description={description} />} withPadding={false}>\n <DataView label={title} isWithinBox columns={columns} data={entries} />\n </Box>\n )\n }\n\n // A flat single-amount earnings table: one \"type\" column and one \"$\" input\n // column. Used for the merged no-overtime list and the overtime-excluded group.\n const renderAmountTable = (\n rows: { label: string; Field: HourEntry['Field'] }[],\n label: string,\n ) => {\n const columns: useDataViewPropReturn<(typeof rows)[number]>['columns'] = [\n { title: t('typeColumn'), render: row => row.label },\n {\n title: t('amountColumn'),\n justify: 'end',\n render: row => (\n <div className={styles.inputContainer}>\n <row.Field label={row.label} shouldVisuallyHideLabel adornmentStart=\"$\" />\n </div>\n ),\n },\n ]\n return <DataView label={label} isWithinBox columns={columns} data={rows} />\n }\n\n const renderGroupLabel = (label: string) => (\n <div className={styles.earningsGroupLabel}>\n <Text size=\"sm\" weight=\"semibold\">\n {label}\n </Text>\n </div>\n )\n\n const renderEarningsSection = () => {\n const includedEarnings = Fields.overtimeIncludedEarnings\n const excludedRows = Fields.overtimeExcludedEarnings.map(entry => ({\n label: earningLabel(entry.id),\n Field: entry.Field,\n }))\n\n const hasIncluded = getSectionRows(includedEarnings).length > 0\n if (!hasIncluded && excludedRows.length === 0) return null\n\n const includedTable = buildBreakdownDataView(includedEarnings, {\n label: t('additionalEarningsTitle'),\n rowHeader: t('typeColumn'),\n valueColumnLabel: t('amountColumn'),\n labelFor: earningLabel,\n adornmentStart: '$',\n })\n\n // Split into per-workweek columns and labeled overtime groups only once\n // overtime is added (the included section becomes workweek-keyed). Otherwise\n // included and excluded earnings render together as one flat list.\n if (!isSplitByWorkweek(includedEarnings)) {\n const mergedRows = [\n ...includedEarnings.map(entry => ({ label: earningLabel(entry.name), Field: entry.Field })),\n ...excludedRows,\n ]\n return (\n <Box header={<BoxHeader title={t('additionalEarningsTitle')} />} withPadding={false}>\n {renderAmountTable(mergedRows, t('additionalEarningsTitle'))}\n </Box>\n )\n }\n\n return (\n <Box header={<BoxHeader title={t('additionalEarningsTitle')} />} withPadding={false}>\n {hasIncluded ? (\n <>\n <div className={styles.earningsAlert}>\n <Alert\n status=\"info\"\n label={t('overtimeMultiplierEarningsAlert')}\n disableScrollIntoView\n >\n <Text size=\"sm\">{t('overtimeMultiplierEarningsAlertDescription')}</Text>\n </Alert>\n </div>\n {renderGroupLabel(t('overtimeIncludedEarningsGroupLabel'))}\n {includedTable}\n </>\n ) : null}\n {excludedRows.length > 0 ? (\n <>\n {renderGroupLabel(t('overtimeExcludedEarningsGroupLabel'))}\n {renderAmountTable(excludedRows, t('overtimeExcludedEarningsGroupLabel'))}\n </>\n ) : null}\n </Box>\n )\n }\n\n const PaymentMethodField = Fields.paymentMethod\n const ReimbursementDraft = Fields.reimbursementDraft\n const reimbursementRows = form.data.reimbursements\n const isAddingReimbursement = form.form.reimbursementDraft?.isAdding ?? false\n\n const handleSave = async () => {\n const result = await form.actions.onSubmit()\n if (!result) return\n onEvent(componentEvents.RUN_PAYROLL_EMPLOYEE_SAVED, {\n payrollPrepared: result.data,\n employee,\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.RUN_PAYROLL_EMPLOYEE_CANCELLED)\n }\n\n const actions = (\n <Flex\n flexDirection={isSmallOrGreater ? 'row' : 'column'}\n justifyContent={isSmallOrGreater ? 'flex-end' : 'normal'}\n alignItems={isSmallOrGreater ? 'flex-start' : 'stretch'}\n gap={12}\n >\n <Button variant=\"secondary\" onClick={handleCancel} title={t('cancelCta')}>\n {t('cancelCta')}\n </Button>\n <Button\n onClick={() => {\n void handleSave()\n }}\n title={t('saveCta')}\n isLoading={form.status.isPending}\n >\n {t('saveCta')}\n </Button>\n </Flex>\n )\n\n return (\n <div ref={containerRef} className={styles.container}>\n <BaseLayout error={form.errorHandling.errors} LoaderComponent={LoaderComponent}>\n <SDKFormProvider formHookResult={form}>\n <Flex flexDirection=\"column\" gap={24}>\n <Flex\n flexDirection={isSmallOrGreater ? 'row' : 'column'}\n justifyContent=\"space-between\"\n alignItems={isSmallOrGreater ? 'flex-start' : 'stretch'}\n gap={12}\n >\n <Flex flexDirection=\"column\" alignItems=\"stretch\" gap={8}>\n <Heading as=\"h1\" styledAs=\"h2\">\n {t('pageTitle', { employeeName })}\n </Heading>\n </Flex>\n {isSmallOrGreater && actions}\n </Flex>\n {!isSmallOrGreater && actions}\n\n {(() => {\n const isMultiJob = Fields.jobs.length > 1\n const genericHoursTitle = form.data.isOvertimeEligible\n ? t('regularHoursTitle')\n : t('regularHoursTitleWithoutOvertime')\n // \"Add overtime\" is an employee-level action, but the design gives\n // every job its own button so each job's hours box can trigger it.\n const showAddOvertime = !form.data.withOvertime && form.data.isOvertimeEligible\n // Its counterpart once overtime is on: a single employee-level alert\n // explaining the workweek split, rendered once above all jobs.\n const showOvertimeWorkweekAlert =\n form.data.withOvertime && form.data.isOvertimeEligible\n\n return (\n <Flex flexDirection=\"column\" gap={16}>\n {isMultiJob ? <Heading as=\"h3\">{genericHoursTitle}</Heading> : null}\n {showOvertimeWorkweekAlert ? (\n <Alert\n status=\"info\"\n label={t('overtimeWorkweekAlert', { employeeName })}\n disableScrollIntoView\n />\n ) : null}\n {Fields.jobs.map(job => (\n <Fragment key={job.jobUuid}>\n {renderBreakdownSection(job.hours, {\n title: isMultiJob ? (job.title ?? genericHoursTitle) : genericHoursTitle,\n label: genericHoursTitle,\n rowHeader: t('hourTypeColumn'),\n valueColumnLabel: t('hoursColumn'),\n labelFor: hoursLabel,\n adornmentEnd: t('hoursUnit'),\n footer: showAddOvertime ? (\n <Button\n variant=\"secondary\"\n onClick={() => {\n form.actions.addOvertime()\n }}\n title={t('addOvertimeCta')}\n >\n {t('addOvertimeCta')}\n </Button>\n ) : undefined,\n })}\n </Fragment>\n ))}\n </Flex>\n )\n })()}\n\n {renderEarningsSection()}\n\n {renderTimeOffSection(Fields.timeOff, {\n title: Fields.finalPayout ? t('timeOffTitleDismissal') : t('timeOffTitle'),\n })}\n\n {Fields.finalPayout\n ? renderTimeOffSection(Fields.finalPayout, {\n title: t('finalPayoutTitle'),\n description: t('finalPayoutDescription'),\n })\n : null}\n\n {PaymentMethodField ? (\n <Flex flexDirection=\"column\" gap={24}>\n {ReimbursementDraft ? (\n <ReimbursementsSection\n rows={reimbursementRows ?? []}\n isAdding={isAddingReimbursement}\n draftFields={ReimbursementDraft}\n onBeginAdd={() => form.actions.beginAddReimbursement?.()}\n onSave={() => form.actions.saveReimbursement?.()}\n onCancel={() => form.actions.cancelReimbursement?.()}\n onRemove={index => form.actions.removeReimbursement?.(index)}\n />\n ) : null}\n\n <Flex flexDirection=\"column\" gap={12}>\n <Heading as=\"h3\" styledAs=\"h4\">\n {t('paymentMethodTitle')}\n </Heading>\n <PaymentMethodField\n label={t('paymentMethodLabel')}\n description={t('paymentMethodDescription')}\n getOptionLabel={value =>\n value === PayrollUpdatePaymentMethod.Check\n ? t('paymentMethodOptions.check')\n : t('paymentMethodOptions.directDeposit')\n }\n />\n </Flex>\n </Flex>\n ) : null}\n </Flex>\n </SDKFormProvider>\n </BaseLayout>\n </div>\n )\n}\n"],"names":["UNSTABLE_PayrollEditEmployee","FallbackComponent","LoaderComponent","props","jsx","BaseBoundaries","Root","ReimbursementsSection","rows","isAdding","draftFields","onBeginAdd","onSave","onCancel","onRemove","t","useTranslation","Button","ButtonIcon","Heading","useComponentContext","Description","Amount","reimbursementDataViewProps","useDataView","row","formatNumberAsCurrency","displayDescription","TrashCanSvg","EmptyData","PlusCircleIcon","jsxs","Flex","DataView","Grid","employeeId","companyId","payrollId","withReimbursements","onEvent","dictionary","useComponentDictionary","useI18n","dateFormatter","useDateFormatter","Alert","Box","BoxHeader","Text","containerRef","useRef","isSmallOrGreater","useContainerBreakpoints","errorMessages","useMemo","PayrollEditEmployeeErrorCodes","form","usePayrollEditEmployeeForm","styles","BaseLayout","employee","Fields","employeeName","firstLastName","hoursLabel","name","COMPENSATION_NAME_REGULAR_HOURS","COMPENSATION_NAME_OVERTIME","COMPENSATION_NAME_DOUBLE_OVERTIME","earningLabel","COMPENSATION_NAME_BONUS","COMPENSATION_NAME_COMMISSION","COMPENSATION_NAME_CORRECTION_PAYMENT","COMPENSATION_NAME_CASH_TIPS","COMPENSATION_NAME_PAYCHECK_TIPS","COMPENSATION_NAME_REIMBURSEMENT","getSectionRows","section","isSplitByWorkweek","buildBreakdownDataView","options","label","rowHeader","valueColumnLabel","labelFor","adornmentStart","adornmentEnd","split","renderField","entry","fieldLabel","valueColumn","workweekColumns","startDate","endDate","rangeLabel","cell","columns","renderBreakdownSection","title","footer","viewOptions","renderTimeOffSection","entries","description","renderAmountTable","renderGroupLabel","renderEarningsSection","includedEarnings","excludedRows","hasIncluded","includedTable","mergedRows","Fragment","PaymentMethodField","ReimbursementDraft","reimbursementRows","isAddingReimbursement","handleSave","result","componentEvents","actions","SDKFormProvider","isMultiJob","genericHoursTitle","showAddOvertime","showOvertimeWorkweekAlert","job","index","value","PayrollUpdatePaymentMethod"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAwDO,SAASA,GAA6B;AAAA,EAC3C,mBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,GAAGC;AACL,GAA6B;AAC3B,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,eAAc;AAAA,MACd,mBAAAJ;AAAA,MACA,iBAAAC;AAAA,MAEA,UAAA,gBAAAE,EAACE,IAAA,EAAK,iBAAAJ,GAAmC,GAAGC,EAAA,CAAO;AAAA,IAAA;AAAA,EAAA;AAGzD;AAeA,MAAMI,KAAwB,CAAC;AAAA,EAC7B,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC;AAAA,EACA,YAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AACF,MAAkC;AAChC,QAAM,EAAE,GAAAC,EAAA,IAAMC,GAAe,sCAAsC,GAC7D,EAAE,QAAAC,GAAQ,YAAAC,GAAY,SAAAC,EAAA,IAAYC,GAAA,GAClC,EAAE,aAAAC,GAAa,QAAAC,EAAA,IAAWZ,GAE1Ba,IAA6BC,GAA8B;AAAA,IAC/D,MAAMhB;AAAA,IACN,SAAS;AAAA,MACP;AAAA,QACE,KAAK;AAAA,QACL,OAAOO,EAAE,gCAAgC;AAAA,QACzC,QAAQ,CAAAU,MAAOA,EAAI,YAAY,KAAA,KAAUV,EAAE,8BAA8B;AAAA,MAAA;AAAA,MAE3E;AAAA,QACE,KAAK;AAAA,QACL,OAAOA,EAAE,2BAA2B;A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,UACV,aAAaF;AAAA,UACb,YAAY,MAAM3D,EAAK,QAAQ,wBAAA;AAAA,UAC/B,QAAQ,MAAMA,EAAK,QAAQ,oBAAA;AAAA,UAC3B,UAAU,MAAMA,EAAK,QAAQ,sBAAA;AAAA,UAC7B,UAAU,CAAAwE,MAASxE,EAAK,QAAQ,sBAAsBwE,CAAK;AAAA,QAAA;AAAA,MAAA,IAE3D;AAAA,MAEJ,gBAAAjG,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,QAAA,gBAAA5B,EAACe,KAAQ,IAAG,MAAK,UAAS,MACvB,UAAAJ,EAAE,oBAAoB,GACzB;AAAA,QACA,gBAAAX;AAAA,UAAC8G;AAAA,UAAA;AAAA,YACC,OAAOnG,EAAE,oBAAoB;AAAA,YAC7B,aAAaA,EAAE,0BAA0B;AAAA,YACzC,gBAAgB,OACdkH,MAAUC,GAA2B,QACjCnH,EAAE,4BAA4B,IAC9BA,EAAE,oCAAoC;AAAA,UAAA;AAAA,QAAA;AAAA,MAE9C,EAAA,CACF;AAAA,IAAA,EAAA,CACF,IACE;AAAA,EAAA,GACN,EAAA,CACF,GACF,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"UNSTABLE_PayrollEditEmployee.js","sources":["../../../../src/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.tsx"],"sourcesContent":["import { Fragment, useMemo, useRef } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { PayrollUpdatePaymentMethod } from '@gusto/embedded-api/models/components/payrollupdate'\nimport type { PayrollEditEmployeeProps } from '../PayrollEditEmployee/PayrollEditEmployee'\nimport { usePayrollEditEmployeeForm } from '../PayrollEditEmployee/shared/usePayrollEditEmployeeForm'\nimport {\n isSplitByWorkweek,\n type HourEntry,\n type TimeOffEntry,\n type ReimbursementRow,\n type ReimbursementDraftFields,\n} from '../PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields'\nimport { PayrollEditEmployeeErrorCodes } from '../PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeSchema'\nimport styles from './UNSTABLE_PayrollEditEmployee.module.scss'\nimport {\n componentEvents,\n COMPENSATION_NAME_REGULAR_HOURS,\n COMPENSATION_NAME_OVERTIME,\n COMPENSATION_NAME_DOUBLE_OVERTIME,\n COMPENSATION_NAME_BONUS,\n COMPENSATION_NAME_COMMISSION,\n COMPENSATION_NAME_CORRECTION_PAYMENT,\n COMPENSATION_NAME_CASH_TIPS,\n COMPENSATION_NAME_PAYCHECK_TIPS,\n COMPENSATION_NAME_REIMBURSEMENT,\n} from '@/shared/constants'\nimport { BaseBoundaries, BaseLayout } from '@/components/Base'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Flex, Grid, DataView, useDataView, EmptyData } from '@/components/Common'\nimport type { useDataViewPropReturn } from '@/components/Common/DataView/useDataView'\nimport { SDKFormProvider } from '@/partner-hook-utils/form/SDKFormProvider'\nimport { firstLastName, formatNumberAsCurrency } from '@/helpers/formattedStrings'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport useContainerBreakpoints from '@/hooks/useContainerBreakpoints/useContainerBreakpoints'\nimport PlusCircleIcon from '@/assets/icons/plus-circle.svg?react'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\n\n/**\n * In-development regular-rate-of-pay rebuild of {@link PayrollEditEmployee}.\n *\n * @remarks\n * Gated behind the `payrollRegularRateOfPay` unstable feature flag and not part of the public\n * SDK surface. `PayrollEditEmployee` renders this in place of the stable editor when the flag is\n * enabled. Consumes {@link usePayrollEditEmployeeForm} and renders the header, the hours /\n * additional-earnings / time-off / payment-method sections, and the\n * `Cancel`/`Save` controls, performing a real payroll update on save. For an overtime-eligible\n * employee on a multi-workweek payroll, Overtime/Double-overtime rows start hidden behind a single,\n * employee-level \"Add overtime\" control (`form.data.withOvertime` / `form.actions.addOvertime`)\n * unless the employee already has real overtime hours or matching per-workweek breakdowns; adding\n * overtime also switches hours and overtime-affecting earnings to per-workweek columns and surfaces\n * the per-row \"fill in every workweek\" validation. `Cancel` and `Save` emit the same events as the\n * stable component so the surrounding flow behaves identically.\n *\n * @internal\n */\nexport function UNSTABLE_PayrollEditEmployee({\n FallbackComponent,\n LoaderComponent,\n ...props\n}: PayrollEditEmployeeProps) {\n return (\n <BaseBoundaries\n componentName=\"Payroll.UNSTABLE_PayrollEditEmployee\"\n FallbackComponent={FallbackComponent}\n LoaderComponent={LoaderComponent}\n >\n <Root LoaderComponent={LoaderComponent} {...props} />\n </BaseBoundaries>\n )\n}\n\ninterface ReimbursementsSectionProps {\n rows: ReimbursementRow[]\n isAdding: boolean\n draftFields: ReimbursementDraftFields\n onBeginAdd: () => void\n onSave: () => void\n onCancel: () => void\n onRemove: (index: number) => void\n}\n\n// Reimbursement UI duplicated from the stable PayrollEditEmployeePresentation for\n// visual parity while the RRoP editor is developed alongside legacy. Powered by\n// usePayrollEditEmployeeForm rather than a local field array/draft form.\nconst ReimbursementsSection = ({\n rows,\n isAdding,\n draftFields,\n onBeginAdd,\n onSave,\n onCancel,\n onRemove,\n}: ReimbursementsSectionProps) => {\n const { t } = useTranslation('Payroll.UNSTABLE_PayrollEditEmployee')\n const { Button, ButtonIcon, Heading } = useComponentContext()\n const { Description, Amount } = draftFields\n\n const reimbursementDataViewProps = useDataView<ReimbursementRow>({\n data: rows,\n columns: [\n {\n key: 'description',\n title: t('reimbursementDescriptionColumn'),\n render: row => row.description.trim() || t('reimbursementUnnamedFallback'),\n },\n {\n key: 'amount',\n title: t('reimbursementAmountColumn'),\n justify: 'end',\n render: row => formatNumberAsCurrency(parseFloat(row.amount || '0')),\n },\n {\n key: 'recurring',\n title: t('reimbursementTypeColumn'),\n render: row =>\n row.recurring ? t('reimbursementTypeRecurring') : t('reimbursementTypeOneTime'),\n },\n ],\n itemMenu: row => {\n if (row.recurring) return null\n const displayDescription = row.description.trim() || t('reimbursementUnnamedFallback')\n return (\n <ButtonIcon\n variant=\"tertiary\"\n onClick={() => {\n onRemove(row.index)\n }}\n aria-label={t('removeReimbursementLabel', { description: displayDescription })}\n >\n <TrashCanSvg aria-hidden />\n </ButtonIcon>\n )\n },\n emptyState: () => (\n <EmptyData title={t('reimbursementEmptyTitle')}>\n <Button variant=\"secondary\" onClick={onBeginAdd} icon={<PlusCircleIcon aria-hidden />}>\n {t('addReimbursementCta')}\n </Button>\n </EmptyData>\n ),\n })\n\n return (\n <Flex flexDirection=\"column\" gap={12}>\n <Heading as=\"h3\" styledAs=\"h4\">\n {t('reimbursementTitle')}\n </Heading>\n {!(rows.length === 0 && isAdding) && (\n <DataView label={t('reimbursementsTableLabel')} {...reimbursementDataViewProps} />\n )}\n {isAdding ? (\n <Flex flexDirection=\"column\" gap={12}>\n <Grid gridTemplateColumns={{ base: '1fr', small: [320, 320] }} gap={20}>\n <Description\n label={t('reimbursementDescriptionLabel')}\n placeholder={t('reimbursementDescriptionPlaceholder')}\n />\n <Amount label={t('reimbursementAmountLabel')} adornmentStart=\"$\" isRequired />\n </Grid>\n <Flex gap={12}>\n <Button onClick={onSave} title={t('saveReimbursementCta')}>\n {t('saveReimbursementCta')}\n </Button>\n <Button variant=\"secondary\" onClick={onCancel} title={t('cancelReimbursementCta')}>\n {t('cancelReimbursementCta')}\n </Button>\n </Flex>\n </Flex>\n ) : (\n rows.length > 0 && (\n <div>\n <Button\n variant=\"secondary\"\n onClick={onBeginAdd}\n title={t('addReimbursementLink')}\n icon={<PlusCircleIcon aria-hidden />}\n >\n {t('addReimbursementLink')}\n </Button>\n </div>\n )\n )}\n </Flex>\n )\n}\n\nconst Root = ({\n employeeId,\n companyId,\n payrollId,\n withReimbursements = true,\n onEvent,\n dictionary,\n LoaderComponent,\n}: PayrollEditEmployeeProps) => {\n useComponentDictionary('Payroll.UNSTABLE_PayrollEditEmployee', dictionary)\n useI18n('Payroll.UNSTABLE_PayrollEditEmployee')\n const { t } = useTranslation('Payroll.UNSTABLE_PayrollEditEmployee')\n const dateFormatter = useDateFormatter()\n\n const { Alert, Box, BoxHeader, Button, Heading, Text } = useComponentContext()\n\n const containerRef = useRef<HTMLDivElement>(null)\n const breakpoints = useContainerBreakpoints({ ref: containerRef })\n const isSmallOrGreater = breakpoints.includes('small')\n\n // Error copy keyed by code, supplied to the hook once. Every bound field\n // resolves and renders its own message from this — the consumer never\n // reconstructs form paths or picks which rule a field can fail. Memoized so\n // the hook's fields aren't rebuilt each render.\n const errorMessages = useMemo(\n () => ({\n [PayrollEditEmployeeErrorCodes.NEGATIVE_AMOUNT]: t('validations.negativeAmount'),\n [PayrollEditEmployeeErrorCodes.MAX_HOURS]: t('validations.maxHours'),\n [PayrollEditEmployeeErrorCodes.REQUIRED_WORKWEEK]: t('validations.requiredWorkweek'),\n [PayrollEditEmployeeErrorCodes.REIMBURSEMENT_AMOUNT]: t('validations.reimbursementAmount'),\n [PayrollEditEmployeeErrorCodes.MAX_REIMBURSEMENT_AMOUNT]: t(\n 'validations.maxReimbursementAmount',\n ),\n }),\n [t],\n )\n\n const form = usePayrollEditEmployeeForm({\n employeeId,\n companyId,\n payrollId,\n withReimbursements,\n errorMessages,\n })\n\n if (form.isLoading) {\n return (\n <div ref={containerRef} className={styles.container}>\n <BaseLayout isLoading error={form.errorHandling.errors} LoaderComponent={LoaderComponent} />\n </div>\n )\n }\n\n const { employee } = form.data\n const Fields = form.form.Fields\n\n const employeeName = firstLastName({\n first_name: employee.firstName,\n last_name: employee.lastName,\n })\n\n const hoursLabel = (name: string) => {\n switch (name) {\n case COMPENSATION_NAME_REGULAR_HOURS:\n return t('compensationNames.regularHours')\n case COMPENSATION_NAME_OVERTIME:\n return t('compensationNames.overtime')\n case COMPENSATION_NAME_DOUBLE_OVERTIME:\n return t('compensationNames.doubleOvertime')\n default:\n return name\n }\n }\n\n const earningLabel = (name: string) => {\n switch (name) {\n case COMPENSATION_NAME_BONUS:\n return t('fixedCompensationNames.bonus')\n case COMPENSATION_NAME_COMMISSION:\n return t('fixedCompensationNames.commission')\n case COMPENSATION_NAME_CORRECTION_PAYMENT:\n return t('fixedCompensationNames.correctionPayment')\n case COMPENSATION_NAME_CASH_TIPS:\n return t('fixedCompensationNames.cashTips')\n case COMPENSATION_NAME_PAYCHECK_TIPS:\n return t('fixedCompensationNames.paycheckTips')\n case COMPENSATION_NAME_REIMBURSEMENT:\n return t('fixedCompensationNames.reimbursement')\n default:\n return name\n }\n }\n\n // The visible rows for a section: the first workweek's rows drive the row set\n // (workweek columns fan out from there), or the flat list when not split.\n const getSectionRows = (section: HourEntry[] | Record<string, HourEntry[]>) =>\n isSplitByWorkweek(section) ? (section[form.data.workweeks[0]?.startDate ?? ''] ?? []) : section\n\n const buildBreakdownDataView = (\n section: HourEntry[] | Record<string, HourEntry[]>,\n options: {\n label: string\n rowHeader: string\n valueColumnLabel: string\n labelFor: (name: string) => string\n adornmentStart?: string\n adornmentEnd?: string\n },\n ) => {\n const { label, rowHeader, valueColumnLabel, labelFor, adornmentStart, adornmentEnd } = options\n const split = isSplitByWorkweek(section)\n const rows = getSectionRows(section)\n\n const renderField = (entry: HourEntry, fieldLabel: string) => (\n <div className={styles.inputContainer}>\n <entry.Field\n label={fieldLabel}\n shouldVisuallyHideLabel\n adornmentStart={adornmentStart}\n adornmentEnd={adornmentEnd}\n />\n </div>\n )\n\n const valueColumn: useDataViewPropReturn<HourEntry>['columns'][number] = {\n title: valueColumnLabel,\n justify: 'end',\n render: row => renderField(row, labelFor(row.name)),\n }\n\n // Columns come straight from the hook's normalized workweeks, so each header\n // has both boundary dates without re-deriving them from the raw payroll.\n const workweekColumns: useDataViewPropReturn<HourEntry>['columns'] = form.data.workweeks.map(\n ({ startDate, endDate }) => {\n const rangeLabel = dateFormatter.formatPayPeriodRange(startDate, endDate, {\n useShortMonth: true,\n })\n return {\n title: rangeLabel,\n justify: 'end',\n render: row => {\n const cell = (section as Record<string, HourEntry[]>)[startDate]?.find(\n entry => entry.jobUuid === row.jobUuid && entry.name === row.name,\n )\n return cell ? renderField(cell, `${labelFor(row.name)} ${rangeLabel}`) : null\n },\n }\n },\n )\n\n const columns: useDataViewPropReturn<HourEntry>['columns'] = [\n { title: rowHeader, render: row => labelFor(row.name) },\n ...(split ? workweekColumns : [valueColumn]),\n ]\n\n return <DataView label={label} isWithinBox columns={columns} data={rows} />\n }\n\n const renderBreakdownSection = (\n section: HourEntry[] | Record<string, HourEntry[]>,\n options: {\n title: string\n label: string\n rowHeader: string\n valueColumnLabel: string\n labelFor: (name: string) => string\n adornmentStart?: string\n adornmentEnd?: string\n footer?: React.ReactNode\n },\n ) => {\n const { title, footer, ...viewOptions } = options\n if (getSectionRows(section).length === 0 && !footer) return null\n\n return (\n <Box header={<BoxHeader title={title} />} withPadding={false} footer={footer}>\n {buildBreakdownDataView(section, viewOptions)}\n </Box>\n )\n }\n\n const renderTimeOffSection = (\n entries: TimeOffEntry[],\n options: { title: string; description?: string },\n ) => {\n if (entries.length === 0) return null\n const { title, description } = options\n\n const columns: useDataViewPropReturn<TimeOffEntry>['columns'] = [\n {\n title: t('typeColumn'),\n render: entry => entry.name,\n },\n {\n title: t('hoursColumn'),\n justify: 'end',\n render: entry => (\n <div className={styles.inputContainer}>\n <entry.Field\n label={entry.name}\n shouldVisuallyHideLabel\n adornmentEnd={t('hoursUnit')}\n description={\n entry.remaining !== null\n ? t('timeOffBalance.remaining', { balance: entry.remaining })\n : undefined\n }\n />\n </div>\n ),\n },\n ]\n\n return (\n <Box header={<BoxHeader title={title} description={description} />} withPadding={false}>\n <DataView label={title} isWithinBox columns={columns} data={entries} />\n </Box>\n )\n }\n\n // A flat single-amount earnings table: one \"type\" column and one \"$\" input\n // column. Used for the merged no-overtime list and the overtime-excluded group.\n const renderAmountTable = (\n rows: { label: string; Field: HourEntry['Field'] }[],\n label: string,\n ) => {\n const columns: useDataViewPropReturn<(typeof rows)[number]>['columns'] = [\n { title: t('typeColumn'), render: row => row.label },\n {\n title: t('amountColumn'),\n justify: 'end',\n render: row => (\n <div className={styles.inputContainer}>\n <row.Field label={row.label} shouldVisuallyHideLabel adornmentStart=\"$\" />\n </div>\n ),\n },\n ]\n return <DataView label={label} isWithinBox columns={columns} data={rows} />\n }\n\n const renderGroupLabel = (label: string) => (\n <div className={styles.earningsGroupLabel}>\n <Text size=\"sm\" weight=\"semibold\">\n {label}\n </Text>\n </div>\n )\n\n const renderEarningsSection = () => {\n const includedEarnings = Fields.overtimeIncludedEarnings\n const excludedRows = Fields.overtimeExcludedEarnings.map(entry => ({\n label: earningLabel(entry.id),\n Field: entry.Field,\n }))\n\n const hasIncluded = getSectionRows(includedEarnings).length > 0\n if (!hasIncluded && excludedRows.length === 0) return null\n\n const includedTable = buildBreakdownDataView(includedEarnings, {\n label: t('additionalEarningsTitle'),\n rowHeader: t('typeColumn'),\n valueColumnLabel: t('amountColumn'),\n labelFor: earningLabel,\n adornmentStart: '$',\n })\n\n // Split into per-workweek columns and labeled overtime groups only once\n // overtime is added (the included section becomes workweek-keyed). Otherwise\n // included and excluded earnings render together as one flat list.\n if (!isSplitByWorkweek(includedEarnings)) {\n const mergedRows = [\n ...includedEarnings.map(entry => ({ label: earningLabel(entry.name), Field: entry.Field })),\n ...excludedRows,\n ]\n return (\n <Box header={<BoxHeader title={t('additionalEarningsTitle')} />} withPadding={false}>\n {renderAmountTable(mergedRows, t('additionalEarningsTitle'))}\n </Box>\n )\n }\n\n return (\n <Box header={<BoxHeader title={t('additionalEarningsTitle')} />} withPadding={false}>\n {hasIncluded ? (\n <>\n <div className={styles.earningsAlert}>\n <Alert\n status=\"info\"\n label={t('overtimeMultiplierEarningsAlert')}\n disableScrollIntoView\n >\n <Text size=\"sm\">{t('overtimeMultiplierEarningsAlertDescription')}</Text>\n </Alert>\n </div>\n {renderGroupLabel(t('overtimeIncludedEarningsGroupLabel'))}\n {includedTable}\n </>\n ) : null}\n {excludedRows.length > 0 ? (\n <>\n {renderGroupLabel(t('overtimeExcludedEarningsGroupLabel'))}\n {renderAmountTable(excludedRows, t('overtimeExcludedEarningsGroupLabel'))}\n </>\n ) : null}\n </Box>\n )\n }\n\n const PaymentMethodField = Fields.paymentMethod\n const ReimbursementDraft = Fields.reimbursementDraft\n const reimbursementRows = form.data.reimbursements\n const isAddingReimbursement = form.form.reimbursementDraft?.isAdding ?? false\n\n const handleSave = async () => {\n const result = await form.actions.onSubmit()\n if (!result) return\n onEvent(componentEvents.RUN_PAYROLL_EMPLOYEE_SAVED, {\n payrollPrepared: result.data,\n employee,\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.RUN_PAYROLL_EMPLOYEE_CANCELLED)\n }\n\n const actions = (\n <Flex\n flexDirection={isSmallOrGreater ? 'row' : 'column'}\n justifyContent={isSmallOrGreater ? 'flex-end' : 'normal'}\n alignItems={isSmallOrGreater ? 'flex-start' : 'stretch'}\n gap={12}\n >\n <Button variant=\"secondary\" onClick={handleCancel} title={t('cancelCta')}>\n {t('cancelCta')}\n </Button>\n <Button\n onClick={() => {\n void handleSave()\n }}\n title={t('saveCta')}\n isLoading={form.status.isPending}\n >\n {t('saveCta')}\n </Button>\n </Flex>\n )\n\n return (\n <div ref={containerRef} className={styles.container}>\n <BaseLayout error={form.errorHandling.errors} LoaderComponent={LoaderComponent}>\n <SDKFormProvider formHookResult={form}>\n <Flex flexDirection=\"column\" gap={24}>\n <Flex\n flexDirection={isSmallOrGreater ? 'row' : 'column'}\n justifyContent=\"space-between\"\n alignItems={isSmallOrGreater ? 'flex-start' : 'stretch'}\n gap={12}\n >\n <Flex flexDirection=\"column\" alignItems=\"stretch\" gap={8}>\n <Heading as=\"h1\" styledAs=\"h2\">\n {t('pageTitle', { employeeName })}\n </Heading>\n </Flex>\n {isSmallOrGreater && actions}\n </Flex>\n {!isSmallOrGreater && actions}\n\n {(() => {\n const isMultiJob = Fields.jobs.length > 1\n const genericHoursTitle = form.data.isOvertimeEligible\n ? t('regularHoursTitle')\n : t('regularHoursTitleWithoutOvertime')\n // \"Add overtime\" is an employee-level action, but the design gives\n // every job its own button so each job's hours box can trigger it.\n const showAddOvertime = !form.data.withOvertime && form.data.isOvertimeEligible\n // Its counterpart once overtime is on: a single employee-level alert\n // explaining the workweek split, rendered once above all jobs.\n const showOvertimeWorkweekAlert =\n form.data.withOvertime && form.data.isOvertimeEligible\n\n return (\n <Flex flexDirection=\"column\" gap={16}>\n {isMultiJob ? <Heading as=\"h3\">{genericHoursTitle}</Heading> : null}\n {showOvertimeWorkweekAlert ? (\n <Alert\n status=\"info\"\n label={t('overtimeWorkweekAlert', { employeeName })}\n disableScrollIntoView\n />\n ) : null}\n {Fields.jobs.map(job => (\n <Fragment key={job.jobUuid}>\n {renderBreakdownSection(job.hours, {\n title: isMultiJob ? (job.title ?? genericHoursTitle) : genericHoursTitle,\n label: genericHoursTitle,\n rowHeader: t('hourTypeColumn'),\n valueColumnLabel: t('hoursColumn'),\n labelFor: hoursLabel,\n adornmentEnd: t('hoursUnit'),\n footer: showAddOvertime ? (\n <Button\n variant=\"secondary\"\n onClick={() => {\n form.actions.addOvertime()\n }}\n title={t('addOvertimeCta')}\n >\n {t('addOvertimeCta')}\n </Button>\n ) : undefined,\n })}\n </Fragment>\n ))}\n </Flex>\n )\n })()}\n\n {renderEarningsSection()}\n\n {renderTimeOffSection(Fields.timeOff, {\n title: Fields.finalPayout ? t('timeOffTitleDismissal') : t('timeOffTitle'),\n })}\n\n {Fields.finalPayout\n ? renderTimeOffSection(Fields.finalPayout, {\n title: t('finalPayoutTitle'),\n description: t('finalPayoutDescription'),\n })\n : null}\n\n {PaymentMethodField ? (\n <Flex flexDirection=\"column\" gap={24}>\n {ReimbursementDraft ? (\n <ReimbursementsSection\n rows={reimbursementRows ?? []}\n isAdding={isAddingReimbursement}\n draftFields={ReimbursementDraft}\n onBeginAdd={() => form.actions.beginAddReimbursement?.()}\n onSave={() => form.actions.saveReimbursement?.()}\n onCancel={() => form.actions.cancelReimbursement?.()}\n onRemove={index => form.actions.removeReimbursement?.(index)}\n />\n ) : null}\n\n <Flex flexDirection=\"column\" gap={12}>\n <Heading as=\"h3\" styledAs=\"h4\">\n {t('paymentMethodTitle')}\n </Heading>\n <PaymentMethodField\n label={t('paymentMethodLabel')}\n description={t('paymentMethodDescription')}\n getOptionLabel={value =>\n value === PayrollUpdatePaymentMethod.Check\n ? t('paymentMethodOptions.check')\n : t('paymentMethodOptions.directDeposit')\n }\n />\n </Flex>\n </Flex>\n ) : null}\n </Flex>\n </SDKFormProvider>\n </BaseLayout>\n </div>\n )\n}\n"],"names":["UNSTABLE_PayrollEditEmployee","FallbackComponent","LoaderComponent","props","jsx","BaseBoundaries","Root","ReimbursementsSection","rows","isAdding","draftFields","onBeginAdd","onSave","onCancel","onRemove","t","useTranslation","Button","ButtonIcon","Heading","useComponentContext","Description","Amount","reimbursementDataViewProps","useDataView","row","formatNumberAsCurrency","displayDescription","TrashCanSvg","EmptyData","PlusCircleIcon","jsxs","Flex","DataView","Grid","employeeId","companyId","payrollId","withReimbursements","onEvent","dictionary","useComponentDictionary","useI18n","dateFormatter","useDateFormatter","Alert","Box","BoxHeader","Text","containerRef","useRef","isSmallOrGreater","useContainerBreakpoints","errorMessages","useMemo","PayrollEditEmployeeErrorCodes","form","usePayrollEditEmployeeForm","styles","BaseLayout","employee","Fields","employeeName","firstLastName","hoursLabel","name","COMPENSATION_NAME_REGULAR_HOURS","COMPENSATION_NAME_OVERTIME","COMPENSATION_NAME_DOUBLE_OVERTIME","earningLabel","COMPENSATION_NAME_BONUS","COMPENSATION_NAME_COMMISSION","COMPENSATION_NAME_CORRECTION_PAYMENT","COMPENSATION_NAME_CASH_TIPS","COMPENSATION_NAME_PAYCHECK_TIPS","COMPENSATION_NAME_REIMBURSEMENT","getSectionRows","section","isSplitByWorkweek","buildBreakdownDataView","options","label","rowHeader","valueColumnLabel","labelFor","adornmentStart","adornmentEnd","split","renderField","entry","fieldLabel","valueColumn","workweekColumns","startDate","endDate","rangeLabel","cell","columns","renderBreakdownSection","title","footer","viewOptions","renderTimeOffSection","entries","description","renderAmountTable","renderGroupLabel","renderEarningsSection","includedEarnings","excludedRows","hasIncluded","includedTable","mergedRows","Fragment","PaymentMethodField","ReimbursementDraft","reimbursementRows","isAddingReimbursement","handleSave","result","componentEvents","actions","SDKFormProvider","isMultiJob","genericHoursTitle","showAddOvertime","showOvertimeWorkweekAlert","job","index","value","PayrollUpdatePaymentMethod"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAwDO,SAASA,GAA6B;AAAA,EAC3C,mBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,GAAGC;AACL,GAA6B;AAC3B,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,eAAc;AAAA,MACd,mBAAAJ;AAAA,MACA,iBAAAC;AAAA,MAEA,UAAA,gBAAAE,EAACE,IAAA,EAAK,iBAAAJ,GAAmC,GAAGC,EAAA,CAAO;AAAA,IAAA;AAAA,EAAA;AAGzD;AAeA,MAAMI,KAAwB,CAAC;AAAA,EAC7B,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,aAAAC;AAAA,EACA,YAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AACF,MAAkC;AAChC,QAAM,EAAE,GAAAC,EAAA,IAAMC,GAAe,sCAAsC,GAC7D,EAAE,QAAAC,GAAQ,YAAAC,GAAY,SAAAC,EAAA,IAAYC,GAAA,GAClC,EAAE,aAAAC,GAAa,QAAAC,EAAA,IAAWZ,GAE1Ba,IAA6BC,GAA8B;AAAA,IAC/D,MAAMhB;AAAA,IACN,SAAS;AAAA,MACP;AAAA,QACE,KAAK;AAAA,QACL,OAAOO,EAAE,gCAAgC;AAAA,QACzC,QAAQ,CAAAU,MAAOA,EAAI,YAAY,KAAA,KAAUV,EAAE,8BAA8B;AAAA,MAAA;AAAA,MAE3E;AAAA,QACE,KAAK;AAAA,QACL,OAAOA,EAAE,2BAA2B;AAAA,QACpC,SAAS;AAAA,QACT,QAAQ,CAAAU,MAAOC,GAAuB,WAAWD,EAAI,UAA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MAAM6G,MAAqB,CAAA;AAAA,UAC3B,UAAUC;AAAA,UACV,aAAaF;AAAA,UACb,YAAY,MAAM3D,EAAK,QAAQ,wBAAA;AAAA,UAC/B,QAAQ,MAAMA,EAAK,QAAQ,oBAAA;AAAA,UAC3B,UAAU,MAAMA,EAAK,QAAQ,sBAAA;AAAA,UAC7B,UAAU,CAAAwE,MAASxE,EAAK,QAAQ,sBAAsBwE,CAAK;AAAA,QAAA;AAAA,MAAA,IAE3D;AAAA,MAEJ,gBAAAjG,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,QAAA,gBAAA5B,EAACe,KAAQ,IAAG,MAAK,UAAS,MACvB,UAAAJ,EAAE,oBAAoB,GACzB;AAAA,QACA,gBAAAX;AAAA,UAAC8G;AAAA,UAAA;AAAA,YACC,OAAOnG,EAAE,oBAAoB;AAAA,YAC7B,aAAaA,EAAE,0BAA0B;AAAA,YACzC,gBAAgB,OACdkH,MAAUC,GAA2B,QACjCnH,EAAE,4BAA4B,IAC9BA,EAAE,oCAAoC;AAAA,UAAA;AAAA,QAAA;AAAA,MAE9C,EAAA,CACF;AAAA,IAAA,EAAA,CACF,IACE;AAAA,EAAA,GACN,EAAA,CACF,GACF,GACF;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useComponentContext.js","sources":["../../../src/contexts/ComponentAdapter/useComponentContext.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { FunctionComponent } from 'react'\nimport type { TextInputProps } from '@/components/Common/UI/TextInput/TextInputTypes'\nimport type { TextAreaProps } from '@/components/Common/UI/TextArea/TextAreaTypes'\nimport type { NumberInputProps } from '@/components/Common/UI/NumberInput/NumberInputTypes'\nimport type { CheckboxGroupProps } from '@/components/Common/UI/CheckboxGroup/CheckboxGroupTypes'\nimport type { ComboBoxProps } from '@/components/Common/UI/ComboBox/ComboBoxTypes'\nimport type { CheckboxProps } from '@/components/Common/UI/Checkbox/CheckboxTypes'\nimport type { DatePickerProps } from '@/components/Common/UI/DatePicker/DatePickerTypes'\nimport type { RadioProps } from '@/components/Common/UI/Radio/RadioTypes'\nimport type { RadioGroupProps } from '@/components/Common/UI/RadioGroup/RadioGroupTypes'\nimport type { SelectProps } from '@/components/Common/UI/Select/SelectTypes'\nimport type { SwitchProps } from '@/components/Common/UI/Switch/SwitchTypes'\nimport type { ButtonIconProps, ButtonProps } from '@/components/Common/UI/Button/ButtonTypes'\nimport type { AlertProps } from '@/components/Common/UI/Alert/AlertTypes'\nimport type { CardProps } from '@/components/Common/UI/Card/CardTypes'\nimport type { BoxProps } from '@/components/Common/UI/Box/BoxTypes'\nimport type { FormBoxProps } from '@/components/Common/UI/FormBox/FormBoxTypes'\nimport type { LinkProps } from '@/components/Common/UI/Link/LinkTypes'\nimport type { BadgeProps } from '@/components/Common/UI/Badge/BadgeTypes'\nimport type { BannerProps } from '@/components/Common/UI/Banner/BannerTypes'\nimport type { MenuProps } from '@/components/Common/UI/Menu/MenuTypes'\nimport type { TableProps } from '@/components/Common/UI/Table/TableTypes'\nimport type { OrderedListProps, UnorderedListProps } from '@/components/Common/UI/List/ListTypes'\nimport type { HeadingProps } from '@/components/Common/UI/Heading/HeadingTypes'\nimport type { PaginationControlProps } from '@/components/Common/PaginationControl/PaginationControlTypes'\nimport type { TextProps } from '@/components/Common/UI/Text/TextTypes'\nimport type { CalendarPreviewProps } from '@/components/Common/UI/CalendarPreview/CalendarPreviewTypes'\nimport type { DateRangePickerProps } from '@/components/Common/UI/DateRangePicker/DateRangePickerTypes'\nimport type { ProgressBarProps } from '@/components/Common/UI/ProgressBar/ProgressBarTypes'\nimport type { BreadcrumbsProps } from '@/components/Common/UI/Breadcrumbs/BreadcrumbsTypes'\nimport type { TabsProps } from '@/components/Common/UI/Tabs/TabsTypes'\nimport type { DialogProps } from '@/components/Common/UI/Dialog/DialogTypes'\nimport type { ModalProps } from '@/components/Common/UI/Modal/ModalTypes'\nimport type { LoadingSpinnerProps } from '@/components/Common/UI/LoadingSpinner/LoadingSpinnerTypes'\nimport type { DescriptionListProps } from '@/components/Common/UI/DescriptionList/DescriptionListTypes'\nimport type { FileInputProps } from '@/components/Common/UI/FileInput/FileInputTypes'\nimport type { BoxHeaderProps } from '@/components/Common/UI/BoxHeader/BoxHeaderTypes'\nimport type { FormBoxHeaderProps } from '@/components/Common/UI/FormBoxHeader/FormBoxHeaderTypes'\nimport type { MultiSelectComboBoxProps } from '@/components/Common/UI/MultiSelectComboBox/MultiSelectComboBoxTypes'\nimport type { PayrollLoadingProps } from '@/components/Common/PayrollLoading/PayrollLoadingTypes'\nimport type { FieldCaptionProps } from '@/components/Common/FieldCaption/FieldCaptionTypes'\n\n/**\n * Full map of UI components used by the SDK. Every property is a React component that the\n * SDK renders internally — override any of them to substitute your own design system.\n *\n * Pass a `Partial<ComponentsContextType>` to {@link GustoProvider} via the `components` prop to\n * replace specific components while keeping SDK defaults for the rest.\n *\n * To take full control of every UI component (and eliminate the React Aria dependency),\n * pass a complete {@link ComponentsContextType} to {@link GustoProviderCustomUIAdapter} instead.\n * All properties are then required except `PaginationControl`, `PayrollLoading`, and `FieldCaption`,\n * which fall back to built-in SDK implementations when omitted.\n *\n * @public\n * @group Component adapter\n *\n * @example Partial override with GustoProvider\n * ```tsx\n * import { GustoProvider } from '@gusto/embedded-react-sdk'\n *\n * function App() {\n * return (\n * <GustoProvider\n * config={{ baseUrl: '/api/gusto/' }}\n * components={{\n * Button: MyButton,\n * TextInput: MyTextInput,\n * }}\n * >\n * <EmployeeOnboardingFlow companyId=\"company_123\" />\n * </GustoProvider>\n * )\n * }\n * ```\n *\n * @example Full replacement with GustoProviderCustomUIAdapter\n * ```tsx\n * import { GustoProviderCustomUIAdapter, type ComponentsContextType } from '@gusto/embedded-react-sdk'\n *\n * const myComponents: ComponentsContextType = {\n * Alert: props => <MyAlert {...props} />,\n * Button: props => <MyButton {...props} />,\n * // ... all required components\n * }\n *\n * function App() {\n * return (\n * <GustoProviderCustomUIAdapter\n * config={{ baseUrl: '/api/gusto/' }}\n * components={myComponents}\n * >\n * <EmployeeOnboardingFlow companyId=\"company_123\" />\n * </GustoProviderCustomUIAdapter>\n * )\n * }\n * ```\n */\nexport interface ComponentsContextType {\n /** Status message with an optional dismiss action; used for errors, warnings, success, and info. */\n Alert: FunctionComponent<AlertProps>\n /** Small inline label for status, counts, or tags; optionally dismissible. */\n Badge: FunctionComponent<BadgeProps>\n /** Full-width notification banner for prominent warnings and errors. */\n Banner: FunctionComponent<BannerProps>\n /** HTML `<button>` with primary, secondary, tertiary, and error variants. */\n Button: FunctionComponent<ButtonProps>\n /** Icon-only `<button>`; requires `aria-label` since there is no visible text for assistive technologies. */\n ButtonIcon: FunctionComponent<ButtonIconProps>\n /** Sectioned layout container with distinct header, body, and footer areas. */\n Box: FunctionComponent<BoxProps>\n /** Header section of a Box with a title, optional description, and optional inline action. */\n BoxHeader: FunctionComponent<BoxHeaderProps>\n /** Bordered container for grouping related form fields, with an optional header slot. */\n FormBox: FunctionComponent<FormBoxProps>\n /** Header section of a FormBox with a title, optional description, and optional inline action. */\n FormBoxHeader: FunctionComponent<FormBoxHeaderProps>\n /** Read-only calendar for visualizing a date range with optional highlighted dates. */\n CalendarPreview: FunctionComponent<CalendarPreviewProps>\n /** Content container with an optional overflow menu and a leading action slot. */\n Card: FunctionComponent<CardProps>\n /** Form field wrapping a single `<input type=\"checkbox\" />`. */\n Checkbox: FunctionComponent<CheckboxProps>\n /** Form field grouping `<input type=\"checkbox\" />` elements for multi-option selection. */\n CheckboxGroup: FunctionComponent<CheckboxGroupProps>\n /** Form field wrapping a typeahead `<input />` for single-option selection. */\n ComboBox: FunctionComponent<ComboBoxProps>\n /** Form field wrapping an `<input type=\"date\" />` with a calendar picker popover. */\n DatePicker: FunctionComponent<DatePickerProps>\n /** Form field wrapping paired `<input type=\"date\" />` elements for a date range. */\n DateRangePicker: FunctionComponent<DateRangePickerProps>\n /** HTML `<dl>` of term/description pairs in stacked or horizontal layout. */\n DescriptionList: FunctionComponent<DescriptionListProps>\n /** Modal confirmation dialog with a primary action and a cancel action. */\n Dialog: FunctionComponent<DialogProps>\n /** Form field wrapping an `<input type=\"file\" />`. */\n FileInput: FunctionComponent<FileInputProps>\n /** HTML `<h1>`–`<h6>` with visual style controlled independently from semantic level. */\n Heading: FunctionComponent<HeadingProps>\n /** HTML `<a>` for inline navigation. */\n Link: FunctionComponent<LinkProps>\n /** Spinner shown while data or an action is pending. */\n LoadingSpinner: FunctionComponent<LoadingSpinnerProps>\n /** Popover menu of actions anchored to a trigger element. */\n Menu: FunctionComponent<MenuProps>\n /** Overlay modal with customizable body content and footer. */\n Modal: FunctionComponent<ModalProps>\n /** Form field wrapping a typeahead `<input />` for multi-option selection. */\n MultiSelectComboBox: FunctionComponent<MultiSelectComboBoxProps>\n /** Form field wrapping a numeric `<input />` for currency, decimal, or percent values. */\n NumberInput: FunctionComponent<NumberInputProps>\n /** HTML `<ol>` for a numbered list of items. */\n OrderedList: FunctionComponent<OrderedListProps>\n /** Step-based progress indicator for multi-step flows. */\n ProgressBar: FunctionComponent<ProgressBarProps>\n /** Navigation breadcrumb trail showing the user's position in a multi-step flow. */\n Breadcrumbs: FunctionComponent<BreadcrumbsProps>\n /** Form field wrapping a single `<input type=\"radio\" />`. */\n Radio: FunctionComponent<RadioProps>\n /** Form field grouping `<input type=\"radio\" />` elements for single-option selection. */\n RadioGroup: FunctionComponent<RadioGroupProps>\n /** Form field wrapping a single-select dropdown. */\n Select: FunctionComponent<SelectProps>\n /** Form field wrapping an `<input type=\"checkbox\" />` styled as a toggle. */\n Switch: FunctionComponent<SwitchProps>\n /** Tabbed navigation with associated content panels. */\n Tabs: FunctionComponent<TabsProps>\n /** Tabular data display with headers, rows, optional footer, and empty state. */\n Table: FunctionComponent<TableProps>\n /** Body text element rendered as `<p>`, `<span>`, `<div>`, or `<pre>`. */\n Text: FunctionComponent<TextProps>\n /** Form field wrapping an `<input />`. */\n TextInput: FunctionComponent<TextInputProps>\n /** Form field wrapping a `<textarea>`. */\n TextArea: FunctionComponent<TextAreaProps>\n /** HTML `<ul>` for an unordered list of items. */\n UnorderedList: FunctionComponent<UnorderedListProps>\n\n /** Label or legend caption for form controls, including the optional/required indicator. Defaults to the SDK's built-in caption UI when omitted. */\n FieldCaption?: FunctionComponent<FieldCaptionProps>\n /** Pagination controls for list views. Defaults to the SDK's built-in pagination UI when omitted. */\n PaginationControl?: FunctionComponent<PaginationControlProps>\n /** Loading indicator for payroll calculation. Defaults to the SDK's built-in loading state when omitted. */\n PayrollLoading?: FunctionComponent<PayrollLoadingProps>\n}\n\n/** @internal */\nexport const ComponentsContext = createContext<ComponentsContextType | null>(null)\n\n/** @internal */\nexport const useComponentContext = () => {\n const context = useContext(ComponentsContext)\n if (!context) {\n throw new Error('useComponentContext must be used within a ComponentsProvider')\n }\n return context\n}\n"],"names":["ComponentsContext","createContext","useComponentContext","context","useContext"],"mappings":";AA4LO,MAAMA,IAAoBC,EAA4C,IAAI,GAGpEC,IAAsB,MAAM;AACvC,QAAMC,IAAUC,EAAWJ,CAAiB;AAC5C,MAAI,CAACG;AACH,UAAM,IAAI,MAAM,8DAA8D;AAEhF,SAAOA;AACT;"}
|
|
1
|
+
{"version":3,"file":"useComponentContext.js","sources":["../../../src/contexts/ComponentAdapter/useComponentContext.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { FunctionComponent } from 'react'\nimport type { TextInputProps } from '@/components/Common/UI/TextInput/TextInputTypes'\nimport type { TextAreaProps } from '@/components/Common/UI/TextArea/TextAreaTypes'\nimport type { NumberInputProps } from '@/components/Common/UI/NumberInput/NumberInputTypes'\nimport type { CheckboxGroupProps } from '@/components/Common/UI/CheckboxGroup/CheckboxGroupTypes'\nimport type { ComboBoxProps } from '@/components/Common/UI/ComboBox/ComboBoxTypes'\nimport type { CheckboxProps } from '@/components/Common/UI/Checkbox/CheckboxTypes'\nimport type { DatePickerProps } from '@/components/Common/UI/DatePicker/DatePickerTypes'\nimport type { RadioProps } from '@/components/Common/UI/Radio/RadioTypes'\nimport type { RadioGroupProps } from '@/components/Common/UI/RadioGroup/RadioGroupTypes'\nimport type { SelectProps } from '@/components/Common/UI/Select/SelectTypes'\nimport type { SwitchProps } from '@/components/Common/UI/Switch/SwitchTypes'\nimport type { ButtonIconProps, ButtonProps } from '@/components/Common/UI/Button/ButtonTypes'\nimport type { AlertProps } from '@/components/Common/UI/Alert/AlertTypes'\nimport type { CardProps } from '@/components/Common/UI/Card/CardTypes'\nimport type { BoxProps } from '@/components/Common/UI/Box/BoxTypes'\nimport type { FormBoxProps } from '@/components/Common/UI/FormBox/FormBoxTypes'\nimport type { LinkProps } from '@/components/Common/UI/Link/LinkTypes'\nimport type { BadgeProps } from '@/components/Common/UI/Badge/BadgeTypes'\nimport type { BannerProps } from '@/components/Common/UI/Banner/BannerTypes'\nimport type { MenuProps } from '@/components/Common/UI/Menu/MenuTypes'\nimport type { TableProps } from '@/components/Common/UI/Table/TableTypes'\nimport type { OrderedListProps, UnorderedListProps } from '@/components/Common/UI/List/ListTypes'\nimport type { HeadingProps } from '@/components/Common/UI/Heading/HeadingTypes'\nimport type { PaginationControlProps } from '@/components/Common/PaginationControl/PaginationControlTypes'\nimport type { TextProps } from '@/components/Common/UI/Text/TextTypes'\nimport type { CalendarPreviewProps } from '@/components/Common/UI/CalendarPreview/CalendarPreviewTypes'\nimport type { DateRangePickerProps } from '@/components/Common/UI/DateRangePicker/DateRangePickerTypes'\nimport type { ProgressBarProps } from '@/components/Common/UI/ProgressBar/ProgressBarTypes'\nimport type { BreadcrumbsProps } from '@/components/Common/UI/Breadcrumbs/BreadcrumbsTypes'\nimport type { TabsProps } from '@/components/Common/UI/Tabs/TabsTypes'\nimport type { DialogProps } from '@/components/Common/UI/Dialog/DialogTypes'\nimport type { ModalProps } from '@/components/Common/UI/Modal/ModalTypes'\nimport type { LoadingSpinnerProps } from '@/components/Common/UI/LoadingSpinner/LoadingSpinnerTypes'\nimport type { DescriptionListProps } from '@/components/Common/UI/DescriptionList/DescriptionListTypes'\nimport type { FileInputProps } from '@/components/Common/UI/FileInput/FileInputTypes'\nimport type { BoxHeaderProps } from '@/components/Common/UI/BoxHeader/BoxHeaderTypes'\nimport type { FormBoxHeaderProps } from '@/components/Common/UI/FormBoxHeader/FormBoxHeaderTypes'\nimport type { MultiSelectComboBoxProps } from '@/components/Common/UI/MultiSelectComboBox/MultiSelectComboBoxTypes'\nimport type { PayrollLoadingProps } from '@/components/Common/PayrollLoading/PayrollLoadingTypes'\nimport type { FieldCaptionProps } from '@/components/Common/FieldCaption/FieldCaptionTypes'\nimport type { DocumentEmbedProps } from '@/components/Common/DocumentEmbed/DocumentEmbedTypes'\n\n/**\n * Full map of UI components used by the SDK. Every property is a React component that the\n * SDK renders internally — override any of them to substitute your own design system.\n *\n * Pass a `Partial<ComponentsContextType>` to {@link GustoProvider} via the `components` prop to\n * replace specific components while keeping SDK defaults for the rest.\n *\n * To take full control of every UI component (and eliminate the React Aria dependency),\n * pass a complete {@link ComponentsContextType} to {@link GustoProviderCustomUIAdapter} instead.\n * All properties are then required except `PaginationControl`, `PayrollLoading`, `FieldCaption`,\n * and `DocumentEmbed`, which fall back to built-in SDK implementations when omitted.\n *\n * @public\n * @group Component adapter\n *\n * @example Partial override with GustoProvider\n * ```tsx\n * import { GustoProvider } from '@gusto/embedded-react-sdk'\n *\n * function App() {\n * return (\n * <GustoProvider\n * config={{ baseUrl: '/api/gusto/' }}\n * components={{\n * Button: MyButton,\n * TextInput: MyTextInput,\n * }}\n * >\n * <EmployeeOnboardingFlow companyId=\"company_123\" />\n * </GustoProvider>\n * )\n * }\n * ```\n *\n * @example Full replacement with GustoProviderCustomUIAdapter\n * ```tsx\n * import { GustoProviderCustomUIAdapter, type ComponentsContextType } from '@gusto/embedded-react-sdk'\n *\n * const myComponents: ComponentsContextType = {\n * Alert: props => <MyAlert {...props} />,\n * Button: props => <MyButton {...props} />,\n * // ... all required components\n * }\n *\n * function App() {\n * return (\n * <GustoProviderCustomUIAdapter\n * config={{ baseUrl: '/api/gusto/' }}\n * components={myComponents}\n * >\n * <EmployeeOnboardingFlow companyId=\"company_123\" />\n * </GustoProviderCustomUIAdapter>\n * )\n * }\n * ```\n */\nexport interface ComponentsContextType {\n /** Status message with an optional dismiss action; used for errors, warnings, success, and info. */\n Alert: FunctionComponent<AlertProps>\n /** Small inline label for status, counts, or tags; optionally dismissible. */\n Badge: FunctionComponent<BadgeProps>\n /** Full-width notification banner for prominent warnings and errors. */\n Banner: FunctionComponent<BannerProps>\n /** HTML `<button>` with primary, secondary, tertiary, and error variants. */\n Button: FunctionComponent<ButtonProps>\n /** Icon-only `<button>`; requires `aria-label` since there is no visible text for assistive technologies. */\n ButtonIcon: FunctionComponent<ButtonIconProps>\n /** Sectioned layout container with distinct header, body, and footer areas. */\n Box: FunctionComponent<BoxProps>\n /** Header section of a Box with a title, optional description, and optional inline action. */\n BoxHeader: FunctionComponent<BoxHeaderProps>\n /** Bordered container for grouping related form fields, with an optional header slot. */\n FormBox: FunctionComponent<FormBoxProps>\n /** Header section of a FormBox with a title, optional description, and optional inline action. */\n FormBoxHeader: FunctionComponent<FormBoxHeaderProps>\n /** Read-only calendar for visualizing a date range with optional highlighted dates. */\n CalendarPreview: FunctionComponent<CalendarPreviewProps>\n /** Content container with an optional overflow menu and a leading action slot. */\n Card: FunctionComponent<CardProps>\n /** Form field wrapping a single `<input type=\"checkbox\" />`. */\n Checkbox: FunctionComponent<CheckboxProps>\n /** Form field grouping `<input type=\"checkbox\" />` elements for multi-option selection. */\n CheckboxGroup: FunctionComponent<CheckboxGroupProps>\n /** Form field wrapping a typeahead `<input />` for single-option selection. */\n ComboBox: FunctionComponent<ComboBoxProps>\n /** Form field wrapping an `<input type=\"date\" />` with a calendar picker popover. */\n DatePicker: FunctionComponent<DatePickerProps>\n /** Form field wrapping paired `<input type=\"date\" />` elements for a date range. */\n DateRangePicker: FunctionComponent<DateRangePickerProps>\n /** HTML `<dl>` of term/description pairs in stacked or horizontal layout. */\n DescriptionList: FunctionComponent<DescriptionListProps>\n /** Modal confirmation dialog with a primary action and a cancel action. */\n Dialog: FunctionComponent<DialogProps>\n /** Form field wrapping an `<input type=\"file\" />`. */\n FileInput: FunctionComponent<FileInputProps>\n /** HTML `<h1>`–`<h6>` with visual style controlled independently from semantic level. */\n Heading: FunctionComponent<HeadingProps>\n /** HTML `<a>` for inline navigation. */\n Link: FunctionComponent<LinkProps>\n /** Spinner shown while data or an action is pending. */\n LoadingSpinner: FunctionComponent<LoadingSpinnerProps>\n /** Popover menu of actions anchored to a trigger element. */\n Menu: FunctionComponent<MenuProps>\n /** Overlay modal with customizable body content and footer. */\n Modal: FunctionComponent<ModalProps>\n /** Form field wrapping a typeahead `<input />` for multi-option selection. */\n MultiSelectComboBox: FunctionComponent<MultiSelectComboBoxProps>\n /** Form field wrapping a numeric `<input />` for currency, decimal, or percent values. */\n NumberInput: FunctionComponent<NumberInputProps>\n /** HTML `<ol>` for a numbered list of items. */\n OrderedList: FunctionComponent<OrderedListProps>\n /** Step-based progress indicator for multi-step flows. */\n ProgressBar: FunctionComponent<ProgressBarProps>\n /** Navigation breadcrumb trail showing the user's position in a multi-step flow. */\n Breadcrumbs: FunctionComponent<BreadcrumbsProps>\n /** Form field wrapping a single `<input type=\"radio\" />`. */\n Radio: FunctionComponent<RadioProps>\n /** Form field grouping `<input type=\"radio\" />` elements for single-option selection. */\n RadioGroup: FunctionComponent<RadioGroupProps>\n /** Form field wrapping a single-select dropdown. */\n Select: FunctionComponent<SelectProps>\n /** Form field wrapping an `<input type=\"checkbox\" />` styled as a toggle. */\n Switch: FunctionComponent<SwitchProps>\n /** Tabbed navigation with associated content panels. */\n Tabs: FunctionComponent<TabsProps>\n /** Tabular data display with headers, rows, optional footer, and empty state. */\n Table: FunctionComponent<TableProps>\n /** Body text element rendered as `<p>`, `<span>`, `<div>`, or `<pre>`. */\n Text: FunctionComponent<TextProps>\n /** Form field wrapping an `<input />`. */\n TextInput: FunctionComponent<TextInputProps>\n /** Form field wrapping a `<textarea>`. */\n TextArea: FunctionComponent<TextAreaProps>\n /** HTML `<ul>` for an unordered list of items. */\n UnorderedList: FunctionComponent<UnorderedListProps>\n\n /** Label or legend caption for form controls, including the optional/required indicator. Defaults to the SDK's built-in caption UI when omitted. */\n FieldCaption?: FunctionComponent<FieldCaptionProps>\n /** Pagination controls for list views. Defaults to the SDK's built-in pagination UI when omitted. */\n PaginationControl?: FunctionComponent<PaginationControlProps>\n /** Loading indicator for payroll calculation. Defaults to the SDK's built-in loading state when omitted. */\n PayrollLoading?: FunctionComponent<PayrollLoadingProps>\n /** Inline PDF document renderer. Defaults to the SDK's built-in `<embed>`-based viewer when omitted; override to control how PDFs are rendered inline — especially useful if you have strict Content Security Policy directives. */\n DocumentEmbed?: FunctionComponent<DocumentEmbedProps>\n}\n\n/** @internal */\nexport const ComponentsContext = createContext<ComponentsContextType | null>(null)\n\n/** @internal */\nexport const useComponentContext = () => {\n const context = useContext(ComponentsContext)\n if (!context) {\n throw new Error('useComponentContext must be used within a ComponentsProvider')\n }\n return context\n}\n"],"names":["ComponentsContext","createContext","useComponentContext","context","useContext"],"mappings":";AA+LO,MAAMA,IAAoBC,EAA4C,IAAI,GAGpEC,IAAsB,MAAM;AACvC,QAAMC,IAAUC,EAAWJ,CAAiB;AAC5C,MAAI,CAACG;AACH,UAAM,IAAI,MAAM,8DAA8D;AAEhF,SAAOA;AACT;"}
|