@gusto/embedded-react-sdk 0.11.3 → 0.12.1

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 (368) hide show
  1. package/CHANGELOG.md +181 -0
  2. package/dist/components/Base/Base.js +18 -19
  3. package/dist/components/Base/Base.js.map +1 -1
  4. package/dist/components/Common/DataView/DataCards/DataCards.module.scss.js +1 -1
  5. package/dist/components/Common/DocumentList/DocumentList.module.scss.js +1 -1
  6. package/dist/components/Common/DocumentViewer/DocumentViewer.module.scss.js +1 -1
  7. package/dist/components/Common/EmptyData/EmptyData.module.scss.js +1 -1
  8. package/dist/components/Common/FieldErrorMessage/FieldErrorMessage.module.scss.js +1 -1
  9. package/dist/components/Common/FieldLayout/FieldLayout.module.scss.js +6 -6
  10. package/dist/components/Common/Flex/Flex.d.ts +2 -2
  11. package/dist/components/Common/Flex/Flex.js +5 -5
  12. package/dist/components/Common/Flex/Flex.js.map +1 -1
  13. package/dist/components/Common/Form/Form.module.scss.js +2 -2
  14. package/dist/components/Common/Grid/Grid.d.ts +2 -2
  15. package/dist/components/Common/Grid/Grid.js +13 -13
  16. package/dist/components/Common/Grid/Grid.js.map +1 -1
  17. package/dist/components/Common/HorizontalFieldLayout/HorizontalFieldLayout.module.scss.js +12 -12
  18. package/dist/components/Common/InternalError/InternalError.module.scss.js +1 -1
  19. package/dist/components/Common/Loading/Loading.module.scss.js +1 -1
  20. package/dist/components/Common/PaginationControl/PaginationControl.module.scss.js +1 -1
  21. package/dist/components/Common/ReorderableList/ReorderableList.module.scss.js +15 -15
  22. package/dist/components/Common/RequirementsList/RequirementsList.module.scss.js +1 -1
  23. package/dist/components/Common/SignatureForm/SignatureForm.js +4 -6
  24. package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
  25. package/dist/components/Common/SignatureForm/SignatureForm.module.scss.js +6 -6
  26. package/dist/components/Common/SignatureForm/SignatureFormActions.js +10 -12
  27. package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
  28. package/dist/components/Common/SignatureForm/SignatureFormFields.js +6 -8
  29. package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
  30. package/dist/components/Common/UI/Alert/Alert.module.scss.js +1 -1
  31. package/dist/components/Common/UI/Badge/Badge.module.scss.js +1 -1
  32. package/dist/components/Common/UI/Button/Button.module.scss.js +1 -1
  33. package/dist/components/Common/UI/Button/ButtonIcon.module.scss.js +1 -1
  34. package/dist/components/Common/UI/CalendarPreview/CalendarPreview.module.scss.js +5 -5
  35. package/dist/components/Common/UI/Card/Card.module.scss.js +1 -1
  36. package/dist/components/Common/UI/Checkbox/Checkbox.module.scss.js +8 -8
  37. package/dist/components/Common/UI/CheckboxGroup/CheckboxGroup.module.scss.js +1 -1
  38. package/dist/components/Common/UI/ComboBox/ComboBox.module.scss.js +1 -1
  39. package/dist/components/Common/UI/DatePicker/DatePicker.module.scss.js +5 -5
  40. package/dist/components/Common/UI/Input/Input.module.scss.js +7 -7
  41. package/dist/components/Common/UI/Link/Link.module.scss.js +1 -1
  42. package/dist/components/Common/UI/List/List.module.scss.js +1 -1
  43. package/dist/components/Common/UI/Menu/Menu.module.scss.js +5 -5
  44. package/dist/components/Common/UI/NumberInput/NumberInput.js +36 -38
  45. package/dist/components/Common/UI/NumberInput/NumberInput.js.map +1 -1
  46. package/dist/components/Common/UI/ProgressBar/ProgressBar.d.ts +1 -1
  47. package/dist/components/Common/UI/ProgressBar/ProgressBar.js +19 -9
  48. package/dist/components/Common/UI/ProgressBar/ProgressBar.js.map +1 -1
  49. package/dist/components/Common/UI/ProgressBar/ProgressBar.module.scss.js +1 -1
  50. package/dist/components/Common/UI/ProgressBar/ProgressBarTypes.d.ts +4 -0
  51. package/dist/components/Common/UI/Radio/Radio.module.scss.js +1 -1
  52. package/dist/components/Common/UI/RadioGroup/RadioGroup.module.scss.js +1 -1
  53. package/dist/components/Common/UI/Select/Select.module.scss.js +1 -1
  54. package/dist/components/Common/UI/Switch/Switch.module.scss.js +4 -4
  55. package/dist/components/Common/UI/Table/Table.module.scss.js +1 -1
  56. package/dist/components/Common/UI/Text/Text.module.scss.js +14 -14
  57. package/dist/components/Company/AssignSignatory/AssignSignatory.js +2 -3
  58. package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
  59. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +6 -8
  60. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
  61. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +8 -10
  62. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
  63. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +11 -11
  64. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +1 -1
  65. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +6 -8
  66. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
  67. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +1 -1
  68. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +1 -1
  69. package/dist/components/Company/AssignSignatory/TitleSelect.js +7 -8
  70. package/dist/components/Company/AssignSignatory/TitleSelect.js.map +1 -1
  71. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +1 -1
  72. package/dist/components/Company/BankAccount/BankAccount.js +6 -6
  73. package/dist/components/Company/BankAccount/BankAccount.js.map +1 -1
  74. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +8 -9
  75. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
  76. package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js +7 -7
  77. package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js.map +1 -1
  78. package/dist/components/Company/BankAccount/BankAccountForm/Form.js +9 -11
  79. package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
  80. package/dist/components/Company/BankAccount/BankAccountForm/context.js +1 -1
  81. package/dist/components/Company/BankAccount/BankAccountList/Actions.js +10 -12
  82. package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
  83. package/dist/components/Company/BankAccount/BankAccountList/BankAccountList.js +3 -3
  84. package/dist/components/Company/BankAccount/BankAccountList/BankAccountList.js.map +1 -1
  85. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +11 -13
  86. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
  87. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +4 -6
  88. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
  89. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +5 -7
  90. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
  91. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +6 -7
  92. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  93. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +1 -1
  94. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +2 -3
  95. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  96. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +1 -1
  97. package/dist/components/Company/FederalTaxes/Actions.js +7 -9
  98. package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
  99. package/dist/components/Company/FederalTaxes/FederalTaxes.js +6 -7
  100. package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
  101. package/dist/components/Company/FederalTaxes/Form.js +3 -5
  102. package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
  103. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +1 -1
  104. package/dist/components/Company/Industry/Actions.js +5 -7
  105. package/dist/components/Company/Industry/Actions.js.map +1 -1
  106. package/dist/components/Company/Industry/Context.js +1 -1
  107. package/dist/components/Company/Industry/Edit.js +10 -12
  108. package/dist/components/Company/Industry/Edit.js.map +1 -1
  109. package/dist/components/Company/Locations/LocationForm/Actions.js +6 -8
  110. package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
  111. package/dist/components/Company/Locations/LocationForm/Form.js +1 -1
  112. package/dist/components/Company/Locations/LocationForm/LocationForm.js +3 -4
  113. package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
  114. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +1 -1
  115. package/dist/components/Company/Locations/LocationsList/Actions.js +6 -8
  116. package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
  117. package/dist/components/Company/Locations/LocationsList/List.js +2 -4
  118. package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
  119. package/dist/components/Company/Locations/LocationsList/LocationsList.js +8 -9
  120. package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
  121. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +1 -1
  122. package/dist/components/Company/OnboardingOverview/Completed.js +12 -14
  123. package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
  124. package/dist/components/Company/OnboardingOverview/MissingRequirements.js +6 -8
  125. package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
  126. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +2 -3
  127. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
  128. package/dist/components/Company/OnboardingOverview/context.js +1 -1
  129. package/dist/components/Company/PaySchedule/PaySchedule.js +3 -4
  130. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  131. package/dist/components/Company/PaySchedule/_parts/Actions.js +10 -12
  132. package/dist/components/Company/PaySchedule/_parts/Actions.js.map +1 -1
  133. package/dist/components/Company/PaySchedule/_parts/Edit.js +14 -14
  134. package/dist/components/Company/PaySchedule/_parts/Edit.module.scss.js +1 -1
  135. package/dist/components/Company/PaySchedule/_parts/Head.js +6 -8
  136. package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
  137. package/dist/components/Company/PaySchedule/_parts/List.js +13 -15
  138. package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
  139. package/dist/components/Company/PaySchedule/usePaySchedule.js +1 -1
  140. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +5 -7
  141. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
  142. package/dist/components/Company/StateTaxes/StateTaxesForm/Form.js +8 -8
  143. package/dist/components/Company/StateTaxes/StateTaxesForm/Form.js.map +1 -1
  144. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +1 -1
  145. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +6 -8
  146. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
  147. package/dist/components/Company/StateTaxes/StateTaxesList/List.js +5 -7
  148. package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
  149. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +1 -1
  150. package/dist/components/Contractor/Address/Address.js +4 -5
  151. package/dist/components/Contractor/Address/Address.js.map +1 -1
  152. package/dist/components/Contractor/Address/Form.js +1 -1
  153. package/dist/components/Contractor/Address/useAddress.js +1 -1
  154. package/dist/components/Contractor/ContractorList/index.d.ts +16 -0
  155. package/dist/components/Contractor/ContractorList/index.js +124 -0
  156. package/dist/components/Contractor/ContractorList/index.js.map +1 -0
  157. package/dist/components/Contractor/{List → ContractorList}/useContractorList.d.ts +1 -3
  158. package/dist/components/Contractor/{List → ContractorList}/useContractorList.js +9 -10
  159. package/dist/components/Contractor/ContractorList/useContractorList.js.map +1 -0
  160. package/dist/components/Contractor/NewHireReport/NewHireReport.js +16 -17
  161. package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
  162. package/dist/components/Contractor/OnboardingFlow/OnboardingFlow.d.ts +2 -0
  163. package/dist/components/Contractor/OnboardingFlow/OnboardingFlow.js +26 -0
  164. package/dist/components/Contractor/OnboardingFlow/OnboardingFlow.js.map +1 -0
  165. package/dist/components/Contractor/OnboardingFlow/OnboardingFlowComponents.d.ts +27 -0
  166. package/dist/components/Contractor/OnboardingFlow/OnboardingFlowComponents.js +91 -0
  167. package/dist/components/Contractor/OnboardingFlow/OnboardingFlowComponents.js.map +1 -0
  168. package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.d.ts +9 -0
  169. package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.js +137 -0
  170. package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.js.map +1 -0
  171. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +5 -7
  172. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -1
  173. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +2 -3
  174. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -1
  175. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +2 -3
  176. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js.map +1 -1
  177. package/dist/components/Contractor/Profile/ContractorProfile.js +38 -17
  178. package/dist/components/Contractor/Profile/ContractorProfile.js.map +1 -1
  179. package/dist/components/Contractor/Profile/ContractorProfileForm.d.ts +3 -1
  180. package/dist/components/Contractor/Profile/ContractorProfileForm.js +73 -74
  181. package/dist/components/Contractor/Profile/ContractorProfileForm.js.map +1 -1
  182. package/dist/components/Contractor/Profile/useContractorProfile.d.ts +29 -28
  183. package/dist/components/Contractor/Profile/useContractorProfile.js +158 -151
  184. package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
  185. package/dist/components/Contractor/Submit/Submit.d.ts +7 -0
  186. package/dist/components/Contractor/Submit/Submit.js +76 -0
  187. package/dist/components/Contractor/Submit/Submit.js.map +1 -0
  188. package/dist/components/Contractor/Submit/SubmitDone.js +11 -11
  189. package/dist/components/Contractor/Submit/SubmitDone.js.map +1 -1
  190. package/dist/components/Contractor/index.d.ts +3 -2
  191. package/dist/components/Contractor/index.js +10 -8
  192. package/dist/components/Contractor/index.js.map +1 -1
  193. package/dist/components/Employee/Compensation/Actions.js +5 -6
  194. package/dist/components/Employee/Compensation/Actions.js.map +1 -1
  195. package/dist/components/Employee/Compensation/Edit.js +14 -15
  196. package/dist/components/Employee/Compensation/Edit.js.map +1 -1
  197. package/dist/components/Employee/Compensation/List.js +23 -25
  198. package/dist/components/Employee/Compensation/List.js.map +1 -1
  199. package/dist/components/Employee/Deductions/Deductions.d.ts +8 -14
  200. package/dist/components/Employee/Deductions/Deductions.js +47 -140
  201. package/dist/components/Employee/Deductions/Deductions.js.map +1 -1
  202. package/dist/components/Employee/Deductions/DeductionsComponents.d.ts +23 -0
  203. package/dist/components/Employee/Deductions/DeductionsComponents.js +31 -0
  204. package/dist/components/Employee/Deductions/DeductionsComponents.js.map +1 -0
  205. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.d.ts +41 -0
  206. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js +134 -0
  207. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js.map +1 -0
  208. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.d.ts +6 -0
  209. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +98 -0
  210. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js.map +1 -0
  211. package/dist/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.d.ts +15 -0
  212. package/dist/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.js +48 -0
  213. package/dist/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.js.map +1 -0
  214. package/dist/components/Employee/Deductions/stateMachine.d.ts +7 -0
  215. package/dist/components/Employee/Deductions/stateMachine.js +107 -0
  216. package/dist/components/Employee/Deductions/stateMachine.js.map +1 -0
  217. package/dist/components/Employee/Deductions/useDeductions.d.ts +2 -2
  218. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +6 -8
  219. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
  220. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +6 -7
  221. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  222. package/dist/components/Employee/DocumentSigner/DocumentList/List.js +2 -4
  223. package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
  224. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +1 -1
  225. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +7 -8
  226. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  227. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +1 -1
  228. package/dist/components/Employee/EmployeeList/Actions.js +4 -6
  229. package/dist/components/Employee/EmployeeList/Actions.js.map +1 -1
  230. package/dist/components/Employee/EmployeeList/EmployeeList.js +3 -4
  231. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  232. package/dist/components/Employee/EmployeeList/Head.js +5 -7
  233. package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
  234. package/dist/components/Employee/EmployeeList/List.js +14 -15
  235. package/dist/components/Employee/EmployeeList/List.js.map +1 -1
  236. package/dist/components/Employee/EmployeeList/useEmployeeList.js +1 -1
  237. package/dist/components/Employee/Landing/Landing.js +12 -13
  238. package/dist/components/Employee/Landing/Landing.js.map +1 -1
  239. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +7 -7
  240. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.module.scss.js +6 -6
  241. package/dist/components/Employee/PaymentMethod/Actions.js +7 -9
  242. package/dist/components/Employee/PaymentMethod/Actions.js.map +1 -1
  243. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +5 -6
  244. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js.map +1 -1
  245. package/dist/components/Employee/PaymentMethod/BankAccountsList.js +8 -10
  246. package/dist/components/Employee/PaymentMethod/BankAccountsList.js.map +1 -1
  247. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +2 -3
  248. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +1 -1
  249. package/dist/components/Employee/PaymentMethod/Split.js +10 -11
  250. package/dist/components/Employee/PaymentMethod/Split.js.map +1 -1
  251. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +1 -1
  252. package/dist/components/Employee/Profile/Actions.js +7 -9
  253. package/dist/components/Employee/Profile/Actions.js.map +1 -1
  254. package/dist/components/Employee/Profile/AdminPersonalDetails.d.ts +6 -6
  255. package/dist/components/Employee/Profile/AdminPersonalDetails.js +9 -10
  256. package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
  257. package/dist/components/Employee/Profile/HomeAddress.js +1 -1
  258. package/dist/components/Employee/Profile/PersonalDetailsInputs.d.ts +2 -2
  259. package/dist/components/Employee/Profile/PersonalDetailsInputs.js +2 -2
  260. package/dist/components/Employee/Profile/useProfile.js +1 -1
  261. package/dist/components/Employee/Taxes/Actions.js +8 -10
  262. package/dist/components/Employee/Taxes/Actions.js.map +1 -1
  263. package/dist/components/Employee/Taxes/FederalForm.js +12 -14
  264. package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
  265. package/dist/components/Employee/Taxes/useTaxes.js +1 -1
  266. package/dist/components/Flow/Flow.js +15 -13
  267. package/dist/components/Flow/Flow.js.map +1 -1
  268. package/dist/components/Flow/useFlow.d.ts +1 -0
  269. package/dist/components/Flow/useFlow.js.map +1 -1
  270. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.d.ts +6 -0
  271. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +41 -0
  272. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -0
  273. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +11 -0
  274. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +78 -0
  275. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -0
  276. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.d.ts +6 -0
  277. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +19 -0
  278. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -0
  279. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.d.ts +5 -0
  280. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +21 -0
  281. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -0
  282. package/dist/components/Payroll/PayrollList/PayrollList.d.ts +6 -0
  283. package/dist/components/Payroll/PayrollList/PayrollList.js +17 -0
  284. package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -0
  285. package/dist/components/Payroll/PayrollList/PayrollListPresentation.d.ts +9 -0
  286. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +49 -0
  287. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -0
  288. package/dist/components/Payroll/PayrollOverview/PayrollOverview.d.ts +7 -0
  289. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +32 -0
  290. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -0
  291. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.d.ts +6 -0
  292. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +68 -0
  293. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -0
  294. package/dist/components/Payroll/RunPayrollFlow/RunPayroll.d.ts +16 -0
  295. package/dist/components/Payroll/RunPayrollFlow/RunPayroll.js +55 -0
  296. package/dist/components/Payroll/RunPayrollFlow/RunPayroll.js.map +1 -0
  297. package/dist/components/Payroll/RunPayrollFlow/RunPayrollFlow.d.ts +6 -0
  298. package/dist/components/Payroll/RunPayrollFlow/RunPayrollFlow.js +20 -0
  299. package/dist/components/Payroll/RunPayrollFlow/RunPayrollFlow.js.map +1 -0
  300. package/dist/components/Payroll/index.d.ts +6 -0
  301. package/dist/components/Payroll/index.js +13 -0
  302. package/dist/components/Payroll/index.js.map +1 -0
  303. package/dist/components/index.d.ts +1 -0
  304. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.d.ts +3 -3
  305. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +5 -7
  306. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
  307. package/dist/contexts/ThemeProvider/ThemeProvider.d.ts +1 -5
  308. package/dist/contexts/ThemeProvider/ThemeProvider.js +18 -60
  309. package/dist/contexts/ThemeProvider/ThemeProvider.js.map +1 -1
  310. package/dist/contexts/ThemeProvider/theme.d.ts +42 -11
  311. package/dist/contexts/ThemeProvider/theme.js +31 -15
  312. package/dist/contexts/ThemeProvider/theme.js.map +1 -1
  313. package/dist/helpers/responsive.d.ts +0 -3
  314. package/dist/helpers/responsive.js +20 -34
  315. package/dist/helpers/responsive.js.map +1 -1
  316. package/dist/i18n/I18n.js +1 -1
  317. package/dist/i18n/I18n.js.map +1 -1
  318. package/dist/i18n/en/Contractor.ContractorList.json.js +16 -10
  319. package/dist/i18n/en/Contractor.ContractorList.json.js.map +1 -1
  320. package/dist/i18n/en/Contractor.Profile.json.js +1 -1
  321. package/dist/i18n/en/Contractor.Submit.json.js +22 -0
  322. package/dist/i18n/en/Contractor.Submit.json.js.map +1 -0
  323. package/dist/i18n/en/Employee.Deductions.json.js +49 -51
  324. package/dist/i18n/en/Employee.Deductions.json.js.map +1 -1
  325. package/dist/index.js +11 -9
  326. package/dist/index.js.map +1 -1
  327. package/dist/shared/constants.d.ts +46 -2
  328. package/dist/shared/constants.js +82 -45
  329. package/dist/shared/constants.js.map +1 -1
  330. package/dist/style.css +1 -1
  331. package/dist/types/i18next.d.ts +27 -17
  332. package/package.json +9 -8
  333. package/dist/components/Common/UI/NumberInput/NumberInput.module.scss.js +0 -8
  334. package/dist/components/Common/UI/NumberInput/NumberInput.module.scss.js.map +0 -1
  335. package/dist/components/Contractor/List/index.d.ts +0 -25
  336. package/dist/components/Contractor/List/index.js +0 -81
  337. package/dist/components/Contractor/List/index.js.map +0 -1
  338. package/dist/components/Contractor/List/useContractorList.js.map +0 -1
  339. package/dist/components/Contractor/Submit/ContractorSubmitWithApi.d.ts +0 -6
  340. package/dist/components/Contractor/Submit/ContractorSubmitWithApi.js +0 -27
  341. package/dist/components/Contractor/Submit/ContractorSubmitWithApi.js.map +0 -1
  342. package/dist/components/Contractor/Submit/index.d.ts +0 -6
  343. package/dist/components/Contractor/Submit/index.js +0 -20
  344. package/dist/components/Contractor/Submit/index.js.map +0 -1
  345. package/dist/components/Contractor/Submit/index.module.scss.js +0 -8
  346. package/dist/components/Contractor/Submit/index.module.scss.js.map +0 -1
  347. package/dist/components/Employee/Deductions/Actions.js +0 -27
  348. package/dist/components/Employee/Deductions/Actions.js.map +0 -1
  349. package/dist/components/Employee/Deductions/DeductionForm.d.ts +0 -1
  350. package/dist/components/Employee/Deductions/DeductionForm.js +0 -78
  351. package/dist/components/Employee/Deductions/DeductionForm.js.map +0 -1
  352. package/dist/components/Employee/Deductions/DeductionsList.d.ts +0 -2
  353. package/dist/components/Employee/Deductions/DeductionsList.js +0 -60
  354. package/dist/components/Employee/Deductions/DeductionsList.js.map +0 -1
  355. package/dist/components/Employee/Deductions/Head.js +0 -13
  356. package/dist/components/Employee/Deductions/Head.js.map +0 -1
  357. package/dist/components/Employee/Deductions/IncludeDeductionsForm.d.ts +0 -1
  358. package/dist/components/Employee/Deductions/IncludeDeductionsForm.js +0 -27
  359. package/dist/components/Employee/Deductions/IncludeDeductionsForm.js.map +0 -1
  360. package/dist/components/Employee/Deductions/useDeductions.js +0 -33
  361. package/dist/components/Employee/Deductions/useDeductions.js.map +0 -1
  362. package/dist/contexts/ThemeProvider/createTheme.d.ts +0 -21
  363. package/dist/contexts/ThemeProvider/createTheme.js +0 -269
  364. package/dist/contexts/ThemeProvider/createTheme.js.map +0 -1
  365. package/dist/i18n/en/Contractor.ContractorSubmit.json.js +0 -18
  366. package/dist/i18n/en/Contractor.ContractorSubmit.json.js.map +0 -1
  367. package/dist/types/GTheme.d.ts +0 -254
  368. /package/dist/contexts/ThemeProvider/{createTheme.test.d.ts → theme.test.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"Deductions.js","sources":["../../../../src/components/Employee/Deductions/Deductions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useEffect, useMemo, useState } from 'react'\nimport { z } from 'zod'\nimport { FormProvider, useForm, type SubmitHandler } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useGarnishmentsListSuspense } from '@gusto/embedded-api/react-query/garnishmentsList'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport type { OnboardingContextInterface } from '../OnboardingFlow/OnboardingFlow'\nimport {\n type DeductionInputs,\n type DeductionPayload,\n DeductionSchema,\n DeductionsProvider,\n type MODE,\n} from './useDeductions'\nimport {\n useBase,\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { Form } from '@/components/Common/Form'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { Actions } from '@/components/Employee/Deductions/Actions'\nimport { IncludeDeductionsForm } from '@/components/Employee/Deductions/IncludeDeductionsForm'\nimport { Head } from '@/components/Employee/Deductions/Head'\nimport { DeductionForm } from '@/components/Employee/Deductions/DeductionForm'\nimport { DeductionsList } from '@/components/Employee/Deductions/DeductionsList'\nimport { useFlow } from '@/components/Flow/useFlow'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\ninterface DeductionsProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n}\n\nconst IncludeDeductionsSchema = z.object({ includeDeductions: z.enum(['Yes', 'No']) })\nexport type IncludeDeductionsPayload = z.output<typeof IncludeDeductionsSchema>\n\nexport function Deductions(props: DeductionsProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\nexport const Root = ({ employeeId, className, dictionary }: DeductionsProps) => {\n const { onEvent, baseSubmitHandler } = useBase()\n useComponentDictionary('Employee.Deductions', dictionary)\n\n const { data } = useGarnishmentsListSuspense({ employeeId })\n const deductions = data.garnishmentList!\n\n // Used for deletion or edit of deduction\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n\n const activeDeductions = deductions.filter(deduction => deduction.active)\n const [mode, setMode] = useState<MODE>(activeDeductions.length < 1 ? 'INITIAL' : 'LIST')\n const [currentDeduction, setCurrentDeduction] = useState<Garnishment | null>(null)\n useI18n('Employee.Deductions')\n\n const defaultValues: DeductionInputs = useMemo(() => {\n return {\n amount: currentDeduction?.amount ? Number(currentDeduction.amount) : 0,\n description: currentDeduction?.description ?? '',\n times: currentDeduction?.times ?? null,\n recurring: currentDeduction?.recurring?.toString() ?? 'true',\n annualMaximum: currentDeduction?.annualMaximum\n ? Number(currentDeduction.annualMaximum)\n : null,\n payPeriodMaximum: currentDeduction?.payPeriodMaximum\n ? Number(currentDeduction.payPeriodMaximum)\n : null,\n deductAsPercentage: currentDeduction?.deductAsPercentage?.toString() ?? 'true',\n active: true,\n courtOrdered: currentDeduction?.courtOrdered ?? false,\n } as DeductionInputs\n }, [currentDeduction])\n\n const includeDeductionsFormMethods = useForm<IncludeDeductionsPayload>({\n // resolver: zodResolver(IncludeDeductionsSchema),\n defaultValues: { includeDeductions: 'No' },\n })\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n\n const { reset: resetForm } = formMethods\n\n useEffect(() => {\n resetForm(defaultValues)\n }, [currentDeduction, defaultValues, resetForm, mode])\n\n const handleDelete = async (deduction: Garnishment) => {\n await baseSubmitHandler(deduction, async payload => {\n //Deletion of deduction is simply updating it with active: false\n const { garnishment } = await updateDeduction({\n request: {\n garnishmentId: payload.uuid,\n requestBody: {\n ...payload,\n totalAmount: payload.totalAmount ?? undefined,\n active: false,\n version: payload.version as string,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DELETED, garnishment)\n })\n }\n const onSubmit: SubmitHandler<DeductionPayload | IncludeDeductionsPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if ('includeDeductions' in payload) {\n if (payload.includeDeductions === 'Yes') {\n setMode('ADD')\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_ADD)\n } else {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DONE)\n return\n }\n }\n if (!('includeDeductions' in payload)) {\n if (mode === 'ADD') {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, times: payload.recurring ? null : 1 },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else if (mode === 'EDIT') {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: currentDeduction?.uuid ?? '',\n requestBody: {\n ...payload,\n version: currentDeduction?.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n setCurrentDeduction(null)\n }\n setMode('LIST')\n }\n })\n }\n const handleAdd = () => {\n setMode('ADD')\n }\n const handleCancel = () => {\n setMode(activeDeductions.length < 1 ? 'INITIAL' : 'LIST')\n setCurrentDeduction(null)\n }\n const handleEdit = (deduction: Garnishment) => {\n setMode('EDIT')\n setCurrentDeduction(deduction)\n }\n const handlePassthrough = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DONE)\n }\n return (\n <section className={className}>\n <DeductionsProvider\n value={{\n isPending: isPendingCreate || isPendingUpdate,\n employeeId,\n mode,\n deductions,\n handleAdd,\n handleCancel,\n handleDelete,\n handleEdit,\n handlePassthrough,\n }}\n >\n {mode === 'INITIAL' ? (\n <FormProvider {...includeDeductionsFormMethods}>\n <Form onSubmit={includeDeductionsFormMethods.handleSubmit(onSubmit)}>\n <Head />\n <IncludeDeductionsForm />\n <Actions />\n </Form>\n </FormProvider>\n ) : (\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Head />\n <DeductionsList />\n <DeductionForm />\n <Actions />\n </Form>\n </FormProvider>\n )}\n </DeductionsProvider>\n </section>\n )\n}\n\nexport const DeductionsContextual = () => {\n const { employeeId, onEvent } = useFlow<OnboardingContextInterface>()\n const { t } = useTranslation('common')\n\n if (!employeeId) {\n throw new Error(\n t('errors.missingParamsOrContext', {\n component: 'Deductions',\n param: 'employeeId',\n provider: 'FlowProvider',\n }),\n )\n }\n return <Deductions employeeId={employeeId} onEvent={onEvent} />\n}\n"],"names":["z","Deductions","props","jsx","BaseComponent","Root","employeeId","className","dictionary","onEvent","baseSubmitHandler","useBase","useComponentDictionary","data","useGarnishmentsListSuspense","deductions","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","activeDeductions","deduction","mode","setMode","useState","currentDeduction","setCurrentDeduction","useI18n","defaultValues","useMemo","includeDeductionsFormMethods","useForm","formMethods","zodResolver","DeductionSchema","resetForm","useEffect","handleDelete","payload","garnishment","componentEvents","onSubmit","createDeductionResponse","updateDeductionResponse","DeductionsProvider","FormProvider","jsxs","Form","Head","IncludeDeductionsForm","Actions","DeductionsList","DeductionForm","DeductionsContextual","useFlow","t","useTranslation"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsCgCA,EAAE,OAAO,EAAE,mBAAmBA,EAAE,KAAK,CAAC,OAAO,IAAI,CAAC,EAAA,CAAG;AAG9E,SAASC,EAAWC,GAAiD;AAC1E,SACE,gBA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X,EAAA,CACF,IAEA,gBAAAjD,EAAC4C,GAAA,EAAc,GAAGb,GAChB,UAAA,gBAAAc,EAACC,GAAA,EAAK,UAAUf,EAAY,aAAaS,CAAQ,GAC/C,UAAA;AAAA,QAAA,gBAAAxC,EAAC+C,GAAA,EAAK;AAAA,0BACLG,GAAA,EAAe;AAAA,0BACfC,GAAA,EAAc;AAAA,0BACdF,GAAA,CAAA,CAAQ;AAAA,MAAA,EAAA,CACX,EAAA,CACF;AAAA,IAAA;AAAA,EAAA,GAGN;AAEJ,GAEaG,KAAuB,MAAM;AACxC,QAAM,EAAE,YAAAjD,GAAY,SAAAG,EAAA,IAAY+C,EAAA,GAC1B,EAAE,GAAAC,EAAA,IAAMC,EAAe,QAAQ;AAErC,MAAI,CAACpD;AACH,UAAM,IAAI;AAAA,MACRmD,EAAE,iCAAiC;AAAA,QACjC,WAAW;AAAA,QACX,OAAO;AAAA,QACP,UAAU;AAAA,MAAA,CACX;AAAA,IAAA;AAGL,SAAO,gBAAAtD,EAACF,GAAA,EAAW,YAAAK,GAAwB,SAAAG,EAAA,CAAkB;AAC/D;"}
1
+ {"version":3,"file":"Deductions.js","sources":["../../../../src/components/Employee/Deductions/Deductions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { createMachine } from 'robot3'\nimport { useGarnishmentsListSuspense } from '@gusto/embedded-api/react-query/garnishmentsList'\nimport { useMemo } from 'react'\nimport type { OnboardingContextInterface } from '../OnboardingFlow/OnboardingFlow'\nimport {\n IncludeDeductionsFormContextual,\n type DeductionsContextInterface,\n DeductionsListContextual,\n} from './DeductionsComponents'\nimport { deductionsStateMachine } from './stateMachine'\nimport { DeductionsForm } from './DeductionsForm/DeductionsForm'\nimport { DeductionsList } from './DeductionsList/DeductionsList'\nimport { IncludeDeductionsForm } from './IncludeDeductionsForm/IncludeDeductionsForm'\nimport { Flow } from '@/components/Flow/Flow'\nimport { BaseComponent, type BaseComponentInterface } from '@/components/Base'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport { useFlow } from '@/components/Flow/useFlow'\n\nexport interface DeductionsProps extends BaseComponentInterface<'Employee.Deductions'> {\n employeeId: string\n}\nfunction DeductionsFlow({ employeeId, onEvent, dictionary }: DeductionsProps) {\n useComponentDictionary('Employee.Deductions', dictionary)\n const { data } = useGarnishmentsListSuspense({ employeeId })\n const deductions = data.garnishmentList!\n const activeDeductions = deductions.filter(deduction => deduction.active)\n const hasExistingDeductions = useMemo(\n () => activeDeductions.length > 0,\n [activeDeductions.length],\n )\n\n // Determine initial state based on existing deductions\n const initialState: 'includeDeductions' | 'viewDeductions' = hasExistingDeductions\n ? 'viewDeductions'\n : 'includeDeductions'\n\n const initialComponent: React.ComponentType = hasExistingDeductions\n ? DeductionsListContextual\n : IncludeDeductionsFormContextual\n\n const manageDeductions = useMemo(\n () =>\n createMachine(\n initialState,\n deductionsStateMachine,\n (initialContext: DeductionsContextInterface) => ({\n ...initialContext,\n component: initialComponent,\n employeeId,\n currentDeductionId: null,\n hasExistingDeductions,\n }),\n ),\n [initialState, initialComponent, employeeId, hasExistingDeductions],\n )\n\n return <Flow machine={manageDeductions} onEvent={onEvent} />\n}\n\nexport function Deductions(props: DeductionsProps) {\n return (\n <BaseComponent {...props}>\n <DeductionsFlow {...props} />\n </BaseComponent>\n )\n}\n\nexport const DeductionsContextual = () => {\n const { employeeId, onEvent } = useFlow<OnboardingContextInterface>()\n const { t } = useTranslation('common')\n\n if (!employeeId) {\n throw new Error(\n t('errors.missingParamsOrContext', {\n component: 'Deductions',\n param: 'employeeId',\n provider: 'FlowProvider',\n }),\n )\n }\n return <Deductions employeeId={employeeId} onEvent={onEvent} />\n}\n\nDeductions.DeductionsForm = DeductionsForm\nDeductions.DeductionsList = DeductionsList\nDeductions.IncludeDeductionsForm = IncludeDeductionsForm\n"],"names":["DeductionsFlow","employeeId","onEvent","dictionary","useComponentDictionary","data","useGarnishmentsListSuspense","activeDeductions","deduction","hasExistingDeductions","useMemo","initialState","initialComponent","DeductionsListContextual","IncludeDeductionsFormContextual","manageDeductions","createMachine","deductionsStateMachine","initialContext","jsx","Flow","Deductions","props","BaseComponent","DeductionsContextual","useFlow","t","useTranslation","DeductionsForm","DeductionsList","IncludeDeductionsForm"],"mappings":";;;;;;;;;;;;;;;AAsBA,SAASA,EAAe,EAAE,YAAAC,GAAY,SAAAC,GAAS,YAAAC,KAA+B;AAC5E,EAAAC,EAAuB,uBAAuBD,CAAU;AACxD,QAAM,EAAE,MAAAE,EAAA,IAASC,EAA4B,EAAE,YAAAL,GAAY,GAErDM,IADaF,EAAK,gBACY,OAAO,CAAAG,MAAaA,EAAU,MAAM,GAClEC,IAAwBC;AAAA,IAC5B,MAAMH,EAAiB,SAAS;AAAA,IAChC,CAACA,EAAiB,MAAM;AAAA,EAAA,GAIpBI,IAAuDF,IACzD,mBACA,qBAEEG,IAAwCH,IAC1CI,IACAC,GAEEC,IAAmBL;AAAA,IACvB,MACEM;AAAA,MACEL;AAAA,MACAM;AAAA,MACA,CAACC,OAAgD;AAAA,QAC/C,GAAGA;AAAA,QACH,WAAWN;AAAA,QACX,YAAAX;AAAA,QACA,oBAAoB;AAAA,QACpB,uBAAAQ;AAAA,MAAA;AAAA,IACF;AAAA,IAEJ,CAACE,GAAcC,GAAkBX,GAAYQ,CAAqB;AAAA,EAAA;AAGpE,SAAO,gBAAAU,EAACC,GAAA,EAAK,SAASL,GAAkB,SAAAb,EAAA,CAAkB;AAC5D;AAEO,SAASmB,EAAWC,GAAwB;AACjD,SACE,gBAAAH,EAACI,KAAe,GAAGD,GACjB,4BAACtB,GAAA,EAAgB,GAAGsB,GAAO,EAAA,CAC7B;AAEJ;AAEO,MAAME,IAAuB,MAAM;AACxC,QAAM,EAAE,YAAAvB,GAAY,SAAAC,EAAA,IAAYuB,EAAA,GAC1B,EAAE,GAAAC,EAAA,IAAMC,EAAe,QAAQ;AAErC,MAAI,CAAC1B;AACH,UAAM,IAAI;AAAA,MACRyB,EAAE,iCAAiC;AAAA,QACjC,WAAW;AAAA,QACX,OAAO;AAAA,QACP,UAAU;AAAA,MAAA,CACX;AAAA,IAAA;AAGL,SAAO,gBAAAP,EAACE,GAAA,EAAW,YAAApB,GAAwB,SAAAC,EAAA,CAAkB;AAC/D;AAEAmB,EAAW,iBAAiBO;AAC5BP,EAAW,iBAAiBQ;AAC5BR,EAAW,wBAAwBS;"}
@@ -0,0 +1,23 @@
1
+ import { Garnishment } from '@gusto/embedded-api/models/components/garnishment';
2
+ import { FlowContextInterface } from '../../Flow/useFlow';
3
+ import { componentEvents } from '../../../shared/constants';
4
+ export type EventPayloads = {
5
+ [componentEvents.EMPLOYEE_DEDUCTION_INCLUDE_YES]: undefined;
6
+ [componentEvents.EMPLOYEE_DEDUCTION_INCLUDE_NO]: undefined;
7
+ [componentEvents.EMPLOYEE_DEDUCTION_ADD]: undefined;
8
+ [componentEvents.EMPLOYEE_DEDUCTION_CREATED]: Garnishment;
9
+ [componentEvents.EMPLOYEE_DEDUCTION_UPDATED]: Garnishment;
10
+ [componentEvents.EMPLOYEE_DEDUCTION_DELETED]: Garnishment;
11
+ [componentEvents.EMPLOYEE_DEDUCTION_EDIT]: Garnishment;
12
+ [componentEvents.EMPLOYEE_DEDUCTION_CANCEL]: undefined;
13
+ [componentEvents.EMPLOYEE_DEDUCTION_DONE]: undefined;
14
+ [componentEvents.CANCEL]: undefined;
15
+ };
16
+ export interface DeductionsContextInterface extends FlowContextInterface {
17
+ employeeId: string;
18
+ currentDeductionId?: string | null;
19
+ hasExistingDeductions?: boolean;
20
+ }
21
+ export declare function IncludeDeductionsFormContextual(): import("react/jsx-runtime").JSX.Element;
22
+ export declare function DeductionsListContextual(): import("react/jsx-runtime").JSX.Element;
23
+ export declare function DeductionFormContextual(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,31 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { IncludeDeductionsForm as m } from "./IncludeDeductionsForm/IncludeDeductionsForm.js";
3
+ import { DeductionsList as d } from "./DeductionsList/DeductionsList.js";
4
+ import { DeductionsForm as i } from "./DeductionsForm/DeductionsForm.js";
5
+ import { useFlow as n } from "../../Flow/useFlow.js";
6
+ import { ensureRequired as r } from "../../../helpers/ensureRequired.js";
7
+ function D() {
8
+ const { employeeId: e, onEvent: o } = n();
9
+ return /* @__PURE__ */ t(m, { onEvent: o, employeeId: r(e) });
10
+ }
11
+ function y() {
12
+ const { employeeId: e, onEvent: o } = n();
13
+ return /* @__PURE__ */ t(d, { onEvent: o, employeeId: r(e) });
14
+ }
15
+ function x() {
16
+ const { employeeId: e, onEvent: o, currentDeductionId: u } = n();
17
+ return /* @__PURE__ */ t(
18
+ i,
19
+ {
20
+ onEvent: o,
21
+ employeeId: r(e),
22
+ deductionId: u
23
+ }
24
+ );
25
+ }
26
+ export {
27
+ x as DeductionFormContextual,
28
+ y as DeductionsListContextual,
29
+ D as IncludeDeductionsFormContextual
30
+ };
31
+ //# sourceMappingURL=DeductionsComponents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeductionsComponents.js","sources":["../../../../src/components/Employee/Deductions/DeductionsComponents.tsx"],"sourcesContent":["import type { Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { IncludeDeductionsForm } from './IncludeDeductionsForm/IncludeDeductionsForm'\nimport { DeductionsList } from './DeductionsList/DeductionsList'\nimport { DeductionsForm } from './DeductionsForm/DeductionsForm'\nimport { useFlow, type FlowContextInterface } from '@/components/Flow/useFlow'\nimport type { componentEvents } from '@/shared/constants'\nimport { ensureRequired } from '@/helpers/ensureRequired'\n\nexport type EventPayloads = {\n [componentEvents.EMPLOYEE_DEDUCTION_INCLUDE_YES]: undefined\n [componentEvents.EMPLOYEE_DEDUCTION_INCLUDE_NO]: undefined\n [componentEvents.EMPLOYEE_DEDUCTION_ADD]: undefined\n [componentEvents.EMPLOYEE_DEDUCTION_CREATED]: Garnishment\n [componentEvents.EMPLOYEE_DEDUCTION_UPDATED]: Garnishment\n [componentEvents.EMPLOYEE_DEDUCTION_DELETED]: Garnishment\n [componentEvents.EMPLOYEE_DEDUCTION_EDIT]: Garnishment\n [componentEvents.EMPLOYEE_DEDUCTION_CANCEL]: undefined\n [componentEvents.EMPLOYEE_DEDUCTION_DONE]: undefined\n [componentEvents.CANCEL]: undefined\n}\n\nexport interface DeductionsContextInterface extends FlowContextInterface {\n employeeId: string\n currentDeductionId?: string | null\n hasExistingDeductions?: boolean\n}\n\nexport function IncludeDeductionsFormContextual() {\n const { employeeId, onEvent } = useFlow<DeductionsContextInterface>()\n return <IncludeDeductionsForm onEvent={onEvent} employeeId={ensureRequired(employeeId)} />\n}\n\nexport function DeductionsListContextual() {\n const { employeeId, onEvent } = useFlow<DeductionsContextInterface>()\n return <DeductionsList onEvent={onEvent} employeeId={ensureRequired(employeeId)} />\n}\n\nexport function DeductionFormContextual() {\n const { employeeId, onEvent, currentDeductionId } = useFlow<DeductionsContextInterface>()\n\n return (\n <DeductionsForm\n onEvent={onEvent}\n employeeId={ensureRequired(employeeId)}\n deductionId={currentDeductionId}\n />\n )\n}\n"],"names":["IncludeDeductionsFormContextual","employeeId","onEvent","useFlow","IncludeDeductionsForm","ensureRequired","DeductionsListContextual","DeductionsList","DeductionFormContextual","currentDeductionId","jsx","DeductionsForm"],"mappings":";;;;;;AA2BO,SAASA,IAAkC;AAChD,QAAM,EAAE,YAAAC,GAAY,SAAAC,EAAA,IAAYC,EAAA;AAChC,2BAAQC,GAAA,EAAsB,SAAAF,GAAkB,YAAYG,EAAeJ,CAAU,GAAG;AAC1F;AAEO,SAASK,IAA2B;AACzC,QAAM,EAAE,YAAAL,GAAY,SAAAC,EAAA,IAAYC,EAAA;AAChC,2BAAQI,GAAA,EAAe,SAAAL,GAAkB,YAAYG,EAAeJ,CAAU,GAAG;AACnF;AAEO,SAASO,IAA0B;AACxC,QAAM,EAAE,YAAAP,GAAY,SAAAC,GAAS,oBAAAO,EAAA,IAAuBN,EAAA;AAEpD,SACE,gBAAAO;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,SAAAT;AAAA,MACA,YAAYG,EAAeJ,CAAU;AAAA,MACrC,aAAaQ;AAAA,IAAA;AAAA,EAAA;AAGnB;"}
@@ -0,0 +1,41 @@
1
+ import { z } from 'zod';
2
+ import { BaseComponentInterface, CommonComponentInterface } from '../../../Base';
3
+ export declare const DeductionSchema: z.ZodObject<{
4
+ active: z.ZodBoolean;
5
+ amount: z.ZodEffects<z.ZodNumber, string, number>;
6
+ description: z.ZodString;
7
+ courtOrdered: z.ZodBoolean;
8
+ times: z.ZodNullable<z.ZodNumber>;
9
+ recurring: z.ZodEffects<z.ZodString, boolean, string>;
10
+ annualMaximum: z.ZodNullable<z.ZodEffects<z.ZodNumber, string | null, number>>;
11
+ payPeriodMaximum: z.ZodNullable<z.ZodEffects<z.ZodNumber, string | null, number>>;
12
+ deductAsPercentage: z.ZodEffects<z.ZodString, boolean, string>;
13
+ }, "strip", z.ZodTypeAny, {
14
+ description: string;
15
+ active: boolean;
16
+ amount: string;
17
+ recurring: boolean;
18
+ courtOrdered: boolean;
19
+ times: number | null;
20
+ annualMaximum: string | null;
21
+ payPeriodMaximum: string | null;
22
+ deductAsPercentage: boolean;
23
+ }, {
24
+ description: string;
25
+ active: boolean;
26
+ amount: number;
27
+ recurring: string;
28
+ courtOrdered: boolean;
29
+ times: number | null;
30
+ annualMaximum: number | null;
31
+ payPeriodMaximum: number | null;
32
+ deductAsPercentage: string;
33
+ }>;
34
+ export type DeductionInputs = z.input<typeof DeductionSchema>;
35
+ export type DeductionPayload = z.output<typeof DeductionSchema>;
36
+ interface DeductionsFormProps extends CommonComponentInterface<'Employee.Deductions'> {
37
+ employeeId: string;
38
+ deductionId?: string | null;
39
+ }
40
+ export declare function DeductionsForm(props: DeductionsFormProps & BaseComponentInterface): import("react/jsx-runtime").JSX.Element;
41
+ export {};
@@ -0,0 +1,134 @@
1
+ import { jsx as n, jsxs as d, Fragment as E } from "react/jsx-runtime";
2
+ import { useTranslation as N } from "react-i18next";
3
+ import { useMemo as B, useEffect as U } from "react";
4
+ import { z as i } from "zod";
5
+ import { useForm as _, useWatch as I, FormProvider as w } from "react-hook-form";
6
+ import { zodResolver as G } from "@hookform/resolvers/zod";
7
+ import { useGarnishmentsCreateMutation as j } from "@gusto/embedded-api/react-query/garnishmentsCreate";
8
+ import { useGarnishmentsUpdateMutation as Y } from "@gusto/embedded-api/react-query/garnishmentsUpdate";
9
+ import { useGarnishmentsListSuspense as k } from "@gusto/embedded-api/react-query/garnishmentsList";
10
+ import { BaseComponent as z } from "../../../Base/Base.js";
11
+ import { useBase as H } from "../../../Base/useBase.js";
12
+ import { Form as V } from "../../../Common/Form/Form.js";
13
+ import { Flex as W } from "../../../Common/Flex/Flex.js";
14
+ import { ActionsLayout as J } from "../../../Common/ActionsLayout/ActionsLayout.js";
15
+ import { useComponentDictionary as K, useI18n as Q } from "../../../../i18n/I18n.js";
16
+ import { componentEvents as p } from "../../../../shared/constants.js";
17
+ import { useComponentContext as X } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
18
+ import { TextInputField as Z } from "../../../Common/Fields/TextInputField/TextInputField.js";
19
+ import { RadioGroupField as x } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
20
+ import { NumberInputField as f } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
21
+ import { CheckboxField as $ } from "../../../Common/Fields/CheckboxField/CheckboxField.js";
22
+ const ee = i.object({
23
+ active: i.boolean(),
24
+ amount: i.number().min(0).transform(String),
25
+ description: i.string().min(1),
26
+ courtOrdered: i.boolean(),
27
+ times: i.number().nullable(),
28
+ recurring: i.string().transform((t) => t === "true"),
29
+ annualMaximum: i.number().min(0).transform((t) => t > 0 ? t.toString() : null).nullable(),
30
+ payPeriodMaximum: i.number().min(0).transform((t) => t > 0 ? t.toString() : null).nullable(),
31
+ deductAsPercentage: i.string().transform((t) => t === "true")
32
+ });
33
+ function Ce(t) {
34
+ return /* @__PURE__ */ n(z, { ...t, children: /* @__PURE__ */ n(ne, { ...t, children: t.children }) });
35
+ }
36
+ function ne({ className: t, children: b, employeeId: g, deductionId: h, dictionary: y }) {
37
+ const { onEvent: u, baseSubmitHandler: P } = H(), { t: r } = N("Employee.Deductions"), m = X();
38
+ K("Employee.Deductions", y), Q("Employee.Deductions");
39
+ const { data: C } = k({ employeeId: g }), e = h ? C.garnishmentList?.find((c) => c.uuid === h) ?? null : null, { mutateAsync: M, isPending: O } = j(), { mutateAsync: L, isPending: T } = Y(), a = B(() => ({
40
+ amount: e?.amount ? Number(e.amount) : 0,
41
+ description: e?.description ?? "",
42
+ times: e?.times ?? null,
43
+ recurring: e?.recurring?.toString() ?? "true",
44
+ annualMaximum: e?.annualMaximum ? Number(e.annualMaximum) : null,
45
+ payPeriodMaximum: e?.payPeriodMaximum ? Number(e.payPeriodMaximum) : null,
46
+ deductAsPercentage: e?.deductAsPercentage?.toString() ?? "true",
47
+ active: !0,
48
+ courtOrdered: e?.courtOrdered ?? !1
49
+ }), [e]), s = _({
50
+ resolver: G(ee),
51
+ defaultValues: a
52
+ }), { reset: D, control: v } = s;
53
+ U(() => {
54
+ D(a);
55
+ }, [e, a, D]);
56
+ const A = I({ control: v, name: "recurring" }), F = O || T, R = async (c) => {
57
+ await P(c, async (o) => {
58
+ if (e) {
59
+ const { garnishment: l } = await L({
60
+ request: {
61
+ garnishmentId: e.uuid,
62
+ requestBody: {
63
+ ...o,
64
+ version: e.version,
65
+ times: o.recurring ? null : 1
66
+ }
67
+ }
68
+ });
69
+ u(p.EMPLOYEE_DEDUCTION_UPDATED, l);
70
+ } else {
71
+ const { garnishment: l } = await M({
72
+ request: {
73
+ employeeId: g,
74
+ requestBody: { ...o, times: o.recurring ? null : 1 }
75
+ }
76
+ });
77
+ u(p.EMPLOYEE_DEDUCTION_CREATED, l);
78
+ }
79
+ });
80
+ }, q = () => {
81
+ u(p.EMPLOYEE_DEDUCTION_CANCEL);
82
+ }, S = r(e ? "editDeductionTitle" : "addDeductionTitle");
83
+ return /* @__PURE__ */ n("section", { className: t, children: /* @__PURE__ */ n(w, { ...s, children: /* @__PURE__ */ n(V, { onSubmit: s.handleSubmit(R), children: /* @__PURE__ */ n(W, { flexDirection: "column", gap: 32, children: b || /* @__PURE__ */ d(E, { children: [
84
+ /* @__PURE__ */ n(m.Heading, { as: "h2", children: S }),
85
+ /* @__PURE__ */ n(Z, { name: "description", label: r("descriptionLabel"), isRequired: !0 }),
86
+ /* @__PURE__ */ n(
87
+ x,
88
+ {
89
+ name: "deductAsPercentage",
90
+ label: r("deductionTypeLabel"),
91
+ isRequired: !0,
92
+ options: [
93
+ { value: "true", label: r("deductionTypePercentageOption") },
94
+ { value: "false", label: r("deductionTypeFixedAmountOption") }
95
+ ]
96
+ }
97
+ ),
98
+ /* @__PURE__ */ n(
99
+ f,
100
+ {
101
+ name: "amount",
102
+ label: r("deductionAmountLabel"),
103
+ isRequired: !0,
104
+ min: 0
105
+ }
106
+ ),
107
+ /* @__PURE__ */ n(
108
+ x,
109
+ {
110
+ name: "recurring",
111
+ label: r("frequencyLabel"),
112
+ isRequired: !0,
113
+ options: [
114
+ { value: "true", label: r("frequencyRecurringOption") },
115
+ { value: "false", label: r("frequencyOneTimeOption") }
116
+ ]
117
+ }
118
+ ),
119
+ A === "true" && /* @__PURE__ */ d(E, { children: [
120
+ /* @__PURE__ */ n(f, { name: "annualMaximum", label: r("annualMaxLabel"), min: 0 }),
121
+ /* @__PURE__ */ n(f, { name: "payPeriodMaximum", label: "Pay period maximum", min: 0 })
122
+ ] }),
123
+ /* @__PURE__ */ n($, { name: "courtOrdered", label: r("courtOrderedLabel") }),
124
+ /* @__PURE__ */ d(J, { children: [
125
+ /* @__PURE__ */ n(m.Button, { variant: "secondary", onClick: q, children: r("cancelCta") }),
126
+ /* @__PURE__ */ n(m.Button, { type: "submit", isLoading: F, children: r(e ? "continueCta" : "addDeductionCta") })
127
+ ] })
128
+ ] }) }) }) }) });
129
+ }
130
+ export {
131
+ ee as DeductionSchema,
132
+ Ce as DeductionsForm
133
+ };
134
+ //# sourceMappingURL=DeductionsForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeductionsForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/DeductionsForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useEffect, useMemo } from 'react'\nimport { z } from 'zod'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { useGarnishmentsListSuspense } from '@gusto/embedded-api/react-query/garnishmentsList'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport {\n CheckboxField,\n NumberInputField,\n RadioGroupField,\n TextInputField,\n} from '@/components/Common'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\nexport const DeductionSchema = z.object({\n active: z.boolean(),\n amount: z.number().min(0).transform(String),\n description: z.string().min(1),\n courtOrdered: z.boolean(),\n times: z.number().nullable(),\n recurring: z.string().transform(val => val === 'true'),\n annualMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n payPeriodMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n deductAsPercentage: z.string().transform(val => val === 'true'),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ninterface DeductionsFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deductionId?: string | null\n}\n\nexport function DeductionsForm(props: DeductionsFormProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ className, children, employeeId, deductionId, dictionary }: DeductionsFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n useComponentDictionary('Employee.Deductions', dictionary)\n useI18n('Employee.Deductions')\n\n // Fetch all garnishments to find the specific one by ID\n const { data } = useGarnishmentsListSuspense({ employeeId })\n const deduction = deductionId\n ? (data.garnishmentList?.find(g => g.uuid === deductionId) ?? null)\n : null\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n\n const defaultValues: DeductionInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n description: deduction?.description ?? '',\n times: deduction?.times ?? null,\n recurring: deduction?.recurring?.toString() ?? 'true',\n annualMaximum: deduction?.annualMaximum ? Number(deduction.annualMaximum) : null,\n payPeriodMaximum: deduction?.payPeriodMaximum ? Number(deduction.payPeriodMaximum) : null,\n deductAsPercentage: deduction?.deductAsPercentage?.toString() ?? 'true',\n active: true,\n courtOrdered: deduction?.courtOrdered ?? false,\n } as DeductionInputs\n }, [deduction])\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n\n const { reset: resetForm, control } = formMethods\n\n useEffect(() => {\n resetForm(defaultValues)\n }, [deduction, defaultValues, resetForm])\n\n const watchedRecurring = useWatch({ control, name: 'recurring' })\n\n const isPending = isPendingCreate || isPendingUpdate\n\n const onSubmit: SubmitHandler<DeductionPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, times: payload.recurring ? null : 1 },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...payload,\n version: deduction.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CANCEL)\n }\n\n const title = !deduction ? t('addDeductionTitle') : t('editDeductionTitle')\n\n return (\n <section className={className}>\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Components.Heading as=\"h2\">{title}</Components.Heading>\n <TextInputField name=\"description\" label={t('descriptionLabel')} isRequired />\n <RadioGroupField\n name=\"deductAsPercentage\"\n label={t('deductionTypeLabel')}\n isRequired\n options={[\n { value: 'true', label: t('deductionTypePercentageOption') },\n { value: 'false', label: t('deductionTypeFixedAmountOption') },\n ]}\n />\n <NumberInputField\n name=\"amount\"\n label={t('deductionAmountLabel')}\n isRequired\n min={0}\n />\n <RadioGroupField\n name=\"recurring\"\n label={t('frequencyLabel')}\n isRequired\n options={[\n { value: 'true', label: t('frequencyRecurringOption') },\n { value: 'false', label: t('frequencyOneTimeOption') },\n ]}\n />\n {watchedRecurring === 'true' && (\n <>\n <NumberInputField name=\"annualMaximum\" label={t('annualMaxLabel')} min={0} />\n <NumberInputField name=\"payPeriodMaximum\" label=\"Pay period maximum\" min={0} />\n </>\n )}\n <CheckboxField name=\"courtOrdered\" label={t('courtOrderedLabel')} />\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {!deduction ? t('addDeductionCta') : t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n )}\n </Flex>\n </Form>\n </FormProvider>\n </section>\n )\n}\n"],"names":["DeductionSchema","z","val","DeductionsForm","props","jsx","BaseComponent","Root","className","children","employeeId","deductionId","dictionary","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","useComponentDictionary","useI18n","data","useGarnishmentsListSuspense","deduction","g","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","defaultValues","useMemo","formMethods","useForm","zodResolver","resetForm","control","useEffect","watchedRecurring","useWatch","isPending","onSubmit","payload","updateDeductionResponse","componentEvents","createDeductionResponse","handleCancel","title","FormProvider","Form","Flex","jsxs","Fragment","TextInputField","RadioGroupField","NumberInputField","CheckboxField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA4BO,MAAMA,KAAkBC,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,OAAA,EAAS,UAAU,CAAAC,MAAOA,MAAQ,MAAM;AAAA,EACrD,eAAeD,EACZ,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAC,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,kBAAkBD,EACf,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAC,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,oBAAoBD,EAAE,OAAA,EAAS,UAAU,CAAAC,MAAOA,MAAQ,MAAM;AAChE,CAAC;AAUM,SAASC,GAAeC,GAAqD;AAClF,SACE,gBAAAC,EAACC,GAAA,EA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EACC,UAAA;AAAA,MAAA,gBAAAtD,EAACa,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAAS8B,GAC7C,UAAAhC,EAAE,WAAW,EAAA,CAChB;AAAA,MACA,gBAAAX,EAACa,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWwB,GACzC,UAAoC1B,EAAnCQ,IAAqC,gBAAvB,iBAAoC,EAAA,CACtD;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,EAAA,CACF,EAAA,CAEJ,GACF,EAAA,CACF,EAAA,CACF;AAEJ;"}
@@ -0,0 +1,6 @@
1
+ import { BaseComponentInterface, CommonComponentInterface } from '../../../Base';
2
+ interface DeductionsListProps extends CommonComponentInterface<'Employee.Deductions'> {
3
+ employeeId: string;
4
+ }
5
+ export declare function DeductionsList(props: DeductionsListProps & BaseComponentInterface): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,98 @@
1
+ import { jsx as n, jsxs as c, Fragment as A } from "react/jsx-runtime";
2
+ import { useTranslation as O } from "react-i18next";
3
+ import { useGarnishmentsListSuspense as x } from "@gusto/embedded-api/react-query/garnishmentsList";
4
+ import { useGarnishmentsUpdateMutation as N } from "@gusto/embedded-api/react-query/garnishmentsUpdate";
5
+ import { BaseComponent as _ } from "../../../Base/Base.js";
6
+ import { useBase as k } from "../../../Base/useBase.js";
7
+ import { Flex as w } from "../../../Common/Flex/Flex.js";
8
+ import { ActionsLayout as I } from "../../../Common/ActionsLayout/ActionsLayout.js";
9
+ import u from "../../../Common/hooks/useNumberFormatter.js";
10
+ import M from "../../../../assets/icons/pencil.svg.js";
11
+ import U from "../../../../assets/icons/trashcan.svg.js";
12
+ import { HamburgerMenu as B } from "../../../Common/HamburgerMenu/HamburgerMenu.js";
13
+ import { useComponentDictionary as S, useI18n as Y } from "../../../../i18n/I18n.js";
14
+ import { componentEvents as a } from "../../../../shared/constants.js";
15
+ import { useComponentContext as q } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
16
+ import { useDataView as F } from "../../../Common/DataView/useDataView.js";
17
+ import { DataView as H } from "../../../Common/DataView/DataView.js";
18
+ function se(r) {
19
+ return /* @__PURE__ */ n(_, { ...r, children: /* @__PURE__ */ n(V, { ...r, children: r.children }) });
20
+ }
21
+ function V({ className: r, children: m, employeeId: d, dictionary: l }) {
22
+ const { onEvent: i, baseSubmitHandler: p } = k(), { t } = O("Employee.Deductions"), s = q(), E = u("currency"), f = u("percent");
23
+ S("Employee.Deductions", l), Y("Employee.Deductions");
24
+ const { data: D } = x({ employeeId: d }), h = D.garnishmentList.filter((e) => e.active), { mutateAsync: C, isPending: g } = N(), y = async (e) => {
25
+ await p(e, async (o) => {
26
+ const { garnishment: P } = await C({
27
+ request: {
28
+ garnishmentId: o.uuid,
29
+ requestBody: {
30
+ ...o,
31
+ totalAmount: o.totalAmount ?? void 0,
32
+ active: !1,
33
+ version: o.version
34
+ }
35
+ }
36
+ });
37
+ i(a.EMPLOYEE_DEDUCTION_DELETED, P);
38
+ });
39
+ }, v = (e) => {
40
+ i(a.EMPLOYEE_DEDUCTION_EDIT, e);
41
+ }, T = () => {
42
+ i(a.EMPLOYEE_DEDUCTION_ADD);
43
+ }, b = () => {
44
+ i(a.EMPLOYEE_DEDUCTION_DONE);
45
+ }, { ...L } = F({
46
+ data: h,
47
+ columns: [
48
+ { key: "description", title: t("nameColumn") },
49
+ {
50
+ key: "recurring",
51
+ title: t("frequencyColumn"),
52
+ render: (e) => e.recurring ? t("recurringText") : t("nonRecurringText")
53
+ },
54
+ {
55
+ key: "amount",
56
+ title: t("withheldColumn"),
57
+ render: (e) => {
58
+ const o = e.deductAsPercentage ? f(Number(e.amount)) : E(Number(e.amount));
59
+ return e.recurring ? t("recurringAmount", { value: o }) : o;
60
+ }
61
+ }
62
+ ],
63
+ itemMenu: (e) => /* @__PURE__ */ n(
64
+ B,
65
+ {
66
+ isLoading: g,
67
+ items: [
68
+ {
69
+ label: t("editCta"),
70
+ onClick: () => {
71
+ v(e);
72
+ },
73
+ icon: /* @__PURE__ */ n(M, { "aria-hidden": !0 })
74
+ },
75
+ {
76
+ label: t("deleteCta"),
77
+ onClick: async () => {
78
+ await y(e);
79
+ },
80
+ icon: /* @__PURE__ */ n(U, { "aria-hidden": !0 })
81
+ }
82
+ ]
83
+ }
84
+ )
85
+ });
86
+ return /* @__PURE__ */ n("section", { className: r, children: /* @__PURE__ */ n(w, { flexDirection: "column", gap: 32, children: m || /* @__PURE__ */ c(A, { children: [
87
+ /* @__PURE__ */ n(s.Heading, { as: "h2", children: t("pageTitle") }),
88
+ /* @__PURE__ */ n(H, { label: t("deductionsTableLabel"), ...L }),
89
+ /* @__PURE__ */ c(I, { children: [
90
+ /* @__PURE__ */ n(s.Button, { variant: "secondary", onClick: T, children: t("addDeductionCta") }),
91
+ /* @__PURE__ */ n(s.Button, { onClick: b, children: t("continueCta") })
92
+ ] })
93
+ ] }) }) });
94
+ }
95
+ export {
96
+ se as DeductionsList
97
+ };
98
+ //# sourceMappingURL=DeductionsList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DeductionsList.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsList/DeductionsList.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useGarnishmentsListSuspense } from '@gusto/embedded-api/react-query/garnishmentsList'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { useDataView, DataView } from '@/components/Common'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport useNumberFormatter from '@/components/Common/hooks/useNumberFormatter'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\ninterface DeductionsListProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n}\n\nexport function DeductionsList(props: DeductionsListProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ className, children, employeeId, dictionary }: DeductionsListProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n const formatCurrency = useNumberFormatter('currency')\n const formatPercent = useNumberFormatter('percent')\n\n useComponentDictionary('Employee.Deductions', dictionary)\n useI18n('Employee.Deductions')\n\n const { data } = useGarnishmentsListSuspense({ employeeId })\n const deductions = data.garnishmentList!\n const activeDeductions = deductions.filter(deduction => deduction.active)\n\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n\n const handleDelete = async (deduction: Garnishment) => {\n await baseSubmitHandler(deduction, async payload => {\n const { garnishment } = await updateDeduction({\n request: {\n garnishmentId: payload.uuid,\n requestBody: {\n ...payload,\n totalAmount: payload.totalAmount ?? undefined,\n active: false,\n version: payload.version as string,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DELETED, garnishment)\n })\n }\n\n const handleEdit = (deduction: Garnishment) => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_EDIT, deduction)\n }\n\n const handleAdd = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_ADD)\n }\n\n const handleContinue = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DONE)\n }\n\n const { ...dataViewProps } = useDataView({\n data: activeDeductions,\n columns: [\n { key: 'description', title: t('nameColumn') },\n {\n key: 'recurring',\n title: t('frequencyColumn'),\n render: deduction => {\n return deduction.recurring ? t('recurringText') : t('nonRecurringText')\n },\n },\n {\n key: 'amount',\n title: t('withheldColumn'),\n render: deduction => {\n const formattedAmount = deduction.deductAsPercentage\n ? formatPercent(Number(deduction.amount))\n : formatCurrency(Number(deduction.amount))\n return deduction.recurring\n ? t('recurringAmount', { value: formattedAmount })\n : formattedAmount\n },\n },\n ],\n itemMenu: deduction => {\n return (\n <HamburgerMenu\n isLoading={isPendingUpdate}\n items={[\n {\n label: t('editCta'),\n onClick: () => {\n handleEdit(deduction)\n },\n icon: <PencilSvg aria-hidden />,\n },\n {\n label: t('deleteCta'),\n onClick: async () => {\n await handleDelete(deduction)\n },\n icon: <TrashCanSvg aria-hidden />,\n },\n ]}\n />\n )\n },\n })\n\n return (\n <section className={className}>\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Components.Heading as=\"h2\">{t('pageTitle')}</Components.Heading>\n <DataView label={t('deductionsTableLabel')} {...dataViewProps} />\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleAdd}>\n {t('addDeductionCta')}\n </Components.Button>\n <Components.Button onClick={handleContinue}>{t('continueCta')}</Components.Button>\n </ActionsLayout>\n </>\n )}\n </Flex>\n </section>\n )\n}\n"],"names":["DeductionsList","props","jsx","BaseComponent","Root","className","children","employeeId","dictionary","onEvent","baseSubmitHandler","useBase","useTranslation","Components","useComponentContext","formatCurrency","useNumberFormatter","formatPercent","useComponentDictionary","useI18n","data","useGarnishmentsListSuspense","activeDeductions","deduction","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","handleDelete","payload","garnishment","componentEvents","handleEdit","handleAdd","handleContinue","dataViewProps","useDataView","formattedAmount","HamburgerMenu","PencilSvg","TrashCanSvg","Flex","jsxs","Fragment","DataView","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;AA0BO,SAASA,GAAeC,GAAqD;AAClF,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,E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AAAA,sBAC3C8B,GAAA,EAAS,OAAO,EAAE,sBAAsB,GAAI,GAAGT,GAAe;AAAA,sBAC9DU,GAAA,EACC,UAAA;AAAA,MAAA,gBAAA1C,EAACW,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASmB,GAC7C,UAAA,EAAE,iBAAiB,EAAA,CACtB;AAAA,MACA,gBAAA9B,EAACW,EAAW,QAAX,EAAkB,SAASoB,GAAiB,UAAA,EAAE,aAAa,EAAA,CAAE;AAAA,IAAA,EAAA,CAChE;AAAA,EAAA,EAAA,CACF,GAEJ,GACF;AAEJ;"}
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ import { BaseComponentInterface, CommonComponentInterface } from '../../../Base';
3
+ declare const IncludeDeductionsSchema: z.ZodObject<{
4
+ includeDeductions: z.ZodEnum<["Yes", "No"]>;
5
+ }, "strip", z.ZodTypeAny, {
6
+ includeDeductions: "Yes" | "No";
7
+ }, {
8
+ includeDeductions: "Yes" | "No";
9
+ }>;
10
+ export type IncludeDeductionsPayload = z.output<typeof IncludeDeductionsSchema>;
11
+ interface IncludeDeductionsFormProps extends CommonComponentInterface<'Employee.Deductions'> {
12
+ employeeId: string;
13
+ }
14
+ export declare function IncludeDeductionsForm(props: IncludeDeductionsFormProps & BaseComponentInterface): import("react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -0,0 +1,48 @@
1
+ import { jsx as e, jsxs as p, Fragment as a } from "react/jsx-runtime";
2
+ import { useTranslation as D } from "react-i18next";
3
+ import { z as m } from "zod";
4
+ import { useForm as f, FormProvider as E } from "react-hook-form";
5
+ import { zodResolver as h } from "@hookform/resolvers/zod";
6
+ import { BaseComponent as C } from "../../../Base/Base.js";
7
+ import { useBase as b } from "../../../Base/useBase.js";
8
+ import { Form as N } from "../../../Common/Form/Form.js";
9
+ import { ActionsLayout as v } from "../../../Common/ActionsLayout/ActionsLayout.js";
10
+ import { useComponentDictionary as F, useI18n as I } from "../../../../i18n/I18n.js";
11
+ import { componentEvents as s } from "../../../../shared/constants.js";
12
+ import { useComponentContext as Y } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
13
+ import { RadioGroupField as y } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
14
+ const L = m.object({ includeDeductions: m.enum(["Yes", "No"]) });
15
+ function A(n) {
16
+ return /* @__PURE__ */ e(C, { ...n, children: /* @__PURE__ */ e(_, { ...n, children: n.children }) });
17
+ }
18
+ function _({ className: n, children: t, dictionary: u }) {
19
+ const { onEvent: i } = b(), { t: o } = D("Employee.Deductions"), r = Y();
20
+ F("Employee.Deductions", u), I("Employee.Deductions");
21
+ const c = f({
22
+ resolver: h(L),
23
+ defaultValues: { includeDeductions: "No" }
24
+ }), d = (l) => {
25
+ l.includeDeductions === "Yes" ? i(s.EMPLOYEE_DEDUCTION_INCLUDE_YES) : i(s.EMPLOYEE_DEDUCTION_INCLUDE_NO);
26
+ };
27
+ return /* @__PURE__ */ e("section", { className: n, children: /* @__PURE__ */ e(E, { ...c, children: /* @__PURE__ */ e(N, { onSubmit: c.handleSubmit(d), children: t || /* @__PURE__ */ p(a, { children: [
28
+ /* @__PURE__ */ e(r.Heading, { as: "h2", children: o("pageTitle") }),
29
+ /* @__PURE__ */ e(
30
+ y,
31
+ {
32
+ name: "includeDeductions",
33
+ isRequired: !0,
34
+ label: o("includeDeductionsFormLabel"),
35
+ description: o("includeDeductionsDescription"),
36
+ options: [
37
+ { value: "Yes", label: o("includeDeductionsYes") },
38
+ { value: "No", label: o("includeDeductionsNo") }
39
+ ]
40
+ }
41
+ ),
42
+ /* @__PURE__ */ e(v, { children: /* @__PURE__ */ e(r.Button, { type: "submit", children: o("continueCta") }) })
43
+ ] }) }) }) });
44
+ }
45
+ export {
46
+ A as IncludeDeductionsForm
47
+ };
48
+ //# sourceMappingURL=IncludeDeductionsForm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IncludeDeductionsForm.js","sources":["../../../../../src/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { FormProvider, useForm, type SubmitHandler } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { Form } from '@/components/Common/Form'\nimport { RadioGroupField } from '@/components/Common'\nimport { ActionsLayout } from '@/components/Common'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\nconst IncludeDeductionsSchema = z.object({ includeDeductions: z.enum(['Yes', 'No']) })\nexport type IncludeDeductionsPayload = z.output<typeof IncludeDeductionsSchema>\n\ninterface IncludeDeductionsFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n}\n\nexport function IncludeDeductionsForm(props: IncludeDeductionsFormProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ className, children, dictionary }: IncludeDeductionsFormProps) {\n const { onEvent } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n useComponentDictionary('Employee.Deductions', dictionary)\n useI18n('Employee.Deductions')\n\n const formMethods = useForm<IncludeDeductionsPayload>({\n resolver: zodResolver(IncludeDeductionsSchema),\n defaultValues: { includeDeductions: 'No' },\n })\n\n const onSubmit: SubmitHandler<IncludeDeductionsPayload> = data => {\n if (data.includeDeductions === 'Yes') {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_INCLUDE_YES)\n } else {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_INCLUDE_NO)\n }\n }\n\n return (\n <section className={className}>\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n {children ? (\n children\n ) : (\n <>\n <Components.Heading as=\"h2\">{t('pageTitle')}</Components.Heading>\n <RadioGroupField\n name=\"includeDeductions\"\n isRequired\n label={t('includeDeductionsFormLabel')}\n description={t('includeDeductionsDescription')}\n options={[\n { value: 'Yes', label: t('includeDeductionsYes') },\n { value: 'No', label: t('includeDeductionsNo') },\n ]}\n />\n <ActionsLayout>\n <Components.Button type=\"submit\">{t('continueCta')}</Components.Button>\n </ActionsLayout>\n </>\n )}\n </Form>\n </FormProvider>\n </section>\n )\n}\n"],"names":["IncludeDeductionsSchema","z","IncludeDeductionsForm","props","jsx","BaseComponent","Root","className","children","dictionary","onEvent","useBase","t","useTranslation","Components","useComponentContext","useComponentDictionary","useI18n","formMethods","useForm","zodResolver","onSubmit","data","componentEvents","FormProvider","Form","jsxs","Fragment","RadioGroupField","ActionsLayout"],"mappings":";;;;;;;;;;;;;AAkBA,MAAMA,IAA0BC,EAAE,OAAO,EAAE,mBAAmBA,EAAE,KAAK,CAAC,OAAO,IAAI,CAAC,GAAG;AAO9E,SAASC,EAAsBC,GAA4D;AAChG,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,SAASG,EAAK,EAAE,WAAAC,GAAW,UAAAC,GAAU,YAAAC,KAA0C;AAC7E,QAAM,EAAE,SAAAC,EAAA,IAAYC,EAAA,GACd,EAAE,GAAAC,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA;AAEnB,EAAAC,EAAuB,uBAAuBP,CAAU,GACxDQ,EAAQ,qBAAqB;AAE7B,QAAMC,IAAcC,EAAkC;AAAA,IACpD,UAAUC,EAAYpB,CAAuB;AAAA,IAC7C,eAAe,EAAE,mBAAmB,KAAA;AAAA,EAAK,CAC1C,GAEKqB,IAAoD,CAAAC,MAAQ;AAChE,IAAIA,EAAK,sBAAsB,QAC7BZ,EAAQa,EAAgB,8BAA8B,IAEtDb,EAAQa,EAAgB,6BAA6B;AAAA,EAEzD;AAEA,2BACG,WAAA,EAAQ,WAAAhB,GACP,UAAA,gBAAAH,EAACoB,GAAA,EAAc,GAAGN,GAChB,UAAA,gBAAAd,EAACqB,GAAA,EAAK,UAAUP,EAAY,aAAaG,CAAQ,GAC9C,UAAAb,KAGC,gBAAAkB,EAAAC,GAAA,EACE,UAAA;AAAA,IAAA,gBAAAvB,EAACU,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAAF,EAAE,WAAW,GAAE;AAAA,IAC5C,gBAAAR;AAAA,MAACwB;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,YAAU;AAAA,QACV,OAAOhB,EAAE,4BAA4B;AAAA,QACrC,aAAaA,EAAE,8BAA8B;AAAA,QAC7C,SAAS;AAAA,UACP,EAAE,OAAO,OAAO,OAAOA,EAAE,sBAAsB,EAAA;AAAA,UAC/C,EAAE,OAAO,MAAM,OAAOA,EAAE,qBAAqB,EAAA;AAAA,QAAE;AAAA,MACjD;AAAA,IAAA;AAAA,IAEF,gBAAAR,EAACyB,GAAA,EACC,UAAA,gBAAAzB,EAACU,EAAW,QAAX,EAAkB,MAAK,UAAU,UAAAF,EAAE,aAAa,EAAA,CAAE,EAAA,CACrD;AAAA,EAAA,GACF,EAAA,CAEJ,GACF,GACF;AAEJ;"}
@@ -0,0 +1,7 @@
1
+ export declare const deductionsStateMachine: {
2
+ includeDeductions: import('robot3').MachineState<"employee/deductions/include/yes" | "employee/deductions/include/no">;
3
+ viewDeductions: import('robot3').MachineState<"employee/deductions/add" | "employee/deductions/deleted" | "employee/deductions/done" | "employee/deductions/edit">;
4
+ addDeduction: import('robot3').MachineState<"employee/deductions/created" | "employee/deductions/cancel">;
5
+ editDeduction: import('robot3').MachineState<"employee/deductions/updated" | "employee/deductions/cancel">;
6
+ done: import('robot3').MachineState<string>;
7
+ };