@gusto/embedded-react-sdk 0.31.1 → 0.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (412) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/dist/assets/icons/icon-arrow-right.svg.js +10 -0
  3. package/dist/assets/icons/icon-arrow-right.svg.js.map +1 -0
  4. package/dist/components/Base/Base.js +46 -45
  5. package/dist/components/Base/Base.js.map +1 -1
  6. package/dist/components/Base/useBase.d.ts +2 -3
  7. package/dist/components/Base/useBase.js.map +1 -1
  8. package/dist/components/Base/useBaseSubmit.js +32 -19
  9. package/dist/components/Base/useBaseSubmit.js.map +1 -1
  10. package/dist/components/Common/DataView/DataView.js +1 -1
  11. package/dist/components/Common/DocumentList/DocumentList.js +1 -1
  12. package/dist/components/Common/DocumentViewer/DocumentViewer.js +1 -1
  13. package/dist/components/Common/FlowBreadcrumbs/FlowBreadcrumbs.js +1 -1
  14. package/dist/components/Common/MultiSelectComboBox/MultiSelectComboBox.d.ts +2 -0
  15. package/dist/components/Common/MultiSelectComboBox/MultiSelectComboBoxTypes.d.ts +16 -0
  16. package/dist/components/Common/MultiSelectComboBox/index.d.ts +3 -0
  17. package/dist/components/Common/RequirementsList/RequirementsList.js +1 -1
  18. package/dist/components/Common/RequirementsList/RequirementsList.js.map +1 -1
  19. package/dist/components/Common/RequirementsList/RequirementsList.module.scss.js +1 -1
  20. package/dist/components/Common/SignatureForm/SignatureForm.js +3 -2
  21. package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
  22. package/dist/components/Common/SignatureForm/SignatureFormActions.js +4 -3
  23. package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
  24. package/dist/components/Common/SignatureForm/SignatureFormFields.js +7 -6
  25. package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
  26. package/dist/components/Common/UI/Badge/Badge.js +39 -8
  27. package/dist/components/Common/UI/Badge/Badge.js.map +1 -1
  28. package/dist/components/Common/UI/Badge/Badge.module.scss.js +8 -4
  29. package/dist/components/Common/UI/Badge/Badge.module.scss.js.map +1 -1
  30. package/dist/components/Common/UI/Badge/BadgeTypes.d.ts +12 -0
  31. package/dist/components/Common/UI/Badge/BadgeTypes.js.map +1 -1
  32. package/dist/components/Common/UI/Box/Box.d.ts +2 -0
  33. package/dist/components/Common/UI/Box/Box.js +13 -0
  34. package/dist/components/Common/UI/Box/Box.js.map +1 -0
  35. package/dist/components/Common/UI/Box/Box.module.scss.js +12 -0
  36. package/dist/components/Common/UI/Box/Box.module.scss.js.map +1 -0
  37. package/dist/components/Common/UI/Box/BoxTypes.d.ts +15 -0
  38. package/dist/components/Common/UI/Box/index.d.ts +2 -0
  39. package/dist/components/Common/UI/Dialog/Dialog.js +1 -1
  40. package/dist/components/Common/UI/Input/InputTypes.d.ts +1 -1
  41. package/dist/components/Common/UI/Input/InputTypes.js.map +1 -1
  42. package/dist/components/Common/UI/List/List.module.scss.js +1 -1
  43. package/dist/components/Common/UI/Modal/Modal.js +1 -1
  44. package/dist/components/Common/UI/Tabs/Tabs.js +1 -1
  45. package/dist/components/Common/UI/TextInput/TextInput.js +30 -28
  46. package/dist/components/Common/UI/TextInput/TextInput.js.map +1 -1
  47. package/dist/components/Common/UI/TextInput/TextInputTypes.d.ts +1 -1
  48. package/dist/components/Common/UI/TextInput/TextInputTypes.js.map +1 -1
  49. package/dist/components/Company/AssignSignatory/AssignSignatory.js +3 -2
  50. package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
  51. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +3 -2
  52. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
  53. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +3 -2
  54. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
  55. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +6 -5
  56. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js.map +1 -1
  57. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +2 -2
  58. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +3 -2
  59. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
  60. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +5 -4
  61. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js.map +1 -1
  62. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +2 -2
  63. package/dist/components/Company/AssignSignatory/TitleSelect.js +5 -5
  64. package/dist/components/Company/AssignSignatory/TitleSelect.js.map +1 -1
  65. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +2 -2
  66. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +9 -8
  67. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
  68. package/dist/components/Company/BankAccount/BankAccountForm/Form.js +5 -4
  69. package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
  70. package/dist/components/Company/BankAccount/BankAccountForm/context.js +2 -2
  71. package/dist/components/Company/BankAccount/BankAccountList/Actions.js +3 -2
  72. package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
  73. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +7 -6
  74. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
  75. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +5 -4
  76. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
  77. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +3 -2
  78. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
  79. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +9 -8
  80. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  81. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +2 -2
  82. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +3 -2
  83. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  84. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +2 -2
  85. package/dist/components/Company/FederalTaxes/Actions.js +7 -6
  86. package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
  87. package/dist/components/Company/FederalTaxes/FederalTaxes.js +3 -2
  88. package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
  89. package/dist/components/Company/FederalTaxes/Form.js +3 -2
  90. package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
  91. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +2 -2
  92. package/dist/components/Company/Industry/Actions.js +8 -7
  93. package/dist/components/Company/Industry/Actions.js.map +1 -1
  94. package/dist/components/Company/Industry/Context.js +2 -2
  95. package/dist/components/Company/Industry/Edit.js +3 -2
  96. package/dist/components/Company/Industry/Edit.js.map +1 -1
  97. package/dist/components/Company/Locations/LocationForm/Actions.js +7 -6
  98. package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
  99. package/dist/components/Company/Locations/LocationForm/Form.js +5 -4
  100. package/dist/components/Company/Locations/LocationForm/Form.js.map +1 -1
  101. package/dist/components/Company/Locations/LocationForm/LocationForm.js +3 -2
  102. package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
  103. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +2 -2
  104. package/dist/components/Company/Locations/LocationsList/Actions.js +3 -2
  105. package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
  106. package/dist/components/Company/Locations/LocationsList/List.js +7 -6
  107. package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
  108. package/dist/components/Company/Locations/LocationsList/LocationsList.js +3 -2
  109. package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
  110. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +2 -2
  111. package/dist/components/Company/OnboardingOverview/Completed.js +11 -10
  112. package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
  113. package/dist/components/Company/OnboardingOverview/MissingRequirements.js +38 -26
  114. package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
  115. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +7 -6
  116. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
  117. package/dist/components/Company/OnboardingOverview/context.js +2 -2
  118. package/dist/components/Company/PaySchedule/PaySchedule.js +24 -21
  119. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  120. package/dist/components/Company/PaySchedule/_parts/Actions.js +3 -2
  121. package/dist/components/Company/PaySchedule/_parts/Actions.js.map +1 -1
  122. package/dist/components/Company/PaySchedule/_parts/Edit.js +10 -9
  123. package/dist/components/Company/PaySchedule/_parts/Edit.js.map +1 -1
  124. package/dist/components/Company/PaySchedule/_parts/Head.js +9 -8
  125. package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
  126. package/dist/components/Company/PaySchedule/_parts/List.js +6 -5
  127. package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
  128. package/dist/components/Company/PaySchedule/usePaySchedule.js +2 -2
  129. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +3 -2
  130. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
  131. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +40 -46
  132. package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
  133. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +2 -2
  134. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +3 -2
  135. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
  136. package/dist/components/Company/StateTaxes/StateTaxesList/List.js +3 -2
  137. package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
  138. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +2 -2
  139. package/dist/components/Company/index.js +20 -20
  140. package/dist/components/Contractor/Address/Address.js +6 -6
  141. package/dist/components/Contractor/Address/Address.js.map +1 -1
  142. package/dist/components/Contractor/Address/Form.js +7 -6
  143. package/dist/components/Contractor/Address/Form.js.map +1 -1
  144. package/dist/components/Contractor/Address/useAddress.js +2 -2
  145. package/dist/components/Contractor/ContractorList/index.js +16 -15
  146. package/dist/components/Contractor/ContractorList/index.js.map +1 -1
  147. package/dist/components/Contractor/NewHireReport/NewHireReport.js +14 -13
  148. package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
  149. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +11 -10
  150. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -1
  151. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +3 -2
  152. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -1
  153. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +3 -2
  154. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js.map +1 -1
  155. package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js +151 -116
  156. package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js.map +1 -1
  157. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.d.ts +4 -1
  158. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js +55 -50
  159. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js.map +1 -1
  160. package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentFormSchema.d.ts +84 -0
  161. package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentFormSchema.js +23 -0
  162. package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentFormSchema.js.map +1 -0
  163. package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.d.ts +3 -31
  164. package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js +61 -66
  165. package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js.map +1 -1
  166. package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.d.ts +2 -1
  167. package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js +21 -22
  168. package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js.map +1 -1
  169. package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.d.ts +2 -1
  170. package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js +32 -29
  171. package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js.map +1 -1
  172. package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js +0 -1
  173. package/dist/components/Contractor/Payments/PaymentFlow/PaymentFlowComponents.js.map +1 -1
  174. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js +3 -2
  175. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js.map +1 -1
  176. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js +3 -2
  177. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js.map +1 -1
  178. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js +3 -2
  179. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js.map +1 -1
  180. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +27 -27
  181. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -1
  182. package/dist/components/Contractor/Profile/useContractorProfile.js +2 -2
  183. package/dist/components/Contractor/Submit/Submit.js +20 -19
  184. package/dist/components/Contractor/Submit/Submit.js.map +1 -1
  185. package/dist/components/Employee/Compensation/Actions.js +13 -12
  186. package/dist/components/Employee/Compensation/Actions.js.map +1 -1
  187. package/dist/components/Employee/Compensation/Edit.js +3 -2
  188. package/dist/components/Employee/Compensation/Edit.js.map +1 -1
  189. package/dist/components/Employee/Compensation/List.js +23 -22
  190. package/dist/components/Employee/Compensation/List.js.map +1 -1
  191. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +2 -2
  192. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +2 -2
  193. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +2 -2
  194. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +7 -6
  195. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js.map +1 -1
  196. package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.js +3 -2
  197. package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.js.map +1 -1
  198. package/dist/components/Employee/Deductions/stateMachine.js +1 -1
  199. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +9 -8
  200. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
  201. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +24 -22
  202. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  203. package/dist/components/Employee/DocumentSigner/DocumentList/List.js +3 -2
  204. package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
  205. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.d.ts +1 -0
  206. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +2 -2
  207. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  208. package/dist/components/Employee/DocumentSigner/DocumentSigner.js +9 -9
  209. package/dist/components/Employee/DocumentSigner/DocumentSigner.js.map +1 -1
  210. package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js +46 -41
  211. package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js.map +1 -1
  212. package/dist/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.js +150 -111
  213. package/dist/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.js.map +1 -1
  214. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +3 -2
  215. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  216. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +2 -2
  217. package/dist/components/Employee/DocumentSigner/documentSignerStateMachine.d.ts +1 -0
  218. package/dist/components/Employee/DocumentSigner/documentSignerStateMachine.js.map +1 -1
  219. package/dist/components/Employee/DocumentSigner/stateMachine.js +34 -22
  220. package/dist/components/Employee/DocumentSigner/stateMachine.js.map +1 -1
  221. package/dist/components/Employee/EmployeeDocuments/EmployeeDocumentsPresentation.js +3 -2
  222. package/dist/components/Employee/EmployeeDocuments/EmployeeDocumentsPresentation.js.map +1 -1
  223. package/dist/components/Employee/EmployeeList/Actions.js +7 -6
  224. package/dist/components/Employee/EmployeeList/Actions.js.map +1 -1
  225. package/dist/components/Employee/EmployeeList/Head.js +6 -5
  226. package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
  227. package/dist/components/Employee/EmployeeList/List.js +3 -2
  228. package/dist/components/Employee/EmployeeList/List.js.map +1 -1
  229. package/dist/components/Employee/EmployeeList/useEmployeeList.js +2 -2
  230. package/dist/components/Employee/FederalTaxes/Actions.js +6 -5
  231. package/dist/components/Employee/FederalTaxes/Actions.js.map +1 -1
  232. package/dist/components/Employee/FederalTaxes/FederalForm.js +5 -4
  233. package/dist/components/Employee/FederalTaxes/FederalForm.js.map +1 -1
  234. package/dist/components/Employee/FederalTaxes/FederalTaxes.js +16 -15
  235. package/dist/components/Employee/FederalTaxes/FederalTaxes.js.map +1 -1
  236. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +2 -2
  237. package/dist/components/Employee/Landing/Landing.js +50 -44
  238. package/dist/components/Employee/Landing/Landing.js.map +1 -1
  239. package/dist/components/Employee/PaymentMethod/Actions.js +6 -5
  240. package/dist/components/Employee/PaymentMethod/Actions.js.map +1 -1
  241. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +3 -2
  242. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js.map +1 -1
  243. package/dist/components/Employee/PaymentMethod/BankAccountsList.js +3 -2
  244. package/dist/components/Employee/PaymentMethod/BankAccountsList.js.map +1 -1
  245. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +6 -5
  246. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +1 -1
  247. package/dist/components/Employee/PaymentMethod/Split.js +3 -2
  248. package/dist/components/Employee/PaymentMethod/Split.js.map +1 -1
  249. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +2 -2
  250. package/dist/components/Employee/Profile/Actions.js +6 -5
  251. package/dist/components/Employee/Profile/Actions.js.map +1 -1
  252. package/dist/components/Employee/Profile/AdminPersonalDetails.js +8 -7
  253. package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
  254. package/dist/components/Employee/Profile/HomeAddress.js +9 -8
  255. package/dist/components/Employee/Profile/HomeAddress.js.map +1 -1
  256. package/dist/components/Employee/Profile/PersonalDetailsInputs.js +9 -8
  257. package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
  258. package/dist/components/Employee/Profile/useProfile.js +2 -2
  259. package/dist/components/Employee/StateTaxes/Actions.js +6 -5
  260. package/dist/components/Employee/StateTaxes/Actions.js.map +1 -1
  261. package/dist/components/Employee/StateTaxes/StateTaxes.js +29 -29
  262. package/dist/components/Employee/StateTaxes/StateTaxes.js.map +1 -1
  263. package/dist/components/Employee/StateTaxes/useStateTaxes.js +2 -2
  264. package/dist/components/Employee/Taxes/Actions.js +7 -6
  265. package/dist/components/Employee/Taxes/Actions.js.map +1 -1
  266. package/dist/components/Employee/Taxes/FederalForm.js +7 -6
  267. package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
  268. package/dist/components/Employee/Taxes/Taxes.js +19 -19
  269. package/dist/components/Employee/Taxes/Taxes.js.map +1 -1
  270. package/dist/components/Employee/Taxes/useTaxes.js +2 -2
  271. package/dist/components/Employee/index.js +22 -22
  272. package/dist/components/Flow/Flow.js +8 -7
  273. package/dist/components/Flow/Flow.js.map +1 -1
  274. package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js +1 -0
  275. package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js.map +1 -1
  276. package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.d.ts +0 -1
  277. package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js +32 -37
  278. package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js.map +1 -1
  279. package/dist/components/InformationRequests/InformationRequests.d.ts +1 -2
  280. package/dist/components/InformationRequests/InformationRequests.js +36 -43
  281. package/dist/components/InformationRequests/InformationRequests.js.map +1 -1
  282. package/dist/components/InformationRequests/index.js +4 -4
  283. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +1 -0
  284. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js.map +1 -1
  285. package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js +23 -21
  286. package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js.map +1 -1
  287. package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.d.ts +2 -0
  288. package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js +79 -0
  289. package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -0
  290. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.d.ts +2 -0
  291. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js +46 -0
  292. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js.map +1 -0
  293. package/dist/components/Payroll/OffCycleCreation/OffCycleCreationTypes.d.ts +14 -0
  294. package/dist/components/Payroll/OffCycleCreation/index.d.ts +3 -0
  295. package/dist/components/Payroll/OffCycleDeductionsSetting/OffCycleDeductionsSetting.d.ts +2 -0
  296. package/dist/components/Payroll/OffCycleDeductionsSetting/OffCycleDeductionsSetting.js +44 -0
  297. package/dist/components/Payroll/OffCycleDeductionsSetting/OffCycleDeductionsSetting.js.map +1 -0
  298. package/dist/components/Payroll/OffCycleDeductionsSetting/index.d.ts +3 -0
  299. package/dist/components/Payroll/OffCycleDeductionsSetting/types.d.ts +10 -0
  300. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.d.ts +1 -2
  301. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js +37 -0
  302. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js.map +1 -0
  303. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.module.scss.js +12 -0
  304. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.module.scss.js.map +1 -0
  305. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes.d.ts +0 -4
  306. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes.js +48 -0
  307. package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes.js.map +1 -0
  308. package/dist/components/Payroll/OffCyclePayPeriodDateForm/useOffCyclePayPeriodDateValidation.js +18 -0
  309. package/dist/components/Payroll/OffCyclePayPeriodDateForm/useOffCyclePayPeriodDateValidation.js.map +1 -0
  310. package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelection.js +26 -27
  311. package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelection.js.map +1 -1
  312. package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.d.ts +3 -3
  313. package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js +17 -16
  314. package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js.map +1 -1
  315. package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.d.ts +2 -0
  316. package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModalTypes.d.ts +8 -0
  317. package/dist/components/Payroll/OffCycleTaxWithholdingModal/index.d.ts +3 -0
  318. package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTable.d.ts +2 -0
  319. package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes.d.ts +17 -0
  320. package/dist/components/Payroll/OffCycleTaxWithholdingTable/index.d.ts +3 -0
  321. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.d.ts +3 -8
  322. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js +37 -35
  323. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js.map +1 -1
  324. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +16 -24
  325. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js.map +1 -1
  326. package/dist/components/Payroll/PayrollBlocker/payrollHelpers.d.ts +2 -0
  327. package/dist/components/Payroll/PayrollBlocker/payrollHelpers.js +30 -24
  328. package/dist/components/Payroll/PayrollBlocker/payrollHelpers.js.map +1 -1
  329. package/dist/components/Payroll/PayrollBlocker/payrollHelpers.test.d.ts +1 -0
  330. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +12 -8
  331. package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
  332. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +42 -41
  333. package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
  334. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +4 -3
  335. package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
  336. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +6 -5
  337. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
  338. package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js +38 -35
  339. package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js.map +1 -1
  340. package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.d.ts +1 -0
  341. package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js.map +1 -1
  342. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +16 -15
  343. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
  344. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js +32 -32
  345. package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js.map +1 -1
  346. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +19 -18
  347. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
  348. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +70 -67
  349. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
  350. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.d.ts +2 -1
  351. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +39 -36
  352. package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
  353. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.d.ts +2 -1
  354. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js +18 -19
  355. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js.map +1 -1
  356. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +1 -1
  357. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js +3 -2
  358. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js.map +1 -1
  359. package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js +7 -6
  360. package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js.map +1 -1
  361. package/dist/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.js +4 -3
  362. package/dist/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.js.map +1 -1
  363. package/dist/components/Payroll/index.d.ts +4 -0
  364. package/dist/components/Payroll/index.js +22 -18
  365. package/dist/components/Payroll/index.js.map +1 -1
  366. package/dist/components/Payroll/usePreparedPayrollData.js +2 -2
  367. package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js +48 -46
  368. package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js.map +1 -1
  369. package/dist/contexts/ComponentAdapter/componentAdapterTypes.d.ts +1 -0
  370. package/dist/contexts/ComponentAdapter/useComponentContext.d.ts +2 -0
  371. package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
  372. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +3 -2
  373. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
  374. package/dist/contexts/ThemeProvider/theme.d.ts +1 -0
  375. package/dist/contexts/ThemeProvider/theme.js +1 -0
  376. package/dist/contexts/ThemeProvider/theme.js.map +1 -1
  377. package/dist/helpers/apiErrorToList.js +14 -8
  378. package/dist/helpers/apiErrorToList.js.map +1 -1
  379. package/dist/helpers/dateFormatting.js +61 -45
  380. package/dist/helpers/dateFormatting.js.map +1 -1
  381. package/dist/helpers/formattedStrings.d.ts +1 -0
  382. package/dist/helpers/formattedStrings.js +21 -20
  383. package/dist/helpers/formattedStrings.js.map +1 -1
  384. package/dist/hooks/useOverflowDetection/useOverflowDetection.js +5 -6
  385. package/dist/i18n/I18n.js +7 -7
  386. package/dist/i18n/I18n.js.map +1 -1
  387. package/dist/i18n/en/Contractor.Payments.CreatePayment.json.js +12 -12
  388. package/dist/i18n/en/Employee.EmployeeDocuments.json.js +1 -1
  389. package/dist/i18n/en/Employee.I9SignatureForm.json.js +83 -65
  390. package/dist/i18n/en/Employee.I9SignatureForm.json.js.map +1 -1
  391. package/dist/i18n/en/Employee.Landing.json.js +7 -9
  392. package/dist/i18n/en/Employee.Landing.json.js.map +1 -1
  393. package/dist/i18n/en/Payroll.OffCycleCreation.json.js +14 -0
  394. package/dist/i18n/en/Payroll.OffCycleCreation.json.js.map +1 -0
  395. package/dist/i18n/en/Payroll.OffCycleDeductionsSetting.json.js +12 -0
  396. package/dist/i18n/en/Payroll.OffCycleDeductionsSetting.json.js.map +1 -0
  397. package/dist/i18n/en/Payroll.OffCycleTaxWithholding.json.js +18 -0
  398. package/dist/i18n/en/Payroll.OffCycleTaxWithholding.json.js.map +1 -0
  399. package/dist/i18n/en/Payroll.PayrollBlocker.json.js +21 -19
  400. package/dist/i18n/en/Payroll.PayrollBlocker.json.js.map +1 -1
  401. package/dist/i18n/en/Payroll.PayrollOverview.json.js +1 -1
  402. package/dist/i18n/en/common.json.d.ts +4 -1
  403. package/dist/i18n/en/common.json.js +5 -5
  404. package/dist/shared/constants.d.ts +4 -0
  405. package/dist/shared/constants.js +6 -4
  406. package/dist/shared/constants.js.map +1 -1
  407. package/dist/style.css +1 -1
  408. package/dist/types/i18next.d.ts +79 -2
  409. package/docs/reference/endpoint-inventory.json +1706 -0
  410. package/package.json +29 -13
  411. package/dist/components/Employee/Landing/Landing.module.scss.js +0 -8
  412. package/dist/components/Employee/Landing/Landing.module.scss.js.map +0 -1
@@ -7,8 +7,8 @@ import { useEmployeeTaxSetupGetFederalTaxesSuspense as B } from "@gusto/embedded
7
7
  import { useEmployeeTaxSetupUpdateFederalTaxesMutation as H } from "@gusto/embedded-api/react-query/employeeTaxSetupUpdateFederalTaxes";
8
8
  import { useEmployeeTaxSetupGetStateTaxesSuspense as Y } from "@gusto/embedded-api/react-query/employeeTaxSetupGetStateTaxes";
9
9
  import { useEmployeeTaxSetupUpdateStateTaxesMutation as j } from "@gusto/embedded-api/react-query/employeeTaxSetupUpdateStateTaxes";
10
- import { Actions as G } from "./Actions.js";
11
- import { FederalFormSchema as z, FederalForm as K } from "./FederalForm.js";
10
+ import { Actions as z } from "./Actions.js";
11
+ import { FederalFormSchema as G, FederalForm as K } from "./FederalForm.js";
12
12
  import { FederalHead as Q } from "./FederalHead.js";
13
13
  import { StateFormSchema as Z, StateForm as $ } from "./StateForm.js";
14
14
  import { TaxesProvider as ee } from "./useTaxes.js";
@@ -17,14 +17,14 @@ import { useBase as oe } from "../../Base/useBase.js";
17
17
  import "../../Flow/useFlow.js";
18
18
  import { useI18n as ae, useComponentDictionary as se } from "../../../i18n/I18n.js";
19
19
  import { componentEvents as T } from "../../../shared/constants.js";
20
- import { snakeCaseToCamelCase as A } from "../../../helpers/formattedStrings.js";
21
- import { Form as ne } from "../../Common/Form/Form.js";
22
- const re = "2010-01-01";
23
- function We(i) {
24
- return /* @__PURE__ */ o(te, { ...i, children: /* @__PURE__ */ o(ie, { ...i, children: i.children }) });
20
+ import { snakeCaseToCamelCase as A, normalizeErrorKeyForForm as ne } from "../../../helpers/formattedStrings.js";
21
+ import { Form as re } from "../../Common/Form/Form.js";
22
+ const ie = "2010-01-01";
23
+ function Ue(i) {
24
+ return /* @__PURE__ */ o(te, { ...i, children: /* @__PURE__ */ o(le, { ...i, children: i.children }) });
25
25
  }
26
- const ie = (i) => {
27
- const { employeeId: m, className: F, children: S, isAdmin: E = !1, dictionary: D } = i, { onEvent: c, fieldErrors: u, baseSubmitHandler: _ } = oe();
26
+ const le = (i) => {
27
+ const { employeeId: m, className: v, children: S, isAdmin: E = !1, dictionary: D } = i, { onEvent: c, fieldErrors: u, baseSubmitHandler: _ } = oe();
28
28
  ae("Employee.Taxes"), se("Employee.Taxes", D);
29
29
  const { data: b } = B({
30
30
  employeeUuid: m
@@ -49,15 +49,15 @@ const ie = (i) => {
49
49
  additionalWithholding: e.additionalWithholding,
50
50
  states: x
51
51
  }, g = V({
52
- resolver: J(z.and(Z)),
52
+ resolver: J(G.and(Z)),
53
53
  defaultValues: I
54
54
  }), { handleSubmit: L, setError: w } = g;
55
55
  return q(() => {
56
56
  u && u.length > 0 && u.forEach((a) => {
57
- const s = a.errorKey.replace(".value", "");
57
+ const s = ne(a.errorKey);
58
58
  w(s, { type: "custom", message: a.message });
59
59
  });
60
- }, [u, w]), /* @__PURE__ */ o("section", { className: F, children: /* @__PURE__ */ o(
60
+ }, [u, w]), /* @__PURE__ */ o("section", { className: v, children: /* @__PURE__ */ o(
61
61
  ee,
62
62
  {
63
63
  value: {
@@ -65,7 +65,7 @@ const ie = (i) => {
65
65
  isAdmin: E,
66
66
  isPending: W || R
67
67
  },
68
- children: /* @__PURE__ */ o(X, { ...g, children: /* @__PURE__ */ o(ne, { onSubmit: L(async (a) => {
68
+ children: /* @__PURE__ */ o(X, { ...g, children: /* @__PURE__ */ o(re, { onSubmit: L(async (a) => {
69
69
  await _(a, async (s) => {
70
70
  const { states: n, ...t } = s, l = t.w4DataType === "rev_2020_w4" ? {
71
71
  filingStatus: t.filingStatus,
@@ -89,10 +89,10 @@ const ie = (i) => {
89
89
  }
90
90
  });
91
91
  if (c(T.EMPLOYEE_FEDERAL_TAXES_UPDATED, d), n && Object.keys(n).length > 0) {
92
- const v = [];
92
+ const F = [];
93
93
  for (const h of f) {
94
94
  const y = h.state;
95
- y && h.questions !== void 0 && v.push({
95
+ y && h.questions !== void 0 && F.push({
96
96
  state: y,
97
97
  questions: h.questions.map((r) => {
98
98
  if (r.isQuestionForAdminOnly && !E)
@@ -102,7 +102,7 @@ const ie = (i) => {
102
102
  key: r.key,
103
103
  answers: [
104
104
  {
105
- validFrom: r.answers[0]?.validFrom ?? re,
105
+ validFrom: r.answers[0]?.validFrom ?? ie,
106
106
  validUpTo: r.answers[0]?.validUpTo ?? null,
107
107
  value: p == null || typeof p == "number" && isNaN(p) ? "" : p
108
108
  }
@@ -112,7 +112,7 @@ const ie = (i) => {
112
112
  });
113
113
  }
114
114
  const M = await N({
115
- request: { employeeUuid: m, employeeStateTaxesRequest: { states: v } }
115
+ request: { employeeUuid: m, employeeStateTaxesRequest: { states: F } }
116
116
  });
117
117
  c(T.EMPLOYEE_STATE_TAXES_UPDATED, M);
118
118
  }
@@ -122,12 +122,12 @@ const ie = (i) => {
122
122
  /* @__PURE__ */ o(Q, {}),
123
123
  /* @__PURE__ */ o(K, {}),
124
124
  /* @__PURE__ */ o($, {}),
125
- /* @__PURE__ */ o(G, {})
125
+ /* @__PURE__ */ o(z, {})
126
126
  ] }) }) })
127
127
  }
128
128
  ) });
129
129
  };
130
130
  export {
131
- We as Taxes
131
+ Ue as Taxes
132
132
  };
133
133
  //# sourceMappingURL=Taxes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Taxes.js","sources":["../../../../src/components/Employee/Taxes/Taxes.tsx"],"sourcesContent":["import { zodResolver } from '@hookform/resolvers/zod'\nimport { FormProvider, useForm, type SubmitHandler } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { useEffect } from 'react'\nimport { useEmployeeTaxSetupGetFederalTaxesSuspense } from '@gusto/embedded-api/react-query/employeeTaxSetupGetFederalTaxes'\nimport { useEmployeeTaxSetupUpdateFederalTaxesMutation } from '@gusto/embedded-api/react-query/employeeTaxSetupUpdateFederalTaxes'\nimport { useEmployeeTaxSetupGetStateTaxesSuspense } from '@gusto/embedded-api/react-query/employeeTaxSetupGetStateTaxes'\nimport { useEmployeeTaxSetupUpdateStateTaxesMutation } from '@gusto/embedded-api/react-query/employeeTaxSetupUpdateStateTaxes'\nimport type { OnboardingContextInterface } from '../OnboardingFlow/OnboardingFlowComponents'\nimport { Actions } from './Actions'\nimport {\n FederalForm,\n FederalFormSchema,\n type FederalFormInputs,\n type FederalFormPayload,\n} from './FederalForm'\nimport { FederalHead } from './FederalHead'\nimport { StateForm, StateFormSchema, type StateFormPayload } from './StateForm'\nimport { TaxesProvider } from './useTaxes'\nimport {\n useBase,\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { useFlow } from '@/components/Flow/useFlow'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { snakeCaseToCamelCase } from '@/helpers/formattedStrings'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\nconst DEFAULT_TAX_VALID_FROM = '2010-01-01'\n\ninterface TaxesProps extends CommonComponentInterface<'Employee.Taxes'> {\n employeeId: string\n isAdmin?: boolean\n}\n\n/**\n * @deprecated The Taxes component has been deprecated and will be removed in a future release.\n * The component has been split into separate components for state and federal. Use Employee.FederalTaxes\n * and Employee.StateTaxes components instead.\n */\nexport function Taxes(props: TaxesProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst Root = (props: TaxesProps) => {\n const { employeeId, className, children, isAdmin = false, dictionary } = props\n const { onEvent, fieldErrors, baseSubmitHandler } = useBase()\n useI18n('Employee.Taxes')\n useComponentDictionary('Employee.Taxes', dictionary)\n\n const { data: fedData } = useEmployeeTaxSetupGetFederalTaxesSuspense({\n employeeUuid: employeeId,\n })\n const employeeFederalTax = fedData.employeeFederalTax!\n\n const { mutateAsync: updateFederalTaxes, isPending: isPendingFederalTaxes } =\n useEmployeeTaxSetupUpdateFederalTaxesMutation()\n\n const { data: stateData } = useEmployeeTaxSetupGetStateTaxesSuspense({\n employeeUuid: employeeId,\n })\n const employeeStateTaxes = stateData.employeeStateTaxesList!\n const { mutateAsync: updateStateTaxes, isPending: isPendingStateTaxes } =\n useEmployeeTaxSetupUpdateStateTaxesMutation()\n\n const isRev2020 = employeeFederalTax.w4DataType === 'rev_2020_w4'\n\n const statesDefaultValues = employeeStateTaxes.reduce((acc: Record<string, unknown>, state) => {\n if (state.state) {\n acc[state.state] = state.questions?.reduce((acc: Record<string, unknown>, question) => {\n const value = question.answers[0]?.value\n const key = snakeCaseToCamelCase(question.key)\n if (key === 'fileNewHireReport') {\n acc[key] = typeof value === 'undefined' ? true : value\n } else {\n acc[key] = value\n }\n return acc\n }, {})\n }\n return acc\n }, {})\n\n const defaultValues: FederalFormInputs & { states: typeof statesDefaultValues } = isRev2020\n ? {\n w4DataType: 'rev_2020_w4',\n filingStatus: employeeFederalTax.filingStatus ?? '',\n twoJobs: employeeFederalTax.twoJobs ? 'true' : 'false',\n deductions: employeeFederalTax.deductions ? Number(employeeFederalTax.deductions) : 0,\n dependentsAmount: employeeFederalTax.dependentsAmount\n ? Number(employeeFederalTax.dependentsAmount)\n : 0,\n otherIncome: employeeFederalTax.otherIncome ? Number(employeeFederalTax.otherIncome) : 0,\n extraWithholding: employeeFederalTax.extraWithholding\n ? Number(employeeFederalTax.extraWithholding)\n : 0,\n states: statesDefaultValues,\n }\n : {\n w4DataType: 'pre_2020_w4',\n filingStatus: employeeFederalTax.filingStatus ?? '',\n federalWithholdingAllowance: employeeFederalTax.federalWithholdingAllowance ?? 0,\n additionalWithholding: employeeFederalTax.additionalWithholding,\n states: statesDefaultValues,\n }\n\n const formMethods = useForm<FederalFormInputs, unknown, FederalFormPayload & StateFormPayload>({\n resolver: zodResolver(FederalFormSchema.and(StateFormSchema)),\n defaultValues,\n })\n const { handleSubmit, setError: _setError } = formMethods\n\n useEffect(() => {\n if (fieldErrors && fieldErrors.length > 0) {\n fieldErrors.forEach(msgObject => {\n const key = msgObject.errorKey.replace('.value', '')\n _setError(key as keyof FederalFormInputs, { type: 'custom', message: msgObject.message })\n })\n }\n }, [fieldErrors, _setError])\n\n const onSubmit: SubmitHandler<FederalFormPayload & StateFormPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n const { states: statesPayload, ...federalPayload } = payload\n\n const requestBody =\n federalPayload.w4DataType === 'rev_2020_w4'\n ? {\n filingStatus: federalPayload.filingStatus,\n twoJobs: federalPayload.twoJobs === 'true',\n dependentsAmount: federalPayload.dependentsAmount,\n otherIncome: federalPayload.otherIncome,\n deductions: federalPayload.deductions,\n extraWithholding: federalPayload.extraWithholding,\n w4DataType: federalPayload.w4DataType,\n version: employeeFederalTax.version,\n }\n : {\n filingStatus: federalPayload.filingStatus,\n federalWithholdingAllowance: federalPayload.federalWithholdingAllowance,\n additionalWithholding: federalPayload.additionalWithholding,\n w4DataType: federalPayload.w4DataType,\n version: employeeFederalTax.version,\n }\n\n const federalTaxesResponse = await updateFederalTaxes({\n request: {\n employeeUuid: employeeId,\n requestBody,\n },\n })\n onEvent(componentEvents.EMPLOYEE_FEDERAL_TAXES_UPDATED, federalTaxesResponse)\n\n if (statesPayload && Object.keys(statesPayload).length > 0) {\n const states = []\n\n for (const state of employeeStateTaxes) {\n const stateName = state.state\n\n if (stateName && state.questions !== undefined) {\n states.push({\n state: stateName,\n questions: state.questions\n .map(question => {\n if (question.isQuestionForAdminOnly && !isAdmin) {\n return null\n }\n const formValue = statesPayload[stateName]?.[snakeCaseToCamelCase(question.key)]\n return {\n key: question.key,\n answers: [\n {\n validFrom: question.answers[0]?.validFrom ?? DEFAULT_TAX_VALID_FROM,\n validUpTo: question.answers[0]?.validUpTo ?? null,\n value:\n formValue == null || (typeof formValue === 'number' && isNaN(formValue))\n ? ''\n : (formValue as string | number | boolean),\n },\n ],\n }\n })\n .filter(q => q !== null),\n })\n }\n }\n\n const stateTaxesResponse = await updateStateTaxes({\n request: { employeeUuid: employeeId, employeeStateTaxesRequest: { states } },\n })\n onEvent(componentEvents.EMPLOYEE_STATE_TAXES_UPDATED, stateTaxesResponse)\n }\n\n onEvent(componentEvents.EMPLOYEE_TAXES_DONE)\n })\n }\n\n return (\n <section className={className}>\n <TaxesProvider\n value={{\n employeeStateTaxes,\n isAdmin: isAdmin,\n isPending: isPendingFederalTaxes || isPendingStateTaxes,\n }}\n >\n <FormProvider {...formMethods}>\n <Form onSubmit={handleSubmit(onSubmit)}>\n {children ? (\n children\n ) : (\n <>\n <FederalHead />\n <FederalForm />\n <StateForm />\n <Actions />\n </>\n )}\n </Form>\n </FormProvider>\n </TaxesProvider>\n </section>\n )\n}\n\nexport const TaxesContextual = () => {\n const { employeeId, onEvent, isAdmin } = useFlow<OnboardingContextInterface>()\n const { t } = useTranslation()\n if (!employeeId) {\n throw new Error(\n t('errors.missingParamsOrContext', {\n component: 'EmployeeTaxes',\n param: 'employeeId',\n provider: 'FlowProvider',\n }),\n )\n }\n return <Taxes employeeId={employeeId} onEvent={onEvent} isAdmin={isAdmin ?? false} />\n}\n"],"names":["DEFAULT_TAX_VALID_FROM","Taxes","props","jsx","BaseComponent","Root","employeeId","className","children","isAdmin","dictionary","onEvent","fieldErrors","baseSubmitHandler","useBase","useI18n","useComponentDictionary","fedData","useEmployeeTaxSetupGetFederalTaxesSuspense","employeeFederalTax","updateFederalTaxes","isPendingFederalTaxes","useEmployeeTaxSetupUpdateFederalTaxesMutation","stateData","useEmployeeTaxSetupGetStateTaxesSuspense","employeeStateTaxes","updateStateTaxes","isPendingStateTaxes","useEmployeeTaxSetupUpdateStateTaxesMutation","isRev2020","statesDefaultValues","acc","state","question","value","key","snakeCaseToCamelCase","defaultValues","formMethods","useForm","zodResolver","FederalFormSchema","StateFormSchema","handleSubmit","_setError","useEffect","msgObject","TaxesProvider","FormProvider","Form","data","payload","statesPayload","federalPayload","requestBody","federalTaxesResponse","componentEvents","states","stateName","formValue","q","stateTaxesResponse","jsxs","Fragment","FederalHead","FederalForm","StateForm","Actions"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAgCA,MAAMA,KAAyB;AAYxB,SAASC,GAAMC,GAA4C;AAChE,SACE,gBAAAC,EAACC,IAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,MAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,MAAMG,KAAO,CAACH,MAAsB;AAClC,QAAM,EAAE,YAAAI,GAAY,WAAAC,GAAW,UAAAC,GAAU,SAAAC,IAAU,IAAO,YAAAC,MAAeR,GACnE,EAAE,SAAAS,GAAS,aAA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AA8BK,CAAkB;AAAA,UAC1E;AAEA,UAAAlD,EAAQ6C,EAAgB,mBAAmB;AAAA,QAC7C,CAAC;AAAA,MACH,CAY6C,GAClC,UAAAhD,KAGC,gBAAAsD,EAAAC,GAAA,EACE,UAAA;AAAA,QAAA,gBAAA5D,EAAC6D,GAAA,EAAY;AAAA,0BACZC,GAAA,EAAY;AAAA,0BACZC,GAAA,EAAU;AAAA,0BACVC,GAAA,CAAA,CAAQ;AAAA,MAAA,EAAA,CACX,GAEJ,EAAA,CACF;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;"}
1
+ {"version":3,"file":"Taxes.js","sources":["../../../../src/components/Employee/Taxes/Taxes.tsx"],"sourcesContent":["import { zodResolver } from '@hookform/resolvers/zod'\nimport { FormProvider, useForm, type SubmitHandler } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { useEffect } from 'react'\nimport { useEmployeeTaxSetupGetFederalTaxesSuspense } from '@gusto/embedded-api/react-query/employeeTaxSetupGetFederalTaxes'\nimport { useEmployeeTaxSetupUpdateFederalTaxesMutation } from '@gusto/embedded-api/react-query/employeeTaxSetupUpdateFederalTaxes'\nimport { useEmployeeTaxSetupGetStateTaxesSuspense } from '@gusto/embedded-api/react-query/employeeTaxSetupGetStateTaxes'\nimport { useEmployeeTaxSetupUpdateStateTaxesMutation } from '@gusto/embedded-api/react-query/employeeTaxSetupUpdateStateTaxes'\nimport type { OnboardingContextInterface } from '../OnboardingFlow/OnboardingFlowComponents'\nimport { Actions } from './Actions'\nimport {\n FederalForm,\n FederalFormSchema,\n type FederalFormInputs,\n type FederalFormPayload,\n} from './FederalForm'\nimport { FederalHead } from './FederalHead'\nimport { StateForm, StateFormSchema, type StateFormPayload } from './StateForm'\nimport { TaxesProvider } from './useTaxes'\nimport {\n useBase,\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base'\nimport { useFlow } from '@/components/Flow/useFlow'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { snakeCaseToCamelCase, normalizeErrorKeyForForm } from '@/helpers/formattedStrings'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\nconst DEFAULT_TAX_VALID_FROM = '2010-01-01'\n\ninterface TaxesProps extends CommonComponentInterface<'Employee.Taxes'> {\n employeeId: string\n isAdmin?: boolean\n}\n\n/**\n * @deprecated The Taxes component has been deprecated and will be removed in a future release.\n * The component has been split into separate components for state and federal. Use Employee.FederalTaxes\n * and Employee.StateTaxes components instead.\n */\nexport function Taxes(props: TaxesProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst Root = (props: TaxesProps) => {\n const { employeeId, className, children, isAdmin = false, dictionary } = props\n const { onEvent, fieldErrors, baseSubmitHandler } = useBase()\n useI18n('Employee.Taxes')\n useComponentDictionary('Employee.Taxes', dictionary)\n\n const { data: fedData } = useEmployeeTaxSetupGetFederalTaxesSuspense({\n employeeUuid: employeeId,\n })\n const employeeFederalTax = fedData.employeeFederalTax!\n\n const { mutateAsync: updateFederalTaxes, isPending: isPendingFederalTaxes } =\n useEmployeeTaxSetupUpdateFederalTaxesMutation()\n\n const { data: stateData } = useEmployeeTaxSetupGetStateTaxesSuspense({\n employeeUuid: employeeId,\n })\n const employeeStateTaxes = stateData.employeeStateTaxesList!\n const { mutateAsync: updateStateTaxes, isPending: isPendingStateTaxes } =\n useEmployeeTaxSetupUpdateStateTaxesMutation()\n\n const isRev2020 = employeeFederalTax.w4DataType === 'rev_2020_w4'\n\n const statesDefaultValues = employeeStateTaxes.reduce((acc: Record<string, unknown>, state) => {\n if (state.state) {\n acc[state.state] = state.questions?.reduce((acc: Record<string, unknown>, question) => {\n const value = question.answers[0]?.value\n const key = snakeCaseToCamelCase(question.key)\n if (key === 'fileNewHireReport') {\n acc[key] = typeof value === 'undefined' ? true : value\n } else {\n acc[key] = value\n }\n return acc\n }, {})\n }\n return acc\n }, {})\n\n const defaultValues: FederalFormInputs & { states: typeof statesDefaultValues } = isRev2020\n ? {\n w4DataType: 'rev_2020_w4',\n filingStatus: employeeFederalTax.filingStatus ?? '',\n twoJobs: employeeFederalTax.twoJobs ? 'true' : 'false',\n deductions: employeeFederalTax.deductions ? Number(employeeFederalTax.deductions) : 0,\n dependentsAmount: employeeFederalTax.dependentsAmount\n ? Number(employeeFederalTax.dependentsAmount)\n : 0,\n otherIncome: employeeFederalTax.otherIncome ? Number(employeeFederalTax.otherIncome) : 0,\n extraWithholding: employeeFederalTax.extraWithholding\n ? Number(employeeFederalTax.extraWithholding)\n : 0,\n states: statesDefaultValues,\n }\n : {\n w4DataType: 'pre_2020_w4',\n filingStatus: employeeFederalTax.filingStatus ?? '',\n federalWithholdingAllowance: employeeFederalTax.federalWithholdingAllowance ?? 0,\n additionalWithholding: employeeFederalTax.additionalWithholding,\n states: statesDefaultValues,\n }\n\n const formMethods = useForm<FederalFormInputs, unknown, FederalFormPayload & StateFormPayload>({\n resolver: zodResolver(FederalFormSchema.and(StateFormSchema)),\n defaultValues,\n })\n const { handleSubmit, setError: _setError } = formMethods\n\n useEffect(() => {\n if (fieldErrors && fieldErrors.length > 0) {\n fieldErrors.forEach(msgObject => {\n const key = normalizeErrorKeyForForm(msgObject.errorKey)\n _setError(key as keyof FederalFormInputs, { type: 'custom', message: msgObject.message })\n })\n }\n }, [fieldErrors, _setError])\n\n const onSubmit: SubmitHandler<FederalFormPayload & StateFormPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n const { states: statesPayload, ...federalPayload } = payload\n\n const requestBody =\n federalPayload.w4DataType === 'rev_2020_w4'\n ? {\n filingStatus: federalPayload.filingStatus,\n twoJobs: federalPayload.twoJobs === 'true',\n dependentsAmount: federalPayload.dependentsAmount,\n otherIncome: federalPayload.otherIncome,\n deductions: federalPayload.deductions,\n extraWithholding: federalPayload.extraWithholding,\n w4DataType: federalPayload.w4DataType,\n version: employeeFederalTax.version,\n }\n : {\n filingStatus: federalPayload.filingStatus,\n federalWithholdingAllowance: federalPayload.federalWithholdingAllowance,\n additionalWithholding: federalPayload.additionalWithholding,\n w4DataType: federalPayload.w4DataType,\n version: employeeFederalTax.version,\n }\n\n const federalTaxesResponse = await updateFederalTaxes({\n request: {\n employeeUuid: employeeId,\n requestBody,\n },\n })\n onEvent(componentEvents.EMPLOYEE_FEDERAL_TAXES_UPDATED, federalTaxesResponse)\n\n if (statesPayload && Object.keys(statesPayload).length > 0) {\n const states = []\n\n for (const state of employeeStateTaxes) {\n const stateName = state.state\n\n if (stateName && state.questions !== undefined) {\n states.push({\n state: stateName,\n questions: state.questions\n .map(question => {\n if (question.isQuestionForAdminOnly && !isAdmin) {\n return null\n }\n const formValue = statesPayload[stateName]?.[snakeCaseToCamelCase(question.key)]\n return {\n key: question.key,\n answers: [\n {\n validFrom: question.answers[0]?.validFrom ?? DEFAULT_TAX_VALID_FROM,\n validUpTo: question.answers[0]?.validUpTo ?? null,\n value:\n formValue == null || (typeof formValue === 'number' && isNaN(formValue))\n ? ''\n : (formValue as string | number | boolean),\n },\n ],\n }\n })\n .filter(q => q !== null),\n })\n }\n }\n\n const stateTaxesResponse = await updateStateTaxes({\n request: { employeeUuid: employeeId, employeeStateTaxesRequest: { states } },\n })\n onEvent(componentEvents.EMPLOYEE_STATE_TAXES_UPDATED, stateTaxesResponse)\n }\n\n onEvent(componentEvents.EMPLOYEE_TAXES_DONE)\n })\n }\n\n return (\n <section className={className}>\n <TaxesProvider\n value={{\n employeeStateTaxes,\n isAdmin: isAdmin,\n isPending: isPendingFederalTaxes || isPendingStateTaxes,\n }}\n >\n <FormProvider {...formMethods}>\n <Form onSubmit={handleSubmit(onSubmit)}>\n {children ? (\n children\n ) : (\n <>\n <FederalHead />\n <FederalForm />\n <StateForm />\n <Actions />\n </>\n )}\n </Form>\n </FormProvider>\n </TaxesProvider>\n </section>\n )\n}\n\nexport const TaxesContextual = () => {\n const { employeeId, onEvent, isAdmin } = useFlow<OnboardingContextInterface>()\n const { t } = useTranslation()\n if (!employeeId) {\n throw new Error(\n t('errors.missingParamsOrContext', {\n component: 'EmployeeTaxes',\n param: 'employeeId',\n provider: 'FlowProvider',\n }),\n )\n }\n return <Taxes employeeId={employeeId} onEvent={onEvent} isAdmin={isAdmin ?? false} />\n}\n"],"names":["DEFAULT_TAX_VALID_FROM","Taxes","props","jsx","BaseComponent","Root","employeeId","className","children","isAdmin","dictionary","onEvent","fieldErrors","baseSubmitHandler","useBase","useI18n","useComponentDictionary","fedData","useEmployeeTaxSetupGetFederalTaxesSuspense","employeeFederalTax","updateFederalTaxes","isPendingFederalTaxes","useEmployeeTaxSetupUpdateFederalTaxesMutation","stateData","useEmployeeTaxSetupGetStateTaxesSuspense","employeeStateTaxes","updateStateTaxes","isPendingStateTaxes","useEmployeeTaxSetupUpdateStateTaxesMutation","isRev2020","statesDefaultValues","acc","state","question","value","key","snakeCaseToCamelCase","defaultValues","formMethods","useForm","zodResolver","FederalFormSchema","StateFormSchema","handleSubmit","_setError","useEffect","msgObject","normalizeErrorKeyForForm","TaxesProvider","FormProvider","Form","data","payload","statesPayload","federalPayload","requestBody","federalTaxesResponse","componentEvents","states","stateName","formValue","q","stateTaxesResponse","jsxs","Fragment","FederalHead","FederalForm","StateForm","Actions"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAgCA,MAAMA,KAAyB;AAYxB,SAASC,GAAMC,GAA4C;AAChE,SACE,gBAAAC,EAACC,IAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,MAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,MAAMG,KAAO,CAACH,MAAsB;AAClC,QAAM,EAAE,YAAAI,GAAY,WAAAC,GAAW,UAAAC,GAAU,SAAAC,IAAU,IAAO,YAAAC,MAAeR,GACnE,EAAE,SAAAS,GAAS,aAAAC,GAAa,mBAAAC,EAAA,IAAsBC,GAAA;AACpD,EAAAC,GAAQ,gB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AAAA,QAC7C,CAAC;AAAA,MACH,CAY6C,GAClC,UAAAjD,KAGC,gBAAAuD,EAAAC,GAAA,EACE,UAAA;AAAA,QAAA,gBAAA7D,EAAC8D,GAAA,EAAY;AAAA,0BACZC,GAAA,EAAY;AAAA,0BACZC,GAAA,EAAU;AAAA,0BACVC,GAAA,CAAA,CAAQ;AAAA,MAAA,EAAA,CACX,GAEJ,EAAA,CACF;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;"}
@@ -2,13 +2,13 @@ import "react/jsx-runtime";
2
2
  import "react";
3
3
  import "react-error-boundary";
4
4
  import "react-i18next";
5
- import "@gusto/embedded-api/models/errors/apierror";
5
+ import "@gusto/embedded-api/models/errors/gustoembeddederror";
6
6
  import "@gusto/embedded-api/models/errors/sdkvalidationerror";
7
7
  import "@tanstack/react-query";
8
8
  import "../../Base/useBase.js";
9
9
  import "../../../shared/constants.js";
10
+ import "classnames";
10
11
  import "../../../contexts/ComponentAdapter/useComponentContext.js";
11
- import "../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
12
12
  import "dompurify";
13
13
  import "../../../contexts/LocaleProvider/useLocale.js";
14
14
  import { createCompoundContext as o } from "../../Base/createCompoundContext.js";
@@ -1,33 +1,33 @@
1
1
  import { EmployeeList as e } from "./EmployeeList/EmployeeList.js";
2
2
  import { OnboardingFlow as m } from "./OnboardingFlow/OnboardingFlow.js";
3
3
  import { SelfOnboardingFlow as x } from "./SelfOnboardingFlow/SelfOnboardingFlow.js";
4
- import { Deductions as n } from "./Deductions/Deductions.js";
5
- import { OnboardingSummary as a } from "./OnboardingSummary/OnboardingSummary.js";
6
- import { Profile as d } from "./Profile/Profile.js";
7
- import { Compensation as g } from "./Compensation/Compensation.js";
8
- import { FederalTaxes as b } from "./FederalTaxes/FederalTaxes.js";
9
- import { StateTaxes as E } from "./StateTaxes/StateTaxes.js";
10
- import { PaymentMethod as c } from "./PaymentMethod/PaymentMethod.js";
11
- import { Landing as F } from "./Landing/Landing.js";
12
- import { DocumentSigner as T } from "./DocumentSigner/DocumentSigner.js";
13
- import { EmployeeDocuments as L } from "./EmployeeDocuments/EmployeeDocuments.js";
14
- import { EmploymentEligibility as h } from "./DocumentSigner/EmploymentEligibility/EmploymentEligibility.js";
4
+ import { Compensation as n } from "./Compensation/Compensation.js";
5
+ import { Deductions as a } from "./Deductions/Deductions.js";
6
+ import { DocumentSigner as d } from "./DocumentSigner/DocumentSigner.js";
7
+ import { EmployeeDocuments as g } from "./EmployeeDocuments/EmployeeDocuments.js";
8
+ import { EmploymentEligibility as b } from "./DocumentSigner/EmploymentEligibility/EmploymentEligibility.js";
9
+ import { FederalTaxes as E } from "./FederalTaxes/FederalTaxes.js";
10
+ import { Landing as c } from "./Landing/Landing.js";
11
+ import { OnboardingSummary as F } from "./OnboardingSummary/OnboardingSummary.js";
12
+ import { PaymentMethod as T } from "./PaymentMethod/PaymentMethod.js";
13
+ import { Profile as L } from "./Profile/Profile.js";
14
+ import { StateTaxes as h } from "./StateTaxes/StateTaxes.js";
15
15
  import { Taxes as M } from "./Taxes/Taxes.js";
16
16
  export {
17
- g as Compensation,
18
- n as Deductions,
19
- T as DocumentSigner,
20
- L as EmployeeDocuments,
17
+ n as Compensation,
18
+ a as Deductions,
19
+ d as DocumentSigner,
20
+ g as EmployeeDocuments,
21
21
  e as EmployeeList,
22
- h as EmploymentEligibility,
23
- b as FederalTaxes,
24
- F as Landing,
22
+ b as EmploymentEligibility,
23
+ E as FederalTaxes,
24
+ c as Landing,
25
25
  m as OnboardingFlow,
26
- a as OnboardingSummary,
27
- c as PaymentMethod,
28
- d as Profile,
26
+ F as OnboardingSummary,
27
+ T as PaymentMethod,
28
+ L as Profile,
29
29
  x as SelfOnboardingFlow,
30
- E as StateTaxes,
30
+ h as StateTaxes,
31
31
  M as Taxes
32
32
  };
33
33
  //# sourceMappingURL=index.js.map
@@ -3,15 +3,16 @@ import { useMachine as v } from "react-robot";
3
3
  import { useTranslation as w } from "react-i18next";
4
4
  import { FlowBreadcrumbs as F } from "../Common/FlowBreadcrumbs/FlowBreadcrumbs.js";
5
5
  import { Flex as s, FlexItem as d } from "../Common/Flex/Flex.js";
6
+ import "classnames";
6
7
  import { useComponentContext as j } from "../../contexts/ComponentAdapter/useComponentContext.js";
7
8
  import "react";
8
9
  import { FlowContext as E } from "./useFlow.js";
9
- const M = ({
10
+ const k = ({
10
11
  onEvent: x,
11
12
  machine: f
12
13
  }) => {
13
14
  const b = j(), { t: g } = w(), [r, h, c] = v(f, {
14
- onEvent: a,
15
+ onEvent: i,
15
16
  component: null,
16
17
  progressBarCta: null
17
18
  }), {
@@ -21,9 +22,9 @@ const M = ({
21
22
  currentBreadcrumbId: n,
22
23
  breadcrumbs: B = {}
23
24
  } = r.context;
24
- function a(i, m) {
25
- const p = { type: i, payload: m }, C = h;
26
- c.child ? c.child.send(p) : C(p), x(i, m);
25
+ function i(m, a) {
26
+ const p = { type: m, payload: a }, C = h;
27
+ c.child ? c.child.send(p) : C(p), x(m, a);
27
28
  }
28
29
  return /* @__PURE__ */ e(s, { children: /* @__PURE__ */ e(
29
30
  E.Provider,
@@ -47,7 +48,7 @@ const M = ({
47
48
  {
48
49
  breadcrumbs: n ? B[n] ?? [] : [],
49
50
  currentBreadcrumbId: n,
50
- onEvent: a
51
+ onEvent: i
51
52
  }
52
53
  ) }),
53
54
  /* @__PURE__ */ e(d, { children: r.context.progressBarCta && /* @__PURE__ */ e(r.context.progressBarCta, {}) })
@@ -58,6 +59,6 @@ const M = ({
58
59
  ) });
59
60
  };
60
61
  export {
61
- M as Flow
62
+ k as Flow
62
63
  };
63
64
  //# sourceMappingURL=Flow.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Flow.js","sources":["../../../src/components/Flow/Flow.tsx"],"sourcesContent":["import { useMachine } from 'react-robot'\nimport { type Machine, type SendFunction } from 'robot3'\nimport { useTranslation } from 'react-i18next'\nimport type { OnEventType } from '../Base/useBase'\nimport { FlowBreadcrumbs } from '../Common/FlowBreadcrumbs/FlowBreadcrumbs'\nimport { Flex } from '../Common/Flex'\nimport { FlexItem } from '../Common'\nimport type { FlowContextInterface } from './useFlow'\nimport { FlowContext } from './useFlow'\nimport { type EventType } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\ntype FlowProps<M extends Machine> = {\n machine: M\n onEvent: OnEventType<EventType, unknown>\n}\n\nexport const Flow = <M extends Machine<object, FlowContextInterface>>({\n onEvent,\n machine,\n}: FlowProps<M>) => {\n const Components = useComponentContext()\n const { t } = useTranslation()\n const [current, send, service] = useMachine(machine, {\n onEvent: handleEvent,\n component: null,\n progressBarCta: null,\n })\n\n const {\n progressBarType = null,\n totalSteps = null,\n currentStep = null,\n currentBreadcrumbId,\n breadcrumbs = {},\n } = current.context\n\n function handleEvent(type: EventType, data: unknown): void {\n const event = { type, payload: data }\n const sendFn = send as SendFunction<string>\n //When dealing with nested state machine, correct machine needs to recieve an event\n if (service.child) {\n ;(service.child.send as SendFunction<string>)(event)\n } else {\n sendFn(event)\n }\n // Pass event upstream - onEvent can be optional on Flow component\n onEvent(type, data)\n }\n\n return (\n <Flex>\n <FlowContext.Provider\n value={{\n ...current.context,\n }}\n >\n <Flex flexDirection=\"column\" gap={32}>\n {progressBarType === 'progress' && currentStep && totalSteps && (\n <Components.ProgressBar\n totalSteps={totalSteps}\n currentStep={currentStep}\n label={t('progressBarLabel', { totalSteps, currentStep })}\n cta={current.context.progressBarCta}\n />\n )}\n {progressBarType === 'breadcrumbs' && (\n <Flex flexDirection=\"row\" justifyContent=\"space-between\" alignItems=\"center\">\n <FlexItem flexGrow={1}>\n <FlowBreadcrumbs\n breadcrumbs={currentBreadcrumbId ? (breadcrumbs[currentBreadcrumbId] ?? []) : []}\n currentBreadcrumbId={currentBreadcrumbId}\n onEvent={handleEvent}\n />\n </FlexItem>\n <FlexItem>\n {current.context.progressBarCta && <current.context.progressBarCta />}\n </FlexItem>\n </Flex>\n )}\n {current.context.component && <current.context.component />}\n </Flex>\n </FlowContext.Provider>\n </Flex>\n )\n}\n"],"names":["Flow","onEvent","machine","Components","useComponentContext","t","useTranslation","current","send","service","useMachine","handleEvent","progressBarType","totalSteps","currentStep","currentBreadcrumbId","breadcrumbs","type","data","event","sendFn","Flex","jsx","FlowContext","jsxs","FlexItem","FlowBreadcrumbs"],"mappings":";;;;;;;;AAiBO,MAAMA,IAAO,CAAkD;AAAA,EACpE,SAAAC;AAAA,EACA,SAAAC;AACF,MAAoB;AAClB,QAAMC,IAAaC,EAAA,GACb,EAAE,GAAAC,EAAA,IAAMC,EAAA,GACR,CAACC,GAASC,GAAMC,CAAO,IAAIC,EAAWR,GAAS;AAAA,IACnD,SAASS;AAAA,IACT,WAAW;AAAA,IACX,gBAAgB;AAAA,EAAA,CACjB,GAEK;AAAA,IACJ,iBAAAC,IAAkB;AAAA,IAClB,YAAAC,IAAa;AAAA,IACb,aAAAC,IAAc;AAAA,IACd,qBAAAC;AAAA,IACA,aAAAC,IAAc,CAAA;AAAA,EAAC,IACbT,EAAQ;AAEZ,WAASI,EAAYM,GAAiBC,GAAqB;AACzD,UAAMC,IAAQ,EAAE,MAAAF,GAAM,SAASC,EAAA,GACzBE,IAASZ;AAEf,IAAIC,EAAQ,QACRA,EAAQ,MAAM,KAA8BU,CAAK,IAEnDC,EAAOD,CAAK,GAGdlB,EAAQgB,GAAMC,CAAI;AAAA,EACpB;AAEA,2BACGG,GAAA,EACC,UAAA,gBAAAC;AAAA,IAACC,EAAY;AAAA,IAAZ;AAAA,MACC,OAAO;AAAA,QACL,GAAGhB,EAAQ;AAAA,MAAA;AAAA,MAGb,UAAA,gBAAAiB,EAACH,GAAA,EAAK,eAAc,UAAS,KAAK,IAC/B,UAAA;AAAA,QAAAT,MAAoB,cAAcE,KAAeD,KAChD,gBAAAS;AAAA,UAACnB,EAAW;AAAA,UAAX;AAAA,YACC,YAAAU;AAAA,YACA,aAAAC;AAAA,YACA,OAAOT,EAAE,oBAAoB,EAAE,YAAAQ,GAAY,aAAAC,GAAa;AAAA,YACxD,KAAKP,EAAQ,QAAQ;AAAA,UAAA;AAAA,QAAA;AAAA,QAGxBK,MAAoB,iBACnB,gBAAAY,EAACH,GAAA,EAAK,eAAc,OAAM,gBAAe,iBAAgB,YAAW,UAClE,UAAA;AAAA,UAAA,gBAAAC,EAACG,GAAA,EAAS,UAAU,GAClB,UAAA,gBAAAH;AAAA,YAACI;AAAA,YAAA;AAAA,cACC,aAAaX,IAAuBC,EAAYD,CAAmB,KAAK,CAAA,IAAM,CAAA;AAAA,cAC9E,qBAAAA;AAAA,cACA,SAASJ;AAAA,YAAA;AAAA,UAAA,GAEb;AAAA,UACA,gBAAAW,EAACG,GAAA,EACE,UAAAlB,EAAQ,QAAQ,oCAAmBA,EAAQ,QAAQ,gBAAhB,CAAA,CAA+B,EAAA,CACrE;AAAA,QAAA,GACF;AAAA,QAEDA,EAAQ,QAAQ,+BAAcA,EAAQ,QAAQ,WAAhB,CAAA,CAA0B;AAAA,MAAA,EAAA,CAC3D;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;"}
1
+ {"version":3,"file":"Flow.js","sources":["../../../src/components/Flow/Flow.tsx"],"sourcesContent":["import { useMachine } from 'react-robot'\nimport { type Machine, type SendFunction } from 'robot3'\nimport { useTranslation } from 'react-i18next'\nimport type { OnEventType } from '../Base/useBase'\nimport { FlowBreadcrumbs } from '../Common/FlowBreadcrumbs/FlowBreadcrumbs'\nimport { Flex } from '../Common/Flex'\nimport { FlexItem } from '../Common'\nimport type { FlowContextInterface } from './useFlow'\nimport { FlowContext } from './useFlow'\nimport { type EventType } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\ntype FlowProps<M extends Machine> = {\n machine: M\n onEvent: OnEventType<EventType, unknown>\n}\n\nexport const Flow = <M extends Machine<object, FlowContextInterface>>({\n onEvent,\n machine,\n}: FlowProps<M>) => {\n const Components = useComponentContext()\n const { t } = useTranslation()\n const [current, send, service] = useMachine(machine, {\n onEvent: handleEvent,\n component: null,\n progressBarCta: null,\n })\n\n const {\n progressBarType = null,\n totalSteps = null,\n currentStep = null,\n currentBreadcrumbId,\n breadcrumbs = {},\n } = current.context\n\n function handleEvent(type: EventType, data: unknown): void {\n const event = { type, payload: data }\n const sendFn = send as SendFunction<string>\n //When dealing with nested state machine, correct machine needs to recieve an event\n if (service.child) {\n ;(service.child.send as SendFunction<string>)(event)\n } else {\n sendFn(event)\n }\n // Pass event upstream - onEvent can be optional on Flow component\n onEvent(type, data)\n }\n\n return (\n <Flex>\n <FlowContext.Provider\n value={{\n ...current.context,\n }}\n >\n <Flex flexDirection=\"column\" gap={32}>\n {progressBarType === 'progress' && currentStep && totalSteps && (\n <Components.ProgressBar\n totalSteps={totalSteps}\n currentStep={currentStep}\n label={t('progressBarLabel', { totalSteps, currentStep })}\n cta={current.context.progressBarCta}\n />\n )}\n {progressBarType === 'breadcrumbs' && (\n <Flex flexDirection=\"row\" justifyContent=\"space-between\" alignItems=\"center\">\n <FlexItem flexGrow={1}>\n <FlowBreadcrumbs\n breadcrumbs={currentBreadcrumbId ? (breadcrumbs[currentBreadcrumbId] ?? []) : []}\n currentBreadcrumbId={currentBreadcrumbId}\n onEvent={handleEvent}\n />\n </FlexItem>\n <FlexItem>\n {current.context.progressBarCta && <current.context.progressBarCta />}\n </FlexItem>\n </Flex>\n )}\n {current.context.component && <current.context.component />}\n </Flex>\n </FlowContext.Provider>\n </Flex>\n )\n}\n"],"names":["Flow","onEvent","machine","Components","useComponentContext","t","useTranslation","current","send","service","useMachine","handleEvent","progressBarType","totalSteps","currentStep","currentBreadcrumbId","breadcrumbs","type","data","event","sendFn","Flex","jsx","FlowContext","jsxs","FlexItem","FlowBreadcrumbs"],"mappings":";;;;;;;;;AAiBO,MAAMA,IAAO,CAAkD;AAAA,EACpE,SAAAC;AAAA,EACA,SAAAC;AACF,MAAoB;AAClB,QAAMC,IAAaC,EAAA,GACb,EAAE,GAAAC,EAAA,IAAMC,EAAA,GACR,CAACC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A,YAAA;AAAA,UAAA,GAEb;AAAA,UACA,gBAAAW,EAACG,GAAA,EACE,UAAAlB,EAAQ,QAAQ,oCAAmBA,EAAQ,QAAQ,gBAAhB,CAAA,CAA+B,EAAA,CACrE;AAAA,QAAA,GACF;AAAA,QAEDA,EAAQ,QAAQ,+BAAcA,EAAQ,QAAQ,WAAhB,CAAA,CAA0B;AAAA,MAAA,EAAA,CAC3D;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;"}
@@ -13,6 +13,7 @@ import r from "./InformationRequestForm.module.scss.js";
13
13
  import { BaseComponent as $ } from "../../Base/Base.js";
14
14
  import { useBase as J } from "../../Base/useBase.js";
15
15
  import { Flex as y } from "../../Common/Flex/Flex.js";
16
+ import "classnames";
16
17
  import { useComponentContext as _ } from "../../../contexts/ComponentAdapter/useComponentContext.js";
17
18
  import "react";
18
19
  import { FileInputField as X } from "../../Common/Fields/FileInputField/FileInputField.js";
@@ -1 +1 @@
1
- {"version":3,"file":"InformationRequestForm.js","sources":["../../../../src/components/InformationRequests/InformationRequestForm/InformationRequestForm.tsx"],"sourcesContent":["import DOMPurify from 'dompurify'\nimport { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { z } from 'zod'\nimport { useIsMutating } from '@tanstack/react-query'\nimport { useInformationRequestsGetInformationRequestsSuspense } from '@gusto/embedded-api/react-query/informationRequestsGetInformationRequests'\nimport {\n useInformationRequestsSubmitMutation,\n mutationKeyInformationRequestsSubmit,\n} from '@gusto/embedded-api/react-query/informationRequestsSubmit'\nimport type { RequiredQuestions } from '@gusto/embedded-api/models/components/informationrequest'\nimport { ResponseType } from '@gusto/embedded-api/models/components/informationrequest'\nimport { ResponseType as SubmitResponseType } from '@gusto/embedded-api/models/operations/submitinformationrequest'\nimport type { InformationRequestsContextInterface } from '../InformationRequestsComponents'\nimport styles from './InformationRequestForm.module.scss'\nimport { BaseComponent, useBase, type BaseComponentInterface } from '@/components/Base'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport { Flex, TextInputField } from '@/components/Common'\nimport { FileInputField } from '@/components/Common/Fields/FileInputField'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { informationRequestEvents, type EventType } from '@/shared/constants'\nimport { useFlow } from '@/components/Flow/useFlow'\n\nconst INFORMATION_REQUEST_FORM_ID = 'gusto-sdk-information-request-form'\nconst ACCEPTED_FILE_TYPES = ['image/jpeg', 'image/png', 'application/pdf']\nconst dompurifyConfig = {\n ALLOWED_TAGS: ['a', 'b', 'strong'],\n ALLOWED_ATTR: ['target', 'href', 'rel'],\n}\n\nconst InformationRequestFormSchema = z.record(\n z.string(),\n z.union([z.string().min(1), z.instanceof(File)]),\n)\n\ntype InformationRequestFormValues = z.infer<typeof InformationRequestFormSchema>\n\ninterface InformationRequestFormProps extends BaseComponentInterface<'InformationRequests.InformationRequestForm'> {\n companyId: string\n requestId: string\n onEvent: OnEventType<EventType, unknown>\n}\n\nexport function InformationRequestForm(props: InformationRequestFormProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst convertFileToDataUrl = (file: File) => {\n return new Promise<string>((resolve, reject) => {\n const reader = new FileReader()\n reader.onload = () => {\n resolve(reader.result as string)\n }\n reader.onerror = reject\n reader.readAsDataURL(file)\n })\n}\n\nconst SUPPORTED_RESPONSE_TYPES: ResponseType[] = [ResponseType.Text, ResponseType.Document]\n\nfunction hasUnsupportedQuestionTypes(questions: RequiredQuestions[]) {\n return questions.some(\n question => question.responseType && !SUPPORTED_RESPONSE_TYPES.includes(question.responseType),\n )\n}\n\nfunction hasPersonaQuestionType(questions: RequiredQuestions[]) {\n return questions.some(question => question.responseType === ResponseType.Persona)\n}\n\nfunction Root({ companyId, requestId, dictionary }: InformationRequestFormProps) {\n useComponentDictionary('InformationRequests.InformationRequestForm', dictionary)\n useI18n('InformationRequests.InformationRequestForm')\n const { t } = useTranslation('InformationRequests.InformationRequestForm')\n const { Alert, Heading, Text } = useComponentContext()\n const { onEvent, baseSubmitHandler } = useBase()\n\n const { data } = useInformationRequestsGetInformationRequestsSuspense({\n companyUuid: companyId,\n })\n\n const informationRequest = data.informationRequestList?.find(req => req.uuid === requestId)\n const requiredQuestions = informationRequest?.requiredQuestions ?? []\n const isBlockingPayroll = informationRequest?.blockingPayroll ?? false\n const hasUnsupportedTypes = hasUnsupportedQuestionTypes(requiredQuestions)\n const hasPersonaType = hasPersonaQuestionType(requiredQuestions)\n\n const { mutateAsync: submitInformationRequest } = useInformationRequestsSubmitMutation()\n\n const defaultValues: Record<string, string | File | undefined> = {}\n const questionUuids: string[] = []\n\n requiredQuestions.forEach(question => {\n if (!question.questionUuid || !question.responseType) return\n\n if (question.responseType === ResponseType.Text) {\n questionUuids.push(question.questionUuid)\n defaultValues[question.questionUuid] = ''\n } else if (question.responseType === ResponseType.Document) {\n questionUuids.push(question.questionUuid)\n defaultValues[question.questionUuid] = undefined\n }\n })\n\n const formMethods = useForm<InformationRequestFormValues>({\n resolver: zodResolver(InformationRequestFormSchema),\n defaultValues,\n })\n\n const onSubmit = async (formData: InformationRequestFormValues) => {\n await baseSubmitHandler(formData, async () => {\n const questionResponses = await Promise.all(\n questionUuids.map(async uuid => {\n const value = formData[uuid]\n\n if (typeof value === 'string') {\n return {\n questionUuid: uuid,\n responseType: SubmitResponseType.Text,\n textResponse: value,\n }\n }\n\n if (value instanceof File) {\n const fileResponse = await convertFileToDataUrl(value)\n return {\n questionUuid: uuid,\n responseType: SubmitResponseType.Document,\n fileResponse,\n fileName: value.name,\n }\n }\n\n return null\n }),\n )\n\n const validResponses = questionResponses.filter(response => response !== null)\n\n const response = await submitInformationRequest({\n request: {\n informationRequestUuid: requestId,\n requestBody: {\n requiredQuestions: validResponses,\n },\n },\n })\n\n onEvent(informationRequestEvents.INFORMATION_REQUEST_FORM_DONE, response.informationRequest)\n })\n }\n\n const renderQuestion = (question: RequiredQuestions) => {\n if (!question.questionUuid || !question.responseType) return null\n\n const fieldName = question.questionUuid\n const isDocumentType = question.responseType === ResponseType.Document\n const isTextType = question.responseType === ResponseType.Text\n\n return (\n <div key={fieldName} className={styles.questionCard}>\n <div className={styles.questionDescription}>\n <Text weight=\"medium\">\n {isDocumentType ? t('questionTypes.document') : t('questionTypes.answer')}\n </Text>\n <Text>\n {/* SECURITY: XSS mitigated via DOMPurify with strict allowlist. Pattern matches TaxInputs.tsx */}\n <span\n dangerouslySetInnerHTML={{\n __html: DOMPurify.sanitize(question.questionText ?? '', dompurifyConfig),\n }}\n />\n </Text>\n </div>\n\n <hr className={styles.divider} />\n\n {isTextType && (\n <div className={styles.textInputWrapper}>\n <TextInputField\n name={fieldName}\n label={t('fields.textAnswer.label')}\n placeholder={t('fields.textAnswer.placeholder')}\n isRequired\n errorMessage={t('validation.required')}\n />\n </div>\n )}\n\n {isDocumentType && (\n <div className={styles.fileInputWrapper}>\n <FileInputField\n name={fieldName}\n label={t('fields.fileUpload.label')}\n accept={ACCEPTED_FILE_TYPES}\n isRequired\n errorMessage={t('validation.required')}\n />\n </div>\n )}\n </div>\n )\n }\n\n const unsupportedPlaceholder = (\n <div className={styles.questionCard}>\n <div className={styles.questionDescription}>\n <Text weight=\"medium\">\n {t(hasPersonaType ? 'unsupported.persona.title' : 'unsupported.generic.title')}\n </Text>\n <Text>\n {t(\n hasPersonaType ? 'unsupported.persona.description' : 'unsupported.generic.description',\n )}\n </Text>\n </div>\n\n <hr className={styles.divider} />\n\n <div className={styles.contactSupport}>\n <Text variant=\"supporting\">{t('unsupported.contactSupport')}</Text>\n </div>\n </div>\n )\n\n return (\n <div className={styles.root}>\n <Flex flexDirection=\"column\" gap={16}>\n <Heading as=\"h2\">{t('title')}</Heading>\n\n {isBlockingPayroll && (\n <Alert status=\"error\" label={t('blockingAlert.title')} disableScrollIntoView>\n {t('blockingAlert.description')}\n </Alert>\n )}\n\n {hasUnsupportedTypes ? (\n unsupportedPlaceholder\n ) : (\n <FormProvider {...formMethods}>\n <Form id={INFORMATION_REQUEST_FORM_ID} onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={16}>\n {requiredQuestions.map(renderQuestion)}\n </Flex>\n </Form>\n </FormProvider>\n )}\n </Flex>\n </div>\n )\n}\n\nconst Footer = ({ onEvent }: { onEvent: OnEventType<EventType, unknown> }) => {\n useI18n('InformationRequests.InformationRequestForm')\n const { t } = useTranslation('InformationRequests.InformationRequestForm')\n const { Button } = useComponentContext()\n const { companyId, selectedRequestId } = useFlow<InformationRequestsContextInterface>()\n\n const { data } = useInformationRequestsGetInformationRequestsSuspense({\n companyUuid: companyId,\n })\n\n const informationRequest = data.informationRequestList?.find(\n req => req.uuid === selectedRequestId,\n )\n const requiredQuestions = informationRequest?.requiredQuestions ?? []\n const hasUnsupportedTypes = hasUnsupportedQuestionTypes(requiredQuestions)\n\n const isMutating = useIsMutating({\n mutationKey: mutationKeyInformationRequestsSubmit(),\n })\n const isPending = isMutating > 0\n\n const handleCancel = () => {\n onEvent(informationRequestEvents.INFORMATION_REQUEST_FORM_CANCEL)\n }\n\n if (hasUnsupportedTypes) {\n return (\n <Flex justifyContent=\"flex-end\" gap={12}>\n <Button variant=\"secondary\" onClick={handleCancel}>\n {t('cta.close')}\n </Button>\n </Flex>\n )\n }\n\n return (\n <Flex justifyContent=\"flex-end\" gap={12}>\n <Button variant=\"secondary\" onClick={handleCancel} isDisabled={isPending}>\n {t('cta.cancel')}\n </Button>\n <Button\n variant=\"primary\"\n type=\"submit\"\n form={INFORMATION_REQUEST_FORM_ID}\n isLoading={isPending}\n >\n {t('cta.submit')}\n </Button>\n </Flex>\n )\n}\n\nInformationRequestForm.Footer = Footer\n"],"names":["INFORMATION_REQUEST_FORM_ID","ACCEPTED_FILE_TYPES","dompurifyConfig","InformationRequestFormSchema","z","InformationRequestForm","props","jsx","BaseComponent","Root","convertFileToDataUrl","file","resolve","reject","reader","SUPPORTED_RESPONSE_TYPES","ResponseType","hasUnsupportedQuestionTypes","questions","question","hasPersonaQuestionType","companyId","requestId","dictionary","useComponentDictionary","useI18n","t","useTranslation","Alert","Heading","Text","useComponentContext","onEvent","baseSubmitHandler","useBase","data","useInformationRequestsGetInformationRequestsSuspense","informationRequest","req","requiredQuestions","isBlockingPayroll","hasUnsupportedTypes","hasPersonaType","submitInformationRequest","useInformationRequestsSubmitMutation","defaultValues","questionUuids","formMethods","useForm","zodResolver","onSubmit","formData","validResponses","uuid","value","SubmitResponseType","fileResponse","response","informationRequestEvents","renderQuestion","fieldName","isDocumentType","isTextType","jsxs","styles","DOMPurify","TextInputField","FileInputField","unsupportedPlaceholder","Flex","FormProvider","Form","Footer","Button","selectedRequestId","useFlow","isPending","useIsMutating","mutationKeyInformationRequestsSubmit","handleCancel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAMA,IAA8B,sCAC9BC,KAAsB,CAAC,cAAc,aAAa,iBAAiB,GACnEC,KAAkB;AAAA,EACtB,cAAc,CAAC,KAAK,KAAK,QAAQ;AAAA,EACjC,cAAc,CAAC,UAAU,QAAQ,KAAK;AACxC,GAEMC,KAA+BC,EAAE;AAAA,EACrCA,EAAE,OAAA;AAAA,EACFA,EAAE,MAAM,CAACA,EAAE,OAAA,EAAS,IAAI,CAAC,GAAGA,EAAE,WAAW,IAAI,CAAC,CAAC;AACjD;AAUO,SAASC,GAAuBC,GAAoC;AACzE,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,MAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,MAAMI,KAAuB,CAACC,MACrB,IAAI,QAAgB,CAACC,GAASC,MAAW;AAC9C,QAAMC,IAAS,IAAI,WAAA;AACnB,EAAAA,EAAO,SAAS,MAAM;AACpB,IAAAF,EAAQE,EAAO,MAAgB;AAAA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mBAAAqD,EAAA,IAAsBC,GAAA,GAEnC,EAAE,MAAAxC,EAAA,IAASC,EAAqD;AAAA,IACpE,aAAaf;AAAA,EAAA,CACd,GAKKkB,IAHqBJ,EAAK,wBAAwB;AAAA,IACtD,CAAAG,MAAOA,EAAI,SAASoC;AAAA,EAAA,GAEwB,qBAAqB,CAAA,GAC7DjC,IAAsBxB,EAA4BsB,CAAiB,GAKnEqC,IAHaC,EAAc;AAAA,IAC/B,aAAaC,EAAA;AAAA,EAAqC,CACnD,IAC8B,GAEzBC,IAAe,MAAM;AACzB,IAAA/C,EAAQ0B,EAAyB,+BAA+B;AAAA,EAClE;AAEA,SAAIjB,IAEA,gBAAAlC,EAAC8D,GAAA,EAAK,gBAAe,YAAW,KAAK,IACnC,UAAA,gBAAA9D,EAACkE,GAAA,EAAO,SAAQ,aAAY,SAASM,GAClC,UAAArD,EAAE,WAAW,GAChB,GACF,IAKF,gBAAAqC,EAACM,GAAA,EAAK,gBAAe,YAAW,KAAK,IACnC,UAAA;AAAA,IAAA,gBAAA9D,EAACkE,GAAA,EAAO,SAAQ,aAAY,SAASM,GAAc,YAAYH,GAC5D,UAAAlD,EAAE,YAAY,EAAA,CACjB;AAAA,IACA,gBAAAnB;AAAA,MAACkE;AAAA,MAAA;AAAA,QACC,SAAQ;AAAA,QACR,MAAK;AAAA,QACL,MAAMzE;AAAA,QACN,WAAW4E;AAAA,QAEV,YAAE,YAAY;AAAA,MAAA;AAAA,IAAA;AAAA,EACjB,GACF;AAEJ;AAEAvE,GAAuB,SAASmE;"}
1
+ {"version":3,"file":"InformationRequestForm.js","sources":["../../../../src/components/InformationRequests/InformationRequestForm/InformationRequestForm.tsx"],"sourcesContent":["import DOMPurify from 'dompurify'\nimport { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { z } from 'zod'\nimport { useIsMutating } from '@tanstack/react-query'\nimport { useInformationRequestsGetInformationRequestsSuspense } from '@gusto/embedded-api/react-query/informationRequestsGetInformationRequests'\nimport {\n useInformationRequestsSubmitMutation,\n mutationKeyInformationRequestsSubmit,\n} from '@gusto/embedded-api/react-query/informationRequestsSubmit'\nimport type { RequiredQuestions } from '@gusto/embedded-api/models/components/informationrequest'\nimport { ResponseType } from '@gusto/embedded-api/models/components/informationrequest'\nimport { ResponseType as SubmitResponseType } from '@gusto/embedded-api/models/operations/submitinformationrequest'\nimport type { InformationRequestsContextInterface } from '../InformationRequestsComponents'\nimport styles from './InformationRequestForm.module.scss'\nimport { BaseComponent, useBase, type BaseComponentInterface } from '@/components/Base'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport { Flex, TextInputField } from '@/components/Common'\nimport { FileInputField } from '@/components/Common/Fields/FileInputField'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { informationRequestEvents, type EventType } from '@/shared/constants'\nimport { useFlow } from '@/components/Flow/useFlow'\n\nconst INFORMATION_REQUEST_FORM_ID = 'gusto-sdk-information-request-form'\nconst ACCEPTED_FILE_TYPES = ['image/jpeg', 'image/png', 'application/pdf']\nconst dompurifyConfig = {\n ALLOWED_TAGS: ['a', 'b', 'strong'],\n ALLOWED_ATTR: ['target', 'href', 'rel'],\n}\n\nconst InformationRequestFormSchema = z.record(\n z.string(),\n z.union([z.string().min(1), z.instanceof(File)]),\n)\n\ntype InformationRequestFormValues = z.infer<typeof InformationRequestFormSchema>\n\ninterface InformationRequestFormProps extends BaseComponentInterface<'InformationRequests.InformationRequestForm'> {\n companyId: string\n requestId: string\n onEvent: OnEventType<EventType, unknown>\n}\n\nexport function InformationRequestForm(props: InformationRequestFormProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst convertFileToDataUrl = (file: File) => {\n return new Promise<string>((resolve, reject) => {\n const reader = new FileReader()\n reader.onload = () => {\n resolve(reader.result as string)\n }\n reader.onerror = reject\n reader.readAsDataURL(file)\n })\n}\n\nconst SUPPORTED_RESPONSE_TYPES: ResponseType[] = [ResponseType.Text, ResponseType.Document]\n\nfunction hasUnsupportedQuestionTypes(questions: RequiredQuestions[]) {\n return questions.some(\n question => question.responseType && !SUPPORTED_RESPONSE_TYPES.includes(question.responseType),\n )\n}\n\nfunction hasPersonaQuestionType(questions: RequiredQuestions[]) {\n return questions.some(question => question.responseType === ResponseType.Persona)\n}\n\nfunction Root({ companyId, requestId, dictionary }: InformationRequestFormProps) {\n useComponentDictionary('InformationRequests.InformationRequestForm', dictionary)\n useI18n('InformationRequests.InformationRequestForm')\n const { t } = useTranslation('InformationRequests.InformationRequestForm')\n const { Alert, Heading, Text } = useComponentContext()\n const { onEvent, baseSubmitHandler } = useBase()\n\n const { data } = useInformationRequestsGetInformationRequestsSuspense({\n companyUuid: companyId,\n })\n\n const informationRequest = data.informationRequestList?.find(req => req.uuid === requestId)\n const requiredQuestions = informationRequest?.requiredQuestions ?? []\n const isBlockingPayroll = informationRequest?.blockingPayroll ?? false\n const hasUnsupportedTypes = hasUnsupportedQuestionTypes(requiredQuestions)\n const hasPersonaType = hasPersonaQuestionType(requiredQuestions)\n\n const { mutateAsync: submitInformationRequest } = useInformationRequestsSubmitMutation()\n\n const defaultValues: Record<string, string | File | undefined> = {}\n const questionUuids: string[] = []\n\n requiredQuestions.forEach(question => {\n if (!question.questionUuid || !question.responseType) return\n\n if (question.responseType === ResponseType.Text) {\n questionUuids.push(question.questionUuid)\n defaultValues[question.questionUuid] = ''\n } else if (question.responseType === ResponseType.Document) {\n questionUuids.push(question.questionUuid)\n defaultValues[question.questionUuid] = undefined\n }\n })\n\n const formMethods = useForm<InformationRequestFormValues>({\n resolver: zodResolver(InformationRequestFormSchema),\n defaultValues,\n })\n\n const onSubmit = async (formData: InformationRequestFormValues) => {\n await baseSubmitHandler(formData, async () => {\n const questionResponses = await Promise.all(\n questionUuids.map(async uuid => {\n const value = formData[uuid]\n\n if (typeof value === 'string') {\n return {\n questionUuid: uuid,\n responseType: SubmitResponseType.Text,\n textResponse: value,\n }\n }\n\n if (value instanceof File) {\n const fileResponse = await convertFileToDataUrl(value)\n return {\n questionUuid: uuid,\n responseType: SubmitResponseType.Document,\n fileResponse,\n fileName: value.name,\n }\n }\n\n return null\n }),\n )\n\n const validResponses = questionResponses.filter(response => response !== null)\n\n const response = await submitInformationRequest({\n request: {\n informationRequestUuid: requestId,\n requestBody: {\n requiredQuestions: validResponses,\n },\n },\n })\n\n onEvent(informationRequestEvents.INFORMATION_REQUEST_FORM_DONE, response.informationRequest)\n })\n }\n\n const renderQuestion = (question: RequiredQuestions) => {\n if (!question.questionUuid || !question.responseType) return null\n\n const fieldName = question.questionUuid\n const isDocumentType = question.responseType === ResponseType.Document\n const isTextType = question.responseType === ResponseType.Text\n\n return (\n <div key={fieldName} className={styles.questionCard}>\n <div className={styles.questionDescription}>\n <Text weight=\"medium\">\n {isDocumentType ? t('questionTypes.document') : t('questionTypes.answer')}\n </Text>\n <Text>\n {/* SECURITY: XSS mitigated via DOMPurify with strict allowlist. Pattern matches TaxInputs.tsx */}\n <span\n dangerouslySetInnerHTML={{\n __html: DOMPurify.sanitize(question.questionText ?? '', dompurifyConfig),\n }}\n />\n </Text>\n </div>\n\n <hr className={styles.divider} />\n\n {isTextType && (\n <div className={styles.textInputWrapper}>\n <TextInputField\n name={fieldName}\n label={t('fields.textAnswer.label')}\n placeholder={t('fields.textAnswer.placeholder')}\n isRequired\n errorMessage={t('validation.required')}\n />\n </div>\n )}\n\n {isDocumentType && (\n <div className={styles.fileInputWrapper}>\n <FileInputField\n name={fieldName}\n label={t('fields.fileUpload.label')}\n accept={ACCEPTED_FILE_TYPES}\n isRequired\n errorMessage={t('validation.required')}\n />\n </div>\n )}\n </div>\n )\n }\n\n const unsupportedPlaceholder = (\n <div className={styles.questionCard}>\n <div className={styles.questionDescription}>\n <Text weight=\"medium\">\n {t(hasPersonaType ? 'unsupported.persona.title' : 'unsupported.generic.title')}\n </Text>\n <Text>\n {t(\n hasPersonaType ? 'unsupported.persona.description' : 'unsupported.generic.description',\n )}\n </Text>\n </div>\n\n <hr className={styles.divider} />\n\n <div className={styles.contactSupport}>\n <Text variant=\"supporting\">{t('unsupported.contactSupport')}</Text>\n </div>\n </div>\n )\n\n return (\n <div className={styles.root}>\n <Flex flexDirection=\"column\" gap={16}>\n <Heading as=\"h2\">{t('title')}</Heading>\n\n {isBlockingPayroll && (\n <Alert status=\"error\" label={t('blockingAlert.title')} disableScrollIntoView>\n {t('blockingAlert.description')}\n </Alert>\n )}\n\n {hasUnsupportedTypes ? (\n unsupportedPlaceholder\n ) : (\n <FormProvider {...formMethods}>\n <Form id={INFORMATION_REQUEST_FORM_ID} onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={16}>\n {requiredQuestions.map(renderQuestion)}\n </Flex>\n </Form>\n </FormProvider>\n )}\n </Flex>\n </div>\n )\n}\n\nconst Footer = ({ onEvent }: { onEvent: OnEventType<EventType, unknown> }) => {\n useI18n('InformationRequests.InformationRequestForm')\n const { t } = useTranslation('InformationRequests.InformationRequestForm')\n const { Button } = useComponentContext()\n const { companyId, selectedRequestId } = useFlow<InformationRequestsContextInterface>()\n\n const { data } = useInformationRequestsGetInformationRequestsSuspense({\n companyUuid: companyId,\n })\n\n const informationRequest = data.informationRequestList?.find(\n req => req.uuid === selectedRequestId,\n )\n const requiredQuestions = informationRequest?.requiredQuestions ?? []\n const hasUnsupportedTypes = hasUnsupportedQuestionTypes(requiredQuestions)\n\n const isMutating = useIsMutating({\n mutationKey: mutationKeyInformationRequestsSubmit(),\n })\n const isPending = isMutating > 0\n\n const handleCancel = () => {\n onEvent(informationRequestEvents.INFORMATION_REQUEST_FORM_CANCEL)\n }\n\n if (hasUnsupportedTypes) {\n return (\n <Flex justifyContent=\"flex-end\" gap={12}>\n <Button variant=\"secondary\" onClick={handleCancel}>\n {t('cta.close')}\n </Button>\n </Flex>\n )\n }\n\n return (\n <Flex justifyContent=\"flex-end\" gap={12}>\n <Button variant=\"secondary\" onClick={handleCancel} isDisabled={isPending}>\n {t('cta.cancel')}\n </Button>\n <Button\n variant=\"primary\"\n type=\"submit\"\n form={INFORMATION_REQUEST_FORM_ID}\n isLoading={isPending}\n >\n {t('cta.submit')}\n </Button>\n </Flex>\n )\n}\n\nInformationRequestForm.Footer = Footer\n"],"names":["INFORMATION_REQUEST_FORM_ID","ACCEPTED_FILE_TYPES","dompurifyConfig","InformationRequestFormSchema","z","InformationRequestForm","props","jsx","BaseComponent","Root","convertFileToDataUrl","file","resolve","reject","reader","SUPPORTED_RESPONSE_TYPES","ResponseType","hasUnsupportedQuestionTypes","questions","question","hasPersonaQuestionType","companyId","requestId","dictionary","useComponentDictionary","useI18n","t","useTranslation","Alert","Heading","Text","useComponentContext","onEvent","baseSubmitHandler","useBase","data","useInformationRequestsGetInformationRequestsSuspense","informationRequest","req","requiredQuestions","isBlockingPayroll","hasUnsupportedTypes","hasPersonaType","submitInformationRequest","useInformationRequestsSubmitMutation","defaultValues","questionUuids","formMethods","useForm","zodResolver","onSubmit","formData","validResponses","uuid","value","SubmitResponseType","fileResponse","response","informationRequestEvents","renderQuestion","fieldName","isDocumentType","isTextType","jsxs","styles","DOMPurify","TextInputField","FileInputField","unsupportedPlaceholder","Flex","FormProvider","Form","Footer","Button","selectedRequestId","useFlow","isPending","useIsMutating","mutationKeyInformationRequestsSubmit","handleCancel"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAMA,IAA8B,sCAC9BC,KAAsB,CAAC,cAAc,aAAa,iBAAiB,GACnEC,KAAkB;AAAA,EACtB,cAAc,CAAC,KAAK,KAAK,QAAQ;AAAA,EACjC,cAAc,CAAC,UAAU,QAAQ,KAAK;AACxC,GAEMC,KAA+BC,EAAE;AAAA,EACrCA,EAAE,OAAA;AAAA,EACFA,EAAE,MAAM,CAACA,EAAE,OAAA,EAAS,IAAI,CAAC,GAAG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A,QAEV,YAAE,YAAY;AAAA,MAAA;AAAA,IAAA;AAAA,EACjB,GACF;AAEJ;AAEAvE,GAAuB,SAASmE;"}
@@ -1,7 +1,6 @@
1
1
  import { BaseComponentInterface } from '../../Base';
2
2
  interface InformationRequestListProps extends BaseComponentInterface<'InformationRequests.InformationRequestList'> {
3
3
  companyId: string;
4
- filterByPayrollBlocking?: boolean;
5
4
  onEvent: BaseComponentInterface['onEvent'];
6
5
  }
7
6
  export declare function InformationRequestList(props: InformationRequestListProps): import("react/jsx-runtime").JSX.Element;
@@ -1,33 +1,28 @@
1
1
  import { jsx as n, jsxs as a } from "react/jsx-runtime";
2
- import { useTranslation as P } from "react-i18next";
3
- import { useInformationRequestsGetInformationRequestsSuspense as w } from "@gusto/embedded-api/react-query/informationRequestsGetInformationRequests";
2
+ import { useTranslation as b } from "react-i18next";
3
+ import { useInformationRequestsGetInformationRequestsSuspense as P } from "@gusto/embedded-api/react-query/informationRequestsGetInformationRequests";
4
4
  import { InformationRequestStatus as s, InformationRequestType as i } from "@gusto/embedded-api/models/components/informationrequest";
5
- import { BaseComponent as x } from "../../Base/Base.js";
5
+ import { BaseComponent as w } from "../../Base/Base.js";
6
6
  import "../../Base/useBase.js";
7
- import { useComponentContext as S } from "../../../contexts/ComponentAdapter/useComponentContext.js";
8
- import { useComponentDictionary as T, useI18n as D } from "../../../i18n/I18n.js";
9
- import { DataView as k } from "../../Common/DataView/DataView.js";
10
- import { useDataView as v } from "../../Common/DataView/useDataView.js";
7
+ import { useComponentContext as x } from "../../../contexts/ComponentAdapter/useComponentContext.js";
8
+ import { useComponentDictionary as S, useI18n as T } from "../../../i18n/I18n.js";
9
+ import { DataView as D } from "../../Common/DataView/DataView.js";
10
+ import { useDataView as k } from "../../Common/DataView/useDataView.js";
11
11
  import { FlexItem as E, Flex as u } from "../../Common/Flex/Flex.js";
12
- import { EmptyData as C } from "../../Common/EmptyData/EmptyData.js";
12
+ import "classnames";
13
+ import { EmptyData as v } from "../../Common/EmptyData/EmptyData.js";
13
14
  import "react";
14
- import { informationRequestEvents as L } from "../../../shared/constants.js";
15
- function W(r) {
16
- return /* @__PURE__ */ n(x, { ...r, children: /* @__PURE__ */ n(A, { ...r, children: r.children }) });
15
+ import { informationRequestEvents as B } from "../../../shared/constants.js";
16
+ function W(o) {
17
+ return /* @__PURE__ */ n(w, { ...o, children: /* @__PURE__ */ n(C, { ...o, children: o.children }) });
17
18
  }
18
- function A({
19
- companyId: r,
20
- dictionary: f,
21
- filterByPayrollBlocking: m = !1,
22
- onEvent: y
23
- }) {
24
- T("InformationRequests.InformationRequestList", f), D("InformationRequests.InformationRequestList");
25
- const { t } = P("InformationRequests.InformationRequestList"), { Heading: R, Text: l, Button: g, Badge: c } = S(), { data: h } = w({
26
- companyUuid: r
27
- }), p = (h.informationRequestList ?? []).filter((e) => {
28
- const o = e.status !== s.Approved;
29
- return m ? e.blockingPayroll && o : o;
30
- }), I = (e) => {
19
+ function C({ companyId: o, dictionary: d, onEvent: f }) {
20
+ S("InformationRequests.InformationRequestList", d), T("InformationRequests.InformationRequestList");
21
+ const { t } = b("InformationRequests.InformationRequestList"), { Heading: y, Text: m, Button: R, Badge: l } = x(), { data: g } = P({
22
+ companyUuid: o
23
+ }), c = (g.informationRequestList ?? []).filter(
24
+ (e) => e.status !== s.Approved
25
+ ), h = (e) => {
31
26
  switch (e) {
32
27
  case i.CompanyOnboarding:
33
28
  return t("types.companyOnboarding");
@@ -49,33 +44,33 @@ function A({
49
44
  default:
50
45
  return null;
51
46
  }
52
- }, b = v({
53
- data: p,
54
- emptyState: () => /* @__PURE__ */ n(C, { title: t("emptyTableTitle"), description: t("emptyTableDescription") }),
47
+ }, I = k({
48
+ data: c,
49
+ emptyState: () => /* @__PURE__ */ n(v, { title: t("emptyTableTitle"), description: t("emptyTableDescription") }),
55
50
  columns: [
56
51
  {
57
52
  key: "type",
58
53
  title: t("columns.type"),
59
- render: (e) => /* @__PURE__ */ n(E, { flexGrow: 1, children: /* @__PURE__ */ n(l, { weight: "medium", children: I(e.type) }) })
54
+ render: (e) => /* @__PURE__ */ n(E, { flexGrow: 1, children: /* @__PURE__ */ n(m, { weight: "medium", children: h(e.type) }) })
60
55
  },
61
56
  {
62
57
  key: "status",
63
58
  title: t("columns.status"),
64
59
  render: (e) => {
65
- const o = q(e.status), d = !m && e.blockingPayroll;
66
- return !o && !d ? null : /* @__PURE__ */ a(u, { gap: 8, alignItems: "center", children: [
67
- o && /* @__PURE__ */ n(c, { status: o.badgeStatus, children: o.label }),
68
- d && /* @__PURE__ */ n(c, { status: "error", children: t("status.payrollBlocking") })
60
+ const r = q(e.status), p = e.blockingPayroll;
61
+ return !r && !p ? null : /* @__PURE__ */ a(u, { gap: 8, alignItems: "center", children: [
62
+ r && /* @__PURE__ */ n(l, { status: r.badgeStatus, children: r.label }),
63
+ p && /* @__PURE__ */ n(l, { status: "error", children: t("status.payrollBlocking") })
69
64
  ] });
70
65
  }
71
66
  }
72
67
  ],
73
68
  itemMenu: (e) => e.status === s.PendingResponse ? /* @__PURE__ */ n(
74
- g,
69
+ R,
75
70
  {
76
71
  variant: "secondary",
77
72
  onClick: () => {
78
- y(L.INFORMATION_REQUEST_RESPOND, {
73
+ f(B.INFORMATION_REQUEST_RESPOND, {
79
74
  requestId: e.uuid
80
75
  });
81
76
  },
@@ -85,10 +80,10 @@ function A({
85
80
  });
86
81
  return /* @__PURE__ */ a(u, { flexDirection: "column", gap: 20, children: [
87
82
  /* @__PURE__ */ a(u, { flexDirection: "column", gap: 2, children: [
88
- /* @__PURE__ */ n(R, { as: "h2", styledAs: "h4", children: t("title") }),
89
- p.length > 0 && /* @__PURE__ */ n(l, { children: t("description") })
83
+ /* @__PURE__ */ n(y, { as: "h2", styledAs: "h4", children: t("title") }),
84
+ c.length > 0 && /* @__PURE__ */ n(m, { children: t("description") })
90
85
  ] }),
91
- /* @__PURE__ */ n(k, { ...b, label: t("title") })
86
+ /* @__PURE__ */ n(D, { ...I, label: t("title") })
92
87
  ] });
93
88
  }
94
89
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"InformationRequestList.js","sources":["../../../../src/components/InformationRequests/InformationRequestList/InformationRequestList.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useInformationRequestsGetInformationRequestsSuspense } from '@gusto/embedded-api/react-query/informationRequestsGetInformationRequests'\nimport type { InformationRequest } from '@gusto/embedded-api/models/components/informationrequest'\nimport {\n InformationRequestStatus,\n InformationRequestType,\n} from '@gusto/embedded-api/models/components/informationrequest'\nimport { BaseComponent, type BaseComponentInterface } from '@/components/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { DataView } from '@/components/Common/DataView/DataView'\nimport { useDataView } from '@/components/Common/DataView/useDataView'\nimport { EmptyData, Flex, FlexItem } from '@/components/Common'\nimport { informationRequestEvents } from '@/shared/constants'\nimport type { BadgeProps } from '@/components/Common/UI/Badge/BadgeTypes'\n\ninterface InformationRequestListProps extends BaseComponentInterface<'InformationRequests.InformationRequestList'> {\n companyId: string\n filterByPayrollBlocking?: boolean\n onEvent: BaseComponentInterface['onEvent']\n}\n\nexport function InformationRequestList(props: InformationRequestListProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\ntype StatusMapping = {\n label: string\n badgeStatus: BadgeProps['status']\n} | null\n\nfunction Root({\n companyId,\n dictionary,\n filterByPayrollBlocking = false,\n onEvent,\n}: InformationRequestListProps) {\n useComponentDictionary('InformationRequests.InformationRequestList', dictionary)\n useI18n('InformationRequests.InformationRequestList')\n const { t } = useTranslation('InformationRequests.InformationRequestList')\n const { Heading, Text, Button, Badge } = useComponentContext()\n\n const { data } = useInformationRequestsGetInformationRequestsSuspense({\n companyUuid: companyId,\n })\n\n const informationRequests = data.informationRequestList ?? []\n\n const visibleRequests = informationRequests.filter(request => {\n const isNotApproved = request.status !== InformationRequestStatus.Approved\n\n if (filterByPayrollBlocking) {\n return request.blockingPayroll && isNotApproved\n }\n\n return isNotApproved\n })\n\n const getTypeLabel = (type: InformationRequest['type']): string => {\n switch (type) {\n case InformationRequestType.CompanyOnboarding:\n return t('types.companyOnboarding')\n case InformationRequestType.AccountProtection:\n return t('types.accountProtection')\n case InformationRequestType.PaymentRequest:\n return t('types.paymentRequest')\n case InformationRequestType.PaymentError:\n return t('types.paymentError')\n default:\n return t('types.unknown')\n }\n }\n\n const getStatusMapping = (status: InformationRequest['status']): StatusMapping => {\n switch (status) {\n case InformationRequestStatus.PendingResponse:\n return { label: t('status.incomplete'), badgeStatus: 'info' }\n case InformationRequestStatus.PendingReview:\n return { label: t('status.underReview'), badgeStatus: 'warning' }\n default:\n return null\n }\n }\n\n const dataViewProps = useDataView({\n data: visibleRequests,\n emptyState: () => (\n <EmptyData title={t('emptyTableTitle')} description={t('emptyTableDescription')} />\n ),\n columns: [\n {\n key: 'type',\n title: t('columns.type'),\n render: request => (\n <FlexItem flexGrow={1}>\n <Text weight=\"medium\">{getTypeLabel(request.type)}</Text>\n </FlexItem>\n ),\n },\n {\n key: 'status',\n title: t('columns.status'),\n render: request => {\n const statusMapping = getStatusMapping(request.status)\n const showPayrollBlockingBadge = !filterByPayrollBlocking && request.blockingPayroll\n\n if (!statusMapping && !showPayrollBlockingBadge) {\n return null\n }\n\n return (\n <Flex gap={8} alignItems=\"center\">\n {statusMapping && (\n <Badge status={statusMapping.badgeStatus}>{statusMapping.label}</Badge>\n )}\n {showPayrollBlockingBadge && (\n <Badge status=\"error\">{t('status.payrollBlocking')}</Badge>\n )}\n </Flex>\n )\n },\n },\n ],\n itemMenu: request => {\n const isPendingResponse = request.status === InformationRequestStatus.PendingResponse\n if (!isPendingResponse) {\n return null\n }\n return (\n <Button\n variant=\"secondary\"\n onClick={() => {\n onEvent(informationRequestEvents.INFORMATION_REQUEST_RESPOND, {\n requestId: request.uuid,\n })\n }}\n >\n {t('cta.respond')}\n </Button>\n )\n },\n })\n\n return (\n <Flex flexDirection=\"column\" gap={20}>\n <Flex flexDirection=\"column\" gap={2}>\n <Heading as=\"h2\" styledAs=\"h4\">\n {t('title')}\n </Heading>\n {visibleRequests.length > 0 && <Text>{t('description')}</Text>}\n </Flex>\n\n <DataView {...dataViewProps} label={t('title')} />\n </Flex>\n )\n}\n"],"names":["InformationRequestList","props","jsx","BaseComponent","Root","companyId","dictionary","filterByPayrollBlocking","onEvent","useComponentDictionary","useI18n","useTranslation","Heading","Text","Button","Badge","useComponentContext","data","useInformationRequestsGetInformationRequestsSuspense","visibleRequests","request","isNotApproved","InformationRequestStatus","getTypeLabel","type","InformationRequestType","getStatusMapping","status","dataViewProps","useDataView","EmptyData","FlexItem","statusMapping","showPayrollBlockingBadge","jsxs","Flex","informationRequestEvents","DataView"],"mappings":";;;;;;;;;;;;;;AAsBO,SAASA,EAAuBC,GAAoC;AACzE,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAOA,SAASG,EAAK;AAAA,EACZ,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,yBAAAC,IAA0B;AAAA,EAC1B,SAAAC;AACF,GAAgC;AAC9B,EAAAC,EAAuB,8CAA8CH,CAAU,GAC/EI,EAAQ,4CAA4C;AACpD,QAAM,EAAE,EAAA,IAAMC,EAAe,4CAA4C,GACnE,EAAE,SAAAC,GAAS,MAAAC,GAAM,QAAAC,GAAQ,OAAAC,EAAA,IAAUC,EAAA,GAEnC,EAAE,MAAAC,EAAA,IAASC,EAAqD;AAAA,IACpE,aAAab;AAAA,EAAA,CACd,GAIKc,KAFsBF,EAAK,0BAA0B,CAAA,GAEf,OAAO,CAAAG,MAAW;AAC5D,UAAMC,IAAgBD,EAAQ,WAAWE,EAAyB;AAElE,WAAIf,IACKa,EAAQ,mBAAmBC,IAG7BA;AAAA,EACT,CAAC,GAEKE,IAAe,CAACC,MAA6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UACtB,UAAA;AAAA,YAAAH,uBACEjB,GAAA,EAAM,QAAQiB,EAAc,aAAc,YAAc,OAAM;AAAA,YAEhEC,KACC,gBAAA/B,EAACa,GAAA,EAAM,QAAO,SAAS,UAAA,EAAE,wBAAwB,EAAA,CAAE;AAAA,UAAA,GAEvD;AAAA,QAEJ;AAAA,MAAA;AAAA,IACF;AAAA,IAEF,UAAU,CAAAK,MACkBA,EAAQ,WAAWE,EAAyB,kBAKpE,gBAAApB;AAAA,MAACY;AAAA,MAAA;AAAA,QACC,SAAQ;AAAA,QACR,SAAS,MAAM;AACb,UAAAN,EAAQ4B,EAAyB,6BAA6B;AAAA,YAC5D,WAAWhB,EAAQ;AAAA,UAAA,CACpB;AAAA,QACH;AAAA,QAEC,YAAE,aAAa;AAAA,MAAA;AAAA,IAAA,IAXX;AAAA,EAcX,CACD;AAED,SACE,gBAAAc,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,IAAA,gBAAAD,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,GAChC,UAAA;AAAA,MAAA,gBAAAjC,EAACU,KAAQ,IAAG,MAAK,UAAS,MACvB,UAAA,EAAE,OAAO,GACZ;AAAA,MACCO,EAAgB,SAAS,uBAAMN,GAAA,EAAM,UAAA,EAAE,aAAa,EAAA,CAAE;AAAA,IAAA,GACzD;AAAA,sBAECwB,GAAA,EAAU,GAAGT,GAAe,OAAO,EAAE,OAAO,EAAA,CAAG;AAAA,EAAA,GAClD;AAEJ;"}
1
+ {"version":3,"file":"InformationRequestList.js","sources":["../../../../src/components/InformationRequests/InformationRequestList/InformationRequestList.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useInformationRequestsGetInformationRequestsSuspense } from '@gusto/embedded-api/react-query/informationRequestsGetInformationRequests'\nimport type { InformationRequest } from '@gusto/embedded-api/models/components/informationrequest'\nimport {\n InformationRequestStatus,\n InformationRequestType,\n} from '@gusto/embedded-api/models/components/informationrequest'\nimport { BaseComponent, type BaseComponentInterface } from '@/components/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { DataView } from '@/components/Common/DataView/DataView'\nimport { useDataView } from '@/components/Common/DataView/useDataView'\nimport { EmptyData, Flex, FlexItem } from '@/components/Common'\nimport { informationRequestEvents } from '@/shared/constants'\nimport type { BadgeProps } from '@/components/Common/UI/Badge/BadgeTypes'\n\ninterface InformationRequestListProps extends BaseComponentInterface<'InformationRequests.InformationRequestList'> {\n companyId: string\n onEvent: BaseComponentInterface['onEvent']\n}\n\nexport function InformationRequestList(props: InformationRequestListProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\ntype StatusMapping = {\n label: string\n badgeStatus: BadgeProps['status']\n} | null\n\nfunction Root({ companyId, dictionary, onEvent }: InformationRequestListProps) {\n useComponentDictionary('InformationRequests.InformationRequestList', dictionary)\n useI18n('InformationRequests.InformationRequestList')\n const { t } = useTranslation('InformationRequests.InformationRequestList')\n const { Heading, Text, Button, Badge } = useComponentContext()\n\n const { data } = useInformationRequestsGetInformationRequestsSuspense({\n companyUuid: companyId,\n })\n\n const informationRequests = data.informationRequestList ?? []\n\n const visibleRequests = informationRequests.filter(\n request => request.status !== InformationRequestStatus.Approved,\n )\n\n const getTypeLabel = (type: InformationRequest['type']): string => {\n switch (type) {\n case InformationRequestType.CompanyOnboarding:\n return t('types.companyOnboarding')\n case InformationRequestType.AccountProtection:\n return t('types.accountProtection')\n case InformationRequestType.PaymentRequest:\n return t('types.paymentRequest')\n case InformationRequestType.PaymentError:\n return t('types.paymentError')\n default:\n return t('types.unknown')\n }\n }\n\n const getStatusMapping = (status: InformationRequest['status']): StatusMapping => {\n switch (status) {\n case InformationRequestStatus.PendingResponse:\n return { label: t('status.incomplete'), badgeStatus: 'info' }\n case InformationRequestStatus.PendingReview:\n return { label: t('status.underReview'), badgeStatus: 'warning' }\n default:\n return null\n }\n }\n\n const dataViewProps = useDataView({\n data: visibleRequests,\n emptyState: () => (\n <EmptyData title={t('emptyTableTitle')} description={t('emptyTableDescription')} />\n ),\n columns: [\n {\n key: 'type',\n title: t('columns.type'),\n render: request => (\n <FlexItem flexGrow={1}>\n <Text weight=\"medium\">{getTypeLabel(request.type)}</Text>\n </FlexItem>\n ),\n },\n {\n key: 'status',\n title: t('columns.status'),\n render: request => {\n const statusMapping = getStatusMapping(request.status)\n const showPayrollBlockingBadge = request.blockingPayroll\n\n if (!statusMapping && !showPayrollBlockingBadge) {\n return null\n }\n\n return (\n <Flex gap={8} alignItems=\"center\">\n {statusMapping && (\n <Badge status={statusMapping.badgeStatus}>{statusMapping.label}</Badge>\n )}\n {showPayrollBlockingBadge && (\n <Badge status=\"error\">{t('status.payrollBlocking')}</Badge>\n )}\n </Flex>\n )\n },\n },\n ],\n itemMenu: request => {\n const isPendingResponse = request.status === InformationRequestStatus.PendingResponse\n if (!isPendingResponse) {\n return null\n }\n return (\n <Button\n variant=\"secondary\"\n onClick={() => {\n onEvent(informationRequestEvents.INFORMATION_REQUEST_RESPOND, {\n requestId: request.uuid,\n })\n }}\n >\n {t('cta.respond')}\n </Button>\n )\n },\n })\n\n return (\n <Flex flexDirection=\"column\" gap={20}>\n <Flex flexDirection=\"column\" gap={2}>\n <Heading as=\"h2\" styledAs=\"h4\">\n {t('title')}\n </Heading>\n {visibleRequests.length > 0 && <Text>{t('description')}</Text>}\n </Flex>\n\n <DataView {...dataViewProps} label={t('title')} />\n </Flex>\n )\n}\n"],"names":["InformationRequestList","props","jsx","BaseComponent","Root","companyId","dictionary","onEvent","useComponentDictionary","useI18n","useTranslation","Heading","Text","Button","Badge","useComponentContext","data","useInformationRequestsGetInformationRequestsSuspense","visibleRequests","request","InformationRequestStatus","getTypeLabel","type","InformationRequestType","getStatusMapping","status","dataViewProps","useDataView","EmptyData","FlexItem","statusMapping","showPayrollBlockingBadge","jsxs","Flex","informationRequestEvents","DataView"],"mappings":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