@gusto/embedded-react-sdk 0.31.0 → 0.31.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 (267) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/components/Base/Base.js +12 -13
  3. package/dist/components/Base/Base.js.map +1 -1
  4. package/dist/components/Common/SignatureForm/SignatureForm.js +10 -12
  5. package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
  6. package/dist/components/Common/SignatureForm/SignatureFormActions.js +2 -3
  7. package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
  8. package/dist/components/Common/SignatureForm/SignatureFormFields.js +6 -7
  9. package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
  10. package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
  11. package/dist/components/Common/UI/FileInput/FileInput.js +1 -1
  12. package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
  13. package/dist/components/Company/AssignSignatory/AssignSignatory.js +2 -3
  14. package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
  15. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +3 -4
  16. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
  17. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +2 -3
  18. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
  19. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +1 -1
  20. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +12 -12
  21. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +3 -4
  22. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  23. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +2 -3
  24. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
  25. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +1 -1
  26. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +1 -1
  27. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +3 -4
  28. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  29. package/dist/components/Company/AssignSignatory/TitleSelect.js +3 -4
  30. package/dist/components/Company/AssignSignatory/TitleSelect.js.map +1 -1
  31. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +5 -6
  32. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  33. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +8 -9
  34. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
  35. package/dist/components/Company/BankAccount/BankAccountForm/Form.js +5 -7
  36. package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
  37. package/dist/components/Company/BankAccount/BankAccountForm/context.js +3 -4
  38. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  39. package/dist/components/Company/BankAccount/BankAccountList/Actions.js +2 -3
  40. package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
  41. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +6 -7
  42. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
  43. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +5 -7
  44. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
  45. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +2 -3
  46. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
  47. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +8 -9
  48. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  49. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +3 -4
  50. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  51. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +3 -4
  52. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  53. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +3 -4
  54. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  55. package/dist/components/Company/FederalTaxes/Actions.js +6 -7
  56. package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
  57. package/dist/components/Company/FederalTaxes/FederalTaxes.js +3 -4
  58. package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
  59. package/dist/components/Company/FederalTaxes/Form.js +3 -5
  60. package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
  61. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +5 -6
  62. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  63. package/dist/components/Company/Industry/Actions.js +7 -8
  64. package/dist/components/Company/Industry/Actions.js.map +1 -1
  65. package/dist/components/Company/Industry/Context.js +6 -7
  66. package/dist/components/Company/Industry/Context.js.map +1 -1
  67. package/dist/components/Company/Industry/Edit.js +2 -3
  68. package/dist/components/Company/Industry/Edit.js.map +1 -1
  69. package/dist/components/Company/Locations/LocationForm/Actions.js +6 -7
  70. package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
  71. package/dist/components/Company/Locations/LocationForm/Form.js +1 -1
  72. package/dist/components/Company/Locations/LocationForm/LocationForm.js +3 -4
  73. package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
  74. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +3 -4
  75. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  76. package/dist/components/Company/Locations/LocationsList/Actions.js +2 -3
  77. package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
  78. package/dist/components/Company/Locations/LocationsList/List.js +6 -7
  79. package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
  80. package/dist/components/Company/Locations/LocationsList/LocationsList.js +3 -4
  81. package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
  82. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +3 -4
  83. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  84. package/dist/components/Company/OnboardingOverview/Completed.js +10 -12
  85. package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
  86. package/dist/components/Company/OnboardingOverview/MissingRequirements.js +6 -8
  87. package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
  88. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +7 -8
  89. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
  90. package/dist/components/Company/OnboardingOverview/context.js +3 -4
  91. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  92. package/dist/components/Company/PaySchedule/PaySchedule.js +3 -4
  93. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  94. package/dist/components/Company/PaySchedule/_parts/Actions.js +2 -3
  95. package/dist/components/Company/PaySchedule/_parts/Actions.js.map +1 -1
  96. package/dist/components/Company/PaySchedule/_parts/Edit.js +15 -15
  97. package/dist/components/Company/PaySchedule/_parts/Head.js +11 -13
  98. package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
  99. package/dist/components/Company/PaySchedule/_parts/List.js +13 -15
  100. package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
  101. package/dist/components/Company/PaySchedule/usePaySchedule.js +5 -6
  102. package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
  103. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +2 -3
  104. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
  105. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +3 -4
  106. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  107. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +2 -3
  108. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
  109. package/dist/components/Company/StateTaxes/StateTaxesList/List.js +2 -3
  110. package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
  111. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +3 -4
  112. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  113. package/dist/components/Contractor/Address/Address.js +4 -5
  114. package/dist/components/Contractor/Address/Address.js.map +1 -1
  115. package/dist/components/Contractor/Address/Form.js +1 -1
  116. package/dist/components/Contractor/Address/useAddress.js +5 -6
  117. package/dist/components/Contractor/Address/useAddress.js.map +1 -1
  118. package/dist/components/Contractor/ContractorList/index.js +31 -32
  119. package/dist/components/Contractor/ContractorList/index.js.map +1 -1
  120. package/dist/components/Contractor/NewHireReport/NewHireReport.js +13 -14
  121. package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
  122. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +11 -12
  123. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -1
  124. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +2 -3
  125. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -1
  126. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +3 -4
  127. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js.map +1 -1
  128. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js +2 -4
  129. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js.map +1 -1
  130. package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js +10 -10
  131. package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js +7 -9
  132. package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js.map +1 -1
  133. package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js +3 -4
  134. package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js.map +1 -1
  135. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js +2 -4
  136. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js.map +1 -1
  137. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js +6 -8
  138. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js.map +1 -1
  139. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js +2 -4
  140. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js.map +1 -1
  141. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +2 -4
  142. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -1
  143. package/dist/components/Contractor/Profile/ContractorProfileForm.js +15 -15
  144. package/dist/components/Contractor/Profile/useContractorProfile.js +2 -3
  145. package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
  146. package/dist/components/Contractor/Submit/Submit.js +20 -21
  147. package/dist/components/Contractor/Submit/Submit.js.map +1 -1
  148. package/dist/components/Employee/Compensation/Actions.js +12 -13
  149. package/dist/components/Employee/Compensation/Actions.js.map +1 -1
  150. package/dist/components/Employee/Compensation/Edit.js +16 -17
  151. package/dist/components/Employee/Compensation/Edit.js.map +1 -1
  152. package/dist/components/Employee/Compensation/List.js +22 -23
  153. package/dist/components/Employee/Compensation/List.js.map +1 -1
  154. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +10 -11
  155. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
  156. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +11 -12
  157. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
  158. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +11 -12
  159. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +1 -1
  160. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +7 -8
  161. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js.map +1 -1
  162. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +5 -6
  163. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
  164. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +2 -3
  165. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  166. package/dist/components/Employee/DocumentSigner/DocumentList/List.js +2 -4
  167. package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
  168. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +3 -4
  169. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  170. package/dist/components/Employee/DocumentSigner/DocumentSigner.js +21 -33
  171. package/dist/components/Employee/DocumentSigner/DocumentSigner.js.map +1 -1
  172. package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js +24 -26
  173. package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js.map +1 -1
  174. package/dist/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.js +9 -10
  175. package/dist/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.js.map +1 -1
  176. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +2 -3
  177. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  178. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +3 -4
  179. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  180. package/dist/components/Employee/EmployeeDocuments/EmployeeDocumentsPresentation.js +2 -4
  181. package/dist/components/Employee/EmployeeDocuments/EmployeeDocumentsPresentation.js.map +1 -1
  182. package/dist/components/Employee/EmployeeList/Actions.js +6 -7
  183. package/dist/components/Employee/EmployeeList/Actions.js.map +1 -1
  184. package/dist/components/Employee/EmployeeList/EmployeeList.js +3 -4
  185. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  186. package/dist/components/Employee/EmployeeList/Head.js +5 -7
  187. package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
  188. package/dist/components/Employee/EmployeeList/List.js +2 -3
  189. package/dist/components/Employee/EmployeeList/List.js.map +1 -1
  190. package/dist/components/Employee/EmployeeList/useEmployeeList.js +3 -4
  191. package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
  192. package/dist/components/Employee/FederalTaxes/Actions.js +5 -6
  193. package/dist/components/Employee/FederalTaxes/Actions.js.map +1 -1
  194. package/dist/components/Employee/FederalTaxes/FederalForm.js +11 -12
  195. package/dist/components/Employee/FederalTaxes/FederalForm.js.map +1 -1
  196. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +3 -4
  197. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
  198. package/dist/components/Employee/Landing/Landing.js +14 -15
  199. package/dist/components/Employee/Landing/Landing.js.map +1 -1
  200. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +7 -7
  201. package/dist/components/Employee/PaymentMethod/Actions.js +5 -6
  202. package/dist/components/Employee/PaymentMethod/Actions.js.map +1 -1
  203. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +4 -5
  204. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js.map +1 -1
  205. package/dist/components/Employee/PaymentMethod/BankAccountsList.js +2 -3
  206. package/dist/components/Employee/PaymentMethod/BankAccountsList.js.map +1 -1
  207. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +6 -7
  208. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +1 -1
  209. package/dist/components/Employee/PaymentMethod/Split.js +10 -11
  210. package/dist/components/Employee/PaymentMethod/Split.js.map +1 -1
  211. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +5 -6
  212. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
  213. package/dist/components/Employee/Profile/Actions.js +5 -6
  214. package/dist/components/Employee/Profile/Actions.js.map +1 -1
  215. package/dist/components/Employee/Profile/AdminPersonalDetails.js +5 -6
  216. package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
  217. package/dist/components/Employee/Profile/HomeAddress.js +1 -1
  218. package/dist/components/Employee/Profile/PersonalDetailsInputs.js +2 -2
  219. package/dist/components/Employee/Profile/useProfile.js +3 -4
  220. package/dist/components/Employee/Profile/useProfile.js.map +1 -1
  221. package/dist/components/Employee/StateTaxes/Actions.js +5 -6
  222. package/dist/components/Employee/StateTaxes/Actions.js.map +1 -1
  223. package/dist/components/Employee/StateTaxes/useStateTaxes.js +3 -4
  224. package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
  225. package/dist/components/Employee/Taxes/Actions.js +6 -7
  226. package/dist/components/Employee/Taxes/Actions.js.map +1 -1
  227. package/dist/components/Employee/Taxes/FederalForm.js +13 -14
  228. package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
  229. package/dist/components/Employee/Taxes/useTaxes.js +3 -4
  230. package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
  231. package/dist/components/Flow/Flow.js +7 -9
  232. package/dist/components/Flow/Flow.js.map +1 -1
  233. package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js +16 -17
  234. package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js.map +1 -1
  235. package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js +6 -7
  236. package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js.map +1 -1
  237. package/dist/components/InformationRequests/InformationRequests.js +3 -4
  238. package/dist/components/InformationRequests/InformationRequests.js.map +1 -1
  239. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +9 -10
  240. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js.map +1 -1
  241. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js +2 -4
  242. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js.map +1 -1
  243. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +12 -12
  244. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +36 -36
  245. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +19 -21
  246. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
  247. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +15 -17
  248. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
  249. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +17 -19
  250. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
  251. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +2 -3
  252. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
  253. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js +2 -4
  254. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js.map +1 -1
  255. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +2 -3
  256. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
  257. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js +3 -4
  258. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js.map +1 -1
  259. package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js +11 -12
  260. package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js.map +1 -1
  261. package/dist/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.js +2 -4
  262. package/dist/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.js.map +1 -1
  263. package/dist/components/Payroll/usePreparedPayrollData.js +2 -3
  264. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  265. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +2 -3
  266. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
  267. package/package.json +2 -2
@@ -10,20 +10,19 @@ import { useGarnishmentsUpdateMutation as $ } from "@gusto/embedded-api/react-qu
10
10
  import { useComponentContext as J } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
11
11
  import { Form as Q } from "../../../Common/Form/Form.js";
12
12
  import { Flex as P } from "../../../Common/Flex/Flex.js";
13
- import "classnames";
14
- import { componentEvents as M } from "../../../../shared/constants.js";
15
- import { TextInputField as Z } from "../../../Common/Fields/TextInputField/TextInputField.js";
16
- import { ActionsLayout as ee } from "../../../Common/ActionsLayout/ActionsLayout.js";
17
- import { NumberInputField as D } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
13
+ import { ActionsLayout as Z } 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 re } from "../../../Base/useBase.js";
18
+ import { useBase as ee } from "../../../Base/useBase.js";
19
+ import { componentEvents as M } from "../../../../shared/constants.js";
23
20
  import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
24
21
  import "dompurify";
25
22
  import "../../../../contexts/LocaleProvider/useLocale.js";
26
23
  import { SelectField as f } from "../../../Common/Fields/SelectField/SelectField.js";
24
+ import { TextInputField as re } from "../../../Common/Fields/TextInputField/TextInputField.js";
25
+ import { NumberInputField as D } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
27
26
  const te = 0, ne = 0, ie = 100, oe = i.nativeEnum(z), me = i.object({
28
27
  state: i.string(),
29
28
  fipsCode: i.string(),
@@ -34,7 +33,7 @@ const te = 0, ne = 0, ie = 100, oe = i.nativeEnum(z), me = i.object({
34
33
  payPeriodMaximum: i.number().min(0).transform((r) => r > 0 ? r.toString() : null).nullable(),
35
34
  paymentPeriod: oe
36
35
  });
37
- function Ie({
36
+ function qe({
38
37
  deduction: r,
39
38
  handleStateAgencySelect: _,
40
39
  stateAgencies: x,
@@ -44,7 +43,7 @@ function Ie({
44
43
  selectedAgency: N,
45
44
  onCancel: v
46
45
  }) {
47
- const { onEvent: E, baseSubmitHandler: R } = re(), { t: e } = W("Employee.Deductions"), a = J(), g = {
46
+ const { onEvent: E, baseSubmitHandler: R } = ee(), { t: e } = W("Employee.Deductions"), a = J(), g = {
48
47
  case_number: {
49
48
  name: "caseNumber",
50
49
  description: e("caseNumberDescription")
@@ -156,7 +155,7 @@ function Ie({
156
155
  }
157
156
  ),
158
157
  T.map(({ name: t, label: u, description: s }) => /* @__PURE__ */ n(
159
- Z,
158
+ re,
160
159
  {
161
160
  name: t,
162
161
  label: u,
@@ -217,13 +216,13 @@ function Ie({
217
216
  )
218
217
  ] })
219
218
  ] }),
220
- /* @__PURE__ */ p(ee, { children: [
219
+ /* @__PURE__ */ p(Z, { children: [
221
220
  /* @__PURE__ */ n(a.Button, { variant: "secondary", onClick: Y, children: e("cancelCta") }),
222
221
  b && /* @__PURE__ */ n(a.Button, { type: "submit", isLoading: O, children: e("saveCta") })
223
222
  ] })
224
223
  ] }) }) });
225
224
  }
226
225
  export {
227
- Ie as default
226
+ qe as default
228
227
  };
229
228
  //# 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 { 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 singleAllCountiesFipsCode: string | null | undefined\n selectedAgency?: Agencies\n onCancel: () => void\n}\n\nfunction ChildSupportForm({\n deduction,\n handleStateAgencySelect,\n stateAgencies,\n counties,\n singleAllCountiesFipsCode,\n employeeId,\n selectedAgency,\n onCancel,\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 useEffect(() => {\n if (typeof singleAllCountiesFipsCode === 'string') {\n setValue('fipsCode', singleAllCountiesFipsCode)\n }\n }, [singleAllCountiesFipsCode, 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 handleCancel = () => {\n onCancel()\n }\n\n const isManualPaymentRequired = selectedAgency?.manualPaymentRequired\n const hasSelectableCounties =\n counties.length > 1 || (counties.length === 1 && singleAllCountiesFipsCode == null)\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 <Flex flexDirection=\"column\" gap={20}>\n <SelectField\n name=\"state\"\n label={t('agency')}\n description={t('agencyDescription')}\n options={stateAgencies}\n onChange={handleStateAgencySelect}\n isRequired\n />\n\n {isManualPaymentRequired && (\n <Components.Alert status=\"warning\" label={t('manualPaymentRequired')} />\n )}\n\n {watchedStateAgency && (\n <Flex flexDirection=\"column\" gap={20}>\n {hasSelectableCounties && (\n <SelectField\n name=\"fipsCode\"\n label={t('county')}\n description={t('countyDescription')}\n options={counties}\n isRequired\n />\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 </Flex>\n )}\n </Flex>\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n {watchedStateAgency && (\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('saveCta')}\n </Components.Button>\n )}\n </ActionsLayout>\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","singleAllCountiesFipsCode","employeeId","selectedAgency","onCancel","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","handleCancel","isManualPaymentRequired","hasSelectableCounties","FormProvider","jsx","Form","jsxs","Flex","SelectField","name","label","description","TextInputField","NumberInputField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,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,IAA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AAAA,cAAA;AAAA,cAET;AAAA,gBACE,OAAOA,EAAE,gBAAgB;AAAA,gBACzB,OAAO;AAAA,cAAA;AAAA,cAET;AAAA,gBACE,OAAOA,EAAE,eAAe;AAAA,gBACxB,OAAO;AAAA,cAAA;AAAA,cAET;AAAA,gBACE,OAAOA,EAAE,SAAS;AAAA,gBAClB,OAAO;AAAA,cAAA;AAAA,YACT;AAAA,YAEF,YAAU;AAAA,UAAA;AAAA,QAAA;AAAA,MACZ,EAAA,CACF;AAAA,IAAA,GAEJ;AAAA,sBACC+C,IAAA,EACC,UAAA;AAAA,MAAA,gBAAAV,EAACnC,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAAS+B,GAC7C,UAAAjC,EAAE,WAAW,EAAA,CAChB;AAAA,MACCsB,KACC,gBAAAe,EAACnC,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWW,GACzC,UAAAb,EAAE,SAAS,EAAA,CACd;AAAA,IAAA,EAAA,CAEJ;AAAA,EAAA,EAAA,CACF,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 { 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 singleAllCountiesFipsCode: string | null | undefined\n selectedAgency?: Agencies\n onCancel: () => void\n}\n\nfunction ChildSupportForm({\n deduction,\n handleStateAgencySelect,\n stateAgencies,\n counties,\n singleAllCountiesFipsCode,\n employeeId,\n selectedAgency,\n onCancel,\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 useEffect(() => {\n if (typeof singleAllCountiesFipsCode === 'string') {\n setValue('fipsCode', singleAllCountiesFipsCode)\n }\n }, [singleAllCountiesFipsCode, 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 handleCancel = () => {\n onCancel()\n }\n\n const isManualPaymentRequired = selectedAgency?.manualPaymentRequired\n const hasSelectableCounties =\n counties.length > 1 || (counties.length === 1 && singleAllCountiesFipsCode == null)\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 <Flex flexDirection=\"column\" gap={20}>\n <SelectField\n name=\"state\"\n label={t('agency')}\n description={t('agencyDescription')}\n options={stateAgencies}\n onChange={handleStateAgencySelect}\n isRequired\n />\n\n {isManualPaymentRequired && (\n <Components.Alert status=\"warning\" label={t('manualPaymentRequired')} />\n )}\n\n {watchedStateAgency && (\n <Flex flexDirection=\"column\" gap={20}>\n {hasSelectableCounties && (\n <SelectField\n name=\"fipsCode\"\n label={t('county')}\n description={t('countyDescription')}\n options={counties}\n isRequired\n />\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 </Flex>\n )}\n </Flex>\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n {watchedStateAgency && (\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('saveCta')}\n </Components.Button>\n )}\n </ActionsLayout>\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","singleAllCountiesFipsCode","employeeId","selectedAgency","onCancel","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","handleCancel","isManualPaymentRequired","hasSelectableCounties","FormProvider","jsx","Form","jsxs","Flex","SelectField","name","label","description","TextInputField","NumberInputField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAmBA,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;AAgBD,SAASK,GAAiB;AAAA,EACxB,WAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,UAAAC;AAAA,EACA,2BAAAC;AAAA,EACA,YAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,UAAAC;AACF,GAA0B;AACxB,QAAM,EAAE,SAAAC,GAAS,mB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;AAAA,MACZ,EAAA,CACF;AAAA,IAAA,GAEJ;AAAA,sBACC+C,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAV,EAACnC,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAAS+B,GAC7C,UAAAjC,EAAE,WAAW,EAAA,CAChB;AAAA,MACCsB,KACC,gBAAAe,EAACnC,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWW,GACzC,UAAAb,EAAE,SAAS,EAAA,CACd;AAAA,IAAA,EAAA,CAEJ;AAAA,EAAA,EAAA,CACF,GACF,GACF;AAEJ;"}
@@ -9,20 +9,19 @@ import { useGarnishmentsUpdateMutation as B } from "@gusto/embedded-api/react-qu
9
9
  import { useComponentContext as I } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
10
10
  import { Form as U } from "../../../Common/Form/Form.js";
11
11
  import { Flex as m } from "../../../Common/Flex/Flex.js";
12
- import "classnames";
13
- import { componentEvents as b } from "../../../../shared/constants.js";
14
- import { RadioGroupField as g } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
15
- import { TextInputField as _ } from "../../../Common/Fields/TextInputField/TextInputField.js";
16
- import { ActionsLayout as j } from "../../../Common/ActionsLayout/ActionsLayout.js";
17
- import { NumberInputField as c } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
12
+ import { ActionsLayout as _ } from "../../../Common/ActionsLayout/ActionsLayout.js";
18
13
  import "react-error-boundary";
19
14
  import "@gusto/embedded-api/models/errors/apierror";
20
15
  import "@gusto/embedded-api/models/errors/sdkvalidationerror";
21
16
  import "@tanstack/react-query";
22
- import { useBase as G } from "../../../Base/useBase.js";
17
+ import { useBase as j } from "../../../Base/useBase.js";
18
+ import { componentEvents as b } from "../../../../shared/constants.js";
23
19
  import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
24
20
  import "dompurify";
25
21
  import "../../../../contexts/LocaleProvider/useLocale.js";
22
+ import { TextInputField as G } from "../../../Common/Fields/TextInputField/TextInputField.js";
23
+ import { RadioGroupField as g } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
24
+ import { NumberInputField as c } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
26
25
  const $ = r.object({
27
26
  active: r.boolean(),
28
27
  amount: r.number().min(0).transform(String),
@@ -33,8 +32,8 @@ const $ = r.object({
33
32
  totalAmount: r.number().min(0).transform((e) => e > 0 ? e.toString() : null).nullable(),
34
33
  deductAsPercentage: r.boolean()
35
34
  });
36
- function be({ deduction: e, employeeId: h, onCancel: D }) {
37
- const { onEvent: d, baseSubmitHandler: A } = G(), { t: n } = T("Employee.Deductions"), u = I(), { mutateAsync: x, isPending: P } = w(), { mutateAsync: y, isPending: E } = B(), v = P || E, C = N(() => ({
35
+ function fe({ deduction: e, employeeId: h, onCancel: D }) {
36
+ const { onEvent: d, baseSubmitHandler: A } = j(), { t: n } = T("Employee.Deductions"), u = I(), { mutateAsync: x, isPending: P } = w(), { mutateAsync: y, isPending: E } = B(), v = P || E, C = N(() => ({
38
37
  amount: e?.amount ? Number(e.amount) : 0,
39
38
  description: e?.description ?? "",
40
39
  times: e?.times ?? null,
@@ -78,7 +77,7 @@ function be({ deduction: e, employeeId: h, onCancel: D }) {
78
77
  /* @__PURE__ */ t(u.Heading, { as: "h3", children: n("customDeductionTitle") }),
79
78
  /* @__PURE__ */ o(m, { flexDirection: "column", gap: 20, children: [
80
79
  /* @__PURE__ */ o(m, { flexDirection: "column", gap: 20, children: [
81
- /* @__PURE__ */ t(_, { name: "description", label: n("descriptionLabelV2"), isRequired: !0 }),
80
+ /* @__PURE__ */ t(G, { name: "description", label: n("descriptionLabelV2"), isRequired: !0 }),
82
81
  /* @__PURE__ */ t(
83
82
  g,
84
83
  {
@@ -142,7 +141,7 @@ function be({ deduction: e, employeeId: h, onCancel: D }) {
142
141
  )
143
142
  ] })
144
143
  ] }),
145
- /* @__PURE__ */ o(j, { children: [
144
+ /* @__PURE__ */ o(_, { children: [
146
145
  /* @__PURE__ */ t(u.Button, { variant: "secondary", onClick: F, children: n("cancelCta") }),
147
146
  /* @__PURE__ */ t(u.Button, { type: "submit", isLoading: v, children: n("saveCta") })
148
147
  ] })
@@ -150,6 +149,6 @@ function be({ deduction: e, employeeId: h, onCancel: D }) {
150
149
  }
151
150
  export {
152
151
  $ as DeductionSchema,
153
- be as default
152
+ fe as default
154
153
  };
155
154
  //# 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 onCancel: () => void\n}\n\nfunction CustomDeductionForm({ deduction, employeeId, onCancel }: 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 onCancel()\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 <Flex flexDirection=\"column\" gap={20}>\n <Flex flexDirection=\"column\" gap={20}>\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 </Flex>\n {watchedRecurring && (\n <Flex flexDirection=\"column\" gap={20}>\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 </Flex>\n )}\n </Flex>\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('saveCta')}\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","onCancel","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;AAWD,SAASE,GAAoB,EAAE,WAAAC,GAAW,YAAAC,GAAY,UAAAC,KAAmC;AACvF,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,GAAi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../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 onCancel: () => void\n}\n\nfunction CustomDeductionForm({ deduction, employeeId, onCancel }: 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 onCancel()\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 <Flex flexDirection=\"column\" gap={20}>\n <Flex flexDirection=\"column\" gap={20}>\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 </Flex>\n {watchedRecurring && (\n <Flex flexDirection=\"column\" gap={20}>\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 </Flex>\n )}\n </Flex>\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('saveCta')}\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","onCancel","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;AAWD,SAASE,GAAoB,EAAE,WAAAC,GAAW,YAAAC,GAAY,UAAAC,KAAmC;AACvF,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,QAAQlB,GAAW,SAAS,OAAOA,EAAU,MAAM,IAAI;AAAA,IACvD,aAAaA,GAAW,eAAe;AAAA,IACvC,OAAOA,GAAW,SAAS;AAAA,IAC3B,WAAWA,GAAW,aAAa;AAAA,IACnC,eAAeA,GAAW,gBAAgB,OAAOA,EAAU,aAAa,IAAI;AAAA,IA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CADsC;AAAA,UACL;AAAA,QAAA;AAAA,MAE3C,GACF;AAAA,MACCF,KACC,gBAAAc,EAACD,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,QAAA,gBAAAF;AAAA,UAACO;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,gBAAe;AAAA,YACf,QAAO;AAAA,YACP,OAAOnC,EAAE,kBAAkB;AAAA,YAC3B,aAAaA,EAAE,wBAAwB;AAAA,YACvC,KAAK;AAAA,UAAA;AAAA,QAAA;AAAA,QAEP,gBAAA4B;AAAA,UAACO;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,gBAAe;AAAA,YACf,QAAO;AAAA,YACP,OAAOnC,EAAE,gBAAgB;AAAA,YACzB,KAAK;AAAA,YACL,aAAaA,EAAE,sBAAsB;AAAA,UAAA;AAAA,QAAA;AAAA,MACvC,EAAA,CACF;AAAA,IAAA,GAEJ;AAAA,sBACCoC,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,UAAAV,EAAE,SAAS,EAAA,CACd;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
@@ -10,20 +10,19 @@ import { useGarnishmentsUpdateMutation as U } from "@gusto/embedded-api/react-qu
10
10
  import { useComponentContext as _ } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
11
11
  import { Form as j } from "../../../Common/Form/Form.js";
12
12
  import { Flex as m } from "../../../Common/Flex/Flex.js";
13
- import "classnames";
14
- import { componentEvents as b } from "../../../../shared/constants.js";
15
- import { RadioGroupField as f } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
16
- import { TextInputField as $ } from "../../../Common/Fields/TextInputField/TextInputField.js";
17
- import { ActionsLayout as z } from "../../../Common/ActionsLayout/ActionsLayout.js";
18
- import { NumberInputField as c } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
13
+ import { ActionsLayout as $ } from "../../../Common/ActionsLayout/ActionsLayout.js";
19
14
  import "react-error-boundary";
20
15
  import "@gusto/embedded-api/models/errors/apierror";
21
16
  import "@gusto/embedded-api/models/errors/sdkvalidationerror";
22
17
  import "@tanstack/react-query";
23
- import { useBase as H } from "../../../Base/useBase.js";
18
+ import { useBase as z } from "../../../Base/useBase.js";
19
+ import { componentEvents as b } from "../../../../shared/constants.js";
24
20
  import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
25
21
  import "dompurify";
26
22
  import "../../../../contexts/LocaleProvider/useLocale.js";
23
+ import { TextInputField as H } from "../../../Common/Fields/TextInputField/TextInputField.js";
24
+ import { RadioGroupField as f } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
25
+ import { NumberInputField as c } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
27
26
  const Y = r.object({
28
27
  active: r.boolean(),
29
28
  amount: r.number().min(0).transform(String),
@@ -36,14 +35,14 @@ const Y = r.object({
36
35
  deductAsPercentage: r.boolean(),
37
36
  garnishmentType: r.nativeEnum(G)
38
37
  });
39
- function De({
38
+ function Ae({
40
39
  deduction: e,
41
40
  employeeId: h,
42
41
  selectedGarnishmentType: A,
43
42
  selectedGarnishmentTitle: D,
44
43
  onCancel: y
45
44
  }) {
46
- const { onEvent: p, baseSubmitHandler: x } = H(), { t: n } = L("Employee.Deductions"), u = _(), { mutateAsync: P, isPending: E } = I(), { mutateAsync: v, isPending: T } = U(), M = E || T, C = w(() => ({
45
+ const { onEvent: p, baseSubmitHandler: x } = z(), { t: n } = L("Employee.Deductions"), u = _(), { mutateAsync: P, isPending: E } = I(), { mutateAsync: v, isPending: T } = U(), M = E || T, C = w(() => ({
47
46
  amount: e?.amount ? Number(e.amount) : 0,
48
47
  description: e?.description ?? "",
49
48
  times: e?.times ?? null,
@@ -88,7 +87,7 @@ function De({
88
87
  /* @__PURE__ */ t(u.Heading, { as: "h3", children: D }),
89
88
  /* @__PURE__ */ o(m, { flexDirection: "column", gap: 20, children: [
90
89
  /* @__PURE__ */ o(m, { flexDirection: "column", gap: 20, children: [
91
- /* @__PURE__ */ t($, { name: "description", label: n("descriptionLabelV2"), isRequired: !0 }),
90
+ /* @__PURE__ */ t(H, { name: "description", label: n("descriptionLabelV2"), isRequired: !0 }),
92
91
  /* @__PURE__ */ t(
93
92
  f,
94
93
  {
@@ -152,7 +151,7 @@ function De({
152
151
  )
153
152
  ] })
154
153
  ] }),
155
- /* @__PURE__ */ o(z, { children: [
154
+ /* @__PURE__ */ o($, { children: [
156
155
  /* @__PURE__ */ t(u.Button, { variant: "secondary", onClick: O, children: n("cancelCta") }),
157
156
  /* @__PURE__ */ t(u.Button, { type: "submit", isLoading: M, children: n("saveCta") })
158
157
  ] })
@@ -160,6 +159,6 @@ function De({
160
159
  }
161
160
  export {
162
161
  Y as DeductionSchema,
163
- De as default
162
+ Ae as default
164
163
  };
165
164
  //# 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 onCancel: () => void\n}\n\nfunction GarnishmentForm({\n deduction,\n employeeId,\n selectedGarnishmentType,\n selectedGarnishmentTitle,\n onCancel,\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 onCancel()\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 <Flex flexDirection=\"column\" gap={20}>\n <Flex flexDirection=\"column\" gap={20}>\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 </Flex>\n {watchedRecurring && (\n <Flex flexDirection=\"column\" gap={20}>\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 </Flex>\n )}\n </Flex>\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('saveCta')}\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","onCancel","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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GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,QAAA,gBAAAF;AAAA,UAACO;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,gBAAe;AAAA,YACf,QAAO;AAAA,YACP,OAAOnC,EAAE,kBAAkB;AAAA,YAC3B,aAAaA,EAAE,wBAAwB;AAAA,YACvC,KAAK;AAAA,UAAA;AAAA,QAAA;AAAA,QAEP,gBAAA4B;AAAA,UAACO;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,gBAAe;AAAA,YACf,QAAO;AAAA,YACP,OAAOnC,EAAE,gBAAgB;AAAA,YACzB,KAAK;AAAA,YACL,aAAaA,EAAE,sBAAsB;AAAA,UAAA;AAAA,QAAA;AAAA,MACvC,EAAA,CACF;AAAA,IAAA,GAEJ;AAAA,sBACCoC,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,UAAAV,EAAE,SAAS,EAAA,CACd;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 onCancel: () => void\n}\n\nfunction GarnishmentForm({\n deduction,\n employeeId,\n selectedGarnishmentType,\n selectedGarnishmentTitle,\n onCancel,\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 onCancel()\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 <Flex flexDirection=\"column\" gap={20}>\n <Flex flexDirection=\"column\" gap={20}>\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 </Flex>\n {watchedRecurring && (\n <Flex flexDirection=\"column\" gap={20}>\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 </Flex>\n )}\n </Flex>\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('saveCta')}\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","onCancel","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,IAAk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mB,IACM,yCACA,iCADsC;AAAA,UACL;AAAA,QAAA;AAAA,MAE3C,GACF;AAAA,MACCF,KACC,gBAAAc,EAACD,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,QAAA,gBAAAF;AAAA,UAACO;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,gBAAe;AAAA,YACf,QAAO;AAAA,YACP,OAAOnC,EAAE,kBAAkB;AAAA,YAC3B,aAAaA,EAAE,wBAAwB;AAAA,YACvC,KAAK;AAAA,UAAA;AAAA,QAAA;AAAA,QAEP,gBAAA4B;AAAA,UAACO;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,gBAAe;AAAA,YACf,QAAO;AAAA,YACP,OAAOnC,EAAE,gBAAgB;AAAA,YACzB,KAAK;AAAA,YACL,aAAaA,EAAE,sBAAsB;AAAA,UAAA;AAAA,QAAA;AAAA,MACvC,EAAA,CACF;AAAA,IAAA,GAEJ;AAAA,sBACCoC,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,UAAAV,EAAE,SAAS,EAAA,CACd;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
@@ -5,25 +5,24 @@ import { useGarnishmentsUpdateMutation as k } from "@gusto/embedded-api/react-qu
5
5
  import { BaseComponent as w } from "../../../Base/Base.js";
6
6
  import { useBase as U } from "../../../Base/useBase.js";
7
7
  import { Flex as E } from "../../../Common/Flex/Flex.js";
8
- import "classnames";
9
- import { componentEvents as c } from "../../../../shared/constants.js";
10
8
  import { ActionsLayout as Y } from "../../../Common/ActionsLayout/ActionsLayout.js";
11
9
  import { HamburgerMenu as B } from "../../../Common/HamburgerMenu/HamburgerMenu.js";
12
- import p from "../../../../hooks/useNumberFormatter.js";
10
+ import D from "../../../../hooks/useNumberFormatter.js";
13
11
  import S from "../../../../assets/icons/pencil.svg.js";
14
12
  import V from "../../../../assets/icons/trashcan.svg.js";
15
13
  import { useComponentDictionary as q, useI18n as F } from "../../../../i18n/I18n.js";
14
+ import { componentEvents as c } from "../../../../shared/constants.js";
16
15
  import { useComponentContext as H } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
17
16
  import j from "../../../../assets/icons/plus-circle.svg.js";
18
17
  import { useDataView as G } from "../../../Common/DataView/useDataView.js";
19
18
  import { DataView as R } from "../../../Common/DataView/DataView.js";
20
- function de(i) {
19
+ function le(i) {
21
20
  return /* @__PURE__ */ n(w, { ...i, children: /* @__PURE__ */ n(z, { ...i, children: i.children }) });
22
21
  }
23
- function z({ className: i, children: m, employeeId: D, dictionary: f }) {
24
- const { onEvent: o, baseSubmitHandler: h } = U(), { t } = N("Employee.Deductions"), a = H(), g = p("currency"), C = p("percent");
22
+ function z({ className: i, children: m, employeeId: p, dictionary: f }) {
23
+ const { onEvent: o, baseSubmitHandler: h } = U(), { t } = N("Employee.Deductions"), a = H(), g = D("currency"), C = D("percent");
25
24
  q("Employee.Deductions", f), F("Employee.Deductions");
26
- const { data: v } = I({ employeeId: D }), u = v.garnishmentList, T = u.filter((e) => e.active), { mutateAsync: y, isPending: L } = k(), P = async (e) => {
25
+ const { data: v } = I({ employeeId: p }), u = v.garnishmentList, T = u.filter((e) => e.active), { mutateAsync: y, isPending: L } = k(), P = async (e) => {
27
26
  await h(e, async (r) => {
28
27
  const { garnishment: l } = await y({
29
28
  request: {
@@ -104,6 +103,6 @@ function z({ className: i, children: m, employeeId: D, dictionary: f }) {
104
103
  ] }) }) });
105
104
  }
106
105
  export {
107
- de as DeductionsList
106
+ le as DeductionsList
108
107
  };
109
108
  //# sourceMappingURL=DeductionsList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DeductionsList.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsList/DeductionsList.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useGarnishmentsListSuspense } from '@gusto/embedded-api/react-query/garnishmentsList'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { useDataView, DataView } from '@/components/Common'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport useNumberFormatter from '@/hooks/useNumberFormatter'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport PlusCircleIcon from '@/assets/icons/plus-circle.svg?react'\n\ninterface DeductionsListProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n}\n\nexport function DeductionsList(props: DeductionsListProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ className, children, employeeId, dictionary }: DeductionsListProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n const formatCurrency = useNumberFormatter('currency')\n const formatPercent = useNumberFormatter('percent')\n\n useComponentDictionary('Employee.Deductions', dictionary)\n useI18n('Employee.Deductions')\n\n const { data } = useGarnishmentsListSuspense({ employeeId })\n const deductions = data.garnishmentList!\n const activeDeductions = deductions.filter(deduction => deduction.active)\n\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n\n const handleDelete = async (deduction: Garnishment) => {\n await baseSubmitHandler(deduction, async payload => {\n const { garnishment } = await updateDeduction({\n request: {\n garnishmentId: payload.uuid,\n requestBody: {\n ...payload,\n totalAmount: payload.totalAmount ?? undefined,\n active: false,\n version: payload.version as string,\n },\n },\n })\n\n // if soft deleted deduction was the last active, then return to empty view\n // else if any other active deductions return to list view\n const remainingActiveDeductions = deductions.filter(d => d.active)\n\n if (\n remainingActiveDeductions.length === 1 &&\n remainingActiveDeductions[0]?.uuid === garnishment?.uuid\n ) {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DELETED_EMPTY)\n } else {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DELETED, garnishment)\n }\n })\n }\n\n const handleEdit = (deduction: Garnishment) => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_EDIT, deduction)\n }\n\n const handleAdd = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_ADD)\n }\n\n const handleContinue = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DONE)\n }\n\n const { ...dataViewProps } = useDataView({\n data: activeDeductions,\n columns: [\n {\n key: 'description',\n title: t('nameColumn'),\n },\n {\n key: 'recurring',\n title: t('frequencyColumn'),\n render: deduction => {\n return deduction.recurring ? t('recurringText') : t('nonRecurringText')\n },\n },\n {\n key: 'amount',\n title: t('withheldColumn'),\n render: deduction => {\n const formattedAmount = deduction.deductAsPercentage\n ? formatPercent(Number(deduction.amount))\n : formatCurrency(Number(deduction.amount))\n return deduction.recurring\n ? t('recurringAmount', { value: formattedAmount })\n : formattedAmount\n },\n },\n ],\n itemMenu: deduction => {\n return (\n <HamburgerMenu\n isLoading={isPendingUpdate}\n items={[\n {\n label: t('editCta'),\n onClick: () => {\n handleEdit(deduction)\n },\n icon: <PencilSvg aria-hidden />,\n },\n {\n label: t('deleteCta'),\n onClick: async () => {\n await handleDelete(deduction)\n },\n icon: <TrashCanSvg aria-hidden />,\n },\n ]}\n />\n )\n },\n })\n\n return (\n <section className={className}>\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Flex flexDirection=\"column\" gap={2}>\n <Components.Heading as=\"h2\">{t('pageTitle')}</Components.Heading>\n <Components.Text variant=\"supporting\">\n {t('includeDeductionsDescriptionV2')}\n </Components.Text>\n </Flex>\n\n <DataView label={t('deductionsTableLabel')} {...dataViewProps} />\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleAdd}>\n <PlusCircleIcon />\n {t('addDeductionCta')}\n </Components.Button>\n <Components.Button onClick={handleContinue}>{t('continueCta')}</Components.Button>\n </ActionsLayout>\n </>\n )}\n </Flex>\n </section>\n )\n}\n"],"names":["DeductionsList","props","jsx","BaseComponent","Root","className","children","employeeId","dictionary","onEvent","baseSubmitHandler","useBase","useTranslation","Components","useComponentContext","formatCurrency","useNumberFormatter","formatPercent","useComponentDictionary","useI18n","data","useGarnishmentsListSuspense","deductions","activeDeductions","deduction","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","handleDelete","payload","garnishment","remainingActiveDeductions","d","componentEvents","handleEdit","handleAdd","handleContinue","dataViewProps","useDataView","formattedAmount","HamburgerMenu","PencilSvg","TrashCanSvg","Flex","jsxs","Fragment","DataView","ActionsLayout","PlusCircleIcon"],"mappings":";;;;;;;;;;;;;;;;;;;AA2BO,SAASA,GAAeC,GAAqD;AAClF,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,SAASG,EAAK,EAAE,WAAAC,GAAW,UAAAC,GAAU,YAAAC,GAAY,YAAAC,KAAmC;AAClF,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,EAAA,GACjC,EAAE,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA,GACbC,IAAiBC,EAAmB,UAAU,GAC9CC,IAAgBD,EAAmB,SAAS;AAElD,EAAAE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MAAX,EAAgB,SAAQ,cACtB,UAAA,EAAE,gCAAgC,EAAA,CACrC;AAAA,IAAA,GACF;AAAA,sBAECiC,GAAA,EAAS,OAAO,EAAE,sBAAsB,GAAI,GAAGT,GAAe;AAAA,sBAC9DU,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAH,EAAC/B,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASsB,GAC9C,UAAA;AAAA,QAAA,gBAAAjC,EAAC8C,GAAA,EAAe;AAAA,QACf,EAAE,iBAAiB;AAAA,MAAA,GACtB;AAAA,MACA,gBAAA9C,EAACW,EAAW,QAAX,EAAkB,SAASuB,GAAiB,UAAA,EAAE,aAAa,EAAA,CAAE;AAAA,IAAA,EAAA,CAChE;AAAA,EAAA,EAAA,CACF,GAEJ,GACF;AAEJ;"}
1
+ {"version":3,"file":"DeductionsList.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsList/DeductionsList.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useGarnishmentsListSuspense } from '@gusto/embedded-api/react-query/garnishmentsList'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { useDataView, DataView } from '@/components/Common'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport useNumberFormatter from '@/hooks/useNumberFormatter'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport PlusCircleIcon from '@/assets/icons/plus-circle.svg?react'\n\ninterface DeductionsListProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n}\n\nexport function DeductionsList(props: DeductionsListProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ className, children, employeeId, dictionary }: DeductionsListProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n const formatCurrency = useNumberFormatter('currency')\n const formatPercent = useNumberFormatter('percent')\n\n useComponentDictionary('Employee.Deductions', dictionary)\n useI18n('Employee.Deductions')\n\n const { data } = useGarnishmentsListSuspense({ employeeId })\n const deductions = data.garnishmentList!\n const activeDeductions = deductions.filter(deduction => deduction.active)\n\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n\n const handleDelete = async (deduction: Garnishment) => {\n await baseSubmitHandler(deduction, async payload => {\n const { garnishment } = await updateDeduction({\n request: {\n garnishmentId: payload.uuid,\n requestBody: {\n ...payload,\n totalAmount: payload.totalAmount ?? undefined,\n active: false,\n version: payload.version as string,\n },\n },\n })\n\n // if soft deleted deduction was the last active, then return to empty view\n // else if any other active deductions return to list view\n const remainingActiveDeductions = deductions.filter(d => d.active)\n\n if (\n remainingActiveDeductions.length === 1 &&\n remainingActiveDeductions[0]?.uuid === garnishment?.uuid\n ) {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DELETED_EMPTY)\n } else {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DELETED, garnishment)\n }\n })\n }\n\n const handleEdit = (deduction: Garnishment) => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_EDIT, deduction)\n }\n\n const handleAdd = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_ADD)\n }\n\n const handleContinue = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DONE)\n }\n\n const { ...dataViewProps } = useDataView({\n data: activeDeductions,\n columns: [\n {\n key: 'description',\n title: t('nameColumn'),\n },\n {\n key: 'recurring',\n title: t('frequencyColumn'),\n render: deduction => {\n return deduction.recurring ? t('recurringText') : t('nonRecurringText')\n },\n },\n {\n key: 'amount',\n title: t('withheldColumn'),\n render: deduction => {\n const formattedAmount = deduction.deductAsPercentage\n ? formatPercent(Number(deduction.amount))\n : formatCurrency(Number(deduction.amount))\n return deduction.recurring\n ? t('recurringAmount', { value: formattedAmount })\n : formattedAmount\n },\n },\n ],\n itemMenu: deduction => {\n return (\n <HamburgerMenu\n isLoading={isPendingUpdate}\n items={[\n {\n label: t('editCta'),\n onClick: () => {\n handleEdit(deduction)\n },\n icon: <PencilSvg aria-hidden />,\n },\n {\n label: t('deleteCta'),\n onClick: async () => {\n await handleDelete(deduction)\n },\n icon: <TrashCanSvg aria-hidden />,\n },\n ]}\n />\n )\n },\n })\n\n return (\n <section className={className}>\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Flex flexDirection=\"column\" gap={2}>\n <Components.Heading as=\"h2\">{t('pageTitle')}</Components.Heading>\n <Components.Text variant=\"supporting\">\n {t('includeDeductionsDescriptionV2')}\n </Components.Text>\n </Flex>\n\n <DataView label={t('deductionsTableLabel')} {...dataViewProps} />\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleAdd}>\n <PlusCircleIcon />\n {t('addDeductionCta')}\n </Components.Button>\n <Components.Button onClick={handleContinue}>{t('continueCta')}</Components.Button>\n </ActionsLayout>\n </>\n )}\n </Flex>\n </section>\n )\n}\n"],"names":["DeductionsList","props","jsx","BaseComponent","Root","className","children","employeeId","dictionary","onEvent","baseSubmitHandler","useBase","useTranslation","Components","useComponentContext","formatCurrency","useNumberFormatter","formatPercent","useComponentDictionary","useI18n","data","useGarnishmentsListSuspense","deductions","activeDeductions","deduction","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","handleDelete","payload","garnishment","remainingActiveDeductions","d","componentEvents","handleEdit","handleAdd","handleContinue","dataViewProps","useDataView","formattedAmount","HamburgerMenu","PencilSvg","TrashCanSvg","Flex","jsxs","Fragment","DataView","ActionsLayout","PlusCircleIcon"],"mappings":";;;;;;;;;;;;;;;;;;AA2BO,SAASA,GAAeC,GAAqD;AAClF,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,SAASG,EAAK,EAAE,WAAAC,GAAW,UAAAC,GAAU,YAAAC,GAAY,YAAAC,KAAmC;AAClF,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,EAAA,GACjC,EAAE,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA,GACbC,IAAiBC,EAAmB,UAAU,GAC9CC,IAAgBD,EAAmB,SAAS;AAElD,EAAAE,EAAuB,uBAAuBV,CAAU,GACxDW,EAAQ,qBAAqB;AAE7B,QAAM,EAAE,MAAAC,EAAA,IAASC,EAA4B,EAAE,YAAAd,GAAY,GACrDe,IAAaF,EAAK,iBAClBG,IAAmBD,EAAW,OAAO,CAAAE,MAAaA,EAAU,MAAM,GAElE,EAAE,aAAaC,GAAiB,WAAWC,EAAA,IAC/CC,EAAA,GAEIC,IAAe,OAAOJ,MAA2B;AACrD,UAAMd,EAAkBc,GAAW,OAAMK,MAAW;AAClD,YAAM,EAAE,aAAAC,MAAgB,MAAML,EAAgB;AAAA,QAC5C,SAAS;AAAA,UACP,eAAeI,EAAQ;AAAA,UACvB,aAAa;AAAA,YACX,GAAGA;AAAA,YACH,aAAaA,EAAQ,eAAe;AAAA,YACpC,QAAQ;AAAA,YACR,SAASA,EAAQ;AAAA,UAAA;AAAA,QACnB;AAAA,MACF,CACD,GAIKE,IAA4BT,EAAW,OAAO,CAAAU,MAAKA,EAAE,MAAM;AAEjE,MACED,EAA0B,WAAW,KACrCA,EAA0B,CAAC,GAAG,SAASD,GAAa,OAEpDrB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OAAO,EAAE,WAAW;AAAA,YACpB,SAAS,YAAY;AACnB,oBAAMb,EAAaJ,CAAS;AAAA,YAC9B;AAAA,YACA,MAAM,gBAAAtB,EAACwC,GAAA,EAAY,eAAW,GAAA,CAAC;AAAA,UAAA;AAAA,QACjC;AAAA,MACF;AAAA,IAAA;AAAA,EAGN,CACD;AAED,SACE,gBAAAxC,EAAC,WAAA,EAAQ,WAAAG,GACP,UAAA,gBAAAH,EAACyC,GAAA,EAAK,eAAc,UAAS,KAAK,IAC/B,UAAArC,KAGC,gBAAAsC,EAAAC,GAAA,EACE,UAAA;AAAA,IAAA,gBAAAD,EAACD,GAAA,EAAK,eAAc,UAAS,KAAK,GAChC,UAAA;AAAA,MAAA,gBAAAzC,EAACW,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAA,EAAE,WAAW,GAAE;AAAA,MAC5C,gBAAAX,EAACW,EAAW,MAAX,EAAgB,SAAQ,cACtB,UAAA,EAAE,gCAAgC,EAAA,CACrC;AAAA,IAAA,GACF;AAAA,sBAECiC,GAAA,EAAS,OAAO,EAAE,sBAAsB,GAAI,GAAGT,GAAe;AAAA,sBAC9DU,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAH,EAAC/B,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASsB,GAC9C,UAAA;AAAA,QAAA,gBAAAjC,EAAC8C,GAAA,EAAe;AAAA,QACf,EAAE,iBAAiB;AAAA,MAAA,GACtB;AAAA,MACA,gBAAA9C,EAACW,EAAW,QAAX,EAAkB,SAASuB,GAAiB,UAAA,EAAE,aAAa,EAAA,CAAE;AAAA,IAAA,EAAA,CAChE;AAAA,EAAA,EAAA,CACF,GAEJ,GACF;AAEJ;"}
@@ -1,16 +1,15 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
- import { useTranslation as r } from "react-i18next";
3
- import { useDocumentList as e } from "./useDocumentList.js";
2
+ import { useTranslation as e } from "react-i18next";
3
+ import { useDocumentList as r } from "./useDocumentList.js";
4
4
  import "../../../../shared/constants.js";
5
- import "classnames";
6
5
  import { ActionsLayout as m } from "../../../Common/ActionsLayout/ActionsLayout.js";
7
6
  import { useComponentContext as s } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
8
7
  import "react";
9
- function h() {
10
- const { t } = r("Employee.DocumentSigner"), { handleContinue: n } = e(), i = s();
8
+ function d() {
9
+ const { t } = e("Employee.DocumentSigner"), { handleContinue: n } = r(), i = s();
11
10
  return /* @__PURE__ */ o(m, { children: /* @__PURE__ */ o(i.Button, { onClick: n, isLoading: !1, children: t("continueCta") }) });
12
11
  }
13
12
  export {
14
- h as Actions
13
+ d as Actions
15
14
  };
16
15
  //# sourceMappingURL=Actions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Actions.js","sources":["../../../../../src/components/Employee/DocumentSigner/DocumentList/Actions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useDocumentList } from './useDocumentList'\nimport { ActionsLayout } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport function Actions() {\n const { t } = useTranslation('Employee.DocumentSigner')\n const { handleContinue } = useDocumentList()\n const Components = useComponentContext()\n\n return (\n <ActionsLayout>\n <Components.Button onClick={handleContinue} isLoading={false}>\n {t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n )\n}\n"],"names":["Actions","useTranslation","handleContinue","useDocumentList","Components","useComponentContext","jsx","ActionsLayout"],"mappings":";;;;;;;;AAKO,SAASA,IAAU;AACxB,QAAM,EAAE,EAAA,IAAMC,EAAe,yBAAyB,GAChD,EAAE,gBAAAC,EAAA,IAAmBC,EAAA,GACrBC,IAAaC,EAAA;AAEnB,SACE,gBAAAC,EAACC,GAAA,EACC,UAAA,gBAAAD,EAACF,EAAW,QAAX,EAAkB,SAASF,GAAgB,WAAW,IACpD,UAAA,EAAE,aAAa,GAClB,GACF;AAEJ;"}
1
+ {"version":3,"file":"Actions.js","sources":["../../../../../src/components/Employee/DocumentSigner/DocumentList/Actions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useDocumentList } from './useDocumentList'\nimport { ActionsLayout } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport function Actions() {\n const { t } = useTranslation('Employee.DocumentSigner')\n const { handleContinue } = useDocumentList()\n const Components = useComponentContext()\n\n return (\n <ActionsLayout>\n <Components.Button onClick={handleContinue} isLoading={false}>\n {t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n )\n}\n"],"names":["Actions","useTranslation","handleContinue","useDocumentList","Components","useComponentContext","jsx","ActionsLayout"],"mappings":";;;;;;;AAKO,SAASA,IAAU;AACxB,QAAM,EAAE,EAAA,IAAMC,EAAe,yBAAyB,GAChD,EAAE,gBAAAC,EAAA,IAAmBC,EAAA,GACrBC,IAAaC,EAAA;AAEnB,SACE,gBAAAC,EAACC,GAAA,EACC,UAAA,gBAAAD,EAACF,EAAW,QAAX,EAAkB,SAASF,GAAgB,WAAW,IACpD,UAAA,EAAE,aAAa,GAClB,GACF;AAEJ;"}
@@ -9,11 +9,10 @@ import { useBase as O } from "../../../Base/useBase.js";
9
9
  import { useI18n as S } from "../../../../i18n/I18n.js";
10
10
  import { componentEvents as i } from "../../../../shared/constants.js";
11
11
  import { Flex as _ } from "../../../Common/Flex/Flex.js";
12
- import "classnames";
13
12
  import "react-i18next";
14
13
  import "../../../../contexts/ComponentAdapter/useComponentContext.js";
15
14
  import "react";
16
- function H(e) {
15
+ function G(e) {
17
16
  return /* @__PURE__ */ o(h, { ...e, children: /* @__PURE__ */ o(x, { ...e }) });
18
17
  }
19
18
  function x({ employeeId: e, className: s, children: r }) {
@@ -42,6 +41,6 @@ function x({ employeeId: e, className: s, children: r }) {
42
41
  ) });
43
42
  }
44
43
  export {
45
- H as DocumentList
44
+ G as DocumentList
46
45
  };
47
46
  //# sourceMappingURL=DocumentList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentList.js","sources":["../../../../../src/components/Employee/DocumentSigner/DocumentList/DocumentList.tsx"],"sourcesContent":["import { useEmployeeFormsListSuspense } from '@gusto/embedded-api/react-query/employeeFormsList'\nimport { type Form } from '@gusto/embedded-api/models/components/form'\nimport { Head } from './Head'\nimport { List } from './List'\nimport { Actions } from './Actions'\nimport { DocumentListProvider } from './useDocumentList'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { Flex } from '@/components/Common'\n\ninterface DocumentListProps extends CommonComponentInterface {\n employeeId: string\n}\n\nexport function DocumentList(props: DocumentListProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nfunction Root({ employeeId, className, children }: DocumentListProps) {\n useI18n('Employee.DocumentSigner')\n const { onEvent } = useBase()\n\n const { data, error: documentListError } = useEmployeeFormsListSuspense({ employeeId })\n const employeeForms = data.formList!\n\n const handleRequestFormToSign = (data: Form) => {\n const fullForm = employeeForms.find(f => f.uuid === data.uuid)\n onEvent(componentEvents.EMPLOYEE_VIEW_FORM_TO_SIGN, { uuid: data.uuid, name: fullForm?.name })\n }\n\n const handleContinue = () => {\n onEvent(componentEvents.EMPLOYEE_FORMS_DONE)\n }\n\n return (\n <section className={className}>\n <DocumentListProvider\n value={{\n employeeForms,\n handleContinue,\n handleRequestFormToSign,\n documentListError,\n }}\n >\n {children ? (\n children\n ) : (\n <Flex flexDirection=\"column\">\n <Head />\n <List />\n <Actions />\n </Flex>\n )}\n </DocumentListProvider>\n </section>\n )\n}\n"],"names":["DocumentList","props","jsx","BaseComponent","Root","employeeId","className","children","useI18n","onEvent","useBase","data","documentListError","useEmployeeFormsListSuspense","employeeForms","DocumentListProvider","componentEvents","fullForm","jsxs","Flex","Head","List","Actions"],"mappings":";;;;;;;;;;;;;;;AAoBO,SAASA,EAAaC,GAAmD;AAC9E,SACE,gBAAAC,EAACC,KAAe,GAAGF,GACjB,4BAACG,GAAA,EAAM,GAAGH,GAAO,EAAA,CACnB;AAEJ;AAEA,SAASG,EAAK,EAAE,YAAAC,GAAY,WAAAC,GAAW,UAAAC,KAA+B;AACpE,EAAAC,EAAQ,yBAAyB;AACjC,QAAM,EAAE,SAAAC,EAAA,IAAYC,EAAA,GAEd,EAAE,MAAAC,GAAM,OAAOC,EAAA,IAAsBC,EAA6B,EAAE,YAAAR,GAAY,GAChFS,IAAgBH,EAAK;AAW3B,SACE,gBAAAT,EAAC,aAAQ,WAAAI,GACP,UAAA,gBAAAJ;AAAA,IAACa;AAAA,IAAA;AAAA,MACC,OAAO;AAAA,QACL,eAAAD;AAAA,QACA,gBATe,MAAM;AAC3B,UAAAL,EAAQO,EAAgB,mBAAmB;AAAA,QAC7C;AAAA,QAQQ,yBAfwB,CAACL,MAAe;AAC9C,gBAAMM,IAAWH,EAAc,KAAK,OAAK,EAAE,SAASH,EAAK,IAAI;AAC7D,UAAAF,EAAQO,EAAgB,4BAA4B,EAAE,MAAML,EAAK,MAAM,MAAMM,GAAU,MAAM;AAAA,QAC/F;AAAA,QAaQ,mBAAAL;AAAA,MAAA;AAAA,MAGD,UAAAL,KAGC,gBAAAW,EAACC,GAAA,EAAK,eAAc,UAClB,UAAA;AAAA,QAAA,gBAAAjB,EAACkB,GAAA,EAAK;AAAA,0BACLC,GAAA,EAAK;AAAA,0BACLC,GAAA,CAAA,CAAQ;AAAA,MAAA,EAAA,CACX;AAAA,IAAA;AAAA,EAAA,GAGN;AAEJ;"}
1
+ {"version":3,"file":"DocumentList.js","sources":["../../../../../src/components/Employee/DocumentSigner/DocumentList/DocumentList.tsx"],"sourcesContent":["import { useEmployeeFormsListSuspense } from '@gusto/embedded-api/react-query/employeeFormsList'\nimport { type Form } from '@gusto/embedded-api/models/components/form'\nimport { Head } from './Head'\nimport { List } from './List'\nimport { Actions } from './Actions'\nimport { DocumentListProvider } from './useDocumentList'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { Flex } from '@/components/Common'\n\ninterface DocumentListProps extends CommonComponentInterface {\n employeeId: string\n}\n\nexport function DocumentList(props: DocumentListProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nfunction Root({ employeeId, className, children }: DocumentListProps) {\n useI18n('Employee.DocumentSigner')\n const { onEvent } = useBase()\n\n const { data, error: documentListError } = useEmployeeFormsListSuspense({ employeeId })\n const employeeForms = data.formList!\n\n const handleRequestFormToSign = (data: Form) => {\n const fullForm = employeeForms.find(f => f.uuid === data.uuid)\n onEvent(componentEvents.EMPLOYEE_VIEW_FORM_TO_SIGN, { uuid: data.uuid, name: fullForm?.name })\n }\n\n const handleContinue = () => {\n onEvent(componentEvents.EMPLOYEE_FORMS_DONE)\n }\n\n return (\n <section className={className}>\n <DocumentListProvider\n value={{\n employeeForms,\n handleContinue,\n handleRequestFormToSign,\n documentListError,\n }}\n >\n {children ? (\n children\n ) : (\n <Flex flexDirection=\"column\">\n <Head />\n <List />\n <Actions />\n </Flex>\n )}\n </DocumentListProvider>\n </section>\n )\n}\n"],"names":["DocumentList","props","jsx","BaseComponent","Root","employeeId","className","children","useI18n","onEvent","useBase","data","documentListError","useEmployeeFormsListSuspense","employeeForms","DocumentListProvider","componentEvents","fullForm","jsxs","Flex","Head","List","Actions"],"mappings":";;;;;;;;;;;;;;AAoBO,SAASA,EAAaC,GAAmD;AAC9E,SACE,gBAAAC,EAACC,KAAe,GAAGF,GACjB,4BAACG,GAAA,EAAM,GAAGH,GAAO,EAAA,CACnB;AAEJ;AAEA,SAASG,EAAK,EAAE,YAAAC,GAAY,WAAAC,GAAW,UAAAC,KAA+B;AACpE,EAAAC,EAAQ,yBAAyB;AACjC,QAAM,EAAE,SAAAC,EAAA,IAAYC,EAAA,GAEd,EAAE,MAAAC,GAAM,OAAOC,EAAA,IAAsBC,EAA6B,EAAE,YAAAR,GAAY,GAChFS,IAAgBH,EAAK;AAW3B,SACE,gBAAAT,EAAC,aAAQ,WAAAI,GACP,UAAA,gBAAAJ;AAAA,IAACa;AAAA,IAAA;AAAA,MACC,OAAO;AAAA,QACL,eAAAD;AAAA,QACA,gBATe,MAAM;AAC3B,UAAAL,EAAQO,EAAgB,mBAAmB;AAAA,QAC7C;AAAA,QAQQ,yBAfwB,CAACL,MAAe;AAC9C,gBAAMM,IAAWH,EAAc,KAAK,OAAK,EAAE,SAASH,EAAK,IAAI;AAC7D,UAAAF,EAAQO,EAAgB,4BAA4B,EAAE,MAAML,EAAK,MAAM,MAAMM,GAAU,MAAM;AAAA,QAC/F;AAAA,QAaQ,mBAAAL;AAAA,MAAA;AAAA,MAGD,UAAAL,KAGC,gBAAAW,EAACC,GAAA,EAAK,eAAc,UAClB,UAAA;AAAA,QAAA,gBAAAjB,EAACkB,GAAA,EAAK;AAAA,0BACLC,GAAA,EAAK;AAAA,0BACLC,GAAA,CAAA,CAAQ;AAAA,MAAA,EAAA,CACX;AAAA,IAAA;AAAA,EAAA,GAGN;AAEJ;"}