@gusto/embedded-react-sdk 0.26.0 → 0.27.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 (360) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/dist/assets/icons/plus-circle.svg.js +5 -5
  3. package/dist/assets/icons/plus-circle.svg.js.map +1 -1
  4. package/dist/components/Base/Base.js +13 -12
  5. package/dist/components/Base/Base.js.map +1 -1
  6. package/dist/components/Common/DocumentList/DocumentList.js +23 -23
  7. package/dist/components/Common/DocumentList/DocumentList.js.map +1 -1
  8. package/dist/components/Common/DocumentList/DocumentList.module.scss.js +6 -10
  9. package/dist/components/Common/DocumentList/DocumentList.module.scss.js.map +1 -1
  10. package/dist/components/Common/DocumentViewer/DocumentViewer.module.scss.js +12 -12
  11. package/dist/components/Common/InlineSpinner/InlineSpinner.module.scss.js +1 -1
  12. package/dist/components/Common/InternalError/InternalError.module.scss.js +4 -4
  13. package/dist/components/Common/ReorderableList/ReorderableList.module.scss.js +8 -8
  14. package/dist/components/Common/RequirementsList/RequirementsList.module.scss.js +1 -1
  15. package/dist/components/Common/SignatureForm/SignatureForm.js +12 -10
  16. package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
  17. package/dist/components/Common/SignatureForm/SignatureFormActions.js +3 -2
  18. package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
  19. package/dist/components/Common/SignatureForm/SignatureFormFields.js +7 -6
  20. package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
  21. package/dist/components/Common/UI/Alert/Alert.module.scss.js +9 -9
  22. package/dist/components/Common/UI/Banner/Banner.module.scss.js +1 -1
  23. package/dist/components/Common/UI/Button/Button.module.scss.js +1 -1
  24. package/dist/components/Common/UI/CalendarPreview/CalendarPreview.module.scss.js +4 -4
  25. package/dist/components/Common/UI/Card/Card.module.scss.js +1 -1
  26. package/dist/components/Common/UI/Checkbox/Checkbox.module.scss.js +1 -1
  27. package/dist/components/Common/UI/ComboBox/ComboBox.module.scss.js +3 -3
  28. package/dist/components/Common/UI/DatePicker/DatePicker.module.scss.js +4 -4
  29. package/dist/components/Common/UI/DescriptionList/DescriptionList.module.scss.js +1 -1
  30. package/dist/components/Common/UI/Dialog/Dialog.module.scss.js +2 -2
  31. package/dist/components/Common/UI/FileInput/FileInput.module.scss.js +26 -26
  32. package/dist/components/Common/UI/Input/Input.module.scss.js +8 -8
  33. package/dist/components/Common/UI/Modal/Modal.module.scss.js +12 -12
  34. package/dist/components/Common/UI/Radio/Radio.module.scss.js +6 -6
  35. package/dist/components/Common/UI/Select/Select.module.scss.js +4 -4
  36. package/dist/components/Common/UI/Table/Table.js +1 -1
  37. package/dist/components/Common/UI/Table/Table.js.map +1 -1
  38. package/dist/components/Common/UI/Table/Table.module.scss.js +1 -1
  39. package/dist/components/Common/UI/Tabs/Tabs.module.scss.js +1 -1
  40. package/dist/components/Common/UI/Text/Text.module.scss.js +17 -15
  41. package/dist/components/Common/UI/Text/Text.module.scss.js.map +1 -1
  42. package/dist/components/Common/UI/TextArea/TextArea.module.scss.js +4 -4
  43. package/dist/components/Company/AssignSignatory/AssignSignatory.js +3 -2
  44. package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
  45. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +4 -3
  46. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
  47. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +3 -2
  48. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
  49. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +1 -1
  50. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +12 -12
  51. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +4 -3
  52. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  53. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +3 -2
  54. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
  55. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +1 -1
  56. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +1 -1
  57. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +4 -3
  58. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  59. package/dist/components/Company/AssignSignatory/TitleSelect.js +4 -3
  60. package/dist/components/Company/AssignSignatory/TitleSelect.js.map +1 -1
  61. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +6 -5
  62. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  63. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +9 -8
  64. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
  65. package/dist/components/Company/BankAccount/BankAccountForm/Form.js +7 -5
  66. package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
  67. package/dist/components/Company/BankAccount/BankAccountForm/context.js +4 -3
  68. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  69. package/dist/components/Company/BankAccount/BankAccountList/Actions.js +3 -2
  70. package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
  71. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +7 -6
  72. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
  73. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +7 -5
  74. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
  75. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +3 -2
  76. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
  77. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +9 -8
  78. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  79. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +4 -3
  80. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  81. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +4 -3
  82. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  83. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +4 -3
  84. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  85. package/dist/components/Company/FederalTaxes/Actions.js +7 -6
  86. package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
  87. package/dist/components/Company/FederalTaxes/FederalTaxes.js +4 -3
  88. package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
  89. package/dist/components/Company/FederalTaxes/Form.js +5 -3
  90. package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
  91. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +6 -5
  92. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  93. package/dist/components/Company/Industry/Actions.js +8 -7
  94. package/dist/components/Company/Industry/Actions.js.map +1 -1
  95. package/dist/components/Company/Industry/Context.js +7 -6
  96. package/dist/components/Company/Industry/Context.js.map +1 -1
  97. package/dist/components/Company/Industry/Edit.js +3 -2
  98. package/dist/components/Company/Industry/Edit.js.map +1 -1
  99. package/dist/components/Company/Locations/LocationForm/Actions.js +7 -6
  100. package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
  101. package/dist/components/Company/Locations/LocationForm/Form.js +1 -1
  102. package/dist/components/Company/Locations/LocationForm/LocationForm.js +4 -3
  103. package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
  104. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +4 -3
  105. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  106. package/dist/components/Company/Locations/LocationsList/Actions.js +3 -2
  107. package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
  108. package/dist/components/Company/Locations/LocationsList/List.js +7 -6
  109. package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
  110. package/dist/components/Company/Locations/LocationsList/LocationsList.js +8 -7
  111. package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
  112. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +4 -3
  113. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  114. package/dist/components/Company/OnboardingOverview/Completed.js +12 -10
  115. package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
  116. package/dist/components/Company/OnboardingOverview/MissingRequirements.js +8 -6
  117. package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
  118. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +8 -7
  119. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
  120. package/dist/components/Company/OnboardingOverview/context.js +4 -3
  121. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  122. package/dist/components/Company/PaySchedule/PaySchedule.js +4 -3
  123. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  124. package/dist/components/Company/PaySchedule/_parts/Actions.js +3 -2
  125. package/dist/components/Company/PaySchedule/_parts/Actions.js.map +1 -1
  126. package/dist/components/Company/PaySchedule/_parts/Edit.js +15 -15
  127. package/dist/components/Company/PaySchedule/_parts/Head.js +13 -11
  128. package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
  129. package/dist/components/Company/PaySchedule/_parts/List.js +15 -13
  130. package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
  131. package/dist/components/Company/PaySchedule/usePaySchedule.js +6 -5
  132. package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
  133. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +3 -2
  134. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
  135. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +4 -3
  136. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  137. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +3 -2
  138. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
  139. package/dist/components/Company/StateTaxes/StateTaxesList/List.js +3 -2
  140. package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
  141. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +4 -3
  142. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  143. package/dist/components/Contractor/Address/Address.js +5 -4
  144. package/dist/components/Contractor/Address/Address.js.map +1 -1
  145. package/dist/components/Contractor/Address/Form.js +1 -1
  146. package/dist/components/Contractor/Address/useAddress.js +6 -5
  147. package/dist/components/Contractor/Address/useAddress.js.map +1 -1
  148. package/dist/components/Contractor/ContractorList/index.js +32 -31
  149. package/dist/components/Contractor/ContractorList/index.js.map +1 -1
  150. package/dist/components/Contractor/NewHireReport/NewHireReport.js +14 -13
  151. package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
  152. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +12 -11
  153. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -1
  154. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +3 -2
  155. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -1
  156. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +4 -3
  157. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js.map +1 -1
  158. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js +4 -2
  159. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js.map +1 -1
  160. package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js +10 -10
  161. package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js +9 -7
  162. package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js.map +1 -1
  163. package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js +9 -8
  164. package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js.map +1 -1
  165. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js +11 -9
  166. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js.map +1 -1
  167. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js +8 -6
  168. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js.map +1 -1
  169. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.module.scss.js +14 -14
  170. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js +4 -2
  171. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js.map +1 -1
  172. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +4 -2
  173. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -1
  174. package/dist/components/Contractor/Profile/ContractorProfileForm.js +15 -15
  175. package/dist/components/Contractor/Profile/ContractorProfileForm.module.scss.js +1 -1
  176. package/dist/components/Contractor/Profile/useContractorProfile.js +3 -2
  177. package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
  178. package/dist/components/Contractor/Submit/Submit.js +21 -20
  179. package/dist/components/Contractor/Submit/Submit.js.map +1 -1
  180. package/dist/components/Employee/Compensation/Actions.js +13 -12
  181. package/dist/components/Employee/Compensation/Actions.js.map +1 -1
  182. package/dist/components/Employee/Compensation/Edit.js +17 -16
  183. package/dist/components/Employee/Compensation/Edit.js.map +1 -1
  184. package/dist/components/Employee/Compensation/List.js +23 -22
  185. package/dist/components/Employee/Compensation/List.js.map +1 -1
  186. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.d.ts +3 -1
  187. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +145 -137
  188. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
  189. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.d.ts +2 -1
  190. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +106 -101
  191. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
  192. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js +90 -87
  193. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js.map +1 -1
  194. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.d.ts +2 -1
  195. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +110 -104
  196. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +1 -1
  197. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +51 -45
  198. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js.map +1 -1
  199. package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.js +31 -30
  200. package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.js.map +1 -1
  201. package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.module.scss.js +4 -8
  202. package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.module.scss.js.map +1 -1
  203. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +3 -2
  204. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
  205. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +3 -2
  206. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  207. package/dist/components/Employee/DocumentSigner/DocumentList/List.js +4 -2
  208. package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
  209. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +4 -3
  210. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  211. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +3 -2
  212. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  213. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +4 -3
  214. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  215. package/dist/components/Employee/EmployeeList/Actions.js +7 -6
  216. package/dist/components/Employee/EmployeeList/Actions.js.map +1 -1
  217. package/dist/components/Employee/EmployeeList/EmployeeList.js +4 -3
  218. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  219. package/dist/components/Employee/EmployeeList/Head.js +7 -5
  220. package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
  221. package/dist/components/Employee/EmployeeList/List.js +3 -2
  222. package/dist/components/Employee/EmployeeList/List.js.map +1 -1
  223. package/dist/components/Employee/EmployeeList/useEmployeeList.js +4 -3
  224. package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
  225. package/dist/components/Employee/FederalTaxes/Actions.js +6 -5
  226. package/dist/components/Employee/FederalTaxes/Actions.js.map +1 -1
  227. package/dist/components/Employee/FederalTaxes/FederalForm.js +12 -11
  228. package/dist/components/Employee/FederalTaxes/FederalForm.js.map +1 -1
  229. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +4 -3
  230. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
  231. package/dist/components/Employee/Landing/Landing.js +11 -10
  232. package/dist/components/Employee/Landing/Landing.js.map +1 -1
  233. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +7 -7
  234. package/dist/components/Employee/PaymentMethod/Actions.js +6 -5
  235. package/dist/components/Employee/PaymentMethod/Actions.js.map +1 -1
  236. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +5 -4
  237. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js.map +1 -1
  238. package/dist/components/Employee/PaymentMethod/BankAccountsList.js +3 -2
  239. package/dist/components/Employee/PaymentMethod/BankAccountsList.js.map +1 -1
  240. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +7 -6
  241. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +1 -1
  242. package/dist/components/Employee/PaymentMethod/Split.js +11 -10
  243. package/dist/components/Employee/PaymentMethod/Split.js.map +1 -1
  244. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +6 -5
  245. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
  246. package/dist/components/Employee/Profile/Actions.js +6 -5
  247. package/dist/components/Employee/Profile/Actions.js.map +1 -1
  248. package/dist/components/Employee/Profile/AdminPersonalDetails.js +6 -5
  249. package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
  250. package/dist/components/Employee/Profile/AdminPersonalDetails.module.scss.js +1 -1
  251. package/dist/components/Employee/Profile/HomeAddress.js +1 -1
  252. package/dist/components/Employee/Profile/PersonalDetailsInputs.js +2 -2
  253. package/dist/components/Employee/Profile/useProfile.js +4 -3
  254. package/dist/components/Employee/Profile/useProfile.js.map +1 -1
  255. package/dist/components/Employee/StateTaxes/Actions.js +6 -5
  256. package/dist/components/Employee/StateTaxes/Actions.js.map +1 -1
  257. package/dist/components/Employee/StateTaxes/useStateTaxes.js +4 -3
  258. package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
  259. package/dist/components/Employee/Taxes/Actions.js +7 -6
  260. package/dist/components/Employee/Taxes/Actions.js.map +1 -1
  261. package/dist/components/Employee/Taxes/FederalForm.js +14 -13
  262. package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
  263. package/dist/components/Employee/Taxes/useTaxes.js +4 -3
  264. package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
  265. package/dist/components/Flow/Flow.js +9 -7
  266. package/dist/components/Flow/Flow.js.map +1 -1
  267. package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js +17 -16
  268. package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js.map +1 -1
  269. package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.module.scss.js +4 -4
  270. package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js +38 -36
  271. package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js.map +1 -1
  272. package/dist/components/InformationRequests/InformationRequests.d.ts +7 -2
  273. package/dist/components/InformationRequests/InformationRequests.js +78 -45
  274. package/dist/components/InformationRequests/InformationRequests.js.map +1 -1
  275. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +10 -9
  276. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js.map +1 -1
  277. package/dist/components/Payroll/ConfirmWireDetails/WireInstructions/WireInstructions.module.scss.js +10 -10
  278. package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelection.d.ts +2 -0
  279. package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelection.js +33 -0
  280. package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelection.js.map +1 -0
  281. package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.d.ts +7 -0
  282. package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js +39 -0
  283. package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js.map +1 -0
  284. package/dist/components/Payroll/OffCycleReasonSelection/index.d.ts +5 -0
  285. package/dist/components/Payroll/OffCycleReasonSelection/types.d.ts +15 -0
  286. package/dist/components/Payroll/OffCycleReasonSelection/types.js +14 -0
  287. package/dist/components/Payroll/OffCycleReasonSelection/types.js.map +1 -0
  288. package/dist/components/Payroll/PayPeriodDateForm/PayPeriodDateForm.d.ts +2 -0
  289. package/dist/components/Payroll/PayPeriodDateForm/PayPeriodDateForm.js +35 -0
  290. package/dist/components/Payroll/PayPeriodDateForm/PayPeriodDateForm.js.map +1 -0
  291. package/dist/components/Payroll/PayPeriodDateForm/PayPeriodDateFormPresentation.d.ts +2 -0
  292. package/dist/components/Payroll/PayPeriodDateForm/PayPeriodDateFormPresentation.js +65 -0
  293. package/dist/components/Payroll/PayPeriodDateForm/PayPeriodDateFormPresentation.js.map +1 -0
  294. package/dist/components/Payroll/PayPeriodDateForm/PayPeriodDateFormPresentation.module.scss.js +18 -0
  295. package/dist/components/Payroll/PayPeriodDateForm/PayPeriodDateFormPresentation.module.scss.js.map +1 -0
  296. package/dist/components/Payroll/PayPeriodDateForm/PayPeriodDateFormTypes.d.ts +53 -0
  297. package/dist/components/Payroll/PayPeriodDateForm/index.d.ts +3 -0
  298. package/dist/components/Payroll/PayPeriodDateForm/usePayPeriodDateValidation.d.ts +5 -0
  299. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js +4 -2
  300. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js.map +1 -1
  301. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +19 -18
  302. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js.map +1 -1
  303. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +36 -36
  304. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.module.scss.js +5 -5
  305. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +21 -19
  306. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
  307. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +17 -15
  308. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
  309. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +26 -24
  310. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
  311. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +30 -29
  312. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
  313. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js +4 -2
  314. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js.map +1 -1
  315. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +3 -2
  316. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
  317. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.module.scss.js +18 -18
  318. package/dist/components/Payroll/RecoveryCases/RecoveryCases.d.ts +4 -1
  319. package/dist/components/Payroll/RecoveryCases/RecoveryCases.js +34 -28
  320. package/dist/components/Payroll/RecoveryCases/RecoveryCases.js.map +1 -1
  321. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js +29 -29
  322. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js.map +1 -1
  323. package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js +12 -11
  324. package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js.map +1 -1
  325. package/dist/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.js +4 -2
  326. package/dist/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.js.map +1 -1
  327. package/dist/components/Payroll/index.d.ts +4 -0
  328. package/dist/components/Payroll/index.js +12 -8
  329. package/dist/components/Payroll/index.js.map +1 -1
  330. package/dist/components/Payroll/usePreparedPayrollData.js +3 -2
  331. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  332. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +3 -2
  333. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
  334. package/dist/contexts/ThemeProvider/theme.d.ts +8 -3
  335. package/dist/contexts/ThemeProvider/theme.js +29 -24
  336. package/dist/contexts/ThemeProvider/theme.js.map +1 -1
  337. package/dist/helpers/dateFormatting.d.ts +3 -0
  338. package/dist/helpers/dateFormatting.js.map +1 -1
  339. package/dist/i18n/I18n.js +1 -1
  340. package/dist/i18n/I18n.js.map +1 -1
  341. package/dist/i18n/en/Employee.Deductions.json.js +157 -161
  342. package/dist/i18n/en/Employee.Deductions.json.js.map +1 -1
  343. package/dist/i18n/en/InformationRequests.InformationRequestList.json.js +12 -10
  344. package/dist/i18n/en/InformationRequests.InformationRequestList.json.js.map +1 -1
  345. package/dist/i18n/en/InformationRequests.json.js +8 -0
  346. package/dist/i18n/en/InformationRequests.json.js.map +1 -0
  347. package/dist/i18n/en/Payroll.OffCycleReasonSelection.json.js +12 -0
  348. package/dist/i18n/en/Payroll.OffCycleReasonSelection.json.js.map +1 -0
  349. package/dist/i18n/en/Payroll.PayPeriodDateForm.json.js +32 -0
  350. package/dist/i18n/en/Payroll.PayPeriodDateForm.json.js.map +1 -0
  351. package/dist/shared/constants.d.ts +4 -0
  352. package/dist/shared/constants.js +10 -8
  353. package/dist/shared/constants.js.map +1 -1
  354. package/dist/style.css +1 -1
  355. package/dist/types/i18next.d.ts +51 -3
  356. package/package.json +11 -11
  357. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.module.scss.js +0 -8
  358. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.module.scss.js.map +0 -1
  359. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.module.scss.js +0 -14
  360. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.module.scss.js.map +0 -1
@@ -1,29 +1,30 @@
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";
1
+ import { jsx as t, jsxs as o, Fragment as S } from "react/jsx-runtime";
2
+ import { useTranslation as L } from "react-i18next";
3
+ import { useForm as N, useWatch as g, FormProvider as V } from "react-hook-form";
4
+ import { useMemo as w } from "react";
5
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 { ActionsLayout as j } from "../../../Common/ActionsLayout/ActionsLayout.js";
6
+ import { zodResolver as B } from "@hookform/resolvers/zod";
7
+ import { GarnishmentType as G } from "@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments";
8
+ import { useGarnishmentsCreateMutation as I } from "@gusto/embedded-api/react-query/garnishmentsCreate";
9
+ import { useGarnishmentsUpdateMutation as U } from "@gusto/embedded-api/react-query/garnishmentsUpdate";
10
+ import { useComponentContext as _ } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
11
+ import { Form as j } from "../../../Common/Form/Form.js";
12
+ import { Flex as m } from "../../../Common/Flex/Flex.js";
13
+ import "classnames";
14
+ import { componentEvents as b } from "../../../../shared/constants.js";
15
+ import { RadioGroupField as f } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
16
+ import { TextInputField as $ } from "../../../Common/Fields/TextInputField/TextInputField.js";
17
+ import { ActionsLayout as z } from "../../../Common/ActionsLayout/ActionsLayout.js";
18
+ import { NumberInputField as c } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
14
19
  import "react-error-boundary";
15
20
  import "@gusto/embedded-api/models/errors/apierror";
16
21
  import "@gusto/embedded-api/models/errors/sdkvalidationerror";
17
22
  import "@tanstack/react-query";
18
- import { useBase as Y } from "../../../Base/useBase.js";
19
- import { componentEvents as c } from "../../../../shared/constants.js";
23
+ import { useBase as H } from "../../../Base/useBase.js";
20
24
  import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
21
25
  import "dompurify";
22
26
  import "../../../../contexts/LocaleProvider/useLocale.js";
23
- import { TextInputField as $ } from "../../../Common/Fields/TextInputField/TextInputField.js";
24
- import { RadioGroupField as f } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
25
- import { NumberInputField as p } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
26
- const z = r.object({
27
+ const Y = r.object({
27
28
  active: r.boolean(),
28
29
  amount: r.number().min(0).transform(String),
29
30
  description: r.string().min(1),
@@ -33,15 +34,16 @@ const z = r.object({
33
34
  annualMaximum: r.number().min(0).transform((e) => e > 0 ? e.toString() : null).nullable(),
34
35
  totalAmount: r.number().min(0).transform((e) => e > 0 ? e.toString() : null).nullable(),
35
36
  deductAsPercentage: r.boolean(),
36
- garnishmentType: r.nativeEnum(U)
37
+ garnishmentType: r.nativeEnum(G)
37
38
  });
38
- function he({
39
+ function De({
39
40
  deduction: e,
40
41
  employeeId: h,
41
42
  selectedGarnishmentType: A,
42
- selectedGarnishmentTitle: D
43
+ selectedGarnishmentTitle: D,
44
+ onCancel: y
43
45
  }) {
44
- 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(() => ({
46
+ const { onEvent: p, baseSubmitHandler: x } = H(), { t: n } = L("Employee.Deductions"), u = _(), { mutateAsync: P, isPending: E } = I(), { mutateAsync: v, isPending: T } = U(), M = E || T, C = w(() => ({
45
47
  amount: e?.amount ? Number(e.amount) : 0,
46
48
  description: e?.description ?? "",
47
49
  times: e?.times ?? null,
@@ -52,108 +54,112 @@ function he({
52
54
  active: !0,
53
55
  courtOrdered: !0,
54
56
  garnishmentType: e?.garnishmentType ?? A
55
- }), [e]), u = R({
56
- resolver: I(z),
57
- defaultValues: M
58
- }), { control: d } = u, v = g({ control: d, name: "recurring" }), o = g({ control: d, name: "deductAsPercentage" }), O = async (q) => {
59
- await E(q, async (i) => {
57
+ }), [e]), s = N({
58
+ resolver: B(Y),
59
+ defaultValues: C
60
+ }), { control: d } = s, q = g({ control: d, name: "recurring" }), i = g({ control: d, name: "deductAsPercentage" }), F = async (R) => {
61
+ await x(R, async (a) => {
60
62
  if (e) {
61
- const { garnishment: s } = await x({
63
+ const { garnishment: l } = await v({
62
64
  request: {
63
65
  garnishmentId: e.uuid,
64
66
  requestBody: {
65
- ...i,
67
+ ...a,
66
68
  version: e.version,
67
- times: i.recurring ? null : 1
69
+ times: a.recurring ? null : 1
68
70
  }
69
71
  }
70
72
  });
71
- a(c.EMPLOYEE_DEDUCTION_UPDATED, s);
73
+ p(b.EMPLOYEE_DEDUCTION_UPDATED, l);
72
74
  } else {
73
- const { garnishment: s } = await y({
75
+ const { garnishment: l } = await P({
74
76
  request: {
75
77
  employeeId: h,
76
- requestBody: { ...i, times: i.recurring ? null : 1 }
78
+ requestBody: { ...a, times: a.recurring ? null : 1 }
77
79
  }
78
80
  });
79
- a(c.EMPLOYEE_DEDUCTION_CREATED, s);
81
+ p(b.EMPLOYEE_DEDUCTION_CREATED, l);
80
82
  }
81
83
  });
82
- }, L = () => {
83
- a(c.EMPLOYEE_DEDUCTION_CANCEL);
84
+ }, O = () => {
85
+ y();
84
86
  };
85
- return /* @__PURE__ */ t(S, { ...u, children: /* @__PURE__ */ t(B, { onSubmit: u.handleSubmit(O), children: /* @__PURE__ */ t(G, { flexDirection: "column", gap: 32, children: /* @__PURE__ */ l(b, { children: [
86
- /* @__PURE__ */ t(m.Heading, { as: "h3", children: D }),
87
- /* @__PURE__ */ t($, { name: "description", label: n("descriptionLabelV2"), isRequired: !0 }),
88
- /* @__PURE__ */ t(
89
- f,
90
- {
91
- name: "recurring",
92
- label: n("frequencyLabel"),
93
- isRequired: !0,
94
- options: [
95
- { value: !0, label: n("frequencyRecurringOptionV2") },
96
- { value: !1, label: n("frequencyOneTimeOptionV2") }
97
- ]
98
- }
99
- ),
100
- /* @__PURE__ */ t(
101
- f,
102
- {
103
- name: "deductAsPercentage",
104
- label: n("deductionTypeLabelV2"),
105
- isRequired: !0,
106
- options: [
107
- { value: !0, label: n("deductionTypePercentageOptionV2") },
108
- { value: !1, label: n("deductionTypeFixedAmountOption") }
109
- ]
110
- }
111
- ),
112
- /* @__PURE__ */ t(
113
- p,
114
- {
115
- name: "amount",
116
- adornmentStart: !o && "$",
117
- adornmentEnd: o && "%",
118
- label: n("deductionAmountLabel"),
119
- isRequired: !0,
120
- min: 0,
121
- format: o ? "percent" : "currency",
122
- description: n(o ? "deductionAmountDescriptionPercentage" : "deductionAmountDescriptionFixed")
123
- }
124
- ),
125
- v && /* @__PURE__ */ l(b, { children: [
126
- /* @__PURE__ */ t(
127
- p,
128
- {
129
- name: "totalAmount",
130
- adornmentStart: "$",
131
- format: "currency",
132
- label: n("totalAmountLabel"),
133
- description: n("totalAmountDescription"),
134
- min: 0
135
- }
136
- ),
137
- /* @__PURE__ */ t(
138
- p,
139
- {
140
- name: "annualMaximum",
141
- adornmentStart: "$",
142
- format: "currency",
143
- label: n("annualMaxLabel"),
144
- min: 0,
145
- description: n("annualMaxDescription")
146
- }
147
- )
87
+ return /* @__PURE__ */ t(V, { ...s, children: /* @__PURE__ */ t(j, { onSubmit: s.handleSubmit(F), children: /* @__PURE__ */ t(m, { flexDirection: "column", gap: 32, children: /* @__PURE__ */ o(S, { children: [
88
+ /* @__PURE__ */ t(u.Heading, { as: "h3", children: D }),
89
+ /* @__PURE__ */ o(m, { flexDirection: "column", gap: 20, children: [
90
+ /* @__PURE__ */ o(m, { flexDirection: "column", gap: 20, children: [
91
+ /* @__PURE__ */ t($, { name: "description", label: n("descriptionLabelV2"), isRequired: !0 }),
92
+ /* @__PURE__ */ t(
93
+ f,
94
+ {
95
+ name: "recurring",
96
+ label: n("frequencyLabel"),
97
+ isRequired: !0,
98
+ options: [
99
+ { value: !0, label: n("frequencyRecurringOptionV2") },
100
+ { value: !1, label: n("frequencyOneTimeOptionV2") }
101
+ ]
102
+ }
103
+ ),
104
+ /* @__PURE__ */ t(
105
+ f,
106
+ {
107
+ name: "deductAsPercentage",
108
+ label: n("deductionTypeLabelV2"),
109
+ isRequired: !0,
110
+ options: [
111
+ { value: !0, label: n("deductionTypePercentageOptionV2") },
112
+ { value: !1, label: n("deductionTypeFixedAmountOption") }
113
+ ]
114
+ }
115
+ ),
116
+ /* @__PURE__ */ t(
117
+ c,
118
+ {
119
+ name: "amount",
120
+ adornmentStart: !i && "$",
121
+ adornmentEnd: i && "%",
122
+ label: n("deductionAmountLabel"),
123
+ isRequired: !0,
124
+ min: 0,
125
+ format: i ? "percent" : "currency",
126
+ description: n(i ? "deductionAmountDescriptionPercentage" : "deductionAmountDescriptionFixed")
127
+ }
128
+ )
129
+ ] }),
130
+ q && /* @__PURE__ */ o(m, { flexDirection: "column", gap: 20, children: [
131
+ /* @__PURE__ */ t(
132
+ c,
133
+ {
134
+ name: "totalAmount",
135
+ adornmentStart: "$",
136
+ format: "currency",
137
+ label: n("totalAmountLabel"),
138
+ description: n("totalAmountDescription"),
139
+ min: 0
140
+ }
141
+ ),
142
+ /* @__PURE__ */ t(
143
+ c,
144
+ {
145
+ name: "annualMaximum",
146
+ adornmentStart: "$",
147
+ format: "currency",
148
+ label: n("annualMaxLabel"),
149
+ min: 0,
150
+ description: n("annualMaxDescription")
151
+ }
152
+ )
153
+ ] })
148
154
  ] }),
149
- /* @__PURE__ */ l(j, { children: [
150
- /* @__PURE__ */ t(m.Button, { variant: "secondary", onClick: L, children: n("cancelCta") }),
151
- /* @__PURE__ */ t(m.Button, { type: "submit", isLoading: T, children: n(e ? "continueCta" : "addDeductionCta") })
155
+ /* @__PURE__ */ o(z, { children: [
156
+ /* @__PURE__ */ t(u.Button, { variant: "secondary", onClick: O, children: n("cancelCta") }),
157
+ /* @__PURE__ */ t(u.Button, { type: "submit", isLoading: M, children: n("saveCta") })
152
158
  ] })
153
159
  ] }) }) }) });
154
160
  }
155
161
  export {
156
- z as DeductionSchema,
157
- he as default
162
+ Y as DeductionSchema,
163
+ De as default
158
164
  };
159
165
  //# sourceMappingURL=GarnishmentForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GarnishmentForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/GarnishmentForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { useMemo } from 'react'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { GarnishmentType } from '@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { NumberInputField, TextInputField, RadioGroupField } from '@/components/Common'\nimport { type CommonComponentInterface, useBase } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\n\nexport const DeductionSchema = z.object({\n active: z.boolean(),\n amount: z.number().min(0).transform(String),\n description: z.string().min(1),\n courtOrdered: z.boolean(),\n times: z.number().nullable(),\n recurring: z.boolean(),\n annualMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n totalAmount: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n deductAsPercentage: z.boolean(),\n garnishmentType: z.nativeEnum(GarnishmentType),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ninterface GarnishmentFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n selectedGarnishmentType: GarnishmentType\n selectedGarnishmentTitle: string\n}\n\nfunction GarnishmentForm({\n deduction,\n employeeId,\n selectedGarnishmentType,\n selectedGarnishmentTitle,\n}: GarnishmentFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n const isPending = isPendingCreate || isPendingUpdate\n\n const defaultValues: DeductionInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n description: deduction?.description ?? '',\n times: deduction?.times ?? null,\n recurring: deduction?.recurring ?? true,\n annualMaximum: deduction?.annualMaximum ? Number(deduction.annualMaximum) : null,\n totalAmount: deduction?.totalAmount ? Number(deduction.totalAmount) : null,\n deductAsPercentage: deduction?.deductAsPercentage ?? true,\n active: true,\n courtOrdered: true,\n garnishmentType: deduction?.garnishmentType ?? selectedGarnishmentType,\n }\n }, [deduction])\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n const { control } = formMethods\n const watchedRecurring = useWatch({ control, name: 'recurring' })\n const watchedAmountPercentage = useWatch({ control, name: 'deductAsPercentage' })\n\n const onSubmit: SubmitHandler<DeductionPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, times: payload.recurring ? null : 1 },\n },\n })\n\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...payload,\n version: deduction.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CANCEL)\n }\n\n return (\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n <>\n <Components.Heading as=\"h3\">{selectedGarnishmentTitle}</Components.Heading>\n <TextInputField name=\"description\" label={t('descriptionLabelV2')} isRequired />\n <RadioGroupField\n name=\"recurring\"\n label={t('frequencyLabel')}\n isRequired\n options={[\n { value: true, label: t('frequencyRecurringOptionV2') },\n { value: false, label: t('frequencyOneTimeOptionV2') },\n ]}\n />\n <RadioGroupField\n name=\"deductAsPercentage\"\n label={t('deductionTypeLabelV2')}\n isRequired\n options={[\n { value: true, label: t('deductionTypePercentageOptionV2') },\n { value: false, label: t('deductionTypeFixedAmountOption') },\n ]}\n />\n <NumberInputField\n name=\"amount\"\n adornmentStart={!watchedAmountPercentage && '$'}\n adornmentEnd={watchedAmountPercentage && '%'}\n label={t('deductionAmountLabel')}\n isRequired\n min={0}\n format={watchedAmountPercentage ? 'percent' : 'currency'}\n description={\n watchedAmountPercentage\n ? t('deductionAmountDescriptionPercentage')\n : t('deductionAmountDescriptionFixed')\n }\n />\n {watchedRecurring && (\n <>\n <NumberInputField\n name=\"totalAmount\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('totalAmountLabel')}\n description={t('totalAmountDescription')}\n min={0}\n />\n <NumberInputField\n name=\"annualMaximum\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('annualMaxLabel')}\n min={0}\n description={t('annualMaxDescription')}\n />\n </>\n )}\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {!deduction ? t('addDeductionCta') : t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n\nexport default GarnishmentForm\n"],"names":["DeductionSchema","z","val","GarnishmentType","GarnishmentForm","deduction","employeeId","selectedGarnishmentType","selectedGarnishmentTitle","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultValues","useMemo","formMethods","useForm","zodResolver","control","watchedRecurring","useWatch","watchedAmountPercentage","onSubmit","data","payload","updateDeductionResponse","componentEvents","createDeductionResponse","handleCancel","FormProvider","jsx","Form","Flex","jsxs","Fragment","TextInputField","RadioGroupField","NumberInputField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAiBO,MAAMA,IAAkBC,EAAE,OAAO;AAAA,EACtC,QAAQA,EAAE,QAAA;AAAA,EACV,QAAQA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,UAAU,MAAM;AAAA,EAC1C,aAAaA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC7B,cAAcA,EAAE,QAAA;AAAA,EAChB,OAAOA,EAAE,OAAA,EAAS,SAAA;AAAA,EAClB,WAAWA,EAAE,QAAA;AAAA,EACb,eAAeA,EACZ,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAC,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,aAAaD,EACV,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAC,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,oBAAoBD,EAAE,QAAA;AAAA,EACtB,iBAAiBA,EAAE,WAAWE,CAAe;AAC/C,CAAC;AAYD,SAASC,GAAgB;AAAA,EACvB,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,0BAAAC;AACF,GAAyB;AACvB,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,EAAA,GACjC,EAAE,GAAAC,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA,GAEb,EAAE,aAAaC,GAAiB,WAAWC,EAAA,IAC/CC,EAAA,GACI,EAAE,aAA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K;AAAA,QACL,gBAAgB,CAAChB,KAA2B;AAAA,QAC5C,cAAcA,KAA2B;AAAA,QACzC,OAAOnB,EAAE,sBAAsB;AAAA,QAC/B,YAAU;AAAA,QACV,KAAK;AAAA,QACL,QAAQmB,IAA0B,YAAY;AAAA,QAC9C,aAEMnB,EADJmB,IACM,yCACA,iCADsC;AAAA,MACL;AAAA,IAAA;AAAA,IAG1CF,KACC,gBAAAc,EAAAC,GAAA,EACE,UAAA;AAAA,MAAA,gBAAAJ;AAAA,QAACO;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,gBAAe;AAAA,UACf,QAAO;AAAA,UACP,OAAOnC,EAAE,kBAAkB;AAAA,UAC3B,aAAaA,EAAE,wBAAwB;AAAA,UACvC,KAAK;AAAA,QAAA;AAAA,MAAA;AAAA,MAEP,gBAAA4B;AAAA,QAACO;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,gBAAe;AAAA,UACf,QAAO;AAAA,UACP,OAAOnC,EAAE,gBAAgB;AAAA,UACzB,KAAK;AAAA,UACL,aAAaA,EAAE,sBAAsB;AAAA,QAAA;AAAA,MAAA;AAAA,IACvC,GACF;AAAA,sBAEDoC,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAR,EAAC1B,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASwB,GAC7C,UAAA1B,EAAE,WAAW,EAAA,CAChB;AAAA,MACA,gBAAA4B,EAAC1B,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWQ,GACzC,UAAoCV,EAAnCP,IAAqC,gBAAvB,iBAAoC,EAAA,CACtD;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
1
+ {"version":3,"file":"GarnishmentForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/GarnishmentForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { useMemo } from 'react'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { GarnishmentType } from '@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { NumberInputField, TextInputField, RadioGroupField } from '@/components/Common'\nimport { type CommonComponentInterface, useBase } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\n\nexport const DeductionSchema = z.object({\n active: z.boolean(),\n amount: z.number().min(0).transform(String),\n description: z.string().min(1),\n courtOrdered: z.boolean(),\n times: z.number().nullable(),\n recurring: z.boolean(),\n annualMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n totalAmount: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n deductAsPercentage: z.boolean(),\n garnishmentType: z.nativeEnum(GarnishmentType),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ninterface GarnishmentFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n selectedGarnishmentType: GarnishmentType\n selectedGarnishmentTitle: string\n onCancel: () => void\n}\n\nfunction GarnishmentForm({\n deduction,\n employeeId,\n selectedGarnishmentType,\n selectedGarnishmentTitle,\n onCancel,\n}: GarnishmentFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n const isPending = isPendingCreate || isPendingUpdate\n\n const defaultValues: DeductionInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n description: deduction?.description ?? '',\n times: deduction?.times ?? null,\n recurring: deduction?.recurring ?? true,\n annualMaximum: deduction?.annualMaximum ? Number(deduction.annualMaximum) : null,\n totalAmount: deduction?.totalAmount ? Number(deduction.totalAmount) : null,\n deductAsPercentage: deduction?.deductAsPercentage ?? true,\n active: true,\n courtOrdered: true,\n garnishmentType: deduction?.garnishmentType ?? selectedGarnishmentType,\n }\n }, [deduction])\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n const { control } = formMethods\n const watchedRecurring = useWatch({ control, name: 'recurring' })\n const watchedAmountPercentage = useWatch({ control, name: 'deductAsPercentage' })\n\n const onSubmit: SubmitHandler<DeductionPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, times: payload.recurring ? null : 1 },\n },\n })\n\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...payload,\n version: deduction.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const handleCancel = () => {\n onCancel()\n }\n\n return (\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n <>\n <Components.Heading as=\"h3\">{selectedGarnishmentTitle}</Components.Heading>\n <Flex flexDirection=\"column\" gap={20}>\n <Flex flexDirection=\"column\" gap={20}>\n <TextInputField name=\"description\" label={t('descriptionLabelV2')} isRequired />\n <RadioGroupField\n name=\"recurring\"\n label={t('frequencyLabel')}\n isRequired\n options={[\n { value: true, label: t('frequencyRecurringOptionV2') },\n { value: false, label: t('frequencyOneTimeOptionV2') },\n ]}\n />\n <RadioGroupField\n name=\"deductAsPercentage\"\n label={t('deductionTypeLabelV2')}\n isRequired\n options={[\n { value: true, label: t('deductionTypePercentageOptionV2') },\n { value: false, label: t('deductionTypeFixedAmountOption') },\n ]}\n />\n <NumberInputField\n name=\"amount\"\n adornmentStart={!watchedAmountPercentage && '$'}\n adornmentEnd={watchedAmountPercentage && '%'}\n label={t('deductionAmountLabel')}\n isRequired\n min={0}\n format={watchedAmountPercentage ? 'percent' : 'currency'}\n description={\n watchedAmountPercentage\n ? t('deductionAmountDescriptionPercentage')\n : t('deductionAmountDescriptionFixed')\n }\n />\n </Flex>\n {watchedRecurring && (\n <Flex flexDirection=\"column\" gap={20}>\n <NumberInputField\n name=\"totalAmount\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('totalAmountLabel')}\n description={t('totalAmountDescription')}\n min={0}\n />\n <NumberInputField\n name=\"annualMaximum\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('annualMaxLabel')}\n min={0}\n description={t('annualMaxDescription')}\n />\n </Flex>\n )}\n </Flex>\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('saveCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n\nexport default GarnishmentForm\n"],"names":["DeductionSchema","z","val","GarnishmentType","GarnishmentForm","deduction","employeeId","selectedGarnishmentType","selectedGarnishmentTitle","onCancel","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultValues","useMemo","formMethods","useForm","zodResolver","control","watchedRecurring","useWatch","watchedAmountPercentage","onSubmit","data","payload","updateDeductionResponse","componentEvents","createDeductionResponse","handleCancel","FormProvider","jsx","Form","Flex","jsxs","Fragment","TextInputField","RadioGroupField","NumberInputField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAiBO,MAAMA,IAAkBC,EAAE,OAAO;AAAA,EACtC,QAAQA,EAAE,QAAA;AAAA,EACV,QAAQA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,UAAU,MAAM;AAAA,EAC1C,aAAaA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC7B,cAAcA,EAAE,QAAA;AAAA,EAChB,OAAOA,EAAE,OAAA,EAAS,SAAA;AAAA,EAClB,WAAWA,EAAE,QAAA;AAAA,EACb,eAAeA,EACZ,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAC,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,aAAaD,EACV,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAC,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,oBAAoBD,EAAE,QAAA;AAAA,EACtB,iBAAiBA,EAAE,WAAWE,CAAe;AAC/C,CAAC;AAaD,SAASC,GAAgB;AAAA,EACvB,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,0BAAAC;AAAA,EACA,UAAAC;AACF,GAAyB;AACvB,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,EAAA,GACjC,EAAE,GAAAC,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA,GAEb,EAAE,aAAaC,GAAiB,WAAWC,EAAA,IAC/CC,EAAA,GACI,EAAE,aAAaC,GAAiB,WAAWC,EAAA,IAC/CC,EAAA,GACIC,IAAYL,KAAmBG,GAE/BG,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M } from "react-i18next";
3
- import { useGarnishmentsListSuspense as N } from "@gusto/embedded-api/react-query/garnishmentsList";
4
- import { useGarnishmentsUpdateMutation as w } from "@gusto/embedded-api/react-query/garnishmentsUpdate";
5
- import { BaseComponent as I } from "../../../Base/Base.js";
6
- import { useBase as k } from "../../../Base/useBase.js";
7
- import { Flex as U } from "../../../Common/Flex/Flex.js";
1
+ import { jsx as n, jsxs as s, Fragment as M } from "react/jsx-runtime";
2
+ import { useTranslation as N } from "react-i18next";
3
+ import { useGarnishmentsListSuspense as I } from "@gusto/embedded-api/react-query/garnishmentsList";
4
+ import { useGarnishmentsUpdateMutation as k } from "@gusto/embedded-api/react-query/garnishmentsUpdate";
5
+ import { BaseComponent as w } from "../../../Base/Base.js";
6
+ import { useBase as U } from "../../../Base/useBase.js";
7
+ import { Flex as E } from "../../../Common/Flex/Flex.js";
8
+ import "classnames";
9
+ import { componentEvents as c } from "../../../../shared/constants.js";
8
10
  import { ActionsLayout as Y } from "../../../Common/ActionsLayout/ActionsLayout.js";
9
11
  import { HamburgerMenu as B } from "../../../Common/HamburgerMenu/HamburgerMenu.js";
10
- import E from "../../../../hooks/useNumberFormatter.js";
12
+ import p from "../../../../hooks/useNumberFormatter.js";
11
13
  import S from "../../../../assets/icons/pencil.svg.js";
12
14
  import V from "../../../../assets/icons/trashcan.svg.js";
13
15
  import { useComponentDictionary as q, useI18n as F } from "../../../../i18n/I18n.js";
14
- import { componentEvents as a } from "../../../../shared/constants.js";
15
16
  import { useComponentContext as H } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
16
- import { useDataView as j } from "../../../Common/DataView/useDataView.js";
17
- import { DataView as G } from "../../../Common/DataView/DataView.js";
18
- function ue(r) {
19
- return /* @__PURE__ */ n(I, { ...r, children: /* @__PURE__ */ n(R, { ...r, children: r.children }) });
17
+ import j from "../../../../assets/icons/plus-circle.svg.js";
18
+ import { useDataView as G } from "../../../Common/DataView/useDataView.js";
19
+ import { DataView as R } from "../../../Common/DataView/DataView.js";
20
+ function de(i) {
21
+ return /* @__PURE__ */ n(w, { ...i, children: /* @__PURE__ */ n(z, { ...i, children: i.children }) });
20
22
  }
21
- function R({ className: r, children: s, employeeId: D, dictionary: p }) {
22
- const { onEvent: o, baseSubmitHandler: f } = k(), { t } = M("Employee.Deductions"), c = H(), h = E("currency"), g = E("percent");
23
- q("Employee.Deductions", p), F("Employee.Deductions");
24
- const { data: C } = N({ employeeId: D }), u = C.garnishmentList, T = u.filter((e) => e.active), { mutateAsync: v, isPending: y } = w(), b = async (e) => {
25
- await f(e, async (i) => {
26
- const { garnishment: m } = await v({
23
+ function z({ className: i, children: m, employeeId: D, dictionary: f }) {
24
+ const { onEvent: o, baseSubmitHandler: h } = U(), { t } = N("Employee.Deductions"), a = H(), g = p("currency"), C = p("percent");
25
+ q("Employee.Deductions", f), F("Employee.Deductions");
26
+ const { data: v } = I({ employeeId: D }), u = v.garnishmentList, T = u.filter((e) => e.active), { mutateAsync: y, isPending: L } = k(), P = async (e) => {
27
+ await h(e, async (r) => {
28
+ const { garnishment: l } = await y({
27
29
  request: {
28
- garnishmentId: i.uuid,
30
+ garnishmentId: r.uuid,
29
31
  requestBody: {
30
- ...i,
31
- totalAmount: i.totalAmount ?? void 0,
32
+ ...r,
33
+ totalAmount: r.totalAmount ?? void 0,
32
34
  active: !1,
33
- version: i.version
35
+ version: r.version
34
36
  }
35
37
  }
36
- }), d = u.filter((x) => x.active);
37
- d.length === 1 && d[0]?.uuid === m?.uuid ? o(a.EMPLOYEE_DEDUCTION_DELETED_EMPTY) : o(a.EMPLOYEE_DEDUCTION_DELETED, m);
38
+ }), d = u.filter((A) => A.active);
39
+ d.length === 1 && d[0]?.uuid === l?.uuid ? o(c.EMPLOYEE_DEDUCTION_DELETED_EMPTY) : o(c.EMPLOYEE_DEDUCTION_DELETED, l);
38
40
  });
39
- }, L = (e) => {
40
- o(a.EMPLOYEE_DEDUCTION_EDIT, e);
41
- }, P = () => {
42
- o(a.EMPLOYEE_DEDUCTION_ADD);
41
+ }, b = (e) => {
42
+ o(c.EMPLOYEE_DEDUCTION_EDIT, e);
43
43
  }, O = () => {
44
- o(a.EMPLOYEE_DEDUCTION_DONE);
45
- }, { ..._ } = j({
44
+ o(c.EMPLOYEE_DEDUCTION_ADD);
45
+ }, _ = () => {
46
+ o(c.EMPLOYEE_DEDUCTION_DONE);
47
+ }, { ...x } = G({
46
48
  data: T,
47
49
  columns: [
48
50
  {
@@ -58,27 +60,27 @@ function R({ className: r, children: s, employeeId: D, dictionary: p }) {
58
60
  key: "amount",
59
61
  title: t("withheldColumn"),
60
62
  render: (e) => {
61
- const i = e.deductAsPercentage ? g(Number(e.amount)) : h(Number(e.amount));
62
- return e.recurring ? t("recurringAmount", { value: i }) : i;
63
+ const r = e.deductAsPercentage ? C(Number(e.amount)) : g(Number(e.amount));
64
+ return e.recurring ? t("recurringAmount", { value: r }) : r;
63
65
  }
64
66
  }
65
67
  ],
66
68
  itemMenu: (e) => /* @__PURE__ */ n(
67
69
  B,
68
70
  {
69
- isLoading: y,
71
+ isLoading: L,
70
72
  items: [
71
73
  {
72
74
  label: t("editCta"),
73
75
  onClick: () => {
74
- L(e);
76
+ b(e);
75
77
  },
76
78
  icon: /* @__PURE__ */ n(S, { "aria-hidden": !0 })
77
79
  },
78
80
  {
79
81
  label: t("deleteCta"),
80
82
  onClick: async () => {
81
- await b(e);
83
+ await P(e);
82
84
  },
83
85
  icon: /* @__PURE__ */ n(V, { "aria-hidden": !0 })
84
86
  }
@@ -86,18 +88,22 @@ function R({ className: r, children: s, employeeId: D, dictionary: p }) {
86
88
  }
87
89
  )
88
90
  });
89
- return /* @__PURE__ */ n("section", { className: r, children: /* @__PURE__ */ n(U, { flexDirection: "column", gap: 32, children: s || /* @__PURE__ */ l(A, { children: [
90
- /* @__PURE__ */ n(c.Heading, { as: "h2", children: t("pageTitle") }),
91
- /* @__PURE__ */ n(c.Text, { variant: "supporting", children: t("includeDeductionsDescriptionV2") }),
92
- /* @__PURE__ */ n(c.Text, { weight: "bold", size: "lg", children: t("includeDeductionsSubtitle") }),
93
- /* @__PURE__ */ n(G, { label: t("deductionsTableLabel"), ..._ }),
94
- /* @__PURE__ */ l(Y, { children: [
95
- /* @__PURE__ */ n(c.Button, { variant: "secondary", onClick: P, children: t("addDeductionCta") }),
96
- /* @__PURE__ */ n(c.Button, { onClick: O, children: t("continueCta") })
91
+ return /* @__PURE__ */ n("section", { className: i, children: /* @__PURE__ */ n(E, { flexDirection: "column", gap: 32, children: m || /* @__PURE__ */ s(M, { children: [
92
+ /* @__PURE__ */ s(E, { flexDirection: "column", gap: 2, children: [
93
+ /* @__PURE__ */ n(a.Heading, { as: "h2", children: t("pageTitle") }),
94
+ /* @__PURE__ */ n(a.Text, { variant: "supporting", children: t("includeDeductionsDescriptionV2") })
95
+ ] }),
96
+ /* @__PURE__ */ n(R, { label: t("deductionsTableLabel"), ...x }),
97
+ /* @__PURE__ */ s(Y, { children: [
98
+ /* @__PURE__ */ s(a.Button, { variant: "secondary", onClick: O, children: [
99
+ /* @__PURE__ */ n(j, {}),
100
+ t("addDeductionCta")
101
+ ] }),
102
+ /* @__PURE__ */ n(a.Button, { onClick: _, children: t("continueCta") })
97
103
  ] })
98
104
  ] }) }) });
99
105
  }
100
106
  export {
101
- ue as DeductionsList
107
+ de as DeductionsList
102
108
  };
103
109
  //# sourceMappingURL=DeductionsList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DeductionsList.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsList/DeductionsList.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useGarnishmentsListSuspense } from '@gusto/embedded-api/react-query/garnishmentsList'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { useDataView, DataView } from '@/components/Common'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport useNumberFormatter from '@/hooks/useNumberFormatter'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\ninterface DeductionsListProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n}\n\nexport function DeductionsList(props: DeductionsListProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ className, children, employeeId, dictionary }: DeductionsListProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n const formatCurrency = useNumberFormatter('currency')\n const formatPercent = useNumberFormatter('percent')\n\n useComponentDictionary('Employee.Deductions', dictionary)\n useI18n('Employee.Deductions')\n\n const { data } = useGarnishmentsListSuspense({ employeeId })\n const deductions = data.garnishmentList!\n const activeDeductions = deductions.filter(deduction => deduction.active)\n\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n\n const handleDelete = async (deduction: Garnishment) => {\n await baseSubmitHandler(deduction, async payload => {\n const { garnishment } = await updateDeduction({\n request: {\n garnishmentId: payload.uuid,\n requestBody: {\n ...payload,\n totalAmount: payload.totalAmount ?? undefined,\n active: false,\n version: payload.version as string,\n },\n },\n })\n\n // if soft deleted deduction was the last active, then return to empty view\n // else if any other active deductions return to list view\n const remainingActiveDeductions = deductions.filter(d => d.active)\n\n if (\n remainingActiveDeductions.length === 1 &&\n remainingActiveDeductions[0]?.uuid === garnishment?.uuid\n ) {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DELETED_EMPTY)\n } else {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DELETED, garnishment)\n }\n })\n }\n\n const handleEdit = (deduction: Garnishment) => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_EDIT, deduction)\n }\n\n const handleAdd = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_ADD)\n }\n\n const handleContinue = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DONE)\n }\n\n const { ...dataViewProps } = useDataView({\n data: activeDeductions,\n columns: [\n {\n key: 'description',\n title: t('nameColumn'),\n },\n {\n key: 'recurring',\n title: t('frequencyColumn'),\n render: deduction => {\n return deduction.recurring ? t('recurringText') : t('nonRecurringText')\n },\n },\n {\n key: 'amount',\n title: t('withheldColumn'),\n render: deduction => {\n const formattedAmount = deduction.deductAsPercentage\n ? formatPercent(Number(deduction.amount))\n : formatCurrency(Number(deduction.amount))\n return deduction.recurring\n ? t('recurringAmount', { value: formattedAmount })\n : formattedAmount\n },\n },\n ],\n itemMenu: deduction => {\n return (\n <HamburgerMenu\n isLoading={isPendingUpdate}\n items={[\n {\n label: t('editCta'),\n onClick: () => {\n handleEdit(deduction)\n },\n icon: <PencilSvg aria-hidden />,\n },\n {\n label: t('deleteCta'),\n onClick: async () => {\n await handleDelete(deduction)\n },\n icon: <TrashCanSvg aria-hidden />,\n },\n ]}\n />\n )\n },\n })\n\n return (\n <section className={className}>\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Components.Heading as=\"h2\">{t('pageTitle')}</Components.Heading>\n <Components.Text variant=\"supporting\">\n {t('includeDeductionsDescriptionV2')}\n </Components.Text>\n <Components.Text weight=\"bold\" size=\"lg\">\n {t('includeDeductionsSubtitle')}\n </Components.Text>\n <DataView label={t('deductionsTableLabel')} {...dataViewProps} />\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleAdd}>\n {t('addDeductionCta')}\n </Components.Button>\n <Components.Button onClick={handleContinue}>{t('continueCta')}</Components.Button>\n </ActionsLayout>\n </>\n )}\n </Flex>\n </section>\n )\n}\n"],"names":["DeductionsList","props","jsx","BaseComponent","Root","className","children","employeeId","dictionary","onEvent","baseSubmitHandler","useBase","useTranslation","Components","useComponentContext","formatCurrency","useNumberFormatter","formatPercent","useComponentDictionary","useI18n","data","useGarnishmentsListSuspense","deductions","activeDeductions","deduction","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","handleDelete","payload","garnishment","remainingActiveDeductions","d","componentEvents","handleEdit","handleAdd","handleContinue","dataViewProps","useDataView","formattedAmount","HamburgerMenu","PencilSvg","TrashCanSvg","Flex","jsxs","Fragment","DataView","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;AA0BO,SAASA,GAAeC,GAAqD;AAClF,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,SAASG,EAAK,EAAE,WAAAC,GAAW,UAAAC,GAAU,YAAAC,GAAY,YAAAC,KAAmC;AAClF,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,EAAA,GACjC,EAAE,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA,GACbC,IAAiBC,EAAmB,UAAU,GAC9CC,IAAgBD,EAAmB,SAAS;AAElD,EAAAE,EAAuB,uBAAuBV,CAAU,GACxDW,EAAQ,qBAAqB;AAE7B,QAAM,EAAE,MAAAC,EAAA,IAASC,EAA4B,EAAE,YAAAd,GAAY,GACrDe,IAAaF,EAAK,iBAClBG,IAAmBD,EAAW,OAAO,CAAAE,MAAaA,EAAU,MAAM,GAElE,EAAE,aAAaC,GAAiB,WAAWC,EAAA,IAC/CC,EAAA,GAEIC,IAAe,OAAOJ,MAA2B;AACrD,UAAMd,EAAkBc,GAAW,OAAMK,MAAW;AAClD,YAAM,EAAE,aAAAC,MAAgB,MAAML,EAAgB;AA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AE,aAAa,EAAA,CAAE;AAAA,IAAA,EAAA,CAChE;AAAA,EAAA,EAAA,CACF,GAEJ,GACF;AAEJ;"}
1
+ {"version":3,"file":"DeductionsList.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsList/DeductionsList.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useGarnishmentsListSuspense } from '@gusto/embedded-api/react-query/garnishmentsList'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { useDataView, DataView } from '@/components/Common'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport useNumberFormatter from '@/hooks/useNumberFormatter'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport PlusCircleIcon from '@/assets/icons/plus-circle.svg?react'\n\ninterface DeductionsListProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n}\n\nexport function DeductionsList(props: DeductionsListProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ className, children, employeeId, dictionary }: DeductionsListProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n const formatCurrency = useNumberFormatter('currency')\n const formatPercent = useNumberFormatter('percent')\n\n useComponentDictionary('Employee.Deductions', dictionary)\n useI18n('Employee.Deductions')\n\n const { data } = useGarnishmentsListSuspense({ employeeId })\n const deductions = data.garnishmentList!\n const activeDeductions = deductions.filter(deduction => deduction.active)\n\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n\n const handleDelete = async (deduction: Garnishment) => {\n await baseSubmitHandler(deduction, async payload => {\n const { garnishment } = await updateDeduction({\n request: {\n garnishmentId: payload.uuid,\n requestBody: {\n ...payload,\n totalAmount: payload.totalAmount ?? undefined,\n active: false,\n version: payload.version as string,\n },\n },\n })\n\n // if soft deleted deduction was the last active, then return to empty view\n // else if any other active deductions return to list view\n const remainingActiveDeductions = deductions.filter(d => d.active)\n\n if (\n remainingActiveDeductions.length === 1 &&\n remainingActiveDeductions[0]?.uuid === garnishment?.uuid\n ) {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DELETED_EMPTY)\n } else {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DELETED, garnishment)\n }\n })\n }\n\n const handleEdit = (deduction: Garnishment) => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_EDIT, deduction)\n }\n\n const handleAdd = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_ADD)\n }\n\n const handleContinue = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DONE)\n }\n\n const { ...dataViewProps } = useDataView({\n data: activeDeductions,\n columns: [\n {\n key: 'description',\n title: t('nameColumn'),\n },\n {\n key: 'recurring',\n title: t('frequencyColumn'),\n render: deduction => {\n return deduction.recurring ? t('recurringText') : t('nonRecurringText')\n },\n },\n {\n key: 'amount',\n title: t('withheldColumn'),\n render: deduction => {\n const formattedAmount = deduction.deductAsPercentage\n ? formatPercent(Number(deduction.amount))\n : formatCurrency(Number(deduction.amount))\n return deduction.recurring\n ? t('recurringAmount', { value: formattedAmount })\n : formattedAmount\n },\n },\n ],\n itemMenu: deduction => {\n return (\n <HamburgerMenu\n isLoading={isPendingUpdate}\n items={[\n {\n label: t('editCta'),\n onClick: () => {\n handleEdit(deduction)\n },\n icon: <PencilSvg aria-hidden />,\n },\n {\n label: t('deleteCta'),\n onClick: async () => {\n await handleDelete(deduction)\n },\n icon: <TrashCanSvg aria-hidden />,\n },\n ]}\n />\n )\n },\n })\n\n return (\n <section className={className}>\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Flex flexDirection=\"column\" gap={2}>\n <Components.Heading as=\"h2\">{t('pageTitle')}</Components.Heading>\n <Components.Text variant=\"supporting\">\n {t('includeDeductionsDescriptionV2')}\n </Components.Text>\n </Flex>\n\n <DataView label={t('deductionsTableLabel')} {...dataViewProps} />\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleAdd}>\n <PlusCircleIcon />\n {t('addDeductionCta')}\n </Components.Button>\n <Components.Button onClick={handleContinue}>{t('continueCta')}</Components.Button>\n </ActionsLayout>\n </>\n )}\n </Flex>\n </section>\n )\n}\n"],"names":["DeductionsList","props","jsx","BaseComponent","Root","className","children","employeeId","dictionary","onEvent","baseSubmitHandler","useBase","useTranslation","Components","useComponentContext","formatCurrency","useNumberFormatter","formatPercent","useComponentDictionary","useI18n","data","useGarnishmentsListSuspense","deductions","activeDeductions","deduction","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","handleDelete","payload","garnishment","remainingActiveDeductions","d","componentEvents","handleEdit","handleAdd","handleContinue","dataViewProps","useDataView","formattedAmount","HamburgerMenu","PencilSvg","TrashCanSvg","Flex","jsxs","Fragment","DataView","ActionsLayout","PlusCircleIcon"],"mappings":";;;;;;;;;;;;;;;;;;;AA2BO,SAASA,GAAeC,GAAqD;AAClF,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,SAASG,EAAK,EAAE,WAAAC,GAAW,UAAAC,GAAU,YAAAC,GAAY,YAAAC,KAAmC;AAClF,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAA,I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