@gusto/embedded-react-sdk 0.23.1 → 0.24.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/components/Common/PayrollLoading/PayrollLoading.d.ts +2 -0
  3. package/dist/components/Common/PayrollLoading/PayrollLoading.js +19 -0
  4. package/dist/components/Common/PayrollLoading/PayrollLoading.js.map +1 -0
  5. package/dist/components/Common/PayrollLoading/PayrollLoadingTypes.d.ts +5 -0
  6. package/dist/components/Common/PayrollLoading/index.d.ts +3 -0
  7. package/dist/components/Common/SignatureForm/SignatureForm.js +11 -12
  8. package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
  9. package/dist/components/Common/SignatureForm/SignatureFormActions.js +1 -1
  10. package/dist/components/Common/SignatureForm/SignatureFormFields.js +2 -2
  11. package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
  12. package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
  13. package/dist/components/Common/index.d.ts +1 -0
  14. package/dist/components/Company/AssignSignatory/AssignSignatory.js +1 -1
  15. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +1 -1
  16. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +1 -1
  17. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +12 -12
  18. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +3 -4
  19. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  20. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +1 -1
  21. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +1 -1
  22. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +3 -4
  23. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  24. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +5 -6
  25. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  26. package/dist/components/Company/BankAccount/BankAccountForm/Form.js +5 -6
  27. package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
  28. package/dist/components/Company/BankAccount/BankAccountForm/context.js +3 -4
  29. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  30. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +5 -6
  31. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
  32. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +2 -2
  33. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +3 -4
  34. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  35. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +2 -2
  36. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +3 -4
  37. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  38. package/dist/components/Company/FederalTaxes/FederalTaxes.js +2 -2
  39. package/dist/components/Company/FederalTaxes/Form.js +3 -4
  40. package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
  41. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +8 -9
  42. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  43. package/dist/components/Company/Industry/Context.js +6 -7
  44. package/dist/components/Company/Industry/Context.js.map +1 -1
  45. package/dist/components/Company/Locations/LocationForm/Form.js +1 -1
  46. package/dist/components/Company/Locations/LocationForm/LocationForm.js +2 -2
  47. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +3 -4
  48. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  49. package/dist/components/Company/Locations/LocationsList/LocationsList.js +2 -2
  50. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +3 -4
  51. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  52. package/dist/components/Company/OnboardingOverview/Completed.js +2 -3
  53. package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
  54. package/dist/components/Company/OnboardingOverview/MissingRequirements.js +2 -3
  55. package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
  56. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +2 -2
  57. package/dist/components/Company/OnboardingOverview/context.js +3 -4
  58. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  59. package/dist/components/Company/PaySchedule/PaySchedule.js +2 -2
  60. package/dist/components/Company/PaySchedule/_parts/Edit.js +15 -15
  61. package/dist/components/Company/PaySchedule/_parts/Head.js +8 -9
  62. package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
  63. package/dist/components/Company/PaySchedule/_parts/List.js +11 -12
  64. package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
  65. package/dist/components/Company/PaySchedule/usePaySchedule.js +5 -6
  66. package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
  67. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +3 -4
  68. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  69. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +3 -4
  70. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  71. package/dist/components/Contractor/Address/Address.js +2 -2
  72. package/dist/components/Contractor/Address/Form.js +1 -1
  73. package/dist/components/Contractor/Address/useAddress.js +5 -6
  74. package/dist/components/Contractor/Address/useAddress.js.map +1 -1
  75. package/dist/components/Contractor/ContractorList/index.js +17 -17
  76. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +2 -2
  77. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +1 -1
  78. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js +13 -14
  79. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js.map +1 -1
  80. package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js +10 -10
  81. package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js +9 -10
  82. package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js.map +1 -1
  83. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js +2 -3
  84. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js.map +1 -1
  85. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +12 -13
  86. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -1
  87. package/dist/components/Contractor/Profile/ContractorProfileForm.js +15 -15
  88. package/dist/components/Contractor/Profile/useContractorProfile.js +2 -3
  89. package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
  90. package/dist/components/Contractor/Submit/Submit.js +1 -1
  91. package/dist/components/Employee/Compensation/Edit.js +14 -14
  92. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +10 -11
  93. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
  94. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +11 -12
  95. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
  96. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +11 -12
  97. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +1 -1
  98. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +1 -1
  99. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +1 -1
  100. package/dist/components/Employee/DocumentSigner/DocumentList/List.js +2 -3
  101. package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
  102. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +3 -4
  103. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  104. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +1 -1
  105. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +3 -4
  106. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  107. package/dist/components/Employee/EmployeeList/EmployeeList.js +3 -4
  108. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  109. package/dist/components/Employee/EmployeeList/Head.js +2 -3
  110. package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
  111. package/dist/components/Employee/EmployeeList/useEmployeeList.js +3 -4
  112. package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
  113. package/dist/components/Employee/FederalTaxes/FederalForm.js +9 -7
  114. package/dist/components/Employee/FederalTaxes/FederalForm.js.map +1 -1
  115. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +3 -4
  116. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
  117. package/dist/components/Employee/Landing/Landing.js +8 -8
  118. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +7 -7
  119. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +2 -2
  120. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +1 -1
  121. package/dist/components/Employee/PaymentMethod/Split.js +8 -8
  122. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +5 -6
  123. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
  124. package/dist/components/Employee/Profile/AdminPersonalDetails.js +1 -1
  125. package/dist/components/Employee/Profile/HomeAddress.js +1 -1
  126. package/dist/components/Employee/Profile/PersonalDetailsInputs.js +2 -2
  127. package/dist/components/Employee/Profile/useProfile.js +3 -4
  128. package/dist/components/Employee/Profile/useProfile.js.map +1 -1
  129. package/dist/components/Employee/StateTaxes/useStateTaxes.js +3 -4
  130. package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
  131. package/dist/components/Employee/Taxes/FederalForm.js +8 -6
  132. package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
  133. package/dist/components/Employee/Taxes/useTaxes.js +3 -4
  134. package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
  135. package/dist/components/Flow/Flow.js +2 -3
  136. package/dist/components/Flow/Flow.js.map +1 -1
  137. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.d.ts +4 -4
  138. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.js +26 -21
  139. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.js.map +1 -1
  140. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +9 -9
  141. package/dist/components/Payroll/ConfirmWireDetails/index.d.ts +1 -1
  142. package/dist/components/Payroll/ConfirmWireDetails/types.d.ts +8 -1
  143. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js +6 -7
  144. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js.map +1 -1
  145. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +2 -3
  146. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js.map +1 -1
  147. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.d.ts +2 -1
  148. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +56 -54
  149. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
  150. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +2 -1
  151. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +90 -91
  152. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
  153. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.d.ts +2 -1
  154. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +33 -31
  155. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
  156. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.d.ts +2 -1
  157. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +72 -71
  158. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
  159. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +8 -9
  160. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
  161. package/dist/components/Payroll/PayrollFlow/PayrollFlow.d.ts +1 -1
  162. package/dist/components/Payroll/PayrollFlow/PayrollFlow.js +24 -18
  163. package/dist/components/Payroll/PayrollFlow/PayrollFlow.js.map +1 -1
  164. package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.d.ts +5 -0
  165. package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js +77 -51
  166. package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js.map +1 -1
  167. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +17 -18
  168. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
  169. package/dist/components/Payroll/PayrollLanding/PayrollLanding.d.ts +4 -1
  170. package/dist/components/Payroll/PayrollLanding/PayrollLanding.js +29 -21
  171. package/dist/components/Payroll/PayrollLanding/PayrollLanding.js.map +1 -1
  172. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.d.ts +5 -0
  173. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js +36 -26
  174. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js.map +1 -1
  175. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +16 -17
  176. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
  177. package/dist/components/Payroll/PayrollOverview/PayrollOverview.d.ts +4 -1
  178. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +70 -60
  179. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
  180. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.d.ts +2 -1
  181. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +237 -232
  182. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
  183. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js +2 -3
  184. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js.map +1 -1
  185. package/dist/components/Payroll/PayrollReceipts/PayrollReceipts.d.ts +2 -1
  186. package/dist/components/Payroll/PayrollReceipts/PayrollReceipts.js +25 -15
  187. package/dist/components/Payroll/PayrollReceipts/PayrollReceipts.js.map +1 -1
  188. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.d.ts +2 -1
  189. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +152 -138
  190. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
  191. package/dist/components/Payroll/index.d.ts +1 -0
  192. package/dist/components/Payroll/usePreparedPayrollData.js +5 -6
  193. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  194. package/dist/contexts/ApiProvider/ApiProvider.d.ts +3 -1
  195. package/dist/contexts/ApiProvider/ApiProvider.js +26 -18
  196. package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -1
  197. package/dist/contexts/ComponentAdapter/componentAdapterTypes.d.ts +1 -0
  198. package/dist/contexts/ComponentAdapter/useComponentContext.d.ts +2 -0
  199. package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
  200. package/dist/contexts/GustoProvider/GustoProvider.d.ts +2 -0
  201. package/dist/contexts/GustoProvider/GustoProvider.js +12 -11
  202. package/dist/contexts/GustoProvider/GustoProvider.js.map +1 -1
  203. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +24 -14
  204. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
  205. package/dist/i18n/en/common.json.d.ts +1 -0
  206. package/dist/i18n/en/common.json.js +1 -1
  207. package/dist/index.d.ts +1 -0
  208. package/dist/shared/constants.d.ts +1 -1
  209. package/dist/shared/constants.js +6 -5
  210. package/dist/shared/constants.js.map +1 -1
  211. package/dist/style.css +1 -1
  212. package/dist/types/i18next.d.ts +1 -0
  213. package/package.json +5 -5
@@ -12,18 +12,17 @@ import { useComponentContext as z } from "../../../../contexts/ComponentAdapter/
12
12
  import { Form as X } from "../../../Common/Form/Form.js";
13
13
  import { Flex as $ } from "../../../Common/Flex/Flex.js";
14
14
  import "classnames";
15
- import { componentEvents as g } from "../../../../shared/constants.js";
16
- import { TextInputField as J } from "../../../Common/Fields/TextInputField/TextInputField.js";
17
- import { ActionsLayout as Q } from "../../../Common/ActionsLayout/ActionsLayout.js";
18
- import { NumberInputField as C } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
15
+ import { ActionsLayout as J } from "../../../Common/ActionsLayout/ActionsLayout.js";
19
16
  import "react-error-boundary";
20
17
  import "@gusto/embedded-api/models/errors/apierror";
21
18
  import "@gusto/embedded-api/models/errors/sdkvalidationerror";
22
19
  import "@tanstack/react-query";
23
- import { useBase as Z } from "../../../Base/useBase.js";
24
- import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
20
+ import { useBase as Q } from "../../../Base/useBase.js";
21
+ import { componentEvents as g } from "../../../../shared/constants.js";
25
22
  import "dompurify";
26
23
  import { SelectField as d } from "../../../Common/Fields/SelectField/SelectField.js";
24
+ import { TextInputField as Z } from "../../../Common/Fields/TextInputField/TextInputField.js";
25
+ import { NumberInputField as C } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
27
26
  const ee = 0, re = 0, te = 100, ne = i.nativeEnum(H), ie = i.object({
28
27
  state: i.string(),
29
28
  fipsCode: i.string(),
@@ -34,7 +33,7 @@ const ee = 0, re = 0, te = 100, ne = i.nativeEnum(H), ie = i.object({
34
33
  payPeriodMaximum: i.number().min(0).transform((r) => r > 0 ? r.toString() : null).nullable(),
35
34
  paymentPeriod: ne
36
35
  });
37
- function ve({
36
+ function Te({
38
37
  deduction: r,
39
38
  handleStateAgencySelect: M,
40
39
  stateAgencies: S,
@@ -42,7 +41,7 @@ function ve({
42
41
  employeeId: A,
43
42
  selectedAgency: b
44
43
  }) {
45
- const { onEvent: h, baseSubmitHandler: _ } = Z(), { t: e } = k("Employee.Deductions"), o = z(), y = {
44
+ const { onEvent: h, baseSubmitHandler: _ } = Q(), { t: e } = k("Employee.Deductions"), o = z(), y = {
46
45
  case_number: {
47
46
  name: "caseNumber",
48
47
  description: e("caseNumberDescription")
@@ -148,7 +147,7 @@ function ve({
148
147
  }
149
148
  ),
150
149
  R.map(({ name: t, label: a, description: s }) => /* @__PURE__ */ n(
151
- J,
150
+ Z,
152
151
  {
153
152
  name: t,
154
153
  label: a,
@@ -211,11 +210,11 @@ function ve({
211
210
  /* @__PURE__ */ n(o.Text, { weight: "bold", children: e("manualPaymentRequired") }),
212
211
  /* @__PURE__ */ n(o.Text, { children: e("manualPaymentRequiredDescription") })
213
212
  ] }),
214
- /* @__PURE__ */ n(Q, { children: /* @__PURE__ */ n(o.Button, { type: "submit", isLoading: F, children: e("saveCta") }) })
213
+ /* @__PURE__ */ n(J, { children: /* @__PURE__ */ n(o.Button, { type: "submit", isLoading: F, children: e("saveCta") }) })
215
214
  ] })
216
215
  ] }) }) });
217
216
  }
218
217
  export {
219
- ve as default
218
+ Te as default
220
219
  };
221
220
  //# sourceMappingURL=ChildSupportForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChildSupportForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/ChildSupportForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { useEffect, useMemo } from 'react'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { PaymentPeriod } from '@gusto/embedded-api/models/components/garnishmentchildsupport'\nimport type { GarnishmentType } from '@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { type Agencies } from '@gusto/embedded-api/models/components/childsupportdata'\nimport styles from './ChildSupportForm.module.scss'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { NumberInputField, TextInputField, SelectField } from '@/components/Common'\nimport { type CommonComponentInterface, useBase } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\n\nconst MINIMUM_PAY_PERIOD_AMOUNT = 0\nconst MINIMUM_PAYCHECK_PERCENTAGE = 0\nconst MAXIMUM_PAYCHECK_PERCENTAGE = 100\n\nconst ChildSupportPaymentPeriodSchema = z.nativeEnum(PaymentPeriod)\nconst ChildSupportSchema = z.object({\n state: z.string(),\n fipsCode: z.string(),\n caseNumber: z.string().nullable(),\n orderNumber: z.string().nullable(),\n remittanceNumber: z.string().nullable(),\n amount: z.number().min(0).transform(String),\n payPeriodMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n paymentPeriod: ChildSupportPaymentPeriodSchema,\n})\n\nexport type ChildSupportInputs = z.input<typeof ChildSupportSchema>\nexport type ChildSupportPayload = z.output<typeof ChildSupportSchema>\n\ninterface ChildSupportFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n handleStateAgencySelect: (stateAgency: string) => void\n stateAgencies: { label: string; value: string }[]\n counties: { label: string; value: string }[]\n selectedAgency?: Agencies\n}\n\nfunction ChildSupportForm({\n deduction,\n handleStateAgencySelect,\n stateAgencies,\n counties,\n employeeId,\n selectedAgency,\n}: ChildSupportFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n const ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER = {\n case_number: {\n name: 'caseNumber',\n description: t('caseNumberDescription'),\n },\n order_number: {\n name: 'orderNumber',\n description: t('orderNumberDescription'),\n },\n remittance_number: {\n name: 'remittanceNumber',\n description: t('remittanceNumberDescription'),\n },\n }\n const requiredSelectedAgencyAttributes =\n selectedAgency?.requiredAttributes?.map(attr => {\n return {\n name: ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER[attr.key!].name,\n label: attr.label as string,\n description: ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER[attr.key!].description,\n }\n }) || []\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n const isPending = isPendingCreate || isPendingUpdate\n\n const defaultChildSupportValues: ChildSupportInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n payPeriodMaximum: deduction?.payPeriodMaximum ? Number(deduction.payPeriodMaximum) : null,\n state: deduction?.childSupport?.state || '',\n fipsCode: deduction?.childSupport?.fipsCode || '',\n caseNumber: deduction?.childSupport?.caseNumber || null,\n orderNumber: deduction?.childSupport?.orderNumber || null,\n remittanceNumber: deduction?.childSupport?.remittanceNumber || null,\n paymentPeriod: deduction?.childSupport?.paymentPeriod as PaymentPeriod,\n }\n }, [deduction])\n\n const childSupportFormMethods = useForm<ChildSupportInputs, unknown, ChildSupportPayload>({\n resolver: zodResolver(ChildSupportSchema),\n defaultValues: defaultChildSupportValues,\n })\n const { reset: resetChildSupportForm, setValue, control } = childSupportFormMethods\n const watchedStateAgency = useWatch({ control, name: 'state' })\n\n useEffect(() => {\n resetChildSupportForm(defaultChildSupportValues)\n }, [deduction, defaultChildSupportValues, resetChildSupportForm])\n\n // if in edit mode and user elects to change state agency, reset the required attribute values\n // as new selected agency might require different payload inputs, e.g. OH requires case number + order number\n useEffect(() => {\n setValue('caseNumber', null)\n setValue('orderNumber', null)\n setValue('remittanceNumber', null)\n }, [watchedStateAgency, setValue])\n\n const onChildSupportSubmit: SubmitHandler<ChildSupportPayload> = async data => {\n const childSupport = {\n state: data.state,\n paymentPeriod: data.paymentPeriod,\n fipsCode: data.fipsCode,\n caseNumber: data.caseNumber,\n orderNumber: data.orderNumber,\n remittanceNumber: data.remittanceNumber,\n }\n\n await baseSubmitHandler(data, async payload => {\n const requestBody = {\n active: true,\n amount: payload.amount,\n description: `Child Support - ${childSupport.caseNumber}`, // child support description follows prefix type + case number convention\n courtOrdered: true,\n garnishmentType: 'child_support' as GarnishmentType,\n times: null,\n deductAsPercentage: true, // child support must always deduct as percentage up to a pay period maximum limit and is recurring until cancelled\n payPeriodMaximum: payload.payPeriodMaximum,\n recurring: true,\n childSupport,\n }\n\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId,\n requestBody,\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...requestBody,\n version: deduction.version as string,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const isManualPaymentRequired = selectedAgency?.manualPaymentRequired\n\n return (\n <FormProvider {...childSupportFormMethods}>\n <Form onSubmit={childSupportFormMethods.handleSubmit(onChildSupportSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n <Components.Heading as=\"h3\">{t('childSupportTitle')}</Components.Heading>\n <SelectField\n name=\"state\"\n label={t('agency')}\n description={t('agencyDescription')}\n options={stateAgencies}\n onChange={handleStateAgencySelect}\n isRequired\n />\n {watchedStateAgency && (\n <>\n <SelectField\n name=\"fipsCode\"\n label={t('county')}\n description={t('countyDescription')}\n options={counties}\n isRequired\n />\n {/* render required inputs for respective agency, e.g. OH requires case number + order number */}\n {requiredSelectedAgencyAttributes.map(({ name, label, description }) => (\n <TextInputField\n key={name}\n name={name}\n label={label}\n description={description}\n isRequired\n />\n ))}\n <NumberInputField\n name=\"payPeriodMaximum\"\n label={t('totalAmountWithheld')}\n description={t('totalAmountWithheldDescription')}\n min={MINIMUM_PAY_PERIOD_AMOUNT}\n adornmentStart=\"$\"\n isRequired\n />\n <NumberInputField\n name=\"amount\"\n label={t('maxPaycheckPercentage')}\n description={t('maxPaycheckPercentageDescription')}\n isRequired\n min={MINIMUM_PAYCHECK_PERCENTAGE}\n max={MAXIMUM_PAYCHECK_PERCENTAGE}\n adornmentEnd=\"%\"\n />\n <SelectField\n name=\"paymentPeriod\"\n label={t('per')}\n description={t('perDescription')}\n options={[\n {\n label: t('everyWeek'),\n value: 'Every week',\n },\n {\n label: t('everyOtherWeek'),\n value: 'Every other week',\n },\n {\n label: t('twicePerMonth'),\n value: 'Twice per month',\n },\n {\n label: t('monthly'),\n value: 'Monthly',\n },\n ]}\n isRequired\n />\n {isManualPaymentRequired && (\n <section className={styles.manualPaymentReminderBanner}>\n <Components.Text weight=\"bold\">{t('manualPaymentRequired')}</Components.Text>\n <Components.Text>{t('manualPaymentRequiredDescription')}</Components.Text>\n </section>\n )}\n <ActionsLayout>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('saveCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n )}\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n\nexport default ChildSupportForm\n"],"names":["MINIMUM_PAY_PERIOD_AMOUNT","MINIMUM_PAYCHECK_PERCENTAGE","MAXIMUM_PAYCHECK_PERCENTAGE","ChildSupportPaymentPeriodSchema","z","PaymentPeriod","ChildSupportSchema","val","ChildSupportForm","deduction","handleStateAgencySelect","stateAgencies","counties","employeeId","selectedAgency","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER","requiredSelectedAgencyAttributes","attr","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultChildSupportValues","useMemo","childSupportFormMethods","useForm","zodResolver","resetChildSupportForm","setValue","control","watchedStateAgency","useWatch","useEffect","onChildSupportSubmit","data","childSupport","payload","requestBody","updateDeductionResponse","componentEvents","createDeductionResponse","isManualPaymentRequired","FormProvider","jsx","Form","jsxs","Flex","SelectField","Fragment","name","label","description","TextInputField","NumberInputField","styles","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAMA,KAA4B,GAC5BC,KAA8B,GAC9BC,KAA8B,KAE9BC,KAAkCC,EAAE,WAAWC,CAAa,GAC5DC,KAAqBF,EAAE,OAAO;AAAA,EAClC,OAAOA,EAAE,OAAA;AAAA,EACT,UAAUA,EAAE,OAAA;AAAA,EACZ,YAAYA,EAAE,OAAA,EAAS,SAAA;AAAA,EACvB,aAAaA,EAAE,OAAA,EAAS,SAAA;AAAA,EACxB,kBAAkBA,EAAE,OAAA,EAAS,SAAA;AAAA,EAC7B,QAAQA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,UAAU,MAAM;AAAA,EAC1C,kBAAkBA,EACf,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAG,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,eAAeJ;AACjB,CAAC;AAcD,SAASK,GAAiB;AAAA,EACxB,WAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC;AAAA,EACA,gBAAAC;AACF,GAA0B;AACxB,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,EAAA,GACjC,EAAE,GAAAC,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA,GAEbC,IAAqC;AAAA,IACzC,aAAa;AAAA,MACX,MAAM;AAAA,MACN,aAAaJ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E,uBAAuB;AAAA,UAChC,aAAaA,EAAE,kCAAkC;AAAA,UACjD,YAAU;AAAA,UACV,KAAKjB;AAAA,UACL,KAAKC;AAAA,UACL,cAAa;AAAA,QAAA;AAAA,MAAA;AAAA,MAEf,gBAAAmD;AAAA,QAACI;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,OAAOvC,EAAE,KAAK;AAAA,UACd,aAAaA,EAAE,gBAAgB;AAAA,UAC/B,SAAS;AAAA,YACP;AAAA,cACE,OAAOA,EAAE,WAAW;AAAA,cACpB,OAAO;AAAA,YAAA;AAAA,YAET;AAAA,cACE,OAAOA,EAAE,gBAAgB;AAAA,cACzB,OAAO;AAAA,YAAA;AAAA,YAET;AAAA,cACE,OAAOA,EAAE,eAAe;AAAA,cACxB,OAAO;AAAA,YAAA;AAAA,YAET;AAAA,cACE,OAAOA,EAAE,SAAS;AAAA,cAClB,OAAO;AAAA,YAAA;AAAA,UACT;AAAA,UAEF,YAAU;AAAA,QAAA;AAAA,MAAA;AAAA,MAEXiC,KACC,gBAAAI,EAAC,WAAA,EAAQ,WAAWS,EAAO,6BACzB,UAAA;AAAA,QAAA,gBAAAX,EAACjC,EAAW,MAAX,EAAgB,QAAO,QAAQ,UAAAF,EAAE,uBAAuB,GAAE;AAAA,0BAC1DE,EAAW,MAAX,EAAiB,UAAAF,EAAE,kCAAkC,EAAA,CAAE;AAAA,MAAA,GAC1D;AAAA,MAEF,gBAAAmC,EAACY,GAAA,EACC,UAAA,gBAAAZ,EAACjC,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWW,GACzC,UAAAb,EAAE,SAAS,GACd,EAAA,CACF;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,EAAA,CAEJ,GACF,GACF;AAEJ;"}
1
+ {"version":3,"file":"ChildSupportForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/ChildSupportForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { useEffect, useMemo } from 'react'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { PaymentPeriod } from '@gusto/embedded-api/models/components/garnishmentchildsupport'\nimport type { GarnishmentType } from '@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { type Agencies } from '@gusto/embedded-api/models/components/childsupportdata'\nimport styles from './ChildSupportForm.module.scss'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { NumberInputField, TextInputField, SelectField } from '@/components/Common'\nimport { type CommonComponentInterface, useBase } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\n\nconst MINIMUM_PAY_PERIOD_AMOUNT = 0\nconst MINIMUM_PAYCHECK_PERCENTAGE = 0\nconst MAXIMUM_PAYCHECK_PERCENTAGE = 100\n\nconst ChildSupportPaymentPeriodSchema = z.nativeEnum(PaymentPeriod)\nconst ChildSupportSchema = z.object({\n state: z.string(),\n fipsCode: z.string(),\n caseNumber: z.string().nullable(),\n orderNumber: z.string().nullable(),\n remittanceNumber: z.string().nullable(),\n amount: z.number().min(0).transform(String),\n payPeriodMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n paymentPeriod: ChildSupportPaymentPeriodSchema,\n})\n\nexport type ChildSupportInputs = z.input<typeof ChildSupportSchema>\nexport type ChildSupportPayload = z.output<typeof ChildSupportSchema>\n\ninterface ChildSupportFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n handleStateAgencySelect: (stateAgency: string) => void\n stateAgencies: { label: string; value: string }[]\n counties: { label: string; value: string }[]\n selectedAgency?: Agencies\n}\n\nfunction ChildSupportForm({\n deduction,\n handleStateAgencySelect,\n stateAgencies,\n counties,\n employeeId,\n selectedAgency,\n}: ChildSupportFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n const ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER = {\n case_number: {\n name: 'caseNumber',\n description: t('caseNumberDescription'),\n },\n order_number: {\n name: 'orderNumber',\n description: t('orderNumberDescription'),\n },\n remittance_number: {\n name: 'remittanceNumber',\n description: t('remittanceNumberDescription'),\n },\n }\n const requiredSelectedAgencyAttributes =\n selectedAgency?.requiredAttributes?.map(attr => {\n return {\n name: ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER[attr.key!].name,\n label: attr.label as string,\n description: ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER[attr.key!].description,\n }\n }) || []\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n const isPending = isPendingCreate || isPendingUpdate\n\n const defaultChildSupportValues: ChildSupportInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n payPeriodMaximum: deduction?.payPeriodMaximum ? Number(deduction.payPeriodMaximum) : null,\n state: deduction?.childSupport?.state || '',\n fipsCode: deduction?.childSupport?.fipsCode || '',\n caseNumber: deduction?.childSupport?.caseNumber || null,\n orderNumber: deduction?.childSupport?.orderNumber || null,\n remittanceNumber: deduction?.childSupport?.remittanceNumber || null,\n paymentPeriod: deduction?.childSupport?.paymentPeriod as PaymentPeriod,\n }\n }, [deduction])\n\n const childSupportFormMethods = useForm<ChildSupportInputs, unknown, ChildSupportPayload>({\n resolver: zodResolver(ChildSupportSchema),\n defaultValues: defaultChildSupportValues,\n })\n const { reset: resetChildSupportForm, setValue, control } = childSupportFormMethods\n const watchedStateAgency = useWatch({ control, name: 'state' })\n\n useEffect(() => {\n resetChildSupportForm(defaultChildSupportValues)\n }, [deduction, defaultChildSupportValues, resetChildSupportForm])\n\n // if in edit mode and user elects to change state agency, reset the required attribute values\n // as new selected agency might require different payload inputs, e.g. OH requires case number + order number\n useEffect(() => {\n setValue('caseNumber', null)\n setValue('orderNumber', null)\n setValue('remittanceNumber', null)\n }, [watchedStateAgency, setValue])\n\n const onChildSupportSubmit: SubmitHandler<ChildSupportPayload> = async data => {\n const childSupport = {\n state: data.state,\n paymentPeriod: data.paymentPeriod,\n fipsCode: data.fipsCode,\n caseNumber: data.caseNumber,\n orderNumber: data.orderNumber,\n remittanceNumber: data.remittanceNumber,\n }\n\n await baseSubmitHandler(data, async payload => {\n const requestBody = {\n active: true,\n amount: payload.amount,\n description: `Child Support - ${childSupport.caseNumber}`, // child support description follows prefix type + case number convention\n courtOrdered: true,\n garnishmentType: 'child_support' as GarnishmentType,\n times: null,\n deductAsPercentage: true, // child support must always deduct as percentage up to a pay period maximum limit and is recurring until cancelled\n payPeriodMaximum: payload.payPeriodMaximum,\n recurring: true,\n childSupport,\n }\n\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId,\n requestBody,\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...requestBody,\n version: deduction.version as string,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const isManualPaymentRequired = selectedAgency?.manualPaymentRequired\n\n return (\n <FormProvider {...childSupportFormMethods}>\n <Form onSubmit={childSupportFormMethods.handleSubmit(onChildSupportSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n <Components.Heading as=\"h3\">{t('childSupportTitle')}</Components.Heading>\n <SelectField\n name=\"state\"\n label={t('agency')}\n description={t('agencyDescription')}\n options={stateAgencies}\n onChange={handleStateAgencySelect}\n isRequired\n />\n {watchedStateAgency && (\n <>\n <SelectField\n name=\"fipsCode\"\n label={t('county')}\n description={t('countyDescription')}\n options={counties}\n isRequired\n />\n {/* render required inputs for respective agency, e.g. OH requires case number + order number */}\n {requiredSelectedAgencyAttributes.map(({ name, label, description }) => (\n <TextInputField\n key={name}\n name={name}\n label={label}\n description={description}\n isRequired\n />\n ))}\n <NumberInputField\n name=\"payPeriodMaximum\"\n label={t('totalAmountWithheld')}\n description={t('totalAmountWithheldDescription')}\n min={MINIMUM_PAY_PERIOD_AMOUNT}\n adornmentStart=\"$\"\n isRequired\n />\n <NumberInputField\n name=\"amount\"\n label={t('maxPaycheckPercentage')}\n description={t('maxPaycheckPercentageDescription')}\n isRequired\n min={MINIMUM_PAYCHECK_PERCENTAGE}\n max={MAXIMUM_PAYCHECK_PERCENTAGE}\n adornmentEnd=\"%\"\n />\n <SelectField\n name=\"paymentPeriod\"\n label={t('per')}\n description={t('perDescription')}\n options={[\n {\n label: t('everyWeek'),\n value: 'Every week',\n },\n {\n label: t('everyOtherWeek'),\n value: 'Every other week',\n },\n {\n label: t('twicePerMonth'),\n value: 'Twice per month',\n },\n {\n label: t('monthly'),\n value: 'Monthly',\n },\n ]}\n isRequired\n />\n {isManualPaymentRequired && (\n <section className={styles.manualPaymentReminderBanner}>\n <Components.Text weight=\"bold\">{t('manualPaymentRequired')}</Components.Text>\n <Components.Text>{t('manualPaymentRequiredDescription')}</Components.Text>\n </section>\n )}\n <ActionsLayout>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('saveCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n )}\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n\nexport default ChildSupportForm\n"],"names":["MINIMUM_PAY_PERIOD_AMOUNT","MINIMUM_PAYCHECK_PERCENTAGE","MAXIMUM_PAYCHECK_PERCENTAGE","ChildSupportPaymentPeriodSchema","z","PaymentPeriod","ChildSupportSchema","val","ChildSupportForm","deduction","handleStateAgencySelect","stateAgencies","counties","employeeId","selectedAgency","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER","requiredSelectedAgencyAttributes","attr","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultChildSupportValues","useMemo","childSupportFormMethods","useForm","zodResolver","resetChildSupportForm","setValue","control","watchedStateAgency","useWatch","useEffect","onChildSupportSubmit","data","childSupport","payload","requestBody","updateDeductionResponse","componentEvents","createDeductionResponse","isManualPaymentRequired","FormProvider","jsx","Form","jsxs","Flex","SelectField","Fragment","name","label","description","TextInputField","NumberInputField","styles","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAMA,KAA4B,GAC5BC,KAA8B,GAC9BC,KAA8B,KAE9BC,KAAkCC,EAAE,WAAWC,CAAa,GAC5DC,KAAqBF,EAAE,OAAO;AAAA,EAClC,OAAOA,EAAE,OAAA;AAAA,EACT,UAAUA,EAAE,OAAA;AAAA,EACZ,YAAYA,EAAE,OAAA,EAAS,SAAA;AAAA,EACvB,aAAaA,EAAE,OAAA,EAAS,SAAA;AAAA,EACxB,kBAAkBA,EAAE,OAAA,EAAS,SAAA;AAAA,EAC7B,QAAQA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,UAAU,MAAM;AAAA,EAC1C,kBAAkBA,EACf,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAG,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,eAAeJ;AACjB,CAAC;AAcD,SAASK,GAAiB;AAAA,EACxB,WAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC;AAAA,EACA,gBAAAC;AACF,G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AA,CACF;AAAA,EAAA,EAAA,CAEJ,GACF,GACF;AAEJ;"}
@@ -10,18 +10,17 @@ import { useComponentContext as U } from "../../../../contexts/ComponentAdapter/
10
10
  import { Form as V } from "../../../Common/Form/Form.js";
11
11
  import { Flex as _ } from "../../../Common/Flex/Flex.js";
12
12
  import "classnames";
13
- import { componentEvents as c } from "../../../../shared/constants.js";
14
- import { RadioGroupField as g } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
15
- import { TextInputField as w } from "../../../Common/Fields/TextInputField/TextInputField.js";
16
- import { ActionsLayout as B } from "../../../Common/ActionsLayout/ActionsLayout.js";
17
- import { NumberInputField as d } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
13
+ import { ActionsLayout as w } from "../../../Common/ActionsLayout/ActionsLayout.js";
18
14
  import "react-error-boundary";
19
15
  import "@gusto/embedded-api/models/errors/apierror";
20
16
  import "@gusto/embedded-api/models/errors/sdkvalidationerror";
21
17
  import "@tanstack/react-query";
22
- import { useBase as j } from "../../../Base/useBase.js";
23
- import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
18
+ import { useBase as B } from "../../../Base/useBase.js";
19
+ import { componentEvents as c } from "../../../../shared/constants.js";
24
20
  import "dompurify";
21
+ import { TextInputField as j } from "../../../Common/Fields/TextInputField/TextInputField.js";
22
+ import { RadioGroupField as g } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
23
+ import { NumberInputField as d } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
25
24
  const G = r.object({
26
25
  active: r.boolean(),
27
26
  amount: r.number().min(0).transform(String),
@@ -32,8 +31,8 @@ const G = r.object({
32
31
  totalAmount: r.number().min(0).transform((e) => e > 0 ? e.toString() : null).nullable(),
33
32
  deductAsPercentage: r.boolean()
34
33
  });
35
- function pe({ deduction: e, employeeId: A }) {
36
- const { onEvent: a, baseSubmitHandler: D } = j(), { t: n } = T("Employee.Deductions"), m = U(), { mutateAsync: h, isPending: E } = N(), { mutateAsync: P, isPending: C } = I(), x = E || C, y = R(() => ({
34
+ function de({ deduction: e, employeeId: A }) {
35
+ const { onEvent: a, baseSubmitHandler: D } = B(), { t: n } = T("Employee.Deductions"), m = U(), { mutateAsync: h, isPending: E } = N(), { mutateAsync: P, isPending: C } = I(), x = E || C, y = R(() => ({
37
36
  amount: e?.amount ? Number(e.amount) : 0,
38
37
  description: e?.description ?? "",
39
38
  times: e?.times ?? null,
@@ -75,7 +74,7 @@ function pe({ deduction: e, employeeId: A }) {
75
74
  };
76
75
  return /* @__PURE__ */ t(F, { ...u, children: /* @__PURE__ */ t(V, { onSubmit: u.handleSubmit(v), children: /* @__PURE__ */ t(_, { flexDirection: "column", gap: 32, children: /* @__PURE__ */ l(b, { children: [
77
76
  /* @__PURE__ */ t(m.Heading, { as: "h3", children: n("customDeductionTitle") }),
78
- /* @__PURE__ */ t(w, { name: "description", label: n("descriptionLabelV2"), isRequired: !0 }),
77
+ /* @__PURE__ */ t(j, { name: "description", label: n("descriptionLabelV2"), isRequired: !0 }),
79
78
  /* @__PURE__ */ t(
80
79
  g,
81
80
  {
@@ -137,7 +136,7 @@ function pe({ deduction: e, employeeId: A }) {
137
136
  }
138
137
  )
139
138
  ] }),
140
- /* @__PURE__ */ l(B, { children: [
139
+ /* @__PURE__ */ l(w, { children: [
141
140
  /* @__PURE__ */ t(m.Button, { variant: "secondary", onClick: L, children: n("cancelCta") }),
142
141
  /* @__PURE__ */ t(m.Button, { type: "submit", isLoading: x, children: n(e ? "continueCta" : "addDeductionCta") })
143
142
  ] })
@@ -145,6 +144,6 @@ function pe({ deduction: e, employeeId: A }) {
145
144
  }
146
145
  export {
147
146
  G as DeductionSchema,
148
- pe as default
147
+ de as default
149
148
  };
150
149
  //# sourceMappingURL=CustomDeductionForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomDeductionForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { useMemo } from 'react'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { NumberInputField, TextInputField, RadioGroupField } from '@/components/Common'\nimport { type CommonComponentInterface, useBase } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\n\nexport const DeductionSchema = z.object({\n active: z.boolean(),\n amount: z.number().min(0).transform(String),\n description: z.string().min(1),\n times: z.number().nullable(),\n recurring: z.boolean(),\n annualMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n totalAmount: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n deductAsPercentage: z.boolean(),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ninterface ChildSupportFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n}\n\nfunction CustomDeductionForm({ deduction, employeeId }: ChildSupportFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n const isPending = isPendingCreate || isPendingUpdate\n\n const defaultValues: DeductionInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n description: deduction?.description ?? '',\n times: deduction?.times ?? null,\n recurring: deduction?.recurring ?? true,\n annualMaximum: deduction?.annualMaximum ? Number(deduction.annualMaximum) : null,\n totalAmount: deduction?.totalAmount ? Number(deduction.totalAmount) : null,\n deductAsPercentage: deduction?.deductAsPercentage ?? true,\n active: true,\n } as DeductionInputs\n }, [deduction])\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n const { control } = formMethods\n const watchedRecurring = useWatch({ control, name: 'recurring' })\n const watchedAmountPercentage = useWatch({ control, name: 'deductAsPercentage' })\n\n const onSubmit: SubmitHandler<DeductionPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, courtOrdered: false, times: payload.recurring ? null : 1 }, // custom deductions cannot be court ordered/garnishment\n },\n })\n\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...payload,\n version: deduction.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CANCEL)\n }\n\n return (\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n <>\n <Components.Heading as=\"h3\">{t('customDeductionTitle')}</Components.Heading>\n <TextInputField name=\"description\" label={t('descriptionLabelV2')} isRequired />\n <RadioGroupField\n name=\"recurring\"\n label={t('frequencyLabel')}\n isRequired\n options={[\n { value: true, label: t('frequencyRecurringOptionV2') },\n { value: false, label: t('frequencyOneTimeOptionV2') },\n ]}\n />\n <RadioGroupField\n name=\"deductAsPercentage\"\n label={t('deductionTypeLabelV2')}\n isRequired\n options={[\n { value: true, label: t('deductionTypePercentageOptionV2') },\n { value: false, label: t('deductionTypeFixedAmountOption') },\n ]}\n />\n <NumberInputField\n name=\"amount\"\n adornmentStart={!watchedAmountPercentage && '$'}\n adornmentEnd={watchedAmountPercentage && '%'}\n label={t('deductionAmountLabel')}\n isRequired\n min={0}\n format={watchedAmountPercentage ? 'percent' : 'currency'}\n description={\n watchedAmountPercentage\n ? t('deductionAmountDescriptionPercentage')\n : t('deductionAmountDescriptionFixed')\n }\n />\n {watchedRecurring && (\n <>\n <NumberInputField\n name=\"totalAmount\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('totalAmountLabel')}\n description={t('totalAmountDescription')}\n min={0}\n />\n <NumberInputField\n name=\"annualMaximum\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('annualMaxLabel')}\n min={0}\n description={t('annualMaxDescription')}\n />\n </>\n )}\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {!deduction ? t('addDeductionCta') : t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n\nexport default CustomDeductionForm\n"],"names":["DeductionSchema","z","val","CustomDeductionForm","deduction","employeeId","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultValues","useMemo","formMethods","useForm","zodResolver","control","watchedRecurring","useWatch","watchedAmountPercentage","onSubmit","data","payload","updateDeductionResponse","componentEvents","createDeductionResponse","handleCancel","FormProvider","jsx","Form","Flex","jsxs","Fragment","TextInputField","RadioGroupField","NumberInputField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAgBO,MAAMA,IAAkBC,EAAE,O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AA;AAAA,MAEP,gBAAA4B;AAAA,QAACO;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,gBAAe;AAAA,UACf,QAAO;AAAA,UACP,OAAOnC,EAAE,gBAAgB;AAAA,UACzB,KAAK;AAAA,UACL,aAAaA,EAAE,sBAAsB;AAAA,QAAA;AAAA,MAAA;AAAA,IACvC,GACF;AAAA,sBAEDoC,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAR,EAAC1B,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASwB,GAC7C,UAAA1B,EAAE,WAAW,EAAA,CAChB;AAAA,MACA,gBAAA4B,EAAC1B,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWQ,GACzC,UAAoCV,EAAnCL,IAAqC,gBAAvB,iBAAoC,EAAA,CACtD;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
1
+ {"version":3,"file":"CustomDeductionForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { useMemo } from 'react'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { NumberInputField, TextInputField, RadioGroupField } from '@/components/Common'\nimport { type CommonComponentInterface, useBase } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\n\nexport const DeductionSchema = z.object({\n active: z.boolean(),\n amount: z.number().min(0).transform(String),\n description: z.string().min(1),\n times: z.number().nullable(),\n recurring: z.boolean(),\n annualMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n totalAmount: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n deductAsPercentage: z.boolean(),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ninterface ChildSupportFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n}\n\nfunction CustomDeductionForm({ deduction, employeeId }: ChildSupportFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n const isPending = isPendingCreate || isPendingUpdate\n\n const defaultValues: DeductionInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n description: deduction?.description ?? '',\n times: deduction?.times ?? null,\n recurring: deduction?.recurring ?? true,\n annualMaximum: deduction?.annualMaximum ? Number(deduction.annualMaximum) : null,\n totalAmount: deduction?.totalAmount ? Number(deduction.totalAmount) : null,\n deductAsPercentage: deduction?.deductAsPercentage ?? true,\n active: true,\n } as DeductionInputs\n }, [deduction])\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n const { control } = formMethods\n const watchedRecurring = useWatch({ control, name: 'recurring' })\n const watchedAmountPercentage = useWatch({ control, name: 'deductAsPercentage' })\n\n const onSubmit: SubmitHandler<DeductionPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, courtOrdered: false, times: payload.recurring ? null : 1 }, // custom deductions cannot be court ordered/garnishment\n },\n })\n\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...payload,\n version: deduction.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CANCEL)\n }\n\n return (\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n <>\n <Components.Heading as=\"h3\">{t('customDeductionTitle')}</Components.Heading>\n <TextInputField name=\"description\" label={t('descriptionLabelV2')} isRequired />\n <RadioGroupField\n name=\"recurring\"\n label={t('frequencyLabel')}\n isRequired\n options={[\n { value: true, label: t('frequencyRecurringOptionV2') },\n { value: false, label: t('frequencyOneTimeOptionV2') },\n ]}\n />\n <RadioGroupField\n name=\"deductAsPercentage\"\n label={t('deductionTypeLabelV2')}\n isRequired\n options={[\n { value: true, label: t('deductionTypePercentageOptionV2') },\n { value: false, label: t('deductionTypeFixedAmountOption') },\n ]}\n />\n <NumberInputField\n name=\"amount\"\n adornmentStart={!watchedAmountPercentage && '$'}\n adornmentEnd={watchedAmountPercentage && '%'}\n label={t('deductionAmountLabel')}\n isRequired\n min={0}\n format={watchedAmountPercentage ? 'percent' : 'currency'}\n description={\n watchedAmountPercentage\n ? t('deductionAmountDescriptionPercentage')\n : t('deductionAmountDescriptionFixed')\n }\n />\n {watchedRecurring && (\n <>\n <NumberInputField\n name=\"totalAmount\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('totalAmountLabel')}\n description={t('totalAmountDescription')}\n min={0}\n />\n <NumberInputField\n name=\"annualMaximum\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('annualMaxLabel')}\n min={0}\n description={t('annualMaxDescription')}\n />\n </>\n )}\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {!deduction ? t('addDeductionCta') : t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n\nexport default CustomDeductionForm\n"],"names":["DeductionSchema","z","val","CustomDeductionForm","deduction","employeeId","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultValues","useMemo","formMethods","useForm","zodResolver","control","watchedRecurring","useWatch","watchedAmountPercentage","onSubmit","data","payload","updateDeductionResponse","componentEvents","createDeductionResponse","handleCancel","FormProvider","jsx","Form","Flex","jsxs","Fragment","TextInputField","RadioGroupField","NumberInputField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAgBO,MAAMA,IAAkBC,EAAE,OAAO;AAAA,EACtC,QAAQA,EAAE,QAAA;AAAA,EACV,QAAQA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,UAAU,MAAM;AAAA,EAC1C,aAAaA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC7B,OAAOA,EAAE,OAAA,EAAS,SAAA;AAAA,EAClB,WAAWA,EAAE,QAAA;AAAA,EACb,eAAeA,EACZ,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAC,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,aAAaD,EACV,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAC,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,oBAAoBD,EAAE,QAAA;AACxB,CAAC;AAUD,SAASE,GAAoB,EAAE,WAAAC,GA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,GACF,GACF;AAEJ;"}
@@ -11,18 +11,17 @@ import { useComponentContext as w } from "../../../../contexts/ComponentAdapter/
11
11
  import { Form as B } from "../../../Common/Form/Form.js";
12
12
  import { Flex as G } from "../../../Common/Flex/Flex.js";
13
13
  import "classnames";
14
- import { componentEvents as c } from "../../../../shared/constants.js";
15
- import { RadioGroupField as f } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
16
- import { TextInputField as j } from "../../../Common/Fields/TextInputField/TextInputField.js";
17
- import { ActionsLayout as Y } from "../../../Common/ActionsLayout/ActionsLayout.js";
18
- import { NumberInputField as p } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
14
+ import { ActionsLayout as j } from "../../../Common/ActionsLayout/ActionsLayout.js";
19
15
  import "react-error-boundary";
20
16
  import "@gusto/embedded-api/models/errors/apierror";
21
17
  import "@gusto/embedded-api/models/errors/sdkvalidationerror";
22
18
  import "@tanstack/react-query";
23
- import { useBase as $ } from "../../../Base/useBase.js";
24
- import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
19
+ import { useBase as Y } from "../../../Base/useBase.js";
20
+ import { componentEvents as c } from "../../../../shared/constants.js";
25
21
  import "dompurify";
22
+ import { TextInputField as $ } from "../../../Common/Fields/TextInputField/TextInputField.js";
23
+ import { RadioGroupField as f } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
24
+ import { NumberInputField as p } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
26
25
  const z = r.object({
27
26
  active: r.boolean(),
28
27
  amount: r.number().min(0).transform(String),
@@ -35,13 +34,13 @@ const z = r.object({
35
34
  deductAsPercentage: r.boolean(),
36
35
  garnishmentType: r.nativeEnum(U)
37
36
  });
38
- function he({
37
+ function fe({
39
38
  deduction: e,
40
39
  employeeId: h,
41
40
  selectedGarnishmentType: A,
42
41
  selectedGarnishmentTitle: D
43
42
  }) {
44
- const { onEvent: a, baseSubmitHandler: E } = $(), { t: n } = F("Employee.Deductions"), m = w(), { mutateAsync: y, isPending: P } = V(), { mutateAsync: x, isPending: C } = _(), T = P || C, M = N(() => ({
43
+ const { onEvent: a, baseSubmitHandler: E } = Y(), { t: n } = F("Employee.Deductions"), m = w(), { mutateAsync: y, isPending: P } = V(), { mutateAsync: x, isPending: C } = _(), T = P || C, M = N(() => ({
45
44
  amount: e?.amount ? Number(e.amount) : 0,
46
45
  description: e?.description ?? "",
47
46
  times: e?.times ?? null,
@@ -84,7 +83,7 @@ function he({
84
83
  };
85
84
  return /* @__PURE__ */ t(S, { ...u, children: /* @__PURE__ */ t(B, { onSubmit: u.handleSubmit(O), children: /* @__PURE__ */ t(G, { flexDirection: "column", gap: 32, children: /* @__PURE__ */ l(b, { children: [
86
85
  /* @__PURE__ */ t(m.Heading, { as: "h3", children: D }),
87
- /* @__PURE__ */ t(j, { name: "description", label: n("descriptionLabelV2"), isRequired: !0 }),
86
+ /* @__PURE__ */ t($, { name: "description", label: n("descriptionLabelV2"), isRequired: !0 }),
88
87
  /* @__PURE__ */ t(
89
88
  f,
90
89
  {
@@ -146,7 +145,7 @@ function he({
146
145
  }
147
146
  )
148
147
  ] }),
149
- /* @__PURE__ */ l(Y, { children: [
148
+ /* @__PURE__ */ l(j, { children: [
150
149
  /* @__PURE__ */ t(m.Button, { variant: "secondary", onClick: L, children: n("cancelCta") }),
151
150
  /* @__PURE__ */ t(m.Button, { type: "submit", isLoading: T, children: n(e ? "continueCta" : "addDeductionCta") })
152
151
  ] })
@@ -154,6 +153,6 @@ function he({
154
153
  }
155
154
  export {
156
155
  z as DeductionSchema,
157
- he as default
156
+ fe as default
158
157
  };
159
158
  //# sourceMappingURL=GarnishmentForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GarnishmentForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/GarnishmentForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { useMemo } from 'react'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { GarnishmentType } from '@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { NumberInputField, TextInputField, RadioGroupField } from '@/components/Common'\nimport { type CommonComponentInterface, useBase } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\n\nexport const DeductionSchema = z.object({\n active: z.boolean(),\n amount: z.number().min(0).transform(String),\n description: z.string().min(1),\n courtOrdered: z.boolean(),\n times: z.number().nullable(),\n recurring: z.boolean(),\n annualMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n totalAmount: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n deductAsPercentage: z.boolean(),\n garnishmentType: z.nativeEnum(GarnishmentType),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ninterface GarnishmentFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n selectedGarnishmentType: GarnishmentType\n selectedGarnishmentTitle: string\n}\n\nfunction GarnishmentForm({\n deduction,\n employeeId,\n selectedGarnishmentType,\n selectedGarnishmentTitle,\n}: GarnishmentFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n const isPending = isPendingCreate || isPendingUpdate\n\n const defaultValues: DeductionInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n description: deduction?.description ?? '',\n times: deduction?.times ?? null,\n recurring: deduction?.recurring ?? true,\n annualMaximum: deduction?.annualMaximum ? Number(deduction.annualMaximum) : null,\n totalAmount: deduction?.totalAmount ? Number(deduction.totalAmount) : null,\n deductAsPercentage: deduction?.deductAsPercentage ?? true,\n active: true,\n courtOrdered: true,\n garnishmentType: deduction?.garnishmentType ?? selectedGarnishmentType,\n }\n }, [deduction])\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n const { control } = formMethods\n const watchedRecurring = useWatch({ control, name: 'recurring' })\n const watchedAmountPercentage = useWatch({ control, name: 'deductAsPercentage' })\n\n const onSubmit: SubmitHandler<DeductionPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, times: payload.recurring ? null : 1 },\n },\n })\n\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...payload,\n version: deduction.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CANCEL)\n }\n\n return (\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n <>\n <Components.Heading as=\"h3\">{selectedGarnishmentTitle}</Components.Heading>\n <TextInputField name=\"description\" label={t('descriptionLabelV2')} isRequired />\n <RadioGroupField\n name=\"recurring\"\n label={t('frequencyLabel')}\n isRequired\n options={[\n { value: true, label: t('frequencyRecurringOptionV2') },\n { value: false, label: t('frequencyOneTimeOptionV2') },\n ]}\n />\n <RadioGroupField\n name=\"deductAsPercentage\"\n label={t('deductionTypeLabelV2')}\n isRequired\n options={[\n { value: true, label: t('deductionTypePercentageOptionV2') },\n { value: false, label: t('deductionTypeFixedAmountOption') },\n ]}\n />\n <NumberInputField\n name=\"amount\"\n adornmentStart={!watchedAmountPercentage && '$'}\n adornmentEnd={watchedAmountPercentage && '%'}\n label={t('deductionAmountLabel')}\n isRequired\n min={0}\n format={watchedAmountPercentage ? 'percent' : 'currency'}\n description={\n watchedAmountPercentage\n ? t('deductionAmountDescriptionPercentage')\n : t('deductionAmountDescriptionFixed')\n }\n />\n {watchedRecurring && (\n <>\n <NumberInputField\n name=\"totalAmount\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('totalAmountLabel')}\n description={t('totalAmountDescription')}\n min={0}\n />\n <NumberInputField\n name=\"annualMaximum\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('annualMaxLabel')}\n min={0}\n description={t('annualMaxDescription')}\n />\n </>\n )}\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {!deduction ? t('addDeductionCta') : t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n\nexport default GarnishmentForm\n"],"names":["DeductionSchema","z","val","GarnishmentType","GarnishmentForm","deduction","employeeId","selectedGarnishmentType","selectedGarnishmentTitle","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultValues","useMemo","formMethods","useForm","zodResolver","control","watchedRecurring","useWatch","watchedAmountPercentage","onSubmit","data","payload","updateDeductionResponse","componentEvents","createDeductionResponse","handleCancel","FormProvider","jsx","Form","Flex","jsxs","Fragment","TextInputField","RadioGroupField","NumberInputField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAiBO,MAAMA,IAAkBC,EAAE,OAAO;AAAA,EACtC,QAAQA,EAAE,QAAA;AAAA,EACV,QAAQA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,UAAU,MAAM;AAAA,EAC1C,aAAaA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC7B,cAAcA,EAAE,QAAA;AAAA,EAChB,OAAOA,EAAE,OAAA,EAAS,SAAA;AAAA,EAClB,WAAWA,EAAE,QAAA;AAAA,EACb,eAAeA,EACZ,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAC,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,aAAaD,EACV,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAC,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,oBAAoBD,EAAE,QAAA;AAAA,EACtB,iBAAiBA,EAAE,WAAWE,CAAe;AAC/C,CAAC;AAYD,SAASC,GAAgB;AAAA,EACvB,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,0BAAAC;AACF,GAAyB;AACvB,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,EAAA,GACjC,EAAE,GAAAC,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA,GAEb,EAAE,aAAaC,GAAiB,WAAWC,EAAA,IAC/CC,EAAA,GACI,EAAE,aAAaC,GAAiB,WAAWC,EAAA,IAC/CC,EAAA,GACIC,IAAYL,KAAmBG,GAE/BG,IAAiCC,EAAQ,OACtC;AAAA,IACL,QAAQnB,GAAW,SAAS,OAAOA,EAAU,MAAM,IAAI;AAAA,IACvD,aAAaA,GAAW,eAAe;AAAA,IAC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B,EADJmB,IACM,yCACA,iCADsC;AAAA,MACL;AAAA,IAAA;AAAA,IAG1CF,KACC,gBAAAc,EAAAC,GAAA,EACE,UAAA;AAAA,MAAA,gBAAAJ;AAAA,QAACO;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,gBAAe;AAAA,UACf,QAAO;AAAA,UACP,OAAOnC,EAAE,kBAAkB;AAAA,UAC3B,aAAaA,EAAE,wBAAwB;AAAA,UACvC,KAAK;AAAA,QAAA;AAAA,MAAA;AAAA,MAEP,gBAAA4B;AAAA,QAACO;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,gBAAe;AAAA,UACf,QAAO;AAAA,UACP,OAAOnC,EAAE,gBAAgB;AAAA,UACzB,KAAK;AAAA,UACL,aAAaA,EAAE,sBAAsB;AAAA,QAAA;AAAA,MAAA;AAAA,IACvC,GACF;AAAA,sBAEDoC,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAR,EAAC1B,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASwB,GAC7C,UAAA1B,EAAE,WAAW,EAAA,CAChB;AAAA,MACA,gBAAA4B,EAAC1B,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWQ,GACzC,UAAoCV,EAAnCP,IAAqC,gBAAvB,iBAAoC,EAAA,CACtD;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
1
+ {"version":3,"file":"GarnishmentForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/GarnishmentForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { useMemo } from 'react'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { GarnishmentType } from '@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { NumberInputField, TextInputField, RadioGroupField } from '@/components/Common'\nimport { type CommonComponentInterface, useBase } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\n\nexport const DeductionSchema = z.object({\n active: z.boolean(),\n amount: z.number().min(0).transform(String),\n description: z.string().min(1),\n courtOrdered: z.boolean(),\n times: z.number().nullable(),\n recurring: z.boolean(),\n annualMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n totalAmount: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n deductAsPercentage: z.boolean(),\n garnishmentType: z.nativeEnum(GarnishmentType),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ninterface GarnishmentFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n selectedGarnishmentType: GarnishmentType\n selectedGarnishmentTitle: string\n}\n\nfunction GarnishmentForm({\n deduction,\n employeeId,\n selectedGarnishmentType,\n selectedGarnishmentTitle,\n}: GarnishmentFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n const isPending = isPendingCreate || isPendingUpdate\n\n const defaultValues: DeductionInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n description: deduction?.description ?? '',\n times: deduction?.times ?? null,\n recurring: deduction?.recurring ?? true,\n annualMaximum: deduction?.annualMaximum ? Number(deduction.annualMaximum) : null,\n totalAmount: deduction?.totalAmount ? Number(deduction.totalAmount) : null,\n deductAsPercentage: deduction?.deductAsPercentage ?? true,\n active: true,\n courtOrdered: true,\n garnishmentType: deduction?.garnishmentType ?? selectedGarnishmentType,\n }\n }, [deduction])\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n const { control } = formMethods\n const watchedRecurring = useWatch({ control, name: 'recurring' })\n const watchedAmountPercentage = useWatch({ control, name: 'deductAsPercentage' })\n\n const onSubmit: SubmitHandler<DeductionPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, times: payload.recurring ? null : 1 },\n },\n })\n\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...payload,\n version: deduction.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CANCEL)\n }\n\n return (\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n <>\n <Components.Heading as=\"h3\">{selectedGarnishmentTitle}</Components.Heading>\n <TextInputField name=\"description\" label={t('descriptionLabelV2')} isRequired />\n <RadioGroupField\n name=\"recurring\"\n label={t('frequencyLabel')}\n isRequired\n options={[\n { value: true, label: t('frequencyRecurringOptionV2') },\n { value: false, label: t('frequencyOneTimeOptionV2') },\n ]}\n />\n <RadioGroupField\n name=\"deductAsPercentage\"\n label={t('deductionTypeLabelV2')}\n isRequired\n options={[\n { value: true, label: t('deductionTypePercentageOptionV2') },\n { value: false, label: t('deductionTypeFixedAmountOption') },\n ]}\n />\n <NumberInputField\n name=\"amount\"\n adornmentStart={!watchedAmountPercentage && '$'}\n adornmentEnd={watchedAmountPercentage && '%'}\n label={t('deductionAmountLabel')}\n isRequired\n min={0}\n format={watchedAmountPercentage ? 'percent' : 'currency'}\n description={\n watchedAmountPercentage\n ? t('deductionAmountDescriptionPercentage')\n : t('deductionAmountDescriptionFixed')\n }\n />\n {watchedRecurring && (\n <>\n <NumberInputField\n name=\"totalAmount\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('totalAmountLabel')}\n description={t('totalAmountDescription')}\n min={0}\n />\n <NumberInputField\n name=\"annualMaximum\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('annualMaxLabel')}\n min={0}\n description={t('annualMaxDescription')}\n />\n </>\n )}\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {!deduction ? t('addDeductionCta') : t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n\nexport default GarnishmentForm\n"],"names":["DeductionSchema","z","val","GarnishmentType","GarnishmentForm","deduction","employeeId","selectedGarnishmentType","selectedGarnishmentTitle","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultValues","useMemo","formMethods","useForm","zodResolver","control","watchedRecurring","useWatch","watchedAmountPercentage","onSubmit","data","payload","updateDeductionResponse","componentEvents","createDeductionResponse","handleCancel","FormProvider","jsx","Form","Flex","jsxs","Fragment","TextInputField","RadioGroupField","NumberInputField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAiBO,MAAMA,IAAkBC,EAAE,O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MAAK;AAAA,UACL,gBAAe;AAAA,UACf,QAAO;AAAA,UACP,OAAOnC,EAAE,kBAAkB;AAAA,UAC3B,aAAaA,EAAE,wBAAwB;AAAA,UACvC,KAAK;AAAA,QAAA;AAAA,MAAA;AAAA,MAEP,gBAAA4B;AAAA,QAACO;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,gBAAe;AAAA,UACf,QAAO;AAAA,UACP,OAAOnC,EAAE,gBAAgB;AAAA,UACzB,KAAK;AAAA,UACL,aAAaA,EAAE,sBAAsB;AAAA,QAAA;AAAA,MAAA;AAAA,IACvC,GACF;AAAA,sBAEDoC,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAR,EAAC1B,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASwB,GAC7C,UAAA1B,EAAE,WAAW,EAAA,CAChB;AAAA,MACA,gBAAA4B,EAAC1B,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWQ,GACzC,UAAoCV,EAAnCP,IAAqC,gBAAvB,iBAAoC,EAAA,CACtD;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
@@ -6,13 +6,13 @@ import { BaseComponent as I } from "../../../Base/Base.js";
6
6
  import { useBase as k } from "../../../Base/useBase.js";
7
7
  import { Flex as U } from "../../../Common/Flex/Flex.js";
8
8
  import "classnames";
9
- import { componentEvents as a } from "../../../../shared/constants.js";
10
9
  import { ActionsLayout as Y } from "../../../Common/ActionsLayout/ActionsLayout.js";
11
10
  import { HamburgerMenu as B } from "../../../Common/HamburgerMenu/HamburgerMenu.js";
12
11
  import E from "../../../../hooks/useNumberFormatter.js";
13
12
  import S from "../../../../assets/icons/pencil.svg.js";
14
13
  import V from "../../../../assets/icons/trashcan.svg.js";
15
14
  import { useComponentDictionary as q, useI18n as F } from "../../../../i18n/I18n.js";
15
+ import { componentEvents as a } from "../../../../shared/constants.js";
16
16
  import { useComponentContext as H } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
17
17
  import { useDataView as j } from "../../../Common/DataView/useDataView.js";
18
18
  import { DataView as G } from "../../../Common/DataView/DataView.js";
@@ -9,8 +9,8 @@ import { useBase as L } from "../../../Base/useBase.js";
9
9
  import { useI18n as S } from "../../../../i18n/I18n.js";
10
10
  import { componentEvents as m } from "../../../../shared/constants.js";
11
11
  import { Flex as g } from "../../../Common/Flex/Flex.js";
12
- import "classnames";
13
12
  import "react-i18next";
13
+ import "classnames";
14
14
  import "../../../../contexts/ComponentAdapter/useComponentContext.js";
15
15
  import "react";
16
16
  function G(e) {
@@ -3,11 +3,10 @@ import { useTranslation as m } from "react-i18next";
3
3
  import { useDocumentList as s } from "./useDocumentList.js";
4
4
  import { Flex as l } from "../../../Common/Flex/Flex.js";
5
5
  import "classnames";
6
- import "../../../../shared/constants.js";
7
6
  import "../../../../contexts/ComponentAdapter/useComponentContext.js";
8
7
  import "react";
9
8
  import { DocumentList as u } from "../../../Common/DocumentList/DocumentList.js";
10
- function D() {
9
+ function S() {
11
10
  const { employeeForms: i, handleRequestFormToSign: n, documentListError: r } = s(), { t: e } = m("Employee.DocumentSigner");
12
11
  return /* @__PURE__ */ o("section", { style: { width: "100%" }, children: /* @__PURE__ */ o(l, { flexDirection: "column", gap: 32, children: /* @__PURE__ */ o(
13
12
  u,
@@ -36,6 +35,6 @@ function D() {
36
35
  ) }) });
37
36
  }
38
37
  export {
39
- D as List
38
+ S as List
40
39
  };
41
40
  //# sourceMappingURL=List.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"List.js","sources":["../../../../../src/components/Employee/DocumentSigner/DocumentList/List.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useDocumentList } from './useDocumentList'\nimport { Flex, DocumentList as SharedDocumentList } from '@/components/Common'\n\nexport function List() {\n const { employeeForms, handleRequestFormToSign, documentListError } = useDocumentList()\n const { t } = useTranslation('Employee.DocumentSigner')\n\n return (\n <section style={{ width: '100%' }}>\n <Flex flexDirection=\"column\" gap={32}>\n <SharedDocumentList\n forms={employeeForms.map(form => ({\n uuid: form.uuid,\n title: form.title,\n description: form.description,\n requires_signing: form.requiresSigning,\n }))}\n onRequestSign={handleRequestFormToSign}\n withError={!!documentListError}\n label={t('documentListLabel')}\n columnLabels={{\n form: t('formColumnLabel'),\n action: t('actionColumnLabel'),\n }}\n statusLabels={{\n signCta: t('signDocumentCta'),\n notSigned: t('notSigned'),\n complete: t('signDocumentComplete'),\n }}\n emptyStateLabel={t('emptyTableTitle')}\n errorLabel={t('documentListError')}\n />\n </Flex>\n </section>\n )\n}\n"],"names":["List","employeeForms","handleRequestFormToSign","documentListError","useDocumentList","t","useTranslation","jsx","Flex","SharedDocumentList","form"],"mappings":";;;;;;;;;AAIO,SAASA,IAAO;AACrB,QAAM,EAAE,eAAAC,GAAe,yBAAAC,GAAyB,mBAAAC,EAAA,IAAsBC,EAAA,GAChE,EAAE,GAAAC,EAAA,IAAMC,EAAe,yBAAyB;AAEtD,SACE,gBAAAC,EAAC,WAAA,EAAQ,OAAO,EAAE,OAAO,UACvB,UAAA,gBAAAA,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA,gBAAAD;AAAA,IAACE;AAAAA,IAAA;AAAA,MACC,OAAOR,EAAc,IAAI,CAAAS,OAAS;AAAA,QAChC,MAAMA,EAAK;AAAA,QACX,OAAOA,EAAK;AAAA,QACZ,aAAaA,EAAK;AAAA,QAClB,kBAAkBA,EAAK;AAAA,MAAA,EACvB;AAAA,MACF,eAAeR;AAAA,MACf,WAAW,CAAC,CAACC;AAAA,MACb,OAAOE,EAAE,mBAAmB;AAAA,MAC5B,cAAc;AAAA,QACZ,MAAMA,EAAE,iBAAiB;AAAA,QACzB,QAAQA,EAAE,mBAAmB;AAAA,MAAA;AAAA,MAE/B,cAAc;AAAA,QACZ,SAASA,EAAE,iBAAiB;AAAA,QAC5B,WAAWA,EAAE,WAAW;AAAA,QACxB,UAAUA,EAAE,sBAAsB;AAAA,MAAA;AAAA,MAEpC,iBAAiBA,EAAE,iBAAiB;AAAA,MACpC,YAAYA,EAAE,mBAAmB;AAAA,IAAA;AAAA,EAAA,GAErC,EAAA,CACF;AAEJ;"}
1
+ {"version":3,"file":"List.js","sources":["../../../../../src/components/Employee/DocumentSigner/DocumentList/List.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useDocumentList } from './useDocumentList'\nimport { Flex, DocumentList as SharedDocumentList } from '@/components/Common'\n\nexport function List() {\n const { employeeForms, handleRequestFormToSign, documentListError } = useDocumentList()\n const { t } = useTranslation('Employee.DocumentSigner')\n\n return (\n <section style={{ width: '100%' }}>\n <Flex flexDirection=\"column\" gap={32}>\n <SharedDocumentList\n forms={employeeForms.map(form => ({\n uuid: form.uuid,\n title: form.title,\n description: form.description,\n requires_signing: form.requiresSigning,\n }))}\n onRequestSign={handleRequestFormToSign}\n withError={!!documentListError}\n label={t('documentListLabel')}\n columnLabels={{\n form: t('formColumnLabel'),\n action: t('actionColumnLabel'),\n }}\n statusLabels={{\n signCta: t('signDocumentCta'),\n notSigned: t('notSigned'),\n complete: t('signDocumentComplete'),\n }}\n emptyStateLabel={t('emptyTableTitle')}\n errorLabel={t('documentListError')}\n />\n </Flex>\n </section>\n )\n}\n"],"names":["List","employeeForms","handleRequestFormToSign","documentListError","useDocumentList","t","useTranslation","jsx","Flex","SharedDocumentList","form"],"mappings":";;;;;;;;AAIO,SAASA,IAAO;AACrB,QAAM,EAAE,eAAAC,GAAe,yBAAAC,GAAyB,mBAAAC,EAAA,IAAsBC,EAAA,GAChE,EAAE,GAAAC,EAAA,IAAMC,EAAe,yBAAyB;AAEtD,SACE,gBAAAC,EAAC,WAAA,EAAQ,OAAO,EAAE,OAAO,UACvB,UAAA,gBAAAA,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA,gBAAAD;AAAA,IAACE;AAAAA,IAAA;AAAA,MACC,OAAOR,EAAc,IAAI,CAAAS,OAAS;AAAA,QAChC,MAAMA,EAAK;AAAA,QACX,OAAOA,EAAK;AAAA,QACZ,aAAaA,EAAK;AAAA,QAClB,kBAAkBA,EAAK;AAAA,MAAA,EACvB;AAAA,MACF,eAAeR;AAAA,MACf,WAAW,CAAC,CAACC;AAAA,MACb,OAAOE,EAAE,mBAAmB;AAAA,MAC5B,cAAc;AAAA,QACZ,MAAMA,EAAE,iBAAiB;AAAA,QACzB,QAAQA,EAAE,mBAAmB;AAAA,MAAA;AAAA,MAE/B,cAAc;AAAA,QACZ,SAASA,EAAE,iBAAiB;AAAA,QAC5B,WAAWA,EAAE,WAAW;AAAA,QACxB,UAAUA,EAAE,sBAAsB;AAAA,MAAA;AAAA,MAEpC,iBAAiBA,EAAE,iBAAiB;AAAA,MACpC,YAAYA,EAAE,mBAAmB;AAAA,IAAA;AAAA,EAAA,GAErC,EAAA,CACF;AAEJ;"}
@@ -9,12 +9,11 @@ import "../../../Base/useBase.js";
9
9
  import "../../../../shared/constants.js";
10
10
  import "classnames";
11
11
  import "../../../../contexts/ComponentAdapter/useComponentContext.js";
12
- import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
13
12
  import "dompurify";
14
13
  import { createCompoundContext as t } from "../../../Base/createCompoundContext.js";
15
- const [d, a] = t("DocumentListContext");
14
+ const [L, d] = t("DocumentListContext");
16
15
  export {
17
- a as DocumentListProvider,
18
- d as useDocumentList
16
+ d as DocumentListProvider,
17
+ L as useDocumentList
19
18
  };
20
19
  //# sourceMappingURL=useDocumentList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDocumentList.js","sources":["../../../../../src/components/Employee/DocumentSigner/DocumentList/useDocumentList.ts"],"sourcesContent":["import type { Form } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype DocumentListContextType = {\n employeeForms: Form[]\n hasSignedAllForms: boolean\n handleContinue: () => void\n handleRequestFormToSign: (form: Form) => void\n documentListError: Error | null\n formToSign?: Form\n}\n\nconst [useDocumentList, DocumentListProvider] =\n createCompoundContext<DocumentListContextType>('DocumentListContext')\nexport { useDocumentList, DocumentListProvider }\n"],"names":["useDocumentList","DocumentListProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;AAYA,MAAM,CAACA,GAAiBC,CAAoB,IAC1CC,EAA+C,qBAAqB;"}
1
+ {"version":3,"file":"useDocumentList.js","sources":["../../../../../src/components/Employee/DocumentSigner/DocumentList/useDocumentList.ts"],"sourcesContent":["import type { Form } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype DocumentListContextType = {\n employeeForms: Form[]\n hasSignedAllForms: boolean\n handleContinue: () => void\n handleRequestFormToSign: (form: Form) => void\n documentListError: Error | null\n formToSign?: Form\n}\n\nconst [useDocumentList, DocumentListProvider] =\n createCompoundContext<DocumentListContextType>('DocumentListContext')\nexport { useDocumentList, DocumentListProvider }\n"],"names":["useDocumentList","DocumentListProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;AAYA,MAAM,CAACA,GAAiBC,CAAoB,IAC1CC,EAA+C,qBAAqB;"}
@@ -12,8 +12,8 @@ import { useBase as C } from "../../../Base/useBase.js";
12
12
  import { useI18n as G } from "../../../../i18n/I18n.js";
13
13
  import { componentEvents as i } from "../../../../shared/constants.js";
14
14
  import { Flex as M } from "../../../Common/Flex/Flex.js";
15
- import "classnames";
16
15
  import "react-i18next";
16
+ import "classnames";
17
17
  import "../../../../contexts/ComponentAdapter/useComponentContext.js";
18
18
  import "react";
19
19
  import { SignatureForm as R } from "../../../Common/SignatureForm/SignatureForm.js";
@@ -9,12 +9,11 @@ import "../../../Base/useBase.js";
9
9
  import "../../../../shared/constants.js";
10
10
  import "classnames";
11
11
  import "../../../../contexts/ComponentAdapter/useComponentContext.js";
12
- import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
13
12
  import "dompurify";
14
13
  import { createCompoundContext as o } from "../../../Base/createCompoundContext.js";
15
- const [c, d] = o("SignatureFormContext");
14
+ const [S, c] = o("SignatureFormContext");
16
15
  export {
17
- d as SignatureFormProvider,
18
- c as useSignatureForm
16
+ c as SignatureFormProvider,
17
+ S as useSignatureForm
19
18
  };
20
19
  //# sourceMappingURL=useSignatureForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSignatureForm.js","sources":["../../../../../src/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.ts"],"sourcesContent":["import type { Form } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype SignatureFormContextType = {\n form: Form\n pdfUrl?: string | null\n handleBack: () => void\n isPending: boolean\n}\n\nconst [useSignatureForm, SignatureFormProvider] =\n createCompoundContext<SignatureFormContextType>('SignatureFormContext')\nexport { useSignatureForm, SignatureFormProvider }\n"],"names":["useSignatureForm","SignatureFormProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;AAUA,MAAM,CAACA,GAAkBC,CAAqB,IAC5CC,EAAgD,sBAAsB;"}
1
+ {"version":3,"file":"useSignatureForm.js","sources":["../../../../../src/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.ts"],"sourcesContent":["import type { Form } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype SignatureFormContextType = {\n form: Form\n pdfUrl?: string | null\n handleBack: () => void\n isPending: boolean\n}\n\nconst [useSignatureForm, SignatureFormProvider] =\n createCompoundContext<SignatureFormContextType>('SignatureFormContext')\nexport { useSignatureForm, SignatureFormProvider }\n"],"names":["useSignatureForm","SignatureFormProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;AAUA,MAAM,CAACA,GAAkBC,CAAqB,IAC5CC,EAAgD,sBAAsB;"}
@@ -9,12 +9,11 @@ import { Actions as k } from "./Actions.js";
9
9
  import { BaseComponent as q } from "../../Base/Base.js";
10
10
  import { useBase as j } from "../../Base/useBase.js";
11
11
  import { Flex as H } from "../../Common/Flex/Flex.js";
12
- import "classnames";
13
- import { componentEvents as s, EmployeeOnboardingStatus as E } from "../../../shared/constants.js";
14
12
  import { Loading as V } from "../../Common/Loading/Loading.js";
15
13
  import "react-i18next";
16
14
  import "../../../contexts/ComponentAdapter/useComponentContext.js";
17
15
  import { useI18n as z, useComponentDictionary as J } from "../../../i18n/I18n.js";
16
+ import { componentEvents as s, EmployeeOnboardingStatus as E } from "../../../shared/constants.js";
18
17
  import { Head as K } from "./Head.js";
19
18
  import { List as Q } from "./List.js";
20
19
  import { useFlow as X } from "../../Flow/useFlow.js";
@@ -109,12 +108,12 @@ function $({ companyId: n, className: m, children: l, dictionary: P }) {
109
108
  }
110
109
  ) });
111
110
  }
112
- const Ne = () => {
111
+ const Ie = () => {
113
112
  const { companyId: n, onEvent: m } = X();
114
113
  return /* @__PURE__ */ o(Z, { companyId: n, onEvent: m });
115
114
  };
116
115
  export {
117
116
  Z as EmployeeList,
118
- Ne as EmployeeListContextual
117
+ Ie as EmployeeListContextual
119
118
  };
120
119
  //# sourceMappingURL=EmployeeList.js.map