@gusto/embedded-react-sdk 0.37.0-rc.1 → 0.37.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (550) hide show
  1. package/CHANGELOG.md +44 -8
  2. package/README.md +6 -0
  3. package/dist/UNSTABLE_Hooks.d.ts +1 -1
  4. package/dist/UNSTABLE_Hooks.js +50 -6
  5. package/dist/UNSTABLE_Hooks.js.map +1 -1
  6. package/dist/components/Base/Base.d.ts +2 -1
  7. package/dist/components/Base/Base.js +76 -76
  8. package/dist/components/Base/Base.js.map +1 -1
  9. package/dist/components/Base/createCompoundContext.js.map +1 -1
  10. package/dist/components/Common/DataView/DataCards/DataCards.js +42 -36
  11. package/dist/components/Common/DataView/DataCards/DataCards.js.map +1 -1
  12. package/dist/components/Common/Fields/CheckboxField/CheckboxField.d.ts +2 -0
  13. package/dist/components/Common/Fields/CheckboxField/CheckboxField.js +22 -19
  14. package/dist/components/Common/Fields/CheckboxField/CheckboxField.js.map +1 -1
  15. package/dist/components/Common/Fields/CheckboxGroupField/CheckboxGroupField.d.ts +1 -1
  16. package/dist/components/Common/Fields/CheckboxGroupField/CheckboxGroupField.js +32 -30
  17. package/dist/components/Common/Fields/CheckboxGroupField/CheckboxGroupField.js.map +1 -1
  18. package/dist/components/Common/Fields/ComboBoxField/ComboBoxField.d.ts +1 -1
  19. package/dist/components/Common/Fields/ComboBoxField/ComboBoxField.js +36 -34
  20. package/dist/components/Common/Fields/ComboBoxField/ComboBoxField.js.map +1 -1
  21. package/dist/components/Common/Fields/DatePickerField/DatePickerField.d.ts +5 -3
  22. package/dist/components/Common/Fields/DatePickerField/DatePickerField.js +52 -40
  23. package/dist/components/Common/Fields/DatePickerField/DatePickerField.js.map +1 -1
  24. package/dist/components/Common/Fields/FileInputField/FileInputField.js +24 -22
  25. package/dist/components/Common/Fields/FileInputField/FileInputField.js.map +1 -1
  26. package/dist/components/Common/Fields/MultiSelectComboBoxField/MultiSelectComboBoxField.js +24 -22
  27. package/dist/components/Common/Fields/MultiSelectComboBoxField/MultiSelectComboBoxField.js.map +1 -1
  28. package/dist/components/Common/Fields/NumberInputField/NumberInputField.d.ts +2 -0
  29. package/dist/components/Common/Fields/NumberInputField/NumberInputField.js +31 -28
  30. package/dist/components/Common/Fields/NumberInputField/NumberInputField.js.map +1 -1
  31. package/dist/components/Common/Fields/RadioGroupField/RadioGroupField.d.ts +3 -1
  32. package/dist/components/Common/Fields/RadioGroupField/RadioGroupField.js +30 -27
  33. package/dist/components/Common/Fields/RadioGroupField/RadioGroupField.js.map +1 -1
  34. package/dist/components/Common/Fields/SelectField/SelectField.d.ts +3 -1
  35. package/dist/components/Common/Fields/SelectField/SelectField.js +31 -28
  36. package/dist/components/Common/Fields/SelectField/SelectField.js.map +1 -1
  37. package/dist/components/Common/Fields/SwitchField/SwitchField.d.ts +2 -0
  38. package/dist/components/Common/Fields/SwitchField/SwitchField.js +24 -21
  39. package/dist/components/Common/Fields/SwitchField/SwitchField.js.map +1 -1
  40. package/dist/components/Common/Fields/TextAreaField/TextAreaField.js +24 -22
  41. package/dist/components/Common/Fields/TextAreaField/TextAreaField.js.map +1 -1
  42. package/dist/components/Common/Fields/TextInputField/TextInputField.d.ts +2 -0
  43. package/dist/components/Common/Fields/TextInputField/TextInputField.js +26 -23
  44. package/dist/components/Common/Fields/TextInputField/TextInputField.js.map +1 -1
  45. package/dist/components/Common/Fields/hooks/useField.d.ts +3 -2
  46. package/dist/components/Common/Fields/hooks/useField.js +37 -33
  47. package/dist/components/Common/Fields/hooks/useField.js.map +1 -1
  48. package/dist/components/Common/ReorderableList/ReorderableList.js.map +1 -1
  49. package/dist/components/Common/SignatureForm/SignatureForm.js +10 -15
  50. package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
  51. package/dist/components/Common/SignatureForm/SignatureFormActions.js +10 -14
  52. package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
  53. package/dist/components/Common/SignatureForm/SignatureFormFields.js +14 -19
  54. package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
  55. package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
  56. package/dist/components/Common/UI/Button/Button.js +33 -29
  57. package/dist/components/Common/UI/Button/Button.js.map +1 -1
  58. package/dist/components/Common/UI/Button/Button.module.scss.js +5 -3
  59. package/dist/components/Common/UI/Button/Button.module.scss.js.map +1 -1
  60. package/dist/components/Common/UI/Button/ButtonTypes.d.ts +4 -0
  61. package/dist/components/Common/UI/Button/ButtonTypes.js.map +1 -1
  62. package/dist/components/Common/UI/DescriptionList/DescriptionList.module.scss.js +2 -2
  63. package/dist/components/Common/UI/FileInput/FileInput.js +1 -1
  64. package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.js +94 -80
  65. package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.js.map +1 -1
  66. package/dist/components/Common/UI/NumberInput/NumberInput.js +1 -1
  67. package/dist/components/Common/UI/NumberInput/NumberInput.js.map +1 -1
  68. package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
  69. package/dist/components/Company/AssignSignatory/AssignSignatory.js +7 -11
  70. package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
  71. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +6 -10
  72. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
  73. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +8 -11
  74. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
  75. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +6 -9
  76. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js.map +1 -1
  77. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +15 -17
  78. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js.map +1 -1
  79. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +8 -7
  80. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  81. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +6 -9
  82. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
  83. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +5 -8
  84. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js.map +1 -1
  85. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +13 -15
  86. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js.map +1 -1
  87. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +8 -7
  88. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  89. package/dist/components/Company/AssignSignatory/TitleSelect.js +2 -5
  90. package/dist/components/Company/AssignSignatory/TitleSelect.js.map +1 -1
  91. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +10 -9
  92. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  93. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +9 -11
  94. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
  95. package/dist/components/Company/BankAccount/BankAccountForm/Form.js +9 -13
  96. package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
  97. package/dist/components/Company/BankAccount/BankAccountForm/context.js +8 -7
  98. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  99. package/dist/components/Company/BankAccount/BankAccountList/Actions.js +10 -13
  100. package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
  101. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +12 -15
  102. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
  103. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +4 -8
  104. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
  105. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +5 -8
  106. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
  107. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +11 -15
  108. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  109. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +8 -7
  110. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  111. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +11 -15
  112. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  113. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +8 -7
  114. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  115. package/dist/components/Company/FederalTaxes/Actions.js +8 -11
  116. package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
  117. package/dist/components/Company/FederalTaxes/FederalTaxes.js +15 -19
  118. package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
  119. package/dist/components/Company/FederalTaxes/Form.js +6 -8
  120. package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
  121. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +13 -12
  122. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  123. package/dist/components/Company/Industry/Actions.js +8 -11
  124. package/dist/components/Company/Industry/Actions.js.map +1 -1
  125. package/dist/components/Company/Industry/Context.js +11 -10
  126. package/dist/components/Company/Industry/Context.js.map +1 -1
  127. package/dist/components/Company/Industry/Edit.js +10 -14
  128. package/dist/components/Company/Industry/Edit.js.map +1 -1
  129. package/dist/components/Company/Locations/LocationForm/Actions.js +8 -11
  130. package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
  131. package/dist/components/Company/Locations/LocationForm/Form.js +5 -8
  132. package/dist/components/Company/Locations/LocationForm/Form.js.map +1 -1
  133. package/dist/components/Company/Locations/LocationForm/LocationForm.js +15 -19
  134. package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
  135. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +8 -7
  136. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  137. package/dist/components/Company/Locations/LocationsList/Actions.js +6 -9
  138. package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
  139. package/dist/components/Company/Locations/LocationsList/List.js +17 -19
  140. package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
  141. package/dist/components/Company/Locations/LocationsList/LocationsList.js +6 -10
  142. package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
  143. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +8 -7
  144. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  145. package/dist/components/Company/OnboardingOverview/Completed.js +12 -15
  146. package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
  147. package/dist/components/Company/OnboardingOverview/MissingRequirements.js +9 -12
  148. package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
  149. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +6 -10
  150. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
  151. package/dist/components/Company/OnboardingOverview/context.js +8 -7
  152. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  153. package/dist/components/Company/PaySchedule/PaySchedule.js +3 -6
  154. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  155. package/dist/components/Company/PaySchedule/_parts/Actions.js +10 -13
  156. package/dist/components/Company/PaySchedule/_parts/Actions.js.map +1 -1
  157. package/dist/components/Company/PaySchedule/_parts/Edit.js +23 -24
  158. package/dist/components/Company/PaySchedule/_parts/Edit.js.map +1 -1
  159. package/dist/components/Company/PaySchedule/_parts/Head.js +11 -14
  160. package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
  161. package/dist/components/Company/PaySchedule/_parts/List.js +19 -21
  162. package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
  163. package/dist/components/Company/PaySchedule/usePaySchedule.js +10 -9
  164. package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
  165. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +5 -8
  166. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
  167. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
  168. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +8 -7
  169. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  170. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +6 -9
  171. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
  172. package/dist/components/Company/StateTaxes/StateTaxesList/List.js +5 -8
  173. package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
  174. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +8 -7
  175. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  176. package/dist/components/Contractor/Address/Address.js +3 -7
  177. package/dist/components/Contractor/Address/Address.js.map +1 -1
  178. package/dist/components/Contractor/Address/Form.js +9 -12
  179. package/dist/components/Contractor/Address/Form.js.map +1 -1
  180. package/dist/components/Contractor/Address/useAddress.js +10 -9
  181. package/dist/components/Contractor/Address/useAddress.js.map +1 -1
  182. package/dist/components/Contractor/ContractorList/index.js +29 -30
  183. package/dist/components/Contractor/ContractorList/index.js.map +1 -1
  184. package/dist/components/Contractor/NewHireReport/NewHireReport.js +2 -3
  185. package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
  186. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +10 -14
  187. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -1
  188. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +2 -3
  189. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -1
  190. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +2 -5
  191. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js.map +1 -1
  192. package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js.map +1 -1
  193. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js +12 -14
  194. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js.map +1 -1
  195. package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js +12 -13
  196. package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js.map +1 -1
  197. package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js +18 -21
  198. package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js.map +1 -1
  199. package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js +3 -4
  200. package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js.map +1 -1
  201. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js +17 -19
  202. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js.map +1 -1
  203. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js +6 -8
  204. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js.map +1 -1
  205. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js +2 -4
  206. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js.map +1 -1
  207. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +2 -5
  208. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -1
  209. package/dist/components/Contractor/Profile/ContractorProfileForm.js +15 -15
  210. package/dist/components/Contractor/Profile/useContractorProfile.js +11 -8
  211. package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
  212. package/dist/components/Contractor/Submit/Submit.js +20 -22
  213. package/dist/components/Contractor/Submit/Submit.js.map +1 -1
  214. package/dist/components/Employee/Compensation/Actions.js +12 -14
  215. package/dist/components/Employee/Compensation/Actions.js.map +1 -1
  216. package/dist/components/Employee/Compensation/Compensation.js.map +1 -1
  217. package/dist/components/Employee/Compensation/Edit.js +27 -28
  218. package/dist/components/Employee/Compensation/Edit.js.map +1 -1
  219. package/dist/components/Employee/Compensation/List.js +23 -25
  220. package/dist/components/Employee/Compensation/List.js.map +1 -1
  221. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +55 -49
  222. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
  223. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +14 -13
  224. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
  225. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js.map +1 -1
  226. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +14 -13
  227. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +1 -1
  228. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +18 -19
  229. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js.map +1 -1
  230. package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.js +6 -8
  231. package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.js.map +1 -1
  232. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +6 -9
  233. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
  234. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +10 -14
  235. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  236. package/dist/components/Employee/DocumentSigner/DocumentList/List.js +2 -6
  237. package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
  238. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +8 -7
  239. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  240. package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js +24 -26
  241. package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js.map +1 -1
  242. package/dist/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.js +9 -11
  243. package/dist/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.js.map +1 -1
  244. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +11 -15
  245. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  246. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +8 -7
  247. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  248. package/dist/components/Employee/EmployeeDocuments/EmployeeDocumentsPresentation.js +6 -9
  249. package/dist/components/Employee/EmployeeDocuments/EmployeeDocumentsPresentation.js.map +1 -1
  250. package/dist/components/Employee/EmployeeList/Actions.js +6 -9
  251. package/dist/components/Employee/EmployeeList/Actions.js.map +1 -1
  252. package/dist/components/Employee/EmployeeList/EmployeeList.js +3 -7
  253. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  254. package/dist/components/Employee/EmployeeList/Head.js +5 -8
  255. package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
  256. package/dist/components/Employee/EmployeeList/List.js +16 -17
  257. package/dist/components/Employee/EmployeeList/List.js.map +1 -1
  258. package/dist/components/Employee/EmployeeList/useEmployeeList.js +8 -7
  259. package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
  260. package/dist/components/Employee/FederalTaxes/Actions.js +7 -10
  261. package/dist/components/Employee/FederalTaxes/Actions.js.map +1 -1
  262. package/dist/components/Employee/FederalTaxes/FederalForm.js +10 -13
  263. package/dist/components/Employee/FederalTaxes/FederalForm.js.map +1 -1
  264. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +8 -7
  265. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
  266. package/dist/components/Employee/Landing/Landing.js +14 -15
  267. package/dist/components/Employee/Landing/Landing.js.map +1 -1
  268. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +7 -7
  269. package/dist/components/Employee/PaymentMethod/Actions.js +8 -11
  270. package/dist/components/Employee/PaymentMethod/Actions.js.map +1 -1
  271. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +5 -8
  272. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js.map +1 -1
  273. package/dist/components/Employee/PaymentMethod/BankAccountsList.js +9 -10
  274. package/dist/components/Employee/PaymentMethod/BankAccountsList.js.map +1 -1
  275. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +7 -10
  276. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +1 -1
  277. package/dist/components/Employee/PaymentMethod/Split.js +9 -10
  278. package/dist/components/Employee/PaymentMethod/Split.js.map +1 -1
  279. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +10 -9
  280. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
  281. package/dist/components/Employee/Profile/Actions.js +8 -11
  282. package/dist/components/Employee/Profile/Actions.js.map +1 -1
  283. package/dist/components/Employee/Profile/AdminPersonalDetails.js +14 -17
  284. package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
  285. package/dist/components/Employee/Profile/HomeAddress.d.ts +3 -3
  286. package/dist/components/Employee/Profile/HomeAddress.js +45 -45
  287. package/dist/components/Employee/Profile/HomeAddress.js.map +1 -1
  288. package/dist/components/Employee/Profile/PersonalDetailsInputs.js +15 -19
  289. package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
  290. package/dist/components/Employee/Profile/Profile.js.map +1 -1
  291. package/dist/components/Employee/Profile/useProfile.js +8 -7
  292. package/dist/components/Employee/Profile/useProfile.js.map +1 -1
  293. package/dist/components/Employee/StateTaxes/Actions.js +8 -11
  294. package/dist/components/Employee/StateTaxes/Actions.js.map +1 -1
  295. package/dist/components/Employee/StateTaxes/useStateTaxes.js +8 -7
  296. package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
  297. package/dist/components/Employee/Taxes/Actions.js +8 -11
  298. package/dist/components/Employee/Taxes/Actions.js.map +1 -1
  299. package/dist/components/Employee/Taxes/FederalForm.js +10 -13
  300. package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
  301. package/dist/components/Employee/Taxes/useTaxes.js +8 -7
  302. package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
  303. package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.js +14 -17
  304. package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.js.map +1 -1
  305. package/dist/components/Employee/Terminations/TerminationFlow/TerminationFlowComponents.d.ts +1 -0
  306. package/dist/components/Employee/Terminations/TerminationFlow/TerminationFlowComponents.js +37 -33
  307. package/dist/components/Employee/Terminations/TerminationFlow/TerminationFlowComponents.js.map +1 -1
  308. package/dist/components/Employee/Terminations/TerminationFlow/terminationStateMachine.d.ts +1 -0
  309. package/dist/components/Employee/Terminations/TerminationFlow/terminationStateMachine.js +57 -45
  310. package/dist/components/Employee/Terminations/TerminationFlow/terminationStateMachine.js.map +1 -1
  311. package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummaryPresentation.js +8 -11
  312. package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummaryPresentation.js.map +1 -1
  313. package/dist/components/Flow/Flow.js +20 -23
  314. package/dist/components/Flow/Flow.js.map +1 -1
  315. package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js +16 -18
  316. package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js.map +1 -1
  317. package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js +18 -20
  318. package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js.map +1 -1
  319. package/dist/components/InformationRequests/InformationRequests.js +3 -4
  320. package/dist/components/InformationRequests/InformationRequests.js.map +1 -1
  321. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.js.map +1 -1
  322. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +8 -10
  323. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js.map +1 -1
  324. package/dist/components/Payroll/Dismissal/DismissalFlow.js +14 -14
  325. package/dist/components/Payroll/Dismissal/DismissalFlow.js.map +1 -1
  326. package/dist/components/Payroll/Dismissal/DismissalFlowComponents.d.ts +2 -2
  327. package/dist/components/Payroll/Dismissal/DismissalFlowComponents.js +8 -8
  328. package/dist/components/Payroll/Dismissal/DismissalFlowComponents.js.map +1 -1
  329. package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.d.ts +2 -1
  330. package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.js +61 -57
  331. package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.js.map +1 -1
  332. package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelectionPresentation.js +8 -11
  333. package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelectionPresentation.js.map +1 -1
  334. package/dist/components/Payroll/GrossUpModal/GrossUpModal.d.ts +1 -1
  335. package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +88 -75
  336. package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
  337. package/dist/components/Payroll/GrossUpModal/GrossUpModal.module.scss.js +6 -6
  338. package/dist/components/Payroll/GrossUpModal/GrossUpModalTypes.d.ts +0 -1
  339. package/dist/components/Payroll/OffCycle/OffCycleFlow.d.ts +1 -1
  340. package/dist/components/Payroll/OffCycle/OffCycleFlow.js +24 -18
  341. package/dist/components/Payroll/OffCycle/OffCycleFlow.js.map +1 -1
  342. package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.d.ts +2 -0
  343. package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js +30 -31
  344. package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js.map +1 -1
  345. package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js +56 -53
  346. package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -1
  347. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js +30 -32
  348. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js.map +1 -1
  349. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js +18 -26
  350. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js.map +1 -1
  351. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes.js +2 -2
  352. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes.js.map +1 -1
  353. package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js +6 -9
  354. package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js.map +1 -1
  355. package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js +12 -14
  356. package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js.map +1 -1
  357. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js +11 -14
  358. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js.map +1 -1
  359. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +12 -12
  360. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +66 -67
  361. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
  362. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +20 -21
  363. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
  364. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.d.ts +1 -1
  365. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +222 -216
  366. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
  367. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +19 -21
  368. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
  369. package/dist/components/Payroll/PayrollFlow/OffCycleFlowContextual.js +13 -6
  370. package/dist/components/Payroll/PayrollFlow/OffCycleFlowContextual.js.map +1 -1
  371. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +31 -33
  372. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
  373. package/dist/components/Payroll/PayrollList/PayrollList.js +44 -40
  374. package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
  375. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +15 -17
  376. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
  377. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +15 -15
  378. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
  379. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +58 -59
  380. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
  381. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js +7 -10
  382. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js.map +1 -1
  383. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +2 -3
  384. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
  385. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js +2 -4
  386. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js.map +1 -1
  387. package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js +11 -13
  388. package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js.map +1 -1
  389. package/dist/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.js +2 -5
  390. package/dist/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.js.map +1 -1
  391. package/dist/components/Payroll/TransitionCreation/TransitionCreationPresentation.js +12 -14
  392. package/dist/components/Payroll/TransitionCreation/TransitionCreationPresentation.js.map +1 -1
  393. package/dist/components/Payroll/helpers.d.ts +4 -0
  394. package/dist/components/Payroll/helpers.js +21 -16
  395. package/dist/components/Payroll/helpers.js.map +1 -1
  396. package/dist/components/Payroll/usePreparedPayrollData.js +4 -4
  397. package/dist/components/UNSTABLE_Hooks/collectErrors.d.ts +6 -0
  398. package/dist/components/UNSTABLE_Hooks/collectErrors.js +9 -0
  399. package/dist/components/UNSTABLE_Hooks/collectErrors.js.map +1 -0
  400. package/dist/components/UNSTABLE_Hooks/form/FormFieldsMetadataContext.d.ts +2 -2
  401. package/dist/components/UNSTABLE_Hooks/form/FormFieldsMetadataContext.js +6 -9
  402. package/dist/components/UNSTABLE_Hooks/form/FormFieldsMetadataContext.js.map +1 -1
  403. package/dist/components/UNSTABLE_Hooks/form/FormFieldsMetadataProvider.d.ts +2 -2
  404. package/dist/components/UNSTABLE_Hooks/form/FormFieldsMetadataProvider.js +13 -0
  405. package/dist/components/UNSTABLE_Hooks/form/FormFieldsMetadataProvider.js.map +1 -0
  406. package/dist/components/UNSTABLE_Hooks/form/SDKFormProvider.d.ts +11 -6
  407. package/dist/components/UNSTABLE_Hooks/form/SDKFormProvider.js +24 -0
  408. package/dist/components/UNSTABLE_Hooks/form/SDKFormProvider.js.map +1 -0
  409. package/dist/components/UNSTABLE_Hooks/form/composeFormSchema.d.ts +26 -0
  410. package/dist/components/UNSTABLE_Hooks/form/composeFormSchema.js +24 -0
  411. package/dist/components/UNSTABLE_Hooks/form/composeFormSchema.js.map +1 -0
  412. package/dist/components/UNSTABLE_Hooks/form/composeSubmitHandler.d.ts +53 -0
  413. package/dist/components/UNSTABLE_Hooks/form/composeSubmitHandler.js +34 -0
  414. package/dist/components/UNSTABLE_Hooks/form/composeSubmitHandler.js.map +1 -0
  415. package/dist/components/UNSTABLE_Hooks/form/composeSubmitHandler.test.d.ts +1 -0
  416. package/dist/components/UNSTABLE_Hooks/form/deriveFieldsMetadata.d.ts +1 -1
  417. package/dist/components/UNSTABLE_Hooks/form/deriveFieldsMetadata.js +14 -0
  418. package/dist/components/UNSTABLE_Hooks/form/deriveFieldsMetadata.js.map +1 -0
  419. package/dist/components/UNSTABLE_Hooks/form/fields/CheckboxHookField.d.ts +11 -0
  420. package/dist/components/UNSTABLE_Hooks/form/fields/CheckboxHookField.js +34 -0
  421. package/dist/components/UNSTABLE_Hooks/form/fields/CheckboxHookField.js.map +1 -0
  422. package/dist/components/UNSTABLE_Hooks/form/fields/DatePickerHookField.d.ts +11 -0
  423. package/dist/components/UNSTABLE_Hooks/form/fields/DatePickerHookField.js +34 -0
  424. package/dist/components/UNSTABLE_Hooks/form/fields/DatePickerHookField.js.map +1 -0
  425. package/dist/components/UNSTABLE_Hooks/form/fields/NumberInputHookField.d.ts +14 -0
  426. package/dist/components/UNSTABLE_Hooks/form/fields/NumberInputHookField.js +40 -0
  427. package/dist/components/UNSTABLE_Hooks/form/fields/NumberInputHookField.js.map +1 -0
  428. package/dist/components/UNSTABLE_Hooks/form/fields/RadioGroupHookField.d.ts +12 -0
  429. package/dist/components/UNSTABLE_Hooks/form/fields/RadioGroupHookField.js +40 -0
  430. package/dist/components/UNSTABLE_Hooks/form/fields/RadioGroupHookField.js.map +1 -0
  431. package/dist/components/UNSTABLE_Hooks/form/fields/SelectHookField.d.ts +12 -0
  432. package/dist/components/UNSTABLE_Hooks/form/fields/SelectHookField.js +40 -0
  433. package/dist/components/UNSTABLE_Hooks/form/fields/SelectHookField.js.map +1 -0
  434. package/dist/components/UNSTABLE_Hooks/form/fields/SwitchHookField.d.ts +11 -0
  435. package/dist/components/UNSTABLE_Hooks/form/fields/SwitchHookField.js +34 -0
  436. package/dist/components/UNSTABLE_Hooks/form/fields/SwitchHookField.js.map +1 -0
  437. package/dist/components/UNSTABLE_Hooks/form/fields/TextInputHookField.d.ts +13 -0
  438. package/dist/components/UNSTABLE_Hooks/form/fields/TextInputHookField.js +38 -0
  439. package/dist/components/UNSTABLE_Hooks/form/fields/TextInputHookField.js.map +1 -0
  440. package/dist/components/UNSTABLE_Hooks/form/fields/index.d.ts +15 -0
  441. package/dist/components/UNSTABLE_Hooks/form/getFieldWithOptions.d.ts +2 -0
  442. package/dist/components/UNSTABLE_Hooks/form/getFieldWithOptions.js +8 -0
  443. package/dist/components/UNSTABLE_Hooks/form/getFieldWithOptions.js.map +1 -0
  444. package/dist/components/UNSTABLE_Hooks/form/getFormSubmissionValues.d.ts +18 -0
  445. package/dist/components/UNSTABLE_Hooks/form/getFormSubmissionValues.js +10 -0
  446. package/dist/components/UNSTABLE_Hooks/form/getFormSubmissionValues.js.map +1 -0
  447. package/dist/components/UNSTABLE_Hooks/form/getFormSubmissionValues.test.d.ts +1 -0
  448. package/dist/components/UNSTABLE_Hooks/form/index.d.ts +8 -1
  449. package/dist/components/UNSTABLE_Hooks/form/resolveFieldError.d.ts +4 -0
  450. package/dist/components/UNSTABLE_Hooks/form/resolveFieldError.js +13 -0
  451. package/dist/components/UNSTABLE_Hooks/form/resolveFieldError.js.map +1 -0
  452. package/dist/components/UNSTABLE_Hooks/form/resolveRequiredFields.d.ts +6 -0
  453. package/dist/components/UNSTABLE_Hooks/form/resolveRequiredFields.js +14 -0
  454. package/dist/components/UNSTABLE_Hooks/form/resolveRequiredFields.js.map +1 -0
  455. package/dist/components/UNSTABLE_Hooks/form/types.d.ts +12 -0
  456. package/dist/components/UNSTABLE_Hooks/form/useFieldErrorMessage.d.ts +2 -1
  457. package/dist/components/UNSTABLE_Hooks/form/useFieldErrorMessage.js +11 -9
  458. package/dist/components/UNSTABLE_Hooks/form/useFieldErrorMessage.js.map +1 -1
  459. package/dist/components/UNSTABLE_Hooks/form/useFieldsMetadata.d.ts +2 -2
  460. package/dist/components/UNSTABLE_Hooks/form/useFieldsMetadata.js +2 -3
  461. package/dist/components/UNSTABLE_Hooks/form/useFieldsMetadata.js.map +1 -1
  462. package/dist/components/UNSTABLE_Hooks/form/useHookFieldResolution.d.ts +23 -0
  463. package/dist/components/UNSTABLE_Hooks/form/useHookFieldResolution.js +11 -0
  464. package/dist/components/UNSTABLE_Hooks/form/useHookFieldResolution.js.map +1 -0
  465. package/dist/components/UNSTABLE_Hooks/form/withOptions.js +7 -0
  466. package/dist/components/UNSTABLE_Hooks/form/withOptions.js.map +1 -0
  467. package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/CompensationForm.d.ts +5 -0
  468. package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/CompensationForm.js +149 -0
  469. package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/CompensationForm.js.map +1 -0
  470. package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/compensationSchema.d.ts +97 -0
  471. package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/compensationSchema.js +121 -0
  472. package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/compensationSchema.js.map +1 -0
  473. package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/fields.d.ts +34 -0
  474. package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/fields.js +50 -0
  475. package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/fields.js.map +1 -0
  476. package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/index.d.ts +5 -1
  477. package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/useCompensationForm.d.ts +97 -9
  478. package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/useCompensationForm.js +255 -3
  479. package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/useCompensationForm.js.map +1 -1
  480. package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/EmployeeDetailsForm.d.ts +5 -0
  481. package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/EmployeeDetailsForm.js +112 -0
  482. package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/EmployeeDetailsForm.js.map +1 -0
  483. package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/employeeDetailsSchema.d.ts +39 -0
  484. package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/employeeDetailsSchema.js +45 -0
  485. package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/employeeDetailsSchema.js.map +1 -0
  486. package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/fields.d.ts +23 -0
  487. package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/fields.js +46 -0
  488. package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/fields.js.map +1 -0
  489. package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/index.d.ts +7 -0
  490. package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/useEmployeeDetailsForm.d.ts +77 -0
  491. package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/useEmployeeDetailsForm.js +153 -0
  492. package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/useEmployeeDetailsForm.js.map +1 -0
  493. package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/WorkAddressForm.d.ts +5 -0
  494. package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/WorkAddressForm.js +69 -0
  495. package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/WorkAddressForm.js.map +1 -0
  496. package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/fields.d.ts +10 -0
  497. package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/fields.js +14 -0
  498. package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/fields.js.map +1 -0
  499. package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/index.d.ts +7 -0
  500. package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/useWorkAddressForm.d.ts +68 -0
  501. package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/useWorkAddressForm.js +129 -0
  502. package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/useWorkAddressForm.js.map +1 -0
  503. package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/workAddressSchema.d.ts +25 -0
  504. package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/workAddressSchema.js +24 -0
  505. package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/workAddressSchema.js.map +1 -0
  506. package/dist/components/UNSTABLE_Hooks/index.d.ts +8 -4
  507. package/dist/components/UNSTABLE_Hooks/types.d.ts +9 -6
  508. package/dist/components/UNSTABLE_Hooks/useErrorHandling.d.ts +9 -0
  509. package/dist/components/UNSTABLE_Hooks/useErrorHandling.js +12 -0
  510. package/dist/components/UNSTABLE_Hooks/useErrorHandling.js.map +1 -0
  511. package/dist/components/UNSTABLE_Hooks/useErrorHandling.test.d.ts +1 -0
  512. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +10 -13
  513. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
  514. package/dist/contexts/LoadingIndicatorProvider/useLoadingIndicator.d.ts +10 -2
  515. package/dist/contexts/LoadingIndicatorProvider/useLoadingIndicator.js.map +1 -1
  516. package/dist/contexts/ThemeProvider/useTheme.js.map +1 -1
  517. package/dist/helpers/requiredIf.d.ts +13 -0
  518. package/dist/helpers/requiredIf.js +8 -0
  519. package/dist/helpers/requiredIf.js.map +1 -0
  520. package/dist/i18n/I18n.js +12 -12
  521. package/dist/i18n/I18n.js.map +1 -1
  522. package/dist/i18n/en/Company.TimeOff.CreateTimeOffPolicy.json.js +26 -0
  523. package/dist/i18n/en/Company.TimeOff.CreateTimeOffPolicy.json.js.map +1 -0
  524. package/dist/i18n/en/Company.TimeOff.HolidayPolicy.json.js +24 -0
  525. package/dist/i18n/en/Company.TimeOff.HolidayPolicy.json.js.map +1 -0
  526. package/dist/i18n/en/Company.TimeOff.TimeOffPolicies.json.js +32 -0
  527. package/dist/i18n/en/Company.TimeOff.TimeOffPolicies.json.js.map +1 -0
  528. package/dist/i18n/en/Company.TimeOff.TimeOffPolicyDetails.json.js +52 -0
  529. package/dist/i18n/en/Company.TimeOff.TimeOffPolicyDetails.json.js.map +1 -0
  530. package/dist/i18n/en/Company.TimeOff.TimeOffRequests.json.js +21 -0
  531. package/dist/i18n/en/Company.TimeOff.TimeOffRequests.json.js.map +1 -0
  532. package/dist/i18n/en/Payroll.GrossUpModal.json.js +16 -14
  533. package/dist/i18n/en/Payroll.GrossUpModal.json.js.map +1 -1
  534. package/dist/i18n/en/Payroll.OffCycleTaxWithholding.json.js +5 -5
  535. package/dist/i18n/en/Payroll.PayrollEditEmployee.json.js +29 -25
  536. package/dist/i18n/en/Payroll.PayrollEditEmployee.json.js.map +1 -1
  537. package/dist/i18n/en/UNSTABLE.CompensationForm.json.js +58 -0
  538. package/dist/i18n/en/UNSTABLE.CompensationForm.json.js.map +1 -0
  539. package/dist/i18n/en/UNSTABLE.EmployeeDetailsForm.json.js +34 -0
  540. package/dist/i18n/en/UNSTABLE.EmployeeDetailsForm.json.js.map +1 -0
  541. package/dist/i18n/en/UNSTABLE.WorkAddressForm.json.js +24 -0
  542. package/dist/i18n/en/UNSTABLE.WorkAddressForm.json.js.map +1 -0
  543. package/dist/models/WA_RISK_CODES.d.ts +5 -2866
  544. package/dist/models/WA_RISK_CODES.js.map +1 -1
  545. package/dist/style.css +1 -1
  546. package/dist/types/i18next.d.ts +545 -1
  547. package/dist/types/sdkError.d.ts +7 -1
  548. package/dist/types/sdkError.js.map +1 -1
  549. package/docs/reference/endpoint-inventory.json +92 -0
  550. package/package.json +12 -12
@@ -1,6 +1,6 @@
1
1
  import { jsx as n, jsxs as l } from "react/jsx-runtime";
2
2
  import { useTranslation as W } from "react-i18next";
3
- import { useForm as H, useWatch as V, FormProvider as j } from "react-hook-form";
3
+ import { useForm as j, useWatch as H, FormProvider as V } from "react-hook-form";
4
4
  import { useMemo as K, useEffect as y } from "react";
5
5
  import { z as o } from "zod";
6
6
  import { zodResolver as z } from "@hookform/resolvers/zod";
@@ -10,18 +10,19 @@ import { useGarnishmentsUpdateMutation as J } from "@gusto/embedded-api/react-qu
10
10
  import { useComponentContext as Q } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
11
11
  import { Form as Z } 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 ee } from "../../../Common/Fields/TextInputField/TextInputField.js";
16
- import { ActionsLayout as re } from "../../../Common/ActionsLayout/ActionsLayout.js";
17
- import { NumberInputField as D } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
13
+ import { ActionsLayout as ee } from "../../../Common/ActionsLayout/ActionsLayout.js";
18
14
  import "react-error-boundary";
19
15
  import "@tanstack/react-query";
20
- import { useBase as te } from "../../../Base/useBase.js";
16
+ import { useBase as re } from "../../../Base/useBase.js";
17
+ import "@gusto/embedded-api/models/errors/apierror";
21
18
  import "@gusto/embedded-api/models/errors/gustoembeddederror";
22
- import "@gusto/embedded-api/models/errors/httpclienterrors";
23
19
  import "@gusto/embedded-api/models/errors/sdkvalidationerror";
24
- import { SelectField as N } from "../../../Common/Fields/SelectField/SelectField.js";
20
+ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
21
+ import "@gusto/embedded-api/models/errors/httpclienterrors";
22
+ import { componentEvents as M } from "../../../../shared/constants.js";
23
+ import { SelectField as f } from "../../../Common/Fields/SelectField/SelectField.js";
24
+ import { TextInputField as te } from "../../../Common/Fields/TextInputField/TextInputField.js";
25
+ import { NumberInputField as D } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
25
26
  const ne = 0, oe = 0, ie = 100, _ = "Number must be greater than or equal to 0", me = o.enum(X), ae = o.object({
26
27
  state: o.string(),
27
28
  fipsCode: o.string(),
@@ -32,17 +33,17 @@ const ne = 0, oe = 0, ie = 100, _ = "Number must be greater than or equal to 0",
32
33
  payPeriodMaximum: o.number().min(0, { error: _ }).transform((r) => r > 0 ? r.toString() : null).nullable(),
33
34
  paymentPeriod: me
34
35
  });
35
- function qe({
36
+ function Ie({
36
37
  deduction: r,
37
- handleStateAgencySelect: R,
38
- stateAgencies: A,
38
+ handleStateAgencySelect: A,
39
+ stateAgencies: R,
39
40
  counties: p,
40
- singleAllCountiesFipsCode: m,
41
+ singleAllCountiesFipsCode: u,
41
42
  employeeId: x,
42
- selectedAgency: f,
43
+ selectedAgency: N,
43
44
  onCancel: T
44
45
  }) {
45
- const { onEvent: E, baseSubmitHandler: v } = te(), { t: e } = W("Employee.Deductions"), a = Q(), g = {
46
+ const { onEvent: E, baseSubmitHandler: v } = re(), { t: e } = W("Employee.Deductions"), s = Q(), g = {
46
47
  case_number: {
47
48
  name: "caseNumber",
48
49
  description: e("caseNumberDescription")
@@ -55,11 +56,16 @@ function qe({
55
56
  name: "remittanceNumber",
56
57
  description: e("remittanceNumberDescription")
57
58
  }
58
- }, q = f?.requiredAttributes?.map((t) => ({
59
- name: g[t.key].name,
60
- label: t.label,
61
- description: g[t.key].description
62
- })) || [], { mutateAsync: I, isPending: O } = $(), { mutateAsync: k, isPending: w } = J(), U = O || w, c = K(() => ({
59
+ }, q = N?.requiredAttributes?.map((t) => {
60
+ if (!t.key || !Object.prototype.hasOwnProperty.call(g, t.key))
61
+ return null;
62
+ const a = t.key, i = g[a];
63
+ return {
64
+ name: i.name,
65
+ label: t.label,
66
+ description: i.description
67
+ };
68
+ }).filter((t) => t !== null) || [], { mutateAsync: I, isPending: O } = $(), { mutateAsync: k, isPending: w } = J(), U = O || w, c = K(() => ({
63
69
  amount: r?.amount ? Number(r.amount) : 0,
64
70
  payPeriodMaximum: r?.payPeriodMaximum ? Number(r.payPeriodMaximum) : null,
65
71
  state: r?.childSupport?.state || "",
@@ -68,19 +74,19 @@ function qe({
68
74
  orderNumber: r?.childSupport?.orderNumber || null,
69
75
  remittanceNumber: r?.childSupport?.remittanceNumber || null,
70
76
  paymentPeriod: r?.childSupport?.paymentPeriod
71
- }), [r]), d = H({
77
+ }), [r]), d = j({
72
78
  resolver: z(ae),
73
79
  defaultValues: c
74
- }), { reset: S, setValue: i, control: F } = d, b = V({ control: F, name: "state" });
80
+ }), { reset: S, setValue: m, control: F } = d, b = H({ control: F, name: "state" });
75
81
  y(() => {
76
82
  S(c);
77
83
  }, [r, c, S]), y(() => {
78
- i("caseNumber", null), i("orderNumber", null), i("remittanceNumber", null);
79
- }, [b, i]), y(() => {
80
- typeof m == "string" && i("fipsCode", m);
81
- }, [m, i]);
84
+ m("caseNumber", null), m("orderNumber", null), m("remittanceNumber", null);
85
+ }, [b, m]), y(() => {
86
+ typeof u == "string" && m("fipsCode", u);
87
+ }, [u, m]);
82
88
  const Y = async (t) => {
83
- const u = {
89
+ const a = {
84
90
  state: t.state,
85
91
  paymentPeriod: t.paymentPeriod,
86
92
  fipsCode: t.fipsCode,
@@ -88,20 +94,20 @@ function qe({
88
94
  orderNumber: t.orderNumber,
89
95
  remittanceNumber: t.remittanceNumber
90
96
  };
91
- await v(t, async (s) => {
97
+ await v(t, async (i) => {
92
98
  const C = {
93
99
  active: !0,
94
- amount: s.amount,
95
- description: `Child Support - ${u.caseNumber}`,
100
+ amount: i.amount,
101
+ description: `Child Support - ${a.caseNumber}`,
96
102
  // child support description follows prefix type + case number convention
97
103
  courtOrdered: !0,
98
104
  garnishmentType: "child_support",
99
105
  times: null,
100
106
  deductAsPercentage: !0,
101
107
  // child support must always deduct as percentage up to a pay period maximum limit and is recurring until cancelled
102
- payPeriodMaximum: s.payPeriodMaximum,
108
+ payPeriodMaximum: i.payPeriodMaximum,
103
109
  recurring: !0,
104
- childSupport: u
110
+ childSupport: a
105
111
  };
106
112
  if (r) {
107
113
  const { garnishment: h } = await k({
@@ -126,25 +132,25 @@ function qe({
126
132
  });
127
133
  }, B = () => {
128
134
  T();
129
- }, G = f?.manualPaymentRequired, L = p.length > 1 || p.length === 1 && m == null;
130
- return /* @__PURE__ */ n(j, { ...d, children: /* @__PURE__ */ n(Z, { onSubmit: d.handleSubmit(Y), children: /* @__PURE__ */ l(P, { flexDirection: "column", gap: 32, children: [
131
- /* @__PURE__ */ n(a.Heading, { as: "h3", children: e("childSupportTitle") }),
135
+ }, G = N?.manualPaymentRequired, L = p.length > 1 || p.length === 1 && u == null;
136
+ return /* @__PURE__ */ n(V, { ...d, children: /* @__PURE__ */ n(Z, { onSubmit: d.handleSubmit(Y), children: /* @__PURE__ */ l(P, { flexDirection: "column", gap: 32, children: [
137
+ /* @__PURE__ */ n(s.Heading, { as: "h3", children: e("childSupportTitle") }),
132
138
  /* @__PURE__ */ l(P, { flexDirection: "column", gap: 20, children: [
133
139
  /* @__PURE__ */ n(
134
- N,
140
+ f,
135
141
  {
136
142
  name: "state",
137
143
  label: e("agency"),
138
144
  description: e("agencyDescription"),
139
- options: A,
140
- onChange: R,
145
+ options: R,
146
+ onChange: A,
141
147
  isRequired: !0
142
148
  }
143
149
  ),
144
- G && /* @__PURE__ */ n(a.Alert, { status: "warning", label: e("manualPaymentRequired") }),
150
+ G && /* @__PURE__ */ n(s.Alert, { status: "warning", label: e("manualPaymentRequired") }),
145
151
  b && /* @__PURE__ */ l(P, { flexDirection: "column", gap: 20, children: [
146
152
  L && /* @__PURE__ */ n(
147
- N,
153
+ f,
148
154
  {
149
155
  name: "fipsCode",
150
156
  label: e("county"),
@@ -153,12 +159,12 @@ function qe({
153
159
  isRequired: !0
154
160
  }
155
161
  ),
156
- q.map(({ name: t, label: u, description: s }) => /* @__PURE__ */ n(
157
- ee,
162
+ q.map(({ name: t, label: a, description: i }) => /* @__PURE__ */ n(
163
+ te,
158
164
  {
159
165
  name: t,
160
- label: u,
161
- description: s,
166
+ label: a,
167
+ description: i,
162
168
  isRequired: !0
163
169
  },
164
170
  t
@@ -187,7 +193,7 @@ function qe({
187
193
  }
188
194
  ),
189
195
  /* @__PURE__ */ n(
190
- N,
196
+ f,
191
197
  {
192
198
  name: "paymentPeriod",
193
199
  label: e("per"),
@@ -215,13 +221,13 @@ function qe({
215
221
  )
216
222
  ] })
217
223
  ] }),
218
- /* @__PURE__ */ l(re, { children: [
219
- /* @__PURE__ */ n(a.Button, { variant: "secondary", onClick: B, children: e("cancelCta") }),
220
- b && /* @__PURE__ */ n(a.Button, { type: "submit", isLoading: U, children: e("saveCta") })
224
+ /* @__PURE__ */ l(ee, { children: [
225
+ /* @__PURE__ */ n(s.Button, { variant: "secondary", onClick: B, children: e("cancelCta") }),
226
+ b && /* @__PURE__ */ n(s.Button, { type: "submit", isLoading: U, children: e("saveCta") })
221
227
  ] })
222
228
  ] }) }) });
223
229
  }
224
230
  export {
225
- qe as default
231
+ Ie as default
226
232
  };
227
233
  //# 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 NON_NEGATIVE_ERROR = 'Number must be greater than or equal to 0'\n\nconst ChildSupportPaymentPeriodSchema = z.enum(PaymentPeriod)\n\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, { error: NON_NEGATIVE_ERROR }).transform(String),\n payPeriodMaximum: z\n .number()\n .min(0, { error: NON_NEGATIVE_ERROR })\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","NON_NEGATIVE_ERROR","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,IAAqB,6CAErBC,KAAkCC,EAAE,KAAKC,CAAa,GAEtDC,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,GAAG,EAAE,OAAOF,EAAA,CAAoB,EAAE,UAAU,MAAM;AAAA,EACzE,kBAAkBE,EACf,SACA,IAAI,GAAG,EAAE,OAAOF,GAAoB,EACpC,UAAU,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AAA,gBACpB,OAAO;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 NON_NEGATIVE_ERROR = 'Number must be greater than or equal to 0'\n\nconst ChildSupportPaymentPeriodSchema = z.enum(PaymentPeriod)\n\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, { error: NON_NEGATIVE_ERROR }).transform(String),\n payPeriodMaximum: z\n .number()\n .min(0, { error: NON_NEGATIVE_ERROR })\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 } as const\n\n const requiredSelectedAgencyAttributes =\n selectedAgency?.requiredAttributes\n ?.map(attr => {\n if (!attr.key) {\n return null\n }\n if (!Object.prototype.hasOwnProperty.call(ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER, attr.key)) {\n return null\n }\n const key = attr.key as keyof typeof ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER\n const mappedAttr = ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER[key]\n return {\n name: mappedAttr.name,\n label: attr.label as string,\n description: mappedAttr.description,\n }\n })\n .filter((attr): attr is NonNullable<typeof attr> => attr !== null) || []\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","NON_NEGATIVE_ERROR","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","key","mappedAttr","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,IAAqB,6CAErBC,KAAkCC,EAAE,KAAKC,CAAa,GAEtDC,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,GAAG,EAAE,OAAOF,EAAA,CAAoB,EAAE,UAAU,MAAM;AAAA,E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,YACL,KAAKC;AAAA,YACL,cAAa;AAAA,UAAA;AAAA,QAAA;AAAA,QAEf,gBAAA0D;AAAA,UAACI;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,OAAO3C,EAAE,KAAK;AAAA,YACd,aAAaA,EAAE,gBAAgB;AAAA,YAC/B,SAAS;AAAA,cACP;AAAA,gBACE,OAAOA,EAAE,WAAW;AAAA,gBACpB,OAAO;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,sBACCiD,IAAA,EACC,UAAA;AAAA,MAAA,gBAAAV,EAACrC,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASiC,GAC7C,UAAAnC,EAAE,WAAW,EAAA,CAChB;AAAA,MACCwB,KACC,gBAAAe,EAACrC,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWa,GACzC,UAAAf,EAAE,SAAS,EAAA,CACd;AAAA,IAAA,EAAA,CAEJ;AAAA,EAAA,EAAA,CACF,GACF,GACF;AAEJ;"}
@@ -9,18 +9,19 @@ import { useGarnishmentsUpdateMutation as w } from "@gusto/embedded-api/react-qu
9
9
  import { useComponentContext as B } 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 g } from "../../../../shared/constants.js";
14
- import { RadioGroupField as h } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
15
- import { TextInputField as G } 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 G } from "../../../Common/ActionsLayout/ActionsLayout.js";
18
13
  import "react-error-boundary";
19
14
  import "@tanstack/react-query";
20
- import { useBase as $ } from "../../../Base/useBase.js";
15
+ import { useBase as j } from "../../../Base/useBase.js";
16
+ import "@gusto/embedded-api/models/errors/apierror";
21
17
  import "@gusto/embedded-api/models/errors/gustoembeddederror";
22
- import "@gusto/embedded-api/models/errors/httpclienterrors";
23
18
  import "@gusto/embedded-api/models/errors/sdkvalidationerror";
19
+ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
20
+ import "@gusto/embedded-api/models/errors/httpclienterrors";
21
+ import { componentEvents as g } from "../../../../shared/constants.js";
22
+ import { TextInputField as $ } from "../../../Common/Fields/TextInputField/TextInputField.js";
23
+ import { RadioGroupField as h } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
24
+ import { NumberInputField as c } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
24
25
  const d = "Number must be greater than or equal to 0", z = r.object({
25
26
  active: r.boolean(),
26
27
  amount: r.number().min(0, { error: d }).transform(String),
@@ -31,8 +32,8 @@ const d = "Number must be greater than or equal to 0", z = r.object({
31
32
  totalAmount: r.number().min(0, { error: d }).transform((e) => e > 0 ? e.toString() : null).nullable(),
32
33
  deductAsPercentage: r.boolean()
33
34
  });
34
- function be({ deduction: e, employeeId: A, onCancel: D }) {
35
- const { onEvent: p, baseSubmitHandler: x } = $(), { t: n } = S("Employee.Deductions"), u = B(), { mutateAsync: E, isPending: P } = _(), { mutateAsync: y, isPending: R } = w(), v = P || R, C = V(() => ({
35
+ function fe({ deduction: e, employeeId: A, onCancel: D }) {
36
+ const { onEvent: p, baseSubmitHandler: x } = j(), { t: n } = S("Employee.Deductions"), u = B(), { mutateAsync: E, isPending: P } = _(), { mutateAsync: y, isPending: R } = w(), v = P || R, C = V(() => ({
36
37
  amount: e?.amount ? Number(e.amount) : 0,
37
38
  description: e?.description ?? "",
38
39
  times: e?.times ?? null,
@@ -76,7 +77,7 @@ function be({ deduction: e, employeeId: A, onCancel: D }) {
76
77
  /* @__PURE__ */ t(u.Heading, { as: "h3", children: n("customDeductionTitle") }),
77
78
  /* @__PURE__ */ o(m, { flexDirection: "column", gap: 20, children: [
78
79
  /* @__PURE__ */ o(m, { flexDirection: "column", gap: 20, children: [
79
- /* @__PURE__ */ t(G, { name: "description", label: n("descriptionLabelV2"), isRequired: !0 }),
80
+ /* @__PURE__ */ t($, { name: "description", label: n("descriptionLabelV2"), isRequired: !0 }),
80
81
  /* @__PURE__ */ t(
81
82
  h,
82
83
  {
@@ -140,7 +141,7 @@ function be({ deduction: e, employeeId: A, onCancel: D }) {
140
141
  )
141
142
  ] })
142
143
  ] }),
143
- /* @__PURE__ */ o(j, { children: [
144
+ /* @__PURE__ */ o(G, { children: [
144
145
  /* @__PURE__ */ t(u.Button, { variant: "secondary", onClick: O, children: n("cancelCta") }),
145
146
  /* @__PURE__ */ t(u.Button, { type: "submit", isLoading: v, children: n("saveCta") })
146
147
  ] })
@@ -148,6 +149,6 @@ function be({ deduction: e, employeeId: A, onCancel: D }) {
148
149
  }
149
150
  export {
150
151
  z as DeductionSchema,
151
- be as default
152
+ fe as default
152
153
  };
153
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\nconst NON_NEGATIVE_ERROR = 'Number must be greater than or equal to 0'\n\nexport const DeductionSchema = z.object({\n active: z.boolean(),\n amount: z.number().min(0, { error: NON_NEGATIVE_ERROR }).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, { error: NON_NEGATIVE_ERROR })\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n totalAmount: z\n .number()\n .min(0, { error: NON_NEGATIVE_ERROR })\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":["NON_NEGATIVE_ERROR","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":";;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAMA,IAAqB,6CAEdC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,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":"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\nconst NON_NEGATIVE_ERROR = 'Number must be greater than or equal to 0'\n\nexport const DeductionSchema = z.object({\n active: z.boolean(),\n amount: z.number().min(0, { error: NON_NEGATIVE_ERROR }).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, { error: NON_NEGATIVE_ERROR })\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n totalAmount: z\n .number()\n .min(0, { error: NON_NEGATIVE_ERROR })\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":["NON_NEGATIVE_ERROR","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":";;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAMA,IAAqB,6CAEdC,IAAkBC,EAAE,OAAO;AAAA,EACtC,QAAQA,EAAE,QAAA;AAAA,EACV,QAAQA,EAAE,OAAA,EAAS,IAAI,GAAG,EAAE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AAe;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 +1 @@
1
- {"version":3,"file":"DeductionsForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/DeductionsForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useState } from 'react'\nimport { useGarnishmentsListSuspense } from '@gusto/embedded-api/react-query/garnishmentsList'\nimport { useGarnishmentsGetChildSupportDataSuspense } from '@gusto/embedded-api/react-query/garnishmentsGetChildSupportData'\nimport type { GarnishmentType } from '@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments'\nimport ChildSupportForm from './ChildSupportForm'\nimport GarnishmentForm from './GarnishmentForm'\nimport CustomDeductionForm from './CustomDeductionForm'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { Grid } from '@/components/Common/Grid/Grid'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport { Flex } from '@/components/Common/Flex/Flex'\n\ninterface DeductionsFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deductionId?: string | null\n}\n\nexport function DeductionsForm(props: DeductionsFormProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\n// deductions can be either garnishment (court-ordered) or a custom deduction\nconst SUPPORTED_GARNISHMENT_TYPES: GarnishmentType[] = [\n 'child_support',\n 'federal_tax_lien',\n 'state_tax_lien',\n 'student_loan',\n 'creditor_garnishment',\n 'federal_loan',\n 'other_garnishment',\n]\n\nfunction Root({ className, employeeId, deductionId, dictionary }: DeductionsFormProps) {\n const { onEvent } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n useComponentDictionary('Employee.Deductions', dictionary)\n useI18n('Employee.Deductions')\n\n // Fetch all garnishments to find the specific one by ID\n const { data } = useGarnishmentsListSuspense({ employeeId })\n\n // Fetch child support garnishment metadata\n const { data: childSupportData } = useGarnishmentsGetChildSupportDataSuspense({})\n\n // find existing deduction to determine if in ADD or EDIT mode\n // if deduction exists we are editing, else we are adding\n const deduction = deductionId\n ? (data.garnishmentList?.find(g => g.uuid === deductionId) ?? null)\n : null\n const title = !deduction ? t('addDeductionTitle') : t('editDeductionTitle')\n const deductionType = deduction?.garnishmentType\n const stateAgencies =\n childSupportData.childSupportData?.agencies?.map(a => ({\n label: a.name as string,\n value: a.state as string,\n })) || []\n\n // if deduction exists check if it has a type, else if does not exist default to garnishment\n const [isGarnishment, setIsGarnishment] = useState<boolean>(\n (deductionType && SUPPORTED_GARNISHMENT_TYPES.includes(deductionType)) || !deduction,\n )\n const [selectedGarnishment, setSelectedGarnishment] = useState<GarnishmentType>(\n deductionType || 'child_support',\n )\n const garnishmentLabels: Record<string, string> = {\n child_support: t('childSupportTitle'),\n federal_tax_lien: t('federalTaxLien'),\n state_tax_lien: t('stateTaxLien'),\n student_loan: t('studentLoan'),\n creditor_garnishment: t('creditorGarnishment'),\n federal_loan: t('federalLoan'),\n other_garnishment: t('otherGarnishment'),\n }\n const garnishmentPlaceholder = garnishmentLabels[selectedGarnishment]\n const garnishmentOptions = SUPPORTED_GARNISHMENT_TYPES.map(garnishment => ({\n value: garnishment,\n label: garnishmentLabels[garnishment] as string,\n }))\n\n const defaultDeductionTypeSelection = deduction\n ? deductionType\n ? 'garnishment'\n : 'custom'\n : 'garnishment'\n\n // filter out specific fipsCodes/counties as mapped to selected state agency\n // some states only have 1 fips code/county to cover the entire state,\n // but the API will return a null label so we need to provide a default label\n const [stateAgency, setStateAgency] = useState<string>(deduction?.childSupport?.state || '')\n const handleStateAgencySelect = (stateAgency: string) => {\n setStateAgency(stateAgency)\n }\n const selectedAgencyFipsCodes = childSupportData.childSupportData?.agencies?.find(\n agency => agency.state === stateAgency,\n )?.fipsCodes\n const counties = (selectedAgencyFipsCodes ?? [])\n .filter(fipsCode => typeof fipsCode.code === 'string')\n .map(fipsCode => ({\n label: fipsCode.county?.length ? fipsCode.county : t('allCounties'),\n value: fipsCode.code ?? '',\n }))\n const singleFipsCode =\n selectedAgencyFipsCodes?.length === 1 ? selectedAgencyFipsCodes[0] : undefined\n const singleAllCountiesFipsCode =\n singleFipsCode && !singleFipsCode.county?.length ? singleFipsCode.code : null\n\n // get a reference to the currently selected agency to determine which required fields to display/include in submission\n const selectedAgency = childSupportData.childSupportData?.agencies?.find(\n agency => agency.state === stateAgency,\n )\n\n const handleCancel = () => {\n // if any active garnishments return to list view, else return to empty state view\n if (data.garnishmentList?.some(g => g.active)) {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CANCEL)\n } else {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CANCEL_EMPTY)\n }\n }\n\n const handleSelectDeductionType = (selection: string) => {\n setIsGarnishment(selection === 'garnishment')\n }\n\n return (\n <section className={className}>\n <Grid gap={32}>\n <Flex flexDirection=\"column\" gap={2}>\n <Components.Heading as=\"h2\">{title}</Components.Heading>\n <Components.Text variant=\"supporting\">\n {t('externalPostTaxDeductionsDescription')}\n </Components.Text>\n </Flex>\n\n {!deduction && (\n <>\n <Flex flexDirection=\"column\" gap={20}>\n <Components.RadioGroup\n label={t('deductionTypeLabel')}\n description={t('deductionTypeRadioLabel')}\n options={[\n { value: 'garnishment', label: t('garnishmentOption') },\n { value: 'custom', label: t('customDeductionOption') },\n ]}\n defaultValue={defaultDeductionTypeSelection}\n onChange={handleSelectDeductionType}\n isRequired\n />\n\n {isGarnishment && (\n <Components.Select\n label={t('garnishmentType')}\n options={garnishmentOptions}\n placeholder={garnishmentPlaceholder}\n onChange={value => {\n setSelectedGarnishment(value as GarnishmentType)\n }}\n isDisabled={!!deduction} // API does not allow to change/edit an existing deduction type\n isRequired\n />\n )}\n </Flex>\n\n <hr />\n </>\n )}\n\n {isGarnishment ? (\n <>\n {selectedGarnishment === 'child_support' ? (\n <ChildSupportForm\n deduction={deduction}\n employeeId={employeeId}\n handleStateAgencySelect={handleStateAgencySelect}\n stateAgencies={stateAgencies}\n counties={counties}\n singleAllCountiesFipsCode={singleAllCountiesFipsCode}\n selectedAgency={selectedAgency}\n onCancel={handleCancel}\n />\n ) : (\n <GarnishmentForm\n deduction={deduction}\n employeeId={employeeId}\n selectedGarnishmentType={selectedGarnishment}\n selectedGarnishmentTitle={garnishmentPlaceholder!}\n onCancel={handleCancel}\n />\n )}\n </>\n ) : (\n <CustomDeductionForm\n deduction={deduction}\n employeeId={employeeId}\n onCancel={handleCancel}\n />\n )}\n </Grid>\n </section>\n )\n}\n"],"names":["DeductionsForm","props","jsx","BaseComponent","Root","SUPPORTED_GARNISHMENT_TYPES","className","employeeId","deductionId","dictionary","onEvent","useBase","useTranslation","Components","useComponentContext","useComponentDictionary","useI18n","data","useGarnishmentsListSuspense","childSupportData","useGarnishmentsGetChildSupportDataSuspense","deduction","g","title","deductionType","stateAgencies","a","isGarnishment","setIsGarnishment","useState","selectedGarnishment","setSelectedGarnishment","garnishmentLabels","garnishmentPlaceholder","garnishmentOptions","garnishment","defaultDeductionTypeSelection","stateAgency","setStateAgency","handleStateAgencySelect","selectedAgencyFipsCodes","agency","counties","fipsCode","singleFipsCode","singleAllCountiesFipsCode","selectedAgency","handleCancel","componentEvents","handleSelectDeductionType","selection","jsxs","Grid","Flex","Fragment","value","ChildSupportForm","GarnishmentForm","CustomDeductionForm"],"mappings":";;;;;;;;;;;;;;;AA0BO,SAASA,GAAeC,GAAqD;AAClF,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAGA,MAAMI,IAAiD;AAAA,EACrD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,SAASD,EAAK,EAAE,WAAAE,GAAW,YAAAC,GAAY,aAAAC,GAAa,YAAAC,KAAmC;AACrF,QAAM,EAAE,SAAAC,EAAA,IAAYC,EAAA,GACd,EAAE,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA;AAEnB,EAAAC,EAAuB,uBAAuBN,CAAU,GACxDO,EAAQ,qBAAqB;AAG7B,QAAM,EAAE,MAAAC,EAAA,IAASC,EAA4B,EAAE,YAAAX,GAAY,GAGrD,EAAE,MAAMY,MAAqBC,EAA2C,CAAA,CAAE,GAI1EC,IAAYb,IACbS,EAAK,iBAAiB,KAAK,OAAKK,EAAE,SAASd,CAAW,KAAK,OAC5D,MACEe,IAA8C,EAArCF,IAAuC,uBAAzB,mBAA6C,GACpEG,IAAgBH,GAAW,iBAC3BI,IACJN,EAAiB,kBAAkB,UAAU,IAAI,CAAAO,OAAM;AAAA,IACrD,OAAOA,EAAE;AAAA,IACT,OAAOA,EAAE;AA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ACT,aAAaD;AAAA,YACb,UAAU,CAAAsB,MAAS;AACjB,cAAAxB,EAAuBwB,CAAwB;AAAA,YACjD;AAAA,YACA,YAAY,CAAC,CAAClC;AAAA,YACd,YAAU;AAAA,UAAA;AAAA,QAAA;AAAA,MACZ,GAEJ;AAAA,wBAEC,MAAA,CAAA,CAAG;AAAA,IAAA,GACN;AAAA,IAGDM,IACC,gBAAAzB,EAAAoD,GAAA,EACG,UAAAxB,MAAwB,kBACvB,gBAAA5B;AAAA,MAACsD;AAAA,MAAA;AAAA,QACC,WAAAnC;AAAA,QACA,YAAAd;AAAA,QACA,yBAAAgC;AAAA,QACA,eAAAd;AAAA,QACA,UAAAiB;AAAA,QACA,2BAAAG;AAAA,QACA,gBAAAC;AAAA,QACA,UAAUC;AAAA,MAAA;AAAA,IAAA,IAGZ,gBAAA7C;AAAA,MAACuD;AAAA,MAAA;AAAA,QACC,WAAApC;AAAA,QACA,YAAAd;AAAA,QACA,yBAAyBuB;AAAA,QACzB,0BAA0BG;AAAA,QAC1B,UAAUc;AAAA,MAAA;AAAA,IAAA,GAGhB,IAEA,gBAAA7C;AAAA,MAACwD;AAAA,MAAA;AAAA,QACC,WAAArC;AAAA,QACA,YAAAd;AAAA,QACA,UAAUwC;AAAA,MAAA;AAAA,IAAA;AAAA,EACZ,EAAA,CAEJ,EAAA,CACF;AAEJ;"}
1
+ {"version":3,"file":"DeductionsForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/DeductionsForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useState } from 'react'\nimport { useGarnishmentsListSuspense } from '@gusto/embedded-api/react-query/garnishmentsList'\nimport { useGarnishmentsGetChildSupportDataSuspense } from '@gusto/embedded-api/react-query/garnishmentsGetChildSupportData'\nimport type { GarnishmentType } from '@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments'\nimport ChildSupportForm from './ChildSupportForm'\nimport GarnishmentForm from './GarnishmentForm'\nimport CustomDeductionForm from './CustomDeductionForm'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { Grid } from '@/components/Common/Grid/Grid'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport { Flex } from '@/components/Common/Flex/Flex'\n\ninterface DeductionsFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deductionId?: string | null\n}\n\nexport function DeductionsForm(props: DeductionsFormProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\n// deductions can be either garnishment (court-ordered) or a custom deduction\nconst SUPPORTED_GARNISHMENT_TYPES: GarnishmentType[] = [\n 'child_support',\n 'federal_tax_lien',\n 'state_tax_lien',\n 'student_loan',\n 'creditor_garnishment',\n 'federal_loan',\n 'other_garnishment',\n]\n\nfunction Root({ className, employeeId, deductionId, dictionary }: DeductionsFormProps) {\n const { onEvent } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n useComponentDictionary('Employee.Deductions', dictionary)\n useI18n('Employee.Deductions')\n\n // Fetch all garnishments to find the specific one by ID\n const { data } = useGarnishmentsListSuspense({ employeeId })\n\n // Fetch child support garnishment metadata\n const { data: childSupportData } = useGarnishmentsGetChildSupportDataSuspense({})\n\n // find existing deduction to determine if in ADD or EDIT mode\n // if deduction exists we are editing, else we are adding\n const deduction = deductionId\n ? (data.garnishmentList?.find(g => g.uuid === deductionId) ?? null)\n : null\n const title = !deduction ? t('addDeductionTitle') : t('editDeductionTitle')\n const deductionType = deduction?.garnishmentType\n const stateAgencies =\n childSupportData.childSupportData?.agencies?.map(a => ({\n label: a.name as string,\n value: a.state as string,\n })) || []\n\n // if deduction exists check if it has a type, else if does not exist default to garnishment\n const [isGarnishment, setIsGarnishment] = useState(\n (deductionType && SUPPORTED_GARNISHMENT_TYPES.includes(deductionType)) || !deduction,\n )\n const [selectedGarnishment, setSelectedGarnishment] = useState<GarnishmentType>(\n deductionType || 'child_support',\n )\n const garnishmentLabels: Record<string, string> = {\n child_support: t('childSupportTitle'),\n federal_tax_lien: t('federalTaxLien'),\n state_tax_lien: t('stateTaxLien'),\n student_loan: t('studentLoan'),\n creditor_garnishment: t('creditorGarnishment'),\n federal_loan: t('federalLoan'),\n other_garnishment: t('otherGarnishment'),\n }\n const garnishmentPlaceholder = garnishmentLabels[selectedGarnishment]\n const garnishmentOptions = SUPPORTED_GARNISHMENT_TYPES.map(garnishment => ({\n value: garnishment,\n label: garnishmentLabels[garnishment] as string,\n }))\n\n const defaultDeductionTypeSelection = deduction\n ? deductionType\n ? 'garnishment'\n : 'custom'\n : 'garnishment'\n\n // filter out specific fipsCodes/counties as mapped to selected state agency\n // some states only have 1 fips code/county to cover the entire state,\n // but the API will return a null label so we need to provide a default label\n const [stateAgency, setStateAgency] = useState(deduction?.childSupport?.state || '')\n const handleStateAgencySelect = (stateAgency: string) => {\n setStateAgency(stateAgency)\n }\n const selectedAgencyFipsCodes = childSupportData.childSupportData?.agencies?.find(\n agency => agency.state === stateAgency,\n )?.fipsCodes\n const counties = (selectedAgencyFipsCodes ?? [])\n .filter(fipsCode => typeof fipsCode.code === 'string')\n .map(fipsCode => ({\n label: fipsCode.county?.length ? fipsCode.county : t('allCounties'),\n value: fipsCode.code ?? '',\n }))\n const singleFipsCode =\n selectedAgencyFipsCodes?.length === 1 ? selectedAgencyFipsCodes[0] : undefined\n const singleAllCountiesFipsCode =\n singleFipsCode && !singleFipsCode.county?.length ? singleFipsCode.code : null\n\n // get a reference to the currently selected agency to determine which required fields to display/include in submission\n const selectedAgency = childSupportData.childSupportData?.agencies?.find(\n agency => agency.state === stateAgency,\n )\n\n const handleCancel = () => {\n // if any active garnishments return to list view, else return to empty state view\n if (data.garnishmentList?.some(g => g.active)) {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CANCEL)\n } else {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CANCEL_EMPTY)\n }\n }\n\n const handleSelectDeductionType = (selection: string) => {\n setIsGarnishment(selection === 'garnishment')\n }\n\n return (\n <section className={className}>\n <Grid gap={32}>\n <Flex flexDirection=\"column\" gap={2}>\n <Components.Heading as=\"h2\">{title}</Components.Heading>\n <Components.Text variant=\"supporting\">\n {t('externalPostTaxDeductionsDescription')}\n </Components.Text>\n </Flex>\n\n {!deduction && (\n <>\n <Flex flexDirection=\"column\" gap={20}>\n <Components.RadioGroup\n label={t('deductionTypeLabel')}\n description={t('deductionTypeRadioLabel')}\n options={[\n { value: 'garnishment', label: t('garnishmentOption') },\n { value: 'custom', label: t('customDeductionOption') },\n ]}\n defaultValue={defaultDeductionTypeSelection}\n onChange={handleSelectDeductionType}\n isRequired\n />\n\n {isGarnishment && (\n <Components.Select\n label={t('garnishmentType')}\n options={garnishmentOptions}\n placeholder={garnishmentPlaceholder}\n onChange={value => {\n setSelectedGarnishment(value as GarnishmentType)\n }}\n isDisabled={!!deduction} // API does not allow to change/edit an existing deduction type\n isRequired\n />\n )}\n </Flex>\n\n <hr />\n </>\n )}\n\n {isGarnishment ? (\n <>\n {selectedGarnishment === 'child_support' ? (\n <ChildSupportForm\n deduction={deduction}\n employeeId={employeeId}\n handleStateAgencySelect={handleStateAgencySelect}\n stateAgencies={stateAgencies}\n counties={counties}\n singleAllCountiesFipsCode={singleAllCountiesFipsCode}\n selectedAgency={selectedAgency}\n onCancel={handleCancel}\n />\n ) : (\n <GarnishmentForm\n deduction={deduction}\n employeeId={employeeId}\n selectedGarnishmentType={selectedGarnishment}\n selectedGarnishmentTitle={garnishmentPlaceholder!}\n onCancel={handleCancel}\n />\n )}\n </>\n ) : (\n <CustomDeductionForm\n deduction={deduction}\n employeeId={employeeId}\n onCancel={handleCancel}\n />\n )}\n </Grid>\n </section>\n )\n}\n"],"names":["DeductionsForm","props","jsx","BaseComponent","Root","SUPPORTED_GARNISHMENT_TYPES","className","employeeId","deductionId","dictionary","onEvent","useBase","useTranslation","Components","useComponentContext","useComponentDictionary","useI18n","data","useGarnishmentsListSuspense","childSupportData","useGarnishmentsGetChildSupportDataSuspense","deduction","g","title","deductionType","stateAgencies","a","isGarnishment","setIsGarnishment","useState","selectedGarnishment","setSelectedGarnishment","garnishmentLabels","garnishmentPlaceholder","garnishmentOptions","garnishment","defaultDeductionTypeSelection","stateAgency","setStateAgency","handleStateAgencySelect","selectedAgencyFipsCodes","agency","counties","fipsCode","singleFipsCode","singleAllCountiesFipsCode","selectedAgency","handleCancel","componentEvents","handleSelectDeductionType","selection","jsxs","Grid","Flex","Fragment","value","ChildSupportForm","GarnishmentForm","CustomDeductionForm"],"mappings":";;;;;;;;;;;;;;;AA0BO,SAASA,GAAeC,GAAqD;AAClF,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAGA,MAAMI,IAAiD;AAAA,EACrD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,SAASD,EAAK,EAAE,WAAAE,GAAW,YAAAC,GAAY,aAAAC,GAAa,YAAAC,KAAmC;AACrF,QAAM,EAAE,SAAAC,EAAA,IAAYC,EAAA,GACd,EAAE,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA;AAEnB,EAAAC,EAAuB,uBAAuBN,CAAU,GACxDO,EAAQ,qBAAqB;AAG7B,QAAM,EAAE,MAAAC,EAAA,IAASC,EAA4B,EAAE,YAAAX,GAAY,GAGrD,EAAE,MAAMY,MAAqBC,EAA2C,CAAA,CAAE,GAI1EC,IAAYb,IACbS,EAAK,iBAAiB,KAAK,OAAKK,EAAE,SAASd,CAAW,KAAK,OAC5D,MACEe,IAA8C,EAArCF,IAAuC,uBAAzB,mBAA6C,GACp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,QAAA;AAAA,QAGXtB,KACC,gBAAAzB;AAAA,UAACW,EAAW;AAAA,UAAX;AAAA,YACC,OAAO,EAAE,iBAAiB;AAAA,YAC1B,SAASqB;AAAA,YACT,aAAaD;AAAA,YACb,UAAU,CAAAsB,MAAS;AACjB,cAAAxB,EAAuBwB,CAAwB;AAAA,YACjD;AAAA,YACA,YAAY,CAAC,CAAClC;AAAA,YACd,YAAU;AAAA,UAAA;AAAA,QAAA;AAAA,MACZ,GAEJ;AAAA,wBAEC,MAAA,CAAA,CAAG;AAAA,IAAA,GACN;AAAA,IAGDM,IACC,gBAAAzB,EAAAoD,GAAA,EACG,UAAAxB,MAAwB,kBACvB,gBAAA5B;AAAA,MAACsD;AAAA,MAAA;AAAA,QACC,WAAAnC;AAAA,QACA,YAAAd;AAAA,QACA,yBAAAgC;AAAA,QACA,eAAAd;AAAA,QACA,UAAAiB;AAAA,QACA,2BAAAG;AAAA,QACA,gBAAAC;AAAA,QACA,UAAUC;AAAA,MAAA;AAAA,IAAA,IAGZ,gBAAA7C;AAAA,MAACuD;AAAA,MAAA;AAAA,QACC,WAAApC;AAAA,QACA,YAAAd;AAAA,QACA,yBAAyBuB;AAAA,QACzB,0BAA0BG;AAAA,QAC1B,UAAUc;AAAA,MAAA;AAAA,IAAA,GAGhB,IAEA,gBAAA7C;AAAA,MAACwD;AAAA,MAAA;AAAA,QACC,WAAArC;AAAA,QACA,YAAAd;AAAA,QACA,UAAUwC;AAAA,MAAA;AAAA,IAAA;AAAA,EACZ,EAAA,CAEJ,EAAA,CACF;AAEJ;"}
@@ -10,18 +10,19 @@ import { useGarnishmentsUpdateMutation as U } from "@gusto/embedded-api/react-qu
10
10
  import { useComponentContext as j } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
11
11
  import { Form as $ } from "../../../Common/Form/Form.js";
12
12
  import { Flex as m } from "../../../Common/Flex/Flex.js";
13
- import "classnames";
14
- import { componentEvents as f } from "../../../../shared/constants.js";
15
- import { RadioGroupField as h } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
16
- import { TextInputField as z } from "../../../Common/Fields/TextInputField/TextInputField.js";
17
- import { ActionsLayout as H } from "../../../Common/ActionsLayout/ActionsLayout.js";
18
- import { NumberInputField as c } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
13
+ import { ActionsLayout as z } from "../../../Common/ActionsLayout/ActionsLayout.js";
19
14
  import "react-error-boundary";
20
15
  import "@tanstack/react-query";
21
- import { useBase as Y } from "../../../Base/useBase.js";
16
+ import { useBase as H } from "../../../Base/useBase.js";
17
+ import "@gusto/embedded-api/models/errors/apierror";
22
18
  import "@gusto/embedded-api/models/errors/gustoembeddederror";
23
- import "@gusto/embedded-api/models/errors/httpclienterrors";
24
19
  import "@gusto/embedded-api/models/errors/sdkvalidationerror";
20
+ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
21
+ import "@gusto/embedded-api/models/errors/httpclienterrors";
22
+ import { componentEvents as f } from "../../../../shared/constants.js";
23
+ import { TextInputField as Y } from "../../../Common/Fields/TextInputField/TextInputField.js";
24
+ import { RadioGroupField as h } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
25
+ import { NumberInputField as c } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
25
26
  const p = "Number must be greater than or equal to 0", k = r.object({
26
27
  active: r.boolean(),
27
28
  amount: r.number().min(0, { error: p }).transform(String),
@@ -34,14 +35,14 @@ const p = "Number must be greater than or equal to 0", k = r.object({
34
35
  deductAsPercentage: r.boolean(),
35
36
  garnishmentType: r.enum(w)
36
37
  });
37
- function Ae({
38
+ function De({
38
39
  deduction: e,
39
40
  employeeId: A,
40
41
  selectedGarnishmentType: D,
41
42
  selectedGarnishmentTitle: y,
42
43
  onCancel: x
43
44
  }) {
44
- const { onEvent: d, baseSubmitHandler: E } = Y(), { t: n } = N("Employee.Deductions"), u = j(), { mutateAsync: P, isPending: T } = B(), { mutateAsync: R, isPending: v } = U(), M = T || v, O = I(() => ({
45
+ const { onEvent: d, baseSubmitHandler: E } = H(), { t: n } = N("Employee.Deductions"), u = j(), { mutateAsync: P, isPending: T } = B(), { mutateAsync: R, isPending: v } = U(), M = T || v, O = I(() => ({
45
46
  amount: e?.amount ? Number(e.amount) : 0,
46
47
  description: e?.description ?? "",
47
48
  times: e?.times ?? null,
@@ -86,7 +87,7 @@ function Ae({
86
87
  /* @__PURE__ */ t(u.Heading, { as: "h3", children: y }),
87
88
  /* @__PURE__ */ o(m, { flexDirection: "column", gap: 20, children: [
88
89
  /* @__PURE__ */ o(m, { flexDirection: "column", gap: 20, children: [
89
- /* @__PURE__ */ t(z, { name: "description", label: n("descriptionLabelV2"), isRequired: !0 }),
90
+ /* @__PURE__ */ t(Y, { name: "description", label: n("descriptionLabelV2"), isRequired: !0 }),
90
91
  /* @__PURE__ */ t(
91
92
  h,
92
93
  {
@@ -150,7 +151,7 @@ function Ae({
150
151
  )
151
152
  ] })
152
153
  ] }),
153
- /* @__PURE__ */ o(H, { children: [
154
+ /* @__PURE__ */ o(z, { children: [
154
155
  /* @__PURE__ */ t(u.Button, { variant: "secondary", onClick: F, children: n("cancelCta") }),
155
156
  /* @__PURE__ */ t(u.Button, { type: "submit", isLoading: M, children: n("saveCta") })
156
157
  ] })
@@ -158,6 +159,6 @@ function Ae({
158
159
  }
159
160
  export {
160
161
  k as DeductionSchema,
161
- Ae as default
162
+ De as default
162
163
  };
163
164
  //# sourceMappingURL=GarnishmentForm.js.map