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