@gusto/embedded-react-sdk 0.24.0 → 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 (292) hide show
  1. package/CHANGELOG.md +80 -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/SignatureFormFields.js +1 -1
  14. package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
  15. package/dist/components/Common/UI/FileInput/FileInput.d.ts +2 -0
  16. package/dist/components/Common/UI/FileInput/FileInput.js +151 -0
  17. package/dist/components/Common/UI/FileInput/FileInput.js.map +1 -0
  18. package/dist/components/Common/UI/FileInput/FileInput.module.scss.js +34 -0
  19. package/dist/components/Common/UI/FileInput/FileInput.module.scss.js.map +1 -0
  20. package/dist/components/Common/UI/FileInput/FileInputTypes.d.ts +45 -0
  21. package/dist/components/Common/UI/FileInput/FileInputTypes.js +8 -0
  22. package/dist/components/Common/UI/FileInput/FileInputTypes.js.map +1 -0
  23. package/dist/components/Common/UI/FileInput/index.d.ts +4 -0
  24. package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
  25. package/dist/components/Common/UI/TextInput/TextInput.js +27 -23
  26. package/dist/components/Common/UI/TextInput/TextInput.js.map +1 -1
  27. package/dist/components/Common/UI/TextInput/TextInputTypes.d.ts +1 -1
  28. package/dist/components/Common/UI/TextInput/TextInputTypes.js.map +1 -1
  29. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +1 -1
  30. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +12 -12
  31. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +4 -3
  32. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  33. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +1 -1
  34. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +4 -3
  35. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  36. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +6 -5
  37. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  38. package/dist/components/Company/BankAccount/BankAccountForm/Form.js +1 -1
  39. package/dist/components/Company/BankAccount/BankAccountForm/context.js +4 -3
  40. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  41. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +1 -1
  42. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +4 -3
  43. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  44. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +4 -3
  45. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  46. package/dist/components/Company/FederalTaxes/Form.js +1 -1
  47. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +9 -8
  48. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  49. package/dist/components/Company/Industry/Context.js +7 -6
  50. package/dist/components/Company/Industry/Context.js.map +1 -1
  51. package/dist/components/Company/Locations/LocationForm/Form.js +1 -1
  52. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +4 -3
  53. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  54. package/dist/components/Company/Locations/LocationsList/List.js +35 -33
  55. package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
  56. package/dist/components/Company/Locations/LocationsList/LocationsList.js +29 -28
  57. package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
  58. package/dist/components/Company/Locations/LocationsList/useLocationsList.d.ts +1 -0
  59. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +4 -3
  60. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  61. package/dist/components/Company/OnboardingOverview/context.js +4 -3
  62. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  63. package/dist/components/Company/PaySchedule/_parts/Edit.js +15 -15
  64. package/dist/components/Company/PaySchedule/usePaySchedule.js +6 -5
  65. package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
  66. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +4 -3
  67. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  68. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +4 -3
  69. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  70. package/dist/components/Contractor/Address/Form.js +1 -1
  71. package/dist/components/Contractor/Address/useAddress.js +6 -5
  72. package/dist/components/Contractor/Address/useAddress.js.map +1 -1
  73. package/dist/components/Contractor/ContractorList/index.js +16 -15
  74. package/dist/components/Contractor/ContractorList/index.js.map +1 -1
  75. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +2 -2
  76. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +1 -1
  77. package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js +61 -59
  78. package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js.map +1 -1
  79. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js +24 -22
  80. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js.map +1 -1
  81. package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js +38 -19
  82. package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js.map +1 -1
  83. package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.d.ts +3 -1
  84. package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js +26 -25
  85. package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js.map +1 -1
  86. package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.d.ts +2 -0
  87. package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js +25 -19
  88. package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js.map +1 -1
  89. package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.d.ts +1 -0
  90. package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js +86 -56
  91. package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js.map +1 -1
  92. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.d.ts +1 -2
  93. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.js +46 -21
  94. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.js.map +1 -1
  95. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.d.ts +6 -15
  96. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js +115 -99
  97. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js.map +1 -1
  98. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.module.scss.js +8 -0
  99. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.module.scss.js.map +1 -0
  100. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.d.ts +8 -0
  101. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.js +51 -0
  102. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.js.map +1 -0
  103. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.d.ts +11 -0
  104. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js +157 -0
  105. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js.map +1 -0
  106. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.module.scss.js +22 -0
  107. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.module.scss.js.map +1 -0
  108. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +40 -43
  109. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -1
  110. package/dist/components/Contractor/Profile/ContractorProfileForm.js +15 -15
  111. package/dist/components/Contractor/Profile/useContractorProfile.js +3 -2
  112. package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
  113. package/dist/components/Employee/Compensation/Edit.js +14 -14
  114. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +10 -9
  115. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
  116. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +11 -10
  117. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
  118. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +11 -10
  119. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +1 -1
  120. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +4 -3
  121. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  122. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +4 -3
  123. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  124. package/dist/components/Employee/EmployeeList/EmployeeList.js +57 -56
  125. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  126. package/dist/components/Employee/EmployeeList/List.js +34 -32
  127. package/dist/components/Employee/EmployeeList/List.js.map +1 -1
  128. package/dist/components/Employee/EmployeeList/useEmployeeList.d.ts +1 -0
  129. package/dist/components/Employee/EmployeeList/useEmployeeList.js +4 -3
  130. package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
  131. package/dist/components/Employee/FederalTaxes/FederalForm.js +7 -7
  132. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +4 -3
  133. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
  134. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +2 -2
  135. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +1 -1
  136. package/dist/components/Employee/PaymentMethod/Split.js +8 -8
  137. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +6 -5
  138. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
  139. package/dist/components/Employee/Profile/AdminPersonalDetails.js +1 -1
  140. package/dist/components/Employee/Profile/HomeAddress.js +1 -1
  141. package/dist/components/Employee/Profile/PersonalDetailsInputs.js +2 -2
  142. package/dist/components/Employee/Profile/useProfile.js +4 -3
  143. package/dist/components/Employee/Profile/useProfile.js.map +1 -1
  144. package/dist/components/Employee/StateTaxes/useStateTaxes.js +4 -3
  145. package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
  146. package/dist/components/Employee/Taxes/FederalForm.js +7 -7
  147. package/dist/components/Employee/Taxes/useTaxes.js +4 -3
  148. package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
  149. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +9 -9
  150. package/dist/components/Payroll/InformationRequests/InformationRequestForm/InformationRequestForm.d.ts +15 -0
  151. package/dist/components/Payroll/InformationRequests/InformationRequestForm/InformationRequestForm.js +142 -0
  152. package/dist/components/Payroll/InformationRequests/InformationRequestForm/InformationRequestForm.js.map +1 -0
  153. package/dist/components/Payroll/InformationRequests/InformationRequestForm/InformationRequestForm.module.scss.js +18 -0
  154. package/dist/components/Payroll/InformationRequests/InformationRequestForm/InformationRequestForm.module.scss.js.map +1 -0
  155. package/dist/components/Payroll/InformationRequests/InformationRequestForm/index.d.ts +2 -0
  156. package/dist/components/Payroll/InformationRequests/InformationRequestList/InformationRequestList.d.ts +7 -0
  157. package/dist/components/Payroll/InformationRequests/InformationRequestList/InformationRequestList.js +88 -0
  158. package/dist/components/Payroll/InformationRequests/InformationRequestList/InformationRequestList.js.map +1 -0
  159. package/dist/components/Payroll/InformationRequests/InformationRequestList/index.d.ts +2 -0
  160. package/dist/components/Payroll/InformationRequests/InformationRequests.d.ts +6 -0
  161. package/dist/components/Payroll/InformationRequests/InformationRequests.js +55 -0
  162. package/dist/components/Payroll/InformationRequests/InformationRequests.js.map +1 -0
  163. package/dist/components/Payroll/InformationRequests/InformationRequestsComponents.d.ts +19 -0
  164. package/dist/components/Payroll/InformationRequests/InformationRequestsComponents.js +20 -0
  165. package/dist/components/Payroll/InformationRequests/InformationRequestsComponents.js.map +1 -0
  166. package/dist/components/Payroll/InformationRequests/index.d.ts +3 -0
  167. package/dist/components/Payroll/InformationRequests/informationRequestsStateMachine.d.ts +13 -0
  168. package/dist/components/Payroll/InformationRequests/informationRequestsStateMachine.js +47 -0
  169. package/dist/components/Payroll/InformationRequests/informationRequestsStateMachine.js.map +1 -0
  170. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +116 -130
  171. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
  172. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +5 -2
  173. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +107 -99
  174. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
  175. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.module.scss.js +2 -4
  176. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.module.scss.js.map +1 -1
  177. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.d.ts +21 -0
  178. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +105 -0
  179. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -0
  180. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +41 -37
  181. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
  182. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.d.ts +5 -4
  183. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +137 -131
  184. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
  185. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +16 -15
  186. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
  187. package/dist/components/Payroll/PayrollFlow/payrollStateMachine.d.ts +2 -0
  188. package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js +174 -106
  189. package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js.map +1 -1
  190. package/dist/components/Payroll/PayrollHistory/PayrollHistory.js +28 -28
  191. package/dist/components/Payroll/PayrollHistory/PayrollHistory.js.map +1 -1
  192. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.d.ts +2 -2
  193. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +85 -104
  194. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
  195. package/dist/components/Payroll/PayrollLanding/PayrollLanding.js +24 -20
  196. package/dist/components/Payroll/PayrollLanding/PayrollLanding.js.map +1 -1
  197. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.d.ts +2 -0
  198. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js +51 -46
  199. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js.map +1 -1
  200. package/dist/components/Payroll/PayrollLanding/payrollLandingStateMachine.d.ts +2 -0
  201. package/dist/components/Payroll/PayrollLanding/payrollLandingStateMachine.js +111 -45
  202. package/dist/components/Payroll/PayrollLanding/payrollLandingStateMachine.js.map +1 -1
  203. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +136 -125
  204. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
  205. package/dist/components/Payroll/PayrollList/PayrollListPresentation.module.scss.js +8 -4
  206. package/dist/components/Payroll/PayrollList/PayrollListPresentation.module.scss.js.map +1 -1
  207. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +117 -110
  208. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
  209. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.d.ts +4 -2
  210. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +282 -278
  211. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
  212. package/dist/components/Payroll/PayrollOverview/PayrollOverviewTypes.d.ts +6 -0
  213. package/dist/components/Payroll/PayrollOverview/PayrollOverviewTypes.js +5 -0
  214. package/dist/components/Payroll/PayrollOverview/PayrollOverviewTypes.js.map +1 -0
  215. package/dist/components/Payroll/RecoveryCases/RecoveryCases.d.ts +6 -0
  216. package/dist/components/Payroll/RecoveryCases/RecoveryCases.js +55 -0
  217. package/dist/components/Payroll/RecoveryCases/RecoveryCases.js.map +1 -0
  218. package/dist/components/Payroll/RecoveryCases/RecoveryCasesComponents.d.ts +19 -0
  219. package/dist/components/Payroll/RecoveryCases/RecoveryCasesComponents.js +19 -0
  220. package/dist/components/Payroll/RecoveryCases/RecoveryCasesComponents.js.map +1 -0
  221. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.d.ts +7 -0
  222. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js +73 -0
  223. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js.map +1 -0
  224. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.module.scss.js +10 -0
  225. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.module.scss.js.map +1 -0
  226. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/index.d.ts +2 -0
  227. package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.d.ts +14 -0
  228. package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js +46 -0
  229. package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js.map +1 -0
  230. package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/index.d.ts +2 -0
  231. package/dist/components/Payroll/RecoveryCases/index.d.ts +3 -0
  232. package/dist/components/Payroll/RecoveryCases/recoveryCasesStateMachine.d.ts +13 -0
  233. package/dist/components/Payroll/RecoveryCases/recoveryCasesStateMachine.js +47 -0
  234. package/dist/components/Payroll/RecoveryCases/recoveryCasesStateMachine.js.map +1 -0
  235. package/dist/components/Payroll/helpers.d.ts +12 -0
  236. package/dist/components/Payroll/helpers.js +129 -117
  237. package/dist/components/Payroll/helpers.js.map +1 -1
  238. package/dist/components/Payroll/index.d.ts +2 -0
  239. package/dist/components/Payroll/index.js +18 -14
  240. package/dist/components/Payroll/index.js.map +1 -1
  241. package/dist/components/Payroll/usePreparedPayrollData.d.ts +4 -1
  242. package/dist/components/Payroll/usePreparedPayrollData.js +43 -31
  243. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  244. package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js +27 -25
  245. package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js.map +1 -1
  246. package/dist/contexts/ComponentAdapter/componentAdapterTypes.d.ts +1 -0
  247. package/dist/contexts/ComponentAdapter/createComponentsWithDefaults.d.ts +5 -0
  248. package/dist/contexts/ComponentAdapter/createComponentsWithDefaults.js +17 -15
  249. package/dist/contexts/ComponentAdapter/createComponentsWithDefaults.js.map +1 -1
  250. package/dist/contexts/ComponentAdapter/useComponentContext.d.ts +2 -0
  251. package/dist/contexts/ComponentAdapter/useComponentContext.js +3 -3
  252. package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
  253. package/dist/helpers/dateFormatting.d.ts +1 -0
  254. package/dist/helpers/dateFormatting.js +1 -0
  255. package/dist/helpers/dateFormatting.js.map +1 -1
  256. package/dist/helpers/formattedStrings.d.ts +1 -0
  257. package/dist/helpers/formattedStrings.js +23 -18
  258. package/dist/helpers/formattedStrings.js.map +1 -1
  259. package/dist/helpers/responsive.js +1 -1
  260. package/dist/helpers/responsive.js.map +1 -1
  261. package/dist/i18n/I18n.js +3 -3
  262. package/dist/i18n/I18n.js.map +1 -1
  263. package/dist/i18n/en/Contractor.Payments.CreatePayment.json.js +36 -32
  264. package/dist/i18n/en/Contractor.Payments.CreatePayment.json.js.map +1 -1
  265. package/dist/i18n/en/Contractor.Payments.PaymentHistory.json.js +11 -11
  266. package/dist/i18n/en/Contractor.Payments.PaymentStatement.json.js +28 -0
  267. package/dist/i18n/en/Contractor.Payments.PaymentStatement.json.js.map +1 -0
  268. package/dist/i18n/en/Contractor.Payments.PaymentsList.json.js +14 -14
  269. package/dist/i18n/en/Payroll.InformationRequestForm.json.js +18 -0
  270. package/dist/i18n/en/Payroll.InformationRequestForm.json.js.map +1 -0
  271. package/dist/i18n/en/Payroll.InformationRequestList.json.js +18 -0
  272. package/dist/i18n/en/Payroll.InformationRequestList.json.js.map +1 -0
  273. package/dist/i18n/en/Payroll.PayrollConfiguration.json.js +27 -21
  274. package/dist/i18n/en/Payroll.PayrollConfiguration.json.js.map +1 -1
  275. package/dist/i18n/en/Payroll.PayrollHistory.json.js +6 -6
  276. package/dist/i18n/en/Payroll.PayrollLanding.json.js +5 -3
  277. package/dist/i18n/en/Payroll.PayrollLanding.json.js.map +1 -1
  278. package/dist/i18n/en/Payroll.PayrollOverview.json.js +32 -28
  279. package/dist/i18n/en/Payroll.PayrollOverview.json.js.map +1 -1
  280. package/dist/i18n/en/Payroll.RecoveryCasesList.json.js +14 -0
  281. package/dist/i18n/en/Payroll.RecoveryCasesList.json.js.map +1 -0
  282. package/dist/i18n/en/Payroll.RecoveryCasesResubmit.json.js +8 -0
  283. package/dist/i18n/en/Payroll.RecoveryCasesResubmit.json.js.map +1 -0
  284. package/dist/i18n/en/common.json.d.ts +6 -0
  285. package/dist/i18n/en/common.json.js +4 -2
  286. package/dist/i18n/en/common.json.js.map +1 -1
  287. package/dist/shared/constants.d.ts +25 -1
  288. package/dist/shared/constants.js +72 -55
  289. package/dist/shared/constants.js.map +1 -1
  290. package/dist/style.css +1 -1
  291. package/dist/types/i18next.d.ts +120 -3
  292. package/package.json +31 -20
@@ -12,16 +12,17 @@ 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
14
  import { componentEvents as c } from "../../../../shared/constants.js";
15
- import { RadioGroupField as f } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
16
- import { TextInputField as j } from "../../../Common/Fields/TextInputField/TextInputField.js";
17
- import { ActionsLayout as Y } from "../../../Common/ActionsLayout/ActionsLayout.js";
18
- import { NumberInputField as p } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
15
+ import { ActionsLayout as j } from "../../../Common/ActionsLayout/ActionsLayout.js";
19
16
  import "react-error-boundary";
20
17
  import "@gusto/embedded-api/models/errors/apierror";
21
18
  import "@gusto/embedded-api/models/errors/sdkvalidationerror";
22
19
  import "@tanstack/react-query";
23
- import { useBase as $ } from "../../../Base/useBase.js";
20
+ import { useBase as Y } from "../../../Base/useBase.js";
21
+ import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
24
22
  import "dompurify";
23
+ import { TextInputField as $ } from "../../../Common/Fields/TextInputField/TextInputField.js";
24
+ import { RadioGroupField as f } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
25
+ import { NumberInputField as p } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
25
26
  const z = r.object({
26
27
  active: r.boolean(),
27
28
  amount: r.number().min(0).transform(String),
@@ -34,13 +35,13 @@ 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,
41
42
  selectedGarnishmentTitle: D
42
43
  }) {
43
- const { onEvent: a, baseSubmitHandler: E } = $(), { t: n } = F("Employee.Deductions"), m = w(), { mutateAsync: y, isPending: P } = V(), { mutateAsync: x, isPending: C } = _(), T = P || C, M = N(() => ({
44
+ const { onEvent: a, baseSubmitHandler: E } = Y(), { t: n } = F("Employee.Deductions"), m = w(), { mutateAsync: y, isPending: P } = V(), { mutateAsync: x, isPending: C } = _(), T = P || C, M = N(() => ({
44
45
  amount: e?.amount ? Number(e.amount) : 0,
45
46
  description: e?.description ?? "",
46
47
  times: e?.times ?? null,
@@ -83,7 +84,7 @@ function fe({
83
84
  };
84
85
  return /* @__PURE__ */ t(S, { ...u, children: /* @__PURE__ */ t(B, { onSubmit: u.handleSubmit(O), children: /* @__PURE__ */ t(G, { flexDirection: "column", gap: 32, children: /* @__PURE__ */ l(b, { children: [
85
86
  /* @__PURE__ */ t(m.Heading, { as: "h3", children: D }),
86
- /* @__PURE__ */ t(j, { name: "description", label: n("descriptionLabelV2"), isRequired: !0 }),
87
+ /* @__PURE__ */ t($, { name: "description", label: n("descriptionLabelV2"), isRequired: !0 }),
87
88
  /* @__PURE__ */ t(
88
89
  f,
89
90
  {
@@ -145,7 +146,7 @@ function fe({
145
146
  }
146
147
  )
147
148
  ] }),
148
- /* @__PURE__ */ l(Y, { children: [
149
+ /* @__PURE__ */ l(j, { children: [
149
150
  /* @__PURE__ */ t(m.Button, { variant: "secondary", onClick: L, children: n("cancelCta") }),
150
151
  /* @__PURE__ */ t(m.Button, { type: "submit", isLoading: T, children: n(e ? "continueCta" : "addDeductionCta") })
151
152
  ] })
@@ -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,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,oBAAoBD,EAAE,QAAA;AAAA,EACtB,iBAAiBA,EAAE,WAAWE,CAAe;AAC/C,CAAC;AAYD,SAASC,GAAgB;AAAA,EACvB,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,0BAAAC;AACF,GAAyB;AACvB,QAAM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F;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,EACA,YAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,0BAAAC;AACF,GAAyB;AACvB,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,EAAA,GACjC,EAAE,GAAAC,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA,GAEb,EAAE,aAAaC,GAAiB,WAAWC,EAAA,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O;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,gBAAgB,CAAChB,KAA2B;AAAA,QAC5C,cAAcA,KAA2B;AAAA,QACzC,OAAOnB,EAAE,sBAAsB;AAAA,QAC/B,YAAU;AAAA,QACV,KAAK;AAAA,QACL,QAAQmB,IAA0B,YAAY;AAAA,QAC9C,aAEMnB,EADJmB,IACM,yCACA,iCADsC;AAAA,MACL;AAAA,IAAA;AAAA,IAG1CF,KACC,gBAAAc,EAAAC,GAAA,EACE,UAAA;AAAA,MAAA,gBAAAJ;AAAA,QAACO;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,gBAAe;AAAA,UACf,QAAO;AAAA,UACP,OAAOnC,EAAE,kBAAkB;AAAA,UAC3B,aAAaA,EAAE,wBAAwB;AAAA,UACvC,KAAK;AAAA,QAAA;AAAA,MAAA;AAAA,MAEP,gBAAA4B;AAAA,QAACO;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,gBAAe;AAAA,UACf,QAAO;AAAA,UACP,OAAOnC,EAAE,gBAAgB;AAAA,UACzB,KAAK;AAAA,UACL,aAAaA,EAAE,sBAAsB;AAAA,QAAA;AAAA,MAAA;AAAA,IACvC,GACF;AAAA,sBAEDoC,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAR,EAAC1B,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASwB,GAC7C,UAAA1B,EAAE,WAAW,EAAA,CAChB;AAAA,MACA,gBAAA4B,EAAC1B,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWQ,GACzC,UAAoCV,EAAnCP,IAAqC,gBAAvB,iBAAoC,EAAA,CACtD;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
@@ -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;"}
@@ -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,72 +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";
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
12
  import "classnames";
13
- import { componentEvents as s, EmployeeOnboardingStatus as E } from "../../../shared/constants.js";
14
- import { Loading as V } from "../../Common/Loading/Loading.js";
13
+ import { componentEvents as s, EmployeeOnboardingStatus as l } from "../../../shared/constants.js";
14
+ import { Loading as z } from "../../Common/Loading/Loading.js";
15
15
  import "react-i18next";
16
16
  import "../../../contexts/ComponentAdapter/useComponentContext.js";
17
- import { useI18n as z, useComponentDictionary as J } from "../../../i18n/I18n.js";
18
- import { Head as K } from "./Head.js";
19
- import { List as Q } from "./List.js";
20
- import { useFlow as X } from "../../Flow/useFlow.js";
21
- function Z(n) {
22
- 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 }) });
23
23
  }
24
- function $({ companyId: n, className: m, children: l, dictionary: P }) {
25
- z("Employee.EmployeeList"), J("Employee.EmployeeList", P);
26
- 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(
27
27
  {
28
28
  companyId: n,
29
29
  page: p,
30
30
  per: u
31
31
  },
32
- { placeholderData: U }
33
- ), { mutateAsync: D } = F(), { mutateAsync: I } = Y();
34
- if (f === "fetching" && !d)
35
- return /* @__PURE__ */ o(V, {});
36
- const { httpMeta: N, showEmployees: A } = d, L = A, c = Number(N.response.headers.get("x-total-pages") ?? 1), _ = (e) => {
37
- g(e);
38
- }, M = () => {
39
- 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);
40
38
  }, S = () => {
41
- i((e) => Math.max(e - 1, 1));
39
+ i(1);
42
40
  }, w = () => {
43
- i((e) => Math.min(e + 1, c));
41
+ i((e) => Math.max(e - 1, 1));
44
42
  }, b = () => {
43
+ i((e) => Math.min(e + 1, c));
44
+ }, x = () => {
45
45
  i(c);
46
46
  }, R = async (e) => {
47
47
  await r(e, async (t) => {
48
- await D({
48
+ await N({
49
49
  request: { employeeId: t }
50
50
  }), a(s.EMPLOYEE_DELETED, { employeeId: t });
51
51
  });
52
52
  }, T = async (e) => {
53
53
  await r(e, async (t) => {
54
- await y({
54
+ await h({
55
55
  employeeId: t,
56
- status: E.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW
56
+ status: l.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW
57
57
  }), a(s.EMPLOYEE_UPDATE, {
58
58
  employeeId: t,
59
- onboardingStatus: E.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW
59
+ onboardingStatus: l.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW
60
60
  });
61
61
  });
62
- }, x = async (e) => {
62
+ }, C = async (e) => {
63
63
  await r(e, async (t) => {
64
- await y({
64
+ await h({
65
65
  employeeId: t,
66
- status: E.ADMIN_ONBOARDING_INCOMPLETE
66
+ status: l.ADMIN_ONBOARDING_INCOMPLETE
67
67
  });
68
68
  });
69
- }, y = async (e) => {
69
+ }, h = async (e) => {
70
70
  await r(e, async ({ employeeId: t, status: v }) => {
71
71
  const { employeeOnboardingStatus: B } = await I({
72
72
  request: { employeeId: t, requestBody: { onboardingStatus: v } }
@@ -75,7 +75,7 @@ function $({ companyId: n, className: m, children: l, dictionary: P }) {
75
75
  });
76
76
  };
77
77
  return /* @__PURE__ */ o("section", { className: m, children: /* @__PURE__ */ o(
78
- W,
78
+ k,
79
79
  {
80
80
  value: {
81
81
  handleEdit: (e, t) => {
@@ -89,32 +89,33 @@ function $({ companyId: n, className: m, children: l, dictionary: P }) {
89
89
  employees: L,
90
90
  currentPage: p,
91
91
  totalPages: c,
92
- handleFirstPage: M,
93
- handlePreviousPage: S,
94
- handleNextPage: w,
95
- handleLastPage: b,
96
- handleCancelSelfOnboarding: x,
97
- handleItemsPerPageChange: _,
92
+ totalCount: _,
93
+ handleFirstPage: S,
94
+ handlePreviousPage: w,
95
+ handleNextPage: b,
96
+ handleLastPage: x,
97
+ handleCancelSelfOnboarding: C,
98
+ handleItemsPerPageChange: M,
98
99
  handleSkip: () => {
99
100
  a(s.EMPLOYEE_ONBOARDING_DONE);
100
101
  },
101
102
  itemsPerPage: u,
102
- isFetching: O
103
+ isFetching: D
103
104
  },
104
- children: l || /* @__PURE__ */ C(H, { flexDirection: "column", children: [
105
- /* @__PURE__ */ o(K, {}),
105
+ children: E || /* @__PURE__ */ G(V, { flexDirection: "column", children: [
106
106
  /* @__PURE__ */ o(Q, {}),
107
- /* @__PURE__ */ o(k, {})
107
+ /* @__PURE__ */ o(X, {}),
108
+ /* @__PURE__ */ o(q, {})
108
109
  ] })
109
110
  }
110
111
  ) });
111
112
  }
112
- const Ne = () => {
113
- const { companyId: n, onEvent: m } = X();
114
- 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 });
115
116
  };
116
117
  export {
117
- Z as EmployeeList,
118
- Ne as EmployeeListContextual
118
+ $ as EmployeeList,
119
+ Ae as EmployeeListContextual
119
120
  };
120
121
  //# sourceMappingURL=EmployeeList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmployeeList.js","sources":["../../../../src/components/Employee/EmployeeList/EmployeeList.tsx"],"sourcesContent":["import { useState } from 'react'\nimport { useEmployeesList } from '@gusto/embedded-api/react-query/employeesList'\nimport type { OnboardingStatus } from '@gusto/embedded-api/models/operations/putv1employeesemployeeidonboardingstatus'\nimport { useEmployeesDeleteMutation } from '@gusto/embedded-api/react-query/employeesDelete'\nimport { useEmployeesUpdateOnboardingStatusMutation } from '@gusto/embedded-api/react-query/employeesUpdateOnboardingStatus'\nimport { keepPreviousData } from '@tanstack/react-query'\nimport type { OnboardingContextInterface } from '../OnboardingFlow/OnboardingFlowComponents'\nimport { EmployeeListProvider } from './useEmployeeList'\nimport { Actions } from './Actions'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { Flex, Loading } from '@/components/Common'\nimport { useI18n, useComponentDictionary } from '@/i18n'\nimport { componentEvents, EmployeeOnboardingStatus } from '@/shared/constants'\nimport { Head } from '@/components/Employee/EmployeeList/Head'\nimport { List } from '@/components/Employee/EmployeeList/List'\nimport { useFlow } from '@/components/Flow/useFlow'\nimport type { PaginationItemsPerPage } from '@/components/Common/PaginationControl/PaginationControlTypes'\n\n//Interface for component specific props\ninterface EmployeeListProps extends CommonComponentInterface<'Employee.EmployeeList'> {\n companyId: string\n}\n\nexport function EmployeeList(props: EmployeeListProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\nfunction Root({ companyId, className, children, dictionary }: EmployeeListProps) {\n //Using i18n hook to directly load necessary namespace\n useI18n('Employee.EmployeeList')\n useComponentDictionary('Employee.EmployeeList', dictionary)\n //Getting props from base context\n const { onEvent, baseSubmitHandler } = useBase()\n const [currentPage, setCurrentPage] = useState(1)\n const [itemsPerPage, setItemsPerPage] = useState<PaginationItemsPerPage>(5)\n\n const { data, fetchStatus, isFetching } = useEmployeesList(\n {\n companyId,\n page: currentPage,\n per: itemsPerPage,\n },\n { placeholderData: keepPreviousData },\n )\n\n const { mutateAsync: deleteEmployeeMutation } = useEmployeesDeleteMutation()\n const { mutateAsync: updateEmployeeOnboardingStatusMutation } =\n useEmployeesUpdateOnboardingStatusMutation()\n\n if (fetchStatus === 'fetching' && !data) {\n return <Loading />\n }\n const { httpMeta, showEmployees: employeeList } = data!\n const employees = employeeList!\n\n const totalPages = Number(httpMeta.response.headers.get('x-total-pages') ?? 1)\n\n const handleItemsPerPageChange = (newCount: PaginationItemsPerPage) => {\n setItemsPerPage(newCount)\n }\n const handleFirstPage = () => {\n setCurrentPage(1)\n }\n const handlePreviousPage = () => {\n setCurrentPage(prevPage => Math.max(prevPage - 1, 1))\n }\n const handleNextPage = () => {\n setCurrentPage(prevPage => Math.min(prevPage + 1, totalPages))\n }\n const handleLastPage = () => {\n setCurrentPage(totalPages)\n }\n const handleDelete = async (uuid: string) => {\n await baseSubmitHandler(uuid, async payload => {\n await deleteEmployeeMutation({\n request: { employeeId: payload },\n })\n\n onEvent(componentEvents.EMPLOYEE_DELETED, { employeeId: payload })\n })\n }\n /**Set onboarding status to self_onboarding_awaiting_admin_review and proceed to edit */\n const handleReview = async (data: string) => {\n await baseSubmitHandler(data, async employeeId => {\n await updateOnboardingStatus({\n employeeId,\n status: EmployeeOnboardingStatus.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW,\n })\n onEvent(componentEvents.EMPLOYEE_UPDATE, {\n employeeId,\n onboardingStatus: EmployeeOnboardingStatus.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW,\n })\n })\n }\n /**Update employee onboarding status reverting it back to admin_onboarding_incomplete */\n const handleCancelSelfOnboarding = async (data: string) => {\n await baseSubmitHandler(data, async employeeId => {\n await updateOnboardingStatus({\n employeeId,\n status: EmployeeOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE,\n })\n })\n }\n const updateOnboardingStatus = async (data: { employeeId: string; status: OnboardingStatus }) => {\n await baseSubmitHandler(data, async ({ employeeId, status }) => {\n const { employeeOnboardingStatus: responseData } =\n await updateEmployeeOnboardingStatusMutation({\n request: { employeeId, requestBody: { onboardingStatus: status } },\n })\n onEvent(componentEvents.EMPLOYEE_ONBOARDING_STATUS_UPDATED, responseData)\n })\n }\n const handleNew = () => {\n onEvent(componentEvents.EMPLOYEE_CREATE)\n }\n const handleSkip = () => {\n onEvent(componentEvents.EMPLOYEE_ONBOARDING_DONE)\n }\n\n const handleEdit = (uuid: string, onboardingStatus?: OnboardingStatus) => {\n onEvent(componentEvents.EMPLOYEE_UPDATE, { employeeId: uuid, onboardingStatus })\n }\n return (\n <section className={className}>\n <EmployeeListProvider\n value={{\n handleEdit,\n handleNew,\n handleReview,\n handleDelete,\n employees,\n currentPage,\n totalPages,\n handleFirstPage,\n handlePreviousPage,\n handleNextPage,\n handleLastPage,\n handleCancelSelfOnboarding,\n handleItemsPerPageChange,\n handleSkip,\n itemsPerPage,\n isFetching,\n }}\n >\n {children ? (\n children\n ) : (\n <Flex flexDirection=\"column\">\n <Head />\n <List />\n <Actions />\n </Flex>\n )}\n </EmployeeListProvider>\n </section>\n )\n}\n\n/**\n * Wrapper used inside Flows -> exposes flow context for required parameters\n */\nexport const EmployeeListContextual = () => {\n const { companyId, onEvent } = useFlow<OnboardingContextInterface>()\n return <EmployeeList companyId={companyId} onEvent={onEvent} />\n}\n"],"names":["EmployeeList","props","jsx","BaseComponent","Root","companyId","className","children","dictionary","useI18n","useComponentDictionary","onEvent","baseSubmitHandler","useBase","currentPage","setCurrentPage","useState","itemsPerPage","setItemsPerPage","data","fetchStatus","isFetching","useEmployeesList","keepPreviousData","deleteEmployeeMutation","useEmployeesDeleteMutation","updateEmployeeOnboardingStatusMutation","useEmployeesUpdateOnboardingStatusMutation","Loading","httpMeta","employeeList","employees","totalPages","handleItemsPerPageChange","newCount","handleFirstPage","handlePreviousPage","prevPage","handleNextPage","handleLastPage","handleDelete","uuid","payload","componentEvents","handleReview","employeeId","updateOnboardingStatus","EmployeeOnboardingStatus","handleCancelSelfOnboarding","status","responseData","EmployeeListProvider","onboardingStatus","jsxs","Flex","Head","List","Actions","EmployeeListContextual","useFlow"],"mappings":";;;;;;;;;;;;;;;;;;;;AA4BO,SAASA,EAAaC,GAAmD;AAC9E,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACn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AAA,QAcQ,cAAAC;AAAA,QACA,cAAAJ;AAAA,QACA,WAAAT;AAAA,QACA,aAAAjB;AAAA,QACA,YAAAkB;AAAA,QACA,iBAAAG;AAAA,QACA,oBAAAC;AAAA,QACA,gBAAAE;AAAA,QACA,gBAAAC;AAAA,QACA,4BAAAS;AAAA,QACA,0BAAAf;AAAA,QACA,YAxBW,MAAM;AACvB,UAAAtB,EAAQgC,EAAgB,wBAAwB;AAAA,QAClD;AAAA,QAuBQ,cAAA1B;AAAA,QACA,YAAAI;AAAA,MAAA;AAAA,MAGD,UAAAd,KAGC,gBAAA8C,EAACC,GAAA,EAAK,eAAc,UAClB,UAAA;AAAA,QAAA,gBAAApD,EAACqD,GAAA,EAAK;AAAA,0BACLC,GAAA,EAAK;AAAA,0BACLC,GAAA,CAAA,CAAQ;AAAA,MAAA,EAAA,CACX;AAAA,IAAA;AAAA,EAAA,GAGN;AAEJ;AAKO,MAAMC,KAAyB,MAAM;AAC1C,QAAM,EAAE,WAAArD,GAAW,SAAAM,EAAA,IAAYgD,EAAA;AAC/B,SAAO,gBAAAzD,EAACF,GAAA,EAAa,WAAAK,GAAsB,SAAAM,EAAA,CAAkB;AAC/D;"}
1
+ {"version":3,"file":"EmployeeList.js","sources":["../../../../src/components/Employee/EmployeeList/EmployeeList.tsx"],"sourcesContent":["import { useState } from 'react'\nimport { useEmployeesList } from '@gusto/embedded-api/react-query/employeesList'\nimport type { OnboardingStatus } from '@gusto/embedded-api/models/operations/putv1employeesemployeeidonboardingstatus'\nimport { useEmployeesDeleteMutation } from '@gusto/embedded-api/react-query/employeesDelete'\nimport { useEmployeesUpdateOnboardingStatusMutation } from '@gusto/embedded-api/react-query/employeesUpdateOnboardingStatus'\nimport { keepPreviousData } from '@tanstack/react-query'\nimport type { OnboardingContextInterface } from '../OnboardingFlow/OnboardingFlowComponents'\nimport { EmployeeListProvider } from './useEmployeeList'\nimport { Actions } from './Actions'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { Flex, Loading } from '@/components/Common'\nimport { useI18n, useComponentDictionary } from '@/i18n'\nimport { componentEvents, EmployeeOnboardingStatus } from '@/shared/constants'\nimport { Head } from '@/components/Employee/EmployeeList/Head'\nimport { List } from '@/components/Employee/EmployeeList/List'\nimport { useFlow } from '@/components/Flow/useFlow'\nimport type { PaginationItemsPerPage } from '@/components/Common/PaginationControl/PaginationControlTypes'\n\n//Interface for component specific props\ninterface EmployeeListProps extends CommonComponentInterface<'Employee.EmployeeList'> {\n companyId: string\n}\n\nexport function EmployeeList(props: EmployeeListProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\nfunction Root({ companyId, className, children, dictionary }: EmployeeListProps) {\n //Using i18n hook to directly load necessary namespace\n useI18n('Employee.EmployeeList')\n useComponentDictionary('Employee.EmployeeList', dictionary)\n //Getting props from base context\n const { onEvent, baseSubmitHandler } = useBase()\n const [currentPage, setCurrentPage] = useState(1)\n const [itemsPerPage, setItemsPerPage] = useState<PaginationItemsPerPage>(5)\n\n const { data, fetchStatus, isFetching } = useEmployeesList(\n {\n companyId,\n page: currentPage,\n per: itemsPerPage,\n },\n { placeholderData: keepPreviousData },\n )\n\n const { mutateAsync: deleteEmployeeMutation } = useEmployeesDeleteMutation()\n const { mutateAsync: updateEmployeeOnboardingStatusMutation } =\n useEmployeesUpdateOnboardingStatusMutation()\n\n if (fetchStatus === 'fetching' && !data) {\n return <Loading />\n }\n const { httpMeta, showEmployees: employeeList } = data!\n const employees = employeeList!\n\n const totalPages = Number(httpMeta.response.headers.get('x-total-pages') ?? 1)\n const totalCount = Number(httpMeta.response.headers.get('x-total-count') ?? 0)\n\n const handleItemsPerPageChange = (newCount: PaginationItemsPerPage) => {\n setItemsPerPage(newCount)\n }\n const handleFirstPage = () => {\n setCurrentPage(1)\n }\n const handlePreviousPage = () => {\n setCurrentPage(prevPage => Math.max(prevPage - 1, 1))\n }\n const handleNextPage = () => {\n setCurrentPage(prevPage => Math.min(prevPage + 1, totalPages))\n }\n const handleLastPage = () => {\n setCurrentPage(totalPages)\n }\n const handleDelete = async (uuid: string) => {\n await baseSubmitHandler(uuid, async payload => {\n await deleteEmployeeMutation({\n request: { employeeId: payload },\n })\n\n onEvent(componentEvents.EMPLOYEE_DELETED, { employeeId: payload })\n })\n }\n /**Set onboarding status to self_onboarding_awaiting_admin_review and proceed to edit */\n const handleReview = async (data: string) => {\n await baseSubmitHandler(data, async employeeId => {\n await updateOnboardingStatus({\n employeeId,\n status: EmployeeOnboardingStatus.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW,\n })\n onEvent(componentEvents.EMPLOYEE_UPDATE, {\n employeeId,\n onboardingStatus: EmployeeOnboardingStatus.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW,\n })\n })\n }\n /**Update employee onboarding status reverting it back to admin_onboarding_incomplete */\n const handleCancelSelfOnboarding = async (data: string) => {\n await baseSubmitHandler(data, async employeeId => {\n await updateOnboardingStatus({\n employeeId,\n status: EmployeeOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE,\n })\n })\n }\n const updateOnboardingStatus = async (data: { employeeId: string; status: OnboardingStatus }) => {\n await baseSubmitHandler(data, async ({ employeeId, status }) => {\n const { employeeOnboardingStatus: responseData } =\n await updateEmployeeOnboardingStatusMutation({\n request: { employeeId, requestBody: { onboardingStatus: status } },\n })\n onEvent(componentEvents.EMPLOYEE_ONBOARDING_STATUS_UPDATED, responseData)\n })\n }\n const handleNew = () => {\n onEvent(componentEvents.EMPLOYEE_CREATE)\n }\n const handleSkip = () => {\n onEvent(componentEvents.EMPLOYEE_ONBOARDING_DONE)\n }\n\n const handleEdit = (uuid: string, onboardingStatus?: OnboardingStatus) => {\n onEvent(componentEvents.EMPLOYEE_UPDATE, { employeeId: uuid, onboardingStatus })\n }\n return (\n <section className={className}>\n <EmployeeListProvider\n value={{\n handleEdit,\n handleNew,\n handleReview,\n handleDelete,\n employees,\n currentPage,\n totalPages,\n totalCount,\n handleFirstPage,\n handlePreviousPage,\n handleNextPage,\n handleLastPage,\n handleCancelSelfOnboarding,\n handleItemsPerPageChange,\n handleSkip,\n itemsPerPage,\n isFetching,\n }}\n >\n {children ? (\n children\n ) : (\n <Flex flexDirection=\"column\">\n <Head />\n <List />\n <Actions />\n </Flex>\n )}\n </EmployeeListProvider>\n </section>\n )\n}\n\n/**\n * Wrapper used inside Flows -> exposes flow context for required parameters\n */\nexport const EmployeeListContextual = () => {\n const { companyId, onEvent } = useFlow<OnboardingContextInterface>()\n return <EmployeeList companyId={companyId} onEvent={onEvent} />\n}\n"],"names":["EmployeeList","props","jsx","BaseComponent","Root","companyId","className","children","dictionary","useI18n","useComponentDictionary","onEvent","baseSubmitHandler","useBase","currentPage","setCurrentPage","useState","itemsPerPage","setItemsPerPage","data","fetchStatus","isFetching","useEmployeesList","keepPreviousData","deleteEmployeeMutation","useEmployeesDeleteMutation","updateEmployeeOnboardingStatusMutation","useEmployeesUpdateOnboardingStatusMutation","Loading","httpMeta","employeeList","employees","totalPages","totalCount","handleItemsPerPageChange","newCount","handleFirstPage","handlePreviousPage","prevPage","handleNextPage","handleLastPage","handleDelete","uuid","payload","componentEvents","handleReview","employeeId","updateOnboardingStatus","EmployeeOnboardingStatus","handleCancelSelfOnboarding","status","responseData","EmployeeListProvider","onboardingStatus","jsxs","Flex","Head","List","Actions","EmployeeListContextual","useFlow"],"mappings":";;;;;;;;;;;;;;;;;;;;AA4BO,SAASA,EAAaC,GAAmD;AAC9E,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,MAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AACA,SAASG,GAAK,EAAE,WAAAC,GAAW,WAAAC,GAAW,UAAAC,GAAU,YAAAC,KAAiC;AAE/E,EAAAC,EAAQ,uBAAuB,GAC/BC,EA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A,QACA,aAAAjB;AAAA,QACA,YAAAkB;AAAA,QACA,YAAAC;AAAA,QACA,iBAAAG;AAAA,QACA,oBAAAC;AAAA,QACA,gBAAAE;AAAA,QACA,gBAAAC;AAAA,QACA,4BAAAS;AAAA,QACA,0BAAAf;AAAA,QACA,YAzBW,MAAM;AACvB,UAAAvB,EAAQiC,EAAgB,wBAAwB;AAAA,QAClD;AAAA,QAwBQ,cAAA3B;AAAA,QACA,YAAAI;AAAA,MAAA;AAAA,MAGD,UAAAd,KAGC,gBAAA+C,EAACC,GAAA,EAAK,eAAc,UAClB,UAAA;AAAA,QAAA,gBAAArD,EAACsD,GAAA,EAAK;AAAA,0BACLC,GAAA,EAAK;AAAA,0BACLC,GAAA,CAAA,CAAQ;AAAA,MAAA,EAAA,CACX;AAAA,IAAA;AAAA,EAAA,GAGN;AAEJ;AAKO,MAAMC,KAAyB,MAAM;AAC1C,QAAM,EAAE,WAAAtD,GAAW,SAAAM,EAAA,IAAYiD,EAAA;AAC/B,SAAO,gBAAA1D,EAACF,GAAA,EAAa,WAAAK,GAAsB,SAAAM,EAAA,CAAkB;AAC/D;"}
@@ -1,21 +1,21 @@
1
- import { jsx as e, jsxs as c, Fragment as w } from "react/jsx-runtime";
2
- import { useTranslation as A } from "react-i18next";
3
- import { useState as T } from "react";
4
- import B from "./List.module.scss.js";
5
- import { useEmployeeList as M } from "./useEmployeeList.js";
6
- import { EmployeeOnboardingStatus as i, EmployeeSelfOnboardingStatuses as y } from "../../../shared/constants.js";
1
+ import { jsx as e, jsxs as c, Fragment as A } from "react/jsx-runtime";
2
+ import { useTranslation as T } from "react-i18next";
3
+ import { useState as B } from "react";
4
+ import M from "./List.module.scss.js";
5
+ import { useEmployeeList as y } from "./useEmployeeList.js";
6
+ import { EmployeeOnboardingStatus as i, EmployeeSelfOnboardingStatuses as G } from "../../../shared/constants.js";
7
7
  import "classnames";
8
- import { EmptyData as G } from "../../Common/EmptyData/EmptyData.js";
8
+ import { EmptyData as R } from "../../Common/EmptyData/EmptyData.js";
9
9
  import { ActionsLayout as h } from "../../Common/ActionsLayout/ActionsLayout.js";
10
- import { HamburgerMenu as R } from "../../Common/HamburgerMenu/HamburgerMenu.js";
11
- import { useComponentContext as F } from "../../../contexts/ComponentAdapter/useComponentContext.js";
12
- import { EmployeeOnboardingStatusBadge as x } from "../../Common/OnboardingStatusBadge/index.js";
10
+ import { HamburgerMenu as F } from "../../Common/HamburgerMenu/HamburgerMenu.js";
11
+ import { useComponentContext as x } from "../../../contexts/ComponentAdapter/useComponentContext.js";
12
+ import { EmployeeOnboardingStatusBadge as V } from "../../Common/OnboardingStatusBadge/index.js";
13
13
  import s from "../../../assets/icons/pencil.svg.js";
14
- import V from "../../../assets/icons/trashcan.svg.js";
15
- import { firstLastName as j } from "../../../helpers/formattedStrings.js";
16
- import { useDataView as W } from "../../Common/DataView/useDataView.js";
17
- import { DataView as Y } from "../../Common/DataView/DataView.js";
18
- const st = () => {
14
+ import j from "../../../assets/icons/trashcan.svg.js";
15
+ import { firstLastName as W } from "../../../helpers/formattedStrings.js";
16
+ import { useDataView as Y } from "../../Common/DataView/useDataView.js";
17
+ import { DataView as H } from "../../Common/DataView/DataView.js";
18
+ const dt = () => {
19
19
  const {
20
20
  handleDelete: g,
21
21
  employees: d,
@@ -30,16 +30,17 @@ const st = () => {
30
30
  handleItemsPerPageChange: L,
31
31
  currentPage: O,
32
32
  totalPages: P,
33
- itemsPerPage: D,
34
- handleSkip: I,
35
- isFetching: _
36
- } = M(), r = F(), { t: a } = A("Employee.EmployeeList"), [v, u] = T(/* @__PURE__ */ new Set()), { ...k } = W({
33
+ totalCount: D,
34
+ itemsPerPage: I,
35
+ handleSkip: _,
36
+ isFetching: v
37
+ } = y(), r = x(), { t: a } = T("Employee.EmployeeList"), [k, u] = B(/* @__PURE__ */ new Set()), { ...w } = Y({
37
38
  data: d,
38
39
  columns: [
39
40
  {
40
41
  key: "name",
41
42
  title: a("nameLabel"),
42
- render: (t) => j({
43
+ render: (t) => W({
43
44
  first_name: t.firstName,
44
45
  last_name: t.lastName
45
46
  })
@@ -48,7 +49,7 @@ const st = () => {
48
49
  key: "status",
49
50
  title: a("statusLabel"),
50
51
  render: ({ onboarded: t, onboardingStatus: n }) => /* @__PURE__ */ e(
51
- x,
52
+ V,
52
53
  {
53
54
  onboarded: t,
54
55
  onboardingStatus: n
@@ -64,7 +65,7 @@ const st = () => {
64
65
  p(t.uuid, t.onboardingStatus ?? void 0);
65
66
  },
66
67
  icon: /* @__PURE__ */ e(s, { "aria-hidden": !0 })
67
- }), y.has(t.onboardingStatus ?? "") && n.push({
68
+ }), G.has(t.onboardingStatus ?? "") && n.push({
68
69
  label: a("cancelSelfOnboardingCta"),
69
70
  onClick: async () => {
70
71
  await b(t.uuid);
@@ -86,17 +87,17 @@ const st = () => {
86
87
  });
87
88
  });
88
89
  },
89
- icon: /* @__PURE__ */ e(V, { "aria-hidden": !0 })
90
+ icon: /* @__PURE__ */ e(j, { "aria-hidden": !0 })
90
91
  }), /* @__PURE__ */ e(
91
- R,
92
+ F,
92
93
  {
93
94
  items: n,
94
95
  triggerLabel: a("hamburgerTitle"),
95
- isLoading: v.has(t.uuid)
96
+ isLoading: k.has(t.uuid)
96
97
  }
97
98
  );
98
99
  },
99
- isFetching: _,
100
+ isFetching: v,
100
101
  pagination: {
101
102
  handleNextPage: C,
102
103
  handleFirstPage: E,
@@ -105,19 +106,20 @@ const st = () => {
105
106
  handleItemsPerPageChange: L,
106
107
  currentPage: O,
107
108
  totalPages: P,
108
- itemsPerPage: D
109
+ totalCount: D,
110
+ itemsPerPage: I
109
111
  },
110
- emptyState: () => /* @__PURE__ */ e(G, { title: a("emptyTableTitle"), description: a("emptyTableDescription"), children: /* @__PURE__ */ c(h, { justifyContent: "center", children: [
111
- /* @__PURE__ */ e(r.Button, { variant: "secondary", onClick: I, children: a("skipCta") }),
112
+ emptyState: () => /* @__PURE__ */ e(R, { title: a("emptyTableTitle"), description: a("emptyTableDescription"), children: /* @__PURE__ */ c(h, { justifyContent: "center", children: [
113
+ /* @__PURE__ */ e(r.Button, { variant: "secondary", onClick: _, children: a("skipCta") }),
112
114
  /* @__PURE__ */ e(r.Button, { variant: "primary", onClick: l, children: a("addEmployeeCta") })
113
115
  ] }) })
114
116
  });
115
- return /* @__PURE__ */ c(w, { children: [
117
+ return /* @__PURE__ */ c(A, { children: [
116
118
  d.length > 0 && /* @__PURE__ */ e(h, { children: /* @__PURE__ */ e(r.Button, { variant: "secondary", onClick: l, children: a("addAnotherCta") }) }),
117
- /* @__PURE__ */ e("div", { className: B.container, children: /* @__PURE__ */ e(Y, { label: a("employeeListLabel"), ...k }) })
119
+ /* @__PURE__ */ e("div", { className: M.container, children: /* @__PURE__ */ e(H, { label: a("employeeListLabel"), ...w }) })
118
120
  ] });
119
121
  };
120
122
  export {
121
- st as List
123
+ dt as List
122
124
  };
123
125
  //# sourceMappingURL=List.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"List.js","sources":["../../../../src/components/Employee/EmployeeList/List.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useState } from 'react'\nimport style from './List.module.scss'\nimport { useEmployeeList } from './useEmployeeList'\nimport { DataView, EmptyData, ActionsLayout, useDataView } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport { EmployeeOnboardingStatusBadge } from '@/components/Common/OnboardingStatusBadge'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\nimport { EmployeeOnboardingStatus, EmployeeSelfOnboardingStatuses } from '@/shared/constants'\nimport { firstLastName } from '@/helpers/formattedStrings'\n\n/**List of employees slot for EmployeeList component */\nexport const List = () => {\n const {\n handleDelete,\n employees,\n handleEdit,\n handleReview,\n handleNew,\n handleCancelSelfOnboarding,\n handleFirstPage,\n handlePreviousPage,\n handleNextPage,\n handleLastPage,\n handleItemsPerPageChange,\n currentPage,\n totalPages,\n itemsPerPage,\n handleSkip,\n isFetching,\n } = useEmployeeList()\n const Components = useComponentContext()\n\n const { t } = useTranslation('Employee.EmployeeList')\n const [deleting, setDeleting] = useState<Set<string>>(new Set())\n const { ...dataViewProps } = useDataView({\n data: employees,\n columns: [\n {\n key: 'name',\n title: t('nameLabel'),\n render: employee => {\n return firstLastName({\n first_name: employee.firstName,\n last_name: employee.lastName,\n })\n },\n },\n {\n key: 'status',\n title: t('statusLabel'),\n render: ({ onboarded, onboardingStatus }) => (\n <EmployeeOnboardingStatusBadge\n onboarded={onboarded}\n onboardingStatus={onboardingStatus}\n />\n ),\n },\n ],\n itemMenu: employee => {\n const menuItems = []\n\n // Edit item\n if (\n employee.onboardingStatus === EmployeeOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE ||\n employee.onboardingStatus === EmployeeOnboardingStatus.SELF_ONBOARDING_PENDING_INVITE ||\n employee.onboardingStatus ===\n EmployeeOnboardingStatus.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW ||\n employee.onboardingStatus === EmployeeOnboardingStatus.ONBOARDING_COMPLETED\n ) {\n menuItems.push({\n label: t('editCta'),\n onClick: () => {\n handleEdit(employee.uuid, employee.onboardingStatus ?? undefined)\n },\n icon: <PencilSvg aria-hidden />,\n })\n }\n\n // Cancel self onboarding item\n /* @ts-expect-error: onboarding_status during runtime can be one of self onboarding statuses */\n if (EmployeeSelfOnboardingStatuses.has(employee.onboardingStatus ?? '')) {\n menuItems.push({\n label: t('cancelSelfOnboardingCta'),\n onClick: async () => {\n await handleCancelSelfOnboarding(employee.uuid)\n },\n icon: <PencilSvg aria-hidden />,\n })\n }\n\n // Review item\n if (\n employee.onboardingStatus === EmployeeOnboardingStatus.SELF_ONBOARDING_COMPLETED_BY_EMPLOYEE\n ) {\n menuItems.push({\n label: t('reviewCta'),\n onClick: () => {\n void handleReview(employee.uuid)\n },\n icon: <PencilSvg aria-hidden />,\n })\n }\n\n // Delete item\n if (!employee.onboarded) {\n menuItems.push({\n label: t('deleteCta'),\n onClick: () => {\n setDeleting(prev => new Set(prev).add(employee.uuid))\n void handleDelete(employee.uuid).then(() => {\n setDeleting(prev => {\n const newSet = new Set(prev)\n newSet.delete(employee.uuid)\n return newSet\n })\n })\n },\n icon: <TrashCanSvg aria-hidden />,\n })\n }\n\n return (\n <HamburgerMenu\n items={menuItems}\n triggerLabel={t('hamburgerTitle')}\n isLoading={deleting.has(employee.uuid)}\n />\n )\n },\n isFetching,\n pagination: {\n handleNextPage,\n handleFirstPage,\n handleLastPage,\n handlePreviousPage,\n handleItemsPerPageChange,\n currentPage,\n totalPages,\n itemsPerPage,\n },\n emptyState: () => (\n <EmptyData title={t('emptyTableTitle')} description={t('emptyTableDescription')}>\n <ActionsLayout justifyContent=\"center\">\n <Components.Button variant=\"secondary\" onClick={handleSkip}>\n {t('skipCta')}\n </Components.Button>\n <Components.Button variant=\"primary\" onClick={handleNew}>\n {t('addEmployeeCta')}\n </Components.Button>\n </ActionsLayout>\n </EmptyData>\n ),\n })\n return (\n <>\n {employees.length > 0 && (\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleNew}>\n {t('addAnotherCta')}\n </Components.Button>\n </ActionsLayout>\n )}\n <div className={style.container}>\n <DataView label={t('employeeListLabel')} {...dataViewProps} />\n </div>\n </>\n )\n}\n"],"names":["List","handleDelete","employees","handleEdit","handleReview","handleNew","handleCancelSelfOnboarding","handleFirstPage","handlePreviousPage","handleNextPage","handleLastPage","handleItemsPerPageChange","currentPage","totalPages","itemsPerPage","handleSkip","isFetching","useEmployeeList","Components","useComponentContext","t","useTranslation","deleting","setDeleting","useState","dataViewProps","useDataView","employee","firstLastName","onboarded","onboardingStatus","jsx","EmployeeOnboardingStatusBadge","menuItems","EmployeeOnboardingStatus","PencilSvg","EmployeeSelfOnboardingStatuses","prev","newSet","TrashCanSvg","HamburgerMenu","EmptyData","jsxs","ActionsLayout","Fragment","style","DataView"],"mappings":";;;;;;;;;;;;;;;;;AAcO,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AAA;AAAA,IAG3C;AAAA,IACA,YAAAX;AAAA,IACA,YAAY;AAAA,MACV,gBAAAP;AAAA,MACA,iBAAAF;AAAA,MACA,gBAAAG;AAAA,MACA,oBAAAF;AAAA,MACA,0BAAAG;AAAA,MACA,aAAAC;AAAA,MACA,YAAAC;AAAA,MACA,cAAAC;AAAA,IAAA;AAAA,IAEF,YAAY,MACV,gBAAAiB,EAACU,GAAA,EAAU,OAAOrB,EAAE,iBAAiB,GAAG,aAAaA,EAAE,uBAAuB,GAC5E,UAAA,gBAAAsB,EAACC,GAAA,EAAc,gBAAe,UAC5B,UAAA;AAAA,MAAA,gBAAAZ,EAACb,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASH,GAC7C,UAAAK,EAAE,SAAS,EAAA,CACd;AAAA,MACA,gBAAAW,EAACb,EAAW,QAAX,EAAkB,SAAQ,WAAU,SAASb,GAC3C,UAAAe,EAAE,gBAAgB,EAAA,CACrB;AAAA,IAAA,EAAA,CACF,EAAA,CACF;AAAA,EAAA,CAEH;AACD,SACE,gBAAAsB,EAAAE,GAAA,EACG,UAAA;AAAA,IAAA1C,EAAU,SAAS,KAClB,gBAAA6B,EAACY,GAAA,EACC,4BAACzB,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASb,GAC7C,UAAAe,EAAE,eAAe,GACpB,GACF;AAAA,IAEF,gBAAAW,EAAC,OAAA,EAAI,WAAWc,EAAM,WACpB,UAAA,gBAAAd,EAACe,GAAA,EAAS,OAAO1B,EAAE,mBAAmB,GAAI,GAAGK,GAAe,EAAA,CAC9D;AAAA,EAAA,GACF;AAEJ;"}
1
+ {"version":3,"file":"List.js","sources":["../../../../src/components/Employee/EmployeeList/List.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useState } from 'react'\nimport style from './List.module.scss'\nimport { useEmployeeList } from './useEmployeeList'\nimport { DataView, EmptyData, ActionsLayout, useDataView } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport { EmployeeOnboardingStatusBadge } from '@/components/Common/OnboardingStatusBadge'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\nimport { EmployeeOnboardingStatus, EmployeeSelfOnboardingStatuses } from '@/shared/constants'\nimport { firstLastName } from '@/helpers/formattedStrings'\n\n/**List of employees slot for EmployeeList component */\nexport const List = () => {\n const {\n handleDelete,\n employees,\n handleEdit,\n handleReview,\n handleNew,\n handleCancelSelfOnboarding,\n handleFirstPage,\n handlePreviousPage,\n handleNextPage,\n handleLastPage,\n handleItemsPerPageChange,\n currentPage,\n totalPages,\n totalCount,\n itemsPerPage,\n handleSkip,\n isFetching,\n } = useEmployeeList()\n const Components = useComponentContext()\n\n const { t } = useTranslation('Employee.EmployeeList')\n const [deleting, setDeleting] = useState<Set<string>>(new Set())\n const { ...dataViewProps } = useDataView({\n data: employees,\n columns: [\n {\n key: 'name',\n title: t('nameLabel'),\n render: employee => {\n return firstLastName({\n first_name: employee.firstName,\n last_name: employee.lastName,\n })\n },\n },\n {\n key: 'status',\n title: t('statusLabel'),\n render: ({ onboarded, onboardingStatus }) => (\n <EmployeeOnboardingStatusBadge\n onboarded={onboarded}\n onboardingStatus={onboardingStatus}\n />\n ),\n },\n ],\n itemMenu: employee => {\n const menuItems = []\n\n // Edit item\n if (\n employee.onboardingStatus === EmployeeOnboardingStatus.ADMIN_ONBOARDING_INCOMPLETE ||\n employee.onboardingStatus === EmployeeOnboardingStatus.SELF_ONBOARDING_PENDING_INVITE ||\n employee.onboardingStatus ===\n EmployeeOnboardingStatus.SELF_ONBOARDING_AWAITING_ADMIN_REVIEW ||\n employee.onboardingStatus === EmployeeOnboardingStatus.ONBOARDING_COMPLETED\n ) {\n menuItems.push({\n label: t('editCta'),\n onClick: () => {\n handleEdit(employee.uuid, employee.onboardingStatus ?? undefined)\n },\n icon: <PencilSvg aria-hidden />,\n })\n }\n\n // Cancel self onboarding item\n /* @ts-expect-error: onboarding_status during runtime can be one of self onboarding statuses */\n if (EmployeeSelfOnboardingStatuses.has(employee.onboardingStatus ?? '')) {\n menuItems.push({\n label: t('cancelSelfOnboardingCta'),\n onClick: async () => {\n await handleCancelSelfOnboarding(employee.uuid)\n },\n icon: <PencilSvg aria-hidden />,\n })\n }\n\n // Review item\n if (\n employee.onboardingStatus === EmployeeOnboardingStatus.SELF_ONBOARDING_COMPLETED_BY_EMPLOYEE\n ) {\n menuItems.push({\n label: t('reviewCta'),\n onClick: () => {\n void handleReview(employee.uuid)\n },\n icon: <PencilSvg aria-hidden />,\n })\n }\n\n // Delete item\n if (!employee.onboarded) {\n menuItems.push({\n label: t('deleteCta'),\n onClick: () => {\n setDeleting(prev => new Set(prev).add(employee.uuid))\n void handleDelete(employee.uuid).then(() => {\n setDeleting(prev => {\n const newSet = new Set(prev)\n newSet.delete(employee.uuid)\n return newSet\n })\n })\n },\n icon: <TrashCanSvg aria-hidden />,\n })\n }\n\n return (\n <HamburgerMenu\n items={menuItems}\n triggerLabel={t('hamburgerTitle')}\n isLoading={deleting.has(employee.uuid)}\n />\n )\n },\n isFetching,\n pagination: {\n handleNextPage,\n handleFirstPage,\n handleLastPage,\n handlePreviousPage,\n handleItemsPerPageChange,\n currentPage,\n totalPages,\n totalCount,\n itemsPerPage,\n },\n emptyState: () => (\n <EmptyData title={t('emptyTableTitle')} description={t('emptyTableDescription')}>\n <ActionsLayout justifyContent=\"center\">\n <Components.Button variant=\"secondary\" onClick={handleSkip}>\n {t('skipCta')}\n </Components.Button>\n <Components.Button variant=\"primary\" onClick={handleNew}>\n {t('addEmployeeCta')}\n </Components.Button>\n </ActionsLayout>\n </EmptyData>\n ),\n })\n return (\n <>\n {employees.length > 0 && (\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleNew}>\n {t('addAnotherCta')}\n </Components.Button>\n </ActionsLayout>\n )}\n <div className={style.container}>\n <DataView label={t('employeeListLabel')} {...dataViewProps} />\n </div>\n </>\n )\n}\n"],"names":["List","handleDelete","employees","handleEdit","handleReview","handleNew","handleCancelSelfOnboarding","handleFirstPage","handlePreviousPage","handleNextPage","handleLastPage","handleItemsPerPageChange","currentPage","totalPages","totalCount","itemsPerPage","handleSkip","isFetching","useEmployeeList","Components","useComponentContext","t","useTranslation","deleting","setDeleting","useState","dataViewProps","useDataView","employee","firstLastName","onboarded","onboardingStatus","jsx","EmployeeOnboardingStatusBadge","menuItems","EmployeeOnboardingStatus","PencilSvg","EmployeeSelfOnboardingStatuses","prev","newSet","TrashCanSvg","HamburgerMenu","EmptyData","jsxs","ActionsLayout","Fragment","style","DataView"],"mappings":";;;;;;;;;;;;;;;;;AAcO,MAAMA,KAAO,MAAM;AACxB,QAAM;AAAA,IACJ,cAAAC;AAAA,IACA,WAAAC;AAAA,IACA,YAAAC;AAAA,IACA,cAAAC;AAAA,IACA,WAAAC;AAAA,IACA,4BAAAC;AAAA,IACA,iBAAAC;AAAA,IACA,oBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,gBAAAC;AAAA,IACA,0BAAAC;AAAA,IACA,aAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,cAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,EAAA,IACEC,EAAA,GACEC,IAAaC,EAAA,GAEb,EAAE,GAAAC,EAAA,IAAMC,EAAe,uBAAuB,GAC9C,CAACC,GAAUC,CAAW,IAAIC,EAAsB,oBAAI,KAAK,GACzD,EAAE,GAAGC,EAAA,IAAkBC,EAAY;AAAA,IACvC,MAAMzB;AAAA,IACN,SAAS;AAAA,MACP;AAAA,QACE,KAAK;AAAA,QACL,OAAOmB,EAAE,WAAW;AAAA,QACpB,QAAQ,CAAAO,MACCC,EAAc;AAAA,UACnB,YAAYD,EAAS;AAAA,UACrB,WAAWA,EAAS;AAAA,QAAA,CACrB;AAAA,MACH;AAAA,MAEF;AAAA,QACE,KAAK;AAAA,QACL,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,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASd,GAC7C,UAAAgB,EAAE,eAAe,GACpB,GACF;AAAA,IAEF,gBAAAW,EAAC,OAAA,EAAI,WAAWc,EAAM,WACpB,UAAA,gBAAAd,EAACe,GAAA,EAAS,OAAO1B,EAAE,mBAAmB,GAAI,GAAGK,GAAe,EAAA,CAC9D;AAAA,EAAA,GACF;AAEJ;"}
@@ -15,6 +15,7 @@ type EmployeeListContextType = {
15
15
  handleItemsPerPageChange: (newCount: PaginationItemsPerPage) => void;
16
16
  currentPage: number;
17
17
  totalPages: number;
18
+ totalCount: number;
18
19
  employees: Employee[];
19
20
  itemsPerPage: PaginationItemsPerPage;
20
21
  isFetching: boolean;
@@ -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 [L, c] = o("EmployeeListContext");
15
+ const [c, d] = o("EmployeeListContext");
15
16
  export {
16
- c as EmployeeListProvider,
17
- L as useEmployeeList
17
+ d as EmployeeListProvider,
18
+ c as useEmployeeList
18
19
  };
19
20
  //# sourceMappingURL=useEmployeeList.js.map