@gusto/embedded-react-sdk 0.12.1 → 0.12.3

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 (298) hide show
  1. package/CHANGELOG.md +133 -0
  2. package/dist/_virtual/dynamic-import-helper.js +1 -8
  3. package/dist/_virtual/dynamic-import-helper.js.map +1 -1
  4. package/dist/components/Base/Base.js +23 -22
  5. package/dist/components/Base/Base.js.map +1 -1
  6. package/dist/components/Common/ReorderableList/DropZone.js +1 -1
  7. package/dist/components/Common/ReorderableList/DropZone.js.map +1 -1
  8. package/dist/components/Common/ReorderableList/ReorderableItem.js +1 -1
  9. package/dist/components/Common/ReorderableList/ReorderableItem.js.map +1 -1
  10. package/dist/components/Common/SignatureForm/SignatureForm.js +7 -5
  11. package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
  12. package/dist/components/Common/SignatureForm/SignatureFormActions.js +12 -10
  13. package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
  14. package/dist/components/Common/SignatureForm/SignatureFormFields.js +8 -6
  15. package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
  16. package/dist/components/Common/UI/CalendarPreview/CalendarPreview.js +1 -1
  17. package/dist/components/Common/UI/DatePicker/DatePicker.js +1 -1
  18. package/dist/components/Common/hooks/useNumberFormatter.js +1 -1
  19. package/dist/components/Company/AssignSignatory/AssignSignatory.js +4 -3
  20. package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
  21. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +8 -6
  22. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
  23. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +10 -8
  24. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
  25. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +5 -5
  26. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +11 -11
  27. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +4 -8
  28. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  29. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +8 -6
  30. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
  31. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +4 -4
  32. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +1 -1
  33. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +4 -8
  34. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  35. package/dist/components/Company/AssignSignatory/TitleSelect.js +8 -7
  36. package/dist/components/Company/AssignSignatory/TitleSelect.js.map +1 -1
  37. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +6 -10
  38. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  39. package/dist/components/Company/BankAccount/BankAccount.js +1 -1
  40. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +9 -8
  41. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
  42. package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js +2 -2
  43. package/dist/components/Company/BankAccount/BankAccountForm/Form.js +11 -9
  44. package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
  45. package/dist/components/Company/BankAccount/BankAccountForm/context.js +4 -8
  46. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  47. package/dist/components/Company/BankAccount/BankAccountList/Actions.js +12 -10
  48. package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
  49. package/dist/components/Company/BankAccount/BankAccountList/BankAccountList.js +1 -1
  50. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +13 -11
  51. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
  52. package/dist/components/Company/BankAccount/BankAccountVerify/BankAccountVerify.js +2 -2
  53. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +6 -4
  54. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
  55. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +7 -5
  56. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
  57. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +9 -8
  58. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  59. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +4 -8
  60. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  61. package/dist/components/Company/DocumentSigner/DocumentSigner.js +1 -1
  62. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +6 -5
  63. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  64. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +4 -8
  65. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  66. package/dist/components/Company/FederalTaxes/Actions.js +9 -7
  67. package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
  68. package/dist/components/Company/FederalTaxes/FederalTaxes.js +10 -9
  69. package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
  70. package/dist/components/Company/FederalTaxes/Form.js +6 -4
  71. package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
  72. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +12 -16
  73. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  74. package/dist/components/Company/Industry/Actions.js +7 -5
  75. package/dist/components/Company/Industry/Actions.js.map +1 -1
  76. package/dist/components/Company/Industry/Context.js +7 -11
  77. package/dist/components/Company/Industry/Context.js.map +1 -1
  78. package/dist/components/Company/Industry/Edit.js +12 -10
  79. package/dist/components/Company/Industry/Edit.js.map +1 -1
  80. package/dist/components/Company/Industry/Industry.js +2 -2
  81. package/dist/components/Company/Locations/LocationForm/Actions.js +8 -6
  82. package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
  83. package/dist/components/Company/Locations/LocationForm/Form.js +1 -1
  84. package/dist/components/Company/Locations/LocationForm/LocationForm.js +8 -7
  85. package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
  86. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +4 -8
  87. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  88. package/dist/components/Company/Locations/LocationsList/Actions.js +8 -6
  89. package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
  90. package/dist/components/Company/Locations/LocationsList/List.js +4 -2
  91. package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
  92. package/dist/components/Company/Locations/LocationsList/LocationsList.js +10 -9
  93. package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
  94. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +4 -8
  95. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  96. package/dist/components/Company/OnboardingOverview/Completed.js +14 -12
  97. package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
  98. package/dist/components/Company/OnboardingOverview/MissingRequirements.js +8 -6
  99. package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
  100. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +4 -3
  101. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
  102. package/dist/components/Company/OnboardingOverview/context.js +4 -8
  103. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  104. package/dist/components/Company/PaySchedule/PaySchedule.js +9 -8
  105. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  106. package/dist/components/Company/PaySchedule/_parts/Actions.js +12 -10
  107. package/dist/components/Company/PaySchedule/_parts/Actions.js.map +1 -1
  108. package/dist/components/Company/PaySchedule/_parts/Edit.js +14 -14
  109. package/dist/components/Company/PaySchedule/_parts/Head.js +8 -6
  110. package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
  111. package/dist/components/Company/PaySchedule/_parts/List.js +15 -13
  112. package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
  113. package/dist/components/Company/PaySchedule/usePaySchedule.js +7 -11
  114. package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
  115. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +7 -5
  116. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
  117. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +3 -3
  118. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +4 -8
  119. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  120. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +8 -6
  121. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
  122. package/dist/components/Company/StateTaxes/StateTaxesList/List.js +7 -5
  123. package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
  124. package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.js +1 -1
  125. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +4 -8
  126. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  127. package/dist/components/Contractor/Address/Address.js +9 -8
  128. package/dist/components/Contractor/Address/Address.js.map +1 -1
  129. package/dist/components/Contractor/Address/Form.js +1 -1
  130. package/dist/components/Contractor/Address/useAddress.js +6 -10
  131. package/dist/components/Contractor/Address/useAddress.js.map +1 -1
  132. package/dist/components/Contractor/ContractorList/index.js +26 -25
  133. package/dist/components/Contractor/ContractorList/index.js.map +1 -1
  134. package/dist/components/Contractor/ContractorList/useContractorList.js +1 -1
  135. package/dist/components/Contractor/NewHireReport/NewHireReport.js +20 -19
  136. package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
  137. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +7 -5
  138. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -1
  139. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +87 -85
  140. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -1
  141. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +3 -2
  142. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js.map +1 -1
  143. package/dist/components/Contractor/Profile/ContractorProfile.js +1 -1
  144. package/dist/components/Contractor/Profile/ContractorProfileForm.js +13 -13
  145. package/dist/components/Contractor/Profile/useContractorProfile.js +36 -40
  146. package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
  147. package/dist/components/Contractor/Submit/Submit.js +7 -6
  148. package/dist/components/Contractor/Submit/Submit.js.map +1 -1
  149. package/dist/components/Employee/Compensation/Actions.js +6 -5
  150. package/dist/components/Employee/Compensation/Actions.js.map +1 -1
  151. package/dist/components/Employee/Compensation/Compensation.js +10 -10
  152. package/dist/components/Employee/Compensation/Compensation.js.map +1 -1
  153. package/dist/components/Employee/Compensation/Edit.js +15 -14
  154. package/dist/components/Employee/Compensation/Edit.js.map +1 -1
  155. package/dist/components/Employee/Compensation/List.js +25 -23
  156. package/dist/components/Employee/Compensation/List.js.map +1 -1
  157. package/dist/components/Employee/Compensation/useCompensation.js +1 -1
  158. package/dist/components/Employee/Compensation/useCompensation.js.map +1 -1
  159. package/dist/components/Employee/Deductions/Deductions.js +1 -1
  160. package/dist/components/Employee/Deductions/Deductions.js.map +1 -1
  161. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js +15 -14
  162. package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js.map +1 -1
  163. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +10 -9
  164. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js.map +1 -1
  165. package/dist/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.js +12 -11
  166. package/dist/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.js.map +1 -1
  167. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +8 -6
  168. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
  169. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +8 -7
  170. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  171. package/dist/components/Employee/DocumentSigner/DocumentList/List.js +4 -2
  172. package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
  173. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +4 -8
  174. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  175. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +11 -10
  176. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  177. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +4 -8
  178. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  179. package/dist/components/Employee/EmployeeList/Actions.js +6 -4
  180. package/dist/components/Employee/EmployeeList/Actions.js.map +1 -1
  181. package/dist/components/Employee/EmployeeList/EmployeeList.js +7 -6
  182. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  183. package/dist/components/Employee/EmployeeList/Head.js +7 -5
  184. package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
  185. package/dist/components/Employee/EmployeeList/List.js +15 -14
  186. package/dist/components/Employee/EmployeeList/List.js.map +1 -1
  187. package/dist/components/Employee/EmployeeList/useEmployeeList.js +4 -8
  188. package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
  189. package/dist/components/Employee/FederalTaxes/Actions.d.ts +1 -0
  190. package/dist/components/Employee/FederalTaxes/Actions.js +15 -0
  191. package/dist/components/Employee/FederalTaxes/Actions.js.map +1 -0
  192. package/dist/components/Employee/FederalTaxes/FederalForm.d.ts +29 -0
  193. package/dist/components/Employee/FederalTaxes/FederalForm.js +110 -0
  194. package/dist/components/Employee/FederalTaxes/FederalForm.js.map +1 -0
  195. package/dist/components/Employee/FederalTaxes/FederalTaxes.d.ts +6 -0
  196. package/dist/components/Employee/FederalTaxes/FederalTaxes.js +72 -0
  197. package/dist/components/Employee/FederalTaxes/FederalTaxes.js.map +1 -0
  198. package/dist/components/Employee/FederalTaxes/Head.d.ts +1 -0
  199. package/dist/components/Employee/FederalTaxes/Head.js +24 -0
  200. package/dist/components/Employee/FederalTaxes/Head.js.map +1 -0
  201. package/dist/components/Employee/FederalTaxes/index.d.ts +2 -0
  202. package/dist/components/Employee/FederalTaxes/useFederalTaxes.d.ts +5 -0
  203. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +16 -0
  204. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -0
  205. package/dist/components/Employee/Landing/Landing.js +15 -14
  206. package/dist/components/Employee/Landing/Landing.js.map +1 -1
  207. package/dist/components/Employee/OnboardingFlow/OnboardingFlow.d.ts +1 -19
  208. package/dist/components/Employee/OnboardingFlow/OnboardingFlow.js.map +1 -1
  209. package/dist/components/Employee/OnboardingFlow/OnboardingFlowComponents.d.ts +22 -0
  210. package/dist/components/Employee/OnboardingFlow/OnboardingFlowComponents.js +18 -0
  211. package/dist/components/Employee/OnboardingFlow/OnboardingFlowComponents.js.map +1 -0
  212. package/dist/components/Employee/OnboardingFlow/onboardingStateMachine.d.ts +2 -1
  213. package/dist/components/Employee/OnboardingFlow/onboardingStateMachine.js +72 -63
  214. package/dist/components/Employee/OnboardingFlow/onboardingStateMachine.js.map +1 -1
  215. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +9 -9
  216. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js.map +1 -1
  217. package/dist/components/Employee/PaymentMethod/Actions.js +9 -7
  218. package/dist/components/Employee/PaymentMethod/Actions.js.map +1 -1
  219. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +6 -5
  220. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js.map +1 -1
  221. package/dist/components/Employee/PaymentMethod/BankAccountsList.js +10 -8
  222. package/dist/components/Employee/PaymentMethod/BankAccountsList.js.map +1 -1
  223. package/dist/components/Employee/PaymentMethod/PaymentMethod.js +8 -8
  224. package/dist/components/Employee/PaymentMethod/PaymentMethod.js.map +1 -1
  225. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +3 -2
  226. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +1 -1
  227. package/dist/components/Employee/PaymentMethod/Split.js +12 -11
  228. package/dist/components/Employee/PaymentMethod/Split.js.map +1 -1
  229. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +10 -14
  230. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
  231. package/dist/components/Employee/Profile/Actions.js +9 -7
  232. package/dist/components/Employee/Profile/Actions.js.map +1 -1
  233. package/dist/components/Employee/Profile/AdminPersonalDetails.js +10 -9
  234. package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
  235. package/dist/components/Employee/Profile/HomeAddress.js +1 -1
  236. package/dist/components/Employee/Profile/PersonalDetailsInputs.js +2 -2
  237. package/dist/components/Employee/Profile/Profile.js +13 -13
  238. package/dist/components/Employee/Profile/Profile.js.map +1 -1
  239. package/dist/components/Employee/Profile/useProfile.js +4 -8
  240. package/dist/components/Employee/Profile/useProfile.js.map +1 -1
  241. package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingComponents.d.ts +2 -1
  242. package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingComponents.js +37 -24
  243. package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingComponents.js.map +1 -1
  244. package/dist/components/Employee/SelfOnboardingFlow/selfOnboardingMachine.d.ts +2 -1
  245. package/dist/components/Employee/SelfOnboardingFlow/selfOnboardingMachine.js +31 -19
  246. package/dist/components/Employee/SelfOnboardingFlow/selfOnboardingMachine.js.map +1 -1
  247. package/dist/components/Employee/StateTaxes/Actions.d.ts +1 -0
  248. package/dist/components/Employee/StateTaxes/Actions.js +15 -0
  249. package/dist/components/Employee/StateTaxes/Actions.js.map +1 -0
  250. package/dist/components/Employee/StateTaxes/StateForm.d.ts +10 -0
  251. package/dist/components/Employee/StateTaxes/StateForm.js +34 -0
  252. package/dist/components/Employee/StateTaxes/StateForm.js.map +1 -0
  253. package/dist/components/Employee/StateTaxes/StateTaxes.d.ts +7 -0
  254. package/dist/components/Employee/StateTaxes/StateTaxes.js +90 -0
  255. package/dist/components/Employee/StateTaxes/StateTaxes.js.map +1 -0
  256. package/dist/components/Employee/StateTaxes/index.d.ts +2 -0
  257. package/dist/components/Employee/StateTaxes/useStateTaxes.d.ts +8 -0
  258. package/dist/components/Employee/StateTaxes/useStateTaxes.js +16 -0
  259. package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -0
  260. package/dist/components/Employee/Taxes/Actions.js +10 -8
  261. package/dist/components/Employee/Taxes/Actions.js.map +1 -1
  262. package/dist/components/Employee/Taxes/FederalForm.js +14 -12
  263. package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
  264. package/dist/components/Employee/Taxes/Taxes.d.ts +5 -0
  265. package/dist/components/Employee/Taxes/Taxes.js +73 -85
  266. package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
  267. package/dist/components/Employee/Taxes/useTaxes.js +4 -8
  268. package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
  269. package/dist/components/Employee/index.d.ts +3 -1
  270. package/dist/components/Employee/index.js +16 -12
  271. package/dist/components/Employee/index.js.map +1 -1
  272. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +8 -6
  273. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
  274. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +12 -10
  275. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
  276. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +10 -8
  277. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
  278. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +1 -1
  279. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +11 -9
  280. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
  281. package/dist/contexts/ApiProvider/ApiProvider.js +4 -4
  282. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +7 -5
  283. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
  284. package/dist/contexts/ThemeProvider/ThemeProvider.js +7 -7
  285. package/dist/contexts/ThemeProvider/ThemeProvider.js.map +1 -1
  286. package/dist/i18n/I18n.js +1 -1
  287. package/dist/i18n/I18n.js.map +1 -1
  288. package/dist/i18n/en/Employee.FederalTaxes.json.js +46 -0
  289. package/dist/i18n/en/Employee.FederalTaxes.json.js.map +1 -0
  290. package/dist/i18n/en/Employee.StateTaxes.json.js +6 -10
  291. package/dist/i18n/en/Employee.StateTaxes.json.js.map +1 -1
  292. package/dist/i18n/en/Employee.Taxes.json.js +7 -7
  293. package/dist/shared/constants.d.ts +4 -2
  294. package/dist/shared/constants.js +10 -9
  295. package/dist/shared/constants.js.map +1 -1
  296. package/dist/style.css +1 -1
  297. package/dist/types/i18next.d.ts +27 -4
  298. package/package.json +5 -6
@@ -5,17 +5,18 @@ import { useTranslation as P, Trans as I } from "react-i18next";
5
5
  import { useCompensation as R, rateMinimumError as Y, rateExemptThresholdError as w } from "./useCompensation.js";
6
6
  import { FlsaStatus as a, PAY_PERIODS as r, FLSA_OVERTIME_SALARY_LIMIT as N } from "../../../shared/constants.js";
7
7
  import x from "../../Common/hooks/useNumberFormatter.js";
8
- import { useComponentContext as j } from "../../../contexts/ComponentAdapter/useComponentContext.js";
9
- import { WA_RISK_CLASS_CODES as X } from "../../../models/WA_RISK_CODES.js";
10
- import { TextInputField as B } from "../../Common/Fields/TextInputField/TextInputField.js";
8
+ import "classnames";
9
+ import { RadioGroupField as j } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
10
+ import { TextInputField as X } from "../../Common/Fields/TextInputField/TextInputField.js";
11
+ import { NumberInputField as B } from "../../Common/Fields/NumberInputField/NumberInputField.js";
12
+ import { SwitchField as J } from "../../Common/Fields/SwitchField/SwitchField.js";
13
+ import { useComponentContext as K } from "../../../contexts/ComponentAdapter/useComponentContext.js";
14
+ import { WA_RISK_CLASS_CODES as q } from "../../../models/WA_RISK_CODES.js";
11
15
  import { SelectField as b } from "../../Common/Fields/SelectField/SelectField.js";
12
- import { NumberInputField as J } from "../../Common/Fields/NumberInputField/NumberInputField.js";
13
- import { SwitchField as K } from "../../Common/Fields/SwitchField/SwitchField.js";
14
- import { RadioGroupField as q } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
15
16
  import { ComboBoxField as H } from "../../Common/Fields/ComboBoxField/ComboBoxField.js";
16
- const me = () => {
17
- const { t: e } = P("Employee.Compensation"), l = x("currency"), m = j(), S = F(
18
- () => X.map(({ code: o, description: D }) => ({ value: o, label: D })),
17
+ const pe = () => {
18
+ const { t: e } = P("Employee.Compensation"), l = x("currency"), m = K(), S = F(
19
+ () => q.map(({ code: o, description: D }) => ({ value: o, label: D })),
19
20
  []
20
21
  ), {
21
22
  control: f,
@@ -44,7 +45,7 @@ const me = () => {
44
45
  limit: l(N)
45
46
  })), /* @__PURE__ */ d(O, { children: [
46
47
  /* @__PURE__ */ t(
47
- B,
48
+ X,
48
49
  {
49
50
  name: "jobTitle",
50
51
  label: e("jobTitle"),
@@ -76,7 +77,7 @@ const me = () => {
76
77
  }
77
78
  ),
78
79
  /* @__PURE__ */ t(
79
- J,
80
+ B,
80
81
  {
81
82
  name: "rate",
82
83
  label: e("amount"),
@@ -89,7 +90,7 @@ const me = () => {
89
90
  ),
90
91
  A && /* @__PURE__ */ d(O, { children: [
91
92
  /* @__PURE__ */ t(
92
- K,
93
+ J,
93
94
  {
94
95
  name: "adjustForMinimumWage",
95
96
  label: e("adjustForMinimumWage"),
@@ -125,7 +126,7 @@ const me = () => {
125
126
  v && /* @__PURE__ */ t(m.Checkbox, { label: e("twoPercentStakeholderLabel"), name: "twoPercentShareholder" }),
126
127
  W === "WA" && /* @__PURE__ */ d(O, { children: [
127
128
  /* @__PURE__ */ t(
128
- q,
129
+ j,
129
130
  {
130
131
  name: "stateWcCovered",
131
132
  label: e("stateWcCoveredLabel"),
@@ -166,6 +167,6 @@ const me = () => {
166
167
  ] });
167
168
  };
168
169
  export {
169
- me as Edit
170
+ pe as Edit
170
171
  };
171
172
  //# sourceMappingURL=Edit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Edit.js","sources":["../../../../src/components/Employee/Compensation/Edit.tsx"],"sourcesContent":["import { useEffect, useMemo } from 'react'\nimport { useFormContext, useWatch } from 'react-hook-form'\nimport { Trans, useTranslation } from 'react-i18next'\nimport {\n type CompensationInputs,\n useCompensation,\n rateMinimumError,\n rateExemptThresholdError,\n} from './useCompensation'\nimport { FLSA_OVERTIME_SALARY_LIMIT, FlsaStatus, PAY_PERIODS } from '@/shared/constants'\nimport useNumberFormatter from '@/components/Common/hooks/useNumberFormatter'\nimport {\n NumberInputField,\n SelectField,\n TextInputField,\n SwitchField,\n RadioGroupField,\n ComboBoxField,\n} from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { WA_RISK_CLASS_CODES } from '@/models/WA_RISK_CODES'\n\nexport interface SelectCategory {\n id: string\n name: string\n}\n\nexport const Edit = () => {\n const { t } = useTranslation('Employee.Compensation')\n const format = useNumberFormatter('currency')\n const Components = useComponentContext()\n\n const stateWcRiskOptions = useMemo(\n () => WA_RISK_CLASS_CODES.map(({ code, description }) => ({ value: code, label: description })),\n [],\n )\n\n const {\n control,\n register,\n setValue,\n formState: { errors, defaultValues },\n } = useFormContext<CompensationInputs>()\n\n const watchedFlsaStatus = useWatch({ control, name: 'flsaStatus' })\n const watchedStateWcCovered = useWatch({ control, name: 'stateWcCovered' })\n const { currentJob, mode, minimumWages, handleFlsaChange, state, showTwoPercentStakeholder } =\n useCompensation()\n\n /**Correctly set payment unit selected option and rate based on flsa status, falling back to default */\n useEffect(() => {\n if (watchedFlsaStatus === FlsaStatus.OWNER) {\n setValue('paymentUnit', 'Paycheck')\n } else if (\n watchedFlsaStatus === FlsaStatus.COMMISSION_ONLY_NONEXEMPT ||\n watchedFlsaStatus === FlsaStatus.COMMISSION_ONLY_EXEMPT\n ) {\n setValue('paymentUnit', 'Year')\n setValue('rate', 0)\n } else if (defaultValues?.paymentUnit) {\n setValue('paymentUnit', defaultValues.paymentUnit)\n }\n }, [watchedFlsaStatus, setValue, defaultValues?.paymentUnit])\n\n if (\n !(\n mode === 'ADD_INITIAL_JOB' ||\n mode === 'ADD_ADDITIONAL_JOB' ||\n mode === 'EDIT_INITIAL_JOB' ||\n mode === 'EDIT_ADDITIONAL_JOB'\n )\n )\n return\n\n const classificationOptions = (Object.keys(FlsaStatus) as Array<keyof typeof FlsaStatus>).map(\n key => ({\n value: FlsaStatus[key],\n label: t(`flsaStatusLabels.${FlsaStatus[key]}`),\n }),\n )\n\n const paymentUnitOptions = [\n { value: PAY_PERIODS.HOUR, label: t('paymentUnitOptions.Hour') },\n { value: PAY_PERIODS.WEEK, label: t('paymentUnitOptions.Week') },\n { value: PAY_PERIODS.MONTH, label: t('paymentUnitOptions.Month') },\n { value: PAY_PERIODS.YEAR, label: t('paymentUnitOptions.Year') },\n { value: PAY_PERIODS.PAYCHECK, label: t('paymentUnitOptions.Paycheck') },\n ]\n\n const isFlsaSelectionEnabled =\n watchedFlsaStatus !== FlsaStatus.NONEXEMPT || currentJob?.primary || mode === 'ADD_INITIAL_JOB'\n\n const isAdjustMinimumWageEnabled =\n watchedFlsaStatus === FlsaStatus.NONEXEMPT && minimumWages.length > 0\n\n let rateErrorMessage = t('validations.rate')\n if (errors.rate?.message === rateMinimumError) {\n rateErrorMessage = t('validations.nonZeroRate')\n } else if (errors.rate?.message === rateExemptThresholdError) {\n rateErrorMessage = t('validations.rateExemptThreshold', {\n limit: format(FLSA_OVERTIME_SALARY_LIMIT),\n })\n }\n\n return (\n <>\n <TextInputField\n name=\"jobTitle\"\n label={t('jobTitle')}\n isRequired\n errorMessage={t('validations.title')}\n />\n {/* hiding flsa selection for secondary jobs */}\n {!isFlsaSelectionEnabled && <input type=\"hidden\" {...register('flsaStatus')} />}\n {isFlsaSelectionEnabled && (\n <SelectField\n name=\"flsaStatus\"\n label={t('employeeClassification')}\n description={\n <Trans\n t={t}\n i18nKey=\"classificationCTA\"\n components={{ classificationCta: <Components.Link /> }}\n />\n }\n errorMessage={t('validations.exemptThreshold', {\n limit: format(FLSA_OVERTIME_SALARY_LIMIT),\n })}\n options={classificationOptions}\n isRequired\n isDisabled={!isFlsaSelectionEnabled}\n onChange={handleFlsaChange}\n />\n )}\n <NumberInputField\n name=\"rate\"\n label={t('amount')}\n format=\"currency\"\n min={0}\n errorMessage={rateErrorMessage}\n isRequired\n isDisabled={\n watchedFlsaStatus === FlsaStatus.COMMISSION_ONLY_NONEXEMPT ||\n watchedFlsaStatus === FlsaStatus.COMMISSION_ONLY_EXEMPT\n }\n />\n {isAdjustMinimumWageEnabled && (\n <>\n <SwitchField\n name=\"adjustForMinimumWage\"\n label={t('adjustForMinimumWage')}\n description={t('adjustForMinimumWageDescription')}\n />\n <SelectField\n name=\"minimumWageId\"\n label={t('minimumWageLabel')}\n description={t('minimumWageDescription')}\n options={minimumWages.map(wage => ({\n value: wage.uuid,\n label: `${format(Number(wage.wage))} - ${wage.authority}: ${wage.notes ?? ''}`,\n }))}\n errorMessage={t('validations.minimumWage')}\n />\n </>\n )}\n <SelectField\n name=\"paymentUnit\"\n label={t('paymentUnitLabel')}\n description={t('paymentUnitDescription')}\n options={paymentUnitOptions}\n errorMessage={t('validations.paymentUnit')}\n isRequired\n isDisabled={\n watchedFlsaStatus === FlsaStatus.OWNER ||\n watchedFlsaStatus === FlsaStatus.COMMISSION_ONLY_NONEXEMPT ||\n watchedFlsaStatus === FlsaStatus.COMMISSION_ONLY_EXEMPT\n }\n />\n {showTwoPercentStakeholder && (\n <Components.Checkbox label={t('twoPercentStakeholderLabel')} name=\"twoPercentShareholder\" />\n )}\n {state === 'WA' && (\n <>\n <RadioGroupField\n name=\"stateWcCovered\"\n label={t('stateWcCoveredLabel')}\n description={\n <Trans\n t={t}\n i18nKey=\"stateWcCoveredDescription\"\n components={{\n wcLink: (\n <Components.Link\n href=\"https://www.lni.wa.gov/insurance/rates-risk-classes/risk-classes-for-workers-compensation/risk-class-lookup#/\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n />\n ),\n }}\n />\n }\n options={[\n { label: t('stateWcCoveredOptions.yes'), value: true },\n { label: t('stateWcCoveredOptions.no'), value: false },\n ]}\n />\n {watchedStateWcCovered && (\n <ComboBoxField\n name=\"stateWcClassCode\"\n label={t('stateWcClassCodeLabel')}\n options={stateWcRiskOptions}\n errorMessage={t('validations.stateWcClassCode')}\n placeholder={t('stateWcClassCodeLabel')}\n />\n )}\n </>\n )}\n </>\n )\n}\n"],"names":["Edit","t","useTranslation","format","useNumberFormatter","Components","useComponentContext","stateWcRiskOptions","useMemo","WA_RISK_CLASS_CODES","code","description","control","register","setValue","errors","defaultValues","useFormContext","watchedFlsaStatus","useWatch","watchedStateWcCovered","currentJob","mode","minimumWages","handleFlsaChange","state","showTwoPercentStakeholder","useCompensation","useEffect","FlsaStatus","classificationOptions","key","paymentUnitOptions","PAY_PERIODS","isFlsaSelectionEnabled","isAdjustMinimumWageEnabled","rateErrorMessage","rateMinimumError","rateExemptThresholdError","FLSA_OVERTIME_SALARY_LIMIT","jsxs","Fragment","jsx","TextInputField","SelectField","Trans","NumberInputField","SwitchField","wage","RadioGroupField","ComboBoxField"],"mappings":";;;;;;;;;;;;;;;AA2BO,MAAMA,KAAO,MAAM;AACxB,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,u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AsBW,EAAW;AAAA,MAAA;AAAA,IAAA;AAAA,IAGpCH,KACC,gBAAAgB,EAACrC,EAAW,UAAX,EAAoB,OAAOJ,EAAE,4BAA4B,GAAG,MAAK,yBAAwB;AAAA,IAE3FwB,MAAU,QACT,gBAAAe,EAAAC,GAAA,EACE,UAAA;AAAA,MAAA,gBAAAC;AAAA,QAACO;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,OAAOhD,EAAE,qBAAqB;AAAA,UAC9B,aACE,gBAAAyC;AAAA,YAACG;AAAA,YAAA;AAAA,cACC,GAAA5C;AAAA,cACA,SAAQ;AAAA,cACR,YAAY;AAAA,gBACV,QACE,gBAAAyC;AAAA,kBAACrC,EAAW;AAAA,kBAAX;AAAA,oBACC,MAAK;AAAA,oBACL,QAAO;AAAA,oBACP,KAAI;AAAA,kBAAA;AAAA,gBAAA;AAAA,cACN;AAAA,YAEJ;AAAA,UAAA;AAAA,UAGJ,SAAS;AAAA,YACP,EAAE,OAAOJ,EAAE,2BAA2B,GAAG,OAAO,GAAA;AAAA,YAChD,EAAE,OAAOA,EAAE,0BAA0B,GAAG,OAAO,GAAA;AAAA,UAAM;AAAA,QACvD;AAAA,MAAA;AAAA,MAEDmB,KACC,gBAAAsB;AAAA,QAACQ;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,OAAOjD,EAAE,uBAAuB;AAAA,UAChC,SAASM;AAAA,UACT,cAAcN,EAAE,8BAA8B;AAAA,UAC9C,aAAaA,EAAE,uBAAuB;AAAA,QAAA;AAAA,MAAA;AAAA,IACxC,EAAA,CAEJ;AAAA,EAAA,GAEJ;AAEJ;"}
1
+ {"version":3,"file":"Edit.js","sources":["../../../../src/components/Employee/Compensation/Edit.tsx"],"sourcesContent":["import { useEffect, useMemo } from 'react'\nimport { useFormContext, useWatch } from 'react-hook-form'\nimport { Trans, useTranslation } from 'react-i18next'\nimport {\n type CompensationInputs,\n useCompensation,\n rateMinimumError,\n rateExemptThresholdError,\n} from './useCompensation'\nimport { FLSA_OVERTIME_SALARY_LIMIT, FlsaStatus, PAY_PERIODS } from '@/shared/constants'\nimport useNumberFormatter from '@/components/Common/hooks/useNumberFormatter'\nimport {\n NumberInputField,\n SelectField,\n TextInputField,\n SwitchField,\n RadioGroupField,\n ComboBoxField,\n} from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { WA_RISK_CLASS_CODES } from '@/models/WA_RISK_CODES'\n\nexport interface SelectCategory {\n id: string\n name: string\n}\n\nexport const Edit = () => {\n const { t } = useTranslation('Employee.Compensation')\n const format = useNumberFormatter('currency')\n const Components = useComponentContext()\n\n const stateWcRiskOptions = useMemo(\n () => WA_RISK_CLASS_CODES.map(({ code, description }) => ({ value: code, label: description })),\n [],\n )\n\n const {\n control,\n register,\n setValue,\n formState: { errors, defaultValues },\n } = useFormContext<CompensationInputs>()\n\n const watchedFlsaStatus = useWatch({ control, name: 'flsaStatus' })\n const watchedStateWcCovered = useWatch({ control, name: 'stateWcCovered' })\n const { currentJob, mode, minimumWages, handleFlsaChange, state, showTwoPercentStakeholder } =\n useCompensation()\n\n /**Correctly set payment unit selected option and rate based on flsa status, falling back to default */\n useEffect(() => {\n if (watchedFlsaStatus === FlsaStatus.OWNER) {\n setValue('paymentUnit', 'Paycheck')\n } else if (\n watchedFlsaStatus === FlsaStatus.COMMISSION_ONLY_NONEXEMPT ||\n watchedFlsaStatus === FlsaStatus.COMMISSION_ONLY_EXEMPT\n ) {\n setValue('paymentUnit', 'Year')\n setValue('rate', 0)\n } else if (defaultValues?.paymentUnit) {\n setValue('paymentUnit', defaultValues.paymentUnit)\n }\n }, [watchedFlsaStatus, setValue, defaultValues?.paymentUnit])\n\n if (\n !(\n mode === 'ADD_INITIAL_JOB' ||\n mode === 'ADD_ADDITIONAL_JOB' ||\n mode === 'EDIT_INITIAL_JOB' ||\n mode === 'EDIT_ADDITIONAL_JOB'\n )\n )\n return\n\n const classificationOptions = (Object.keys(FlsaStatus) as Array<keyof typeof FlsaStatus>).map(\n key => ({\n value: FlsaStatus[key],\n label: t(`flsaStatusLabels.${FlsaStatus[key]}`),\n }),\n )\n\n const paymentUnitOptions = [\n { value: PAY_PERIODS.HOUR, label: t('paymentUnitOptions.Hour') },\n { value: PAY_PERIODS.WEEK, label: t('paymentUnitOptions.Week') },\n { value: PAY_PERIODS.MONTH, label: t('paymentUnitOptions.Month') },\n { value: PAY_PERIODS.YEAR, label: t('paymentUnitOptions.Year') },\n { value: PAY_PERIODS.PAYCHECK, label: t('paymentUnitOptions.Paycheck') },\n ]\n\n const isFlsaSelectionEnabled =\n watchedFlsaStatus !== FlsaStatus.NONEXEMPT || currentJob?.primary || mode === 'ADD_INITIAL_JOB'\n\n const isAdjustMinimumWageEnabled =\n watchedFlsaStatus === FlsaStatus.NONEXEMPT && minimumWages.length > 0\n\n let rateErrorMessage = t('validations.rate')\n if (errors.rate?.message === rateMinimumError) {\n rateErrorMessage = t('validations.nonZeroRate')\n } else if (errors.rate?.message === rateExemptThresholdError) {\n rateErrorMessage = t('validations.rateExemptThreshold', {\n limit: format(FLSA_OVERTIME_SALARY_LIMIT),\n })\n }\n\n return (\n <>\n <TextInputField\n name=\"jobTitle\"\n label={t('jobTitle')}\n isRequired\n errorMessage={t('validations.title')}\n />\n {/* hiding flsa selection for secondary jobs */}\n {!isFlsaSelectionEnabled && <input type=\"hidden\" {...register('flsaStatus')} />}\n {isFlsaSelectionEnabled && (\n <SelectField\n name=\"flsaStatus\"\n label={t('employeeClassification')}\n description={\n <Trans\n t={t}\n i18nKey=\"classificationCTA\"\n components={{ classificationCta: <Components.Link /> }}\n />\n }\n errorMessage={t('validations.exemptThreshold', {\n limit: format(FLSA_OVERTIME_SALARY_LIMIT),\n })}\n options={classificationOptions}\n isRequired\n isDisabled={!isFlsaSelectionEnabled}\n onChange={handleFlsaChange}\n />\n )}\n <NumberInputField\n name=\"rate\"\n label={t('amount')}\n format=\"currency\"\n min={0}\n errorMessage={rateErrorMessage}\n isRequired\n isDisabled={\n watchedFlsaStatus === FlsaStatus.COMMISSION_ONLY_NONEXEMPT ||\n watchedFlsaStatus === FlsaStatus.COMMISSION_ONLY_EXEMPT\n }\n />\n {isAdjustMinimumWageEnabled && (\n <>\n <SwitchField\n name=\"adjustForMinimumWage\"\n label={t('adjustForMinimumWage')}\n description={t('adjustForMinimumWageDescription')}\n />\n <SelectField\n name=\"minimumWageId\"\n label={t('minimumWageLabel')}\n description={t('minimumWageDescription')}\n options={minimumWages.map(wage => ({\n value: wage.uuid,\n label: `${format(Number(wage.wage))} - ${wage.authority}: ${wage.notes ?? ''}`,\n }))}\n errorMessage={t('validations.minimumWage')}\n />\n </>\n )}\n <SelectField\n name=\"paymentUnit\"\n label={t('paymentUnitLabel')}\n description={t('paymentUnitDescription')}\n options={paymentUnitOptions}\n errorMessage={t('validations.paymentUnit')}\n isRequired\n isDisabled={\n watchedFlsaStatus === FlsaStatus.OWNER ||\n watchedFlsaStatus === FlsaStatus.COMMISSION_ONLY_NONEXEMPT ||\n watchedFlsaStatus === FlsaStatus.COMMISSION_ONLY_EXEMPT\n }\n />\n {showTwoPercentStakeholder && (\n <Components.Checkbox label={t('twoPercentStakeholderLabel')} name=\"twoPercentShareholder\" />\n )}\n {state === 'WA' && (\n <>\n <RadioGroupField\n name=\"stateWcCovered\"\n label={t('stateWcCoveredLabel')}\n description={\n <Trans\n t={t}\n i18nKey=\"stateWcCoveredDescription\"\n components={{\n wcLink: (\n <Components.Link\n href=\"https://www.lni.wa.gov/insurance/rates-risk-classes/risk-classes-for-workers-compensation/risk-class-lookup#/\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n />\n ),\n }}\n />\n }\n options={[\n { label: t('stateWcCoveredOptions.yes'), value: true },\n { label: t('stateWcCoveredOptions.no'), value: false },\n ]}\n />\n {watchedStateWcCovered && (\n <ComboBoxField\n name=\"stateWcClassCode\"\n label={t('stateWcClassCodeLabel')}\n options={stateWcRiskOptions}\n errorMessage={t('validations.stateWcClassCode')}\n placeholder={t('stateWcClassCodeLabel')}\n />\n )}\n </>\n )}\n </>\n )\n}\n"],"names":["Edit","t","useTranslation","format","useNumberFormatter","Components","useComponentContext","stateWcRiskOptions","useMemo","WA_RISK_CLASS_CODES","code","description","control","register","setValue","errors","defaultValues","useFormContext","watchedFlsaStatus","useWatch","watchedStateWcCovered","currentJob","mode","minimumWages","handleFlsaChange","state","showTwoPercentStakeholder","useCompensation","useEffect","FlsaStatus","classificationOptions","key","paymentUnitOptions","PAY_PERIODS","isFlsaSelectionEnabled","isAdjustMinimumWageEnabled","rateErrorMessage","rateMinimumError","rateExemptThresholdError","FLSA_OVERTIME_SALARY_LIMIT","jsxs","Fragment","jsx","TextInputField","SelectField","Trans","NumberInputField","SwitchField","wage","RadioGroupField","ComboBoxField"],"mappings":";;;;;;;;;;;;;;;;AA2BO,MAAMA,KAAO,MAAM;AACxB,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,uBAAuB,GAC9CC,IAASC,EAAmB,UAAU,GACtCC,IAAaC,EAAA,GAEbC,IAAqBC;AAAA,IACzB,MAAMC,EAAoB,IAAI,CAAC,EAAE,MAAAC,GAAM,aAAAC,EAAA,OAAmB,EAAE,OAAOD,GAAM,OAAOC,IAAc;AAAA,IAC9F,CAAA;AAAA,EAAC,GAGG;AAAA,IACJ,SAAAC;AAAA,IACA,UAAAC;AAAA,IACA,UAAAC;AAAA,IACA,WAAW,EAAE,QAAAC,GAAQ,eAAAC,EAAA;AAAA,EAAc,IACjCC,EAAA,GAEEC,IAAoBC,EAAS,EAAE,SAAAP,GAAS,MAAM,cAAc,GAC5DQ,IAAwBD,EAAS,EAAE,SAAAP,GAAS,MAAM,kBAAkB,GACpE,EAAE,YAAAS,GAAY,MAAAC,GAAM,cAAAC,GAAc,kBAAAC,GAAkB,OAAAC,GAAO,2BAAAC,EAAA,IAC/DC,EAAA;AAiBF,MAdAC,EAAU,MAAM;AACd,IAAIV,MAAsBW,EAAW,QACnCf,EAAS,eAAe,UAAU,IA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AA,YAChD,EAAE,OAAOA,EAAE,0BAA0B,GAAG,OAAO,GAAA;AAAA,UAAM;AAAA,QACvD;AAAA,MAAA;AAAA,MAEDmB,KACC,gBAAAsB;AAAA,QAACQ;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,OAAOjD,EAAE,uBAAuB;AAAA,UAChC,SAASM;AAAA,UACT,cAAcN,EAAE,8BAA8B;AAAA,UAC9C,aAAaA,EAAE,uBAAuB;AAAA,QAAA;AAAA,MAAA;AAAA,IACxC,EAAA,CAEJ;AAAA,EAAA,GAEJ;AAEJ;"}
@@ -3,69 +3,71 @@ import { useTranslation as p } from "react-i18next";
3
3
  import { useCompensation as d } from "./useCompensation.js";
4
4
  import C from "../../../assets/icons/pencil.svg.js";
5
5
  import c from "../../../assets/icons/trashcan.svg.js";
6
+ import "classnames";
7
+ import "../../../shared/constants.js";
6
8
  import { HamburgerMenu as f } from "../../Common/HamburgerMenu/HamburgerMenu.js";
7
9
  import { useDataView as y } from "../../Common/DataView/useDataView.js";
8
10
  import { DataView as g } from "../../Common/DataView/DataView.js";
9
- const D = () => {
10
- const { employeeJobs: i, mode: o, isPending: l, handleEdit: r, handleDelete: s } = d(), { t } = p("Employee.Compensation"), { ...m } = y({
11
+ const U = () => {
12
+ const { employeeJobs: i, mode: o, isPending: r, handleEdit: l, handleDelete: s } = d(), { t: e } = p("Employee.Compensation"), { ...m } = y({
11
13
  data: i,
12
14
  columns: [
13
15
  {
14
16
  key: "title",
15
- title: t("allCompensations.jobColumn"),
16
- render: (e) => e.title || ""
17
+ title: e("allCompensations.jobColumn"),
18
+ render: (t) => t.title || ""
17
19
  },
18
20
  {
19
21
  key: "flsaStatus",
20
- title: t("allCompensations.typeColumn"),
21
- render: (e) => {
22
- const n = e.compensations?.find(
23
- (u) => u.uuid === e.currentCompensationUuid
22
+ title: e("allCompensations.typeColumn"),
23
+ render: (t) => {
24
+ const n = t.compensations?.find(
25
+ (u) => u.uuid === t.currentCompensationUuid
24
26
  )?.flsaStatus;
25
- return n !== void 0 ? t(`flsaStatusLabels.${n}`) : null;
27
+ return n !== void 0 ? e(`flsaStatusLabels.${n}`) : null;
26
28
  }
27
29
  },
28
30
  {
29
31
  key: "rate",
30
- title: t("allCompensations.amountColumn"),
31
- render: (e) => e.rate?.toString() || ""
32
+ title: e("allCompensations.amountColumn"),
33
+ render: (t) => t.rate?.toString() || ""
32
34
  },
33
35
  {
34
36
  key: "paymentUnit",
35
- title: t("allCompensations.perColumn"),
36
- render: (e) => e.paymentUnit || ""
37
+ title: e("allCompensations.perColumn"),
38
+ render: (t) => t.paymentUnit || ""
37
39
  }
38
40
  ],
39
- itemMenu: (e) => /* @__PURE__ */ a(
41
+ itemMenu: (t) => /* @__PURE__ */ a(
40
42
  f,
41
43
  {
42
- triggerLabel: t("hamburgerTitle"),
44
+ triggerLabel: e("hamburgerTitle"),
43
45
  items: [
44
46
  {
45
- label: t("allCompensations.editCta"),
47
+ label: e("allCompensations.editCta"),
46
48
  icon: /* @__PURE__ */ a(C, { "aria-hidden": !0 }),
47
49
  onClick: () => {
48
- r(e.uuid);
50
+ l(t.uuid);
49
51
  }
50
52
  },
51
- ...e.primary ? [] : [
53
+ ...t.primary ? [] : [
52
54
  {
53
- label: t("allCompensations.deleteCta"),
55
+ label: e("allCompensations.deleteCta"),
54
56
  icon: /* @__PURE__ */ a(c, { "aria-hidden": !0 }),
55
57
  onClick: () => {
56
- s(e.uuid);
58
+ s(t.uuid);
57
59
  }
58
60
  }
59
61
  ]
60
62
  ],
61
- isLoading: l
63
+ isLoading: r
62
64
  }
63
65
  )
64
66
  });
65
67
  if (o === "LIST")
66
- return /* @__PURE__ */ a(g, { "data-testid": "data-view", label: t("allCompensations.tableLabel"), ...m });
68
+ return /* @__PURE__ */ a(g, { "data-testid": "data-view", label: e("allCompensations.tableLabel"), ...m });
67
69
  };
68
70
  export {
69
- D as List
71
+ U as List
70
72
  };
71
73
  //# sourceMappingURL=List.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"List.js","sources":["../../../../src/components/Employee/Compensation/List.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { type Job } from '@gusto/embedded-api/models/components/job'\nimport { useCompensation } from './useCompensation'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\nimport { DataView, useDataView } from '@/components/Common'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\n\nexport const List = () => {\n const { employeeJobs, mode, isPending, handleEdit, handleDelete } = useCompensation()\n const { t } = useTranslation('Employee.Compensation')\n\n const { ...dataViewProps } = useDataView({\n data: employeeJobs,\n columns: [\n {\n key: 'title',\n title: t('allCompensations.jobColumn'),\n render: (job: Job) => job.title || '',\n },\n {\n key: 'flsaStatus',\n title: t('allCompensations.typeColumn'),\n render: (job: Job) => {\n const flsaStatus = job.compensations?.find(\n comp => comp.uuid === job.currentCompensationUuid,\n )?.flsaStatus\n return flsaStatus !== undefined ? t(`flsaStatusLabels.${flsaStatus}`) : null\n },\n },\n {\n key: 'rate',\n title: t('allCompensations.amountColumn'),\n render: (job: Job) => job.rate?.toString() || '',\n },\n {\n key: 'paymentUnit',\n title: t('allCompensations.perColumn'),\n render: (job: Job) => job.paymentUnit || '',\n },\n ],\n itemMenu: (job: Job) => (\n <HamburgerMenu\n triggerLabel={t('hamburgerTitle')}\n items={[\n {\n label: t('allCompensations.editCta'),\n icon: <PencilSvg aria-hidden />,\n onClick: () => {\n handleEdit(job.uuid)\n },\n },\n ...(!job.primary\n ? [\n {\n label: t('allCompensations.deleteCta'),\n icon: <TrashCanSvg aria-hidden />,\n onClick: () => {\n handleDelete(job.uuid)\n },\n },\n ]\n : []),\n ]}\n isLoading={isPending}\n />\n ),\n })\n\n if (mode !== 'LIST') {\n return\n }\n\n return (\n <DataView data-testid=\"data-view\" label={t('allCompensations.tableLabel')} {...dataViewProps} />\n )\n}\n"],"names":["List","employeeJobs","mode","isPending","handleEdit","handleDelete","useCompensation","useTranslation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AI,IAAI;AAAA,YACrB;AAAA,UAAA;AAAA,UAEF,GAAKA,EAAI,UAUL,CAAA,IATA;AAAA,YACE;AAAA,cACE,OAAO,EAAE,4BAA4B;AAAA,cACrC,MAAM,gBAAAG,EAACG,GAAA,EAAY,eAAW,GAAA,CAAC;AAAA,cAC/B,SAAS,MAAM;AACb,gBAAAX,EAAaK,EAAI,IAAI;AAAA,cACvB;AAAA,YAAA;AAAA,UACF;AAAA,QAED;AAAA,QAEP,WAAWP;AAAA,MAAA;AAAA,IAAA;AAAA,EACb,CAEH;AAED,MAAID,MAAS;AAIb,WACE,gBAAAW,EAACI,KAAS,eAAY,aAAY,OAAO,EAAE,6BAA6B,GAAI,GAAGT,GAAe;AAElG;"}
1
+ {"version":3,"file":"List.js","sources":["../../../../src/components/Employee/Compensation/List.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { type Job } from '@gusto/embedded-api/models/components/job'\nimport { useCompensation } from './useCompensation'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\nimport { DataView, useDataView } from '@/components/Common'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\n\nexport const List = () => {\n const { employeeJobs, mode, isPending, handleEdit, handleDelete } = useCompensation()\n const { t } = useTranslation('Employee.Compensation')\n\n const { ...dataViewProps } = useDataView({\n data: employeeJobs,\n columns: [\n {\n key: 'title',\n title: t('allCompensations.jobColumn'),\n render: (job: Job) => job.title || '',\n },\n {\n key: 'flsaStatus',\n title: t('allCompensations.typeColumn'),\n render: (job: Job) => {\n const flsaStatus = job.compensations?.find(\n comp => comp.uuid === job.currentCompensationUuid,\n )?.flsaStatus\n return flsaStatus !== undefined ? t(`flsaStatusLabels.${flsaStatus}`) : null\n },\n },\n {\n key: 'rate',\n title: t('allCompensations.amountColumn'),\n render: (job: Job) => job.rate?.toString() || '',\n },\n {\n key: 'paymentUnit',\n title: t('allCompensations.perColumn'),\n render: (job: Job) => job.paymentUnit || '',\n },\n ],\n itemMenu: (job: Job) => (\n <HamburgerMenu\n triggerLabel={t('hamburgerTitle')}\n items={[\n {\n label: t('allCompensations.editCta'),\n icon: <PencilSvg aria-hidden />,\n onClick: () => {\n handleEdit(job.uuid)\n },\n },\n ...(!job.primary\n ? [\n {\n label: t('allCompensations.deleteCta'),\n icon: <TrashCanSvg aria-hidden />,\n onClick: () => {\n handleDelete(job.uuid)\n },\n },\n ]\n : []),\n ]}\n isLoading={isPending}\n />\n ),\n })\n\n if (mode !== 'LIST') {\n return\n }\n\n return (\n <DataView data-testid=\"data-view\" label={t('allCompensations.tableLabel')} {...dataViewProps} />\n )\n}\n"],"names":["List","employeeJobs","mode","isPending","handleEdit","handleDelete","useCompensation","t","useTranslation","dataViewProps","useDataView","job","flsaStatus","comp","jsx","HamburgerMenu","PencilSvg","TrashCanSvg","DataView"],"mappings":";;;;;;;;;;AAQO,MAAMA,IAAO,MAAM;AACxB,QAAM,EAAE,cAAAC,GAAc,MAAAC,GAAM,WAAAC,GAAW,YAAAC,GAAY,cAAAC,EAAA,IAAiBC,EAAA,GAC9D,EAAE,GAAAC,EAAA,IAAMC,EAAe,uBAAuB,GAE9C,EAAE,GAAGC,EAAA,IAAkBC,EAAY;AAAA,IACvC,MAAMT;AAAA,IACN,SAAS;AAAA,MACP;AAAA,QACE,KAAK;AAAA,QACL,OAAOM,EAAE,4BAA4B;AAAA,QACrC,QAAQ,CAACI,MAAaA,EAAI,SAAS;AAAA,MAAA;AAAA,MAErC;AAAA,QACE,KAAK;AAAA,QACL,OAAOJ,EAAE,6BAA6B;AAAA,QACtC,QAAQ,CAACI,MAAa;AACpB,gBAAMC,IAAaD,EAAI,eAAe;AAAA,YACpC,CAAAE,MAAQA,EAAK,SAASF,EAAI;AAAA,UAAA,GACzB;AACH,iBAAOC,MAAe,SAAYL,EAAE,oBAAoBK,CAAU,EAAE,IAAI;AAAA,QAC1E;AAAA,MAAA;AAAA,MAEF;AAAA,QACE,KAAK;AAAA,QACL,OAAOL,EAAE,+BAA+B;AAAA,QACxC,QAAQ,CAACI,MAAaA,EAAI,MAAM,cAAc;AAAA,MAAA;AAAA,MAEhD;AAAA,QACE,KAAK;AAAA,QACL,OAAOJ,EAAE,4BAA4B;AAAA,QACrC,QAAQ,CAACI,MAAaA,EAAI,eAAe;AAAA,MAAA;AAAA,IAC3C;AAAA,IAEF,UAAU,CAACA,MACT,gBAAAG;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,cAAcR,EAAE,gBAAgB;AAAA,QAChC,OAAO;AAAA,UACL;AAAA,YACE,OAAOA,EAAE,0BAA0B;AAAA,YACnC,MAAM,gBAAAO,EAACE,GAAA,EAAU,eAAW,GAAA,CAAC;AAAA,YAC7B,SAAS,MAAM;AACb,cAAAZ,EAAWO,EAAI,IAAI;AAAA,YACrB;AAAA,UAAA;AAAA,UAEF,GAAKA,EAAI,UAUL,CAAA,IATA;AAAA,YACE;AAAA,cACE,OAAOJ,EAAE,4BAA4B;AAAA,cACrC,MAAM,gBAAAO,EAACG,GAAA,EAAY,eAAW,GAAA,CAAC;AAAA,cAC/B,SAAS,MAAM;AACb,gBAAAZ,EAAaM,EAAI,IAAI;AAAA,cACvB;AAAA,YAAA;AAAA,UACF;AAAA,QAED;AAAA,QAEP,WAAWR;AAAA,MAAA;AAAA,IAAA;AAAA,EACb,CAEH;AAED,MAAID,MAAS;AAIb,WACE,gBAAAY,EAACI,KAAS,eAAY,aAAY,OAAOX,EAAE,6BAA6B,GAAI,GAAGE,GAAe;AAElG;"}
@@ -30,7 +30,7 @@ const r = "rate_minimum_error", c = "rate_exempt_threshold_error", M = e.object(
30
30
  message: "stateWcClassCode is required when stateWcCovered is true"
31
31
  });
32
32
  const { flsaStatus: m, paymentUnit: i, rate: a } = t;
33
- m === s.EXEMPT || m === s.SALARIED_NONEXEMPT || m === s.NONEXEMPT ? (m === s.EXEMPT && a !== void 0 && u(Number(a), i) < n && o.addIssue({
33
+ m === s.EXEMPT || m === s.SALARIED_NONEXEMPT || m === s.NONEXEMPT ? (m === s.EXEMPT && a !== void 0 && u(a, i) < n && o.addIssue({
34
34
  code: e.ZodIssueCode.custom,
35
35
  path: ["rate"],
36
36
  message: c
@@ -1 +1 @@
1
- {"version":3,"file":"useCompensation.js","sources":["../../../../src/components/Employee/Compensation/useCompensation.ts"],"sourcesContent":["import type { Job } from '@gusto/embedded-api/models/components/job'\nimport type { MinimumWage } from '@gusto/embedded-api/models/components/minimumwage'\nimport { z } from 'zod'\nimport { createCompoundContext } from '@/components/Base/createCompoundContext'\nimport { FLSA_OVERTIME_SALARY_LIMIT, FlsaStatus } from '@/shared/constants'\nimport { yearlyRate } from '@/helpers/payRateCalculator'\n\nexport const rateMinimumError = 'rate_minimum_error'\nexport const rateExemptThresholdError = 'rate_exempt_threshold_error'\n\nexport const CompensationSchema = z\n .object({\n jobTitle: z.string().min(1),\n adjustForMinimumWage: z.boolean(),\n minimumWageId: z.string().optional(),\n stateWcCovered: z.boolean().optional(),\n stateWcClassCode: z.string().optional(),\n twoPercentShareholder: z.boolean().optional(),\n flsaStatus: z.enum([\n FlsaStatus.EXEMPT,\n FlsaStatus.SALARIED_NONEXEMPT,\n FlsaStatus.NONEXEMPT,\n FlsaStatus.OWNER,\n FlsaStatus.COMMISSION_ONLY_EXEMPT,\n FlsaStatus.COMMISSION_ONLY_NONEXEMPT,\n ]),\n paymentUnit: z.enum(['Hour', 'Week', 'Month', 'Year', 'Paycheck']),\n rate: z.number().optional(),\n })\n .superRefine((data, ctx) => {\n // adjustForMinimumWage\n if (data.adjustForMinimumWage && (!data.minimumWageId || data.minimumWageId.trim() === '')) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['minimumWageId'],\n message: 'minimumWageId is required when adjustForMinimumWage is true',\n })\n }\n\n // stateWcCovered\n if (\n data.stateWcCovered === true &&\n (!data.stateWcClassCode || data.stateWcClassCode.trim() === '')\n ) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['stateWcClassCode'],\n message: 'stateWcClassCode is required when stateWcCovered is true',\n })\n }\n\n // FLSA logic\n const { flsaStatus, paymentUnit, rate } = data\n if (\n flsaStatus === FlsaStatus.EXEMPT ||\n flsaStatus === FlsaStatus.SALARIED_NONEXEMPT ||\n flsaStatus === FlsaStatus.NONEXEMPT\n ) {\n // For EXEMPT, check salary threshold\n if (\n flsaStatus === FlsaStatus.EXEMPT &&\n rate !== undefined &&\n yearlyRate(Number(rate), paymentUnit) < FLSA_OVERTIME_SALARY_LIMIT\n ) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['rate'],\n message: rateExemptThresholdError,\n })\n }\n\n if (rate === undefined || rate < 1) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['rate'],\n message: rateMinimumError,\n })\n }\n } else if (flsaStatus === FlsaStatus.OWNER) {\n if (paymentUnit !== 'Paycheck') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['paymentUnit'],\n message: 'paymentUnit must be Paycheck for OWNER',\n })\n }\n if (rate === undefined || rate < 1) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['rate'],\n message: rateMinimumError,\n })\n }\n } else if (\n [FlsaStatus.COMMISSION_ONLY_EXEMPT, FlsaStatus.COMMISSION_ONLY_NONEXEMPT].includes(flsaStatus)\n ) {\n if (paymentUnit !== 'Year') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['paymentUnit'],\n message: 'paymentUnit must be Year for commission-only FLSA statuses',\n })\n }\n if (rate !== 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['rate'],\n message: rateMinimumError,\n })\n }\n }\n })\n\nexport type CompensationInputs = z.input<typeof CompensationSchema>\nexport type CompensationOutputs = z.output<typeof CompensationSchema>\n\nexport type MODE =\n | 'LIST'\n | 'ADD_ADDITIONAL_JOB'\n | 'ADD_INITIAL_JOB'\n | 'EDIT_ADDITIONAL_JOB'\n | 'EDIT_INITIAL_JOB'\n | 'PROCEED'\n\ntype CompensationContextType = {\n employeeJobs: Job[]\n currentJob?: Job | null\n primaryFlsaStatus?: string\n isPending: boolean\n mode: MODE\n showFlsaChangeWarning: boolean\n minimumWages: MinimumWage[]\n state?: string\n showTwoPercentStakeholder?: boolean\n submitWithEffect: (newMode: MODE) => void\n handleAdd: () => void\n handleEdit: (uuid: string) => void\n handleDelete: (uuid: string) => void\n handleFlsaChange: (status: string | number) => void\n handleCancelAddJob: () => void\n}\nconst [useCompensation, CompensationProvider] =\n createCompoundContext<CompensationContextType>('CompensationContext')\nexport { useCompensation, CompensationProvider }\n"],"names":["rateMinimumError","rateExemptThresholdError","CompensationSchema","z","FlsaStatus","data","ctx","flsaStatus","paymentUnit","rate","yearlyRate","FLSA_OVERTIME_SALARY_LIMIT","useCompensation","CompensationProvider","createCompoundContext"],"mappings":";;;;AAOO,MAAMA,IAAmB,sBACnBC,IAA2B,+BAE3BC,IAAqBC,EAC/B,OAAO;AAAA,EACN,UAAUA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC1B,sBAAsBA,EAAE,QAAA;AAAA,EACxB,eAAeA,EAAE,OAAA,EAAS,SAAA;AAAA,EAC1B,gBAAgBA,EAAE,QAAA,EAAU,SAAA;AAAA,EAC5B,kBAAkBA,EAAE,OAAA,EAAS,SAAA;AAAA,EAC7B,uBAAuBA,EAAE,QAAA,EAAU,SAAA;AAAA,EACnC,YAAYA,EAAE,KAAK;AAAA,IACjBC,EAAW;AAAA,IACXA,EAAW;AAAA,IACXA,EAAW;AAAA,IACXA,EAAW;AAAA,IACXA,EAAW;AAAA,IACXA,EAAW;AAAA,EAAA,CACZ;AAAA,EACD,aAAaD,EAAE,KAAK,CAAC,QAAQ,QAAQ,SAAS,QAAQ,UAAU,CAAC;AAAA,EACjE,MAAMA,EAAE,OAAA,EAAS,SAAA;AACnB,CAAC,EACA,YAAY,CAACE,GAAMC,MAAQ;AAE1B,EAAID,EAAK,yBAAyB,CAACA,EAAK,iBAAiBA,EAAK,cAAc,WA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AA,IACpB,SAAS;AAAA,EAAA,CACV,GAECM,MAAS,KACXH,EAAI,SAAS;AAAA,IACX,MAAMH,EAAE,aAAa;AAAA,IACrB,MAAM,CAAC,MAAM;AAAA,IACb,SAASH;AAAA,EAAA,CACV;AAGP,CAAC,GA8BG,CAACY,GAAiBC,CAAoB,IAC1CC,EAA+C,qBAAqB;"}
1
+ {"version":3,"file":"useCompensation.js","sources":["../../../../src/components/Employee/Compensation/useCompensation.ts"],"sourcesContent":["import type { Job } from '@gusto/embedded-api/models/components/job'\nimport type { MinimumWage } from '@gusto/embedded-api/models/components/minimumwage'\nimport { z } from 'zod'\nimport { createCompoundContext } from '@/components/Base/createCompoundContext'\nimport { FLSA_OVERTIME_SALARY_LIMIT, FlsaStatus } from '@/shared/constants'\nimport { yearlyRate } from '@/helpers/payRateCalculator'\n\nexport const rateMinimumError = 'rate_minimum_error'\nexport const rateExemptThresholdError = 'rate_exempt_threshold_error'\n\nexport const CompensationSchema = z\n .object({\n jobTitle: z.string().min(1),\n adjustForMinimumWage: z.boolean(),\n minimumWageId: z.string().optional(),\n stateWcCovered: z.boolean().optional(),\n stateWcClassCode: z.string().optional(),\n twoPercentShareholder: z.boolean().optional(),\n flsaStatus: z.enum([\n FlsaStatus.EXEMPT,\n FlsaStatus.SALARIED_NONEXEMPT,\n FlsaStatus.NONEXEMPT,\n FlsaStatus.OWNER,\n FlsaStatus.COMMISSION_ONLY_EXEMPT,\n FlsaStatus.COMMISSION_ONLY_NONEXEMPT,\n ]),\n paymentUnit: z.enum(['Hour', 'Week', 'Month', 'Year', 'Paycheck']),\n rate: z.number().optional(),\n })\n .superRefine((data, ctx) => {\n // adjustForMinimumWage\n if (data.adjustForMinimumWage && (!data.minimumWageId || data.minimumWageId.trim() === '')) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['minimumWageId'],\n message: 'minimumWageId is required when adjustForMinimumWage is true',\n })\n }\n\n // stateWcCovered\n if (\n data.stateWcCovered === true &&\n (!data.stateWcClassCode || data.stateWcClassCode.trim() === '')\n ) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['stateWcClassCode'],\n message: 'stateWcClassCode is required when stateWcCovered is true',\n })\n }\n\n // FLSA logic\n const { flsaStatus, paymentUnit, rate } = data\n if (\n flsaStatus === FlsaStatus.EXEMPT ||\n flsaStatus === FlsaStatus.SALARIED_NONEXEMPT ||\n flsaStatus === FlsaStatus.NONEXEMPT\n ) {\n // For EXEMPT, check salary threshold\n if (\n flsaStatus === FlsaStatus.EXEMPT &&\n rate !== undefined &&\n yearlyRate(rate, paymentUnit) < FLSA_OVERTIME_SALARY_LIMIT\n ) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['rate'],\n message: rateExemptThresholdError,\n })\n }\n\n if (rate === undefined || rate < 1) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['rate'],\n message: rateMinimumError,\n })\n }\n } else if (flsaStatus === FlsaStatus.OWNER) {\n if (paymentUnit !== 'Paycheck') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['paymentUnit'],\n message: 'paymentUnit must be Paycheck for OWNER',\n })\n }\n if (rate === undefined || rate < 1) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['rate'],\n message: rateMinimumError,\n })\n }\n } else if (\n [FlsaStatus.COMMISSION_ONLY_EXEMPT, FlsaStatus.COMMISSION_ONLY_NONEXEMPT].includes(flsaStatus)\n ) {\n if (paymentUnit !== 'Year') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['paymentUnit'],\n message: 'paymentUnit must be Year for commission-only FLSA statuses',\n })\n }\n if (rate !== 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['rate'],\n message: rateMinimumError,\n })\n }\n }\n })\n\nexport type CompensationInputs = z.input<typeof CompensationSchema>\nexport type CompensationOutputs = z.output<typeof CompensationSchema>\n\nexport type MODE =\n | 'LIST'\n | 'ADD_ADDITIONAL_JOB'\n | 'ADD_INITIAL_JOB'\n | 'EDIT_ADDITIONAL_JOB'\n | 'EDIT_INITIAL_JOB'\n | 'PROCEED'\n\ntype CompensationContextType = {\n employeeJobs: Job[]\n currentJob?: Job | null\n primaryFlsaStatus?: string\n isPending: boolean\n mode: MODE\n showFlsaChangeWarning: boolean\n minimumWages: MinimumWage[]\n state?: string\n showTwoPercentStakeholder?: boolean\n submitWithEffect: (newMode: MODE) => void\n handleAdd: () => void\n handleEdit: (uuid: string) => void\n handleDelete: (uuid: string) => void\n handleFlsaChange: (status: string | number) => void\n handleCancelAddJob: () => void\n}\nconst [useCompensation, CompensationProvider] =\n createCompoundContext<CompensationContextType>('CompensationContext')\nexport { useCompensation, CompensationProvider }\n"],"names":["rateMinimumError","rateExemptThresholdError","CompensationSchema","z","FlsaStatus","data","ctx","flsaStatus","paymentUnit","rate","yearlyRate","FLSA_OVERTIME_SALARY_LIMIT","useCompensation","CompensationProvider","createCompoundContext"],"mappings":";;;;AAOO,MAAMA,IAAmB,sBACnBC,IAA2B,+BAE3BC,IAAqBC,EAC/B,OAAO;AAAA,EACN,UAAUA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC1B,sBAAsBA,EAAE,QAAA;AAAA,EACxB,eAAeA,EAAE,OAAA,EAAS,SAAA;AAAA,EAC1B,gBAAgBA,EAAE,QAAA,EAAU,SAAA;AAAA,EAC5B,kBAAkBA,EAAE,OAAA,EAAS,SAAA;AAAA,EAC7B,uBAAuBA,EAAE,QAAA,EAAU,SAAA;AAAA,EACnC,YAAYA,EAAE,KAAK;AAAA,IACjBC,EAAW;AAAA,IACXA,EAAW;AAAA,IACXA,EAAW;AAAA,IACXA,EAAW;AAAA,IACXA,EAAW;AAAA,IACXA,EAAW;AAAA,EAAA,CACZ;AAAA,EACD,aAAaD,EAAE,KAAK,CAAC,QAAQ,QAAQ,SAAS,QAAQ,UAAU,CAAC;AAAA,EACjE,MAAMA,EAAE,OAAA,EAAS,SAAA;AACnB,CAAC,EACA,YAAY,C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AI,SAAS;AAAA,IACX,MAAMH,EAAE,aAAa;AAAA,IACrB,MAAM,CAAC,aAAa;AAAA,IACpB,SAAS;AAAA,EAAA,CACV,GAECM,MAAS,KACXH,EAAI,SAAS;AAAA,IACX,MAAMH,EAAE,aAAa;AAAA,IACrB,MAAM,CAAC,MAAM;AAAA,IACb,SAASH;AAAA,EAAA,CACV;AAGP,CAAC,GA8BG,CAACY,GAAiBC,CAAoB,IAC1CC,EAA+C,qBAAqB;"}
@@ -1,7 +1,7 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
2
  import { useTranslation as l } from "react-i18next";
3
3
  import { createMachine as D } from "robot3";
4
- import { useGarnishmentsListSuspense as f } from "@gusto/embedded-api/react-query/garnishmentsList";
4
+ import { useGarnishmentsListSuspense as f } from "/home/runner/work/embedded-react-sdk/embedded-react-sdk/node_modules/@gusto/embedded-api/esm/react-query/garnishmentsList.js";
5
5
  import { useMemo as d } from "react";
6
6
  import { DeductionsListContextual as h, IncludeDeductionsFormContextual as F } from "./DeductionsComponents.js";
7
7
  import { deductionsStateMachine as w } from "./stateMachine.js";
@@ -1 +1 @@
1
- {"version":3,"file":"Deductions.js","sources":["../../../../src/components/Employee/Deductions/Deductions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { createMachine } from 'robot3'\nimport { useGarnishmentsListSuspense } from '@gusto/embedded-api/react-query/garnishmentsList'\nimport { useMemo } from 'react'\nimport type { OnboardingContextInterface } from '../OnboardingFlow/OnboardingFlow'\nimport {\n IncludeDeductionsFormContextual,\n type DeductionsContextInterface,\n DeductionsListContextual,\n} from './DeductionsComponents'\nimport { deductionsStateMachine } from './stateMachine'\nimport { DeductionsForm } from './DeductionsForm/DeductionsForm'\nimport { DeductionsList } from './DeductionsList/DeductionsList'\nimport { IncludeDeductionsForm } from './IncludeDeductionsForm/IncludeDeductionsForm'\nimport { Flow } from '@/components/Flow/Flow'\nimport { BaseComponent, type BaseComponentInterface } from '@/components/Base'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport { useFlow } from '@/components/Flow/useFlow'\n\nexport interface DeductionsProps extends BaseComponentInterface<'Employee.Deductions'> {\n employeeId: string\n}\nfunction DeductionsFlow({ employeeId, onEvent, dictionary }: DeductionsProps) {\n useComponentDictionary('Employee.Deductions', dictionary)\n const { data } = useGarnishmentsListSuspense({ employeeId })\n const deductions = data.garnishmentList!\n const activeDeductions = deductions.filter(deduction => deduction.active)\n const hasExistingDeductions = useMemo(\n () => activeDeductions.length > 0,\n [activeDeductions.length],\n )\n\n // Determine initial state based on existing deductions\n const initialState: 'includeDeductions' | 'viewDeductions' = hasExistingDeductions\n ? 'viewDeductions'\n : 'includeDeductions'\n\n const initialComponent: React.ComponentType = hasExistingDeductions\n ? DeductionsListContextual\n : IncludeDeductionsFormContextual\n\n const manageDeductions = useMemo(\n () =>\n createMachine(\n initialState,\n deductionsStateMachine,\n (initialContext: DeductionsContextInterface) => ({\n ...initialContext,\n component: initialComponent,\n employeeId,\n currentDeductionId: null,\n hasExistingDeductions,\n }),\n ),\n [initialState, initialComponent, employeeId, hasExistingDeductions],\n )\n\n return <Flow machine={manageDeductions} onEvent={onEvent} />\n}\n\nexport function Deductions(props: DeductionsProps) {\n return (\n <BaseComponent {...props}>\n <DeductionsFlow {...props} />\n </BaseComponent>\n )\n}\n\nexport const DeductionsContextual = () => {\n const { employeeId, onEvent } = useFlow<OnboardingContextInterface>()\n const { t } = useTranslation('common')\n\n if (!employeeId) {\n throw new Error(\n t('errors.missingParamsOrContext', {\n component: 'Deductions',\n param: 'employeeId',\n provider: 'FlowProvider',\n }),\n )\n }\n return <Deductions employeeId={employeeId} onEvent={onEvent} />\n}\n\nDeductions.DeductionsForm = DeductionsForm\nDeductions.DeductionsList = DeductionsList\nDeductions.IncludeDeductionsForm = IncludeDeductionsForm\n"],"names":["DeductionsFlow","employeeId","onEvent","dictionary","useComponentDictionary","data","useGarnishmentsListSuspense","activeDeductions","deduction","hasExistingDeductions","useMemo","initialState","initialComponent","DeductionsListContextual","IncludeDeductionsFormContextual","manageDeductions","createMachine","deductionsStateMachine","initialContext","jsx","Flow","Deductions","props","BaseComponent","DeductionsContextual","useFlow","t","useTranslation","DeductionsForm","DeductionsList","IncludeDeductionsForm"],"mappings":";;;;;;;;;;;;;;;AAsBA,SAASA,EAAe,EAAE,YAAAC,GAAY,SAAAC,GAAS,YAAAC,KAA+B;AAC5E,EAAAC,EAAuB,uBAAuBD,CAAU;AACxD,QAAM,EAAE,MAAAE,EAAA,IAASC,EAA4B,EAAE,YAAAL,GAAY,GAErDM,IADaF,EAAK,gBACY,OAAO,CAAAG,MAAaA,EAAU,MAAM,GAClEC,IAAwBC;AAAA,IAC5B,MAAMH,EAAiB,SAAS;AAAA,IAChC,CAACA,EAAiB,MAAM;AAAA,EAAA,GAIpBI,IAAuDF,IACzD,mBACA,qBAEEG,IAAwCH,IAC1CI,IACAC,GAEEC,IAAmBL;AAAA,IACvB,MACEM;AAAA,MACEL;AAAA,MACAM;AAAA,MACA,CAACC,OAAgD;AAAA,QAC/C,GAAGA;AAAA,QACH,WAAWN;AAAA,QACX,YAAAX;AAAA,QACA,oBAAoB;AAAA,QACpB,uBAAAQ;AAAA,MAAA;AAAA,IACF;AAAA,IAEJ,CAACE,GAAcC,GAAkBX,GAAYQ,CAAqB;AAAA,EAAA;AAGpE,SAAO,gBAAAU,EAACC,GAAA,EAAK,SAASL,GAAkB,SAAAb,EAAA,CAAkB;AAC5D;AAEO,SAASmB,EAAWC,GAAwB;AACjD,SACE,gBAAAH,EAACI,KAAe,GAAGD,GACjB,4BAACtB,GAAA,EAAgB,GAAGsB,GAAO,EAAA,CAC7B;AAEJ;AAEO,MAAME,IAAuB,MAAM;AACxC,QAAM,EAAE,YAAAvB,GAAY,SAAAC,EAAA,IAAYuB,EAAA,GAC1B,EAAE,GAAAC,EAAA,IAAMC,EAAe,QAAQ;AAErC,MAAI,CAAC1B;AACH,UAAM,IAAI;AAAA,MACRyB,EAAE,iCAAiC;AAAA,QACjC,WAAW;AAAA,QACX,OAAO;AAAA,QACP,UAAU;AAAA,MAAA,CACX;AAAA,IAAA;AAGL,SAAO,gBAAAP,EAACE,GAAA,EAAW,YAAApB,GAAwB,SAAAC,EAAA,CAAkB;AAC/D;AAEAmB,EAAW,iBAAiBO;AAC5BP,EAAW,iBAAiBQ;AAC5BR,EAAW,wBAAwBS;"}
1
+ {"version":3,"file":"Deductions.js","sources":["../../../../src/components/Employee/Deductions/Deductions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { createMachine } from 'robot3'\nimport { useGarnishmentsListSuspense } from '@gusto/embedded-api/react-query/garnishmentsList'\nimport { useMemo } from 'react'\nimport type { OnboardingContextInterface } from '../OnboardingFlow/OnboardingFlowComponents'\nimport {\n IncludeDeductionsFormContextual,\n type DeductionsContextInterface,\n DeductionsListContextual,\n} from './DeductionsComponents'\nimport { deductionsStateMachine } from './stateMachine'\nimport { DeductionsForm } from './DeductionsForm/DeductionsForm'\nimport { DeductionsList } from './DeductionsList/DeductionsList'\nimport { IncludeDeductionsForm } from './IncludeDeductionsForm/IncludeDeductionsForm'\nimport { Flow } from '@/components/Flow/Flow'\nimport { BaseComponent, type BaseComponentInterface } from '@/components/Base'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport { useFlow } from '@/components/Flow/useFlow'\n\nexport interface DeductionsProps extends BaseComponentInterface<'Employee.Deductions'> {\n employeeId: string\n}\nfunction DeductionsFlow({ employeeId, onEvent, dictionary }: DeductionsProps) {\n useComponentDictionary('Employee.Deductions', dictionary)\n const { data } = useGarnishmentsListSuspense({ employeeId })\n const deductions = data.garnishmentList!\n const activeDeductions = deductions.filter(deduction => deduction.active)\n const hasExistingDeductions = useMemo(\n () => activeDeductions.length > 0,\n [activeDeductions.length],\n )\n\n // Determine initial state based on existing deductions\n const initialState: 'includeDeductions' | 'viewDeductions' = hasExistingDeductions\n ? 'viewDeductions'\n : 'includeDeductions'\n\n const initialComponent: React.ComponentType = hasExistingDeductions\n ? DeductionsListContextual\n : IncludeDeductionsFormContextual\n\n const manageDeductions = useMemo(\n () =>\n createMachine(\n initialState,\n deductionsStateMachine,\n (initialContext: DeductionsContextInterface) => ({\n ...initialContext,\n component: initialComponent,\n employeeId,\n currentDeductionId: null,\n hasExistingDeductions,\n }),\n ),\n [initialState, initialComponent, employeeId, hasExistingDeductions],\n )\n\n return <Flow machine={manageDeductions} onEvent={onEvent} />\n}\n\nexport function Deductions(props: DeductionsProps) {\n return (\n <BaseComponent {...props}>\n <DeductionsFlow {...props} />\n </BaseComponent>\n )\n}\n\nexport const DeductionsContextual = () => {\n const { employeeId, onEvent } = useFlow<OnboardingContextInterface>()\n const { t } = useTranslation('common')\n\n if (!employeeId) {\n throw new Error(\n t('errors.missingParamsOrContext', {\n component: 'Deductions',\n param: 'employeeId',\n provider: 'FlowProvider',\n }),\n )\n }\n return <Deductions employeeId={employeeId} onEvent={onEvent} />\n}\n\nDeductions.DeductionsForm = DeductionsForm\nDeductions.DeductionsList = DeductionsList\nDeductions.IncludeDeductionsForm = IncludeDeductionsForm\n"],"names":["DeductionsFlow","employeeId","onEvent","dictionary","useComponentDictionary","data","useGarnishmentsListSuspense","activeDeductions","deduction","hasExistingDeductions","useMemo","initialState","initialComponent","DeductionsListContextual","IncludeDeductionsFormContextual","manageDeductions","createMachine","deductionsStateMachine","initialContext","jsx","Flow","Deductions","props","BaseComponent","DeductionsContextual","useFlow","t","useTranslation","DeductionsForm","DeductionsList","IncludeDeductionsForm"],"mappings":";;;;;;;;;;;;;;;AAsBA,SAASA,EAAe,EAAE,YAAAC,GAAY,SAAAC,GAAS,YAAAC,KAA+B;AAC5E,EAAAC,EAAuB,uBAAuBD,CAAU;AACxD,QAAM,EAAE,MAAAE,EAAA,IAASC,EAA4B,EAAE,YAAAL,GAAY,GAErDM,IADaF,EAAK,gBACY,OAAO,CAAAG,MAAaA,EAAU,MAAM,GAClEC,IAAwBC;AAAA,IAC5B,MAAMH,EAAiB,SAAS;AAAA,IAChC,CAACA,EAAiB,MAAM;AAAA,EAAA,GAIpBI,IAAuDF,IACzD,mBACA,qBAEEG,IAAwCH,IAC1CI,IACAC,GAEEC,IAAmBL;AAAA,IACvB,MACEM;AAAA,MACEL;AAAA,MACAM;AAAA,MACA,CAACC,OAAgD;AAAA,QAC/C,GAAGA;AAAA,QACH,WAAWN;AAAA,QACX,YAAAX;AAAA,QACA,oBAAoB;AAAA,QACpB,uBAAAQ;AAAA,MAAA;AAAA,IACF;AAAA,IAEJ,CAACE,GAAcC,GAAkBX,GAAYQ,CAAqB;AAAA,EAAA;AAGpE,SAAO,gBAAAU,EAACC,GAAA,EAAK,SAASL,GAAkB,SAAAb,EAAA,CAAkB;AAC5D;AAEO,SAASmB,EAAWC,GAAwB;AACjD,SACE,gBAAAH,EAACI,KAAe,GAAGD,GACjB,4BAACtB,GAAA,EAAgB,GAAGsB,GAAO,EAAA,CAC7B;AAEJ;AAEO,MAAME,IAAuB,MAAM;AACxC,QAAM,EAAE,YAAAvB,GAAY,SAAAC,EAAA,IAAYuB,EAAA,GAC1B,EAAE,GAAAC,EAAA,IAAMC,EAAe,QAAQ;AAErC,MAAI,CAAC1B;AACH,UAAM,IAAI;AAAA,MACRyB,EAAE,iCAAiC;AAAA,QACjC,WAAW;AAAA,QACX,OAAO;AAAA,QACP,UAAU;AAAA,MAAA,CACX;AAAA,IAAA;AAGL,SAAO,gBAAAP,EAACE,GAAA,EAAW,YAAApB,GAAwB,SAAAC,EAAA,CAAkB;AAC/D;AAEAmB,EAAW,iBAAiBO;AAC5BP,EAAW,iBAAiBQ;AAC5BR,EAAW,wBAAwBS;"}
@@ -3,21 +3,22 @@ import { useTranslation as N } from "react-i18next";
3
3
  import { useMemo as B, useEffect as U } from "react";
4
4
  import { z as i } from "zod";
5
5
  import { useForm as _, useWatch as I, FormProvider as w } from "react-hook-form";
6
- import { zodResolver as G } from "@hookform/resolvers/zod";
7
- import { useGarnishmentsCreateMutation as j } from "@gusto/embedded-api/react-query/garnishmentsCreate";
8
- import { useGarnishmentsUpdateMutation as Y } from "@gusto/embedded-api/react-query/garnishmentsUpdate";
9
- import { useGarnishmentsListSuspense as k } from "@gusto/embedded-api/react-query/garnishmentsList";
6
+ import { zodResolver as G } from "/home/runner/work/embedded-react-sdk/embedded-react-sdk/node_modules/@hookform/resolvers/zod/dist/zod.mjs";
7
+ import { useGarnishmentsCreateMutation as j } from "/home/runner/work/embedded-react-sdk/embedded-react-sdk/node_modules/@gusto/embedded-api/esm/react-query/garnishmentsCreate.js";
8
+ import { useGarnishmentsUpdateMutation as Y } from "/home/runner/work/embedded-react-sdk/embedded-react-sdk/node_modules/@gusto/embedded-api/esm/react-query/garnishmentsUpdate.js";
9
+ import { useGarnishmentsListSuspense as k } from "/home/runner/work/embedded-react-sdk/embedded-react-sdk/node_modules/@gusto/embedded-api/esm/react-query/garnishmentsList.js";
10
10
  import { BaseComponent as z } from "../../../Base/Base.js";
11
11
  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
- import { ActionsLayout as J } from "../../../Common/ActionsLayout/ActionsLayout.js";
15
- import { useComponentDictionary as K, useI18n as Q } from "../../../../i18n/I18n.js";
14
+ import "classnames";
16
15
  import { componentEvents as p } from "../../../../shared/constants.js";
17
- import { useComponentContext as X } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
18
- import { TextInputField as Z } from "../../../Common/Fields/TextInputField/TextInputField.js";
19
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";
20
19
  import { NumberInputField as f } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
20
+ import { useComponentDictionary as Q, useI18n as X } from "../../../../i18n/I18n.js";
21
+ import { useComponentContext as Z } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
21
22
  import { CheckboxField as $ } from "../../../Common/Fields/CheckboxField/CheckboxField.js";
22
23
  const ee = i.object({
23
24
  active: i.boolean(),
@@ -30,12 +31,12 @@ const ee = i.object({
30
31
  payPeriodMaximum: i.number().min(0).transform((t) => t > 0 ? t.toString() : null).nullable(),
31
32
  deductAsPercentage: i.string().transform((t) => t === "true")
32
33
  });
33
- function Ce(t) {
34
+ function Me(t) {
34
35
  return /* @__PURE__ */ n(z, { ...t, children: /* @__PURE__ */ n(ne, { ...t, children: t.children }) });
35
36
  }
36
37
  function ne({ className: t, children: b, employeeId: g, deductionId: h, dictionary: y }) {
37
- const { onEvent: u, baseSubmitHandler: P } = H(), { t: r } = N("Employee.Deductions"), m = X();
38
- K("Employee.Deductions", y), Q("Employee.Deductions");
38
+ const { onEvent: u, baseSubmitHandler: P } = H(), { t: r } = N("Employee.Deductions"), m = Z();
39
+ Q("Employee.Deductions", y), X("Employee.Deductions");
39
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(() => ({
40
41
  amount: e?.amount ? Number(e.amount) : 0,
41
42
  description: e?.description ?? "",
@@ -82,7 +83,7 @@ function ne({ className: t, children: b, employeeId: g, deductionId: h, dictiona
82
83
  }, S = r(e ? "editDeductionTitle" : "addDeductionTitle");
83
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: [
84
85
  /* @__PURE__ */ n(m.Heading, { as: "h2", children: S }),
85
- /* @__PURE__ */ n(Z, { name: "description", label: r("descriptionLabel"), isRequired: !0 }),
86
+ /* @__PURE__ */ n(J, { name: "description", label: r("descriptionLabel"), isRequired: !0 }),
86
87
  /* @__PURE__ */ n(
87
88
  x,
88
89
  {
@@ -121,7 +122,7 @@ function ne({ className: t, children: b, employeeId: g, deductionId: h, dictiona
121
122
  /* @__PURE__ */ n(f, { name: "payPeriodMaximum", label: "Pay period maximum", min: 0 })
122
123
  ] }),
123
124
  /* @__PURE__ */ n($, { name: "courtOrdered", label: r("courtOrderedLabel") }),
124
- /* @__PURE__ */ d(J, { children: [
125
+ /* @__PURE__ */ d(K, { children: [
125
126
  /* @__PURE__ */ n(m.Button, { variant: "secondary", onClick: q, children: r("cancelCta") }),
126
127
  /* @__PURE__ */ n(m.Button, { type: "submit", isLoading: F, children: r(e ? "continueCta" : "addDeductionCta") })
127
128
  ] })
@@ -129,6 +130,6 @@ function ne({ className: t, children: b, employeeId: g, deductionId: h, dictiona
129
130
  }
130
131
  export {
131
132
  ee as DeductionSchema,
132
- Ce as DeductionsForm
133
+ Me as DeductionsForm
133
134
  };
134
135
  //# sourceMappingURL=DeductionsForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DeductionsForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/DeductionsForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useEffect, useMemo } from 'react'\nimport { z } from 'zod'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { useGarnishmentsListSuspense } from '@gusto/embedded-api/react-query/garnishmentsList'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport {\n CheckboxField,\n NumberInputField,\n RadioGroupField,\n TextInputField,\n} from '@/components/Common'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\nexport const DeductionSchema = z.object({\n active: z.boolean(),\n amount: z.number().min(0).transform(String),\n description: z.string().min(1),\n courtOrdered: z.boolean(),\n times: z.number().nullable(),\n recurring: z.string().transform(val => val === 'true'),\n annualMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n payPeriodMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n deductAsPercentage: z.string().transform(val => val === 'true'),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ninterface DeductionsFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deductionId?: string | null\n}\n\nexport function DeductionsForm(props: DeductionsFormProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ className, children, employeeId, deductionId, dictionary }: DeductionsFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n useComponentDictionary('Employee.Deductions', dictionary)\n useI18n('Employee.Deductions')\n\n // Fetch all garnishments to find the specific one by ID\n const { data } = useGarnishmentsListSuspense({ employeeId })\n const deduction = deductionId\n ? (data.garnishmentList?.find(g => g.uuid === deductionId) ?? null)\n : null\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n\n const defaultValues: DeductionInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n description: deduction?.description ?? '',\n times: deduction?.times ?? null,\n recurring: deduction?.recurring?.toString() ?? 'true',\n annualMaximum: deduction?.annualMaximum ? Number(deduction.annualMaximum) : null,\n payPeriodMaximum: deduction?.payPeriodMaximum ? Number(deduction.payPeriodMaximum) : null,\n deductAsPercentage: deduction?.deductAsPercentage?.toString() ?? 'true',\n active: true,\n courtOrdered: deduction?.courtOrdered ?? false,\n } as DeductionInputs\n }, [deduction])\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n\n const { reset: resetForm, control } = formMethods\n\n useEffect(() => {\n resetForm(defaultValues)\n }, [deduction, defaultValues, resetForm])\n\n const watchedRecurring = useWatch({ control, name: 'recurring' })\n\n const isPending = isPendingCreate || isPendingUpdate\n\n const onSubmit: SubmitHandler<DeductionPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, times: payload.recurring ? null : 1 },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...payload,\n version: deduction.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CANCEL)\n }\n\n const title = !deduction ? t('addDeductionTitle') : t('editDeductionTitle')\n\n return (\n <section className={className}>\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Components.Heading as=\"h2\">{title}</Components.Heading>\n <TextInputField name=\"description\" label={t('descriptionLabel')} isRequired />\n <RadioGroupField\n name=\"deductAsPercentage\"\n label={t('deductionTypeLabel')}\n isRequired\n options={[\n { value: 'true', label: t('deductionTypePercentageOption') },\n { value: 'false', label: t('deductionTypeFixedAmountOption') },\n ]}\n />\n <NumberInputField\n name=\"amount\"\n label={t('deductionAmountLabel')}\n isRequired\n min={0}\n />\n <RadioGroupField\n name=\"recurring\"\n label={t('frequencyLabel')}\n isRequired\n options={[\n { value: 'true', label: t('frequencyRecurringOption') },\n { value: 'false', label: t('frequencyOneTimeOption') },\n ]}\n />\n {watchedRecurring === 'true' && (\n <>\n <NumberInputField name=\"annualMaximum\" label={t('annualMaxLabel')} min={0} />\n <NumberInputField name=\"payPeriodMaximum\" label=\"Pay period maximum\" min={0} />\n </>\n )}\n <CheckboxField name=\"courtOrdered\" label={t('courtOrderedLabel')} />\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {!deduction ? t('addDeductionCta') : t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n )}\n </Flex>\n </Form>\n </FormProvider>\n </section>\n )\n}\n"],"names":["DeductionSchema","z","val","DeductionsForm","props","jsx","BaseComponent","Root","className","children","employeeId","deductionId","dictionary","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","useComponentDictionary","useI18n","data","useGarnishmentsListSuspense","deduction","g","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","defaultValues","useMemo","formMethods","useForm","zodResolver","resetForm","control","useEffect","watchedRecurring","useWatch","isPending","onSubmit","payload","updateDeductionResponse","componentEvents","createDeductionResponse","handleCancel","title","FormProvider","Form","Flex","jsxs","Fragment","TextInputField","RadioGroupField","NumberInputField","CheckboxField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA4BO,MAAMA,KAAkBC,EAAE,OAAO;AAAA,EACtC,QAAQA,EAAE,QAAA;AAAA,EACV,QAAQA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,UAAU,MAAM;AAAA,EAC1C,aAAaA,EAA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ACL,OAAOxC,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,IAEDwB,MAAqB,UACpB,gBAAAa,EAAAC,GAAA,EACE,UAAA;AAAA,MAAA,gBAAAjD,EAACoD,GAAA,EAAiB,MAAK,iBAAgB,OAAOzC,EAAE,gBAAgB,GAAG,KAAK,GAAG;AAAA,wBAC1EyC,GAAA,EAAiB,MAAK,oBAAmB,OAAM,sBAAqB,KAAK,EAAA,CAAG;AAAA,IAAA,GAC/E;AAAA,sBAEDC,GAAA,EAAc,MAAK,gBAAe,OAAO1C,EAAE,mBAAmB,GAAG;AAAA,sBACjE2C,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAtD,EAACa,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAAS8B,GAC7C,UAAAhC,EAAE,WAAW,EAAA,CAChB;AAAA,MACA,gBAAAX,EAACa,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWwB,GACzC,UAAoC1B,EAAnCQ,IAAqC,gBAAvB,iBAAoC,EAAA,CACtD;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,EAAA,CACF,EAAA,CAEJ,GACF,EAAA,CACF,EAAA,CACF;AAEJ;"}
1
+ {"version":3,"file":"DeductionsForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/DeductionsForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useEffect, useMemo } from 'react'\nimport { z } from 'zod'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { useGarnishmentsListSuspense } from '@gusto/embedded-api/react-query/garnishmentsList'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport {\n CheckboxField,\n NumberInputField,\n RadioGroupField,\n TextInputField,\n} from '@/components/Common'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\nexport const DeductionSchema = z.object({\n active: z.boolean(),\n amount: z.number().min(0).transform(String),\n description: z.string().min(1),\n courtOrdered: z.boolean(),\n times: z.number().nullable(),\n recurring: z.string().transform(val => val === 'true'),\n annualMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n payPeriodMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n deductAsPercentage: z.string().transform(val => val === 'true'),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ninterface DeductionsFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deductionId?: string | null\n}\n\nexport function DeductionsForm(props: DeductionsFormProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ className, children, employeeId, deductionId, dictionary }: DeductionsFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n useComponentDictionary('Employee.Deductions', dictionary)\n useI18n('Employee.Deductions')\n\n // Fetch all garnishments to find the specific one by ID\n const { data } = useGarnishmentsListSuspense({ employeeId })\n const deduction = deductionId\n ? (data.garnishmentList?.find(g => g.uuid === deductionId) ?? null)\n : null\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n\n const defaultValues: DeductionInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n description: deduction?.description ?? '',\n times: deduction?.times ?? null,\n recurring: deduction?.recurring?.toString() ?? 'true',\n annualMaximum: deduction?.annualMaximum ? Number(deduction.annualMaximum) : null,\n payPeriodMaximum: deduction?.payPeriodMaximum ? Number(deduction.payPeriodMaximum) : null,\n deductAsPercentage: deduction?.deductAsPercentage?.toString() ?? 'true',\n active: true,\n courtOrdered: deduction?.courtOrdered ?? false,\n } as DeductionInputs\n }, [deduction])\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n\n const { reset: resetForm, control } = formMethods\n\n useEffect(() => {\n resetForm(defaultValues)\n }, [deduction, defaultValues, resetForm])\n\n const watchedRecurring = useWatch({ control, name: 'recurring' })\n\n const isPending = isPendingCreate || isPendingUpdate\n\n const onSubmit: SubmitHandler<DeductionPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, times: payload.recurring ? null : 1 },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...payload,\n version: deduction.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CANCEL)\n }\n\n const title = !deduction ? t('addDeductionTitle') : t('editDeductionTitle')\n\n return (\n <section className={className}>\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Components.Heading as=\"h2\">{title}</Components.Heading>\n <TextInputField name=\"description\" label={t('descriptionLabel')} isRequired />\n <RadioGroupField\n name=\"deductAsPercentage\"\n label={t('deductionTypeLabel')}\n isRequired\n options={[\n { value: 'true', label: t('deductionTypePercentageOption') },\n { value: 'false', label: t('deductionTypeFixedAmountOption') },\n ]}\n />\n <NumberInputField\n name=\"amount\"\n label={t('deductionAmountLabel')}\n isRequired\n min={0}\n />\n <RadioGroupField\n name=\"recurring\"\n label={t('frequencyLabel')}\n isRequired\n options={[\n { value: 'true', label: t('frequencyRecurringOption') },\n { value: 'false', label: t('frequencyOneTimeOption') },\n ]}\n />\n {watchedRecurring === 'true' && (\n <>\n <NumberInputField name=\"annualMaximum\" label={t('annualMaxLabel')} min={0} />\n <NumberInputField name=\"payPeriodMaximum\" label=\"Pay period maximum\" min={0} />\n </>\n )}\n <CheckboxField name=\"courtOrdered\" label={t('courtOrderedLabel')} />\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {!deduction ? t('addDeductionCta') : t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n )}\n </Flex>\n </Form>\n </FormProvider>\n </section>\n )\n}\n"],"names":["DeductionSchema","z","val","DeductionsForm","props","jsx","BaseComponent","Root","className","children","employeeId","deductionId","dictionary","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","useComponentDictionary","useI18n","data","useGarnishmentsListSuspense","deduction","g","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","defaultValues","useMemo","formMethods","useForm","zodResolver","resetForm","control","useEffect","watchedRecurring","useWatch","isPending","onSubmit","payload","updateDeductionResponse","componentEvents","createDeductionResponse","handleCancel","title","FormProvider","Form","Flex","jsxs","Fragment","TextInputField","RadioGroupField","NumberInputField","CheckboxField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA4BO,MAAMA,KAAkBC,EAAE,OAAO;AAAA,EACtC,QAAQA,EAAE,QAAA;AAAA,EACV,QAAQA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,UAAU,MAAM;AAAA,EAC1C,aAAaA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC7B,cAAcA,EAAE,QAAA;AAAA,EAChB,OAAOA,EAAE,OAAA,EAAS,SAAA;AAAA,EAClB,WAAWA,EAAE,OAAA,EAAS,UAAU,CAAAC,MAAOA,MAAQ,MAAM;AAAA,EACrD,eAAeD,EACZ,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAC,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,kBAAkBD,EACf,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAC,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,oBAAoBD,EAAE,OAAA,EAAS,UAAU,CAAAC,MAAOA,MAAQ,MAAM;AAChE,CAAC;AAUM,SAASC,GAAeC,GAAqD;AAClF,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,MAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,SAASG,GAAK,EAAE,WAAAC,GAAW,UAAAC,GAAU,YAAAC,GAAY,aAAAC,GAAa,YAAAC,KAAmC;AAC/F,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,EAAA,GACjC,EAAE,GAAAC,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA;AAEnB,EAAAC,EAAuB,uBAAuBR,CAAU,GACxDS,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{ jsx as n, jsxs as c, Fragment as A } from "react/jsx-runtime";
2
2
  import { useTranslation as O } from "react-i18next";
3
- import { useGarnishmentsListSuspense as x } from "@gusto/embedded-api/react-query/garnishmentsList";
4
- import { useGarnishmentsUpdateMutation as N } from "@gusto/embedded-api/react-query/garnishmentsUpdate";
3
+ import { useGarnishmentsListSuspense as x } from "/home/runner/work/embedded-react-sdk/embedded-react-sdk/node_modules/@gusto/embedded-api/esm/react-query/garnishmentsList.js";
4
+ import { useGarnishmentsUpdateMutation as N } from "/home/runner/work/embedded-react-sdk/embedded-react-sdk/node_modules/@gusto/embedded-api/esm/react-query/garnishmentsUpdate.js";
5
5
  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
+ import "classnames";
9
+ import { componentEvents as a } from "../../../../shared/constants.js";
8
10
  import { ActionsLayout as I } from "../../../Common/ActionsLayout/ActionsLayout.js";
9
11
  import u from "../../../Common/hooks/useNumberFormatter.js";
10
12
  import M from "../../../../assets/icons/pencil.svg.js";
11
13
  import U from "../../../../assets/icons/trashcan.svg.js";
12
14
  import { HamburgerMenu as B } from "../../../Common/HamburgerMenu/HamburgerMenu.js";
13
15
  import { useComponentDictionary as S, useI18n as Y } from "../../../../i18n/I18n.js";
14
- import { componentEvents as a } from "../../../../shared/constants.js";
15
16
  import { useComponentContext as q } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
16
17
  import { useDataView as F } from "../../../Common/DataView/useDataView.js";
17
18
  import { DataView as H } from "../../../Common/DataView/DataView.js";
18
19
  function se(r) {
19
20
  return /* @__PURE__ */ n(_, { ...r, children: /* @__PURE__ */ n(V, { ...r, children: r.children }) });
20
21
  }
21
- function V({ className: r, children: m, employeeId: d, dictionary: l }) {
22
- const { onEvent: i, baseSubmitHandler: p } = k(), { t } = O("Employee.Deductions"), s = q(), E = u("currency"), f = u("percent");
22
+ function V({ className: r, children: s, employeeId: d, dictionary: l }) {
23
+ const { onEvent: i, baseSubmitHandler: p } = k(), { t } = O("Employee.Deductions"), m = q(), E = u("currency"), f = u("percent");
23
24
  S("Employee.Deductions", l), Y("Employee.Deductions");
24
25
  const { data: D } = x({ employeeId: d }), h = D.garnishmentList.filter((e) => e.active), { mutateAsync: C, isPending: g } = N(), y = async (e) => {
25
26
  await p(e, async (o) => {
@@ -83,12 +84,12 @@ function V({ className: r, children: m, employeeId: d, dictionary: l }) {
83
84
  }
84
85
  )
85
86
  });
86
- return /* @__PURE__ */ n("section", { className: r, children: /* @__PURE__ */ n(w, { flexDirection: "column", gap: 32, children: m || /* @__PURE__ */ c(A, { children: [
87
- /* @__PURE__ */ n(s.Heading, { as: "h2", children: t("pageTitle") }),
87
+ return /* @__PURE__ */ n("section", { className: r, children: /* @__PURE__ */ n(w, { flexDirection: "column", gap: 32, children: s || /* @__PURE__ */ c(A, { children: [
88
+ /* @__PURE__ */ n(m.Heading, { as: "h2", children: t("pageTitle") }),
88
89
  /* @__PURE__ */ n(H, { label: t("deductionsTableLabel"), ...L }),
89
90
  /* @__PURE__ */ c(I, { children: [
90
- /* @__PURE__ */ n(s.Button, { variant: "secondary", onClick: T, children: t("addDeductionCta") }),
91
- /* @__PURE__ */ n(s.Button, { onClick: b, children: t("continueCta") })
91
+ /* @__PURE__ */ n(m.Button, { variant: "secondary", onClick: T, children: t("addDeductionCta") }),
92
+ /* @__PURE__ */ n(m.Button, { onClick: b, children: t("continueCta") })
92
93
  ] })
93
94
  ] }) }) });
94
95
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DeductionsList.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsList/DeductionsList.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useGarnishmentsListSuspense } from '@gusto/embedded-api/react-query/garnishmentsList'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { useDataView, DataView } from '@/components/Common'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport useNumberFormatter from '@/components/Common/hooks/useNumberFormatter'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\ninterface DeductionsListProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n}\n\nexport function DeductionsList(props: DeductionsListProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ className, children, employeeId, dictionary }: DeductionsListProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n const formatCurrency = useNumberFormatter('currency')\n const formatPercent = useNumberFormatter('percent')\n\n useComponentDictionary('Employee.Deductions', dictionary)\n useI18n('Employee.Deductions')\n\n const { data } = useGarnishmentsListSuspense({ employeeId })\n const deductions = data.garnishmentList!\n const activeDeductions = deductions.filter(deduction => deduction.active)\n\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n\n const handleDelete = async (deduction: Garnishment) => {\n await baseSubmitHandler(deduction, async payload => {\n const { garnishment } = await updateDeduction({\n request: {\n garnishmentId: payload.uuid,\n requestBody: {\n ...payload,\n totalAmount: payload.totalAmount ?? undefined,\n active: false,\n version: payload.version as string,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DELETED, garnishment)\n })\n }\n\n const handleEdit = (deduction: Garnishment) => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_EDIT, deduction)\n }\n\n const handleAdd = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_ADD)\n }\n\n const handleContinue = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DONE)\n }\n\n const { ...dataViewProps } = useDataView({\n data: activeDeductions,\n columns: [\n { key: 'description', title: t('nameColumn') },\n {\n key: 'recurring',\n title: t('frequencyColumn'),\n render: deduction => {\n return deduction.recurring ? t('recurringText') : t('nonRecurringText')\n },\n },\n {\n key: 'amount',\n title: t('withheldColumn'),\n render: deduction => {\n const formattedAmount = deduction.deductAsPercentage\n ? formatPercent(Number(deduction.amount))\n : formatCurrency(Number(deduction.amount))\n return deduction.recurring\n ? t('recurringAmount', { value: formattedAmount })\n : formattedAmount\n },\n },\n ],\n itemMenu: deduction => {\n return (\n <HamburgerMenu\n isLoading={isPendingUpdate}\n items={[\n {\n label: t('editCta'),\n onClick: () => {\n handleEdit(deduction)\n },\n icon: <PencilSvg aria-hidden />,\n },\n {\n label: t('deleteCta'),\n onClick: async () => {\n await handleDelete(deduction)\n },\n icon: <TrashCanSvg aria-hidden />,\n },\n ]}\n />\n )\n },\n })\n\n return (\n <section className={className}>\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Components.Heading as=\"h2\">{t('pageTitle')}</Components.Heading>\n <DataView label={t('deductionsTableLabel')} {...dataViewProps} />\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleAdd}>\n {t('addDeductionCta')}\n </Components.Button>\n <Components.Button onClick={handleContinue}>{t('continueCta')}</Components.Button>\n </ActionsLayout>\n </>\n )}\n </Flex>\n </section>\n )\n}\n"],"names":["DeductionsList","props","jsx","BaseComponent","Root","className","children","employeeId","dictionary","onEvent","baseSubmitHandler","useBase","useTranslation","Components","useComponentContext","formatCurrency","useNumberFormatter","formatPercent","useComponentDictionary","useI18n","data","useGarnishmentsListSuspense","activeDeductions","deduction","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","handleDelete","payload","garnishment","componentEvents","handleEdit","handleAdd","handleContinue","dataViewProps","useDataView","formattedAmount","HamburgerMenu","PencilSvg","TrashCanSvg","Flex","jsxs","Fragment","DataView","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;AA0BO,SAASA,GAAeC,GAAqD;AAClF,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,SAASG,EAAK,EAAE,WAAAC,GAAW,UAAAC,GAAU,YAAAC,GAAY,YAAAC,KAAmC;AAClF,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,EAAA,GACjC,EAAE,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA,GACbC,IAAiBC,EAAmB,UAAU,GAC9CC,IAAgBD,EAAmB,SAAS;AAElD,EAAAE,EAAuB,uBAAuBV,CAAU,GACxDW,EAAQ,qBAAqB;AAE7B,QAAM,EAAE,MAAAC,EAAA,IAASC,EAA4B,EAAE,YAAAd,GAAY,GAErDe,IADaF,EAAK,gBACY,OAAO,CAAAG,MAAaA,EAAU,MAAM,GAElE,EAAE,aAAaC,GAAiB,WAAWC,EAAA,IAC/CC,EAAA,GAEIC,IAAe,OAAOJ,MAA2B;AACrD,UAAMb,EAAkBa,GAAW,OAAMK,MAAW;AAClD,YAAM,EAAE,aAAAC,MAAgB,MAAML,EAAgB;AAAA,QAC5C,SAAS;AAAA,UACP,eAAeI,EAAQ;AAAA,UACvB,aAAa;AAAA,YACX,GAAGA;AAAA,YACH,aAAaA,EAAQ,eAAe;AAAA,YACpC,QAAQ;AAAA,YACR,SAASA,EAAQ;AAAA,UAAA;AAAA,QACnB;AAAA,MACF,CACD;AACD,MAAAnB,EAAQqB,EAAgB,4BAA4BD,CAAW;AAAA,IACjE,CAAC;AAAA,EACH,GAEME,IAAa,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AY,eAAW,GAAA,CAAC;AAAA,UAAA;AAAA,QACjC;AAAA,MACF;AAAA,IAAA;AAAA,EAGN,CACD;AAED,SACE,gBAAArC,EAAC,WAAA,EAAQ,WAAAG,GACP,UAAA,gBAAAH,EAACsC,GAAA,EAAK,eAAc,UAAS,KAAK,IAC/B,UAAAlC,KAGC,gBAAAmC,EAAAC,GAAA,EACE,UAAA;AAAA,IAAA,gBAAAxC,EAACW,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAA,EAAE,WAAW,GAAE;AAAA,sBAC3C8B,GAAA,EAAS,OAAO,EAAE,sBAAsB,GAAI,GAAGT,GAAe;AAAA,sBAC9DU,GAAA,EACC,UAAA;AAAA,MAAA,gBAAA1C,EAACW,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASmB,GAC7C,UAAA,EAAE,iBAAiB,EAAA,CACtB;AAAA,MACA,gBAAA9B,EAACW,EAAW,QAAX,EAAkB,SAASoB,GAAiB,UAAA,EAAE,aAAa,EAAA,CAAE;AAAA,IAAA,EAAA,CAChE;AAAA,EAAA,EAAA,CACF,GAEJ,GACF;AAEJ;"}
1
+ {"version":3,"file":"DeductionsList.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsList/DeductionsList.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useGarnishmentsListSuspense } from '@gusto/embedded-api/react-query/garnishmentsList'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { useDataView, DataView } from '@/components/Common'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport useNumberFormatter from '@/components/Common/hooks/useNumberFormatter'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\ninterface DeductionsListProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n}\n\nexport function DeductionsList(props: DeductionsListProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ className, children, employeeId, dictionary }: DeductionsListProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n const formatCurrency = useNumberFormatter('currency')\n const formatPercent = useNumberFormatter('percent')\n\n useComponentDictionary('Employee.Deductions', dictionary)\n useI18n('Employee.Deductions')\n\n const { data } = useGarnishmentsListSuspense({ employeeId })\n const deductions = data.garnishmentList!\n const activeDeductions = deductions.filter(deduction => deduction.active)\n\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n\n const handleDelete = async (deduction: Garnishment) => {\n await baseSubmitHandler(deduction, async payload => {\n const { garnishment } = await updateDeduction({\n request: {\n garnishmentId: payload.uuid,\n requestBody: {\n ...payload,\n totalAmount: payload.totalAmount ?? undefined,\n active: false,\n version: payload.version as string,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DELETED, garnishment)\n })\n }\n\n const handleEdit = (deduction: Garnishment) => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_EDIT, deduction)\n }\n\n const handleAdd = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_ADD)\n }\n\n const handleContinue = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DONE)\n }\n\n const { ...dataViewProps } = useDataView({\n data: activeDeductions,\n columns: [\n { key: 'description', title: t('nameColumn') },\n {\n key: 'recurring',\n title: t('frequencyColumn'),\n render: deduction => {\n return deduction.recurring ? t('recurringText') : t('nonRecurringText')\n },\n },\n {\n key: 'amount',\n title: t('withheldColumn'),\n render: deduction => {\n const formattedAmount = deduction.deductAsPercentage\n ? formatPercent(Number(deduction.amount))\n : formatCurrency(Number(deduction.amount))\n return deduction.recurring\n ? t('recurringAmount', { value: formattedAmount })\n : formattedAmount\n },\n },\n ],\n itemMenu: deduction => {\n return (\n <HamburgerMenu\n isLoading={isPendingUpdate}\n items={[\n {\n label: t('editCta'),\n onClick: () => {\n handleEdit(deduction)\n },\n icon: <PencilSvg aria-hidden />,\n },\n {\n label: t('deleteCta'),\n onClick: async () => {\n await handleDelete(deduction)\n },\n icon: <TrashCanSvg aria-hidden />,\n },\n ]}\n />\n )\n },\n })\n\n return (\n <section className={className}>\n <Flex flexDirection=\"column\" gap={32}>\n {children ? (\n children\n ) : (\n <>\n <Components.Heading as=\"h2\">{t('pageTitle')}</Components.Heading>\n <DataView label={t('deductionsTableLabel')} {...dataViewProps} />\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleAdd}>\n {t('addDeductionCta')}\n </Components.Button>\n <Components.Button onClick={handleContinue}>{t('continueCta')}</Components.Button>\n </ActionsLayout>\n </>\n )}\n </Flex>\n </section>\n )\n}\n"],"names":["DeductionsList","props","jsx","BaseComponent","Root","className","children","employeeId","dictionary","onEvent","baseSubmitHandler","useBase","useTranslation","Components","useComponentContext","formatCurrency","useNumberFormatter","formatPercent","useComponentDictionary","useI18n","data","useGarnishmentsListSuspense","activeDeductions","deduction","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","handleDelete","payload","garnishment","componentEvents","handleEdit","handleAdd","handleContinue","dataViewProps","useDataView","formattedAmount","HamburgerMenu","PencilSvg","TrashCanSvg","Flex","jsxs","Fragment","DataView","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;AA0BO,SAASA,GAAeC,GAAqD;AAClF,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAA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