@gusto/embedded-react-sdk 0.14.1 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (258) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/dist/assets/icons/feature-icon-check.svg.js +10 -0
  3. package/dist/assets/icons/feature-icon-check.svg.js.map +1 -0
  4. package/dist/components/Base/Base.js +4 -4
  5. package/dist/components/Common/DataView/DataView.d.ts +2 -1
  6. package/dist/components/Common/DataView/DataView.js +19 -18
  7. package/dist/components/Common/DataView/DataView.js.map +1 -1
  8. package/dist/components/Common/PaginationControl/PaginationControl.js +36 -36
  9. package/dist/components/Common/PaginationControl/PaginationControl.js.map +1 -1
  10. package/dist/components/Common/PaginationControl/PaginationControlTypes.d.ts +3 -1
  11. package/dist/components/Common/SignatureForm/SignatureForm.js +14 -11
  12. package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
  13. package/dist/components/Common/SignatureForm/SignatureFormActions.js +9 -7
  14. package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
  15. package/dist/components/Common/SignatureForm/SignatureFormFields.js +15 -12
  16. package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
  17. package/dist/components/Company/AssignSignatory/AssignSignatory.js +8 -6
  18. package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
  19. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +5 -2
  20. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
  21. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +4 -2
  22. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
  23. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +9 -7
  24. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js.map +1 -1
  25. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +16 -15
  26. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js.map +1 -1
  27. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +5 -4
  28. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  29. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +4 -2
  30. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
  31. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +12 -10
  32. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js.map +1 -1
  33. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +10 -9
  34. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js.map +1 -1
  35. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +5 -4
  36. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  37. package/dist/components/Company/AssignSignatory/TitleSelect.js +5 -3
  38. package/dist/components/Company/AssignSignatory/TitleSelect.js.map +1 -1
  39. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +7 -6
  40. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  41. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +10 -9
  42. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
  43. package/dist/components/Company/BankAccount/BankAccountForm/Form.js +11 -8
  44. package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
  45. package/dist/components/Company/BankAccount/BankAccountForm/context.js +5 -4
  46. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  47. package/dist/components/Company/BankAccount/BankAccountList/Actions.js +10 -8
  48. package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
  49. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +10 -8
  50. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
  51. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +7 -4
  52. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
  53. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +4 -2
  54. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
  55. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +11 -9
  56. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  57. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +5 -4
  58. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  59. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +10 -8
  60. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  61. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +5 -4
  62. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  63. package/dist/components/Company/FederalTaxes/Actions.js +9 -7
  64. package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
  65. package/dist/components/Company/FederalTaxes/FederalTaxes.js +5 -3
  66. package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
  67. package/dist/components/Company/FederalTaxes/Form.js +7 -6
  68. package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
  69. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +10 -9
  70. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  71. package/dist/components/Company/Industry/Actions.js +9 -7
  72. package/dist/components/Company/Industry/Actions.js.map +1 -1
  73. package/dist/components/Company/Industry/Context.js +8 -7
  74. package/dist/components/Company/Industry/Context.js.map +1 -1
  75. package/dist/components/Company/Industry/Edit.js +7 -4
  76. package/dist/components/Company/Industry/Edit.js.map +1 -1
  77. package/dist/components/Company/Locations/LocationForm/Actions.js +10 -8
  78. package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
  79. package/dist/components/Company/Locations/LocationForm/Form.js +7 -5
  80. package/dist/components/Company/Locations/LocationForm/Form.js.map +1 -1
  81. package/dist/components/Company/Locations/LocationForm/LocationForm.js +12 -10
  82. package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
  83. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +5 -4
  84. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  85. package/dist/components/Company/Locations/LocationsList/Actions.js +8 -6
  86. package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
  87. package/dist/components/Company/Locations/LocationsList/List.js +25 -22
  88. package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
  89. package/dist/components/Company/Locations/LocationsList/LocationsList.js +11 -9
  90. package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
  91. package/dist/components/Company/Locations/LocationsList/useLocationsList.d.ts +3 -1
  92. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +5 -4
  93. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  94. package/dist/components/Company/OnboardingOverview/Completed.js +12 -10
  95. package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
  96. package/dist/components/Company/OnboardingOverview/MissingRequirements.js +11 -9
  97. package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
  98. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +9 -7
  99. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
  100. package/dist/components/Company/OnboardingOverview/context.js +5 -4
  101. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  102. package/dist/components/Company/PaySchedule/PaySchedule.js +5 -4
  103. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  104. package/dist/components/Company/PaySchedule/_parts/Actions.js +11 -9
  105. package/dist/components/Company/PaySchedule/_parts/Actions.js.map +1 -1
  106. package/dist/components/Company/PaySchedule/_parts/Edit.js +14 -14
  107. package/dist/components/Company/PaySchedule/_parts/Head.js +11 -9
  108. package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
  109. package/dist/components/Company/PaySchedule/_parts/List.js +18 -17
  110. package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
  111. package/dist/components/Company/PaySchedule/usePaySchedule.js +7 -6
  112. package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
  113. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +4 -2
  114. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
  115. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +5 -4
  116. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  117. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +4 -2
  118. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
  119. package/dist/components/Company/StateTaxes/StateTaxesList/List.js +4 -2
  120. package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
  121. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +5 -4
  122. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  123. package/dist/components/Contractor/Address/Address.js +7 -5
  124. package/dist/components/Contractor/Address/Address.js.map +1 -1
  125. package/dist/components/Contractor/Address/Form.js +9 -7
  126. package/dist/components/Contractor/Address/Form.js.map +1 -1
  127. package/dist/components/Contractor/Address/useAddress.js +7 -6
  128. package/dist/components/Contractor/Address/useAddress.js.map +1 -1
  129. package/dist/components/Contractor/ContractorList/index.js +59 -57
  130. package/dist/components/Contractor/ContractorList/index.js.map +1 -1
  131. package/dist/components/Contractor/ContractorList/useContractorList.d.ts +3 -1
  132. package/dist/components/Contractor/ContractorList/useContractorList.js +7 -6
  133. package/dist/components/Contractor/ContractorList/useContractorList.js.map +1 -1
  134. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +13 -10
  135. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -1
  136. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +4 -2
  137. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js.map +1 -1
  138. package/dist/components/Contractor/Profile/ContractorProfileForm.js +13 -13
  139. package/dist/components/Contractor/Profile/useContractorProfile.js +4 -3
  140. package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
  141. package/dist/components/Contractor/Submit/Submit.js +21 -20
  142. package/dist/components/Contractor/Submit/Submit.js.map +1 -1
  143. package/dist/components/Employee/Compensation/Actions.js +13 -12
  144. package/dist/components/Employee/Compensation/Actions.js.map +1 -1
  145. package/dist/components/Employee/Compensation/Edit.js +14 -14
  146. package/dist/components/Employee/Compensation/List.js +23 -22
  147. package/dist/components/Employee/Compensation/List.js.map +1 -1
  148. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +11 -10
  149. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
  150. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +33 -32
  151. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
  152. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js +8 -8
  153. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +11 -11
  154. package/dist/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.js +23 -22
  155. package/dist/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.js.map +1 -1
  156. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +8 -6
  157. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
  158. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +5 -3
  159. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  160. package/dist/components/Employee/DocumentSigner/DocumentList/List.js +5 -2
  161. package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
  162. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +5 -4
  163. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  164. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +5 -3
  165. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  166. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +5 -4
  167. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  168. package/dist/components/Employee/EmployeeList/Actions.js +8 -6
  169. package/dist/components/Employee/EmployeeList/Actions.js.map +1 -1
  170. package/dist/components/Employee/EmployeeList/EmployeeList.js +17 -13
  171. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  172. package/dist/components/Employee/EmployeeList/Head.js +7 -5
  173. package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
  174. package/dist/components/Employee/EmployeeList/List.js +45 -43
  175. package/dist/components/Employee/EmployeeList/List.js.map +1 -1
  176. package/dist/components/Employee/EmployeeList/useEmployeeList.d.ts +3 -1
  177. package/dist/components/Employee/EmployeeList/useEmployeeList.js +5 -4
  178. package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
  179. package/dist/components/Employee/FederalTaxes/Actions.js +9 -7
  180. package/dist/components/Employee/FederalTaxes/Actions.js.map +1 -1
  181. package/dist/components/Employee/FederalTaxes/FederalForm.js +13 -11
  182. package/dist/components/Employee/FederalTaxes/FederalForm.js.map +1 -1
  183. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +5 -4
  184. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
  185. package/dist/components/Employee/Landing/Landing.js +11 -10
  186. package/dist/components/Employee/Landing/Landing.js.map +1 -1
  187. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +7 -7
  188. package/dist/components/Employee/PaymentMethod/Actions.js +8 -6
  189. package/dist/components/Employee/PaymentMethod/Actions.js.map +1 -1
  190. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +5 -3
  191. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js.map +1 -1
  192. package/dist/components/Employee/PaymentMethod/BankAccountsList.js +12 -11
  193. package/dist/components/Employee/PaymentMethod/BankAccountsList.js.map +1 -1
  194. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +4 -2
  195. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +1 -1
  196. package/dist/components/Employee/PaymentMethod/Split.js +7 -7
  197. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +7 -6
  198. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
  199. package/dist/components/Employee/Profile/Actions.js +9 -7
  200. package/dist/components/Employee/Profile/Actions.js.map +1 -1
  201. package/dist/components/Employee/Profile/AdminPersonalDetails.js +7 -6
  202. package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
  203. package/dist/components/Employee/Profile/HomeAddress.js +6 -5
  204. package/dist/components/Employee/Profile/HomeAddress.js.map +1 -1
  205. package/dist/components/Employee/Profile/PersonalDetailsInputs.js +25 -23
  206. package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
  207. package/dist/components/Employee/Profile/useProfile.js +5 -4
  208. package/dist/components/Employee/Profile/useProfile.js.map +1 -1
  209. package/dist/components/Employee/StateTaxes/Actions.js +10 -8
  210. package/dist/components/Employee/StateTaxes/Actions.js.map +1 -1
  211. package/dist/components/Employee/StateTaxes/useStateTaxes.js +5 -4
  212. package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
  213. package/dist/components/Employee/Taxes/Actions.js +10 -8
  214. package/dist/components/Employee/Taxes/Actions.js.map +1 -1
  215. package/dist/components/Employee/Taxes/FederalForm.js +14 -12
  216. package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
  217. package/dist/components/Employee/Taxes/useTaxes.js +5 -4
  218. package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
  219. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js +15 -13
  220. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js.map +1 -1
  221. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +15 -13
  222. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js.map +1 -1
  223. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +118 -88
  224. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
  225. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +3 -1
  226. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +72 -76
  227. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
  228. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +21 -20
  229. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
  230. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +27 -27
  231. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +9 -8
  232. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
  233. package/dist/components/Payroll/PayrollHistory/PayrollHistory.js +21 -20
  234. package/dist/components/Payroll/PayrollHistory/PayrollHistory.js.map +1 -1
  235. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +23 -22
  236. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
  237. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +84 -78
  238. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
  239. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +75 -74
  240. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
  241. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +3 -2
  242. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
  243. package/dist/components/Payroll/helpers.d.ts +2 -0
  244. package/dist/components/Payroll/helpers.js +38 -37
  245. package/dist/components/Payroll/helpers.js.map +1 -1
  246. package/dist/components/Payroll/usePreparedPayrollData.d.ts +4 -1
  247. package/dist/components/Payroll/usePreparedPayrollData.js +26 -19
  248. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  249. package/dist/components/index.d.ts +1 -1
  250. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +4 -2
  251. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
  252. package/dist/i18n/en/Payroll.PayrollHistory.json.js +9 -9
  253. package/dist/index.js +1 -1
  254. package/dist/style.css +1 -1
  255. package/dist/types/i18next.d.ts +1 -1
  256. package/package.json +7 -7
  257. package/dist/components/Payroll/RunPayrollFlow/RunPayroll.d.ts +0 -23
  258. package/dist/components/Payroll/RunPayrollFlow/RunPayrollFlow.d.ts +0 -6
@@ -1 +1 @@
1
- {"version":3,"file":"ChildSupportForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/ChildSupportForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { useEffect, useMemo } from 'react'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { PaymentPeriod } from '@gusto/embedded-api/models/components/garnishmentchildsupport'\nimport type { GarnishmentType } from '@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { type Agencies } from '@gusto/embedded-api/models/components/childsupportdata'\nimport styles from './ChildSupportForm.module.scss'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { NumberInputField, TextInputField, SelectField } from '@/components/Common'\nimport { type CommonComponentInterface, useBase } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\n\nconst MINIMUM_PAY_PERIOD_AMOUNT = 0\nconst MINIMUM_PAYCHECK_PERCENTAGE = 0\nconst MAXIMUM_PAYCHECK_PERCENTAGE = 100\n\nconst ChildSupportPaymentPeriodSchema = z.nativeEnum(PaymentPeriod)\nconst ChildSupportSchema = z.object({\n state: z.string(),\n fipsCode: z.string(),\n caseNumber: z.string().nullable(),\n orderNumber: z.string().nullable(),\n remittanceNumber: z.string().nullable(),\n amount: z.number().min(0).transform(String),\n payPeriodMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n paymentPeriod: ChildSupportPaymentPeriodSchema,\n})\n\nexport type ChildSupportInputs = z.input<typeof ChildSupportSchema>\nexport type ChildSupportPayload = z.output<typeof ChildSupportSchema>\n\ninterface ChildSupportFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n handleStateAgencySelect: (stateAgency: string) => void\n stateAgencies: { label: string; value: string }[]\n counties: { label: string; value: string }[]\n selectedAgency?: Agencies\n}\n\nfunction ChildSupportForm({\n deduction,\n handleStateAgencySelect,\n stateAgencies,\n counties,\n employeeId,\n selectedAgency,\n}: ChildSupportFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n const ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER = {\n case_number: {\n name: 'caseNumber',\n description: t('caseNumberHelperText'),\n },\n order_number: {\n name: 'orderNumber',\n description: t('orderNumberHelperText'),\n },\n remittance_number: {\n name: 'remittanceNumber',\n description: t('remittanceNumberHelperText'),\n },\n }\n const requiredSelectedAgencyAttributes =\n selectedAgency?.requiredAttributes?.map(attr => {\n return {\n name: ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER[attr.key!].name,\n label: attr.label as string,\n description: ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER[attr.key!].description,\n }\n }) || []\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n const isPending = isPendingCreate || isPendingUpdate\n\n const defaultChildSupportValues: ChildSupportInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n payPeriodMaximum: deduction?.payPeriodMaximum ? Number(deduction.payPeriodMaximum) : null,\n state: deduction?.childSupport?.state || '',\n fipsCode: deduction?.childSupport?.fipsCode || '',\n caseNumber: deduction?.childSupport?.caseNumber || null,\n orderNumber: deduction?.childSupport?.orderNumber || null,\n remittanceNumber: deduction?.childSupport?.remittanceNumber || null,\n paymentPeriod: deduction?.childSupport?.paymentPeriod as PaymentPeriod,\n }\n }, [deduction])\n\n const childSupportFormMethods = useForm<ChildSupportInputs, unknown, ChildSupportPayload>({\n resolver: zodResolver(ChildSupportSchema),\n defaultValues: defaultChildSupportValues,\n })\n const { reset: resetChildSupportForm, setValue, control } = childSupportFormMethods\n const watchedStateAgency = useWatch({ control, name: 'state' })\n\n useEffect(() => {\n resetChildSupportForm(defaultChildSupportValues)\n }, [deduction, defaultChildSupportValues, resetChildSupportForm])\n\n // if in edit mode and user elects to change state agency, reset the required attribute values\n // as new selected agency might require different payload inputs, e.g. OH requires case number + order number\n useEffect(() => {\n setValue('caseNumber', null)\n setValue('orderNumber', null)\n setValue('remittanceNumber', null)\n }, [watchedStateAgency, setValue])\n\n const onChildSupportSubmit: SubmitHandler<ChildSupportPayload> = async data => {\n const childSupport = {\n state: data.state,\n paymentPeriod: data.paymentPeriod,\n fipsCode: data.fipsCode,\n caseNumber: data.caseNumber,\n orderNumber: data.orderNumber,\n remittanceNumber: data.remittanceNumber,\n }\n\n await baseSubmitHandler(data, async payload => {\n const requestBody = {\n active: true,\n amount: payload.amount,\n description: `Child Support - ${childSupport.caseNumber}`, // child support description follows prefix type + case number convention\n courtOrdered: true,\n garnishmentType: 'child_support' as GarnishmentType,\n times: null,\n deductAsPercentage: true, // child support must always deduct as percentage up to a pay period maximum limit and is recurring until cancelled\n payPeriodMaximum: payload.payPeriodMaximum,\n recurring: true,\n childSupport,\n }\n\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId,\n requestBody,\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...requestBody,\n version: deduction.version as string,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const isManualPaymentRequired = selectedAgency?.manualPaymentRequired\n\n return (\n <FormProvider {...childSupportFormMethods}>\n <Form onSubmit={childSupportFormMethods.handleSubmit(onChildSupportSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n <SelectField\n name=\"state\"\n label={t('agency')}\n description={t('agencyHelperText')}\n options={stateAgencies}\n onChange={handleStateAgencySelect}\n isRequired\n />\n {watchedStateAgency && (\n <>\n <SelectField\n name=\"fipsCode\"\n label={t('county')}\n description={t('countyHelperText')}\n options={counties}\n isRequired\n />\n {/* render required inputs for respective agency, e.g. OH requires case number + order number */}\n {requiredSelectedAgencyAttributes.map(({ name, label, description }) => (\n <TextInputField\n key={name}\n name={name}\n label={label}\n description={description}\n isRequired\n />\n ))}\n <NumberInputField\n name=\"payPeriodMaximum\"\n label={t('totalAmountWithheld')}\n description={t('totalAmountWithheldHelperText')}\n min={MINIMUM_PAY_PERIOD_AMOUNT}\n adornmentStart=\"$\"\n isRequired\n />\n <NumberInputField\n name=\"amount\"\n label={t('maxPaycheckPercentage')}\n description={t('maxPaycheckPercentageHelperText')}\n isRequired\n min={MINIMUM_PAYCHECK_PERCENTAGE}\n max={MAXIMUM_PAYCHECK_PERCENTAGE}\n adornmentStart=\"%\"\n />\n <SelectField\n name=\"paymentPeriod\"\n label={t('per')}\n description={t('perHelperText')}\n options={[\n {\n label: t('everyWeek'),\n value: 'Every week',\n },\n {\n label: t('everyOtherWeek'),\n value: 'Every other week',\n },\n {\n label: t('twicePerMonth'),\n value: 'Twice per month',\n },\n {\n label: t('monthly'),\n value: 'Monthly',\n },\n ]}\n isRequired\n />\n {isManualPaymentRequired && (\n <section className={styles.manualPaymentReminderBanner}>\n <Components.Text weight=\"bold\">{t('manualPaymentRequired')}</Components.Text>\n <Components.Text>{t('manualPaymentRequiredDescription')}</Components.Text>\n </section>\n )}\n <ActionsLayout>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('saveCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n )}\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n\nexport default ChildSupportForm\n"],"names":["MINIMUM_PAY_PERIOD_AMOUNT","MINIMUM_PAYCHECK_PERCENTAGE","MAXIMUM_PAYCHECK_PERCENTAGE","ChildSupportPaymentPeriodSchema","z","PaymentPeriod","ChildSupportSchema","val","ChildSupportForm","deduction","handleStateAgencySelect","stateAgencies","counties","employeeId","selectedAgency","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER","requiredSelectedAgencyAttributes","attr","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultChildSupportValues","useMemo","childSupportFormMethods","useForm","zodResolver","resetChildSupportForm","setValue","control","watchedStateAgency","useWatch","useEffect","onChildSupportSubmit","data","childSupport","payload","requestBody","updateDeductionResponse","componentEvents","createDeductionResponse","isManualPaymentRequired","FormProvider","jsx","Form","jsxs","Flex","SelectField","Fragment","name","label","description","TextInputField","NumberInputField","styles","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;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;AAAA,YAET;AAAA,cACE,OAAOA,EAAE,eAAe;AAAA,cACxB,OAAO;AAAA,YAAA;AAAA,YAET;AAAA,cACE,OAAOA,EAAE,SAAS;AAAA,cAClB,OAAO;AAAA,YAAA;AAAA,UACT;AAAA,UAEF,YAAU;AAAA,QAAA;AAAA,MAAA;AAAA,MAEXiC,KACC,gBAAAI,EAAC,WAAA,EAAQ,WAAWS,EAAO,6BACzB,UAAA;AAAA,QAAA,gBAAAX,EAACjC,EAAW,MAAX,EAAgB,QAAO,QAAQ,UAAAF,EAAE,uBAAuB,GAAE;AAAA,0BAC1DE,EAAW,MAAX,EAAiB,UAAAF,EAAE,kCAAkC,EAAA,CAAE;AAAA,MAAA,GAC1D;AAAA,MAEF,gBAAAmC,EAACY,GAAA,EACC,UAAA,gBAAAZ,EAACjC,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWW,GACzC,UAAAb,EAAE,SAAS,GACd,EAAA,CACF;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,EAAA,CAEJ,GACF,GACF;AAEJ;"}
1
+ {"version":3,"file":"ChildSupportForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/ChildSupportForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { useEffect, useMemo } from 'react'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { PaymentPeriod } from '@gusto/embedded-api/models/components/garnishmentchildsupport'\nimport type { GarnishmentType } from '@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { type Agencies } from '@gusto/embedded-api/models/components/childsupportdata'\nimport styles from './ChildSupportForm.module.scss'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { NumberInputField, TextInputField, SelectField } from '@/components/Common'\nimport { type CommonComponentInterface, useBase } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\n\nconst MINIMUM_PAY_PERIOD_AMOUNT = 0\nconst MINIMUM_PAYCHECK_PERCENTAGE = 0\nconst MAXIMUM_PAYCHECK_PERCENTAGE = 100\n\nconst ChildSupportPaymentPeriodSchema = z.nativeEnum(PaymentPeriod)\nconst ChildSupportSchema = z.object({\n state: z.string(),\n fipsCode: z.string(),\n caseNumber: z.string().nullable(),\n orderNumber: z.string().nullable(),\n remittanceNumber: z.string().nullable(),\n amount: z.number().min(0).transform(String),\n payPeriodMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n paymentPeriod: ChildSupportPaymentPeriodSchema,\n})\n\nexport type ChildSupportInputs = z.input<typeof ChildSupportSchema>\nexport type ChildSupportPayload = z.output<typeof ChildSupportSchema>\n\ninterface ChildSupportFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n handleStateAgencySelect: (stateAgency: string) => void\n stateAgencies: { label: string; value: string }[]\n counties: { label: string; value: string }[]\n selectedAgency?: Agencies\n}\n\nfunction ChildSupportForm({\n deduction,\n handleStateAgencySelect,\n stateAgencies,\n counties,\n employeeId,\n selectedAgency,\n}: ChildSupportFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n const ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER = {\n case_number: {\n name: 'caseNumber',\n description: t('caseNumberHelperText'),\n },\n order_number: {\n name: 'orderNumber',\n description: t('orderNumberHelperText'),\n },\n remittance_number: {\n name: 'remittanceNumber',\n description: t('remittanceNumberHelperText'),\n },\n }\n const requiredSelectedAgencyAttributes =\n selectedAgency?.requiredAttributes?.map(attr => {\n return {\n name: ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER[attr.key!].name,\n label: attr.label as string,\n description: ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER[attr.key!].description,\n }\n }) || []\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n const isPending = isPendingCreate || isPendingUpdate\n\n const defaultChildSupportValues: ChildSupportInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n payPeriodMaximum: deduction?.payPeriodMaximum ? Number(deduction.payPeriodMaximum) : null,\n state: deduction?.childSupport?.state || '',\n fipsCode: deduction?.childSupport?.fipsCode || '',\n caseNumber: deduction?.childSupport?.caseNumber || null,\n orderNumber: deduction?.childSupport?.orderNumber || null,\n remittanceNumber: deduction?.childSupport?.remittanceNumber || null,\n paymentPeriod: deduction?.childSupport?.paymentPeriod as PaymentPeriod,\n }\n }, [deduction])\n\n const childSupportFormMethods = useForm<ChildSupportInputs, unknown, ChildSupportPayload>({\n resolver: zodResolver(ChildSupportSchema),\n defaultValues: defaultChildSupportValues,\n })\n const { reset: resetChildSupportForm, setValue, control } = childSupportFormMethods\n const watchedStateAgency = useWatch({ control, name: 'state' })\n\n useEffect(() => {\n resetChildSupportForm(defaultChildSupportValues)\n }, [deduction, defaultChildSupportValues, resetChildSupportForm])\n\n // if in edit mode and user elects to change state agency, reset the required attribute values\n // as new selected agency might require different payload inputs, e.g. OH requires case number + order number\n useEffect(() => {\n setValue('caseNumber', null)\n setValue('orderNumber', null)\n setValue('remittanceNumber', null)\n }, [watchedStateAgency, setValue])\n\n const onChildSupportSubmit: SubmitHandler<ChildSupportPayload> = async data => {\n const childSupport = {\n state: data.state,\n paymentPeriod: data.paymentPeriod,\n fipsCode: data.fipsCode,\n caseNumber: data.caseNumber,\n orderNumber: data.orderNumber,\n remittanceNumber: data.remittanceNumber,\n }\n\n await baseSubmitHandler(data, async payload => {\n const requestBody = {\n active: true,\n amount: payload.amount,\n description: `Child Support - ${childSupport.caseNumber}`, // child support description follows prefix type + case number convention\n courtOrdered: true,\n garnishmentType: 'child_support' as GarnishmentType,\n times: null,\n deductAsPercentage: true, // child support must always deduct as percentage up to a pay period maximum limit and is recurring until cancelled\n payPeriodMaximum: payload.payPeriodMaximum,\n recurring: true,\n childSupport,\n }\n\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId,\n requestBody,\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...requestBody,\n version: deduction.version as string,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const isManualPaymentRequired = selectedAgency?.manualPaymentRequired\n\n return (\n <FormProvider {...childSupportFormMethods}>\n <Form onSubmit={childSupportFormMethods.handleSubmit(onChildSupportSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n <SelectField\n name=\"state\"\n label={t('agency')}\n description={t('agencyHelperText')}\n options={stateAgencies}\n onChange={handleStateAgencySelect}\n isRequired\n />\n {watchedStateAgency && (\n <>\n <SelectField\n name=\"fipsCode\"\n label={t('county')}\n description={t('countyHelperText')}\n options={counties}\n isRequired\n />\n {/* render required inputs for respective agency, e.g. OH requires case number + order number */}\n {requiredSelectedAgencyAttributes.map(({ name, label, description }) => (\n <TextInputField\n key={name}\n name={name}\n label={label}\n description={description}\n isRequired\n />\n ))}\n <NumberInputField\n name=\"payPeriodMaximum\"\n label={t('totalAmountWithheld')}\n description={t('totalAmountWithheldHelperText')}\n min={MINIMUM_PAY_PERIOD_AMOUNT}\n adornmentStart=\"$\"\n isRequired\n />\n <NumberInputField\n name=\"amount\"\n label={t('maxPaycheckPercentage')}\n description={t('maxPaycheckPercentageHelperText')}\n isRequired\n min={MINIMUM_PAYCHECK_PERCENTAGE}\n max={MAXIMUM_PAYCHECK_PERCENTAGE}\n adornmentStart=\"%\"\n />\n <SelectField\n name=\"paymentPeriod\"\n label={t('per')}\n description={t('perHelperText')}\n options={[\n {\n label: t('everyWeek'),\n value: 'Every week',\n },\n {\n label: t('everyOtherWeek'),\n value: 'Every other week',\n },\n {\n label: t('twicePerMonth'),\n value: 'Twice per month',\n },\n {\n label: t('monthly'),\n value: 'Monthly',\n },\n ]}\n isRequired\n />\n {isManualPaymentRequired && (\n <section className={styles.manualPaymentReminderBanner}>\n <Components.Text weight=\"bold\">{t('manualPaymentRequired')}</Components.Text>\n <Components.Text>{t('manualPaymentRequiredDescription')}</Components.Text>\n </section>\n )}\n <ActionsLayout>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('saveCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n )}\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n\nexport default ChildSupportForm\n"],"names":["MINIMUM_PAY_PERIOD_AMOUNT","MINIMUM_PAYCHECK_PERCENTAGE","MAXIMUM_PAYCHECK_PERCENTAGE","ChildSupportPaymentPeriodSchema","z","PaymentPeriod","ChildSupportSchema","val","ChildSupportForm","deduction","handleStateAgencySelect","stateAgencies","counties","employeeId","selectedAgency","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","ATTR_KEY_TO_TEXT_FIELD_NAME_MAPPER","requiredSelectedAgencyAttributes","attr","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultChildSupportValues","useMemo","childSupportFormMethods","useForm","zodResolver","resetChildSupportForm","setValue","control","watchedStateAgency","useWatch","useEffect","onChildSupportSubmit","data","childSupport","payload","requestBody","updateDeductionResponse","componentEvents","createDeductionResponse","isManualPaymentRequired","FormProvider","jsx","Form","jsxs","Flex","SelectField","Fragment","name","label","description","TextInputField","NumberInputField","styles","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoBA,MAAMA,KAA4B,GAC5BC,KAA8B,GAC9BC,KAA8B,KAE9BC,KAAkCC,EAAE,WAAWC,CAAa,GAC5DC,KAAqBF,EAAE,OAAO;AAAA,EAClC,OAAOA,EAAE,OAAA;AAAA,EACT,UAAUA,EAAE,OAAA;AAAA,EACZ,YAAYA,EAAE,OAAA,EAAS,SAAA;AAAA,EACvB,aAAaA,EAAE,OAAA,EAAS,SAAA;AAAA,EACxB,kBAAkBA,EAAE,OAAA,EAAS,SAAA;AAAA,EAC7B,QAAQA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,UAAU,MAAM;AAAA,EAC1C,kBAAkBA,EACf,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAG,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,eAAeJ;AACjB,CAAC;AAcD,SAASK,GAAiB;AAAA,EACxB,WAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC;AAAA,EACA,gBAAAC;AACF,GAA0B;AACxB,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,EAAA,GACjC,EAAE,GAAAC,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA,GAEbC,IAAqC;AAAA,IACzC,aAAa;AAAA,MACX,MAAM;AAAA,MACN,aAAaJ,EAAE,sBAAsB;AAAA,IAAA;AAAA,IAEvC,cAAc;AAAA,MACZ,MAAM;AAAA,MACN,aAAaA,EAAE,uBAAuB;AAAA,IAAA;AAAA,IAExC,mBAAmB;AAAA,MACjB,MAAM;AAAA,MACN,aAAaA,EAAE,4BAA4B;AAAA,IAAA;AAAA,EAC7C,GAEIK,IACJT,GAAgB,oBAAoB,IAAI,CAAAU,OAC/B;AAAA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AA,YAAA;AAAA,YAET;AAAA,cACE,OAAOA,EAAE,gBAAgB;AAAA,cACzB,OAAO;AAAA,YAAA;AAAA,YAET;AAAA,cACE,OAAOA,EAAE,eAAe;AAAA,cACxB,OAAO;AAAA,YAAA;AAAA,YAET;AAAA,cACE,OAAOA,EAAE,SAAS;AAAA,cAClB,OAAO;AAAA,YAAA;AAAA,UACT;AAAA,UAEF,YAAU;AAAA,QAAA;AAAA,MAAA;AAAA,MAEXiC,KACC,gBAAAI,EAAC,WAAA,EAAQ,WAAWS,EAAO,6BACzB,UAAA;AAAA,QAAA,gBAAAX,EAACjC,EAAW,MAAX,EAAgB,QAAO,QAAQ,UAAAF,EAAE,uBAAuB,GAAE;AAAA,0BAC1DE,EAAW,MAAX,EAAiB,UAAAF,EAAE,kCAAkC,EAAA,CAAE;AAAA,MAAA,GAC1D;AAAA,MAEF,gBAAAmC,EAACY,GAAA,EACC,UAAA,gBAAAZ,EAACjC,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWW,GACzC,UAAAb,EAAE,SAAS,GACd,EAAA,CACF;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,EAAA,CAEJ,GACF,GACF;AAEJ;"}
@@ -1,8 +1,8 @@
1
- import { jsx as n, jsxs as s, Fragment as b } from "react/jsx-runtime";
1
+ import { jsx as t, jsxs as s, Fragment as b } from "react/jsx-runtime";
2
2
  import { useTranslation as F } from "react-i18next";
3
3
  import { useForm as L, useWatch as q, FormProvider as R } from "react-hook-form";
4
4
  import { useMemo as T, useEffect as S } from "react";
5
- import { z as t } from "zod";
5
+ import { z as n } from "zod";
6
6
  import { zodResolver as N } from "@hookform/resolvers/zod";
7
7
  import { useGarnishmentsCreateMutation as I } from "@gusto/embedded-api/react-query/garnishmentsCreate";
8
8
  import { useGarnishmentsUpdateMutation as U } from "@gusto/embedded-api/react-query/garnishmentsUpdate";
@@ -10,33 +10,34 @@ import { useComponentContext as _ } from "../../../../contexts/ComponentAdapter/
10
10
  import { Form as B } from "../../../Common/Form/Form.js";
11
11
  import { Flex as w } from "../../../Common/Flex/Flex.js";
12
12
  import "classnames";
13
- import { ActionsLayout as j } from "../../../Common/ActionsLayout/ActionsLayout.js";
13
+ import { componentEvents as l } from "../../../../shared/constants.js";
14
+ import { RadioGroupField as f } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
15
+ import { TextInputField as j } from "../../../Common/Fields/TextInputField/TextInputField.js";
16
+ import { ActionsLayout as G } from "../../../Common/ActionsLayout/ActionsLayout.js";
17
+ import { NumberInputField as c } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
14
18
  import "react-error-boundary";
15
19
  import "@gusto/embedded-api/models/errors/apierror";
16
20
  import "@gusto/embedded-api/models/errors/sdkvalidationerror";
17
21
  import "@gusto/embedded-api/models/errors/unprocessableentityerrorobject";
18
22
  import "@tanstack/react-query";
19
- import { useBase as G } from "../../../Base/useBase.js";
20
- import { componentEvents as l } from "../../../../shared/constants.js";
23
+ import { useBase as Y } from "../../../Base/useBase.js";
21
24
  import "dompurify";
22
25
  import "../../../../contexts/LocaleProvider/useLocale.js";
23
- import { TextInputField as Y } from "../../../Common/Fields/TextInputField/TextInputField.js";
24
- import { RadioGroupField as f } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
25
- import { NumberInputField as c } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
26
+ import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
26
27
  import { CheckboxField as k } from "../../../Common/Fields/CheckboxField/CheckboxField.js";
27
- const z = t.object({
28
- active: t.boolean(),
29
- amount: t.number().min(0).transform(String),
30
- description: t.string().min(1),
31
- courtOrdered: t.boolean(),
32
- times: t.number().nullable(),
33
- recurring: t.string().transform((e) => e === "true"),
34
- annualMaximum: t.number().min(0).transform((e) => e > 0 ? e.toString() : null).nullable(),
35
- payPeriodMaximum: t.number().min(0).transform((e) => e > 0 ? e.toString() : null).nullable(),
36
- deductAsPercentage: t.string().transform((e) => e === "true")
28
+ const z = n.object({
29
+ active: n.boolean(),
30
+ amount: n.number().min(0).transform(String),
31
+ description: n.string().min(1),
32
+ courtOrdered: n.boolean(),
33
+ times: n.number().nullable(),
34
+ recurring: n.string().transform((e) => e === "true"),
35
+ annualMaximum: n.number().min(0).transform((e) => e > 0 ? e.toString() : null).nullable(),
36
+ payPeriodMaximum: n.number().min(0).transform((e) => e > 0 ? e.toString() : null).nullable(),
37
+ deductAsPercentage: n.string().transform((e) => e === "true")
37
38
  });
38
- function xe({ deduction: e, employeeId: g }) {
39
- const { onEvent: o, baseSubmitHandler: x } = G(), { t: r } = F("Employee.Deductions"), p = _(), { mutateAsync: P, isPending: h } = I(), { mutateAsync: E, isPending: y } = U(), D = h || y, m = T(() => ({
39
+ function Pe({ deduction: e, employeeId: g }) {
40
+ const { onEvent: o, baseSubmitHandler: x } = Y(), { t: r } = F("Employee.Deductions"), p = _(), { mutateAsync: P, isPending: h } = I(), { mutateAsync: E, isPending: y } = U(), D = h || y, m = T(() => ({
40
41
  amount: e?.amount ? Number(e.amount) : 0,
41
42
  description: e?.description ?? "",
42
43
  times: e?.times ?? null,
@@ -80,9 +81,9 @@ function xe({ deduction: e, employeeId: g }) {
80
81
  }, v = () => {
81
82
  o(l.EMPLOYEE_DEDUCTION_CANCEL);
82
83
  };
83
- return /* @__PURE__ */ n(R, { ...a, children: /* @__PURE__ */ n(B, { onSubmit: a.handleSubmit(O), children: /* @__PURE__ */ n(w, { flexDirection: "column", gap: 32, children: /* @__PURE__ */ s(b, { children: [
84
- /* @__PURE__ */ n(Y, { name: "description", label: r("descriptionLabel"), isRequired: !0 }),
85
- /* @__PURE__ */ n(
84
+ return /* @__PURE__ */ t(R, { ...a, children: /* @__PURE__ */ t(B, { onSubmit: a.handleSubmit(O), children: /* @__PURE__ */ t(w, { flexDirection: "column", gap: 32, children: /* @__PURE__ */ s(b, { children: [
85
+ /* @__PURE__ */ t(j, { name: "description", label: r("descriptionLabel"), isRequired: !0 }),
86
+ /* @__PURE__ */ t(
86
87
  f,
87
88
  {
88
89
  name: "deductAsPercentage",
@@ -94,8 +95,8 @@ function xe({ deduction: e, employeeId: g }) {
94
95
  ]
95
96
  }
96
97
  ),
97
- /* @__PURE__ */ n(c, { name: "amount", label: r("deductionAmountLabel"), isRequired: !0, min: 0 }),
98
- /* @__PURE__ */ n(
98
+ /* @__PURE__ */ t(c, { name: "amount", label: r("deductionAmountLabel"), isRequired: !0, min: 0 }),
99
+ /* @__PURE__ */ t(
99
100
  f,
100
101
  {
101
102
  name: "recurring",
@@ -108,10 +109,10 @@ function xe({ deduction: e, employeeId: g }) {
108
109
  }
109
110
  ),
110
111
  M === "true" && /* @__PURE__ */ s(b, { children: [
111
- /* @__PURE__ */ n(c, { name: "annualMaximum", label: r("annualMaxLabel"), min: 0 }),
112
- /* @__PURE__ */ n(c, { name: "payPeriodMaximum", label: "Pay period maximum", min: 0 })
112
+ /* @__PURE__ */ t(c, { name: "annualMaximum", label: r("annualMaxLabel"), min: 0 }),
113
+ /* @__PURE__ */ t(c, { name: "payPeriodMaximum", label: "Pay period maximum", min: 0 })
113
114
  ] }),
114
- /* @__PURE__ */ n(
115
+ /* @__PURE__ */ t(
115
116
  k,
116
117
  {
117
118
  name: "courtOrdered",
@@ -119,14 +120,14 @@ function xe({ deduction: e, employeeId: g }) {
119
120
  isDisabled: !!e
120
121
  }
121
122
  ),
122
- /* @__PURE__ */ s(j, { children: [
123
- /* @__PURE__ */ n(p.Button, { variant: "secondary", onClick: v, children: r("cancelCta") }),
124
- /* @__PURE__ */ n(p.Button, { type: "submit", isLoading: D, children: r(e ? "continueCta" : "addDeductionCta") })
123
+ /* @__PURE__ */ s(G, { children: [
124
+ /* @__PURE__ */ t(p.Button, { variant: "secondary", onClick: v, children: r("cancelCta") }),
125
+ /* @__PURE__ */ t(p.Button, { type: "submit", isLoading: D, children: r(e ? "continueCta" : "addDeductionCta") })
125
126
  ] })
126
127
  ] }) }) }) });
127
128
  }
128
129
  export {
129
130
  z as DeductionSchema,
130
- xe as default
131
+ Pe as default
131
132
  };
132
133
  //# sourceMappingURL=CustomDeductionForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomDeductionForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { useEffect, 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 {\n NumberInputField,\n TextInputField,\n RadioGroupField,\n CheckboxField,\n} from '@/components/Common'\nimport { type CommonComponentInterface, useBase } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\n\nexport const DeductionSchema = z.object({\n active: z.boolean(),\n amount: z.number().min(0).transform(String),\n description: z.string().min(1),\n courtOrdered: z.boolean(),\n times: z.number().nullable(),\n recurring: z.string().transform(val => val === 'true'),\n annualMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n payPeriodMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n deductAsPercentage: z.string().transform(val => val === 'true'),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ninterface ChildSupportFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n}\n\nfunction CustomDeductionForm({ deduction, employeeId }: ChildSupportFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n const isPending = isPendingCreate || isPendingUpdate\n\n const defaultValues: DeductionInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n description: deduction?.description ?? '',\n times: deduction?.times ?? null,\n recurring: deduction?.recurring?.toString() ?? 'true',\n annualMaximum: deduction?.annualMaximum ? Number(deduction.annualMaximum) : null,\n payPeriodMaximum: deduction?.payPeriodMaximum ? Number(deduction.payPeriodMaximum) : null,\n deductAsPercentage: deduction?.deductAsPercentage?.toString() ?? 'true',\n active: true,\n courtOrdered: deduction?.courtOrdered ?? false,\n } as DeductionInputs\n }, [deduction])\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n const { reset: resetForm, control } = formMethods\n\n useEffect(() => {\n resetForm(defaultValues)\n }, [deduction, defaultValues, resetForm])\n\n const watchedRecurring = useWatch({ control, name: 'recurring' })\n\n const onSubmit: SubmitHandler<DeductionPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, times: payload.recurring ? null : 1 },\n },\n })\n\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...payload,\n version: deduction.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CANCEL)\n }\n\n return (\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n <>\n <TextInputField name=\"description\" label={t('descriptionLabel')} isRequired />\n <RadioGroupField\n name=\"deductAsPercentage\"\n label={t('deductionTypeLabel')}\n isRequired\n options={[\n { value: 'true', label: t('deductionTypePercentageOption') },\n { value: 'false', label: t('deductionTypeFixedAmountOption') },\n ]}\n />\n <NumberInputField name=\"amount\" label={t('deductionAmountLabel')} isRequired min={0} />\n <RadioGroupField\n name=\"recurring\"\n label={t('frequencyLabel')}\n isRequired\n options={[\n { value: 'true', label: t('frequencyRecurringOption') },\n { value: 'false', label: t('frequencyOneTimeOption') },\n ]}\n />\n {watchedRecurring === 'true' && (\n <>\n <NumberInputField name=\"annualMaximum\" label={t('annualMaxLabel')} min={0} />\n <NumberInputField name=\"payPeriodMaximum\" label=\"Pay period maximum\" min={0} />\n </>\n )}\n <CheckboxField\n name=\"courtOrdered\"\n label={t('courtOrderedLabel')}\n isDisabled={!!deduction}\n />\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {!deduction ? t('addDeductionCta') : t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n\nexport default CustomDeductionForm\n"],"names":["DeductionSchema","z","val","CustomDeductionForm","deduction","employeeId","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultValues","useMemo","formMethods","useForm","zodResolver","resetForm","control","useEffect","watchedRecurring","useWatch","onSubmit","data","payload","updateDeductionResponse","componentEvents","createDeductionResponse","handleCancel","FormProvider","jsx","Form","Flex","jsxs","Fragment","TextInputField","RadioGroupField","NumberInputField","CheckboxField","ActionsLayout"],"mappings":";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,EAAA,CAAG;AAAA,IAAA,GAC/E;AAAA,IAEF,gBAAAP;AAAA,MAACQ;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOrC,EAAE,mBAAmB;AAAA,QAC5B,YAAY,CAAC,CAACL;AAAA,MAAA;AAAA,IAAA;AAAA,sBAEf2C,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAT,EAAC3B,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASyB,GAC7C,UAAA3B,EAAE,WAAW,EAAA,CAChB;AAAA,MACA,gBAAA6B,EAAC3B,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWQ,GACzC,UAAoCV,EAAnCL,IAAqC,gBAAvB,iBAAoC,EAAA,CACtD;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
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 { useEffect, 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 {\n NumberInputField,\n TextInputField,\n RadioGroupField,\n CheckboxField,\n} from '@/components/Common'\nimport { type CommonComponentInterface, useBase } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\n\nexport const DeductionSchema = z.object({\n active: z.boolean(),\n amount: z.number().min(0).transform(String),\n description: z.string().min(1),\n courtOrdered: z.boolean(),\n times: z.number().nullable(),\n recurring: z.string().transform(val => val === 'true'),\n annualMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n payPeriodMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n deductAsPercentage: z.string().transform(val => val === 'true'),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ninterface ChildSupportFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n}\n\nfunction CustomDeductionForm({ deduction, employeeId }: ChildSupportFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n const isPending = isPendingCreate || isPendingUpdate\n\n const defaultValues: DeductionInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n description: deduction?.description ?? '',\n times: deduction?.times ?? null,\n recurring: deduction?.recurring?.toString() ?? 'true',\n annualMaximum: deduction?.annualMaximum ? Number(deduction.annualMaximum) : null,\n payPeriodMaximum: deduction?.payPeriodMaximum ? Number(deduction.payPeriodMaximum) : null,\n deductAsPercentage: deduction?.deductAsPercentage?.toString() ?? 'true',\n active: true,\n courtOrdered: deduction?.courtOrdered ?? false,\n } as DeductionInputs\n }, [deduction])\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n const { reset: resetForm, control } = formMethods\n\n useEffect(() => {\n resetForm(defaultValues)\n }, [deduction, defaultValues, resetForm])\n\n const watchedRecurring = useWatch({ control, name: 'recurring' })\n\n const onSubmit: SubmitHandler<DeductionPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, times: payload.recurring ? null : 1 },\n },\n })\n\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...payload,\n version: deduction.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CANCEL)\n }\n\n return (\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n <>\n <TextInputField name=\"description\" label={t('descriptionLabel')} isRequired />\n <RadioGroupField\n name=\"deductAsPercentage\"\n label={t('deductionTypeLabel')}\n isRequired\n options={[\n { value: 'true', label: t('deductionTypePercentageOption') },\n { value: 'false', label: t('deductionTypeFixedAmountOption') },\n ]}\n />\n <NumberInputField name=\"amount\" label={t('deductionAmountLabel')} isRequired min={0} />\n <RadioGroupField\n name=\"recurring\"\n label={t('frequencyLabel')}\n isRequired\n options={[\n { value: 'true', label: t('frequencyRecurringOption') },\n { value: 'false', label: t('frequencyOneTimeOption') },\n ]}\n />\n {watchedRecurring === 'true' && (\n <>\n <NumberInputField name=\"annualMaximum\" label={t('annualMaxLabel')} min={0} />\n <NumberInputField name=\"payPeriodMaximum\" label=\"Pay period maximum\" min={0} />\n </>\n )}\n <CheckboxField\n name=\"courtOrdered\"\n label={t('courtOrderedLabel')}\n isDisabled={!!deduction}\n />\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {!deduction ? t('addDeductionCta') : t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n\nexport default CustomDeductionForm\n"],"names":["DeductionSchema","z","val","CustomDeductionForm","deduction","employeeId","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultValues","useMemo","formMethods","useForm","zodResolver","resetForm","control","useEffect","watchedRecurring","useWatch","onSubmit","data","payload","updateDeductionResponse","componentEvents","createDeductionResponse","handleCancel","FormProvider","jsx","Form","Flex","jsxs","Fragment","TextInputField","RadioGroupField","NumberInputField","CheckboxField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBO,MAAMA,IAAkBC,EAAE,OAAO;AAAA,EACtC,QAAQA,EAAE,QAAA;AAAA,EACV,QAAQA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,UAAU,MAAM;AAAA,EAC1C,aAAaA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC7B,cAAcA,EAAE,QAAA;AAAA,EAChB,OAAOA,EAAE,OAAA,EAAS,SAAA;AAAA,EAClB,WAAWA,EAAE,OAAA,EAAS,UAAU,CAAAC,MAAOA,MAAQ,MAAM;AAAA,EACrD,eAAeD,EACZ,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAC,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,kBAAkBD,EACf,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAC,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,oBAAoBD,EAAE,OAAA,EAAS,UAAU,CAAAC,MAAOA,MAAQ,MAAM;AAChE,CAAC;AAUD,SAASC,GAAoB,EAAE,WAAAC,GAAW,YAAAC,KAAqC;AAC7E,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EA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,QACC,MAAK;AAAA,QACL,OAAOnC,EAAE,gBAAgB;AAAA,QACzB,YAAU;AAAA,QACV,SAAS;AAAA,UACP,EAAE,OAAO,QAAQ,OAAOA,EAAE,0BAA0B,EAAA;AAAA,UACpD,EAAE,OAAO,SAAS,OAAOA,EAAE,wBAAwB,EAAA;AAAA,QAAE;AAAA,MACvD;AAAA,IAAA;AAAA,IAEDmB,MAAqB,UACpB,gBAAAa,EAAAC,GAAA,EACE,UAAA;AAAA,MAAA,gBAAAJ,EAACO,GAAA,EAAiB,MAAK,iBAAgB,OAAOpC,EAAE,gBAAgB,GAAG,KAAK,GAAG;AAAA,wBAC1EoC,GAAA,EAAiB,MAAK,oBAAmB,OAAM,sBAAqB,KAAK,EAAA,CAAG;AAAA,IAAA,GAC/E;AAAA,IAEF,gBAAAP;AAAA,MAACQ;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOrC,EAAE,mBAAmB;AAAA,QAC5B,YAAY,CAAC,CAACL;AAAA,MAAA;AAAA,IAAA;AAAA,sBAEf2C,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAT,EAAC3B,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASyB,GAC7C,UAAA3B,EAAE,WAAW,EAAA,CAChB;AAAA,MACA,gBAAA6B,EAAC3B,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWQ,GACzC,UAAoCV,EAAnCL,IAAqC,gBAAvB,iBAAoC,EAAA,CACtD;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
@@ -12,13 +12,13 @@ import { useBase as H } from "../../../Base/useBase.js";
12
12
  import { Form as V } from "../../../Common/Form/Form.js";
13
13
  import { Flex as W } from "../../../Common/Flex/Flex.js";
14
14
  import "classnames";
15
- import { ActionsLayout as J } from "../../../Common/ActionsLayout/ActionsLayout.js";
16
- import { useComponentDictionary as K, useI18n as Q } from "../../../../i18n/I18n.js";
17
15
  import { componentEvents as p } from "../../../../shared/constants.js";
18
- import { useComponentContext as X } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
19
- import { TextInputField as Z } from "../../../Common/Fields/TextInputField/TextInputField.js";
20
16
  import { RadioGroupField as x } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
17
+ import { TextInputField as J } from "../../../Common/Fields/TextInputField/TextInputField.js";
18
+ import { ActionsLayout as K } from "../../../Common/ActionsLayout/ActionsLayout.js";
21
19
  import { NumberInputField as f } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
20
+ import { useComponentContext as Q } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
21
+ import { useComponentDictionary as X, useI18n as Z } from "../../../../i18n/I18n.js";
22
22
  import { CheckboxField as $ } from "../../../Common/Fields/CheckboxField/CheckboxField.js";
23
23
  const ee = i.object({
24
24
  active: i.boolean(),
@@ -35,8 +35,8 @@ function Me(t) {
35
35
  return /* @__PURE__ */ n(z, { ...t, children: /* @__PURE__ */ n(ne, { ...t, children: t.children }) });
36
36
  }
37
37
  function ne({ className: t, children: b, employeeId: g, deductionId: h, dictionary: y }) {
38
- const { onEvent: u, baseSubmitHandler: P } = H(), { t: r } = N("Employee.Deductions"), m = X();
39
- K("Employee.Deductions", y), Q("Employee.Deductions");
38
+ const { onEvent: u, baseSubmitHandler: P } = H(), { t: r } = N("Employee.Deductions"), m = Q();
39
+ X("Employee.Deductions", y), Z("Employee.Deductions");
40
40
  const { data: C } = k({ employeeId: g }), e = h ? C.garnishmentList?.find((c) => c.uuid === h) ?? null : null, { mutateAsync: M, isPending: O } = j(), { mutateAsync: L, isPending: T } = Y(), a = B(() => ({
41
41
  amount: e?.amount ? Number(e.amount) : 0,
42
42
  description: e?.description ?? "",
@@ -83,7 +83,7 @@ function ne({ className: t, children: b, employeeId: g, deductionId: h, dictiona
83
83
  }, S = r(e ? "editDeductionTitle" : "addDeductionTitle");
84
84
  return /* @__PURE__ */ n("section", { className: t, children: /* @__PURE__ */ n(w, { ...s, children: /* @__PURE__ */ n(V, { onSubmit: s.handleSubmit(R), children: /* @__PURE__ */ n(W, { flexDirection: "column", gap: 32, children: b || /* @__PURE__ */ d(E, { children: [
85
85
  /* @__PURE__ */ n(m.Heading, { as: "h2", children: S }),
86
- /* @__PURE__ */ n(Z, { name: "description", label: r("descriptionLabel"), isRequired: !0 }),
86
+ /* @__PURE__ */ n(J, { name: "description", label: r("descriptionLabel"), isRequired: !0 }),
87
87
  /* @__PURE__ */ n(
88
88
  x,
89
89
  {
@@ -122,7 +122,7 @@ function ne({ className: t, children: b, employeeId: g, deductionId: h, dictiona
122
122
  /* @__PURE__ */ n(f, { name: "payPeriodMaximum", label: "Pay period maximum", min: 0 })
123
123
  ] }),
124
124
  /* @__PURE__ */ n($, { name: "courtOrdered", label: r("courtOrderedLabel") }),
125
- /* @__PURE__ */ d(J, { children: [
125
+ /* @__PURE__ */ d(K, { children: [
126
126
  /* @__PURE__ */ n(m.Button, { variant: "secondary", onClick: q, children: r("cancelCta") }),
127
127
  /* @__PURE__ */ n(m.Button, { type: "submit", isLoading: F, children: r(e ? "continueCta" : "addDeductionCta") })
128
128
  ] })
@@ -6,22 +6,22 @@ import { BaseComponent as _ } from "../../../Base/Base.js";
6
6
  import { useBase as k } from "../../../Base/useBase.js";
7
7
  import { Flex as w } from "../../../Common/Flex/Flex.js";
8
8
  import "classnames";
9
+ import { componentEvents as a } from "../../../../shared/constants.js";
9
10
  import { ActionsLayout as I } from "../../../Common/ActionsLayout/ActionsLayout.js";
11
+ import { HamburgerMenu as M } from "../../../Common/HamburgerMenu/HamburgerMenu.js";
10
12
  import u from "../../../Common/hooks/useNumberFormatter.js";
11
- import M from "../../../../assets/icons/pencil.svg.js";
12
- import U from "../../../../assets/icons/trashcan.svg.js";
13
- import { useComponentDictionary as B, useI18n as S } from "../../../../i18n/I18n.js";
14
- import { componentEvents as a } from "../../../../shared/constants.js";
15
- import { useComponentContext as Y } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
16
- import { HamburgerMenu as q } from "../../../Common/HamburgerMenu/HamburgerMenu.js";
13
+ import U from "../../../../assets/icons/pencil.svg.js";
14
+ import B from "../../../../assets/icons/trashcan.svg.js";
15
+ import { useComponentDictionary as S, useI18n as Y } from "../../../../i18n/I18n.js";
16
+ import { useComponentContext as q } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
17
17
  import { useDataView as F } from "../../../Common/DataView/useDataView.js";
18
18
  import { DataView as H } from "../../../Common/DataView/DataView.js";
19
19
  function se(r) {
20
20
  return /* @__PURE__ */ n(_, { ...r, children: /* @__PURE__ */ n(V, { ...r, children: r.children }) });
21
21
  }
22
22
  function V({ className: r, children: s, employeeId: d, dictionary: l }) {
23
- const { onEvent: i, baseSubmitHandler: p } = k(), { t } = O("Employee.Deductions"), m = Y(), E = u("currency"), f = u("percent");
24
- B("Employee.Deductions", l), S("Employee.Deductions");
23
+ const { onEvent: i, baseSubmitHandler: p } = k(), { t } = O("Employee.Deductions"), m = q(), E = u("currency"), f = u("percent");
24
+ S("Employee.Deductions", l), Y("Employee.Deductions");
25
25
  const { data: D } = x({ employeeId: d }), h = D.garnishmentList.filter((e) => e.active), { mutateAsync: C, isPending: g } = N(), y = async (e) => {
26
26
  await p(e, async (o) => {
27
27
  const { garnishment: P } = await C({
@@ -62,7 +62,7 @@ function V({ className: r, children: s, employeeId: d, dictionary: l }) {
62
62
  }
63
63
  ],
64
64
  itemMenu: (e) => /* @__PURE__ */ n(
65
- q,
65
+ M,
66
66
  {
67
67
  isLoading: g,
68
68
  items: [
@@ -71,14 +71,14 @@ function V({ className: r, children: s, employeeId: d, dictionary: l }) {
71
71
  onClick: () => {
72
72
  v(e);
73
73
  },
74
- icon: /* @__PURE__ */ n(M, { "aria-hidden": !0 })
74
+ icon: /* @__PURE__ */ n(U, { "aria-hidden": !0 })
75
75
  },
76
76
  {
77
77
  label: t("deleteCta"),
78
78
  onClick: async () => {
79
79
  await y(e);
80
80
  },
81
- icon: /* @__PURE__ */ n(U, { "aria-hidden": !0 })
81
+ icon: /* @__PURE__ */ n(B, { "aria-hidden": !0 })
82
82
  }
83
83
  ]
84
84
  }
@@ -1,49 +1,50 @@
1
- import { jsx as e, jsxs as p, Fragment as a } from "react/jsx-runtime";
1
+ import { jsx as o, jsxs as p, Fragment as a } from "react/jsx-runtime";
2
2
  import { useTranslation as D } from "react-i18next";
3
- import { z as m } from "zod";
3
+ import { z as c } from "zod";
4
4
  import { useForm as f, FormProvider as E } from "react-hook-form";
5
5
  import { zodResolver as h } from "@hookform/resolvers/zod";
6
6
  import { BaseComponent as C } from "../../../Base/Base.js";
7
7
  import { useBase as b } from "../../../Base/useBase.js";
8
8
  import { Form as N } from "../../../Common/Form/Form.js";
9
9
  import "classnames";
10
- import { ActionsLayout as v } from "../../../Common/ActionsLayout/ActionsLayout.js";
11
- import { useComponentDictionary as F, useI18n as I } from "../../../../i18n/I18n.js";
12
10
  import { componentEvents as s } from "../../../../shared/constants.js";
13
- import { useComponentContext as Y } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
14
- import { RadioGroupField as y } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
15
- const L = m.object({ includeDeductions: m.enum(["Yes", "No"]) });
16
- function G(n) {
17
- return /* @__PURE__ */ e(C, { ...n, children: /* @__PURE__ */ e(_, { ...n, children: n.children }) });
11
+ import { RadioGroupField as v } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
12
+ import { ActionsLayout as F } from "../../../Common/ActionsLayout/ActionsLayout.js";
13
+ import { useComponentContext as I } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
14
+ import "react";
15
+ import { useComponentDictionary as Y, useI18n as y } from "../../../../i18n/I18n.js";
16
+ const L = c.object({ includeDeductions: c.enum(["Yes", "No"]) });
17
+ function H(n) {
18
+ return /* @__PURE__ */ o(C, { ...n, children: /* @__PURE__ */ o(_, { ...n, children: n.children }) });
18
19
  }
19
20
  function _({ className: n, children: t, dictionary: u }) {
20
- const { onEvent: i } = b(), { t: o } = D("Employee.Deductions"), r = Y();
21
- F("Employee.Deductions", u), I("Employee.Deductions");
22
- const c = f({
21
+ const { onEvent: i } = b(), { t: e } = D("Employee.Deductions"), r = I();
22
+ Y("Employee.Deductions", u), y("Employee.Deductions");
23
+ const m = f({
23
24
  resolver: h(L),
24
25
  defaultValues: { includeDeductions: "No" }
25
26
  }), d = (l) => {
26
27
  l.includeDeductions === "Yes" ? i(s.EMPLOYEE_DEDUCTION_INCLUDE_YES) : i(s.EMPLOYEE_DEDUCTION_INCLUDE_NO);
27
28
  };
28
- return /* @__PURE__ */ e("section", { className: n, children: /* @__PURE__ */ e(E, { ...c, children: /* @__PURE__ */ e(N, { onSubmit: c.handleSubmit(d), children: t || /* @__PURE__ */ p(a, { children: [
29
- /* @__PURE__ */ e(r.Heading, { as: "h2", children: o("pageTitle") }),
30
- /* @__PURE__ */ e(
31
- y,
29
+ return /* @__PURE__ */ o("section", { className: n, children: /* @__PURE__ */ o(E, { ...m, children: /* @__PURE__ */ o(N, { onSubmit: m.handleSubmit(d), children: t || /* @__PURE__ */ p(a, { children: [
30
+ /* @__PURE__ */ o(r.Heading, { as: "h2", children: e("pageTitle") }),
31
+ /* @__PURE__ */ o(
32
+ v,
32
33
  {
33
34
  name: "includeDeductions",
34
35
  isRequired: !0,
35
- label: o("includeDeductionsFormLabel"),
36
- description: o("includeDeductionsDescription"),
36
+ label: e("includeDeductionsFormLabel"),
37
+ description: e("includeDeductionsDescription"),
37
38
  options: [
38
- { value: "Yes", label: o("includeDeductionsYes") },
39
- { value: "No", label: o("includeDeductionsNo") }
39
+ { value: "Yes", label: e("includeDeductionsYes") },
40
+ { value: "No", label: e("includeDeductionsNo") }
40
41
  ]
41
42
  }
42
43
  ),
43
- /* @__PURE__ */ e(v, { children: /* @__PURE__ */ e(r.Button, { type: "submit", children: o("continueCta") }) })
44
+ /* @__PURE__ */ o(F, { children: /* @__PURE__ */ o(r.Button, { type: "submit", children: e("continueCta") }) })
44
45
  ] }) }) }) });
45
46
  }
46
47
  export {
47
- G as IncludeDeductionsForm
48
+ H as IncludeDeductionsForm
48
49
  };
49
50
  //# sourceMappingURL=IncludeDeductionsForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IncludeDeductionsForm.js","sources":["../../../../../src/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { FormProvider, useForm, type SubmitHandler } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { Form } from '@/components/Common/Form'\nimport { RadioGroupField } from '@/components/Common'\nimport { ActionsLayout } from '@/components/Common'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\nconst IncludeDeductionsSchema = z.object({ includeDeductions: z.enum(['Yes', 'No']) })\nexport type IncludeDeductionsPayload = z.output<typeof IncludeDeductionsSchema>\n\ninterface IncludeDeductionsFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n}\n\nexport function IncludeDeductionsForm(props: IncludeDeductionsFormProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ className, children, dictionary }: IncludeDeductionsFormProps) {\n const { onEvent } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n useComponentDictionary('Employee.Deductions', dictionary)\n useI18n('Employee.Deductions')\n\n const formMethods = useForm<IncludeDeductionsPayload>({\n resolver: zodResolver(IncludeDeductionsSchema),\n defaultValues: { includeDeductions: 'No' },\n })\n\n const onSubmit: SubmitHandler<IncludeDeductionsPayload> = data => {\n if (data.includeDeductions === 'Yes') {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_INCLUDE_YES)\n } else {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_INCLUDE_NO)\n }\n }\n\n return (\n <section className={className}>\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n {children ? (\n children\n ) : (\n <>\n <Components.Heading as=\"h2\">{t('pageTitle')}</Components.Heading>\n <RadioGroupField\n name=\"includeDeductions\"\n isRequired\n label={t('includeDeductionsFormLabel')}\n description={t('includeDeductionsDescription')}\n options={[\n { value: 'Yes', label: t('includeDeductionsYes') },\n { value: 'No', label: t('includeDeductionsNo') },\n ]}\n />\n <ActionsLayout>\n <Components.Button type=\"submit\">{t('continueCta')}</Components.Button>\n </ActionsLayout>\n </>\n )}\n </Form>\n </FormProvider>\n </section>\n )\n}\n"],"names":["IncludeDeductionsSchema","z","IncludeDeductionsForm","props","jsx","BaseComponent","Root","className","children","dictionary","onEvent","useBase","t","useTranslation","Components","useComponentContext","useComponentDictionary","useI18n","formMethods","useForm","zodResolver","onSubmit","data","componentEvents","FormProvider","Form","jsxs","Fragment","RadioGroupField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;AAkBA,MAAMA,IAA0BC,EAAE,OAAO,EAAE,mBAAmBA,EAAE,KAAK,CAAC,OAAO,IAAI,CAAC,GAAG;AAO9E,SAASC,EAAsBC,GAA4D;AAChG,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,SAASG,EAAK,EAAE,WAAAC,GAAW,UAAAC,GAAU,YAAAC,KAA0C;AAC7E,QAAM,EAAE,SAAAC,EAAA,IAAYC,EAAA,GACd,EAAE,GAAAC,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA;AAEnB,EAAAC,EAAuB,uBAAuBP,CAAU,GACxDQ,EAAQ,qBAAqB;AAE7B,QAAMC,IAAcC,EAAkC;AAAA,IACpD,UAAUC,EAAYpB,CAAuB;AAAA,IAC7C,eAAe,EAAE,mBAAmB,KAAA;AAAA,EAAK,CAC1C,GAEKqB,IAAoD,CAAAC,MAAQ;AAChE,IAAIA,EAAK,sBAAsB,QAC7BZ,EAAQa,EAAgB,8BAA8B,IAEtDb,EAAQa,EAAgB,6BAA6B;AAAA,EAEzD;AAEA,2BACG,WAAA,EAAQ,WAAAhB,GACP,UAAA,gBAAAH,EAACoB,GAAA,EAAc,GAAGN,GAChB,UAAA,gBAAAd,EAACqB,GAAA,EAAK,UAAUP,EAAY,aAAaG,CAAQ,GAC9C,UAAAb,KAGC,gBAAAkB,EAAAC,GAAA,EACE,UAAA;AAAA,IAAA,gBAAAvB,EAACU,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAAF,EAAE,WAAW,GAAE;AAAA,IAC5C,gBAAAR;AAAA,MAACwB;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,YAAU;AAAA,QACV,OAAOhB,EAAE,4BAA4B;AAAA,QACrC,aAAaA,EAAE,8BAA8B;AAAA,QAC7C,SAAS;AAAA,UACP,EAAE,OAAO,OAAO,OAAOA,EAAE,sBAAsB,EAAA;AAAA,UAC/C,EAAE,OAAO,MAAM,OAAOA,EAAE,qBAAqB,EAAA;AAAA,QAAE;AAAA,MACjD;AAAA,IAAA;AAAA,IAEF,gBAAAR,EAACyB,GAAA,EACC,UAAA,gBAAAzB,EAACU,EAAW,QAAX,EAAkB,MAAK,UAAU,UAAAF,EAAE,aAAa,EAAA,CAAE,EAAA,CACrD;AAAA,EAAA,GACF,EAAA,CAEJ,GACF,GACF;AAEJ;"}
1
+ {"version":3,"file":"IncludeDeductionsForm.js","sources":["../../../../../src/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { FormProvider, useForm, type SubmitHandler } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { Form } from '@/components/Common/Form'\nimport { RadioGroupField } from '@/components/Common'\nimport { ActionsLayout } from '@/components/Common'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\nconst IncludeDeductionsSchema = z.object({ includeDeductions: z.enum(['Yes', 'No']) })\nexport type IncludeDeductionsPayload = z.output<typeof IncludeDeductionsSchema>\n\ninterface IncludeDeductionsFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n}\n\nexport function IncludeDeductionsForm(props: IncludeDeductionsFormProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ className, children, dictionary }: IncludeDeductionsFormProps) {\n const { onEvent } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n useComponentDictionary('Employee.Deductions', dictionary)\n useI18n('Employee.Deductions')\n\n const formMethods = useForm<IncludeDeductionsPayload>({\n resolver: zodResolver(IncludeDeductionsSchema),\n defaultValues: { includeDeductions: 'No' },\n })\n\n const onSubmit: SubmitHandler<IncludeDeductionsPayload> = data => {\n if (data.includeDeductions === 'Yes') {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_INCLUDE_YES)\n } else {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_INCLUDE_NO)\n }\n }\n\n return (\n <section className={className}>\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n {children ? (\n children\n ) : (\n <>\n <Components.Heading as=\"h2\">{t('pageTitle')}</Components.Heading>\n <RadioGroupField\n name=\"includeDeductions\"\n isRequired\n label={t('includeDeductionsFormLabel')}\n description={t('includeDeductionsDescription')}\n options={[\n { value: 'Yes', label: t('includeDeductionsYes') },\n { value: 'No', label: t('includeDeductionsNo') },\n ]}\n />\n <ActionsLayout>\n <Components.Button type=\"submit\">{t('continueCta')}</Components.Button>\n </ActionsLayout>\n </>\n )}\n </Form>\n </FormProvider>\n </section>\n )\n}\n"],"names":["IncludeDeductionsSchema","z","IncludeDeductionsForm","props","jsx","BaseComponent","Root","className","children","dictionary","onEvent","useBase","t","useTranslation","Components","useComponentContext","useComponentDictionary","useI18n","formMethods","useForm","zodResolver","onSubmit","data","componentEvents","FormProvider","Form","jsxs","Fragment","RadioGroupField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;AAkBA,MAAMA,IAA0BC,EAAE,OAAO,EAAE,mBAAmBA,EAAE,KAAK,CAAC,OAAO,IAAI,CAAC,GAAG;AAO9E,SAASC,EAAsBC,GAA4D;AAChG,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,SAASG,EAAK,EAAE,WAAAC,GAAW,UAAAC,GAAU,YAAAC,KAA0C;AAC7E,QAAM,EAAE,SAAAC,EAAA,IAAYC,EAAA,GACd,EAAE,GAAAC,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA;AAEnB,EAAAC,EAAuB,uBAAuBP,CAAU,GACxDQ,EAAQ,qBAAqB;AAE7B,QAAMC,IAAcC,EAAkC;AAAA,IACpD,UAAUC,EAAYpB,CAAuB;AAAA,IAC7C,eAAe,EAAE,mBAAmB,KAAA;AAAA,EAAK,CAC1C,GAEKqB,IAAoD,CAAAC,MAAQ;AAChE,IAAIA,EAAK,sBAAsB,QAC7BZ,EAAQa,EAAgB,8BAA8B,IAEtDb,EAAQa,EAAgB,6BAA6B;AAAA,EAEzD;AAEA,2BACG,WAAA,EAAQ,WAAAhB,GACP,UAAA,gBAAAH,EAACoB,GAAA,EAAc,GAAGN,GAChB,UAAA,gBAAAd,EAACqB,GAAA,EAAK,UAAUP,EAAY,aAAaG,CAAQ,GAC9C,UAAAb,KAGC,gBAAAkB,EAAAC,GAAA,EACE,UAAA;AAAA,IAAA,gBAAAvB,EAACU,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAAF,EAAE,WAAW,GAAE;AAAA,IAC5C,gBAAAR;AAAA,MAACwB;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,YAAU;AAAA,QACV,OAAOhB,EAAE,4BAA4B;AAAA,QACrC,aAAaA,EAAE,8BAA8B;AAAA,QAC7C,SAAS;AAAA,UACP,EAAE,OAAO,OAAO,OAAOA,EAAE,sBAAsB,EAAA;AAAA,UAC/C,EAAE,OAAO,MAAM,OAAOA,EAAE,qBAAqB,EAAA;AAAA,QAAE;AAAA,MACjD;AAAA,IAAA;AAAA,IAEF,gBAAAR,EAACyB,GAAA,EACC,UAAA,gBAAAzB,EAACU,EAAW,QAAX,EAAkB,MAAK,UAAU,UAAAF,EAAE,aAAa,EAAA,CAAE,EAAA,CACrD;AAAA,EAAA,GACF,EAAA,CAEJ,GACF,GACF;AAEJ;"}
@@ -1,14 +1,16 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
2
  import { useTranslation as r } from "react-i18next";
3
- import { useDocumentList as s } from "./useDocumentList.js";
3
+ import { useDocumentList as m } from "./useDocumentList.js";
4
4
  import "classnames";
5
- import { ActionsLayout as m } from "../../../Common/ActionsLayout/ActionsLayout.js";
5
+ import "../../../../shared/constants.js";
6
+ import { ActionsLayout as s } from "../../../Common/ActionsLayout/ActionsLayout.js";
6
7
  import { useComponentContext as c } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
7
- function C() {
8
- const { t: n } = r("Employee.DocumentSigner"), { handleContinue: t, hasSignedAllForms: i } = s(), e = c();
9
- return /* @__PURE__ */ o(m, { children: /* @__PURE__ */ o(e.Button, { onClick: t, isLoading: !1, isDisabled: !i, children: n("continueCta") }) });
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") }) });
10
12
  }
11
13
  export {
12
- C as Actions
14
+ g as Actions
13
15
  };
14
16
  //# 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","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
+ {"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;"}
@@ -9,9 +9,11 @@ import { useBase as L } from "../../../Base/useBase.js";
9
9
  import { useI18n as S } from "../../../../i18n/I18n.js";
10
10
  import { componentEvents as m } from "../../../../shared/constants.js";
11
11
  import { Flex as g } from "../../../Common/Flex/Flex.js";
12
- import "react-i18next";
13
12
  import "classnames";
14
- function N(e) {
13
+ import "react-i18next";
14
+ import "../../../../contexts/ComponentAdapter/useComponentContext.js";
15
+ import "react";
16
+ function G(e) {
15
17
  return /* @__PURE__ */ o(F, { ...e, children: /* @__PURE__ */ o(O, { ...e }) });
16
18
  }
17
19
  function O({ employeeId: e, className: s, children: t }) {
@@ -40,6 +42,6 @@ function O({ employeeId: e, className: s, children: t }) {
40
42
  ) });
41
43
  }
42
44
  export {
43
- N as DocumentList
45
+ G as DocumentList
44
46
  };
45
47
  //# sourceMappingURL=DocumentList.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentList.js","sources":["../../../../../src/components/Employee/DocumentSigner/DocumentList/DocumentList.tsx"],"sourcesContent":["import { useEmployeeFormsListSuspense } from '@gusto/embedded-api/react-query/employeeFormsList'\nimport { type Form } from '@gusto/embedded-api/models/components/form'\nimport { Head } from './Head'\nimport { List } from './List'\nimport { Actions } from './Actions'\nimport { DocumentListProvider } from './useDocumentList'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { Flex } from '@/components/Common'\n\ninterface DocumentListProps extends CommonComponentInterface {\n employeeId: string\n}\n\nexport function DocumentList(props: DocumentListProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nfunction Root({ employeeId, className, children }: DocumentListProps) {\n useI18n('Employee.DocumentSigner')\n const { onEvent } = useBase()\n\n const { data, error: documentListError } = useEmployeeFormsListSuspense({ employeeId })\n const employeeForms = data.formList!\n\n const hasSignedAllForms = employeeForms.every(employeeForm => !employeeForm.requiresSigning)\n\n const handleRequestFormToSign = (data: Form) => {\n onEvent(componentEvents.EMPLOYEE_VIEW_FORM_TO_SIGN, { uuid: data.uuid })\n }\n\n const handleContinue = () => {\n onEvent(componentEvents.EMPLOYEE_FORMS_DONE)\n }\n\n return (\n <section className={className}>\n <DocumentListProvider\n value={{\n employeeForms,\n hasSignedAllForms,\n handleContinue,\n handleRequestFormToSign,\n documentListError,\n }}\n >\n {children ? (\n children\n ) : (\n <Flex flexDirection=\"column\">\n <Head />\n <List />\n <Actions />\n </Flex>\n )}\n </DocumentListProvider>\n </section>\n )\n}\n"],"names":["DocumentList","props","jsx","BaseComponent","Root","employeeId","className","children","useI18n","onEvent","useBase","data","documentListError","useEmployeeFormsListSuspense","employeeForms","hasSignedAllForms","employeeForm","DocumentListProvider","componentEvents","jsxs","Flex","Head","List","Actions"],"mappings":";;;;;;;;;;;;;AAoBO,SAASA,EAAaC,GAAmD;AAC9E,SACE,gBAAAC,EAACC,KAAe,GAAGF,GACjB,4BAACG,GAAA,EAAM,GAAGH,GAAO,EAAA,CACnB;AAEJ;AAEA,SAASG,EAAK,EAAE,YAAAC,GAAY,WAAAC,GAAW,UAAAC,KAA+B;AACpE,EAAAC,EAAQ,yBAAyB;AACjC,QAAM,EAAE,SAAAC,EAAA,IAAYC,EAAA,GAEd,EAAE,MAAAC,GAAM,OAAOC,EAAA,IAAsBC,EAA6B,EAAE,YAAAR,GAAY,GAChFS,IAAgBH,EAAK,UAErBI,IAAoBD,EAAc,MAAM,CAAAE,MAAgB,CAACA,EAAa,eAAe;AAU3F,SACE,gBAAAd,EAAC,aAAQ,WAAAI,GACP,UAAA,gBAAAJ;AAAA,IAACe;AAAA,IAAA;AAAA,MACC,OAAO;AAAA,QACL,eAAAH;AAAA,QACA,mBAAAC;AAAA,QACA,gBAVe,MAAM;AAC3B,UAAAN,EAAQS,EAAgB,mBAAmB;AAAA,QAC7C;AAAA,QASQ,yBAfwB,CAACP,MAAe;AAC9C,UAAAF,EAAQS,EAAgB,4BAA4B,EAAE,MAAMP,EAAK,MAAM;AAAA,QACzE;AAAA,QAcQ,mBAAAC;AAAA,MAAA;AAAA,MAGD,UAAAL,KAGC,gBAAAY,EAACC,GAAA,EAAK,eAAc,UAClB,UAAA;AAAA,QAAA,gBAAAlB,EAACmB,GAAA,EAAK;AAAA,0BACLC,GAAA,EAAK;AAAA,0BACLC,GAAA,CAAA,CAAQ;AAAA,MAAA,EAAA,CACX;AAAA,IAAA;AAAA,EAAA,GAGN;AAEJ;"}
1
+ {"version":3,"file":"DocumentList.js","sources":["../../../../../src/components/Employee/DocumentSigner/DocumentList/DocumentList.tsx"],"sourcesContent":["import { useEmployeeFormsListSuspense } from '@gusto/embedded-api/react-query/employeeFormsList'\nimport { type Form } from '@gusto/embedded-api/models/components/form'\nimport { Head } from './Head'\nimport { List } from './List'\nimport { Actions } from './Actions'\nimport { DocumentListProvider } from './useDocumentList'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { Flex } from '@/components/Common'\n\ninterface DocumentListProps extends CommonComponentInterface {\n employeeId: string\n}\n\nexport function DocumentList(props: DocumentListProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nfunction Root({ employeeId, className, children }: DocumentListProps) {\n useI18n('Employee.DocumentSigner')\n const { onEvent } = useBase()\n\n const { data, error: documentListError } = useEmployeeFormsListSuspense({ employeeId })\n const employeeForms = data.formList!\n\n const hasSignedAllForms = employeeForms.every(employeeForm => !employeeForm.requiresSigning)\n\n const handleRequestFormToSign = (data: Form) => {\n onEvent(componentEvents.EMPLOYEE_VIEW_FORM_TO_SIGN, { uuid: data.uuid })\n }\n\n const handleContinue = () => {\n onEvent(componentEvents.EMPLOYEE_FORMS_DONE)\n }\n\n return (\n <section className={className}>\n <DocumentListProvider\n value={{\n employeeForms,\n hasSignedAllForms,\n handleContinue,\n handleRequestFormToSign,\n documentListError,\n }}\n >\n {children ? (\n children\n ) : (\n <Flex flexDirection=\"column\">\n <Head />\n <List />\n <Actions />\n </Flex>\n )}\n </DocumentListProvider>\n </section>\n )\n}\n"],"names":["DocumentList","props","jsx","BaseComponent","Root","employeeId","className","children","useI18n","onEvent","useBase","data","documentListError","useEmployeeFormsListSuspense","employeeForms","hasSignedAllForms","employeeForm","DocumentListProvider","componentEvents","jsxs","Flex","Head","List","Actions"],"mappings":";;;;;;;;;;;;;;;AAoBO,SAASA,EAAaC,GAAmD;AAC9E,SACE,gBAAAC,EAACC,KAAe,GAAGF,GACjB,4BAACG,GAAA,EAAM,GAAGH,GAAO,EAAA,CACnB;AAEJ;AAEA,SAASG,EAAK,EAAE,YAAAC,GAAY,WAAAC,GAAW,UAAAC,KAA+B;AACpE,EAAAC,EAAQ,yBAAyB;AACjC,QAAM,EAAE,SAAAC,EAAA,IAAYC,EAAA,GAEd,EAAE,MAAAC,GAAM,OAAOC,EAAA,IAAsBC,EAA6B,EAAE,YAAAR,GAAY,GAChFS,IAAgBH,EAAK,UAErBI,IAAoBD,EAAc,MAAM,CAAAE,MAAgB,CAACA,EAAa,eAAe;AAU3F,SACE,gBAAAd,EAAC,aAAQ,WAAAI,GACP,UAAA,gBAAAJ;AAAA,IAACe;AAAA,IAAA;AAAA,MACC,OAAO;AAAA,QACL,eAAAH;AAAA,QACA,mBAAAC;AAAA,QACA,gBAVe,MAAM;AAC3B,UAAAN,EAAQS,EAAgB,mBAAmB;AAAA,QAC7C;AAAA,QASQ,yBAfwB,CAACP,MAAe;AAC9C,UAAAF,EAAQS,EAAgB,4BAA4B,EAAE,MAAMP,EAAK,MAAM;AAAA,QACzE;AAAA,QAcQ,mBAAAC;AAAA,MAAA;AAAA,MAGD,UAAAL,KAGC,gBAAAY,EAACC,GAAA,EAAK,eAAc,UAClB,UAAA;AAAA,QAAA,gBAAAlB,EAACmB,GAAA,EAAK;AAAA,0BACLC,GAAA,EAAK;AAAA,0BACLC,GAAA,CAAA,CAAQ;AAAA,MAAA,EAAA,CACX;AAAA,IAAA;AAAA,EAAA,GAGN;AAEJ;"}
@@ -3,8 +3,11 @@ import { useTranslation as m } from "react-i18next";
3
3
  import { useDocumentList as s } from "./useDocumentList.js";
4
4
  import { Flex as l } from "../../../Common/Flex/Flex.js";
5
5
  import "classnames";
6
+ import "../../../../shared/constants.js";
7
+ import "../../../../contexts/ComponentAdapter/useComponentContext.js";
8
+ import "react";
6
9
  import { DocumentList as u } from "../../../Common/DocumentList/DocumentList.js";
7
- function b() {
10
+ function D() {
8
11
  const { employeeForms: i, handleRequestFormToSign: n, documentListError: r } = s(), { t: e } = m("Employee.DocumentSigner");
9
12
  return /* @__PURE__ */ o("section", { style: { width: "100%" }, children: /* @__PURE__ */ o(l, { flexDirection: "column", gap: 32, children: /* @__PURE__ */ o(
10
13
  u,
@@ -33,6 +36,6 @@ function b() {
33
36
  ) }) });
34
37
  }
35
38
  export {
36
- b as List
39
+ D as List
37
40
  };
38
41
  //# sourceMappingURL=List.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"List.js","sources":["../../../../../src/components/Employee/DocumentSigner/DocumentList/List.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useDocumentList } from './useDocumentList'\nimport { Flex, DocumentList as SharedDocumentList } from '@/components/Common'\n\nexport function List() {\n const { employeeForms, handleRequestFormToSign, documentListError } = useDocumentList()\n const { t } = useTranslation('Employee.DocumentSigner')\n\n return (\n <section style={{ width: '100%' }}>\n <Flex flexDirection=\"column\" gap={32}>\n <SharedDocumentList\n forms={employeeForms.map(form => ({\n uuid: form.uuid,\n title: form.title,\n description: form.description,\n requires_signing: form.requiresSigning,\n }))}\n onRequestSign={handleRequestFormToSign}\n withError={!!documentListError}\n label={t('documentListLabel')}\n columnLabels={{\n form: t('formColumnLabel'),\n action: t('actionColumnLabel'),\n }}\n statusLabels={{\n signCta: t('signDocumentCta'),\n notSigned: t('notSigned'),\n complete: t('signDocumentComplete'),\n }}\n emptyStateLabel={t('emptyTableTitle')}\n errorLabel={t('documentListError')}\n />\n </Flex>\n </section>\n )\n}\n"],"names":["List","employeeForms","handleRequestFormToSign","documentListError","useDocumentList","t","useTranslation","jsx","Flex","SharedDocumentList","form"],"mappings":";;;;;;AAIO,SAASA,IAAO;AACrB,QAAM,EAAE,eAAAC,GAAe,yBAAAC,GAAyB,mBAAAC,EAAA,IAAsBC,EAAA,GAChE,EAAE,GAAAC,EAAA,IAAMC,EAAe,yBAAyB;AAEtD,SACE,gBAAAC,EAAC,WAAA,EAAQ,OAAO,EAAE,OAAO,UACvB,UAAA,gBAAAA,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA,gBAAAD;AAAA,IAACE;AAAAA,IAAA;AAAA,MACC,OAAOR,EAAc,IAAI,CAAAS,OAAS;AAAA,QAChC,MAAMA,EAAK;AAAA,QACX,OAAOA,EAAK;AAAA,QACZ,aAAaA,EAAK;AAAA,QAClB,kBAAkBA,EAAK;AAAA,MAAA,EACvB;AAAA,MACF,eAAeR;AAAA,MACf,WAAW,CAAC,CAACC;AAAA,MACb,OAAOE,EAAE,mBAAmB;AAAA,MAC5B,cAAc;AAAA,QACZ,MAAMA,EAAE,iBAAiB;AAAA,QACzB,QAAQA,EAAE,mBAAmB;AAAA,MAAA;AAAA,MAE/B,cAAc;AAAA,QACZ,SAASA,EAAE,iBAAiB;AAAA,QAC5B,WAAWA,EAAE,WAAW;AAAA,QACxB,UAAUA,EAAE,sBAAsB;AAAA,MAAA;AAAA,MAEpC,iBAAiBA,EAAE,iBAAiB;AAAA,MACpC,YAAYA,EAAE,mBAAmB;AAAA,IAAA;AAAA,EAAA,GAErC,EAAA,CACF;AAEJ;"}
1
+ {"version":3,"file":"List.js","sources":["../../../../../src/components/Employee/DocumentSigner/DocumentList/List.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useDocumentList } from './useDocumentList'\nimport { Flex, DocumentList as SharedDocumentList } from '@/components/Common'\n\nexport function List() {\n const { employeeForms, handleRequestFormToSign, documentListError } = useDocumentList()\n const { t } = useTranslation('Employee.DocumentSigner')\n\n return (\n <section style={{ width: '100%' }}>\n <Flex flexDirection=\"column\" gap={32}>\n <SharedDocumentList\n forms={employeeForms.map(form => ({\n uuid: form.uuid,\n title: form.title,\n description: form.description,\n requires_signing: form.requiresSigning,\n }))}\n onRequestSign={handleRequestFormToSign}\n withError={!!documentListError}\n label={t('documentListLabel')}\n columnLabels={{\n form: t('formColumnLabel'),\n action: t('actionColumnLabel'),\n }}\n statusLabels={{\n signCta: t('signDocumentCta'),\n notSigned: t('notSigned'),\n complete: t('signDocumentComplete'),\n }}\n emptyStateLabel={t('emptyTableTitle')}\n errorLabel={t('documentListError')}\n />\n </Flex>\n </section>\n )\n}\n"],"names":["List","employeeForms","handleRequestFormToSign","documentListError","useDocumentList","t","useTranslation","jsx","Flex","SharedDocumentList","form"],"mappings":";;;;;;;;;AAIO,SAASA,IAAO;AACrB,QAAM,EAAE,eAAAC,GAAe,yBAAAC,GAAyB,mBAAAC,EAAA,IAAsBC,EAAA,GAChE,EAAE,GAAAC,EAAA,IAAMC,EAAe,yBAAyB;AAEtD,SACE,gBAAAC,EAAC,WAAA,EAAQ,OAAO,EAAE,OAAO,UACvB,UAAA,gBAAAA,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA,gBAAAD;AAAA,IAACE;AAAAA,IAAA;AAAA,MACC,OAAOR,EAAc,IAAI,CAAAS,OAAS;AAAA,QAChC,MAAMA,EAAK;AAAA,QACX,OAAOA,EAAK;AAAA,QACZ,aAAaA,EAAK;AAAA,QAClB,kBAAkBA,EAAK;AAAA,MAAA,EACvB;AAAA,MACF,eAAeR;AAAA,MACf,WAAW,CAAC,CAACC;AAAA,MACb,OAAOE,EAAE,mBAAmB;AAAA,MAC5B,cAAc;AAAA,QACZ,MAAMA,EAAE,iBAAiB;AAAA,QACzB,QAAQA,EAAE,mBAAmB;AAAA,MAAA;AAAA,MAE/B,cAAc;AAAA,QACZ,SAASA,EAAE,iBAAiB;AAAA,QAC5B,WAAWA,EAAE,WAAW;AAAA,QACxB,UAAUA,EAAE,sBAAsB;AAAA,MAAA;AAAA,MAEpC,iBAAiBA,EAAE,iBAAiB;AAAA,MACpC,YAAYA,EAAE,mBAAmB;AAAA,IAAA;AAAA,EAAA,GAErC,EAAA,CACF;AAEJ;"}