@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.
Files changed (172) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/dist/components/Common/DataView/DataTable/DataTable.js +76 -72
  3. package/dist/components/Common/DataView/DataTable/DataTable.js.map +1 -1
  4. package/dist/components/Common/DataView/DataTable/DataTable.module.scss.js +8 -0
  5. package/dist/components/Common/DataView/DataTable/DataTable.module.scss.js.map +1 -0
  6. package/dist/components/Common/DataView/useDataView.d.ts +2 -0
  7. package/dist/components/Common/DataView/useDataView.js.map +1 -1
  8. package/dist/components/Common/DocumentViewer/DocumentViewer.js +10 -10
  9. package/dist/components/Common/DocumentViewer/DocumentViewer.js.map +1 -1
  10. package/dist/components/Common/DocumentViewer/DocumentViewer.module.scss.js +9 -9
  11. package/dist/components/Common/PaginationControl/PaginationControl.js +11 -10
  12. package/dist/components/Common/PaginationControl/PaginationControl.js.map +1 -1
  13. package/dist/components/Common/PaginationControl/PaginationControlTypes.d.ts +1 -1
  14. package/dist/components/Common/UI/DescriptionList/DescriptionList.js +11 -10
  15. package/dist/components/Common/UI/DescriptionList/DescriptionList.js.map +1 -1
  16. package/dist/components/Common/UI/DescriptionList/DescriptionList.module.scss.js +4 -4
  17. package/dist/components/Common/UI/Input/InputTypes.d.ts +1 -1
  18. package/dist/components/Common/UI/Input/InputTypes.js.map +1 -1
  19. package/dist/components/Common/UI/NumberInput/NumberInput.js +51 -48
  20. package/dist/components/Common/UI/NumberInput/NumberInput.js.map +1 -1
  21. package/dist/components/Common/VisuallyHidden/VisuallyHidden.d.ts +1 -1
  22. package/dist/components/Common/VisuallyHidden/VisuallyHidden.js.map +1 -1
  23. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +3 -4
  24. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  25. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +3 -4
  26. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  27. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +5 -6
  28. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  29. package/dist/components/Company/BankAccount/BankAccountForm/context.js +3 -4
  30. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  31. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +3 -4
  32. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  33. package/dist/components/Company/DocumentSigner/shared/useSignCompanyForm/fields.js +4 -4
  34. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +5 -6
  35. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  36. package/dist/components/Company/Industry/Context.js +6 -7
  37. package/dist/components/Company/Industry/Context.js.map +1 -1
  38. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +3 -4
  39. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  40. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +3 -4
  41. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  42. package/dist/components/Company/OnboardingOverview/context.js +3 -4
  43. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  44. package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/fields.js +5 -5
  45. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +3 -4
  46. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  47. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +3 -4
  48. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  49. package/dist/components/Contractor/Address/useAddress.js +5 -6
  50. package/dist/components/Contractor/Address/useAddress.js.map +1 -1
  51. package/dist/components/Contractor/Profile/useContractorProfile.js +33 -34
  52. package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
  53. package/dist/components/Employee/Compensation/management/EditCompensation/EditCompensation.js +14 -11
  54. package/dist/components/Employee/Compensation/management/EditCompensation/EditCompensation.js.map +1 -1
  55. package/dist/components/Employee/Compensation/management/EditPendingCompensation/EditPendingCompensation.js +0 -2
  56. package/dist/components/Employee/Compensation/management/EditPendingCompensation/EditPendingCompensation.js.map +1 -1
  57. package/dist/components/Employee/Compensation/management/ManagementCompensationFormBody.js +18 -18
  58. package/dist/components/Employee/Compensation/management/ManagementCompensationFormBody.js.map +1 -1
  59. package/dist/components/Employee/Compensation/onboarding/JobsList/JobsListPresentation.js +36 -36
  60. package/dist/components/Employee/Compensation/onboarding/JobsList/JobsListPresentation.js.map +1 -1
  61. package/dist/components/Employee/Compensation/shared/useCompensationForm/fields.js +4 -4
  62. package/dist/components/Employee/Compensation/shared/useCompensationForm/useCompensationForm.js +140 -140
  63. package/dist/components/Employee/Compensation/shared/useCompensationForm/useCompensationForm.js.map +1 -1
  64. package/dist/components/Employee/Compensation/shared/useJobForm/fields.js +6 -6
  65. package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.d.ts +6 -5
  66. package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.js +162 -131
  67. package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.js.map +1 -1
  68. package/dist/components/Employee/Dashboard/BasicDetailsView.js +74 -88
  69. package/dist/components/Employee/Dashboard/BasicDetailsView.js.map +1 -1
  70. package/dist/components/Employee/Dashboard/Dashboard.js +53 -51
  71. package/dist/components/Employee/Dashboard/Dashboard.js.map +1 -1
  72. package/dist/components/Employee/Dashboard/DocumentsView.js +17 -10
  73. package/dist/components/Employee/Dashboard/DocumentsView.js.map +1 -1
  74. package/dist/components/Employee/Dashboard/JobAndPayView.js +383 -357
  75. package/dist/components/Employee/Dashboard/JobAndPayView.js.map +1 -1
  76. package/dist/components/Employee/Dashboard/TaxesView.js +114 -101
  77. package/dist/components/Employee/Dashboard/TaxesView.js.map +1 -1
  78. package/dist/components/Employee/Dashboard/getPendingCompensationChanges.js +36 -36
  79. package/dist/components/Employee/Dashboard/getPendingCompensationChanges.js.map +1 -1
  80. package/dist/components/Employee/Deductions/DeductionsForm/StandardDeductionForm.js +57 -57
  81. package/dist/components/Employee/Deductions/DeductionsForm/StandardDeductionForm.js.map +1 -1
  82. package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/childSupportGarnishmentFormSchema.d.ts +14 -5
  83. package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/childSupportGarnishmentFormSchema.js +55 -36
  84. package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/childSupportGarnishmentFormSchema.js.map +1 -1
  85. package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/fields.js +8 -8
  86. package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/useChildSupportGarnishmentForm.js +18 -18
  87. package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/useChildSupportGarnishmentForm.js.map +1 -1
  88. package/dist/components/Employee/Deductions/shared/useDeductionForm/fields.js +4 -4
  89. package/dist/components/Employee/Deductions/shared/useDeductionForm/useDeductionForm.d.ts +3 -3
  90. package/dist/components/Employee/Deductions/shared/useDeductionForm/useDeductionForm.js.map +1 -1
  91. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +3 -4
  92. package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  93. package/dist/components/Employee/Documents/shared/useSignEmployeeForm/fields.js +1 -1
  94. package/dist/components/Employee/FederalTaxes/shared/useFederalTaxesForm/fields.js +4 -4
  95. package/dist/components/Employee/HomeAddress/management/HomeAddressView.js +157 -147
  96. package/dist/components/Employee/HomeAddress/management/HomeAddressView.js.map +1 -1
  97. package/dist/components/Employee/HomeAddress/management/useHomeAddressManagement.js +56 -55
  98. package/dist/components/Employee/HomeAddress/management/useHomeAddressManagement.js.map +1 -1
  99. package/dist/components/Employee/PaymentMethod/onboarding/BankForm.js +20 -20
  100. package/dist/components/Employee/PaymentMethod/onboarding/BankForm.js.map +1 -1
  101. package/dist/components/Employee/PaymentMethod/shared/useBankForm/fields.js +1 -1
  102. package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/splitFieldFactory.d.ts +1 -1
  103. package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/splitFieldFactory.js +4 -4
  104. package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/splitFieldFactory.js.map +1 -1
  105. package/dist/components/Employee/Profile/shared/useEmployeeDetailsForm/fields.js +8 -8
  106. package/dist/components/Employee/Profile/shared/useHomeAddressForm/fields.js +5 -5
  107. package/dist/components/Employee/Profile/shared/useHomeAddressForm/homeAddressSchema.d.ts +0 -1
  108. package/dist/components/Employee/Profile/shared/useHomeAddressForm/homeAddressSchema.js +11 -12
  109. package/dist/components/Employee/Profile/shared/useHomeAddressForm/homeAddressSchema.js.map +1 -1
  110. package/dist/components/Employee/Profile/shared/useHomeAddressForm/homeAddressSchema.test.d.ts +1 -0
  111. package/dist/components/Employee/Profile/shared/useHomeAddressForm/useHomeAddressForm.d.ts +6 -1
  112. package/dist/components/Employee/Profile/shared/useHomeAddressForm/useHomeAddressForm.js +95 -94
  113. package/dist/components/Employee/Profile/shared/useHomeAddressForm/useHomeAddressForm.js.map +1 -1
  114. package/dist/components/Employee/Profile/shared/useWorkAddressForm/fields.js +4 -4
  115. package/dist/components/Employee/Profile/shared/useWorkAddressForm/useWorkAddressForm.d.ts +6 -1
  116. package/dist/components/Employee/Profile/shared/useWorkAddressForm/useWorkAddressForm.js +87 -86
  117. package/dist/components/Employee/Profile/shared/useWorkAddressForm/useWorkAddressForm.js.map +1 -1
  118. package/dist/components/Employee/StateTaxes/shared/EmployeeStateTaxesView.js +18 -18
  119. package/dist/components/Employee/StateTaxes/shared/EmployeeStateTaxesView.js.map +1 -1
  120. package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fieldComponents.js +8 -8
  121. package/dist/components/Employee/Taxes/useTaxes.js +3 -4
  122. package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
  123. package/dist/components/Employee/WorkAddress/management/WorkAddressView.js +5 -1
  124. package/dist/components/Employee/WorkAddress/management/WorkAddressView.js.map +1 -1
  125. package/dist/components/Employee/WorkAddress/management/useWorkAddressManagement.js +61 -60
  126. package/dist/components/Employee/WorkAddress/management/useWorkAddressManagement.js.map +1 -1
  127. package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +2 -3
  128. package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
  129. package/dist/components/Payroll/usePreparedPayrollData.js +2 -3
  130. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  131. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday.js +6 -7
  132. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday.js.map +1 -1
  133. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.d.ts +1 -1
  134. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.js +52 -68
  135. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.js.map +1 -1
  136. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.module.scss.js +4 -4
  137. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentationTypes.d.ts +0 -11
  138. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.js +137 -163
  139. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.js.map +1 -1
  140. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/useSelectEmployeesData.js +36 -35
  141. package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/useSelectEmployeesData.js.map +1 -1
  142. package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetailPresentation.js +34 -34
  143. package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetailPresentation.js.map +1 -1
  144. package/dist/helpers/breadcrumbHelpers.d.ts +1 -1
  145. package/dist/helpers/breadcrumbHelpers.js.map +1 -1
  146. package/dist/helpers/federalEin.d.ts +1 -0
  147. package/dist/helpers/federalEin.js.map +1 -1
  148. package/dist/helpers/mask.d.ts +8 -4
  149. package/dist/helpers/mask.js.map +1 -1
  150. package/dist/helpers/rem.d.ts +2 -1
  151. package/dist/helpers/rem.js.map +1 -1
  152. package/dist/hooks/useAsyncError.d.ts +1 -0
  153. package/dist/hooks/useAsyncError.js.map +1 -1
  154. package/dist/hooks/useForkRef/useForkRef.d.ts +1 -0
  155. package/dist/hooks/useForkRef/useForkRef.js.map +1 -1
  156. package/dist/i18n/I18n.d.ts +9 -1
  157. package/dist/i18n/I18n.js.map +1 -1
  158. package/dist/i18n/en/Company.TimeOff.EmployeeTable.json.js +14 -14
  159. package/dist/i18n/en/Company.TimeOff.SelectEmployees.json.js +12 -18
  160. package/dist/i18n/en/Company.TimeOff.SelectEmployees.json.js.map +1 -1
  161. package/dist/i18n/en/Employee.Compensation.json.js +24 -24
  162. package/dist/i18n/en/Employee.Dashboard.json.js +22 -20
  163. package/dist/i18n/en/Employee.Dashboard.json.js.map +1 -1
  164. package/dist/i18n/en/Employee.PaymentMethod.json.js +25 -25
  165. package/dist/i18n/en/Employee.StateTaxes.json.js +12 -10
  166. package/dist/i18n/en/Employee.StateTaxes.json.js.map +1 -1
  167. package/dist/style.css +1 -1
  168. package/dist/types/hooks.d.ts +1 -1
  169. package/dist/types/i18next.d.ts +4 -17
  170. package/dist/types/observability.d.ts +1 -1
  171. package/package.json +30 -27
  172. package/dist/components/Employee/Dashboard/CompensationCard.d.ts +0 -13
@@ -1,36 +1,36 @@
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";
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 et, addDays as tt } from "../../../../../helpers/dateFormatting.js";
22
- function nt(e, o, n) {
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 a of e) {
26
- const W = a.compensations?.find((I) => I.uuid === o);
27
- if (W) return { compensation: W, job: a };
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((a) => a.uuid === n) ?? null : null };
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 it(e) {
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 ot(e) {
42
+ function st(e) {
43
43
  if (!e?.compensations) return [];
44
- const o = ce();
44
+ const o = de();
45
45
  return e.compensations.filter((n) => n.effectiveDate !== void 0 && n.effectiveDate > o);
46
46
  }
47
- function st(e) {
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 me = [
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
- ], at = me.map((e) => ({ value: e, label: e })), le = [
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
- ], rt = le.map((e) => ({ value: e, label: e }));
67
- function ce() {
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 Tt({
70
+ function wt({
71
71
  employeeId: e,
72
72
  jobId: o,
73
73
  compensationId: n,
74
74
  optionalFieldsToRequire: r,
75
- defaultValues: a,
75
+ defaultValues: s,
76
76
  validationMode: W = "onSubmit",
77
- shouldFocusError: I = !0,
77
+ shouldFocusError: R = !0,
78
78
  withEffectiveDateField: E = !0
79
79
  }) {
80
- const R = Re(
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 ? Te.AllCompensations : void 0
86
+ include: n ? we.AllCompensations : void 0
87
87
  },
88
88
  { enabled: !!e }
89
- ), T = _e(
89
+ ), w = Je(
90
90
  { employeeId: e ?? "" },
91
91
  { enabled: !!e }
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(
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
- ), 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
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, Q = ot(s).filter(
104
+ f?.find((t) => t.primary)?.hireDate ?? null, K = st(a).filter(
105
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: _,
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: F,
113
+ hireDate: N,
114
114
  minEffectiveDate: h,
115
115
  withEffectiveDateField: E
116
116
  }),
117
- [_, r, F, h, E]
118
- ), x = B?.state, P = U(
117
+ [J, r, N, h, E]
118
+ ), z = G?.state, P = I(
119
119
  () => ({
120
- title: u?.title ?? s?.title ?? a?.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: 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
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, s, a, N, J]
132
- ), S = Ue({
133
- resolver: Ie($),
131
+ [u, a, s, F, V]
132
+ ), S = Ie({
133
+ resolver: Re(x),
134
134
  mode: W,
135
- shouldFocusError: I,
135
+ shouldFocusError: R,
136
136
  defaultValues: P,
137
137
  values: P,
138
138
  resetOptions: { keepDirtyValues: !0 }
139
- }), { control: z, getValues: g, setValue: m } = S, l = ue({ control: z, name: "flsaStatus" }), Ee = ue({
140
- control: z,
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
- 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, {
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
- }), V.current = null, A.current = !1);
151
+ }), X.current = null, U.current = !1);
152
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) => ({
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 = 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 = {
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: ie,
173
- maxDate: K
172
+ minDate: oe,
173
+ maxDate: $
174
174
  },
175
- flsaStatus: H(
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: H(
190
+ minimumWageId: B(
191
191
  v.minimumWageId,
192
- We,
192
+ Ce,
193
193
  C
194
194
  )
195
195
  }, Ne = async (t) => {
196
196
  let O;
197
- return await new Promise((oe) => {
197
+ return await new Promise((se) => {
198
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 = {
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: Ae,
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 (ae === "create") {
212
- if (!se)
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 ee.mutateAsync({
218
+ if (D = (await te.mutateAsync({
219
219
  request: {
220
- jobId: se,
221
- compensationsRequestBody: { ...re, flsaStatus: c.flsaStatus }
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 (!X)
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 k = t?.compensationVersion ?? u?.version;
230
- if (!k)
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 Z.mutateAsync({
234
+ if (D = (await ee.mutateAsync({
235
235
  request: {
236
- compensationId: X,
236
+ compensationId: k,
237
237
  compensationsUpdateRequestBody: {
238
- version: k,
239
- ...re
238
+ version: Y,
239
+ ...ue
240
240
  }
241
241
  }
242
242
  })).compensation, !D) throw new M("Compensation update failed");
243
243
  }
244
- O = { mode: ae, data: D };
245
- }), oe();
244
+ O = { mode: re, data: D };
245
+ }), se();
246
246
  },
247
247
  () => {
248
- oe();
248
+ se();
249
249
  }
250
250
  )();
251
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 } : {
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: s,
257
+ currentJob: a,
258
258
  minimumWages: C,
259
- minimumEffectiveDate: ie,
260
- maximumEffectiveDate: K,
261
- hasPendingFutureCompensation: pe
259
+ minimumEffectiveDate: oe,
260
+ maximumEffectiveDate: $,
261
+ hasPendingFutureCompensation: ve
262
262
  },
263
263
  status: {
264
- isPending: Se,
265
- mode: _,
264
+ isPending: ge,
265
+ mode: J,
266
266
  willDeleteSecondaryJobs: b
267
267
  },
268
268
  actions: { onSubmit: Ne },
269
- errorHandling: te,
269
+ errorHandling: ne,
270
270
  form: {
271
271
  Fields: {
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
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: Ce,
281
- hookFormInternals: he,
282
- getFormSubmissionValues: Qe(S, $)
280
+ fieldsMetadata: Fe,
281
+ hookFormInternals: Pe,
282
+ getFormSubmissionValues: Ke(S, x)
283
283
  }
284
284
  };
285
285
  }
286
286
  export {
287
- Tt as useCompensationForm
287
+ wt as useCompensationForm
288
288
  };
289
289
  //# sourceMappingURL=useCompensationForm.js.map