@gusto/embedded-react-sdk 0.44.0 → 0.44.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 +8 -0
- package/dist/components/Base/useBaseSubmit.js +6 -6
- package/dist/components/Base/useBaseSubmit.js.map +1 -1
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +1 -1
- package/dist/components/Company/AssignSignatory/TitleSelect.js +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +9 -9
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +7 -7
- package/dist/components/Company/FederalTaxes/Actions.js +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +1 -1
- package/dist/components/Company/Industry/Actions.js +1 -1
- package/dist/components/Company/Industry/Context.js +1 -1
- package/dist/components/Company/Industry/Edit.js +1 -1
- package/dist/components/Company/Locations/LocationForm/Actions.js +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +1 -1
- package/dist/components/Company/Locations/LocationsList/Actions.js +1 -1
- package/dist/components/Company/Locations/LocationsList/List.js +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +1 -1
- package/dist/components/Company/PaySchedule/PaySchedule.d.ts +2 -2
- package/dist/components/Company/PaySchedule/PaySchedule.js +6 -6
- package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
- package/dist/components/Company/PaySchedule/PayScheduleList.js +8 -8
- package/dist/components/Company/PaySchedule/PayScheduleList.js.map +1 -1
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.d.ts +3 -3
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.js +12 -12
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +1 -1
- package/dist/components/Contractor/Address/Address.js +16 -16
- package/dist/components/Contractor/Address/Address.js.map +1 -1
- package/dist/components/Contractor/Address/Form.js +4 -4
- package/dist/components/Contractor/Address/useAddress.js +1 -1
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +8 -8
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js +5 -5
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js.map +1 -1
- package/dist/components/Contractor/Profile/useContractorProfile.js +1 -1
- package/dist/components/Contractor/Submit/Submit.js +22 -20
- package/dist/components/Contractor/Submit/Submit.js.map +1 -1
- package/dist/components/Employee/Dashboard/hooks/useEmployeeCompensation.d.ts +1 -1
- package/dist/components/Employee/Dashboard/hooks/useEmployeeCompensation.js +6 -6
- package/dist/components/Employee/Dashboard/hooks/useEmployeeCompensation.js.map +1 -1
- package/dist/components/Employee/Dashboard/hooks/useEmployeeForms.js +3 -3
- package/dist/components/Employee/Dashboard/hooks/useEmployeeForms.js.map +1 -1
- package/dist/components/Employee/Deductions/Deductions.js +7 -7
- package/dist/components/Employee/Deductions/Deductions.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +24 -24
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +13 -9
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js +2 -2
- package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.d.ts +1 -2
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +17 -17
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +30 -30
- package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +8 -8
- package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentSigner.js +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentSigner.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js +12 -12
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.js +1 -1
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.js +5 -5
- package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +7 -7
- package/dist/components/Employee/FederalTaxes/management/FederalTaxes.js +1 -1
- package/dist/components/Employee/FederalTaxes/onboarding/FederalTaxes.js +1 -1
- package/dist/components/Employee/PaymentMethod/Actions.js +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountsList.js +1 -1
- package/dist/components/Employee/PaymentMethod/PaymentMethod.js +14 -14
- package/dist/components/Employee/PaymentMethod/PaymentMethod.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +1 -1
- package/dist/components/Employee/PaymentMethod/Split.js +1 -1
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +1 -1
- package/dist/components/Employee/Profile/management/Profile.js +1 -1
- package/dist/components/Employee/Profile/onboarding/AdminProfile.js +1 -1
- package/dist/components/Employee/Profile/onboarding/EmployeeProfile.js +1 -1
- package/dist/components/Employee/StateTaxes/management/StateTaxes.js +1 -1
- package/dist/components/Employee/StateTaxes/onboarding/StateTaxes.js +1 -1
- package/dist/components/Employee/Taxes/Actions.js +1 -1
- package/dist/components/Employee/Taxes/FederalForm.js +1 -1
- package/dist/components/Employee/Taxes/useTaxes.js +1 -1
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.js +11 -11
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummary.js +3 -3
- package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummary.js.map +1 -1
- package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js +40 -45
- package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js.map +1 -1
- package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js +1 -1
- package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +17 -17
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js.map +1 -1
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.js +7 -7
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.js.map +1 -1
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +1 -1
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js +1 -1
- package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js +1 -1
- package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js +1 -1
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +10 -10
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/payrollHelpers.d.ts +2 -2
- package/dist/components/Payroll/PayrollBlocker/payrollHelpers.js +21 -25
- package/dist/components/Payroll/PayrollBlocker/payrollHelpers.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.d.ts +2 -2
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +1 -1
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +4 -4
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.d.ts +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollList.js +4 -4
- package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.d.ts +2 -2
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js +5 -5
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js.map +1 -1
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js +1 -1
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js.map +1 -1
- package/dist/components/Payroll/TransitionCreation/TransitionCreation.js +7 -7
- package/dist/components/Payroll/TransitionCreation/TransitionCreation.js.map +1 -1
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.js +9 -9
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.js.map +1 -1
- package/dist/components/Payroll/helpers.d.ts +1 -1
- package/dist/components/Payroll/helpers.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.d.ts +2 -2
- package/dist/components/Payroll/usePreparedPayrollData.js +10 -10
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetailPresentation.js +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.js +41 -41
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.js.map +1 -1
- package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.js +1 -1
- package/dist/components/TimeOff/shared/PolicyDetailLayout/PolicyDetailLayout.js +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +1 -1
- package/dist/partner-hook-utils/form/fields/CheckboxHookField.js +1 -1
- package/dist/partner-hook-utils/form/fields/NumberInputHookField.js +1 -1
- package/dist/partner-hook-utils/form/fields/RadioGroupHookField.js +1 -1
- package/dist/partner-hook-utils/form/fields/SelectHookField.js +1 -1
- package/dist/partner-hook-utils/form/fields/SwitchHookField.js +1 -1
- package/dist/partner-hook-utils/form/fields/TextInputHookField.js +1 -1
- package/package.json +6 -6
|
@@ -3,9 +3,9 @@ import { useRef as $, useCallback as u, useMemo as y, useState as T } from "reac
|
|
|
3
3
|
import { useTimeOffPoliciesAddEmployeesMutation as J } from "@gusto/embedded-api/react-query/timeOffPoliciesAddEmployees";
|
|
4
4
|
import { useTimeOffPoliciesRemoveEmployeesMutation as X } from "@gusto/embedded-api/react-query/timeOffPoliciesRemoveEmployees";
|
|
5
5
|
import { useTimeOffPoliciesGetSuspense as Z } from "@gusto/embedded-api/react-query/timeOffPoliciesGet";
|
|
6
|
-
import {
|
|
7
|
-
import { useQueryClient as
|
|
8
|
-
import { useTranslation as
|
|
6
|
+
import { UnprocessableEntityError as ee } from "@gusto/embedded-api/models/errors/unprocessableentityerror";
|
|
7
|
+
import { useQueryClient as ne } from "@tanstack/react-query";
|
|
8
|
+
import { useTranslation as te } from "react-i18next";
|
|
9
9
|
import { SelectEmployeesPresentation as oe } from "./SelectEmployeesPresentation.js";
|
|
10
10
|
import { useSelectEmployeesData as re } from "./useSelectEmployeesData.js";
|
|
11
11
|
import { useBase as se } from "../../../Base/useBase.js";
|
|
@@ -18,14 +18,14 @@ const ce = {
|
|
|
18
18
|
};
|
|
19
19
|
function R(a, l) {
|
|
20
20
|
if (!a) return;
|
|
21
|
-
const r = ce[l],
|
|
22
|
-
return
|
|
21
|
+
const r = ce[l], t = a.eligiblePaidTimeOff?.find((f) => f.name === r)?.accrualBalance;
|
|
22
|
+
return t && t.length > 0 ? t : void 0;
|
|
23
23
|
}
|
|
24
24
|
function le(a, l) {
|
|
25
25
|
const r = {};
|
|
26
26
|
for (const m of a) {
|
|
27
|
-
const
|
|
28
|
-
|
|
27
|
+
const t = R(m, l);
|
|
28
|
+
t && (r[m.uuid] = t);
|
|
29
29
|
}
|
|
30
30
|
return r;
|
|
31
31
|
}
|
|
@@ -42,7 +42,7 @@ function me(a) {
|
|
|
42
42
|
for (const i of r.employees)
|
|
43
43
|
i.uuid && f.add(i.uuid);
|
|
44
44
|
return f;
|
|
45
|
-
}, [r.employees]),
|
|
45
|
+
}, [r.employees]), t = y(() => {
|
|
46
46
|
const f = {};
|
|
47
47
|
for (const i of r.employees)
|
|
48
48
|
i.uuid && (f[i.uuid] = i.balance ?? "0");
|
|
@@ -54,7 +54,7 @@ function me(a) {
|
|
|
54
54
|
...a,
|
|
55
55
|
mode: "standalone",
|
|
56
56
|
originalUuids: m,
|
|
57
|
-
originalBalances:
|
|
57
|
+
originalBalances: t
|
|
58
58
|
}
|
|
59
59
|
);
|
|
60
60
|
}
|
|
@@ -63,11 +63,11 @@ function F({
|
|
|
63
63
|
policyId: l,
|
|
64
64
|
policyType: r,
|
|
65
65
|
mode: m = "standalone",
|
|
66
|
-
originalUuids:
|
|
66
|
+
originalUuids: t,
|
|
67
67
|
originalBalances: f
|
|
68
68
|
}) {
|
|
69
69
|
ie("Company.TimeOff.SelectEmployees");
|
|
70
|
-
const { t: i } =
|
|
70
|
+
const { t: i } = te("Company.TimeOff.SelectEmployees"), { onEvent: d, baseSubmitHandler: P } = se(), _ = ne(), {
|
|
71
71
|
filteredEmployees: C,
|
|
72
72
|
selectedUuids: c,
|
|
73
73
|
searchValue: L,
|
|
@@ -77,16 +77,16 @@ function F({
|
|
|
77
77
|
handleSelectAll: b,
|
|
78
78
|
handleSearchChange: N,
|
|
79
79
|
handleSearchClear: Y
|
|
80
|
-
} = re(a,
|
|
81
|
-
(e,
|
|
82
|
-
|
|
80
|
+
} = re(a, t), p = $(/* @__PURE__ */ new Map()), x = u(
|
|
81
|
+
(e, n) => {
|
|
82
|
+
n ? p.current.set(e.uuid, e) : p.current.delete(e.uuid), w(e, n);
|
|
83
83
|
},
|
|
84
84
|
[w]
|
|
85
85
|
), k = u(
|
|
86
|
-
(e,
|
|
87
|
-
for (const o of
|
|
86
|
+
(e, n) => {
|
|
87
|
+
for (const o of n)
|
|
88
88
|
e ? p.current.set(o.uuid, o) : p.current.delete(o.uuid);
|
|
89
|
-
b(e,
|
|
89
|
+
b(e, n);
|
|
90
90
|
},
|
|
91
91
|
[b]
|
|
92
92
|
), B = y(
|
|
@@ -95,26 +95,26 @@ function F({
|
|
|
95
95
|
), [h, z] = T({}), H = y(
|
|
96
96
|
() => ({ ...B, ...h }),
|
|
97
97
|
[B, h]
|
|
98
|
-
), { mutateAsync: A } = J(), { mutateAsync: D, isPending: V } = X(), [W, v] = T(!1),
|
|
99
|
-
z((o) => ({ ...o, [e]:
|
|
98
|
+
), { mutateAsync: A } = J(), { mutateAsync: D, isPending: V } = X(), [W, v] = T(!1), K = u((e, n) => {
|
|
99
|
+
z((o) => ({ ...o, [e]: n }));
|
|
100
100
|
}, []), M = u(
|
|
101
|
-
(e) => e.map((
|
|
102
|
-
const o = h[
|
|
103
|
-
p.current.get(
|
|
101
|
+
(e) => e.map((n) => {
|
|
102
|
+
const o = h[n], s = R(
|
|
103
|
+
p.current.get(n),
|
|
104
104
|
r
|
|
105
105
|
), O = o && o.length > 0 ? o : s;
|
|
106
|
-
return O ? { uuid:
|
|
106
|
+
return O ? { uuid: n, balance: O } : { uuid: n };
|
|
107
107
|
}),
|
|
108
108
|
[h, r]
|
|
109
109
|
), E = u(
|
|
110
|
-
async (e,
|
|
110
|
+
async (e, n) => {
|
|
111
111
|
await P({}, async () => {
|
|
112
|
-
if (
|
|
112
|
+
if (n.length > 0)
|
|
113
113
|
try {
|
|
114
114
|
await D({
|
|
115
115
|
request: {
|
|
116
116
|
timeOffPolicyUuid: l,
|
|
117
|
-
requestBody: { employees:
|
|
117
|
+
requestBody: { employees: n.map((s) => ({ uuid: s })) }
|
|
118
118
|
}
|
|
119
119
|
});
|
|
120
120
|
} catch (s) {
|
|
@@ -148,15 +148,15 @@ function F({
|
|
|
148
148
|
d,
|
|
149
149
|
i
|
|
150
150
|
]
|
|
151
|
-
),
|
|
151
|
+
), Q = u(async () => {
|
|
152
152
|
if (m === "wizard") {
|
|
153
153
|
d(S.TIME_OFF_ADD_EMPLOYEES_DONE, {
|
|
154
154
|
employeeUuids: [...c]
|
|
155
155
|
});
|
|
156
156
|
return;
|
|
157
157
|
}
|
|
158
|
-
const e =
|
|
159
|
-
if (
|
|
158
|
+
const e = t ?? /* @__PURE__ */ new Set(), n = [...c].filter((s) => !e.has(s)), o = [...e].filter((s) => !c.has(s));
|
|
159
|
+
if (n.length === 0 && o.length === 0) {
|
|
160
160
|
d(S.TIME_OFF_ADD_EMPLOYEES_DONE);
|
|
161
161
|
return;
|
|
162
162
|
}
|
|
@@ -164,16 +164,16 @@ function F({
|
|
|
164
164
|
v(!0);
|
|
165
165
|
return;
|
|
166
166
|
}
|
|
167
|
-
await E(
|
|
168
|
-
}, [m,
|
|
169
|
-
const e =
|
|
170
|
-
v(!1), await E(
|
|
171
|
-
}, [
|
|
172
|
-
if (!
|
|
167
|
+
await E(n, o);
|
|
168
|
+
}, [m, t, c, d, E]), j = u(async () => {
|
|
169
|
+
const e = t ?? /* @__PURE__ */ new Set(), n = [...c].filter((s) => !e.has(s)), o = [...e].filter((s) => !c.has(s));
|
|
170
|
+
v(!1), await E(n, o);
|
|
171
|
+
}, [t, c, E]), G = y(() => {
|
|
172
|
+
if (!t) return 0;
|
|
173
173
|
let e = 0;
|
|
174
|
-
for (const
|
|
174
|
+
for (const n of t) c.has(n) || (e += 1);
|
|
175
175
|
return e;
|
|
176
|
-
}, [
|
|
176
|
+
}, [t, c]), U = u(() => {
|
|
177
177
|
d(S.CANCEL);
|
|
178
178
|
}, [d]);
|
|
179
179
|
return /* @__PURE__ */ g(
|
|
@@ -187,20 +187,20 @@ function F({
|
|
|
187
187
|
onSearchChange: N,
|
|
188
188
|
onSearchClear: Y,
|
|
189
189
|
onBack: U,
|
|
190
|
-
onContinue:
|
|
190
|
+
onContinue: Q,
|
|
191
191
|
showReassignmentWarning: !0,
|
|
192
192
|
policyTypeLabel: i(`policyTypeLabel_${r}`),
|
|
193
193
|
balances: H,
|
|
194
|
-
onBalanceChange:
|
|
194
|
+
onBalanceChange: K,
|
|
195
195
|
pagination: I,
|
|
196
196
|
isFetching: q,
|
|
197
|
-
originallyOnPolicyUuids:
|
|
197
|
+
originallyOnPolicyUuids: t,
|
|
198
198
|
originalBalances: f,
|
|
199
199
|
removeConfirmDialog: m === "standalone" ? {
|
|
200
200
|
isOpen: W,
|
|
201
201
|
count: G,
|
|
202
202
|
onConfirm: () => {
|
|
203
|
-
|
|
203
|
+
j();
|
|
204
204
|
},
|
|
205
205
|
onClose: () => {
|
|
206
206
|
v(!1);
|
package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectEmployeesTimeOff.js","sources":["../../../../../src/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.tsx"],"sourcesContent":["import { useCallback, useMemo, useRef, useState } from 'react'\nimport { useTimeOffPoliciesAddEmployeesMutation } from '@gusto/embedded-api/react-query/timeOffPoliciesAddEmployees'\nimport { useTimeOffPoliciesRemoveEmployeesMutation } from '@gusto/embedded-api/react-query/timeOffPoliciesRemoveEmployees'\nimport { useTimeOffPoliciesGetSuspense } from '@gusto/embedded-api/react-query/timeOffPoliciesGet'\nimport { UnprocessableEntityErrorObject } from '@gusto/embedded-api/models/errors/unprocessableentityerrorobject'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { useTranslation } from 'react-i18next'\nimport type { CreatableTimeOffPolicyType } from '../../TimeOffFlow/timeOffPolicyTypes'\nimport { SelectEmployeesPresentation } from './SelectEmployeesPresentation'\nimport { useSelectEmployeesData } from './useSelectEmployeesData'\nimport type { EmployeeItem } from './SelectEmployeesPresentationTypes'\nimport { useBase } from '@/components/Base/useBase'\nimport { SDKInternalError } from '@/types/sdkError'\nimport { componentEvents } from '@/shared/constants'\nimport { useI18n } from '@/i18n'\n\ninterface SelectEmployeesTimeOffProps {\n companyId: string\n policyId: string\n policyType: CreatableTimeOffPolicyType\n mode?: 'standalone' | 'wizard'\n}\n\nconst PAID_TIME_OFF_NAME_BY_POLICY_TYPE: Record<CreatableTimeOffPolicyType, string> = {\n vacation: 'Vacation Hours',\n sick: 'Sick Hours',\n}\n\nfunction extractCarryOverBalance(\n employee: EmployeeItem | undefined,\n policyType: CreatableTimeOffPolicyType,\n): string | undefined {\n if (!employee) return undefined\n const targetName = PAID_TIME_OFF_NAME_BY_POLICY_TYPE[policyType]\n const matching = employee.eligiblePaidTimeOff?.find(pto => pto.name === targetName)\n const balance = matching?.accrualBalance\n return balance && balance.length > 0 ? balance : undefined\n}\n\nfunction deriveCarryOverBalances(\n employees: EmployeeItem[],\n policyType: CreatableTimeOffPolicyType,\n): Record<string, string> {\n const map: Record<string, string> = {}\n for (const employee of employees) {\n const balance = extractCarryOverBalance(employee, policyType)\n if (balance) {\n map[employee.uuid] = balance\n }\n }\n return map\n}\n\nexport function SelectEmployeesTimeOff(props: SelectEmployeesTimeOffProps) {\n if (props.mode === 'wizard') {\n return <SelectEmployeesTimeOffInner {...props} mode=\"wizard\" />\n }\n return <StandaloneLoader {...props} />\n}\n\nfunction StandaloneLoader(props: SelectEmployeesTimeOffProps) {\n const { data: policyResponse } = useTimeOffPoliciesGetSuspense({\n timeOffPolicyUuid: props.policyId,\n })\n const policy = policyResponse.timeOffPolicy\n if (!policy) throw new Error('Unexpected response: missing timeOffPolicy')\n\n const originalUuids = useMemo(() => {\n const set = new Set<string>()\n for (const e of policy.employees) {\n if (e.uuid) set.add(e.uuid)\n }\n return set\n }, [policy.employees])\n\n const originalBalances = useMemo(() => {\n const map: Record<string, string> = {}\n for (const e of policy.employees) {\n if (e.uuid) map[e.uuid] = e.balance ?? '0'\n }\n return map\n }, [policy.employees])\n\n return (\n <SelectEmployeesTimeOffInner\n {...props}\n mode=\"standalone\"\n originalUuids={originalUuids}\n originalBalances={originalBalances}\n />\n )\n}\n\ninterface InnerProps extends SelectEmployeesTimeOffProps {\n originalUuids?: Set<string>\n originalBalances?: Record<string, string>\n}\n\nfunction SelectEmployeesTimeOffInner({\n companyId,\n policyId,\n policyType,\n mode = 'standalone',\n originalUuids,\n originalBalances,\n}: InnerProps) {\n useI18n('Company.TimeOff.SelectEmployees')\n const { t } = useTranslation('Company.TimeOff.SelectEmployees')\n const { onEvent, baseSubmitHandler } = useBase()\n const queryClient = useQueryClient()\n const {\n filteredEmployees,\n selectedUuids,\n searchValue,\n pagination,\n isFetching,\n handleSelect,\n handleSelectAll,\n handleSearchChange,\n handleSearchClear,\n } = useSelectEmployeesData(companyId, originalUuids)\n\n // Captures the full Employee record at the moment a row is selected so\n // their carry-over balance is still available at submit time even if the\n // user has since searched/paginated the row out of view. Without this,\n // `selectedUuids` would point at UUIDs we no longer have data for.\n const selectedEmployeesRef = useRef(new Map<string, EmployeeItem>())\n\n const handleSelectWithCapture = useCallback(\n (item: EmployeeItem, checked: boolean) => {\n if (checked) {\n selectedEmployeesRef.current.set(item.uuid, item)\n } else {\n selectedEmployeesRef.current.delete(item.uuid)\n }\n handleSelect(item, checked)\n },\n [handleSelect],\n )\n\n const handleSelectAllWithCapture = useCallback(\n (checked: boolean, visibleItems: EmployeeItem[]) => {\n for (const item of visibleItems) {\n if (checked) {\n selectedEmployeesRef.current.set(item.uuid, item)\n } else {\n selectedEmployeesRef.current.delete(item.uuid)\n }\n }\n handleSelectAll(checked, visibleItems)\n },\n [handleSelectAll],\n )\n\n const carryOverBalances = useMemo(\n () => deriveCarryOverBalances(filteredEmployees, policyType),\n [filteredEmployees, policyType],\n )\n\n const [balances, setBalances] = useState<Record<string, string>>({})\n\n const effectiveBalances = useMemo<Record<string, string>>(\n () => ({ ...carryOverBalances, ...balances }),\n [carryOverBalances, balances],\n )\n\n const { mutateAsync: addEmployees } = useTimeOffPoliciesAddEmployeesMutation()\n const { mutateAsync: removeEmployees, isPending: isRemovePending } =\n useTimeOffPoliciesRemoveEmployeesMutation()\n\n const [confirmRemoveOpen, setConfirmRemoveOpen] = useState(false)\n\n const handleBalanceChange = useCallback((uuid: string, value: string) => {\n setBalances(prev => ({ ...prev, [uuid]: value }))\n }, [])\n\n const buildAddPayload = useCallback(\n (uuids: string[]) =>\n uuids.map(uuid => {\n const userValue = balances[uuid]\n const carryOver = extractCarryOverBalance(\n selectedEmployeesRef.current.get(uuid),\n policyType,\n )\n // Per design review: do not zero out balances accidentally.\n // Prefer user input → fall back to carry-over → omit `balance`\n // entirely (backend defaults the row to 0) when neither is set.\n const balance = userValue && userValue.length > 0 ? userValue : carryOver\n return balance ? { uuid, balance } : { uuid }\n }),\n [balances, policyType],\n )\n\n const submitDiff = useCallback(\n async (toAdd: string[], toRemove: string[]) => {\n await baseSubmitHandler({}, async () => {\n if (toRemove.length > 0) {\n try {\n await removeEmployees({\n request: {\n timeOffPolicyUuid: policyId,\n requestBody: { employees: toRemove.map(uuid => ({ uuid })) },\n },\n })\n } catch (err) {\n if (err instanceof UnprocessableEntityErrorObject) {\n const apiMessage = err.errors[0]?.message ?? ''\n throw new SDKInternalError(\n t('errors.removeEmployeesFailed', { details: apiMessage }),\n 'api_error',\n )\n }\n throw err\n }\n }\n let policyResult: unknown\n if (toAdd.length > 0) {\n const response = await addEmployees({\n request: {\n timeOffPolicyUuid: policyId,\n requestBody: { employees: buildAddPayload(toAdd) },\n },\n })\n policyResult = response.timeOffPolicy\n }\n void queryClient.invalidateQueries({\n queryKey: ['@gusto/embedded-api', 'timeOffPolicies', 'get'],\n })\n onEvent(componentEvents.TIME_OFF_ADD_EMPLOYEES_DONE, policyResult)\n })\n },\n [\n baseSubmitHandler,\n removeEmployees,\n addEmployees,\n buildAddPayload,\n policyId,\n queryClient,\n onEvent,\n t,\n ],\n )\n\n const handleContinue = useCallback(async () => {\n if (mode === 'wizard') {\n onEvent(componentEvents.TIME_OFF_ADD_EMPLOYEES_DONE, {\n employeeUuids: [...selectedUuids],\n })\n return\n }\n\n const original = originalUuids ?? new Set<string>()\n const toAdd = [...selectedUuids].filter(uuid => !original.has(uuid))\n const toRemove = [...original].filter(uuid => !selectedUuids.has(uuid))\n\n if (toAdd.length === 0 && toRemove.length === 0) {\n onEvent(componentEvents.TIME_OFF_ADD_EMPLOYEES_DONE)\n return\n }\n\n if (toRemove.length > 0) {\n setConfirmRemoveOpen(true)\n return\n }\n\n await submitDiff(toAdd, toRemove)\n }, [mode, originalUuids, selectedUuids, onEvent, submitDiff])\n\n const handleConfirmRemove = useCallback(async () => {\n const original = originalUuids ?? new Set<string>()\n const toAdd = [...selectedUuids].filter(uuid => !original.has(uuid))\n const toRemove = [...original].filter(uuid => !selectedUuids.has(uuid))\n setConfirmRemoveOpen(false)\n await submitDiff(toAdd, toRemove)\n }, [originalUuids, selectedUuids, submitDiff])\n\n const removeCount = useMemo(() => {\n if (!originalUuids) return 0\n let count = 0\n for (const uuid of originalUuids) if (!selectedUuids.has(uuid)) count += 1\n return count\n }, [originalUuids, selectedUuids])\n\n const handleBack = useCallback(() => {\n onEvent(componentEvents.CANCEL)\n }, [onEvent])\n\n return (\n <SelectEmployeesPresentation\n employees={filteredEmployees}\n selectedUuids={selectedUuids}\n searchValue={searchValue}\n onSelect={handleSelectWithCapture}\n onSelectAll={handleSelectAllWithCapture}\n onSearchChange={handleSearchChange}\n onSearchClear={handleSearchClear}\n onBack={handleBack}\n onContinue={handleContinue}\n showReassignmentWarning\n policyTypeLabel={t(`policyTypeLabel_${policyType}`)}\n balances={effectiveBalances}\n onBalanceChange={handleBalanceChange}\n pagination={pagination}\n isFetching={isFetching}\n originallyOnPolicyUuids={originalUuids}\n originalBalances={originalBalances}\n removeConfirmDialog={\n mode === 'standalone'\n ? {\n isOpen: confirmRemoveOpen,\n count: removeCount,\n onConfirm: () => {\n void handleConfirmRemove()\n },\n onClose: () => {\n setConfirmRemoveOpen(false)\n },\n isPending: isRemovePending,\n }\n : undefined\n }\n />\n )\n}\n"],"names":["PAID_TIME_OFF_NAME_BY_POLICY_TYPE","extractCarryOverBalance","employee","policyType","targetName","balance","pto","deriveCarryOverBalances","employees","map","SelectEmployeesTimeOff","props","jsx","SelectEmployeesTimeOffInner","StandaloneLoader","policyResponse","useTimeOffPoliciesGetSuspense","policy","originalUuids","useMemo","set","e","originalBalances","companyId","policyId","mode","useI18n","t","useTranslation","onEvent","baseSubmitHandler","useBase","queryClient","useQueryClient","filteredEmployees","selectedUuids","searchValue","pagination","isFetching","handleSelect","handleSelectAll","handleSearchChange","handleSearchClear","useSelectEmployeesData","selectedEmployeesRef","useRef","handleSelectWithCapture","useCallback","item","checked","handleSelectAllWithCapture","visibleItems","carryOverBalances","balances","setBalances","useState","effectiveBalances","addEmployees","useTimeOffPoliciesAddEmployeesMutation","removeEmployees","isRemovePending","useTimeOffPoliciesRemoveEmployeesMutation","confirmRemoveOpen","setConfirmRemoveOpen","handleBalanceChange","uuid","value","prev","buildAddPayload","uuids","userValue","carryOver","submitDiff","toAdd","toRemove","err","UnprocessableEntityErrorObject","apiMessage","SDKInternalError","policyResult","componentEvents","handleContinue","original","handleConfirmRemove","removeCount","count","handleBack","SelectEmployeesPresentation"],"mappings":";;;;;;;;;;;;;;AAuBA,MAAMA,KAAgF;AAAA,EACpF,UAAU;AAAA,EACV,MAAM;AACR;AAEA,SAASC,EACPC,GACAC,GACoB;AACpB,MAAI,CAACD,EAAU;AACf,QAAME,IAAaJ,GAAkCG,CAAU,GAEzDE,IADWH,EAAS,qBAAqB,KAAK,CAAAI,MAAOA,EAAI,SAASF,CAAU,GACxD;AAC1B,SAAOC,KAAWA,EAAQ,SAAS,IAAIA,IAAU;AACnD;AAEA,SAASE,GACPC,GACAL,GACwB;AACxB,QAAMM,IAA8B,CAAA;AACpC,aAAWP,KAAYM,GAAW;AAChC,UAAMH,IAAUJ,EAAwBC,GAAUC,CAAU;A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AAAjB,MAAQ,CAAC9B,EAAc,IAAI8B,CAAI,CAAC;AACtE,IAAAF,EAAqB,EAAK,GAC1B,MAAMS,EAAWC,GAAOC,CAAQ;AAAA,EAClC,GAAG,CAACxD,GAAeiB,GAAeqC,CAAU,CAAC,GAEvCY,IAAcjE,EAAQ,MAAM;AAChC,QAAI,CAACD,EAAe,QAAO;AAC3B,QAAImE,IAAQ;AACZ,eAAWpB,KAAQ/C,EAAe,CAAKiB,EAAc,IAAI8B,CAAI,MAAGoB,KAAS;AACzE,WAAOA;AAAA,EACT,GAAG,CAACnE,GAAeiB,CAAa,CAAC,GAE3BmD,IAAavC,EAAY,MAAM;AACnC,IAAAlB,EAAQmD,EAAgB,MAAM;AAAA,EAChC,GAAG,CAACnD,CAAO,CAAC;AAEZ,SACE,gBAAAjB;AAAA,IAAC2E;AAAA,IAAA;AAAA,MACC,WAAWrD;AAAA,MACX,eAAAC;AAAA,MACA,aAAAC;AAAA,MACA,UAAUU;AAAA,MACV,aAAaI;AAAA,MACb,gBAAgBT;AAAA,MAChB,eAAeC;AAAA,MACf,QAAQ4C;AAAA,MACR,YAAYL;AAAA,MACZ,yBAAuB;AAAA,MACvB,iBAAiBtD,EAAE,mBAAmBxB,CAAU,EAAE;AAAA,MAClD,UAAUqD;AAAA,MACV,iBAAiBQ;AAAA,MACjB,YAAA3B;AAAA,MACA,YAAAC;AAAA,MACA,yBAAyBpB;AAAA,MACzB,kBAAAI;AAAA,MACA,qBACEG,MAAS,eACL;AAAA,QACE,QAAQqC;AAAA,QACR,OAAOsB;AAAA,QACP,WAAW,MAAM;AACf,UAAKD,EAAA;AAAA,QACP;AAAA,QACA,SAAS,MAAM;AACb,UAAApB,EAAqB,EAAK;AAAA,QAC5B;AAAA,QACA,WAAWH;AAAA,MAAA,IAEb;AAAA,IAAA;AAAA,EAAA;AAIZ;"}
|
|
1
|
+
{"version":3,"file":"SelectEmployeesTimeOff.js","sources":["../../../../../src/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.tsx"],"sourcesContent":["import { useCallback, useMemo, useRef, useState } from 'react'\nimport { useTimeOffPoliciesAddEmployeesMutation } from '@gusto/embedded-api/react-query/timeOffPoliciesAddEmployees'\nimport { useTimeOffPoliciesRemoveEmployeesMutation } from '@gusto/embedded-api/react-query/timeOffPoliciesRemoveEmployees'\nimport { useTimeOffPoliciesGetSuspense } from '@gusto/embedded-api/react-query/timeOffPoliciesGet'\nimport { UnprocessableEntityError } from '@gusto/embedded-api/models/errors/unprocessableentityerror'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { useTranslation } from 'react-i18next'\nimport type { CreatableTimeOffPolicyType } from '../../TimeOffFlow/timeOffPolicyTypes'\nimport { SelectEmployeesPresentation } from './SelectEmployeesPresentation'\nimport { useSelectEmployeesData } from './useSelectEmployeesData'\nimport type { EmployeeItem } from './SelectEmployeesPresentationTypes'\nimport { useBase } from '@/components/Base/useBase'\nimport { SDKInternalError } from '@/types/sdkError'\nimport { componentEvents } from '@/shared/constants'\nimport { useI18n } from '@/i18n'\n\ninterface SelectEmployeesTimeOffProps {\n companyId: string\n policyId: string\n policyType: CreatableTimeOffPolicyType\n mode?: 'standalone' | 'wizard'\n}\n\nconst PAID_TIME_OFF_NAME_BY_POLICY_TYPE: Record<CreatableTimeOffPolicyType, string> = {\n vacation: 'Vacation Hours',\n sick: 'Sick Hours',\n}\n\nfunction extractCarryOverBalance(\n employee: EmployeeItem | undefined,\n policyType: CreatableTimeOffPolicyType,\n): string | undefined {\n if (!employee) return undefined\n const targetName = PAID_TIME_OFF_NAME_BY_POLICY_TYPE[policyType]\n const matching = employee.eligiblePaidTimeOff?.find(pto => pto.name === targetName)\n const balance = matching?.accrualBalance\n return balance && balance.length > 0 ? balance : undefined\n}\n\nfunction deriveCarryOverBalances(\n employees: EmployeeItem[],\n policyType: CreatableTimeOffPolicyType,\n): Record<string, string> {\n const map: Record<string, string> = {}\n for (const employee of employees) {\n const balance = extractCarryOverBalance(employee, policyType)\n if (balance) {\n map[employee.uuid] = balance\n }\n }\n return map\n}\n\nexport function SelectEmployeesTimeOff(props: SelectEmployeesTimeOffProps) {\n if (props.mode === 'wizard') {\n return <SelectEmployeesTimeOffInner {...props} mode=\"wizard\" />\n }\n return <StandaloneLoader {...props} />\n}\n\nfunction StandaloneLoader(props: SelectEmployeesTimeOffProps) {\n const { data: policyResponse } = useTimeOffPoliciesGetSuspense({\n timeOffPolicyUuid: props.policyId,\n })\n const policy = policyResponse.timeOffPolicy\n if (!policy) throw new Error('Unexpected response: missing timeOffPolicy')\n\n const originalUuids = useMemo(() => {\n const set = new Set<string>()\n for (const e of policy.employees) {\n if (e.uuid) set.add(e.uuid)\n }\n return set\n }, [policy.employees])\n\n const originalBalances = useMemo(() => {\n const map: Record<string, string> = {}\n for (const e of policy.employees) {\n if (e.uuid) map[e.uuid] = e.balance ?? '0'\n }\n return map\n }, [policy.employees])\n\n return (\n <SelectEmployeesTimeOffInner\n {...props}\n mode=\"standalone\"\n originalUuids={originalUuids}\n originalBalances={originalBalances}\n />\n )\n}\n\ninterface InnerProps extends SelectEmployeesTimeOffProps {\n originalUuids?: Set<string>\n originalBalances?: Record<string, string>\n}\n\nfunction SelectEmployeesTimeOffInner({\n companyId,\n policyId,\n policyType,\n mode = 'standalone',\n originalUuids,\n originalBalances,\n}: InnerProps) {\n useI18n('Company.TimeOff.SelectEmployees')\n const { t } = useTranslation('Company.TimeOff.SelectEmployees')\n const { onEvent, baseSubmitHandler } = useBase()\n const queryClient = useQueryClient()\n const {\n filteredEmployees,\n selectedUuids,\n searchValue,\n pagination,\n isFetching,\n handleSelect,\n handleSelectAll,\n handleSearchChange,\n handleSearchClear,\n } = useSelectEmployeesData(companyId, originalUuids)\n\n // Captures the full Employee record at the moment a row is selected so\n // their carry-over balance is still available at submit time even if the\n // user has since searched/paginated the row out of view. Without this,\n // `selectedUuids` would point at UUIDs we no longer have data for.\n const selectedEmployeesRef = useRef(new Map<string, EmployeeItem>())\n\n const handleSelectWithCapture = useCallback(\n (item: EmployeeItem, checked: boolean) => {\n if (checked) {\n selectedEmployeesRef.current.set(item.uuid, item)\n } else {\n selectedEmployeesRef.current.delete(item.uuid)\n }\n handleSelect(item, checked)\n },\n [handleSelect],\n )\n\n const handleSelectAllWithCapture = useCallback(\n (checked: boolean, visibleItems: EmployeeItem[]) => {\n for (const item of visibleItems) {\n if (checked) {\n selectedEmployeesRef.current.set(item.uuid, item)\n } else {\n selectedEmployeesRef.current.delete(item.uuid)\n }\n }\n handleSelectAll(checked, visibleItems)\n },\n [handleSelectAll],\n )\n\n const carryOverBalances = useMemo(\n () => deriveCarryOverBalances(filteredEmployees, policyType),\n [filteredEmployees, policyType],\n )\n\n const [balances, setBalances] = useState<Record<string, string>>({})\n\n const effectiveBalances = useMemo<Record<string, string>>(\n () => ({ ...carryOverBalances, ...balances }),\n [carryOverBalances, balances],\n )\n\n const { mutateAsync: addEmployees } = useTimeOffPoliciesAddEmployeesMutation()\n const { mutateAsync: removeEmployees, isPending: isRemovePending } =\n useTimeOffPoliciesRemoveEmployeesMutation()\n\n const [confirmRemoveOpen, setConfirmRemoveOpen] = useState(false)\n\n const handleBalanceChange = useCallback((uuid: string, value: string) => {\n setBalances(prev => ({ ...prev, [uuid]: value }))\n }, [])\n\n const buildAddPayload = useCallback(\n (uuids: string[]) =>\n uuids.map(uuid => {\n const userValue = balances[uuid]\n const carryOver = extractCarryOverBalance(\n selectedEmployeesRef.current.get(uuid),\n policyType,\n )\n // Per design review: do not zero out balances accidentally.\n // Prefer user input → fall back to carry-over → omit `balance`\n // entirely (backend defaults the row to 0) when neither is set.\n const balance = userValue && userValue.length > 0 ? userValue : carryOver\n return balance ? { uuid, balance } : { uuid }\n }),\n [balances, policyType],\n )\n\n const submitDiff = useCallback(\n async (toAdd: string[], toRemove: string[]) => {\n await baseSubmitHandler({}, async () => {\n if (toRemove.length > 0) {\n try {\n await removeEmployees({\n request: {\n timeOffPolicyUuid: policyId,\n requestBody: { employees: toRemove.map(uuid => ({ uuid })) },\n },\n })\n } catch (err) {\n if (err instanceof UnprocessableEntityError) {\n const apiMessage = err.errors[0]?.message ?? ''\n throw new SDKInternalError(\n t('errors.removeEmployeesFailed', { details: apiMessage }),\n 'api_error',\n )\n }\n throw err\n }\n }\n let policyResult: unknown\n if (toAdd.length > 0) {\n const response = await addEmployees({\n request: {\n timeOffPolicyUuid: policyId,\n requestBody: { employees: buildAddPayload(toAdd) },\n },\n })\n policyResult = response.timeOffPolicy\n }\n void queryClient.invalidateQueries({\n queryKey: ['@gusto/embedded-api', 'timeOffPolicies', 'get'],\n })\n onEvent(componentEvents.TIME_OFF_ADD_EMPLOYEES_DONE, policyResult)\n })\n },\n [\n baseSubmitHandler,\n removeEmployees,\n addEmployees,\n buildAddPayload,\n policyId,\n queryClient,\n onEvent,\n t,\n ],\n )\n\n const handleContinue = useCallback(async () => {\n if (mode === 'wizard') {\n onEvent(componentEvents.TIME_OFF_ADD_EMPLOYEES_DONE, {\n employeeUuids: [...selectedUuids],\n })\n return\n }\n\n const original = originalUuids ?? new Set<string>()\n const toAdd = [...selectedUuids].filter(uuid => !original.has(uuid))\n const toRemove = [...original].filter(uuid => !selectedUuids.has(uuid))\n\n if (toAdd.length === 0 && toRemove.length === 0) {\n onEvent(componentEvents.TIME_OFF_ADD_EMPLOYEES_DONE)\n return\n }\n\n if (toRemove.length > 0) {\n setConfirmRemoveOpen(true)\n return\n }\n\n await submitDiff(toAdd, toRemove)\n }, [mode, originalUuids, selectedUuids, onEvent, submitDiff])\n\n const handleConfirmRemove = useCallback(async () => {\n const original = originalUuids ?? new Set<string>()\n const toAdd = [...selectedUuids].filter(uuid => !original.has(uuid))\n const toRemove = [...original].filter(uuid => !selectedUuids.has(uuid))\n setConfirmRemoveOpen(false)\n await submitDiff(toAdd, toRemove)\n }, [originalUuids, selectedUuids, submitDiff])\n\n const removeCount = useMemo(() => {\n if (!originalUuids) return 0\n let count = 0\n for (const uuid of originalUuids) if (!selectedUuids.has(uuid)) count += 1\n return count\n }, [originalUuids, selectedUuids])\n\n const handleBack = useCallback(() => {\n onEvent(componentEvents.CANCEL)\n }, [onEvent])\n\n return (\n <SelectEmployeesPresentation\n employees={filteredEmployees}\n selectedUuids={selectedUuids}\n searchValue={searchValue}\n onSelect={handleSelectWithCapture}\n onSelectAll={handleSelectAllWithCapture}\n onSearchChange={handleSearchChange}\n onSearchClear={handleSearchClear}\n onBack={handleBack}\n onContinue={handleContinue}\n showReassignmentWarning\n policyTypeLabel={t(`policyTypeLabel_${policyType}`)}\n balances={effectiveBalances}\n onBalanceChange={handleBalanceChange}\n pagination={pagination}\n isFetching={isFetching}\n originallyOnPolicyUuids={originalUuids}\n originalBalances={originalBalances}\n removeConfirmDialog={\n mode === 'standalone'\n ? {\n isOpen: confirmRemoveOpen,\n count: removeCount,\n onConfirm: () => {\n void handleConfirmRemove()\n },\n onClose: () => {\n setConfirmRemoveOpen(false)\n },\n isPending: isRemovePending,\n }\n : undefined\n }\n />\n )\n}\n"],"names":["PAID_TIME_OFF_NAME_BY_POLICY_TYPE","extractCarryOverBalance","employee","policyType","targetName","balance","pto","deriveCarryOverBalances","employees","map","SelectEmployeesTimeOff","props","jsx","SelectEmployeesTimeOffInner","StandaloneLoader","policyResponse","useTimeOffPoliciesGetSuspense","policy","originalUuids","useMemo","set","e","originalBalances","companyId","policyId","mode","useI18n","t","useTranslation","onEvent","baseSubmitHandler","useBase","queryClient","useQueryClient","filteredEmployees","selectedUuids","searchValue","pagination","isFetching","handleSelect","handleSelectAll","handleSearchChange","handleSearchClear","useSelectEmployeesData","selectedEmployeesRef","useRef","handleSelectWithCapture","useCallback","item","checked","handleSelectAllWithCapture","visibleItems","carryOverBalances","balances","setBalances","useState","effectiveBalances","addEmployees","useTimeOffPoliciesAddEmployeesMutation","removeEmployees","isRemovePending","useTimeOffPoliciesRemoveEmployeesMutation","confirmRemoveOpen","setConfirmRemoveOpen","handleBalanceChange","uuid","value","prev","buildAddPayload","uuids","userValue","carryOver","submitDiff","toAdd","toRemove","err","UnprocessableEntityError","apiMessage","SDKInternalError","policyResult","componentEvents","handleContinue","original","handleConfirmRemove","removeCount","count","handleBack","SelectEmployeesPresentation"],"mappings":";;;;;;;;;;;;;;AAuBA,MAAMA,KAAgF;AAAA,EACpF,UAAU;AAAA,EACV,MAAM;AACR;AAEA,SAASC,EACPC,GACAC,GACoB;AACpB,MAAI,CAACD,EAAU;AACf,QAAME,IAAaJ,GAAkCG,CAAU,GAEzDE,IADWH,EAAS,qBAAqB,KAAK,CAAAI,MAAOA,EAAI,SAASF,CAAU,GACxD;AAC1B,SAAOC,KAAWA,EAAQ,SAAS,IAAIA,IAAU;AACnD;AAEA,SAASE,GACPC,GACAL,GACwB;AACxB,QAAMM,IAA8B,CAAA;AACpC,aAAWP,KAAYM,GAAW;AAChC,UAAMH,IAAUJ,EAAwBC,GAAUC,CAAU;AAC5D,IAAIE,MACFI,EAAIP,EAAS,IAAI,IAAIG;AAAA,EAEzB;AACA,SAAOI;AACT;AAEO,SAASC,GAAuBC,GAAoC;AACzE,SAAIA,EAAM,SAAS,WACV,gBAAAC,EAACC,GAAA,EAA6B,GAAGF,GAAO,MAAK,UAAS,IAExD,gBAAAC,EAACE,IAAA,EAAkB,GAAGH,EAAA,CAAO;AACtC;AAEA,SAASG,GAAiBH,GAAoC;AAC5D,QAAM,EAAE,MAAMI,EAAA,IAAmBC,EAA8B;AAAA,IAC7D,mBAAmBL,EAAM;AAAA,EAAA,CAC1B,GACKM,IAASF,EAAe;AAC9B,MAAI,CAACE,EAAQ,OAAM,IAAI,MAAM,4CAA4C;AAEzE,QAAMC,IAAgBC,EAAQ,MAAM;AAClC,UAAMC,wBAAU,IAAA;AAChB,eAAWC,KAAKJ,EAAO;AACrB,MAAII,EAAE,QAAMD,EAAI,IAAIC,EAAE,IAAI;AAE5B,WAAOD;AAAA,EACT,GAAG,CAACH,EAAO,SAAS,CAAC,GAEfK,IAAmBH,EAAQ,MAAM;AACrC,UAAMV,IAA8B,CAAA;AACpC,eA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AAAA,MACZ,yBAAuB;AAAA,MACvB,iBAAiBtD,EAAE,mBAAmBxB,CAAU,EAAE;AAAA,MAClD,UAAUqD;AAAA,MACV,iBAAiBQ;AAAA,MACjB,YAAA3B;AAAA,MACA,YAAAC;AAAA,MACA,yBAAyBpB;AAAA,MACzB,kBAAAI;AAAA,MACA,qBACEG,MAAS,eACL;AAAA,QACE,QAAQqC;AAAA,QACR,OAAOsB;AAAA,QACP,WAAW,MAAM;AACf,UAAKD,EAAA;AAAA,QACP;AAAA,QACA,SAAS,MAAM;AACb,UAAApB,EAAqB,EAAK;AAAA,QAC5B;AAAA,QACA,WAAWH;AAAA,MAAA,IAEb;AAAA,IAAA;AAAA,EAAA;AAIZ;"}
|
|
@@ -2,8 +2,8 @@ import { jsx as r, jsxs as R } from "react/jsx-runtime";
|
|
|
2
2
|
import { useMemo as l } from "react";
|
|
3
3
|
import { useTranslation as V } from "react-i18next";
|
|
4
4
|
import y from "./EmployeeTable.module.scss.js";
|
|
5
|
-
import "../../../../shared/constants.js";
|
|
6
5
|
import "classnames";
|
|
6
|
+
import "../../../../shared/constants.js";
|
|
7
7
|
import { useComponentContext as b } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
8
8
|
import { useI18n as I } from "../../../../i18n/I18n.js";
|
|
9
9
|
import { firstLastName as O } from "../../../../helpers/formattedStrings.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as n, jsxs as g, Fragment as P } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation as b } from "react-i18next";
|
|
3
3
|
import { EmployeeTable as E } from "../EmployeeTable/EmployeeTable.js";
|
|
4
|
-
import "../../../../shared/constants.js";
|
|
5
4
|
import "classnames";
|
|
5
|
+
import "../../../../shared/constants.js";
|
|
6
6
|
import { useComponentContext as D } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
7
7
|
import { useI18n as S } from "../../../../i18n/I18n.js";
|
|
8
8
|
import { DetailViewLayout as L } from "../../../Common/DetailViewLayout/DetailViewLayout.js";
|
|
@@ -7,8 +7,8 @@ import { ApiProvider as I } from "../ApiProvider/ApiProvider.js";
|
|
|
7
7
|
import { LoadingIndicatorProvider as L } from "../LoadingIndicatorProvider/LoadingIndicatorProvider.js";
|
|
8
8
|
import { sanitizeError as x } from "../ObservabilityProvider/sanitization.js";
|
|
9
9
|
import { SDKI18next as m } from "./SDKI18next.js";
|
|
10
|
-
import "../../shared/constants.js";
|
|
11
10
|
import "classnames";
|
|
11
|
+
import "../../shared/constants.js";
|
|
12
12
|
import { InternalError as z } from "../../components/Common/InternalError/InternalError.js";
|
|
13
13
|
import { LocaleProvider as D } from "../LocaleProvider/LocaleProvider.js";
|
|
14
14
|
import "../LocaleProvider/useLocale.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { useHookFieldResolution as p } from "../useHookFieldResolution.js";
|
|
3
3
|
import { withFieldElementRegistry as c } from "./withFieldElementRegistry.js";
|
|
4
|
-
import "../../../shared/constants.js";
|
|
5
4
|
import "classnames";
|
|
5
|
+
import "../../../shared/constants.js";
|
|
6
6
|
import { CheckboxField as u } from "../../../components/Common/Fields/CheckboxField/CheckboxField.js";
|
|
7
7
|
function h({
|
|
8
8
|
name: e,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as R } from "react/jsx-runtime";
|
|
2
2
|
import { useHookFieldResolution as b } from "../useHookFieldResolution.js";
|
|
3
3
|
import { withFieldElementRegistry as c } from "./withFieldElementRegistry.js";
|
|
4
|
-
import "../../../shared/constants.js";
|
|
5
4
|
import "classnames";
|
|
5
|
+
import "../../../shared/constants.js";
|
|
6
6
|
import { NumberInputField as F } from "../../../components/Common/Fields/NumberInputField/NumberInputField.js";
|
|
7
7
|
function E({
|
|
8
8
|
name: e,
|
|
@@ -2,8 +2,8 @@ import { jsx as F } from "react/jsx-runtime";
|
|
|
2
2
|
import { useHookFieldResolution as g } from "../useHookFieldResolution.js";
|
|
3
3
|
import { getFieldWithOptions as b } from "../getFieldWithOptions.js";
|
|
4
4
|
import { withFieldElementRegistry as h } from "./withFieldElementRegistry.js";
|
|
5
|
-
import "../../../shared/constants.js";
|
|
6
5
|
import "classnames";
|
|
6
|
+
import "../../../shared/constants.js";
|
|
7
7
|
import { RadioGroupField as k } from "../../../components/Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
8
8
|
function H({
|
|
9
9
|
name: i,
|
|
@@ -2,8 +2,8 @@ import { jsx as b } from "react/jsx-runtime";
|
|
|
2
2
|
import { useHookFieldResolution as h } from "../useHookFieldResolution.js";
|
|
3
3
|
import { getFieldWithOptions as k } from "../getFieldWithOptions.js";
|
|
4
4
|
import { withFieldElementRegistry as q } from "./withFieldElementRegistry.js";
|
|
5
|
-
import "../../../shared/constants.js";
|
|
6
5
|
import "classnames";
|
|
6
|
+
import "../../../shared/constants.js";
|
|
7
7
|
import { SelectField as v } from "../../../components/Common/Fields/SelectField/SelectField.js";
|
|
8
8
|
function j({
|
|
9
9
|
name: t,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { useHookFieldResolution as p } from "../useHookFieldResolution.js";
|
|
3
3
|
import { withFieldElementRegistry as c } from "./withFieldElementRegistry.js";
|
|
4
|
-
import "../../../shared/constants.js";
|
|
5
4
|
import "classnames";
|
|
5
|
+
import "../../../shared/constants.js";
|
|
6
6
|
import { SwitchField as u } from "../../../components/Common/Fields/SwitchField/SwitchField.js";
|
|
7
7
|
function k({
|
|
8
8
|
name: i,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as f } from "react/jsx-runtime";
|
|
2
2
|
import { useHookFieldResolution as R } from "../useHookFieldResolution.js";
|
|
3
3
|
import { withFieldElementRegistry as c } from "./withFieldElementRegistry.js";
|
|
4
|
-
import "../../../shared/constants.js";
|
|
5
4
|
import "classnames";
|
|
5
|
+
import "../../../shared/constants.js";
|
|
6
6
|
import { TextInputField as x } from "../../../components/Common/Fields/TextInputField/TextInputField.js";
|
|
7
7
|
function D({
|
|
8
8
|
name: e,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gusto/embedded-react-sdk",
|
|
3
|
-
"version": "0.44.
|
|
3
|
+
"version": "0.44.1",
|
|
4
4
|
"homepage": "https://github.com/Gusto/embedded-react-sdk",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/Gusto/embedded-react-sdk/issues"
|
|
@@ -81,8 +81,8 @@
|
|
|
81
81
|
"sdk-app:analyze-props": "npx tsx sdk-app/scripts/analyze-component-props.ts"
|
|
82
82
|
},
|
|
83
83
|
"devDependencies": {
|
|
84
|
-
"@commitlint/cli": "^
|
|
85
|
-
"@commitlint/config-conventional": "^
|
|
84
|
+
"@commitlint/cli": "^21.0.0",
|
|
85
|
+
"@commitlint/config-conventional": "^21.0.0",
|
|
86
86
|
"@eslint/js": "^9.39.2",
|
|
87
87
|
"@playwright/test": "^1.59.1",
|
|
88
88
|
"@storybook/addon-a11y": "^10.3.6",
|
|
@@ -116,8 +116,8 @@
|
|
|
116
116
|
"js-yaml": "^4.1.1",
|
|
117
117
|
"jsdom": "^26.1.0",
|
|
118
118
|
"jsdom-testing-mocks": "^1.16.0",
|
|
119
|
-
"lint-staged": "^17.0.
|
|
120
|
-
"msw": "^2.14.
|
|
119
|
+
"lint-staged": "^17.0.4",
|
|
120
|
+
"msw": "^2.14.6",
|
|
121
121
|
"npm-run-all": "^4.1.5",
|
|
122
122
|
"pixelmatch": "^7.2.0",
|
|
123
123
|
"pngjs": "^7.0.0",
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
"typescript": "^5.8.3"
|
|
149
149
|
},
|
|
150
150
|
"dependencies": {
|
|
151
|
-
"@gusto/embedded-api": "0.
|
|
151
|
+
"@gusto/embedded-api": "0.13.0",
|
|
152
152
|
"@hookform/error-message": "^2.0.1",
|
|
153
153
|
"@hookform/resolvers": "^5.2.2",
|
|
154
154
|
"@internationalized/date": "^3.12.1",
|