@gusto/embedded-react-sdk 0.51.0 → 0.51.2
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 +18 -0
- package/dist/components/Base/useBaseSubmit.js +4 -4
- package/dist/components/Base/useBaseSubmit.js.map +1 -1
- package/dist/components/Common/DocumentList/DocumentList.d.ts +8 -1
- package/dist/components/Common/DocumentList/DocumentList.js +24 -21
- package/dist/components/Common/DocumentList/DocumentList.js.map +1 -1
- package/dist/components/Common/OnboardingStatusBadge/index.d.ts +2 -2
- package/dist/components/Common/OnboardingStatusBadge/index.js.map +1 -1
- package/dist/components/Common/TaxInputs/TaxInputs.d.ts +2 -2
- package/dist/components/Common/TaxInputs/TaxInputs.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +5 -5
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.d.ts +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +9 -8
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +3 -3
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.d.ts +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +9 -8
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +11 -10
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccount.js +1 -1
- package/dist/components/Company/BankAccount/BankAccount.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountComponents.d.ts +1 -1
- package/dist/components/Company/BankAccount/BankAccountComponents.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +9 -8
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/BankAccountList.js +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/BankAccountList.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/context.d.ts +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/context.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/BankAccountVerify.js +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/BankAccountVerify.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +2 -2
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.d.ts +2 -2
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +9 -8
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentSigner.js +1 -1
- package/dist/components/Company/DocumentSigner/DocumentSigner.js.map +1 -1
- package/dist/components/Company/DocumentSigner/documentSignerStateMachine.d.ts +2 -2
- package/dist/components/Company/DocumentSigner/documentSignerStateMachine.js.map +1 -1
- package/dist/components/Company/DocumentSigner/shared/useSignCompanyForm/useSignCompanyForm.d.ts +1 -1
- package/dist/components/Company/DocumentSigner/shared/useSignCompanyForm/useSignCompanyForm.js +3 -3
- package/dist/components/Company/DocumentSigner/shared/useSignCompanyForm/useSignCompanyForm.js.map +1 -1
- package/dist/components/Company/FederalTaxes/FederalTaxes.js +2 -2
- package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
- package/dist/components/Company/FederalTaxes/Form.js +1 -1
- package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.d.ts +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +12 -11
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +12 -11
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Industry/Industry.js +2 -2
- package/dist/components/Company/Industry/Industry.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Actions.js +7 -7
- package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/LocationForm.js +46 -45
- package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +9 -8
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/LocationsList.js +1 -1
- package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.d.ts +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +9 -8
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +1 -1
- package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.d.ts +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +9 -8
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/PaySchedule.js +1 -1
- package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
- package/dist/components/Company/PaySchedule/PayScheduleList.js +1 -1
- package/dist/components/Company/PaySchedule/PayScheduleList.js.map +1 -1
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.d.ts +2 -2
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.js +6 -6
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +3 -3
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +2 -2
- package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/applicableIf.d.ts +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/applicableIf.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.d.ts +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +9 -8
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.js +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.d.ts +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +9 -8
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Contractor/Address/shared/useContractorAddressForm/useContractorAddressForm.d.ts +2 -2
- package/dist/components/Contractor/Address/shared/useContractorAddressForm/useContractorAddressForm.js +3 -3
- package/dist/components/Contractor/Address/shared/useContractorAddressForm/useContractorAddressForm.js.map +1 -1
- package/dist/components/Contractor/ContractorList/index.js +1 -1
- package/dist/components/Contractor/ContractorList/index.js.map +1 -1
- package/dist/components/Contractor/ContractorList/useContractorList.d.ts +1 -1
- package/dist/components/Contractor/ContractorList/useContractorList.js +1 -1
- package/dist/components/Contractor/ContractorList/useContractorList.js.map +1 -1
- package/dist/components/Contractor/Documents/DocumentSigner/documentSignerStateMachine.d.ts +1 -1
- package/dist/components/Contractor/Documents/DocumentSigner/documentSignerStateMachine.js.map +1 -1
- package/dist/components/Contractor/Documents/DocumentsList/DocumentsList.d.ts +3 -1
- package/dist/components/Contractor/Documents/DocumentsList/DocumentsList.js +64 -51
- package/dist/components/Contractor/Documents/DocumentsList/DocumentsList.js.map +1 -1
- package/dist/components/Contractor/Documents/DocumentsList/useContractorDocumentsList/useContractorDocumentsList.d.ts +1 -1
- package/dist/components/Contractor/Documents/DocumentsList/useContractorDocumentsList/useContractorDocumentsList.js +1 -1
- package/dist/components/Contractor/Documents/DocumentsList/useContractorDocumentsList/useContractorDocumentsList.js.map +1 -1
- package/dist/components/Contractor/Documents/SignatureForm/SignatureForm.js +201 -161
- package/dist/components/Contractor/Documents/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/useContractorSignatureForm.d.ts +2 -2
- package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/useContractorSignatureForm.js +3 -3
- package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/useContractorSignatureForm.js.map +1 -1
- package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/w9Fields.d.ts +1 -1
- package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/w9Fields.js +55 -54
- package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/w9Fields.js.map +1 -1
- package/dist/components/Contractor/Landing/Landing.js +2 -2
- package/dist/components/Contractor/Landing/Landing.js.map +1 -1
- package/dist/components/Contractor/NewHireReport/NewHireReport.js +2 -2
- package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/shared/useContractorBankAccountForm/useContractorBankAccountForm.d.ts +1 -1
- package/dist/components/Contractor/PaymentMethod/shared/useContractorBankAccountForm/useContractorBankAccountForm.js +2 -2
- package/dist/components/Contractor/PaymentMethod/shared/useContractorBankAccountForm/useContractorBankAccountForm.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/shared/useContractorPaymentMethodForm/useContractorPaymentMethodForm.d.ts +1 -1
- package/dist/components/Contractor/PaymentMethod/shared/useContractorPaymentMethodForm/useContractorPaymentMethodForm.js +2 -2
- package/dist/components/Contractor/PaymentMethod/shared/useContractorPaymentMethodForm/useContractorPaymentMethodForm.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js +5 -5
- package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.d.ts +2 -2
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.d.ts +2 -2
- package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/GenericBlocker.d.ts +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/GenericBlocker.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.d.ts +4 -4
- package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/helpers.d.ts +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/helpers.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.js +3 -3
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.d.ts +2 -2
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.js +4 -4
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.d.ts +3 -3
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummary.js +3 -3
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummary.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.d.ts +3 -3
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js +3 -3
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.d.ts +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -1
- package/dist/components/Contractor/Profile/SelfOnboardingContractorProfile.js +1 -1
- package/dist/components/Contractor/Profile/SelfOnboardingContractorProfile.js.map +1 -1
- package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/contractorDetailsSchema.js +1 -1
- package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/contractorDetailsSchema.js.map +1 -1
- package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/useContractorDetailsForm.d.ts +1 -1
- package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/useContractorDetailsForm.js +3 -3
- package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/useContractorDetailsForm.js.map +1 -1
- package/dist/components/Contractor/Submit/Submit.js +3 -3
- package/dist/components/Contractor/Submit/Submit.js.map +1 -1
- package/dist/components/Employee/Compensation/management/CompensationCard/CompensationCard.js +1 -1
- package/dist/components/Employee/Compensation/management/CompensationCard/CompensationCard.js.map +1 -1
- package/dist/components/Employee/Compensation/management/CompensationEditForm/CompensationEditForm.js +1 -1
- package/dist/components/Employee/Compensation/management/CompensationEditForm/CompensationEditForm.js.map +1 -1
- package/dist/components/Employee/Compensation/management/CompensationEditJobForm/CompensationEditJobForm.js +1 -1
- package/dist/components/Employee/Compensation/management/CompensationEditJobForm/CompensationEditJobForm.js.map +1 -1
- package/dist/components/Employee/Compensation/management/ManagementCompensationFormBody.js.map +1 -1
- package/dist/components/Employee/Compensation/onboarding/Compensation.d.ts +2 -2
- package/dist/components/Employee/Compensation/onboarding/Compensation.js +1 -1
- package/dist/components/Employee/Compensation/onboarding/Compensation.js.map +1 -1
- package/dist/components/Employee/Compensation/onboarding/CompensationFlowComponents.d.ts +2 -2
- package/dist/components/Employee/Compensation/onboarding/CompensationFlowComponents.js.map +1 -1
- package/dist/components/Employee/Compensation/onboarding/JobsList/JobsList.js +2 -2
- package/dist/components/Employee/Compensation/onboarding/JobsList/JobsList.js.map +1 -1
- package/dist/components/Employee/Compensation/onboarding/JobsList/JobsListPresentation.d.ts +1 -1
- package/dist/components/Employee/Compensation/onboarding/JobsList/JobsListPresentation.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/AddCompensationFormBody.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/derivePrimaryFlsaStatus.d.ts +1 -1
- package/dist/components/Employee/Compensation/shared/derivePrimaryFlsaStatus.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/getPendingCompensationChanges.d.ts +2 -2
- package/dist/components/Employee/Compensation/shared/getPendingCompensationChanges.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/useCompensationForm/fields.d.ts +3 -3
- package/dist/components/Employee/Compensation/shared/useCompensationForm/fields.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/useCompensationForm/useCompensationForm.d.ts +4 -4
- package/dist/components/Employee/Compensation/shared/useCompensationForm/useCompensationForm.js +7 -7
- package/dist/components/Employee/Compensation/shared/useCompensationForm/useCompensationForm.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/useCompensationManagement/useCompensationManagement.d.ts +1 -1
- package/dist/components/Employee/Compensation/shared/useCompensationManagement/useCompensationManagement.js +4 -4
- package/dist/components/Employee/Compensation/shared/useCompensationManagement/useCompensationManagement.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.d.ts +3 -3
- package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.js +7 -7
- package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.js.map +1 -1
- package/dist/components/Employee/Dashboard/Dashboard.js +1 -1
- package/dist/components/Employee/Dashboard/Dashboard.js.map +1 -1
- package/dist/components/Employee/Dashboard/dashboardStateMachine.js.map +1 -1
- package/dist/components/Employee/Deductions/management/DeductionsCard/DeductionsCard.js.map +1 -1
- package/dist/components/Employee/Deductions/management/deductionsStateMachine.js.map +1 -1
- package/dist/components/Employee/Deductions/onboarding/DeductionsList/DeductionsList.d.ts +1 -1
- package/dist/components/Employee/Deductions/onboarding/DeductionsList/DeductionsList.js.map +1 -1
- package/dist/components/Employee/Deductions/onboarding/deductionsContextualComponents.d.ts +1 -1
- package/dist/components/Employee/Deductions/onboarding/deductionsContextualComponents.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/DeductionsForm/ChildSupportFormView.d.ts +1 -1
- package/dist/components/Employee/Deductions/shared/DeductionsForm/ChildSupportFormView.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/DeductionsForm/DeductionsForm.d.ts +1 -1
- package/dist/components/Employee/Deductions/shared/DeductionsForm/DeductionsForm.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/DeductionsForm/StandardDeductionForm.d.ts +1 -1
- package/dist/components/Employee/Deductions/shared/DeductionsForm/StandardDeductionForm.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/DeleteDeductionDialog.d.ts +1 -1
- package/dist/components/Employee/Deductions/shared/DeleteDeductionDialog.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/formatDeductionAmount.d.ts +1 -1
- package/dist/components/Employee/Deductions/shared/formatDeductionAmount.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/childSupportGarnishmentFormSchema.d.ts +1 -1
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/childSupportGarnishmentFormSchema.js +1 -1
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/childSupportGarnishmentFormSchema.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/fields.d.ts +1 -1
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/fields.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/useChildSupportGarnishmentForm.d.ts +2 -2
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/useChildSupportGarnishmentForm.js +5 -5
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/useChildSupportGarnishmentForm.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/useDeductionForm/deductionFormSchema.js +1 -1
- package/dist/components/Employee/Deductions/shared/useDeductionForm/deductionFormSchema.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/useDeductionForm/fields.d.ts +1 -1
- package/dist/components/Employee/Deductions/shared/useDeductionForm/fields.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/useDeductionForm/useDeductionForm.d.ts +1 -1
- package/dist/components/Employee/Deductions/shared/useDeductionForm/useDeductionForm.js +3 -3
- package/dist/components/Employee/Deductions/shared/useDeductionForm/useDeductionForm.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/useDeductionsList.d.ts +1 -1
- package/dist/components/Employee/Deductions/shared/useDeductionsList.js +2 -2
- package/dist/components/Employee/Deductions/shared/useDeductionsList.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/useDeleteDeduction.d.ts +1 -1
- package/dist/components/Employee/Deductions/shared/useDeleteDeduction.js.map +1 -1
- package/dist/components/Employee/Documents/management/DocumentManager.js +2 -2
- package/dist/components/Employee/Documents/management/DocumentManager.js.map +1 -1
- package/dist/components/Employee/Documents/management/DocumentsCard/DocumentsCard.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/DocumentList.js +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.d.ts +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +9 -8
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentSigner.js +2 -2
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentSigner.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibility.js +3 -3
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibility.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.js +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/I9SignatureForm/I9SignatureForm.js +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/I9SignatureForm/I9SignatureForm.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/documentSignerStateMachine.d.ts +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/documentSignerStateMachine.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/EmployeeDocuments/EmployeeDocuments.js +2 -2
- package/dist/components/Employee/Documents/onboarding/EmployeeDocuments/EmployeeDocuments.js.map +1 -1
- package/dist/components/Employee/Documents/shared/useDocumentsList/useDocumentsList.d.ts +1 -1
- package/dist/components/Employee/Documents/shared/useDocumentsList/useDocumentsList.js +1 -1
- package/dist/components/Employee/Documents/shared/useDocumentsList/useDocumentsList.js.map +1 -1
- package/dist/components/Employee/Documents/shared/useSignEmployeeForm/useSignEmployeeForm.d.ts +1 -1
- package/dist/components/Employee/Documents/shared/useSignEmployeeForm/useSignEmployeeForm.js +3 -3
- package/dist/components/Employee/Documents/shared/useSignEmployeeForm/useSignEmployeeForm.js.map +1 -1
- package/dist/components/Employee/EmployeeList/onboarding/EmployeeList.js.map +1 -1
- package/dist/components/Employee/EmployeeList/onboarding/EmployeeListView.d.ts +1 -1
- package/dist/components/Employee/EmployeeList/onboarding/EmployeeListView.js.map +1 -1
- package/dist/components/Employee/EmployeeList/shared/useEmployeeList.d.ts +3 -3
- package/dist/components/Employee/EmployeeList/shared/useEmployeeList.js +3 -3
- package/dist/components/Employee/EmployeeList/shared/useEmployeeList.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/shared/useFederalTaxesForm/federalTaxesSchema.js +1 -1
- package/dist/components/Employee/FederalTaxes/shared/useFederalTaxesForm/federalTaxesSchema.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/shared/useFederalTaxesForm/useFederalTaxesForm.d.ts +1 -1
- package/dist/components/Employee/FederalTaxes/shared/useFederalTaxesForm/useFederalTaxesForm.js +2 -2
- package/dist/components/Employee/FederalTaxes/shared/useFederalTaxesForm/useFederalTaxesForm.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/shared/useFederalTaxesSummary/useFederalTaxesSummary.d.ts +1 -1
- package/dist/components/Employee/FederalTaxes/shared/useFederalTaxesSummary/useFederalTaxesSummary.js +1 -1
- package/dist/components/Employee/FederalTaxes/shared/useFederalTaxesSummary/useFederalTaxesSummary.js.map +1 -1
- package/dist/components/Employee/HomeAddress/management/HomeAddressEditForm.js.map +1 -1
- package/dist/components/Employee/HomeAddress/management/HomeAddressView.d.ts +1 -1
- package/dist/components/Employee/HomeAddress/management/HomeAddressView.js.map +1 -1
- package/dist/components/Employee/HomeAddress/management/getPendingFutureHomeAddress.d.ts +1 -1
- package/dist/components/Employee/HomeAddress/management/getPendingFutureHomeAddress.js.map +1 -1
- package/dist/components/Employee/HomeAddress/management/useHomeAddressManagement.d.ts +1 -1
- package/dist/components/Employee/HomeAddress/management/useHomeAddressManagement.js +3 -3
- package/dist/components/Employee/HomeAddress/management/useHomeAddressManagement.js.map +1 -1
- package/dist/components/Employee/HomeAddress/shared/useHomeAddressSummary/useHomeAddressSummary.d.ts +1 -1
- package/dist/components/Employee/HomeAddress/shared/useHomeAddressSummary/useHomeAddressSummary.js +1 -1
- package/dist/components/Employee/HomeAddress/shared/useHomeAddressSummary/useHomeAddressSummary.js.map +1 -1
- package/dist/components/Employee/Landing/Landing.js +2 -2
- package/dist/components/Employee/Landing/Landing.js.map +1 -1
- package/dist/components/Employee/OnboardingExecutionFlow/OnboardingExecutionFlowComponents.d.ts +1 -1
- package/dist/components/Employee/OnboardingExecutionFlow/OnboardingExecutionFlowComponents.js.map +1 -1
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +2 -2
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/shared/BankFormBody/BankFormBody.d.ts +1 -1
- package/dist/components/Employee/PaymentMethod/shared/BankFormBody/BankFormBody.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/shared/SplitPaymentsFormBody/SplitPaymentsFormBody.d.ts +1 -1
- package/dist/components/Employee/PaymentMethod/shared/SplitPaymentsFormBody/SplitPaymentsFormBody.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/shared/useBankForm/useBankForm.d.ts +1 -1
- package/dist/components/Employee/PaymentMethod/shared/useBankForm/useBankForm.js +1 -1
- package/dist/components/Employee/PaymentMethod/shared/useBankForm/useBankForm.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/shared/usePaymentMethodForm/usePaymentMethodForm.d.ts +1 -1
- package/dist/components/Employee/PaymentMethod/shared/usePaymentMethodForm/usePaymentMethodForm.js +2 -2
- package/dist/components/Employee/PaymentMethod/shared/usePaymentMethodForm/usePaymentMethodForm.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/shared/usePaymentMethodList.d.ts +2 -2
- package/dist/components/Employee/PaymentMethod/shared/usePaymentMethodList.js +4 -4
- package/dist/components/Employee/PaymentMethod/shared/usePaymentMethodList.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/useSplitPaymentsForm.d.ts +2 -2
- package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/useSplitPaymentsForm.js +3 -3
- package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/useSplitPaymentsForm.js.map +1 -1
- package/dist/components/Employee/Paystubs/shared/usePaystubsList/usePaystubsList.d.ts +1 -1
- package/dist/components/Employee/Paystubs/shared/usePaystubsList/usePaystubsList.js +3 -3
- package/dist/components/Employee/Paystubs/shared/usePaystubsList/usePaystubsList.js.map +1 -1
- package/dist/components/Employee/Profile/onboarding/AdminProfile.js.map +1 -1
- package/dist/components/Employee/Profile/onboarding/EmployeeProfile.js +1 -1
- package/dist/components/Employee/Profile/onboarding/EmployeeProfile.js.map +1 -1
- package/dist/components/Employee/Profile/shared/useEmployeeDetailsForm/useEmployeeDetailsForm.d.ts +1 -1
- package/dist/components/Employee/Profile/shared/useEmployeeDetailsForm/useEmployeeDetailsForm.js +5 -5
- package/dist/components/Employee/Profile/shared/useEmployeeDetailsForm/useEmployeeDetailsForm.js.map +1 -1
- package/dist/components/Employee/Profile/shared/useEmployeeProfileSummary/useEmployeeProfileSummary.d.ts +1 -1
- package/dist/components/Employee/Profile/shared/useEmployeeProfileSummary/useEmployeeProfileSummary.js +1 -1
- package/dist/components/Employee/Profile/shared/useEmployeeProfileSummary/useEmployeeProfileSummary.js.map +1 -1
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/useCurrentHomeAddressForm.js +1 -1
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/useCurrentHomeAddressForm.js.map +1 -1
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/useHomeAddressForm.d.ts +1 -1
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/useHomeAddressForm.js +4 -4
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/useHomeAddressForm.js.map +1 -1
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/fields.d.ts +1 -1
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/fields.js.map +1 -1
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/useCurrentWorkAddressForm.js +1 -1
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/useCurrentWorkAddressForm.js.map +1 -1
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/useWorkAddressForm.d.ts +2 -2
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/useWorkAddressForm.js +5 -5
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/useWorkAddressForm.js.map +1 -1
- package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingComponents.d.ts +1 -1
- package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingComponents.js.map +1 -1
- package/dist/components/Employee/StateTaxes/management/StateTaxesCard/StateTaxesCard.js.map +1 -1
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/__fixtures__/stateTaxesFixtures.d.ts +1 -1
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/__fixtures__/toWireFormat.d.ts +1 -1
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/employeeStateTaxesSchema.d.ts +1 -1
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/employeeStateTaxesSchema.js.map +1 -1
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fieldMapping.d.ts +1 -1
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fieldMapping.js.map +1 -1
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fields.d.ts +1 -1
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fields.js.map +1 -1
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/useEmployeeStateTaxesForm.d.ts +1 -1
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/useEmployeeStateTaxesForm.js +2 -2
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/useEmployeeStateTaxesForm.js.map +1 -1
- package/dist/components/Employee/StateTaxes/shared/useStateTaxesSummary/useStateTaxesSummary.d.ts +1 -1
- package/dist/components/Employee/StateTaxes/shared/useStateTaxesSummary/useStateTaxesSummary.js +1 -1
- package/dist/components/Employee/StateTaxes/shared/useStateTaxesSummary/useStateTaxesSummary.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.js +9 -9
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.d.ts +1 -1
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummary.js +4 -4
- package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummary.js.map +1 -1
- package/dist/components/Employee/WorkAddress/management/WorkAddressEditForm.js.map +1 -1
- package/dist/components/Employee/WorkAddress/management/WorkAddressView.d.ts +1 -1
- package/dist/components/Employee/WorkAddress/management/WorkAddressView.js.map +1 -1
- package/dist/components/Employee/WorkAddress/management/getPendingFutureWorkAddress.d.ts +2 -2
- package/dist/components/Employee/WorkAddress/management/getPendingFutureWorkAddress.js.map +1 -1
- package/dist/components/Employee/WorkAddress/management/useWorkAddressManagement.d.ts +1 -1
- package/dist/components/Employee/WorkAddress/management/useWorkAddressManagement.js +3 -3
- package/dist/components/Employee/WorkAddress/management/useWorkAddressManagement.js.map +1 -1
- package/dist/components/Employee/WorkAddress/shared/useEmployeeWorkAddressSummary/useEmployeeWorkAddressSummary.d.ts +1 -1
- package/dist/components/Employee/WorkAddress/shared/useEmployeeWorkAddressSummary/useEmployeeWorkAddressSummary.js +1 -1
- package/dist/components/Employee/WorkAddress/shared/useEmployeeWorkAddressSummary/useEmployeeWorkAddressSummary.js.map +1 -1
- package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js +4 -4
- package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js.map +1 -1
- package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js +2 -2
- package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.js +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.js +2 -2
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +3 -3
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/WireInstructions/WireInstructions.js +2 -2
- package/dist/components/Payroll/ConfirmWireDetails/WireInstructions/WireInstructions.js.map +1 -1
- package/dist/components/Payroll/Dismissal/DismissalFlowComponents.js +1 -1
- package/dist/components/Payroll/Dismissal/DismissalFlowComponents.js.map +1 -1
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.js +4 -4
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.js.map +1 -1
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +8 -7
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
- package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js +1 -1
- package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js +4 -4
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -1
- package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js +1 -1
- package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js.map +1 -1
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes.d.ts +1 -1
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes.js +1 -1
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +4 -4
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/payrollHelpers.js +2 -2
- package/dist/components/Payroll/PayrollBlocker/payrollHelpers.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +7 -7
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +5 -5
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.d.ts +4 -4
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +5 -5
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +3 -3
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.d.ts +4 -4
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.d.ts +2 -2
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.d.ts +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollExecutionFlowContextual.js +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollExecutionFlowContextual.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.d.ts +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/TransitionFlowContextual.js +2 -2
- package/dist/components/Payroll/PayrollFlow/TransitionFlowContextual.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistory.js +4 -4
- package/dist/components/Payroll/PayrollHistory/PayrollHistory.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.d.ts +2 -2
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js +2 -2
- package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollList.js +8 -8
- package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.d.ts +3 -3
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +7 -7
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.d.ts +4 -4
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.d.ts +2 -2
- package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/GenericBlocker.d.ts +1 -1
- package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/GenericBlocker.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceipts.js +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceipts.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.d.ts +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollStatusBadges/payrollStatusConfig.d.ts +1 -1
- package/dist/components/Payroll/PayrollStatusBadges/payrollStatusConfig.js +2 -2
- package/dist/components/Payroll/PayrollStatusBadges/payrollStatusConfig.js.map +1 -1
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js +1 -1
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js.map +1 -1
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js +2 -2
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js.map +1 -1
- package/dist/components/Payroll/Transition/TransitionFlowComponents.js +1 -1
- package/dist/components/Payroll/Transition/TransitionFlowComponents.js.map +1 -1
- package/dist/components/Payroll/TransitionCreation/TransitionCreation.js +4 -4
- package/dist/components/Payroll/TransitionCreation/TransitionCreation.js.map +1 -1
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.js +3 -3
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.js.map +1 -1
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.d.ts +1 -1
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.js.map +1 -1
- package/dist/components/Payroll/helpers.d.ts +6 -6
- package/dist/components/Payroll/helpers.js +1 -1
- package/dist/components/Payroll/helpers.js.map +1 -1
- package/dist/components/Payroll/payrollTypes.js +1 -1
- package/dist/components/Payroll/payrollTypes.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.d.ts +2 -2
- package/dist/components/Payroll/usePreparedPayrollData.js +16 -15
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/components/Payroll/useUnprocessedTransitionPayPeriods.d.ts +1 -1
- package/dist/components/Payroll/useUnprocessedTransitionPayPeriods.js +3 -3
- package/dist/components/Payroll/useUnprocessedTransitionPayPeriods.js.map +1 -1
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetail.js +3 -3
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetail.js.map +1 -1
- package/dist/components/TimeOff/HolidaySelectionForm/HolidaySelectionForm.js +3 -3
- package/dist/components/TimeOff/HolidaySelectionForm/HolidaySelectionForm.js.map +1 -1
- package/dist/components/TimeOff/PolicyList/PolicyList.js +6 -6
- package/dist/components/TimeOff/PolicyList/PolicyList.js.map +1 -1
- package/dist/components/TimeOff/PolicySettings/PolicySettings.js +30 -29
- package/dist/components/TimeOff/PolicySettings/PolicySettings.js.map +1 -1
- package/dist/components/TimeOff/PolicyTypeSelector/PolicyTypeSelector.js +1 -1
- package/dist/components/TimeOff/PolicyTypeSelector/PolicyTypeSelector.js.map +1 -1
- package/dist/components/TimeOff/TimeOffFlow/timeOffPolicyTypes.d.ts +1 -1
- package/dist/components/TimeOff/TimeOffFlow/timeOffPolicyTypes.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationForm.js +27 -26
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationForm.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday.js +2 -2
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentationTypes.d.ts +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.js +69 -68
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/useSelectEmployeesData.js +3 -3
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/useSelectEmployeesData.js.map +1 -1
- package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetail.js +67 -66
- package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetail.js.map +1 -1
- package/dist/contexts/ApiProvider/ApiProvider.js +3 -3
- package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -1
- package/dist/contexts/ApiProvider/apiVersion.d.ts +23 -0
- package/dist/contexts/ApiProvider/apiVersion.js +6 -0
- package/dist/contexts/ApiProvider/apiVersion.js.map +1 -0
- package/dist/contexts/ApiProvider/apiVersionHook.js +3 -2
- package/dist/contexts/ApiProvider/apiVersionHook.js.map +1 -1
- package/dist/contexts/ApiProvider/createSdkQueryClient.d.ts +1 -1
- package/dist/contexts/ApiProvider/createSdkQueryClient.js +7 -6
- package/dist/contexts/ApiProvider/createSdkQueryClient.js.map +1 -1
- package/dist/helpers/apiErrorToList.d.ts +1 -1
- package/dist/helpers/apiErrorToList.js.map +1 -1
- package/dist/helpers/formattedStrings.d.ts +2 -2
- package/dist/helpers/formattedStrings.js.map +1 -1
- package/dist/hooks/useCompanyPaymentSpeed.d.ts +1 -1
- package/dist/hooks/useCompanyPaymentSpeed.js +1 -1
- package/dist/hooks/useCompanyPaymentSpeed.js.map +1 -1
- package/dist/i18n/en/Contractor.DocumentsList.json.js +20 -16
- package/dist/i18n/en/Contractor.DocumentsList.json.js.map +1 -1
- package/dist/i18n/types.d.ts +4 -0
- package/dist/models/external.d.ts +204 -204
- package/dist/shared/constants.d.ts +1 -1
- package/dist/shared/constants.js +2 -2
- package/dist/shared/constants.js.map +1 -1
- package/dist/types/hooks.d.ts +1 -1
- package/dist/types/sdkError.js +3 -3
- package/dist/types/sdkError.js.map +1 -1
- package/docs/guides/endpoint-inventory.json +1201 -297
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useJobForm.js","sources":["../../../../../../src/components/Employee/Compensation/shared/useJobForm/useJobForm.tsx"],"sourcesContent":["import type { ComponentType } from 'react'\nimport { useMemo, useState } from 'react'\nimport { useForm, useWatch } from 'react-hook-form'\nimport type { UseFormProps } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport type { Job } from '@gusto/embedded-api-v-2026-02-01/models/components/job'\nimport type { Employee } from '@gusto/embedded-api-v-2026-02-01/models/components/employee'\nimport type { EmployeeWorkAddress } from '@gusto/embedded-api-v-2026-02-01/models/components/employeeworkaddress'\nimport { useJobsAndCompensationsGetJobs } from '@gusto/embedded-api-v-2026-02-01/react-query/jobsAndCompensationsGetJobs'\nimport { useJobsAndCompensationsCreateJobMutation } from '@gusto/embedded-api-v-2026-02-01/react-query/jobsAndCompensationsCreateJob'\nimport { useJobsAndCompensationsUpdateMutation } from '@gusto/embedded-api-v-2026-02-01/react-query/jobsAndCompensationsUpdate'\nimport { useJobsAndCompensationsUpdateCompensationMutation } from '@gusto/embedded-api-v-2026-02-01/react-query/jobsAndCompensationsUpdateCompensation'\nimport { useEmployeeAddressesGetWorkAddresses } from '@gusto/embedded-api-v-2026-02-01/react-query/employeeAddressesGetWorkAddresses'\nimport { useEmployeesGet } from '@gusto/embedded-api-v-2026-02-01/react-query/employeesGet'\nimport { useFederalTaxDetailsGet } from '@gusto/embedded-api-v-2026-02-01/react-query/federalTaxDetailsGet'\nimport {\n createJobSchema,\n type JobOptionalFieldsToRequire,\n type JobFormData,\n type JobFormOutputs,\n} from './jobSchema'\nimport {\n JobTitleField,\n HireDateField,\n TwoPercentShareholderField,\n StateWcCoveredField,\n StateWcClassCodeField,\n} from './fields'\nimport type {\n JobTitleFieldProps,\n HireDateFieldProps,\n TwoPercentShareholderFieldProps,\n StateWcCoveredFieldProps,\n StateWcClassCodeFieldProps,\n} from './fields'\nimport { useDeriveFieldsMetadata } from '@/partner-hook-utils/form/useDeriveFieldsMetadata'\nimport { useHookFormInternals } from '@/partner-hook-utils/form/useHookFormInternals'\nimport { createGetFormSubmissionValues } from '@/partner-hook-utils/form/getFormSubmissionValues'\nimport { withOptions } from '@/partner-hook-utils/form/withOptions'\nimport { withFlags } from '@/partner-hook-utils/form/withFlags'\nimport { composeErrorHandler } from '@/partner-hook-utils/composeErrorHandler'\nimport type {\n BaseFormHookReady,\n FieldMetadata,\n FieldsMetadata,\n HookLoadingResult,\n HookSubmitResult,\n} from '@/partner-hook-utils/types'\nimport { useBaseSubmit } from '@/components/Base/useBaseSubmit'\nimport { SDKInternalError } from '@/types/sdkError'\nimport { WA_RISK_CLASS_CODES, type WARiskClassCode } from '@/models/WA_RISK_CODES'\n\n/**\n * Optional values supplied to {@link useJobForm}'s `actions.onSubmit` at submit time.\n *\n * @remarks\n * Use these when a value isn't sourced from a rendered field — typically\n * because the hook was configured with `withHireDateField: false`, or because\n * the employee being saved was created in the same submit chain and the\n * `employeeId` wasn't known at hook construction.\n *\n * @public\n */\nexport interface JobSubmitOptions {\n /** Override the `employeeId` configured at hook construction. Useful when the employee is created in the same submit chain. */\n employeeId?: string\n /**\n * Supply `hireDate` at submit time rather than via a rendered field. Use\n * with `withHireDateField: false` for screens that derive hireDate from\n * external context (e.g. the employee's `startDate` during onboarding).\n * Falls back to the loaded job's `hireDate` on update mode when omitted;\n * required (or sourced from a default) on create mode.\n */\n hireDate?: string\n}\n\n/**\n * Configuration options for {@link useJobForm}.\n *\n * @remarks\n * Presence or absence of `jobId` selects the API verb — see the `jobId` field\n * description. `employeeId` is optional so the hook can be composed alongside\n * an employee-creation step; supply it at submit time via\n * {@link JobSubmitOptions.employeeId} in that case.\n *\n * @public\n */\nexport interface UseJobFormProps {\n /** UUID of the employee whose job is being created or edited. May be omitted when the employee is created in the same submit chain — supply the value via {@link JobSubmitOptions.employeeId} at submit time. */\n employeeId?: string\n /** Present → update mode (PUT /v1/jobs/:id with `version`). Omitted → create mode (POST /v1/employees/:id/jobs). */\n jobId?: string\n /** Override fields that are optional on a given mode to be required. See {@link JobOptionalFieldsToRequire}. */\n optionalFieldsToRequire?: JobOptionalFieldsToRequire\n /** Pre-fill form values. Server data takes precedence on update mode. */\n defaultValues?: Partial<JobFormData>\n /** Passed through to react-hook-form. Defaults to `'onSubmit'`. */\n validationMode?: UseFormProps['mode']\n /** Auto-focus the first invalid field on submit. Set to `false` when using `composeSubmitHandler` so submit-time focus is coordinated across multiple forms. Defaults to `true`. */\n shouldFocusError?: boolean\n /**\n * When `false`, hides `Fields.HireDate` (becomes `undefined`) and removes\n * `hireDate` from schema validation. Supply the value via\n * {@link JobSubmitOptions.hireDate} at submit time, or rely on the loaded\n * job's existing value on update. Use this when the date is driven by\n * external context rather than user input (e.g. the employee's `startDate`).\n * Defaults to `true`.\n */\n withHireDateField?: boolean\n /**\n * When `false`, hides `Fields.Title` (becomes `undefined`), removes\n * `title` from schema validation, and skips sending `title` on PUT/POST.\n * Use this when another form owns the title field — e.g. compensation\n * edit surfaces render the title via `CompFields.Title` because title\n * lives on compensation in the API (`job.title` is just a denormalized\n * snapshot of the primary comp's title). Defaults to `true` so the\n * standalone job-creation flow still gathers a title for the create\n * body.\n */\n withTitleField?: boolean\n}\n\n/**\n * Pre-bound field components exposed on `useJobForm().form.Fields`.\n *\n * @remarks\n * Each property is either the field component or `undefined`. A field is\n * `undefined` when conditions for rendering it aren't met — see each member\n * for its visibility rule. Always null-check conditional fields (e.g.\n * `{Fields.TwoPercentShareholder && <Fields.TwoPercentShareholder ... />}`)\n * before rendering.\n *\n * @public\n */\nexport interface JobFormFields {\n /** Bound to `title`. Job title text input. `undefined` when `withTitleField: false`. */\n Title: ComponentType<JobTitleFieldProps> | undefined\n /** Bound to `hireDate`. Hire date picker. `undefined` when `withHireDateField: false`. */\n HireDate: ComponentType<HireDateFieldProps> | undefined\n /** Bound to `twoPercentShareholder`. S-Corp 2% shareholder checkbox. `undefined` when the company is not taxable as an S-Corp (see `data.showTwoPercentShareholder`). */\n TwoPercentShareholder: ComponentType<TwoPercentShareholderFieldProps> | undefined\n /** Bound to `stateWcCovered`. Washington state workers' compensation coverage radio group. `undefined` when the active work address is not in Washington (see `data.showStateWc`). */\n StateWcCovered: ComponentType<StateWcCoveredFieldProps> | undefined\n /** Bound to `stateWcClassCode`. Washington state workers' compensation risk class code select. `undefined` when the active work address is not in Washington or when `stateWcCovered` is `false`. */\n StateWcClassCode: ComponentType<StateWcClassCodeFieldProps> | undefined\n}\n\n/**\n * Ready-state shape returned by {@link useJobForm} once data has loaded.\n *\n * @remarks\n * Discriminated by `isLoading: false`. Extends\n * {@link BaseFormHookReady} with the job-specific `data`, `status`,\n * `actions`, and `form.Fields` shape.\n *\n * @public\n */\nexport interface UseJobFormReady extends BaseFormHookReady<\n JobFieldsMetadata,\n JobFormData,\n JobFormFields\n> {\n /** Job-specific data payload: the loaded job (if any), the employee's other jobs, the employee record, the active work address, and presentation flags for conditional fields. */\n data: {\n /** The job row loaded for update; `null` in create mode. */\n currentJob: Job | null\n /** All jobs for the employee, when employeeId is set. Useful for screen-level cross-checks across jobs. */\n jobs: Job[] | undefined\n /** The loaded employee record, or `null` when `employeeId` was omitted. */\n employee: Employee | null\n /** The employee's active work address, or `null` when none is set. */\n currentWorkAddress: EmployeeWorkAddress | null\n /** True when the company is taxable as an S-Corp; use this to decide whether to render `TwoPercentShareholder`. */\n showTwoPercentShareholder: boolean\n /**\n * True when the active work-address state is WA; use this to decide whether to render\n * `StateWcCovered`. `Fields.StateWcClassCode` is additionally gated on `stateWcCovered === true`,\n * so most callers only need to check `Fields.StateWcCovered` / `Fields.StateWcClassCode`\n * truthiness rather than this flag directly.\n */\n showStateWc: boolean\n }\n /** Submission state. `isPending` is `true` while any in-flight mutation (including the secondary-compensation correction block) hasn't settled. `mode` reflects whether the next submit will create or update. */\n status: { isPending: boolean; mode: 'create' | 'update' }\n /** Submit actions exposed by the hook. */\n actions: {\n /** Validates the form, runs the appropriate create/update mutation, and resolves to a {@link HookSubmitResult} containing the saved job. Resolves to `undefined` on validation failure or mutation error. */\n onSubmit: (options?: JobSubmitOptions) => Promise<HookSubmitResult<Job> | undefined>\n }\n}\n\nfunction findJob(jobs: Job[] | undefined, jobId: string | undefined): Job | null {\n if (!jobs || !jobId) return null\n return jobs.find(j => j.uuid === jobId) ?? null\n}\n\n/** @internal */\nfunction buildJobFieldsMetadata(\n base: Record<keyof JobFormData, FieldMetadata>,\n {\n showTwoPercentShareholder,\n showStateWc,\n }: { showTwoPercentShareholder: boolean; showStateWc: boolean },\n) {\n return {\n title: base.title,\n hireDate: base.hireDate,\n twoPercentShareholder: withFlags(base.twoPercentShareholder, {\n isDisabled: !showTwoPercentShareholder,\n }),\n stateWcCovered: withOptions<boolean>(\n withFlags(base.stateWcCovered, { isDisabled: !showStateWc }),\n [\n { label: 'Yes', value: 'true' },\n { label: 'No', value: 'false' },\n ],\n [true, false],\n ),\n stateWcClassCode: withOptions<WARiskClassCode>(\n withFlags(base.stateWcClassCode, { isDisabled: !showStateWc }),\n WA_RISK_CLASS_CODES.map(({ code, description }) => ({\n value: code,\n label: `${code}: ${description}`,\n })),\n WA_RISK_CLASS_CODES,\n ),\n } satisfies FieldsMetadata\n}\n\n/**\n * Headless hook for creating or updating an employee's job — title, hire date, S-Corp 2% shareholder flag, and Washington state workers' compensation fields.\n *\n * @remarks\n * Companion hook to `useCompensationForm`. Jobs and their compensations are\n * separate entities in the Gusto API and this hook focuses exclusively on\n * the job side. Presence of `jobId` selects the verb:\n *\n * | Hook config | Mode | API call |\n * | ----------- | ---- | -------- |\n * | `{ employeeId, jobId }` | update | `PUT /v1/jobs/:jobId` (with `version`) |\n * | `{ employeeId }` (no `jobId`) | create | `POST /v1/employees/:employeeId/jobs` |\n * | `{}` + submit `employeeId` | create | `POST /v1/employees/:options.employeeId/jobs` |\n *\n * Creating a job auto-creates a stub compensation. To update the stub in the\n * same flow, capture `currentCompensationUuid` (and the compensation's\n * `version` from `compensations[]`) from the create response and thread them\n * into `useCompensationForm.actions.onSubmit({ jobId, compensationId, compensationVersion })`.\n *\n * When the primary job's `hireDate` changes, secondary compensation effective\n * dates are corrected after the PUT; `isPending` stays `true` through that.\n *\n * @param input - {@link UseJobFormProps} — `employeeId`, `jobId` (toggle create/update), and configuration for required-field overrides, default values, and which fields the hook renders.\n * @returns A {@link HookLoadingResult} while data is loading, or a {@link UseJobFormReady} once ready.\n * @public\n *\n * @example\n * ```tsx\n * import { useJobForm, SDKFormProvider } from '@gusto/embedded-react-sdk'\n *\n * function JobForm({ employeeId }: { employeeId: string }) {\n * const job = useJobForm({ employeeId })\n * if (job.isLoading) return null\n *\n * const { Fields } = job.form\n * return (\n * <form onSubmit={e => { e.preventDefault(); job.actions.onSubmit() }}>\n * <SDKFormProvider formHookResult={job}>\n * {Fields.Title && <Fields.Title label=\"Job title\" />}\n * {Fields.HireDate && <Fields.HireDate label=\"Hire date\" />}\n * {Fields.TwoPercentShareholder && (\n * <Fields.TwoPercentShareholder label=\"2% S-Corp shareholder\" />\n * )}\n * </SDKFormProvider>\n * <button type=\"submit\" disabled={job.status.isPending}>Save</button>\n * </form>\n * )\n * }\n * ```\n */\nexport function useJobForm({\n employeeId,\n jobId,\n optionalFieldsToRequire,\n defaultValues: partnerDefaults,\n validationMode = 'onSubmit',\n shouldFocusError = true,\n withHireDateField = true,\n withTitleField = true,\n}: UseJobFormProps): HookLoadingResult | UseJobFormReady {\n const jobsQuery = useJobsAndCompensationsGetJobs(\n { employeeId: employeeId ?? '' },\n { enabled: !!employeeId },\n )\n const addressesQuery = useEmployeeAddressesGetWorkAddresses(\n { employeeId: employeeId ?? '' },\n { enabled: !!employeeId },\n )\n const employeeQuery = useEmployeesGet({ employeeId: employeeId ?? '' }, { enabled: !!employeeId })\n\n const employeeJobs = jobsQuery.data?.jobs\n const workAddresses = addressesQuery.data?.employeeWorkAddressesList\n const currentWorkAddress = workAddresses?.find(address => address.active) ?? null\n const employee = employeeQuery.data?.employee ?? null\n const companyUuid = employee?.companyUuid\n\n const taxQuery = useFederalTaxDetailsGet(\n { companyId: companyUuid ?? '' },\n { enabled: !!companyUuid },\n )\n const federalTaxDetails = taxQuery.data?.federalTaxDetails\n const showTwoPercentShareholder = federalTaxDetails?.taxableAsScorp === true\n const showStateWc = currentWorkAddress?.state === 'WA'\n\n const currentJob = useMemo(() => findJob(employeeJobs, jobId), [employeeJobs, jobId])\n const isCreateMode = !jobId\n const mode = isCreateMode ? 'create' : 'update'\n\n const [schema, metadataConfig] = useMemo(\n () => createJobSchema({ mode, optionalFieldsToRequire, withHireDateField, withTitleField }),\n [mode, optionalFieldsToRequire, withHireDateField, withTitleField],\n )\n\n const resolvedDefaults: JobFormData = useMemo(\n () => ({\n title: currentJob?.title ?? partnerDefaults?.title ?? '',\n hireDate: currentJob?.hireDate ?? partnerDefaults?.hireDate ?? null,\n twoPercentShareholder:\n currentJob?.twoPercentShareholder ?? partnerDefaults?.twoPercentShareholder ?? false,\n stateWcCovered: currentJob?.stateWcCovered ?? partnerDefaults?.stateWcCovered ?? false,\n stateWcClassCode: currentJob?.stateWcClassCode ?? partnerDefaults?.stateWcClassCode ?? '',\n }),\n [currentJob, partnerDefaults],\n )\n\n const formMethods = useForm<JobFormData, unknown, JobFormOutputs>({\n resolver: zodResolver(schema),\n mode: validationMode,\n shouldFocusError,\n defaultValues: resolvedDefaults,\n values: resolvedDefaults,\n resetOptions: { keepDirtyValues: true },\n })\n\n const watchedStateWcCovered = useWatch({ control: formMethods.control, name: 'stateWcCovered' })\n\n const createJobMutation = useJobsAndCompensationsCreateJobMutation()\n const updateJobMutation = useJobsAndCompensationsUpdateMutation()\n const updateSecondaryCompMutation = useJobsAndCompensationsUpdateCompensationMutation()\n // Tracks the post-primary-PUT corrective block (jobs refetch + parallel\n // secondary comp PUTs). No single mutation hook reports `isPending` for the\n // whole window — the refetch isn't a mutation, and `Promise.all` over one\n // mutation hook makes its `isPending` track the latest-settled call — so we\n // OR this in to keep the spinner solid through it.\n const [isCorrectingSecondaries, setIsCorrectingSecondaries] = useState(false)\n const isPending =\n createJobMutation.isPending ||\n updateJobMutation.isPending ||\n updateSecondaryCompMutation.isPending ||\n isCorrectingSecondaries\n\n const {\n baseSubmitHandler,\n error: submitError,\n setError: setSubmitError,\n } = useBaseSubmit('JobForm')\n\n const queriesForErrors = employeeId ? [jobsQuery, addressesQuery, employeeQuery, taxQuery] : []\n const errorHandling = composeErrorHandler(queriesForErrors, { submitError, setSubmitError })\n\n const baseMetadata = useDeriveFieldsMetadata(metadataConfig, formMethods.control)\n const fieldsMetadata = buildJobFieldsMetadata(baseMetadata, {\n showTwoPercentShareholder,\n showStateWc,\n })\n\n const onSubmit = async (\n options?: JobSubmitOptions,\n ): Promise<HookSubmitResult<Job> | undefined> => {\n let submitResult: HookSubmitResult<Job> | undefined\n\n await new Promise<void>(resolve => {\n void formMethods.handleSubmit(\n async (data: JobFormOutputs) => {\n await baseSubmitHandler(data, async payload => {\n const resolvedEmployeeId = options?.employeeId ?? employeeId\n if (!resolvedEmployeeId) {\n throw new SDKInternalError('employeeId is required to submit a job')\n }\n\n const stateWcClassCode = payload.stateWcCovered ? payload.stateWcClassCode : null\n\n // Mirror the work/home address pattern: when the field is rendered\n // the payload value wins; when it isn't, fall back to a submit-time\n // override (`options.hireDate`), then to the loaded job's existing\n // value on update mode. Create mode requires a resolved value —\n // hireDate is mandatory on POST /v1/employees/:id/jobs.\n const resolvedHireDate =\n withHireDateField && payload.hireDate\n ? payload.hireDate\n : (options?.hireDate ?? currentJob?.hireDate ?? null)\n\n // When the title field is suppressed (steady-state edits drive\n // title through useCompensationForm), omit it from the body so\n // the server preserves the existing value rather than clobbering\n // it with whatever sat in form state.\n const titleToSend = withTitleField ? payload.title : undefined\n\n // When a primary job's hire_date is PUT and the value actually\n // changes, the API unconditionally overwrites every secondary's\n // current-compensation effective_date to match the new hire_date —\n // even when the secondary's original effective_date was already on\n // or after the new hire_date. Read those originals now so we can\n // PUT them back below; by the time we re-fetch they'll be gone.\n const shouldCorrectSecondaries =\n !isCreateMode &&\n currentJob?.primary === true &&\n !!resolvedHireDate &&\n resolvedHireDate !== currentJob.hireDate\n const secondaryJobEffectiveDates = shouldCorrectSecondaries\n ? (employeeJobs ?? [])\n .filter(j => !j.primary && j.currentCompensationUuid)\n .map(j => ({\n compId: j.currentCompensationUuid!,\n effectiveDate: j.compensations?.find(c => c.uuid === j.currentCompensationUuid)\n ?.effectiveDate,\n }))\n : []\n\n let updatedJob: Job\n\n if (isCreateMode) {\n if (!resolvedHireDate) {\n throw new SDKInternalError(\n withHireDateField\n ? 'hireDate is required to create a job'\n : 'hireDate is required to create a job. Pass it via JobSubmitOptions when withHireDateField is false.',\n )\n }\n if (titleToSend === undefined) {\n throw new SDKInternalError(\n 'title is required to create a job. Set withTitleField: true (the default) on useJobForm for create flows.',\n )\n }\n const result = await createJobMutation.mutateAsync({\n request: {\n employeeId: resolvedEmployeeId,\n jobsCreateRequestBody: {\n title: titleToSend,\n hireDate: resolvedHireDate,\n twoPercentShareholder: payload.twoPercentShareholder,\n stateWcCovered: payload.stateWcCovered,\n stateWcClassCode,\n },\n },\n })\n if (!result.job) {\n throw new SDKInternalError('Job creation failed')\n }\n updatedJob = result.job\n } else {\n if (!currentJob) {\n throw new SDKInternalError('Cannot update job: no matching job on file')\n }\n const result = await updateJobMutation.mutateAsync({\n request: {\n jobId: currentJob.uuid,\n jobsUpdateRequestBody: {\n version: currentJob.version as string,\n title: titleToSend,\n hireDate: resolvedHireDate ?? undefined,\n twoPercentShareholder: payload.twoPercentShareholder,\n stateWcCovered: payload.stateWcCovered,\n stateWcClassCode,\n },\n },\n })\n if (!result.job) {\n throw new SDKInternalError('Job update failed')\n }\n updatedJob = result.job\n\n // The primary PUT above clobbered each secondary's\n // current-compensation effective_date. Refetch jobs for the\n // bumped versions, then PUT each secondary back to\n // max(originalEffectiveDate, newHireDate) in parallel — the\n // requests are independent (different compensation_id, separate\n // versions), and `Promise.all` still surfaces the first\n // rejection through the surrounding baseSubmitHandler's catch.\n if (shouldCorrectSecondaries && secondaryJobEffectiveDates.length > 0) {\n setIsCorrectingSecondaries(true)\n try {\n const refreshed = await jobsQuery.refetch()\n const freshComps = (refreshed.data?.jobs ?? []).flatMap(\n j => j.compensations ?? [],\n )\n await Promise.all(\n secondaryJobEffectiveDates.flatMap(entry => {\n const freshComp = freshComps.find(c => c.uuid === entry.compId)\n if (!freshComp?.version) return []\n\n const desired =\n !entry.effectiveDate || entry.effectiveDate < resolvedHireDate\n ? resolvedHireDate\n : entry.effectiveDate\n\n return [\n updateSecondaryCompMutation.mutateAsync({\n request: {\n compensationId: entry.compId,\n compensationsUpdateRequestBody: {\n version: freshComp.version,\n effectiveDate: desired,\n },\n },\n }),\n ]\n }),\n )\n } finally {\n setIsCorrectingSecondaries(false)\n }\n }\n }\n\n submitResult = {\n mode: isCreateMode ? 'create' : 'update',\n data: updatedJob,\n }\n })\n resolve()\n },\n () => {\n resolve()\n },\n )()\n })\n\n return submitResult\n }\n\n const isDataLoading = employeeId\n ? jobsQuery.isLoading || addressesQuery.isLoading || employeeQuery.isLoading\n : false\n\n const hookFormInternals = useHookFormInternals(formMethods)\n\n if (isDataLoading || (employeeId && (!employeeJobs || !employee))) {\n return { isLoading: true as const, errorHandling }\n }\n\n return {\n isLoading: false as const,\n data: {\n currentJob,\n jobs: employeeJobs,\n employee,\n currentWorkAddress,\n showTwoPercentShareholder,\n showStateWc,\n },\n status: {\n isPending,\n mode: isCreateMode ? 'create' : 'update',\n },\n actions: { onSubmit },\n errorHandling,\n form: {\n Fields: {\n Title: withTitleField ? JobTitleField : undefined,\n HireDate: withHireDateField ? HireDateField : undefined,\n TwoPercentShareholder: showTwoPercentShareholder ? TwoPercentShareholderField : undefined,\n StateWcCovered: showStateWc ? StateWcCoveredField : undefined,\n StateWcClassCode: showStateWc && watchedStateWcCovered ? StateWcClassCodeField : undefined,\n },\n fieldsMetadata,\n hookFormInternals,\n getFormSubmissionValues: createGetFormSubmissionValues(formMethods, schema),\n },\n }\n}\n\n/**\n * Discriminated union returned by {@link useJobForm}.\n *\n * @remarks\n * Branch on `isLoading` to narrow to either {@link HookLoadingResult} or\n * {@link UseJobFormReady}.\n *\n * @public\n */\nexport type UseJobFormResult = HookLoadingResult | UseJobFormReady\n\n/**\n * Shape of the per-field metadata exposed at `useJobForm().form.fieldsMetadata`.\n *\n * @remarks\n * Maps each field name in {@link JobFormData} to its presentation metadata —\n * including the registered `name`, whether the field is required or disabled,\n * and (for select-like fields) the option list.\n *\n * @public\n */\nexport type JobFieldsMetadata = ReturnType<typeof buildJobFieldsMetadata>\n"],"names":["findJob","jobs","jobId","j","buildJobFieldsMetadata","base","showTwoPercentShareholder","showStateWc","withFlags","withOptions","WA_RISK_CLASS_CODES","code","description","useJobForm","employeeId","optionalFieldsToRequire","partnerDefaults","validationMode","shouldFocusError","withHireDateField","withTitleField","jobsQuery","useJobsAndCompensationsGetJobs","addressesQuery","useEmployeeAddressesGetWorkAddresses","employeeQuery","useEmployeesGet","employeeJobs","currentWorkAddress","address","employee","companyUuid","taxQuery","useFederalTaxDetailsGet","currentJob","useMemo","isCreateMode","mode","schema","metadataConfig","createJobSchema","resolvedDefaults","formMethods","useForm","zodResolver","watchedStateWcCovered","useWatch","createJobMutation","useJobsAndCompensationsCreateJobMutation","updateJobMutation","useJobsAndCompensationsUpdateMutation","updateSecondaryCompMutation","useJobsAndCompensationsUpdateCompensationMutation","isCorrectingSecondaries","setIsCorrectingSecondaries","useState","isPending","baseSubmitHandler","submitError","setSubmitError","useBaseSubmit","errorHandling","composeErrorHandler","baseMetadata","useDeriveFieldsMetadata","fieldsMetadata","onSubmit","options","submitResult","resolve","data","payload","resolvedEmployeeId","SDKInternalError","stateWcClassCode","resolvedHireDate","titleToSend","shouldCorrectSecondaries","secondaryJobEffectiveDates","c","updatedJob","result","freshComps","entry","freshComp","desired","isDataLoading","hookFormInternals","useHookFormInternals","JobTitleField","HireDateField","TwoPercentShareholderField","StateWcCoveredField","StateWcClassCodeField","createGetFormSubmissionValues"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA+LA,SAASA,GAAQC,GAAyBC,GAAuC;AAC/E,SAAI,CAACD,KAAQ,CAACC,IAAc,OACrBD,EAAK,KAAK,CAAAE,MAAKA,EAAE,SAASD,CAAK,KAAK;AAC7C;AAGA,SAASE,GACPC,GACA;AAAA,EACE,2BAAAC;AAAA,EACA,aAAAC;AACF,GACA;AACA,SAAO;AAAA,IACL,OAAOF,EAAK;AAAA,IACZ,UAAUA,EAAK;AAAA,IACf,uBAAuBG,EAAUH,EAAK,uBAAuB;AAAA,MAC3D,YAAY,CAACC;AAAA,IAAA,CACd;AAAA,IACD,gBAAgBG;AAAA,MACdD,EAAUH,EAAK,gBAAgB,EAAE,YAAY,CAACE,GAAa;AAAA,MAC3D;AAAA,QACE,EAAE,OAAO,OAAO,OAAO,OAAA;AAAA,QACvB,EAAE,OAAO,MAAM,OAAO,QAAA;AAAA,MAAQ;AAAA,MAEhC,CAAC,IAAM,EAAK;AAAA,IAAA;AAAA,IAEd,kBAAkBE;AAAA,MAChBD,EAAUH,EAAK,kBAAkB,EAAE,YAAY,CAACE,GAAa;AAAA,MAC7DG,EAAoB,IAAI,CAAC,EAAE,MAAAC,GAAM,aAAAC,SAAmB;AAAA,QAClD,OAAOD;AAAA,QACP,OAAO,GAAGA,CAAI,KAAKC,CAAW;AAAA,MAAA,EAC9B;AAAA,MACFF;AAA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AAAA,cACF;AAAA,YACF;AAEA,YAAAc,IAAe;AAAA,cACb,MAAMhC,IAAe,WAAW;AAAA,cAChC,MAAM4C;AAAA,YAAA;AAAA,UAEV,CAAC,GACDX,EAAA;AAAA,QACF;AAAA,QACA,MAAM;AACJ,UAAAA,EAAA;AAAA,QACF;AAAA,MAAA,EACF;AAAA,IACF,CAAC,GAEMD;AAAA,EACT,GAEMkB,KAAgBxE,IAClBO,EAAU,aAAaE,EAAe,aAAaE,EAAc,YACjE,IAEE8D,KAAoBC,GAAqB9C,CAAW;AAE1D,SAAI4C,MAAkBxE,MAAe,CAACa,KAAgB,CAACG,KAC9C,EAAE,WAAW,IAAe,eAAA+B,EAAA,IAG9B;AAAA,IACL,WAAW;AAAA,IACX,MAAM;AAAA,MACJ,YAAA3B;AAAA,MACA,MAAMP;AAAA,MACN,UAAAG;AAAA,MACA,oBAAAF;AAAA,MACA,2BAAAtB;AAAA,MACA,aAAAC;AAAA,IAAA;AAAA,IAEF,QAAQ;AAAA,MACN,WAAAiD;AAAA,MACA,MAAMpB,IAAe,WAAW;AAAA,IAAA;AAAA,IAElC,SAAS,EAAE,UAAA8B,GAAA;AAAA,IACX,eAAAL;AAAA,IACA,MAAM;AAAA,MACJ,QAAQ;AAAA,QACN,OAAOzC,IAAiBqE,KAAgB;AAAA,QACxC,UAAUtE,IAAoBuE,KAAgB;AAAA,QAC9C,uBAAuBpF,IAA4BqF,KAA6B;AAAA,QAChF,gBAAgBpF,IAAcqF,KAAsB;AAAA,QACpD,kBAAkBrF,KAAesC,IAAwBgD,KAAwB;AAAA,MAAA;AAAA,MAEnF,gBAAA5B;AAAA,MACA,mBAAAsB;AAAA,MACA,yBAAyBO,GAA8BpD,GAAaJ,CAAM;AAAA,IAAA;AAAA,EAC5E;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"useJobForm.js","sources":["../../../../../../src/components/Employee/Compensation/shared/useJobForm/useJobForm.tsx"],"sourcesContent":["import type { ComponentType } from 'react'\nimport { useMemo, useState } from 'react'\nimport { useForm, useWatch } from 'react-hook-form'\nimport type { UseFormProps } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport type { Job } from '@gusto/embedded-api/models/components/job'\nimport type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport type { EmployeeWorkAddress } from '@gusto/embedded-api/models/components/employeeworkaddress'\nimport { useJobsAndCompensationsGetJobs } from '@gusto/embedded-api/react-query/jobsAndCompensationsGetJobs'\nimport { useJobsAndCompensationsCreateJobMutation } from '@gusto/embedded-api/react-query/jobsAndCompensationsCreateJob'\nimport { useJobsAndCompensationsUpdateMutation } from '@gusto/embedded-api/react-query/jobsAndCompensationsUpdate'\nimport { useJobsAndCompensationsUpdateCompensationMutation } from '@gusto/embedded-api/react-query/jobsAndCompensationsUpdateCompensation'\nimport { useEmployeeAddressesGetWorkAddresses } from '@gusto/embedded-api/react-query/employeeAddressesGetWorkAddresses'\nimport { useEmployeesGet } from '@gusto/embedded-api/react-query/employeesGet'\nimport { useFederalTaxDetailsGet } from '@gusto/embedded-api/react-query/federalTaxDetailsGet'\nimport {\n createJobSchema,\n type JobOptionalFieldsToRequire,\n type JobFormData,\n type JobFormOutputs,\n} from './jobSchema'\nimport {\n JobTitleField,\n HireDateField,\n TwoPercentShareholderField,\n StateWcCoveredField,\n StateWcClassCodeField,\n} from './fields'\nimport type {\n JobTitleFieldProps,\n HireDateFieldProps,\n TwoPercentShareholderFieldProps,\n StateWcCoveredFieldProps,\n StateWcClassCodeFieldProps,\n} from './fields'\nimport { useDeriveFieldsMetadata } from '@/partner-hook-utils/form/useDeriveFieldsMetadata'\nimport { useHookFormInternals } from '@/partner-hook-utils/form/useHookFormInternals'\nimport { createGetFormSubmissionValues } from '@/partner-hook-utils/form/getFormSubmissionValues'\nimport { withOptions } from '@/partner-hook-utils/form/withOptions'\nimport { withFlags } from '@/partner-hook-utils/form/withFlags'\nimport { composeErrorHandler } from '@/partner-hook-utils/composeErrorHandler'\nimport type {\n BaseFormHookReady,\n FieldMetadata,\n FieldsMetadata,\n HookLoadingResult,\n HookSubmitResult,\n} from '@/partner-hook-utils/types'\nimport { useBaseSubmit } from '@/components/Base/useBaseSubmit'\nimport { SDKInternalError } from '@/types/sdkError'\nimport { WA_RISK_CLASS_CODES, type WARiskClassCode } from '@/models/WA_RISK_CODES'\n\n/**\n * Optional values supplied to {@link useJobForm}'s `actions.onSubmit` at submit time.\n *\n * @remarks\n * Use these when a value isn't sourced from a rendered field — typically\n * because the hook was configured with `withHireDateField: false`, or because\n * the employee being saved was created in the same submit chain and the\n * `employeeId` wasn't known at hook construction.\n *\n * @public\n */\nexport interface JobSubmitOptions {\n /** Override the `employeeId` configured at hook construction. Useful when the employee is created in the same submit chain. */\n employeeId?: string\n /**\n * Supply `hireDate` at submit time rather than via a rendered field. Use\n * with `withHireDateField: false` for screens that derive hireDate from\n * external context (e.g. the employee's `startDate` during onboarding).\n * Falls back to the loaded job's `hireDate` on update mode when omitted;\n * required (or sourced from a default) on create mode.\n */\n hireDate?: string\n}\n\n/**\n * Configuration options for {@link useJobForm}.\n *\n * @remarks\n * Presence or absence of `jobId` selects the API verb — see the `jobId` field\n * description. `employeeId` is optional so the hook can be composed alongside\n * an employee-creation step; supply it at submit time via\n * {@link JobSubmitOptions.employeeId} in that case.\n *\n * @public\n */\nexport interface UseJobFormProps {\n /** UUID of the employee whose job is being created or edited. May be omitted when the employee is created in the same submit chain — supply the value via {@link JobSubmitOptions.employeeId} at submit time. */\n employeeId?: string\n /** Present → update mode (PUT /v1/jobs/:id with `version`). Omitted → create mode (POST /v1/employees/:id/jobs). */\n jobId?: string\n /** Override fields that are optional on a given mode to be required. See {@link JobOptionalFieldsToRequire}. */\n optionalFieldsToRequire?: JobOptionalFieldsToRequire\n /** Pre-fill form values. Server data takes precedence on update mode. */\n defaultValues?: Partial<JobFormData>\n /** Passed through to react-hook-form. Defaults to `'onSubmit'`. */\n validationMode?: UseFormProps['mode']\n /** Auto-focus the first invalid field on submit. Set to `false` when using `composeSubmitHandler` so submit-time focus is coordinated across multiple forms. Defaults to `true`. */\n shouldFocusError?: boolean\n /**\n * When `false`, hides `Fields.HireDate` (becomes `undefined`) and removes\n * `hireDate` from schema validation. Supply the value via\n * {@link JobSubmitOptions.hireDate} at submit time, or rely on the loaded\n * job's existing value on update. Use this when the date is driven by\n * external context rather than user input (e.g. the employee's `startDate`).\n * Defaults to `true`.\n */\n withHireDateField?: boolean\n /**\n * When `false`, hides `Fields.Title` (becomes `undefined`), removes\n * `title` from schema validation, and skips sending `title` on PUT/POST.\n * Use this when another form owns the title field — e.g. compensation\n * edit surfaces render the title via `CompFields.Title` because title\n * lives on compensation in the API (`job.title` is just a denormalized\n * snapshot of the primary comp's title). Defaults to `true` so the\n * standalone job-creation flow still gathers a title for the create\n * body.\n */\n withTitleField?: boolean\n}\n\n/**\n * Pre-bound field components exposed on `useJobForm().form.Fields`.\n *\n * @remarks\n * Each property is either the field component or `undefined`. A field is\n * `undefined` when conditions for rendering it aren't met — see each member\n * for its visibility rule. Always null-check conditional fields (e.g.\n * `{Fields.TwoPercentShareholder && <Fields.TwoPercentShareholder ... />}`)\n * before rendering.\n *\n * @public\n */\nexport interface JobFormFields {\n /** Bound to `title`. Job title text input. `undefined` when `withTitleField: false`. */\n Title: ComponentType<JobTitleFieldProps> | undefined\n /** Bound to `hireDate`. Hire date picker. `undefined` when `withHireDateField: false`. */\n HireDate: ComponentType<HireDateFieldProps> | undefined\n /** Bound to `twoPercentShareholder`. S-Corp 2% shareholder checkbox. `undefined` when the company is not taxable as an S-Corp (see `data.showTwoPercentShareholder`). */\n TwoPercentShareholder: ComponentType<TwoPercentShareholderFieldProps> | undefined\n /** Bound to `stateWcCovered`. Washington state workers' compensation coverage radio group. `undefined` when the active work address is not in Washington (see `data.showStateWc`). */\n StateWcCovered: ComponentType<StateWcCoveredFieldProps> | undefined\n /** Bound to `stateWcClassCode`. Washington state workers' compensation risk class code select. `undefined` when the active work address is not in Washington or when `stateWcCovered` is `false`. */\n StateWcClassCode: ComponentType<StateWcClassCodeFieldProps> | undefined\n}\n\n/**\n * Ready-state shape returned by {@link useJobForm} once data has loaded.\n *\n * @remarks\n * Discriminated by `isLoading: false`. Extends\n * {@link BaseFormHookReady} with the job-specific `data`, `status`,\n * `actions`, and `form.Fields` shape.\n *\n * @public\n */\nexport interface UseJobFormReady extends BaseFormHookReady<\n JobFieldsMetadata,\n JobFormData,\n JobFormFields\n> {\n /** Job-specific data payload: the loaded job (if any), the employee's other jobs, the employee record, the active work address, and presentation flags for conditional fields. */\n data: {\n /** The job row loaded for update; `null` in create mode. */\n currentJob: Job | null\n /** All jobs for the employee, when employeeId is set. Useful for screen-level cross-checks across jobs. */\n jobs: Job[] | undefined\n /** The loaded employee record, or `null` when `employeeId` was omitted. */\n employee: Employee | null\n /** The employee's active work address, or `null` when none is set. */\n currentWorkAddress: EmployeeWorkAddress | null\n /** True when the company is taxable as an S-Corp; use this to decide whether to render `TwoPercentShareholder`. */\n showTwoPercentShareholder: boolean\n /**\n * True when the active work-address state is WA; use this to decide whether to render\n * `StateWcCovered`. `Fields.StateWcClassCode` is additionally gated on `stateWcCovered === true`,\n * so most callers only need to check `Fields.StateWcCovered` / `Fields.StateWcClassCode`\n * truthiness rather than this flag directly.\n */\n showStateWc: boolean\n }\n /** Submission state. `isPending` is `true` while any in-flight mutation (including the secondary-compensation correction block) hasn't settled. `mode` reflects whether the next submit will create or update. */\n status: { isPending: boolean; mode: 'create' | 'update' }\n /** Submit actions exposed by the hook. */\n actions: {\n /** Validates the form, runs the appropriate create/update mutation, and resolves to a {@link HookSubmitResult} containing the saved job. Resolves to `undefined` on validation failure or mutation error. */\n onSubmit: (options?: JobSubmitOptions) => Promise<HookSubmitResult<Job> | undefined>\n }\n}\n\nfunction findJob(jobs: Job[] | undefined, jobId: string | undefined): Job | null {\n if (!jobs || !jobId) return null\n return jobs.find(j => j.uuid === jobId) ?? null\n}\n\n/** @internal */\nfunction buildJobFieldsMetadata(\n base: Record<keyof JobFormData, FieldMetadata>,\n {\n showTwoPercentShareholder,\n showStateWc,\n }: { showTwoPercentShareholder: boolean; showStateWc: boolean },\n) {\n return {\n title: base.title,\n hireDate: base.hireDate,\n twoPercentShareholder: withFlags(base.twoPercentShareholder, {\n isDisabled: !showTwoPercentShareholder,\n }),\n stateWcCovered: withOptions<boolean>(\n withFlags(base.stateWcCovered, { isDisabled: !showStateWc }),\n [\n { label: 'Yes', value: 'true' },\n { label: 'No', value: 'false' },\n ],\n [true, false],\n ),\n stateWcClassCode: withOptions<WARiskClassCode>(\n withFlags(base.stateWcClassCode, { isDisabled: !showStateWc }),\n WA_RISK_CLASS_CODES.map(({ code, description }) => ({\n value: code,\n label: `${code}: ${description}`,\n })),\n WA_RISK_CLASS_CODES,\n ),\n } satisfies FieldsMetadata\n}\n\n/**\n * Headless hook for creating or updating an employee's job — title, hire date, S-Corp 2% shareholder flag, and Washington state workers' compensation fields.\n *\n * @remarks\n * Companion hook to `useCompensationForm`. Jobs and their compensations are\n * separate entities in the Gusto API and this hook focuses exclusively on\n * the job side. Presence of `jobId` selects the verb:\n *\n * | Hook config | Mode | API call |\n * | ----------- | ---- | -------- |\n * | `{ employeeId, jobId }` | update | `PUT /v1/jobs/:jobId` (with `version`) |\n * | `{ employeeId }` (no `jobId`) | create | `POST /v1/employees/:employeeId/jobs` |\n * | `{}` + submit `employeeId` | create | `POST /v1/employees/:options.employeeId/jobs` |\n *\n * Creating a job auto-creates a stub compensation. To update the stub in the\n * same flow, capture `currentCompensationUuid` (and the compensation's\n * `version` from `compensations[]`) from the create response and thread them\n * into `useCompensationForm.actions.onSubmit({ jobId, compensationId, compensationVersion })`.\n *\n * When the primary job's `hireDate` changes, secondary compensation effective\n * dates are corrected after the PUT; `isPending` stays `true` through that.\n *\n * @param input - {@link UseJobFormProps} — `employeeId`, `jobId` (toggle create/update), and configuration for required-field overrides, default values, and which fields the hook renders.\n * @returns A {@link HookLoadingResult} while data is loading, or a {@link UseJobFormReady} once ready.\n * @public\n *\n * @example\n * ```tsx\n * import { useJobForm, SDKFormProvider } from '@gusto/embedded-react-sdk'\n *\n * function JobForm({ employeeId }: { employeeId: string }) {\n * const job = useJobForm({ employeeId })\n * if (job.isLoading) return null\n *\n * const { Fields } = job.form\n * return (\n * <form onSubmit={e => { e.preventDefault(); job.actions.onSubmit() }}>\n * <SDKFormProvider formHookResult={job}>\n * {Fields.Title && <Fields.Title label=\"Job title\" />}\n * {Fields.HireDate && <Fields.HireDate label=\"Hire date\" />}\n * {Fields.TwoPercentShareholder && (\n * <Fields.TwoPercentShareholder label=\"2% S-Corp shareholder\" />\n * )}\n * </SDKFormProvider>\n * <button type=\"submit\" disabled={job.status.isPending}>Save</button>\n * </form>\n * )\n * }\n * ```\n */\nexport function useJobForm({\n employeeId,\n jobId,\n optionalFieldsToRequire,\n defaultValues: partnerDefaults,\n validationMode = 'onSubmit',\n shouldFocusError = true,\n withHireDateField = true,\n withTitleField = true,\n}: UseJobFormProps): HookLoadingResult | UseJobFormReady {\n const jobsQuery = useJobsAndCompensationsGetJobs(\n { employeeId: employeeId ?? '' },\n { enabled: !!employeeId },\n )\n const addressesQuery = useEmployeeAddressesGetWorkAddresses(\n { employeeId: employeeId ?? '' },\n { enabled: !!employeeId },\n )\n const employeeQuery = useEmployeesGet({ employeeId: employeeId ?? '' }, { enabled: !!employeeId })\n\n const employeeJobs = jobsQuery.data?.jobs\n const workAddresses = addressesQuery.data?.employeeWorkAddressesList\n const currentWorkAddress = workAddresses?.find(address => address.active) ?? null\n const employee = employeeQuery.data?.employee ?? null\n const companyUuid = employee?.companyUuid\n\n const taxQuery = useFederalTaxDetailsGet(\n { companyId: companyUuid ?? '' },\n { enabled: !!companyUuid },\n )\n const federalTaxDetails = taxQuery.data?.federalTaxDetails\n const showTwoPercentShareholder = federalTaxDetails?.taxableAsScorp === true\n const showStateWc = currentWorkAddress?.state === 'WA'\n\n const currentJob = useMemo(() => findJob(employeeJobs, jobId), [employeeJobs, jobId])\n const isCreateMode = !jobId\n const mode = isCreateMode ? 'create' : 'update'\n\n const [schema, metadataConfig] = useMemo(\n () => createJobSchema({ mode, optionalFieldsToRequire, withHireDateField, withTitleField }),\n [mode, optionalFieldsToRequire, withHireDateField, withTitleField],\n )\n\n const resolvedDefaults: JobFormData = useMemo(\n () => ({\n title: currentJob?.title ?? partnerDefaults?.title ?? '',\n hireDate: currentJob?.hireDate ?? partnerDefaults?.hireDate ?? null,\n twoPercentShareholder:\n currentJob?.twoPercentShareholder ?? partnerDefaults?.twoPercentShareholder ?? false,\n stateWcCovered: currentJob?.stateWcCovered ?? partnerDefaults?.stateWcCovered ?? false,\n stateWcClassCode: currentJob?.stateWcClassCode ?? partnerDefaults?.stateWcClassCode ?? '',\n }),\n [currentJob, partnerDefaults],\n )\n\n const formMethods = useForm<JobFormData, unknown, JobFormOutputs>({\n resolver: zodResolver(schema),\n mode: validationMode,\n shouldFocusError,\n defaultValues: resolvedDefaults,\n values: resolvedDefaults,\n resetOptions: { keepDirtyValues: true },\n })\n\n const watchedStateWcCovered = useWatch({ control: formMethods.control, name: 'stateWcCovered' })\n\n const createJobMutation = useJobsAndCompensationsCreateJobMutation()\n const updateJobMutation = useJobsAndCompensationsUpdateMutation()\n const updateSecondaryCompMutation = useJobsAndCompensationsUpdateCompensationMutation()\n // Tracks the post-primary-PUT corrective block (jobs refetch + parallel\n // secondary comp PUTs). No single mutation hook reports `isPending` for the\n // whole window — the refetch isn't a mutation, and `Promise.all` over one\n // mutation hook makes its `isPending` track the latest-settled call — so we\n // OR this in to keep the spinner solid through it.\n const [isCorrectingSecondaries, setIsCorrectingSecondaries] = useState(false)\n const isPending =\n createJobMutation.isPending ||\n updateJobMutation.isPending ||\n updateSecondaryCompMutation.isPending ||\n isCorrectingSecondaries\n\n const {\n baseSubmitHandler,\n error: submitError,\n setError: setSubmitError,\n } = useBaseSubmit('JobForm')\n\n const queriesForErrors = employeeId ? [jobsQuery, addressesQuery, employeeQuery, taxQuery] : []\n const errorHandling = composeErrorHandler(queriesForErrors, { submitError, setSubmitError })\n\n const baseMetadata = useDeriveFieldsMetadata(metadataConfig, formMethods.control)\n const fieldsMetadata = buildJobFieldsMetadata(baseMetadata, {\n showTwoPercentShareholder,\n showStateWc,\n })\n\n const onSubmit = async (\n options?: JobSubmitOptions,\n ): Promise<HookSubmitResult<Job> | undefined> => {\n let submitResult: HookSubmitResult<Job> | undefined\n\n await new Promise<void>(resolve => {\n void formMethods.handleSubmit(\n async (data: JobFormOutputs) => {\n await baseSubmitHandler(data, async payload => {\n const resolvedEmployeeId = options?.employeeId ?? employeeId\n if (!resolvedEmployeeId) {\n throw new SDKInternalError('employeeId is required to submit a job')\n }\n\n const stateWcClassCode = payload.stateWcCovered ? payload.stateWcClassCode : null\n\n // Mirror the work/home address pattern: when the field is rendered\n // the payload value wins; when it isn't, fall back to a submit-time\n // override (`options.hireDate`), then to the loaded job's existing\n // value on update mode. Create mode requires a resolved value —\n // hireDate is mandatory on POST /v1/employees/:id/jobs.\n const resolvedHireDate =\n withHireDateField && payload.hireDate\n ? payload.hireDate\n : (options?.hireDate ?? currentJob?.hireDate ?? null)\n\n // When the title field is suppressed (steady-state edits drive\n // title through useCompensationForm), omit it from the body so\n // the server preserves the existing value rather than clobbering\n // it with whatever sat in form state.\n const titleToSend = withTitleField ? payload.title : undefined\n\n // When a primary job's hire_date is PUT and the value actually\n // changes, the API unconditionally overwrites every secondary's\n // current-compensation effective_date to match the new hire_date —\n // even when the secondary's original effective_date was already on\n // or after the new hire_date. Read those originals now so we can\n // PUT them back below; by the time we re-fetch they'll be gone.\n const shouldCorrectSecondaries =\n !isCreateMode &&\n currentJob?.primary === true &&\n !!resolvedHireDate &&\n resolvedHireDate !== currentJob.hireDate\n const secondaryJobEffectiveDates = shouldCorrectSecondaries\n ? (employeeJobs ?? [])\n .filter(j => !j.primary && j.currentCompensationUuid)\n .map(j => ({\n compId: j.currentCompensationUuid!,\n effectiveDate: j.compensations?.find(c => c.uuid === j.currentCompensationUuid)\n ?.effectiveDate,\n }))\n : []\n\n let updatedJob: Job\n\n if (isCreateMode) {\n if (!resolvedHireDate) {\n throw new SDKInternalError(\n withHireDateField\n ? 'hireDate is required to create a job'\n : 'hireDate is required to create a job. Pass it via JobSubmitOptions when withHireDateField is false.',\n )\n }\n if (titleToSend === undefined) {\n throw new SDKInternalError(\n 'title is required to create a job. Set withTitleField: true (the default) on useJobForm for create flows.',\n )\n }\n const result = await createJobMutation.mutateAsync({\n request: {\n employeeId: resolvedEmployeeId,\n jobsCreateRequestBody: {\n title: titleToSend,\n hireDate: resolvedHireDate,\n twoPercentShareholder: payload.twoPercentShareholder,\n stateWcCovered: payload.stateWcCovered,\n stateWcClassCode,\n },\n },\n })\n if (!result.job) {\n throw new SDKInternalError('Job creation failed')\n }\n updatedJob = result.job\n } else {\n if (!currentJob) {\n throw new SDKInternalError('Cannot update job: no matching job on file')\n }\n const result = await updateJobMutation.mutateAsync({\n request: {\n jobId: currentJob.uuid,\n jobsUpdateRequestBody: {\n version: currentJob.version as string,\n title: titleToSend,\n hireDate: resolvedHireDate ?? undefined,\n twoPercentShareholder: payload.twoPercentShareholder,\n stateWcCovered: payload.stateWcCovered,\n stateWcClassCode,\n },\n },\n })\n if (!result.job) {\n throw new SDKInternalError('Job update failed')\n }\n updatedJob = result.job\n\n // The primary PUT above clobbered each secondary's\n // current-compensation effective_date. Refetch jobs for the\n // bumped versions, then PUT each secondary back to\n // max(originalEffectiveDate, newHireDate) in parallel — the\n // requests are independent (different compensation_id, separate\n // versions), and `Promise.all` still surfaces the first\n // rejection through the surrounding baseSubmitHandler's catch.\n if (shouldCorrectSecondaries && secondaryJobEffectiveDates.length > 0) {\n setIsCorrectingSecondaries(true)\n try {\n const refreshed = await jobsQuery.refetch()\n const freshComps = (refreshed.data?.jobs ?? []).flatMap(\n j => j.compensations ?? [],\n )\n await Promise.all(\n secondaryJobEffectiveDates.flatMap(entry => {\n const freshComp = freshComps.find(c => c.uuid === entry.compId)\n if (!freshComp?.version) return []\n\n const desired =\n !entry.effectiveDate || entry.effectiveDate < resolvedHireDate\n ? resolvedHireDate\n : entry.effectiveDate\n\n return [\n updateSecondaryCompMutation.mutateAsync({\n request: {\n compensationId: entry.compId,\n compensationsUpdateRequestBody: {\n version: freshComp.version,\n effectiveDate: desired,\n },\n },\n }),\n ]\n }),\n )\n } finally {\n setIsCorrectingSecondaries(false)\n }\n }\n }\n\n submitResult = {\n mode: isCreateMode ? 'create' : 'update',\n data: updatedJob,\n }\n })\n resolve()\n },\n () => {\n resolve()\n },\n )()\n })\n\n return submitResult\n }\n\n const isDataLoading = employeeId\n ? jobsQuery.isLoading || addressesQuery.isLoading || employeeQuery.isLoading\n : false\n\n const hookFormInternals = useHookFormInternals(formMethods)\n\n if (isDataLoading || (employeeId && (!employeeJobs || !employee))) {\n return { isLoading: true as const, errorHandling }\n }\n\n return {\n isLoading: false as const,\n data: {\n currentJob,\n jobs: employeeJobs,\n employee,\n currentWorkAddress,\n showTwoPercentShareholder,\n showStateWc,\n },\n status: {\n isPending,\n mode: isCreateMode ? 'create' : 'update',\n },\n actions: { onSubmit },\n errorHandling,\n form: {\n Fields: {\n Title: withTitleField ? JobTitleField : undefined,\n HireDate: withHireDateField ? HireDateField : undefined,\n TwoPercentShareholder: showTwoPercentShareholder ? TwoPercentShareholderField : undefined,\n StateWcCovered: showStateWc ? StateWcCoveredField : undefined,\n StateWcClassCode: showStateWc && watchedStateWcCovered ? StateWcClassCodeField : undefined,\n },\n fieldsMetadata,\n hookFormInternals,\n getFormSubmissionValues: createGetFormSubmissionValues(formMethods, schema),\n },\n }\n}\n\n/**\n * Discriminated union returned by {@link useJobForm}.\n *\n * @remarks\n * Branch on `isLoading` to narrow to either {@link HookLoadingResult} or\n * {@link UseJobFormReady}.\n *\n * @public\n */\nexport type UseJobFormResult = HookLoadingResult | UseJobFormReady\n\n/**\n * Shape of the per-field metadata exposed at `useJobForm().form.fieldsMetadata`.\n *\n * @remarks\n * Maps each field name in {@link JobFormData} to its presentation metadata —\n * including the registered `name`, whether the field is required or disabled,\n * and (for select-like fields) the option list.\n *\n * @public\n */\nexport type JobFieldsMetadata = ReturnType<typeof buildJobFieldsMetadata>\n"],"names":["findJob","jobs","jobId","j","buildJobFieldsMetadata","base","showTwoPercentShareholder","showStateWc","withFlags","withOptions","WA_RISK_CLASS_CODES","code","description","useJobForm","employeeId","optionalFieldsToRequire","partnerDefaults","validationMode","shouldFocusError","withHireDateField","withTitleField","jobsQuery","useJobsAndCompensationsGetJobs","addressesQuery","useEmployeeAddressesGetWorkAddresses","employeeQuery","useEmployeesGet","employeeJobs","currentWorkAddress","address","employee","companyUuid","taxQuery","useFederalTaxDetailsGet","currentJob","useMemo","isCreateMode","mode","schema","metadataConfig","createJobSchema","resolvedDefaults","formMethods","useForm","zodResolver","watchedStateWcCovered","useWatch","createJobMutation","useJobsAndCompensationsCreateJobMutation","updateJobMutation","useJobsAndCompensationsUpdateMutation","updateSecondaryCompMutation","useJobsAndCompensationsUpdateCompensationMutation","isCorrectingSecondaries","setIsCorrectingSecondaries","useState","isPending","baseSubmitHandler","submitError","setSubmitError","useBaseSubmit","errorHandling","composeErrorHandler","baseMetadata","useDeriveFieldsMetadata","fieldsMetadata","onSubmit","options","submitResult","resolve","data","payload","resolvedEmployeeId","SDKInternalError","stateWcClassCode","resolvedHireDate","titleToSend","shouldCorrectSecondaries","secondaryJobEffectiveDates","c","updatedJob","result","freshComps","entry","freshComp","desired","isDataLoading","hookFormInternals","useHookFormInternals","JobTitleField","HireDateField","TwoPercentShareholderField","StateWcCoveredField","StateWcClassCodeField","createGetFormSubmissionValues"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA+LA,SAASA,GAAQC,GAAyBC,GAAuC;AAC/E,SAAI,CAACD,KAAQ,CAACC,IAAc,OACrBD,EAAK,KAAK,CAAAE,MAAKA,EAAE,SAASD,CAAK,KAAK;AAC7C;AAGA,SAASE,GACPC,GACA;AAAA,EACE,2BAAAC;AAAA,EACA,aAAAC;AACF,GACA;AACA,SAAO;AA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ACN,WAAAiD;AAAA,MACA,MAAMpB,IAAe,WAAW;AAAA,IAAA;AAAA,IAElC,SAAS,EAAE,UAAA8B,GAAA;AAAA,IACX,eAAAL;AAAA,IACA,MAAM;AAAA,MACJ,QAAQ;AAAA,QACN,OAAOzC,IAAiBqE,KAAgB;AAAA,QACxC,UAAUtE,IAAoBuE,KAAgB;AAAA,QAC9C,uBAAuBpF,IAA4BqF,KAA6B;AAAA,QAChF,gBAAgBpF,IAAcqF,KAAsB;AAAA,QACpD,kBAAkBrF,KAAesC,IAAwBgD,KAAwB;AAAA,MAAA;AAAA,MAEnF,gBAAA5B;AAAA,MACA,mBAAAsB;AAAA,MACA,yBAAyBO,GAA8BpD,GAAaJ,CAAM;AAAA,IAAA;AAAA,EAC5E;AAEJ;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as e, jsxs as i } from "react/jsx-runtime";
|
|
2
2
|
import { useState as h, Suspense as x } from "react";
|
|
3
3
|
import { useTranslation as c } from "react-i18next";
|
|
4
|
-
import { useEmployeesGetSuspense as y } from "@gusto/embedded-api
|
|
4
|
+
import { useEmployeesGetSuspense as y } from "@gusto/embedded-api/react-query/employeesGet";
|
|
5
5
|
import { BasicDetailsView as T } from "./BasicDetailsView.js";
|
|
6
6
|
import { JobAndPayView as A } from "./JobAndPayView.js";
|
|
7
7
|
import { TaxesViewWithData as C } from "./TaxesView.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dashboard.js","sources":["../../../../src/components/Employee/Dashboard/Dashboard.tsx"],"sourcesContent":["import { Suspense, useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { useEmployeesGetSuspense } from '@gusto/embedded-api
|
|
1
|
+
{"version":3,"file":"Dashboard.js","sources":["../../../../src/components/Employee/Dashboard/Dashboard.tsx"],"sourcesContent":["import { Suspense, useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { useEmployeesGetSuspense } from '@gusto/embedded-api/react-query/employeesGet'\nimport { BasicDetailsView } from './BasicDetailsView'\nimport { JobAndPayView } from './JobAndPayView'\nimport { TaxesViewWithData } from './TaxesView'\nimport { DocumentsCard } from '@/components/Employee/Documents/management/DocumentsCard'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { BaseBoundaries, type BaseComponentInterface } from '@/components/Base/Base'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { firstLastName } from '@/helpers/formattedStrings'\n\n/** @public */\nexport type DashboardTab = 'basicDetails' | 'jobAndPay' | 'taxes' | 'documents'\n\n/** @public */\nexport interface DashboardProps extends BaseComponentInterface<'Employee.Dashboard'> {\n /** The associated employee identifier. */\n employeeId: string\n /** The currently active tab. Defaults to `'basicDetails'` when uncontrolled. */\n selectedTab?: DashboardTab\n}\n\nfunction DashboardRoot({\n employeeId,\n dictionary,\n onEvent,\n selectedTab: controlledTab,\n}: DashboardProps) {\n useI18n('Employee.Dashboard')\n useComponentDictionary('Employee.Dashboard', dictionary)\n const { t } = useTranslation('Employee.Dashboard')\n const Components = useComponentContext()\n const [internalTab, setInternalTab] = useState<DashboardTab>('basicDetails')\n const selectedTab = controlledTab ?? internalTab\n\n const tabs = [\n {\n id: 'basicDetails' as const,\n label: t('tabs.basicDetails'),\n content: null,\n },\n {\n id: 'jobAndPay' as const,\n label: t('tabs.jobAndPay'),\n content: null,\n },\n {\n id: 'taxes' as const,\n label: t('tabs.taxes'),\n content: null,\n },\n {\n id: 'documents' as const,\n label: t('tabs.documents'),\n content: null,\n },\n ]\n\n return (\n <Flex flexDirection=\"column\" gap={32}>\n <Suspense fallback={null}>\n <DashboardHeader employeeId={employeeId} />\n </Suspense>\n\n <Flex flexDirection=\"column\" gap={8}>\n <Components.Tabs\n tabs={tabs}\n selectedId={selectedTab}\n onSelectionChange={id => {\n const next = id as DashboardTab\n setInternalTab(next)\n onEvent(componentEvents.EMPLOYEE_DASHBOARD_TAB_CHANGE, { tab: next })\n }}\n aria-label={t('tabsLabel')}\n />\n\n <Flex flexDirection=\"column\" gap={24}>\n {selectedTab === 'basicDetails' && (\n <BasicDetailsView employeeId={employeeId} onEvent={onEvent} />\n )}\n\n {selectedTab === 'jobAndPay' && (\n <JobAndPayView employeeId={employeeId} onEvent={onEvent} />\n )}\n\n {selectedTab === 'taxes' && (\n <TaxesViewWithData employeeId={employeeId} onEvent={onEvent} />\n )}\n\n {selectedTab === 'documents' && (\n <DocumentsCard employeeId={employeeId} onEvent={onEvent} />\n )}\n </Flex>\n </Flex>\n </Flex>\n )\n}\n\nfunction DashboardHeader({ employeeId }: { employeeId: string }) {\n const { t } = useTranslation('Employee.Dashboard')\n const Components = useComponentContext()\n const {\n data: { employee },\n } = useEmployeesGetSuspense({ employeeId })\n\n return (\n <Flex flexDirection=\"column\" gap={4}>\n <Components.Heading as=\"h2\">\n {firstLastName({ first_name: employee?.firstName, last_name: employee?.lastName })}\n </Components.Heading>\n <Components.Text variant=\"supporting\">{t('employeeRoleLabel')}</Components.Text>\n </Flex>\n )\n}\n\n/**\n * Employee self-service dashboard summarizing a single employee's basic details, job and pay, taxes, and documents.\n *\n * @remarks\n * Renders a tabbed overview of the employee, wrapped in the SDK's standard error and suspense\n * boundaries. The active tab may be controlled via `selectedTab` or left uncontrolled, in which\n * case it defaults to basic details. Each tab composes the read-only section cards listed below.\n *\n * @components\n * - {@link ProfileCard}\n * - {@link HomeAddressCard}\n * - {@link WorkAddressCard}\n * - {@link CompensationCard}\n * - {@link PaymentMethodCard}\n * - {@link DeductionsCard}\n * - {@link PaystubsCard}\n * - {@link FederalTaxesCard}\n * - {@link StateTaxesCard}\n * - {@link DocumentsCard}\n *\n * @param props - Component props. See {@link DashboardProps}.\n * @returns A React element rendering the employee dashboard.\n * @public\n */\nexport function Dashboard({ FallbackComponent, ...props }: DashboardProps) {\n return (\n <BaseBoundaries componentName=\"Employee.Dashboard\" FallbackComponent={FallbackComponent}>\n <DashboardRoot {...props} />\n </BaseBoundaries>\n )\n}\n"],"names":["DashboardRoot","employeeId","dictionary","onEvent","controlledTab","useI18n","useComponentDictionary","t","useTranslation","Components","useComponentContext","internalTab","setInternalTab","useState","selectedTab","tabs","jsxs","Flex","jsx","Suspense","DashboardHeader","id","next","componentEvents","BasicDetailsView","JobAndPayView","TaxesViewWithData","DocumentsCard","employee","useEmployeesGetSuspense","firstLastName","Dashboard","FallbackComponent","props","BaseBoundaries"],"mappings":";;;;;;;;;;;;;;AAyBA,SAASA,EAAc;AAAA,EACrB,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,SAAAC;AAAA,EACA,aAAaC;AACf,GAAmB;AACjB,EAAAC,EAAQ,oBAAoB,GAC5BC,EAAuB,sBAAsBJ,CAAU;AACvD,QAAM,EAAE,GAAAK,EAAA,IAAMC,EAAe,oBAAoB,GAC3CC,IAAaC,EAAA,GACb,CAACC,GAAaC,CAAc,IAAIC,EAAuB,cAAc,GACrEC,IAAcV,KAAiBO,GAE/BI,IAAO;AAAA,IACX;AAAA,MACE,IAAI;AAAA,MACJ,OAAOR,EAAE,mBAAmB;AAAA,MAC5B,SAAS;AAAA,IAAA;AAAA,IAEX;AAAA,MACE,IAAI;AAAA,MACJ,OAAOA,EAAE,gBAAgB;AAAA,MACzB,SAAS;AAAA,IAAA;AAAA,IAEX;AAAA,MACE,IAAI;AAAA,MACJ,OAAOA,EAAE,YAAY;AAAA,MACrB,SAAS;AAAA,IAAA;AAAA,IAEX;AAAA,MACE,IAAI;AAAA,MACJ,OAAOA,EAAE,gBAAgB;AAAA,MACzB,SAAS;AAAA,IAAA;AAAA,EACX;AAGF,SACE,gBAAAS,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,IAAA,gBAAAC,EAACC,KAAS,UAAU,MAClB,UAAA,gBAAAD,EAACE,GAAA,EAAgB,YAAAnB,GAAwB,GAC3C;AAAA,IAEA,gBAAAe,EAACC,GAAA,EAAK,eAAc,UAAS,KAA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,SAAQ,cAAc,UAAAF,EAAE,mBAAmB,EAAA,CAAE;AAAA,EAAA,GAChE;AAEJ;AA0BO,SAASwB,EAAU,EAAE,mBAAAC,GAAmB,GAAGC,KAAyB;AACzE,SACE,gBAAAf,EAACgB,KAAe,eAAc,sBAAqB,mBAAAF,GACjD,UAAA,gBAAAd,EAAClB,GAAA,EAAe,GAAGiC,EAAA,CAAO,EAAA,CAC5B;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboardStateMachine.js","sources":["../../../../src/components/Employee/Dashboard/dashboardStateMachine.ts"],"sourcesContent":["import { transition, reduce, state } from 'robot3'\nimport type { Garnishment } from '@gusto/embedded-api-v-2026-02-01/models/components/garnishment'\nimport type { DashboardTab } from './Dashboard'\nimport {\n DashboardViewContextual,\n HomeAddressContextual,\n WorkAddressContextual,\n FederalTaxesContextual,\n StateTaxesContextual,\n ProfileContextual,\n PaymentBankFormContextual,\n PaymentSplitViewContextual,\n DocumentManagerContextual,\n DeductionsEditFormContextual,\n AddJobContextual,\n EditCompensationContextual,\n AddAnotherJobContextual,\n type DashboardContextInterface,\n} from './DashboardComponents'\nimport { componentEvents } from '@/shared/constants'\nimport type { MachineEventType, MachineTransition } from '@/types/Helpers'\n\ntype EventPayloads = {\n [componentEvents.EMPLOYEE_MANAGEMENT_DOCUMENTS_CARD_VIEW_REQUESTED]: {\n employeeId: string\n formId: string\n }\n [componentEvents.EMPLOYEE_MANAGEMENT_DEDUCTIONS_CARD_EDIT_REQUESTED]: Garnishment\n [componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_CARD_EDIT_REQUESTED]: {\n employeeId: string\n jobId: string\n }\n [componentEvents.EMPLOYEE_DASHBOARD_TAB_CHANGE]: { tab: DashboardTab }\n}\n\nconst returnToIndex = reduce((ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: DashboardViewContextual,\n header: null,\n currentJobId: null,\n successAlert: null,\n}))\n\nconst returnToIndexWithAlert = (alert: DashboardContextInterface['successAlert']) =>\n reduce((ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: DashboardViewContextual,\n header: null,\n currentJobId: null,\n successAlert: alert,\n }))\n\n/** @internal */\nexport const dashboardStateMachine = {\n index: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_PROFILE_EDIT_REQUESTED,\n 'profile',\n reduce((ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: ProfileContextual,\n successAlert: null,\n })),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_HOME_ADDRESS_EDIT_REQUESTED,\n 'homeAddress',\n reduce((ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: HomeAddressContextual,\n successAlert: null,\n })),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_WORK_ADDRESS_EDIT_REQUESTED,\n 'workAddress',\n reduce((ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: WorkAddressContextual,\n successAlert: null,\n })),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_FEDERAL_TAXES_CARD_EDIT_REQUESTED,\n 'federalTaxes',\n reduce((ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: FederalTaxesContextual,\n successAlert: null,\n })),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_STATE_TAXES_EDIT_REQUESTED,\n 'stateTaxes',\n reduce((ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: StateTaxesContextual,\n successAlert: null,\n })),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_PAYMENT_METHOD_CARD_ADD_REQUESTED,\n 'paymentBankForm',\n reduce((ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: PaymentBankFormContextual,\n successAlert: null,\n })),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_PAYMENT_METHOD_CARD_SPLIT_REQUESTED,\n 'paymentSplitView',\n reduce((ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: PaymentSplitViewContextual,\n successAlert: null,\n })),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_DOCUMENTS_CARD_VIEW_REQUESTED,\n 'documentManager',\n reduce(\n (\n ctx: DashboardContextInterface,\n ev: MachineEventType<\n EventPayloads,\n typeof componentEvents.EMPLOYEE_MANAGEMENT_DOCUMENTS_CARD_VIEW_REQUESTED\n >,\n ): DashboardContextInterface => ({\n ...ctx,\n component: DocumentManagerContextual,\n formId: ev.payload.formId,\n successAlert: null,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_CARD_ADD_REQUESTED,\n 'addJob',\n reduce((ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: AddJobContextual,\n currentJobId: null,\n successAlert: null,\n })),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_CARD_EDIT_REQUESTED,\n 'editCompensation',\n reduce(\n (\n ctx: DashboardContextInterface,\n ev: MachineEventType<\n EventPayloads,\n typeof componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_CARD_EDIT_REQUESTED\n >,\n ): DashboardContextInterface => ({\n ...ctx,\n component: EditCompensationContextual,\n currentJobId: ev.payload.jobId,\n successAlert: null,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_CARD_ADD_ANOTHER_REQUESTED,\n 'addAnotherJob',\n reduce((ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: AddAnotherJobContextual,\n currentJobId: null,\n successAlert: null,\n })),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_PAYMENT_METHOD_CARD_BANK_ACCOUNT_DELETED,\n 'index',\n reduce((ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n successAlert: 'bankAccountDeleted',\n })),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_DEDUCTIONS_CARD_ADD_REQUESTED,\n 'editDeduction',\n reduce((ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: DeductionsEditFormContextual,\n successAlert: null,\n editingDeductionId: undefined,\n })),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_DEDUCTIONS_CARD_EDIT_REQUESTED,\n 'editDeduction',\n reduce(\n (\n ctx: DashboardContextInterface,\n ev: MachineEventType<\n EventPayloads,\n typeof componentEvents.EMPLOYEE_MANAGEMENT_DEDUCTIONS_CARD_EDIT_REQUESTED\n >,\n ): DashboardContextInterface => ({\n ...ctx,\n component: DeductionsEditFormContextual,\n successAlert: null,\n editingDeductionId: ev.payload.uuid,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_DEDUCTIONS_CARD_DELETED,\n 'index',\n reduce((ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n successAlert: 'deductionDeleted',\n })),\n ),\n transition(\n componentEvents.EMPLOYEE_DISMISS,\n 'index',\n reduce((ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n successAlert: null,\n })),\n ),\n transition(\n componentEvents.EMPLOYEE_DASHBOARD_TAB_CHANGE,\n 'index',\n reduce(\n (\n ctx: DashboardContextInterface,\n ev: MachineEventType<EventPayloads, typeof componentEvents.EMPLOYEE_DASHBOARD_TAB_CHANGE>,\n ): DashboardContextInterface => ({\n ...ctx,\n selectedTab: ev.payload.tab,\n }),\n ),\n ),\n ),\n homeAddress: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_HOME_ADDRESS_EDIT_CANCELLED,\n 'index',\n returnToIndex,\n ),\n ),\n workAddress: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_WORK_ADDRESS_EDIT_CANCELLED,\n 'index',\n returnToIndex,\n ),\n ),\n federalTaxes: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_FEDERAL_TAXES_EDIT_FORM_CANCELLED,\n 'index',\n returnToIndex,\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_FEDERAL_TAXES_EDIT_FORM_SUBMITTED,\n 'index',\n returnToIndexWithAlert('federalTaxesUpdated'),\n ),\n ),\n stateTaxes: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_STATE_TAXES_UPDATED,\n 'index',\n returnToIndexWithAlert('stateTaxesUpdated'),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_STATE_TAXES_EDIT_CANCELLED,\n 'index',\n returnToIndex,\n ),\n ),\n profile: state<MachineTransition>(\n transition(componentEvents.EMPLOYEE_MANAGEMENT_PROFILE_EDIT_CANCELLED, 'index', returnToIndex),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_PROFILE_UPDATED,\n 'index',\n returnToIndexWithAlert('profileUpdated'),\n ),\n ),\n paymentBankForm: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_PAYMENT_METHOD_BANK_FORM_SUBMITTED,\n 'index',\n returnToIndexWithAlert('bankAccountAdded'),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_PAYMENT_METHOD_BANK_FORM_CANCELLED,\n 'index',\n returnToIndex,\n ),\n ),\n paymentSplitView: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_PAYMENT_METHOD_SPLIT_FORM_SUBMITTED,\n 'index',\n returnToIndexWithAlert('splitUpdated'),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_PAYMENT_METHOD_SPLIT_FORM_CANCELLED,\n 'index',\n returnToIndex,\n ),\n ),\n documentManager: state<MachineTransition>(\n // Admin-facing dashboard: documents are read-only here, so the viewer only\n // returns to the dashboard on Back. Signing happens in the employee\n // onboarding DocumentSigner flow, not from this surface.\n transition(componentEvents.CANCEL, 'index', returnToIndex),\n ),\n editDeduction: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_DEDUCTIONS_EDIT_FORM_CREATED,\n 'index',\n returnToIndexWithAlert('deductionAdded'),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_DEDUCTIONS_EDIT_FORM_UPDATED,\n 'index',\n returnToIndexWithAlert('deductionUpdated'),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_DEDUCTIONS_EDIT_FORM_CANCELLED,\n 'index',\n returnToIndex,\n ),\n ),\n addJob: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_ADD_JOB_FORM_SUBMITTED,\n 'index',\n returnToIndexWithAlert('jobAdded'),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_ADD_JOB_FORM_CANCELLED,\n 'index',\n returnToIndex,\n ),\n ),\n editCompensation: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_EDIT_FORM_SUBMITTED,\n 'index',\n returnToIndex,\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_EDIT_FORM_CANCELLED,\n 'index',\n returnToIndex,\n ),\n ),\n addAnotherJob: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_ADD_ANOTHER_JOB_FORM_SUBMITTED,\n 'index',\n returnToIndexWithAlert('jobAdded'),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_ADD_ANOTHER_JOB_FORM_CANCELLED,\n 'index',\n returnToIndex,\n ),\n ),\n}\n"],"names":["returnToIndex","reduce","ctx","DashboardViewContextual","returnToIndexWithAlert","alert","dashboardStateMachine","state","transition","componentEvents","ProfileContextual","HomeAddressContextual","WorkAddressContextual","FederalTaxesContextual","StateTaxesContextual","PaymentBankFormContextual","PaymentSplitViewContextual","ev","DocumentManagerContextual","AddJobContextual","EditCompensationContextual","AddAnotherJobContextual","DeductionsEditFormContextual"],"mappings":";;;AAmCA,MAAMA,I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,IAAA;AAAA,IAEFQ;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAT;AAAA,IAAA;AAAA,EACF;AAAA,EAEF,eAAeO;AAAA,IACbC;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAL,EAAuB,UAAU;AAAA,IAAA;AAAA,IAEnCI;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAT;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"dashboardStateMachine.js","sources":["../../../../src/components/Employee/Dashboard/dashboardStateMachine.ts"],"sourcesContent":["import { transition, reduce, state } from 'robot3'\nimport type { Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport type { DashboardTab } from './Dashboard'\nimport {\n DashboardViewContextual,\n HomeAddressContextual,\n WorkAddressContextual,\n FederalTaxesContextual,\n StateTaxesContextual,\n ProfileContextual,\n PaymentBankFormContextual,\n PaymentSplitViewContextual,\n DocumentManagerContextual,\n DeductionsEditFormContextual,\n AddJobContextual,\n EditCompensationContextual,\n AddAnotherJobContextual,\n type DashboardContextInterface,\n} from './DashboardComponents'\nimport { componentEvents } from '@/shared/constants'\nimport type { MachineEventType, MachineTransition } from '@/types/Helpers'\n\ntype EventPayloads = {\n [componentEvents.EMPLOYEE_MANAGEMENT_DOCUMENTS_CARD_VIEW_REQUESTED]: {\n employeeId: string\n formId: string\n }\n [componentEvents.EMPLOYEE_MANAGEMENT_DEDUCTIONS_CARD_EDIT_REQUESTED]: Garnishment\n [componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_CARD_EDIT_REQUESTED]: {\n employeeId: string\n jobId: string\n }\n [componentEvents.EMPLOYEE_DASHBOARD_TAB_CHANGE]: { tab: DashboardTab }\n}\n\nconst returnToIndex = reduce((ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: DashboardViewContextual,\n header: null,\n currentJobId: null,\n successAlert: null,\n}))\n\nconst returnToIndexWithAlert = (alert: DashboardContextInterface['successAlert']) =>\n reduce((ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: DashboardViewContextual,\n header: null,\n currentJobId: null,\n successAlert: alert,\n }))\n\n/** @internal */\nexport const dashboardStateMachine = {\n index: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_PROFILE_EDIT_REQUESTED,\n 'profile',\n reduce((ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: ProfileContextual,\n successAlert: null,\n })),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_HOME_ADDRESS_EDIT_REQUESTED,\n 'homeAddress',\n reduce((ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: HomeAddressContextual,\n successAlert: null,\n })),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_WORK_ADDRESS_EDIT_REQUESTED,\n 'workAddress',\n reduce((ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: WorkAddressContextual,\n successAlert: null,\n })),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_FEDERAL_TAXES_CARD_EDIT_REQUESTED,\n 'federalTaxes',\n reduce((ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: FederalTaxesContextual,\n successAlert: null,\n })),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_STATE_TAXES_EDIT_REQUESTED,\n 'stateTaxes',\n reduce((ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: StateTaxesContextual,\n successAlert: null,\n })),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_PAYMENT_METHOD_CARD_ADD_REQUESTED,\n 'paymentBankForm',\n reduce((ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: PaymentBankFormContextual,\n successAlert: null,\n })),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_PAYMENT_METHOD_CARD_SPLIT_REQUESTED,\n 'paymentSplitView',\n reduce((ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: PaymentSplitViewContextual,\n successAlert: null,\n })),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_DOCUMENTS_CARD_VIEW_REQUESTED,\n 'documentManager',\n reduce(\n (\n ctx: DashboardContextInterface,\n ev: MachineEventType<\n EventPayloads,\n typeof componentEvents.EMPLOYEE_MANAGEMENT_DOCUMENTS_CARD_VIEW_REQUESTED\n >,\n ): DashboardContextInterface => ({\n ...ctx,\n component: DocumentManagerContextual,\n formId: ev.payload.formId,\n successAlert: null,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_CARD_ADD_REQUESTED,\n 'addJob',\n reduce((ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: AddJobContextual,\n currentJobId: null,\n successAlert: null,\n })),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_CARD_EDIT_REQUESTED,\n 'editCompensation',\n reduce(\n (\n ctx: DashboardContextInterface,\n ev: MachineEventType<\n EventPayloads,\n typeof componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_CARD_EDIT_REQUESTED\n >,\n ): DashboardContextInterface => ({\n ...ctx,\n component: EditCompensationContextual,\n currentJobId: ev.payload.jobId,\n successAlert: null,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_CARD_ADD_ANOTHER_REQUESTED,\n 'addAnotherJob',\n reduce((ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: AddAnotherJobContextual,\n currentJobId: null,\n successAlert: null,\n })),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_PAYMENT_METHOD_CARD_BANK_ACCOUNT_DELETED,\n 'index',\n reduce((ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n successAlert: 'bankAccountDeleted',\n })),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_DEDUCTIONS_CARD_ADD_REQUESTED,\n 'editDeduction',\n reduce((ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n component: DeductionsEditFormContextual,\n successAlert: null,\n editingDeductionId: undefined,\n })),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_DEDUCTIONS_CARD_EDIT_REQUESTED,\n 'editDeduction',\n reduce(\n (\n ctx: DashboardContextInterface,\n ev: MachineEventType<\n EventPayloads,\n typeof componentEvents.EMPLOYEE_MANAGEMENT_DEDUCTIONS_CARD_EDIT_REQUESTED\n >,\n ): DashboardContextInterface => ({\n ...ctx,\n component: DeductionsEditFormContextual,\n successAlert: null,\n editingDeductionId: ev.payload.uuid,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_DEDUCTIONS_CARD_DELETED,\n 'index',\n reduce((ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n successAlert: 'deductionDeleted',\n })),\n ),\n transition(\n componentEvents.EMPLOYEE_DISMISS,\n 'index',\n reduce((ctx: DashboardContextInterface): DashboardContextInterface => ({\n ...ctx,\n successAlert: null,\n })),\n ),\n transition(\n componentEvents.EMPLOYEE_DASHBOARD_TAB_CHANGE,\n 'index',\n reduce(\n (\n ctx: DashboardContextInterface,\n ev: MachineEventType<EventPayloads, typeof componentEvents.EMPLOYEE_DASHBOARD_TAB_CHANGE>,\n ): DashboardContextInterface => ({\n ...ctx,\n selectedTab: ev.payload.tab,\n }),\n ),\n ),\n ),\n homeAddress: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_HOME_ADDRESS_EDIT_CANCELLED,\n 'index',\n returnToIndex,\n ),\n ),\n workAddress: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_WORK_ADDRESS_EDIT_CANCELLED,\n 'index',\n returnToIndex,\n ),\n ),\n federalTaxes: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_FEDERAL_TAXES_EDIT_FORM_CANCELLED,\n 'index',\n returnToIndex,\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_FEDERAL_TAXES_EDIT_FORM_SUBMITTED,\n 'index',\n returnToIndexWithAlert('federalTaxesUpdated'),\n ),\n ),\n stateTaxes: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_STATE_TAXES_UPDATED,\n 'index',\n returnToIndexWithAlert('stateTaxesUpdated'),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_STATE_TAXES_EDIT_CANCELLED,\n 'index',\n returnToIndex,\n ),\n ),\n profile: state<MachineTransition>(\n transition(componentEvents.EMPLOYEE_MANAGEMENT_PROFILE_EDIT_CANCELLED, 'index', returnToIndex),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_PROFILE_UPDATED,\n 'index',\n returnToIndexWithAlert('profileUpdated'),\n ),\n ),\n paymentBankForm: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_PAYMENT_METHOD_BANK_FORM_SUBMITTED,\n 'index',\n returnToIndexWithAlert('bankAccountAdded'),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_PAYMENT_METHOD_BANK_FORM_CANCELLED,\n 'index',\n returnToIndex,\n ),\n ),\n paymentSplitView: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_PAYMENT_METHOD_SPLIT_FORM_SUBMITTED,\n 'index',\n returnToIndexWithAlert('splitUpdated'),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_PAYMENT_METHOD_SPLIT_FORM_CANCELLED,\n 'index',\n returnToIndex,\n ),\n ),\n documentManager: state<MachineTransition>(\n // Admin-facing dashboard: documents are read-only here, so the viewer only\n // returns to the dashboard on Back. Signing happens in the employee\n // onboarding DocumentSigner flow, not from this surface.\n transition(componentEvents.CANCEL, 'index', returnToIndex),\n ),\n editDeduction: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_DEDUCTIONS_EDIT_FORM_CREATED,\n 'index',\n returnToIndexWithAlert('deductionAdded'),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_DEDUCTIONS_EDIT_FORM_UPDATED,\n 'index',\n returnToIndexWithAlert('deductionUpdated'),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_DEDUCTIONS_EDIT_FORM_CANCELLED,\n 'index',\n returnToIndex,\n ),\n ),\n addJob: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_ADD_JOB_FORM_SUBMITTED,\n 'index',\n returnToIndexWithAlert('jobAdded'),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_ADD_JOB_FORM_CANCELLED,\n 'index',\n returnToIndex,\n ),\n ),\n editCompensation: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_EDIT_FORM_SUBMITTED,\n 'index',\n returnToIndex,\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_EDIT_FORM_CANCELLED,\n 'index',\n returnToIndex,\n ),\n ),\n addAnotherJob: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_ADD_ANOTHER_JOB_FORM_SUBMITTED,\n 'index',\n returnToIndexWithAlert('jobAdded'),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_ADD_ANOTHER_JOB_FORM_CANCELLED,\n 'index',\n returnToIndex,\n ),\n ),\n}\n"],"names":["returnToIndex","reduce","ctx","DashboardViewContextual","returnToIndexWithAlert","alert","dashboardStateMachine","state","transition","componentEvents","ProfileContextual","HomeAddressContextual","WorkAddressContextual","FederalTaxesContextual","StateTaxesContextual","PaymentBankFormContextual","PaymentSplitViewContextual","ev","DocumentManagerContextual","AddJobContextual","EditCompensationContextual","AddAnotherJobContextual","DeductionsEditFormContextual"],"mappings":";;;AAmCA,MAAMA,IAAgBC,EAAO,CAACC,OAA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AAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAT;AAAA,IAAA;AAAA,EACF;AAAA,EAEF,eAAeO;AAAA,IACbC;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAL,EAAuB,UAAU;AAAA,IAAA;AAAA,IAEnCI;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAT;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeductionsCard.js","sources":["../../../../../../src/components/Employee/Deductions/management/DeductionsCard/DeductionsCard.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { Garnishment } from '@gusto/embedded-api-v-2026-02-01/models/components/garnishment'\nimport { useDeductionsList } from '../../shared/useDeductionsList'\nimport { useDeleteDeduction } from '../../shared/useDeleteDeduction'\nimport { DeleteDeductionDialog } from '../../shared/DeleteDeductionDialog'\nimport { formatDeductionAmount } from '../../shared/formatDeductionAmount'\nimport { DataView, useDataView, EmptyData, Loading } from '@/components/Common'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport { BaseBoundaries, BaseLayout } from '@/components/Base/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport useNumberFormatter from '@/hooks/useNumberFormatter'\nimport { useI18n } from '@/i18n'\nimport { componentEvents, type EventType } from '@/shared/constants'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport PlusCircleIcon from '@/assets/icons/plus-circle.svg?react'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\n\n/**\n * Props for {@link DeductionsCard}.\n *\n * @public\n */\nexport interface DeductionsCardProps {\n /** The associated employee identifier. */\n employeeId: string\n /** Callback invoked when the card emits an event. See the events table on {@link DeductionsCard} for the available event types and payloads. */\n onEvent: OnEventType<EventType, unknown>\n}\n\n/**\n * Standalone read-only card listing an employee's active deductions, with affordances to add, edit, or delete a deduction.\n *\n * @remarks\n * Fetches its own data and owns the delete confirm dialog. Has no alert API — alert rendering is the consumer's responsibility. Add and edit affordances do not open a form themselves; emit-then-route is the contract, so the consumer listens for the `addRequested` / `editRequested` events and renders {@link DeductionsEditForm} (or its own equivalent) accordingly. For an orchestrated card-plus-form flow, use {@link Deductions} instead.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `employee/management/deductions/card/addRequested` | Fired when the \"Add deduction\" CTA is clicked | `{ employeeId: string }` |\n * | `employee/management/deductions/card/editRequested` | Fired when an \"Edit\" CTA is clicked for a deduction | The matching `Garnishment` |\n * | `employee/management/deductions/card/deleted` | Fired after a deduction is deleted via the confirm dialog | The deleted `Garnishment` |\n *\n * @param props - See {@link DeductionsCardProps}.\n * @returns The rendered deductions card.\n * @public\n */\nexport function DeductionsCard(props: DeductionsCardProps) {\n return (\n <BaseBoundaries componentName=\"Employee.Management.Deductions\">\n <DeductionsCardContent {...props} />\n </BaseBoundaries>\n )\n}\n\nfunction DeductionsCardContent({ employeeId, onEvent }: DeductionsCardProps) {\n useI18n('Employee.Management.Deductions')\n const { t } = useTranslation('Employee.Management.Deductions')\n const Components = useComponentContext()\n const formatCurrency = useNumberFormatter('currency')\n const formatPercent = useNumberFormatter('percent')\n\n const deductionsList = useDeductionsList({ employeeId })\n\n const {\n pendingDeleteDeduction,\n setPendingDeleteDeduction,\n handleConfirmDelete: handleConfirmDeleteDeduction,\n } = useDeleteDeduction(async garnishment => {\n if (deductionsList.isLoading) return\n const result = await deductionsList.actions.onDelete(garnishment)\n if (result) {\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_DEDUCTIONS_CARD_DELETED, result.data.garnishment)\n }\n })\n\n // `useDeductionsList` returns `isLoading: true` even when the query has\n // errored and `data` is missing. Treat those rows as \"not loading\" so the\n // section doesn't show a perpetual skeleton while BaseLayout already\n // renders the error alert.\n const isDeductionsLoading =\n deductionsList.isLoading && deductionsList.errorHandling.errors.length === 0\n\n const deductions = deductionsList.isLoading ? [] : deductionsList.data.deductions\n const deletingGarnishmentUuid = deductionsList.isLoading\n ? undefined\n : deductionsList.status.deletingGarnishmentUuid\n\n const handleAdd = () => {\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_DEDUCTIONS_CARD_ADD_REQUESTED, { employeeId })\n }\n const handleEdit = (garnishment: Garnishment) => {\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_DEDUCTIONS_CARD_EDIT_REQUESTED, garnishment)\n }\n\n const garnishmentsColumns = [\n {\n key: 'description',\n title: t('columns.deduction'),\n render: (garnishment: Garnishment) => garnishment.description || '-',\n },\n {\n key: 'frequency',\n title: t('columns.frequency'),\n render: (garnishment: Garnishment) => (garnishment.recurring ? t('recurring') : t('oneTime')),\n },\n {\n key: 'amount',\n title: t('columns.withhold'),\n render: (garnishment: Garnishment) =>\n formatDeductionAmount(garnishment, {\n formatCurrency,\n formatPercent,\n formatPerPaycheck: (value: string) => t('amountPerPaycheck', { value }),\n }),\n },\n ]\n\n const garnishmentsDataView = useDataView({\n data: deductions,\n columns: garnishmentsColumns,\n itemMenu: (garnishment: Garnishment) => (\n <HamburgerMenu\n isLoading={deletingGarnishmentUuid === garnishment.uuid}\n items={[\n {\n label: t('editCta'),\n onClick: () => {\n handleEdit(garnishment)\n },\n icon: <PencilSvg aria-hidden />,\n },\n {\n label: t('deleteCta'),\n onClick: () => {\n setPendingDeleteDeduction(garnishment)\n },\n icon: <TrashCanSvg aria-hidden />,\n },\n ]}\n triggerLabel={t('hamburgerTitle')}\n />\n ),\n emptyState: () => (\n <EmptyData title={t('emptyState.title')} description={t('emptyState.description')} />\n ),\n })\n\n return (\n <BaseLayout error={deductionsList.errorHandling.errors}>\n <Components.Box\n withPadding={false}\n header={\n <Components.BoxHeader\n title={t('title')}\n action={\n <Components.Button variant=\"secondary\" onClick={handleAdd} icon={<PlusCircleIcon />}>\n {t('addDeductionCta')}\n </Components.Button>\n }\n />\n }\n >\n {isDeductionsLoading ? (\n <Loading />\n ) : (\n <DataView label={t('listLabel')} isWithinBox {...garnishmentsDataView} />\n )}\n </Components.Box>\n\n <DeleteDeductionDialog\n pendingDeleteDeduction={pendingDeleteDeduction}\n isPrimaryActionLoading={deletingGarnishmentUuid === pendingDeleteDeduction?.uuid}\n onClose={() => {\n setPendingDeleteDeduction(null)\n }}\n onConfirm={() => {\n void handleConfirmDeleteDeduction()\n }}\n title={t('deleteDeductionDialog.title')}\n description={t('deleteDeductionDialog.description', {\n deduction: pendingDeleteDeduction?.description ?? '',\n })}\n confirmLabel={t('deleteDeductionDialog.confirmCta')}\n cancelLabel={t('deleteDeductionDialog.cancelCta')}\n />\n </BaseLayout>\n )\n}\n"],"names":["DeductionsCard","props","jsx","BaseBoundaries","DeductionsCardContent","employeeId","onEvent","useI18n","t","useTranslation","Components","useComponentContext","formatCurrency","useNumberFormatter","formatPercent","deductionsList","useDeductionsList","pendingDeleteDeduction","setPendingDeleteDeduction","handleConfirmDeleteDeduction","useDeleteDeduction","garnishment","result","componentEvents","isDeductionsLoading","deductions","deletingGarnishmentUuid","handleAdd","handleEdit","garnishmentsColumns","formatDeductionAmount","value","garnishmentsDataView","useDataView","HamburgerMenu","PencilSvg","TrashCanSvg","EmptyData","jsxs","BaseLayout","PlusCircleIcon","Loading","DataView","DeleteDeductionDialog"],"mappings":";;;;;;;;;;;;;;;;;;;AA+CO,SAASA,GAAeC,GAA4B;AACzD,SACE,gBAAAC,EAACC,KAAe,eAAc,kCAC5B,4BAACC,GAAA,EAAuB,GAAGH,GAAO,EAAA,CACpC;AAEJ;AAEA,SAASG,EAAsB,EAAE,YAAAC,GAAY,SAAAC,KAAgC;AAC3E,EAAAC,EAAQ,gCAAgC;AACxC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,gCAAgC,GACvDC,IAAaC,EAAA,GACbC,IAAiBC,EAAmB,UAAU,GAC9CC,IAAgBD,EAAmB,SAAS,GAE5CE,IAAiBC,EAAkB,EAAE,YAAAX,GAAY,GAEjD;AAAA,IACJ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;AAAA,IAI3E,gBAAA9B;AAAA,MAACyC;AAAA,MAAA;AAAA,QACC,wBAAA1B;AAAA,QACA,wBAAwBS,MAA4BT,GAAwB;AAAA,QAC5E,SAAS,MAAM;AACb,UAAAC,EAA0B,IAAI;AAAA,QAChC;AAAA,QACA,WAAW,MAAM;AACf,UAAKC,EAAA;AAAA,QACP;AAAA,QACA,OAAOX,EAAE,6BAA6B;AAAA,QACtC,aAAaA,EAAE,qCAAqC;AAAA,UAClD,WAAWS,GAAwB,eAAe;AAAA,QAAA,CACnD;AAAA,QACD,cAAcT,EAAE,kCAAkC;AAAA,QAClD,aAAaA,EAAE,iCAAiC;AAAA,MAAA;AAAA,IAAA;AAAA,EAClD,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"DeductionsCard.js","sources":["../../../../../../src/components/Employee/Deductions/management/DeductionsCard/DeductionsCard.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { useDeductionsList } from '../../shared/useDeductionsList'\nimport { useDeleteDeduction } from '../../shared/useDeleteDeduction'\nimport { DeleteDeductionDialog } from '../../shared/DeleteDeductionDialog'\nimport { formatDeductionAmount } from '../../shared/formatDeductionAmount'\nimport { DataView, useDataView, EmptyData, Loading } from '@/components/Common'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport { BaseBoundaries, BaseLayout } from '@/components/Base/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport useNumberFormatter from '@/hooks/useNumberFormatter'\nimport { useI18n } from '@/i18n'\nimport { componentEvents, type EventType } from '@/shared/constants'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport PlusCircleIcon from '@/assets/icons/plus-circle.svg?react'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\n\n/**\n * Props for {@link DeductionsCard}.\n *\n * @public\n */\nexport interface DeductionsCardProps {\n /** The associated employee identifier. */\n employeeId: string\n /** Callback invoked when the card emits an event. See the events table on {@link DeductionsCard} for the available event types and payloads. */\n onEvent: OnEventType<EventType, unknown>\n}\n\n/**\n * Standalone read-only card listing an employee's active deductions, with affordances to add, edit, or delete a deduction.\n *\n * @remarks\n * Fetches its own data and owns the delete confirm dialog. Has no alert API — alert rendering is the consumer's responsibility. Add and edit affordances do not open a form themselves; emit-then-route is the contract, so the consumer listens for the `addRequested` / `editRequested` events and renders {@link DeductionsEditForm} (or its own equivalent) accordingly. For an orchestrated card-plus-form flow, use {@link Deductions} instead.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `employee/management/deductions/card/addRequested` | Fired when the \"Add deduction\" CTA is clicked | `{ employeeId: string }` |\n * | `employee/management/deductions/card/editRequested` | Fired when an \"Edit\" CTA is clicked for a deduction | The matching `Garnishment` |\n * | `employee/management/deductions/card/deleted` | Fired after a deduction is deleted via the confirm dialog | The deleted `Garnishment` |\n *\n * @param props - See {@link DeductionsCardProps}.\n * @returns The rendered deductions card.\n * @public\n */\nexport function DeductionsCard(props: DeductionsCardProps) {\n return (\n <BaseBoundaries componentName=\"Employee.Management.Deductions\">\n <DeductionsCardContent {...props} />\n </BaseBoundaries>\n )\n}\n\nfunction DeductionsCardContent({ employeeId, onEvent }: DeductionsCardProps) {\n useI18n('Employee.Management.Deductions')\n const { t } = useTranslation('Employee.Management.Deductions')\n const Components = useComponentContext()\n const formatCurrency = useNumberFormatter('currency')\n const formatPercent = useNumberFormatter('percent')\n\n const deductionsList = useDeductionsList({ employeeId })\n\n const {\n pendingDeleteDeduction,\n setPendingDeleteDeduction,\n handleConfirmDelete: handleConfirmDeleteDeduction,\n } = useDeleteDeduction(async garnishment => {\n if (deductionsList.isLoading) return\n const result = await deductionsList.actions.onDelete(garnishment)\n if (result) {\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_DEDUCTIONS_CARD_DELETED, result.data.garnishment)\n }\n })\n\n // `useDeductionsList` returns `isLoading: true` even when the query has\n // errored and `data` is missing. Treat those rows as \"not loading\" so the\n // section doesn't show a perpetual skeleton while BaseLayout already\n // renders the error alert.\n const isDeductionsLoading =\n deductionsList.isLoading && deductionsList.errorHandling.errors.length === 0\n\n const deductions = deductionsList.isLoading ? [] : deductionsList.data.deductions\n const deletingGarnishmentUuid = deductionsList.isLoading\n ? undefined\n : deductionsList.status.deletingGarnishmentUuid\n\n const handleAdd = () => {\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_DEDUCTIONS_CARD_ADD_REQUESTED, { employeeId })\n }\n const handleEdit = (garnishment: Garnishment) => {\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_DEDUCTIONS_CARD_EDIT_REQUESTED, garnishment)\n }\n\n const garnishmentsColumns = [\n {\n key: 'description',\n title: t('columns.deduction'),\n render: (garnishment: Garnishment) => garnishment.description || '-',\n },\n {\n key: 'frequency',\n title: t('columns.frequency'),\n render: (garnishment: Garnishment) => (garnishment.recurring ? t('recurring') : t('oneTime')),\n },\n {\n key: 'amount',\n title: t('columns.withhold'),\n render: (garnishment: Garnishment) =>\n formatDeductionAmount(garnishment, {\n formatCurrency,\n formatPercent,\n formatPerPaycheck: (value: string) => t('amountPerPaycheck', { value }),\n }),\n },\n ]\n\n const garnishmentsDataView = useDataView({\n data: deductions,\n columns: garnishmentsColumns,\n itemMenu: (garnishment: Garnishment) => (\n <HamburgerMenu\n isLoading={deletingGarnishmentUuid === garnishment.uuid}\n items={[\n {\n label: t('editCta'),\n onClick: () => {\n handleEdit(garnishment)\n },\n icon: <PencilSvg aria-hidden />,\n },\n {\n label: t('deleteCta'),\n onClick: () => {\n setPendingDeleteDeduction(garnishment)\n },\n icon: <TrashCanSvg aria-hidden />,\n },\n ]}\n triggerLabel={t('hamburgerTitle')}\n />\n ),\n emptyState: () => (\n <EmptyData title={t('emptyState.title')} description={t('emptyState.description')} />\n ),\n })\n\n return (\n <BaseLayout error={deductionsList.errorHandling.errors}>\n <Components.Box\n withPadding={false}\n header={\n <Components.BoxHeader\n title={t('title')}\n action={\n <Components.Button variant=\"secondary\" onClick={handleAdd} icon={<PlusCircleIcon />}>\n {t('addDeductionCta')}\n </Components.Button>\n }\n />\n }\n >\n {isDeductionsLoading ? (\n <Loading />\n ) : (\n <DataView label={t('listLabel')} isWithinBox {...garnishmentsDataView} />\n )}\n </Components.Box>\n\n <DeleteDeductionDialog\n pendingDeleteDeduction={pendingDeleteDeduction}\n isPrimaryActionLoading={deletingGarnishmentUuid === pendingDeleteDeduction?.uuid}\n onClose={() => {\n setPendingDeleteDeduction(null)\n }}\n onConfirm={() => {\n void handleConfirmDeleteDeduction()\n }}\n title={t('deleteDeductionDialog.title')}\n description={t('deleteDeductionDialog.description', {\n deduction: pendingDeleteDeduction?.description ?? '',\n })}\n confirmLabel={t('deleteDeductionDialog.confirmCta')}\n cancelLabel={t('deleteDeductionDialog.cancelCta')}\n />\n </BaseLayout>\n )\n}\n"],"names":["DeductionsCard","props","jsx","BaseBoundaries","DeductionsCardContent","employeeId","onEvent","useI18n","t","useTranslation","Components","useComponentContext","formatCurrency","useNumberFormatter","formatPercent","deductionsList","useDeductionsList","pendingDeleteDeduction","setPendingDeleteDeduction","handleConfirmDeleteDeduction","useDeleteDeduction","garnishment","result","componentEvents","isDeductionsLoading","deductions","deletingGarnishmentUuid","handleAdd","handleEdit","garnishmentsColumns","formatDeductionAmount","value","garnishmentsDataView","useDataView","HamburgerMenu","PencilSvg","TrashCanSvg","EmptyData","jsxs","BaseLayout","PlusCircleIcon","Loading","DataView","DeleteDeductionDialog"],"mappings":";;;;;;;;;;;;;;;;;;;AA+CO,SAASA,GAAeC,GAA4B;AACzD,SACE,gBAAAC,EAACC,KAAe,eAAc,kCAC5B,4BAACC,GAAA,EAAuB,GAAGH,GAAO,EAAA,CACpC;AAEJ;AAEA,SAASG,EAAsB,EAAE,YAAAC,GAAY,SAAAC,KAAgC;AAC3E,EAAAC,EAAQ,gCAAgC;AACxC,QAAM,EAAE,GAAAC,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UAAAgB,IACC,gBAAAtB,EAACuC,GAAA,CAAA,CAAQ,IAET,gBAAAvC,EAACwC,GAAA,EAAS,OAAOlC,EAAE,WAAW,GAAG,aAAW,IAAE,GAAGwB,EAAA,CAAsB;AAAA,MAAA;AAAA,IAAA;AAAA,IAI3E,gBAAA9B;AAAA,MAACyC;AAAA,MAAA;AAAA,QACC,wBAAA1B;AAAA,QACA,wBAAwBS,MAA4BT,GAAwB;AAAA,QAC5E,SAAS,MAAM;AACb,UAAAC,EAA0B,IAAI;AAAA,QAChC;AAAA,QACA,WAAW,MAAM;AACf,UAAKC,EAAA;AAAA,QACP;AAAA,QACA,OAAOX,EAAE,6BAA6B;AAAA,QACtC,aAAaA,EAAE,qCAAqC;AAAA,UAClD,WAAWS,GAAwB,eAAe;AAAA,QAAA,CACnD;AAAA,QACD,cAAcT,EAAE,kCAAkC;AAAA,QAClD,aAAaA,EAAE,iCAAiC;AAAA,MAAA;AAAA,IAAA;AAAA,EAClD,GACF;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deductionsStateMachine.js","sources":["../../../../../src/components/Employee/Deductions/management/deductionsStateMachine.ts"],"sourcesContent":["import { reduce, state, transition } from 'robot3'\nimport type { ComponentType } from 'react'\nimport type { Garnishment } from '@gusto/embedded-api
|
|
1
|
+
{"version":3,"file":"deductionsStateMachine.js","sources":["../../../../../src/components/Employee/Deductions/management/deductionsStateMachine.ts"],"sourcesContent":["import { reduce, state, transition } from 'robot3'\nimport type { ComponentType } from 'react'\nimport type { Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport type { DeductionsContextInterface } from './DeductionsComponents'\nimport { DeductionsCardContextual, DeductionsEditFormContextual } from './DeductionsComponents'\nimport { componentEvents } from '@/shared/constants'\nimport type { MachineEventType, MachineTransition } from '@/types/Helpers'\n\ntype EventPayloads = {\n [componentEvents.EMPLOYEE_MANAGEMENT_DEDUCTIONS_CARD_EDIT_REQUESTED]: Garnishment\n}\n\nconst returnToCard = reduce((ctx: DeductionsContextInterface): DeductionsContextInterface => ({\n ...ctx,\n component: DeductionsCardContextual as ComponentType,\n successAlert: null,\n editingDeductionId: undefined,\n}))\n\nconst returnToCardWithAlert = (alert: DeductionsContextInterface['successAlert']) =>\n reduce((ctx: DeductionsContextInterface): DeductionsContextInterface => ({\n ...ctx,\n component: DeductionsCardContextual as ComponentType,\n successAlert: alert,\n editingDeductionId: undefined,\n }))\n\n/** @internal */\nexport const deductionsStateMachine = {\n card: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_DEDUCTIONS_CARD_ADD_REQUESTED,\n 'editDeduction',\n reduce((ctx: DeductionsContextInterface): DeductionsContextInterface => ({\n ...ctx,\n component: DeductionsEditFormContextual as ComponentType,\n successAlert: null,\n editingDeductionId: undefined,\n })),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_DEDUCTIONS_CARD_EDIT_REQUESTED,\n 'editDeduction',\n reduce(\n (\n ctx: DeductionsContextInterface,\n ev: MachineEventType<\n EventPayloads,\n typeof componentEvents.EMPLOYEE_MANAGEMENT_DEDUCTIONS_CARD_EDIT_REQUESTED\n >,\n ): DeductionsContextInterface => ({\n ...ctx,\n component: DeductionsEditFormContextual as ComponentType,\n successAlert: null,\n editingDeductionId: ev.payload.uuid,\n }),\n ),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_DEDUCTIONS_CARD_DELETED,\n 'card',\n returnToCardWithAlert('deductionDeleted'),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_DEDUCTIONS_ALERT_DISMISSED,\n 'card',\n returnToCard,\n ),\n ),\n editDeduction: state<MachineTransition>(\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_DEDUCTIONS_EDIT_FORM_CREATED,\n 'card',\n returnToCardWithAlert('deductionAdded'),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_DEDUCTIONS_EDIT_FORM_UPDATED,\n 'card',\n returnToCardWithAlert('deductionUpdated'),\n ),\n transition(\n componentEvents.EMPLOYEE_MANAGEMENT_DEDUCTIONS_EDIT_FORM_CANCELLED,\n 'card',\n returnToCard,\n ),\n ),\n}\n"],"names":["returnToCard","reduce","ctx","DeductionsCardContextual","returnToCardWithAlert","alert","deductionsStateMachine","state","transition","componentEvents","DeductionsEditFormContextual","ev"],"mappings":";;;AAYA,MAAMA,IAAeC,EAAO,CAACC,OAAiE;AAAA,EAC5F,GAAGA;AAAA,EACH,WAAWC;AAAA,EACX,cAAc;AAAA,EACd,oBAAoB;AACtB,EAAE,GAEIC,IAAwB,CAACC,MAC7BJ,EAAO,CAACC,OAAiE;AAAA,EACvE,GAAGA;AAAA,EACH,WAAWC;AAAA,EACX,cAAcE;AAAA,EACd,oBAAoB;AACtB,EAAE,GAGSC,IAAyB;AAAA,EACpC,MAAMC;AAAA,IACJC;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAR,EAAO,CAACC,OAAiE;AAAA,QACvE,GAAGA;AAAA,QACH,WAAWQ;AAAA,QACX,cAAc;AAAA,QACd,oBAAoB;AAAA,MAAA,EACpB;AAAA,IAAA;AAAA,IAEJF;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAR;AAAA,QACE,CACEC,GACAS,OAIgC;AAAA,UAChC,GAAGT;AAAA,UACH,WAAWQ;AAAA,UACX,cAAc;AAAA,UACd,oBAAoBC,EAAG,QAAQ;AAAA,QAAA;AAAA,MACjC;AAAA,IACF;AAAA,IAEFH;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAL,EAAsB,kBAAkB;AAAA,IAAA;AAAA,IAE1CI;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAT;AAAA,IAAA;AAAA,EACF;AAAA,EAEF,eAAeO;AAAA,IACbC;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAL,EAAsB,gBAAgB;AAAA,IAAA;AAAA,IAExCI;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAL,EAAsB,kBAAkB;AAAA,IAAA;AAAA,IAE1CI;AAAA,MACEC,EAAgB;AAAA,MAChB;AAAA,MACAT;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Garnishment } from '@gusto/embedded-api
|
|
1
|
+
import { Garnishment } from '@gusto/embedded-api/models/components/garnishment';
|
|
2
2
|
import { UseDeductionsListReady } from '../../shared/useDeductionsList';
|
|
3
3
|
/** @internal */
|
|
4
4
|
export interface DeductionsListProps {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeductionsList.js","sources":["../../../../../../src/components/Employee/Deductions/onboarding/DeductionsList/DeductionsList.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { Garnishment } from '@gusto/embedded-api
|
|
1
|
+
{"version":3,"file":"DeductionsList.js","sources":["../../../../../../src/components/Employee/Deductions/onboarding/DeductionsList/DeductionsList.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport type { UseDeductionsListReady } from '../../shared/useDeductionsList'\nimport { formatDeductionAmount } from '../../shared/formatDeductionAmount'\nimport { useDataView, DataView } from '@/components/Common'\nimport { ActionsLayout } from '@/components/Common'\nimport { EmptyData } from '@/components/Common/EmptyData/EmptyData'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport useNumberFormatter from '@/hooks/useNumberFormatter'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport PlusCircleIcon from '@/assets/icons/plus-circle.svg?react'\n\n/** @internal */\nexport interface DeductionsListProps {\n className?: string\n deductionsList: UseDeductionsListReady\n onAdd: () => void\n onEdit: (deduction: Garnishment) => void\n onDelete: (deduction: Garnishment) => void\n onContinue: () => void\n}\n\n/** @internal */\nexport function DeductionsList({\n className,\n deductionsList,\n onAdd,\n onEdit,\n onDelete,\n onContinue,\n}: DeductionsListProps) {\n useI18n('Employee.Deductions')\n const { t } = useTranslation('Employee.Deductions')\n const Components = useComponentContext()\n const formatCurrency = useNumberFormatter('currency')\n const formatPercent = useNumberFormatter('percent')\n\n const { deductions } = deductionsList.data\n const isPendingAny = deductionsList.status.isPending\n const isEmpty = deductions.length === 0\n\n const { ...dataViewProps } = useDataView({\n data: deductions,\n columns: [\n {\n key: 'description',\n title: t('nameColumn'),\n },\n {\n key: 'recurring',\n title: t('frequencyColumn'),\n render: deduction => {\n return deduction.recurring ? t('recurringText') : t('nonRecurringText')\n },\n },\n {\n key: 'amount',\n title: t('withheldColumn'),\n render: deduction =>\n formatDeductionAmount(deduction, {\n formatCurrency,\n formatPercent,\n formatPerPaycheck: (value: string) => t('recurringAmount', { value }),\n }),\n },\n ],\n emptyState: () => (\n <EmptyData title={t('includeDeductionsEmptyState')}>\n <Components.Button type=\"button\" variant=\"secondary\" onClick={onAdd}>\n <PlusCircleIcon />\n {t('addDeductionButtonCta')}\n </Components.Button>\n </EmptyData>\n ),\n itemMenu: deduction => {\n return (\n <HamburgerMenu\n isLoading={isPendingAny}\n items={[\n {\n label: t('editCta'),\n onClick: () => {\n onEdit(deduction)\n },\n icon: <PencilSvg aria-hidden />,\n },\n {\n label: t('deleteCta'),\n onClick: () => {\n onDelete(deduction)\n },\n icon: <TrashCanSvg aria-hidden />,\n },\n ]}\n />\n )\n },\n })\n\n return (\n <section className={className}>\n <Flex flexDirection=\"column\" gap={32}>\n <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 <DataView label={t('deductionsTableLabel')} {...dataViewProps} />\n <ActionsLayout>\n {!isEmpty && (\n <Components.Button variant=\"secondary\" onClick={onAdd}>\n <PlusCircleIcon />\n {t('addDeductionCta')}\n </Components.Button>\n )}\n <Components.Button onClick={onContinue}>{t('continueCta')}</Components.Button>\n </ActionsLayout>\n </Flex>\n </section>\n )\n}\n"],"names":["DeductionsList","className","deductionsList","onAdd","onEdit","onDelete","onContinue","useI18n","useTranslation","Components","useComponentContext","formatCurrency","useNumberFormatter","formatPercent","deductions","isPendingAny","isEmpty","dataViewProps","useDataView","deduction","formatDeductionAmount","value","jsx","EmptyData","jsxs","PlusCircleIcon","HamburgerMenu","PencilSvg","TrashCanSvg","Flex","DataView","ActionsLayout"],"mappings":";;;;;;;;;;;;;;;AA2BO,SAASA,EAAe;AAAA,EAC7B,WAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC;AACF,GAAwB;AACtB,EAAAC,EAAQ,qBAAqB;AAC7B,QAAM,EAAE,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA,GACbC,IAAiBC,EAAmB,UAAU,GAC9CC,IAAgBD,EAAmB,SAAS,GAE5C,EAAE,YAAAE,MAAeZ,EAAe,MAChCa,IAAeb,EAAe,OAAO,WACrCc,IAAUF,EAAW,WAAW,GAEhC,EAAE,GAAGG,EAAA,IAAkBC,EAAY;AAAA,IACvC,MAAMJ;AAAA,IACN,SAAS;AAAA,MACP;AAAA,QACE,KAAK;AAAA,QACL,OAAO,EAAE,YAAY;AAAA,MAAA;AAAA,MAEvB;AAAA,QACE,KAAK;AAAA,QACL,OAAO,EAAE,iBAAiB;AAAA,QAC1B,QAAQ,CAAAK,MACCA,EAAU,YAAY,EAAE,eAAe,IAAI,EAAE,kBAAkB;AAAA,MACxE;AAAA,MAEF;AAAA,QACE,KAAK;AAAA,QACL,OAAO,EAAE,gBAAgB;AAAA,QACzB,QAAQ,CAAAA,MACNC,EAAsBD,GAAW;AAAA,UAC/B,gBAAAR;AAAA,UACA,eAAA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ACF;AAAA,sBAECqB,GAAA,EAAS,OAAO,EAAE,sBAAsB,GAAI,GAAGb,GAAe;AAAA,sBAC9Dc,GAAA,EACE,UAAA;AAAA,MAAA,CAACf,uBACCP,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASN,GAC9C,UAAA;AAAA,QAAA,gBAAAmB,EAACG,GAAA,EAAe;AAAA,QACf,EAAE,iBAAiB;AAAA,MAAA,GACtB;AAAA,MAEF,gBAAAH,EAACb,EAAW,QAAX,EAAkB,SAASH,GAAa,UAAA,EAAE,aAAa,EAAA,CAAE;AAAA,IAAA,EAAA,CAC5D;AAAA,EAAA,EAAA,CACF,EAAA,CACF;AAEJ;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Garnishment } from '@gusto/embedded-api
|
|
1
|
+
import { Garnishment } from '@gusto/embedded-api/models/components/garnishment';
|
|
2
2
|
import { FlowContextInterface } from '../../../Flow/useFlow';
|
|
3
3
|
import { componentEvents } from '../../../../shared/constants';
|
|
4
4
|
/** @internal */
|
package/dist/components/Employee/Deductions/onboarding/deductionsContextualComponents.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deductionsContextualComponents.js","sources":["../../../../../src/components/Employee/Deductions/onboarding/deductionsContextualComponents.tsx"],"sourcesContent":["import { type Garnishment } from '@gusto/embedded-api
|
|
1
|
+
{"version":3,"file":"deductionsContextualComponents.js","sources":["../../../../../src/components/Employee/Deductions/onboarding/deductionsContextualComponents.tsx"],"sourcesContent":["import { type Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport { useDeductionsList } from '../shared/useDeductionsList'\nimport { DeductionsForm } from '../shared/DeductionsForm'\nimport { DeductionsList } from './DeductionsList/DeductionsList'\nimport { useOnboardingDeductionsFormDictionary } from './useFormDictionary'\nimport { BaseLayout } from '@/components/Base/Base'\nimport { useFlow, type FlowContextInterface } from '@/components/Flow/useFlow'\nimport { componentEvents } from '@/shared/constants'\nimport { ensureRequired } from '@/helpers/ensureRequired'\n\n/** @internal */\nexport type EventPayloads = {\n [componentEvents.EMPLOYEE_DEDUCTION_ADD]: undefined\n [componentEvents.EMPLOYEE_DEDUCTION_EDIT]: Garnishment\n [componentEvents.EMPLOYEE_DEDUCTION_CANCEL]: undefined\n [componentEvents.EMPLOYEE_DEDUCTION_CANCEL_EMPTY]: undefined\n [componentEvents.EMPLOYEE_DEDUCTION_CREATED]: Garnishment\n [componentEvents.EMPLOYEE_DEDUCTION_UPDATED]: Garnishment\n [componentEvents.EMPLOYEE_DEDUCTION_DELETED]: Garnishment\n [componentEvents.EMPLOYEE_DEDUCTION_DELETED_EMPTY]: undefined\n [componentEvents.EMPLOYEE_DEDUCTION_DONE]: undefined\n}\n\n/** @internal */\nexport interface DeductionsContextInterface extends FlowContextInterface {\n employeeId: string\n /** Set by the EDIT transition; consumed by the form-mode contextual. */\n editingDeductionId?: string\n}\n\n/** @internal */\nexport function DeductionsListContextual() {\n const { employeeId, onEvent } = useFlow<DeductionsContextInterface>()\n const list = useDeductionsList({ employeeId: ensureRequired(employeeId) })\n\n if (list.isLoading) {\n return <BaseLayout isLoading error={list.errorHandling.errors} />\n }\n\n const onAdd = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_ADD)\n }\n const onEdit = (deduction: Garnishment) => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_EDIT, deduction)\n }\n const onContinue = () => {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DONE)\n }\n const onDelete = async (deduction: Garnishment) => {\n const result = await list.actions.onDelete(deduction)\n if (!result) return\n if (result.data.remainingActiveCount === 0) {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DELETED_EMPTY)\n } else {\n onEvent(componentEvents.EMPLOYEE_DEDUCTION_DELETED, result.data.garnishment)\n }\n }\n\n return (\n <BaseLayout error={list.errorHandling.errors}>\n <DeductionsList\n deductionsList={list}\n onAdd={onAdd}\n onEdit={onEdit}\n onDelete={(d: Garnishment) => {\n void onDelete(d)\n }}\n onContinue={onContinue}\n />\n </BaseLayout>\n )\n}\n\n/** @internal */\nexport function DeductionsFormContextual() {\n const { employeeId, editingDeductionId, onEvent } = useFlow<DeductionsContextInterface>()\n // The same list query the form hooks use internally — React Query dedupes\n // so this is the only outstanding request.\n const list = useDeductionsList({ employeeId: ensureRequired(employeeId) })\n const formDictionary = useOnboardingDeductionsFormDictionary()\n\n if (list.isLoading) {\n return <BaseLayout isLoading error={list.errorHandling.errors} />\n }\n\n const deduction = editingDeductionId\n ? (list.data.deductions.find(d => d.uuid === editingDeductionId) ?? null)\n : null\n const hasActiveDeductions = list.data.deductions.length > 0\n\n const onSaved = (saved: Garnishment, mode: 'create' | 'update') => {\n onEvent(\n mode === 'create'\n ? componentEvents.EMPLOYEE_DEDUCTION_CREATED\n : componentEvents.EMPLOYEE_DEDUCTION_UPDATED,\n saved,\n )\n }\n const onCancel = () => {\n onEvent(\n hasActiveDeductions\n ? componentEvents.EMPLOYEE_DEDUCTION_CANCEL\n : componentEvents.EMPLOYEE_DEDUCTION_CANCEL_EMPTY,\n )\n }\n\n return (\n <BaseLayout error={list.errorHandling.errors}>\n <DeductionsForm\n employeeId={ensureRequired(employeeId)}\n deduction={deduction}\n dictionary={formDictionary}\n onSaved={onSaved}\n onCancel={onCancel}\n />\n </BaseLayout>\n )\n}\n"],"names":["DeductionsListContextual","employeeId","onEvent","useFlow","list","useDeductionsList","ensureRequired","BaseLayout","onAdd","componentEvents","onEdit","deduction","onContinue","onDelete","result","jsx","DeductionsList","d","DeductionsFormContextual","editingDeductionId","formDictionary","useOnboardingDeductionsFormDictionary","hasActiveDeductions","onSaved","saved","mode","onCancel","DeductionsForm"],"mappings":";;;;;;;;;AA+BO,SAASA,IAA2B;AACzC,QAAM,EAAE,YAAAC,GAAY,SAAAC,EAAA,IAAYC,EAAA,GAC1BC,IAAOC,EAAkB,EAAE,YAAYC,EAAeL,CAAU,GAAG;AAEzE,MAAIG,EAAK;AACP,6BAAQG,GAAA,EAAW,WAAS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EAAgB,6BAChBA,EAAgB;AAAA,MACpBe;AAAA,IAAA;AAAA,EAEJ,GACME,IAAW,MAAM;AACrB,IAAAxB;AAAA,MACEoB,IACIb,EAAgB,4BAChBA,EAAgB;AAAA,IAAA;AAAA,EAExB;AAEA,SACE,gBAAAM,EAACR,GAAA,EAAW,OAAOH,EAAK,cAAc,QACpC,UAAA,gBAAAW;AAAA,IAACY;AAAA,IAAA;AAAA,MACC,YAAYrB,EAAeL,CAAU;AAAA,MACrC,WAAAU;AAAA,MACA,YAAYS;AAAA,MACZ,SAAAG;AAAA,MACA,UAAAG;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;"}
|
package/dist/components/Employee/Deductions/shared/DeductionsForm/ChildSupportFormView.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChildSupportFormView.js","sources":["../../../../../../src/components/Employee/Deductions/shared/DeductionsForm/ChildSupportFormView.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { Garnishment } from '@gusto/embedded-api-v-2026-02-01/models/components/garnishment'\nimport type { PaymentPeriod } from '@gusto/embedded-api-v-2026-02-01/models/components/garnishmentchildsupport'\nimport { useChildSupportGarnishmentForm } from '../useChildSupportGarnishmentForm'\nimport type { StateFieldEntry, CountyEntry } from '../useChildSupportGarnishmentForm'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { BaseLayout } from '@/components/Base/Base'\nimport { SDKFormProvider } from '@/partner-hook-utils/form/SDKFormProvider'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\ninterface ChildSupportFormViewProps {\n employeeId: string\n deduction: Garnishment | null\n onSaved: (deduction: Garnishment, mode: 'create' | 'update') => void\n onCancel: () => void\n}\n\n/** @internal */\nexport function ChildSupportFormView({\n employeeId,\n deduction,\n onSaved,\n onCancel,\n}: ChildSupportFormViewProps) {\n const { t } = useTranslation('Employee.DeductionsForm')\n const Components = useComponentContext()\n\n const form = useChildSupportGarnishmentForm({\n employeeId,\n garnishmentId: deduction?.uuid,\n })\n\n if (form.isLoading) {\n return <BaseLayout isLoading error={form.errorHandling.errors} />\n }\n\n const { Fields } = form.form\n const hasSelection = form.status.selectedAgency !== null\n\n const handleSubmit = async () => {\n const result = await form.actions.onSubmit()\n if (result) onSaved(result.data, result.mode)\n }\n\n return (\n <BaseLayout error={form.errorHandling.errors}>\n <SDKFormProvider formHookResult={form}>\n <Form onSubmit={handleSubmit}>\n <Flex flexDirection=\"column\" gap={32}>\n <Components.Heading as=\"h3\">{t('types.childSupport')}</Components.Heading>\n\n <Flex flexDirection=\"column\" gap={20}>\n <Fields.State\n label={t('childSupport.agencyLabel')}\n placeholder={t('childSupport.agencyPlaceholder')}\n description={t('childSupport.agencyDescription')}\n getOptionLabel={(entry: StateFieldEntry) => entry.name}\n validationMessages={{ REQUIRED: t('childSupport.agencyRequired') }}\n />\n\n {form.status.isManualPaymentRequired && (\n <Components.Alert\n status=\"warning\"\n label={t('childSupport.manualPaymentRequired')}\n />\n )}\n\n {hasSelection && (\n <Flex flexDirection=\"column\" gap={20}>\n {Fields.FipsCode && (\n <Fields.FipsCode\n label={t('childSupport.countyLabel')}\n placeholder={t('childSupport.countyPlaceholder')}\n description={t('childSupport.countyDescription')}\n getOptionLabel={(entry: CountyEntry) =>\n entry.county ?? t('childSupport.allCounties')\n }\n validationMessages={{ REQUIRED: t('childSupport.countyRequired') }}\n />\n )}\n {Fields.CaseNumber && (\n <Fields.CaseNumber\n label={requiredAttrLabel(form.status.selectedAgency, 'case_number')}\n description={t('childSupport.caseNumberDescription')}\n validationMessages={{ REQUIRED: t('childSupport.caseNumberRequired') }}\n />\n )}\n {Fields.OrderNumber && (\n <Fields.OrderNumber\n label={requiredAttrLabel(form.status.selectedAgency, 'order_number')}\n description={t('childSupport.orderNumberDescription')}\n validationMessages={{ REQUIRED: t('childSupport.orderNumberRequired') }}\n />\n )}\n {Fields.RemittanceNumber && (\n <Fields.RemittanceNumber\n label={requiredAttrLabel(form.status.selectedAgency, 'remittance_number')}\n description={t('childSupport.remittanceNumberDescription')}\n validationMessages={{\n REQUIRED: t('childSupport.remittanceNumberRequired'),\n }}\n />\n )}\n <Fields.PayPeriodMaximum\n label={t('childSupport.totalAmountWithheld')}\n description={t('childSupport.totalAmountWithheldDescription')}\n format=\"currency\"\n min={0}\n validationMessages={{\n REQUIRED: t('childSupport.payPeriodMaximumRequired'),\n NEGATIVE_AMOUNT: t('childSupport.amountNonNegative'),\n }}\n />\n <Fields.Amount\n label={t('childSupport.maxPaycheckPercentage')}\n description={t('childSupport.maxPaycheckPercentageDescription')}\n format=\"percent\"\n min={0}\n max={100}\n validationMessages={{\n REQUIRED: t('childSupport.amountRequired'),\n PERCENT_OUT_OF_RANGE: t('childSupport.percentOutOfRange'),\n }}\n />\n <Fields.PaymentPeriod\n label={t('childSupport.paymentPeriodLabel')}\n placeholder={t('childSupport.paymentPeriodPlaceholder')}\n description={t('childSupport.paymentPeriodDescription')}\n getOptionLabel={(value: PaymentPeriod) => paymentPeriodLabel(t, value)}\n validationMessages={{ REQUIRED: t('childSupport.paymentPeriodRequired') }}\n />\n </Flex>\n )}\n </Flex>\n <ActionsLayout>\n <Components.Button variant=\"secondary\" type=\"button\" onClick={onCancel}>\n {t('actions.cancel')}\n </Components.Button>\n {hasSelection && (\n <Components.Button type=\"submit\" isLoading={form.status.isPending}>\n {t('actions.save')}\n </Components.Button>\n )}\n </ActionsLayout>\n </Flex>\n </Form>\n </SDKFormProvider>\n </BaseLayout>\n )\n}\n\nfunction requiredAttrLabel(\n selectedAgency: { requiredAttributes?: Array<{ key?: string; label?: string }> } | null,\n key: 'case_number' | 'order_number' | 'remittance_number',\n): string {\n const match = selectedAgency?.requiredAttributes?.find(a => a.key === key)\n return match?.label ?? key\n}\n\nfunction paymentPeriodLabel(\n t: ReturnType<typeof useTranslation<'Employee.DeductionsForm'>>['t'],\n value: PaymentPeriod,\n): string {\n switch (value) {\n case 'Every week':\n return t('childSupport.paymentPeriod.everyWeek')\n case 'Every other week':\n return t('childSupport.paymentPeriod.everyOtherWeek')\n case 'Twice per month':\n return t('childSupport.paymentPeriod.twicePerMonth')\n case 'Monthly':\n return t('childSupport.paymentPeriod.monthly')\n }\n}\n"],"names":["ChildSupportFormView","employeeId","deduction","onSaved","onCancel","t","useTranslation","Components","useComponentContext","form","useChildSupportGarnishmentForm","BaseLayout","Fields","hasSelection","handleSubmit","result","SDKFormProvider","jsx","Form","jsxs","Flex","entry","requiredAttrLabel","value","paymentPeriodLabel","ActionsLayout","selectedAgency","key","a"],"mappings":";;;;;;;;;;AAoBO,SAASA,EAAqB;AAAA,EACnC,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AACF,GAA8B;AAC5B,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,yBAAyB,GAChDC,IAAaC,EAAA,GAEbC,IAAOC,EAA+B;AAAA,IAC1C,YAAAT;AAAA,IACA,eAAeC,GAAW;AAAA,EAAA,CAC3B;AAED,MAAIO,EAAK;AACP,6BAAQE,GAAA,EAAW,WAAS,IAAC,OAAOF,EAAK,cAAc,QAAQ;AAGjE,QAAM,EAAE,QAAAG,MAAWH,EAAK,MAClBI,IAAeJ,EAAK,OAAO,mBAAmB,MAE9CK,IAAe,YAAY;AAC/B,UAAMC,IAAS,MAAMN,EAAK,QAAQ,SAAA;AAClC,IAAIM,KAAQZ,EAAQY,EAAO,MAAMA,EAAO,IAAI;AAAA,EAC9C;AAEA,2BACGJ,GAAA,EAAW,OAAOF,EAAK,cAAc,QACpC,4BAACO,GAAA,EAAgB,gBAAgBP,GAC/B,UAAA,gBAAAQ,EAACC,GAAA,EAAK,UAAUJ,GACd,UAAA,gBAAAK,EAACC,KAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,IAAA,gBAAAH,EAACV,EAAW,SAAX,EAAmB,IAAG,MAAM,UAAAF,EAAE,o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A,MAC1E,EAAA,CACF;AAAA,IAAA,GAEJ;AAAA,sBACCoB,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAR,EAACV,EAAW,QAAX,EAAkB,SAAQ,aAAY,MAAK,UAAS,SAASH,GAC3D,UAAAC,EAAE,gBAAgB,EAAA,CACrB;AAAA,MACCQ,KACC,gBAAAI,EAACV,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWE,EAAK,OAAO,WACrD,UAAAJ,EAAE,cAAc,EAAA,CACnB;AAAA,IAAA,EAAA,CAEJ;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;AAEA,SAASiB,EACPI,GACAC,GACQ;AAER,SADcD,GAAgB,oBAAoB,KAAK,CAAAE,MAAKA,EAAE,QAAQD,CAAG,GAC3D,SAASA;AACzB;AAEA,SAASH,EACPnB,GACAkB,GACQ;AACR,UAAQA,GAAA;AAAA,IACN,KAAK;AACH,aAAOlB,EAAE,sCAAsC;AAAA,IACjD,KAAK;AACH,aAAOA,EAAE,2CAA2C;AAAA,IACtD,KAAK;AACH,aAAOA,EAAE,0CAA0C;AAAA,IACrD,KAAK;AACH,aAAOA,EAAE,oCAAoC;AAAA,EAAA;AAEnD;"}
|
|
1
|
+
{"version":3,"file":"ChildSupportFormView.js","sources":["../../../../../../src/components/Employee/Deductions/shared/DeductionsForm/ChildSupportFormView.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { Garnishment } from '@gusto/embedded-api/models/components/garnishment'\nimport type { PaymentPeriod } from '@gusto/embedded-api/models/components/garnishmentchildsupport'\nimport { useChildSupportGarnishmentForm } from '../useChildSupportGarnishmentForm'\nimport type { StateFieldEntry, CountyEntry } from '../useChildSupportGarnishmentForm'\nimport { Form } from '@/components/Common/Form'\nimport { ActionsLayout } from '@/components/Common'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { BaseLayout } from '@/components/Base/Base'\nimport { SDKFormProvider } from '@/partner-hook-utils/form/SDKFormProvider'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\ninterface ChildSupportFormViewProps {\n employeeId: string\n deduction: Garnishment | null\n onSaved: (deduction: Garnishment, mode: 'create' | 'update') => void\n onCancel: () => void\n}\n\n/** @internal */\nexport function ChildSupportFormView({\n employeeId,\n deduction,\n onSaved,\n onCancel,\n}: ChildSupportFormViewProps) {\n const { t } = useTranslation('Employee.DeductionsForm')\n const Components = useComponentContext()\n\n const form = useChildSupportGarnishmentForm({\n employeeId,\n garnishmentId: deduction?.uuid,\n })\n\n if (form.isLoading) {\n return <BaseLayout isLoading error={form.errorHandling.errors} />\n }\n\n const { Fields } = form.form\n const hasSelection = form.status.selectedAgency !== null\n\n const handleSubmit = async () => {\n const result = await form.actions.onSubmit()\n if (result) onSaved(result.data, result.mode)\n }\n\n return (\n <BaseLayout error={form.errorHandling.errors}>\n <SDKFormProvider formHookResult={form}>\n <Form onSubmit={handleSubmit}>\n <Flex flexDirection=\"column\" gap={32}>\n <Components.Heading as=\"h3\">{t('types.childSupport')}</Components.Heading>\n\n <Flex flexDirection=\"column\" gap={20}>\n <Fields.State\n label={t('childSupport.agencyLabel')}\n placeholder={t('childSupport.agencyPlaceholder')}\n description={t('childSupport.agencyDescription')}\n getOptionLabel={(entry: StateFieldEntry) => entry.name}\n validationMessages={{ REQUIRED: t('childSupport.agencyRequired') }}\n />\n\n {form.status.isManualPaymentRequired && (\n <Components.Alert\n status=\"warning\"\n label={t('childSupport.manualPaymentRequired')}\n />\n )}\n\n {hasSelection && (\n <Flex flexDirection=\"column\" gap={20}>\n {Fields.FipsCode && (\n <Fields.FipsCode\n label={t('childSupport.countyLabel')}\n placeholder={t('childSupport.countyPlaceholder')}\n description={t('childSupport.countyDescription')}\n getOptionLabel={(entry: CountyEntry) =>\n entry.county ?? t('childSupport.allCounties')\n }\n validationMessages={{ REQUIRED: t('childSupport.countyRequired') }}\n />\n )}\n {Fields.CaseNumber && (\n <Fields.CaseNumber\n label={requiredAttrLabel(form.status.selectedAgency, 'case_number')}\n description={t('childSupport.caseNumberDescription')}\n validationMessages={{ REQUIRED: t('childSupport.caseNumberRequired') }}\n />\n )}\n {Fields.OrderNumber && (\n <Fields.OrderNumber\n label={requiredAttrLabel(form.status.selectedAgency, 'order_number')}\n description={t('childSupport.orderNumberDescription')}\n validationMessages={{ REQUIRED: t('childSupport.orderNumberRequired') }}\n />\n )}\n {Fields.RemittanceNumber && (\n <Fields.RemittanceNumber\n label={requiredAttrLabel(form.status.selectedAgency, 'remittance_number')}\n description={t('childSupport.remittanceNumberDescription')}\n validationMessages={{\n REQUIRED: t('childSupport.remittanceNumberRequired'),\n }}\n />\n )}\n <Fields.PayPeriodMaximum\n label={t('childSupport.totalAmountWithheld')}\n description={t('childSupport.totalAmountWithheldDescription')}\n format=\"currency\"\n min={0}\n validationMessages={{\n REQUIRED: t('childSupport.payPeriodMaximumRequired'),\n NEGATIVE_AMOUNT: t('childSupport.amountNonNegative'),\n }}\n />\n <Fields.Amount\n label={t('childSupport.maxPaycheckPercentage')}\n description={t('childSupport.maxPaycheckPercentageDescription')}\n format=\"percent\"\n min={0}\n max={100}\n validationMessages={{\n REQUIRED: t('childSupport.amountRequired'),\n PERCENT_OUT_OF_RANGE: t('childSupport.percentOutOfRange'),\n }}\n />\n <Fields.PaymentPeriod\n label={t('childSupport.paymentPeriodLabel')}\n placeholder={t('childSupport.paymentPeriodPlaceholder')}\n description={t('childSupport.paymentPeriodDescription')}\n getOptionLabel={(value: PaymentPeriod) => paymentPeriodLabel(t, value)}\n validationMessages={{ REQUIRED: t('childSupport.paymentPeriodRequired') }}\n />\n </Flex>\n )}\n </Flex>\n <ActionsLayout>\n <Components.Button variant=\"secondary\" type=\"button\" onClick={onCancel}>\n {t('actions.cancel')}\n </Components.Button>\n {hasSelection && (\n <Components.Button type=\"submit\" isLoading={form.status.isPending}>\n {t('actions.save')}\n </Components.Button>\n )}\n </ActionsLayout>\n </Flex>\n </Form>\n </SDKFormProvider>\n </BaseLayout>\n )\n}\n\nfunction requiredAttrLabel(\n selectedAgency: { requiredAttributes?: Array<{ key?: string; label?: string }> } | null,\n key: 'case_number' | 'order_number' | 'remittance_number',\n): string {\n const match = selectedAgency?.requiredAttributes?.find(a => a.key === key)\n return match?.label ?? key\n}\n\nfunction paymentPeriodLabel(\n t: ReturnType<typeof useTranslation<'Employee.DeductionsForm'>>['t'],\n value: PaymentPeriod,\n): string {\n switch (value) {\n case 'Every week':\n return t('childSupport.paymentPeriod.everyWeek')\n case 'Every other week':\n return t('childSupport.paymentPeriod.everyOtherWeek')\n case 'Twice per month':\n return t('childSupport.paymentPeriod.twicePerMonth')\n case 'Monthly':\n return t('childSupport.paymentPeriod.monthly')\n }\n}\n"],"names":["ChildSupportFormView","employeeId","deduction","onSaved","onCancel","t","useTranslation","Components","useComponentContext","form","useChildSupportGarnishmentForm","BaseLayout","Fields","hasSelection","handleSubmit","result","SDKFormProvider","jsx","Form","jsxs","Flex","entry","requiredAttrLabel","value","paymentPeriodLabel","ActionsLayout","selectedAgency","key","a"],"mappings":";;;;;;;;;;AAoBO,SAASA,EAAqB;AAAA,EACnC,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AACF,GAA8B;AAC5B,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,yBAAyB,GAChDC,IAAaC,EAAA,GAEbC,IAAOC,EAA+B;AAAA,IAC1C,YAAAT;AAAA,IACA,eAAeC,GAAW;AAAA,EAAA,CAC3B;AAED,MAAIO,EAAK;AACP,6BAAQE,GAAA,EAAW,WAAS,IAAC,OAAOF,EAAK,cAAc,QAAQ;AAGjE,QAAM,EAAE,QAAAG,MAAWH,EAAK,MAClBI,IAAeJ,EAAK,OAAO,mBAAmB,MAE9CK,IAAe,YAAY;AAC/B,UAAMC,IAAS,MAAMN,EAAK,QAAQ,SAAA;AAClC,IAAIM,KAAQZ,EAAQY,EAAO,MAAMA,EAAO,IAAI;AAAA,EAC9C;AAEA,2BACGJ,GAAA,EAAW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,YACC,OAAOP,EAAE,iCAAiC;AAAA,YAC1C,aAAaA,EAAE,uCAAuC;AAAA,YACtD,aAAaA,EAAE,uCAAuC;AAAA,YACtD,gBAAgB,CAACkB,MAAyBC,EAAmBnB,GAAGkB,CAAK;AAAA,YACrE,oBAAoB,EAAE,UAAUlB,EAAE,oCAAoC,EAAA;AAAA,UAAE;AAAA,QAAA;AAAA,MAC1E,EAAA,CACF;AAAA,IAAA,GAEJ;AAAA,sBACCoB,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAR,EAACV,EAAW,QAAX,EAAkB,SAAQ,aAAY,MAAK,UAAS,SAASH,GAC3D,UAAAC,EAAE,gBAAgB,EAAA,CACrB;AAAA,MACCQ,KACC,gBAAAI,EAACV,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWE,EAAK,OAAO,WACrD,UAAAJ,EAAE,cAAc,EAAA,CACnB;AAAA,IAAA,EAAA,CAEJ;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;AAEA,SAASiB,EACPI,GACAC,GACQ;AAER,SADcD,GAAgB,oBAAoB,KAAK,CAAAE,MAAKA,EAAE,QAAQD,CAAG,GAC3D,SAASA;AACzB;AAEA,SAASH,EACPnB,GACAkB,GACQ;AACR,UAAQA,GAAA;AAAA,IACN,KAAK;AACH,aAAOlB,EAAE,sCAAsC;AAAA,IACjD,KAAK;AACH,aAAOA,EAAE,2CAA2C;AAAA,IACtD,KAAK;AACH,aAAOA,EAAE,0CAA0C;AAAA,IACrD,KAAK;AACH,aAAOA,EAAE,oCAAoC;AAAA,EAAA;AAEnD;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Garnishment } from '@gusto/embedded-api
|
|
1
|
+
import { Garnishment } from '@gusto/embedded-api/models/components/garnishment';
|
|
2
2
|
import { ResourceDictionary } from '../../../../../types/Helpers';
|
|
3
3
|
/** @internal */
|
|
4
4
|
export type DeductionsFormDictionary = ResourceDictionary<'Employee.DeductionsForm'>;
|