@gusto/embedded-react-sdk 0.31.0 → 0.31.1
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.
- package/CHANGELOG.md +7 -0
- package/dist/components/Base/Base.js +12 -13
- package/dist/components/Base/Base.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureForm.js +10 -12
- package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormActions.js +2 -3
- package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormFields.js +6 -7
- package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
- package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/components/Common/UI/FileInput/FileInput.js +1 -1
- package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
- package/dist/components/Company/AssignSignatory/AssignSignatory.js +2 -3
- package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +3 -4
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +2 -3
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +12 -12
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +3 -4
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +2 -3
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +3 -4
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/TitleSelect.js +3 -4
- package/dist/components/Company/AssignSignatory/TitleSelect.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +5 -6
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +8 -9
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Form.js +5 -7
- package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +3 -4
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js +2 -3
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +6 -7
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +5 -7
- package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +2 -3
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +8 -9
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +3 -4
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +3 -4
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +3 -4
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Company/FederalTaxes/Actions.js +6 -7
- package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
- package/dist/components/Company/FederalTaxes/FederalTaxes.js +3 -4
- package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
- package/dist/components/Company/FederalTaxes/Form.js +3 -5
- package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +5 -6
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Actions.js +7 -8
- package/dist/components/Company/Industry/Actions.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +6 -7
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Industry/Edit.js +2 -3
- package/dist/components/Company/Industry/Edit.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Actions.js +6 -7
- package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Form.js +1 -1
- package/dist/components/Company/Locations/LocationForm/LocationForm.js +3 -4
- package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +3 -4
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/Actions.js +2 -3
- package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/List.js +6 -7
- package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/LocationsList.js +3 -4
- package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +3 -4
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/Completed.js +10 -12
- package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/MissingRequirements.js +6 -8
- package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +7 -8
- package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +3 -4
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/PaySchedule.js +3 -4
- package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Actions.js +2 -3
- package/dist/components/Company/PaySchedule/_parts/Actions.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Edit.js +15 -15
- package/dist/components/Company/PaySchedule/_parts/Head.js +11 -13
- package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/List.js +13 -15
- package/dist/components/Company/PaySchedule/_parts/List.js.map +1 -1
- package/dist/components/Company/PaySchedule/usePaySchedule.js +5 -6
- package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +2 -3
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +3 -4
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +2 -3
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js +2 -3
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +3 -4
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Contractor/Address/Address.js +4 -5
- package/dist/components/Contractor/Address/Address.js.map +1 -1
- package/dist/components/Contractor/Address/Form.js +1 -1
- package/dist/components/Contractor/Address/useAddress.js +5 -6
- package/dist/components/Contractor/Address/useAddress.js.map +1 -1
- package/dist/components/Contractor/ContractorList/index.js +31 -32
- package/dist/components/Contractor/ContractorList/index.js.map +1 -1
- package/dist/components/Contractor/NewHireReport/NewHireReport.js +13 -14
- package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +11 -12
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +2 -3
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +3 -4
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js +2 -4
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js +10 -10
- package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js +7 -9
- package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js +3 -4
- package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js +2 -4
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js +6 -8
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js +2 -4
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +2 -4
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -1
- package/dist/components/Contractor/Profile/ContractorProfileForm.js +15 -15
- package/dist/components/Contractor/Profile/useContractorProfile.js +2 -3
- package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
- package/dist/components/Contractor/Submit/Submit.js +20 -21
- package/dist/components/Contractor/Submit/Submit.js.map +1 -1
- package/dist/components/Employee/Compensation/Actions.js +12 -13
- package/dist/components/Employee/Compensation/Actions.js.map +1 -1
- package/dist/components/Employee/Compensation/Edit.js +16 -17
- package/dist/components/Employee/Compensation/Edit.js.map +1 -1
- package/dist/components/Employee/Compensation/List.js +22 -23
- package/dist/components/Employee/Compensation/List.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +10 -11
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +11 -12
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +11 -12
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +7 -8
- package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +5 -6
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +2 -3
- package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/List.js +2 -4
- package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +3 -4
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentSigner.js +21 -33
- package/dist/components/Employee/DocumentSigner/DocumentSigner.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js +24 -26
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.js +9 -10
- package/dist/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +2 -3
- package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +3 -4
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Employee/EmployeeDocuments/EmployeeDocumentsPresentation.js +2 -4
- package/dist/components/Employee/EmployeeDocuments/EmployeeDocumentsPresentation.js.map +1 -1
- package/dist/components/Employee/EmployeeList/Actions.js +6 -7
- package/dist/components/Employee/EmployeeList/Actions.js.map +1 -1
- package/dist/components/Employee/EmployeeList/EmployeeList.js +3 -4
- package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
- package/dist/components/Employee/EmployeeList/Head.js +5 -7
- package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
- package/dist/components/Employee/EmployeeList/List.js +2 -3
- package/dist/components/Employee/EmployeeList/List.js.map +1 -1
- package/dist/components/Employee/EmployeeList/useEmployeeList.js +3 -4
- package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/Actions.js +5 -6
- package/dist/components/Employee/FederalTaxes/Actions.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/FederalForm.js +11 -12
- package/dist/components/Employee/FederalTaxes/FederalForm.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +3 -4
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Employee/Landing/Landing.js +14 -15
- package/dist/components/Employee/Landing/Landing.js.map +1 -1
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +7 -7
- package/dist/components/Employee/PaymentMethod/Actions.js +5 -6
- package/dist/components/Employee/PaymentMethod/Actions.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +4 -5
- package/dist/components/Employee/PaymentMethod/BankAccountEdit.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountsList.js +2 -3
- package/dist/components/Employee/PaymentMethod/BankAccountsList.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +6 -7
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/Split.js +10 -11
- package/dist/components/Employee/PaymentMethod/Split.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +5 -6
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/Actions.js +5 -6
- package/dist/components/Employee/Profile/Actions.js.map +1 -1
- package/dist/components/Employee/Profile/AdminPersonalDetails.js +5 -6
- package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
- package/dist/components/Employee/Profile/HomeAddress.js +1 -1
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js +2 -2
- package/dist/components/Employee/Profile/useProfile.js +3 -4
- package/dist/components/Employee/Profile/useProfile.js.map +1 -1
- package/dist/components/Employee/StateTaxes/Actions.js +5 -6
- package/dist/components/Employee/StateTaxes/Actions.js.map +1 -1
- package/dist/components/Employee/StateTaxes/useStateTaxes.js +3 -4
- package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
- package/dist/components/Employee/Taxes/Actions.js +6 -7
- package/dist/components/Employee/Taxes/Actions.js.map +1 -1
- package/dist/components/Employee/Taxes/FederalForm.js +13 -14
- package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
- package/dist/components/Employee/Taxes/useTaxes.js +3 -4
- package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
- package/dist/components/Flow/Flow.js +7 -9
- package/dist/components/Flow/Flow.js.map +1 -1
- package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js +16 -17
- package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js.map +1 -1
- package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js +6 -7
- package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js.map +1 -1
- package/dist/components/InformationRequests/InformationRequests.js +3 -4
- package/dist/components/InformationRequests/InformationRequests.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +9 -10
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js +2 -4
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +12 -12
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +36 -36
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +19 -21
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +15 -17
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +17 -19
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +2 -3
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js +2 -4
- package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +2 -3
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js +3 -4
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js.map +1 -1
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js +11 -12
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js.map +1 -1
- package/dist/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.js +2 -4
- package/dist/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +2 -3
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +2 -3
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/package.json +2 -2
|
@@ -2,12 +2,10 @@ import { jsx as o } from "react/jsx-runtime";
|
|
|
2
2
|
import { useTranslation as m } from "react-i18next";
|
|
3
3
|
import { useDocumentList as s } from "./useDocumentList.js";
|
|
4
4
|
import { Flex as l } from "../../../Common/Flex/Flex.js";
|
|
5
|
-
import "classnames";
|
|
6
|
-
import "../../../../shared/constants.js";
|
|
7
5
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
8
6
|
import "react";
|
|
9
7
|
import { DocumentList as u } from "../../../Common/DocumentList/DocumentList.js";
|
|
10
|
-
function
|
|
8
|
+
function f() {
|
|
11
9
|
const { employeeForms: i, handleRequestFormToSign: n, documentListError: r } = s(), { t: e } = m("Employee.DocumentSigner");
|
|
12
10
|
return /* @__PURE__ */ o("section", { style: { width: "100%" }, children: /* @__PURE__ */ o(l, { flexDirection: "column", gap: 32, children: /* @__PURE__ */ o(
|
|
13
11
|
u,
|
|
@@ -36,6 +34,6 @@ function D() {
|
|
|
36
34
|
) }) });
|
|
37
35
|
}
|
|
38
36
|
export {
|
|
39
|
-
|
|
37
|
+
f as List
|
|
40
38
|
};
|
|
41
39
|
//# sourceMappingURL=List.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.js","sources":["../../../../../src/components/Employee/DocumentSigner/DocumentList/List.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useDocumentList } from './useDocumentList'\nimport { Flex, DocumentList as SharedDocumentList } from '@/components/Common'\n\nexport function List() {\n const { employeeForms, handleRequestFormToSign, documentListError } = useDocumentList()\n const { t } = useTranslation('Employee.DocumentSigner')\n\n return (\n <section style={{ width: '100%' }}>\n <Flex flexDirection=\"column\" gap={32}>\n <SharedDocumentList\n forms={employeeForms.map(form => ({\n uuid: form.uuid,\n title: form.title,\n description: form.description,\n requires_signing: form.requiresSigning,\n }))}\n onRequestSign={handleRequestFormToSign}\n withError={!!documentListError}\n label={t('documentListLabel')}\n columnLabels={{\n form: t('formColumnLabel'),\n action: t('actionColumnLabel'),\n }}\n statusLabels={{\n signCta: t('signDocumentCta'),\n notSigned: t('notSigned'),\n complete: t('signDocumentComplete'),\n }}\n emptyStateLabel={t('emptyTableTitle')}\n errorLabel={t('documentListError')}\n />\n </Flex>\n </section>\n )\n}\n"],"names":["List","employeeForms","handleRequestFormToSign","documentListError","useDocumentList","t","useTranslation","jsx","Flex","SharedDocumentList","form"],"mappings":"
|
|
1
|
+
{"version":3,"file":"List.js","sources":["../../../../../src/components/Employee/DocumentSigner/DocumentList/List.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useDocumentList } from './useDocumentList'\nimport { Flex, DocumentList as SharedDocumentList } from '@/components/Common'\n\nexport function List() {\n const { employeeForms, handleRequestFormToSign, documentListError } = useDocumentList()\n const { t } = useTranslation('Employee.DocumentSigner')\n\n return (\n <section style={{ width: '100%' }}>\n <Flex flexDirection=\"column\" gap={32}>\n <SharedDocumentList\n forms={employeeForms.map(form => ({\n uuid: form.uuid,\n title: form.title,\n description: form.description,\n requires_signing: form.requiresSigning,\n }))}\n onRequestSign={handleRequestFormToSign}\n withError={!!documentListError}\n label={t('documentListLabel')}\n columnLabels={{\n form: t('formColumnLabel'),\n action: t('actionColumnLabel'),\n }}\n statusLabels={{\n signCta: t('signDocumentCta'),\n notSigned: t('notSigned'),\n complete: t('signDocumentComplete'),\n }}\n emptyStateLabel={t('emptyTableTitle')}\n errorLabel={t('documentListError')}\n />\n </Flex>\n </section>\n )\n}\n"],"names":["List","employeeForms","handleRequestFormToSign","documentListError","useDocumentList","t","useTranslation","jsx","Flex","SharedDocumentList","form"],"mappings":";;;;;;;AAIO,SAASA,IAAO;AACrB,QAAM,EAAE,eAAAC,GAAe,yBAAAC,GAAyB,mBAAAC,EAAA,IAAsBC,EAAA,GAChE,EAAE,GAAAC,EAAA,IAAMC,EAAe,yBAAyB;AAEtD,SACE,gBAAAC,EAAC,WAAA,EAAQ,OAAO,EAAE,OAAO,UACvB,UAAA,gBAAAA,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA,gBAAAD;AAAA,IAACE;AAAAA,IAAA;AAAA,MACC,OAAOR,EAAc,IAAI,CAAAS,OAAS;AAAA,QAChC,MAAMA,EAAK;AAAA,QACX,OAAOA,EAAK;AAAA,QACZ,aAAaA,EAAK;AAAA,QAClB,kBAAkBA,EAAK;AAAA,MAAA,EACvB;AAAA,MACF,eAAeR;AAAA,MACf,WAAW,CAAC,CAACC;AAAA,MACb,OAAOE,EAAE,mBAAmB;AAAA,MAC5B,cAAc;AAAA,QACZ,MAAMA,EAAE,iBAAiB;AAAA,QACzB,QAAQA,EAAE,mBAAmB;AAAA,MAAA;AAAA,MAE/B,cAAc;AAAA,QACZ,SAASA,EAAE,iBAAiB;AAAA,QAC5B,WAAWA,EAAE,WAAW;AAAA,QACxB,UAAUA,EAAE,sBAAsB;AAAA,MAAA;AAAA,MAEpC,iBAAiBA,EAAE,iBAAiB;AAAA,MACpC,YAAYA,EAAE,mBAAmB;AAAA,IAAA;AAAA,EAAA,GAErC,EAAA,CACF;AAEJ;"}
|
|
@@ -7,15 +7,14 @@ 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";
|
|
11
10
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
12
11
|
import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
13
12
|
import "dompurify";
|
|
14
13
|
import "../../../../contexts/LocaleProvider/useLocale.js";
|
|
15
14
|
import { createCompoundContext as t } from "../../../Base/createCompoundContext.js";
|
|
16
|
-
const [
|
|
15
|
+
const [d, a] = t("DocumentListContext");
|
|
17
16
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
a as DocumentListProvider,
|
|
18
|
+
d as useDocumentList
|
|
20
19
|
};
|
|
21
20
|
//# sourceMappingURL=useDocumentList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDocumentList.js","sources":["../../../../../src/components/Employee/DocumentSigner/DocumentList/useDocumentList.ts"],"sourcesContent":["import type { Form } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype DocumentListContextType = {\n employeeForms: Form[]\n handleContinue: () => void\n handleRequestFormToSign: (form: Form) => void\n documentListError: Error | null\n formToSign?: Form\n}\n\nconst [useDocumentList, DocumentListProvider] =\n createCompoundContext<DocumentListContextType>('DocumentListContext')\nexport { useDocumentList, DocumentListProvider }\n"],"names":["useDocumentList","DocumentListProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useDocumentList.js","sources":["../../../../../src/components/Employee/DocumentSigner/DocumentList/useDocumentList.ts"],"sourcesContent":["import type { Form } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype DocumentListContextType = {\n employeeForms: Form[]\n handleContinue: () => void\n handleRequestFormToSign: (form: Form) => void\n documentListError: Error | null\n formToSign?: Form\n}\n\nconst [useDocumentList, DocumentListProvider] =\n createCompoundContext<DocumentListContextType>('DocumentListContext')\nexport { useDocumentList, DocumentListProvider }\n"],"names":["useDocumentList","DocumentListProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;AAWA,MAAM,CAACA,GAAiBC,CAAoB,IAC1CC,EAA+C,qBAAqB;"}
|
|
@@ -1,48 +1,36 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createMachine as
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { createMachine as f } from "robot3";
|
|
3
3
|
import { useMemo as l } from "react";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
function N(o) {
|
|
16
|
-
return /* @__PURE__ */ i(M, { ...o, children: /* @__PURE__ */ i(B, { ...o }) });
|
|
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
|
|
19
|
-
|
|
20
|
-
const {
|
|
21
|
-
|
|
22
|
-
{ enabled: t }
|
|
23
|
-
), r = u?.employee?.onboardingDocumentsConfig?.i9Document === !0, { data: f, isLoading: p } = y(
|
|
24
|
-
{ employeeId: o },
|
|
25
|
-
{
|
|
26
|
-
enabled: t && r,
|
|
27
|
-
retry: !1,
|
|
28
|
-
throwOnError: (n) => !(n instanceof D && n.httpMeta.response.status === 404)
|
|
29
|
-
}
|
|
30
|
-
), e = t && r && !f?.i9Authorization?.employeeSigned, g = l(
|
|
31
|
-
() => 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(
|
|
32
20
|
e ? "employmentEligibility" : "index",
|
|
33
|
-
|
|
21
|
+
E,
|
|
34
22
|
(n) => ({
|
|
35
23
|
...n,
|
|
36
|
-
component: e ?
|
|
24
|
+
component: e ? d : y,
|
|
37
25
|
employeeId: o,
|
|
38
26
|
withEmployeeI9: t
|
|
39
27
|
})
|
|
40
28
|
),
|
|
41
29
|
[o, e, t]
|
|
42
30
|
);
|
|
43
|
-
return
|
|
31
|
+
return /* @__PURE__ */ m(S, { machine: p, onEvent: i });
|
|
44
32
|
}
|
|
45
33
|
export {
|
|
46
|
-
|
|
34
|
+
O as DocumentSigner
|
|
47
35
|
};
|
|
48
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 {
|
|
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;"}
|
|
@@ -7,31 +7,29 @@ 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 "
|
|
11
|
-
import "../../../../
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { useI18n as U } from "../../../../i18n/I18n.js";
|
|
20
|
-
import { SelectField as W } from "../../../Common/Fields/SelectField/SelectField.js";
|
|
10
|
+
import { ActionsLayout as P } from "../../../Common/ActionsLayout/ActionsLayout.js";
|
|
11
|
+
import { useComponentContext as V } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
12
|
+
import { ComboBoxField as B } from "../../../Common/Fields/ComboBoxField/ComboBoxField.js";
|
|
13
|
+
import { Form as H } from "../../../Common/Form/Form.js";
|
|
14
|
+
import { useI18n as K } from "../../../../i18n/I18n.js";
|
|
15
|
+
import { SelectField as G } from "../../../Common/Fields/SelectField/SelectField.js";
|
|
16
|
+
import { RadioGroupField as M } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
17
|
+
import { TextInputField as U } from "../../../Common/Fields/TextInputField/TextInputField.js";
|
|
18
|
+
import { DatePickerField as W } from "../../../Common/Fields/DatePickerField/DatePickerField.js";
|
|
21
19
|
const J = {
|
|
22
20
|
citizen: "statusDescriptions.citizen",
|
|
23
21
|
permanent_resident: "statusDescriptions.permanent_resident",
|
|
24
22
|
noncitizen: "statusDescriptions.noncitizen",
|
|
25
23
|
alien: "statusDescriptions.alien"
|
|
26
|
-
},
|
|
24
|
+
}, be = ({
|
|
27
25
|
onSubmit: h,
|
|
28
26
|
defaultValues: f,
|
|
29
27
|
hasDocumentNumber: y,
|
|
30
28
|
isPending: D
|
|
31
29
|
}) => {
|
|
32
|
-
|
|
33
|
-
const { Heading: g, Text: x, Alert: z, Button: E, Link: N } =
|
|
34
|
-
resolver: j(L(
|
|
30
|
+
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)),
|
|
35
33
|
defaultValues: f
|
|
36
34
|
}), { 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) => ({
|
|
37
35
|
value: n,
|
|
@@ -40,11 +38,11 @@ const J = {
|
|
|
40
38
|
value: n,
|
|
41
39
|
label: e(`authorizationDocument.options.${n}`)
|
|
42
40
|
})), C = () => {
|
|
43
|
-
u("documentNumber", ""), c("documentNumber"),
|
|
41
|
+
u("documentNumber", ""), c("documentNumber"), m(!1);
|
|
44
42
|
}, F = () => {
|
|
45
|
-
u("documentNumber", ""), c("documentNumber"),
|
|
43
|
+
u("documentNumber", ""), c("documentNumber"), m(!1);
|
|
46
44
|
}, _ = o === "alien", R = o === "permanent_resident" || o === "alien" && !!s, i = o === "permanent_resident" ? "uscis_alien_registration_number" : s;
|
|
47
|
-
return /* @__PURE__ */ t($, { ...r, children: /* @__PURE__ */ t(
|
|
45
|
+
return /* @__PURE__ */ t($, { ...r, children: /* @__PURE__ */ t(H, { onSubmit: r.handleSubmit(h), children: /* @__PURE__ */ p(b, { flexDirection: "column", gap: 16, children: [
|
|
48
46
|
/* @__PURE__ */ p(b, { flexDirection: "column", gap: 2, children: [
|
|
49
47
|
/* @__PURE__ */ t(g, { as: "h2", children: e("title") }),
|
|
50
48
|
/* @__PURE__ */ t(x, { variant: "supporting", children: /* @__PURE__ */ t(
|
|
@@ -59,7 +57,7 @@ const J = {
|
|
|
59
57
|
) })
|
|
60
58
|
] }),
|
|
61
59
|
/* @__PURE__ */ t(
|
|
62
|
-
|
|
60
|
+
G,
|
|
63
61
|
{
|
|
64
62
|
name: "authorizationStatus",
|
|
65
63
|
label: e("select.label"),
|
|
@@ -78,9 +76,9 @@ const J = {
|
|
|
78
76
|
disableScrollIntoView: !0
|
|
79
77
|
}
|
|
80
78
|
),
|
|
81
|
-
o === "alien" && /* @__PURE__ */ t(
|
|
79
|
+
o === "alien" && /* @__PURE__ */ t(W, { name: "expirationDate", label: e("expirationDate.label") }),
|
|
82
80
|
_ && /* @__PURE__ */ t(
|
|
83
|
-
|
|
81
|
+
M,
|
|
84
82
|
{
|
|
85
83
|
name: "documentType",
|
|
86
84
|
label: e("authorizationDocument.label"),
|
|
@@ -90,17 +88,17 @@ const J = {
|
|
|
90
88
|
}
|
|
91
89
|
),
|
|
92
90
|
R && i && /* @__PURE__ */ t(
|
|
93
|
-
|
|
91
|
+
U,
|
|
94
92
|
{
|
|
95
93
|
name: "documentNumber",
|
|
96
94
|
label: e(`documentNumber.${i}.label`),
|
|
97
95
|
description: i !== "foreign_passport" ? e(`documentNumber.${i}.description`) : void 0,
|
|
98
|
-
placeholder:
|
|
96
|
+
placeholder: a ? e(`documentNumber.${i}.placeholder`) : void 0,
|
|
99
97
|
isRequired: !0
|
|
100
98
|
}
|
|
101
99
|
),
|
|
102
100
|
s === "foreign_passport" && o === "alien" && /* @__PURE__ */ t(
|
|
103
|
-
|
|
101
|
+
B,
|
|
104
102
|
{
|
|
105
103
|
name: "country",
|
|
106
104
|
label: e("country.label"),
|
|
@@ -111,10 +109,10 @@ const J = {
|
|
|
111
109
|
isRequired: !0
|
|
112
110
|
}
|
|
113
111
|
),
|
|
114
|
-
/* @__PURE__ */ t(
|
|
112
|
+
/* @__PURE__ */ t(P, { children: /* @__PURE__ */ t(E, { type: "submit", isLoading: D, children: e("submit") }) })
|
|
115
113
|
] }) }) });
|
|
116
114
|
};
|
|
117
115
|
export {
|
|
118
|
-
|
|
116
|
+
be as EmploymentEligibilityPresentation
|
|
119
117
|
};
|
|
120
118
|
//# 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;A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;AAAA,QACT,YAAU;AAAA,QACV,UAAUG;AAAA,MAAA;AAAA,IAAA;AAAA,IAIbE,KAA2BC,KAC1B,gBAAAE;AAAA,MAACQ;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOlC,EAAE,kBAAkBwB,CAAkB,QAAQ;AAAA,QACrD,aACEA,MAAuB,qBACnBxB,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,a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,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;"}
|
|
@@ -12,14 +12,13 @@ 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 "
|
|
16
|
-
import { RadioGroupField as O } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
17
|
-
import { TextInputField as p } from "../../../Common/Fields/TextInputField/TextInputField.js";
|
|
18
|
-
import { ActionsLayout as V } from "../../../Common/ActionsLayout/ActionsLayout.js";
|
|
15
|
+
import { ActionsLayout as O } from "../../../Common/ActionsLayout/ActionsLayout.js";
|
|
19
16
|
import { useComponentContext as E } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
20
17
|
import "react";
|
|
21
|
-
import { Form as
|
|
18
|
+
import { Form as V } from "../../../Common/Form/Form.js";
|
|
19
|
+
import { TextInputField as p } from "../../../Common/Fields/TextInputField/TextInputField.js";
|
|
22
20
|
import { CheckboxField as R } from "../../../Common/Fields/CheckboxField/CheckboxField.js";
|
|
21
|
+
import { RadioGroupField as Z } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
23
22
|
import { SelectField as U } from "../../../Common/Fields/SelectField/SelectField.js";
|
|
24
23
|
import { DocumentViewer as Y } from "../../../Common/DocumentViewer/DocumentViewer.js";
|
|
25
24
|
const K = 4, Q = l.object({
|
|
@@ -38,7 +37,7 @@ const K = 4, Q = l.object({
|
|
|
38
37
|
usedPreparer: l.enum(["yes", "no"]),
|
|
39
38
|
preparers: l.array(Q)
|
|
40
39
|
});
|
|
41
|
-
function
|
|
40
|
+
function Re(n) {
|
|
42
41
|
return /* @__PURE__ */ e(_, { ...n, children: /* @__PURE__ */ e(J, { ...n }) });
|
|
43
42
|
}
|
|
44
43
|
function J({ employeeId: n, formId: i, className: s }) {
|
|
@@ -70,7 +69,7 @@ function J({ employeeId: n, formId: i, className: s }) {
|
|
|
70
69
|
o(C.EMPLOYEE_SIGN_FORM, M);
|
|
71
70
|
});
|
|
72
71
|
};
|
|
73
|
-
return /* @__PURE__ */ e("section", { className: s, children: /* @__PURE__ */ e(I, { ...F, children: /* @__PURE__ */ e(
|
|
72
|
+
return /* @__PURE__ */ e("section", { className: s, children: /* @__PURE__ */ e(I, { ...F, children: /* @__PURE__ */ e(V, { onSubmit: F.handleSubmit(N), children: /* @__PURE__ */ u(b, { flexDirection: "column", gap: 20, children: [
|
|
74
73
|
/* @__PURE__ */ u("section", { children: [
|
|
75
74
|
/* @__PURE__ */ e(m.Heading, { as: "h2", children: t("title") }),
|
|
76
75
|
/* @__PURE__ */ e(m.Text, { children: /* @__PURE__ */ e(
|
|
@@ -123,7 +122,7 @@ function J({ employeeId: n, formId: i, className: s }) {
|
|
|
123
122
|
)
|
|
124
123
|
] }),
|
|
125
124
|
/* @__PURE__ */ e(W, {}),
|
|
126
|
-
/* @__PURE__ */ u(
|
|
125
|
+
/* @__PURE__ */ u(O, { children: [
|
|
127
126
|
/* @__PURE__ */ e(m.Button, { variant: "secondary", type: "button", onClick: $, children: t("cancelCta") }),
|
|
128
127
|
/* @__PURE__ */ e(m.Button, { type: "submit", isLoading: c, children: t("signCta") })
|
|
129
128
|
] })
|
|
@@ -148,7 +147,7 @@ function W() {
|
|
|
148
147
|
};
|
|
149
148
|
return /* @__PURE__ */ u(b, { flexDirection: "column", gap: 20, children: [
|
|
150
149
|
/* @__PURE__ */ e(
|
|
151
|
-
|
|
150
|
+
Z,
|
|
152
151
|
{
|
|
153
152
|
name: "usedPreparer",
|
|
154
153
|
label: n("preparerQuestion"),
|
|
@@ -279,6 +278,6 @@ function re(n) {
|
|
|
279
278
|
}), i;
|
|
280
279
|
}
|
|
281
280
|
export {
|
|
282
|
-
|
|
281
|
+
Re as I9SignatureForm
|
|
283
282
|
};
|
|
284
283
|
//# 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,IAAI,CAAC;AAAA,EAC3B,OAAOA,EAAE,QAAA,EAAU,OAAO,OAAOC,CAAG;AACtC,CAAC,GAIKC,IAAwBF,EAAE,OAAO;AAAA,EACrC,WAAWA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC3B,OAAOA,EAAE,QAAQ,EAAI;AAAA,EACrB,cAAcA,EAAE,KAAK,CAAC,OAAO,IAAI,CAAC;AAAA,EAClC,WAAWA,EAAE,MAAMD,CAAc;AACnC,CAAC;AASM,SAASI,GAAgBC,GAAsD;AACpF,SACE,gBAAAC,EAACC,KAAe,GAAGF,GACjB,4BAACG,GAAA,EAAM,GAAGH,GAAO,EAAA,CACnB;AAEJ;AAEA,SAASG,EAAK,EAAE,YAAAC,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E,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,EACvB,KAAKA,EAAE,SAAS,IAAI,CAAC;AAAA,EACrB,WAAWA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC3B,OAAOA,EAAE,QAAA,EAAU,OAAO,OAAOC,CAAG;AACtC,CAAC,GAIKC,IAAwBF,EAAE,OAAO;AAAA,EACrC,WAAWA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC3B,OAAOA,EAAE,QAAQ,EAAI;AAAA,EACrB,cAAcA,EAAE,KAAK,CAAC,OAAO,IAAI,CAAC;AAAA,EAClC,WAAWA,EAAE,MAAMD,CAAc;AACnC,CAAC;AASM,SAASI,GAAgBC,GAAsD;AACpF,SACE,gBAAAC,EAACC,KAAe,GAAGF,GACjB,4BAACG,GA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,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,12 +12,11 @@ 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";
|
|
16
15
|
import "react-i18next";
|
|
17
16
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
18
17
|
import "react";
|
|
19
18
|
import { SignatureForm as R } from "../../../Common/SignatureForm/SignatureForm.js";
|
|
20
|
-
function
|
|
19
|
+
function Z(r) {
|
|
21
20
|
return /* @__PURE__ */ o(A, { ...r, children: /* @__PURE__ */ o(j, { ...r }) });
|
|
22
21
|
}
|
|
23
22
|
function j({ employeeId: r, formId: s, className: u, children: n }) {
|
|
@@ -62,6 +61,6 @@ function j({ employeeId: r, formId: s, className: u, children: n }) {
|
|
|
62
61
|
) });
|
|
63
62
|
}
|
|
64
63
|
export {
|
|
65
|
-
|
|
64
|
+
Z as SignatureForm
|
|
66
65
|
};
|
|
67
66
|
//# 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":"
|
|
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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AAC;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,15 +7,14 @@ 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";
|
|
11
10
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
12
11
|
import "../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
13
12
|
import "dompurify";
|
|
14
13
|
import "../../../../contexts/LocaleProvider/useLocale.js";
|
|
15
14
|
import { createCompoundContext as o } from "../../../Base/createCompoundContext.js";
|
|
16
|
-
const [
|
|
15
|
+
const [c, d] = o("SignatureFormContext");
|
|
17
16
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
d as SignatureFormProvider,
|
|
18
|
+
c as useSignatureForm
|
|
20
19
|
};
|
|
21
20
|
//# 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":"
|
|
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;"}
|