@gusto/embedded-react-sdk 0.56.0 → 0.56.1
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 +16 -0
- package/dist/components/Payroll/OffCycle/OffCycleFlow.js.map +1 -1
- package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js +24 -18
- package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js.map +1 -1
- package/dist/components/Payroll/OffCycle/offCycleStateMachine.js +39 -21
- package/dist/components/Payroll/OffCycle/offCycleStateMachine.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js +85 -82
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js +52 -51
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js +12 -12
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +40 -40
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +26 -25
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +13 -16
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +0 -1
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeHelpers.js +138 -110
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeHelpers.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/usePayrollEditEmployeeForm.js +149 -146
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/usePayrollEditEmployeeForm.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js +4 -0
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollFlow.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/TransitionFlowContextual.js +22 -35
- package/dist/components/Payroll/PayrollFlow/TransitionFlowContextual.js.map +1 -1
- package/dist/components/Payroll/Transition/TransitionFlow.js +49 -36
- package/dist/components/Payroll/Transition/TransitionFlow.js.map +1 -1
- package/dist/components/Payroll/Transition/TransitionFlowComponents.js +24 -47
- package/dist/components/Payroll/Transition/TransitionFlowComponents.js.map +1 -1
- package/dist/components/Payroll/Transition/transitionStateMachine.js +35 -40
- package/dist/components/Payroll/Transition/transitionStateMachine.js.map +1 -1
- package/dist/components/Payroll/TransitionPayroll/TransitionPayroll.js +48 -0
- package/dist/components/Payroll/TransitionPayroll/TransitionPayroll.js.map +1 -0
- package/dist/components/Payroll/TransitionPayroll/TransitionPayrollComponents.js +35 -0
- package/dist/components/Payroll/TransitionPayroll/TransitionPayrollComponents.js.map +1 -0
- package/dist/components/Payroll/TransitionPayroll/transitionPayrollStateMachine.js +23 -0
- package/dist/components/Payroll/TransitionPayroll/transitionPayrollStateMachine.js.map +1 -0
- package/dist/components/Payroll/TransitionPayroll/useResolveTransitionPayroll.js +32 -0
- package/dist/components/Payroll/TransitionPayroll/useResolveTransitionPayroll.js.map +1 -0
- package/dist/components/Payroll/index.js +7 -5
- package/dist/components/Payroll/index.js.map +1 -1
- package/dist/i18n/I18n.js +9 -4
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollBlocker.json.js +10 -8
- package/dist/i18n/en/Payroll.PayrollBlocker.json.js.map +1 -1
- package/dist/i18n/es_US/Company.StateTaxes.json.js +1 -1
- package/dist/i18n/es_US/Contractor.ContractorList.json.js +14 -12
- package/dist/i18n/es_US/Contractor.ContractorList.json.js.map +1 -1
- package/dist/i18n/es_US/Contractor.Management.Compensation.json.js +4 -4
- package/dist/i18n/es_US/Contractor.Management.Profile.json.js +4 -4
- package/dist/i18n/es_US/Contractor.ManagementContractorList.json.js +40 -38
- package/dist/i18n/es_US/Contractor.ManagementContractorList.json.js.map +1 -1
- package/dist/i18n/es_US/Contractor.Payments.PaymentsList.json.js +18 -16
- package/dist/i18n/es_US/Contractor.Payments.PaymentsList.json.js.map +1 -1
- package/dist/i18n/es_US/Contractor.Profile.json.js +5 -5
- package/dist/i18n/es_US/Payroll.OffCycleCreation.json.js +11 -9
- package/dist/i18n/es_US/Payroll.OffCycleCreation.json.js.map +1 -1
- package/dist/i18n/es_US/Payroll.OffCyclePayPeriodDateForm.json.js +2 -2
- package/dist/i18n/es_US/Payroll.OffCycleTaxWithholding.json.js +6 -6
- package/dist/i18n/es_US/Payroll.PayrollConfiguration.json.js +15 -15
- package/dist/i18n/es_US/Payroll.PayrollEditEmployee.json.js +28 -26
- package/dist/i18n/es_US/Payroll.PayrollEditEmployee.json.js.map +1 -1
- package/dist/i18n/es_US/Payroll.PayrollOverview.json.js +40 -38
- package/dist/i18n/es_US/Payroll.PayrollOverview.json.js.map +1 -1
- package/dist/i18n/es_US/Payroll.PrintChecksBanner.json.js +14 -0
- package/dist/i18n/es_US/Payroll.PrintChecksBanner.json.js.map +1 -0
- package/dist/i18n/es_US/Payroll.PrintChecksFailure.json.js +12 -0
- package/dist/i18n/es_US/Payroll.PrintChecksFailure.json.js.map +1 -0
- package/dist/i18n/es_US/Payroll.PrintChecksForm.json.js +26 -0
- package/dist/i18n/es_US/Payroll.PrintChecksForm.json.js.map +1 -0
- package/dist/i18n/es_US/Payroll.PrintChecksSummary.json.js +14 -0
- package/dist/i18n/es_US/Payroll.PrintChecksSummary.json.js.map +1 -0
- package/dist/i18n/es_US/Payroll.UNSTABLE_PayrollEditEmployee.json.js +78 -0
- package/dist/i18n/es_US/Payroll.UNSTABLE_PayrollEditEmployee.json.js.map +1 -0
- package/dist/i18n/es_US/common.json.js +1 -1
- package/dist/package.json.js +1 -1
- package/dist/shared/constants.js +21 -20
- package/dist/shared/constants.js.map +1 -1
- package/dist/src/components/Payroll/OffCycle/OffCycleFlow.d.ts +2 -0
- package/dist/src/components/Payroll/OffCycle/OffCycleFlowComponents.d.ts +2 -0
- package/dist/src/components/Payroll/OffCycle/offCycleStateMachine.d.ts +1 -0
- package/dist/src/components/Payroll/OffCycleCreation/OffCycleCreation.d.ts +1 -0
- package/dist/src/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.d.ts +1 -1
- package/dist/src/components/Payroll/OffCycleCreation/OffCycleCreationTypes.d.ts +5 -0
- package/dist/src/components/Payroll/PayrollConfiguration/PayrollConfiguration.d.ts +1 -1
- package/dist/src/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeHelpers.d.ts +18 -0
- package/dist/src/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.d.ts +1 -1
- package/dist/src/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.d.ts +8 -0
- package/dist/src/components/Payroll/PayrollFlow/PayrollFlow.d.ts +1 -1
- package/dist/src/components/Payroll/PayrollFlow/TransitionFlowContextual.d.ts +6 -1
- package/dist/src/components/Payroll/Transition/TransitionFlow.d.ts +17 -15
- package/dist/src/components/Payroll/Transition/TransitionFlowComponents.d.ts +21 -12
- package/dist/src/components/Payroll/Transition/transitionStateMachine.d.ts +25 -4
- package/dist/src/components/Payroll/TransitionPayroll/TransitionPayroll.d.ts +55 -0
- package/dist/src/components/Payroll/TransitionPayroll/TransitionPayrollComponents.d.ts +24 -0
- package/dist/src/components/Payroll/TransitionPayroll/TransitionPayrollTypes.d.ts +23 -0
- package/dist/src/components/Payroll/TransitionPayroll/index.d.ts +2 -0
- package/dist/src/components/Payroll/TransitionPayroll/transitionPayrollStateMachine.d.ts +15 -0
- package/dist/src/components/Payroll/TransitionPayroll/useResolveTransitionPayroll.d.ts +28 -0
- package/dist/src/components/Payroll/index.d.ts +2 -0
- package/dist/src/i18n/types.d.ts +6 -0
- package/dist/src/shared/constants.d.ts +2 -0
- package/docs/guides/endpoint-inventory.json +14 -19
- package/package.json +4 -4
|
@@ -1,132 +1,132 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { useQueryClient as
|
|
3
|
-
import { useForm as
|
|
1
|
+
import { useState as O, useRef as De, useCallback as b, useEffect as Oe, useMemo as o } from "react";
|
|
2
|
+
import { useQueryClient as ke } from "@tanstack/react-query";
|
|
3
|
+
import { useForm as Ae, useWatch as Ce, useFieldArray as Fe } from "react-hook-form";
|
|
4
4
|
import { zodResolver as Me } from "@hookform/resolvers/zod";
|
|
5
5
|
import { useEmployeesGetSuspense as Te } from "@gusto/embedded-api/react-query/employeesGet";
|
|
6
6
|
import { useEmployeePaymentMethodsGetBankAccountsSuspense as Ue } from "@gusto/embedded-api/react-query/employeePaymentMethodsGetBankAccounts";
|
|
7
|
-
import { useEarningTypesListSuspense as
|
|
8
|
-
import { usePayrollsPrepareMutation as
|
|
7
|
+
import { useEarningTypesListSuspense as Ve } from "@gusto/embedded-api/react-query/earningTypesList";
|
|
8
|
+
import { usePayrollsPrepareMutation as Be } from "@gusto/embedded-api/react-query/payrollsPrepare";
|
|
9
9
|
import { usePaySchedulesGet as _e } from "@gusto/embedded-api/react-query/paySchedulesGet";
|
|
10
10
|
import { usePayrollsUpdateMutation as xe } from "@gusto/embedded-api/react-query/payrollsUpdate";
|
|
11
11
|
import { UnprocessableEntityError as Le } from "@gusto/embedded-api/models/errors/unprocessableentityerror";
|
|
12
|
-
import { createPayrollEditEmployeeSchema as je, reimbursementDraftSchema as Ne, PayrollEditEmployeeErrorCodes as
|
|
13
|
-
import { normalizeWorkweeks as Ye, collectOvertimeEarningNames as qe, hasExistingOvertimeHours as
|
|
14
|
-
import { createReimbursementDraftFields as
|
|
15
|
-
import { withOptions as
|
|
16
|
-
import { derivePayrollCategory as
|
|
17
|
-
import { PREPARE_QUERY_KEY as
|
|
18
|
-
import { isOvertimeEligibleFlsaStatus as
|
|
19
|
-
import { retryAsync as
|
|
20
|
-
import { useHookFormInternals as
|
|
21
|
-
import { createGetFormSubmissionValues as
|
|
22
|
-
import { composeErrorHandler as
|
|
23
|
-
import { useBaseSubmit as
|
|
24
|
-
import { SDKInternalError as
|
|
25
|
-
const
|
|
26
|
-
function
|
|
12
|
+
import { createPayrollEditEmployeeSchema as je, reimbursementDraftSchema as Ne, PayrollEditEmployeeErrorCodes as We, PAYMENT_METHOD_VALUES as He, PAYMENT_METHOD_OPTIONS as Qe } from "./payrollEditEmployeeSchema.js";
|
|
13
|
+
import { normalizeWorkweeks as Ye, collectOvertimeEarningNames as qe, hasExistingOvertimeHours as ze, hasBreakdownsMatchingWorkweeks as Ge, resolveEditableFixedCompensations as Ie, derivePayrollEditEmployeeDefaults as J, zeroFillClearedWorkweekCells as Je, buildPayrollUpdateEmployeeCompensation as Ke } from "./payrollEditEmployeeHelpers.js";
|
|
14
|
+
import { createReimbursementDraftFields as Xe, createPayrollEditEmployeeFields as Ze, computeTimeOffRemaining as $e } from "./fields.js";
|
|
15
|
+
import { withOptions as et } from "../../../../../partner-hook-utils/form/withOptions.js";
|
|
16
|
+
import { derivePayrollCategory as tt, isOffCyclePayroll as rt } from "../../../payrollTypes.js";
|
|
17
|
+
import { PREPARE_QUERY_KEY as ot } from "../../../PayrollConfiguration/usePayrollConfigurationData.js";
|
|
18
|
+
import { isOvertimeEligibleFlsaStatus as st } from "../../../helpers.js";
|
|
19
|
+
import { retryAsync as nt } from "../../../../../helpers/retryAsync.js";
|
|
20
|
+
import { useHookFormInternals as at } from "../../../../../partner-hook-utils/form/useHookFormInternals.js";
|
|
21
|
+
import { createGetFormSubmissionValues as it } from "../../../../../partner-hook-utils/form/getFormSubmissionValues.js";
|
|
22
|
+
import { composeErrorHandler as mt } from "../../../../../partner-hook-utils/composeErrorHandler.js";
|
|
23
|
+
import { useBaseSubmit as ut } from "../../../../Base/useBaseSubmit.js";
|
|
24
|
+
import { SDKInternalError as lt } from "../../../../../types/sdkError.js";
|
|
25
|
+
const ct = 4, dt = 1500, pt = (u) => u instanceof Le && u.errors.some((l) => l.category === "invalid_operation");
|
|
26
|
+
function jt({
|
|
27
27
|
employeeId: u,
|
|
28
28
|
companyId: l,
|
|
29
29
|
payrollId: h,
|
|
30
30
|
withReimbursements: K = !0,
|
|
31
|
-
validationMode:
|
|
32
|
-
shouldFocusError:
|
|
31
|
+
validationMode: X = "onSubmit",
|
|
32
|
+
shouldFocusError: Z = !0,
|
|
33
33
|
errorMessages: P
|
|
34
34
|
}) {
|
|
35
|
-
const { data:
|
|
35
|
+
const { data: $ } = Te({ employeeId: u }), { data: ee } = Ue({
|
|
36
36
|
employeeId: u
|
|
37
|
-
}), { data:
|
|
38
|
-
|
|
37
|
+
}), { data: U } = Ve({ companyId: l }), te = ke(), { mutateAsync: V } = Be(), { mutateAsync: re, isPending: oe } = xe(), [n, B] = O(), [se, _] = O(null), x = De(!1), k = b(async () => {
|
|
38
|
+
_(null);
|
|
39
39
|
try {
|
|
40
|
-
const e = await
|
|
41
|
-
() =>
|
|
40
|
+
const e = await nt(
|
|
41
|
+
() => V({
|
|
42
42
|
request: { companyId: l, payrollId: h, requestBody: { employeeUuids: [u] } }
|
|
43
43
|
}),
|
|
44
44
|
{
|
|
45
|
-
maxAttempts:
|
|
46
|
-
delayMs:
|
|
45
|
+
maxAttempts: ct,
|
|
46
|
+
delayMs: dt,
|
|
47
47
|
shouldRetry: pt
|
|
48
48
|
}
|
|
49
49
|
);
|
|
50
|
-
|
|
50
|
+
B(e.payrollPrepared);
|
|
51
51
|
} catch (e) {
|
|
52
|
-
|
|
52
|
+
_(e);
|
|
53
53
|
}
|
|
54
|
-
}, [l, h, u,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}, [
|
|
58
|
-
const
|
|
54
|
+
}, [l, h, u, V]);
|
|
55
|
+
Oe(() => {
|
|
56
|
+
x.current || (x.current = !0, k());
|
|
57
|
+
}, [k]);
|
|
58
|
+
const L = _e(
|
|
59
59
|
{ companyId: l, payScheduleId: n?.payPeriod?.payScheduleUuid ?? "" },
|
|
60
60
|
{ enabled: !!n?.payPeriod?.payScheduleUuid }
|
|
61
|
-
), a =
|
|
61
|
+
), a = $.employee, s = n?.employeeCompensations?.at(0), g = tt(n ?? {}), d = (ee.employeeBankAccounts?.length ?? 0) > 0, i = o(
|
|
62
62
|
() => n ? Ye(n.workweeks, n.payPeriod) : [],
|
|
63
63
|
[n]
|
|
64
64
|
), f = o(
|
|
65
|
-
() => qe(
|
|
66
|
-
[
|
|
67
|
-
),
|
|
65
|
+
() => qe(U.earningTypeList),
|
|
66
|
+
[U.earningTypeList]
|
|
67
|
+
), A = o(() => {
|
|
68
68
|
const e = s?.hourlyCompensations?.find(
|
|
69
69
|
(m) => m.flsaStatus
|
|
70
70
|
)?.flsaStatus;
|
|
71
71
|
return e || a?.jobs?.find((m) => m.primary)?.compensations?.[0]?.flsaStatus;
|
|
72
|
-
}, [s, a]), c =
|
|
73
|
-
() =>
|
|
72
|
+
}, [s, a]), c = st(A), [ne, ae] = O(!1), p = ne || ze(s?.hourlyCompensations) || Ge(s?.hourlyCompensations, i), j = o(() => a?.jobs?.find((e) => e.primary)?.uuid, [a]), y = o(
|
|
73
|
+
() => Ie(
|
|
74
74
|
s?.fixedCompensations,
|
|
75
75
|
n?.fixedCompensationTypes,
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
j,
|
|
77
|
+
A
|
|
78
78
|
),
|
|
79
|
-
[s, n?.fixedCompensationTypes,
|
|
80
|
-
),
|
|
79
|
+
[s, n?.fixedCompensationTypes, j, A]
|
|
80
|
+
), N = o(() => {
|
|
81
81
|
const e = /* @__PURE__ */ new Map();
|
|
82
82
|
for (const t of a?.jobs ?? [])
|
|
83
83
|
t.uuid && t.title && e.set(t.uuid, t.title);
|
|
84
84
|
return e;
|
|
85
|
-
}, [a]),
|
|
85
|
+
}, [a]), S = o(() => {
|
|
86
86
|
const e = /* @__PURE__ */ new Map();
|
|
87
87
|
for (const t of a?.eligiblePaidTimeOff ?? [])
|
|
88
88
|
t.name && t.accrualBalance != null && e.set(t.name, t.accrualBalance);
|
|
89
89
|
return e;
|
|
90
|
-
}, [a]),
|
|
90
|
+
}, [a]), W = o(() => je(), []), C = o(
|
|
91
91
|
() => J(
|
|
92
92
|
s,
|
|
93
93
|
i,
|
|
94
|
-
|
|
94
|
+
d,
|
|
95
95
|
f,
|
|
96
96
|
c,
|
|
97
|
-
|
|
97
|
+
p,
|
|
98
98
|
y
|
|
99
99
|
),
|
|
100
100
|
[
|
|
101
101
|
s,
|
|
102
102
|
i,
|
|
103
|
-
|
|
103
|
+
d,
|
|
104
104
|
f,
|
|
105
105
|
c,
|
|
106
|
-
|
|
106
|
+
p,
|
|
107
107
|
y
|
|
108
108
|
]
|
|
109
|
-
), r =
|
|
109
|
+
), r = Ae(
|
|
110
110
|
{
|
|
111
|
-
resolver: Me(
|
|
112
|
-
mode:
|
|
113
|
-
shouldFocusError:
|
|
114
|
-
defaultValues:
|
|
115
|
-
values:
|
|
111
|
+
resolver: Me(W),
|
|
112
|
+
mode: X,
|
|
113
|
+
shouldFocusError: Z,
|
|
114
|
+
defaultValues: C,
|
|
115
|
+
values: C,
|
|
116
116
|
resetOptions: { keepDirtyValues: !0 }
|
|
117
117
|
}
|
|
118
|
-
), H =
|
|
118
|
+
), H = Ce({ control: r.control, name: "timeOff" }), ie = !rt(g), v = K && ie, {
|
|
119
119
|
fields: R,
|
|
120
|
-
append:
|
|
121
|
-
remove:
|
|
122
|
-
update:
|
|
123
|
-
} =
|
|
120
|
+
append: Q,
|
|
121
|
+
remove: Y,
|
|
122
|
+
update: q
|
|
123
|
+
} = Fe({
|
|
124
124
|
control: r.control,
|
|
125
125
|
name: "reimbursements"
|
|
126
|
-
}), [
|
|
127
|
-
() =>
|
|
126
|
+
}), [me, F] = O(!1), ue = o(
|
|
127
|
+
() => Xe(P),
|
|
128
128
|
[P]
|
|
129
|
-
),
|
|
129
|
+
), le = o(
|
|
130
130
|
() => R.map((e, t) => ({
|
|
131
131
|
key: e.id,
|
|
132
132
|
index: t,
|
|
@@ -136,83 +136,83 @@ function Lt({
|
|
|
136
136
|
recurring: e.recurring ?? !1
|
|
137
137
|
})).filter((e) => parseFloat(e.amount || "0") !== 0),
|
|
138
138
|
[R]
|
|
139
|
-
),
|
|
139
|
+
), ce = b(() => {
|
|
140
140
|
F(!0);
|
|
141
|
-
}, []),
|
|
141
|
+
}, []), de = b(() => {
|
|
142
142
|
r.setValue("reimbursementDraft", { description: "", amount: "" }), r.clearErrors("reimbursementDraft"), F(!1);
|
|
143
|
-
}, [r]), pe =
|
|
143
|
+
}, [r]), pe = b(() => {
|
|
144
144
|
const e = r.getValues("reimbursementDraft"), t = Ne.safeParse(e);
|
|
145
145
|
if (!t.success) {
|
|
146
146
|
r.setError("reimbursementDraft.amount", {
|
|
147
|
-
message:
|
|
147
|
+
message: We.REIMBURSEMENT_AMOUNT
|
|
148
148
|
});
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
|
-
|
|
151
|
+
Q({
|
|
152
152
|
uuid: null,
|
|
153
153
|
description: t.data.description.trim(),
|
|
154
154
|
amount: parseFloat(t.data.amount).toFixed(2),
|
|
155
155
|
recurring: !1
|
|
156
156
|
}), r.setValue("reimbursementDraft", { description: "", amount: "" }), r.clearErrors("reimbursementDraft"), F(!1);
|
|
157
|
-
}, [
|
|
157
|
+
}, [Q, r]), fe = b(
|
|
158
158
|
(e) => {
|
|
159
159
|
const t = R[e];
|
|
160
|
-
t && (t.uuid ?
|
|
160
|
+
t && (t.uuid ? q(e, { ...t, amount: "0" }) : Y(e));
|
|
161
161
|
},
|
|
162
|
-
[R,
|
|
163
|
-
),
|
|
164
|
-
() =>
|
|
162
|
+
[R, Y, q]
|
|
163
|
+
), M = o(
|
|
164
|
+
() => Ze({
|
|
165
165
|
employeeCompensation: s,
|
|
166
166
|
fixedCompensations: y,
|
|
167
167
|
workweeks: i,
|
|
168
|
-
payrollCategory:
|
|
169
|
-
hasDirectDepositSetup:
|
|
168
|
+
payrollCategory: g,
|
|
169
|
+
hasDirectDepositSetup: d,
|
|
170
170
|
overtimeEarningNames: f,
|
|
171
171
|
isOvertimeEligible: c,
|
|
172
|
-
withOvertime:
|
|
173
|
-
jobTitlesByUuid:
|
|
174
|
-
timeOffAccrualByName:
|
|
172
|
+
withOvertime: p,
|
|
173
|
+
jobTitlesByUuid: N,
|
|
174
|
+
timeOffAccrualByName: S,
|
|
175
175
|
errorMessages: P
|
|
176
176
|
}),
|
|
177
177
|
[
|
|
178
178
|
s,
|
|
179
179
|
y,
|
|
180
180
|
i,
|
|
181
|
-
|
|
182
|
-
|
|
181
|
+
g,
|
|
182
|
+
d,
|
|
183
183
|
f,
|
|
184
184
|
c,
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
185
|
+
p,
|
|
186
|
+
N,
|
|
187
|
+
S,
|
|
188
188
|
P
|
|
189
189
|
]
|
|
190
|
-
),
|
|
191
|
-
() =>
|
|
190
|
+
), ye = o(
|
|
191
|
+
() => M.timeOff.map((e) => ({
|
|
192
192
|
...e,
|
|
193
|
-
remaining:
|
|
194
|
-
|
|
193
|
+
remaining: $e(
|
|
194
|
+
S.get(e.name),
|
|
195
195
|
H[e.name]
|
|
196
196
|
)
|
|
197
197
|
})),
|
|
198
|
-
[
|
|
199
|
-
),
|
|
200
|
-
|
|
198
|
+
[M.timeOff, S, H]
|
|
199
|
+
), Ee = () => {
|
|
200
|
+
ae(!0);
|
|
201
201
|
const e = J(
|
|
202
202
|
s,
|
|
203
203
|
i,
|
|
204
|
-
|
|
204
|
+
d,
|
|
205
205
|
f,
|
|
206
206
|
c,
|
|
207
207
|
!0,
|
|
208
208
|
y
|
|
209
|
-
), t = i[0]?.startDate ?? "", m = r.getValues(), w = (
|
|
210
|
-
for (const [
|
|
211
|
-
for (const [Re, we] of Object.entries(
|
|
212
|
-
const
|
|
213
|
-
|
|
209
|
+
), t = i[0]?.startDate ?? "", m = r.getValues(), w = (D, T) => {
|
|
210
|
+
for (const [G, E] of Object.entries(D))
|
|
211
|
+
for (const [Re, we] of Object.entries(E)) {
|
|
212
|
+
const I = T?.[G]?.[Re]?.[t];
|
|
213
|
+
I !== void 0 && (we[t] = I);
|
|
214
214
|
}
|
|
215
|
-
return
|
|
215
|
+
return D;
|
|
216
216
|
};
|
|
217
217
|
r.setValue(
|
|
218
218
|
"hours",
|
|
@@ -228,96 +228,99 @@ function Lt({
|
|
|
228
228
|
);
|
|
229
229
|
}, be = o(
|
|
230
230
|
() => ({
|
|
231
|
-
paymentMethod:
|
|
231
|
+
paymentMethod: et(
|
|
232
232
|
{ name: "paymentMethod" },
|
|
233
233
|
Qe,
|
|
234
|
-
|
|
234
|
+
He
|
|
235
235
|
)
|
|
236
236
|
}),
|
|
237
237
|
[]
|
|
238
238
|
), {
|
|
239
|
-
baseSubmitHandler:
|
|
240
|
-
error:
|
|
241
|
-
setError:
|
|
242
|
-
} =
|
|
243
|
-
error:
|
|
244
|
-
refetch: (() =>
|
|
245
|
-
},
|
|
246
|
-
submitError:
|
|
247
|
-
setSubmitError:
|
|
248
|
-
}), Se =
|
|
239
|
+
baseSubmitHandler: he,
|
|
240
|
+
error: Pe,
|
|
241
|
+
setError: ge
|
|
242
|
+
} = ut("PayrollEditEmployeeForm"), z = mt([{
|
|
243
|
+
error: se,
|
|
244
|
+
refetch: (() => k())
|
|
245
|
+
}, L], {
|
|
246
|
+
submitError: Pe,
|
|
247
|
+
setSubmitError: ge
|
|
248
|
+
}), Se = at(r), ve = async () => {
|
|
249
249
|
let e;
|
|
250
|
-
|
|
250
|
+
const t = Je(r.getValues(), C);
|
|
251
|
+
return t.hours && r.setValue("hours", t.hours, { shouldDirty: !0 }), t.overtimeIncludedEarnings && r.setValue("overtimeIncludedEarnings", t.overtimeIncludedEarnings, {
|
|
252
|
+
shouldDirty: !0
|
|
253
|
+
}), await new Promise((m) => {
|
|
251
254
|
r.handleSubmit(
|
|
252
|
-
async (
|
|
253
|
-
await
|
|
254
|
-
const
|
|
255
|
-
|
|
255
|
+
async (w) => {
|
|
256
|
+
await he(w, async (D) => {
|
|
257
|
+
const T = Ke(
|
|
258
|
+
D,
|
|
256
259
|
s,
|
|
257
260
|
i,
|
|
258
|
-
|
|
261
|
+
g,
|
|
259
262
|
c,
|
|
260
|
-
|
|
261
|
-
),
|
|
263
|
+
p
|
|
264
|
+
), E = (await re({
|
|
262
265
|
request: {
|
|
263
266
|
companyId: l,
|
|
264
267
|
payrollId: h,
|
|
265
|
-
payrollUpdate: { employeeCompensations: [
|
|
268
|
+
payrollUpdate: { employeeCompensations: [T] }
|
|
266
269
|
}
|
|
267
270
|
})).payrollPrepared;
|
|
268
|
-
if (!
|
|
269
|
-
throw new
|
|
270
|
-
|
|
271
|
-
queryKey: [
|
|
272
|
-
}), e = { mode: "update", data:
|
|
273
|
-
}),
|
|
271
|
+
if (!E)
|
|
272
|
+
throw new lt("Payroll update did not return a prepared payroll");
|
|
273
|
+
B(E), await te.invalidateQueries({
|
|
274
|
+
queryKey: [ot, h]
|
|
275
|
+
}), e = { mode: "update", data: E };
|
|
276
|
+
}), m();
|
|
274
277
|
},
|
|
275
278
|
() => {
|
|
276
|
-
|
|
279
|
+
m();
|
|
277
280
|
}
|
|
278
281
|
)();
|
|
279
282
|
}), e;
|
|
280
283
|
};
|
|
281
|
-
return !n || !a ? { isLoading: !0, errorHandling:
|
|
284
|
+
return !n || !a ? { isLoading: !0, errorHandling: z } : {
|
|
282
285
|
isLoading: !1,
|
|
283
286
|
data: {
|
|
284
287
|
employee: a,
|
|
285
288
|
employeeCompensation: s,
|
|
286
289
|
preparedPayroll: n,
|
|
287
|
-
paySchedule:
|
|
290
|
+
paySchedule: L.data?.payScheduleShow,
|
|
288
291
|
isMultipleWorkweeks: i.length > 1,
|
|
289
292
|
workweeks: i,
|
|
290
293
|
isOvertimeEligible: c,
|
|
291
|
-
withOvertime:
|
|
292
|
-
hasDirectDepositSetup:
|
|
293
|
-
...v ? { reimbursements:
|
|
294
|
+
withOvertime: p,
|
|
295
|
+
hasDirectDepositSetup: d,
|
|
296
|
+
...v ? { reimbursements: le } : {}
|
|
294
297
|
},
|
|
295
|
-
status: { isPending:
|
|
298
|
+
status: { isPending: oe, mode: "update" },
|
|
296
299
|
actions: {
|
|
297
|
-
onSubmit:
|
|
298
|
-
addOvertime:
|
|
300
|
+
onSubmit: ve,
|
|
301
|
+
addOvertime: Ee,
|
|
299
302
|
...v ? {
|
|
300
|
-
beginAddReimbursement:
|
|
303
|
+
beginAddReimbursement: ce,
|
|
301
304
|
saveReimbursement: pe,
|
|
302
|
-
cancelReimbursement:
|
|
303
|
-
removeReimbursement:
|
|
305
|
+
cancelReimbursement: de,
|
|
306
|
+
removeReimbursement: fe
|
|
304
307
|
} : {}
|
|
305
308
|
},
|
|
306
|
-
errorHandling:
|
|
309
|
+
errorHandling: z,
|
|
307
310
|
form: {
|
|
308
311
|
Fields: {
|
|
309
|
-
...
|
|
310
|
-
timeOff:
|
|
311
|
-
reimbursementDraft: v ?
|
|
312
|
+
...M,
|
|
313
|
+
timeOff: ye,
|
|
314
|
+
reimbursementDraft: v ? ue : void 0
|
|
312
315
|
},
|
|
313
316
|
fieldsMetadata: be,
|
|
314
317
|
hookFormInternals: Se,
|
|
315
|
-
getFormSubmissionValues:
|
|
316
|
-
...v ? { reimbursementDraft: { isAdding:
|
|
318
|
+
getFormSubmissionValues: it(r, W),
|
|
319
|
+
...v ? { reimbursementDraft: { isAdding: me } } : {}
|
|
317
320
|
}
|
|
318
321
|
};
|
|
319
322
|
}
|
|
320
323
|
export {
|
|
321
|
-
|
|
324
|
+
jt as usePayrollEditEmployeeForm
|
|
322
325
|
};
|
|
323
326
|
//# sourceMappingURL=usePayrollEditEmployeeForm.js.map
|