@gusto/embedded-react-sdk 0.24.1 → 0.25.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 (315) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/dist/assets/icons/slash-circle.svg.js +10 -0
  3. package/dist/assets/icons/slash-circle.svg.js.map +1 -0
  4. package/dist/components/Base/Base.d.ts +1 -1
  5. package/dist/components/Base/Base.js.map +1 -1
  6. package/dist/components/Common/Fields/FileInputField/FileInputField.d.ts +5 -0
  7. package/dist/components/Common/Fields/FileInputField/FileInputField.js +34 -0
  8. package/dist/components/Common/Fields/FileInputField/FileInputField.js.map +1 -0
  9. package/dist/components/Common/Fields/FileInputField/index.d.ts +2 -0
  10. package/dist/components/Common/PaginationControl/PaginationControl.js +41 -40
  11. package/dist/components/Common/PaginationControl/PaginationControl.js.map +1 -1
  12. package/dist/components/Common/PaginationControl/PaginationControlTypes.d.ts +1 -0
  13. package/dist/components/Common/SignatureForm/SignatureForm.js +12 -11
  14. package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
  15. package/dist/components/Common/SignatureForm/SignatureFormActions.js +1 -1
  16. package/dist/components/Common/SignatureForm/SignatureFormFields.js +1 -1
  17. package/dist/components/Common/UI/FileInput/FileInput.d.ts +2 -0
  18. package/dist/components/Common/UI/FileInput/FileInput.js +151 -0
  19. package/dist/components/Common/UI/FileInput/FileInput.js.map +1 -0
  20. package/dist/components/Common/UI/FileInput/FileInput.module.scss.js +34 -0
  21. package/dist/components/Common/UI/FileInput/FileInput.module.scss.js.map +1 -0
  22. package/dist/components/Common/UI/FileInput/FileInputTypes.d.ts +45 -0
  23. package/dist/components/Common/UI/FileInput/FileInputTypes.js +8 -0
  24. package/dist/components/Common/UI/FileInput/FileInputTypes.js.map +1 -0
  25. package/dist/components/Common/UI/FileInput/index.d.ts +4 -0
  26. package/dist/components/Common/UI/TextInput/TextInput.js +27 -23
  27. package/dist/components/Common/UI/TextInput/TextInput.js.map +1 -1
  28. package/dist/components/Common/UI/TextInput/TextInputTypes.d.ts +1 -1
  29. package/dist/components/Common/UI/TextInput/TextInputTypes.js.map +1 -1
  30. package/dist/components/Company/AssignSignatory/AssignSignatory.js +1 -1
  31. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +1 -1
  32. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +4 -3
  33. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  34. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +1 -1
  35. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +4 -3
  36. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  37. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +6 -5
  38. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  39. package/dist/components/Company/BankAccount/BankAccountForm/Form.js +5 -4
  40. package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
  41. package/dist/components/Company/BankAccount/BankAccountForm/context.js +4 -3
  42. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  43. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +5 -4
  44. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
  45. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +2 -2
  46. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +4 -3
  47. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  48. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +2 -2
  49. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +4 -3
  50. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  51. package/dist/components/Company/FederalTaxes/FederalTaxes.js +2 -2
  52. package/dist/components/Company/FederalTaxes/Form.js +3 -2
  53. package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
  54. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +9 -8
  55. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  56. package/dist/components/Company/Industry/Context.js +7 -6
  57. package/dist/components/Company/Industry/Context.js.map +1 -1
  58. package/dist/components/Company/Locations/LocationForm/LocationForm.js +2 -2
  59. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +4 -3
  60. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  61. package/dist/components/Company/Locations/LocationsList/List.js +35 -33
  62. package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
  63. package/dist/components/Company/Locations/LocationsList/LocationsList.js +30 -29
  64. package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
  65. package/dist/components/Company/Locations/LocationsList/useLocationsList.d.ts +1 -0
  66. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +4 -3
  67. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  68. package/dist/components/Company/OnboardingOverview/Completed.js +3 -2
  69. package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
  70. package/dist/components/Company/OnboardingOverview/MissingRequirements.js +3 -2
  71. package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
  72. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +2 -2
  73. package/dist/components/Company/OnboardingOverview/context.js +4 -3
  74. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  75. package/dist/components/Company/PaySchedule/PaySchedule.js +2 -2
  76. package/dist/components/Company/PaySchedule/_parts/Head.js +9 -8
  77. package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
  78. package/dist/components/Company/PaySchedule/_parts/List.js +12 -11
  79. package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
  80. package/dist/components/Company/PaySchedule/usePaySchedule.js +6 -5
  81. package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
  82. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +4 -3
  83. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  84. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +4 -3
  85. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  86. package/dist/components/Contractor/Address/Address.js +2 -2
  87. package/dist/components/Contractor/Address/useAddress.js +6 -5
  88. package/dist/components/Contractor/Address/useAddress.js.map +1 -1
  89. package/dist/components/Contractor/ContractorList/index.js +31 -30
  90. package/dist/components/Contractor/ContractorList/index.js.map +1 -1
  91. package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js +61 -59
  92. package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js.map +1 -1
  93. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js +34 -31
  94. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js.map +1 -1
  95. package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js +29 -10
  96. package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js.map +1 -1
  97. package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.d.ts +3 -1
  98. package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js +33 -31
  99. package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js.map +1 -1
  100. package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.d.ts +2 -0
  101. package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js +25 -19
  102. package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js.map +1 -1
  103. package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.d.ts +1 -0
  104. package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js +86 -56
  105. package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js.map +1 -1
  106. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.d.ts +1 -2
  107. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.js +46 -21
  108. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.js.map +1 -1
  109. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.d.ts +6 -15
  110. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js +116 -99
  111. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js.map +1 -1
  112. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.module.scss.js +8 -0
  113. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.module.scss.js.map +1 -0
  114. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.d.ts +8 -0
  115. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.js +51 -0
  116. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.js.map +1 -0
  117. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.d.ts +11 -0
  118. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js +157 -0
  119. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js.map +1 -0
  120. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.module.scss.js +22 -0
  121. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.module.scss.js.map +1 -0
  122. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +46 -48
  123. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -1
  124. package/dist/components/Contractor/Profile/useContractorProfile.js +3 -2
  125. package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
  126. package/dist/components/Contractor/Submit/Submit.js +1 -1
  127. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +4 -3
  128. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
  129. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +4 -3
  130. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
  131. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +4 -3
  132. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +1 -1
  133. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +1 -1
  134. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +1 -1
  135. package/dist/components/Employee/DocumentSigner/DocumentList/List.js +3 -2
  136. package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
  137. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +4 -3
  138. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  139. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +1 -1
  140. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +4 -3
  141. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  142. package/dist/components/Employee/EmployeeList/EmployeeList.js +58 -56
  143. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  144. package/dist/components/Employee/EmployeeList/Head.js +3 -2
  145. package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
  146. package/dist/components/Employee/EmployeeList/List.js +34 -32
  147. package/dist/components/Employee/EmployeeList/List.js.map +1 -1
  148. package/dist/components/Employee/EmployeeList/useEmployeeList.d.ts +1 -0
  149. package/dist/components/Employee/EmployeeList/useEmployeeList.js +4 -3
  150. package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
  151. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +4 -3
  152. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
  153. package/dist/components/Employee/Landing/Landing.js +8 -8
  154. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +7 -7
  155. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +6 -5
  156. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
  157. package/dist/components/Employee/Profile/useProfile.js +4 -3
  158. package/dist/components/Employee/Profile/useProfile.js.map +1 -1
  159. package/dist/components/Employee/StateTaxes/useStateTaxes.js +4 -3
  160. package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
  161. package/dist/components/Employee/Taxes/useTaxes.js +4 -3
  162. package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
  163. package/dist/components/Flow/Flow.js +3 -2
  164. package/dist/components/Flow/Flow.js.map +1 -1
  165. package/dist/components/Payroll/InformationRequests/InformationRequestForm/InformationRequestForm.d.ts +15 -0
  166. package/dist/components/Payroll/InformationRequests/InformationRequestForm/InformationRequestForm.js +142 -0
  167. package/dist/components/Payroll/InformationRequests/InformationRequestForm/InformationRequestForm.js.map +1 -0
  168. package/dist/components/Payroll/InformationRequests/InformationRequestForm/InformationRequestForm.module.scss.js +18 -0
  169. package/dist/components/Payroll/InformationRequests/InformationRequestForm/InformationRequestForm.module.scss.js.map +1 -0
  170. package/dist/components/Payroll/InformationRequests/InformationRequestForm/index.d.ts +2 -0
  171. package/dist/components/Payroll/InformationRequests/InformationRequestList/InformationRequestList.d.ts +7 -0
  172. package/dist/components/Payroll/InformationRequests/InformationRequestList/InformationRequestList.js +88 -0
  173. package/dist/components/Payroll/InformationRequests/InformationRequestList/InformationRequestList.js.map +1 -0
  174. package/dist/components/Payroll/InformationRequests/InformationRequestList/index.d.ts +2 -0
  175. package/dist/components/Payroll/InformationRequests/InformationRequests.d.ts +6 -0
  176. package/dist/components/Payroll/InformationRequests/InformationRequests.js +55 -0
  177. package/dist/components/Payroll/InformationRequests/InformationRequests.js.map +1 -0
  178. package/dist/components/Payroll/InformationRequests/InformationRequestsComponents.d.ts +19 -0
  179. package/dist/components/Payroll/InformationRequests/InformationRequestsComponents.js +20 -0
  180. package/dist/components/Payroll/InformationRequests/InformationRequestsComponents.js.map +1 -0
  181. package/dist/components/Payroll/InformationRequests/index.d.ts +3 -0
  182. package/dist/components/Payroll/InformationRequests/informationRequestsStateMachine.d.ts +13 -0
  183. package/dist/components/Payroll/InformationRequests/informationRequestsStateMachine.js +47 -0
  184. package/dist/components/Payroll/InformationRequests/informationRequestsStateMachine.js.map +1 -0
  185. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js +7 -6
  186. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js.map +1 -1
  187. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +3 -2
  188. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js.map +1 -1
  189. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +116 -130
  190. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
  191. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +5 -2
  192. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +107 -99
  193. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
  194. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.module.scss.js +2 -4
  195. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.module.scss.js.map +1 -1
  196. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.d.ts +21 -0
  197. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +105 -0
  198. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -0
  199. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +41 -37
  200. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
  201. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.d.ts +5 -4
  202. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +151 -145
  203. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
  204. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +14 -12
  205. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
  206. package/dist/components/Payroll/PayrollFlow/payrollStateMachine.d.ts +2 -0
  207. package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js +174 -106
  208. package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js.map +1 -1
  209. package/dist/components/Payroll/PayrollHistory/PayrollHistory.js +28 -28
  210. package/dist/components/Payroll/PayrollHistory/PayrollHistory.js.map +1 -1
  211. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.d.ts +2 -2
  212. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +84 -102
  213. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
  214. package/dist/components/Payroll/PayrollLanding/PayrollLanding.js +24 -20
  215. package/dist/components/Payroll/PayrollLanding/PayrollLanding.js.map +1 -1
  216. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.d.ts +2 -0
  217. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js +51 -46
  218. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js.map +1 -1
  219. package/dist/components/Payroll/PayrollLanding/payrollLandingStateMachine.d.ts +2 -0
  220. package/dist/components/Payroll/PayrollLanding/payrollLandingStateMachine.js +111 -45
  221. package/dist/components/Payroll/PayrollLanding/payrollLandingStateMachine.js.map +1 -1
  222. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +137 -125
  223. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
  224. package/dist/components/Payroll/PayrollList/PayrollListPresentation.module.scss.js +8 -4
  225. package/dist/components/Payroll/PayrollList/PayrollListPresentation.module.scss.js.map +1 -1
  226. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +117 -110
  227. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
  228. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.d.ts +4 -2
  229. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +282 -278
  230. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
  231. package/dist/components/Payroll/PayrollOverview/PayrollOverviewTypes.d.ts +6 -0
  232. package/dist/components/Payroll/PayrollOverview/PayrollOverviewTypes.js +5 -0
  233. package/dist/components/Payroll/PayrollOverview/PayrollOverviewTypes.js.map +1 -0
  234. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js +3 -2
  235. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js.map +1 -1
  236. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +3 -2
  237. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
  238. package/dist/components/Payroll/RecoveryCases/RecoveryCases.d.ts +6 -0
  239. package/dist/components/Payroll/RecoveryCases/RecoveryCases.js +55 -0
  240. package/dist/components/Payroll/RecoveryCases/RecoveryCases.js.map +1 -0
  241. package/dist/components/Payroll/RecoveryCases/RecoveryCasesComponents.d.ts +19 -0
  242. package/dist/components/Payroll/RecoveryCases/RecoveryCasesComponents.js +19 -0
  243. package/dist/components/Payroll/RecoveryCases/RecoveryCasesComponents.js.map +1 -0
  244. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.d.ts +7 -0
  245. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js +73 -0
  246. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js.map +1 -0
  247. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.module.scss.js +10 -0
  248. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.module.scss.js.map +1 -0
  249. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/index.d.ts +2 -0
  250. package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.d.ts +14 -0
  251. package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js +46 -0
  252. package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js.map +1 -0
  253. package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/index.d.ts +2 -0
  254. package/dist/components/Payroll/RecoveryCases/index.d.ts +3 -0
  255. package/dist/components/Payroll/RecoveryCases/recoveryCasesStateMachine.d.ts +13 -0
  256. package/dist/components/Payroll/RecoveryCases/recoveryCasesStateMachine.js +47 -0
  257. package/dist/components/Payroll/RecoveryCases/recoveryCasesStateMachine.js.map +1 -0
  258. package/dist/components/Payroll/helpers.d.ts +12 -0
  259. package/dist/components/Payroll/helpers.js +129 -117
  260. package/dist/components/Payroll/helpers.js.map +1 -1
  261. package/dist/components/Payroll/index.d.ts +2 -0
  262. package/dist/components/Payroll/index.js +18 -14
  263. package/dist/components/Payroll/index.js.map +1 -1
  264. package/dist/components/Payroll/usePreparedPayrollData.d.ts +4 -1
  265. package/dist/components/Payroll/usePreparedPayrollData.js +43 -31
  266. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  267. package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js +27 -25
  268. package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js.map +1 -1
  269. package/dist/contexts/ComponentAdapter/componentAdapterTypes.d.ts +1 -0
  270. package/dist/contexts/ComponentAdapter/createComponentsWithDefaults.d.ts +5 -0
  271. package/dist/contexts/ComponentAdapter/createComponentsWithDefaults.js +17 -15
  272. package/dist/contexts/ComponentAdapter/createComponentsWithDefaults.js.map +1 -1
  273. package/dist/contexts/ComponentAdapter/useComponentContext.d.ts +2 -0
  274. package/dist/contexts/ComponentAdapter/useComponentContext.js +3 -3
  275. package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
  276. package/dist/helpers/dateFormatting.d.ts +1 -0
  277. package/dist/helpers/dateFormatting.js +1 -0
  278. package/dist/helpers/dateFormatting.js.map +1 -1
  279. package/dist/helpers/formattedStrings.d.ts +1 -0
  280. package/dist/helpers/formattedStrings.js +23 -18
  281. package/dist/helpers/formattedStrings.js.map +1 -1
  282. package/dist/helpers/responsive.js +1 -1
  283. package/dist/helpers/responsive.js.map +1 -1
  284. package/dist/i18n/I18n.js +3 -3
  285. package/dist/i18n/I18n.js.map +1 -1
  286. package/dist/i18n/en/Contractor.Payments.CreatePayment.json.js +36 -32
  287. package/dist/i18n/en/Contractor.Payments.CreatePayment.json.js.map +1 -1
  288. package/dist/i18n/en/Contractor.Payments.PaymentHistory.json.js +11 -11
  289. package/dist/i18n/en/Contractor.Payments.PaymentStatement.json.js +28 -0
  290. package/dist/i18n/en/Contractor.Payments.PaymentStatement.json.js.map +1 -0
  291. package/dist/i18n/en/Contractor.Payments.PaymentsList.json.js +14 -14
  292. package/dist/i18n/en/Payroll.InformationRequestForm.json.js +18 -0
  293. package/dist/i18n/en/Payroll.InformationRequestForm.json.js.map +1 -0
  294. package/dist/i18n/en/Payroll.InformationRequestList.json.js +18 -0
  295. package/dist/i18n/en/Payroll.InformationRequestList.json.js.map +1 -0
  296. package/dist/i18n/en/Payroll.PayrollConfiguration.json.js +27 -21
  297. package/dist/i18n/en/Payroll.PayrollConfiguration.json.js.map +1 -1
  298. package/dist/i18n/en/Payroll.PayrollHistory.json.js +6 -6
  299. package/dist/i18n/en/Payroll.PayrollLanding.json.js +5 -3
  300. package/dist/i18n/en/Payroll.PayrollLanding.json.js.map +1 -1
  301. package/dist/i18n/en/Payroll.PayrollOverview.json.js +32 -28
  302. package/dist/i18n/en/Payroll.PayrollOverview.json.js.map +1 -1
  303. package/dist/i18n/en/Payroll.RecoveryCasesList.json.js +14 -0
  304. package/dist/i18n/en/Payroll.RecoveryCasesList.json.js.map +1 -0
  305. package/dist/i18n/en/Payroll.RecoveryCasesResubmit.json.js +8 -0
  306. package/dist/i18n/en/Payroll.RecoveryCasesResubmit.json.js.map +1 -0
  307. package/dist/i18n/en/common.json.d.ts +5 -0
  308. package/dist/i18n/en/common.json.js +4 -2
  309. package/dist/i18n/en/common.json.js.map +1 -1
  310. package/dist/shared/constants.d.ts +24 -0
  311. package/dist/shared/constants.js +70 -54
  312. package/dist/shared/constants.js.map +1 -1
  313. package/dist/style.css +1 -1
  314. package/dist/types/i18next.d.ts +119 -3
  315. package/package.json +31 -20
@@ -1 +1 @@
1
- {"version":3,"file":"ChildSupportForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/ChildSupportForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { useEffect, useMemo } from 'react'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { PaymentPeriod } from '@gusto/embedded-api/models/components/garnishmentchildsupport'\nimport type { GarnishmentType } from '@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { type Agencies } from '@gusto/embedded-api/models/components/childsupportdata'\nimport styles from './ChildSupportForm.module.scss'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { NumberInputField, TextInputField, SelectField } from '@/components/Common'\nimport { type CommonComponentInterface, useBase } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\n\nconst MINIMUM_PAY_PERIOD_AMOUNT = 0\nconst MINIMUM_PAYCHECK_PERCENTAGE = 0\nconst MAXIMUM_PAYCHECK_PERCENTAGE = 100\n\nconst ChildSupportPaymentPeriodSchema = z.nativeEnum(PaymentPeriod)\nconst ChildSupportSchema = z.object({\n state: z.string(),\n fipsCode: z.string(),\n caseNumber: z.string().nullable(),\n orderNumber: z.string().nullable(),\n remittanceNumber: z.string().nullable(),\n amount: z.number().min(0).transform(String),\n payPeriodMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n paymentPeriod: ChildSupportPaymentPeriodSchema,\n})\n\nexport type ChildSupportInputs = z.input<typeof ChildSupportSchema>\nexport type ChildSupportPayload = z.output<typeof ChildSupportSchema>\n\ninterface ChildSupportFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n handleStateAgencySelect: (stateAgency: string) => void\n stateAgencies: { label: string; value: string }[]\n counties: { label: string; value: string }[]\n selectedAgency?: Agencies\n}\n\nfunction ChildSupportForm({\n deduction,\n handleStateAgencySelect,\n stateAgencies,\n counties,\n employeeId,\n selectedAgency,\n}: ChildSupportFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n const ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER = {\n case_number: {\n name: 'caseNumber',\n description: t('caseNumberDescription'),\n },\n order_number: {\n name: 'orderNumber',\n description: t('orderNumberDescription'),\n },\n remittance_number: {\n name: 'remittanceNumber',\n description: t('remittanceNumberDescription'),\n },\n }\n const requiredSelectedAgencyAttributes =\n selectedAgency?.requiredAttributes?.map(attr => {\n return {\n name: ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER[attr.key!].name,\n label: attr.label as string,\n description: ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER[attr.key!].description,\n }\n }) || []\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n const isPending = isPendingCreate || isPendingUpdate\n\n const defaultChildSupportValues: ChildSupportInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n payPeriodMaximum: deduction?.payPeriodMaximum ? Number(deduction.payPeriodMaximum) : null,\n state: deduction?.childSupport?.state || '',\n fipsCode: deduction?.childSupport?.fipsCode || '',\n caseNumber: deduction?.childSupport?.caseNumber || null,\n orderNumber: deduction?.childSupport?.orderNumber || null,\n remittanceNumber: deduction?.childSupport?.remittanceNumber || null,\n paymentPeriod: deduction?.childSupport?.paymentPeriod as PaymentPeriod,\n }\n }, [deduction])\n\n const childSupportFormMethods = useForm<ChildSupportInputs, unknown, ChildSupportPayload>({\n resolver: zodResolver(ChildSupportSchema),\n defaultValues: defaultChildSupportValues,\n })\n const { reset: resetChildSupportForm, setValue, control } = childSupportFormMethods\n const watchedStateAgency = useWatch({ control, name: 'state' })\n\n useEffect(() => {\n resetChildSupportForm(defaultChildSupportValues)\n }, [deduction, defaultChildSupportValues, resetChildSupportForm])\n\n // if in edit mode and user elects to change state agency, reset the required attribute values\n // as new selected agency might require different payload inputs, e.g. OH requires case number + order number\n useEffect(() => {\n setValue('caseNumber', null)\n setValue('orderNumber', null)\n setValue('remittanceNumber', null)\n }, [watchedStateAgency, setValue])\n\n const onChildSupportSubmit: SubmitHandler<ChildSupportPayload> = async data => {\n const childSupport = {\n state: data.state,\n paymentPeriod: data.paymentPeriod,\n fipsCode: data.fipsCode,\n caseNumber: data.caseNumber,\n orderNumber: data.orderNumber,\n remittanceNumber: data.remittanceNumber,\n }\n\n await baseSubmitHandler(data, async payload => {\n const requestBody = {\n active: true,\n amount: payload.amount,\n description: `Child Support - ${childSupport.caseNumber}`, // child support description follows prefix type + case number convention\n courtOrdered: true,\n garnishmentType: 'child_support' as GarnishmentType,\n times: null,\n deductAsPercentage: true, // child support must always deduct as percentage up to a pay period maximum limit and is recurring until cancelled\n payPeriodMaximum: payload.payPeriodMaximum,\n recurring: true,\n childSupport,\n }\n\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId,\n requestBody,\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...requestBody,\n version: deduction.version as string,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const isManualPaymentRequired = selectedAgency?.manualPaymentRequired\n\n return (\n <FormProvider {...childSupportFormMethods}>\n <Form onSubmit={childSupportFormMethods.handleSubmit(onChildSupportSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n <Components.Heading as=\"h3\">{t('childSupportTitle')}</Components.Heading>\n <SelectField\n name=\"state\"\n label={t('agency')}\n description={t('agencyDescription')}\n options={stateAgencies}\n onChange={handleStateAgencySelect}\n isRequired\n />\n {watchedStateAgency && (\n <>\n <SelectField\n name=\"fipsCode\"\n label={t('county')}\n description={t('countyDescription')}\n options={counties}\n isRequired\n />\n {/* render required inputs for respective agency, e.g. OH requires case number + order number */}\n {requiredSelectedAgencyAttributes.map(({ name, label, description }) => (\n <TextInputField\n key={name}\n name={name}\n label={label}\n description={description}\n isRequired\n />\n ))}\n <NumberInputField\n name=\"payPeriodMaximum\"\n label={t('totalAmountWithheld')}\n description={t('totalAmountWithheldDescription')}\n min={MINIMUM_PAY_PERIOD_AMOUNT}\n adornmentStart=\"$\"\n isRequired\n />\n <NumberInputField\n name=\"amount\"\n label={t('maxPaycheckPercentage')}\n description={t('maxPaycheckPercentageDescription')}\n isRequired\n min={MINIMUM_PAYCHECK_PERCENTAGE}\n max={MAXIMUM_PAYCHECK_PERCENTAGE}\n adornmentEnd=\"%\"\n />\n <SelectField\n name=\"paymentPeriod\"\n label={t('per')}\n description={t('perDescription')}\n options={[\n {\n label: t('everyWeek'),\n value: 'Every week',\n },\n {\n label: t('everyOtherWeek'),\n value: 'Every other week',\n },\n {\n label: t('twicePerMonth'),\n value: 'Twice per month',\n },\n {\n label: t('monthly'),\n value: 'Monthly',\n },\n ]}\n isRequired\n />\n {isManualPaymentRequired && (\n <section className={styles.manualPaymentReminderBanner}>\n <Components.Text weight=\"bold\">{t('manualPaymentRequired')}</Components.Text>\n <Components.Text>{t('manualPaymentRequiredDescription')}</Components.Text>\n </section>\n )}\n <ActionsLayout>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('saveCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n )}\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n\nexport default ChildSupportForm\n"],"names":["MINIMUM_PAY_PERIOD_AMOUNT","MINIMUM_PAYCHECK_PERCENTAGE","MAXIMUM_PAYCHECK_PERCENTAGE","ChildSupportPaymentPeriodSchema","z","PaymentPeriod","ChildSupportSchema","val","ChildSupportForm","deduction","handleStateAgencySelect","stateAgencies","counties","employeeId","selectedAgency","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER","requiredSelectedAgencyAttributes","attr","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultChildSupportValues","useMemo","childSupportFormMethods","useForm","zodResolver","resetChildSupportForm","setValue","control","watchedStateAgency","useWatch","useEffect","onChildSupportSubmit","data","childSupport","payload","requestBody","updateDeductionResponse","componentEvents","createDeductionResponse","isManualPaymentRequired","FormProvider","jsx","Form","jsxs","Flex","SelectField","Fragment","name","label","description","TextInputField","NumberInputField","styles","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAMA,KAA4B,GAC5BC,KAA8B,GAC9BC,KAA8B,KAE9BC,KAAkCC,EAAE,WAAWC,CAAa,GAC5DC,KAAqBF,EAAE,OAAO;AAAA,EAClC,OAAOA,EAAE,OAAA;AAAA,EACT,UAAUA,EAAE,OAAA;AAAA,EACZ,YAAYA,EAAE,OAA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A,YAAA;AAAA,UACT;AAAA,UAEF,YAAU;AAAA,QAAA;AAAA,MAAA;AAAA,MAEXiC,KACC,gBAAAI,EAAC,WAAA,EAAQ,WAAWS,EAAO,6BACzB,UAAA;AAAA,QAAA,gBAAAX,EAACjC,EAAW,MAAX,EAAgB,QAAO,QAAQ,UAAAF,EAAE,uBAAuB,GAAE;AAAA,0BAC1DE,EAAW,MAAX,EAAiB,UAAAF,EAAE,kCAAkC,EAAA,CAAE;AAAA,MAAA,GAC1D;AAAA,MAEF,gBAAAmC,EAACY,GAAA,EACC,UAAA,gBAAAZ,EAACjC,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWW,GACzC,UAAAb,EAAE,SAAS,GACd,EAAA,CACF;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,EAAA,CAEJ,GACF,GACF;AAEJ;"}
1
+ {"version":3,"file":"ChildSupportForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/ChildSupportForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { useEffect, useMemo } from 'react'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { PaymentPeriod } from '@gusto/embedded-api/models/components/garnishmentchildsupport'\nimport type { GarnishmentType } from '@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { type Agencies } from '@gusto/embedded-api/models/components/childsupportdata'\nimport styles from './ChildSupportForm.module.scss'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { NumberInputField, TextInputField, SelectField } from '@/components/Common'\nimport { type CommonComponentInterface, useBase } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\n\nconst MINIMUM_PAY_PERIOD_AMOUNT = 0\nconst MINIMUM_PAYCHECK_PERCENTAGE = 0\nconst MAXIMUM_PAYCHECK_PERCENTAGE = 100\n\nconst ChildSupportPaymentPeriodSchema = z.nativeEnum(PaymentPeriod)\nconst ChildSupportSchema = z.object({\n state: z.string(),\n fipsCode: z.string(),\n caseNumber: z.string().nullable(),\n orderNumber: z.string().nullable(),\n remittanceNumber: z.string().nullable(),\n amount: z.number().min(0).transform(String),\n payPeriodMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n paymentPeriod: ChildSupportPaymentPeriodSchema,\n})\n\nexport type ChildSupportInputs = z.input<typeof ChildSupportSchema>\nexport type ChildSupportPayload = z.output<typeof ChildSupportSchema>\n\ninterface ChildSupportFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n handleStateAgencySelect: (stateAgency: string) => void\n stateAgencies: { label: string; value: string }[]\n counties: { label: string; value: string }[]\n selectedAgency?: Agencies\n}\n\nfunction ChildSupportForm({\n deduction,\n handleStateAgencySelect,\n stateAgencies,\n counties,\n employeeId,\n selectedAgency,\n}: ChildSupportFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n const ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER = {\n case_number: {\n name: 'caseNumber',\n description: t('caseNumberDescription'),\n },\n order_number: {\n name: 'orderNumber',\n description: t('orderNumberDescription'),\n },\n remittance_number: {\n name: 'remittanceNumber',\n description: t('remittanceNumberDescription'),\n },\n }\n const requiredSelectedAgencyAttributes =\n selectedAgency?.requiredAttributes?.map(attr => {\n return {\n name: ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER[attr.key!].name,\n label: attr.label as string,\n description: ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER[attr.key!].description,\n }\n }) || []\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n const isPending = isPendingCreate || isPendingUpdate\n\n const defaultChildSupportValues: ChildSupportInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n payPeriodMaximum: deduction?.payPeriodMaximum ? Number(deduction.payPeriodMaximum) : null,\n state: deduction?.childSupport?.state || '',\n fipsCode: deduction?.childSupport?.fipsCode || '',\n caseNumber: deduction?.childSupport?.caseNumber || null,\n orderNumber: deduction?.childSupport?.orderNumber || null,\n remittanceNumber: deduction?.childSupport?.remittanceNumber || null,\n paymentPeriod: deduction?.childSupport?.paymentPeriod as PaymentPeriod,\n }\n }, [deduction])\n\n const childSupportFormMethods = useForm<ChildSupportInputs, unknown, ChildSupportPayload>({\n resolver: zodResolver(ChildSupportSchema),\n defaultValues: defaultChildSupportValues,\n })\n const { reset: resetChildSupportForm, setValue, control } = childSupportFormMethods\n const watchedStateAgency = useWatch({ control, name: 'state' })\n\n useEffect(() => {\n resetChildSupportForm(defaultChildSupportValues)\n }, [deduction, defaultChildSupportValues, resetChildSupportForm])\n\n // if in edit mode and user elects to change state agency, reset the required attribute values\n // as new selected agency might require different payload inputs, e.g. OH requires case number + order number\n useEffect(() => {\n setValue('caseNumber', null)\n setValue('orderNumber', null)\n setValue('remittanceNumber', null)\n }, [watchedStateAgency, setValue])\n\n const onChildSupportSubmit: SubmitHandler<ChildSupportPayload> = async data => {\n const childSupport = {\n state: data.state,\n paymentPeriod: data.paymentPeriod,\n fipsCode: data.fipsCode,\n caseNumber: data.caseNumber,\n orderNumber: data.orderNumber,\n remittanceNumber: data.remittanceNumber,\n }\n\n await baseSubmitHandler(data, async payload => {\n const requestBody = {\n active: true,\n amount: payload.amount,\n description: `Child Support - ${childSupport.caseNumber}`, // child support description follows prefix type + case number convention\n courtOrdered: true,\n garnishmentType: 'child_support' as GarnishmentType,\n times: null,\n deductAsPercentage: true, // child support must always deduct as percentage up to a pay period maximum limit and is recurring until cancelled\n payPeriodMaximum: payload.payPeriodMaximum,\n recurring: true,\n childSupport,\n }\n\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId,\n requestBody,\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...requestBody,\n version: deduction.version as string,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const isManualPaymentRequired = selectedAgency?.manualPaymentRequired\n\n return (\n <FormProvider {...childSupportFormMethods}>\n <Form onSubmit={childSupportFormMethods.handleSubmit(onChildSupportSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n <Components.Heading as=\"h3\">{t('childSupportTitle')}</Components.Heading>\n <SelectField\n name=\"state\"\n label={t('agency')}\n description={t('agencyDescription')}\n options={stateAgencies}\n onChange={handleStateAgencySelect}\n isRequired\n />\n {watchedStateAgency && (\n <>\n <SelectField\n name=\"fipsCode\"\n label={t('county')}\n description={t('countyDescription')}\n options={counties}\n isRequired\n />\n {/* render required inputs for respective agency, e.g. OH requires case number + order number */}\n {requiredSelectedAgencyAttributes.map(({ name, label, description }) => (\n <TextInputField\n key={name}\n name={name}\n label={label}\n description={description}\n isRequired\n />\n ))}\n <NumberInputField\n name=\"payPeriodMaximum\"\n label={t('totalAmountWithheld')}\n description={t('totalAmountWithheldDescription')}\n min={MINIMUM_PAY_PERIOD_AMOUNT}\n adornmentStart=\"$\"\n isRequired\n />\n <NumberInputField\n name=\"amount\"\n label={t('maxPaycheckPercentage')}\n description={t('maxPaycheckPercentageDescription')}\n isRequired\n min={MINIMUM_PAYCHECK_PERCENTAGE}\n max={MAXIMUM_PAYCHECK_PERCENTAGE}\n adornmentEnd=\"%\"\n />\n <SelectField\n name=\"paymentPeriod\"\n label={t('per')}\n description={t('perDescription')}\n options={[\n {\n label: t('everyWeek'),\n value: 'Every week',\n },\n {\n label: t('everyOtherWeek'),\n value: 'Every other week',\n },\n {\n label: t('twicePerMonth'),\n value: 'Twice per month',\n },\n {\n label: t('monthly'),\n value: 'Monthly',\n },\n ]}\n isRequired\n />\n {isManualPaymentRequired && (\n <section className={styles.manualPaymentReminderBanner}>\n <Components.Text weight=\"bold\">{t('manualPaymentRequired')}</Components.Text>\n <Components.Text>{t('manualPaymentRequiredDescription')}</Components.Text>\n </section>\n )}\n <ActionsLayout>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('saveCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n )}\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n\nexport default ChildSupportForm\n"],"names":["MINIMUM_PAY_PERIOD_AMOUNT","MINIMUM_PAYCHECK_PERCENTAGE","MAXIMUM_PAYCHECK_PERCENTAGE","ChildSupportPaymentPeriodSchema","z","PaymentPeriod","ChildSupportSchema","val","ChildSupportForm","deduction","handleStateAgencySelect","stateAgencies","counties","employeeId","selectedAgency","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER","requiredSelectedAgencyAttributes","attr","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultChildSupportValues","useMemo","childSupportFormMethods","useForm","zodResolver","resetChildSupportForm","setValue","control","watchedStateAgency","useWatch","useEffect","onChildSupportSubmit","data","childSupport","payload","requestBody","updateDeductionResponse","componentEvents","createDeductionResponse","isManualPaymentRequired","FormProvider","jsx","Form","jsxs","Flex","SelectField","Fragment","name","label","description","TextInputField","NumberInputField","styles","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAoB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A,YAET;AAAA,cACE,OAAOA,EAAE,gBAAgB;AAAA,cACzB,OAAO;AAAA,YAAA;AAAA,YAET;AAAA,cACE,OAAOA,EAAE,eAAe;AAAA,cACxB,OAAO;AAAA,YAAA;AAAA,YAET;AAAA,cACE,OAAOA,EAAE,SAAS;AAAA,cAClB,OAAO;AAAA,YAAA;AAAA,UACT;AAAA,UAEF,YAAU;AAAA,QAAA;AAAA,MAAA;AAAA,MAEXiC,KACC,gBAAAI,EAAC,WAAA,EAAQ,WAAWS,EAAO,6BACzB,UAAA;AAAA,QAAA,gBAAAX,EAACjC,EAAW,MAAX,EAAgB,QAAO,QAAQ,UAAAF,EAAE,uBAAuB,GAAE;AAAA,0BAC1DE,EAAW,MAAX,EAAiB,UAAAF,EAAE,kCAAkC,EAAA,CAAE;AAAA,MAAA,GAC1D;AAAA,MAEF,gBAAAmC,EAACY,GAAA,EACC,UAAA,gBAAAZ,EAACjC,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWW,GACzC,UAAAb,EAAE,SAAS,GACd,EAAA,CACF;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,EAAA,CAEJ,GACF,GACF;AAEJ;"}
@@ -10,13 +10,14 @@ import { useComponentContext as U } from "../../../../contexts/ComponentAdapter/
10
10
  import { Form as V } from "../../../Common/Form/Form.js";
11
11
  import { Flex as _ } from "../../../Common/Flex/Flex.js";
12
12
  import "classnames";
13
+ import { componentEvents as c } from "../../../../shared/constants.js";
13
14
  import { ActionsLayout as w } from "../../../Common/ActionsLayout/ActionsLayout.js";
14
15
  import "react-error-boundary";
15
16
  import "@gusto/embedded-api/models/errors/apierror";
16
17
  import "@gusto/embedded-api/models/errors/sdkvalidationerror";
17
18
  import "@tanstack/react-query";
18
19
  import { useBase as B } from "../../../Base/useBase.js";
19
- import { componentEvents as c } from "../../../../shared/constants.js";
20
+ import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
20
21
  import "dompurify";
21
22
  import { TextInputField as j } from "../../../Common/Fields/TextInputField/TextInputField.js";
22
23
  import { RadioGroupField as g } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
@@ -31,7 +32,7 @@ const G = r.object({
31
32
  totalAmount: r.number().min(0).transform((e) => e > 0 ? e.toString() : null).nullable(),
32
33
  deductAsPercentage: r.boolean()
33
34
  });
34
- function de({ deduction: e, employeeId: A }) {
35
+ function pe({ deduction: e, employeeId: A }) {
35
36
  const { onEvent: a, baseSubmitHandler: D } = B(), { t: n } = T("Employee.Deductions"), m = U(), { mutateAsync: h, isPending: E } = N(), { mutateAsync: P, isPending: C } = I(), x = E || C, y = R(() => ({
36
37
  amount: e?.amount ? Number(e.amount) : 0,
37
38
  description: e?.description ?? "",
@@ -144,6 +145,6 @@ function de({ deduction: e, employeeId: A }) {
144
145
  }
145
146
  export {
146
147
  G as DeductionSchema,
147
- de as default
148
+ pe as default
148
149
  };
149
150
  //# sourceMappingURL=CustomDeductionForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomDeductionForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { useMemo } from 'react'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { NumberInputField, TextInputField, RadioGroupField } from '@/components/Common'\nimport { type CommonComponentInterface, useBase } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\n\nexport const DeductionSchema = z.object({\n active: z.boolean(),\n amount: z.number().min(0).transform(String),\n description: z.string().min(1),\n times: z.number().nullable(),\n recurring: z.boolean(),\n annualMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n totalAmount: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n deductAsPercentage: z.boolean(),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ninterface ChildSupportFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n}\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 } as DeductionInputs\n }, [deduction])\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n const { control } = formMethods\n const watchedRecurring = useWatch({ control, name: 'recurring' })\n const watchedAmountPercentage = useWatch({ control, name: 'deductAsPercentage' })\n\n const onSubmit: SubmitHandler<DeductionPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, courtOrdered: false, times: payload.recurring ? null : 1 }, // custom deductions cannot be court ordered/garnishment\n },\n })\n\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...payload,\n version: deduction.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const handleCancel = () => {\n 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 <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","t","useTranslation","Components","useComponentContext","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultValues","useMemo","formMethods","useForm","zodResolver","control","watchedRecurring","useWatch","watchedAmountPercentage","onSubmit","data","payload","updateDeductionResponse","componentEvents","createDeductionResponse","handleCancel","FormProvider","jsx","Form","Flex","jsxs","Fragment","TextInputField","RadioGroupField","NumberInputField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAgBO,MAAMA,IAAkBC,EAAE,OAAO;AAAA,EACtC,QAAQA,EAAE,QAAA;AAAA,EACV,QAAQA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,UAAU,MAAM;AAAA,EAC1C,aAAaA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC7B,OAAOA,EAAE,OAAA,EAAS,SAAA;AAAA,EAClB,WAAWA,EAAE,QAAA;AAAA,EACb,eAAeA,EACZ,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAC,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,aAAaD,EACV,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAC,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,oBAAoBD,EAAE,QAAA;AACxB,CAAC;AAU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CACF;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
1
+ {"version":3,"file":"CustomDeductionForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { useMemo } from 'react'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { NumberInputField, TextInputField, RadioGroupField } from '@/components/Common'\nimport { type CommonComponentInterface, useBase } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\n\nexport const DeductionSchema = z.object({\n active: z.boolean(),\n amount: z.number().min(0).transform(String),\n description: z.string().min(1),\n times: z.number().nullable(),\n recurring: z.boolean(),\n annualMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n totalAmount: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n deductAsPercentage: z.boolean(),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ninterface ChildSupportFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n}\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 } as DeductionInputs\n }, [deduction])\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n const { control } = formMethods\n const watchedRecurring = useWatch({ control, name: 'recurring' })\n const watchedAmountPercentage = useWatch({ control, name: 'deductAsPercentage' })\n\n const onSubmit: SubmitHandler<DeductionPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, courtOrdered: false, times: payload.recurring ? null : 1 }, // custom deductions cannot be court ordered/garnishment\n },\n })\n\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...payload,\n version: deduction.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const handleCancel = () => {\n 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 <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","t","useTranslation","Components","useComponentContext","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultValues","useMemo","formMethods","useForm","zodResolver","control","watchedRecurring","useWatch","watchedAmountPercentage","onSubmit","data","payload","updateDeductionResponse","componentEvents","createDeductionResponse","handleCancel","FormProvider","jsx","Form","Flex","jsxs","Fragment","TextInputField","RadioGroupField","NumberInputField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAgBO,MAAMA,IAAkBC,EAAE,OAAO;AAAA,EACtC,QAAQA,EAAE,QAAA;AAAA,EACV,QAAQA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,UAAU,MAAM;AAAA,EAC1C,aAAaA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC7B,OAAOA,EAAE,OAAA,EAAS,SAAA;AAAA,EAClB,WAAWA,EAAE,QAAA;AAAA,EACb,eAAeA,EACZ,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAC,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,aAAaD,EACV,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAC,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,oBAAoBD,EAAE,QAAA;AACxB,CAAC;AAUD,SAASE,GAAoB,EAAE,WAAAC,GAAW,YAAAC,KAAqC;AAC7E,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,EAAA,GACjC,EAAE,GAAAC,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA,GAEb,EAAE,aAAaC,GAAiB,WAAWC,EAAA,IAC/CC,EAAA,GACI,EAAE,aAAaC,GAAiB,WAAWC,EAAA,IAC/CC,EAAA,GACIC,IAAYL,KAAmBG,GAE/BG,IAAiCC,EAAQ,OACtC;AAAA,IACL,QAAQjB,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,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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,EAAnCL,IAAqC,gBAAvB,iBAAoC,EAAA,CACtD;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
@@ -11,13 +11,14 @@ import { useComponentContext as w } from "../../../../contexts/ComponentAdapter/
11
11
  import { Form as B } from "../../../Common/Form/Form.js";
12
12
  import { Flex as G } from "../../../Common/Flex/Flex.js";
13
13
  import "classnames";
14
+ import { componentEvents as c } from "../../../../shared/constants.js";
14
15
  import { ActionsLayout as j } from "../../../Common/ActionsLayout/ActionsLayout.js";
15
16
  import "react-error-boundary";
16
17
  import "@gusto/embedded-api/models/errors/apierror";
17
18
  import "@gusto/embedded-api/models/errors/sdkvalidationerror";
18
19
  import "@tanstack/react-query";
19
20
  import { useBase as Y } from "../../../Base/useBase.js";
20
- import { componentEvents as c } from "../../../../shared/constants.js";
21
+ import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
21
22
  import "dompurify";
22
23
  import { TextInputField as $ } from "../../../Common/Fields/TextInputField/TextInputField.js";
23
24
  import { RadioGroupField as f } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
@@ -34,7 +35,7 @@ const z = r.object({
34
35
  deductAsPercentage: r.boolean(),
35
36
  garnishmentType: r.nativeEnum(U)
36
37
  });
37
- function fe({
38
+ function he({
38
39
  deduction: e,
39
40
  employeeId: h,
40
41
  selectedGarnishmentType: A,
@@ -153,6 +154,6 @@ function fe({
153
154
  }
154
155
  export {
155
156
  z as DeductionSchema,
156
- fe as default
157
+ he as default
157
158
  };
158
159
  //# 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,SAA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AASwB,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}\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,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oC,EAAA,CACtD;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
@@ -6,13 +6,13 @@ import { BaseComponent as I } from "../../../Base/Base.js";
6
6
  import { useBase as k } from "../../../Base/useBase.js";
7
7
  import { Flex as U } from "../../../Common/Flex/Flex.js";
8
8
  import "classnames";
9
+ import { componentEvents as a } from "../../../../shared/constants.js";
9
10
  import { ActionsLayout as Y } from "../../../Common/ActionsLayout/ActionsLayout.js";
10
11
  import { HamburgerMenu as B } from "../../../Common/HamburgerMenu/HamburgerMenu.js";
11
12
  import E from "../../../../hooks/useNumberFormatter.js";
12
13
  import S from "../../../../assets/icons/pencil.svg.js";
13
14
  import V from "../../../../assets/icons/trashcan.svg.js";
14
15
  import { useComponentDictionary as q, useI18n as F } from "../../../../i18n/I18n.js";
15
- import { componentEvents as a } from "../../../../shared/constants.js";
16
16
  import { useComponentContext as H } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
17
17
  import { useDataView as j } from "../../../Common/DataView/useDataView.js";
18
18
  import { DataView as G } from "../../../Common/DataView/DataView.js";
@@ -9,8 +9,8 @@ import { useBase as L } from "../../../Base/useBase.js";
9
9
  import { useI18n as S } from "../../../../i18n/I18n.js";
10
10
  import { componentEvents as m } from "../../../../shared/constants.js";
11
11
  import { Flex as g } from "../../../Common/Flex/Flex.js";
12
- import "react-i18next";
13
12
  import "classnames";
13
+ import "react-i18next";
14
14
  import "../../../../contexts/ComponentAdapter/useComponentContext.js";
15
15
  import "react";
16
16
  function G(e) {
@@ -3,10 +3,11 @@ import { useTranslation as m } from "react-i18next";
3
3
  import { useDocumentList as s } from "./useDocumentList.js";
4
4
  import { Flex as l } from "../../../Common/Flex/Flex.js";
5
5
  import "classnames";
6
+ import "../../../../shared/constants.js";
6
7
  import "../../../../contexts/ComponentAdapter/useComponentContext.js";
7
8
  import "react";
8
9
  import { DocumentList as u } from "../../../Common/DocumentList/DocumentList.js";
9
- function S() {
10
+ function D() {
10
11
  const { employeeForms: i, handleRequestFormToSign: n, documentListError: r } = s(), { t: e } = m("Employee.DocumentSigner");
11
12
  return /* @__PURE__ */ o("section", { style: { width: "100%" }, children: /* @__PURE__ */ o(l, { flexDirection: "column", gap: 32, children: /* @__PURE__ */ o(
12
13
  u,
@@ -35,6 +36,6 @@ function S() {
35
36
  ) }) });
36
37
  }
37
38
  export {
38
- S as List
39
+ D as List
39
40
  };
40
41
  //# sourceMappingURL=List.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"List.js","sources":["../../../../../src/components/Employee/DocumentSigner/DocumentList/List.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useDocumentList } from './useDocumentList'\nimport { Flex, DocumentList as SharedDocumentList } from '@/components/Common'\n\nexport function List() {\n const { employeeForms, handleRequestFormToSign, documentListError } = useDocumentList()\n const { t } = useTranslation('Employee.DocumentSigner')\n\n return (\n <section style={{ width: '100%' }}>\n <Flex flexDirection=\"column\" gap={32}>\n <SharedDocumentList\n forms={employeeForms.map(form => ({\n uuid: form.uuid,\n title: form.title,\n description: form.description,\n requires_signing: form.requiresSigning,\n }))}\n onRequestSign={handleRequestFormToSign}\n withError={!!documentListError}\n label={t('documentListLabel')}\n columnLabels={{\n form: t('formColumnLabel'),\n action: t('actionColumnLabel'),\n }}\n statusLabels={{\n signCta: t('signDocumentCta'),\n notSigned: t('notSigned'),\n complete: t('signDocumentComplete'),\n }}\n emptyStateLabel={t('emptyTableTitle')}\n errorLabel={t('documentListError')}\n />\n </Flex>\n </section>\n )\n}\n"],"names":["List","employeeForms","handleRequestFormToSign","documentListError","useDocumentList","t","useTranslation","jsx","Flex","SharedDocumentList","form"],"mappings":";;;;;;;;AAIO,SAASA,IAAO;AACrB,QAAM,EAAE,eAAAC,GAAe,yBAAAC,GAAyB,mBAAAC,EAAA,IAAsBC,EAAA,GAChE,EAAE,GAAAC,EAAA,IAAMC,EAAe,yBAAyB;AAEtD,SACE,gBAAAC,EAAC,WAAA,EAAQ,OAAO,EAAE,OAAO,UACvB,UAAA,gBAAAA,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA,gBAAAD;AAAA,IAACE;AAAAA,IAAA;AAAA,MACC,OAAOR,EAAc,IAAI,CAAAS,OAAS;AAAA,QAChC,MAAMA,EAAK;AAAA,QACX,OAAOA,EAAK;AAAA,QACZ,aAAaA,EAAK;AAAA,QAClB,kBAAkBA,EAAK;AAAA,MAAA,EACvB;AAAA,MACF,eAAeR;AAAA,MACf,WAAW,CAAC,CAACC;AAAA,MACb,OAAOE,EAAE,mBAAmB;AAAA,MAC5B,cAAc;AAAA,QACZ,MAAMA,EAAE,iBAAiB;AAAA,QACzB,QAAQA,EAAE,mBAAmB;AAAA,MAAA;AAAA,MAE/B,cAAc;AAAA,QACZ,SAASA,EAAE,iBAAiB;AAAA,QAC5B,WAAWA,EAAE,WAAW;AAAA,QACxB,UAAUA,EAAE,sBAAsB;AAAA,MAAA;AAAA,MAEpC,iBAAiBA,EAAE,iBAAiB;AAAA,MACpC,YAAYA,EAAE,mBAAmB;AAAA,IAAA;AAAA,EAAA,GAErC,EAAA,CACF;AAEJ;"}
1
+ {"version":3,"file":"List.js","sources":["../../../../../src/components/Employee/DocumentSigner/DocumentList/List.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useDocumentList } from './useDocumentList'\nimport { Flex, DocumentList as SharedDocumentList } from '@/components/Common'\n\nexport function List() {\n const { employeeForms, handleRequestFormToSign, documentListError } = useDocumentList()\n const { t } = useTranslation('Employee.DocumentSigner')\n\n return (\n <section style={{ width: '100%' }}>\n <Flex flexDirection=\"column\" gap={32}>\n <SharedDocumentList\n forms={employeeForms.map(form => ({\n uuid: form.uuid,\n title: form.title,\n description: form.description,\n requires_signing: form.requiresSigning,\n }))}\n onRequestSign={handleRequestFormToSign}\n withError={!!documentListError}\n label={t('documentListLabel')}\n columnLabels={{\n form: t('formColumnLabel'),\n action: t('actionColumnLabel'),\n }}\n statusLabels={{\n signCta: t('signDocumentCta'),\n notSigned: t('notSigned'),\n complete: t('signDocumentComplete'),\n }}\n emptyStateLabel={t('emptyTableTitle')}\n errorLabel={t('documentListError')}\n />\n </Flex>\n </section>\n )\n}\n"],"names":["List","employeeForms","handleRequestFormToSign","documentListError","useDocumentList","t","useTranslation","jsx","Flex","SharedDocumentList","form"],"mappings":";;;;;;;;;AAIO,SAASA,IAAO;AACrB,QAAM,EAAE,eAAAC,GAAe,yBAAAC,GAAyB,mBAAAC,EAAA,IAAsBC,EAAA,GAChE,EAAE,GAAAC,EAAA,IAAMC,EAAe,yBAAyB;AAEtD,SACE,gBAAAC,EAAC,WAAA,EAAQ,OAAO,EAAE,OAAO,UACvB,UAAA,gBAAAA,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA,gBAAAD;AAAA,IAACE;AAAAA,IAAA;AAAA,MACC,OAAOR,EAAc,IAAI,CAAAS,OAAS;AAAA,QAChC,MAAMA,EAAK;AAAA,QACX,OAAOA,EAAK;AAAA,QACZ,aAAaA,EAAK;AAAA,QAClB,kBAAkBA,EAAK;AAAA,MAAA,EACvB;AAAA,MACF,eAAeR;AAAA,MACf,WAAW,CAAC,CAACC;AAAA,MACb,OAAOE,EAAE,mBAAmB;AAAA,MAC5B,cAAc;AAAA,QACZ,MAAMA,EAAE,iBAAiB;AAAA,QACzB,QAAQA,EAAE,mBAAmB;AAAA,MAAA;AAAA,MAE/B,cAAc;AAAA,QACZ,SAASA,EAAE,iBAAiB;AAAA,QAC5B,WAAWA,EAAE,WAAW;AAAA,QACxB,UAAUA,EAAE,sBAAsB;AAAA,MAAA;AAAA,MAEpC,iBAAiBA,EAAE,iBAAiB;AAAA,MACpC,YAAYA,EAAE,mBAAmB;AAAA,IAAA;AAAA,EAAA,GAErC,EAAA,CACF;AAEJ;"}
@@ -9,11 +9,12 @@ import "../../../Base/useBase.js";
9
9
  import "../../../../shared/constants.js";
10
10
  import "classnames";
11
11
  import "../../../../contexts/ComponentAdapter/useComponentContext.js";
12
+ import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
12
13
  import "dompurify";
13
14
  import { createCompoundContext as t } from "../../../Base/createCompoundContext.js";
14
- const [L, d] = t("DocumentListContext");
15
+ const [d, a] = t("DocumentListContext");
15
16
  export {
16
- d as DocumentListProvider,
17
- L as useDocumentList
17
+ a as DocumentListProvider,
18
+ d as useDocumentList
18
19
  };
19
20
  //# sourceMappingURL=useDocumentList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDocumentList.js","sources":["../../../../../src/components/Employee/DocumentSigner/DocumentList/useDocumentList.ts"],"sourcesContent":["import type { Form } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype DocumentListContextType = {\n employeeForms: Form[]\n hasSignedAllForms: boolean\n handleContinue: () => void\n handleRequestFormToSign: (form: Form) => void\n documentListError: Error | null\n formToSign?: Form\n}\n\nconst [useDocumentList, DocumentListProvider] =\n createCompoundContext<DocumentListContextType>('DocumentListContext')\nexport { useDocumentList, DocumentListProvider }\n"],"names":["useDocumentList","DocumentListProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;AAYA,MAAM,CAACA,GAAiBC,CAAoB,IAC1CC,EAA+C,qBAAqB;"}
1
+ {"version":3,"file":"useDocumentList.js","sources":["../../../../../src/components/Employee/DocumentSigner/DocumentList/useDocumentList.ts"],"sourcesContent":["import type { Form } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype DocumentListContextType = {\n employeeForms: Form[]\n hasSignedAllForms: boolean\n handleContinue: () => void\n handleRequestFormToSign: (form: Form) => void\n documentListError: Error | null\n formToSign?: Form\n}\n\nconst [useDocumentList, DocumentListProvider] =\n createCompoundContext<DocumentListContextType>('DocumentListContext')\nexport { useDocumentList, DocumentListProvider }\n"],"names":["useDocumentList","DocumentListProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;AAYA,MAAM,CAACA,GAAiBC,CAAoB,IAC1CC,EAA+C,qBAAqB;"}
@@ -12,8 +12,8 @@ import { useBase as C } from "../../../Base/useBase.js";
12
12
  import { useI18n as G } from "../../../../i18n/I18n.js";
13
13
  import { componentEvents as i } from "../../../../shared/constants.js";
14
14
  import { Flex as M } from "../../../Common/Flex/Flex.js";
15
- import "react-i18next";
16
15
  import "classnames";
16
+ import "react-i18next";
17
17
  import "../../../../contexts/ComponentAdapter/useComponentContext.js";
18
18
  import "react";
19
19
  import { SignatureForm as R } from "../../../Common/SignatureForm/SignatureForm.js";
@@ -9,11 +9,12 @@ import "../../../Base/useBase.js";
9
9
  import "../../../../shared/constants.js";
10
10
  import "classnames";
11
11
  import "../../../../contexts/ComponentAdapter/useComponentContext.js";
12
+ import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
12
13
  import "dompurify";
13
14
  import { createCompoundContext as o } from "../../../Base/createCompoundContext.js";
14
- const [S, c] = o("SignatureFormContext");
15
+ const [c, d] = o("SignatureFormContext");
15
16
  export {
16
- c as SignatureFormProvider,
17
- S as useSignatureForm
17
+ d as SignatureFormProvider,
18
+ c as useSignatureForm
18
19
  };
19
20
  //# sourceMappingURL=useSignatureForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSignatureForm.js","sources":["../../../../../src/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.ts"],"sourcesContent":["import type { Form } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype SignatureFormContextType = {\n form: Form\n pdfUrl?: string | null\n handleBack: () => void\n isPending: boolean\n}\n\nconst [useSignatureForm, SignatureFormProvider] =\n createCompoundContext<SignatureFormContextType>('SignatureFormContext')\nexport { useSignatureForm, SignatureFormProvider }\n"],"names":["useSignatureForm","SignatureFormProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;AAUA,MAAM,CAACA,GAAkBC,CAAqB,IAC5CC,EAAgD,sBAAsB;"}
1
+ {"version":3,"file":"useSignatureForm.js","sources":["../../../../../src/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.ts"],"sourcesContent":["import type { Form } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype SignatureFormContextType = {\n form: Form\n pdfUrl?: string | null\n handleBack: () => void\n isPending: boolean\n}\n\nconst [useSignatureForm, SignatureFormProvider] =\n createCompoundContext<SignatureFormContextType>('SignatureFormContext')\nexport { useSignatureForm, SignatureFormProvider }\n"],"names":["useSignatureForm","SignatureFormProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;AAUA,MAAM,CAACA,GAAkBC,CAAqB,IAC5CC,EAAgD,sBAAsB;"}
@@ -1,71 +1,72 @@
1
- import { jsx as o, jsxs as C } from "react/jsx-runtime";
2
- import { useState as h } from "react";
3
- import { useEmployeesList as G } from "@gusto/embedded-api/react-query/employeesList";
4
- import { useEmployeesDeleteMutation as F } from "@gusto/embedded-api/react-query/employeesDelete";
5
- import { useEmployeesUpdateOnboardingStatusMutation as Y } from "@gusto/embedded-api/react-query/employeesUpdateOnboardingStatus";
6
- import { keepPreviousData as U } from "@tanstack/react-query";
7
- import { EmployeeListProvider as W } from "./useEmployeeList.js";
8
- import { Actions as k } from "./Actions.js";
9
- import { BaseComponent as q } from "../../Base/Base.js";
10
- import { useBase as j } from "../../Base/useBase.js";
11
- import { Flex as H } from "../../Common/Flex/Flex.js";
12
- import { Loading as V } from "../../Common/Loading/Loading.js";
1
+ import { jsx as o, jsxs as G } from "react/jsx-runtime";
2
+ import { useState as g } from "react";
3
+ import { useEmployeesList as F } from "@gusto/embedded-api/react-query/employeesList";
4
+ import { useEmployeesDeleteMutation as Y } from "@gusto/embedded-api/react-query/employeesDelete";
5
+ import { useEmployeesUpdateOnboardingStatusMutation as U } from "@gusto/embedded-api/react-query/employeesUpdateOnboardingStatus";
6
+ import { keepPreviousData as W } from "@tanstack/react-query";
7
+ import { EmployeeListProvider as k } from "./useEmployeeList.js";
8
+ import { Actions as q } from "./Actions.js";
9
+ import { BaseComponent as j } from "../../Base/Base.js";
10
+ import { useBase as H } from "../../Base/useBase.js";
11
+ import { Flex as V } from "../../Common/Flex/Flex.js";
12
+ import "classnames";
13
+ import { componentEvents as s, EmployeeOnboardingStatus as l } from "../../../shared/constants.js";
14
+ import { Loading as z } from "../../Common/Loading/Loading.js";
13
15
  import "react-i18next";
14
16
  import "../../../contexts/ComponentAdapter/useComponentContext.js";
15
- import { useI18n as z, useComponentDictionary as J } from "../../../i18n/I18n.js";
16
- import { componentEvents as s, EmployeeOnboardingStatus as E } from "../../../shared/constants.js";
17
- import { Head as K } from "./Head.js";
18
- import { List as Q } from "./List.js";
19
- import { useFlow as X } from "../../Flow/useFlow.js";
20
- function Z(n) {
21
- return /* @__PURE__ */ o(q, { ...n, children: /* @__PURE__ */ o($, { ...n, children: n.children }) });
17
+ import { useI18n as J, useComponentDictionary as K } from "../../../i18n/I18n.js";
18
+ import { Head as Q } from "./Head.js";
19
+ import { List as X } from "./List.js";
20
+ import { useFlow as Z } from "../../Flow/useFlow.js";
21
+ function $(n) {
22
+ return /* @__PURE__ */ o(j, { ...n, children: /* @__PURE__ */ o(ee, { ...n, children: n.children }) });
22
23
  }
23
- function $({ companyId: n, className: m, children: l, dictionary: P }) {
24
- z("Employee.EmployeeList"), J("Employee.EmployeeList", P);
25
- const { onEvent: a, baseSubmitHandler: r } = j(), [p, i] = h(1), [u, g] = h(5), { data: d, fetchStatus: f, isFetching: O } = G(
24
+ function ee({ companyId: n, className: m, children: E, dictionary: P }) {
25
+ J("Employee.EmployeeList"), K("Employee.EmployeeList", P);
26
+ const { onEvent: a, baseSubmitHandler: r } = H(), [p, i] = g(1), [u, f] = g(5), { data: d, fetchStatus: O, isFetching: D } = F(
26
27
  {
27
28
  companyId: n,
28
29
  page: p,
29
30
  per: u
30
31
  },
31
- { placeholderData: U }
32
- ), { mutateAsync: D } = F(), { mutateAsync: I } = Y();
33
- if (f === "fetching" && !d)
34
- return /* @__PURE__ */ o(V, {});
35
- const { httpMeta: N, showEmployees: A } = d, L = A, c = Number(N.response.headers.get("x-total-pages") ?? 1), _ = (e) => {
36
- g(e);
37
- }, M = () => {
38
- i(1);
32
+ { placeholderData: W }
33
+ ), { mutateAsync: N } = Y(), { mutateAsync: I } = U();
34
+ if (O === "fetching" && !d)
35
+ return /* @__PURE__ */ o(z, {});
36
+ const { httpMeta: y, showEmployees: A } = d, L = A, c = Number(y.response.headers.get("x-total-pages") ?? 1), _ = Number(y.response.headers.get("x-total-count") ?? 0), M = (e) => {
37
+ f(e);
39
38
  }, S = () => {
40
- i((e) => Math.max(e - 1, 1));
39
+ i(1);
41
40
  }, w = () => {
42
- i((e) => Math.min(e + 1, c));
41
+ i((e) => Math.max(e - 1, 1));
43
42
  }, b = () => {
43
+ i((e) => Math.min(e + 1, c));
44
+ }, x = () => {
44
45
  i(c);
45
46
  }, R = async (e) => {
46
47
  await r(e, async (t) => {
47
- await D({
48
+ await N({
48
49
  request: { employeeId: t }
49
50
  }), a(s.EMPLOYEE_DELETED, { employeeId: t });
50
51
  });
51
52
  }, T = async (e) => {
52
53
  await r(e, async (t) => {
53
- await y({
54
+ await h({
54
55
  employeeId: t,
55
- status: E.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW
56
+ status: l.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW
56
57
  }), a(s.EMPLOYEE_UPDATE, {
57
58
  employeeId: t,
58
- onboardingStatus: E.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW
59
+ onboardingStatus: l.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW
59
60
  });
60
61
  });
61
- }, x = async (e) => {
62
+ }, C = async (e) => {
62
63
  await r(e, async (t) => {
63
- await y({
64
+ await h({
64
65
  employeeId: t,
65
- status: E.ADMIN_ONBOARDING_INCOMPLETE
66
+ status: l.ADMIN_ONBOARDING_INCOMPLETE
66
67
  });
67
68
  });
68
- }, y = async (e) => {
69
+ }, h = async (e) => {
69
70
  await r(e, async ({ employeeId: t, status: v }) => {
70
71
  const { employeeOnboardingStatus: B } = await I({
71
72
  request: { employeeId: t, requestBody: { onboardingStatus: v } }
@@ -74,7 +75,7 @@ function $({ companyId: n, className: m, children: l, dictionary: P }) {
74
75
  });
75
76
  };
76
77
  return /* @__PURE__ */ o("section", { className: m, children: /* @__PURE__ */ o(
77
- W,
78
+ k,
78
79
  {
79
80
  value: {
80
81
  handleEdit: (e, t) => {
@@ -88,32 +89,33 @@ function $({ companyId: n, className: m, children: l, dictionary: P }) {
88
89
  employees: L,
89
90
  currentPage: p,
90
91
  totalPages: c,
91
- handleFirstPage: M,
92
- handlePreviousPage: S,
93
- handleNextPage: w,
94
- handleLastPage: b,
95
- handleCancelSelfOnboarding: x,
96
- handleItemsPerPageChange: _,
92
+ totalCount: _,
93
+ handleFirstPage: S,
94
+ handlePreviousPage: w,
95
+ handleNextPage: b,
96
+ handleLastPage: x,
97
+ handleCancelSelfOnboarding: C,
98
+ handleItemsPerPageChange: M,
97
99
  handleSkip: () => {
98
100
  a(s.EMPLOYEE_ONBOARDING_DONE);
99
101
  },
100
102
  itemsPerPage: u,
101
- isFetching: O
103
+ isFetching: D
102
104
  },
103
- children: l || /* @__PURE__ */ C(H, { flexDirection: "column", children: [
104
- /* @__PURE__ */ o(K, {}),
105
+ children: E || /* @__PURE__ */ G(V, { flexDirection: "column", children: [
105
106
  /* @__PURE__ */ o(Q, {}),
106
- /* @__PURE__ */ o(k, {})
107
+ /* @__PURE__ */ o(X, {}),
108
+ /* @__PURE__ */ o(q, {})
107
109
  ] })
108
110
  }
109
111
  ) });
110
112
  }
111
- const Ie = () => {
112
- const { companyId: n, onEvent: m } = X();
113
- return /* @__PURE__ */ o(Z, { companyId: n, onEvent: m });
113
+ const Ae = () => {
114
+ const { companyId: n, onEvent: m } = Z();
115
+ return /* @__PURE__ */ o($, { companyId: n, onEvent: m });
114
116
  };
115
117
  export {
116
- Z as EmployeeList,
117
- Ie as EmployeeListContextual
118
+ $ as EmployeeList,
119
+ Ae as EmployeeListContextual
118
120
  };
119
121
  //# sourceMappingURL=EmployeeList.js.map