@gusto/embedded-react-sdk 0.31.0-rc.3 → 0.31.0-rc.5

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 (255) hide show
  1. package/dist/components/Base/Base.js +13 -12
  2. package/dist/components/Base/Base.js.map +1 -1
  3. package/dist/components/Common/SignatureForm/SignatureForm.js +12 -10
  4. package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
  5. package/dist/components/Common/SignatureForm/SignatureFormActions.js +3 -2
  6. package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
  7. package/dist/components/Common/SignatureForm/SignatureFormFields.js +7 -6
  8. package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
  9. package/dist/components/Company/AssignSignatory/AssignSignatory.js +3 -2
  10. package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
  11. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +3 -2
  12. package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
  13. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +3 -2
  14. package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
  15. package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +1 -1
  16. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +4 -3
  17. package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
  18. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +3 -2
  19. package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
  20. package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +1 -1
  21. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +4 -3
  22. package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
  23. package/dist/components/Company/AssignSignatory/TitleSelect.js +4 -3
  24. package/dist/components/Company/AssignSignatory/TitleSelect.js.map +1 -1
  25. package/dist/components/Company/AssignSignatory/useAssignSignatory.js +6 -5
  26. package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
  27. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +9 -8
  28. package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
  29. package/dist/components/Company/BankAccount/BankAccountForm/Form.js +6 -4
  30. package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
  31. package/dist/components/Company/BankAccount/BankAccountForm/context.js +4 -3
  32. package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
  33. package/dist/components/Company/BankAccount/BankAccountList/Actions.js +3 -2
  34. package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
  35. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +7 -6
  36. package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
  37. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +6 -4
  38. package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
  39. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +3 -2
  40. package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
  41. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +9 -8
  42. package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  43. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +4 -3
  44. package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  45. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +4 -3
  46. package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  47. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +4 -3
  48. package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  49. package/dist/components/Company/FederalTaxes/Actions.js +7 -6
  50. package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
  51. package/dist/components/Company/FederalTaxes/FederalTaxes.js +4 -3
  52. package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
  53. package/dist/components/Company/FederalTaxes/Form.js +4 -2
  54. package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
  55. package/dist/components/Company/FederalTaxes/useFederalTaxes.js +6 -5
  56. package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
  57. package/dist/components/Company/Industry/Actions.js +8 -7
  58. package/dist/components/Company/Industry/Actions.js.map +1 -1
  59. package/dist/components/Company/Industry/Context.js +7 -6
  60. package/dist/components/Company/Industry/Context.js.map +1 -1
  61. package/dist/components/Company/Industry/Edit.js +3 -2
  62. package/dist/components/Company/Industry/Edit.js.map +1 -1
  63. package/dist/components/Company/Locations/LocationForm/Actions.js +7 -6
  64. package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
  65. package/dist/components/Company/Locations/LocationForm/LocationForm.js +4 -3
  66. package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
  67. package/dist/components/Company/Locations/LocationForm/useLocationForm.js +4 -3
  68. package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
  69. package/dist/components/Company/Locations/LocationsList/Actions.js +3 -2
  70. package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
  71. package/dist/components/Company/Locations/LocationsList/List.js +7 -6
  72. package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
  73. package/dist/components/Company/Locations/LocationsList/LocationsList.js +4 -3
  74. package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
  75. package/dist/components/Company/Locations/LocationsList/useLocationsList.js +4 -3
  76. package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
  77. package/dist/components/Company/OnboardingOverview/Completed.js +12 -10
  78. package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
  79. package/dist/components/Company/OnboardingOverview/MissingRequirements.js +8 -6
  80. package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
  81. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +8 -7
  82. package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
  83. package/dist/components/Company/OnboardingOverview/context.js +4 -3
  84. package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
  85. package/dist/components/Company/PaySchedule/PaySchedule.js +4 -3
  86. package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
  87. package/dist/components/Company/PaySchedule/_parts/Actions.js +3 -2
  88. package/dist/components/Company/PaySchedule/_parts/Actions.js.map +1 -1
  89. package/dist/components/Company/PaySchedule/_parts/Head.js +13 -11
  90. package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
  91. package/dist/components/Company/PaySchedule/_parts/List.js +15 -13
  92. package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
  93. package/dist/components/Company/PaySchedule/usePaySchedule.js +6 -5
  94. package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
  95. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +3 -2
  96. package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
  97. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +4 -3
  98. package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
  99. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +3 -2
  100. package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
  101. package/dist/components/Company/StateTaxes/StateTaxesList/List.js +3 -2
  102. package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
  103. package/dist/components/Company/StateTaxes/StateTaxesList/context.js +4 -3
  104. package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
  105. package/dist/components/Contractor/Address/Address.js +5 -4
  106. package/dist/components/Contractor/Address/Address.js.map +1 -1
  107. package/dist/components/Contractor/Address/useAddress.js +6 -5
  108. package/dist/components/Contractor/Address/useAddress.js.map +1 -1
  109. package/dist/components/Contractor/ContractorList/index.js +32 -31
  110. package/dist/components/Contractor/ContractorList/index.js.map +1 -1
  111. package/dist/components/Contractor/NewHireReport/NewHireReport.js +14 -13
  112. package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
  113. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +11 -10
  114. package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -1
  115. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +3 -2
  116. package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -1
  117. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +3 -2
  118. package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js.map +1 -1
  119. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js +4 -2
  120. package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js.map +1 -1
  121. package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js +9 -7
  122. package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js.map +1 -1
  123. package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js +4 -3
  124. package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js.map +1 -1
  125. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js +4 -2
  126. package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js.map +1 -1
  127. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js +8 -6
  128. package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js.map +1 -1
  129. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js +4 -2
  130. package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js.map +1 -1
  131. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +4 -2
  132. package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -1
  133. package/dist/components/Contractor/Profile/useContractorProfile.js +3 -2
  134. package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
  135. package/dist/components/Contractor/Submit/Submit.js +21 -20
  136. package/dist/components/Contractor/Submit/Submit.js.map +1 -1
  137. package/dist/components/Employee/Compensation/Actions.js +13 -12
  138. package/dist/components/Employee/Compensation/Actions.js.map +1 -1
  139. package/dist/components/Employee/Compensation/Edit.js +3 -2
  140. package/dist/components/Employee/Compensation/Edit.js.map +1 -1
  141. package/dist/components/Employee/Compensation/List.js +23 -22
  142. package/dist/components/Employee/Compensation/List.js.map +1 -1
  143. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +4 -3
  144. package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
  145. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +4 -3
  146. package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
  147. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +4 -3
  148. package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +1 -1
  149. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +8 -7
  150. package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js.map +1 -1
  151. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +6 -5
  152. package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
  153. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +3 -2
  154. package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
  155. package/dist/components/Employee/DocumentSigner/DocumentList/List.js +4 -2
  156. package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
  157. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +4 -3
  158. package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
  159. package/dist/components/Employee/DocumentSigner/DocumentSigner.js +25 -40
  160. package/dist/components/Employee/DocumentSigner/DocumentSigner.js.map +1 -1
  161. package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibility.js +25 -28
  162. package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibility.js.map +1 -1
  163. package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js +9 -7
  164. package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js.map +1 -1
  165. package/dist/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.js +3 -2
  166. package/dist/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.js.map +1 -1
  167. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +3 -2
  168. package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
  169. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +4 -3
  170. package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
  171. package/dist/components/Employee/EmployeeDocuments/EmployeeDocumentsPresentation.js +4 -2
  172. package/dist/components/Employee/EmployeeDocuments/EmployeeDocumentsPresentation.js.map +1 -1
  173. package/dist/components/Employee/EmployeeList/Actions.js +7 -6
  174. package/dist/components/Employee/EmployeeList/Actions.js.map +1 -1
  175. package/dist/components/Employee/EmployeeList/EmployeeList.js +4 -3
  176. package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
  177. package/dist/components/Employee/EmployeeList/Head.js +7 -5
  178. package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
  179. package/dist/components/Employee/EmployeeList/List.js +3 -2
  180. package/dist/components/Employee/EmployeeList/List.js.map +1 -1
  181. package/dist/components/Employee/EmployeeList/useEmployeeList.js +4 -3
  182. package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
  183. package/dist/components/Employee/FederalTaxes/Actions.js +6 -5
  184. package/dist/components/Employee/FederalTaxes/Actions.js.map +1 -1
  185. package/dist/components/Employee/FederalTaxes/FederalForm.js +5 -4
  186. package/dist/components/Employee/FederalTaxes/FederalForm.js.map +1 -1
  187. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +4 -3
  188. package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
  189. package/dist/components/Employee/Landing/Landing.js +15 -14
  190. package/dist/components/Employee/Landing/Landing.js.map +1 -1
  191. package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +7 -7
  192. package/dist/components/Employee/PaymentMethod/Actions.js +6 -5
  193. package/dist/components/Employee/PaymentMethod/Actions.js.map +1 -1
  194. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +3 -2
  195. package/dist/components/Employee/PaymentMethod/BankAccountEdit.js.map +1 -1
  196. package/dist/components/Employee/PaymentMethod/BankAccountsList.js +3 -2
  197. package/dist/components/Employee/PaymentMethod/BankAccountsList.js.map +1 -1
  198. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +6 -5
  199. package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +1 -1
  200. package/dist/components/Employee/PaymentMethod/Split.js +3 -2
  201. package/dist/components/Employee/PaymentMethod/Split.js.map +1 -1
  202. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +6 -5
  203. package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
  204. package/dist/components/Employee/Profile/Actions.js +6 -5
  205. package/dist/components/Employee/Profile/Actions.js.map +1 -1
  206. package/dist/components/Employee/Profile/AdminPersonalDetails.js +5 -4
  207. package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
  208. package/dist/components/Employee/Profile/useProfile.js +4 -3
  209. package/dist/components/Employee/Profile/useProfile.js.map +1 -1
  210. package/dist/components/Employee/StateTaxes/Actions.js +6 -5
  211. package/dist/components/Employee/StateTaxes/Actions.js.map +1 -1
  212. package/dist/components/Employee/StateTaxes/useStateTaxes.js +4 -3
  213. package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
  214. package/dist/components/Employee/Taxes/Actions.js +7 -6
  215. package/dist/components/Employee/Taxes/Actions.js.map +1 -1
  216. package/dist/components/Employee/Taxes/FederalForm.js +7 -6
  217. package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
  218. package/dist/components/Employee/Taxes/useTaxes.js +4 -3
  219. package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
  220. package/dist/components/Flow/Flow.js +9 -7
  221. package/dist/components/Flow/Flow.js.map +1 -1
  222. package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js +10 -9
  223. package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js.map +1 -1
  224. package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js +7 -6
  225. package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js.map +1 -1
  226. package/dist/components/InformationRequests/InformationRequests.js +4 -3
  227. package/dist/components/InformationRequests/InformationRequests.js.map +1 -1
  228. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +1 -0
  229. package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js.map +1 -1
  230. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js +4 -2
  231. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js.map +1 -1
  232. package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +12 -12
  233. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +16 -14
  234. package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
  235. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +17 -15
  236. package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
  237. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +19 -17
  238. package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
  239. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +3 -2
  240. package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
  241. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js +4 -2
  242. package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js.map +1 -1
  243. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +3 -2
  244. package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
  245. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js +4 -3
  246. package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js.map +1 -1
  247. package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js +12 -11
  248. package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js.map +1 -1
  249. package/dist/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.js +4 -2
  250. package/dist/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.js.map +1 -1
  251. package/dist/components/Payroll/usePreparedPayrollData.js +3 -2
  252. package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
  253. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +3 -2
  254. package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
  255. package/package.json +1 -1
@@ -1,51 +1,36 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { createMachine as d } from "robot3";
3
- import { useMemo as g } from "react";
4
- import { useIsMutating as b } from "@tanstack/react-query";
5
- import { APIError as y } from "@gusto/embedded-api/models/errors/apierror";
6
- import { useI9VerificationGetAuthorization as D } from "@gusto/embedded-api/react-query/i9VerificationGetAuthorization";
7
- import { mutationKeyI9VerificationUpdate as h } from "@gusto/embedded-api/react-query/i9VerificationUpdate";
8
- import { useEmployeesGet as L } from "@gusto/embedded-api/react-query/employeesGet";
9
- import { EmploymentEligibilityContextual as M, DocumentListContextual as S } from "./documentSignerStateMachine.js";
10
- import { documentSignerMachine as x } from "./stateMachine.js";
11
- import { Flow as A } from "../../Flow/Flow.js";
12
- import { BaseComponent as C } from "../../Base/Base.js";
13
- import { useBase as E } from "../../Base/useBase.js";
14
- import { useComponentDictionary as F } from "../../../i18n/I18n.js";
15
- function v(t) {
16
- return /* @__PURE__ */ i(C, { ...t, children: /* @__PURE__ */ i(O, { ...t }) });
1
+ import { jsx as m } from "react/jsx-runtime";
2
+ import { createMachine as f } from "robot3";
3
+ import { useMemo as l } from "react";
4
+ import { useEmployeesGetSuspense as g } from "@gusto/embedded-api/react-query/employeesGet";
5
+ import { useEmployeeFormsListSuspense as D } from "@gusto/embedded-api/react-query/employeeFormsList";
6
+ import { EmploymentEligibilityContextual as d, DocumentListContextual as y } from "./documentSignerStateMachine.js";
7
+ import { documentSignerMachine as E } from "./stateMachine.js";
8
+ import { Flow as S } from "../../Flow/Flow.js";
9
+ import { BaseComponent as x } from "../../Base/Base.js";
10
+ import "../../Base/useBase.js";
11
+ import { useComponentDictionary as C } from "../../../i18n/I18n.js";
12
+ import { I9_FORM_NAME as F } from "../../../shared/constants.js";
13
+ function O(o) {
14
+ return /* @__PURE__ */ m(x, { ...o, children: /* @__PURE__ */ m(M, { ...o }) });
17
15
  }
18
- function O({ employeeId: t, onEvent: m, dictionary: a, withEmployeeI9: o = !1 }) {
19
- F("Employee.DocumentSigner", a);
20
- const { LoadingIndicator: s } = E(), { data: u, isLoading: c } = L(
21
- { employeeId: t },
22
- { enabled: o }
23
- ), r = u?.employee?.onboardingDocumentsConfig?.i9Document === !0, { data: f, isLoading: p } = D(
24
- { employeeId: t },
25
- {
26
- enabled: o && r,
27
- retry: !1,
28
- refetchOnMount: !1,
29
- refetchOnWindowFocus: !1,
30
- staleTime: 1 / 0,
31
- throwOnError: (n) => !(n instanceof y && n.httpMeta.response.status === 404)
32
- }
33
- ), e = o && r && !f?.i9Authorization?.employeeSigned, l = g(
34
- () => d(
16
+ function M({ employeeId: o, onEvent: i, dictionary: s, withEmployeeI9: t = !1 }) {
17
+ C("Employee.DocumentSigner", s);
18
+ const { data: a } = g({ employeeId: o }), { data: c } = D({ employeeId: o }), u = a.employee?.onboardingDocumentsConfig?.i9Document === !0, r = c.formList?.find((n) => n.name === F), e = t && u && (!r || r.requiresSigning === !0), p = l(
19
+ () => f(
35
20
  e ? "employmentEligibility" : "index",
36
- x,
21
+ E,
37
22
  (n) => ({
38
23
  ...n,
39
- component: e ? M : S,
40
- employeeId: t,
41
- withEmployeeI9: o
24
+ component: e ? d : y,
25
+ employeeId: o,
26
+ withEmployeeI9: t
42
27
  })
43
28
  ),
44
- [t, e, o]
29
+ [o, e, t]
45
30
  );
46
- return !(b({ mutationKey: h() }) > 0) && o && (c || p) ? /* @__PURE__ */ i(s, {}) : /* @__PURE__ */ i(A, { machine: l, onEvent: m });
31
+ return /* @__PURE__ */ m(S, { machine: p, onEvent: i });
47
32
  }
48
33
  export {
49
- v as DocumentSigner
34
+ O as DocumentSigner
50
35
  };
51
36
  //# sourceMappingURL=DocumentSigner.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentSigner.js","sources":["../../../../src/components/Employee/DocumentSigner/DocumentSigner.tsx"],"sourcesContent":["import { createMachine } from 'robot3'\nimport { useMemo } from 'react'\nimport { useIsMutating } from '@tanstack/react-query'\nimport { APIError } from '@gusto/embedded-api/models/errors/apierror'\nimport { useI9VerificationGetAuthorization } from '@gusto/embedded-api/react-query/i9VerificationGetAuthorization'\nimport { mutationKeyI9VerificationUpdate } from '@gusto/embedded-api/react-query/i9VerificationUpdate'\nimport { useEmployeesGet } from '@gusto/embedded-api/react-query/employeesGet'\nimport {\n DocumentListContextual,\n EmploymentEligibilityContextual,\n type DocumentSignerContextInterface,\n} from './documentSignerStateMachine'\nimport { documentSignerMachine } from './stateMachine'\nimport { Flow } from '@/components/Flow/Flow'\nimport { BaseComponent, type BaseComponentInterface } from '@/components/Base'\nimport { useBase } from '@/components/Base'\nimport { useComponentDictionary } from '@/i18n/I18n'\n\nexport interface DocumentSignerProps extends BaseComponentInterface<'Employee.DocumentSigner'> {\n employeeId: string\n withEmployeeI9?: boolean\n}\n\nexport function DocumentSigner(props: DocumentSignerProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nfunction Root({ employeeId, onEvent, dictionary, withEmployeeI9 = false }: DocumentSignerProps) {\n useComponentDictionary('Employee.DocumentSigner', dictionary)\n const { LoadingIndicator } = useBase()\n\n const { data: employeeData, isLoading: employeeLoading } = useEmployeesGet(\n { employeeId },\n { enabled: withEmployeeI9 },\n )\n\n const employeeHasI9Enabled =\n employeeData?.employee?.onboardingDocumentsConfig?.i9Document === true\n\n const { data: i9AuthData, isLoading: i9AuthLoading } = useI9VerificationGetAuthorization(\n { employeeId },\n {\n enabled: withEmployeeI9 && employeeHasI9Enabled,\n retry: false,\n refetchOnMount: false,\n refetchOnWindowFocus: false,\n staleTime: Infinity,\n throwOnError: (error: Error) => {\n return !(error instanceof APIError && error.httpMeta.response.status === 404)\n },\n },\n )\n\n const needsI9Form =\n withEmployeeI9 && employeeHasI9Enabled && !i9AuthData?.i9Authorization?.employeeSigned\n\n const machine = useMemo(\n () =>\n createMachine(\n needsI9Form ? 'employmentEligibility' : 'index',\n documentSignerMachine,\n (initialContext: DocumentSignerContextInterface) => ({\n ...initialContext,\n component: needsI9Form ? EmploymentEligibilityContextual : DocumentListContextual,\n employeeId,\n withEmployeeI9,\n }),\n ),\n [employeeId, needsI9Form, withEmployeeI9],\n )\n\n const isSubmittingI9 = useIsMutating({ mutationKey: mutationKeyI9VerificationUpdate() }) > 0\n\n if (!isSubmittingI9 && withEmployeeI9 && (employeeLoading || i9AuthLoading)) {\n return <LoadingIndicator />\n }\n\n return <Flow machine={machine} onEvent={onEvent} />\n}\n"],"names":["DocumentSigner","props","jsx","BaseComponent","Root","employeeId","onEvent","dictionary","withEmployeeI9","useComponentDictionary","LoadingIndicator","useBase","employeeData","employeeLoading","useEmployeesGet","employeeHasI9Enabled","i9AuthData","i9AuthLoading","useI9VerificationGetAuthorization","error","APIError","needsI9Form","machine","useMemo","createMachine","documentSignerMachine","initialContext","EmploymentEligibilityContextual","DocumentListContextual","useIsMutating","mutationKeyI9VerificationUpdate","Flow"],"mappings":";;;;;;;;;;;;;;AAuBO,SAASA,EAAeC,GAA4B;AACzD,SACE,gBAAAC,EAACC,KAAe,GAAGF,GACjB,4BAACG,GAAA,EAAM,GAAGH,GAAO,EAAA,CACnB;AAEJ;AAEA,SAASG,EAAK,EAAE,YAAAC,GAAY,SAAAC,GAAS,YAAAC,GAAY,gBAAAC,IAAiB,MAA8B;AAC9F,EAAAC,EAAuB,2BAA2BF,CAAU;AAC5D,QAAM,EAAE,kBAAAG,EAAA,IAAqBC,EAAA,GAEvB,EAAE,MAAMC,GAAc,WAAWC,MAAoBC;AAAA,IACzD,EAAE,YAAAT,EAAA;AAAA,IACF,EAAE,SAASG,EAAA;AAAA,EAAe,GAGtBO,IACJH,GAAc,UAAU,2BAA2B,eAAe,IAE9D,EAAE,MAAMI,GAAY,WAAWC,MAAkBC;AAAA,IACrD,EAAE,YAAAb,EAAA;AAAA,IACF;AAAA,MACE,SAASG,KAAkBO;AAAA,MAC3B,OAAO;AAAA,MACP,gBAAgB;AAAA,MAChB,sBAAsB;AAAA,MACtB,WAAW;AAAA,MACX,cAAc,CAACI,MACN,EAAEA,aAAiBC,KAAYD,EAAM,SAAS,SAAS,WAAW;AAAA,IAC3E;AAAA,EACF,GAGIE,IACJb,KAAkBO,KAAwB,CAACC,GAAY,iBAAiB,gBAEpEM,IAAUC;AAAA,IACd,MACEC;AAAA,MACEH,IAAc,0BAA0B;AAAA,MACxCI;AAAA,MACA,CAACC,OAAoD;AAAA,QACnD,GAAGA;AAAA,QACH,WAAWL,IAAcM,IAAkCC;AAAA,QAC3D,YAAAvB;AAAA,QACA,gBAAAG;AAAA,MAAA;AAAA,IACF;AAAA,IAEJ,CAACH,GAAYgB,GAAab,CAAc;AAAA,EAAA;AAK1C,SAAI,EAFmBqB,EAAc,EAAE,aAAaC,EAAA,EAAgC,CAAG,IAAI,MAEpEtB,MAAmBK,KAAmBI,uBACnDP,GAAA,EAAiB,IAGpB,gBAAAR,EAAC6B,GAAA,EAAK,SAAAT,GAAkB,SAAAhB,EAAA,CAAkB;AACnD;"}
1
+ {"version":3,"file":"DocumentSigner.js","sources":["../../../../src/components/Employee/DocumentSigner/DocumentSigner.tsx"],"sourcesContent":["import { createMachine } from 'robot3'\nimport { useMemo } from 'react'\nimport { useEmployeesGetSuspense } from '@gusto/embedded-api/react-query/employeesGet'\nimport { useEmployeeFormsListSuspense } from '@gusto/embedded-api/react-query/employeeFormsList'\nimport {\n DocumentListContextual,\n EmploymentEligibilityContextual,\n type DocumentSignerContextInterface,\n} from './documentSignerStateMachine'\nimport { documentSignerMachine } from './stateMachine'\nimport { Flow } from '@/components/Flow/Flow'\nimport { BaseComponent, type BaseComponentInterface } from '@/components/Base'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport { I9_FORM_NAME } from '@/shared/constants'\n\nexport interface DocumentSignerProps extends BaseComponentInterface<'Employee.DocumentSigner'> {\n employeeId: string\n withEmployeeI9?: boolean\n}\n\nexport function DocumentSigner(props: DocumentSignerProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nfunction Root({ employeeId, onEvent, dictionary, withEmployeeI9 = false }: DocumentSignerProps) {\n useComponentDictionary('Employee.DocumentSigner', dictionary)\n\n const { data: employeeData } = useEmployeesGetSuspense({ employeeId })\n const { data: formsData } = useEmployeeFormsListSuspense({ employeeId })\n\n const employeeHasI9Enabled = employeeData.employee?.onboardingDocumentsConfig?.i9Document === true\n\n const i9Form = formsData.formList?.find(form => form.name === I9_FORM_NAME)\n const needsI9Form =\n withEmployeeI9 && employeeHasI9Enabled && (!i9Form || i9Form.requiresSigning === true)\n\n const machine = useMemo(\n () =>\n createMachine(\n needsI9Form ? 'employmentEligibility' : 'index',\n documentSignerMachine,\n (initialContext: DocumentSignerContextInterface) => ({\n ...initialContext,\n component: needsI9Form ? EmploymentEligibilityContextual : DocumentListContextual,\n employeeId,\n withEmployeeI9,\n }),\n ),\n [employeeId, needsI9Form, withEmployeeI9],\n )\n\n return <Flow machine={machine} onEvent={onEvent} />\n}\n"],"names":["DocumentSigner","props","jsx","BaseComponent","Root","employeeId","onEvent","dictionary","withEmployeeI9","useComponentDictionary","employeeData","useEmployeesGetSuspense","formsData","useEmployeeFormsListSuspense","employeeHasI9Enabled","i9Form","form","I9_FORM_NAME","needsI9Form","machine","useMemo","createMachine","documentSignerMachine","initialContext","EmploymentEligibilityContextual","DocumentListContextual","Flow"],"mappings":";;;;;;;;;;;;AAoBO,SAASA,EAAeC,GAA4B;AACzD,SACE,gBAAAC,EAACC,KAAe,GAAGF,GACjB,4BAACG,GAAA,EAAM,GAAGH,GAAO,EAAA,CACnB;AAEJ;AAEA,SAASG,EAAK,EAAE,YAAAC,GAAY,SAAAC,GAAS,YAAAC,GAAY,gBAAAC,IAAiB,MAA8B;AAC9F,EAAAC,EAAuB,2BAA2BF,CAAU;AAE5D,QAAM,EAAE,MAAMG,EAAA,IAAiBC,EAAwB,EAAE,YAAAN,GAAY,GAC/D,EAAE,MAAMO,EAAA,IAAcC,EAA6B,EAAE,YAAAR,GAAY,GAEjES,IAAuBJ,EAAa,UAAU,2BAA2B,eAAe,IAExFK,IAASH,EAAU,UAAU,KAAK,CAAAI,MAAQA,EAAK,SAASC,CAAY,GACpEC,IACJV,KAAkBM,MAAyB,CAACC,KAAUA,EAAO,oBAAoB,KAE7EI,IAAUC;AAAA,IACd,MACEC;AAAA,MACEH,IAAc,0BAA0B;AAAA,MACxCI;AAAA,MACA,CAACC,OAAoD;AAAA,QACnD,GAAGA;AAAA,QACH,WAAWL,IAAcM,IAAkCC;AAAA,QAC3D,YAAApB;AAAA,QACA,gBAAAG;AAAA,MAAA;AAAA,IACF;AAAA,IAEJ,CAACH,GAAYa,GAAaV,CAAc;AAAA,EAAA;AAG1C,SAAO,gBAAAN,EAACwB,GAAA,EAAK,SAAAP,GAAkB,SAAAb,EAAA,CAAkB;AACnD;"}
@@ -5,57 +5,54 @@ import { useI9VerificationUpdateMutation as _ } from "@gusto/embedded-api/react-
5
5
  import { EmploymentEligibilityPresentation as v } from "./EmploymentEligibilityPresentation.js";
6
6
  import { BaseComponent as x } from "../../../Base/Base.js";
7
7
  import { useBase as z } from "../../../Base/useBase.js";
8
- import { useComponentDictionary as T, useI18n as L } from "../../../../i18n/I18n.js";
9
- import { componentEvents as M } from "../../../../shared/constants.js";
10
- function G(i) {
11
- return /* @__PURE__ */ r(x, { ...i, children: /* @__PURE__ */ r(O, { ...i }) });
8
+ import { useComponentDictionary as L, useI18n as S } from "../../../../i18n/I18n.js";
9
+ import { componentEvents as T } from "../../../../shared/constants.js";
10
+ function G(o) {
11
+ return /* @__PURE__ */ r(x, { ...o, children: /* @__PURE__ */ r(M, { ...o }) });
12
12
  }
13
- const O = ({ employeeId: i, dictionary: s }) => {
14
- T("Employee.EmploymentEligibility", s), L("Employee.EmploymentEligibility");
15
- const { onEvent: m, baseSubmitHandler: c, LoadingIndicator: p } = z(), { data: l, isLoading: f } = A(
16
- { employeeId: i },
13
+ const M = ({ employeeId: o, dictionary: s }) => {
14
+ L("Employee.EmploymentEligibility", s), S("Employee.EmploymentEligibility");
15
+ const { onEvent: m, baseSubmitHandler: c, LoadingIndicator: p } = z(), { data: l, isLoading: y } = A(
16
+ { employeeId: o },
17
17
  {
18
18
  retry: !1,
19
- refetchOnMount: !1,
20
- refetchOnWindowFocus: !1,
21
- staleTime: 1 / 0,
22
- throwOnError: (o) => !(o instanceof I && o.httpMeta.response.status === 404)
19
+ throwOnError: (i) => !(i instanceof I && i.httpMeta.response.status === 404)
23
20
  }
24
- ), t = l?.i9Authorization, { mutateAsync: y, isPending: u } = _(), d = async (o) => {
25
- await c(o, async (h) => {
26
- const { authorizationStatus: e, documentType: a, documentNumber: n, expirationDate: b, country: g } = h;
27
- if (!e) return;
28
- const D = await y({
21
+ ), t = l?.i9Authorization, { mutateAsync: d, isPending: u } = _(), E = async (i) => {
22
+ await c(i, async (h) => {
23
+ const { authorizationStatus: n, documentType: a, documentNumber: e, expirationDate: b, country: g } = h;
24
+ if (!n) return;
25
+ const D = await d({
29
26
  request: {
30
- employeeId: i,
27
+ employeeId: o,
31
28
  requestBody: {
32
- authorizationStatus: e,
29
+ authorizationStatus: n,
33
30
  version: t?.version,
34
- ...e === "permanent_resident" && n && {
31
+ ...n === "permanent_resident" && e && {
35
32
  documentType: "uscis_alien_registration_number",
36
- documentNumber: n
33
+ documentNumber: e
37
34
  },
38
- ...e === "alien" && {
39
- ...n && a && { documentType: a, documentNumber: n },
35
+ ...n === "alien" && {
36
+ ...e && a && { documentType: a, documentNumber: e },
40
37
  expirationDate: b,
41
38
  ...a === "foreign_passport" && { country: g }
42
39
  }
43
40
  }
44
41
  }
45
42
  });
46
- m(M.EMPLOYEE_EMPLOYMENT_ELIGIBILITY_DONE, D.i9Authorization);
43
+ m(T.EMPLOYEE_EMPLOYMENT_ELIGIBILITY_DONE, D.i9Authorization);
47
44
  });
48
- }, E = t ? {
45
+ }, f = t ? {
49
46
  authorizationStatus: t.authorizationStatus,
50
47
  documentType: t.documentType ?? void 0,
51
48
  expirationDate: t.expirationDate ? new Date(t.expirationDate) : void 0,
52
49
  country: t.country ?? void 0
53
50
  } : {};
54
- return !u && f ? /* @__PURE__ */ r(p, {}) : /* @__PURE__ */ r(
51
+ return !u && y ? /* @__PURE__ */ r(p, {}) : /* @__PURE__ */ r(
55
52
  v,
56
53
  {
57
- onSubmit: d,
58
- defaultValues: E,
54
+ onSubmit: E,
55
+ defaultValues: f,
59
56
  hasDocumentNumber: t?.hasDocumentNumber,
60
57
  isPending: u
61
58
  },
@@ -1 +1 @@
1
- {"version":3,"file":"EmploymentEligibility.js","sources":["../../../../../src/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibility.tsx"],"sourcesContent":["import { APIError } from '@gusto/embedded-api/models/errors/apierror'\nimport { useI9VerificationGetAuthorization } from '@gusto/embedded-api/react-query/i9VerificationGetAuthorization'\nimport { useI9VerificationUpdateMutation } from '@gusto/embedded-api/react-query/i9VerificationUpdate'\nimport { EmploymentEligibilityPresentation } from './EmploymentEligibilityPresentation'\nimport type {\n EmploymentEligibilityInputs,\n EmploymentEligibilityPayload,\n} from './EmploymentEligibilitySchema'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\n\nexport interface EmploymentEligibilityProps extends BaseComponentInterface<'Employee.EmploymentEligibility'> {\n employeeId: string\n}\n\nexport function EmploymentEligibility(props: EmploymentEligibilityProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nconst Root = ({ employeeId, dictionary }: EmploymentEligibilityProps) => {\n useComponentDictionary('Employee.EmploymentEligibility', dictionary)\n useI18n('Employee.EmploymentEligibility')\n const { onEvent, baseSubmitHandler, LoadingIndicator } = useBase()\n\n const { data: i9AuthData, isLoading } = useI9VerificationGetAuthorization(\n { employeeId },\n {\n retry: false,\n refetchOnMount: false,\n refetchOnWindowFocus: false,\n staleTime: Infinity,\n throwOnError: (error: Error) => {\n return !(error instanceof APIError && error.httpMeta.response.status === 404)\n },\n },\n )\n\n const existingAuth = i9AuthData?.i9Authorization\n\n const { mutateAsync: updateI9Authorization, isPending } = useI9VerificationUpdateMutation()\n\n const handleSubmit = async (data: EmploymentEligibilityPayload) => {\n await baseSubmitHandler(data, async payload => {\n const { authorizationStatus, documentType, documentNumber, expirationDate, country } = payload\n\n if (!authorizationStatus) return\n\n const result = await updateI9Authorization({\n request: {\n employeeId,\n requestBody: {\n authorizationStatus,\n version: existingAuth?.version,\n ...(authorizationStatus === 'permanent_resident' &&\n documentNumber && {\n documentType: 'uscis_alien_registration_number',\n documentNumber,\n }),\n ...(authorizationStatus === 'alien' && {\n ...(documentNumber && documentType && { documentType, documentNumber }),\n expirationDate,\n ...(documentType === 'foreign_passport' && { country }),\n }),\n },\n },\n })\n\n onEvent(componentEvents.EMPLOYEE_EMPLOYMENT_ELIGIBILITY_DONE, result.i9Authorization)\n })\n }\n\n const defaultValues: Partial<EmploymentEligibilityInputs> = existingAuth\n ? {\n authorizationStatus: existingAuth.authorizationStatus,\n documentType: existingAuth.documentType ?? undefined,\n expirationDate: existingAuth.expirationDate\n ? new Date(existingAuth.expirationDate)\n : undefined,\n country: existingAuth.country ?? undefined,\n }\n : {}\n\n if (!isPending && isLoading) return <LoadingIndicator />\n\n return (\n <EmploymentEligibilityPresentation\n key={existingAuth?.uuid}\n onSubmit={handleSubmit}\n defaultValues={defaultValues}\n hasDocumentNumber={existingAuth?.hasDocumentNumber}\n isPending={isPending}\n />\n )\n}\n"],"names":["EmploymentEligibility","props","jsx","BaseComponent","Root","employeeId","dictionary","useComponentDictionary","useI18n","onEvent","baseSubmitHandler","LoadingIndicator","useBase","i9AuthData","isLoading","useI9VerificationGetAuthorization","error","APIError","existingAuth","updateI9Authorization","isPending","useI9VerificationUpdateMutation","handleSubmit","data","payload","authorizationStatus","documentType","documentNumber","expirationDate","country","result","componentEvents","defaultValues","EmploymentEligibilityPresentation"],"mappings":";;;;;;;;;AAkBO,SAASA,EAAsBC,GAAmC;AACvE,SACE,gBAAAC,EAACC,KAAe,GAAGF,GACjB,4BAACG,GAAA,EAAM,GAAGH,GAAO,EAAA,CACnB;AAEJ;AAEA,MAAMG,IAAO,CAAC,EAAE,YAAAC,GAAY,YAAAC,QAA6C;AACvE,EAAAC,EAAuB,kCAAkCD,CAAU,GACnEE,EAAQ,gCAAgC;AACxC,QAAM,EAAE,SAAAC,GAAS,mBAAAC,GAAmB,kBAAAC,EAAA,IAAqBC,EAAA,GAEnD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AA,EAAA,IAEnC,CAAA;AAEJ,SAAI,CAACE,KAAaN,sBAAmBH,GAAA,CAAA,CAAiB,IAGpD,gBAAAT;AAAA,IAAC+B;AAAA,IAAA;AAAA,MAEC,UAAUX;AAAA,MACV,eAAAU;AAAA,MACA,mBAAmBd,GAAc;AAAA,MACjC,WAAAE;AAAA,IAAA;AAAA,IAJKF,GAAc;AAAA,EAAA;AAOzB;"}
1
+ {"version":3,"file":"EmploymentEligibility.js","sources":["../../../../../src/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibility.tsx"],"sourcesContent":["import { APIError } from '@gusto/embedded-api/models/errors/apierror'\nimport { useI9VerificationGetAuthorization } from '@gusto/embedded-api/react-query/i9VerificationGetAuthorization'\nimport { useI9VerificationUpdateMutation } from '@gusto/embedded-api/react-query/i9VerificationUpdate'\nimport { EmploymentEligibilityPresentation } from './EmploymentEligibilityPresentation'\nimport type {\n EmploymentEligibilityInputs,\n EmploymentEligibilityPayload,\n} from './EmploymentEligibilitySchema'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\n\nexport interface EmploymentEligibilityProps extends BaseComponentInterface<'Employee.EmploymentEligibility'> {\n employeeId: string\n}\n\nexport function EmploymentEligibility(props: EmploymentEligibilityProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nconst Root = ({ employeeId, dictionary }: EmploymentEligibilityProps) => {\n useComponentDictionary('Employee.EmploymentEligibility', dictionary)\n useI18n('Employee.EmploymentEligibility')\n const { onEvent, baseSubmitHandler, LoadingIndicator } = useBase()\n\n const { data: i9AuthData, isLoading } = useI9VerificationGetAuthorization(\n { employeeId },\n {\n retry: false,\n throwOnError: (error: Error) => {\n return !(error instanceof APIError && error.httpMeta.response.status === 404)\n },\n },\n )\n\n const existingAuth = i9AuthData?.i9Authorization\n\n const { mutateAsync: updateI9Authorization, isPending } = useI9VerificationUpdateMutation()\n\n const handleSubmit = async (data: EmploymentEligibilityPayload) => {\n await baseSubmitHandler(data, async payload => {\n const { authorizationStatus, documentType, documentNumber, expirationDate, country } = payload\n\n if (!authorizationStatus) return\n\n const result = await updateI9Authorization({\n request: {\n employeeId,\n requestBody: {\n authorizationStatus,\n version: existingAuth?.version,\n ...(authorizationStatus === 'permanent_resident' &&\n documentNumber && {\n documentType: 'uscis_alien_registration_number',\n documentNumber,\n }),\n ...(authorizationStatus === 'alien' && {\n ...(documentNumber && documentType && { documentType, documentNumber }),\n expirationDate,\n ...(documentType === 'foreign_passport' && { country }),\n }),\n },\n },\n })\n\n onEvent(componentEvents.EMPLOYEE_EMPLOYMENT_ELIGIBILITY_DONE, result.i9Authorization)\n })\n }\n\n const defaultValues: Partial<EmploymentEligibilityInputs> = existingAuth\n ? {\n authorizationStatus: existingAuth.authorizationStatus,\n documentType: existingAuth.documentType ?? undefined,\n expirationDate: existingAuth.expirationDate\n ? new Date(existingAuth.expirationDate)\n : undefined,\n country: existingAuth.country ?? undefined,\n }\n : {}\n\n if (!isPending && isLoading) return <LoadingIndicator />\n\n return (\n <EmploymentEligibilityPresentation\n key={existingAuth?.uuid}\n onSubmit={handleSubmit}\n defaultValues={defaultValues}\n hasDocumentNumber={existingAuth?.hasDocumentNumber}\n isPending={isPending}\n />\n )\n}\n"],"names":["EmploymentEligibility","props","jsx","BaseComponent","Root","employeeId","dictionary","useComponentDictionary","useI18n","onEvent","baseSubmitHandler","LoadingIndicator","useBase","i9AuthData","isLoading","useI9VerificationGetAuthorization","error","APIError","existingAuth","updateI9Authorization","isPending","useI9VerificationUpdateMutation","handleSubmit","data","payload","authorizationStatus","documentType","documentNumber","expirationDate","country","result","componentEvents","defaultValues","EmploymentEligibilityPresentation"],"mappings":";;;;;;;;;AAkBO,SAASA,EAAsBC,GAAmC;AACvE,SACE,gBAAAC,EAACC,KAAe,GAAGF,GACjB,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C;AAAA,EACH,GAEME,IAAsDd,IACxD;AAAA,IACE,qBAAqBA,EAAa;AAAA,IAClC,cAAcA,EAAa,gBAAgB;AAAA,IAC3C,gBAAgBA,EAAa,iBACzB,IAAI,KAAKA,EAAa,cAAc,IACpC;AAAA,IACJ,SAASA,EAAa,WAAW;AAAA,EAAA,IAEnC,CAAA;AAEJ,SAAI,CAACE,KAAaN,sBAAmBH,GAAA,CAAA,CAAiB,IAGpD,gBAAAT;AAAA,IAAC+B;AAAA,IAAA;AAAA,MAEC,UAAUX;AAAA,MACV,eAAAU;AAAA,MACA,mBAAmBd,GAAc;AAAA,MACjC,WAAAE;AAAA,IAAA;AAAA,IAJKF,GAAc;AAAA,EAAA;AAOzB;"}
@@ -7,6 +7,8 @@ import { AuthorizationStatus as q, I9AuthorizationDocumentType as w } from "@gus
7
7
  import { generateEmploymentEligibilitySchema as L } from "./EmploymentEligibilitySchema.js";
8
8
  import { COUNTRIES as k } from "./countries.js";
9
9
  import { Flex as b } from "../../../Common/Flex/Flex.js";
10
+ import "classnames";
11
+ import "../../../../shared/constants.js";
10
12
  import { ActionsLayout as P } from "../../../Common/ActionsLayout/ActionsLayout.js";
11
13
  import { useComponentContext as V } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
12
14
  import { ComboBoxField as B } from "../../../Common/Fields/ComboBoxField/ComboBoxField.js";
@@ -21,15 +23,15 @@ const J = {
21
23
  permanent_resident: "statusDescriptions.permanent_resident",
22
24
  noncitizen: "statusDescriptions.noncitizen",
23
25
  alien: "statusDescriptions.alien"
24
- }, be = ({
26
+ }, fe = ({
25
27
  onSubmit: h,
26
28
  defaultValues: f,
27
29
  hasDocumentNumber: y,
28
30
  isPending: D
29
31
  }) => {
30
32
  K("Employee.EmploymentEligibility");
31
- const { Heading: g, Text: x, Alert: z, Button: E, Link: N } = V(), { t: e } = I("Employee.EmploymentEligibility"), [a, m] = v(!!y), r = O({
32
- resolver: j(L(a)),
33
+ const { Heading: g, Text: x, Alert: z, Button: E, Link: N } = V(), { t: e } = I("Employee.EmploymentEligibility"), [m, a] = v(!!y), r = O({
34
+ resolver: j(L(m)),
33
35
  defaultValues: f
34
36
  }), { control: l, setValue: u, clearErrors: c } = r, o = d({ control: l, name: "authorizationStatus" }), s = d({ control: l, name: "documentType" }), S = Object.values(q).map((n) => ({
35
37
  value: n,
@@ -38,9 +40,9 @@ const J = {
38
40
  value: n,
39
41
  label: e(`authorizationDocument.options.${n}`)
40
42
  })), C = () => {
41
- u("documentNumber", ""), c("documentNumber"), m(!1);
43
+ u("documentNumber", ""), c("documentNumber"), a(!1);
42
44
  }, F = () => {
43
- u("documentNumber", ""), c("documentNumber"), m(!1);
45
+ u("documentNumber", ""), c("documentNumber"), a(!1);
44
46
  }, _ = o === "alien", R = o === "permanent_resident" || o === "alien" && !!s, i = o === "permanent_resident" ? "uscis_alien_registration_number" : s;
45
47
  return /* @__PURE__ */ t($, { ...r, children: /* @__PURE__ */ t(H, { onSubmit: r.handleSubmit(h), children: /* @__PURE__ */ p(b, { flexDirection: "column", gap: 16, children: [
46
48
  /* @__PURE__ */ p(b, { flexDirection: "column", gap: 2, children: [
@@ -93,7 +95,7 @@ const J = {
93
95
  name: "documentNumber",
94
96
  label: e(`documentNumber.${i}.label`),
95
97
  description: i !== "foreign_passport" ? e(`documentNumber.${i}.description`) : void 0,
96
- placeholder: a ? e(`documentNumber.${i}.placeholder`) : void 0,
98
+ placeholder: m ? e(`documentNumber.${i}.placeholder`) : void 0,
97
99
  isRequired: !0
98
100
  }
99
101
  ),
@@ -113,6 +115,6 @@ const J = {
113
115
  ] }) }) });
114
116
  };
115
117
  export {
116
- be as EmploymentEligibilityPresentation
118
+ fe as EmploymentEligibilityPresentation
117
119
  };
118
120
  //# sourceMappingURL=EmploymentEligibilityPresentation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EmploymentEligibilityPresentation.js","sources":["../../../../../src/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.tsx"],"sourcesContent":["import { useState } from 'react'\nimport { useTranslation, Trans } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport {\n AuthorizationStatus,\n I9AuthorizationDocumentType,\n} from '@gusto/embedded-api/models/components/i9authorization'\nimport {\n generateEmploymentEligibilitySchema,\n type EmploymentEligibilityInputs,\n type EmploymentEligibilityPayload,\n} from './EmploymentEligibilitySchema'\nimport { COUNTRIES } from './countries'\nimport {\n Flex,\n SelectField,\n RadioGroupField,\n TextInputField,\n DatePickerField,\n ActionsLayout,\n} from '@/components/Common'\nimport { ComboBoxField } from '@/components/Common/Fields/ComboBoxField/ComboBoxField'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\n\ninterface EmploymentEligibilityPresentationProps {\n onSubmit: SubmitHandler<EmploymentEligibilityPayload>\n defaultValues?: Partial<EmploymentEligibilityInputs>\n hasDocumentNumber?: boolean | null\n isPending?: boolean\n}\n\nconst statusDescriptionKeys = {\n citizen: 'statusDescriptions.citizen',\n permanent_resident: 'statusDescriptions.permanent_resident',\n noncitizen: 'statusDescriptions.noncitizen',\n alien: 'statusDescriptions.alien',\n} as const satisfies Record<AuthorizationStatus, string>\n\nexport const EmploymentEligibilityPresentation = ({\n onSubmit,\n defaultValues,\n hasDocumentNumber,\n isPending,\n}: EmploymentEligibilityPresentationProps) => {\n useI18n('Employee.EmploymentEligibility')\n const { Heading, Text, Alert, Button, Link } = useComponentContext()\n const { t } = useTranslation('Employee.EmploymentEligibility')\n\n const [hasExistingDocumentNumber, setHasExistingDocumentNumber] = useState(!!hasDocumentNumber)\n\n const formMethods = useForm<EmploymentEligibilityInputs, unknown, EmploymentEligibilityPayload>({\n resolver: zodResolver(generateEmploymentEligibilitySchema(hasExistingDocumentNumber)),\n defaultValues,\n })\n\n const { control, setValue, clearErrors } = formMethods\n const authorizationStatus = useWatch({ control, name: 'authorizationStatus' })\n const documentType = useWatch({ control, name: 'documentType' })\n\n const statusOptions = Object.values(AuthorizationStatus).map(value => ({\n value,\n label: t(`select.options.${value}`),\n }))\n\n const authorizationDocumentOptions = Object.values(I9AuthorizationDocumentType).map(value => ({\n value,\n label: t(`authorizationDocument.options.${value}`),\n }))\n\n const handleAuthorizationStatusChange = () => {\n setValue('documentNumber', '')\n clearErrors('documentNumber')\n setHasExistingDocumentNumber(false)\n }\n\n const handleDocumentTypeChange = () => {\n setValue('documentNumber', '')\n clearErrors('documentNumber')\n setHasExistingDocumentNumber(false)\n }\n\n const showDocumentTypeRadio = authorizationStatus === 'alien'\n const showDocumentNumberInput =\n authorizationStatus === 'permanent_resident' ||\n (authorizationStatus === 'alien' && !!documentType)\n const activeDocumentType =\n authorizationStatus === 'permanent_resident' ? 'uscis_alien_registration_number' : documentType\n\n return (\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={16}>\n <Flex flexDirection=\"column\" gap={2}>\n <Heading as=\"h2\">{t('title')}</Heading>\n <Text variant=\"supporting\">\n <Trans\n i18nKey={'subtitle'}\n t={t}\n components={{\n formI9Link: <Link />,\n }}\n />\n </Text>\n </Flex>\n\n <SelectField\n name=\"authorizationStatus\"\n label={t('select.label')}\n description={t('select.description')}\n placeholder={t('select.placeholder')}\n options={statusOptions}\n isRequired\n onChange={handleAuthorizationStatusChange}\n />\n\n {authorizationStatus && (\n <Alert\n status=\"info\"\n label={t(statusDescriptionKeys[authorizationStatus])}\n disableScrollIntoView\n />\n )}\n\n {authorizationStatus === 'alien' && (\n <DatePickerField name=\"expirationDate\" label={t('expirationDate.label')} />\n )}\n\n {showDocumentTypeRadio && (\n <RadioGroupField\n name=\"documentType\"\n label={t('authorizationDocument.label')}\n options={authorizationDocumentOptions}\n isRequired\n onChange={handleDocumentTypeChange}\n />\n )}\n\n {showDocumentNumberInput && activeDocumentType && (\n <TextInputField\n name=\"documentNumber\"\n label={t(`documentNumber.${activeDocumentType}.label`)}\n description={\n activeDocumentType !== 'foreign_passport'\n ? t(`documentNumber.${activeDocumentType}.description`)\n : undefined\n }\n placeholder={\n hasExistingDocumentNumber\n ? t(`documentNumber.${activeDocumentType}.placeholder`)\n : undefined\n }\n isRequired\n />\n )}\n\n {documentType === 'foreign_passport' && authorizationStatus === 'alien' && (\n <ComboBoxField\n name=\"country\"\n label={t('country.label')}\n description={t('country.description')}\n options={COUNTRIES}\n placeholder={t('country.placeholder')}\n allowsCustomValue\n isRequired\n />\n )}\n\n <ActionsLayout>\n <Button type=\"submit\" isLoading={isPending}>\n {t('submit')}\n </Button>\n </ActionsLayout>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n"],"names":["statusDescriptionKeys","EmploymentEligibilityPresentation","onSubmit","defaultValues","hasDocumentNumber","isPending","useI18n","Heading","Text","Alert","Button","Link","useComponentContext","t","useTranslation","hasExistingDocumentNumber","setHasExistingDocumentNumber","useState","formMethods","useForm","zodResolver","generateEmploymentEligibilitySchema","control","setValue","clearErrors","authorizationStatus","useWatch","documentType","statusOptions","AuthorizationStatus","value","authorizationDocumentOptions","I9AuthorizationDocumentType","handleAuthorizationStatusChange","handleDocumentTypeChange","showDocumentTypeRadio","showDocumentNumberInput","activeDocumentType","FormProvider","jsx","Form","jsxs","Flex","Trans","SelectField","DatePickerField","RadioGroupField","TextInputField","ComboBoxField","COUNTRIES","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;AAkCA,MAAMA,IAAwB;AAAA,EAC5B,SAAS;AAAA,EACT,oBAAoB;AAAA,EACpB,YAAY;AAAA,EACZ,OAAO;AACT,GAEaC,KAAoC,CAAC;AAAA,EAChD,UAAAC;AAAA,EACA,eAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,WAAAC;AACF,MAA8C;AAC5C,EAAAC,EAAQ,gCAAgC;AACxC,QAAM,EAAE,SAAAC,GAAS,MAAAC,GAAM,OAAAC,GAAO,QAAAC,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,EAAE,kBAAkBwB,CAAkB,cAAc,IACpD;AAAA,QAEN,aACEtB,IACIF,EAAE,kBAAkBwB,CAAkB,cAAc,IACpD;AAAA,QAEN,YAAU;AAAA,MAAA;AAAA,IAAA;AAAA,IAIbV,MAAiB,sBAAsBF,MAAwB,WAC9D,gBAAAc;AAAA,MAACS;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOnC,EAAE,eAAe;AAAA,QACxB,aAAaA,EAAE,qBAAqB;AAAA,QACpC,SAASoC;AAAA,QACT,aAAapC,EAAE,qBAAqB;AAAA,QACpC,mBAAiB;AAAA,QACjB,YAAU;AAAA,MAAA;AAAA,IAAA;AAAA,IAId,gBAAA0B,EAACW,GAAA,EACC,UAAA,gBAAAX,EAAC7B,GAAA,EAAO,MAAK,UAAS,WAAWL,GAC9B,UAAAQ,EAAE,QAAQ,EAAA,CACb,EAAA,CACF;AAAA,EAAA,EAAA,CACF,GACF,GACF;AAEJ;"}
1
+ {"version":3,"file":"EmploymentEligibilityPresentation.js","sources":["../../../../../src/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.tsx"],"sourcesContent":["import { useState } from 'react'\nimport { useTranslation, Trans } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport {\n AuthorizationStatus,\n I9AuthorizationDocumentType,\n} from '@gusto/embedded-api/models/components/i9authorization'\nimport {\n generateEmploymentEligibilitySchema,\n type EmploymentEligibilityInputs,\n type EmploymentEligibilityPayload,\n} from './EmploymentEligibilitySchema'\nimport { COUNTRIES } from './countries'\nimport {\n Flex,\n SelectField,\n RadioGroupField,\n TextInputField,\n DatePickerField,\n ActionsLayout,\n} from '@/components/Common'\nimport { ComboBoxField } from '@/components/Common/Fields/ComboBoxField/ComboBoxField'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\n\ninterface EmploymentEligibilityPresentationProps {\n onSubmit: SubmitHandler<EmploymentEligibilityPayload>\n defaultValues?: Partial<EmploymentEligibilityInputs>\n hasDocumentNumber?: boolean | null\n isPending?: boolean\n}\n\nconst statusDescriptionKeys = {\n citizen: 'statusDescriptions.citizen',\n permanent_resident: 'statusDescriptions.permanent_resident',\n noncitizen: 'statusDescriptions.noncitizen',\n alien: 'statusDescriptions.alien',\n} as const satisfies Record<AuthorizationStatus, string>\n\nexport const EmploymentEligibilityPresentation = ({\n onSubmit,\n defaultValues,\n hasDocumentNumber,\n isPending,\n}: EmploymentEligibilityPresentationProps) => {\n useI18n('Employee.EmploymentEligibility')\n const { Heading, Text, Alert, Button, Link } = useComponentContext()\n const { t } = useTranslation('Employee.EmploymentEligibility')\n\n const [hasExistingDocumentNumber, setHasExistingDocumentNumber] = useState(!!hasDocumentNumber)\n\n const formMethods = useForm<EmploymentEligibilityInputs, unknown, EmploymentEligibilityPayload>({\n resolver: zodResolver(generateEmploymentEligibilitySchema(hasExistingDocumentNumber)),\n defaultValues,\n })\n\n const { control, setValue, clearErrors } = formMethods\n const authorizationStatus = useWatch({ control, name: 'authorizationStatus' })\n const documentType = useWatch({ control, name: 'documentType' })\n\n const statusOptions = Object.values(AuthorizationStatus).map(value => ({\n value,\n label: t(`select.options.${value}`),\n }))\n\n const authorizationDocumentOptions = Object.values(I9AuthorizationDocumentType).map(value => ({\n value,\n label: t(`authorizationDocument.options.${value}`),\n }))\n\n const handleAuthorizationStatusChange = () => {\n setValue('documentNumber', '')\n clearErrors('documentNumber')\n setHasExistingDocumentNumber(false)\n }\n\n const handleDocumentTypeChange = () => {\n setValue('documentNumber', '')\n clearErrors('documentNumber')\n setHasExistingDocumentNumber(false)\n }\n\n const showDocumentTypeRadio = authorizationStatus === 'alien'\n const showDocumentNumberInput =\n authorizationStatus === 'permanent_resident' ||\n (authorizationStatus === 'alien' && !!documentType)\n const activeDocumentType =\n authorizationStatus === 'permanent_resident' ? 'uscis_alien_registration_number' : documentType\n\n return (\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={16}>\n <Flex flexDirection=\"column\" gap={2}>\n <Heading as=\"h2\">{t('title')}</Heading>\n <Text variant=\"supporting\">\n <Trans\n i18nKey={'subtitle'}\n t={t}\n components={{\n formI9Link: <Link />,\n }}\n />\n </Text>\n </Flex>\n\n <SelectField\n name=\"authorizationStatus\"\n label={t('select.label')}\n description={t('select.description')}\n placeholder={t('select.placeholder')}\n options={statusOptions}\n isRequired\n onChange={handleAuthorizationStatusChange}\n />\n\n {authorizationStatus && (\n <Alert\n status=\"info\"\n label={t(statusDescriptionKeys[authorizationStatus])}\n disableScrollIntoView\n />\n )}\n\n {authorizationStatus === 'alien' && (\n <DatePickerField name=\"expirationDate\" label={t('expirationDate.label')} />\n )}\n\n {showDocumentTypeRadio && (\n <RadioGroupField\n name=\"documentType\"\n label={t('authorizationDocument.label')}\n options={authorizationDocumentOptions}\n isRequired\n onChange={handleDocumentTypeChange}\n />\n )}\n\n {showDocumentNumberInput && activeDocumentType && (\n <TextInputField\n name=\"documentNumber\"\n label={t(`documentNumber.${activeDocumentType}.label`)}\n description={\n activeDocumentType !== 'foreign_passport'\n ? t(`documentNumber.${activeDocumentType}.description`)\n : undefined\n }\n placeholder={\n hasExistingDocumentNumber\n ? t(`documentNumber.${activeDocumentType}.placeholder`)\n : undefined\n }\n isRequired\n />\n )}\n\n {documentType === 'foreign_passport' && authorizationStatus === 'alien' && (\n <ComboBoxField\n name=\"country\"\n label={t('country.label')}\n description={t('country.description')}\n options={COUNTRIES}\n placeholder={t('country.placeholder')}\n allowsCustomValue\n isRequired\n />\n )}\n\n <ActionsLayout>\n <Button type=\"submit\" isLoading={isPending}>\n {t('submit')}\n </Button>\n </ActionsLayout>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n"],"names":["statusDescriptionKeys","EmploymentEligibilityPresentation","onSubmit","defaultValues","hasDocumentNumber","isPending","useI18n","Heading","Text","Alert","Button","Link","useComponentContext","t","useTranslation","hasExistingDocumentNumber","setHasExistingDocumentNumber","useState","formMethods","useForm","zodResolver","generateEmploymentEligibilitySchema","control","setValue","clearErrors","authorizationStatus","useWatch","documentType","statusOptions","AuthorizationStatus","value","authorizationDocumentOptions","I9AuthorizationDocumentType","handleAuthorizationStatusChange","handleDocumentTypeChange","showDocumentTypeRadio","showDocumentNumberInput","activeDocumentType","FormProvider","jsx","Form","jsxs","Flex","Trans","SelectField","DatePickerField","RadioGroupField","TextInputField","ComboBoxField","COUNTRIES","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkCA,MAAMA,IAAwB;AAAA,EAC5B,SAAS;AAAA,EACT,oBAAoB;AAAA,EACpB,YAAY;AAAA,EACZ,OAAO;AACT,GAEaC,KAAoC,CAAC;AAAA,EAChD,UAAAC;AAAA,EACA,eAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,WAAAC;AACF,MAA8C;AAC5C,EAAAC,EAAQ,gCAAgC;AACxC,QAAM,EAAE,SAAAC,GAAS,MAAAC,GAAM,OAAAC,GAAO,QAAAC,GAAQ,MAAAC,EAAA,IAASC,EAAA,GACzC,EAAE,GAAAC,EAAA,IAAMC,EAAe,gCAAgC,GAEvD,CAACC,GAA2BC,CAA4B,IAAIC,EAAS,CAAC,CAACb,CAAiB,GAExFc,IAAcC,EAA4E;AAAA,IAC9F,UAAUC,EAAYC,EAAoCN,CAAyB,CAAC;AAAA,IACpF,eAAAZ;AAAA,EAAA,CACD,GAEK,EAAE,SAAAmB,GAAS,UAAAC,GAAU,aAAAC,EAAA,IAAgBN,GACrCO,IAAsBC,EAAS,EAAE,SAAAJ,GAAS,MAAM,uBAAuB,GACvEK,IAAeD,EAAS,EAAE,SAAAJ,GAAS,MAAM,gBAAgB,GAEzDM,IAAgB,OAAO,OAAOC,CAAmB,EAAE,IAAI,CAAAC,OAAU;AAAA,IACrE,OAAAA;AAAA,IACA,OAAO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,EAAE,QAAQ,EAAA,CACb,EAAA,CACF;AAAA,EAAA,EAAA,CACF,GACF,GACF;AAEJ;"}
@@ -12,6 +12,7 @@ import { useBase as j } from "../../../Base/useBase.js";
12
12
  import { useI18n as G } from "../../../../i18n/I18n.js";
13
13
  import { componentEvents as C, STATES_ABBR as H } from "../../../../shared/constants.js";
14
14
  import { Flex as b } from "../../../Common/Flex/Flex.js";
15
+ import "classnames";
15
16
  import { ActionsLayout as O } from "../../../Common/ActionsLayout/ActionsLayout.js";
16
17
  import { useComponentContext as E } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
17
18
  import "react";
@@ -37,7 +38,7 @@ const K = 4, Q = l.object({
37
38
  usedPreparer: l.enum(["yes", "no"]),
38
39
  preparers: l.array(Q)
39
40
  });
40
- function Re(n) {
41
+ function $e(n) {
41
42
  return /* @__PURE__ */ e(_, { ...n, children: /* @__PURE__ */ e(J, { ...n }) });
42
43
  }
43
44
  function J({ employeeId: n, formId: i, className: s }) {
@@ -278,6 +279,6 @@ function re(n) {
278
279
  }), i;
279
280
  }
280
281
  export {
281
- Re as I9SignatureForm
282
+ $e as I9SignatureForm
282
283
  };
283
284
  //# sourceMappingURL=I9SignatureForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"I9SignatureForm.js","sources":["../../../../../src/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.tsx"],"sourcesContent":["import { z } from 'zod'\nimport { FormProvider, useFieldArray, useForm, useFormContext } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useTranslation, Trans } from 'react-i18next'\nimport { useEmployeeFormsGetPdfSuspense } from '@gusto/embedded-api/react-query/employeeFormsGetPdf'\nimport { useEmployeeFormsSignMutation } from '@gusto/embedded-api/react-query/employeeFormsSign'\nimport { useEmployeeFormsGetSuspense } from '@gusto/embedded-api/react-query/employeeFormsGet'\nimport styles from './I9SignatureForm.module.scss'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { useI18n } from '@/i18n'\nimport { componentEvents, STATES_ABBR } from '@/shared/constants'\nimport {\n ActionsLayout,\n CheckboxField,\n Flex,\n RadioGroupField,\n SelectField,\n TextInputField,\n} from '@/components/Common'\nimport { DocumentViewer } from '@/components/Common/DocumentViewer'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nconst MAX_PREPARERS = 4\n\nconst preparerSchema = z.object({\n firstName: z.string().min(1),\n lastName: z.string().min(1),\n street1: z.string().min(1),\n street2: z.string().optional(),\n city: z.string().min(1),\n state: z.string().min(1),\n zip: z.string().min(1),\n signature: z.string().min(1),\n agree: z.boolean().refine(val => val),\n})\n\nexport type PreparerInputs = z.infer<typeof preparerSchema>\n\nconst i9SignatureFormSchema = z.object({\n signature: z.string().min(1),\n agree: z.literal(true),\n usedPreparer: z.enum(['yes', 'no']),\n preparers: z.array(preparerSchema),\n})\n\nexport type I9SignatureFormInputs = z.infer<typeof i9SignatureFormSchema>\n\ninterface I9SignatureFormProps extends CommonComponentInterface {\n employeeId: string\n formId: string\n}\n\nexport function I9SignatureForm(props: I9SignatureFormProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nfunction Root({ employeeId, formId, className }: I9SignatureFormProps) {\n useI18n('Employee.I9SignatureForm')\n const { t } = useTranslation('Employee.I9SignatureForm')\n const { onEvent, baseSubmitHandler } = useBase()\n const Components = useComponentContext()\n\n const { data: formData } = useEmployeeFormsGetSuspense({ employeeId, formId })\n const form = formData.form!\n\n const {\n data: { formPdf },\n } = useEmployeeFormsGetPdfSuspense({ employeeId, formId: form.uuid })\n const pdfUrl = formPdf?.documentUrl\n\n const { mutateAsync: signForm, isPending } = useEmployeeFormsSignMutation()\n\n const methods = useForm<I9SignatureFormInputs>({\n resolver: zodResolver(i9SignatureFormSchema),\n defaultValues: {\n signature: '',\n usedPreparer: 'no',\n preparers: [],\n },\n })\n\n const handleBack = () => {\n onEvent(componentEvents.CANCEL)\n }\n\n const handleSubmit = async (data: I9SignatureFormInputs) => {\n await baseSubmitHandler(data, async payload => {\n const preparerPayload = buildPreparerPayload(payload)\n const { form: signFormResult } = await signForm({\n request: {\n employeeId,\n formId: form.uuid,\n requestBody: {\n signatureText: payload.signature,\n agree: payload.agree,\n ...preparerPayload,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_SIGN_FORM, signFormResult)\n })\n }\n\n return (\n <section className={className}>\n <FormProvider {...methods}>\n <Form onSubmit={methods.handleSubmit(handleSubmit)}>\n <Flex flexDirection=\"column\" gap={20}>\n <section>\n <Components.Heading as=\"h2\">{t('title')}</Components.Heading>\n <Components.Text>\n <Trans\n i18nKey=\"description\"\n t={t}\n components={{\n viewFormLink: pdfUrl ? (\n <Components.Link\n href={pdfUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n download={`${form.title || 'form'}.pdf`}\n />\n ) : (\n <span />\n ),\n }}\n />\n </Components.Text>\n </section>\n\n <DocumentViewer\n url={pdfUrl}\n title={form.title}\n downloadInstructions={t('downloadInstructions')}\n viewDocumentLabel={t('viewDocumentCta')}\n />\n\n <Flex flexDirection=\"column\" gap={12}>\n <TextInputField\n name=\"signature\"\n label={t('signatureLabel')}\n description={t('signatureDescription')}\n errorMessage={t('signatureError')}\n isRequired\n />\n <CheckboxField\n name=\"agree\"\n isRequired\n label={t('confirmationLabel')}\n errorMessage={t('confirmationError')}\n />\n </Flex>\n\n <PreparerSection />\n\n <ActionsLayout>\n <Components.Button variant=\"secondary\" type=\"button\" onClick={handleBack}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('signCta')}\n </Components.Button>\n </ActionsLayout>\n </Flex>\n </Form>\n </FormProvider>\n </section>\n )\n}\n\nconst emptyPreparer = {\n firstName: '',\n lastName: '',\n street1: '',\n street2: '',\n city: '',\n state: '',\n zip: '',\n signature: '',\n agree: false,\n}\n\nfunction PreparerSection() {\n const { t } = useTranslation('Employee.I9SignatureForm')\n const Components = useComponentContext()\n const { watch, control } = useFormContext<I9SignatureFormInputs>()\n const { fields, append, remove } = useFieldArray({ control, name: 'preparers' })\n\n const usedPreparer = watch('usedPreparer')\n const canAddPreparer = fields.length < MAX_PREPARERS\n\n const handlePreparerChange = (value: string) => {\n if (value === 'yes' && fields.length === 0) {\n append(emptyPreparer)\n }\n if (value === 'no' && fields.length > 0) {\n remove()\n }\n }\n\n const handleAddPreparer = () => {\n if (canAddPreparer) {\n append(emptyPreparer)\n }\n }\n\n return (\n <Flex flexDirection=\"column\" gap={20}>\n <RadioGroupField\n name=\"usedPreparer\"\n label={t('preparerQuestion')}\n isRequired\n options={[\n { label: t('preparerNo'), value: 'no' },\n { label: t('preparerYes'), value: 'yes' },\n ]}\n onChange={handlePreparerChange}\n />\n\n {usedPreparer === 'yes' &&\n fields.map((field, index) => (\n <Flex flexDirection=\"column\" gap={0} key={field.id}>\n <div className={styles.preparerAlert}>\n <Components.Alert label={t('preparerNote')} status=\"info\" disableScrollIntoView />\n </div>\n <PreparerFields\n index={index}\n onRemove={() => {\n remove(index)\n }}\n showRemoveButton={index !== 0 && index === fields.length - 1}\n showAddButton={canAddPreparer && index === fields.length - 1}\n onAdd={handleAddPreparer}\n />\n </Flex>\n ))}\n </Flex>\n )\n}\n\ninterface PreparerFieldsProps {\n index: number\n onRemove: () => void\n showRemoveButton: boolean\n showAddButton: boolean\n onAdd: () => void\n}\n\nfunction PreparerFields({\n index,\n onRemove,\n showRemoveButton,\n showAddButton,\n onAdd,\n}: PreparerFieldsProps) {\n const { t } = useTranslation('Employee.I9SignatureForm')\n const Components = useComponentContext()\n\n const stateOptions = STATES_ABBR.map(abbr => ({ label: abbr, value: abbr }))\n const fieldId = `preparers.${index}`\n\n return (\n <Flex flexDirection=\"column\" gap={12}>\n <Components.Heading as=\"h3\">{t('preparerSectionTitle')}</Components.Heading>\n\n <TextInputField\n name={`${fieldId}.firstName`}\n label={t('preparerFirstNameLabel')}\n errorMessage={t('preparerFirstNameError')}\n isRequired\n />\n <TextInputField\n name={`${fieldId}.lastName`}\n label={t('preparerLastNameLabel')}\n errorMessage={t('preparerLastNameError')}\n isRequired\n />\n <TextInputField\n name={`${fieldId}.street1`}\n label={t('preparerStreet1Label')}\n errorMessage={t('preparerStreet1Error')}\n isRequired\n />\n <TextInputField name={`${fieldId}.street2`} label={t('preparerStreet2Label')} />\n <TextInputField\n name={`${fieldId}.city`}\n label={t('preparerCityLabel')}\n errorMessage={t('preparerCityError')}\n isRequired\n />\n <SelectField\n name={`${fieldId}.state`}\n label={t('preparerStateLabel')}\n errorMessage={t('preparerStateError')}\n isRequired\n options={stateOptions}\n placeholder=\"Select a state...\"\n />\n <TextInputField\n name={`${fieldId}.zip`}\n label={t('preparerZipLabel')}\n errorMessage={t('preparerZipError')}\n isRequired\n />\n <TextInputField\n name={`${fieldId}.signature`}\n label={t('preparerSignatureLabel')}\n description={t('preparerSignatureDescription')}\n errorMessage={t('preparerSignatureError')}\n isRequired\n />\n <CheckboxField\n name={`${fieldId}.agree`}\n isRequired\n label={t('preparerConfirmationLabel')}\n errorMessage={t('preparerConfirmationError')}\n />\n\n {(showAddButton || showRemoveButton) && (\n <div className={styles.preparerActions}>\n {showAddButton && (\n <Components.Button type=\"button\" variant=\"secondary\" onClick={onAdd}>\n {t('addPreparerCta')}\n </Components.Button>\n )}\n {showRemoveButton && (\n <Components.Button type=\"button\" variant=\"error\" onClick={onRemove}>\n {t('removePreparerCta')}\n </Components.Button>\n )}\n </div>\n )}\n </Flex>\n )\n}\n\nfunction buildPreparerPayload(payload: I9SignatureFormInputs) {\n if (payload.usedPreparer !== 'yes' || payload.preparers.length === 0) {\n return { preparer: false }\n }\n\n const result: Record<string, unknown> = { preparer: true }\n\n payload.preparers.forEach((preparer, index) => {\n const prefix = index === 0 ? 'preparer' : `preparer${index + 1}`\n if (index > 0) {\n result[`preparer${index + 1}`] = true\n }\n result[`${prefix}FirstName`] = preparer.firstName\n result[`${prefix}LastName`] = preparer.lastName\n result[`${prefix}Street1`] = preparer.street1\n if (preparer.street2) result[`${prefix}Street2`] = preparer.street2\n result[`${prefix}City`] = preparer.city\n result[`${prefix}State`] = preparer.state\n result[`${prefix}Zip`] = preparer.zip\n result[`${prefix}Agree`] = 'true'\n })\n\n return result\n}\n"],"names":["MAX_PREPARERS","preparerSchema","z","val","i9SignatureFormSchema","I9SignatureForm","props","jsx","BaseComponent","Root","employeeId","formId","className","useI18n","useTranslation","onEvent","baseSubmitHandler","useBase","Components","useComponentContext","formData","useEmployeeFormsGetSuspense","form","formPdf","useEmployeeFormsGetPdfSuspense","pdfUrl","signForm","isPending","useEmployeeFormsSignMutation","methods","useForm","zodResolver","handleBack","componentEvents","handleSubmit","data","payload","preparerPayload","buildPreparerPayload","signFormResult","FormProvider","Form","jsxs","Flex","Trans","DocumentViewer","TextInputField","CheckboxField","PreparerSection","ActionsLayout","emptyPreparer","t","watch","control","useFormContext","fields","append","remove","useFieldArray","usedPreparer","canAddPreparer","handlePreparerChange","value","handleAddPreparer","RadioGroupField","field","index","styles","PreparerFields","onRemove","showRemoveButton","showAddButton","onAdd","stateOptions","STATES_ABBR","abbr","fieldId","SelectField","result","preparer","prefix"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAMA,IAAgB,GAEhBC,IAAiBC,EAAE,OAAO;AAAA,EAC9B,WAAWA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC3B,UAAUA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC1B,SAASA,EAAE,SAAS,IAAI,CAAC;AAAA,EACzB,SAASA,EAAE,OAAA,EAAS,SAAA;AAAA,EACpB,MAAMA,EAAE,SAAS,IAAI,CAAC;AAAA,EACtB,OAAOA,EAAE,SAAS,IAAI,CAAC;AAAA,EACvB,KAAKA,EAAE,SAAS,IAAI,CAAC;AAAA,EACrB,WAAWA,EAAE,SAAS,I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,GACvD,UAAAlB,EAAE,mBAAmB,EAAA,CACxB;AAAA,IAAA,EAAA,CAEJ;AAAA,EAAA,GAEJ;AAEJ;AAEA,SAASb,GAAqBF,GAAgC;AAC5D,MAAIA,EAAQ,iBAAiB,SAASA,EAAQ,UAAU,WAAW;AACjE,WAAO,EAAE,UAAU,GAAA;AAGrB,QAAM0C,IAAkC,EAAE,UAAU,GAAA;AAEpD,SAAA1C,EAAQ,UAAU,QAAQ,CAAC2C,GAAUb,MAAU;AAC7C,UAAMc,IAASd,MAAU,IAAI,aAAa,WAAWA,IAAQ,CAAC;AAC9D,IAAIA,IAAQ,MACVY,EAAO,WAAWZ,IAAQ,CAAC,EAAE,IAAI,KAEnCY,EAAO,GAAGE,CAAM,WAAW,IAAID,EAAS,WACxCD,EAAO,GAAGE,CAAM,UAAU,IAAID,EAAS,UACvCD,EAAO,GAAGE,CAAM,SAAS,IAAID,EAAS,SAClCA,EAAS,YAASD,EAAO,GAAGE,CAAM,SAAS,IAAID,EAAS,UAC5DD,EAAO,GAAGE,CAAM,MAAM,IAAID,EAAS,MACnCD,EAAO,GAAGE,CAAM,OAAO,IAAID,EAAS,OACpCD,EAAO,GAAGE,CAAM,KAAK,IAAID,EAAS,KAClCD,EAAO,GAAGE,CAAM,OAAO,IAAI;AAAA,EAC7B,CAAC,GAEMF;AACT;"}
1
+ {"version":3,"file":"I9SignatureForm.js","sources":["../../../../../src/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.tsx"],"sourcesContent":["import { z } from 'zod'\nimport { FormProvider, useFieldArray, useForm, useFormContext } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useTranslation, Trans } from 'react-i18next'\nimport { useEmployeeFormsGetPdfSuspense } from '@gusto/embedded-api/react-query/employeeFormsGetPdf'\nimport { useEmployeeFormsSignMutation } from '@gusto/embedded-api/react-query/employeeFormsSign'\nimport { useEmployeeFormsGetSuspense } from '@gusto/embedded-api/react-query/employeeFormsGet'\nimport styles from './I9SignatureForm.module.scss'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { useI18n } from '@/i18n'\nimport { componentEvents, STATES_ABBR } from '@/shared/constants'\nimport {\n ActionsLayout,\n CheckboxField,\n Flex,\n RadioGroupField,\n SelectField,\n TextInputField,\n} from '@/components/Common'\nimport { DocumentViewer } from '@/components/Common/DocumentViewer'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nconst MAX_PREPARERS = 4\n\nconst preparerSchema = z.object({\n firstName: z.string().min(1),\n lastName: z.string().min(1),\n street1: z.string().min(1),\n street2: z.string().optional(),\n city: z.string().min(1),\n state: z.string().min(1),\n zip: z.string().min(1),\n signature: z.string().min(1),\n agree: z.boolean().refine(val => val),\n})\n\nexport type PreparerInputs = z.infer<typeof preparerSchema>\n\nconst i9SignatureFormSchema = z.object({\n signature: z.string().min(1),\n agree: z.literal(true),\n usedPreparer: z.enum(['yes', 'no']),\n preparers: z.array(preparerSchema),\n})\n\nexport type I9SignatureFormInputs = z.infer<typeof i9SignatureFormSchema>\n\ninterface I9SignatureFormProps extends CommonComponentInterface {\n employeeId: string\n formId: string\n}\n\nexport function I9SignatureForm(props: I9SignatureFormProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nfunction Root({ employeeId, formId, className }: I9SignatureFormProps) {\n useI18n('Employee.I9SignatureForm')\n const { t } = useTranslation('Employee.I9SignatureForm')\n const { onEvent, baseSubmitHandler } = useBase()\n const Components = useComponentContext()\n\n const { data: formData } = useEmployeeFormsGetSuspense({ employeeId, formId })\n const form = formData.form!\n\n const {\n data: { formPdf },\n } = useEmployeeFormsGetPdfSuspense({ employeeId, formId: form.uuid })\n const pdfUrl = formPdf?.documentUrl\n\n const { mutateAsync: signForm, isPending } = useEmployeeFormsSignMutation()\n\n const methods = useForm<I9SignatureFormInputs>({\n resolver: zodResolver(i9SignatureFormSchema),\n defaultValues: {\n signature: '',\n usedPreparer: 'no',\n preparers: [],\n },\n })\n\n const handleBack = () => {\n onEvent(componentEvents.CANCEL)\n }\n\n const handleSubmit = async (data: I9SignatureFormInputs) => {\n await baseSubmitHandler(data, async payload => {\n const preparerPayload = buildPreparerPayload(payload)\n const { form: signFormResult } = await signForm({\n request: {\n employeeId,\n formId: form.uuid,\n requestBody: {\n signatureText: payload.signature,\n agree: payload.agree,\n ...preparerPayload,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_SIGN_FORM, signFormResult)\n })\n }\n\n return (\n <section className={className}>\n <FormProvider {...methods}>\n <Form onSubmit={methods.handleSubmit(handleSubmit)}>\n <Flex flexDirection=\"column\" gap={20}>\n <section>\n <Components.Heading as=\"h2\">{t('title')}</Components.Heading>\n <Components.Text>\n <Trans\n i18nKey=\"description\"\n t={t}\n components={{\n viewFormLink: pdfUrl ? (\n <Components.Link\n href={pdfUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n download={`${form.title || 'form'}.pdf`}\n />\n ) : (\n <span />\n ),\n }}\n />\n </Components.Text>\n </section>\n\n <DocumentViewer\n url={pdfUrl}\n title={form.title}\n downloadInstructions={t('downloadInstructions')}\n viewDocumentLabel={t('viewDocumentCta')}\n />\n\n <Flex flexDirection=\"column\" gap={12}>\n <TextInputField\n name=\"signature\"\n label={t('signatureLabel')}\n description={t('signatureDescription')}\n errorMessage={t('signatureError')}\n isRequired\n />\n <CheckboxField\n name=\"agree\"\n isRequired\n label={t('confirmationLabel')}\n errorMessage={t('confirmationError')}\n />\n </Flex>\n\n <PreparerSection />\n\n <ActionsLayout>\n <Components.Button variant=\"secondary\" type=\"button\" onClick={handleBack}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('signCta')}\n </Components.Button>\n </ActionsLayout>\n </Flex>\n </Form>\n </FormProvider>\n </section>\n )\n}\n\nconst emptyPreparer = {\n firstName: '',\n lastName: '',\n street1: '',\n street2: '',\n city: '',\n state: '',\n zip: '',\n signature: '',\n agree: false,\n}\n\nfunction PreparerSection() {\n const { t } = useTranslation('Employee.I9SignatureForm')\n const Components = useComponentContext()\n const { watch, control } = useFormContext<I9SignatureFormInputs>()\n const { fields, append, remove } = useFieldArray({ control, name: 'preparers' })\n\n const usedPreparer = watch('usedPreparer')\n const canAddPreparer = fields.length < MAX_PREPARERS\n\n const handlePreparerChange = (value: string) => {\n if (value === 'yes' && fields.length === 0) {\n append(emptyPreparer)\n }\n if (value === 'no' && fields.length > 0) {\n remove()\n }\n }\n\n const handleAddPreparer = () => {\n if (canAddPreparer) {\n append(emptyPreparer)\n }\n }\n\n return (\n <Flex flexDirection=\"column\" gap={20}>\n <RadioGroupField\n name=\"usedPreparer\"\n label={t('preparerQuestion')}\n isRequired\n options={[\n { label: t('preparerNo'), value: 'no' },\n { label: t('preparerYes'), value: 'yes' },\n ]}\n onChange={handlePreparerChange}\n />\n\n {usedPreparer === 'yes' &&\n fields.map((field, index) => (\n <Flex flexDirection=\"column\" gap={0} key={field.id}>\n <div className={styles.preparerAlert}>\n <Components.Alert label={t('preparerNote')} status=\"info\" disableScrollIntoView />\n </div>\n <PreparerFields\n index={index}\n onRemove={() => {\n remove(index)\n }}\n showRemoveButton={index !== 0 && index === fields.length - 1}\n showAddButton={canAddPreparer && index === fields.length - 1}\n onAdd={handleAddPreparer}\n />\n </Flex>\n ))}\n </Flex>\n )\n}\n\ninterface PreparerFieldsProps {\n index: number\n onRemove: () => void\n showRemoveButton: boolean\n showAddButton: boolean\n onAdd: () => void\n}\n\nfunction PreparerFields({\n index,\n onRemove,\n showRemoveButton,\n showAddButton,\n onAdd,\n}: PreparerFieldsProps) {\n const { t } = useTranslation('Employee.I9SignatureForm')\n const Components = useComponentContext()\n\n const stateOptions = STATES_ABBR.map(abbr => ({ label: abbr, value: abbr }))\n const fieldId = `preparers.${index}`\n\n return (\n <Flex flexDirection=\"column\" gap={12}>\n <Components.Heading as=\"h3\">{t('preparerSectionTitle')}</Components.Heading>\n\n <TextInputField\n name={`${fieldId}.firstName`}\n label={t('preparerFirstNameLabel')}\n errorMessage={t('preparerFirstNameError')}\n isRequired\n />\n <TextInputField\n name={`${fieldId}.lastName`}\n label={t('preparerLastNameLabel')}\n errorMessage={t('preparerLastNameError')}\n isRequired\n />\n <TextInputField\n name={`${fieldId}.street1`}\n label={t('preparerStreet1Label')}\n errorMessage={t('preparerStreet1Error')}\n isRequired\n />\n <TextInputField name={`${fieldId}.street2`} label={t('preparerStreet2Label')} />\n <TextInputField\n name={`${fieldId}.city`}\n label={t('preparerCityLabel')}\n errorMessage={t('preparerCityError')}\n isRequired\n />\n <SelectField\n name={`${fieldId}.state`}\n label={t('preparerStateLabel')}\n errorMessage={t('preparerStateError')}\n isRequired\n options={stateOptions}\n placeholder=\"Select a state...\"\n />\n <TextInputField\n name={`${fieldId}.zip`}\n label={t('preparerZipLabel')}\n errorMessage={t('preparerZipError')}\n isRequired\n />\n <TextInputField\n name={`${fieldId}.signature`}\n label={t('preparerSignatureLabel')}\n description={t('preparerSignatureDescription')}\n errorMessage={t('preparerSignatureError')}\n isRequired\n />\n <CheckboxField\n name={`${fieldId}.agree`}\n isRequired\n label={t('preparerConfirmationLabel')}\n errorMessage={t('preparerConfirmationError')}\n />\n\n {(showAddButton || showRemoveButton) && (\n <div className={styles.preparerActions}>\n {showAddButton && (\n <Components.Button type=\"button\" variant=\"secondary\" onClick={onAdd}>\n {t('addPreparerCta')}\n </Components.Button>\n )}\n {showRemoveButton && (\n <Components.Button type=\"button\" variant=\"error\" onClick={onRemove}>\n {t('removePreparerCta')}\n </Components.Button>\n )}\n </div>\n )}\n </Flex>\n )\n}\n\nfunction buildPreparerPayload(payload: I9SignatureFormInputs) {\n if (payload.usedPreparer !== 'yes' || payload.preparers.length === 0) {\n return { preparer: false }\n }\n\n const result: Record<string, unknown> = { preparer: true }\n\n payload.preparers.forEach((preparer, index) => {\n const prefix = index === 0 ? 'preparer' : `preparer${index + 1}`\n if (index > 0) {\n result[`preparer${index + 1}`] = true\n }\n result[`${prefix}FirstName`] = preparer.firstName\n result[`${prefix}LastName`] = preparer.lastName\n result[`${prefix}Street1`] = preparer.street1\n if (preparer.street2) result[`${prefix}Street2`] = preparer.street2\n result[`${prefix}City`] = preparer.city\n result[`${prefix}State`] = preparer.state\n result[`${prefix}Zip`] = preparer.zip\n result[`${prefix}Agree`] = 'true'\n })\n\n return result\n}\n"],"names":["MAX_PREPARERS","preparerSchema","z","val","i9SignatureFormSchema","I9SignatureForm","props","jsx","BaseComponent","Root","employeeId","formId","className","useI18n","useTranslation","onEvent","baseSubmitHandler","useBase","Components","useComponentContext","formData","useEmployeeFormsGetSuspense","form","formPdf","useEmployeeFormsGetPdfSuspense","pdfUrl","signForm","isPending","useEmployeeFormsSignMutation","methods","useForm","zodResolver","handleBack","componentEvents","handleSubmit","data","payload","preparerPayload","buildPreparerPayload","signFormResult","FormProvider","Form","jsxs","Flex","Trans","DocumentViewer","TextInputField","CheckboxField","PreparerSection","ActionsLayout","emptyPreparer","t","watch","control","useFormContext","fields","append","remove","useFieldArray","usedPreparer","canAddPreparer","handlePreparerChange","value","handleAddPreparer","RadioGroupField","field","index","styles","PreparerFields","onRemove","showRemoveButton","showAddButton","onAdd","stateOptions","STATES_ABBR","abbr","fieldId","SelectField","result","preparer","prefix"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAMA,IAAgB,GAEhBC,IAAiBC,EAAE,OAAO;AAAA,EAC9B,WAAWA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC3B,UAAUA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC1B,SAASA,EAAE,SAAS,IAAI,CAAC;AAAA,EACzB,SAASA,EAAE,OAAA,EAAS,SAAA;AAAA,EACpB,MAAMA,EAAE,SAAS,IAAI,CAAC;AAAA,EACtB,OAAOA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC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gBAAA/D,EAACW,EAAW,QAAX,EAAkB,MAAK,UAAS,SAAQ,SAAQ,SAASmD,GACvD,UAAAlB,EAAE,mBAAmB,EAAA,CACxB;AAAA,IAAA,EAAA,CAEJ;AAAA,EAAA,GAEJ;AAEJ;AAEA,SAASb,GAAqBF,GAAgC;AAC5D,MAAIA,EAAQ,iBAAiB,SAASA,EAAQ,UAAU,WAAW;AACjE,WAAO,EAAE,UAAU,GAAA;AAGrB,QAAM0C,IAAkC,EAAE,UAAU,GAAA;AAEpD,SAAA1C,EAAQ,UAAU,QAAQ,CAAC2C,GAAUb,MAAU;AAC7C,UAAMc,IAASd,MAAU,IAAI,aAAa,WAAWA,IAAQ,CAAC;AAC9D,IAAIA,IAAQ,MACVY,EAAO,WAAWZ,IAAQ,CAAC,EAAE,IAAI,KAEnCY,EAAO,GAAGE,CAAM,WAAW,IAAID,EAAS,WACxCD,EAAO,GAAGE,CAAM,UAAU,IAAID,EAAS,UACvCD,EAAO,GAAGE,CAAM,SAAS,IAAID,EAAS,SAClCA,EAAS,YAASD,EAAO,GAAGE,CAAM,SAAS,IAAID,EAAS,UAC5DD,EAAO,GAAGE,CAAM,MAAM,IAAID,EAAS,MACnCD,EAAO,GAAGE,CAAM,OAAO,IAAID,EAAS,OACpCD,EAAO,GAAGE,CAAM,KAAK,IAAID,EAAS,KAClCD,EAAO,GAAGE,CAAM,OAAO,IAAI;AAAA,EAC7B,CAAC,GAEMF;AACT;"}
@@ -12,11 +12,12 @@ import { useBase as C } from "../../../Base/useBase.js";
12
12
  import { useI18n as G } from "../../../../i18n/I18n.js";
13
13
  import { componentEvents as i } from "../../../../shared/constants.js";
14
14
  import { Flex as M } from "../../../Common/Flex/Flex.js";
15
+ import "classnames";
15
16
  import "react-i18next";
16
17
  import "../../../../contexts/ComponentAdapter/useComponentContext.js";
17
18
  import "react";
18
19
  import { SignatureForm as R } from "../../../Common/SignatureForm/SignatureForm.js";
19
- function Z(r) {
20
+ function oo(r) {
20
21
  return /* @__PURE__ */ o(A, { ...r, children: /* @__PURE__ */ o(j, { ...r }) });
21
22
  }
22
23
  function j({ employeeId: r, formId: s, className: u, children: n }) {
@@ -61,6 +62,6 @@ function j({ employeeId: r, formId: s, className: u, children: n }) {
61
62
  ) });
62
63
  }
63
64
  export {
64
- Z as SignatureForm
65
+ oo as SignatureForm
65
66
  };
66
67
  //# sourceMappingURL=SignatureForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SignatureForm.js","sources":["../../../../../src/components/Employee/DocumentSigner/SignatureForm/SignatureForm.tsx"],"sourcesContent":["import { useEmployeeFormsGetPdfSuspense } from '@gusto/embedded-api/react-query/employeeFormsGetPdf'\nimport { useEmployeeFormsSignMutation } from '@gusto/embedded-api/react-query/employeeFormsSign'\nimport { useEmployeeFormsGetSuspense } from '@gusto/embedded-api/react-query/employeeFormsGet'\nimport { Form as FormComponent } from './Form'\nimport { Head } from './Head'\nimport { Actions } from './Actions'\nimport { Preview } from './Preview'\nimport { SignatureFormProvider } from './useSignatureForm'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { Flex } from '@/components/Common'\nimport type { SignatureFormInputs } from '@/components/Common/SignatureForm'\nimport { SignatureForm as SharedSignatureForm } from '@/components/Common/SignatureForm'\n\ninterface SignatureFormProps extends CommonComponentInterface {\n employeeId: string\n formId: string\n}\n\nexport function SignatureForm(props: SignatureFormProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nfunction Root({ employeeId, formId, className, children }: SignatureFormProps) {\n useI18n('Employee.DocumentSigner')\n const { onEvent, baseSubmitHandler } = useBase()\n\n const { data } = useEmployeeFormsGetSuspense({ employeeId, formId })\n const form = data.form!\n\n const {\n data: { formPdf },\n } = useEmployeeFormsGetPdfSuspense({ employeeId, formId: form.uuid })\n const pdfUrl = formPdf!.documentUrl\n\n const { mutateAsync: signForm, isPending: isSignFormPending } = useEmployeeFormsSignMutation()\n\n const handleBack = () => {\n onEvent(componentEvents.CANCEL)\n }\n\n const handleSubmit = async (data: SignatureFormInputs) => {\n await baseSubmitHandler(data, async payload => {\n if (form.uuid) {\n const { form: signFormResult } = await signForm({\n request: {\n employeeId,\n formId: form.uuid,\n requestBody: {\n signatureText: payload.signature,\n agree: payload.confirmSignature,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_SIGN_FORM, signFormResult)\n }\n })\n }\n\n return (\n <section className={className}>\n <SignatureFormProvider\n value={{\n pdfUrl,\n handleBack,\n form,\n isPending: isSignFormPending,\n }}\n >\n <SharedSignatureForm onSubmit={handleSubmit}>\n <Flex flexDirection=\"column\">\n {children ? (\n children\n ) : (\n <>\n <Head />\n <Preview />\n <FormComponent />\n <Actions />\n </>\n )}\n </Flex>\n </SharedSignatureForm>\n </SignatureFormProvider>\n </section>\n )\n}\n"],"names":["SignatureForm","props","jsx","BaseComponent","Root","employeeId","formId","className","children","useI18n","onEvent","baseSubmitHandler","useBase","data","useEmployeeFormsGetSuspense","form","formPdf","useEmployeeFormsGetPdfSuspense","pdfUrl","signForm","isSignFormPending","useEmployeeFormsSignMutation","SignatureFormProvider","componentEvents","SharedSignatureForm","payload","signFormResult","Flex","jsxs","Fragment","Head","Preview","FormComponent","Actions"],"mappings":";;;;;;;;;;;;;;;;;;AAyBO,SAASA,EAAcC,GAAoD;AAChF,SACE,gBAAAC,EAACC,KAAe,GAAGF,GACjB,4BAACG,GAAA,EAAM,GAAGH,GAAO,EAAA,CACnB;AAEJ;AAEA,SAASG,EAAK,EAAE,YAAAC,GAAY,QAAAC,GAAQ,WAAAC,GAAW,UAAAC,KAAgC;AAC7E,EAAAC,EAAQ,yBAAyB;AACjC,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,EAAA,GAEjC,EAAE,MAAAC,EAAA,IAASC,EAA4B,EA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;"}
1
+ {"version":3,"file":"SignatureForm.js","sources":["../../../../../src/components/Employee/DocumentSigner/SignatureForm/SignatureForm.tsx"],"sourcesContent":["import { useEmployeeFormsGetPdfSuspense } from '@gusto/embedded-api/react-query/employeeFormsGetPdf'\nimport { useEmployeeFormsSignMutation } from '@gusto/embedded-api/react-query/employeeFormsSign'\nimport { useEmployeeFormsGetSuspense } from '@gusto/embedded-api/react-query/employeeFormsGet'\nimport { Form as FormComponent } from './Form'\nimport { Head } from './Head'\nimport { Actions } from './Actions'\nimport { Preview } from './Preview'\nimport { SignatureFormProvider } from './useSignatureForm'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n} from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { Flex } from '@/components/Common'\nimport type { SignatureFormInputs } from '@/components/Common/SignatureForm'\nimport { SignatureForm as SharedSignatureForm } from '@/components/Common/SignatureForm'\n\ninterface SignatureFormProps extends CommonComponentInterface {\n employeeId: string\n formId: string\n}\n\nexport function SignatureForm(props: SignatureFormProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nfunction Root({ employeeId, formId, className, children }: SignatureFormProps) {\n useI18n('Employee.DocumentSigner')\n const { onEvent, baseSubmitHandler } = useBase()\n\n const { data } = useEmployeeFormsGetSuspense({ employeeId, formId })\n const form = data.form!\n\n const {\n data: { formPdf },\n } = useEmployeeFormsGetPdfSuspense({ employeeId, formId: form.uuid })\n const pdfUrl = formPdf!.documentUrl\n\n const { mutateAsync: signForm, isPending: isSignFormPending } = useEmployeeFormsSignMutation()\n\n const handleBack = () => {\n onEvent(componentEvents.CANCEL)\n }\n\n const handleSubmit = async (data: SignatureFormInputs) => {\n await baseSubmitHandler(data, async payload => {\n if (form.uuid) {\n const { form: signFormResult } = await signForm({\n request: {\n employeeId,\n formId: form.uuid,\n requestBody: {\n signatureText: payload.signature,\n agree: payload.confirmSignature,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_SIGN_FORM, signFormResult)\n }\n })\n }\n\n return (\n <section className={className}>\n <SignatureFormProvider\n value={{\n pdfUrl,\n handleBack,\n form,\n isPending: isSignFormPending,\n }}\n >\n <SharedSignatureForm onSubmit={handleSubmit}>\n <Flex flexDirection=\"column\">\n {children ? (\n children\n ) : (\n <>\n <Head />\n <Preview />\n <FormComponent />\n <Actions />\n </>\n )}\n </Flex>\n </SharedSignatureForm>\n </SignatureFormProvider>\n </section>\n )\n}\n"],"names":["SignatureForm","props","jsx","BaseComponent","Root","employeeId","formId","className","children","useI18n","onEvent","baseSubmitHandler","useBase","data","useEmployeeFormsGetSuspense","form","formPdf","useEmployeeFormsGetPdfSuspense","pdfUrl","signForm","isSignFormPending","useEmployeeFormsSignMutation","SignatureFormProvider","componentEvents","SharedSignatureForm","payload","signFormResult","Flex","jsxs","Fragment","Head","Preview","FormComponent","Actions"],"mappings":";;;;;;;;;;;;;;;;;;;AAyBO,SAASA,GAAcC,GAAoD;AAChF,SACE,gBAAAC,EAACC,KAAe,GAAGF,GACjB,4BAACG,GAAA,EAAM,GAAGH,GAAO,EAAA,CACnB;AAEJ;AAEA,SAASG,EAAK,EAAE,YAAAC,GAAY,QAAAC,GAAQ,WAAAC,GAAW,UAAAC,KAAgC;AAC7E,EAAAC,EAAQ,yBAAyB;AACjC,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,EAAA,GAEjC,EAAE,MAAAC,EAAA,IAASC,EAA4B,EAAE,YAAAT,GAAY,QAAAC,GAAQ,GAC7DS,IAAOF,EAAK,MAEZ;AAAA,IACJ,MAAM,EAAE,SAAAG,EAAA;AAAA,EAAQ,IACdC,EAA+B,EAAE,YAAAZ,GAAY,QAAQU,EAAK,MAAM,GAC9DG,IAASF,EAAS,aAElB,EAAE,aAAaG,GAAU,WAAWC,EAAA,IAAsBC,EAAA;AAwBhE,SACE,gBAAAnB,EAAC,aAAQ,WAAAK,GACP,UAAA,gBAAAL;AAAA,IAACoB;AAAA,IAAA;AAAA,MACC,OAAO;AAAA,QACL,QAAAJ;AAAA,QACA,YA3BW,MAAM;AACvB,UAAAR,EAAQa,EAAgB,MAAM;AAAA,QAChC;AAAA,QA0BQ,MAAAR;AAAA,QACA,WAAWK;AAAA,MAAA;AAAA,MAGb,UAAA,gBAAAlB,EAACsB,GAAA,EAAoB,UA5BN,OAAOX,MAA8B;AACxD,cAAMF,EAAkBE,GAAM,OAAMY,MAAW;AAC7C,cAAIV,EAAK,MAAM;AACb,kBAAM,EAAE,MAAMW,EAAA,IAAmB,MAAMP,EAAS;AAAA,cAC9C,SAAS;AAAA,gBACP,YAAAd;AAAA,gBACA,QAAQU,EAAK;AAAA,gBACb,aAAa;AAAA,kBACX,eAAeU,EAAQ;AAAA,kBACvB,OAAOA,EAAQ;AAAA,gBAAA;AAAA,cACjB;AAAA,YACF,CACD;AACD,YAAAf,EAAQa,EAAgB,oBAAoBG,CAAc;AAAA,UAC5D;AAAA,QACF,CAAC;AAAA,MACH,GAaQ,UAAA,gBAAAxB,EAACyB,KAAK,eAAc,UACjB,UAAAnB,KAGC,gBAAAoB,EAAAC,GAAA,EACE,UAAA;AAAA,QAAA,gBAAA3B,EAAC4B,GAAA,EAAK;AAAA,0BACLC,GAAA,EAAQ;AAAA,0BACRC,GAAA,EAAc;AAAA,0BACdC,GAAA,CAAA,CAAQ;AAAA,MAAA,EAAA,CACX,GAEJ,EAAA,CACF;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;"}
@@ -7,14 +7,15 @@ 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
12
  import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
12
13
  import "dompurify";
13
14
  import "../../../../contexts/LocaleProvider/useLocale.js";
14
15
  import { createCompoundContext as o } from "../../../Base/createCompoundContext.js";
15
- const [c, d] = o("SignatureFormContext");
16
+ const [d, s] = o("SignatureFormContext");
16
17
  export {
17
- d as SignatureFormProvider,
18
- c as useSignatureForm
18
+ s as SignatureFormProvider,
19
+ d as useSignatureForm
19
20
  };
20
21
  //# sourceMappingURL=useSignatureForm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useSignatureForm.js","sources":["../../../../../src/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.ts"],"sourcesContent":["import type { Form } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype SignatureFormContextType = {\n form: Form\n pdfUrl?: string | null\n handleBack: () => void\n isPending: boolean\n}\n\nconst [useSignatureForm, SignatureFormProvider] =\n createCompoundContext<SignatureFormContextType>('SignatureFormContext')\nexport { useSignatureForm, SignatureFormProvider }\n"],"names":["useSignatureForm","SignatureFormProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;AAUA,MAAM,CAACA,GAAkBC,CAAqB,IAC5CC,EAAgD,sBAAsB;"}
1
+ {"version":3,"file":"useSignatureForm.js","sources":["../../../../../src/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.ts"],"sourcesContent":["import type { Form } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype SignatureFormContextType = {\n form: Form\n pdfUrl?: string | null\n handleBack: () => void\n isPending: boolean\n}\n\nconst [useSignatureForm, SignatureFormProvider] =\n createCompoundContext<SignatureFormContextType>('SignatureFormContext')\nexport { useSignatureForm, SignatureFormProvider }\n"],"names":["useSignatureForm","SignatureFormProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;;AAUA,MAAM,CAACA,GAAkBC,CAAqB,IAC5CC,EAAgD,sBAAsB;"}
@@ -4,6 +4,8 @@ import { useForm as I, FormProvider as L } from "react-hook-form";
4
4
  import { zodResolver as E } from "@hookform/resolvers/zod";
5
5
  import { z as p } from "zod";
6
6
  import { Flex as l, FlexItem as o } from "../../Common/Flex/Flex.js";
7
+ import "classnames";
8
+ import "../../../shared/constants.js";
7
9
  import { useComponentContext as v } from "../../../contexts/ComponentAdapter/useComponentContext.js";
8
10
  import "react";
9
11
  import { Form as w } from "../../Common/Form/Form.js";
@@ -11,7 +13,7 @@ import { useI18n as C } from "../../../i18n/I18n.js";
11
13
  import { CheckboxField as F } from "../../Common/Fields/CheckboxField/CheckboxField.js";
12
14
  const u = "gusto-sdk-employee-documents-form", T = p.object({
13
15
  includeI9: p.boolean()
14
- }), A = ({
16
+ }), Y = ({
15
17
  isEmployeeSelfOnboarding: a,
16
18
  currentI9Status: g,
17
19
  onSubmit: f,
@@ -109,6 +111,6 @@ const u = "gusto-sdk-employee-documents-form", T = p.object({
109
111
  ] }) });
110
112
  };
111
113
  export {
112
- A as EmployeeDocumentsPresentation
114
+ Y as EmployeeDocumentsPresentation
113
115
  };
114
116
  //# sourceMappingURL=EmployeeDocumentsPresentation.js.map