@gusto/embedded-react-sdk 0.46.2 → 0.46.3
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 +67 -0
- package/dist/components/Common/DataView/DataTable/DataTable.js +76 -72
- package/dist/components/Common/DataView/DataTable/DataTable.js.map +1 -1
- package/dist/components/Common/DataView/DataTable/DataTable.module.scss.js +8 -0
- package/dist/components/Common/DataView/DataTable/DataTable.module.scss.js.map +1 -0
- package/dist/components/Common/DataView/useDataView.d.ts +2 -0
- package/dist/components/Common/DataView/useDataView.js.map +1 -1
- package/dist/components/Common/DocumentViewer/DocumentViewer.js +10 -10
- package/dist/components/Common/DocumentViewer/DocumentViewer.js.map +1 -1
- package/dist/components/Common/DocumentViewer/DocumentViewer.module.scss.js +9 -9
- package/dist/components/Common/PaginationControl/PaginationControl.js +11 -10
- package/dist/components/Common/PaginationControl/PaginationControl.js.map +1 -1
- package/dist/components/Common/PaginationControl/PaginationControlTypes.d.ts +1 -1
- package/dist/components/Common/UI/DescriptionList/DescriptionList.js +11 -10
- package/dist/components/Common/UI/DescriptionList/DescriptionList.js.map +1 -1
- package/dist/components/Common/UI/DescriptionList/DescriptionList.module.scss.js +4 -4
- package/dist/components/Common/UI/Input/InputTypes.d.ts +1 -1
- package/dist/components/Common/UI/Input/InputTypes.js.map +1 -1
- package/dist/components/Common/UI/NumberInput/NumberInput.js +51 -48
- package/dist/components/Common/UI/NumberInput/NumberInput.js.map +1 -1
- package/dist/components/Common/VisuallyHidden/VisuallyHidden.d.ts +1 -1
- package/dist/components/Common/VisuallyHidden/VisuallyHidden.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +3 -4
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +3 -4
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +5 -6
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +3 -4
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +3 -4
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/shared/useSignCompanyForm/fields.js +4 -4
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +5 -6
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +6 -7
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +3 -4
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +3 -4
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +3 -4
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/fields.js +5 -5
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +3 -4
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +3 -4
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Contractor/Address/useAddress.js +5 -6
- package/dist/components/Contractor/Address/useAddress.js.map +1 -1
- package/dist/components/Contractor/Profile/useContractorProfile.js +33 -34
- package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
- package/dist/components/Employee/Compensation/management/EditCompensation/EditCompensation.js +14 -11
- package/dist/components/Employee/Compensation/management/EditCompensation/EditCompensation.js.map +1 -1
- package/dist/components/Employee/Compensation/management/EditPendingCompensation/EditPendingCompensation.js +0 -2
- package/dist/components/Employee/Compensation/management/EditPendingCompensation/EditPendingCompensation.js.map +1 -1
- package/dist/components/Employee/Compensation/management/ManagementCompensationFormBody.js +18 -18
- package/dist/components/Employee/Compensation/management/ManagementCompensationFormBody.js.map +1 -1
- package/dist/components/Employee/Compensation/onboarding/JobsList/JobsListPresentation.js +36 -36
- package/dist/components/Employee/Compensation/onboarding/JobsList/JobsListPresentation.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/useCompensationForm/fields.js +4 -4
- package/dist/components/Employee/Compensation/shared/useCompensationForm/useCompensationForm.js +140 -140
- package/dist/components/Employee/Compensation/shared/useCompensationForm/useCompensationForm.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/useJobForm/fields.js +6 -6
- package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.d.ts +6 -5
- package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.js +162 -131
- package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.js.map +1 -1
- package/dist/components/Employee/Dashboard/BasicDetailsView.js +74 -88
- package/dist/components/Employee/Dashboard/BasicDetailsView.js.map +1 -1
- package/dist/components/Employee/Dashboard/Dashboard.js +53 -51
- package/dist/components/Employee/Dashboard/Dashboard.js.map +1 -1
- package/dist/components/Employee/Dashboard/DocumentsView.js +17 -10
- package/dist/components/Employee/Dashboard/DocumentsView.js.map +1 -1
- package/dist/components/Employee/Dashboard/JobAndPayView.js +383 -357
- package/dist/components/Employee/Dashboard/JobAndPayView.js.map +1 -1
- package/dist/components/Employee/Dashboard/TaxesView.js +114 -101
- package/dist/components/Employee/Dashboard/TaxesView.js.map +1 -1
- package/dist/components/Employee/Dashboard/getPendingCompensationChanges.js +36 -36
- package/dist/components/Employee/Dashboard/getPendingCompensationChanges.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/StandardDeductionForm.js +57 -57
- package/dist/components/Employee/Deductions/DeductionsForm/StandardDeductionForm.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/childSupportGarnishmentFormSchema.d.ts +14 -5
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/childSupportGarnishmentFormSchema.js +55 -36
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/childSupportGarnishmentFormSchema.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/fields.js +8 -8
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/useChildSupportGarnishmentForm.js +18 -18
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/useChildSupportGarnishmentForm.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/useDeductionForm/fields.js +4 -4
- package/dist/components/Employee/Deductions/shared/useDeductionForm/useDeductionForm.d.ts +3 -3
- package/dist/components/Employee/Deductions/shared/useDeductionForm/useDeductionForm.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +3 -4
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/Documents/shared/useSignEmployeeForm/fields.js +1 -1
- package/dist/components/Employee/FederalTaxes/shared/useFederalTaxesForm/fields.js +4 -4
- package/dist/components/Employee/HomeAddress/management/HomeAddressView.js +157 -147
- package/dist/components/Employee/HomeAddress/management/HomeAddressView.js.map +1 -1
- package/dist/components/Employee/HomeAddress/management/useHomeAddressManagement.js +56 -55
- package/dist/components/Employee/HomeAddress/management/useHomeAddressManagement.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/onboarding/BankForm.js +20 -20
- package/dist/components/Employee/PaymentMethod/onboarding/BankForm.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/shared/useBankForm/fields.js +1 -1
- package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/splitFieldFactory.d.ts +1 -1
- package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/splitFieldFactory.js +4 -4
- package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/splitFieldFactory.js.map +1 -1
- package/dist/components/Employee/Profile/shared/useEmployeeDetailsForm/fields.js +8 -8
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/fields.js +5 -5
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/homeAddressSchema.d.ts +0 -1
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/homeAddressSchema.js +11 -12
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/homeAddressSchema.js.map +1 -1
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/homeAddressSchema.test.d.ts +1 -0
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/useHomeAddressForm.d.ts +6 -1
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/useHomeAddressForm.js +95 -94
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/useHomeAddressForm.js.map +1 -1
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/fields.js +4 -4
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/useWorkAddressForm.d.ts +6 -1
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/useWorkAddressForm.js +87 -86
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/useWorkAddressForm.js.map +1 -1
- package/dist/components/Employee/StateTaxes/shared/EmployeeStateTaxesView.js +18 -18
- package/dist/components/Employee/StateTaxes/shared/EmployeeStateTaxesView.js.map +1 -1
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fieldComponents.js +8 -8
- package/dist/components/Employee/Taxes/useTaxes.js +3 -4
- package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
- package/dist/components/Employee/WorkAddress/management/WorkAddressView.js +5 -1
- package/dist/components/Employee/WorkAddress/management/WorkAddressView.js.map +1 -1
- package/dist/components/Employee/WorkAddress/management/useWorkAddressManagement.js +61 -60
- package/dist/components/Employee/WorkAddress/management/useWorkAddressManagement.js.map +1 -1
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +2 -3
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +2 -3
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday.js +6 -7
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.d.ts +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.js +52 -68
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.module.scss.js +4 -4
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentationTypes.d.ts +0 -11
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.js +137 -163
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/useSelectEmployeesData.js +36 -35
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/useSelectEmployeesData.js.map +1 -1
- package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetailPresentation.js +34 -34
- package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetailPresentation.js.map +1 -1
- package/dist/helpers/breadcrumbHelpers.d.ts +1 -1
- package/dist/helpers/breadcrumbHelpers.js.map +1 -1
- package/dist/helpers/federalEin.d.ts +1 -0
- package/dist/helpers/federalEin.js.map +1 -1
- package/dist/helpers/mask.d.ts +8 -4
- package/dist/helpers/mask.js.map +1 -1
- package/dist/helpers/rem.d.ts +2 -1
- package/dist/helpers/rem.js.map +1 -1
- package/dist/hooks/useAsyncError.d.ts +1 -0
- package/dist/hooks/useAsyncError.js.map +1 -1
- package/dist/hooks/useForkRef/useForkRef.d.ts +1 -0
- package/dist/hooks/useForkRef/useForkRef.js.map +1 -1
- package/dist/i18n/I18n.d.ts +9 -1
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Company.TimeOff.EmployeeTable.json.js +14 -14
- package/dist/i18n/en/Company.TimeOff.SelectEmployees.json.js +12 -18
- package/dist/i18n/en/Company.TimeOff.SelectEmployees.json.js.map +1 -1
- package/dist/i18n/en/Employee.Compensation.json.js +24 -24
- package/dist/i18n/en/Employee.Dashboard.json.js +22 -20
- package/dist/i18n/en/Employee.Dashboard.json.js.map +1 -1
- package/dist/i18n/en/Employee.PaymentMethod.json.js +25 -25
- package/dist/i18n/en/Employee.StateTaxes.json.js +12 -10
- package/dist/i18n/en/Employee.StateTaxes.json.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/hooks.d.ts +1 -1
- package/dist/types/i18next.d.ts +4 -17
- package/dist/types/observability.d.ts +1 -1
- package/package.json +30 -27
- package/dist/components/Employee/Dashboard/CompensationCard.d.ts +0 -13
package/dist/components/Employee/Compensation/shared/useCompensationForm/useCompensationForm.js
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
import { useForm as
|
|
3
|
-
import { zodResolver as
|
|
4
|
-
import { useJobsAndCompensationsGetJobs as
|
|
5
|
-
import { GetV1EmployeesEmployeeIdJobsQueryParamInclude as
|
|
6
|
-
import { useJobsAndCompensationsCreateCompensationMutation as
|
|
7
|
-
import { useJobsAndCompensationsUpdateCompensationMutation as
|
|
8
|
-
import { useLocationsGetMinimumWages as
|
|
9
|
-
import { useEmployeeAddressesGetWorkAddresses as
|
|
10
|
-
import { useEmployeesGet as
|
|
11
|
-
import { createCompensationSchema as
|
|
12
|
-
import { EffectiveDateField as
|
|
13
|
-
import { withOptions as
|
|
14
|
-
import { createGetFormSubmissionValues as
|
|
15
|
-
import { useDeriveFieldsMetadata as
|
|
16
|
-
import { useHookFormInternals as
|
|
17
|
-
import { composeErrorHandler as
|
|
18
|
-
import { FlsaStatus as i, PAY_PERIODS as p, TIP_CREDITS_UNSUPPORTED_STATES as
|
|
19
|
-
import { useBaseSubmit as
|
|
1
|
+
import { useRef as q, useMemo as I, useEffect as H } from "react";
|
|
2
|
+
import { useForm as Ie, useWatch as me } from "react-hook-form";
|
|
3
|
+
import { zodResolver as Re } from "@hookform/resolvers/zod";
|
|
4
|
+
import { useJobsAndCompensationsGetJobs as Te } from "@gusto/embedded-api/react-query/jobsAndCompensationsGetJobs";
|
|
5
|
+
import { GetV1EmployeesEmployeeIdJobsQueryParamInclude as we } from "@gusto/embedded-api/models/operations/getv1employeesemployeeidjobs";
|
|
6
|
+
import { useJobsAndCompensationsCreateCompensationMutation as je } from "@gusto/embedded-api/react-query/jobsAndCompensationsCreateCompensation";
|
|
7
|
+
import { useJobsAndCompensationsUpdateCompensationMutation as Le } from "@gusto/embedded-api/react-query/jobsAndCompensationsUpdateCompensation";
|
|
8
|
+
import { useLocationsGetMinimumWages as _e } from "@gusto/embedded-api/react-query/locationsGetMinimumWages";
|
|
9
|
+
import { useEmployeeAddressesGetWorkAddresses as Je } from "@gusto/embedded-api/react-query/employeeAddressesGetWorkAddresses";
|
|
10
|
+
import { useEmployeesGet as Ve } from "@gusto/embedded-api/react-query/employeesGet";
|
|
11
|
+
import { createCompensationSchema as Xe } from "./compensationSchema.js";
|
|
12
|
+
import { EffectiveDateField as ke, MinimumWageIdField as Ye, AdjustForMinimumWageField as qe, PaymentUnitField as He, RateField as Be, FlsaStatusField as Ge, TitleField as Qe } from "./fields.js";
|
|
13
|
+
import { withOptions as B } from "../../../../../partner-hook-utils/form/withOptions.js";
|
|
14
|
+
import { createGetFormSubmissionValues as Ke } from "../../../../../partner-hook-utils/form/getFormSubmissionValues.js";
|
|
15
|
+
import { useDeriveFieldsMetadata as $e } from "../../../../../partner-hook-utils/form/useDeriveFieldsMetadata.js";
|
|
16
|
+
import { useHookFormInternals as xe } from "../../../../../partner-hook-utils/form/useHookFormInternals.js";
|
|
17
|
+
import { composeErrorHandler as ze } from "../../../../../partner-hook-utils/composeErrorHandler.js";
|
|
18
|
+
import { FlsaStatus as i, PAY_PERIODS as p, TIP_CREDITS_UNSUPPORTED_STATES as Ze } from "../../../../../shared/constants.js";
|
|
19
|
+
import { useBaseSubmit as et } from "../../../../Base/useBaseSubmit.js";
|
|
20
20
|
import { SDKInternalError as M } from "../../../../../types/sdkError.js";
|
|
21
|
-
import { formatDateToStringDate as
|
|
22
|
-
function
|
|
21
|
+
import { formatDateToStringDate as tt, addDays as nt } from "../../../../../helpers/dateFormatting.js";
|
|
22
|
+
function it(e, o, n) {
|
|
23
23
|
if (!e) return { compensation: null, job: null };
|
|
24
24
|
if (o) {
|
|
25
|
-
for (const
|
|
26
|
-
const W =
|
|
27
|
-
if (W) return { compensation: W, job:
|
|
25
|
+
for (const s of e) {
|
|
26
|
+
const W = s.compensations?.find((R) => R.uuid === o);
|
|
27
|
+
if (W) return { compensation: W, job: s };
|
|
28
28
|
}
|
|
29
|
-
return { compensation: null, job: n ? e.find((
|
|
29
|
+
return { compensation: null, job: n ? e.find((s) => s.uuid === n) ?? null : null };
|
|
30
30
|
}
|
|
31
31
|
return n ? { compensation: null, job: e.find((r) => r.uuid === n) ?? null } : { compensation: null, job: null };
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function ot(e) {
|
|
34
34
|
if (!e) return null;
|
|
35
35
|
for (const o of e) {
|
|
36
36
|
if (!o.primary) continue;
|
|
@@ -39,251 +39,251 @@ function it(e) {
|
|
|
39
39
|
}
|
|
40
40
|
return null;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function st(e) {
|
|
43
43
|
if (!e?.compensations) return [];
|
|
44
|
-
const o =
|
|
44
|
+
const o = de();
|
|
45
45
|
return e.compensations.filter((n) => n.effectiveDate !== void 0 && n.effectiveDate > o);
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function at(e) {
|
|
48
48
|
return e.length === 0 ? null : e.reduce((o, n) => {
|
|
49
49
|
const r = n.effectiveDate;
|
|
50
50
|
return r && (!o || r < o) ? r : o;
|
|
51
51
|
}, null);
|
|
52
52
|
}
|
|
53
|
-
const
|
|
53
|
+
const le = [
|
|
54
54
|
i.EXEMPT,
|
|
55
55
|
i.SALARIED_NONEXEMPT,
|
|
56
56
|
i.NONEXEMPT,
|
|
57
57
|
i.OWNER,
|
|
58
58
|
i.COMMISSION_ONLY_EXEMPT,
|
|
59
59
|
i.COMMISSION_ONLY_NONEXEMPT
|
|
60
|
-
],
|
|
60
|
+
], rt = le.map((e) => ({ value: e, label: e })), ce = [
|
|
61
61
|
p.HOUR,
|
|
62
62
|
p.WEEK,
|
|
63
63
|
p.MONTH,
|
|
64
64
|
p.YEAR,
|
|
65
65
|
p.PAYCHECK
|
|
66
|
-
],
|
|
67
|
-
function
|
|
66
|
+
], ut = ce.map((e) => ({ value: e, label: e }));
|
|
67
|
+
function de() {
|
|
68
68
|
return (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function wt({
|
|
71
71
|
employeeId: e,
|
|
72
72
|
jobId: o,
|
|
73
73
|
compensationId: n,
|
|
74
74
|
optionalFieldsToRequire: r,
|
|
75
|
-
defaultValues:
|
|
75
|
+
defaultValues: s,
|
|
76
76
|
validationMode: W = "onSubmit",
|
|
77
|
-
shouldFocusError:
|
|
77
|
+
shouldFocusError: R = !0,
|
|
78
78
|
withEffectiveDateField: E = !0
|
|
79
79
|
}) {
|
|
80
|
-
const
|
|
80
|
+
const T = Te(
|
|
81
81
|
{
|
|
82
82
|
employeeId: e ?? "",
|
|
83
83
|
// Fetch all effective-dated compensations when editing an existing one so
|
|
84
84
|
// resolveCompAndJob can find the target comp (future-dated comps are
|
|
85
85
|
// omitted from the default response, which only returns the current comp).
|
|
86
|
-
include: n ?
|
|
86
|
+
include: n ? we.AllCompensations : void 0
|
|
87
87
|
},
|
|
88
88
|
{ enabled: !!e }
|
|
89
|
-
),
|
|
89
|
+
), w = Je(
|
|
90
90
|
{ employeeId: e ?? "" },
|
|
91
91
|
{ enabled: !!e }
|
|
92
|
-
),
|
|
93
|
-
{ locationUuid:
|
|
94
|
-
{ enabled: !!
|
|
95
|
-
), C =
|
|
92
|
+
), j = Ve({ employeeId: e ?? "" }, { enabled: !!e }), f = T.data?.jobs, G = w.data?.employeeWorkAddressesList?.find((t) => t.active), Q = G?.locationUuid, fe = j.data?.employee, L = _e(
|
|
93
|
+
{ locationUuid: Q ?? "" },
|
|
94
|
+
{ enabled: !!Q }
|
|
95
|
+
), C = L.data?.minimumWageList ?? [], { compensation: u, job: a } = it(
|
|
96
96
|
f,
|
|
97
97
|
n,
|
|
98
98
|
o
|
|
99
|
-
),
|
|
100
|
-
|
|
101
|
-
const
|
|
99
|
+
), pe = f && a ? f.filter((t) => t.uuid !== a.uuid).length : 0, _ = q(null);
|
|
100
|
+
_.current === null && f !== void 0 && (_.current = f.some((t) => t.primary));
|
|
101
|
+
const F = _.current === !0 ? ot(f) : null, N = a?.hireDate ?? // Secondary jobs being created (AddAnotherJob) have no hireDate until the
|
|
102
102
|
// job POST completes. Fall back to the primary job's hireDate so the schema
|
|
103
103
|
// can enforce EFFECTIVE_DATE_BEFORE_HIRE during that window.
|
|
104
|
-
f?.find((t) => t.primary)?.hireDate ?? null,
|
|
104
|
+
f?.find((t) => t.primary)?.hireDate ?? null, K = st(a).filter(
|
|
105
105
|
(t) => t.uuid !== n
|
|
106
|
-
),
|
|
107
|
-
if (E && !(!d &&
|
|
108
|
-
return
|
|
109
|
-
}, [d,
|
|
110
|
-
() =>
|
|
111
|
-
mode:
|
|
106
|
+
), ve = K.length > 0, $ = at(K), d = !n, J = d ? "create" : "update", V = d && F === i.NONEXEMPT && a?.primary !== !0, h = I(() => {
|
|
107
|
+
if (E && !(!d && a?.primary === !0))
|
|
108
|
+
return tt(nt(/* @__PURE__ */ new Date(), 1)) ?? void 0;
|
|
109
|
+
}, [d, a?.primary, E]), [x, Ee] = I(
|
|
110
|
+
() => Xe({
|
|
111
|
+
mode: J,
|
|
112
112
|
optionalFieldsToRequire: r,
|
|
113
|
-
hireDate:
|
|
113
|
+
hireDate: N,
|
|
114
114
|
minEffectiveDate: h,
|
|
115
115
|
withEffectiveDateField: E
|
|
116
116
|
}),
|
|
117
|
-
[
|
|
118
|
-
),
|
|
117
|
+
[J, r, N, h, E]
|
|
118
|
+
), z = G?.state, P = I(
|
|
119
119
|
() => ({
|
|
120
|
-
title: u?.title ?? s?.title ??
|
|
120
|
+
title: u?.title ?? s?.title ?? "",
|
|
121
121
|
// When adding a secondary, the FLSA must match the primary's — force it
|
|
122
122
|
// here (overriding any partner default) so the form submits the right
|
|
123
123
|
// value even though `Fields.FlsaStatus` is hidden.
|
|
124
|
-
flsaStatus:
|
|
125
|
-
rate: Number(u?.rate ??
|
|
126
|
-
adjustForMinimumWage: u?.adjustForMinimumWage ??
|
|
127
|
-
minimumWageId: u?.minimumWages?.[0]?.uuid ??
|
|
128
|
-
paymentUnit: u?.paymentUnit ??
|
|
129
|
-
effectiveDate: u?.effectiveDate ??
|
|
124
|
+
flsaStatus: V ? F : u?.flsaStatus ?? s?.flsaStatus ?? F ?? void 0,
|
|
125
|
+
rate: Number(u?.rate ?? s?.rate ?? 0),
|
|
126
|
+
adjustForMinimumWage: u?.adjustForMinimumWage ?? s?.adjustForMinimumWage ?? !1,
|
|
127
|
+
minimumWageId: u?.minimumWages?.[0]?.uuid ?? s?.minimumWageId ?? "",
|
|
128
|
+
paymentUnit: u?.paymentUnit ?? s?.paymentUnit ?? p.HOUR,
|
|
129
|
+
effectiveDate: u?.effectiveDate ?? s?.effectiveDate ?? null
|
|
130
130
|
}),
|
|
131
|
-
[u,
|
|
132
|
-
), S =
|
|
133
|
-
resolver:
|
|
131
|
+
[u, a, s, F, V]
|
|
132
|
+
), S = Ie({
|
|
133
|
+
resolver: Re(x),
|
|
134
134
|
mode: W,
|
|
135
|
-
shouldFocusError:
|
|
135
|
+
shouldFocusError: R,
|
|
136
136
|
defaultValues: P,
|
|
137
137
|
values: P,
|
|
138
138
|
resetOptions: { keepDirtyValues: !0 }
|
|
139
|
-
}), { control:
|
|
140
|
-
control:
|
|
139
|
+
}), { control: Z, getValues: g, setValue: m, clearErrors: A } = S, l = me({ control: Z, name: "flsaStatus" }), Me = me({
|
|
140
|
+
control: Z,
|
|
141
141
|
name: "adjustForMinimumWage"
|
|
142
142
|
});
|
|
143
|
-
|
|
144
|
-
l === i.OWNER ? m("paymentUnit", p.PAYCHECK) : l === i.COMMISSION_ONLY_NONEXEMPT || l === i.COMMISSION_ONLY_EXEMPT ? (m("paymentUnit", p.YEAR), m("rate", 0)) : m("paymentUnit", P.paymentUnit);
|
|
145
|
-
}, [l, m, P.paymentUnit]);
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
!d && b && !
|
|
143
|
+
H(() => {
|
|
144
|
+
A(["paymentUnit", "rate"]), l === i.OWNER ? m("paymentUnit", p.PAYCHECK) : l === i.COMMISSION_ONLY_NONEXEMPT || l === i.COMMISSION_ONLY_EXEMPT ? (m("paymentUnit", p.YEAR), m("rate", 0)) : m("paymentUnit", P.paymentUnit);
|
|
145
|
+
}, [l, m, A, P.paymentUnit]);
|
|
146
|
+
const Se = a ? a.compensations?.find((t) => t.uuid === a.currentCompensationUuid) : void 0, b = (u?.flsaStatus ?? Se?.flsaStatus ?? null) === i.NONEXEMPT && l !== void 0 && l !== i.NONEXEMPT && pe > 0, U = q(!1), X = q(null);
|
|
147
|
+
H(() => {
|
|
148
|
+
!d && b && !U.current ? (X.current = g("effectiveDate") ?? null, m("effectiveDate", de(), { shouldDirty: !0, shouldValidate: !1 }), U.current = !0) : !d && !b && U.current && (m("effectiveDate", X.current ?? null, {
|
|
149
149
|
shouldDirty: !0,
|
|
150
150
|
shouldValidate: !1
|
|
151
|
-
}),
|
|
151
|
+
}), X.current = null, U.current = !1);
|
|
152
152
|
}, [d, b, g, m]);
|
|
153
|
-
const
|
|
154
|
-
baseSubmitHandler:
|
|
155
|
-
error:
|
|
156
|
-
setError:
|
|
157
|
-
} =
|
|
158
|
-
|
|
159
|
-
y || (g("adjustForMinimumWage") && m("adjustForMinimumWage", !1, { shouldDirty: !0, shouldValidate: !1 }), g("minimumWageId") && m("minimumWageId", "", { shouldDirty: !0, shouldValidate: !1 }));
|
|
160
|
-
}, [y, g, m]);
|
|
161
|
-
const
|
|
153
|
+
const ee = Le(), te = je(), ge = ee.isPending || te.isPending, {
|
|
154
|
+
baseSubmitHandler: be,
|
|
155
|
+
error: ye,
|
|
156
|
+
setError: Oe
|
|
157
|
+
} = et("CompensationForm"), ne = ze(e ? [T, w, j, L] : [], { submitError: ye, setSubmitError: Oe }), ie = l === i.COMMISSION_ONLY_NONEXEMPT || l === i.COMMISSION_ONLY_EXEMPT, De = l === i.OWNER, We = !V && (l !== i.NONEXEMPT || a?.primary === !0 || d), y = l === i.NONEXEMPT && C.length > 0 && z !== void 0 && !Ze.includes(z);
|
|
158
|
+
H(() => {
|
|
159
|
+
y || (g("adjustForMinimumWage") && m("adjustForMinimumWage", !1, { shouldDirty: !0, shouldValidate: !1 }), g("minimumWageId") && m("minimumWageId", "", { shouldDirty: !0, shouldValidate: !1 }), A(["adjustForMinimumWage", "minimumWageId"]));
|
|
160
|
+
}, [y, g, m, A]);
|
|
161
|
+
const Ce = C.map((t) => ({
|
|
162
162
|
value: t.uuid,
|
|
163
163
|
label: `${t.wage} - ${t.authority}: ${t.notes ?? ""}`
|
|
164
|
-
})), v =
|
|
165
|
-
() => [h,
|
|
166
|
-
[h,
|
|
167
|
-
),
|
|
164
|
+
})), v = $e(Ee, S.control), oe = I(
|
|
165
|
+
() => [h, N].filter((t) => !!t).reduce((t, O) => !t || O > t ? O : t, null),
|
|
166
|
+
[h, N]
|
|
167
|
+
), Fe = {
|
|
168
168
|
title: v.title,
|
|
169
169
|
effectiveDate: {
|
|
170
170
|
...v.effectiveDate,
|
|
171
171
|
isDisabled: b && !d,
|
|
172
|
-
minDate:
|
|
173
|
-
maxDate:
|
|
172
|
+
minDate: oe,
|
|
173
|
+
maxDate: $
|
|
174
174
|
},
|
|
175
|
-
flsaStatus:
|
|
175
|
+
flsaStatus: B(
|
|
176
176
|
v.flsaStatus,
|
|
177
|
-
at,
|
|
178
|
-
me
|
|
179
|
-
),
|
|
180
|
-
rate: { ...v.rate, isDisabled: ne },
|
|
181
|
-
paymentUnit: H(
|
|
182
|
-
{ ...v.paymentUnit, isDisabled: Oe || ne },
|
|
183
177
|
rt,
|
|
184
178
|
le
|
|
185
179
|
),
|
|
180
|
+
rate: { ...v.rate, isDisabled: ie },
|
|
181
|
+
paymentUnit: B(
|
|
182
|
+
{ ...v.paymentUnit, isDisabled: De || ie },
|
|
183
|
+
ut,
|
|
184
|
+
ce
|
|
185
|
+
),
|
|
186
186
|
adjustForMinimumWage: {
|
|
187
187
|
...v.adjustForMinimumWage,
|
|
188
188
|
isDisabled: !y
|
|
189
189
|
},
|
|
190
|
-
minimumWageId:
|
|
190
|
+
minimumWageId: B(
|
|
191
191
|
v.minimumWageId,
|
|
192
|
-
|
|
192
|
+
Ce,
|
|
193
193
|
C
|
|
194
194
|
)
|
|
195
195
|
}, Ne = async (t) => {
|
|
196
196
|
let O;
|
|
197
|
-
return await new Promise((
|
|
197
|
+
return await new Promise((se) => {
|
|
198
198
|
S.handleSubmit(
|
|
199
|
-
async (
|
|
200
|
-
await
|
|
201
|
-
const
|
|
199
|
+
async (Ae) => {
|
|
200
|
+
await be(Ae, async (c) => {
|
|
201
|
+
const ae = t?.jobId ?? o, k = t?.compensationId ?? n, re = k ? "update" : "create", Ue = E ? t?.effectiveDate ?? c.effectiveDate ?? void 0 : t?.effectiveDate ?? void 0, ue = {
|
|
202
202
|
rate: String(c.rate),
|
|
203
203
|
paymentUnit: c.paymentUnit,
|
|
204
204
|
flsaStatus: c.flsaStatus,
|
|
205
|
-
effectiveDate:
|
|
205
|
+
effectiveDate: Ue,
|
|
206
206
|
title: c.title || void 0,
|
|
207
207
|
adjustForMinimumWage: c.adjustForMinimumWage,
|
|
208
208
|
minimumWages: c.adjustForMinimumWage ? [{ uuid: c.minimumWageId }] : []
|
|
209
209
|
};
|
|
210
210
|
let D;
|
|
211
|
-
if (
|
|
212
|
-
if (!
|
|
211
|
+
if (re === "create") {
|
|
212
|
+
if (!ae)
|
|
213
213
|
throw new M(
|
|
214
214
|
"jobId is required to create a compensation. Pass it as a hook prop or via submit options."
|
|
215
215
|
);
|
|
216
216
|
if (!c.flsaStatus)
|
|
217
217
|
throw new M("flsaStatus is required to create a compensation.");
|
|
218
|
-
if (D = (await
|
|
218
|
+
if (D = (await te.mutateAsync({
|
|
219
219
|
request: {
|
|
220
|
-
jobId:
|
|
221
|
-
compensationsRequestBody: { ...
|
|
220
|
+
jobId: ae,
|
|
221
|
+
compensationsRequestBody: { ...ue, flsaStatus: c.flsaStatus }
|
|
222
222
|
}
|
|
223
223
|
})).compensation, !D) throw new M("Compensation creation failed");
|
|
224
224
|
} else {
|
|
225
|
-
if (!
|
|
225
|
+
if (!k)
|
|
226
226
|
throw new M(
|
|
227
227
|
"compensationId is required to update a compensation. Pass it as a hook prop or via submit options."
|
|
228
228
|
);
|
|
229
|
-
const
|
|
230
|
-
if (!
|
|
229
|
+
const Y = t?.compensationVersion ?? u?.version;
|
|
230
|
+
if (!Y)
|
|
231
231
|
throw new M(
|
|
232
232
|
"compensation version is required to update a compensation. Pass it via submit options when threading post-create, or ensure the compensation is loaded."
|
|
233
233
|
);
|
|
234
|
-
if (D = (await
|
|
234
|
+
if (D = (await ee.mutateAsync({
|
|
235
235
|
request: {
|
|
236
|
-
compensationId:
|
|
236
|
+
compensationId: k,
|
|
237
237
|
compensationsUpdateRequestBody: {
|
|
238
|
-
version:
|
|
239
|
-
...
|
|
238
|
+
version: Y,
|
|
239
|
+
...ue
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
242
|
})).compensation, !D) throw new M("Compensation update failed");
|
|
243
243
|
}
|
|
244
|
-
O = { mode:
|
|
245
|
-
}),
|
|
244
|
+
O = { mode: re, data: D };
|
|
245
|
+
}), se();
|
|
246
246
|
},
|
|
247
247
|
() => {
|
|
248
|
-
|
|
248
|
+
se();
|
|
249
249
|
}
|
|
250
250
|
)();
|
|
251
251
|
}), O;
|
|
252
|
-
},
|
|
253
|
-
return
|
|
252
|
+
}, he = e ? T.isLoading || w.isLoading || j.isLoading || L.isLoading : !1, Pe = xe(S);
|
|
253
|
+
return he || e && (!f || !fe) ? { isLoading: !0, errorHandling: ne } : {
|
|
254
254
|
isLoading: !1,
|
|
255
255
|
data: {
|
|
256
256
|
compensation: u,
|
|
257
|
-
currentJob:
|
|
257
|
+
currentJob: a,
|
|
258
258
|
minimumWages: C,
|
|
259
|
-
minimumEffectiveDate:
|
|
260
|
-
maximumEffectiveDate:
|
|
261
|
-
hasPendingFutureCompensation:
|
|
259
|
+
minimumEffectiveDate: oe,
|
|
260
|
+
maximumEffectiveDate: $,
|
|
261
|
+
hasPendingFutureCompensation: ve
|
|
262
262
|
},
|
|
263
263
|
status: {
|
|
264
|
-
isPending:
|
|
265
|
-
mode:
|
|
264
|
+
isPending: ge,
|
|
265
|
+
mode: J,
|
|
266
266
|
willDeleteSecondaryJobs: b
|
|
267
267
|
},
|
|
268
268
|
actions: { onSubmit: Ne },
|
|
269
|
-
errorHandling:
|
|
269
|
+
errorHandling: ne,
|
|
270
270
|
form: {
|
|
271
271
|
Fields: {
|
|
272
|
-
Title:
|
|
273
|
-
FlsaStatus:
|
|
274
|
-
Rate:
|
|
275
|
-
PaymentUnit:
|
|
276
|
-
AdjustForMinimumWage: y ?
|
|
277
|
-
MinimumWageId: y &&
|
|
278
|
-
EffectiveDate: E ?
|
|
272
|
+
Title: Qe,
|
|
273
|
+
FlsaStatus: We ? Ge : void 0,
|
|
274
|
+
Rate: Be,
|
|
275
|
+
PaymentUnit: He,
|
|
276
|
+
AdjustForMinimumWage: y ? qe : void 0,
|
|
277
|
+
MinimumWageId: y && Me ? Ye : void 0,
|
|
278
|
+
EffectiveDate: E ? ke : void 0
|
|
279
279
|
},
|
|
280
|
-
fieldsMetadata:
|
|
281
|
-
hookFormInternals:
|
|
282
|
-
getFormSubmissionValues:
|
|
280
|
+
fieldsMetadata: Fe,
|
|
281
|
+
hookFormInternals: Pe,
|
|
282
|
+
getFormSubmissionValues: Ke(S, x)
|
|
283
283
|
}
|
|
284
284
|
};
|
|
285
285
|
}
|
|
286
286
|
export {
|
|
287
|
-
|
|
287
|
+
wt as useCompensationForm
|
|
288
288
|
};
|
|
289
289
|
//# sourceMappingURL=useCompensationForm.js.map
|