@gusto/embedded-react-sdk 0.32.0 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/dist/components/Common/MultiSelectComboBox/MultiSelectComboBox.d.ts +2 -0
- package/dist/components/Common/MultiSelectComboBox/MultiSelectComboBoxTypes.d.ts +16 -0
- package/dist/components/Common/MultiSelectComboBox/index.d.ts +3 -0
- package/dist/components/Common/SignatureForm/SignatureForm.js +11 -12
- package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormActions.js +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormFields.js +2 -2
- package/dist/components/Common/UI/Badge/Badge.js +39 -8
- package/dist/components/Common/UI/Badge/Badge.js.map +1 -1
- package/dist/components/Common/UI/Badge/Badge.module.scss.js +8 -4
- package/dist/components/Common/UI/Badge/Badge.module.scss.js.map +1 -1
- package/dist/components/Common/UI/Badge/BadgeTypes.d.ts +12 -0
- package/dist/components/Common/UI/Badge/BadgeTypes.js.map +1 -1
- package/dist/components/Company/AssignSignatory/AssignSignatory.js +1 -1
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +17 -16
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js.map +1 -1
- 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/InviteSignatory.js +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +6 -5
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js.map +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/useAssignSignatory.js +5 -6
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Form.js +5 -6
- 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/BankAccountVerify/Form.js +5 -6
- package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +2 -2
- 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 +2 -2
- 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/FederalTaxes.js +2 -2
- package/dist/components/Company/FederalTaxes/Form.js +3 -4
- 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/Context.js +6 -7
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Form.js +6 -5
- package/dist/components/Company/Locations/LocationForm/Form.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/LocationForm.js +2 -2
- 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/LocationsList.js +2 -2
- 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 +2 -3
- package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/MissingRequirements.js +5 -6
- package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +2 -2
- 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 +2 -2
- package/dist/components/Company/PaySchedule/_parts/Edit.js +24 -23
- package/dist/components/Company/PaySchedule/_parts/Edit.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Head.js +8 -9
- package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/List.js +11 -12
- 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/StateTaxesForm.js +40 -46
- package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.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/context.js +3 -4
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Contractor/Address/Address.js +2 -2
- package/dist/components/Contractor/Address/Form.js +8 -7
- package/dist/components/Contractor/Address/Form.js.map +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 +17 -17
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +2 -2
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js +108 -100
- package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.d.ts +4 -1
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js +54 -51
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js +13 -12
- package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js +17 -18
- package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js +1 -1
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js +2 -3
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js +6 -7
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js +2 -3
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +2 -3
- 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 +1 -1
- package/dist/components/Employee/Compensation/Edit.js +14 -14
- 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 +1 -1
- package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.js +3 -2
- package/dist/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/List.js +2 -3
- 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/EmploymentEligibility/EmploymentEligibilityPresentation.js +20 -21
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/I9SignatureForm/I9SignatureForm.js +7 -7
- package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +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 -3
- package/dist/components/Employee/EmployeeDocuments/EmployeeDocumentsPresentation.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 +2 -3
- package/dist/components/Employee/EmployeeList/Head.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/FederalForm.js +7 -7
- 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 +8 -8
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +7 -7
- package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +2 -2
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +1 -1
- package/dist/components/Employee/PaymentMethod/Split.js +8 -8
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +5 -6
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/AdminPersonalDetails.js +1 -1
- package/dist/components/Employee/Profile/HomeAddress.js +10 -9
- package/dist/components/Employee/Profile/HomeAddress.js.map +1 -1
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js +11 -10
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
- package/dist/components/Employee/Profile/useProfile.js +3 -4
- package/dist/components/Employee/Profile/useProfile.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/FederalForm.js +7 -7
- 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 +2 -3
- package/dist/components/Flow/Flow.js.map +1 -1
- package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js +16 -16
- package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js.map +1 -1
- package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js +4 -4
- package/dist/components/InformationRequests/InformationRequests.js +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +9 -9
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js +6 -7
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js.map +1 -1
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js +1 -1
- package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js +1 -1
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js +2 -3
- 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/PayrollBlocker/payrollHelpers.js +22 -18
- package/dist/components/Payroll/PayrollBlocker/payrollHelpers.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/payrollHelpers.test.d.ts +1 -0
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +12 -8
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +39 -38
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +39 -38
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +17 -18
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js +38 -35
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.d.ts +1 -0
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +2 -3
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +2 -3
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +3 -2
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js +7 -8
- 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 +1 -1
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js +6 -6
- package/dist/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.js +2 -3
- 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/i18n/en/common.json.d.ts +4 -1
- package/dist/i18n/en/common.json.js +5 -5
- package/dist/style.css +1 -1
- package/dist/types/i18next.d.ts +3 -0
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GarnishmentForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/GarnishmentForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { useMemo } from 'react'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { GarnishmentType } from '@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { NumberInputField, TextInputField, RadioGroupField } from '@/components/Common'\nimport { type CommonComponentInterface, useBase } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\n\nexport const DeductionSchema = z.object({\n active: z.boolean(),\n amount: z.number().min(0).transform(String),\n description: z.string().min(1),\n courtOrdered: z.boolean(),\n times: z.number().nullable(),\n recurring: z.boolean(),\n annualMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n totalAmount: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n deductAsPercentage: z.boolean(),\n garnishmentType: z.nativeEnum(GarnishmentType),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ninterface GarnishmentFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n selectedGarnishmentType: GarnishmentType\n selectedGarnishmentTitle: string\n onCancel: () => void\n}\n\nfunction GarnishmentForm({\n deduction,\n employeeId,\n selectedGarnishmentType,\n selectedGarnishmentTitle,\n onCancel,\n}: GarnishmentFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n const isPending = isPendingCreate || isPendingUpdate\n\n const defaultValues: DeductionInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n description: deduction?.description ?? '',\n times: deduction?.times ?? null,\n recurring: deduction?.recurring ?? true,\n annualMaximum: deduction?.annualMaximum ? Number(deduction.annualMaximum) : null,\n totalAmount: deduction?.totalAmount ? Number(deduction.totalAmount) : null,\n deductAsPercentage: deduction?.deductAsPercentage ?? true,\n active: true,\n courtOrdered: true,\n garnishmentType: deduction?.garnishmentType ?? selectedGarnishmentType,\n }\n }, [deduction])\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n const { control } = formMethods\n const watchedRecurring = useWatch({ control, name: 'recurring' })\n const watchedAmountPercentage = useWatch({ control, name: 'deductAsPercentage' })\n\n const onSubmit: SubmitHandler<DeductionPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, times: payload.recurring ? null : 1 },\n },\n })\n\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...payload,\n version: deduction.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const handleCancel = () => {\n onCancel()\n }\n\n return (\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n <>\n <Components.Heading as=\"h3\">{selectedGarnishmentTitle}</Components.Heading>\n <Flex flexDirection=\"column\" gap={20}>\n <Flex flexDirection=\"column\" gap={20}>\n <TextInputField name=\"description\" label={t('descriptionLabelV2')} isRequired />\n <RadioGroupField\n name=\"recurring\"\n label={t('frequencyLabel')}\n isRequired\n options={[\n { value: true, label: t('frequencyRecurringOptionV2') },\n { value: false, label: t('frequencyOneTimeOptionV2') },\n ]}\n />\n <RadioGroupField\n name=\"deductAsPercentage\"\n label={t('deductionTypeLabelV2')}\n isRequired\n options={[\n { value: true, label: t('deductionTypePercentageOptionV2') },\n { value: false, label: t('deductionTypeFixedAmountOption') },\n ]}\n />\n <NumberInputField\n name=\"amount\"\n adornmentStart={!watchedAmountPercentage && '$'}\n adornmentEnd={watchedAmountPercentage && '%'}\n label={t('deductionAmountLabel')}\n isRequired\n min={0}\n format={watchedAmountPercentage ? 'percent' : 'currency'}\n description={\n watchedAmountPercentage\n ? t('deductionAmountDescriptionPercentage')\n : t('deductionAmountDescriptionFixed')\n }\n />\n </Flex>\n {watchedRecurring && (\n <Flex flexDirection=\"column\" gap={20}>\n <NumberInputField\n name=\"totalAmount\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('totalAmountLabel')}\n description={t('totalAmountDescription')}\n min={0}\n />\n <NumberInputField\n name=\"annualMaximum\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('annualMaxLabel')}\n min={0}\n description={t('annualMaxDescription')}\n />\n </Flex>\n )}\n </Flex>\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('saveCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n\nexport default GarnishmentForm\n"],"names":["DeductionSchema","z","val","GarnishmentType","GarnishmentForm","deduction","employeeId","selectedGarnishmentType","selectedGarnishmentTitle","onCancel","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultValues","useMemo","formMethods","useForm","zodResolver","control","watchedRecurring","useWatch","watchedAmountPercentage","onSubmit","data","payload","updateDeductionResponse","componentEvents","createDeductionResponse","handleCancel","FormProvider","jsx","Form","Flex","jsxs","Fragment","TextInputField","RadioGroupField","NumberInputField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAiBO,MAAMA,IAAkBC,EAAE,OAAO;AAAA,EACtC,QAAQA,EAAE,QAAA;AAAA,EACV,QAAQA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,UAAU,MAAM;AAAA,EAC1C,aAAaA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC7B,cAAcA,EAAE,QAAA;AAAA,EAChB,OAAOA,EAAE,OAAA,EAAS,SAAA;AAAA,EAClB,WAAWA,EAAE,QAAA;AAAA,EACb,eAAeA,EACZ,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAC,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,aAAaD,EACV,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAC,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,oBAAoBD,EAAE,QAAA;AAAA,EACtB,iBAAiBA,EAAE,WAAWE,CAAe;AAC/C,CAAC;AAaD,SAASC,GAAgB;AAAA,EACvB,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,0BAAAC;AAAA,EACA,UAAAC;AACF,GAAyB;AACvB,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,EAAA,GACjC,EAAE,GAAAC,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA,GAEb,EAAE,aAAaC,GAAiB,WAAWC,EAAA,IAC/CC,EAAA,GACI,EAAE,aAAaC,GAAiB,WAAWC,EAAA,IAC/CC,EAAA,GACIC,IAAYL,KAAmBG,GAE/BG,IAAiCC,EAAQ,OACtC;AAAA,IACL,QAAQpB,GAAW,SAAS,OAAOA,EAAU,MAAM,IAAI;AAAA,IAC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A2B;AAAA,YAC5C,cAAcA,KAA2B;AAAA,YACzC,OAAOnB,EAAE,sBAAsB;AAAA,YAC/B,YAAU;AAAA,YACV,KAAK;AAAA,YACL,QAAQmB,IAA0B,YAAY;AAAA,YAC9C,aAEMnB,EADJmB,IACM,yCACA,iCADsC;AAAA,UACL;AAAA,QAAA;AAAA,MAE3C,GACF;AAAA,MACCF,KACC,gBAAAc,EAACD,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,QAAA,gBAAAF;AAAA,UAACO;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,gBAAe;AAAA,YACf,QAAO;AAAA,YACP,OAAOnC,EAAE,kBAAkB;AAAA,YAC3B,aAAaA,EAAE,wBAAwB;AAAA,YACvC,KAAK;AAAA,UAAA;AAAA,QAAA;AAAA,QAEP,gBAAA4B;AAAA,UAACO;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,gBAAe;AAAA,YACf,QAAO;AAAA,YACP,OAAOnC,EAAE,gBAAgB;AAAA,YACzB,KAAK;AAAA,YACL,aAAaA,EAAE,sBAAsB;AAAA,UAAA;AAAA,QAAA;AAAA,MACvC,EAAA,CACF;AAAA,IAAA,GAEJ;AAAA,sBACCoC,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAR,EAAC1B,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASwB,GAC7C,UAAA1B,EAAE,WAAW,EAAA,CAChB;AAAA,MACA,gBAAA4B,EAAC1B,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWQ,GACzC,UAAAV,EAAE,SAAS,EAAA,CACd;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"GarnishmentForm.js","sources":["../../../../../src/components/Employee/Deductions/DeductionsForm/GarnishmentForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm, useWatch, type SubmitHandler } from 'react-hook-form'\nimport { useMemo } from 'react'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { GarnishmentType } from '@gusto/embedded-api/models/operations/postv1employeesemployeeidgarnishments'\nimport { useGarnishmentsCreateMutation } from '@gusto/embedded-api/react-query/garnishmentsCreate'\nimport { useGarnishmentsUpdateMutation } from '@gusto/embedded-api/react-query/garnishmentsUpdate'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { NumberInputField, TextInputField, RadioGroupField } from '@/components/Common'\nimport { type CommonComponentInterface, useBase } from '@/components/Base'\nimport { componentEvents } from '@/shared/constants'\n\nexport const DeductionSchema = z.object({\n active: z.boolean(),\n amount: z.number().min(0).transform(String),\n description: z.string().min(1),\n courtOrdered: z.boolean(),\n times: z.number().nullable(),\n recurring: z.boolean(),\n annualMaximum: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n totalAmount: z\n .number()\n .min(0)\n .transform(val => (val > 0 ? val.toString() : null))\n .nullable(),\n deductAsPercentage: z.boolean(),\n garnishmentType: z.nativeEnum(GarnishmentType),\n})\n\nexport type DeductionInputs = z.input<typeof DeductionSchema>\nexport type DeductionPayload = z.output<typeof DeductionSchema>\n\ninterface GarnishmentFormProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n deduction?: Garnishment | null\n selectedGarnishmentType: GarnishmentType\n selectedGarnishmentTitle: string\n onCancel: () => void\n}\n\nfunction GarnishmentForm({\n deduction,\n employeeId,\n selectedGarnishmentType,\n selectedGarnishmentTitle,\n onCancel,\n}: GarnishmentFormProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n const { mutateAsync: createDeduction, isPending: isPendingCreate } =\n useGarnishmentsCreateMutation()\n const { mutateAsync: updateDeduction, isPending: isPendingUpdate } =\n useGarnishmentsUpdateMutation()\n const isPending = isPendingCreate || isPendingUpdate\n\n const defaultValues: DeductionInputs = useMemo(() => {\n return {\n amount: deduction?.amount ? Number(deduction.amount) : 0,\n description: deduction?.description ?? '',\n times: deduction?.times ?? null,\n recurring: deduction?.recurring ?? true,\n annualMaximum: deduction?.annualMaximum ? Number(deduction.annualMaximum) : null,\n totalAmount: deduction?.totalAmount ? Number(deduction.totalAmount) : null,\n deductAsPercentage: deduction?.deductAsPercentage ?? true,\n active: true,\n courtOrdered: true,\n garnishmentType: deduction?.garnishmentType ?? selectedGarnishmentType,\n }\n }, [deduction])\n\n const formMethods = useForm<DeductionInputs, unknown, DeductionPayload>({\n resolver: zodResolver(DeductionSchema),\n defaultValues,\n })\n const { control } = formMethods\n const watchedRecurring = useWatch({ control, name: 'recurring' })\n const watchedAmountPercentage = useWatch({ control, name: 'deductAsPercentage' })\n\n const onSubmit: SubmitHandler<DeductionPayload> = async data => {\n await baseSubmitHandler(data, async payload => {\n if (!deduction) {\n const { garnishment: createDeductionResponse } = await createDeduction({\n request: {\n employeeId: employeeId,\n requestBody: { ...payload, times: payload.recurring ? null : 1 },\n },\n })\n\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_CREATED, createDeductionResponse)\n } else {\n const { garnishment: updateDeductionResponse } = await updateDeduction({\n request: {\n garnishmentId: deduction.uuid,\n requestBody: {\n ...payload,\n version: deduction.version as string,\n times: payload.recurring ? null : 1,\n },\n },\n })\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_UPDATED, updateDeductionResponse)\n }\n })\n }\n\n const handleCancel = () => {\n onCancel()\n }\n\n return (\n <FormProvider {...formMethods}>\n <Form onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={32}>\n <>\n <Components.Heading as=\"h3\">{selectedGarnishmentTitle}</Components.Heading>\n <Flex flexDirection=\"column\" gap={20}>\n <Flex flexDirection=\"column\" gap={20}>\n <TextInputField name=\"description\" label={t('descriptionLabelV2')} isRequired />\n <RadioGroupField\n name=\"recurring\"\n label={t('frequencyLabel')}\n isRequired\n options={[\n { value: true, label: t('frequencyRecurringOptionV2') },\n { value: false, label: t('frequencyOneTimeOptionV2') },\n ]}\n />\n <RadioGroupField\n name=\"deductAsPercentage\"\n label={t('deductionTypeLabelV2')}\n isRequired\n options={[\n { value: true, label: t('deductionTypePercentageOptionV2') },\n { value: false, label: t('deductionTypeFixedAmountOption') },\n ]}\n />\n <NumberInputField\n name=\"amount\"\n adornmentStart={!watchedAmountPercentage && '$'}\n adornmentEnd={watchedAmountPercentage && '%'}\n label={t('deductionAmountLabel')}\n isRequired\n min={0}\n format={watchedAmountPercentage ? 'percent' : 'currency'}\n description={\n watchedAmountPercentage\n ? t('deductionAmountDescriptionPercentage')\n : t('deductionAmountDescriptionFixed')\n }\n />\n </Flex>\n {watchedRecurring && (\n <Flex flexDirection=\"column\" gap={20}>\n <NumberInputField\n name=\"totalAmount\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('totalAmountLabel')}\n description={t('totalAmountDescription')}\n min={0}\n />\n <NumberInputField\n name=\"annualMaximum\"\n adornmentStart=\"$\"\n format=\"currency\"\n label={t('annualMaxLabel')}\n min={0}\n description={t('annualMaxDescription')}\n />\n </Flex>\n )}\n </Flex>\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('saveCta')}\n </Components.Button>\n </ActionsLayout>\n </>\n </Flex>\n </Form>\n </FormProvider>\n )\n}\n\nexport default GarnishmentForm\n"],"names":["DeductionSchema","z","val","GarnishmentType","GarnishmentForm","deduction","employeeId","selectedGarnishmentType","selectedGarnishmentTitle","onCancel","onEvent","baseSubmitHandler","useBase","t","useTranslation","Components","useComponentContext","createDeduction","isPendingCreate","useGarnishmentsCreateMutation","updateDeduction","isPendingUpdate","useGarnishmentsUpdateMutation","isPending","defaultValues","useMemo","formMethods","useForm","zodResolver","control","watchedRecurring","useWatch","watchedAmountPercentage","onSubmit","data","payload","updateDeductionResponse","componentEvents","createDeductionResponse","handleCancel","FormProvider","jsx","Form","Flex","jsxs","Fragment","TextInputField","RadioGroupField","NumberInputField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAiBO,MAAMA,IAAkBC,EAAE,OAAO;AAAA,EACtC,QAAQA,EAAE,QAAA;AAAA,EACV,QAAQA,EAAE,OAAA,EAAS,IAAI,CAAC,EAAE,UAAU,MAAM;AAAA,EAC1C,aAAaA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC7B,cAAcA,EAAE,QAAA;AAAA,EAChB,OAAOA,EAAE,OAAA,EAAS,SAAA;AAAA,EAClB,WAAWA,EAAE,QAAA;AAAA,EACb,eAAeA,EACZ,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAC,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,aAAaD,EACV,OAAA,EACA,IAAI,CAAC,EACL,UAAU,CAAAC,MAAQA,IAAM,IAAIA,EAAI,SAAA,IAAa,IAAK,EAClD,SAAA;AAAA,EACH,oBAAoBD,EAAE,QAAA;AAAA,EACtB,iBAAiBA,EAAE,WAAWE,CAAe;AAC/C,CAAC;AAaD,SAASC,GAAgB;AAAA,EACvB,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,yBAAAC;AAAA,EACA,0BAAAC;AAAA,EACA,UAAAC;AACF,GAAyB;AACvB,QAAM,EAAE,SAAAC,GAAS,mBAAAC,EAAA,IAAsBC,EAAA,GACjC,EAAE,GAAAC,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA,GAEb,EAAE,aAAaC,GAAiB,WAAWC,EAAA,IAC/CC,EAAA,GACI,EAAE,aAAaC,GAAiB,WAAWC,EAAA,IAC/CC,EAAA,GACIC,IAAYL,KA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6
|
import { useBase as U } from "../../../Base/useBase.js";
|
|
7
7
|
import { Flex as E } from "../../../Common/Flex/Flex.js";
|
|
8
8
|
import "classnames";
|
|
9
|
-
import { componentEvents as c } from "../../../../shared/constants.js";
|
|
10
9
|
import { ActionsLayout as Y } from "../../../Common/ActionsLayout/ActionsLayout.js";
|
|
11
10
|
import { HamburgerMenu as B } from "../../../Common/HamburgerMenu/HamburgerMenu.js";
|
|
12
11
|
import p from "../../../../hooks/useNumberFormatter.js";
|
|
13
12
|
import S from "../../../../assets/icons/pencil.svg.js";
|
|
14
13
|
import V from "../../../../assets/icons/trashcan.svg.js";
|
|
15
14
|
import { useComponentDictionary as q, useI18n as F } from "../../../../i18n/I18n.js";
|
|
15
|
+
import { componentEvents as c } from "../../../../shared/constants.js";
|
|
16
16
|
import { useComponentContext as H } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
17
17
|
import j from "../../../../assets/icons/plus-circle.svg.js";
|
|
18
18
|
import { useDataView as G } from "../../../Common/DataView/useDataView.js";
|
|
@@ -5,6 +5,7 @@ import { BaseComponent as p } from "../../../Base/Base.js";
|
|
|
5
5
|
import { useBase as h } from "../../../Base/useBase.js";
|
|
6
6
|
import { Grid as C } from "../../../Common/Grid/Grid.js";
|
|
7
7
|
import { Flex as m } from "../../../Common/Flex/Flex.js";
|
|
8
|
+
import "classnames";
|
|
8
9
|
import { ActionsLayout as f } from "../../../Common/ActionsLayout/ActionsLayout.js";
|
|
9
10
|
import { useComponentContext as D } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
10
11
|
import "react";
|
|
@@ -12,7 +13,7 @@ import { useComponentDictionary as E, useI18n as y } from "../../../../i18n/I18n
|
|
|
12
13
|
import { componentEvents as s } from "../../../../shared/constants.js";
|
|
13
14
|
import g from "../../../../assets/icons/coins-hand.svg.js";
|
|
14
15
|
import x from "../../../../assets/icons/plus-circle.svg.js";
|
|
15
|
-
function
|
|
16
|
+
function w(t) {
|
|
16
17
|
return /* @__PURE__ */ n(p, { ...t, children: /* @__PURE__ */ n(I, { ...t, children: t.children }) });
|
|
17
18
|
}
|
|
18
19
|
function I({ className: t, dictionary: d }) {
|
|
@@ -49,6 +50,6 @@ function I({ className: t, dictionary: d }) {
|
|
|
49
50
|
] }) });
|
|
50
51
|
}
|
|
51
52
|
export {
|
|
52
|
-
|
|
53
|
+
w as IncludeDeductions
|
|
53
54
|
};
|
|
54
55
|
//# sourceMappingURL=IncludeDeductions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IncludeDeductions.js","sources":["../../../../../src/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport styles from './IncludeDeductions.module.scss'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { Grid } from '@/components/Common/Grid/Grid'\nimport { ActionsLayout, Flex } from '@/components/Common'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport CoinsHandsIcon from '@/assets/icons/coins-hand.svg?react'\nimport PlusCircleIcon from '@/assets/icons/plus-circle.svg?react'\n\ninterface IncludeDeductionsProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n}\n\nexport function IncludeDeductions(props: IncludeDeductionsProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ className, dictionary }: IncludeDeductionsProps) {\n const { onEvent } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n useComponentDictionary('Employee.Deductions', dictionary)\n useI18n('Employee.Deductions')\n\n const handleAdd = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_INCLUDE_YES)\n }\n\n const handleContinue = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_INCLUDE_NO)\n }\n\n return (\n <section className={className}>\n <Grid gridTemplateColumns=\"1fr\">\n <Flex flexDirection=\"column\" gap={2}>\n <Components.Heading as=\"h2\">{t('pageTitle')}</Components.Heading>\n <Components.Text variant=\"supporting\">\n {t('includeDeductionsDescriptionV2')}\n </Components.Text>\n </Flex>\n\n {/* TODO: Replace with proper empty state component for DataViews */}\n <section className={styles.emptyStateContainer}>\n <Flex flexDirection=\"column\" gap={16} justifyContent=\"center\" alignItems=\"center\">\n <section className={styles.coinHandsIconContainer}>\n <CoinsHandsIcon width={24} height={24} />\n </section>\n <Components.Text weight=\"bold\">{t('includeDeductionsEmptyState')}</Components.Text>\n <Components.Button\n type=\"button\"\n variant=\"secondary\"\n onClick={handleAdd}\n className={styles.addDeductionButton}\n >\n <PlusCircleIcon />\n {t('addDeductionButtonCta')}\n </Components.Button>\n </Flex>\n </section>\n <ActionsLayout>\n <Components.Button type=\"button\" onClick={handleContinue}>\n {t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </Grid>\n </section>\n )\n}\n"],"names":["IncludeDeductions","props","jsx","BaseComponent","Root","className","dictionary","onEvent","useBase","t","useTranslation","Components","useComponentContext","useComponentDictionary","useI18n","handleAdd","componentEvents","handleContinue","jsxs","Grid","Flex","styles","CoinsHandsIcon","PlusCircleIcon","ActionsLayout"],"mappings":"
|
|
1
|
+
{"version":3,"file":"IncludeDeductions.js","sources":["../../../../../src/components/Employee/Deductions/IncludeDeductions/IncludeDeductions.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport styles from './IncludeDeductions.module.scss'\nimport {\n BaseComponent,\n type BaseComponentInterface,\n type CommonComponentInterface,\n useBase,\n} from '@/components/Base'\nimport { Grid } from '@/components/Common/Grid/Grid'\nimport { ActionsLayout, Flex } from '@/components/Common'\nimport { useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary } from '@/i18n/I18n'\nimport CoinsHandsIcon from '@/assets/icons/coins-hand.svg?react'\nimport PlusCircleIcon from '@/assets/icons/plus-circle.svg?react'\n\ninterface IncludeDeductionsProps extends CommonComponentInterface<'Employee.Deductions'> {\n employeeId: string\n}\n\nexport function IncludeDeductions(props: IncludeDeductionsProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ className, dictionary }: IncludeDeductionsProps) {\n const { onEvent } = useBase()\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n\n useComponentDictionary('Employee.Deductions', dictionary)\n useI18n('Employee.Deductions')\n\n const handleAdd = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_INCLUDE_YES)\n }\n\n const handleContinue = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_INCLUDE_NO)\n }\n\n return (\n <section className={className}>\n <Grid gridTemplateColumns=\"1fr\">\n <Flex flexDirection=\"column\" gap={2}>\n <Components.Heading as=\"h2\">{t('pageTitle')}</Components.Heading>\n <Components.Text variant=\"supporting\">\n {t('includeDeductionsDescriptionV2')}\n </Components.Text>\n </Flex>\n\n {/* TODO: Replace with proper empty state component for DataViews */}\n <section className={styles.emptyStateContainer}>\n <Flex flexDirection=\"column\" gap={16} justifyContent=\"center\" alignItems=\"center\">\n <section className={styles.coinHandsIconContainer}>\n <CoinsHandsIcon width={24} height={24} />\n </section>\n <Components.Text weight=\"bold\">{t('includeDeductionsEmptyState')}</Components.Text>\n <Components.Button\n type=\"button\"\n variant=\"secondary\"\n onClick={handleAdd}\n className={styles.addDeductionButton}\n >\n <PlusCircleIcon />\n {t('addDeductionButtonCta')}\n </Components.Button>\n </Flex>\n </section>\n <ActionsLayout>\n <Components.Button type=\"button\" onClick={handleContinue}>\n {t('continueCta')}\n </Components.Button>\n </ActionsLayout>\n </Grid>\n </section>\n )\n}\n"],"names":["IncludeDeductions","props","jsx","BaseComponent","Root","className","dictionary","onEvent","useBase","t","useTranslation","Components","useComponentContext","useComponentDictionary","useI18n","handleAdd","componentEvents","handleContinue","jsxs","Grid","Flex","styles","CoinsHandsIcon","PlusCircleIcon","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;AAqBO,SAASA,EAAkBC,GAAwD;AACxF,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,SAASG,EAAK,EAAE,WAAAC,GAAW,YAAAC,KAAsC;AAC/D,QAAM,EAAE,SAAAC,EAAA,IAAYC,EAAA,GACd,EAAE,GAAAC,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA;AAEnB,EAAAC,EAAuB,uBAAuBP,CAAU,GACxDQ,EAAQ,qBAAqB;AAE7B,QAAMC,IAAY,MAAM;AACtB,IAAAR,EAAQS,EAAgB,8BAA8B;AAAA,EACxD,GAEMC,IAAiB,MAAM;AAC3B,IAAAV,EAAQS,EAAgB,6BAA6B;AAAA,EACvD;AAEA,2BACG,WAAA,EAAQ,WAAAX,GACP,UAAA,gBAAAa,EAACC,GAAA,EAAK,qBAAoB,OACxB,UAAA;AAAA,IAAA,gBAAAD,EAACE,GAAA,EAAK,eAAc,UAAS,KAAK,GAChC,UAAA;AAAA,MAAA,gBAAAlB,EAACS,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAAF,EAAE,WAAW,GAAE;AAAA,MAC5C,gBAAAP,EAACS,EAAW,MAAX,EAAgB,SAAQ,cACtB,UAAAF,EAAE,gCAAgC,EAAA,CACrC;AAAA,IAAA,GACF;AAAA,IAGA,gBAAAP,EAAC,WAAA,EAAQ,WAAWmB,EAAO,qBACzB,UAAA,gBAAAH,EAACE,GAAA,EAAK,eAAc,UAAS,KAAK,IAAI,gBAAe,UAAS,YAAW,UACvE,UAAA;AAAA,MAAA,gBAAAlB,EAAC,WAAA,EAAQ,WAAWmB,EAAO,wBACzB,UAAA,gBAAAnB,EAACoB,KAAe,OAAO,IAAI,QAAQ,GAAA,CAAI,EAAA,CACzC;AAAA,MACA,gBAAApB,EAACS,EAAW,MAAX,EAAgB,QAAO,QAAQ,UAAAF,EAAE,6BAA6B,GAAE;AAAA,MACjE,gBAAAS;AAAA,QAACP,EAAW;AAAA,QAAX;AAAA,UACC,MAAK;AAAA,UACL,SAAQ;AAAA,UACR,SAASI;AAAA,UACT,WAAWM,EAAO;AAAA,UAElB,UAAA;AAAA,YAAA,gBAAAnB,EAACqB,GAAA,EAAe;AAAA,YACfd,EAAE,uBAAuB;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAC5B,EAAA,CACF,EAAA,CACF;AAAA,IACA,gBAAAP,EAACsB,GAAA,EACC,UAAA,gBAAAtB,EAACS,EAAW,QAAX,EAAkB,MAAK,UAAS,SAASM,GACvC,UAAAR,EAAE,aAAa,GAClB,EAAA,CACF;AAAA,EAAA,EAAA,CACF,EAAA,CACF;AAEJ;"}
|
|
@@ -9,8 +9,8 @@ import { useBase as g } from "../../../Base/useBase.js";
|
|
|
9
9
|
import { useI18n as O } from "../../../../i18n/I18n.js";
|
|
10
10
|
import { componentEvents as m } from "../../../../shared/constants.js";
|
|
11
11
|
import { Flex as _ } from "../../../Common/Flex/Flex.js";
|
|
12
|
-
import "classnames";
|
|
13
12
|
import "react-i18next";
|
|
13
|
+
import "classnames";
|
|
14
14
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
15
15
|
import "react";
|
|
16
16
|
function V(e) {
|
|
@@ -3,11 +3,10 @@ import { useTranslation as m } from "react-i18next";
|
|
|
3
3
|
import { useDocumentList as s } from "./useDocumentList.js";
|
|
4
4
|
import { Flex as l } from "../../../Common/Flex/Flex.js";
|
|
5
5
|
import "classnames";
|
|
6
|
-
import "../../../../shared/constants.js";
|
|
7
6
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
8
7
|
import "react";
|
|
9
8
|
import { DocumentList as u } from "../../../Common/DocumentList/DocumentList.js";
|
|
10
|
-
function
|
|
9
|
+
function S() {
|
|
11
10
|
const { employeeForms: i, handleRequestFormToSign: n, documentListError: r } = s(), { t: e } = m("Employee.DocumentSigner");
|
|
12
11
|
return /* @__PURE__ */ o("section", { style: { width: "100%" }, children: /* @__PURE__ */ o(l, { flexDirection: "column", gap: 32, children: /* @__PURE__ */ o(
|
|
13
12
|
u,
|
|
@@ -36,6 +35,6 @@ function D() {
|
|
|
36
35
|
) }) });
|
|
37
36
|
}
|
|
38
37
|
export {
|
|
39
|
-
|
|
38
|
+
S as List
|
|
40
39
|
};
|
|
41
40
|
//# 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;"}
|
|
@@ -9,13 +9,12 @@ import "../../../Base/useBase.js";
|
|
|
9
9
|
import "../../../../shared/constants.js";
|
|
10
10
|
import "classnames";
|
|
11
11
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
12
|
-
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 hasSignedAllForms: boolean\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 hasSignedAllForms: boolean\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":";;;;;;;;;;;;;;AAYA,MAAM,CAACA,GAAiBC,CAAoB,IAC1CC,EAA+C,qBAAqB;"}
|
|
@@ -8,29 +8,28 @@ import { generateEmploymentEligibilitySchema as k } from "./EmploymentEligibilit
|
|
|
8
8
|
import { COUNTRIES as P } from "./countries.js";
|
|
9
9
|
import { Flex as b } from "../../../Common/Flex/Flex.js";
|
|
10
10
|
import "classnames";
|
|
11
|
-
import "
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import { SelectField as J } from "../../../Common/Fields/SelectField/SelectField.js";
|
|
11
|
+
import { ActionsLayout as V } from "../../../Common/ActionsLayout/ActionsLayout.js";
|
|
12
|
+
import { useComponentContext as B } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
13
|
+
import { ComboBoxField as H } from "../../../Common/Fields/ComboBoxField/ComboBoxField.js";
|
|
14
|
+
import { Form as K } from "../../../Common/Form/Form.js";
|
|
15
|
+
import { useI18n as M } from "../../../../i18n/I18n.js";
|
|
16
|
+
import { SelectField as G } from "../../../Common/Fields/SelectField/SelectField.js";
|
|
17
|
+
import { RadioGroupField as U } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
18
|
+
import { TextInputField as W } from "../../../Common/Fields/TextInputField/TextInputField.js";
|
|
19
|
+
import { DatePickerField as J } from "../../../Common/Fields/DatePickerField/DatePickerField.js";
|
|
21
20
|
const Q = {
|
|
22
21
|
citizen: "statusDescriptions.citizen",
|
|
23
22
|
permanent_resident: "statusDescriptions.permanent_resident",
|
|
24
23
|
noncitizen: "statusDescriptions.noncitizen",
|
|
25
24
|
alien: "statusDescriptions.alien"
|
|
26
|
-
},
|
|
25
|
+
}, fe = ({
|
|
27
26
|
onSubmit: h,
|
|
28
27
|
defaultValues: f,
|
|
29
28
|
hasDocumentNumber: y,
|
|
30
29
|
isPending: g
|
|
31
30
|
}) => {
|
|
32
|
-
|
|
33
|
-
const { Heading: D, Text: x, Alert: z, Button: E, Link: N } =
|
|
31
|
+
M("Employee.EmploymentEligibility");
|
|
32
|
+
const { Heading: D, Text: x, Alert: z, Button: E, Link: N } = B(), { t: e } = L("Employee.EmploymentEligibility"), [m, a] = I(!!y), r = O({
|
|
34
33
|
resolver: j(k(m)),
|
|
35
34
|
defaultValues: f
|
|
36
35
|
}), { control: l, setValue: u, clearErrors: c } = r, o = d({ control: l, name: "authorizationStatus" }), s = d({ control: l, name: "documentType" }), _ = Object.values(q).map((n) => ({
|
|
@@ -47,7 +46,7 @@ const Q = {
|
|
|
47
46
|
uscis_alien_registration_number: 9,
|
|
48
47
|
form_i94: 11
|
|
49
48
|
};
|
|
50
|
-
return /* @__PURE__ */ t($, { ...r, children: /* @__PURE__ */ t(
|
|
49
|
+
return /* @__PURE__ */ t($, { ...r, children: /* @__PURE__ */ t(K, { onSubmit: r.handleSubmit(h), children: /* @__PURE__ */ p(b, { flexDirection: "column", gap: 16, children: [
|
|
51
50
|
/* @__PURE__ */ p(b, { flexDirection: "column", gap: 2, children: [
|
|
52
51
|
/* @__PURE__ */ t(D, { as: "h2", children: e("title") }),
|
|
53
52
|
/* @__PURE__ */ t(x, { variant: "supporting", children: /* @__PURE__ */ t(
|
|
@@ -62,7 +61,7 @@ const Q = {
|
|
|
62
61
|
) })
|
|
63
62
|
] }),
|
|
64
63
|
/* @__PURE__ */ t(
|
|
65
|
-
|
|
64
|
+
G,
|
|
66
65
|
{
|
|
67
66
|
name: "authorizationStatus",
|
|
68
67
|
label: e("select.label"),
|
|
@@ -81,9 +80,9 @@ const Q = {
|
|
|
81
80
|
disableScrollIntoView: !0
|
|
82
81
|
}
|
|
83
82
|
),
|
|
84
|
-
o === "alien" && /* @__PURE__ */ t(
|
|
83
|
+
o === "alien" && /* @__PURE__ */ t(J, { name: "expirationDate", label: e("expirationDate.label") }),
|
|
85
84
|
F && /* @__PURE__ */ t(
|
|
86
|
-
|
|
85
|
+
U,
|
|
87
86
|
{
|
|
88
87
|
name: "documentType",
|
|
89
88
|
label: e("authorizationDocument.label"),
|
|
@@ -93,7 +92,7 @@ const Q = {
|
|
|
93
92
|
}
|
|
94
93
|
),
|
|
95
94
|
R && i && /* @__PURE__ */ t(
|
|
96
|
-
|
|
95
|
+
W,
|
|
97
96
|
{
|
|
98
97
|
name: "documentNumber",
|
|
99
98
|
label: e(`documentNumber.${i}.label`),
|
|
@@ -104,7 +103,7 @@ const Q = {
|
|
|
104
103
|
}
|
|
105
104
|
),
|
|
106
105
|
s === "foreign_passport" && o === "alien" && /* @__PURE__ */ t(
|
|
107
|
-
|
|
106
|
+
H,
|
|
108
107
|
{
|
|
109
108
|
name: "country",
|
|
110
109
|
label: e("country.label"),
|
|
@@ -115,10 +114,10 @@ const Q = {
|
|
|
115
114
|
isRequired: !0
|
|
116
115
|
}
|
|
117
116
|
),
|
|
118
|
-
/* @__PURE__ */ t(
|
|
117
|
+
/* @__PURE__ */ t(V, { children: /* @__PURE__ */ t(E, { type: "submit", isLoading: g, children: e("submit") }) })
|
|
119
118
|
] }) }) });
|
|
120
119
|
};
|
|
121
120
|
export {
|
|
122
|
-
|
|
121
|
+
fe as EmploymentEligibilityPresentation
|
|
123
122
|
};
|
|
124
123
|
//# 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 const documentNumberMaxLength: Partial<Record<I9AuthorizationDocumentType, number>> = {\n uscis_alien_registration_number: 9,\n form_i94: 11,\n }\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 maxLength={documentNumberMaxLength[activeDocumentType]}\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","documentNumberMaxLength","FormProvider","jsx","Form","jsxs","Flex","Trans","Select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;AAAA,IAAA;AAAA,IAIxBA,MAAwB,WACvB,gBAAAe,EAACM,GAAA,EAAgB,MAAK,kBAAiB,OAAOjC,EAAE,sBAAsB,GAAG;AAAA,IAG1EsB,KACC,gBAAAK;AAAA,MAACO;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOlC,EAAE,6BAA6B;AAAA,QACtC,SAASkB;AAAA,QACT,YAAU;AAAA,QACV,UAAUG;AAAA,MAAA;AAAA,IAAA;AAAA,IAIbE,KAA2BC,KAC1B,gBAAAG;AAAA,MAACQ;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOnC,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,WAAWC,EAAwBD,CAAkB;AAAA,QACrD,YAAU;AAAA,MAAA;AAAA,IAAA;AAAA,IAIbV,MAAiB,sBAAsBF,MAAwB,WAC9D,gBAAAe;AAAA,MAACS;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOpC,EAAE,eAAe;AAAA,QACxB,aAAaA,EAAE,qBAAqB;AAAA,QACpC,SAASqC;AAAA,QACT,aAAarC,EAAE,qBAAqB;AAAA,QACpC,mBAAiB;AAAA,QACjB,YAAU;AAAA,MAAA;AAAA,IAAA;AAAA,IAId,gBAAA2B,EAACW,GAAA,EACC,UAAA,gBAAAX,EAAC9B,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 const documentNumberMaxLength: Partial<Record<I9AuthorizationDocumentType, number>> = {\n uscis_alien_registration_number: 9,\n form_i94: 11,\n }\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 maxLength={documentNumberMaxLength[activeDocumentType]}\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","documentNumberMaxLength","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,WA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A;AAAA,IAAA;AAAA,IAIbE,KAA2BC,KAC1B,gBAAAG;AAAA,MAACQ;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOnC,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,WAAWC,EAAwBD,CAAkB;AAAA,QACrD,YAAU;AAAA,MAAA;AAAA,IAAA;AAAA,IAIbV,MAAiB,sBAAsBF,MAAwB,WAC9D,gBAAAe;AAAA,MAACS;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOpC,EAAE,eAAe;AAAA,QACxB,aAAaA,EAAE,qBAAqB;AAAA,QACpC,SAASqC;AAAA,QACT,aAAarC,EAAE,qBAAqB;AAAA,QACpC,mBAAiB;AAAA,QACjB,YAAU;AAAA,MAAA;AAAA,IAAA;AAAA,IAId,gBAAA2B,EAACW,GAAA,EACC,UAAA,gBAAAX,EAAC9B,GAAA,EAAO,MAAK,UAAS,WAAWL,GAC9B,UAAAQ,EAAE,QAAQ,EAAA,CACb,EAAA,CACF;AAAA,EAAA,EAAA,CACF,GACF,GACF;AAEJ;"}
|
|
@@ -14,13 +14,13 @@ import { useI18n as Y } from "../../../../i18n/I18n.js";
|
|
|
14
14
|
import { componentEvents as C, STATES_ABBR as K } from "../../../../shared/constants.js";
|
|
15
15
|
import { Flex as f } from "../../../Common/Flex/Flex.js";
|
|
16
16
|
import "classnames";
|
|
17
|
-
import {
|
|
18
|
-
import { TextInputField as c } from "../../../Common/Fields/TextInputField/TextInputField.js";
|
|
19
|
-
import { ActionsLayout as Z } from "../../../Common/ActionsLayout/ActionsLayout.js";
|
|
17
|
+
import { ActionsLayout as U } from "../../../Common/ActionsLayout/ActionsLayout.js";
|
|
20
18
|
import { useComponentContext as S } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
21
19
|
import "react";
|
|
22
|
-
import { Form as
|
|
20
|
+
import { Form as Z } from "../../../Common/Form/Form.js";
|
|
21
|
+
import { TextInputField as c } from "../../../Common/Fields/TextInputField/TextInputField.js";
|
|
23
22
|
import { CheckboxField as P } from "../../../Common/Fields/CheckboxField/CheckboxField.js";
|
|
23
|
+
import { RadioGroupField as Q } from "../../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
24
24
|
import { SelectField as X } from "../../../Common/Fields/SelectField/SelectField.js";
|
|
25
25
|
import { DocumentViewer as J } from "../../../Common/DocumentViewer/DocumentViewer.js";
|
|
26
26
|
const W = 4, ee = l.object({
|
|
@@ -73,7 +73,7 @@ function te({ employeeId: i, formId: a, className: o }) {
|
|
|
73
73
|
n(C.EMPLOYEE_SIGN_FORM, z);
|
|
74
74
|
});
|
|
75
75
|
};
|
|
76
|
-
return /* @__PURE__ */ e("section", { className: o, children: /* @__PURE__ */ e(q, { ...A, children: /* @__PURE__ */ e(
|
|
76
|
+
return /* @__PURE__ */ e("section", { className: o, children: /* @__PURE__ */ e(q, { ...A, children: /* @__PURE__ */ e(Z, { onSubmit: A.handleSubmit(_), children: /* @__PURE__ */ m(f, { flexDirection: "column", gap: 20, children: [
|
|
77
77
|
/* @__PURE__ */ m("section", { children: [
|
|
78
78
|
/* @__PURE__ */ e(p.Heading, { as: "h2", children: t("title") }),
|
|
79
79
|
/* @__PURE__ */ e(p.Text, { children: /* @__PURE__ */ e(
|
|
@@ -133,7 +133,7 @@ function te({ employeeId: i, formId: a, className: o }) {
|
|
|
133
133
|
)
|
|
134
134
|
] }),
|
|
135
135
|
/* @__PURE__ */ e(ne, {}),
|
|
136
|
-
/* @__PURE__ */ m(
|
|
136
|
+
/* @__PURE__ */ m(U, { children: [
|
|
137
137
|
/* @__PURE__ */ e(p.Button, { variant: "secondary", type: "button", onClick: $, children: t("cancelCta") }),
|
|
138
138
|
/* @__PURE__ */ e(p.Button, { type: "submit", isLoading: R, children: t("signCta") })
|
|
139
139
|
] })
|
|
@@ -186,7 +186,7 @@ function ne() {
|
|
|
186
186
|
};
|
|
187
187
|
return /* @__PURE__ */ m(f, { flexDirection: "column", gap: 20, children: [
|
|
188
188
|
/* @__PURE__ */ e(
|
|
189
|
-
|
|
189
|
+
Q,
|
|
190
190
|
{
|
|
191
191
|
name: "usedPreparer",
|
|
192
192
|
label: i("preparerQuestion"),
|
|
@@ -12,8 +12,8 @@ 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";
|
|
16
|
+
import "classnames";
|
|
17
17
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
18
18
|
import "react";
|
|
19
19
|
import { SignatureForm as R } from "../../../Common/SignatureForm/SignatureForm.js";
|
|
@@ -9,13 +9,12 @@ import "../../../Base/useBase.js";
|
|
|
9
9
|
import "../../../../shared/constants.js";
|
|
10
10
|
import "classnames";
|
|
11
11
|
import "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
12
|
-
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;"}
|
|
@@ -5,7 +5,6 @@ import { zodResolver as E } from "@hookform/resolvers/zod";
|
|
|
5
5
|
import { z as p } from "zod";
|
|
6
6
|
import { Flex as l, FlexItem as o } from "../../Common/Flex/Flex.js";
|
|
7
7
|
import "classnames";
|
|
8
|
-
import "../../../shared/constants.js";
|
|
9
8
|
import { useComponentContext as v } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
10
9
|
import "react";
|
|
11
10
|
import { Form as w } from "../../Common/Form/Form.js";
|
|
@@ -13,7 +12,7 @@ import { useI18n as C } from "../../../i18n/I18n.js";
|
|
|
13
12
|
import { CheckboxField as F } from "../../Common/Fields/CheckboxField/CheckboxField.js";
|
|
14
13
|
const u = "gusto-sdk-employee-documents-form", T = p.object({
|
|
15
14
|
includeI9: p.boolean()
|
|
16
|
-
}),
|
|
15
|
+
}), B = ({
|
|
17
16
|
isEmployeeSelfOnboarding: a,
|
|
18
17
|
currentI9Status: g,
|
|
19
18
|
onSubmit: f,
|
|
@@ -111,6 +110,6 @@ const u = "gusto-sdk-employee-documents-form", T = p.object({
|
|
|
111
110
|
] }) });
|
|
112
111
|
};
|
|
113
112
|
export {
|
|
114
|
-
|
|
113
|
+
B as EmployeeDocumentsPresentation
|
|
115
114
|
};
|
|
116
115
|
//# sourceMappingURL=EmployeeDocumentsPresentation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmployeeDocumentsPresentation.js","sources":["../../../../src/components/Employee/EmployeeDocuments/EmployeeDocumentsPresentation.tsx"],"sourcesContent":["import { Trans, useTranslation } from 'react-i18next'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { z } from 'zod'\nimport { Flex, CheckboxField, FlexItem } from '@/components/Common'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\n\nconst EMPLOYEE_DOCUMENTS_FORM_ID = 'gusto-sdk-employee-documents-form'\n\nconst EmployeeDocumentsSchema = z.object({\n includeI9: z.boolean(),\n})\n\nexport type EmployeeDocumentsFormValues = z.infer<typeof EmployeeDocumentsSchema>\n\nexport interface EmployeeDocumentsPresentationProps {\n isEmployeeSelfOnboarding: boolean\n currentI9Status: boolean\n onSubmit: (formData: EmployeeDocumentsFormValues) => Promise<void>\n onDone: () => void\n isPending: boolean\n}\n\nexport const EmployeeDocumentsPresentation = ({\n isEmployeeSelfOnboarding,\n currentI9Status,\n onSubmit,\n onDone,\n isPending,\n}: EmployeeDocumentsPresentationProps) => {\n useI18n('Employee.EmployeeDocuments')\n const { t } = useTranslation('Employee.EmployeeDocuments')\n const { Alert, Heading, Text, Button, Link, UnorderedList } = useComponentContext()\n\n const formMethods = useForm<EmployeeDocumentsFormValues>({\n resolver: zodResolver(EmployeeDocumentsSchema),\n defaultValues: {\n includeI9: currentI9Status,\n },\n })\n\n const includeI9 = formMethods.watch('includeI9')\n\n const renderSelfOnboarding = () => (\n <FormProvider {...formMethods}>\n <Form id={EMPLOYEE_DOCUMENTS_FORM_ID} onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={16}>\n <FlexItem>\n <Heading as=\"h2\">{t('selfOnboarding.title')}</Heading>\n <Text variant=\"supporting\">{t('selfOnboarding.description')}</Text>\n </FlexItem>\n\n <Heading as=\"h3\">{t('selfOnboarding.documentsIncludedLabel')}</Heading>\n <FlexItem>\n <Text weight=\"medium\">{t('selfOnboarding.taxWithholdingLabel')}</Text>\n <Text variant=\"supporting\">{t('selfOnboarding.taxWithholdingDescription')}</Text>\n </FlexItem>\n <FlexItem>\n <Text weight=\"medium\">{t('selfOnboarding.directDepositLabel')}</Text>\n <Text variant=\"supporting\">{t('selfOnboarding.directDepositDescription')}</Text>\n </FlexItem>\n\n <Heading as=\"h3\">{t('selfOnboarding.includeI9Heading')}</Heading>\n <CheckboxField\n name=\"includeI9\"\n label={t('selfOnboarding.includeI9Label')}\n description={t('selfOnboarding.includeI9Description')}\n />\n\n {includeI9 ? (\n <Alert status=\"warning\" label={t('selfOnboarding.alerts.includedTitle')}>\n <UnorderedList\n items={[\n <Trans\n key=\"included-description-1\"\n i18nKey={'selfOnboarding.alerts.includedDescription'}\n t={t}\n components={{\n Link: <Link />,\n }}\n />,\n <span key=\"included-description-2\">\n {t('selfOnboarding.alerts.includedDescription2')}\n </span>,\n ]}\n />\n </Alert>\n ) : (\n <Alert status=\"info\" label={t('selfOnboarding.alerts.notIncludedTitle')}>\n <Trans\n i18nKey={'selfOnboarding.alerts.notIncludedDescription'}\n t={t}\n components={{\n Link: <Link />,\n }}\n />\n </Alert>\n )}\n </Flex>\n </Form>\n </FormProvider>\n )\n\n const renderNotSelfOnboarding = () => (\n <Flex flexDirection=\"column\" gap={16}>\n <FlexItem>\n <Heading as=\"h2\">{t('notSelfOnboarding.title')}</Heading>\n <Text>{t('notSelfOnboarding.description')}</Text>\n </FlexItem>\n\n <FlexItem>\n <Text weight=\"medium\">{t('notSelfOnboarding.employmentEligibilityLabel')}</Text>\n <Text>{t('notSelfOnboarding.employmentEligibilityDescription')}</Text>\n </FlexItem>\n\n <FlexItem>\n <Text weight=\"medium\">{t('notSelfOnboarding.taxWithholdingLabel')}</Text>\n <Text>{t('notSelfOnboarding.taxWithholdingDescription')}</Text>\n </FlexItem>\n\n <FlexItem>\n <Text weight=\"medium\">{t('notSelfOnboarding.directDepositLabel')}</Text>\n <Text>{t('notSelfOnboarding.directDepositDescription')}</Text>\n </FlexItem>\n\n <Alert status=\"info\" label={t('notSelfOnboarding.alertTitle')} disableScrollIntoView></Alert>\n </Flex>\n )\n\n return (\n <>\n <Flex flexDirection=\"column\" gap={16}>\n {isEmployeeSelfOnboarding ? renderSelfOnboarding() : renderNotSelfOnboarding()}\n\n <Flex justifyContent=\"flex-end\" gap={12}>\n {isEmployeeSelfOnboarding ? (\n <Button\n variant=\"primary\"\n type=\"submit\"\n form={EMPLOYEE_DOCUMENTS_FORM_ID}\n isLoading={isPending}\n >\n {t('continueCta')}\n </Button>\n ) : (\n <Button variant=\"primary\" onClick={onDone}>\n {t('continueCta')}\n </Button>\n )}\n </Flex>\n </Flex>\n </>\n )\n}\n"],"names":["EMPLOYEE_DOCUMENTS_FORM_ID","EmployeeDocumentsSchema","z","EmployeeDocumentsPresentation","isEmployeeSelfOnboarding","currentI9Status","onSubmit","onDone","isPending","useI18n","t","useTranslation","Alert","Heading","Text","Button","Link","UnorderedList","useComponentContext","formMethods","useForm","zodResolver","includeI9","jsxs","Flex","jsx","FormProvider","Form","FlexItem","CheckboxField","Trans"],"mappings":"
|
|
1
|
+
{"version":3,"file":"EmployeeDocumentsPresentation.js","sources":["../../../../src/components/Employee/EmployeeDocuments/EmployeeDocumentsPresentation.tsx"],"sourcesContent":["import { Trans, useTranslation } from 'react-i18next'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { z } from 'zod'\nimport { Flex, CheckboxField, FlexItem } from '@/components/Common'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\n\nconst EMPLOYEE_DOCUMENTS_FORM_ID = 'gusto-sdk-employee-documents-form'\n\nconst EmployeeDocumentsSchema = z.object({\n includeI9: z.boolean(),\n})\n\nexport type EmployeeDocumentsFormValues = z.infer<typeof EmployeeDocumentsSchema>\n\nexport interface EmployeeDocumentsPresentationProps {\n isEmployeeSelfOnboarding: boolean\n currentI9Status: boolean\n onSubmit: (formData: EmployeeDocumentsFormValues) => Promise<void>\n onDone: () => void\n isPending: boolean\n}\n\nexport const EmployeeDocumentsPresentation = ({\n isEmployeeSelfOnboarding,\n currentI9Status,\n onSubmit,\n onDone,\n isPending,\n}: EmployeeDocumentsPresentationProps) => {\n useI18n('Employee.EmployeeDocuments')\n const { t } = useTranslation('Employee.EmployeeDocuments')\n const { Alert, Heading, Text, Button, Link, UnorderedList } = useComponentContext()\n\n const formMethods = useForm<EmployeeDocumentsFormValues>({\n resolver: zodResolver(EmployeeDocumentsSchema),\n defaultValues: {\n includeI9: currentI9Status,\n },\n })\n\n const includeI9 = formMethods.watch('includeI9')\n\n const renderSelfOnboarding = () => (\n <FormProvider {...formMethods}>\n <Form id={EMPLOYEE_DOCUMENTS_FORM_ID} onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={16}>\n <FlexItem>\n <Heading as=\"h2\">{t('selfOnboarding.title')}</Heading>\n <Text variant=\"supporting\">{t('selfOnboarding.description')}</Text>\n </FlexItem>\n\n <Heading as=\"h3\">{t('selfOnboarding.documentsIncludedLabel')}</Heading>\n <FlexItem>\n <Text weight=\"medium\">{t('selfOnboarding.taxWithholdingLabel')}</Text>\n <Text variant=\"supporting\">{t('selfOnboarding.taxWithholdingDescription')}</Text>\n </FlexItem>\n <FlexItem>\n <Text weight=\"medium\">{t('selfOnboarding.directDepositLabel')}</Text>\n <Text variant=\"supporting\">{t('selfOnboarding.directDepositDescription')}</Text>\n </FlexItem>\n\n <Heading as=\"h3\">{t('selfOnboarding.includeI9Heading')}</Heading>\n <CheckboxField\n name=\"includeI9\"\n label={t('selfOnboarding.includeI9Label')}\n description={t('selfOnboarding.includeI9Description')}\n />\n\n {includeI9 ? (\n <Alert status=\"warning\" label={t('selfOnboarding.alerts.includedTitle')}>\n <UnorderedList\n items={[\n <Trans\n key=\"included-description-1\"\n i18nKey={'selfOnboarding.alerts.includedDescription'}\n t={t}\n components={{\n Link: <Link />,\n }}\n />,\n <span key=\"included-description-2\">\n {t('selfOnboarding.alerts.includedDescription2')}\n </span>,\n ]}\n />\n </Alert>\n ) : (\n <Alert status=\"info\" label={t('selfOnboarding.alerts.notIncludedTitle')}>\n <Trans\n i18nKey={'selfOnboarding.alerts.notIncludedDescription'}\n t={t}\n components={{\n Link: <Link />,\n }}\n />\n </Alert>\n )}\n </Flex>\n </Form>\n </FormProvider>\n )\n\n const renderNotSelfOnboarding = () => (\n <Flex flexDirection=\"column\" gap={16}>\n <FlexItem>\n <Heading as=\"h2\">{t('notSelfOnboarding.title')}</Heading>\n <Text>{t('notSelfOnboarding.description')}</Text>\n </FlexItem>\n\n <FlexItem>\n <Text weight=\"medium\">{t('notSelfOnboarding.employmentEligibilityLabel')}</Text>\n <Text>{t('notSelfOnboarding.employmentEligibilityDescription')}</Text>\n </FlexItem>\n\n <FlexItem>\n <Text weight=\"medium\">{t('notSelfOnboarding.taxWithholdingLabel')}</Text>\n <Text>{t('notSelfOnboarding.taxWithholdingDescription')}</Text>\n </FlexItem>\n\n <FlexItem>\n <Text weight=\"medium\">{t('notSelfOnboarding.directDepositLabel')}</Text>\n <Text>{t('notSelfOnboarding.directDepositDescription')}</Text>\n </FlexItem>\n\n <Alert status=\"info\" label={t('notSelfOnboarding.alertTitle')} disableScrollIntoView></Alert>\n </Flex>\n )\n\n return (\n <>\n <Flex flexDirection=\"column\" gap={16}>\n {isEmployeeSelfOnboarding ? renderSelfOnboarding() : renderNotSelfOnboarding()}\n\n <Flex justifyContent=\"flex-end\" gap={12}>\n {isEmployeeSelfOnboarding ? (\n <Button\n variant=\"primary\"\n type=\"submit\"\n form={EMPLOYEE_DOCUMENTS_FORM_ID}\n isLoading={isPending}\n >\n {t('continueCta')}\n </Button>\n ) : (\n <Button variant=\"primary\" onClick={onDone}>\n {t('continueCta')}\n </Button>\n )}\n </Flex>\n </Flex>\n </>\n )\n}\n"],"names":["EMPLOYEE_DOCUMENTS_FORM_ID","EmployeeDocumentsSchema","z","EmployeeDocumentsPresentation","isEmployeeSelfOnboarding","currentI9Status","onSubmit","onDone","isPending","useI18n","t","useTranslation","Alert","Heading","Text","Button","Link","UnorderedList","useComponentContext","formMethods","useForm","zodResolver","includeI9","jsxs","Flex","jsx","FormProvider","Form","FlexItem","CheckboxField","Trans"],"mappings":";;;;;;;;;;;;AASA,MAAMA,IAA6B,qCAE7BC,IAA0BC,EAAE,OAAO;AAAA,EACvC,WAAWA,EAAE,QAAA;AACf,CAAC,GAYYC,IAAgC,CAAC;AAAA,EAC5C,0BAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,WAAAC;AACF,MAA0C;AACxC,EAAAC,EAAQ,4BAA4B;AACpC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,4BAA4B,GACnD,EAAE,OAAAC,GAAO,SAAAC,GAAS,MAAAC,GAAM,QAAAC,GAAQ,MAAAC,GAAM,eAAAC,EAAA,IAAkBC,EAAA,GAExDC,IAAcC,EAAqC;AAAA,IACvD,UAAUC,EAAYpB,CAAuB;AAAA,IAC7C,eAAe;AAAA,MACb,WAAWI;AAAA,IAAA;AAAA,EACb,CACD,GAEKiB,IAAYH,EAAY,MAAM,WAAW;AAwF/C,gCAEI,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AuC,GAAE;AAAA,QAClE,gBAAAe,EAACX,GAAA,EAAM,UAAAJ,EAAE,6CAA6C,EAAA,CAAE;AAAA,MAAA,GAC1D;AAAA,wBAECkB,GAAA,EACC,UAAA;AAAA,QAAA,gBAAAH,EAACX,GAAA,EAAK,QAAO,UAAU,UAAAJ,EAAE,sCAAsC,GAAE;AAAA,QACjE,gBAAAe,EAACX,GAAA,EAAM,UAAAJ,EAAE,4CAA4C,EAAA,CAAE;AAAA,MAAA,GACzD;AAAA,MAEA,gBAAAe,EAACb,KAAM,QAAO,QAAO,OAAOF,EAAE,8BAA8B,GAAG,uBAAqB,GAAA,CAAC;AAAA,IAAA,GACvF;AAAA,sBAQKc,GAAA,EAAK,gBAAe,YAAW,KAAK,IAClC,UAAApB,IACC,gBAAAqB;AAAA,MAACV;AAAA,MAAA;AAAA,QACC,SAAQ;AAAA,QACR,MAAK;AAAA,QACL,MAAMf;AAAA,QACN,WAAWQ;AAAA,QAEV,YAAE,aAAa;AAAA,MAAA;AAAA,IAAA,IAGlB,gBAAAiB,EAACV,GAAA,EAAO,SAAQ,WAAU,SAASR,GAChC,UAAAG,EAAE,aAAa,EAAA,CAClB,EAAA,CAEJ;AAAA,EAAA,EAAA,CACF,EAAA,CACF;AAEJ;"}
|
|
@@ -8,13 +8,12 @@ import { Actions as C } from "./Actions.js";
|
|
|
8
8
|
import { BaseComponent as Y } from "../../Base/Base.js";
|
|
9
9
|
import { useBase as F } from "../../Base/useBase.js";
|
|
10
10
|
import { Flex as U } from "../../Common/Flex/Flex.js";
|
|
11
|
-
import "classnames";
|
|
12
|
-
import { componentEvents as s, EmployeeOnboardingStatus as m } from "../../../shared/constants.js";
|
|
13
11
|
import { Loading as W } from "../../Common/Loading/Loading.js";
|
|
14
12
|
import "react-i18next";
|
|
15
13
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
16
14
|
import "react";
|
|
17
15
|
import { useI18n as q, useComponentDictionary as j } from "../../../i18n/I18n.js";
|
|
16
|
+
import { componentEvents as s, EmployeeOnboardingStatus as m } from "../../../shared/constants.js";
|
|
18
17
|
import { Head as k } from "./Head.js";
|
|
19
18
|
import { List as H } from "./List.js";
|
|
20
19
|
import { useFlow as V } from "../../Flow/useFlow.js";
|
|
@@ -93,12 +92,12 @@ function K({ companyId: n, className: r, children: E, dictionary: u }) {
|
|
|
93
92
|
}
|
|
94
93
|
) });
|
|
95
94
|
}
|
|
96
|
-
const
|
|
95
|
+
const fe = () => {
|
|
97
96
|
const { companyId: n, onEvent: r } = V();
|
|
98
97
|
return /* @__PURE__ */ o(J, { companyId: n, onEvent: r });
|
|
99
98
|
};
|
|
100
99
|
export {
|
|
101
100
|
J as EmployeeList,
|
|
102
|
-
|
|
101
|
+
fe as EmployeeListContextual
|
|
103
102
|
};
|
|
104
103
|
//# sourceMappingURL=EmployeeList.js.map
|