@gusto/embedded-react-sdk 0.36.0 → 0.37.0-rc.2

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 (712) hide show
  1. package/CHANGELOG.md +58 -0
  2. package/README.md +6 -0
  3. package/dist/UNSTABLE_Hooks.d.ts +1 -1
  4. package/dist/UNSTABLE_Hooks.js +50 -6
  5. package/dist/UNSTABLE_Hooks.js.map +1 -1
  6. package/dist/components/Base/Base.d.ts +8 -9
  7. package/dist/components/Base/Base.js +123 -102
  8. package/dist/components/Base/Base.js.map +1 -1
  9. package/dist/components/Base/createCompoundContext.js.map +1 -1
  10. package/dist/components/Base/index.d.ts +1 -1
  11. package/dist/components/Base/useBase.d.ts +3 -7
  12. package/dist/components/Base/useBase.js.map +1 -1
  13. package/dist/components/Base/useBaseSubmit.d.ts +3 -5
  14. package/dist/components/Base/useBaseSubmit.js +27 -50
  15. package/dist/components/Base/useBaseSubmit.js.map +1 -1
  16. package/dist/components/Common/DataView/DataCards/DataCards.js +42 -36
  17. package/dist/components/Common/DataView/DataCards/DataCards.js.map +1 -1
  18. package/dist/components/Common/Fields/CheckboxField/CheckboxField.d.ts +2 -0
  19. package/dist/components/Common/Fields/CheckboxField/CheckboxField.js +22 -19
  20. package/dist/components/Common/Fields/CheckboxField/CheckboxField.js.map +1 -1
  21. package/dist/components/Common/Fields/CheckboxGroupField/CheckboxGroupField.d.ts +1 -1
  22. package/dist/components/Common/Fields/CheckboxGroupField/CheckboxGroupField.js +32 -30
  23. package/dist/components/Common/Fields/CheckboxGroupField/CheckboxGroupField.js.map +1 -1
  24. package/dist/components/Common/Fields/ComboBoxField/ComboBoxField.d.ts +1 -1
  25. package/dist/components/Common/Fields/ComboBoxField/ComboBoxField.js +36 -34
  26. package/dist/components/Common/Fields/ComboBoxField/ComboBoxField.js.map +1 -1
  27. package/dist/components/Common/Fields/DatePickerField/DatePickerField.d.ts +5 -3
  28. package/dist/components/Common/Fields/DatePickerField/DatePickerField.js +52 -40
  29. package/dist/components/Common/Fields/DatePickerField/DatePickerField.js.map +1 -1
  30. package/dist/components/Common/Fields/FileInputField/FileInputField.js +24 -22
  31. package/dist/components/Common/Fields/FileInputField/FileInputField.js.map +1 -1
  32. package/dist/components/Common/Fields/MultiSelectComboBoxField/MultiSelectComboBoxField.js +24 -22
  33. package/dist/components/Common/Fields/MultiSelectComboBoxField/MultiSelectComboBoxField.js.map +1 -1
  34. package/dist/components/Common/Fields/NumberInputField/NumberInputField.d.ts +2 -0
  35. package/dist/components/Common/Fields/NumberInputField/NumberInputField.js +31 -28
  36. package/dist/components/Common/Fields/NumberInputField/NumberInputField.js.map +1 -1
  37. package/dist/components/Common/Fields/RadioGroupField/RadioGroupField.d.ts +3 -1
  38. package/dist/components/Common/Fields/RadioGroupField/RadioGroupField.js +30 -27
  39. package/dist/components/Common/Fields/RadioGroupField/RadioGroupField.js.map +1 -1
  40. package/dist/components/Common/Fields/SelectField/SelectField.d.ts +3 -1
  41. package/dist/components/Common/Fields/SelectField/SelectField.js +31 -28
  42. package/dist/components/Common/Fields/SelectField/SelectField.js.map +1 -1
  43. package/dist/components/Common/Fields/SwitchField/SwitchField.d.ts +2 -0
  44. package/dist/components/Common/Fields/SwitchField/SwitchField.js +24 -21
  45. package/dist/components/Common/Fields/SwitchField/SwitchField.js.map +1 -1
  46. package/dist/components/Common/Fields/TextAreaField/TextAreaField.js +24 -22
  47. package/dist/components/Common/Fields/TextAreaField/TextAreaField.js.map +1 -1
  48. package/dist/components/Common/Fields/TextInputField/TextInputField.d.ts +2 -0
  49. package/dist/components/Common/Fields/TextInputField/TextInputField.js +26 -23
  50. package/dist/components/Common/Fields/TextInputField/TextInputField.js.map +1 -1
  51. package/dist/components/Common/Fields/hooks/useField.d.ts +3 -2
  52. package/dist/components/Common/Fields/hooks/useField.js +37 -33
  53. package/dist/components/Common/Fields/hooks/useField.js.map +1 -1
  54. package/dist/components/Common/ReorderableList/ReorderableList.js.map +1 -1
  55. package/dist/components/Common/SignatureForm/SignatureForm.js +10 -15
  56. package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
  57. package/dist/components/Common/SignatureForm/SignatureFormActions.js +10 -14
  58. package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
  59. package/dist/components/Common/SignatureForm/SignatureFormFields.js +14 -19
  60. package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
  61. package/dist/components/Common/UI/Button/Button.js +33 -29
  62. package/dist/components/Common/UI/Button/Button.js.map +1 -1
  63. package/dist/components/Common/UI/Button/Button.module.scss.js +5 -3
  64. package/dist/components/Common/UI/Button/Button.module.scss.js.map +1 -1
  65. package/dist/components/Common/UI/Button/ButtonTypes.d.ts +4 -0
  66. package/dist/components/Common/UI/Button/ButtonTypes.js.map +1 -1
  67. package/dist/components/Common/UI/DescriptionList/DescriptionList.module.scss.js +1 -1
  68. package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.js +94 -80
  69. package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBox.js.map +1 -1
  70. package/dist/components/Common/UI/NumberInput/NumberInput.js +1 -1
  71. package/dist/components/Common/UI/NumberInput/NumberInput.js.map +1 -1
  72. package/dist/components/Company/AssignSignatory/AssignSignatory.js +7 -11
  73. package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
  74. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +6 -10
  75. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
  76. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +8 -11
  77. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
  78. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +6 -9
  79. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js.map +1 -1
  80. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +13 -14
  81. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js.map +1 -1
  82. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +8 -9
  83. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  84. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +6 -9
  85. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
  86. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +5 -8
  87. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js.map +1 -1
  88. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +13 -14
  89. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js.map +1 -1
  90. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +8 -9
  91. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  92. package/dist/components/Company/AssignSignatory/TitleSelect.js +2 -5
  93. package/dist/components/Company/AssignSignatory/TitleSelect.js.map +1 -1
  94. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +10 -11
  95. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  96. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +9 -11
  97. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
  98. package/dist/components/Company/BankAccount/BankAccountForm/Form.js +9 -13
  99. package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
  100. package/dist/components/Company/BankAccount/BankAccountForm/context.js +8 -9
  101. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  102. package/dist/components/Company/BankAccount/BankAccountList/Actions.js +10 -13
  103. package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
  104. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +12 -15
  105. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
  106. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +4 -8
  107. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
  108. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +5 -8
  109. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
  110. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +11 -15
  111. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  112. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +8 -9
  113. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  114. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +11 -15
  115. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  116. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +8 -9
  117. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  118. package/dist/components/Company/FederalTaxes/Actions.js +8 -11
  119. package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
  120. package/dist/components/Company/FederalTaxes/FederalTaxes.js +15 -19
  121. package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
  122. package/dist/components/Company/FederalTaxes/Form.js +6 -8
  123. package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
  124. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +10 -11
  125. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  126. package/dist/components/Company/Industry/Actions.js +8 -11
  127. package/dist/components/Company/Industry/Actions.js.map +1 -1
  128. package/dist/components/Company/Industry/Context.js +11 -12
  129. package/dist/components/Company/Industry/Context.js.map +1 -1
  130. package/dist/components/Company/Industry/Edit.js +10 -14
  131. package/dist/components/Company/Industry/Edit.js.map +1 -1
  132. package/dist/components/Company/Locations/LocationForm/Actions.js +8 -11
  133. package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
  134. package/dist/components/Company/Locations/LocationForm/Form.js +5 -7
  135. package/dist/components/Company/Locations/LocationForm/Form.js.map +1 -1
  136. package/dist/components/Company/Locations/LocationForm/LocationForm.js +15 -19
  137. package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
  138. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +8 -9
  139. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  140. package/dist/components/Company/Locations/LocationsList/Actions.js +6 -9
  141. package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
  142. package/dist/components/Company/Locations/LocationsList/List.js +17 -19
  143. package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
  144. package/dist/components/Company/Locations/LocationsList/LocationsList.js +6 -10
  145. package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
  146. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +8 -9
  147. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  148. package/dist/components/Company/OnboardingOverview/Completed.js +12 -15
  149. package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
  150. package/dist/components/Company/OnboardingOverview/MissingRequirements.js +9 -12
  151. package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
  152. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +6 -10
  153. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
  154. package/dist/components/Company/OnboardingOverview/context.js +8 -9
  155. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  156. package/dist/components/Company/PaySchedule/PaySchedule.js +60 -63
  157. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  158. package/dist/components/Company/PaySchedule/_parts/Actions.js +10 -13
  159. package/dist/components/Company/PaySchedule/_parts/Actions.js.map +1 -1
  160. package/dist/components/Company/PaySchedule/_parts/Edit.js +15 -15
  161. package/dist/components/Company/PaySchedule/_parts/Edit.js.map +1 -1
  162. package/dist/components/Company/PaySchedule/_parts/Head.js +11 -14
  163. package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
  164. package/dist/components/Company/PaySchedule/_parts/List.js +19 -21
  165. package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
  166. package/dist/components/Company/PaySchedule/usePaySchedule.js +10 -11
  167. package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
  168. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +5 -8
  169. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
  170. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
  171. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +8 -9
  172. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  173. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +6 -9
  174. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
  175. package/dist/components/Company/StateTaxes/StateTaxesList/List.js +5 -8
  176. package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
  177. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +8 -9
  178. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  179. package/dist/components/Contractor/Address/Address.js +3 -7
  180. package/dist/components/Contractor/Address/Address.js.map +1 -1
  181. package/dist/components/Contractor/Address/Form.js +6 -8
  182. package/dist/components/Contractor/Address/Form.js.map +1 -1
  183. package/dist/components/Contractor/Address/useAddress.js +10 -11
  184. package/dist/components/Contractor/Address/useAddress.js.map +1 -1
  185. package/dist/components/Contractor/ContractorList/index.js +29 -30
  186. package/dist/components/Contractor/ContractorList/index.js.map +1 -1
  187. package/dist/components/Contractor/NewHireReport/NewHireReport.js +2 -3
  188. package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
  189. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +10 -14
  190. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -1
  191. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +2 -3
  192. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -1
  193. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +2 -5
  194. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js.map +1 -1
  195. package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js.map +1 -1
  196. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js +12 -14
  197. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js.map +1 -1
  198. package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js +10 -10
  199. package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js +18 -21
  200. package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js.map +1 -1
  201. package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js +3 -4
  202. package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js.map +1 -1
  203. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js +17 -19
  204. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js.map +1 -1
  205. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js +6 -8
  206. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js.map +1 -1
  207. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js +2 -4
  208. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js.map +1 -1
  209. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +2 -5
  210. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -1
  211. package/dist/components/Contractor/Profile/ContractorProfileForm.js +15 -15
  212. package/dist/components/Contractor/Profile/useContractorProfile.js +33 -32
  213. package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
  214. package/dist/components/Contractor/Submit/Submit.js +20 -22
  215. package/dist/components/Contractor/Submit/Submit.js.map +1 -1
  216. package/dist/components/Employee/Compensation/Actions.js +12 -14
  217. package/dist/components/Employee/Compensation/Actions.js.map +1 -1
  218. package/dist/components/Employee/Compensation/Compensation.js.map +1 -1
  219. package/dist/components/Employee/Compensation/Edit.js +27 -28
  220. package/dist/components/Employee/Compensation/Edit.js.map +1 -1
  221. package/dist/components/Employee/Compensation/List.js +23 -25
  222. package/dist/components/Employee/Compensation/List.js.map +1 -1
  223. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +61 -57
  224. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
  225. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +15 -16
  226. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
  227. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js.map +1 -1
  228. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +15 -16
  229. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +1 -1
  230. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +18 -19
  231. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js.map +1 -1
  232. package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.js +6 -7
  233. package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.js.map +1 -1
  234. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +6 -9
  235. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
  236. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +10 -14
  237. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  238. package/dist/components/Employee/DocumentSigner/DocumentList/List.js +2 -6
  239. package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
  240. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +8 -9
  241. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  242. package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js +24 -26
  243. package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js.map +1 -1
  244. package/dist/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.js +9 -11
  245. package/dist/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.js.map +1 -1
  246. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +11 -15
  247. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  248. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +8 -9
  249. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  250. package/dist/components/Employee/EmployeeDocuments/EmployeeDocumentsPresentation.js +6 -9
  251. package/dist/components/Employee/EmployeeDocuments/EmployeeDocumentsPresentation.js.map +1 -1
  252. package/dist/components/Employee/EmployeeList/Actions.js +6 -9
  253. package/dist/components/Employee/EmployeeList/Actions.js.map +1 -1
  254. package/dist/components/Employee/EmployeeList/EmployeeList.js +3 -7
  255. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  256. package/dist/components/Employee/EmployeeList/Head.js +5 -8
  257. package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
  258. package/dist/components/Employee/EmployeeList/List.js +16 -17
  259. package/dist/components/Employee/EmployeeList/List.js.map +1 -1
  260. package/dist/components/Employee/EmployeeList/useEmployeeList.js +8 -9
  261. package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
  262. package/dist/components/Employee/FederalTaxes/Actions.js +7 -10
  263. package/dist/components/Employee/FederalTaxes/Actions.js.map +1 -1
  264. package/dist/components/Employee/FederalTaxes/FederalForm.js +10 -13
  265. package/dist/components/Employee/FederalTaxes/FederalForm.js.map +1 -1
  266. package/dist/components/Employee/FederalTaxes/FederalTaxes.js +42 -42
  267. package/dist/components/Employee/FederalTaxes/FederalTaxes.js.map +1 -1
  268. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +8 -9
  269. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
  270. package/dist/components/Employee/Landing/Landing.js +14 -15
  271. package/dist/components/Employee/Landing/Landing.js.map +1 -1
  272. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +7 -7
  273. package/dist/components/Employee/PaymentMethod/Actions.js +8 -11
  274. package/dist/components/Employee/PaymentMethod/Actions.js.map +1 -1
  275. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +5 -8
  276. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js.map +1 -1
  277. package/dist/components/Employee/PaymentMethod/BankAccountsList.js +9 -10
  278. package/dist/components/Employee/PaymentMethod/BankAccountsList.js.map +1 -1
  279. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +7 -10
  280. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +1 -1
  281. package/dist/components/Employee/PaymentMethod/Split.js +9 -10
  282. package/dist/components/Employee/PaymentMethod/Split.js.map +1 -1
  283. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +10 -11
  284. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
  285. package/dist/components/Employee/Profile/Actions.js +8 -11
  286. package/dist/components/Employee/Profile/Actions.js.map +1 -1
  287. package/dist/components/Employee/Profile/AdminPersonalDetails.js +14 -17
  288. package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
  289. package/dist/components/Employee/Profile/HomeAddress.d.ts +3 -3
  290. package/dist/components/Employee/Profile/HomeAddress.js +45 -44
  291. package/dist/components/Employee/Profile/HomeAddress.js.map +1 -1
  292. package/dist/components/Employee/Profile/PersonalDetailsInputs.js +10 -13
  293. package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
  294. package/dist/components/Employee/Profile/Profile.js +30 -29
  295. package/dist/components/Employee/Profile/Profile.js.map +1 -1
  296. package/dist/components/Employee/Profile/useProfile.js +8 -9
  297. package/dist/components/Employee/Profile/useProfile.js.map +1 -1
  298. package/dist/components/Employee/StateTaxes/Actions.js +8 -11
  299. package/dist/components/Employee/StateTaxes/Actions.js.map +1 -1
  300. package/dist/components/Employee/StateTaxes/StateTaxes.js +50 -50
  301. package/dist/components/Employee/StateTaxes/StateTaxes.js.map +1 -1
  302. package/dist/components/Employee/StateTaxes/useStateTaxes.js +8 -9
  303. package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
  304. package/dist/components/Employee/Taxes/Actions.js +8 -11
  305. package/dist/components/Employee/Taxes/Actions.js.map +1 -1
  306. package/dist/components/Employee/Taxes/FederalForm.js +10 -13
  307. package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
  308. package/dist/components/Employee/Taxes/Taxes.js +53 -53
  309. package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
  310. package/dist/components/Employee/Taxes/useTaxes.js +8 -9
  311. package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
  312. package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.d.ts +11 -0
  313. package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.js +123 -0
  314. package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.js.map +1 -0
  315. package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.d.ts +11 -0
  316. package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.js +89 -0
  317. package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.js.map +1 -0
  318. package/dist/components/Employee/Terminations/TerminationFlow/TerminationFlow.d.ts +2 -0
  319. package/dist/components/Employee/Terminations/TerminationFlow/TerminationFlow.js +30 -0
  320. package/dist/components/Employee/Terminations/TerminationFlow/TerminationFlow.js.map +1 -0
  321. package/dist/components/Employee/Terminations/TerminationFlow/TerminationFlowComponents.d.ts +24 -0
  322. package/dist/components/Employee/Terminations/TerminationFlow/TerminationFlowComponents.js +76 -0
  323. package/dist/components/Employee/Terminations/TerminationFlow/TerminationFlowComponents.js.map +1 -0
  324. package/dist/components/Employee/Terminations/TerminationFlow/index.d.ts +3 -0
  325. package/dist/components/Employee/Terminations/TerminationFlow/terminationStateMachine.d.ts +8 -0
  326. package/dist/components/Employee/Terminations/TerminationFlow/terminationStateMachine.js +177 -0
  327. package/dist/components/Employee/Terminations/TerminationFlow/terminationStateMachine.js.map +1 -0
  328. package/dist/components/Employee/Terminations/TerminationFlow/terminationStateMachine.test.d.ts +1 -0
  329. package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummary.d.ts +9 -0
  330. package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummary.js +86 -0
  331. package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummary.js.map +1 -0
  332. package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummaryPresentation.d.ts +20 -0
  333. package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummaryPresentation.js +100 -0
  334. package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummaryPresentation.js.map +1 -0
  335. package/dist/components/Employee/Terminations/TerminationsData.d.ts +6 -0
  336. package/dist/components/Employee/Terminations/index.d.ts +8 -0
  337. package/dist/components/Employee/Terminations/types.d.ts +1 -0
  338. package/dist/components/Employee/index.d.ts +7 -0
  339. package/dist/components/Employee/index.js +34 -28
  340. package/dist/components/Employee/index.js.map +1 -1
  341. package/dist/components/Flow/Flow.js +20 -23
  342. package/dist/components/Flow/Flow.js.map +1 -1
  343. package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js +16 -18
  344. package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js.map +1 -1
  345. package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js +18 -20
  346. package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js.map +1 -1
  347. package/dist/components/InformationRequests/InformationRequests.js +34 -35
  348. package/dist/components/InformationRequests/InformationRequests.js.map +1 -1
  349. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.js +41 -41
  350. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.js.map +1 -1
  351. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.js.map +1 -1
  352. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +8 -10
  353. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js.map +1 -1
  354. package/dist/components/Payroll/Dismissal/DismissalFlow.d.ts +2 -0
  355. package/dist/components/Payroll/Dismissal/DismissalFlow.js +32 -0
  356. package/dist/components/Payroll/Dismissal/DismissalFlow.js.map +1 -0
  357. package/dist/components/Payroll/Dismissal/DismissalFlowComponents.d.ts +16 -0
  358. package/dist/components/Payroll/Dismissal/DismissalFlowComponents.js +52 -0
  359. package/dist/components/Payroll/Dismissal/DismissalFlowComponents.js.map +1 -0
  360. package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.d.ts +7 -0
  361. package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.js +73 -0
  362. package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.js.map +1 -0
  363. package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelectionPresentation.d.ts +9 -0
  364. package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelectionPresentation.js +50 -0
  365. package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelectionPresentation.js.map +1 -0
  366. package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/index.d.ts +3 -0
  367. package/dist/components/Payroll/Dismissal/dismissalStateMachine.d.ts +6 -0
  368. package/dist/components/Payroll/Dismissal/dismissalStateMachine.js +51 -0
  369. package/dist/components/Payroll/Dismissal/dismissalStateMachine.js.map +1 -0
  370. package/dist/components/Payroll/Dismissal/dismissalStateMachine.test.d.ts +1 -0
  371. package/dist/components/Payroll/Dismissal/index.d.ts +3 -0
  372. package/dist/components/Payroll/GrossUpModal/GrossUpModal.d.ts +1 -1
  373. package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +89 -76
  374. package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
  375. package/dist/components/Payroll/GrossUpModal/GrossUpModal.module.scss.js +6 -6
  376. package/dist/components/Payroll/GrossUpModal/GrossUpModalTypes.d.ts +0 -1
  377. package/dist/components/Payroll/OffCycle/OffCycleFlow.d.ts +1 -1
  378. package/dist/components/Payroll/OffCycle/OffCycleFlow.js +25 -18
  379. package/dist/components/Payroll/OffCycle/OffCycleFlow.js.map +1 -1
  380. package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.d.ts +5 -0
  381. package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js +31 -24
  382. package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js.map +1 -1
  383. package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js +78 -75
  384. package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -1
  385. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.d.ts +1 -1
  386. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js +75 -68
  387. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js.map +1 -1
  388. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.module.scss.js +8 -0
  389. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.module.scss.js.map +1 -0
  390. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationTypes.d.ts +0 -1
  391. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js +18 -26
  392. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js.map +1 -1
  393. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.module.scss.js +4 -4
  394. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes.js +4 -4
  395. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes.js.map +1 -1
  396. package/dist/components/Payroll/OffCyclePayPeriodDateForm/useOffCyclePayPeriodDateValidation.d.ts +1 -0
  397. package/dist/components/Payroll/OffCyclePayPeriodDateForm/useOffCyclePayPeriodDateValidation.js +1 -0
  398. package/dist/components/Payroll/OffCyclePayPeriodDateForm/useOffCyclePayPeriodDateValidation.js.map +1 -1
  399. package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js +6 -9
  400. package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js.map +1 -1
  401. package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js +12 -14
  402. package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js.map +1 -1
  403. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js +11 -14
  404. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js.map +1 -1
  405. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +12 -12
  406. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +174 -148
  407. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
  408. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +3 -3
  409. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +71 -71
  410. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
  411. package/dist/components/Payroll/PayrollConfiguration/grossUpHelpers.d.ts +3 -2
  412. package/dist/components/Payroll/PayrollConfiguration/grossUpHelpers.js +8 -8
  413. package/dist/components/Payroll/PayrollConfiguration/grossUpHelpers.js.map +1 -1
  414. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.d.ts +5 -3
  415. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +76 -70
  416. package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -1
  417. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +47 -42
  418. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
  419. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.d.ts +5 -3
  420. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +256 -219
  421. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
  422. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +19 -21
  423. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
  424. package/dist/components/Payroll/PayrollFlow/OffCycleFlowContextual.d.ts +1 -0
  425. package/dist/components/Payroll/PayrollFlow/OffCycleFlowContextual.js +19 -0
  426. package/dist/components/Payroll/PayrollFlow/OffCycleFlowContextual.js.map +1 -0
  427. package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.d.ts +3 -0
  428. package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js.map +1 -1
  429. package/dist/components/Payroll/PayrollFlow/TransitionFlowContextual.d.ts +1 -0
  430. package/dist/components/Payroll/PayrollFlow/TransitionFlowContextual.js +21 -0
  431. package/dist/components/Payroll/PayrollFlow/TransitionFlowContextual.js.map +1 -0
  432. package/dist/components/Payroll/PayrollFlow/payrollStateMachine.d.ts +2 -0
  433. package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js +95 -64
  434. package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js.map +1 -1
  435. package/dist/components/Payroll/PayrollHistory/PayrollHistory.js +53 -47
  436. package/dist/components/Payroll/PayrollHistory/PayrollHistory.js.map +1 -1
  437. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +38 -40
  438. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
  439. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js +25 -23
  440. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js.map +1 -1
  441. package/dist/components/Payroll/PayrollList/PayrollList.js +55 -43
  442. package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
  443. package/dist/components/Payroll/PayrollList/PayrollListPresentation.d.ts +2 -1
  444. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +110 -95
  445. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
  446. package/dist/components/Payroll/PayrollList/PayrollListPresentation.module.scss.js +12 -8
  447. package/dist/components/Payroll/PayrollList/PayrollListPresentation.module.scss.js.map +1 -1
  448. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +15 -15
  449. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
  450. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +59 -59
  451. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
  452. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js +7 -10
  453. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js.map +1 -1
  454. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +2 -3
  455. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
  456. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js +2 -4
  457. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js.map +1 -1
  458. package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js +11 -13
  459. package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js.map +1 -1
  460. package/dist/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.js +2 -5
  461. package/dist/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.js.map +1 -1
  462. package/dist/components/Payroll/Transition/TransitionFlow.d.ts +2 -0
  463. package/dist/components/Payroll/Transition/TransitionFlow.js +38 -0
  464. package/dist/components/Payroll/Transition/TransitionFlow.js.map +1 -0
  465. package/dist/components/Payroll/Transition/TransitionFlowComponents.d.ts +19 -0
  466. package/dist/components/Payroll/Transition/TransitionFlowComponents.js +54 -0
  467. package/dist/components/Payroll/Transition/TransitionFlowComponents.js.map +1 -0
  468. package/dist/components/Payroll/Transition/index.d.ts +3 -0
  469. package/dist/components/Payroll/Transition/transitionStateMachine.d.ts +6 -0
  470. package/dist/components/Payroll/Transition/transitionStateMachine.js +58 -0
  471. package/dist/components/Payroll/Transition/transitionStateMachine.js.map +1 -0
  472. package/dist/components/Payroll/Transition/transitionStateMachine.test.d.ts +1 -0
  473. package/dist/components/Payroll/TransitionCreation/TransitionCreation.d.ts +2 -0
  474. package/dist/components/Payroll/TransitionCreation/TransitionCreation.js +92 -0
  475. package/dist/components/Payroll/TransitionCreation/TransitionCreation.js.map +1 -0
  476. package/dist/components/Payroll/TransitionCreation/TransitionCreationPresentation.d.ts +2 -0
  477. package/dist/components/Payroll/TransitionCreation/TransitionCreationPresentation.js +109 -0
  478. package/dist/components/Payroll/TransitionCreation/TransitionCreationPresentation.js.map +1 -0
  479. package/dist/components/Payroll/TransitionCreation/TransitionCreationPresentation.module.scss.js +8 -0
  480. package/dist/components/Payroll/TransitionCreation/TransitionCreationPresentation.module.scss.js.map +1 -0
  481. package/dist/components/Payroll/TransitionCreation/TransitionCreationTypes.d.ts +28 -0
  482. package/dist/components/Payroll/TransitionCreation/TransitionCreationTypes.js +21 -0
  483. package/dist/components/Payroll/TransitionCreation/TransitionCreationTypes.js.map +1 -0
  484. package/dist/components/Payroll/TransitionCreation/index.d.ts +3 -0
  485. package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.d.ts +8 -0
  486. package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.js +83 -0
  487. package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.js.map +1 -0
  488. package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.d.ts +16 -0
  489. package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.js +100 -0
  490. package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.js.map +1 -0
  491. package/dist/components/Payroll/TransitionPayrollAlert/index.d.ts +2 -0
  492. package/dist/components/Payroll/helpers.d.ts +6 -1
  493. package/dist/components/Payroll/helpers.js +100 -84
  494. package/dist/components/Payroll/helpers.js.map +1 -1
  495. package/dist/components/Payroll/index.d.ts +6 -0
  496. package/dist/components/Payroll/index.js +32 -26
  497. package/dist/components/Payroll/index.js.map +1 -1
  498. package/dist/components/Payroll/payrollTypes.d.ts +21 -0
  499. package/dist/components/Payroll/payrollTypes.js +27 -0
  500. package/dist/components/Payroll/payrollTypes.js.map +1 -0
  501. package/dist/components/Payroll/usePreparedPayrollData.js +6 -8
  502. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  503. package/dist/components/UNSTABLE_Hooks/collectErrors.d.ts +6 -0
  504. package/dist/components/UNSTABLE_Hooks/collectErrors.js +9 -0
  505. package/dist/components/UNSTABLE_Hooks/collectErrors.js.map +1 -0
  506. package/dist/components/UNSTABLE_Hooks/form/FormFieldsMetadataContext.d.ts +8 -0
  507. package/dist/components/UNSTABLE_Hooks/form/FormFieldsMetadataContext.js +10 -0
  508. package/dist/components/UNSTABLE_Hooks/form/FormFieldsMetadataContext.js.map +1 -0
  509. package/dist/components/UNSTABLE_Hooks/form/FormFieldsMetadataProvider.d.ts +10 -0
  510. package/dist/components/UNSTABLE_Hooks/form/FormFieldsMetadataProvider.js +13 -0
  511. package/dist/components/UNSTABLE_Hooks/form/FormFieldsMetadataProvider.js.map +1 -0
  512. package/dist/components/UNSTABLE_Hooks/form/SDKFormProvider.d.ts +23 -0
  513. package/dist/components/UNSTABLE_Hooks/form/SDKFormProvider.js +24 -0
  514. package/dist/components/UNSTABLE_Hooks/form/SDKFormProvider.js.map +1 -0
  515. package/dist/components/UNSTABLE_Hooks/form/composeFormSchema.d.ts +26 -0
  516. package/dist/components/UNSTABLE_Hooks/form/composeFormSchema.js +24 -0
  517. package/dist/components/UNSTABLE_Hooks/form/composeFormSchema.js.map +1 -0
  518. package/dist/components/UNSTABLE_Hooks/form/composeSubmitHandler.d.ts +53 -0
  519. package/dist/components/UNSTABLE_Hooks/form/composeSubmitHandler.js +34 -0
  520. package/dist/components/UNSTABLE_Hooks/form/composeSubmitHandler.js.map +1 -0
  521. package/dist/components/UNSTABLE_Hooks/form/composeSubmitHandler.test.d.ts +1 -0
  522. package/dist/components/UNSTABLE_Hooks/form/deriveFieldsMetadata.d.ts +3 -0
  523. package/dist/components/UNSTABLE_Hooks/form/deriveFieldsMetadata.js +14 -0
  524. package/dist/components/UNSTABLE_Hooks/form/deriveFieldsMetadata.js.map +1 -0
  525. package/dist/components/UNSTABLE_Hooks/form/deriveFieldsMetadata.test.d.ts +1 -0
  526. package/dist/components/UNSTABLE_Hooks/form/fields/CheckboxHookField.d.ts +11 -0
  527. package/dist/components/UNSTABLE_Hooks/form/fields/CheckboxHookField.js +34 -0
  528. package/dist/components/UNSTABLE_Hooks/form/fields/CheckboxHookField.js.map +1 -0
  529. package/dist/components/UNSTABLE_Hooks/form/fields/DatePickerHookField.d.ts +11 -0
  530. package/dist/components/UNSTABLE_Hooks/form/fields/DatePickerHookField.js +34 -0
  531. package/dist/components/UNSTABLE_Hooks/form/fields/DatePickerHookField.js.map +1 -0
  532. package/dist/components/UNSTABLE_Hooks/form/fields/NumberInputHookField.d.ts +14 -0
  533. package/dist/components/UNSTABLE_Hooks/form/fields/NumberInputHookField.js +40 -0
  534. package/dist/components/UNSTABLE_Hooks/form/fields/NumberInputHookField.js.map +1 -0
  535. package/dist/components/UNSTABLE_Hooks/form/fields/RadioGroupHookField.d.ts +12 -0
  536. package/dist/components/UNSTABLE_Hooks/form/fields/RadioGroupHookField.js +40 -0
  537. package/dist/components/UNSTABLE_Hooks/form/fields/RadioGroupHookField.js.map +1 -0
  538. package/dist/components/UNSTABLE_Hooks/form/fields/SelectHookField.d.ts +12 -0
  539. package/dist/components/UNSTABLE_Hooks/form/fields/SelectHookField.js +40 -0
  540. package/dist/components/UNSTABLE_Hooks/form/fields/SelectHookField.js.map +1 -0
  541. package/dist/components/UNSTABLE_Hooks/form/fields/SwitchHookField.d.ts +11 -0
  542. package/dist/components/UNSTABLE_Hooks/form/fields/SwitchHookField.js +34 -0
  543. package/dist/components/UNSTABLE_Hooks/form/fields/SwitchHookField.js.map +1 -0
  544. package/dist/components/UNSTABLE_Hooks/form/fields/TextInputHookField.d.ts +13 -0
  545. package/dist/components/UNSTABLE_Hooks/form/fields/TextInputHookField.js +38 -0
  546. package/dist/components/UNSTABLE_Hooks/form/fields/TextInputHookField.js.map +1 -0
  547. package/dist/components/UNSTABLE_Hooks/form/fields/index.d.ts +15 -0
  548. package/dist/components/UNSTABLE_Hooks/form/getFieldWithOptions.d.ts +2 -0
  549. package/dist/components/UNSTABLE_Hooks/form/getFieldWithOptions.js +8 -0
  550. package/dist/components/UNSTABLE_Hooks/form/getFieldWithOptions.js.map +1 -0
  551. package/dist/components/UNSTABLE_Hooks/form/getFormSubmissionValues.d.ts +18 -0
  552. package/dist/components/UNSTABLE_Hooks/form/getFormSubmissionValues.js +10 -0
  553. package/dist/components/UNSTABLE_Hooks/form/getFormSubmissionValues.js.map +1 -0
  554. package/dist/components/UNSTABLE_Hooks/form/getFormSubmissionValues.test.d.ts +1 -0
  555. package/dist/components/UNSTABLE_Hooks/form/index.d.ts +16 -0
  556. package/dist/components/UNSTABLE_Hooks/form/resolveFieldError.d.ts +4 -0
  557. package/dist/components/UNSTABLE_Hooks/form/resolveFieldError.js +13 -0
  558. package/dist/components/UNSTABLE_Hooks/form/resolveFieldError.js.map +1 -0
  559. package/dist/components/UNSTABLE_Hooks/form/resolveRequiredFields.d.ts +6 -0
  560. package/dist/components/UNSTABLE_Hooks/form/resolveRequiredFields.js +14 -0
  561. package/dist/components/UNSTABLE_Hooks/form/resolveRequiredFields.js.map +1 -0
  562. package/dist/components/UNSTABLE_Hooks/form/types.d.ts +27 -0
  563. package/dist/components/UNSTABLE_Hooks/form/useFieldErrorMessage.d.ts +2 -0
  564. package/dist/components/UNSTABLE_Hooks/form/useFieldErrorMessage.js +17 -0
  565. package/dist/components/UNSTABLE_Hooks/form/useFieldErrorMessage.js.map +1 -0
  566. package/dist/components/UNSTABLE_Hooks/form/useFieldsMetadata.d.ts +4 -0
  567. package/dist/components/UNSTABLE_Hooks/form/useFieldsMetadata.js +8 -0
  568. package/dist/components/UNSTABLE_Hooks/form/useFieldsMetadata.js.map +1 -0
  569. package/dist/components/UNSTABLE_Hooks/form/useHookFieldResolution.d.ts +23 -0
  570. package/dist/components/UNSTABLE_Hooks/form/useHookFieldResolution.js +11 -0
  571. package/dist/components/UNSTABLE_Hooks/form/useHookFieldResolution.js.map +1 -0
  572. package/dist/components/UNSTABLE_Hooks/form/withOptions.d.ts +5 -0
  573. package/dist/components/UNSTABLE_Hooks/form/withOptions.js +7 -0
  574. package/dist/components/UNSTABLE_Hooks/form/withOptions.js.map +1 -0
  575. package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/CompensationForm.d.ts +5 -0
  576. package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/CompensationForm.js +149 -0
  577. package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/CompensationForm.js.map +1 -0
  578. package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/compensationSchema.d.ts +97 -0
  579. package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/compensationSchema.js +121 -0
  580. package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/compensationSchema.js.map +1 -0
  581. package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/fields.d.ts +34 -0
  582. package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/fields.js +50 -0
  583. package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/fields.js.map +1 -0
  584. package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/index.d.ts +7 -0
  585. package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/useCompensationForm.d.ts +104 -0
  586. package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/useCompensationForm.js +259 -0
  587. package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/useCompensationForm.js.map +1 -0
  588. package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/EmployeeDetailsForm.d.ts +5 -0
  589. package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/EmployeeDetailsForm.js +112 -0
  590. package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/EmployeeDetailsForm.js.map +1 -0
  591. package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/employeeDetailsSchema.d.ts +39 -0
  592. package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/employeeDetailsSchema.js +45 -0
  593. package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/employeeDetailsSchema.js.map +1 -0
  594. package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/fields.d.ts +23 -0
  595. package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/fields.js +46 -0
  596. package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/fields.js.map +1 -0
  597. package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/index.d.ts +7 -0
  598. package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/useEmployeeDetailsForm.d.ts +77 -0
  599. package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/useEmployeeDetailsForm.js +153 -0
  600. package/dist/components/UNSTABLE_Hooks/hooks/useEmployeeDetailsForm/useEmployeeDetailsForm.js.map +1 -0
  601. package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/WorkAddressForm.d.ts +5 -0
  602. package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/WorkAddressForm.js +69 -0
  603. package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/WorkAddressForm.js.map +1 -0
  604. package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/fields.d.ts +10 -0
  605. package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/fields.js +14 -0
  606. package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/fields.js.map +1 -0
  607. package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/index.d.ts +7 -0
  608. package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/useWorkAddressForm.d.ts +68 -0
  609. package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/useWorkAddressForm.js +129 -0
  610. package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/useWorkAddressForm.js.map +1 -0
  611. package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/workAddressSchema.d.ts +25 -0
  612. package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/workAddressSchema.js +24 -0
  613. package/dist/components/UNSTABLE_Hooks/hooks/useWorkAddressForm/workAddressSchema.js.map +1 -0
  614. package/dist/components/UNSTABLE_Hooks/index.d.ts +9 -0
  615. package/dist/components/UNSTABLE_Hooks/types.d.ts +49 -0
  616. package/dist/components/UNSTABLE_Hooks/useErrorHandling.d.ts +9 -0
  617. package/dist/components/UNSTABLE_Hooks/useErrorHandling.js +12 -0
  618. package/dist/components/UNSTABLE_Hooks/useErrorHandling.js.map +1 -0
  619. package/dist/components/UNSTABLE_Hooks/useErrorHandling.test.d.ts +1 -0
  620. package/dist/contexts/ApiProvider/ApiProvider.js +11 -11
  621. package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -1
  622. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +43 -50
  623. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
  624. package/dist/contexts/LoadingIndicatorProvider/useLoadingIndicator.d.ts +10 -2
  625. package/dist/contexts/LoadingIndicatorProvider/useLoadingIndicator.js.map +1 -1
  626. package/dist/contexts/ObservabilityProvider/index.d.ts +1 -1
  627. package/dist/contexts/ObservabilityProvider/sanitization.d.ts +0 -14
  628. package/dist/contexts/ObservabilityProvider/sanitization.js +51 -51
  629. package/dist/contexts/ObservabilityProvider/sanitization.js.map +1 -1
  630. package/dist/contexts/ObservabilityProvider/useSanitizedObservability.d.ts +0 -3
  631. package/dist/contexts/ObservabilityProvider/useSanitizedObservability.js.map +1 -1
  632. package/dist/contexts/ThemeProvider/useTheme.js.map +1 -1
  633. package/dist/helpers/requiredIf.d.ts +13 -0
  634. package/dist/helpers/requiredIf.js +8 -0
  635. package/dist/helpers/requiredIf.js.map +1 -0
  636. package/dist/i18n/I18n.js +7 -7
  637. package/dist/i18n/I18n.js.map +1 -1
  638. package/dist/i18n/en/Company.TimeOff.CreateTimeOffPolicy.json.js +26 -0
  639. package/dist/i18n/en/Company.TimeOff.CreateTimeOffPolicy.json.js.map +1 -0
  640. package/dist/i18n/en/Company.TimeOff.HolidayPolicy.json.js +24 -0
  641. package/dist/i18n/en/Company.TimeOff.HolidayPolicy.json.js.map +1 -0
  642. package/dist/i18n/en/Company.TimeOff.TimeOffPolicies.json.js +32 -0
  643. package/dist/i18n/en/Company.TimeOff.TimeOffPolicies.json.js.map +1 -0
  644. package/dist/i18n/en/Company.TimeOff.TimeOffPolicyDetails.json.js +52 -0
  645. package/dist/i18n/en/Company.TimeOff.TimeOffPolicyDetails.json.js.map +1 -0
  646. package/dist/i18n/en/Company.TimeOff.TimeOffRequests.json.js +21 -0
  647. package/dist/i18n/en/Company.TimeOff.TimeOffRequests.json.js.map +1 -0
  648. package/dist/i18n/en/Employee.Terminations.TerminateEmployee.json.js +18 -0
  649. package/dist/i18n/en/Employee.Terminations.TerminateEmployee.json.js.map +1 -0
  650. package/dist/i18n/en/Employee.Terminations.TerminationFlow.json.js +12 -0
  651. package/dist/i18n/en/Employee.Terminations.TerminationFlow.json.js.map +1 -0
  652. package/dist/i18n/en/Employee.Terminations.TerminationSummary.json.js +20 -0
  653. package/dist/i18n/en/Employee.Terminations.TerminationSummary.json.js.map +1 -0
  654. package/dist/i18n/en/Payroll.Dismissal.json.js +22 -0
  655. package/dist/i18n/en/Payroll.Dismissal.json.js.map +1 -0
  656. package/dist/i18n/en/Payroll.GrossUpModal.json.js +16 -14
  657. package/dist/i18n/en/Payroll.GrossUpModal.json.js.map +1 -1
  658. package/dist/i18n/en/Payroll.OffCycleCreation.json.js +15 -11
  659. package/dist/i18n/en/Payroll.OffCycleCreation.json.js.map +1 -1
  660. package/dist/i18n/en/Payroll.OffCyclePayPeriodDateForm.json.js +1 -1
  661. package/dist/i18n/en/Payroll.OffCycleTaxWithholding.json.js +5 -5
  662. package/dist/i18n/en/Payroll.PayrollEditEmployee.json.js +31 -25
  663. package/dist/i18n/en/Payroll.PayrollEditEmployee.json.js.map +1 -1
  664. package/dist/i18n/en/Payroll.PayrollList.json.js +20 -18
  665. package/dist/i18n/en/Payroll.PayrollList.json.js.map +1 -1
  666. package/dist/i18n/en/Payroll.Transition.json.js +8 -0
  667. package/dist/i18n/en/Payroll.Transition.json.js.map +1 -0
  668. package/dist/i18n/en/Payroll.TransitionCreation.json.js +26 -0
  669. package/dist/i18n/en/Payroll.TransitionCreation.json.js.map +1 -0
  670. package/dist/i18n/en/Payroll.TransitionPayrollAlert.json.js +18 -0
  671. package/dist/i18n/en/Payroll.TransitionPayrollAlert.json.js.map +1 -0
  672. package/dist/i18n/en/UNSTABLE.CompensationForm.json.js +58 -0
  673. package/dist/i18n/en/UNSTABLE.CompensationForm.json.js.map +1 -0
  674. package/dist/i18n/en/UNSTABLE.EmployeeDetailsForm.json.js +34 -0
  675. package/dist/i18n/en/UNSTABLE.EmployeeDetailsForm.json.js.map +1 -0
  676. package/dist/i18n/en/UNSTABLE.WorkAddressForm.json.js +24 -0
  677. package/dist/i18n/en/UNSTABLE.WorkAddressForm.json.js.map +1 -0
  678. package/dist/i18n/en/common.json.d.ts +2 -1
  679. package/dist/i18n/en/common.json.js +9 -9
  680. package/dist/index.d.ts +3 -2
  681. package/dist/index.js +14 -13
  682. package/dist/models/WA_RISK_CODES.d.ts +5 -2866
  683. package/dist/models/WA_RISK_CODES.js.map +1 -1
  684. package/dist/shared/constants.d.ts +32 -0
  685. package/dist/shared/constants.js +83 -65
  686. package/dist/shared/constants.js.map +1 -1
  687. package/dist/style.css +1 -1
  688. package/dist/types/i18next.d.ts +707 -1
  689. package/dist/types/observability.d.ts +31 -65
  690. package/dist/types/sdkError.d.ts +97 -0
  691. package/dist/types/sdkError.js +95 -0
  692. package/dist/types/sdkError.js.map +1 -0
  693. package/dist/types/sdkError.test.d.ts +1 -0
  694. package/docs/reference/endpoint-inventory.json +212 -14
  695. package/package.json +17 -17
  696. package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/PayrollConfiguration.d.ts +0 -6
  697. package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/PayrollConfiguration.js +0 -70
  698. package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/PayrollConfiguration.js.map +0 -1
  699. package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/PayrollConfigurationContext.d.ts +0 -7
  700. package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/PayrollConfigurationContext.js +0 -6
  701. package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/PayrollConfigurationContext.js.map +0 -1
  702. package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/PayrollConfigurationProvider.d.ts +0 -9
  703. package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/PayrollConfigurationProvider.js +0 -40
  704. package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/PayrollConfigurationProvider.js.map +0 -1
  705. package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/index.d.ts +0 -5
  706. package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/usePayrollConfiguration.d.ts +0 -2
  707. package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/usePayrollConfiguration.js +0 -12
  708. package/dist/components/Payroll/UNSTABLE_PayrollHooks/PayrollConfiguration/usePayrollConfiguration.js.map +0 -1
  709. package/dist/components/Payroll/UNSTABLE_PayrollHooks/index.d.ts +0 -2
  710. package/dist/contexts/ObservabilityProvider/observabilityUtils.d.ts +0 -5
  711. package/dist/contexts/ObservabilityProvider/observabilityUtils.js +0 -45
  712. package/dist/contexts/ObservabilityProvider/observabilityUtils.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"CustomDeductionForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { useMemo } from 'react'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { NumberInputField, TextInputField, RadioGroupField } from '@/components/Common'\nimport { type CommonComponentInterface, useBase } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\n\nconst NON_NEGATIVE_ERROR = 'Number must be greater than or equal to 0'\n\nexport const DeductionSchema = z.object({\n active: z.boolean(),\n amount: z.number().min(0, { error: NON_NEGATIVE_ERROR }).transform(String),\n description: z.string().min(1),\n times: z.number().nullable(),\n recurring: z.boolean(),\n annualMaximum: z\n .number()\n .min(0, { error: NON_NEGATIVE_ERROR })\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n totalAmount: z\n .number()\n .min(0, { error: NON_NEGATIVE_ERROR })\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n deductAsPercentage: z.boolean(),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ninterface ChildSupportFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n onCancel: () => void\n}\n\nfunction CustomDeductionForm({ deduction, employeeId, onCancel }: ChildSupportFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n const isPending = isPendingCreate || isPendingUpdate\n\n const defaultValues: DeductionInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n description: deduction?.description ?? '',\n times: deduction?.times ?? null,\n recurring: deduction?.recurring ?? true,\n annualMaximum: deduction?.annualMaximum ? Number(deduction.annualMaximum) : null,\n totalAmount: deduction?.totalAmount ? Number(deduction.totalAmount) : null,\n deductAsPercentage: deduction?.deductAsPercentage ?? true,\n active: true,\n } as DeductionInputs\n }, [deduction])\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n const { control } = formMethods\n const watchedRecurring = useWatch({ control, name: 'recurring' })\n const watchedAmountPercentage = useWatch({ control, name: 'deductAsPercentage' })\n\n const onSubmit: SubmitHandler<DeductionPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, courtOrdered: false, times: payload.recurring ? null : 1 }, // custom deductions cannot be court ordered/garnishment\n },\n })\n\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...payload,\n version: deduction.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const handleCancel = () => {\n onCancel()\n }\n\n return (\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n <>\n <Components.Heading as=\"h3\">{t('customDeductionTitle')}</Components.Heading>\n <Flex flexDirection=\"column\" gap={20}>\n <Flex flexDirection=\"column\" gap={20}>\n <TextInputField name=\"description\" label={t('descriptionLabelV2')} isRequired />\n <RadioGroupField\n name=\"recurring\"\n label={t('frequencyLabel')}\n isRequired\n options={[\n { value: true, label: t('frequencyRecurringOptionV2') },\n { value: false, label: t('frequencyOneTimeOptionV2') },\n ]}\n />\n <RadioGroupField\n name=\"deductAsPercentage\"\n label={t('deductionTypeLabelV2')}\n isRequired\n options={[\n { value: true, label: t('deductionTypePercentageOptionV2') },\n { value: false, label: t('deductionTypeFixedAmountOption') },\n ]}\n />\n <NumberInputField\n name=\"amount\"\n adornmentStart={!watchedAmountPercentage && '$'}\n adornmentEnd={watchedAmountPercentage && '%'}\n label={t('deductionAmountLabel')}\n isRequired\n min={0}\n format={watchedAmountPercentage ? 'percent' : 'currency'}\n description={\n watchedAmountPercentage\n ? t('deductionAmountDescriptionPercentage')\n : t('deductionAmountDescriptionFixed')\n }\n />\n </Flex>\n {watchedRecurring && (\n <Flex flexDirection=\"column\" gap={20}>\n <NumberInputField\n name=\"totalAmount\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('totalAmountLabel')}\n description={t('totalAmountDescription')}\n min={0}\n />\n <NumberInputField\n name=\"annualMaximum\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('annualMaxLabel')}\n min={0}\n description={t('annualMaxDescription')}\n />\n </Flex>\n )}\n </Flex>\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('saveCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n\nexport default CustomDeductionForm\n"],"names":["NON_NEGATIVE_ERROR","DeductionSchema","z","val","CustomDeductionForm","deduction","employeeId","onCancel","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultValues","useMemo","formMethods","useForm","zodResolver","control","watchedRecurring","useWatch","watchedAmountPercentage","onSubmit","data","payload","updateDeductionResponse","componentEvents","createDeductionResponse","handleCancel","FormProvider","jsx","Form","Flex","jsxs","Fragment","TextInputField","RadioGroupField","NumberInputField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAMA,IAAqB,6CAEdC,IAAkBC,EAAE,OAAO;AAAA,EACtC,QAAQA,EAAE,QAAA;AAAA,EACV,QAAQA,EAAE,OAAA,EAAS,IAAI,GAAG,EAAE,OAAOF,EAAA,CAAoB,EAAE,UAAU,MAAM;AAAA,EACzE,aAAaE,EAAE,SAAS,IAAI,CAAC;AAAA,EAC7B,OAAOA,EAAE,OAAA,EAAS,SAAA;AAAA,EAClB,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AEP,gBAAA4B;AAAA,UAACO;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,gBAAe;AAAA,YACf,QAAO;AAAA,YACP,OAAOnC,EAAE,gBAAgB;AAAA,YACzB,KAAK;AAAA,YACL,aAAaA,EAAE,sBAAsB;AAAA,UAAA;AAAA,QAAA;AAAA,MACvC,EAAA,CACF;AAAA,IAAA,GAEJ;AAAA,sBACCoC,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAR,EAAC1B,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASwB,GAC7C,UAAA1B,EAAE,WAAW,EAAA,CAChB;AAAA,MACA,gBAAA4B,EAAC1B,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWQ,GACzC,UAAAV,EAAE,SAAS,EAAA,CACd;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
1
+ {"version":3,"file":"CustomDeductionForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { useMemo } from 'react'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { NumberInputField, TextInputField, RadioGroupField } from '@/components/Common'\nimport { type CommonComponentInterface, useBase } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\n\nconst NON_NEGATIVE_ERROR = 'Number must be greater than or equal to 0'\n\nexport const DeductionSchema = z.object({\n active: z.boolean(),\n amount: z.number().min(0, { error: NON_NEGATIVE_ERROR }).transform(String),\n description: z.string().min(1),\n times: z.number().nullable(),\n recurring: z.boolean(),\n annualMaximum: z\n .number()\n .min(0, { error: NON_NEGATIVE_ERROR })\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n totalAmount: z\n .number()\n .min(0, { error: NON_NEGATIVE_ERROR })\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n deductAsPercentage: z.boolean(),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ninterface ChildSupportFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n onCancel: () => void\n}\n\nfunction CustomDeductionForm({ deduction, employeeId, onCancel }: ChildSupportFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n const isPending = isPendingCreate || isPendingUpdate\n\n const defaultValues: DeductionInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n description: deduction?.description ?? '',\n times: deduction?.times ?? null,\n recurring: deduction?.recurring ?? true,\n annualMaximum: deduction?.annualMaximum ? Number(deduction.annualMaximum) : null,\n totalAmount: deduction?.totalAmount ? Number(deduction.totalAmount) : null,\n deductAsPercentage: deduction?.deductAsPercentage ?? true,\n active: true,\n } as DeductionInputs\n }, [deduction])\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n const { control } = formMethods\n const watchedRecurring = useWatch({ control, name: 'recurring' })\n const watchedAmountPercentage = useWatch({ control, name: 'deductAsPercentage' })\n\n const onSubmit: SubmitHandler<DeductionPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, courtOrdered: false, times: payload.recurring ? null : 1 }, // custom deductions cannot be court ordered/garnishment\n },\n })\n\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...payload,\n version: deduction.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const handleCancel = () => {\n onCancel()\n }\n\n return (\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n <>\n <Components.Heading as=\"h3\">{t('customDeductionTitle')}</Components.Heading>\n <Flex flexDirection=\"column\" gap={20}>\n <Flex flexDirection=\"column\" gap={20}>\n <TextInputField name=\"description\" label={t('descriptionLabelV2')} isRequired />\n <RadioGroupField\n name=\"recurring\"\n label={t('frequencyLabel')}\n isRequired\n options={[\n { value: true, label: t('frequencyRecurringOptionV2') },\n { value: false, label: t('frequencyOneTimeOptionV2') },\n ]}\n />\n <RadioGroupField\n name=\"deductAsPercentage\"\n label={t('deductionTypeLabelV2')}\n isRequired\n options={[\n { value: true, label: t('deductionTypePercentageOptionV2') },\n { value: false, label: t('deductionTypeFixedAmountOption') },\n ]}\n />\n <NumberInputField\n name=\"amount\"\n adornmentStart={!watchedAmountPercentage && '$'}\n adornmentEnd={watchedAmountPercentage && '%'}\n label={t('deductionAmountLabel')}\n isRequired\n min={0}\n format={watchedAmountPercentage ? 'percent' : 'currency'}\n description={\n watchedAmountPercentage\n ? t('deductionAmountDescriptionPercentage')\n : t('deductionAmountDescriptionFixed')\n }\n />\n </Flex>\n {watchedRecurring && (\n <Flex flexDirection=\"column\" gap={20}>\n <NumberInputField\n name=\"totalAmount\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('totalAmountLabel')}\n description={t('totalAmountDescription')}\n min={0}\n />\n <NumberInputField\n name=\"annualMaximum\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('annualMaxLabel')}\n min={0}\n description={t('annualMaxDescription')}\n />\n </Flex>\n )}\n </Flex>\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('saveCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n\nexport default CustomDeductionForm\n"],"names":["NON_NEGATIVE_ERROR","DeductionSchema","z","val","CustomDeductionForm","deduction","employeeId","onCancel","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultValues","useMemo","formMethods","useForm","zodResolver","control","watchedRecurring","useWatch","watchedAmountPercentage","onSubmit","data","payload","updateDeductionResponse","componentEvents","createDeductionResponse","handleCancel","FormProvider","jsx","Form","Flex","jsxs","Fragment","TextInputField","RadioGroupField","NumberInputField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAMA,IAAqB,6CAEdC,IAAkBC,EAAE,OAAO;AAAA,EACtC,QAAQA,EAAE,QAAA;AAAA,EACV,QAAQA,EAAE,OAAA,EAAS,IAAI,GAAG,EAAE,OAAOF,EAAA,CAAoB,EAAE,UAAU,MAAM;AAAA,EACzE,aAAaE,EAAE,SAAS,IAAI,CAAC;AAAA,EAC7B,OAAOA,EAAE,OAAA,EAAS,SAAA;AAAA,EAClB,WAAWA,EAAE,QAAA;AAAA,EACb,eAAeA,EACZ,SACA,IAAI,GAAG,EAAE,OAAOF,GAAoB,EACpC,UAAU,CAAAG,MAAQA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nC,EAAE,gBAAgB;AAAA,YACzB,KAAK;AAAA,YACL,aAAaA,EAAE,sBAAsB;AAAA,UAAA;AAAA,QAAA;AAAA,MACvC,EAAA,CACF;AAAA,IAAA,GAEJ;AAAA,sBACCoC,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAR,EAAC1B,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASwB,GAC7C,UAAA1B,EAAE,WAAW,EAAA,CAChB;AAAA,MACA,gBAAA4B,EAAC1B,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWQ,GACzC,UAAAV,EAAE,SAAS,EAAA,CACd;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"DeductionsForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/DeductionsForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useState } from 'react'\nimport { useGarnishmentsListSuspense } from '@gusto/embedded-api/react-query/garnishmentsList'\nimport { useGarnishmentsGetChildSupportDataSuspense } from '@gusto/embedded-api/react-query/garnishmentsGetChildSupportData'\nimport type { GarnishmentType } from '@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments'\nimport ChildSupportForm from './ChildSupportForm'\nimport GarnishmentForm from './GarnishmentForm'\nimport CustomDeductionForm from './CustomDeductionForm'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { Grid } from '@/components/Common/Grid/Grid'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport { Flex } from '@/components/Common/Flex/Flex'\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\n// deductions can be either garnishment (court-ordered) or a custom deduction\nconst SUPPORTED_GARNISHMENT_TYPES: GarnishmentType[] = [\n 'child_support',\n 'federal_tax_lien',\n 'state_tax_lien',\n 'student_loan',\n 'creditor_garnishment',\n 'federal_loan',\n 'other_garnishment',\n]\n\nfunction Root({ className, employeeId, deductionId, dictionary }: DeductionsFormProps) {\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 // Fetch all garnishments to find the specific one by ID\n const { data } = useGarnishmentsListSuspense({ employeeId })\n\n // Fetch child support garnishment metadata\n const { data: childSupportData } = useGarnishmentsGetChildSupportDataSuspense({})\n\n // find existing deduction to determine if in ADD or EDIT mode\n // if deduction exists we are editing, else we are adding\n const deduction = deductionId\n ? (data.garnishmentList?.find(g => g.uuid === deductionId) ?? null)\n : null\n const title = !deduction ? t('addDeductionTitle') : t('editDeductionTitle')\n const deductionType = deduction?.garnishmentType\n const stateAgencies =\n childSupportData.childSupportData?.agencies?.map(a => ({\n label: a.name as string,\n value: a.state as string,\n })) || []\n\n // if deduction exists check if it has a type, else if does not exist default to garnishment\n const [isGarnishment, setIsGarnishment] = useState<boolean>(\n (deductionType && SUPPORTED_GARNISHMENT_TYPES.includes(deductionType)) || !deduction,\n )\n const [selectedGarnishment, setSelectedGarnishment] = useState<GarnishmentType>(\n deductionType || 'child_support',\n )\n const garnishmentLabels: Record<string, string> = {\n child_support: t('childSupportTitle'),\n federal_tax_lien: t('federalTaxLien'),\n state_tax_lien: t('stateTaxLien'),\n student_loan: t('studentLoan'),\n creditor_garnishment: t('creditorGarnishment'),\n federal_loan: t('federalLoan'),\n other_garnishment: t('otherGarnishment'),\n }\n const garnishmentPlaceholder = garnishmentLabels[selectedGarnishment]\n const garnishmentOptions = SUPPORTED_GARNISHMENT_TYPES.map(garnishment => ({\n value: garnishment,\n label: garnishmentLabels[garnishment] as string,\n }))\n\n const defaultDeductionTypeSelection = deduction\n ? deductionType\n ? 'garnishment'\n : 'custom'\n : 'garnishment'\n\n // filter out specific fipsCodes/counties as mapped to selected state agency\n // some states only have 1 fips code/county to cover the entire state,\n // but the API will return a null label so we need to provide a default label\n const [stateAgency, setStateAgency] = useState<string>(deduction?.childSupport?.state || '')\n const handleStateAgencySelect = (stateAgency: string) => {\n setStateAgency(stateAgency)\n }\n const selectedAgencyFipsCodes = childSupportData.childSupportData?.agencies?.find(\n agency => agency.state === stateAgency,\n )?.fipsCodes\n const counties = (selectedAgencyFipsCodes ?? [])\n .filter(fipsCode => typeof fipsCode.code === 'string')\n .map(fipsCode => ({\n label: fipsCode.county?.length ? fipsCode.county : t('allCounties'),\n value: fipsCode.code ?? '',\n }))\n const singleFipsCode =\n selectedAgencyFipsCodes?.length === 1 ? selectedAgencyFipsCodes[0] : undefined\n const singleAllCountiesFipsCode =\n singleFipsCode && !singleFipsCode.county?.length ? singleFipsCode.code : null\n\n // get a reference to the currently selected agency to determine which required fields to display/include in submission\n const selectedAgency = childSupportData.childSupportData?.agencies?.find(\n agency => agency.state === stateAgency,\n )\n\n const handleCancel = () => {\n // if any active garnishments return to list view, else return to empty state view\n if (data.garnishmentList?.some(g => g.active)) {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CANCEL)\n } else {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CANCEL_EMPTY)\n }\n }\n\n const handleSelectDeductionType = (selection: string) => {\n setIsGarnishment(selection === 'garnishment')\n }\n\n return (\n <section className={className}>\n <Grid gap={32}>\n <Flex flexDirection=\"column\" gap={2}>\n <Components.Heading as=\"h2\">{title}</Components.Heading>\n <Components.Text variant=\"supporting\">\n {t('externalPostTaxDeductionsDescription')}\n </Components.Text>\n </Flex>\n\n {!deduction && (\n <>\n <Flex flexDirection=\"column\" gap={20}>\n <Components.RadioGroup\n label={t('deductionTypeLabel')}\n description={t('deductionTypeRadioLabel')}\n options={[\n { value: 'garnishment', label: t('garnishmentOption') },\n { value: 'custom', label: t('customDeductionOption') },\n ]}\n defaultValue={defaultDeductionTypeSelection}\n onChange={handleSelectDeductionType}\n isRequired\n />\n\n {isGarnishment && (\n <Components.Select\n label={t('garnishmentType')}\n options={garnishmentOptions}\n placeholder={garnishmentPlaceholder}\n onChange={value => {\n setSelectedGarnishment(value as GarnishmentType)\n }}\n isDisabled={!!deduction} // API does not allow to change/edit an existing deduction type\n isRequired\n />\n )}\n </Flex>\n\n <hr />\n </>\n )}\n\n {isGarnishment ? (\n <>\n {selectedGarnishment === 'child_support' ? (\n <ChildSupportForm\n deduction={deduction}\n employeeId={employeeId}\n handleStateAgencySelect={handleStateAgencySelect}\n stateAgencies={stateAgencies}\n counties={counties}\n singleAllCountiesFipsCode={singleAllCountiesFipsCode}\n selectedAgency={selectedAgency}\n onCancel={handleCancel}\n />\n ) : (\n <GarnishmentForm\n deduction={deduction}\n employeeId={employeeId}\n selectedGarnishmentType={selectedGarnishment}\n selectedGarnishmentTitle={garnishmentPlaceholder!}\n onCancel={handleCancel}\n />\n )}\n </>\n ) : (\n <CustomDeductionForm\n deduction={deduction}\n employeeId={employeeId}\n onCancel={handleCancel}\n />\n )}\n </Grid>\n </section>\n )\n}\n"],"names":["DeductionsForm","props","jsx","BaseComponent","Root","SUPPORTED_GARNISHMENT_TYPES","className","employeeId","deductionId","dictionary","onEvent","useBase","useTranslation","Components","useComponentContext","useComponentDictionary","useI18n","data","useGarnishmentsListSuspense","childSupportData","useGarnishmentsGetChildSupportDataSuspense","deduction","g","title","deductionType","stateAgencies","a","isGarnishment","setIsGarnishment","useState","selectedGarnishment","setSelectedGarnishment","garnishmentLabels","garnishmentPlaceholder","garnishmentOptions","garnishment","defaultDeductionTypeSelection","stateAgency","setStateAgency","handleStateAgencySelect","selectedAgencyFipsCodes","agency","counties","fipsCode","singleFipsCode","singleAllCountiesFipsCode","selectedAgency","handleCancel","componentEvents","handleSelectDeductionType","selection","jsxs","Grid","Flex","Fragment","value","ChildSupportForm","GarnishmentForm","CustomDeductionForm"],"mappings":";;;;;;;;;;;;;;;AA0BO,SAASA,GAAeC,GAAqD;AAClF,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAGA,MAAMI,IAAiD;AAAA,EACrD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,SAASD,EAAK,EAAE,WAAAE,GAAW,YAAAC,GAAY,aAAAC,GAAa,YAAAC,KAAmC;AACrF,QAAM,EAAE,SAAAC,EAAA,IAAYC,EAAA,GACd,EAAE,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA;AAEnB,EAAAC,EAAuB,uBAAuBN,CAAU,GACxDO,EAAQ,qBAAqB;AAG7B,QAAM,EAAE,MAAAC,EAAA,IAASC,EAA4B,EAAE,YAAAX,GAAY,GAGrD,EAAE,MAAMY,MAAqBC,EAA2C,CAAA,CAAE,GAI1EC,IAAYb,IACbS,EAAK,iBAAiB,KAAK,OAAKK,EAAE,SAASd,CAAW,KAAK,OAC5D,MACEe,IAA8C,EAArCF,IAAuC,uBAAzB,mBAA6C,GACpEG,IAAgBH,GAAW,iBAC3BI,IACJN,EAAiB,kBAAkB,UAAU,IAAI,CAAAO,OAAM;AAAA,IACrD,OAAOA,EAAE;AAAA,IACT,OAAOA,EAAE;AAAA,EAAA,EACT,KAAK,CAAA,GAGH,CAACC,GAAeC,CAAgB,IAAIC;AAAA,IACvCL,KAAiBnB,EAA4B,SAASmB,CAAa,KAAM,CAACH;AAAA,EAAA,GAEvE,CAACS,GAAqBC,CAAsB,IAAIF;AAAA,IACpDL,KAAiB;AAAA,EAAA,GAEbQ,IAA4C;AAAA,IAChD,eAAe,EAAE,mBAAmB;A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AAzB,EAAAoD,GAAA,EACG,UAAAxB,MAAwB,kBACvB,gBAAA5B;AAAA,MAACsD;AAAA,MAAA;AAAA,QACC,WAAAnC;AAAA,QACA,YAAAd;AAAA,QACA,yBAAAgC;AAAA,QACA,eAAAd;AAAA,QACA,UAAAiB;AAAA,QACA,2BAAAG;AAAA,QACA,gBAAAC;AAAA,QACA,UAAUC;AAAA,MAAA;AAAA,IAAA,IAGZ,gBAAA7C;AAAA,MAACuD;AAAA,MAAA;AAAA,QACC,WAAApC;AAAA,QACA,YAAAd;AAAA,QACA,yBAAyBuB;AAAA,QACzB,0BAA0BG;AAAA,QAC1B,UAAUc;AAAA,MAAA;AAAA,IAAA,GAGhB,IAEA,gBAAA7C;AAAA,MAACwD;AAAA,MAAA;AAAA,QACC,WAAArC;AAAA,QACA,YAAAd;AAAA,QACA,UAAUwC;AAAA,MAAA;AAAA,IAAA;AAAA,EACZ,EAAA,CAEJ,EAAA,CACF;AAEJ;"}
1
+ {"version":3,"file":"DeductionsForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/DeductionsForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useState } from 'react'\nimport { useGarnishmentsListSuspense } from '@gusto/embedded-api/react-query/garnishmentsList'\nimport { useGarnishmentsGetChildSupportDataSuspense } from '@gusto/embedded-api/react-query/garnishmentsGetChildSupportData'\nimport type { GarnishmentType } from '@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments'\nimport ChildSupportForm from './ChildSupportForm'\nimport GarnishmentForm from './GarnishmentForm'\nimport CustomDeductionForm from './CustomDeductionForm'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { Grid } from '@/components/Common/Grid/Grid'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport { Flex } from '@/components/Common/Flex/Flex'\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\n// deductions can be either garnishment (court-ordered) or a custom deduction\nconst SUPPORTED_GARNISHMENT_TYPES: GarnishmentType[] = [\n 'child_support',\n 'federal_tax_lien',\n 'state_tax_lien',\n 'student_loan',\n 'creditor_garnishment',\n 'federal_loan',\n 'other_garnishment',\n]\n\nfunction Root({ className, employeeId, deductionId, dictionary }: DeductionsFormProps) {\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 // Fetch all garnishments to find the specific one by ID\n const { data } = useGarnishmentsListSuspense({ employeeId })\n\n // Fetch child support garnishment metadata\n const { data: childSupportData } = useGarnishmentsGetChildSupportDataSuspense({})\n\n // find existing deduction to determine if in ADD or EDIT mode\n // if deduction exists we are editing, else we are adding\n const deduction = deductionId\n ? (data.garnishmentList?.find(g => g.uuid === deductionId) ?? null)\n : null\n const title = !deduction ? t('addDeductionTitle') : t('editDeductionTitle')\n const deductionType = deduction?.garnishmentType\n const stateAgencies =\n childSupportData.childSupportData?.agencies?.map(a => ({\n label: a.name as string,\n value: a.state as string,\n })) || []\n\n // if deduction exists check if it has a type, else if does not exist default to garnishment\n const [isGarnishment, setIsGarnishment] = useState(\n (deductionType && SUPPORTED_GARNISHMENT_TYPES.includes(deductionType)) || !deduction,\n )\n const [selectedGarnishment, setSelectedGarnishment] = useState<GarnishmentType>(\n deductionType || 'child_support',\n )\n const garnishmentLabels: Record<string, string> = {\n child_support: t('childSupportTitle'),\n federal_tax_lien: t('federalTaxLien'),\n state_tax_lien: t('stateTaxLien'),\n student_loan: t('studentLoan'),\n creditor_garnishment: t('creditorGarnishment'),\n federal_loan: t('federalLoan'),\n other_garnishment: t('otherGarnishment'),\n }\n const garnishmentPlaceholder = garnishmentLabels[selectedGarnishment]\n const garnishmentOptions = SUPPORTED_GARNISHMENT_TYPES.map(garnishment => ({\n value: garnishment,\n label: garnishmentLabels[garnishment] as string,\n }))\n\n const defaultDeductionTypeSelection = deduction\n ? deductionType\n ? 'garnishment'\n : 'custom'\n : 'garnishment'\n\n // filter out specific fipsCodes/counties as mapped to selected state agency\n // some states only have 1 fips code/county to cover the entire state,\n // but the API will return a null label so we need to provide a default label\n const [stateAgency, setStateAgency] = useState(deduction?.childSupport?.state || '')\n const handleStateAgencySelect = (stateAgency: string) => {\n setStateAgency(stateAgency)\n }\n const selectedAgencyFipsCodes = childSupportData.childSupportData?.agencies?.find(\n agency => agency.state === stateAgency,\n )?.fipsCodes\n const counties = (selectedAgencyFipsCodes ?? [])\n .filter(fipsCode => typeof fipsCode.code === 'string')\n .map(fipsCode => ({\n label: fipsCode.county?.length ? fipsCode.county : t('allCounties'),\n value: fipsCode.code ?? '',\n }))\n const singleFipsCode =\n selectedAgencyFipsCodes?.length === 1 ? selectedAgencyFipsCodes[0] : undefined\n const singleAllCountiesFipsCode =\n singleFipsCode && !singleFipsCode.county?.length ? singleFipsCode.code : null\n\n // get a reference to the currently selected agency to determine which required fields to display/include in submission\n const selectedAgency = childSupportData.childSupportData?.agencies?.find(\n agency => agency.state === stateAgency,\n )\n\n const handleCancel = () => {\n // if any active garnishments return to list view, else return to empty state view\n if (data.garnishmentList?.some(g => g.active)) {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CANCEL)\n } else {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CANCEL_EMPTY)\n }\n }\n\n const handleSelectDeductionType = (selection: string) => {\n setIsGarnishment(selection === 'garnishment')\n }\n\n return (\n <section className={className}>\n <Grid gap={32}>\n <Flex flexDirection=\"column\" gap={2}>\n <Components.Heading as=\"h2\">{title}</Components.Heading>\n <Components.Text variant=\"supporting\">\n {t('externalPostTaxDeductionsDescription')}\n </Components.Text>\n </Flex>\n\n {!deduction && (\n <>\n <Flex flexDirection=\"column\" gap={20}>\n <Components.RadioGroup\n label={t('deductionTypeLabel')}\n description={t('deductionTypeRadioLabel')}\n options={[\n { value: 'garnishment', label: t('garnishmentOption') },\n { value: 'custom', label: t('customDeductionOption') },\n ]}\n defaultValue={defaultDeductionTypeSelection}\n onChange={handleSelectDeductionType}\n isRequired\n />\n\n {isGarnishment && (\n <Components.Select\n label={t('garnishmentType')}\n options={garnishmentOptions}\n placeholder={garnishmentPlaceholder}\n onChange={value => {\n setSelectedGarnishment(value as GarnishmentType)\n }}\n isDisabled={!!deduction} // API does not allow to change/edit an existing deduction type\n isRequired\n />\n )}\n </Flex>\n\n <hr />\n </>\n )}\n\n {isGarnishment ? (\n <>\n {selectedGarnishment === 'child_support' ? (\n <ChildSupportForm\n deduction={deduction}\n employeeId={employeeId}\n handleStateAgencySelect={handleStateAgencySelect}\n stateAgencies={stateAgencies}\n counties={counties}\n singleAllCountiesFipsCode={singleAllCountiesFipsCode}\n selectedAgency={selectedAgency}\n onCancel={handleCancel}\n />\n ) : (\n <GarnishmentForm\n deduction={deduction}\n employeeId={employeeId}\n selectedGarnishmentType={selectedGarnishment}\n selectedGarnishmentTitle={garnishmentPlaceholder!}\n onCancel={handleCancel}\n />\n )}\n </>\n ) : (\n <CustomDeductionForm\n deduction={deduction}\n employeeId={employeeId}\n onCancel={handleCancel}\n />\n )}\n </Grid>\n </section>\n )\n}\n"],"names":["DeductionsForm","props","jsx","BaseComponent","Root","SUPPORTED_GARNISHMENT_TYPES","className","employeeId","deductionId","dictionary","onEvent","useBase","useTranslation","Components","useComponentContext","useComponentDictionary","useI18n","data","useGarnishmentsListSuspense","childSupportData","useGarnishmentsGetChildSupportDataSuspense","deduction","g","title","deductionType","stateAgencies","a","isGarnishment","setIsGarnishment","useState","selectedGarnishment","setSelectedGarnishment","garnishmentLabels","garnishmentPlaceholder","garnishmentOptions","garnishment","defaultDeductionTypeSelection","stateAgency","setStateAgency","handleStateAgencySelect","selectedAgencyFipsCodes","agency","counties","fipsCode","singleFipsCode","singleAllCountiesFipsCode","selectedAgency","handleCancel","componentEvents","handleSelectDeductionType","selection","jsxs","Grid","Flex","Fragment","value","ChildSupportForm","GarnishmentForm","CustomDeductionForm"],"mappings":";;;;;;;;;;;;;;;AA0BO,SAASA,GAAeC,GAAqD;AAClF,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAGA,MAAMI,IAAiD;AAAA,EACrD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,SAASD,EAAK,EAAE,WAAAE,GAAW,YAAAC,GAAY,aAAAC,GAAa,YAAAC,KAAmC;AACrF,QAAM,EAAE,SAAAC,EAAA,IAAYC,EAAA,GACd,EAAE,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA;AAEnB,EAAAC,EAAuB,uBAAuBN,CAAU,GACxDO,EAAQ,qBAAqB;AAG7B,QAAM,EAAE,MAAAC,EAAA,IAASC,EAA4B,EAAE,YAAAX,GAAY,GAGrD,EAAE,MAAMY,MAAqBC,EAA2C,CAAA,CAAE,GAI1EC,IAAYb,IACbS,EAAK,iBAAiB,KAAK,OAAKK,EAAE,SAASd,CAAW,KAAK,OAC5D,MACEe,IAA8C,EAArCF,IAAuC,uBAAzB,mBAA6C,GACpEG,IAAgBH,GAAW,iBAC3BI,IACJN,EAAiB,kBAAkB,UAAU,IAAI,CAAAO,OAAM;AAAA,IACrD,OAAOA,EAAE;AAAA,IACT,OAAOA,EAAE;AAAA,EAAA,EACT,KAAK,CAAA,GAGH,CAACC,GAAeC,CAAgB,IAAIC;AAAA,IACvCL,KAAiBnB,EAA4B,SAASmB,CAAa,KAAM,CAACH;AAA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,YACd,YAAU;AAAA,UAAA;AAAA,QAAA;AAAA,MACZ,GAEJ;AAAA,wBAEC,MAAA,CAAA,CAAG;AAAA,IAAA,GACN;AAAA,IAGDM,IACC,gBAAAzB,EAAAoD,GAAA,EACG,UAAAxB,MAAwB,kBACvB,gBAAA5B;AAAA,MAACsD;AAAA,MAAA;AAAA,QACC,WAAAnC;AAAA,QACA,YAAAd;AAAA,QACA,yBAAAgC;AAAA,QACA,eAAAd;AAAA,QACA,UAAAiB;AAAA,QACA,2BAAAG;AAAA,QACA,gBAAAC;AAAA,QACA,UAAUC;AAAA,MAAA;AAAA,IAAA,IAGZ,gBAAA7C;AAAA,MAACuD;AAAA,MAAA;AAAA,QACC,WAAApC;AAAA,QACA,YAAAd;AAAA,QACA,yBAAyBuB;AAAA,QACzB,0BAA0BG;AAAA,QAC1B,UAAUc;AAAA,MAAA;AAAA,IAAA,GAGhB,IAEA,gBAAA7C;AAAA,MAACwD;AAAA,MAAA;AAAA,QACC,WAAArC;AAAA,QACA,YAAAd;AAAA,QACA,UAAUwC;AAAA,MAAA;AAAA,IAAA;AAAA,EACZ,EAAA,CAEJ,EAAA,CACF;AAEJ;"}
@@ -10,20 +10,19 @@ import { useGarnishmentsUpdateMutation as U } from "@gusto/embedded-api/react-qu
10
10
  import { useComponentContext as j } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
11
11
  import { Form as $ } from "../../../Common/Form/Form.js";
12
12
  import { Flex as m } from "../../../Common/Flex/Flex.js";
13
- import "classnames";
14
- import { componentEvents as f } from "../../../../shared/constants.js";
15
- import { RadioGroupField as h } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
16
- import { TextInputField as z } from "../../../Common/Fields/TextInputField/TextInputField.js";
17
- import { ActionsLayout as H } from "../../../Common/ActionsLayout/ActionsLayout.js";
18
- import { NumberInputField as c } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
13
+ import { ActionsLayout as z } from "../../../Common/ActionsLayout/ActionsLayout.js";
19
14
  import "react-error-boundary";
15
+ import "@tanstack/react-query";
16
+ import { useBase as H } from "../../../Base/useBase.js";
17
+ import "@gusto/embedded-api/models/errors/apierror";
20
18
  import "@gusto/embedded-api/models/errors/gustoembeddederror";
21
19
  import "@gusto/embedded-api/models/errors/sdkvalidationerror";
22
- import "@tanstack/react-query";
23
- import { useBase as Y } from "../../../Base/useBase.js";
24
- import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
25
- import "dompurify";
26
- import "../../../../contexts/LocaleProvider/useLocale.js";
20
+ import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
21
+ import "@gusto/embedded-api/models/errors/httpclienterrors";
22
+ import { componentEvents as f } from "../../../../shared/constants.js";
23
+ import { TextInputField as Y } from "../../../Common/Fields/TextInputField/TextInputField.js";
24
+ import { RadioGroupField as h } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
25
+ import { NumberInputField as c } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
27
26
  const p = "Number must be greater than or equal to 0", k = r.object({
28
27
  active: r.boolean(),
29
28
  amount: r.number().min(0, { error: p }).transform(String),
@@ -36,14 +35,14 @@ const p = "Number must be greater than or equal to 0", k = r.object({
36
35
  deductAsPercentage: r.boolean(),
37
36
  garnishmentType: r.enum(w)
38
37
  });
39
- function ye({
38
+ function De({
40
39
  deduction: e,
41
40
  employeeId: A,
42
41
  selectedGarnishmentType: D,
43
42
  selectedGarnishmentTitle: y,
44
43
  onCancel: x
45
44
  }) {
46
- const { onEvent: d, baseSubmitHandler: E } = Y(), { t: n } = N("Employee.Deductions"), u = j(), { mutateAsync: P, isPending: T } = B(), { mutateAsync: R, isPending: v } = U(), M = T || v, O = I(() => ({
45
+ const { onEvent: d, baseSubmitHandler: E } = H(), { t: n } = N("Employee.Deductions"), u = j(), { mutateAsync: P, isPending: T } = B(), { mutateAsync: R, isPending: v } = U(), M = T || v, O = I(() => ({
47
46
  amount: e?.amount ? Number(e.amount) : 0,
48
47
  description: e?.description ?? "",
49
48
  times: e?.times ?? null,
@@ -88,7 +87,7 @@ function ye({
88
87
  /* @__PURE__ */ t(u.Heading, { as: "h3", children: y }),
89
88
  /* @__PURE__ */ o(m, { flexDirection: "column", gap: 20, children: [
90
89
  /* @__PURE__ */ o(m, { flexDirection: "column", gap: 20, children: [
91
- /* @__PURE__ */ t(z, { name: "description", label: n("descriptionLabelV2"), isRequired: !0 }),
90
+ /* @__PURE__ */ t(Y, { name: "description", label: n("descriptionLabelV2"), isRequired: !0 }),
92
91
  /* @__PURE__ */ t(
93
92
  h,
94
93
  {
@@ -152,7 +151,7 @@ function ye({
152
151
  )
153
152
  ] })
154
153
  ] }),
155
- /* @__PURE__ */ o(H, { children: [
154
+ /* @__PURE__ */ o(z, { children: [
156
155
  /* @__PURE__ */ t(u.Button, { variant: "secondary", onClick: F, children: n("cancelCta") }),
157
156
  /* @__PURE__ */ t(u.Button, { type: "submit", isLoading: M, children: n("saveCta") })
158
157
  ] })
@@ -160,6 +159,6 @@ function ye({
160
159
  }
161
160
  export {
162
161
  k as DeductionSchema,
163
- ye as default
162
+ De as default
164
163
  };
165
164
  //# sourceMappingURL=GarnishmentForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"GarnishmentForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/GarnishmentForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { useMemo } from 'react'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { GarnishmentType } from '@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { NumberInputField, TextInputField, RadioGroupField } from '@/components/Common'\nimport { type CommonComponentInterface, useBase } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\n\nconst NON_NEGATIVE_ERROR = 'Number must be greater than or equal to 0'\n\nexport const DeductionSchema = z.object({\n active: z.boolean(),\n amount: z.number().min(0, { error: NON_NEGATIVE_ERROR }).transform(String),\n description: z.string().min(1),\n courtOrdered: z.boolean(),\n times: z.number().nullable(),\n recurring: z.boolean(),\n annualMaximum: z\n .number()\n .min(0, { error: NON_NEGATIVE_ERROR })\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n totalAmount: z\n .number()\n .min(0, { error: NON_NEGATIVE_ERROR })\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n deductAsPercentage: z.boolean(),\n garnishmentType: z.enum(GarnishmentType),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ninterface GarnishmentFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n selectedGarnishmentType: GarnishmentType\n selectedGarnishmentTitle: string\n onCancel: () => void\n}\n\nfunction GarnishmentForm({\n deduction,\n employeeId,\n selectedGarnishmentType,\n selectedGarnishmentTitle,\n onCancel,\n}: GarnishmentFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n const isPending = isPendingCreate || isPendingUpdate\n\n const defaultValues: DeductionInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n description: deduction?.description ?? '',\n times: deduction?.times ?? null,\n recurring: deduction?.recurring ?? true,\n annualMaximum: deduction?.annualMaximum ? Number(deduction.annualMaximum) : null,\n totalAmount: deduction?.totalAmount ? Number(deduction.totalAmount) : null,\n deductAsPercentage: deduction?.deductAsPercentage ?? true,\n active: true,\n courtOrdered: true,\n garnishmentType: deduction?.garnishmentType ?? selectedGarnishmentType,\n }\n }, [deduction])\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n const { control } = formMethods\n const watchedRecurring = useWatch({ control, name: 'recurring' })\n const watchedAmountPercentage = useWatch({ control, name: 'deductAsPercentage' })\n\n const onSubmit: SubmitHandler<DeductionPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, times: payload.recurring ? null : 1 },\n },\n })\n\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...payload,\n version: deduction.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const handleCancel = () => {\n onCancel()\n }\n\n return (\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n <>\n <Components.Heading as=\"h3\">{selectedGarnishmentTitle}</Components.Heading>\n <Flex flexDirection=\"column\" gap={20}>\n <Flex flexDirection=\"column\" gap={20}>\n <TextInputField name=\"description\" label={t('descriptionLabelV2')} isRequired />\n <RadioGroupField\n name=\"recurring\"\n label={t('frequencyLabel')}\n isRequired\n options={[\n { value: true, label: t('frequencyRecurringOptionV2') },\n { value: false, label: t('frequencyOneTimeOptionV2') },\n ]}\n />\n <RadioGroupField\n name=\"deductAsPercentage\"\n label={t('deductionTypeLabelV2')}\n isRequired\n options={[\n { value: true, label: t('deductionTypePercentageOptionV2') },\n { value: false, label: t('deductionTypeFixedAmountOption') },\n ]}\n />\n <NumberInputField\n name=\"amount\"\n adornmentStart={!watchedAmountPercentage && '$'}\n adornmentEnd={watchedAmountPercentage && '%'}\n label={t('deductionAmountLabel')}\n isRequired\n min={0}\n format={watchedAmountPercentage ? 'percent' : 'currency'}\n description={\n watchedAmountPercentage\n ? t('deductionAmountDescriptionPercentage')\n : t('deductionAmountDescriptionFixed')\n }\n />\n </Flex>\n {watchedRecurring && (\n <Flex flexDirection=\"column\" gap={20}>\n <NumberInputField\n name=\"totalAmount\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('totalAmountLabel')}\n description={t('totalAmountDescription')}\n min={0}\n />\n <NumberInputField\n name=\"annualMaximum\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('annualMaxLabel')}\n min={0}\n description={t('annualMaxDescription')}\n />\n </Flex>\n )}\n </Flex>\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('saveCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n\nexport default GarnishmentForm\n"],"names":["NON_NEGATIVE_ERROR","DeductionSchema","z","val","GarnishmentType","GarnishmentForm","deduction","employeeId","selectedGarnishmentType","selectedGarnishmentTitle","onCancel","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultValues","useMemo","formMethods","useForm","zodResolver","control","watchedRecurring","useWatch","watchedAmountPercentage","onSubmit","data","payload","updateDeductionResponse","componentEvents","createDeductionResponse","handleCancel","FormProvider","jsx","Form","Flex","jsxs","Fragment","TextInputField","RadioGroupField","NumberInputField","ActionsLayout"],"mappings":";;;;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E,sBAAsB;AAAA,YAC/B,YAAU;AAAA,YACV,KAAK;AAAA,YACL,QAAQmB,IAA0B,YAAY;AAAA,YAC9C,aAEMnB,EADJmB,IACM,yCACA,iCADsC;AAAA,UACL;AAAA,QAAA;AAAA,MAE3C,GACF;AAAA,MACCF,KACC,gBAAAc,EAACD,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,QAAA,gBAAAF;AAAA,UAACO;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,gBAAe;AAAA,YACf,QAAO;AAAA,YACP,OAAOnC,EAAE,kBAAkB;AAAA,YAC3B,aAAaA,EAAE,wBAAwB;AAAA,YACvC,KAAK;AAAA,UAAA;AAAA,QAAA;AAAA,QAEP,gBAAA4B;AAAA,UAACO;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,gBAAe;AAAA,YACf,QAAO;AAAA,YACP,OAAOnC,EAAE,gBAAgB;AAAA,YACzB,KAAK;AAAA,YACL,aAAaA,EAAE,sBAAsB;AAAA,UAAA;AAAA,QAAA;AAAA,MACvC,EAAA,CACF;AAAA,IAAA,GAEJ;AAAA,sBACCoC,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAR,EAAC1B,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASwB,GAC7C,UAAA1B,EAAE,WAAW,EAAA,CAChB;AAAA,MACA,gBAAA4B,EAAC1B,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWQ,GACzC,UAAAV,EAAE,SAAS,EAAA,CACd;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
1
+ {"version":3,"file":"GarnishmentForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/GarnishmentForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { useMemo } from 'react'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { GarnishmentType } from '@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { NumberInputField, TextInputField, RadioGroupField } from '@/components/Common'\nimport { type CommonComponentInterface, useBase } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\n\nconst NON_NEGATIVE_ERROR = 'Number must be greater than or equal to 0'\n\nexport const DeductionSchema = z.object({\n active: z.boolean(),\n amount: z.number().min(0, { error: NON_NEGATIVE_ERROR }).transform(String),\n description: z.string().min(1),\n courtOrdered: z.boolean(),\n times: z.number().nullable(),\n recurring: z.boolean(),\n annualMaximum: z\n .number()\n .min(0, { error: NON_NEGATIVE_ERROR })\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n totalAmount: z\n .number()\n .min(0, { error: NON_NEGATIVE_ERROR })\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n deductAsPercentage: z.boolean(),\n garnishmentType: z.enum(GarnishmentType),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ninterface GarnishmentFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n selectedGarnishmentType: GarnishmentType\n selectedGarnishmentTitle: string\n onCancel: () => void\n}\n\nfunction GarnishmentForm({\n deduction,\n employeeId,\n selectedGarnishmentType,\n selectedGarnishmentTitle,\n onCancel,\n}: GarnishmentFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n const isPending = isPendingCreate || isPendingUpdate\n\n const defaultValues: DeductionInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n description: deduction?.description ?? '',\n times: deduction?.times ?? null,\n recurring: deduction?.recurring ?? true,\n annualMaximum: deduction?.annualMaximum ? Number(deduction.annualMaximum) : null,\n totalAmount: deduction?.totalAmount ? Number(deduction.totalAmount) : null,\n deductAsPercentage: deduction?.deductAsPercentage ?? true,\n active: true,\n courtOrdered: true,\n garnishmentType: deduction?.garnishmentType ?? selectedGarnishmentType,\n }\n }, [deduction])\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n const { control } = formMethods\n const watchedRecurring = useWatch({ control, name: 'recurring' })\n const watchedAmountPercentage = useWatch({ control, name: 'deductAsPercentage' })\n\n const onSubmit: SubmitHandler<DeductionPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, times: payload.recurring ? null : 1 },\n },\n })\n\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...payload,\n version: deduction.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const handleCancel = () => {\n onCancel()\n }\n\n return (\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n <>\n <Components.Heading as=\"h3\">{selectedGarnishmentTitle}</Components.Heading>\n <Flex flexDirection=\"column\" gap={20}>\n <Flex flexDirection=\"column\" gap={20}>\n <TextInputField name=\"description\" label={t('descriptionLabelV2')} isRequired />\n <RadioGroupField\n name=\"recurring\"\n label={t('frequencyLabel')}\n isRequired\n options={[\n { value: true, label: t('frequencyRecurringOptionV2') },\n { value: false, label: t('frequencyOneTimeOptionV2') },\n ]}\n />\n <RadioGroupField\n name=\"deductAsPercentage\"\n label={t('deductionTypeLabelV2')}\n isRequired\n options={[\n { value: true, label: t('deductionTypePercentageOptionV2') },\n { value: false, label: t('deductionTypeFixedAmountOption') },\n ]}\n />\n <NumberInputField\n name=\"amount\"\n adornmentStart={!watchedAmountPercentage && '$'}\n adornmentEnd={watchedAmountPercentage && '%'}\n label={t('deductionAmountLabel')}\n isRequired\n min={0}\n format={watchedAmountPercentage ? 'percent' : 'currency'}\n description={\n watchedAmountPercentage\n ? t('deductionAmountDescriptionPercentage')\n : t('deductionAmountDescriptionFixed')\n }\n />\n </Flex>\n {watchedRecurring && (\n <Flex flexDirection=\"column\" gap={20}>\n <NumberInputField\n name=\"totalAmount\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('totalAmountLabel')}\n description={t('totalAmountDescription')}\n min={0}\n />\n <NumberInputField\n name=\"annualMaximum\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('annualMaxLabel')}\n min={0}\n description={t('annualMaxDescription')}\n />\n </Flex>\n )}\n </Flex>\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('saveCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n\nexport default GarnishmentForm\n"],"names":["NON_NEGATIVE_ERROR","DeductionSchema","z","val","GarnishmentType","GarnishmentForm","deduction","employeeId","selectedGarnishmentType","selectedGarnishmentTitle","onCancel","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultValues","useMemo","formMethods","useForm","zodResolver","control","watchedRecurring","useWatch","watchedAmountPercentage","onSubmit","data","payload","updateDeductionResponse","componentEvents","createDeductionResponse","handleCancel","FormProvider","jsx","Form","Flex","jsxs","Fragment","TextInputField","RadioGroupField","NumberInputField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,MAAMA,IAAqB,6CAEdC,IAAkBC,EAAE,OAAO;AAAA,EACtC,QAAQA,EAAE,QAAA;AAAA,EACV,QAAQA,EAAE,OAAA,EAAS,IAAI,GAAG,EAAE,OAAOF,EAAA,CAAoB,EAAE,UAAU,MAAM;AAAA,EACzE,aAAaE,EAAE,SAAS,IAAI,CAAC;AAAA,EAC7B,cAAcA,EAAE,QAAA;AAAA,EAChB,OAAOA,EAAE,OAAA,EAAS,SAAA;AAAA,EAClB,WAAWA,EAAE,QAAA;AAAA,EACb,eAAeA,EACZ,SACA,IAAI,GAAG,EAAE,OAAOF,GAAoB,EACpC,UAAU,CAAAG,MAAQA,IAAM,IAAIA,EAAI,aAAa,IAAK,EAClD,SAAA;AAAA,EACH,aAAaD,EACV,SACA,IAAI,GAAG,EAAE,OAAOF,GAAoB,EACpC,UAAU,CAAAG,MAAQA,IAAM,IAAIA,EAAI,aAAa,IAAK,EAClD,SAAA;AAAA,EACH,oBAAoBD,EAAE,QAAA;AAAA,EACtB,iBAAiBA,EAAE,KAAKE,CAAe;AACzC,CAAC;AAaD,SAASC,GAAgB;AAAA,EACvB,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,0BAAAC;AAAA,EACA,UAAAC;AACF,GAAyB;AACvB,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,EAAA,GACjC,EAAE,GAAAC,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAA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A,EAAA,CACF;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
@@ -5,25 +5,24 @@ import { useGarnishmentsUpdateMutation as k } from "@gusto/embedded-api/react-qu
5
5
  import { BaseComponent as w } from "../../../Base/Base.js";
6
6
  import { useBase as U } from "../../../Base/useBase.js";
7
7
  import { Flex as E } from "../../../Common/Flex/Flex.js";
8
- import "classnames";
9
- import { componentEvents as c } from "../../../../shared/constants.js";
10
8
  import { ActionsLayout as Y } from "../../../Common/ActionsLayout/ActionsLayout.js";
11
- import { HamburgerMenu as B } from "../../../Common/HamburgerMenu/HamburgerMenu.js";
12
- import p from "../../../../hooks/useNumberFormatter.js";
13
- import S from "../../../../assets/icons/pencil.svg.js";
14
- import V from "../../../../assets/icons/trashcan.svg.js";
15
- import { useComponentDictionary as q, useI18n as F } from "../../../../i18n/I18n.js";
16
- import { useComponentContext as H } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
17
- import j from "../../../../assets/icons/plus-circle.svg.js";
9
+ import D from "../../../../hooks/useNumberFormatter.js";
10
+ import B from "../../../../assets/icons/pencil.svg.js";
11
+ import S from "../../../../assets/icons/trashcan.svg.js";
12
+ import { useComponentDictionary as V, useI18n as q } from "../../../../i18n/I18n.js";
13
+ import { componentEvents as c } from "../../../../shared/constants.js";
14
+ import { useComponentContext as F } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
15
+ import H from "../../../../assets/icons/plus-circle.svg.js";
16
+ import { HamburgerMenu as j } from "../../../Common/HamburgerMenu/HamburgerMenu.js";
18
17
  import { useDataView as G } from "../../../Common/DataView/useDataView.js";
19
18
  import { DataView as R } from "../../../Common/DataView/DataView.js";
20
- function de(i) {
19
+ function le(i) {
21
20
  return /* @__PURE__ */ n(w, { ...i, children: /* @__PURE__ */ n(z, { ...i, children: i.children }) });
22
21
  }
23
- function z({ className: i, children: m, employeeId: D, dictionary: f }) {
24
- const { onEvent: o, baseSubmitHandler: h } = U(), { t } = N("Employee.Deductions"), a = H(), g = p("currency"), C = p("percent");
25
- q("Employee.Deductions", f), F("Employee.Deductions");
26
- const { data: v } = I({ employeeId: D }), u = v.garnishmentList, T = u.filter((e) => e.active), { mutateAsync: y, isPending: L } = k(), P = async (e) => {
22
+ function z({ className: i, children: m, employeeId: p, dictionary: f }) {
23
+ const { onEvent: o, baseSubmitHandler: h } = U(), { t } = N("Employee.Deductions"), a = F(), g = D("currency"), C = D("percent");
24
+ V("Employee.Deductions", f), q("Employee.Deductions");
25
+ const { data: v } = I({ employeeId: p }), u = v.garnishmentList, T = u.filter((e) => e.active), { mutateAsync: y, isPending: L } = k(), P = async (e) => {
27
26
  await h(e, async (r) => {
28
27
  const { garnishment: l } = await y({
29
28
  request: {
@@ -66,7 +65,7 @@ function z({ className: i, children: m, employeeId: D, dictionary: f }) {
66
65
  }
67
66
  ],
68
67
  itemMenu: (e) => /* @__PURE__ */ n(
69
- B,
68
+ j,
70
69
  {
71
70
  isLoading: L,
72
71
  items: [
@@ -75,14 +74,14 @@ function z({ className: i, children: m, employeeId: D, dictionary: f }) {
75
74
  onClick: () => {
76
75
  b(e);
77
76
  },
78
- icon: /* @__PURE__ */ n(S, { "aria-hidden": !0 })
77
+ icon: /* @__PURE__ */ n(B, { "aria-hidden": !0 })
79
78
  },
80
79
  {
81
80
  label: t("deleteCta"),
82
81
  onClick: async () => {
83
82
  await P(e);
84
83
  },
85
- icon: /* @__PURE__ */ n(V, { "aria-hidden": !0 })
84
+ icon: /* @__PURE__ */ n(S, { "aria-hidden": !0 })
86
85
  }
87
86
  ]
88
87
  }
@@ -96,7 +95,7 @@ function z({ className: i, children: m, employeeId: D, dictionary: f }) {
96
95
  /* @__PURE__ */ n(R, { label: t("deductionsTableLabel"), ...x }),
97
96
  /* @__PURE__ */ s(Y, { children: [
98
97
  /* @__PURE__ */ s(a.Button, { variant: "secondary", onClick: O, children: [
99
- /* @__PURE__ */ n(j, {}),
98
+ /* @__PURE__ */ n(H, {}),
100
99
  t("addDeductionCta")
101
100
  ] }),
102
101
  /* @__PURE__ */ n(a.Button, { onClick: _, children: t("continueCta") })
@@ -104,6 +103,6 @@ function z({ className: i, children: m, employeeId: D, dictionary: f }) {
104
103
  ] }) }) });
105
104
  }
106
105
  export {
107
- de as DeductionsList
106
+ le as DeductionsList
108
107
  };
109
108
  //# sourceMappingURL=DeductionsList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DeductionsList.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsList/DeductionsList.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useGarnishmentsListSuspense } from '@gusto/embedded-api/react-query/garnishmentsList'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { useDataView, DataView } from '@/components/Common'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport useNumberFormatter from '@/hooks/useNumberFormatter'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport PlusCircleIcon from '@/assets/icons/plus-circle.svg?react'\n\ninterface DeductionsListProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n}\n\nexport function DeductionsList(props: DeductionsListProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ className, children, employeeId, dictionary }: DeductionsListProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n const formatCurrency = useNumberFormatter('currency')\n const formatPercent = useNumberFormatter('percent')\n\n useComponentDictionary('Employee.Deductions', dictionary)\n useI18n('Employee.Deductions')\n\n const { data } = useGarnishmentsListSuspense({ employeeId })\n const deductions = data.garnishmentList!\n const activeDeductions = deductions.filter(deduction => deduction.active)\n\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n\n const handleDelete = async (deduction: Garnishment) => {\n await baseSubmitHandler(deduction, async payload => {\n const { garnishment } = await updateDeduction({\n request: {\n garnishmentId: payload.uuid,\n requestBody: {\n ...payload,\n totalAmount: payload.totalAmount ?? undefined,\n active: false,\n version: payload.version as string,\n },\n },\n })\n\n // if soft deleted deduction was the last active, then return to empty view\n // else if any other active deductions return to list view\n const remainingActiveDeductions = deductions.filter(d => d.active)\n\n if (\n remainingActiveDeductions.length === 1 &&\n remainingActiveDeductions[0]?.uuid === garnishment?.uuid\n ) {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DELETED_EMPTY)\n } else {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DELETED, garnishment)\n }\n })\n }\n\n const handleEdit = (deduction: Garnishment) => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_EDIT, deduction)\n }\n\n const handleAdd = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_ADD)\n }\n\n const handleContinue = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DONE)\n }\n\n const { ...dataViewProps } = useDataView({\n data: activeDeductions,\n columns: [\n {\n key: 'description',\n title: t('nameColumn'),\n },\n {\n key: 'recurring',\n title: t('frequencyColumn'),\n render: deduction => {\n return deduction.recurring ? t('recurringText') : t('nonRecurringText')\n },\n },\n {\n key: 'amount',\n title: t('withheldColumn'),\n render: deduction => {\n const formattedAmount = deduction.deductAsPercentage\n ? formatPercent(Number(deduction.amount))\n : formatCurrency(Number(deduction.amount))\n return deduction.recurring\n ? t('recurringAmount', { value: formattedAmount })\n : formattedAmount\n },\n },\n ],\n itemMenu: deduction => {\n return (\n <HamburgerMenu\n isLoading={isPendingUpdate}\n items={[\n {\n label: t('editCta'),\n onClick: () => {\n handleEdit(deduction)\n },\n icon: <PencilSvg aria-hidden />,\n },\n {\n label: t('deleteCta'),\n onClick: async () => {\n await handleDelete(deduction)\n },\n icon: <TrashCanSvg aria-hidden />,\n },\n ]}\n />\n )\n },\n })\n\n return (\n <section className={className}>\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Flex flexDirection=\"column\" gap={2}>\n <Components.Heading as=\"h2\">{t('pageTitle')}</Components.Heading>\n <Components.Text variant=\"supporting\">\n {t('includeDeductionsDescriptionV2')}\n </Components.Text>\n </Flex>\n\n <DataView label={t('deductionsTableLabel')} {...dataViewProps} />\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleAdd}>\n <PlusCircleIcon />\n {t('addDeductionCta')}\n </Components.Button>\n <Components.Button onClick={handleContinue}>{t('continueCta')}</Components.Button>\n </ActionsLayout>\n </>\n )}\n </Flex>\n </section>\n )\n}\n"],"names":["DeductionsList","props","jsx","BaseComponent","Root","className","children","employeeId","dictionary","onEvent","baseSubmitHandler","useBase","useTranslation","Components","useComponentContext","formatCurrency","useNumberFormatter","formatPercent","useComponentDictionary","useI18n","data","useGarnishmentsListSuspense","deductions","activeDeductions","deduction","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","handleDelete","payload","garnishment","remainingActiveDeductions","d","componentEvents","handleEdit","handleAdd","handleContinue","dataViewProps","useDataView","formattedAmount","HamburgerMenu","PencilSvg","TrashCanSvg","Flex","jsxs","Fragment","DataView","ActionsLayout","PlusCircleIcon"],"mappings":";;;;;;;;;;;;;;;;;;;AA2BO,SAASA,GAAeC,GAAqD;AAClF,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC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,EAACyC,GAAA,EAAK,eAAc,UAAS,KAAK,IAC/B,UAAArC,KAGC,gBAAAsC,EAAAC,GAAA,EACE,UAAA;AAAA,IAAA,gBAAAD,EAACD,GAAA,EAAK,eAAc,UAAS,KAAK,GAChC,UAAA;AAAA,MAAA,gBAAAzC,EAACW,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAA,EAAE,WAAW,GAAE;AAAA,MAC5C,gBAAAX,EAACW,EAAW,MAAX,EAAgB,SAAQ,cACtB,UAAA,EAAE,gCAAgC,EAAA,CACrC;AAAA,IAAA,GACF;AAAA,sBAECiC,GAAA,EAAS,OAAO,EAAE,sBAAsB,GAAI,GAAGT,GAAe;AAAA,sBAC9DU,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAH,EAAC/B,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASsB,GAC9C,UAAA;AAAA,QAAA,gBAAAjC,EAAC8C,GAAA,EAAe;AAAA,QACf,EAAE,iBAAiB;AAAA,MAAA,GACtB;AAAA,MACA,gBAAA9C,EAACW,EAAW,QAAX,EAAkB,SAASuB,GAAiB,UAAA,EAAE,aAAa,EAAA,CAAE;AAAA,IAAA,EAAA,CAChE;AAAA,EAAA,EAAA,CACF,GAEJ,GACF;AAEJ;"}
1
+ {"version":3,"file":"DeductionsList.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsList/DeductionsList.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useGarnishmentsListSuspense } from '@gusto/embedded-api/react-query/garnishmentsList'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { useDataView, DataView } from '@/components/Common'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport useNumberFormatter from '@/hooks/useNumberFormatter'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport PlusCircleIcon from '@/assets/icons/plus-circle.svg?react'\n\ninterface DeductionsListProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n}\n\nexport function DeductionsList(props: DeductionsListProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ className, children, employeeId, dictionary }: DeductionsListProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n const formatCurrency = useNumberFormatter('currency')\n const formatPercent = useNumberFormatter('percent')\n\n useComponentDictionary('Employee.Deductions', dictionary)\n useI18n('Employee.Deductions')\n\n const { data } = useGarnishmentsListSuspense({ employeeId })\n const deductions = data.garnishmentList!\n const activeDeductions = deductions.filter(deduction => deduction.active)\n\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n\n const handleDelete = async (deduction: Garnishment) => {\n await baseSubmitHandler(deduction, async payload => {\n const { garnishment } = await updateDeduction({\n request: {\n garnishmentId: payload.uuid,\n requestBody: {\n ...payload,\n totalAmount: payload.totalAmount ?? undefined,\n active: false,\n version: payload.version as string,\n },\n },\n })\n\n // if soft deleted deduction was the last active, then return to empty view\n // else if any other active deductions return to list view\n const remainingActiveDeductions = deductions.filter(d => d.active)\n\n if (\n remainingActiveDeductions.length === 1 &&\n remainingActiveDeductions[0]?.uuid === garnishment?.uuid\n ) {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DELETED_EMPTY)\n } else {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DELETED, garnishment)\n }\n })\n }\n\n const handleEdit = (deduction: Garnishment) => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_EDIT, deduction)\n }\n\n const handleAdd = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_ADD)\n }\n\n const handleContinue = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DONE)\n }\n\n const { ...dataViewProps } = useDataView({\n data: activeDeductions,\n columns: [\n {\n key: 'description',\n title: t('nameColumn'),\n },\n {\n key: 'recurring',\n title: t('frequencyColumn'),\n render: deduction => {\n return deduction.recurring ? t('recurringText') : t('nonRecurringText')\n },\n },\n {\n key: 'amount',\n title: t('withheldColumn'),\n render: deduction => {\n const formattedAmount = deduction.deductAsPercentage\n ? formatPercent(Number(deduction.amount))\n : formatCurrency(Number(deduction.amount))\n return deduction.recurring\n ? t('recurringAmount', { value: formattedAmount })\n : formattedAmount\n },\n },\n ],\n itemMenu: deduction => {\n return (\n <HamburgerMenu\n isLoading={isPendingUpdate}\n items={[\n {\n label: t('editCta'),\n onClick: () => {\n handleEdit(deduction)\n },\n icon: <PencilSvg aria-hidden />,\n },\n {\n label: t('deleteCta'),\n onClick: async () => {\n await handleDelete(deduction)\n },\n icon: <TrashCanSvg aria-hidden />,\n },\n ]}\n />\n )\n },\n })\n\n return (\n <section className={className}>\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Flex flexDirection=\"column\" gap={2}>\n <Components.Heading as=\"h2\">{t('pageTitle')}</Components.Heading>\n <Components.Text variant=\"supporting\">\n {t('includeDeductionsDescriptionV2')}\n </Components.Text>\n </Flex>\n\n <DataView label={t('deductionsTableLabel')} {...dataViewProps} />\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleAdd}>\n <PlusCircleIcon />\n {t('addDeductionCta')}\n </Components.Button>\n <Components.Button onClick={handleContinue}>{t('continueCta')}</Components.Button>\n </ActionsLayout>\n </>\n )}\n </Flex>\n </section>\n )\n}\n"],"names":["DeductionsList","props","jsx","BaseComponent","Root","className","children","employeeId","dictionary","onEvent","baseSubmitHandler","useBase","useTranslation","Components","useComponentContext","formatCurrency","useNumberFormatter","formatPercent","useComponentDictionary","useI18n","data","useGarnishmentsListSuspense","deductions","activeDeductions","deduction","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","handleDelete","payload","garnishment","remainingActiveDeductions","d","componentEvents","handleEdit","handleAdd","handleContinue","dataViewProps","useDataView","formattedAmount","HamburgerMenu","PencilSvg","TrashCanSvg","Flex","jsxs","Fragment","DataView","ActionsLayout","PlusCircleIcon"],"mappings":";;;;;;;;;;;;;;;;;;AA2BO,SAASA,GAAeC,GAAqD;AAClF,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,SAASG,EAAK,EAAE,WAAAC,GAAW,UAAAC,GAAU,YAAAC,GAAY,YAAAC,KAAmC;AAClF,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,EAAA,GACjC,EAAE,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA,GACbC,IAAiBC,EAAmB,UAAU,GAC9CC,IAAgBD,EAAmB,SAAS;AAElD,EAAAE,EAAuB,uBAAuBV,CAAU,GACxDW,EAAQ,qBAAqB;AAE7B,QAAM,EAAE,MAAAC,EAAA,IAASC,EAA4B,EAAE,YAAAd,GAAY,GACrDe,IAAaF,EAAK,iBAClBG,IAAmBD,EAAW,OAAO,CAAAE,MAAaA,EAAU,MAAM,GAElE,EAAE,aAAaC,GAAiB,WAAWC,EAAA,IAC/CC,EAAA,GAEIC,IAAe,OAAOJ,MAA2B;AACrD,UAAMd,EAAkBc,GAAW,OAAMK,MAAW;AAClD,YAAM,EAAE,aAAAC,MAAgB,MAAML,EAAgB;AAAA,QAC5C,SAAS;AAAA,UACP,eAAeI,EAAQ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,UAAA,EAAE,aAAa,EAAA,CAAE;AAAA,IAAA,EAAA,CAChE;AAAA,EAAA,EAAA,CACF,GAEJ,GACF;AAEJ;"}
@@ -6,18 +6,17 @@ import { useBase as h } from "../../../Base/useBase.js";
6
6
  import { Grid as C } from "../../../Common/Grid/Grid.js";
7
7
  import { Flex as m } from "../../../Common/Flex/Flex.js";
8
8
  import { ActionsLayout as f } from "../../../Common/ActionsLayout/ActionsLayout.js";
9
- import { useComponentContext as D } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
10
- import "react";
11
- import { useComponentDictionary as E, useI18n as y } from "../../../../i18n/I18n.js";
9
+ import { useComponentDictionary as D, useI18n as E } from "../../../../i18n/I18n.js";
12
10
  import { componentEvents as s } from "../../../../shared/constants.js";
11
+ import { useComponentContext as y } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
13
12
  import g from "../../../../assets/icons/coins-hand.svg.js";
14
13
  import x from "../../../../assets/icons/plus-circle.svg.js";
15
- function k(t) {
14
+ function Y(t) {
16
15
  return /* @__PURE__ */ n(p, { ...t, children: /* @__PURE__ */ n(I, { ...t, children: t.children }) });
17
16
  }
18
17
  function I({ className: t, dictionary: d }) {
19
- const { onEvent: c } = h(), { t: e } = u("Employee.Deductions"), o = D();
20
- E("Employee.Deductions", d), y("Employee.Deductions");
18
+ const { onEvent: c } = h(), { t: e } = u("Employee.Deductions"), o = y();
19
+ D("Employee.Deductions", d), E("Employee.Deductions");
21
20
  const l = () => {
22
21
  c(s.EMPLOYEE_DEDUCTION_INCLUDE_YES);
23
22
  }, a = () => {
@@ -49,6 +48,6 @@ function I({ className: t, dictionary: d }) {
49
48
  ] }) });
50
49
  }
51
50
  export {
52
- k as IncludeDeductions
51
+ Y as IncludeDeductions
53
52
  };
54
53
  //# sourceMappingURL=IncludeDeductions.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IncludeDeductions.js","sources":["../../../../../src/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport styles from './IncludeDeductions.module.scss'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { Grid } from '@/components/Common/Grid/Grid'\nimport { ActionsLayout, Flex } from '@/components/Common'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport CoinsHandsIcon from '@/assets/icons/coins-hand.svg?react'\nimport PlusCircleIcon from '@/assets/icons/plus-circle.svg?react'\n\ninterface IncludeDeductionsProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n}\n\nexport function IncludeDeductions(props: IncludeDeductionsProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ className, dictionary }: IncludeDeductionsProps) {\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 handleAdd = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_INCLUDE_YES)\n }\n\n const handleContinue = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_INCLUDE_NO)\n }\n\n return (\n <section className={className}>\n <Grid gridTemplateColumns=\"1fr\">\n <Flex flexDirection=\"column\" gap={2}>\n <Components.Heading as=\"h2\">{t('pageTitle')}</Components.Heading>\n <Components.Text variant=\"supporting\">\n {t('includeDeductionsDescriptionV2')}\n </Components.Text>\n </Flex>\n\n {/* TODO: Replace with proper empty state component for DataViews */}\n <section className={styles.emptyStateContainer}>\n <Flex flexDirection=\"column\" gap={16} justifyContent=\"center\" alignItems=\"center\">\n <section className={styles.coinHandsIconContainer}>\n <CoinsHandsIcon width={24} height={24} />\n </section>\n <Components.Text weight=\"bold\">{t('includeDeductionsEmptyState')}</Components.Text>\n <Components.Button\n type=\"button\"\n variant=\"secondary\"\n onClick={handleAdd}\n className={styles.addDeductionButton}\n >\n <PlusCircleIcon />\n {t('addDeductionButtonCta')}\n </Components.Button>\n </Flex>\n </section>\n <ActionsLayout>\n <Components.Button type=\"button\" onClick={handleContinue}>\n {t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </Grid>\n </section>\n )\n}\n"],"names":["IncludeDeductions","props","jsx","BaseComponent","Root","className","dictionary","onEvent","useBase","t","useTranslation","Components","useComponentContext","useComponentDictionary","useI18n","handleAdd","componentEvents","handleContinue","jsxs","Grid","Flex","styles","CoinsHandsIcon","PlusCircleIcon","ActionsLayout"],"mappings":";;;;;;;;;;;;;;AAqBO,SAASA,EAAkBC,GAAwD;AACxF,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,YAAAC,KAAsC;AAC/D,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,IAAY,MAAM;AACtB,IAAAR,EAAQS,EAAgB,8BAA8B;AAAA,EACxD,GAEMC,IAAiB,MAAM;AAC3B,IAAAV,EAAQS,EAAgB,6BAA6B;AAAA,EACvD;AAEA,2BACG,WAAA,EAAQ,WAAAX,GACP,UAAA,gBAAAa,EAACC,GAAA,EAAK,qBAAoB,OACxB,UAAA;AAAA,IAAA,gBAAAD,EAACE,GAAA,EAAK,eAAc,UAAS,KAAK,GAChC,UAAA;AAAA,MAAA,gBAAAlB,EAACS,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAAF,EAAE,WAAW,GAAE;AAAA,MAC5C,gBAAAP,EAACS,EAAW,MAAX,EAAgB,SAAQ,cACtB,UAAAF,EAAE,gCAAgC,EAAA,CACrC;AAAA,IAAA,GACF;AAAA,IAGA,gBAAAP,EAAC,WAAA,EAAQ,WAAWmB,EAAO,qBACzB,UAAA,gBAAAH,EAACE,GAAA,EAAK,eAAc,UAAS,KAAK,IAAI,gBAAe,UAAS,YAAW,UACvE,UAAA;AAAA,MAAA,gBAAAlB,EAAC,WAAA,EAAQ,WAAWmB,EAAO,wBACzB,UAAA,gBAAAnB,EAACoB,KAAe,OAAO,IAAI,QAAQ,GAAA,CAAI,EAAA,CACzC;AAAA,MACA,gBAAApB,EAACS,EAAW,MAAX,EAAgB,QAAO,QAAQ,UAAAF,EAAE,6BAA6B,GAAE;AAAA,MACjE,gBAAAS;AAAA,QAACP,EAAW;AAAA,QAAX;AAAA,UACC,MAAK;AAAA,UACL,SAAQ;AAAA,UACR,SAASI;AAAA,UACT,WAAWM,EAAO;AAAA,UAElB,UAAA;AAAA,YAAA,gBAAAnB,EAACqB,GAAA,EAAe;AAAA,YACfd,EAAE,uBAAuB;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAC5B,EAAA,CACF,EAAA,CACF;AAAA,IACA,gBAAAP,EAACsB,GAAA,EACC,UAAA,gBAAAtB,EAACS,EAAW,QAAX,EAAkB,MAAK,UAAS,SAASM,GACvC,UAAAR,EAAE,aAAa,GAClB,EAAA,CACF;AAAA,EAAA,EAAA,CACF,EAAA,CACF;AAEJ;"}
1
+ {"version":3,"file":"IncludeDeductions.js","sources":["../../../../../src/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport styles from './IncludeDeductions.module.scss'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { Grid } from '@/components/Common/Grid/Grid'\nimport { ActionsLayout, Flex } from '@/components/Common'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport CoinsHandsIcon from '@/assets/icons/coins-hand.svg?react'\nimport PlusCircleIcon from '@/assets/icons/plus-circle.svg?react'\n\ninterface IncludeDeductionsProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n}\n\nexport function IncludeDeductions(props: IncludeDeductionsProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ className, dictionary }: IncludeDeductionsProps) {\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 handleAdd = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_INCLUDE_YES)\n }\n\n const handleContinue = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_INCLUDE_NO)\n }\n\n return (\n <section className={className}>\n <Grid gridTemplateColumns=\"1fr\">\n <Flex flexDirection=\"column\" gap={2}>\n <Components.Heading as=\"h2\">{t('pageTitle')}</Components.Heading>\n <Components.Text variant=\"supporting\">\n {t('includeDeductionsDescriptionV2')}\n </Components.Text>\n </Flex>\n\n {/* TODO: Replace with proper empty state component for DataViews */}\n <section className={styles.emptyStateContainer}>\n <Flex flexDirection=\"column\" gap={16} justifyContent=\"center\" alignItems=\"center\">\n <section className={styles.coinHandsIconContainer}>\n <CoinsHandsIcon width={24} height={24} />\n </section>\n <Components.Text weight=\"bold\">{t('includeDeductionsEmptyState')}</Components.Text>\n <Components.Button\n type=\"button\"\n variant=\"secondary\"\n onClick={handleAdd}\n className={styles.addDeductionButton}\n >\n <PlusCircleIcon />\n {t('addDeductionButtonCta')}\n </Components.Button>\n </Flex>\n </section>\n <ActionsLayout>\n <Components.Button type=\"button\" onClick={handleContinue}>\n {t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </Grid>\n </section>\n )\n}\n"],"names":["IncludeDeductions","props","jsx","BaseComponent","Root","className","dictionary","onEvent","useBase","t","useTranslation","Components","useComponentContext","useComponentDictionary","useI18n","handleAdd","componentEvents","handleContinue","jsxs","Grid","Flex","styles","CoinsHandsIcon","PlusCircleIcon","ActionsLayout"],"mappings":";;;;;;;;;;;;;AAqBO,SAASA,EAAkBC,GAAwD;AACxF,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,YAAAC,KAAsC;AAC/D,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,IAAY,MAAM;AACtB,IAAAR,EAAQS,EAAgB,8BAA8B;AAAA,EACxD,GAEMC,IAAiB,MAAM;AAC3B,IAAAV,EAAQS,EAAgB,6BAA6B;AAAA,EACvD;AAEA,2BACG,WAAA,EAAQ,WAAAX,GACP,UAAA,gBAAAa,EAACC,GAAA,EAAK,qBAAoB,OACxB,UAAA;AAAA,IAAA,gBAAAD,EAACE,GAAA,EAAK,eAAc,UAAS,KAAK,GAChC,UAAA;AAAA,MAAA,gBAAAlB,EAACS,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAAF,EAAE,WAAW,GAAE;AAAA,MAC5C,gBAAAP,EAACS,EAAW,MAAX,EAAgB,SAAQ,cACtB,UAAAF,EAAE,gCAAgC,EAAA,CACrC;AAAA,IAAA,GACF;AAAA,IAGA,gBAAAP,EAAC,WAAA,EAAQ,WAAWmB,EAAO,qBACzB,UAAA,gBAAAH,EAACE,GAAA,EAAK,eAAc,UAAS,KAAK,IAAI,gBAAe,UAAS,YAAW,UACvE,UAAA;AAAA,MAAA,gBAAAlB,EAAC,WAAA,EAAQ,WAAWmB,EAAO,wBACzB,UAAA,gBAAAnB,EAACoB,KAAe,OAAO,IAAI,QAAQ,GAAA,CAAI,EAAA,CACzC;AAAA,MACA,gBAAApB,EAACS,EAAW,MAAX,EAAgB,QAAO,QAAQ,UAAAF,EAAE,6BAA6B,GAAE;AAAA,MACjE,gBAAAS;AAAA,QAACP,EAAW;AAAA,QAAX;AAAA,UACC,MAAK;AAAA,UACL,SAAQ;AAAA,UACR,SAASI;AAAA,UACT,WAAWM,EAAO;AAAA,UAElB,UAAA;AAAA,YAAA,gBAAAnB,EAACqB,GAAA,EAAe;AAAA,YACfd,EAAE,uBAAuB;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAC5B,EAAA,CACF,EAAA,CACF;AAAA,IACA,gBAAAP,EAACsB,GAAA,EACC,UAAA,gBAAAtB,EAACS,EAAW,QAAX,EAAkB,MAAK,UAAS,SAASM,GACvC,UAAAR,EAAE,aAAa,GAClB,EAAA,CACF;AAAA,EAAA,EAAA,CACF,EAAA,CACF;AAEJ;"}
@@ -1,16 +1,13 @@
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";
4
- import "../../../../shared/constants.js";
5
- import "classnames";
6
- import { ActionsLayout as s } from "../../../Common/ActionsLayout/ActionsLayout.js";
3
+ import { useDocumentList as s } from "./useDocumentList.js";
4
+ import { ActionsLayout as m } from "../../../Common/ActionsLayout/ActionsLayout.js";
7
5
  import { useComponentContext as c } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
8
- import "react";
9
- function g() {
10
- const { t } = r("Employee.DocumentSigner"), { handleContinue: n, hasSignedAllForms: i } = m(), e = c();
11
- return /* @__PURE__ */ o(s, { children: /* @__PURE__ */ o(e.Button, { onClick: n, isLoading: !1, isDisabled: !i, children: t("continueCta") }) });
6
+ function d() {
7
+ const { t: n } = r("Employee.DocumentSigner"), { handleContinue: t, hasSignedAllForms: e } = s(), i = c();
8
+ return /* @__PURE__ */ o(m, { children: /* @__PURE__ */ o(i.Button, { onClick: t, isLoading: !1, isDisabled: !e, children: n("continueCta") }) });
12
9
  }
13
10
  export {
14
- g as Actions
11
+ d as Actions
15
12
  };
16
13
  //# 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;"}
@@ -1,4 +1,4 @@
1
- import { jsx as o, jsxs as d } from "react/jsx-runtime";
1
+ import { jsx as o, jsxs as p } from "react/jsx-runtime";
2
2
  import { useEmployeeFormsListSuspense as E } from "@gusto/embedded-api/react-query/employeeFormsList";
3
3
  import { Head as a } from "./Head.js";
4
4
  import { List as F } from "./List.js";
@@ -9,32 +9,28 @@ import { useBase as g } from "../../../Base/useBase.js";
9
9
  import { useI18n as O } from "../../../../i18n/I18n.js";
10
10
  import { componentEvents as m } from "../../../../shared/constants.js";
11
11
  import { Flex as _ } from "../../../Common/Flex/Flex.js";
12
- import "classnames";
13
- import "react-i18next";
14
- import "../../../../contexts/ComponentAdapter/useComponentContext.js";
15
- import "react";
16
- function V(e) {
12
+ function N(e) {
17
13
  return /* @__PURE__ */ o(S, { ...e, children: /* @__PURE__ */ o(v, { ...e }) });
18
14
  }
19
15
  function v({ employeeId: e, className: s, children: t }) {
20
16
  O("Employee.DocumentSigner");
21
- const { onEvent: i } = g(), { data: u, error: c } = E({ employeeId: e }), n = u.formList, p = n.every((r) => !r.requiresSigning);
17
+ const { onEvent: i } = g(), { data: u, error: c } = E({ employeeId: e }), r = u.formList, l = r.every((n) => !n.requiresSigning);
22
18
  return /* @__PURE__ */ o("section", { className: s, children: /* @__PURE__ */ o(
23
19
  L,
24
20
  {
25
21
  value: {
26
- employeeForms: n,
27
- hasSignedAllForms: p,
22
+ employeeForms: r,
23
+ hasSignedAllForms: l,
28
24
  handleContinue: () => {
29
25
  i(m.EMPLOYEE_FORMS_DONE);
30
26
  },
31
- handleRequestFormToSign: (r) => {
32
- const l = n.find((f) => f.uuid === r.uuid);
33
- i(m.EMPLOYEE_VIEW_FORM_TO_SIGN, { uuid: r.uuid, name: l?.name });
27
+ handleRequestFormToSign: (n) => {
28
+ const f = r.find((d) => d.uuid === n.uuid);
29
+ i(m.EMPLOYEE_VIEW_FORM_TO_SIGN, { uuid: n.uuid, name: f?.name });
34
30
  },
35
31
  documentListError: c
36
32
  },
37
- children: t || /* @__PURE__ */ d(_, { flexDirection: "column", children: [
33
+ children: t || /* @__PURE__ */ p(_, { flexDirection: "column", children: [
38
34
  /* @__PURE__ */ o(a, {}),
39
35
  /* @__PURE__ */ o(F, {}),
40
36
  /* @__PURE__ */ o(h, {})
@@ -43,6 +39,6 @@ function v({ employeeId: e, className: s, children: t }) {
43
39
  ) });
44
40
  }
45
41
  export {
46
- V as DocumentList
42
+ N as DocumentList
47
43
  };
48
44
  //# 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 const fullForm = employeeForms.find(f => f.uuid === data.uuid)\n onEvent(componentEvents.EMPLOYEE_VIEW_FORM_TO_SIGN, { uuid: data.uuid, name: fullForm?.name })\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","fullForm","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;AAW3F,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,yBAhBwB,CAACP,MAAe;AAC9C,gBAAMQ,IAAWL,EAAc,KAAK,OAAK,EAAE,SAASH,EAAK,IAAI;AAC7D,UAAAF,EAAQS,EAAgB,4BAA4B,EAAE,MAAMP,EAAK,MAAM,MAAMQ,GAAU,MAAM;AAAA,QAC/F;AAAA,QAcQ,mBAAAP;AAAA,MAAA;AAAA,MAGD,UAAAL,KAGC,gBAAAa,EAACC,GAAA,EAAK,eAAc,UAClB,UAAA;AAAA,QAAA,gBAAAnB,EAACoB,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 const fullForm = employeeForms.find(f => f.uuid === data.uuid)\n onEvent(componentEvents.EMPLOYEE_VIEW_FORM_TO_SIGN, { uuid: data.uuid, name: fullForm?.name })\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","fullForm","f","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;AAW3F,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,yBAhBwB,CAACP,MAAe;AAC9C,gBAAMQ,IAAWL,EAAc,KAAK,OAAKM,EAAE,SAAST,EAAK,IAAI;AAC7D,UAAAF,EAAQS,EAAgB,4BAA4B,EAAE,MAAMP,EAAK,MAAM,MAAMQ,GAAU,MAAM;AAAA,QAC/F;AAAA,QAcQ,mBAAAP;AAAA,MAAA;AAAA,MAGD,UAAAL,KAGC,gBAAAc,EAACC,GAAA,EAAK,eAAc,UAClB,UAAA;AAAA,QAAA,gBAAApB,EAACqB,GAAA,EAAK;AAAA,0BACLC,GAAA,EAAK;AAAA,0BACLC,GAAA,CAAA,CAAQ;AAAA,MAAA,EAAA,CACX;AAAA,IAAA;AAAA,EAAA,GAGN;AAEJ;"}