@gusto/embedded-react-sdk 0.21.0 → 0.22.0

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 (300) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +32 -17
  3. package/dist/assets/icons/icon-file-outline.svg.js +10 -0
  4. package/dist/assets/icons/icon-file-outline.svg.js.map +1 -0
  5. package/dist/assets/icons/icon-receipt-outline.svg.js +10 -0
  6. package/dist/assets/icons/icon-receipt-outline.svg.js.map +1 -0
  7. package/dist/components/Base/Base.js.map +1 -1
  8. package/dist/components/Base/index.d.ts +1 -1
  9. package/dist/components/Common/Fields/CheckboxField/CheckboxField.js.map +1 -1
  10. package/dist/components/Common/Fields/CheckboxGroupField/CheckboxGroupField.js.map +1 -1
  11. package/dist/components/Common/Fields/ComboBoxField/ComboBoxField.js.map +1 -1
  12. package/dist/components/Common/Fields/DatePickerField/DatePickerField.js.map +1 -1
  13. package/dist/components/Common/Fields/NumberInputField/NumberInputField.js.map +1 -1
  14. package/dist/components/Common/Fields/RadioGroupField/RadioGroupField.js.map +1 -1
  15. package/dist/components/Common/Fields/SelectField/SelectField.js.map +1 -1
  16. package/dist/components/Common/Fields/SwitchField/SwitchField.js.map +1 -1
  17. package/dist/components/Common/Fields/TextAreaField/TextAreaField.js.map +1 -1
  18. package/dist/components/Common/Fields/TextInputField/TextInputField.js.map +1 -1
  19. package/dist/components/Common/Fieldset/Fieldset.js.map +1 -1
  20. package/dist/components/Common/FlowBreadcrumbs/breadcrumbTransitionHelpers.d.ts +1 -0
  21. package/dist/components/Common/FlowBreadcrumbs/breadcrumbTransitionHelpers.js +14 -0
  22. package/dist/components/Common/FlowBreadcrumbs/breadcrumbTransitionHelpers.js.map +1 -0
  23. package/dist/components/Common/FlowBreadcrumbs/index.d.ts +1 -0
  24. package/dist/components/Common/SignatureForm/SignatureForm.js +11 -12
  25. package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
  26. package/dist/components/Common/SignatureForm/SignatureFormActions.js +1 -1
  27. package/dist/components/Common/SignatureForm/SignatureFormFields.js +2 -2
  28. package/dist/components/Common/UI/Badge/BadgeTypes.js.map +1 -1
  29. package/dist/components/Common/UI/Banner/BannerTypes.js.map +1 -1
  30. package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
  31. package/dist/components/Common/UI/Button/ButtonTypes.js.map +1 -1
  32. package/dist/components/Common/UI/Checkbox/CheckboxTypes.js.map +1 -1
  33. package/dist/components/Common/UI/CheckboxGroup/CheckboxGroupTypes.js.map +1 -1
  34. package/dist/components/Common/UI/ComboBox/ComboBox.module.scss.js +1 -1
  35. package/dist/components/Common/UI/DatePicker/DatePicker.module.scss.js +7 -7
  36. package/dist/components/Common/UI/Input/InputTypes.js.map +1 -1
  37. package/dist/components/Common/UI/LoadingSpinner/LoadingSpinnerTypes.js.map +1 -1
  38. package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
  39. package/dist/components/Common/UI/Radio/RadioTypes.js.map +1 -1
  40. package/dist/components/Common/UI/RadioGroup/RadioGroupTypes.js.map +1 -1
  41. package/dist/components/Common/UI/Select/Select.module.scss.js +6 -6
  42. package/dist/components/Common/UI/Switch/SwitchTypes.js.map +1 -1
  43. package/dist/components/Common/UI/Table/Table.module.scss.js +1 -1
  44. package/dist/components/Common/UI/Table/TableTypes.js.map +1 -1
  45. package/dist/components/Common/UI/TextArea/TextAreaTypes.js.map +1 -1
  46. package/dist/components/Common/UI/TextInput/TextInputTypes.js.map +1 -1
  47. package/dist/components/Company/AssignSignatory/AssignSignatory.js +1 -1
  48. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +1 -1
  49. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +1 -1
  50. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +17 -16
  51. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js.map +1 -1
  52. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +3 -5
  53. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  54. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +1 -1
  55. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +6 -5
  56. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js.map +1 -1
  57. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +3 -5
  58. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  59. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +5 -7
  60. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  61. package/dist/components/Company/BankAccount/BankAccountForm/Form.js +5 -6
  62. package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
  63. package/dist/components/Company/BankAccount/BankAccountForm/context.js +3 -5
  64. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  65. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +5 -6
  66. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
  67. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +2 -2
  68. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +3 -5
  69. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  70. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +2 -2
  71. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +3 -5
  72. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  73. package/dist/components/Company/FederalTaxes/FederalTaxes.js +2 -2
  74. package/dist/components/Company/FederalTaxes/Form.js +3 -4
  75. package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
  76. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +8 -10
  77. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  78. package/dist/components/Company/Industry/Context.js +6 -8
  79. package/dist/components/Company/Industry/Context.js.map +1 -1
  80. package/dist/components/Company/Locations/LocationForm/Form.js +6 -5
  81. package/dist/components/Company/Locations/LocationForm/Form.js.map +1 -1
  82. package/dist/components/Company/Locations/LocationForm/LocationForm.js +2 -2
  83. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +3 -5
  84. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  85. package/dist/components/Company/Locations/LocationsList/LocationsList.js +2 -2
  86. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +3 -5
  87. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  88. package/dist/components/Company/OnboardingOverview/Completed.js +2 -3
  89. package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
  90. package/dist/components/Company/OnboardingOverview/MissingRequirements.js +2 -3
  91. package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
  92. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +2 -2
  93. package/dist/components/Company/OnboardingOverview/context.js +3 -5
  94. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  95. package/dist/components/Company/PaySchedule/PaySchedule.js +2 -2
  96. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  97. package/dist/components/Company/PaySchedule/_parts/Edit.js +24 -23
  98. package/dist/components/Company/PaySchedule/_parts/Edit.js.map +1 -1
  99. package/dist/components/Company/PaySchedule/_parts/Head.js +8 -9
  100. package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
  101. package/dist/components/Company/PaySchedule/_parts/List.js +11 -12
  102. package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
  103. package/dist/components/Company/PaySchedule/usePaySchedule.js +5 -7
  104. package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
  105. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +3 -5
  106. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  107. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +3 -5
  108. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  109. package/dist/components/Contractor/Address/Address.js +2 -2
  110. package/dist/components/Contractor/Address/Form.js +8 -7
  111. package/dist/components/Contractor/Address/Form.js.map +1 -1
  112. package/dist/components/Contractor/Address/useAddress.js +5 -7
  113. package/dist/components/Contractor/Address/useAddress.js.map +1 -1
  114. package/dist/components/Contractor/ContractorList/index.js +17 -17
  115. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +2 -2
  116. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +1 -1
  117. package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.d.ts +7 -0
  118. package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js +48 -0
  119. package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js.map +1 -0
  120. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.d.ts +1 -2
  121. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js +109 -0
  122. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js.map +1 -0
  123. package/dist/components/Contractor/Payments/EditPayment/EditPayment.d.ts +7 -0
  124. package/dist/components/Contractor/Payments/EditPayment/EditPayment.js +34 -0
  125. package/dist/components/Contractor/Payments/EditPayment/EditPayment.js.map +1 -0
  126. package/dist/components/Contractor/Payments/EditPayment/EditPaymentPresentation.d.ts +6 -0
  127. package/dist/components/Contractor/Payments/EditPayment/EditPaymentPresentation.js +84 -0
  128. package/dist/components/Contractor/Payments/EditPayment/EditPaymentPresentation.js.map +1 -0
  129. package/dist/components/Contractor/Payments/Overview/Overview.d.ts +7 -0
  130. package/dist/components/Contractor/Payments/Overview/Overview.js +72 -0
  131. package/dist/components/Contractor/Payments/Overview/Overview.js.map +1 -0
  132. package/dist/components/Contractor/Payments/Overview/OverviewPresentation.js +131 -0
  133. package/dist/components/Contractor/Payments/Overview/OverviewPresentation.js.map +1 -0
  134. package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlow.d.ts +2 -0
  135. package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlow.js +26 -0
  136. package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlow.js.map +1 -0
  137. package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.d.ts +15 -0
  138. package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js +30 -0
  139. package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js.map +1 -0
  140. package/dist/components/Contractor/Payments/PaymentFlow/index.d.ts +3 -0
  141. package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.d.ts +8 -0
  142. package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js +158 -0
  143. package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js.map +1 -0
  144. package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.d.ts +7 -0
  145. package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js +29 -0
  146. package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js.map +1 -0
  147. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.d.ts +18 -0
  148. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +108 -0
  149. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -0
  150. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.module.scss.js +10 -0
  151. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.module.scss.js.map +1 -0
  152. package/dist/components/Contractor/Profile/ContractorProfileForm.js +15 -15
  153. package/dist/components/Contractor/Profile/useContractorProfile.d.ts +26 -26
  154. package/dist/components/Contractor/Profile/useContractorProfile.js +2 -3
  155. package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
  156. package/dist/components/Contractor/Submit/Submit.js +1 -1
  157. package/dist/components/Contractor/Submit/Submit.js.map +1 -1
  158. package/dist/components/Contractor/index.d.ts +1 -0
  159. package/dist/components/Contractor/index.js +4 -2
  160. package/dist/components/Contractor/index.js.map +1 -1
  161. package/dist/components/Employee/Compensation/Edit.js +14 -14
  162. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +10 -12
  163. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
  164. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +11 -13
  165. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
  166. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js +83 -50
  167. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js.map +1 -1
  168. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.d.ts +56 -0
  169. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +158 -0
  170. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +1 -0
  171. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +1 -1
  172. package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.js +3 -2
  173. package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.js.map +1 -1
  174. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +1 -1
  175. package/dist/components/Employee/DocumentSigner/DocumentList/List.js +2 -3
  176. package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
  177. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +3 -5
  178. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  179. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +1 -1
  180. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +3 -5
  181. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  182. package/dist/components/Employee/EmployeeList/EmployeeList.js +3 -4
  183. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  184. package/dist/components/Employee/EmployeeList/Head.js +2 -3
  185. package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
  186. package/dist/components/Employee/EmployeeList/useEmployeeList.js +3 -5
  187. package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
  188. package/dist/components/Employee/FederalTaxes/FederalForm.d.ts +22 -7
  189. package/dist/components/Employee/FederalTaxes/FederalForm.js +86 -32
  190. package/dist/components/Employee/FederalTaxes/FederalForm.js.map +1 -1
  191. package/dist/components/Employee/FederalTaxes/FederalTaxes.js +62 -46
  192. package/dist/components/Employee/FederalTaxes/FederalTaxes.js.map +1 -1
  193. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +3 -5
  194. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
  195. package/dist/components/Employee/Landing/Landing.js +8 -8
  196. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +7 -7
  197. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +2 -2
  198. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +1 -1
  199. package/dist/components/Employee/PaymentMethod/Split.js +8 -8
  200. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +5 -7
  201. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
  202. package/dist/components/Employee/Profile/AdminPersonalDetails.d.ts +6 -6
  203. package/dist/components/Employee/Profile/AdminPersonalDetails.js +1 -1
  204. package/dist/components/Employee/Profile/HomeAddress.js +10 -9
  205. package/dist/components/Employee/Profile/HomeAddress.js.map +1 -1
  206. package/dist/components/Employee/Profile/PersonalDetailsInputs.d.ts +2 -2
  207. package/dist/components/Employee/Profile/PersonalDetailsInputs.js +11 -10
  208. package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
  209. package/dist/components/Employee/Profile/useProfile.js +3 -5
  210. package/dist/components/Employee/Profile/useProfile.js.map +1 -1
  211. package/dist/components/Employee/StateTaxes/useStateTaxes.js +3 -5
  212. package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
  213. package/dist/components/Employee/Taxes/FederalForm.d.ts +22 -7
  214. package/dist/components/Employee/Taxes/FederalForm.js +86 -32
  215. package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
  216. package/dist/components/Employee/Taxes/Taxes.js +97 -81
  217. package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
  218. package/dist/components/Employee/Taxes/useTaxes.js +3 -5
  219. package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
  220. package/dist/components/Flow/Flow.js +12 -13
  221. package/dist/components/Flow/Flow.js.map +1 -1
  222. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.js +46 -39
  223. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.js.map +1 -1
  224. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.module.scss.js +8 -0
  225. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.module.scss.js.map +1 -0
  226. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.js.map +1 -1
  227. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsComponents.js.map +1 -1
  228. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +78 -79
  229. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js.map +1 -1
  230. package/dist/components/Payroll/ConfirmWireDetails/WireInstructions/WireInstructions.js +21 -22
  231. package/dist/components/Payroll/ConfirmWireDetails/WireInstructions/WireInstructions.js.map +1 -1
  232. package/dist/components/Payroll/ConfirmWireDetails/confirmWireDetailsStateMachine.d.ts +2 -2
  233. package/dist/components/Payroll/ConfirmWireDetails/confirmWireDetailsStateMachine.js +19 -19
  234. package/dist/components/Payroll/ConfirmWireDetails/confirmWireDetailsStateMachine.js.map +1 -1
  235. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js +6 -7
  236. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js.map +1 -1
  237. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +2 -3
  238. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js.map +1 -1
  239. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +17 -16
  240. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
  241. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +57 -56
  242. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
  243. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +8 -9
  244. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
  245. package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.d.ts +1 -0
  246. package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js.map +1 -1
  247. package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js +32 -40
  248. package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js.map +1 -1
  249. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +53 -53
  250. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
  251. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +16 -17
  252. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
  253. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +127 -103
  254. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
  255. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +254 -185
  256. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
  257. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchThresholdExceeded.js +2 -3
  258. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchThresholdExceeded.js.map +1 -1
  259. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +2 -3
  260. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
  261. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.module.scss.js +1 -1
  262. package/dist/components/Payroll/usePreparedPayrollData.js +7 -9
  263. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  264. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +2 -3
  265. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
  266. package/dist/helpers/formattedStrings.js +11 -12
  267. package/dist/helpers/formattedStrings.js.map +1 -1
  268. package/dist/i18n/I18n.js +8 -8
  269. package/dist/i18n/I18n.js.map +1 -1
  270. package/dist/i18n/en/Contractor.Payments.CreatePayment.json.js +34 -0
  271. package/dist/i18n/en/Contractor.Payments.CreatePayment.json.js.map +1 -0
  272. package/dist/i18n/en/Contractor.Payments.EditPayment.json.js +36 -0
  273. package/dist/i18n/en/Contractor.Payments.EditPayment.json.js.map +1 -0
  274. package/dist/i18n/en/Contractor.Payments.Overview.json.js +34 -0
  275. package/dist/i18n/en/Contractor.Payments.Overview.json.js.map +1 -0
  276. package/dist/i18n/en/Contractor.Payments.PaymentsList.json.js +34 -0
  277. package/dist/i18n/en/Contractor.Payments.PaymentsList.json.js.map +1 -0
  278. package/dist/i18n/en/Employee.Deductions.json.js +58 -46
  279. package/dist/i18n/en/Employee.Deductions.json.js.map +1 -1
  280. package/dist/i18n/en/Employee.FederalTaxes.json.js +49 -41
  281. package/dist/i18n/en/Employee.FederalTaxes.json.js.map +1 -1
  282. package/dist/i18n/en/Employee.Taxes.json.js +53 -45
  283. package/dist/i18n/en/Employee.Taxes.json.js.map +1 -1
  284. package/dist/i18n/en/Payroll.ConfirmWireDetailsForm.json.js +5 -5
  285. package/dist/i18n/en/Payroll.PayrollOverview.json.js +34 -30
  286. package/dist/i18n/en/Payroll.PayrollOverview.json.js.map +1 -1
  287. package/dist/shared/constants.d.ts +12 -0
  288. package/dist/shared/constants.js +66 -58
  289. package/dist/shared/constants.js.map +1 -1
  290. package/dist/style.css +1 -1
  291. package/dist/types/i18next.d.ts +141 -95
  292. package/package.json +13 -13
  293. package/dist/components/Contractor/Payments/PaymentEdit/PaymentEditPresentation.d.ts +0 -6
  294. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.d.ts +0 -18
  295. package/dist/i18n/en/ContractorPayment.ContractorPaymentCreatePayment.json.js +0 -32
  296. package/dist/i18n/en/ContractorPayment.ContractorPaymentCreatePayment.json.js.map +0 -1
  297. package/dist/i18n/en/ContractorPayment.ContractorPaymentOverview.json.js +0 -32
  298. package/dist/i18n/en/ContractorPayment.ContractorPaymentOverview.json.js.map +0 -1
  299. package/dist/i18n/en/ContractorPayment.ContractorPaymentPaymentHistory.json.js +0 -32
  300. package/dist/i18n/en/ContractorPayment.ContractorPaymentPaymentHistory.json.js.map +0 -1
@@ -10,19 +10,17 @@ import { useComponentContext as _ } from "../../../../contexts/ComponentAdapter/
10
10
  import { Form as w } from "../../../Common/Form/Form.js";
11
11
  import { Flex as B } from "../../../Common/Flex/Flex.js";
12
12
  import "classnames";
13
- import { componentEvents as d } from "../../../../shared/constants.js";
14
- import { RadioGroupField as h } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
15
- import { TextInputField as j } from "../../../Common/Fields/TextInputField/TextInputField.js";
16
- import { ActionsLayout as G } from "../../../Common/ActionsLayout/ActionsLayout.js";
17
- import { NumberInputField as p } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
13
+ import { ActionsLayout as j } from "../../../Common/ActionsLayout/ActionsLayout.js";
18
14
  import "react-error-boundary";
19
15
  import "@gusto/embedded-api/models/errors/apierror";
20
16
  import "@gusto/embedded-api/models/errors/sdkvalidationerror";
21
17
  import "@tanstack/react-query";
22
- import { useBase as Y } from "../../../Base/useBase.js";
23
- import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
18
+ import { useBase as G } from "../../../Base/useBase.js";
19
+ import { componentEvents as d } from "../../../../shared/constants.js";
24
20
  import "dompurify";
25
- import "../../../../contexts/LocaleProvider/useLocale.js";
21
+ import { TextInputField as Y } from "../../../Common/Fields/TextInputField/TextInputField.js";
22
+ import { RadioGroupField as h } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
23
+ import { NumberInputField as p } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
26
24
  import { CheckboxField as $ } from "../../../Common/Fields/CheckboxField/CheckboxField.js";
27
25
  const k = r.object({
28
26
  active: r.boolean(),
@@ -35,8 +33,8 @@ const k = r.object({
35
33
  totalAmount: r.number().min(0).transform((e) => e > 0 ? e.toString() : null).nullable(),
36
34
  deductAsPercentage: r.boolean()
37
35
  });
38
- function he({ deduction: e, employeeId: A }) {
39
- const { onEvent: a, baseSubmitHandler: E } = Y(), { t } = T("Employee.Deductions"), m = _(), { mutateAsync: C, isPending: P } = U(), { mutateAsync: x, isPending: y } = V(), O = P || y, u = S(() => ({
36
+ function ge({ deduction: e, employeeId: A }) {
37
+ const { onEvent: a, baseSubmitHandler: E } = G(), { t } = T("Employee.Deductions"), m = _(), { mutateAsync: C, isPending: P } = U(), { mutateAsync: x, isPending: y } = V(), O = P || y, u = S(() => ({
40
38
  amount: e?.amount ? Number(e.amount) : 0,
41
39
  description: e?.description ?? "",
42
40
  times: e?.times ?? null,
@@ -82,7 +80,7 @@ function he({ deduction: e, employeeId: A }) {
82
80
  };
83
81
  return /* @__PURE__ */ n(R, { ...s, children: /* @__PURE__ */ n(w, { onSubmit: s.handleSubmit(F), children: /* @__PURE__ */ n(B, { flexDirection: "column", gap: 32, children: /* @__PURE__ */ c(g, { children: [
84
82
  /* @__PURE__ */ n(m.Heading, { as: "h3", children: t("customDeductionTitle") }),
85
- /* @__PURE__ */ n(j, { name: "description", label: t("descriptionLabelV2"), isRequired: !0 }),
83
+ /* @__PURE__ */ n(Y, { name: "description", label: t("descriptionLabelV2"), isRequired: !0 }),
86
84
  /* @__PURE__ */ n(
87
85
  h,
88
86
  {
@@ -152,7 +150,7 @@ function he({ deduction: e, employeeId: A }) {
152
150
  isDisabled: !!e
153
151
  }
154
152
  ),
155
- /* @__PURE__ */ c(G, { children: [
153
+ /* @__PURE__ */ c(j, { children: [
156
154
  /* @__PURE__ */ n(m.Button, { variant: "secondary", onClick: L, children: t("cancelCta") }),
157
155
  /* @__PURE__ */ n(m.Button, { type: "submit", isLoading: O, children: t(e ? "continueCta" : "addDeductionCta") })
158
156
  ] })
@@ -160,6 +158,6 @@ function he({ deduction: e, employeeId: A }) {
160
158
  }
161
159
  export {
162
160
  k as DeductionSchema,
163
- he as default
161
+ ge as default
164
162
  };
165
163
  //# 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 { useEffect, 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 {\n NumberInputField,\n TextInputField,\n RadioGroupField,\n CheckboxField,\n} from '@/components/Common'\nimport { type CommonComponentInterface, useBase } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\n\nexport const DeductionSchema = z.object({\n active: z.boolean(),\n amount: z.number().min(0).transform(String),\n description: z.string().min(1),\n courtOrdered: z.boolean(),\n times: z.number().nullable(),\n recurring: z.boolean(),\n annualMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n totalAmount: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n deductAsPercentage: z.boolean(),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ninterface ChildSupportFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n}\n\nfunction CustomDeductionForm({ deduction, employeeId }: ChildSupportFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n const isPending = isPendingCreate || isPendingUpdate\n\n const defaultValues: DeductionInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n description: deduction?.description ?? '',\n times: deduction?.times ?? null,\n recurring: deduction?.recurring ?? true,\n annualMaximum: deduction?.annualMaximum ? Number(deduction.annualMaximum) : null,\n totalAmount: deduction?.totalAmount ? Number(deduction.totalAmount) : null,\n deductAsPercentage: deduction?.deductAsPercentage ?? true,\n active: true,\n courtOrdered: deduction?.courtOrdered ?? false,\n } as DeductionInputs\n }, [deduction])\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n const { reset: resetForm, control } = formMethods\n\n useEffect(() => {\n resetForm(defaultValues)\n }, [deduction, defaultValues, resetForm])\n\n const watchedRecurring = useWatch({ control, name: 'recurring' })\n const watchedAmountPercentage = useWatch({ control, name: 'deductAsPercentage' })\n\n const onSubmit: SubmitHandler<DeductionPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, times: payload.recurring ? null : 1 },\n },\n })\n\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...payload,\n version: deduction.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CANCEL)\n }\n\n return (\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n <>\n <Components.Heading as=\"h3\">{t('customDeductionTitle')}</Components.Heading>\n <TextInputField name=\"description\" label={t('descriptionLabelV2')} isRequired />\n <RadioGroupField\n name=\"recurring\"\n label={t('frequencyLabel')}\n isRequired\n options={[\n { value: true, label: t('frequencyRecurringOptionV2') },\n { value: false, label: t('frequencyOneTimeOptionV2') },\n ]}\n />\n <RadioGroupField\n name=\"deductAsPercentage\"\n label={t('deductionTypeLabelV2')}\n isRequired\n options={[\n { value: true, label: t('deductionTypePercentageOptionV2') },\n { value: false, label: t('deductionTypeFixedAmountOption') },\n ]}\n />\n <NumberInputField\n name=\"amount\"\n adornmentStart={!watchedAmountPercentage && '$'}\n adornmentEnd={watchedAmountPercentage && '%'}\n label={t('deductionAmountLabel')}\n isRequired\n min={0}\n format={watchedAmountPercentage ? 'percent' : 'currency'}\n description={\n watchedAmountPercentage\n ? t('deductionAmountDescriptionPercentage')\n : t('deductionAmountDescriptionFixed')\n }\n />\n {watchedRecurring && (\n <>\n <NumberInputField\n name=\"totalAmount\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('totalAmountLabel')}\n description={t('totalAmountDescription')}\n min={0}\n />\n <NumberInputField\n name=\"annualMaximum\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('annualMaxLabel')}\n min={0}\n description={t('annualMaxDescription')}\n />\n </>\n )}\n <CheckboxField\n name=\"courtOrdered\"\n label={t('courtOrderedLabel')}\n isDisabled={!!deduction}\n />\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {!deduction ? t('addDeductionCta') : t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n\nexport default CustomDeductionForm\n"],"names":["DeductionSchema","z","val","CustomDeductionForm","deduction","employeeId","onEvent","baseSubmitHandler","useBase","useTranslation","Components","useComponentContext","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultValues","useMemo","formMethods","useForm","zodResolver","resetForm","control","useEffect","watchedRecurring","useWatch","watchedAmountPercentage","onSubmit","data","payload","updateDeductionResponse","componentEvents","createDeductionResponse","handleCancel","FormProvider","jsx","Form","Flex","jsxs","Fragment","TextInputField","RadioGroupField","NumberInputField","CheckboxField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAqBO,MAAMA,IAAkBC,EAAE,OAAO;AAAA,EACtC,QAAQA,EAAE,QAAA;AAAA,EACV,QAAQA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,UAAU,MAAM;AAAA,EAC1C,aAAaA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC7B,cAAcA,EAAE,QAAA;AAAA,EAChB,OAAOA,EAAE,OAAA,EAAS,SAAA;AAAA,EAClB,WAAWA,EAAE,QAAA;AAAA,EACb,eAAeA,EACZ,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAC,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,S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,IAEF,gBAAAP;AAAA,MAACQ;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAO,EAAE,mBAAmB;AAAA,QAC5B,YAAY,CAAC,CAAC1C;AAAA,MAAA;AAAA,IAAA;AAAA,sBAEf2C,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAT,EAAC5B,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAAS0B,GAC7C,UAAA,EAAE,WAAW,EAAA,CAChB;AAAA,MACA,gBAAAE,EAAC5B,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWQ,GACzC,UAAoC,EAAnCd,IAAqC,gBAAvB,iBAAoC,EAAA,CACtD;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
1
+ {"version":3,"file":"CustomDeductionForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { useEffect, 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 {\n NumberInputField,\n TextInputField,\n RadioGroupField,\n CheckboxField,\n} from '@/components/Common'\nimport { type CommonComponentInterface, useBase } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\n\nexport const DeductionSchema = z.object({\n active: z.boolean(),\n amount: z.number().min(0).transform(String),\n description: z.string().min(1),\n courtOrdered: z.boolean(),\n times: z.number().nullable(),\n recurring: z.boolean(),\n annualMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n totalAmount: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n deductAsPercentage: z.boolean(),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ninterface ChildSupportFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n}\n\nfunction CustomDeductionForm({ deduction, employeeId }: ChildSupportFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n const isPending = isPendingCreate || isPendingUpdate\n\n const defaultValues: DeductionInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n description: deduction?.description ?? '',\n times: deduction?.times ?? null,\n recurring: deduction?.recurring ?? true,\n annualMaximum: deduction?.annualMaximum ? Number(deduction.annualMaximum) : null,\n totalAmount: deduction?.totalAmount ? Number(deduction.totalAmount) : null,\n deductAsPercentage: deduction?.deductAsPercentage ?? true,\n active: true,\n courtOrdered: deduction?.courtOrdered ?? false,\n } as DeductionInputs\n }, [deduction])\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n const { reset: resetForm, control } = formMethods\n\n useEffect(() => {\n resetForm(defaultValues)\n }, [deduction, defaultValues, resetForm])\n\n const watchedRecurring = useWatch({ control, name: 'recurring' })\n const watchedAmountPercentage = useWatch({ control, name: 'deductAsPercentage' })\n\n const onSubmit: SubmitHandler<DeductionPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, times: payload.recurring ? null : 1 },\n },\n })\n\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...payload,\n version: deduction.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CANCEL)\n }\n\n return (\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n <>\n <Components.Heading as=\"h3\">{t('customDeductionTitle')}</Components.Heading>\n <TextInputField name=\"description\" label={t('descriptionLabelV2')} isRequired />\n <RadioGroupField\n name=\"recurring\"\n label={t('frequencyLabel')}\n isRequired\n options={[\n { value: true, label: t('frequencyRecurringOptionV2') },\n { value: false, label: t('frequencyOneTimeOptionV2') },\n ]}\n />\n <RadioGroupField\n name=\"deductAsPercentage\"\n label={t('deductionTypeLabelV2')}\n isRequired\n options={[\n { value: true, label: t('deductionTypePercentageOptionV2') },\n { value: false, label: t('deductionTypeFixedAmountOption') },\n ]}\n />\n <NumberInputField\n name=\"amount\"\n adornmentStart={!watchedAmountPercentage && '$'}\n adornmentEnd={watchedAmountPercentage && '%'}\n label={t('deductionAmountLabel')}\n isRequired\n min={0}\n format={watchedAmountPercentage ? 'percent' : 'currency'}\n description={\n watchedAmountPercentage\n ? t('deductionAmountDescriptionPercentage')\n : t('deductionAmountDescriptionFixed')\n }\n />\n {watchedRecurring && (\n <>\n <NumberInputField\n name=\"totalAmount\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('totalAmountLabel')}\n description={t('totalAmountDescription')}\n min={0}\n />\n <NumberInputField\n name=\"annualMaximum\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('annualMaxLabel')}\n min={0}\n description={t('annualMaxDescription')}\n />\n </>\n )}\n <CheckboxField\n name=\"courtOrdered\"\n label={t('courtOrderedLabel')}\n isDisabled={!!deduction}\n />\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {!deduction ? t('addDeductionCta') : t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n\nexport default CustomDeductionForm\n"],"names":["DeductionSchema","z","val","CustomDeductionForm","deduction","employeeId","onEvent","baseSubmitHandler","useBase","useTranslation","Components","useComponentContext","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultValues","useMemo","formMethods","useForm","zodResolver","resetForm","control","useEffect","watchedRecurring","useWatch","watchedAmountPercentage","onSubmit","data","payload","updateDeductionResponse","componentEvents","createDeductionResponse","handleCancel","FormProvider","jsx","Form","Flex","jsxs","Fragment","TextInputField","RadioGroupField","NumberInputField","CheckboxField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAqBO,MAAMA,IAAkBC,EAAE,OAAO;AAAA,EACtC,QAAQA,EAAE,QAAA;AAAA,EACV,QAAQA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,UAAU,MAAM;AAAA,EAC1C,aAAaA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC7B,cAAcA,EAAE,QAAA;AAAA,EAChB,OAAOA,EAAE,OAAA,EAAS,SAAA;AAAA,EAClB,WAAWA,EAAE,QAAA;AAAA,EACb,eAAeA,EACZ,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAC,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,aAAaD,EACV,OAAA,EACA,IAAI,CAAC,EACL,UAAU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AA,QACL,OAAO,EAAE,mBAAmB;AAAA,QAC5B,YAAY,CAAC,CAAC1C;AAAA,MAAA;AAAA,IAAA;AAAA,sBAEf2C,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAT,EAAC5B,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAAS0B,GAC7C,UAAA,EAAE,WAAW,EAAA,CAChB;AAAA,MACA,gBAAAE,EAAC5B,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWQ,GACzC,UAAoC,EAAnCd,IAAqC,gBAAvB,iBAAoC,EAAA,CACtD;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
@@ -1,49 +1,71 @@
1
- import { jsx as n, jsxs as a } from "react/jsx-runtime";
2
- import { useTranslation as A } from "react-i18next";
3
- import { useState as D } from "react";
4
- import { useGarnishmentsListSuspense as P } from "@gusto/embedded-api/react-query/garnishmentsList";
5
- import { useGarnishmentsGetChildSupportDataSuspense as _ } from "@gusto/embedded-api/react-query/garnishmentsGetChildSupportData";
1
+ import { jsx as n, jsxs as a, Fragment as H } from "react/jsx-runtime";
2
+ import { useTranslation as M } from "react-i18next";
3
+ import { useState as u } from "react";
4
+ import { useGarnishmentsListSuspense as Y } from "@gusto/embedded-api/react-query/garnishmentsList";
5
+ import { useGarnishmentsGetChildSupportDataSuspense as B } from "@gusto/embedded-api/react-query/garnishmentsGetChildSupportData";
6
6
  import c from "./DeductionsForm.module.scss.js";
7
- import O from "./ChildSupportForm.js";
8
- import R from "./CustomDeductionForm.js";
9
- import { BaseComponent as H } from "../../../Base/Base.js";
10
- import { useBase as M } from "../../../Base/useBase.js";
11
- import { Grid as Y } from "../../../Common/Grid/Grid.js";
12
- import { useComponentDictionary as B, useI18n as F } from "../../../../i18n/I18n.js";
13
- import { componentEvents as f } from "../../../../shared/constants.js";
14
- import { useComponentContext as I } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
15
- import U from "../../../../assets/icons/caret-left.svg.js";
16
- function ie(s) {
17
- return /* @__PURE__ */ n(H, { ...s, children: /* @__PURE__ */ n(k, { ...s, children: s.children }) });
7
+ import U from "./ChildSupportForm.js";
8
+ import j from "./GarnishmentForm.js";
9
+ import k from "./CustomDeductionForm.js";
10
+ import { BaseComponent as I } from "../../../Base/Base.js";
11
+ import { useBase as V } from "../../../Base/useBase.js";
12
+ import { Grid as q } from "../../../Common/Grid/Grid.js";
13
+ import { useComponentDictionary as w, useI18n as z } from "../../../../i18n/I18n.js";
14
+ import { componentEvents as C } from "../../../../shared/constants.js";
15
+ import { useComponentContext as J } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
16
+ import K from "../../../../assets/icons/caret-left.svg.js";
17
+ function ue(s) {
18
+ return /* @__PURE__ */ n(I, { ...s, children: /* @__PURE__ */ n(Q, { ...s, children: s.children }) });
18
19
  }
19
- const j = ["child_support"];
20
- function k({ className: s, employeeId: r, deductionId: u, dictionary: T }) {
21
- const { onEvent: m } = M(), { t } = A("Employee.Deductions"), i = I();
22
- B("Employee.Deductions", T), F("Employee.Deductions");
23
- const { data: p } = P({ employeeId: r }), { data: l } = _({}), o = u ? p.garnishmentList?.find((e) => e.uuid === u) ?? null : null, y = t(o ? "editDeductionTitle" : "addDeductionTitle"), d = o?.garnishmentType, C = l.childSupportData?.agencies?.map((e) => ({
20
+ const S = [
21
+ "child_support",
22
+ "federal_tax_lien",
23
+ "state_tax_lien",
24
+ "student_loan",
25
+ "creditor_garnishment",
26
+ "federal_loan",
27
+ "other_garnishment"
28
+ ];
29
+ function Q({ className: s, employeeId: r, deductionId: p, dictionary: y }) {
30
+ const { onEvent: h } = V(), { t } = M("Employee.Deductions"), i = J();
31
+ w("Employee.Deductions", y), z("Employee.Deductions");
32
+ const { data: g } = Y({ employeeId: r }), { data: d } = B({}), o = p ? g.garnishmentList?.find((e) => e.uuid === p) ?? null : null, E = t(o ? "editDeductionTitle" : "addDeductionTitle"), l = o?.garnishmentType, L = d.childSupportData?.agencies?.map((e) => ({
24
33
  label: e.name,
25
34
  value: e.state
26
- })) || [], [h, S] = D(
27
- d && j.includes(d) || !o
28
- ), E = o ? d ? "garnishment" : "custom" : "garnishment", [g, b] = D(o?.childSupport?.state || ""), L = (e) => {
29
- b(e);
30
- }, v = l.childSupportData?.agencies?.find((e) => e.state === g)?.fipsCodes?.map((e) => ({
35
+ })) || [], [f, b] = u(
36
+ l && S.includes(l) || !o
37
+ ), [m, x] = u(
38
+ l || "child_support"
39
+ ), T = {
40
+ child_support: t("childSupportTitle"),
41
+ federal_tax_lien: t("federalTaxLien"),
42
+ state_tax_lien: t("stateTaxLien"),
43
+ student_loan: t("studentLoan"),
44
+ creditor_garnishment: t("creditorGarnishment"),
45
+ federal_loan: t("federalLoan"),
46
+ other_garnishment: t("otherGarnishment")
47
+ }, D = T[m], G = S.map((e) => ({
48
+ value: e,
49
+ label: T[e]
50
+ })), v = o ? l ? "garnishment" : "custom" : "garnishment", [_, N] = u(o?.childSupport?.state || ""), P = (e) => {
51
+ N(e);
52
+ }, A = d.childSupportData?.agencies?.find((e) => e.state === _)?.fipsCodes?.map((e) => ({
31
53
  label: e.county?.length ? e.county : t("allCounties"),
32
54
  value: e.code
33
- })) || [], x = l.childSupportData?.agencies?.find(
34
- (e) => e.state === g
35
- ), N = () => {
36
- p.garnishmentList?.some((e) => e.active) ? m(f.EMPLOYEE_DEDUCTION_CANCEL) : m(f.EMPLOYEE_DEDUCTION_CANCEL_EMPTY);
37
- }, G = (e) => {
38
- S(e === "garnishment");
55
+ })) || [], O = d.childSupportData?.agencies?.find(
56
+ (e) => e.state === _
57
+ ), R = () => {
58
+ g.garnishmentList?.some((e) => e.active) ? h(C.EMPLOYEE_DEDUCTION_CANCEL) : h(C.EMPLOYEE_DEDUCTION_CANCEL_EMPTY);
59
+ }, F = (e) => {
60
+ b(e === "garnishment");
39
61
  };
40
62
  return /* @__PURE__ */ a("section", { className: s, children: [
41
- /* @__PURE__ */ a(i.Button, { variant: "secondary", onClick: N, children: [
42
- /* @__PURE__ */ n(U, { className: c.leftCaretIcon }),
63
+ /* @__PURE__ */ a(i.Button, { variant: "secondary", onClick: R, children: [
64
+ /* @__PURE__ */ n(K, { className: c.leftCaretIcon }),
43
65
  t("backToDeductionsCta")
44
66
  ] }),
45
- /* @__PURE__ */ a(Y, { gap: 16, className: c.formHeadingContainer, children: [
46
- /* @__PURE__ */ n(i.Heading, { as: "h2", children: y }),
67
+ /* @__PURE__ */ a(q, { gap: 16, className: c.formHeadingContainer, children: [
68
+ /* @__PURE__ */ n(i.Heading, { as: "h2", children: E }),
47
69
  /* @__PURE__ */ a("section", { children: [
48
70
  /* @__PURE__ */ n(i.Heading, { as: "h3", children: t("externalPostTaxDeductions") }),
49
71
  /* @__PURE__ */ n(i.Text, { variant: "supporting", children: t("externalPostTaxDeductionsDescription") })
@@ -57,42 +79,53 @@ function k({ className: s, employeeId: r, deductionId: u, dictionary: T }) {
57
79
  { value: "garnishment", label: t("garnishmentOption") },
58
80
  { value: "custom", label: t("customDeductionOption") }
59
81
  ],
60
- defaultValue: E,
61
- onChange: G,
82
+ defaultValue: v,
83
+ onChange: F,
62
84
  isRequired: !0,
63
85
  isDisabled: !!o,
64
86
  className: c.deductionTypeRadioGroup
65
87
  }
66
88
  ),
67
- h && /* @__PURE__ */ a("section", { children: [
89
+ f && /* @__PURE__ */ a("section", { children: [
68
90
  /* @__PURE__ */ n(i.Text, { weight: "bold", className: c.garnishmentTypeLabel, children: t("garnishmentType") }),
69
91
  /* @__PURE__ */ n(
70
92
  i.Select,
71
93
  {
72
94
  label: t("garnishmentType"),
73
- options: [],
74
- placeholder: t("childSupport"),
95
+ options: G,
96
+ placeholder: D,
75
97
  shouldVisuallyHideLabel: !0,
76
- isDisabled: !0
98
+ onChange: (e) => {
99
+ x(e);
100
+ },
101
+ isDisabled: !!o
77
102
  }
78
103
  )
79
104
  ] }),
80
105
  /* @__PURE__ */ n("hr", {})
81
106
  ] }),
82
- h ? /* @__PURE__ */ n(
83
- O,
107
+ f ? /* @__PURE__ */ n(H, { children: m === "child_support" ? /* @__PURE__ */ n(
108
+ U,
84
109
  {
85
110
  deduction: o,
86
111
  employeeId: r,
87
- handleStateAgencySelect: L,
88
- stateAgencies: C,
89
- counties: v,
90
- selectedAgency: x
112
+ handleStateAgencySelect: P,
113
+ stateAgencies: L,
114
+ counties: A,
115
+ selectedAgency: O
91
116
  }
92
- ) : /* @__PURE__ */ n(R, { deduction: o, employeeId: r })
117
+ ) : /* @__PURE__ */ n(
118
+ j,
119
+ {
120
+ deduction: o,
121
+ employeeId: r,
122
+ selectedGarnishmentType: m,
123
+ selectedGarnishmentTitle: D
124
+ }
125
+ ) }) : /* @__PURE__ */ n(k, { deduction: o, employeeId: r })
93
126
  ] });
94
127
  }
95
128
  export {
96
- ie as DeductionsForm
129
+ ue as DeductionsForm
97
130
  };
98
131
  //# sourceMappingURL=DeductionsForm.js.map
@@ -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 styles from './DeductionsForm.module.scss'\nimport ChildSupportForm from './ChildSupportForm'\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 CaretLeft from '@/assets/icons/caret-left.svg?react'\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 custom or a garnishment\n// we currently only support child support garnishment type\nconst SUPPORTED_GARNISHMENT_TYPES = ['child_support']\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 // edit deductions cannot change the record type, it can only update the existing entries of the record\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 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 counties =\n childSupportData.childSupportData?.agencies\n ?.find(agency => agency.state === stateAgency)\n ?.fipsCodes?.map(fipsCode => ({\n label: fipsCode.county?.length ? fipsCode.county : t('allCounties'),\n value: fipsCode.code as string,\n })) || []\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 <Components.Button variant=\"secondary\" onClick={handleCancel}>\n <CaretLeft className={styles.leftCaretIcon} />\n {t('backToDeductionsCta')}\n </Components.Button>\n <Grid gap={16} className={styles.formHeadingContainer}>\n <Components.Heading as=\"h2\">{title}</Components.Heading>\n <section>\n <Components.Heading as=\"h3\">{t('externalPostTaxDeductions')}</Components.Heading>\n <Components.Text variant=\"supporting\">\n {t('externalPostTaxDeductionsDescription')}\n </Components.Text>\n </section>\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 isDisabled={!!deduction}\n className={styles.deductionTypeRadioGroup}\n />\n {isGarnishment && (\n <section>\n <Components.Text weight=\"bold\" className={styles.garnishmentTypeLabel}>\n {t('garnishmentType')}\n </Components.Text>\n {/* we currently only support child support garnishment type */}\n <Components.Select\n label={t('garnishmentType')}\n options={[]}\n placeholder={t('childSupport')}\n shouldVisuallyHideLabel\n isDisabled\n />\n </section>\n )}\n <hr />\n </Grid>\n\n {isGarnishment ? (\n <ChildSupportForm\n deduction={deduction}\n employeeId={employeeId}\n handleStateAgencySelect={handleStateAgencySelect}\n stateAgencies={stateAgencies}\n counties={counties}\n selectedAgency={selectedAgency}\n />\n ) : (\n <CustomDeductionForm deduction={deduction} employeeId={employeeId} />\n )}\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","defaultDeductionTypeSelection","stateAgency","setStateAgency","handleStateAgencySelect","counties","agency","fipsCode","selectedAgency","handleCancel","componentEvents","handleSelectDeductionType","selection","jsxs","CaretLeft","styles","Grid","ChildSupportForm","CustomDeductionForm"],"mappings":";;;;;;;;;;;;;;;AAwBO,SAASA,GAAeC,GAAqD;AAClF,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAIA,MAAMI,IAA8B,CAAC,eAAe;AAEpD,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,GAK1EC,IAAYb,IACbS,EAAK,iBAAiB,KAAK,OAAKK,EAAE,SAASd,CAAW,KAAK,OAC5D,MACEe,IAA8C,EAArCF,IAAuC,uBAAzB,mBAA6C,GACpEG,IAAgBH,GAAW,iBAC3BI,IACJN,EAAiB,kBAAk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B;AAAA,QACA,eAAAR;AAAA,QACA,UAAAS;AAAA,QACA,gBAAAG;AAAA,MAAA;AAAA,IAAA,IAGF,gBAAAnC,EAAC6C,GAAA,EAAoB,WAAA1B,GAAsB,YAAAd,EAAA,CAAwB;AAAA,EAAA,GAEvE;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 styles from './DeductionsForm.module.scss'\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 CaretLeft from '@/assets/icons/caret-left.svg?react'\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 counties =\n childSupportData.childSupportData?.agencies\n ?.find(agency => agency.state === stateAgency)\n ?.fipsCodes?.map(fipsCode => ({\n label: fipsCode.county?.length ? fipsCode.county : t('allCounties'),\n value: fipsCode.code as string,\n })) || []\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 <Components.Button variant=\"secondary\" onClick={handleCancel}>\n <CaretLeft className={styles.leftCaretIcon} />\n {t('backToDeductionsCta')}\n </Components.Button>\n <Grid gap={16} className={styles.formHeadingContainer}>\n <Components.Heading as=\"h2\">{title}</Components.Heading>\n <section>\n <Components.Heading as=\"h3\">{t('externalPostTaxDeductions')}</Components.Heading>\n <Components.Text variant=\"supporting\">\n {t('externalPostTaxDeductionsDescription')}\n </Components.Text>\n </section>\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 isDisabled={!!deduction}\n className={styles.deductionTypeRadioGroup}\n />\n {isGarnishment && (\n <section>\n <Components.Text weight=\"bold\" className={styles.garnishmentTypeLabel}>\n {t('garnishmentType')}\n </Components.Text>\n <Components.Select\n label={t('garnishmentType')}\n options={garnishmentOptions}\n placeholder={garnishmentPlaceholder}\n shouldVisuallyHideLabel\n onChange={value => {\n setSelectedGarnishment(value as GarnishmentType)\n }}\n isDisabled={!!deduction} // API does not allow to change/edit an existing deduction type\n />\n </section>\n )}\n <hr />\n </Grid>\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 selectedAgency={selectedAgency}\n />\n ) : (\n <GarnishmentForm\n deduction={deduction}\n employeeId={employeeId}\n selectedGarnishmentType={selectedGarnishment}\n selectedGarnishmentTitle={garnishmentPlaceholder!}\n />\n )}\n </>\n ) : (\n <CustomDeductionForm deduction={deduction} employeeId={employeeId} />\n )}\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","counties","agency","fipsCode","selectedAgency","handleCancel","componentEvents","handleSelectDeductionType","selection","jsxs","CaretLeft","styles","Grid","value","Fragment","ChildSupportForm","GarnishmentForm","CustomDeductionForm"],"mappings":";;;;;;;;;;;;;;;;AA2BO,SAASA,GAAeC,GAAqD;AAClF,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAGA,MAAMI,IAAiD;AAAA,EACrD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;A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;AAAA,MAACqD;AAAA,MAAA;AAAA,QACC,WAAAlC;AAAA,QACA,YAAAd;AAAA,QACA,yBAAyBuB;AAAA,QACzB,0BAA0BG;AAAA,MAAA;AAAA,IAAA,EAC5B,CAEJ,IAEA,gBAAA/B,EAACsD,GAAA,EAAoB,WAAAnC,GAAsB,YAAAd,EAAA,CAAwB;AAAA,EAAA,GAEvE;AAEJ;"}
@@ -0,0 +1,56 @@
1
+ import { z } from 'zod';
2
+ import { Garnishment } from '@gusto/embedded-api/models/components/garnishment';
3
+ import { GarnishmentType } from '@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments';
4
+ import { CommonComponentInterface } from '../../../Base';
5
+ export declare const DeductionSchema: z.ZodObject<{
6
+ active: z.ZodBoolean;
7
+ amount: z.ZodEffects<z.ZodNumber, string, number>;
8
+ description: z.ZodString;
9
+ courtOrdered: z.ZodBoolean;
10
+ times: z.ZodNullable<z.ZodNumber>;
11
+ recurring: z.ZodBoolean;
12
+ annualMaximum: z.ZodNullable<z.ZodEffects<z.ZodNumber, string | null, number>>;
13
+ totalAmount: z.ZodNullable<z.ZodEffects<z.ZodNumber, string | null, number>>;
14
+ deductAsPercentage: z.ZodBoolean;
15
+ garnishmentType: z.ZodNativeEnum<{
16
+ readonly ChildSupport: "child_support";
17
+ readonly FederalTaxLien: "federal_tax_lien";
18
+ readonly StateTaxLien: "state_tax_lien";
19
+ readonly StudentLoan: "student_loan";
20
+ readonly CreditorGarnishment: "creditor_garnishment";
21
+ readonly FederalLoan: "federal_loan";
22
+ readonly OtherGarnishment: "other_garnishment";
23
+ }>;
24
+ }, "strip", z.ZodTypeAny, {
25
+ description: string;
26
+ active: boolean;
27
+ totalAmount: string | null;
28
+ amount: string;
29
+ garnishmentType: "child_support" | "federal_tax_lien" | "state_tax_lien" | "student_loan" | "creditor_garnishment" | "federal_loan" | "other_garnishment";
30
+ recurring: boolean;
31
+ courtOrdered: boolean;
32
+ times: number | null;
33
+ annualMaximum: string | null;
34
+ deductAsPercentage: boolean;
35
+ }, {
36
+ description: string;
37
+ active: boolean;
38
+ totalAmount: number | null;
39
+ amount: number;
40
+ garnishmentType: "child_support" | "federal_tax_lien" | "state_tax_lien" | "student_loan" | "creditor_garnishment" | "federal_loan" | "other_garnishment";
41
+ recurring: boolean;
42
+ courtOrdered: boolean;
43
+ times: number | null;
44
+ annualMaximum: number | null;
45
+ deductAsPercentage: boolean;
46
+ }>;
47
+ export type DeductionInputs = z.input<typeof DeductionSchema>;
48
+ export type DeductionPayload = z.output<typeof DeductionSchema>;
49
+ interface GarnishmentFormProps extends CommonComponentInterface<'Employee.Deductions'> {
50
+ employeeId: string;
51
+ deduction?: Garnishment | null;
52
+ selectedGarnishmentType: GarnishmentType;
53
+ selectedGarnishmentTitle: string;
54
+ }
55
+ declare function GarnishmentForm({ deduction, employeeId, selectedGarnishmentType, selectedGarnishmentTitle, }: GarnishmentFormProps): import("react/jsx-runtime").JSX.Element;
56
+ export default GarnishmentForm;
@@ -0,0 +1,158 @@
1
+ import { jsx as t, jsxs as l, Fragment as b } from "react/jsx-runtime";
2
+ import { useTranslation as F } from "react-i18next";
3
+ import { useForm as R, useWatch as g, FormProvider as S } from "react-hook-form";
4
+ import { useMemo as N } from "react";
5
+ import { z as r } from "zod";
6
+ import { zodResolver as I } from "@hookform/resolvers/zod";
7
+ import { GarnishmentType as U } from "@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments";
8
+ import { useGarnishmentsCreateMutation as V } from "@gusto/embedded-api/react-query/garnishmentsCreate";
9
+ import { useGarnishmentsUpdateMutation as _ } from "@gusto/embedded-api/react-query/garnishmentsUpdate";
10
+ import { useComponentContext as w } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
11
+ import { Form as B } from "../../../Common/Form/Form.js";
12
+ import { Flex as G } from "../../../Common/Flex/Flex.js";
13
+ import "classnames";
14
+ import { ActionsLayout as j } from "../../../Common/ActionsLayout/ActionsLayout.js";
15
+ import "react-error-boundary";
16
+ import "@gusto/embedded-api/models/errors/apierror";
17
+ import "@gusto/embedded-api/models/errors/sdkvalidationerror";
18
+ import "@tanstack/react-query";
19
+ import { useBase as Y } from "../../../Base/useBase.js";
20
+ import { componentEvents as c } from "../../../../shared/constants.js";
21
+ import "dompurify";
22
+ import { TextInputField as $ } from "../../../Common/Fields/TextInputField/TextInputField.js";
23
+ import { RadioGroupField as f } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
24
+ import { NumberInputField as p } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
25
+ const z = r.object({
26
+ active: r.boolean(),
27
+ amount: r.number().min(0).transform(String),
28
+ description: r.string().min(1),
29
+ courtOrdered: r.boolean(),
30
+ times: r.number().nullable(),
31
+ recurring: r.boolean(),
32
+ annualMaximum: r.number().min(0).transform((e) => e > 0 ? e.toString() : null).nullable(),
33
+ totalAmount: r.number().min(0).transform((e) => e > 0 ? e.toString() : null).nullable(),
34
+ deductAsPercentage: r.boolean(),
35
+ garnishmentType: r.nativeEnum(U)
36
+ });
37
+ function fe({
38
+ deduction: e,
39
+ employeeId: h,
40
+ selectedGarnishmentType: A,
41
+ selectedGarnishmentTitle: D
42
+ }) {
43
+ const { onEvent: a, baseSubmitHandler: E } = Y(), { t: n } = F("Employee.Deductions"), m = w(), { mutateAsync: y, isPending: P } = V(), { mutateAsync: x, isPending: C } = _(), T = P || C, M = N(() => ({
44
+ amount: e?.amount ? Number(e.amount) : 0,
45
+ description: e?.description ?? "",
46
+ times: e?.times ?? null,
47
+ recurring: e?.recurring ?? !0,
48
+ annualMaximum: e?.annualMaximum ? Number(e.annualMaximum) : null,
49
+ totalAmount: e?.totalAmount ? Number(e.totalAmount) : null,
50
+ deductAsPercentage: e?.deductAsPercentage ?? !0,
51
+ active: !0,
52
+ courtOrdered: !0,
53
+ garnishmentType: e?.garnishmentType ?? A
54
+ }), [e]), u = R({
55
+ resolver: I(z),
56
+ defaultValues: M
57
+ }), { control: d } = u, v = g({ control: d, name: "recurring" }), o = g({ control: d, name: "deductAsPercentage" }), O = async (q) => {
58
+ await E(q, async (i) => {
59
+ if (e) {
60
+ const { garnishment: s } = await x({
61
+ request: {
62
+ garnishmentId: e.uuid,
63
+ requestBody: {
64
+ ...i,
65
+ version: e.version,
66
+ times: i.recurring ? null : 1
67
+ }
68
+ }
69
+ });
70
+ a(c.EMPLOYEE_DEDUCTION_UPDATED, s);
71
+ } else {
72
+ const { garnishment: s } = await y({
73
+ request: {
74
+ employeeId: h,
75
+ requestBody: { ...i, times: i.recurring ? null : 1 }
76
+ }
77
+ });
78
+ a(c.EMPLOYEE_DEDUCTION_CREATED, s);
79
+ }
80
+ });
81
+ }, L = () => {
82
+ a(c.EMPLOYEE_DEDUCTION_CANCEL);
83
+ };
84
+ return /* @__PURE__ */ t(S, { ...u, children: /* @__PURE__ */ t(B, { onSubmit: u.handleSubmit(O), children: /* @__PURE__ */ t(G, { flexDirection: "column", gap: 32, children: /* @__PURE__ */ l(b, { children: [
85
+ /* @__PURE__ */ t(m.Heading, { as: "h3", children: D }),
86
+ /* @__PURE__ */ t($, { name: "description", label: n("descriptionLabelV2"), isRequired: !0 }),
87
+ /* @__PURE__ */ t(
88
+ f,
89
+ {
90
+ name: "recurring",
91
+ label: n("frequencyLabel"),
92
+ isRequired: !0,
93
+ options: [
94
+ { value: !0, label: n("frequencyRecurringOptionV2") },
95
+ { value: !1, label: n("frequencyOneTimeOptionV2") }
96
+ ]
97
+ }
98
+ ),
99
+ /* @__PURE__ */ t(
100
+ f,
101
+ {
102
+ name: "deductAsPercentage",
103
+ label: n("deductionTypeLabelV2"),
104
+ isRequired: !0,
105
+ options: [
106
+ { value: !0, label: n("deductionTypePercentageOptionV2") },
107
+ { value: !1, label: n("deductionTypeFixedAmountOption") }
108
+ ]
109
+ }
110
+ ),
111
+ /* @__PURE__ */ t(
112
+ p,
113
+ {
114
+ name: "amount",
115
+ adornmentStart: !o && "$",
116
+ adornmentEnd: o && "%",
117
+ label: n("deductionAmountLabel"),
118
+ isRequired: !0,
119
+ min: 0,
120
+ format: o ? "percent" : "currency",
121
+ description: n(o ? "deductionAmountDescriptionPercentage" : "deductionAmountDescriptionFixed")
122
+ }
123
+ ),
124
+ v && /* @__PURE__ */ l(b, { children: [
125
+ /* @__PURE__ */ t(
126
+ p,
127
+ {
128
+ name: "totalAmount",
129
+ adornmentStart: "$",
130
+ format: "currency",
131
+ label: n("totalAmountLabel"),
132
+ description: n("totalAmountDescription"),
133
+ min: 0
134
+ }
135
+ ),
136
+ /* @__PURE__ */ t(
137
+ p,
138
+ {
139
+ name: "annualMaximum",
140
+ adornmentStart: "$",
141
+ format: "currency",
142
+ label: n("annualMaxLabel"),
143
+ min: 0,
144
+ description: n("annualMaxDescription")
145
+ }
146
+ )
147
+ ] }),
148
+ /* @__PURE__ */ l(j, { children: [
149
+ /* @__PURE__ */ t(m.Button, { variant: "secondary", onClick: L, children: n("cancelCta") }),
150
+ /* @__PURE__ */ t(m.Button, { type: "submit", isLoading: T, children: n(e ? "continueCta" : "addDeductionCta") })
151
+ ] })
152
+ ] }) }) }) });
153
+ }
154
+ export {
155
+ z as DeductionSchema,
156
+ fe as default
157
+ };
158
+ //# sourceMappingURL=GarnishmentForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GarnishmentForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/GarnishmentForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { useMemo } from 'react'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { GarnishmentType } from '@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { NumberInputField, TextInputField, RadioGroupField } from '@/components/Common'\nimport { type CommonComponentInterface, useBase } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\n\nexport const DeductionSchema = z.object({\n active: z.boolean(),\n amount: z.number().min(0).transform(String),\n description: z.string().min(1),\n courtOrdered: z.boolean(),\n times: z.number().nullable(),\n recurring: z.boolean(),\n annualMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n totalAmount: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n deductAsPercentage: z.boolean(),\n garnishmentType: z.nativeEnum(GarnishmentType),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ninterface GarnishmentFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n selectedGarnishmentType: GarnishmentType\n selectedGarnishmentTitle: string\n}\n\nfunction GarnishmentForm({\n deduction,\n employeeId,\n selectedGarnishmentType,\n selectedGarnishmentTitle,\n}: GarnishmentFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n const isPending = isPendingCreate || isPendingUpdate\n\n const defaultValues: DeductionInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n description: deduction?.description ?? '',\n times: deduction?.times ?? null,\n recurring: deduction?.recurring ?? true,\n annualMaximum: deduction?.annualMaximum ? Number(deduction.annualMaximum) : null,\n totalAmount: deduction?.totalAmount ? Number(deduction.totalAmount) : null,\n deductAsPercentage: deduction?.deductAsPercentage ?? true,\n active: true,\n courtOrdered: true,\n garnishmentType: deduction?.garnishmentType ?? selectedGarnishmentType,\n }\n }, [deduction])\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n const { control } = formMethods\n const watchedRecurring = useWatch({ control, name: 'recurring' })\n const watchedAmountPercentage = useWatch({ control, name: 'deductAsPercentage' })\n\n const onSubmit: SubmitHandler<DeductionPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, times: payload.recurring ? null : 1 },\n },\n })\n\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...payload,\n version: deduction.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CANCEL)\n }\n\n return (\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n <>\n <Components.Heading as=\"h3\">{selectedGarnishmentTitle}</Components.Heading>\n <TextInputField name=\"description\" label={t('descriptionLabelV2')} isRequired />\n <RadioGroupField\n name=\"recurring\"\n label={t('frequencyLabel')}\n isRequired\n options={[\n { value: true, label: t('frequencyRecurringOptionV2') },\n { value: false, label: t('frequencyOneTimeOptionV2') },\n ]}\n />\n <RadioGroupField\n name=\"deductAsPercentage\"\n label={t('deductionTypeLabelV2')}\n isRequired\n options={[\n { value: true, label: t('deductionTypePercentageOptionV2') },\n { value: false, label: t('deductionTypeFixedAmountOption') },\n ]}\n />\n <NumberInputField\n name=\"amount\"\n adornmentStart={!watchedAmountPercentage && '$'}\n adornmentEnd={watchedAmountPercentage && '%'}\n label={t('deductionAmountLabel')}\n isRequired\n min={0}\n format={watchedAmountPercentage ? 'percent' : 'currency'}\n description={\n watchedAmountPercentage\n ? t('deductionAmountDescriptionPercentage')\n : t('deductionAmountDescriptionFixed')\n }\n />\n {watchedRecurring && (\n <>\n <NumberInputField\n name=\"totalAmount\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('totalAmountLabel')}\n description={t('totalAmountDescription')}\n min={0}\n />\n <NumberInputField\n name=\"annualMaximum\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('annualMaxLabel')}\n min={0}\n description={t('annualMaxDescription')}\n />\n </>\n )}\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {!deduction ? t('addDeductionCta') : t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n\nexport default GarnishmentForm\n"],"names":["DeductionSchema","z","val","GarnishmentType","GarnishmentForm","deduction","employeeId","selectedGarnishmentType","selectedGarnishmentTitle","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultValues","useMemo","formMethods","useForm","zodResolver","control","watchedRecurring","useWatch","watchedAmountPercentage","onSubmit","data","payload","updateDeductionResponse","componentEvents","createDeductionResponse","handleCancel","FormProvider","jsx","Form","Flex","jsxs","Fragment","TextInputField","RadioGroupField","NumberInputField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAiBO,MAAMA,IAAkBC,EAAE,OAAO;AAAA,EACtC,QAAQA,EAAE,QAAA;AAAA,EACV,QAAQA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,UAAU,MAAM;AAAA,EAC1C,aAAaA,E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