@gusto/embedded-react-sdk 0.19.0 → 0.21.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 (405) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/dist/UNSTABLE_Hooks.d.ts +1 -0
  3. package/dist/UNSTABLE_Hooks.js +9 -0
  4. package/dist/UNSTABLE_Hooks.js.map +1 -0
  5. package/dist/assets/icons/coins-hand.svg.js +10 -0
  6. package/dist/assets/icons/coins-hand.svg.js.map +1 -0
  7. package/dist/components/Base/Base.d.ts +19 -4
  8. package/dist/components/Base/Base.js +68 -61
  9. package/dist/components/Base/Base.js.map +1 -1
  10. package/dist/components/Base/useBase.d.ts +1 -1
  11. package/dist/components/Base/useBase.js.map +1 -1
  12. package/dist/components/Base/useBaseSubmit.d.ts +10 -0
  13. package/dist/components/Base/useBaseSubmit.js +33 -0
  14. package/dist/components/Base/useBaseSubmit.js.map +1 -0
  15. package/dist/components/Common/Fields/TextAreaField/TextAreaField.d.ts +5 -0
  16. package/dist/components/Common/Fields/TextAreaField/TextAreaField.js +34 -0
  17. package/dist/components/Common/Fields/TextAreaField/TextAreaField.js.map +1 -0
  18. package/dist/components/Common/Fields/TextAreaField/index.d.ts +3 -0
  19. package/dist/components/Common/FlowBreadcrumbs/FlowBreadcrumbs.js +10 -10
  20. package/dist/components/Common/FlowBreadcrumbs/FlowBreadcrumbs.js.map +1 -1
  21. package/dist/components/Common/SignatureForm/SignatureForm.js +15 -10
  22. package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
  23. package/dist/components/Common/SignatureForm/SignatureFormActions.js +14 -10
  24. package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
  25. package/dist/components/Common/SignatureForm/SignatureFormFields.js +19 -14
  26. package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
  27. package/dist/components/Common/UI/Alert/Alert.js +23 -22
  28. package/dist/components/Common/UI/Alert/Alert.js.map +1 -1
  29. package/dist/components/Common/UI/Alert/AlertTypes.d.ts +4 -0
  30. package/dist/components/Common/UI/Alert/AlertTypes.js.map +1 -1
  31. package/dist/components/Common/UI/DatePicker/DatePicker.d.ts +1 -1
  32. package/dist/components/Common/UI/DatePicker/DatePicker.js +38 -37
  33. package/dist/components/Common/UI/DatePicker/DatePicker.js.map +1 -1
  34. package/dist/components/Common/UI/DatePicker/DatePickerTypes.d.ts +4 -0
  35. package/dist/components/Common/UI/Modal/Modal.module.scss.js +17 -17
  36. package/dist/components/Common/UI/Select/Select.d.ts +1 -1
  37. package/dist/components/Common/UI/Select/Select.js +27 -26
  38. package/dist/components/Common/UI/Select/Select.js.map +1 -1
  39. package/dist/components/Common/UI/Select/SelectTypes.d.ts +4 -0
  40. package/dist/components/Common/UI/TextArea/TextArea.d.ts +2 -0
  41. package/dist/components/Common/UI/TextArea/TextArea.js +79 -0
  42. package/dist/components/Common/UI/TextArea/TextArea.js.map +1 -0
  43. package/dist/components/Common/UI/TextArea/TextArea.module.scss.js +12 -0
  44. package/dist/components/Common/UI/TextArea/TextArea.module.scss.js.map +1 -0
  45. package/dist/components/Common/UI/TextArea/TextAreaTypes.d.ts +37 -0
  46. package/dist/components/Common/UI/TextArea/TextAreaTypes.js +9 -0
  47. package/dist/components/Common/UI/TextArea/TextAreaTypes.js.map +1 -0
  48. package/dist/components/Common/UI/TextArea/index.d.ts +4 -0
  49. package/dist/components/Company/AssignSignatory/AssignSignatory.js +11 -7
  50. package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
  51. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +10 -6
  52. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
  53. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +11 -8
  54. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
  55. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +9 -6
  56. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js.map +1 -1
  57. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +14 -13
  58. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js.map +1 -1
  59. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +6 -4
  60. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  61. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +9 -6
  62. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
  63. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +13 -10
  64. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js.map +1 -1
  65. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +14 -13
  66. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js.map +1 -1
  67. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +6 -4
  68. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  69. package/dist/components/Company/AssignSignatory/TitleSelect.js +10 -7
  70. package/dist/components/Company/AssignSignatory/TitleSelect.js.map +1 -1
  71. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +8 -6
  72. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  73. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +11 -9
  74. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
  75. package/dist/components/Company/BankAccount/BankAccountForm/Form.js +13 -9
  76. package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
  77. package/dist/components/Company/BankAccount/BankAccountForm/context.js +6 -4
  78. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  79. package/dist/components/Company/BankAccount/BankAccountList/Actions.js +13 -10
  80. package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
  81. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +15 -12
  82. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
  83. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +8 -4
  84. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
  85. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +8 -5
  86. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
  87. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +15 -11
  88. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  89. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +6 -4
  90. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  91. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +15 -11
  92. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  93. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +6 -4
  94. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  95. package/dist/components/Company/FederalTaxes/Actions.js +11 -8
  96. package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
  97. package/dist/components/Company/FederalTaxes/FederalTaxes.js +19 -15
  98. package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
  99. package/dist/components/Company/FederalTaxes/Form.js +8 -6
  100. package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
  101. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +11 -9
  102. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  103. package/dist/components/Company/Industry/Actions.js +11 -8
  104. package/dist/components/Company/Industry/Actions.js.map +1 -1
  105. package/dist/components/Company/Industry/Context.js +9 -7
  106. package/dist/components/Company/Industry/Context.js.map +1 -1
  107. package/dist/components/Company/Industry/Edit.js +14 -10
  108. package/dist/components/Company/Industry/Edit.js.map +1 -1
  109. package/dist/components/Company/Locations/LocationForm/Actions.js +11 -8
  110. package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
  111. package/dist/components/Company/Locations/LocationForm/Form.js +7 -5
  112. package/dist/components/Company/Locations/LocationForm/Form.js.map +1 -1
  113. package/dist/components/Company/Locations/LocationForm/LocationForm.js +19 -15
  114. package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
  115. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +6 -4
  116. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  117. package/dist/components/Company/Locations/LocationsList/Actions.js +9 -6
  118. package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
  119. package/dist/components/Company/Locations/LocationsList/List.js +17 -15
  120. package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
  121. package/dist/components/Company/Locations/LocationsList/LocationsList.js +15 -12
  122. package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
  123. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +6 -4
  124. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  125. package/dist/components/Company/OnboardingOverview/Completed.js +15 -12
  126. package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
  127. package/dist/components/Company/OnboardingOverview/MissingRequirements.js +12 -9
  128. package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
  129. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +10 -6
  130. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
  131. package/dist/components/Company/OnboardingOverview/context.js +6 -4
  132. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  133. package/dist/components/Company/PaySchedule/PaySchedule.js +36 -33
  134. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  135. package/dist/components/Company/PaySchedule/_parts/Actions.js +13 -10
  136. package/dist/components/Company/PaySchedule/_parts/Actions.js.map +1 -1
  137. package/dist/components/Company/PaySchedule/_parts/Edit.js +15 -15
  138. package/dist/components/Company/PaySchedule/_parts/Head.js +14 -11
  139. package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
  140. package/dist/components/Company/PaySchedule/_parts/List.js +21 -19
  141. package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
  142. package/dist/components/Company/PaySchedule/usePaySchedule.js +8 -6
  143. package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
  144. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +8 -5
  145. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
  146. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +6 -4
  147. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  148. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +9 -6
  149. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
  150. package/dist/components/Company/StateTaxes/StateTaxesList/List.js +8 -5
  151. package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
  152. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +6 -4
  153. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  154. package/dist/components/Contractor/Address/Address.js +8 -4
  155. package/dist/components/Contractor/Address/Address.js.map +1 -1
  156. package/dist/components/Contractor/Address/Form.js +8 -6
  157. package/dist/components/Contractor/Address/Form.js.map +1 -1
  158. package/dist/components/Contractor/Address/useAddress.js +8 -6
  159. package/dist/components/Contractor/Address/useAddress.js.map +1 -1
  160. package/dist/components/Contractor/ContractorList/index.js +29 -28
  161. package/dist/components/Contractor/ContractorList/index.js.map +1 -1
  162. package/dist/components/Contractor/NewHireReport/NewHireReport.js +14 -13
  163. package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
  164. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +14 -10
  165. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -1
  166. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +3 -2
  167. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -1
  168. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +5 -2
  169. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js.map +1 -1
  170. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.d.ts +15 -0
  171. package/dist/components/Contractor/Payments/Detail/DetailPresentation.d.ts +19 -0
  172. package/dist/components/Contractor/Payments/Overview/OverviewPresentation.d.ts +18 -0
  173. package/dist/components/Contractor/Payments/PaymentEdit/PaymentEditPresentation.d.ts +6 -0
  174. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.d.ts +18 -0
  175. package/dist/components/Contractor/Payments/types.d.ts +4 -0
  176. package/dist/components/Contractor/Profile/ContractorProfileForm.js +13 -13
  177. package/dist/components/Contractor/Profile/useContractorProfile.js +4 -3
  178. package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
  179. package/dist/components/Contractor/Submit/Submit.js +22 -20
  180. package/dist/components/Contractor/Submit/Submit.js.map +1 -1
  181. package/dist/components/Employee/Compensation/Actions.js +14 -12
  182. package/dist/components/Employee/Compensation/Actions.js.map +1 -1
  183. package/dist/components/Employee/Compensation/Edit.js +17 -16
  184. package/dist/components/Employee/Compensation/Edit.js.map +1 -1
  185. package/dist/components/Employee/Compensation/List.js +25 -23
  186. package/dist/components/Employee/Compensation/List.js.map +1 -1
  187. package/dist/components/Employee/Deductions/Deductions.d.ts +1 -1
  188. package/dist/components/Employee/Deductions/Deductions.js +10 -10
  189. package/dist/components/Employee/Deductions/Deductions.js.map +1 -1
  190. package/dist/components/Employee/Deductions/DeductionsComponents.d.ts +2 -0
  191. package/dist/components/Employee/Deductions/DeductionsComponents.js +6 -6
  192. package/dist/components/Employee/Deductions/DeductionsComponents.js.map +1 -1
  193. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +222 -0
  194. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -0
  195. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.module.scss.js +8 -0
  196. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.module.scss.js.map +1 -0
  197. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.d.ts +2 -2
  198. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +165 -0
  199. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -0
  200. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.d.ts +0 -34
  201. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js +90 -126
  202. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js.map +1 -1
  203. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.module.scss.js +14 -0
  204. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.module.scss.js.map +1 -0
  205. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +56 -55
  206. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js.map +1 -1
  207. package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.d.ts +6 -0
  208. package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.js +53 -0
  209. package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.js.map +1 -0
  210. package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.module.scss.js +14 -0
  211. package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.module.scss.js.map +1 -0
  212. package/dist/components/Employee/Deductions/stateMachine.js +49 -29
  213. package/dist/components/Employee/Deductions/stateMachine.js.map +1 -1
  214. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +9 -6
  215. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
  216. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +13 -9
  217. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  218. package/dist/components/Employee/DocumentSigner/DocumentList/List.js +6 -2
  219. package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
  220. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +6 -4
  221. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  222. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +15 -11
  223. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  224. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +6 -4
  225. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  226. package/dist/components/Employee/EmployeeList/Actions.js +9 -6
  227. package/dist/components/Employee/EmployeeList/Actions.js.map +1 -1
  228. package/dist/components/Employee/EmployeeList/EmployeeList.js +6 -3
  229. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  230. package/dist/components/Employee/EmployeeList/Head.js +8 -5
  231. package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
  232. package/dist/components/Employee/EmployeeList/List.js +17 -16
  233. package/dist/components/Employee/EmployeeList/List.js.map +1 -1
  234. package/dist/components/Employee/EmployeeList/useEmployeeList.js +6 -4
  235. package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
  236. package/dist/components/Employee/FederalTaxes/Actions.js +10 -7
  237. package/dist/components/Employee/FederalTaxes/Actions.js.map +1 -1
  238. package/dist/components/Employee/FederalTaxes/FederalForm.js +14 -11
  239. package/dist/components/Employee/FederalTaxes/FederalForm.js.map +1 -1
  240. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +6 -4
  241. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
  242. package/dist/components/Employee/Landing/Landing.js +15 -13
  243. package/dist/components/Employee/Landing/Landing.js.map +1 -1
  244. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +7 -7
  245. package/dist/components/Employee/PaymentMethod/Actions.js +11 -8
  246. package/dist/components/Employee/PaymentMethod/Actions.js.map +1 -1
  247. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +8 -5
  248. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js.map +1 -1
  249. package/dist/components/Employee/PaymentMethod/BankAccountsList.js +13 -11
  250. package/dist/components/Employee/PaymentMethod/BankAccountsList.js.map +1 -1
  251. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +10 -7
  252. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +1 -1
  253. package/dist/components/Employee/PaymentMethod/Split.js +10 -9
  254. package/dist/components/Employee/PaymentMethod/Split.js.map +1 -1
  255. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +8 -6
  256. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
  257. package/dist/components/Employee/Profile/Actions.js +11 -8
  258. package/dist/components/Employee/Profile/Actions.js.map +1 -1
  259. package/dist/components/Employee/Profile/AdminPersonalDetails.js +11 -8
  260. package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
  261. package/dist/components/Employee/Profile/HomeAddress.js +8 -7
  262. package/dist/components/Employee/Profile/HomeAddress.js.map +1 -1
  263. package/dist/components/Employee/Profile/PersonalDetailsInputs.js +31 -28
  264. package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
  265. package/dist/components/Employee/Profile/useProfile.js +6 -4
  266. package/dist/components/Employee/Profile/useProfile.js.map +1 -1
  267. package/dist/components/Employee/StateTaxes/Actions.js +11 -8
  268. package/dist/components/Employee/StateTaxes/Actions.js.map +1 -1
  269. package/dist/components/Employee/StateTaxes/useStateTaxes.js +6 -4
  270. package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
  271. package/dist/components/Employee/Taxes/Actions.js +11 -8
  272. package/dist/components/Employee/Taxes/Actions.js.map +1 -1
  273. package/dist/components/Employee/Taxes/FederalForm.js +15 -12
  274. package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
  275. package/dist/components/Employee/Taxes/useTaxes.js +6 -4
  276. package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
  277. package/dist/components/Flow/Flow.js +30 -27
  278. package/dist/components/Flow/Flow.js.map +1 -1
  279. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.d.ts +1 -1
  280. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.js +58 -36
  281. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.js.map +1 -1
  282. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.d.ts +2 -0
  283. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.js +71 -54
  284. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.js.map +1 -1
  285. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsComponents.d.ts +23 -0
  286. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsComponents.js +27 -15
  287. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsComponents.js.map +1 -1
  288. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.d.ts +25 -2
  289. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +153 -23
  290. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js.map +1 -1
  291. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.module.scss.js +10 -0
  292. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.module.scss.js.map +1 -0
  293. package/dist/components/Payroll/ConfirmWireDetails/WireInstructions/WireInstructions.d.ts +9 -1
  294. package/dist/components/Payroll/ConfirmWireDetails/WireInstructions/WireInstructions.js +195 -22
  295. package/dist/components/Payroll/ConfirmWireDetails/WireInstructions/WireInstructions.js.map +1 -1
  296. package/dist/components/Payroll/ConfirmWireDetails/WireInstructions/WireInstructions.module.scss.js +18 -0
  297. package/dist/components/Payroll/ConfirmWireDetails/WireInstructions/WireInstructions.module.scss.js.map +1 -0
  298. package/dist/components/Payroll/ConfirmWireDetails/confirmWireDetailsStateMachine.d.ts +10 -2
  299. package/dist/components/Payroll/ConfirmWireDetails/confirmWireDetailsStateMachine.js +39 -25
  300. package/dist/components/Payroll/ConfirmWireDetails/confirmWireDetailsStateMachine.js.map +1 -1
  301. package/dist/components/Payroll/ConfirmWireDetails/index.d.ts +1 -0
  302. package/dist/components/Payroll/ConfirmWireDetails/types.d.ts +5 -0
  303. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js +16 -13
  304. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js.map +1 -1
  305. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +8 -6
  306. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js.map +1 -1
  307. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +15 -15
  308. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
  309. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +27 -27
  310. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +13 -11
  311. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
  312. package/dist/components/Payroll/PayrollHistory/PayrollHistory.d.ts +0 -12
  313. package/dist/components/Payroll/PayrollHistory/PayrollHistory.js +44 -52
  314. package/dist/components/Payroll/PayrollHistory/PayrollHistory.js.map +1 -1
  315. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.d.ts +9 -6
  316. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +97 -93
  317. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
  318. package/dist/components/Payroll/PayrollList/PayrollList.js +58 -59
  319. package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
  320. package/dist/components/Payroll/PayrollList/PayrollListPresentation.d.ts +4 -6
  321. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +82 -72
  322. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
  323. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +3 -2
  324. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
  325. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +11 -10
  326. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
  327. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchThresholdExceeded.js +8 -5
  328. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchThresholdExceeded.js.map +1 -1
  329. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +3 -2
  330. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
  331. package/dist/components/Payroll/PayrollStatusBadges/PayrollStatusBadges.d.ts +7 -0
  332. package/dist/components/Payroll/PayrollStatusBadges/PayrollStatusBadges.js +19 -0
  333. package/dist/components/Payroll/PayrollStatusBadges/PayrollStatusBadges.js.map +1 -0
  334. package/dist/components/Payroll/PayrollStatusBadges/PayrollStatusBadges.module.scss.js +10 -0
  335. package/dist/components/Payroll/PayrollStatusBadges/PayrollStatusBadges.module.scss.js.map +1 -0
  336. package/dist/components/Payroll/PayrollStatusBadges/index.d.ts +4 -0
  337. package/dist/components/Payroll/PayrollStatusBadges/payrollStatusConfig.d.ts +33 -0
  338. package/dist/components/Payroll/PayrollStatusBadges/payrollStatusConfig.js +161 -0
  339. package/dist/components/Payroll/PayrollStatusBadges/payrollStatusConfig.js.map +1 -0
  340. package/dist/components/Payroll/PayrollStatusBadges/usePayrollStatusBadges.d.ts +3 -0
  341. package/dist/components/Payroll/PayrollStatusBadges/usePayrollStatusBadges.js +17 -0
  342. package/dist/components/Payroll/PayrollStatusBadges/usePayrollStatusBadges.js.map +1 -0
  343. package/dist/components/Payroll/PayrollStatusBadges/usePayrollStatusBadges.test.d.ts +1 -0
  344. package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/PayrollConfiguration.d.ts +6 -0
  345. package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/PayrollConfiguration.js +70 -0
  346. package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/PayrollConfiguration.js.map +1 -0
  347. package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/PayrollConfigurationContext.d.ts +7 -0
  348. package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/PayrollConfigurationContext.js +6 -0
  349. package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/PayrollConfigurationContext.js.map +1 -0
  350. package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/PayrollConfigurationProvider.d.ts +9 -0
  351. package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/PayrollConfigurationProvider.js +40 -0
  352. package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/PayrollConfigurationProvider.js.map +1 -0
  353. package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/index.d.ts +5 -0
  354. package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/usePayrollConfiguration.d.ts +2 -0
  355. package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/usePayrollConfiguration.js +12 -0
  356. package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/usePayrollConfiguration.js.map +1 -0
  357. package/dist/components/Payroll/UNSTABLE_PayrollHooks/index.d.ts +2 -0
  358. package/dist/components/Payroll/helpers.d.ts +0 -5
  359. package/dist/components/Payroll/helpers.js +106 -112
  360. package/dist/components/Payroll/helpers.js.map +1 -1
  361. package/dist/components/Payroll/usePreparedPayrollData.js +10 -8
  362. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  363. package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js +48 -46
  364. package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js.map +1 -1
  365. package/dist/contexts/ComponentAdapter/useComponentContext.d.ts +2 -0
  366. package/dist/contexts/ComponentAdapter/useComponentContext.js +3 -3
  367. package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
  368. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +9 -5
  369. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
  370. package/dist/helpers/dateFormatting.d.ts +9 -0
  371. package/dist/helpers/dateFormatting.js +65 -52
  372. package/dist/helpers/dateFormatting.js.map +1 -1
  373. package/dist/helpers/formattedStrings.js +12 -11
  374. package/dist/helpers/formattedStrings.js.map +1 -1
  375. package/dist/helpers/validations.js +1 -1
  376. package/dist/helpers/validations.js.map +1 -1
  377. package/dist/i18n/I18n.js +10 -10
  378. package/dist/i18n/I18n.js.map +1 -1
  379. package/dist/i18n/en/ContractorPayment.ContractorPaymentCreatePayment.json.js +32 -0
  380. package/dist/i18n/en/ContractorPayment.ContractorPaymentCreatePayment.json.js.map +1 -0
  381. package/dist/i18n/en/ContractorPayment.ContractorPaymentDetail.json.js +24 -0
  382. package/dist/i18n/en/ContractorPayment.ContractorPaymentDetail.json.js.map +1 -0
  383. package/dist/i18n/en/ContractorPayment.ContractorPaymentOverview.json.js +32 -0
  384. package/dist/i18n/en/ContractorPayment.ContractorPaymentOverview.json.js.map +1 -0
  385. package/dist/i18n/en/ContractorPayment.ContractorPaymentPaymentHistory.json.js +32 -0
  386. package/dist/i18n/en/ContractorPayment.ContractorPaymentPaymentHistory.json.js.map +1 -0
  387. package/dist/i18n/en/Payroll.Common.json.js +8 -0
  388. package/dist/i18n/en/Payroll.Common.json.js.map +1 -0
  389. package/dist/i18n/en/Payroll.ConfirmWireDetailsForm.json.js +25 -5
  390. package/dist/i18n/en/Payroll.ConfirmWireDetailsForm.json.js.map +1 -1
  391. package/dist/i18n/en/Payroll.PayrollList.json.js +14 -16
  392. package/dist/i18n/en/Payroll.PayrollList.json.js.map +1 -1
  393. package/dist/i18n/en/Payroll.WireInstructions.json.js +22 -6
  394. package/dist/i18n/en/Payroll.WireInstructions.json.js.map +1 -1
  395. package/dist/shared/constants.d.ts +6 -0
  396. package/dist/shared/constants.js +15 -12
  397. package/dist/shared/constants.js.map +1 -1
  398. package/dist/style.css +1 -1
  399. package/dist/types/i18next.d.ts +183 -8
  400. package/package.json +13 -9
  401. package/dist/components/Employee/Deductions/DeductionsForm/UNSTABLE_DeductionsForm.d.ts +0 -7
  402. package/dist/components/Employee/Deductions/EmptyState/EmptyState.d.ts +0 -6
  403. package/dist/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.d.ts +0 -15
  404. package/dist/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.js +0 -48
  405. package/dist/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.js.map +0 -1
@@ -0,0 +1,165 @@
1
+ import { jsx as n, jsxs as c, Fragment as g } from "react/jsx-runtime";
2
+ import { useTranslation as T } from "react-i18next";
3
+ import { useForm as q, useWatch as D, FormProvider as R } from "react-hook-form";
4
+ import { useMemo as S, useEffect as N } from "react";
5
+ import { z as r } from "zod";
6
+ import { zodResolver as I } from "@hookform/resolvers/zod";
7
+ import { useGarnishmentsCreateMutation as U } from "@gusto/embedded-api/react-query/garnishmentsCreate";
8
+ import { useGarnishmentsUpdateMutation as V } from "@gusto/embedded-api/react-query/garnishmentsUpdate";
9
+ import { useComponentContext as _ } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
10
+ import { Form as w } from "../../../Common/Form/Form.js";
11
+ import { Flex as B } from "../../../Common/Flex/Flex.js";
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";
18
+ import "react-error-boundary";
19
+ import "@gusto/embedded-api/models/errors/apierror";
20
+ import "@gusto/embedded-api/models/errors/sdkvalidationerror";
21
+ import "@tanstack/react-query";
22
+ import { useBase as Y } from "../../../Base/useBase.js";
23
+ import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
24
+ import "dompurify";
25
+ import "../../../../contexts/LocaleProvider/useLocale.js";
26
+ import { CheckboxField as $ } from "../../../Common/Fields/CheckboxField/CheckboxField.js";
27
+ const k = r.object({
28
+ active: r.boolean(),
29
+ amount: r.number().min(0).transform(String),
30
+ description: r.string().min(1),
31
+ courtOrdered: r.boolean(),
32
+ times: r.number().nullable(),
33
+ recurring: r.boolean(),
34
+ annualMaximum: r.number().min(0).transform((e) => e > 0 ? e.toString() : null).nullable(),
35
+ totalAmount: r.number().min(0).transform((e) => e > 0 ? e.toString() : null).nullable(),
36
+ deductAsPercentage: r.boolean()
37
+ });
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(() => ({
40
+ amount: e?.amount ? Number(e.amount) : 0,
41
+ description: e?.description ?? "",
42
+ times: e?.times ?? null,
43
+ recurring: e?.recurring ?? !0,
44
+ annualMaximum: e?.annualMaximum ? Number(e.annualMaximum) : null,
45
+ totalAmount: e?.totalAmount ? Number(e.totalAmount) : null,
46
+ deductAsPercentage: e?.deductAsPercentage ?? !0,
47
+ active: !0,
48
+ courtOrdered: e?.courtOrdered ?? !1
49
+ }), [e]), s = q({
50
+ resolver: I(k),
51
+ defaultValues: u
52
+ }), { reset: b, control: f } = s;
53
+ N(() => {
54
+ b(u);
55
+ }, [e, u, b]);
56
+ const M = D({ control: f, name: "recurring" }), o = D({ control: f, name: "deductAsPercentage" }), F = async (v) => {
57
+ await E(v, async (i) => {
58
+ if (e) {
59
+ const { garnishment: l } = await x({
60
+ request: {
61
+ garnishmentId: e.uuid,
62
+ requestBody: {
63
+ ...i,
64
+ version: e.version,
65
+ times: i.recurring ? null : 1
66
+ }
67
+ }
68
+ });
69
+ a(d.EMPLOYEE_DEDUCTION_UPDATED, l);
70
+ } else {
71
+ const { garnishment: l } = await C({
72
+ request: {
73
+ employeeId: A,
74
+ requestBody: { ...i, times: i.recurring ? null : 1 }
75
+ }
76
+ });
77
+ a(d.EMPLOYEE_DEDUCTION_CREATED, l);
78
+ }
79
+ });
80
+ }, L = () => {
81
+ a(d.EMPLOYEE_DEDUCTION_CANCEL);
82
+ };
83
+ 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
+ /* @__PURE__ */ n(m.Heading, { as: "h3", children: t("customDeductionTitle") }),
85
+ /* @__PURE__ */ n(j, { name: "description", label: t("descriptionLabelV2"), isRequired: !0 }),
86
+ /* @__PURE__ */ n(
87
+ h,
88
+ {
89
+ name: "recurring",
90
+ label: t("frequencyLabel"),
91
+ isRequired: !0,
92
+ options: [
93
+ { value: !0, label: t("frequencyRecurringOptionV2") },
94
+ { value: !1, label: t("frequencyOneTimeOptionV2") }
95
+ ]
96
+ }
97
+ ),
98
+ /* @__PURE__ */ n(
99
+ h,
100
+ {
101
+ name: "deductAsPercentage",
102
+ label: t("deductionTypeLabelV2"),
103
+ isRequired: !0,
104
+ options: [
105
+ { value: !0, label: t("deductionTypePercentageOptionV2") },
106
+ { value: !1, label: t("deductionTypeFixedAmountOption") }
107
+ ]
108
+ }
109
+ ),
110
+ /* @__PURE__ */ n(
111
+ p,
112
+ {
113
+ name: "amount",
114
+ adornmentStart: !o && "$",
115
+ adornmentEnd: o && "%",
116
+ label: t("deductionAmountLabel"),
117
+ isRequired: !0,
118
+ min: 0,
119
+ format: o ? "percent" : "currency",
120
+ description: t(o ? "deductionAmountDescriptionPercentage" : "deductionAmountDescriptionFixed")
121
+ }
122
+ ),
123
+ M && /* @__PURE__ */ c(g, { children: [
124
+ /* @__PURE__ */ n(
125
+ p,
126
+ {
127
+ name: "totalAmount",
128
+ adornmentStart: "$",
129
+ format: "currency",
130
+ label: t("totalAmountLabel"),
131
+ description: t("totalAmountDescription"),
132
+ min: 0
133
+ }
134
+ ),
135
+ /* @__PURE__ */ n(
136
+ p,
137
+ {
138
+ name: "annualMaximum",
139
+ adornmentStart: "$",
140
+ format: "currency",
141
+ label: t("annualMaxLabel"),
142
+ min: 0,
143
+ description: t("annualMaxDescription")
144
+ }
145
+ )
146
+ ] }),
147
+ /* @__PURE__ */ n(
148
+ $,
149
+ {
150
+ name: "courtOrdered",
151
+ label: t("courtOrderedLabel"),
152
+ isDisabled: !!e
153
+ }
154
+ ),
155
+ /* @__PURE__ */ c(G, { children: [
156
+ /* @__PURE__ */ n(m.Button, { variant: "secondary", onClick: L, children: t("cancelCta") }),
157
+ /* @__PURE__ */ n(m.Button, { type: "submit", isLoading: O, children: t(e ? "continueCta" : "addDeductionCta") })
158
+ ] })
159
+ ] }) }) }) });
160
+ }
161
+ export {
162
+ k as DeductionSchema,
163
+ he as default
164
+ };
165
+ //# sourceMappingURL=CustomDeductionForm.js.map
@@ -0,0 +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,SAAA;AAAA,EACH,aAAaD,EACV,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAC,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,oBAAoBD,EAAE,QAAA;AACxB,CAAC;AAUD,SAASE,GAAoB,EAAE,WAAAC,GAAW,YAAAC,KAAqC;AAC7E,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,EAAA,GACjC,EAAE,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA,GAEb,EAAE,aAAaC,GAAiB,WAAWC,EAAA,IAC/CC,EAAA,GACI,EAAE,aAAaC,GAAiB,WAAWC,EAAA,IAC/CC,EAAA,GACIC,IAAYL,KAAmBG,GAE/BG,IAAiCC,EAAQ,OACtC;AAAA,IACL,QAAQhB,GAAW,SAAS,OAAOA,EAAU,MAAM,IAAI;AAAA,IACvD,aAAaA,GAAW,eAAe;AAAA,IACvC,OAAOA,GAAW,SAAS;AAAA,IAC3B,WAAWA,GAAW,aAAa;AAAA,IACnC,eAAeA,GAAW,gBAAgB,OAAOA,EAAU,aAAa,IAAI;AAA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CACA,iCADsC;AAAA,MACL;AAAA,IAAA;AAAA,IAG1CF,KACC,gBAAAc,EAAAC,GAAA,EACE,UAAA;AAAA,MAAA,gBAAAJ;AAAA,QAACO;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,gBAAe;AAAA,UACf,QAAO;AAAA,UACP,OAAO,EAAE,kBAAkB;AAAA,UAC3B,aAAa,EAAE,wBAAwB;AAAA,UACvC,KAAK;AAAA,QAAA;AAAA,MAAA;AAAA,MAEP,gBAAAP;AAAA,QAACO;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,gBAAe;AAAA,UACf,QAAO;AAAA,UACP,OAAO,EAAE,gBAAgB;AAAA,UACzB,KAAK;AAAA,UACL,aAAa,EAAE,sBAAsB;AAAA,QAAA;AAAA,MAAA;AAAA,IACvC,GACF;AAAA,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,38 +1,4 @@
1
- import { z } from 'zod';
2
1
  import { BaseComponentInterface, CommonComponentInterface } from '../../../Base';
3
- export declare const DeductionSchema: z.ZodObject<{
4
- active: z.ZodBoolean;
5
- amount: z.ZodEffects<z.ZodNumber, string, number>;
6
- description: z.ZodString;
7
- courtOrdered: z.ZodBoolean;
8
- times: z.ZodNullable<z.ZodNumber>;
9
- recurring: z.ZodEffects<z.ZodString, boolean, string>;
10
- annualMaximum: z.ZodNullable<z.ZodEffects<z.ZodNumber, string | null, number>>;
11
- payPeriodMaximum: z.ZodNullable<z.ZodEffects<z.ZodNumber, string | null, number>>;
12
- deductAsPercentage: z.ZodEffects<z.ZodString, boolean, string>;
13
- }, "strip", z.ZodTypeAny, {
14
- description: string;
15
- active: boolean;
16
- amount: string;
17
- payPeriodMaximum: string | null;
18
- recurring: boolean;
19
- courtOrdered: boolean;
20
- times: number | null;
21
- annualMaximum: string | null;
22
- deductAsPercentage: boolean;
23
- }, {
24
- description: string;
25
- active: boolean;
26
- amount: number;
27
- payPeriodMaximum: number | null;
28
- recurring: string;
29
- courtOrdered: boolean;
30
- times: number | null;
31
- annualMaximum: number | null;
32
- deductAsPercentage: string;
33
- }>;
34
- export type DeductionInputs = z.input<typeof DeductionSchema>;
35
- export type DeductionPayload = z.output<typeof DeductionSchema>;
36
2
  interface DeductionsFormProps extends CommonComponentInterface<'Employee.Deductions'> {
37
3
  employeeId: string;
38
4
  deductionId?: string | null;
@@ -1,134 +1,98 @@
1
- import { jsx as n, jsxs as d, Fragment as E } from "react/jsx-runtime";
2
- import { useTranslation as N } from "react-i18next";
3
- import { useMemo as B, useEffect as U } from "react";
4
- import { z as i } from "zod";
5
- import { useForm as _, useWatch as I, FormProvider as w } from "react-hook-form";
6
- import { zodResolver as G } from "@hookform/resolvers/zod";
7
- import { useGarnishmentsCreateMutation as j } from "@gusto/embedded-api/react-query/garnishmentsCreate";
8
- import { useGarnishmentsUpdateMutation as Y } from "@gusto/embedded-api/react-query/garnishmentsUpdate";
9
- import { useGarnishmentsListSuspense as k } from "@gusto/embedded-api/react-query/garnishmentsList";
10
- import { BaseComponent as z } from "../../../Base/Base.js";
11
- import { useBase as H } from "../../../Base/useBase.js";
12
- import { Form as V } from "../../../Common/Form/Form.js";
13
- import { Flex as W } from "../../../Common/Flex/Flex.js";
14
- import { ActionsLayout as J } from "../../../Common/ActionsLayout/ActionsLayout.js";
15
- import { useComponentDictionary as K, useI18n as Q } from "../../../../i18n/I18n.js";
16
- import { componentEvents as p } from "../../../../shared/constants.js";
17
- import { useComponentContext as X } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
18
- import { TextInputField as Z } from "../../../Common/Fields/TextInputField/TextInputField.js";
19
- import { RadioGroupField as x } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
20
- import { NumberInputField as f } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
21
- import { CheckboxField as $ } from "../../../Common/Fields/CheckboxField/CheckboxField.js";
22
- const ee = i.object({
23
- active: i.boolean(),
24
- amount: i.number().min(0).transform(String),
25
- description: i.string().min(1),
26
- courtOrdered: i.boolean(),
27
- times: i.number().nullable(),
28
- recurring: i.string().transform((t) => t === "true"),
29
- annualMaximum: i.number().min(0).transform((t) => t > 0 ? t.toString() : null).nullable(),
30
- payPeriodMaximum: i.number().min(0).transform((t) => t > 0 ? t.toString() : null).nullable(),
31
- deductAsPercentage: i.string().transform((t) => t === "true")
32
- });
33
- function Ce(t) {
34
- return /* @__PURE__ */ n(z, { ...t, children: /* @__PURE__ */ n(ne, { ...t, children: t.children }) });
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";
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 }) });
35
18
  }
36
- function ne({ className: t, children: b, employeeId: g, deductionId: h, dictionary: y }) {
37
- const { onEvent: u, baseSubmitHandler: P } = H(), { t: r } = N("Employee.Deductions"), m = X();
38
- K("Employee.Deductions", y), Q("Employee.Deductions");
39
- const { data: C } = k({ employeeId: g }), e = h ? C.garnishmentList?.find((c) => c.uuid === h) ?? null : null, { mutateAsync: M, isPending: O } = j(), { mutateAsync: L, isPending: T } = Y(), a = B(() => ({
40
- amount: e?.amount ? Number(e.amount) : 0,
41
- description: e?.description ?? "",
42
- times: e?.times ?? null,
43
- recurring: e?.recurring?.toString() ?? "true",
44
- annualMaximum: e?.annualMaximum ? Number(e.annualMaximum) : null,
45
- payPeriodMaximum: e?.payPeriodMaximum ? Number(e.payPeriodMaximum) : null,
46
- deductAsPercentage: e?.deductAsPercentage?.toString() ?? "true",
47
- active: !0,
48
- courtOrdered: e?.courtOrdered ?? !1
49
- }), [e]), s = _({
50
- resolver: G(ee),
51
- defaultValues: a
52
- }), { reset: D, control: v } = s;
53
- U(() => {
54
- D(a);
55
- }, [e, a, D]);
56
- const A = I({ control: v, name: "recurring" }), F = O || T, R = async (c) => {
57
- await P(c, async (o) => {
58
- if (e) {
59
- const { garnishment: l } = await L({
60
- request: {
61
- garnishmentId: e.uuid,
62
- requestBody: {
63
- ...o,
64
- version: e.version,
65
- times: o.recurring ? null : 1
66
- }
67
- }
68
- });
69
- u(p.EMPLOYEE_DEDUCTION_UPDATED, l);
70
- } else {
71
- const { garnishment: l } = await M({
72
- request: {
73
- employeeId: g,
74
- requestBody: { ...o, times: o.recurring ? null : 1 }
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) => ({
24
+ label: e.name,
25
+ 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) => ({
31
+ label: e.county?.length ? e.county : t("allCounties"),
32
+ 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");
39
+ };
40
+ return /* @__PURE__ */ a("section", { className: s, children: [
41
+ /* @__PURE__ */ a(i.Button, { variant: "secondary", onClick: N, children: [
42
+ /* @__PURE__ */ n(U, { className: c.leftCaretIcon }),
43
+ t("backToDeductionsCta")
44
+ ] }),
45
+ /* @__PURE__ */ a(Y, { gap: 16, className: c.formHeadingContainer, children: [
46
+ /* @__PURE__ */ n(i.Heading, { as: "h2", children: y }),
47
+ /* @__PURE__ */ a("section", { children: [
48
+ /* @__PURE__ */ n(i.Heading, { as: "h3", children: t("externalPostTaxDeductions") }),
49
+ /* @__PURE__ */ n(i.Text, { variant: "supporting", children: t("externalPostTaxDeductionsDescription") })
50
+ ] }),
51
+ /* @__PURE__ */ n(
52
+ i.RadioGroup,
53
+ {
54
+ label: t("deductionTypeLabel"),
55
+ description: t("deductionTypeRadioLabel"),
56
+ options: [
57
+ { value: "garnishment", label: t("garnishmentOption") },
58
+ { value: "custom", label: t("customDeductionOption") }
59
+ ],
60
+ defaultValue: E,
61
+ onChange: G,
62
+ isRequired: !0,
63
+ isDisabled: !!o,
64
+ className: c.deductionTypeRadioGroup
65
+ }
66
+ ),
67
+ h && /* @__PURE__ */ a("section", { children: [
68
+ /* @__PURE__ */ n(i.Text, { weight: "bold", className: c.garnishmentTypeLabel, children: t("garnishmentType") }),
69
+ /* @__PURE__ */ n(
70
+ i.Select,
71
+ {
72
+ label: t("garnishmentType"),
73
+ options: [],
74
+ placeholder: t("childSupport"),
75
+ shouldVisuallyHideLabel: !0,
76
+ isDisabled: !0
75
77
  }
76
- });
77
- u(p.EMPLOYEE_DEDUCTION_CREATED, l);
78
- }
79
- });
80
- }, q = () => {
81
- u(p.EMPLOYEE_DEDUCTION_CANCEL);
82
- }, S = r(e ? "editDeductionTitle" : "addDeductionTitle");
83
- return /* @__PURE__ */ n("section", { className: t, children: /* @__PURE__ */ n(w, { ...s, children: /* @__PURE__ */ n(V, { onSubmit: s.handleSubmit(R), children: /* @__PURE__ */ n(W, { flexDirection: "column", gap: 32, children: b || /* @__PURE__ */ d(E, { children: [
84
- /* @__PURE__ */ n(m.Heading, { as: "h2", children: S }),
85
- /* @__PURE__ */ n(Z, { name: "description", label: r("descriptionLabel"), isRequired: !0 }),
86
- /* @__PURE__ */ n(
87
- x,
88
- {
89
- name: "deductAsPercentage",
90
- label: r("deductionTypeLabel"),
91
- isRequired: !0,
92
- options: [
93
- { value: "true", label: r("deductionTypePercentageOption") },
94
- { value: "false", label: r("deductionTypeFixedAmountOption") }
95
- ]
96
- }
97
- ),
98
- /* @__PURE__ */ n(
99
- f,
100
- {
101
- name: "amount",
102
- label: r("deductionAmountLabel"),
103
- isRequired: !0,
104
- min: 0
105
- }
106
- ),
107
- /* @__PURE__ */ n(
108
- x,
78
+ )
79
+ ] }),
80
+ /* @__PURE__ */ n("hr", {})
81
+ ] }),
82
+ h ? /* @__PURE__ */ n(
83
+ O,
109
84
  {
110
- name: "recurring",
111
- label: r("frequencyLabel"),
112
- isRequired: !0,
113
- options: [
114
- { value: "true", label: r("frequencyRecurringOption") },
115
- { value: "false", label: r("frequencyOneTimeOption") }
116
- ]
85
+ deduction: o,
86
+ employeeId: r,
87
+ handleStateAgencySelect: L,
88
+ stateAgencies: C,
89
+ counties: v,
90
+ selectedAgency: x
117
91
  }
118
- ),
119
- A === "true" && /* @__PURE__ */ d(E, { children: [
120
- /* @__PURE__ */ n(f, { name: "annualMaximum", label: r("annualMaxLabel"), min: 0 }),
121
- /* @__PURE__ */ n(f, { name: "payPeriodMaximum", label: "Pay period maximum", min: 0 })
122
- ] }),
123
- /* @__PURE__ */ n($, { name: "courtOrdered", label: r("courtOrderedLabel") }),
124
- /* @__PURE__ */ d(J, { children: [
125
- /* @__PURE__ */ n(m.Button, { variant: "secondary", onClick: q, children: r("cancelCta") }),
126
- /* @__PURE__ */ n(m.Button, { type: "submit", isLoading: F, children: r(e ? "continueCta" : "addDeductionCta") })
127
- ] })
128
- ] }) }) }) }) });
92
+ ) : /* @__PURE__ */ n(R, { deduction: o, employeeId: r })
93
+ ] });
129
94
  }
130
95
  export {
131
- ee as DeductionSchema,
132
- Ce as DeductionsForm
96
+ ie as DeductionsForm
133
97
  };
134
98
  //# 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 { useEffect, useMemo } from 'react'\nimport { z } from 'zod'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { useGarnishmentsListSuspense } from '@gusto/embedded-api/react-query/garnishmentsList'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport {\n CheckboxField,\n NumberInputField,\n RadioGroupField,\n TextInputField,\n} from '@/components/Common'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\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.string().transform(val => val === 'true'),\n annualMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n payPeriodMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n deductAsPercentage: z.string().transform(val => val === 'true'),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\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\nfunction Root({ className, children, employeeId, deductionId, dictionary }: DeductionsFormProps) {\n const { onEvent, baseSubmitHandler } = 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 const deduction = deductionId\n ? (data.garnishmentList?.find(g => g.uuid === deductionId) ?? null)\n : null\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\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?.toString() ?? 'true',\n annualMaximum: deduction?.annualMaximum ? Number(deduction.annualMaximum) : null,\n payPeriodMaximum: deduction?.payPeriodMaximum ? Number(deduction.payPeriodMaximum) : null,\n deductAsPercentage: deduction?.deductAsPercentage?.toString() ?? '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\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\n const isPending = isPendingCreate || isPendingUpdate\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 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 const title = !deduction ? t('addDeductionTitle') : t('editDeductionTitle')\n\n return (\n <section className={className}>\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Components.Heading as=\"h2\">{title}</Components.Heading>\n <TextInputField name=\"description\" label={t('descriptionLabel')} isRequired />\n <RadioGroupField\n name=\"deductAsPercentage\"\n label={t('deductionTypeLabel')}\n isRequired\n options={[\n { value: 'true', label: t('deductionTypePercentageOption') },\n { value: 'false', label: t('deductionTypeFixedAmountOption') },\n ]}\n />\n <NumberInputField\n name=\"amount\"\n label={t('deductionAmountLabel')}\n isRequired\n min={0}\n />\n <RadioGroupField\n name=\"recurring\"\n label={t('frequencyLabel')}\n isRequired\n options={[\n { value: 'true', label: t('frequencyRecurringOption') },\n { value: 'false', label: t('frequencyOneTimeOption') },\n ]}\n />\n {watchedRecurring === 'true' && (\n <>\n <NumberInputField name=\"annualMaximum\" label={t('annualMaxLabel')} min={0} />\n <NumberInputField name=\"payPeriodMaximum\" label=\"Pay period maximum\" min={0} />\n </>\n )}\n <CheckboxField name=\"courtOrdered\" label={t('courtOrderedLabel')} />\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 )}\n </Flex>\n </Form>\n </FormProvider>\n </section>\n )\n}\n"],"names":["DeductionSchema","z","val","DeductionsForm","props","jsx","BaseComponent","Root","className","children","employeeId","deductionId","dictionary","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","useComponentDictionary","useI18n","data","useGarnishmentsListSuspense","deduction","g","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","defaultValues","useMemo","formMethods","useForm","zodResolver","resetForm","control","useEffect","watchedRecurring","useWatch","isPending","onSubmit","payload","updateDeductionResponse","componentEvents","createDeductionResponse","handleCancel","title","FormProvider","Form","Flex","jsxs","Fragment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,IAAA;AAAA,IAEF,gBAAAX;AAAA,MAACoD;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOzC,EAAE,sBAAsB;AAAA,QAC/B,YAAU;AAAA,QACV,KAAK;AAAA,MAAA;AAAA,IAAA;AAAA,IAEP,gBAAAX;AAAA,MAACmD;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOxC,EAAE,gBAAgB;AAAA,QACzB,YAAU;AAAA,QACV,SAAS;AAAA,UACP,EAAE,OAAO,QAAQ,OAAOA,EAAE,0BAA0B,EAAA;AAAA,UACpD,EAAE,OAAO,SAAS,OAAOA,EAAE,wBAAwB,EAAA;AAAA,QAAE;AAAA,MACvD;AAAA,IAAA;AAAA,IAEDwB,MAAqB,UACpB,gBAAAa,EAAAC,GAAA,EACE,UAAA;AAAA,MAAA,gBAAAjD,EAACoD,GAAA,EAAiB,MAAK,iBAAgB,OAAOzC,EAAE,gBAAgB,GAAG,KAAK,GAAG;AAAA,wBAC1EyC,GAAA,EAAiB,MAAK,oBAAmB,OAAM,sBAAqB,KAAK,EAAA,CAAG;AAAA,IAAA,GAC/E;AAAA,sBAEDC,GAAA,EAAc,MAAK,gBAAe,OAAO1C,EAAE,mBAAmB,GAAG;AAAA,sBACjE2C,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAtD,EAACa,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAAS8B,GAC7C,UAAAhC,EAAE,WAAW,EAAA,CAChB;AAAA,MACA,gBAAAX,EAACa,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWwB,GACzC,UAAoC1B,EAAnCQ,IAAqC,gBAAvB,iBAAoC,EAAA,CACtD;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,EAAA,CACF,EAAA,CAEJ,GACF,EAAA,CACF,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 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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ACd,WAAWuB,EAAO;AAAA,QAAA;AAAA,MAAA;AAAA,MAEnBjB,uBACE,WAAA,EACC,UAAA;AAAA,QAAA,gBAAAzB,EAACW,EAAW,MAAX,EAAgB,QAAO,QAAO,WAAW+B,EAAO,sBAC9C,UAAA,EAAE,iBAAiB,EAAA,CACtB;AAAA,QAEA,gBAAA1C;AAAA,UAACW,EAAW;AAAA,UAAX;AAAA,YACC,OAAO,EAAE,iBAAiB;AAAA,YAC1B,SAAS,CAAA;AAAA,YACT,aAAa,EAAE,cAAc;AAAA,YAC7B,yBAAuB;AAAA,YACvB,YAAU;AAAA,UAAA;AAAA,QAAA;AAAA,MACZ,GACF;AAAA,wBAED,MAAA,CAAA,CAAG;AAAA,IAAA,GACN;AAAA,IAECc,IACC,gBAAAzB;AAAA,MAAC4C;AAAA,MAAA;AAAA,QACC,WAAAzB;AAAA,QACA,YAAAd;AAAA,QACA,yBAAA0B;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;"}
@@ -0,0 +1,14 @@
1
+ const e = "_leftCaretIcon_cfkf8_6", n = "_formHeadingContainer_cfkf8_10", o = "_deductionTypeRadioGroup_cfkf8_14", t = "_garnishmentTypeLabel_cfkf8_18", a = {
2
+ leftCaretIcon: e,
3
+ formHeadingContainer: n,
4
+ deductionTypeRadioGroup: o,
5
+ garnishmentTypeLabel: t
6
+ };
7
+ export {
8
+ o as deductionTypeRadioGroup,
9
+ a as default,
10
+ n as formHeadingContainer,
11
+ t as garnishmentTypeLabel,
12
+ e as leftCaretIcon
13
+ };
14
+ //# sourceMappingURL=DeductionsForm.module.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeductionsForm.module.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}