@gusto/embedded-react-sdk 0.11.3 → 0.12.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 (281) hide show
  1. package/CHANGELOG.md +181 -0
  2. package/dist/components/Common/DataView/DataCards/DataCards.module.scss.js +1 -1
  3. package/dist/components/Common/DocumentList/DocumentList.module.scss.js +1 -1
  4. package/dist/components/Common/DocumentViewer/DocumentViewer.module.scss.js +1 -1
  5. package/dist/components/Common/EmptyData/EmptyData.module.scss.js +1 -1
  6. package/dist/components/Common/FieldErrorMessage/FieldErrorMessage.module.scss.js +1 -1
  7. package/dist/components/Common/FieldLayout/FieldLayout.module.scss.js +6 -6
  8. package/dist/components/Common/Flex/Flex.d.ts +2 -2
  9. package/dist/components/Common/Flex/Flex.js +5 -5
  10. package/dist/components/Common/Flex/Flex.js.map +1 -1
  11. package/dist/components/Common/Form/Form.module.scss.js +2 -2
  12. package/dist/components/Common/Grid/Grid.d.ts +2 -2
  13. package/dist/components/Common/Grid/Grid.js +13 -13
  14. package/dist/components/Common/Grid/Grid.js.map +1 -1
  15. package/dist/components/Common/HorizontalFieldLayout/HorizontalFieldLayout.module.scss.js +12 -12
  16. package/dist/components/Common/InternalError/InternalError.module.scss.js +1 -1
  17. package/dist/components/Common/Loading/Loading.module.scss.js +1 -1
  18. package/dist/components/Common/PaginationControl/PaginationControl.module.scss.js +1 -1
  19. package/dist/components/Common/ReorderableList/ReorderableList.module.scss.js +15 -15
  20. package/dist/components/Common/RequirementsList/RequirementsList.module.scss.js +1 -1
  21. package/dist/components/Common/SignatureForm/SignatureForm.js +1 -1
  22. package/dist/components/Common/SignatureForm/SignatureForm.module.scss.js +6 -6
  23. package/dist/components/Common/SignatureForm/SignatureFormActions.js +1 -1
  24. package/dist/components/Common/SignatureForm/SignatureFormFields.js +1 -1
  25. package/dist/components/Common/UI/Alert/Alert.module.scss.js +1 -1
  26. package/dist/components/Common/UI/Badge/Badge.module.scss.js +1 -1
  27. package/dist/components/Common/UI/Button/Button.module.scss.js +1 -1
  28. package/dist/components/Common/UI/Button/ButtonIcon.module.scss.js +1 -1
  29. package/dist/components/Common/UI/CalendarPreview/CalendarPreview.module.scss.js +5 -5
  30. package/dist/components/Common/UI/Card/Card.module.scss.js +1 -1
  31. package/dist/components/Common/UI/Checkbox/Checkbox.module.scss.js +8 -8
  32. package/dist/components/Common/UI/CheckboxGroup/CheckboxGroup.module.scss.js +1 -1
  33. package/dist/components/Common/UI/ComboBox/ComboBox.module.scss.js +1 -1
  34. package/dist/components/Common/UI/DatePicker/DatePicker.module.scss.js +5 -5
  35. package/dist/components/Common/UI/Input/Input.module.scss.js +7 -7
  36. package/dist/components/Common/UI/Link/Link.module.scss.js +1 -1
  37. package/dist/components/Common/UI/List/List.module.scss.js +1 -1
  38. package/dist/components/Common/UI/Menu/Menu.module.scss.js +5 -5
  39. package/dist/components/Common/UI/NumberInput/NumberInput.js +36 -38
  40. package/dist/components/Common/UI/NumberInput/NumberInput.js.map +1 -1
  41. package/dist/components/Common/UI/ProgressBar/ProgressBar.module.scss.js +1 -1
  42. package/dist/components/Common/UI/Radio/Radio.module.scss.js +1 -1
  43. package/dist/components/Common/UI/RadioGroup/RadioGroup.module.scss.js +1 -1
  44. package/dist/components/Common/UI/Select/Select.module.scss.js +1 -1
  45. package/dist/components/Common/UI/Switch/Switch.module.scss.js +4 -4
  46. package/dist/components/Common/UI/Table/Table.module.scss.js +1 -1
  47. package/dist/components/Common/UI/Text/Text.module.scss.js +14 -14
  48. package/dist/components/Company/AssignSignatory/AssignSignatory.js +7 -6
  49. package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
  50. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +2 -3
  51. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
  52. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +2 -3
  53. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
  54. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +3 -2
  55. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js.map +1 -1
  56. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +14 -13
  57. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js.map +1 -1
  58. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +2 -3
  59. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
  60. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +6 -5
  61. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js.map +1 -1
  62. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +11 -10
  63. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js.map +1 -1
  64. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +6 -6
  65. package/dist/components/Company/BankAccount/BankAccountForm/Form.js +8 -9
  66. package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
  67. package/dist/components/Company/BankAccount/BankAccountList/Actions.js +8 -9
  68. package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
  69. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +7 -8
  70. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
  71. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +4 -5
  72. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
  73. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +2 -3
  74. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
  75. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +9 -8
  76. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  77. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +7 -6
  78. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  79. package/dist/components/Company/FederalTaxes/Actions.js +5 -6
  80. package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
  81. package/dist/components/Company/FederalTaxes/FederalTaxes.js +13 -12
  82. package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
  83. package/dist/components/Company/FederalTaxes/Form.js +3 -4
  84. package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
  85. package/dist/components/Company/Industry/Actions.js +2 -3
  86. package/dist/components/Company/Industry/Actions.js.map +1 -1
  87. package/dist/components/Company/Industry/Edit.js +4 -5
  88. package/dist/components/Company/Industry/Edit.js.map +1 -1
  89. package/dist/components/Company/Locations/LocationForm/Actions.js +6 -7
  90. package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
  91. package/dist/components/Company/Locations/LocationForm/Form.js +6 -5
  92. package/dist/components/Company/Locations/LocationForm/Form.js.map +1 -1
  93. package/dist/components/Company/Locations/LocationForm/LocationForm.js +11 -10
  94. package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
  95. package/dist/components/Company/Locations/LocationsList/Actions.js +6 -7
  96. package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
  97. package/dist/components/Company/Locations/LocationsList/List.js +2 -3
  98. package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
  99. package/dist/components/Company/Locations/LocationsList/LocationsList.js +7 -6
  100. package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
  101. package/dist/components/Company/OnboardingOverview/Completed.js +10 -11
  102. package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
  103. package/dist/components/Company/OnboardingOverview/MissingRequirements.js +6 -7
  104. package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
  105. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +3 -2
  106. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
  107. package/dist/components/Company/PaySchedule/PaySchedule.js +34 -33
  108. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  109. package/dist/components/Company/PaySchedule/_parts/Actions.js +9 -10
  110. package/dist/components/Company/PaySchedule/_parts/Actions.js.map +1 -1
  111. package/dist/components/Company/PaySchedule/_parts/Edit.js +17 -16
  112. package/dist/components/Company/PaySchedule/_parts/Edit.js.map +1 -1
  113. package/dist/components/Company/PaySchedule/_parts/Edit.module.scss.js +1 -1
  114. package/dist/components/Company/PaySchedule/_parts/Head.js +6 -7
  115. package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
  116. package/dist/components/Company/PaySchedule/_parts/List.js +11 -12
  117. package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
  118. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +2 -3
  119. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
  120. package/dist/components/Company/StateTaxes/StateTaxesForm/Form.js +8 -8
  121. package/dist/components/Company/StateTaxes/StateTaxesForm/Form.js.map +1 -1
  122. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +2 -3
  123. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
  124. package/dist/components/Company/StateTaxes/StateTaxesList/List.js +2 -3
  125. package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
  126. package/dist/components/Contractor/Address/Address.js +5 -4
  127. package/dist/components/Contractor/Address/Address.js.map +1 -1
  128. package/dist/components/Contractor/Address/Form.js +4 -3
  129. package/dist/components/Contractor/Address/Form.js.map +1 -1
  130. package/dist/components/Contractor/ContractorList/index.d.ts +16 -0
  131. package/dist/components/Contractor/ContractorList/index.js +125 -0
  132. package/dist/components/Contractor/ContractorList/index.js.map +1 -0
  133. package/dist/components/Contractor/{List → ContractorList}/useContractorList.d.ts +1 -3
  134. package/dist/components/Contractor/{List → ContractorList}/useContractorList.js +9 -10
  135. package/dist/components/Contractor/ContractorList/useContractorList.js.map +1 -0
  136. package/dist/components/Contractor/OnboardingFlow/OnboardingFlow.d.ts +2 -0
  137. package/dist/components/Contractor/OnboardingFlow/OnboardingFlow.js +25 -0
  138. package/dist/components/Contractor/OnboardingFlow/OnboardingFlow.js.map +1 -0
  139. package/dist/components/Contractor/OnboardingFlow/OnboardingFlowComponents.d.ts +26 -0
  140. package/dist/components/Contractor/OnboardingFlow/OnboardingFlowComponents.js +71 -0
  141. package/dist/components/Contractor/OnboardingFlow/OnboardingFlowComponents.js.map +1 -0
  142. package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.d.ts +9 -0
  143. package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.js +119 -0
  144. package/dist/components/Contractor/OnboardingFlow/onboardingStateMachine.js.map +1 -0
  145. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +5 -6
  146. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -1
  147. package/dist/components/Contractor/Profile/ContractorProfile.js +31 -17
  148. package/dist/components/Contractor/Profile/ContractorProfile.js.map +1 -1
  149. package/dist/components/Contractor/Profile/ContractorProfileForm.d.ts +1 -1
  150. package/dist/components/Contractor/Profile/ContractorProfileForm.js +40 -44
  151. package/dist/components/Contractor/Profile/ContractorProfileForm.js.map +1 -1
  152. package/dist/components/Contractor/Profile/useContractorProfile.d.ts +13 -12
  153. package/dist/components/Contractor/Profile/useContractorProfile.js +144 -144
  154. package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
  155. package/dist/components/Contractor/Submit/Submit.d.ts +7 -0
  156. package/dist/components/Contractor/Submit/Submit.js +77 -0
  157. package/dist/components/Contractor/Submit/Submit.js.map +1 -0
  158. package/dist/components/Contractor/Submit/SubmitDone.js +11 -11
  159. package/dist/components/Contractor/Submit/SubmitDone.js.map +1 -1
  160. package/dist/components/Contractor/index.d.ts +3 -2
  161. package/dist/components/Contractor/index.js +10 -8
  162. package/dist/components/Contractor/index.js.map +1 -1
  163. package/dist/components/Employee/Compensation/Actions.js +1 -1
  164. package/dist/components/Employee/Compensation/Edit.js +12 -12
  165. package/dist/components/Employee/Compensation/List.js +22 -23
  166. package/dist/components/Employee/Compensation/List.js.map +1 -1
  167. package/dist/components/Employee/Deductions/Deductions.d.ts +8 -14
  168. package/dist/components/Employee/Deductions/Deductions.js +47 -140
  169. package/dist/components/Employee/Deductions/Deductions.js.map +1 -1
  170. package/dist/components/Employee/Deductions/DeductionsComponents.d.ts +23 -0
  171. package/dist/components/Employee/Deductions/DeductionsComponents.js +31 -0
  172. package/dist/components/Employee/Deductions/DeductionsComponents.js.map +1 -0
  173. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.d.ts +41 -0
  174. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js +135 -0
  175. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js.map +1 -0
  176. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.d.ts +6 -0
  177. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +99 -0
  178. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js.map +1 -0
  179. package/dist/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.d.ts +15 -0
  180. package/dist/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.js +49 -0
  181. package/dist/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.js.map +1 -0
  182. package/dist/components/Employee/Deductions/stateMachine.d.ts +7 -0
  183. package/dist/components/Employee/Deductions/stateMachine.js +107 -0
  184. package/dist/components/Employee/Deductions/stateMachine.js.map +1 -0
  185. package/dist/components/Employee/Deductions/useDeductions.d.ts +2 -2
  186. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +6 -7
  187. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
  188. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +8 -7
  189. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  190. package/dist/components/Employee/DocumentSigner/DocumentList/List.js +2 -3
  191. package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
  192. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +10 -9
  193. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  194. package/dist/components/Employee/EmployeeList/Actions.js +2 -3
  195. package/dist/components/Employee/EmployeeList/Actions.js.map +1 -1
  196. package/dist/components/Employee/EmployeeList/EmployeeList.js +4 -3
  197. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  198. package/dist/components/Employee/EmployeeList/Head.js +5 -6
  199. package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
  200. package/dist/components/Employee/EmployeeList/List.js +12 -12
  201. package/dist/components/Employee/Landing/Landing.js +8 -8
  202. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +7 -7
  203. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.module.scss.js +6 -6
  204. package/dist/components/Employee/PaymentMethod/Actions.js +5 -6
  205. package/dist/components/Employee/PaymentMethod/Actions.js.map +1 -1
  206. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +1 -1
  207. package/dist/components/Employee/PaymentMethod/BankAccountsList.js +8 -9
  208. package/dist/components/Employee/PaymentMethod/BankAccountsList.js.map +1 -1
  209. package/dist/components/Employee/PaymentMethod/Split.js +8 -8
  210. package/dist/components/Employee/Profile/Actions.js +6 -7
  211. package/dist/components/Employee/Profile/Actions.js.map +1 -1
  212. package/dist/components/Employee/Profile/HomeAddress.js +6 -5
  213. package/dist/components/Employee/Profile/HomeAddress.js.map +1 -1
  214. package/dist/components/Employee/Profile/PersonalDetailsInputs.js +22 -21
  215. package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
  216. package/dist/components/Employee/Taxes/Actions.js +8 -9
  217. package/dist/components/Employee/Taxes/Actions.js.map +1 -1
  218. package/dist/components/Employee/Taxes/FederalForm.js +12 -13
  219. package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
  220. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.d.ts +3 -3
  221. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +2 -3
  222. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
  223. package/dist/contexts/ThemeProvider/ThemeProvider.d.ts +1 -5
  224. package/dist/contexts/ThemeProvider/ThemeProvider.js +18 -60
  225. package/dist/contexts/ThemeProvider/ThemeProvider.js.map +1 -1
  226. package/dist/contexts/ThemeProvider/theme.d.ts +42 -11
  227. package/dist/contexts/ThemeProvider/theme.js +31 -15
  228. package/dist/contexts/ThemeProvider/theme.js.map +1 -1
  229. package/dist/helpers/responsive.d.ts +0 -3
  230. package/dist/helpers/responsive.js +20 -34
  231. package/dist/helpers/responsive.js.map +1 -1
  232. package/dist/i18n/I18n.js +1 -1
  233. package/dist/i18n/I18n.js.map +1 -1
  234. package/dist/i18n/en/Contractor.ContractorList.json.js +14 -10
  235. package/dist/i18n/en/Contractor.ContractorList.json.js.map +1 -1
  236. package/dist/i18n/en/Contractor.Submit.json.js +22 -0
  237. package/dist/i18n/en/Contractor.Submit.json.js.map +1 -0
  238. package/dist/i18n/en/Employee.Deductions.json.js +49 -51
  239. package/dist/i18n/en/Employee.Deductions.json.js.map +1 -1
  240. package/dist/shared/constants.d.ts +20 -2
  241. package/dist/shared/constants.js +21 -11
  242. package/dist/shared/constants.js.map +1 -1
  243. package/dist/style.css +1 -1
  244. package/dist/types/i18next.d.ts +25 -14
  245. package/package.json +2 -1
  246. package/dist/components/Common/UI/NumberInput/NumberInput.module.scss.js +0 -8
  247. package/dist/components/Common/UI/NumberInput/NumberInput.module.scss.js.map +0 -1
  248. package/dist/components/Contractor/List/index.d.ts +0 -25
  249. package/dist/components/Contractor/List/index.js +0 -81
  250. package/dist/components/Contractor/List/index.js.map +0 -1
  251. package/dist/components/Contractor/List/useContractorList.js.map +0 -1
  252. package/dist/components/Contractor/Submit/ContractorSubmitWithApi.d.ts +0 -6
  253. package/dist/components/Contractor/Submit/ContractorSubmitWithApi.js +0 -27
  254. package/dist/components/Contractor/Submit/ContractorSubmitWithApi.js.map +0 -1
  255. package/dist/components/Contractor/Submit/index.d.ts +0 -6
  256. package/dist/components/Contractor/Submit/index.js +0 -20
  257. package/dist/components/Contractor/Submit/index.js.map +0 -1
  258. package/dist/components/Contractor/Submit/index.module.scss.js +0 -8
  259. package/dist/components/Contractor/Submit/index.module.scss.js.map +0 -1
  260. package/dist/components/Employee/Deductions/Actions.js +0 -27
  261. package/dist/components/Employee/Deductions/Actions.js.map +0 -1
  262. package/dist/components/Employee/Deductions/DeductionForm.d.ts +0 -1
  263. package/dist/components/Employee/Deductions/DeductionForm.js +0 -78
  264. package/dist/components/Employee/Deductions/DeductionForm.js.map +0 -1
  265. package/dist/components/Employee/Deductions/DeductionsList.d.ts +0 -2
  266. package/dist/components/Employee/Deductions/DeductionsList.js +0 -60
  267. package/dist/components/Employee/Deductions/DeductionsList.js.map +0 -1
  268. package/dist/components/Employee/Deductions/Head.js +0 -13
  269. package/dist/components/Employee/Deductions/Head.js.map +0 -1
  270. package/dist/components/Employee/Deductions/IncludeDeductionsForm.d.ts +0 -1
  271. package/dist/components/Employee/Deductions/IncludeDeductionsForm.js +0 -27
  272. package/dist/components/Employee/Deductions/IncludeDeductionsForm.js.map +0 -1
  273. package/dist/components/Employee/Deductions/useDeductions.js +0 -33
  274. package/dist/components/Employee/Deductions/useDeductions.js.map +0 -1
  275. package/dist/contexts/ThemeProvider/createTheme.d.ts +0 -21
  276. package/dist/contexts/ThemeProvider/createTheme.js +0 -269
  277. package/dist/contexts/ThemeProvider/createTheme.js.map +0 -1
  278. package/dist/i18n/en/Contractor.ContractorSubmit.json.js +0 -18
  279. package/dist/i18n/en/Contractor.ContractorSubmit.json.js.map +0 -1
  280. package/dist/types/GTheme.d.ts +0 -254
  281. /package/dist/contexts/ThemeProvider/{createTheme.test.d.ts → theme.test.d.ts} +0 -0
@@ -0,0 +1,135 @@
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 "classnames";
15
+ import { ActionsLayout as J } from "../../../Common/ActionsLayout/ActionsLayout.js";
16
+ import { useComponentDictionary as K, useI18n as Q } from "../../../../i18n/I18n.js";
17
+ import { componentEvents as p } from "../../../../shared/constants.js";
18
+ import { useComponentContext as X } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
19
+ import { TextInputField as Z } from "../../../Common/Fields/TextInputField/TextInputField.js";
20
+ import { RadioGroupField as x } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
21
+ import { NumberInputField as f } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
22
+ import { CheckboxField as $ } from "../../../Common/Fields/CheckboxField/CheckboxField.js";
23
+ const ee = i.object({
24
+ active: i.boolean(),
25
+ amount: i.number().min(0).transform(String),
26
+ description: i.string().min(1),
27
+ courtOrdered: i.boolean(),
28
+ times: i.number().nullable(),
29
+ recurring: i.string().transform((t) => t === "true"),
30
+ annualMaximum: i.number().min(0).transform((t) => t > 0 ? t.toString() : null).nullable(),
31
+ payPeriodMaximum: i.number().min(0).transform((t) => t > 0 ? t.toString() : null).nullable(),
32
+ deductAsPercentage: i.string().transform((t) => t === "true")
33
+ });
34
+ function Me(t) {
35
+ return /* @__PURE__ */ n(z, { ...t, children: /* @__PURE__ */ n(ne, { ...t, children: t.children }) });
36
+ }
37
+ function ne({ className: t, children: b, employeeId: g, deductionId: h, dictionary: y }) {
38
+ const { onEvent: u, baseSubmitHandler: P } = H(), { t: r } = N("Employee.Deductions"), m = X();
39
+ K("Employee.Deductions", y), Q("Employee.Deductions");
40
+ 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(() => ({
41
+ amount: e?.amount ? Number(e.amount) : 0,
42
+ description: e?.description ?? "",
43
+ times: e?.times ?? null,
44
+ recurring: e?.recurring?.toString() ?? "true",
45
+ annualMaximum: e?.annualMaximum ? Number(e.annualMaximum) : null,
46
+ payPeriodMaximum: e?.payPeriodMaximum ? Number(e.payPeriodMaximum) : null,
47
+ deductAsPercentage: e?.deductAsPercentage?.toString() ?? "true",
48
+ active: !0,
49
+ courtOrdered: e?.courtOrdered ?? !1
50
+ }), [e]), s = _({
51
+ resolver: G(ee),
52
+ defaultValues: a
53
+ }), { reset: D, control: v } = s;
54
+ U(() => {
55
+ D(a);
56
+ }, [e, a, D]);
57
+ const A = I({ control: v, name: "recurring" }), F = O || T, R = async (c) => {
58
+ await P(c, async (o) => {
59
+ if (e) {
60
+ const { garnishment: l } = await L({
61
+ request: {
62
+ garnishmentId: e.uuid,
63
+ requestBody: {
64
+ ...o,
65
+ version: e.version,
66
+ times: o.recurring ? null : 1
67
+ }
68
+ }
69
+ });
70
+ u(p.EMPLOYEE_DEDUCTION_UPDATED, l);
71
+ } else {
72
+ const { garnishment: l } = await M({
73
+ request: {
74
+ employeeId: g,
75
+ requestBody: { ...o, times: o.recurring ? null : 1 }
76
+ }
77
+ });
78
+ u(p.EMPLOYEE_DEDUCTION_CREATED, l);
79
+ }
80
+ });
81
+ }, q = () => {
82
+ u(p.EMPLOYEE_DEDUCTION_CANCEL);
83
+ }, S = r(e ? "editDeductionTitle" : "addDeductionTitle");
84
+ 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: [
85
+ /* @__PURE__ */ n(m.Heading, { as: "h2", children: S }),
86
+ /* @__PURE__ */ n(Z, { name: "description", label: r("descriptionLabel"), isRequired: !0 }),
87
+ /* @__PURE__ */ n(
88
+ x,
89
+ {
90
+ name: "deductAsPercentage",
91
+ label: r("deductionTypeLabel"),
92
+ isRequired: !0,
93
+ options: [
94
+ { value: "true", label: r("deductionTypePercentageOption") },
95
+ { value: "false", label: r("deductionTypeFixedAmountOption") }
96
+ ]
97
+ }
98
+ ),
99
+ /* @__PURE__ */ n(
100
+ f,
101
+ {
102
+ name: "amount",
103
+ label: r("deductionAmountLabel"),
104
+ isRequired: !0,
105
+ min: 0
106
+ }
107
+ ),
108
+ /* @__PURE__ */ n(
109
+ x,
110
+ {
111
+ name: "recurring",
112
+ label: r("frequencyLabel"),
113
+ isRequired: !0,
114
+ options: [
115
+ { value: "true", label: r("frequencyRecurringOption") },
116
+ { value: "false", label: r("frequencyOneTimeOption") }
117
+ ]
118
+ }
119
+ ),
120
+ A === "true" && /* @__PURE__ */ d(E, { children: [
121
+ /* @__PURE__ */ n(f, { name: "annualMaximum", label: r("annualMaxLabel"), min: 0 }),
122
+ /* @__PURE__ */ n(f, { name: "payPeriodMaximum", label: "Pay period maximum", min: 0 })
123
+ ] }),
124
+ /* @__PURE__ */ n($, { name: "courtOrdered", label: r("courtOrderedLabel") }),
125
+ /* @__PURE__ */ d(J, { children: [
126
+ /* @__PURE__ */ n(m.Button, { variant: "secondary", onClick: q, children: r("cancelCta") }),
127
+ /* @__PURE__ */ n(m.Button, { type: "submit", isLoading: F, children: r(e ? "continueCta" : "addDeductionCta") })
128
+ ] })
129
+ ] }) }) }) }) });
130
+ }
131
+ export {
132
+ ee as DeductionSchema,
133
+ Me as DeductionsForm
134
+ };
135
+ //# 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,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C,GAAA,EAAc,MAAK,gBAAe,OAAO1C,EAAE,mBAAmB,GAAG;AAAA,sBACjE2C,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAtD,EAACa,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAAS8B,GAC7C,UAAAhC,EAAE,WAAW,EAAA,CAChB;AAAA,MACA,gBAAAX,EAACa,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWwB,GACzC,UAAoC1B,EAAnCQ,IAAqC,gBAAvB,iBAAoC,EAAA,CACtD;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,EAAA,CACF,EAAA,CAEJ,GACF,EAAA,CACF,EAAA,CACF;AAEJ;"}
@@ -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,99 @@
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 "classnames";
9
+ import { ActionsLayout as I } from "../../../Common/ActionsLayout/ActionsLayout.js";
10
+ import u from "../../../Common/hooks/useNumberFormatter.js";
11
+ import M from "../../../../assets/icons/pencil.svg.js";
12
+ import U from "../../../../assets/icons/trashcan.svg.js";
13
+ import { HamburgerMenu as B } from "../../../Common/HamburgerMenu/HamburgerMenu.js";
14
+ import { useComponentDictionary as S, useI18n as Y } from "../../../../i18n/I18n.js";
15
+ import { componentEvents as a } from "../../../../shared/constants.js";
16
+ import { useComponentContext as q } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
17
+ import { useDataView as F } from "../../../Common/DataView/useDataView.js";
18
+ import { DataView as H } from "../../../Common/DataView/DataView.js";
19
+ function se(r) {
20
+ return /* @__PURE__ */ n(_, { ...r, children: /* @__PURE__ */ n(V, { ...r, children: r.children }) });
21
+ }
22
+ function V({ className: r, children: s, employeeId: d, dictionary: l }) {
23
+ const { onEvent: i, baseSubmitHandler: p } = k(), { t } = O("Employee.Deductions"), m = q(), E = u("currency"), f = u("percent");
24
+ S("Employee.Deductions", l), Y("Employee.Deductions");
25
+ const { data: D } = x({ employeeId: d }), h = D.garnishmentList.filter((e) => e.active), { mutateAsync: C, isPending: g } = N(), y = async (e) => {
26
+ await p(e, async (o) => {
27
+ const { garnishment: P } = await C({
28
+ request: {
29
+ garnishmentId: o.uuid,
30
+ requestBody: {
31
+ ...o,
32
+ totalAmount: o.totalAmount ?? void 0,
33
+ active: !1,
34
+ version: o.version
35
+ }
36
+ }
37
+ });
38
+ i(a.EMPLOYEE_DEDUCTION_DELETED, P);
39
+ });
40
+ }, v = (e) => {
41
+ i(a.EMPLOYEE_DEDUCTION_EDIT, e);
42
+ }, T = () => {
43
+ i(a.EMPLOYEE_DEDUCTION_ADD);
44
+ }, b = () => {
45
+ i(a.EMPLOYEE_DEDUCTION_DONE);
46
+ }, { ...L } = F({
47
+ data: h,
48
+ columns: [
49
+ { key: "description", title: t("nameColumn") },
50
+ {
51
+ key: "recurring",
52
+ title: t("frequencyColumn"),
53
+ render: (e) => e.recurring ? t("recurringText") : t("nonRecurringText")
54
+ },
55
+ {
56
+ key: "amount",
57
+ title: t("withheldColumn"),
58
+ render: (e) => {
59
+ const o = e.deductAsPercentage ? f(Number(e.amount)) : E(Number(e.amount));
60
+ return e.recurring ? t("recurringAmount", { value: o }) : o;
61
+ }
62
+ }
63
+ ],
64
+ itemMenu: (e) => /* @__PURE__ */ n(
65
+ B,
66
+ {
67
+ isLoading: g,
68
+ items: [
69
+ {
70
+ label: t("editCta"),
71
+ onClick: () => {
72
+ v(e);
73
+ },
74
+ icon: /* @__PURE__ */ n(M, { "aria-hidden": !0 })
75
+ },
76
+ {
77
+ label: t("deleteCta"),
78
+ onClick: async () => {
79
+ await y(e);
80
+ },
81
+ icon: /* @__PURE__ */ n(U, { "aria-hidden": !0 })
82
+ }
83
+ ]
84
+ }
85
+ )
86
+ });
87
+ return /* @__PURE__ */ n("section", { className: r, children: /* @__PURE__ */ n(w, { flexDirection: "column", gap: 32, children: s || /* @__PURE__ */ c(A, { children: [
88
+ /* @__PURE__ */ n(m.Heading, { as: "h2", children: t("pageTitle") }),
89
+ /* @__PURE__ */ n(H, { label: t("deductionsTableLabel"), ...L }),
90
+ /* @__PURE__ */ c(I, { children: [
91
+ /* @__PURE__ */ n(m.Button, { variant: "secondary", onClick: T, children: t("addDeductionCta") }),
92
+ /* @__PURE__ */ n(m.Button, { onClick: b, children: t("continueCta") })
93
+ ] })
94
+ ] }) }) });
95
+ }
96
+ export {
97
+ se as DeductionsList
98
+ };
99
+ //# 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,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ACE,UAAA;AAAA,IAAA,gBAAAxC,EAACW,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAA,EAAE,WAAW,GAAE;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,49 @@
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 "classnames";
10
+ import { ActionsLayout as v } from "../../../Common/ActionsLayout/ActionsLayout.js";
11
+ import { useComponentDictionary as F, useI18n as I } from "../../../../i18n/I18n.js";
12
+ import { componentEvents as s } from "../../../../shared/constants.js";
13
+ import { useComponentContext as Y } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
14
+ import { RadioGroupField as y } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
15
+ const L = m.object({ includeDeductions: m.enum(["Yes", "No"]) });
16
+ function G(n) {
17
+ return /* @__PURE__ */ e(C, { ...n, children: /* @__PURE__ */ e(_, { ...n, children: n.children }) });
18
+ }
19
+ function _({ className: n, children: t, dictionary: u }) {
20
+ const { onEvent: i } = b(), { t: o } = D("Employee.Deductions"), r = Y();
21
+ F("Employee.Deductions", u), I("Employee.Deductions");
22
+ const c = f({
23
+ resolver: h(L),
24
+ defaultValues: { includeDeductions: "No" }
25
+ }), d = (l) => {
26
+ l.includeDeductions === "Yes" ? i(s.EMPLOYEE_DEDUCTION_INCLUDE_YES) : i(s.EMPLOYEE_DEDUCTION_INCLUDE_NO);
27
+ };
28
+ 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: [
29
+ /* @__PURE__ */ e(r.Heading, { as: "h2", children: o("pageTitle") }),
30
+ /* @__PURE__ */ e(
31
+ y,
32
+ {
33
+ name: "includeDeductions",
34
+ isRequired: !0,
35
+ label: o("includeDeductionsFormLabel"),
36
+ description: o("includeDeductionsDescription"),
37
+ options: [
38
+ { value: "Yes", label: o("includeDeductionsYes") },
39
+ { value: "No", label: o("includeDeductionsNo") }
40
+ ]
41
+ }
42
+ ),
43
+ /* @__PURE__ */ e(v, { children: /* @__PURE__ */ e(r.Button, { type: "submit", children: o("continueCta") }) })
44
+ ] }) }) }) });
45
+ }
46
+ export {
47
+ G as IncludeDeductionsForm
48
+ };
49
+ //# 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
+ };
@@ -0,0 +1,107 @@
1
+ import { state as D, transition as e, reduce as t } from "robot3";
2
+ import { DeductionsListContextual as d, DeductionFormContextual as u } from "./DeductionsComponents.js";
3
+ import { componentEvents as n } from "../../../shared/constants.js";
4
+ const E = (o) => (c) => ({
5
+ ...c,
6
+ ...o
7
+ }), _ = {
8
+ includeDeductions: D(
9
+ e(
10
+ n.EMPLOYEE_DEDUCTION_INCLUDE_YES,
11
+ "addDeduction",
12
+ t(
13
+ E({
14
+ component: u,
15
+ currentDeductionId: null
16
+ })
17
+ )
18
+ ),
19
+ e(
20
+ n.EMPLOYEE_DEDUCTION_INCLUDE_NO,
21
+ "done",
22
+ t((o) => (o.onEvent(n.EMPLOYEE_DEDUCTION_DONE), o))
23
+ )
24
+ ),
25
+ viewDeductions: D(
26
+ e(
27
+ n.EMPLOYEE_DEDUCTION_ADD,
28
+ "addDeduction",
29
+ t(
30
+ E({
31
+ component: u,
32
+ currentDeductionId: null
33
+ })
34
+ )
35
+ ),
36
+ e(
37
+ n.EMPLOYEE_DEDUCTION_EDIT,
38
+ "editDeduction",
39
+ t(
40
+ (o, c) => ({
41
+ ...o,
42
+ component: u,
43
+ currentDeductionId: c.payload.uuid
44
+ })
45
+ )
46
+ ),
47
+ e(
48
+ n.EMPLOYEE_DEDUCTION_DELETED,
49
+ "viewDeductions",
50
+ t(
51
+ E({
52
+ component: d
53
+ })
54
+ )
55
+ ),
56
+ e(n.EMPLOYEE_DEDUCTION_DONE, "done")
57
+ ),
58
+ addDeduction: D(
59
+ e(
60
+ n.EMPLOYEE_DEDUCTION_CREATED,
61
+ "viewDeductions",
62
+ t(
63
+ E({
64
+ component: d,
65
+ currentDeductionId: null
66
+ })
67
+ )
68
+ ),
69
+ e(
70
+ n.EMPLOYEE_DEDUCTION_CANCEL,
71
+ "viewDeductions",
72
+ t(
73
+ E({
74
+ component: d,
75
+ currentDeductionId: null
76
+ })
77
+ )
78
+ )
79
+ ),
80
+ editDeduction: D(
81
+ e(
82
+ n.EMPLOYEE_DEDUCTION_UPDATED,
83
+ "viewDeductions",
84
+ t(
85
+ E({
86
+ component: d,
87
+ currentDeductionId: null
88
+ })
89
+ )
90
+ ),
91
+ e(
92
+ n.EMPLOYEE_DEDUCTION_CANCEL,
93
+ "viewDeductions",
94
+ t(
95
+ E({
96
+ component: d,
97
+ currentDeductionId: null
98
+ })
99
+ )
100
+ )
101
+ ),
102
+ done: D()
103
+ };
104
+ export {
105
+ _ as deductionsStateMachine
106
+ };
107
+ //# sourceMappingURL=stateMachine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stateMachine.js","sources":["../../../../src/components/Employee/Deductions/stateMachine.ts"],"sourcesContent":["import { state, transition, reduce, state as final } from 'robot3'\nimport type { DeductionsContextInterface, EventPayloads } from './DeductionsComponents'\nimport { DeductionsListContextual, DeductionFormContextual } from './DeductionsComponents'\nimport { componentEvents } from '@/shared/constants'\nimport type { MachineEventType } from '@/types/Helpers'\n\n// Helper function to create consistent reducers\nconst createReducer =\n (props: Partial<DeductionsContextInterface>) => (ctx: DeductionsContextInterface) => ({\n ...ctx,\n ...props,\n })\n\nexport const deductionsStateMachine = {\n includeDeductions: state(\n transition(\n componentEvents.EMPLOYEE_DEDUCTION_INCLUDE_YES,\n 'addDeduction',\n reduce(\n createReducer({\n component: DeductionFormContextual,\n currentDeductionId: null,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_DEDUCTION_INCLUDE_NO,\n 'done',\n reduce((ctx: DeductionsContextInterface) => {\n // Emit the completion event to notify parent onboarding flow\n ctx.onEvent(componentEvents.EMPLOYEE_DEDUCTION_DONE)\n return ctx\n }),\n ),\n ),\n viewDeductions: state(\n transition(\n componentEvents.EMPLOYEE_DEDUCTION_ADD,\n 'addDeduction',\n reduce(\n createReducer({\n component: DeductionFormContextual,\n currentDeductionId: null,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_DEDUCTION_EDIT,\n 'editDeduction',\n reduce(\n (\n ctx: DeductionsContextInterface,\n ev: MachineEventType<EventPayloads, typeof componentEvents.EMPLOYEE_DEDUCTION_EDIT>,\n ) => ({\n ...ctx,\n component: DeductionFormContextual,\n currentDeductionId: ev.payload.uuid,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_DEDUCTION_DELETED,\n 'viewDeductions',\n reduce(\n createReducer({\n component: DeductionsListContextual,\n }),\n ),\n ),\n transition(componentEvents.EMPLOYEE_DEDUCTION_DONE, 'done'),\n ),\n addDeduction: state(\n transition(\n componentEvents.EMPLOYEE_DEDUCTION_CREATED,\n 'viewDeductions',\n reduce(\n createReducer({\n component: DeductionsListContextual,\n currentDeductionId: null,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_DEDUCTION_CANCEL,\n 'viewDeductions',\n reduce(\n createReducer({\n component: DeductionsListContextual,\n currentDeductionId: null,\n }),\n ),\n ),\n ),\n editDeduction: state(\n transition(\n componentEvents.EMPLOYEE_DEDUCTION_UPDATED,\n 'viewDeductions',\n reduce(\n createReducer({\n component: DeductionsListContextual,\n currentDeductionId: null,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_DEDUCTION_CANCEL,\n 'viewDeductions',\n reduce(\n createReducer({\n component: DeductionsListContextual,\n currentDeductionId: null,\n }),\n ),\n ),\n ),\n done: final(),\n}\n"],"names":["createReducer","props","ctx","deductionsStateMachine","state","transition","componentEvents","reduce","DeductionFormContextual","ev","DeductionsListContextual","final"],"mappings":";;;AAOA,MAAMA,IACJ,CAACC,MAA+C,CAACC,OAAqC;AAAA,EACpF,GAAGA;AAAA,EACH,GAAGD;AACL,IAEWE,IAAyB;AAAA,EACpC,mBAAmBC;AAAA,IACjBC;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAC;AAAA,QACEP,EAAc;AAAA,UACZ,WAAWQ;AAAA,UACX,oBAAoB;AAAA,QAAA,CACrB;AAAA,MAAA;AAAA,IACH;AAAA,IAEFH;AAAA,MACEC,EAAgB;AA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A,QACEP,EAAc;AAAA,UACZ,WAAWU;AAAA,UACX,oBAAoB;AAAA,QAAA,CACrB;AAAA,MAAA;AAAA,IACH;AAAA,EACF;AAAA,EAEF,MAAMC,EAAA;AACR;"}
@@ -15,9 +15,9 @@ export declare const DeductionSchema: z.ZodObject<{
15
15
  description: string;
16
16
  active: boolean;
17
17
  amount: string;
18
+ recurring: boolean;
18
19
  courtOrdered: boolean;
19
20
  times: number | null;
20
- recurring: boolean;
21
21
  annualMaximum: string | null;
22
22
  payPeriodMaximum: string | null;
23
23
  deductAsPercentage: boolean;
@@ -25,9 +25,9 @@ export declare const DeductionSchema: z.ZodObject<{
25
25
  description: string;
26
26
  active: boolean;
27
27
  amount: number;
28
+ recurring: string;
28
29
  courtOrdered: boolean;
29
30
  times: number | null;
30
- recurring: string;
31
31
  annualMaximum: number | null;
32
32
  payPeriodMaximum: number | null;
33
33
  deductAsPercentage: string;
@@ -1,15 +1,14 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
2
  import { useTranslation as r } from "react-i18next";
3
- import { useDocumentList as m } from "./useDocumentList.js";
3
+ import { useDocumentList as s } from "./useDocumentList.js";
4
4
  import "classnames";
5
- import "../../../../shared/constants.js";
6
- import { ActionsLayout as s } from "../../../Common/ActionsLayout/ActionsLayout.js";
5
+ import { ActionsLayout as m } from "../../../Common/ActionsLayout/ActionsLayout.js";
7
6
  import { useComponentContext as c } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
8
- function h() {
9
- const { t } = r("Employee.DocumentSigner"), { handleContinue: n, hasSignedAllForms: i } = m(), e = c();
10
- return /* @__PURE__ */ o(s, { children: /* @__PURE__ */ o(e.Button, { onClick: n, isLoading: !1, isDisabled: !i, children: t("continueCta") }) });
7
+ function C() {
8
+ const { t: n } = r("Employee.DocumentSigner"), { handleContinue: t, hasSignedAllForms: i } = s(), e = c();
9
+ return /* @__PURE__ */ o(m, { children: /* @__PURE__ */ o(e.Button, { onClick: t, isLoading: !1, isDisabled: !i, children: n("continueCta") }) });
11
10
  }
12
11
  export {
13
- h as Actions
12
+ C as Actions
14
13
  };
15
14
  //# sourceMappingURL=Actions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Actions.js","sources":["../../../../../src/components/Employee/DocumentSigner/DocumentList/Actions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useDocumentList } from './useDocumentList'\nimport { ActionsLayout } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport function Actions() {\n const { t } = useTranslation('Employee.DocumentSigner')\n const { handleContinue, hasSignedAllForms } = useDocumentList()\n const Components = useComponentContext()\n\n return (\n <ActionsLayout>\n <Components.Button onClick={handleContinue} isLoading={false} isDisabled={!hasSignedAllForms}>\n {t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n )\n}\n"],"names":["Actions","useTranslation","handleContinue","hasSignedAllForms","useDocumentList","Components","useComponentContext","ActionsLayout","jsx"],"mappings":";;;;;;;AAKO,SAASA,IAAU;AACxB,QAAM,EAAE,EAAA,IAAMC,EAAe,yBAAyB,GAChD,EAAE,gBAAAC,GAAgB,mBAAAC,EAAA,IAAsBC,EAAA,GACxCC,IAAaC,EAAA;AAEnB,2BACGC,GAAA,EACC,UAAA,gBAAAC,EAACH,EAAW,QAAX,EAAkB,SAASH,GAAgB,WAAW,IAAO,YAAY,CAACC,GACxE,UAAA,EAAE,aAAa,GAClB,GACF;AAEJ;"}
1
+ {"version":3,"file":"Actions.js","sources":["../../../../../src/components/Employee/DocumentSigner/DocumentList/Actions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useDocumentList } from './useDocumentList'\nimport { ActionsLayout } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport function Actions() {\n const { t } = useTranslation('Employee.DocumentSigner')\n const { handleContinue, hasSignedAllForms } = useDocumentList()\n const Components = useComponentContext()\n\n return (\n <ActionsLayout>\n <Components.Button onClick={handleContinue} isLoading={false} isDisabled={!hasSignedAllForms}>\n {t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n )\n}\n"],"names":["Actions","t","useTranslation","handleContinue","hasSignedAllForms","useDocumentList","Components","useComponentContext","ActionsLayout","jsx"],"mappings":";;;;;;AAKO,SAASA,IAAU;AACxB,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,yBAAyB,GAChD,EAAE,gBAAAC,GAAgB,mBAAAC,EAAA,IAAsBC,EAAA,GACxCC,IAAaC,EAAA;AAEnB,2BACGC,GAAA,EACC,UAAA,gBAAAC,EAACH,EAAW,QAAX,EAAkB,SAASH,GAAgB,WAAW,IAAO,YAAY,CAACC,GACxE,UAAAH,EAAE,aAAa,GAClB,GACF;AAEJ;"}
@@ -9,13 +9,14 @@ import { useBase as L } from "../../../Base/useBase.js";
9
9
  import { useI18n as S } from "../../../../i18n/I18n.js";
10
10
  import { componentEvents as m } from "../../../../shared/constants.js";
11
11
  import { Flex as g } from "../../../Common/Flex/Flex.js";
12
+ import "react-i18next";
12
13
  import "classnames";
13
- function B(e) {
14
+ function N(e) {
14
15
  return /* @__PURE__ */ o(F, { ...e, children: /* @__PURE__ */ o(O, { ...e }) });
15
16
  }
16
- function O({ employeeId: e, className: s, children: n }) {
17
+ function O({ employeeId: e, className: s, children: t }) {
17
18
  S("Employee.DocumentSigner");
18
- const { onEvent: t } = L(), { data: u, error: c } = f({ employeeId: e }), i = u.formList, p = i.every((r) => !r.requiresSigning);
19
+ const { onEvent: n } = L(), { data: u, error: c } = f({ employeeId: e }), i = u.formList, p = i.every((r) => !r.requiresSigning);
19
20
  return /* @__PURE__ */ o("section", { className: s, children: /* @__PURE__ */ o(
20
21
  h,
21
22
  {
@@ -23,14 +24,14 @@ function O({ employeeId: e, className: s, children: n }) {
23
24
  employeeForms: i,
24
25
  hasSignedAllForms: p,
25
26
  handleContinue: () => {
26
- t(m.EMPLOYEE_FORMS_DONE);
27
+ n(m.EMPLOYEE_FORMS_DONE);
27
28
  },
28
29
  handleRequestFormToSign: (r) => {
29
- t(m.EMPLOYEE_VIEW_FORM_TO_SIGN, { uuid: r.uuid });
30
+ n(m.EMPLOYEE_VIEW_FORM_TO_SIGN, { uuid: r.uuid });
30
31
  },
31
32
  documentListError: c
32
33
  },
33
- children: n || /* @__PURE__ */ l(g, { flexDirection: "column", children: [
34
+ children: t || /* @__PURE__ */ l(g, { flexDirection: "column", children: [
34
35
  /* @__PURE__ */ o(d, {}),
35
36
  /* @__PURE__ */ o(E, {}),
36
37
  /* @__PURE__ */ o(a, {})
@@ -39,6 +40,6 @@ function O({ employeeId: e, className: s, children: n }) {
39
40
  ) });
40
41
  }
41
42
  export {
42
- B as DocumentList
43
+ N as DocumentList
43
44
  };
44
45
  //# sourceMappingURL=DocumentList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentList.js","sources":["../../../../../src/components/Employee/DocumentSigner/DocumentList/DocumentList.tsx"],"sourcesContent":["import { useEmployeeFormsListSuspense } from '@gusto/embedded-api/react-query/employeeFormsList'\nimport { type Form } from '@gusto/embedded-api/models/components/form'\nimport { Head } from './Head'\nimport { List } from './List'\nimport { Actions } from './Actions'\nimport { DocumentListProvider } from './useDocumentList'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { Flex } from '@/components/Common'\n\ninterface DocumentListProps extends CommonComponentInterface {\n employeeId: string\n}\n\nexport function DocumentList(props: DocumentListProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nfunction Root({ employeeId, className, children }: DocumentListProps) {\n useI18n('Employee.DocumentSigner')\n const { onEvent } = useBase()\n\n const { data, error: documentListError } = useEmployeeFormsListSuspense({ employeeId })\n const employeeForms = data.formList!\n\n const hasSignedAllForms = employeeForms.every(employeeForm => !employeeForm.requiresSigning)\n\n const handleRequestFormToSign = (data: Form) => {\n onEvent(componentEvents.EMPLOYEE_VIEW_FORM_TO_SIGN, { uuid: data.uuid })\n }\n\n const handleContinue = () => {\n onEvent(componentEvents.EMPLOYEE_FORMS_DONE)\n }\n\n return (\n <section className={className}>\n <DocumentListProvider\n value={{\n employeeForms,\n hasSignedAllForms,\n handleContinue,\n handleRequestFormToSign,\n documentListError,\n }}\n >\n {children ? (\n children\n ) : (\n <Flex flexDirection=\"column\">\n <Head />\n <List />\n <Actions />\n </Flex>\n )}\n </DocumentListProvider>\n </section>\n )\n}\n"],"names":["DocumentList","props","jsx","BaseComponent","Root","employeeId","className","children","useI18n","onEvent","useBase","data","documentListError","useEmployeeFormsListSuspense","employeeForms","hasSignedAllForms","employeeForm","DocumentListProvider","componentEvents","jsxs","Flex","Head","List","Actions"],"mappings":";;;;;;;;;;;;AAoBO,SAASA,EAAaC,GAAmD;AAC9E,SACE,gBAAAC,EAACC,KAAe,GAAGF,GACjB,4BAACG,GAAA,EAAM,GAAGH,GAAO,EAAA,CACnB;AAEJ;AAEA,SAASG,EAAK,EAAE,YAAAC,GAAY,WAAAC,GAAW,UAAAC,KAA+B;AACpE,EAAAC,EAAQ,yBAAyB;AACjC,QAAM,EAAE,SAAAC,EAAA,IAAYC,EAAA,GAEd,EAAE,MAAAC,GAAM,OAAOC,EAAA,IAAsBC,EAA6B,EAAE,YAAAR,GAAY,GAChFS,IAAgBH,EAAK,UAErBI,IAAoBD,EAAc,MAAM,CAAAE,MAAgB,CAACA,EAAa,eAAe;AAU3F,SACE,gBAAAd,EAAC,aAAQ,WAAAI,GACP,UAAA,gBAAAJ;AAAA,IAACe;AAAA,IAAA;AAAA,MACC,OAAO;AAAA,QACL,eAAAH;AAAA,QACA,mBAAAC;AAAA,QACA,gBAVe,MAAM;AAC3B,UAAAN,EAAQS,EAAgB,mBAAmB;AAAA,QAC7C;AAAA,QASQ,yBAfwB,CAACP,MAAe;AAC9C,UAAAF,EAAQS,EAAgB,4BAA4B,EAAE,MAAMP,EAAK,MAAM;AAAA,QACzE;AAAA,QAcQ,mBAAAC;AAAA,MAAA;AAAA,MAGD,UAAAL,KAGC,gBAAAY,EAACC,GAAA,EAAK,eAAc,UAClB,UAAA;AAAA,QAAA,gBAAAlB,EAACmB,GAAA,EAAK;AAAA,0BACLC,GAAA,EAAK;AAAA,0BACLC,GAAA,CAAA,CAAQ;AAAA,MAAA,EAAA,CACX;AAAA,IAAA;AAAA,EAAA,GAGN;AAEJ;"}
1
+ {"version":3,"file":"DocumentList.js","sources":["../../../../../src/components/Employee/DocumentSigner/DocumentList/DocumentList.tsx"],"sourcesContent":["import { useEmployeeFormsListSuspense } from '@gusto/embedded-api/react-query/employeeFormsList'\nimport { type Form } from '@gusto/embedded-api/models/components/form'\nimport { Head } from './Head'\nimport { List } from './List'\nimport { Actions } from './Actions'\nimport { DocumentListProvider } from './useDocumentList'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { Flex } from '@/components/Common'\n\ninterface DocumentListProps extends CommonComponentInterface {\n employeeId: string\n}\n\nexport function DocumentList(props: DocumentListProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nfunction Root({ employeeId, className, children }: DocumentListProps) {\n useI18n('Employee.DocumentSigner')\n const { onEvent } = useBase()\n\n const { data, error: documentListError } = useEmployeeFormsListSuspense({ employeeId })\n const employeeForms = data.formList!\n\n const hasSignedAllForms = employeeForms.every(employeeForm => !employeeForm.requiresSigning)\n\n const handleRequestFormToSign = (data: Form) => {\n onEvent(componentEvents.EMPLOYEE_VIEW_FORM_TO_SIGN, { uuid: data.uuid })\n }\n\n const handleContinue = () => {\n onEvent(componentEvents.EMPLOYEE_FORMS_DONE)\n }\n\n return (\n <section className={className}>\n <DocumentListProvider\n value={{\n employeeForms,\n hasSignedAllForms,\n handleContinue,\n handleRequestFormToSign,\n documentListError,\n }}\n >\n {children ? (\n children\n ) : (\n <Flex flexDirection=\"column\">\n <Head />\n <List />\n <Actions />\n </Flex>\n )}\n </DocumentListProvider>\n </section>\n )\n}\n"],"names":["DocumentList","props","jsx","BaseComponent","Root","employeeId","className","children","useI18n","onEvent","useBase","data","documentListError","useEmployeeFormsListSuspense","employeeForms","hasSignedAllForms","employeeForm","DocumentListProvider","componentEvents","jsxs","Flex","Head","List","Actions"],"mappings":";;;;;;;;;;;;;AAoBO,SAASA,EAAaC,GAAmD;AAC9E,SACE,gBAAAC,EAACC,KAAe,GAAGF,GACjB,4BAACG,GAAA,EAAM,GAAGH,GAAO,EAAA,CACnB;AAEJ;AAEA,SAASG,EAAK,EAAE,YAAAC,GAAY,WAAAC,GAAW,UAAAC,KAA+B;AACpE,EAAAC,EAAQ,yBAAyB;AACjC,QAAM,EAAE,SAAAC,EAAA,IAAYC,EAAA,GAEd,EAAE,MAAAC,GAAM,OAAOC,EAAA,IAAsBC,EAA6B,EAAE,YAAAR,GAAY,GAChFS,IAAgBH,EAAK,UAErBI,IAAoBD,EAAc,MAAM,CAAAE,MAAgB,CAACA,EAAa,eAAe;AAU3F,SACE,gBAAAd,EAAC,aAAQ,WAAAI,GACP,UAAA,gBAAAJ;AAAA,IAACe;AAAA,IAAA;AAAA,MACC,OAAO;AAAA,QACL,eAAAH;AAAA,QACA,mBAAAC;AAAA,QACA,gBAVe,MAAM;AAC3B,UAAAN,EAAQS,EAAgB,mBAAmB;AAAA,QAC7C;AAAA,QASQ,yBAfwB,CAACP,MAAe;AAC9C,UAAAF,EAAQS,EAAgB,4BAA4B,EAAE,MAAMP,EAAK,MAAM;AAAA,QACzE;AAAA,QAcQ,mBAAAC;AAAA,MAAA;AAAA,MAGD,UAAAL,KAGC,gBAAAY,EAACC,GAAA,EAAK,eAAc,UAClB,UAAA;AAAA,QAAA,gBAAAlB,EAACmB,GAAA,EAAK;AAAA,0BACLC,GAAA,EAAK;AAAA,0BACLC,GAAA,CAAA,CAAQ;AAAA,MAAA,EAAA,CACX;AAAA,IAAA;AAAA,EAAA,GAGN;AAEJ;"}