@gusto/embedded-react-sdk 0.52.2 → 0.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/dist/components/Common/DateRangeFilter/DateRangeFilter.d.ts +1 -2
- package/dist/components/Common/DateRangeFilter/DateRangeFilter.js +42 -43
- package/dist/components/Common/DateRangeFilter/DateRangeFilter.js.map +1 -1
- package/dist/components/Common/Fields/PercentageField/PercentageField.js +44 -42
- package/dist/components/Common/Fields/PercentageField/PercentageField.js.map +1 -1
- package/dist/components/Common/UI/Box/Box.js +6 -6
- package/dist/components/Common/UI/Box/Box.js.map +1 -1
- package/dist/components/Common/UI/Box/Box.module.scss.js +8 -8
- package/dist/components/Common/UI/Box/BoxTypes.d.ts +1 -1
- package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/components/Common/UI/CalendarPreview/CalendarPreview.js +16 -14
- package/dist/components/Common/UI/CalendarPreview/CalendarPreview.js.map +1 -1
- package/dist/components/Common/UI/Dialog/Dialog.js +29 -28
- package/dist/components/Common/UI/Dialog/Dialog.js.map +1 -1
- package/dist/components/Common/UI/FileInput/FileInput.js +1 -1
- package/dist/components/Common/UI/FormBox/FormBox.d.ts +1 -1
- package/dist/components/Common/UI/FormBox/FormBox.js +9 -8
- package/dist/components/Common/UI/FormBox/FormBox.js.map +1 -1
- package/dist/components/Common/UI/FormBox/FormBox.module.scss.js +8 -6
- package/dist/components/Common/UI/FormBox/FormBox.module.scss.js.map +1 -1
- package/dist/components/Common/UI/FormBox/FormBoxTypes.d.ts +5 -1
- package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
- package/dist/components/Company/AssignSignatory/AssignSignatory.js +7 -10
- package/dist/components/Company/AssignSignatory/AssignSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +6 -8
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +8 -9
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +18 -21
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +11 -12
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +5 -4
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/Head.js +8 -9
- package/dist/components/Company/AssignSignatory/Head.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +6 -7
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +5 -8
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js +20 -21
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatoryForm.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +5 -4
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/TitleSelect.js +10 -12
- package/dist/components/Company/AssignSignatory/TitleSelect.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +7 -6
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +2 -3
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Form.js +9 -11
- package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Head.js +2 -3
- package/dist/components/Company/BankAccount/BankAccountForm/Head.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +5 -4
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js +6 -7
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +7 -8
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +4 -6
- package/dist/components/Company/BankAccount/BankAccountVerify/Form.js.map +1 -1
- package/dist/components/Company/BankAccount/stateMachine.d.ts +0 -1
- package/dist/components/Company/BankAccount/stateMachine.js +33 -35
- package/dist/components/Company/BankAccount/stateMachine.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +5 -6
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +11 -14
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +5 -4
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +7 -8
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Company/DocumentSigner/shared/useSignCompanyForm/fields.js +4 -4
- package/dist/components/Company/DocumentSigner/stateMachine.d.ts +0 -1
- package/dist/components/Company/DocumentSigner/stateMachine.js +27 -29
- package/dist/components/Company/DocumentSigner/stateMachine.js.map +1 -1
- package/dist/components/Company/FederalTaxes/Actions.js +6 -7
- package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
- package/dist/components/Company/FederalTaxes/FederalTaxes.js +7 -10
- package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
- package/dist/components/Company/FederalTaxes/Form.js +4 -4
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +10 -9
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Actions.js +5 -6
- package/dist/components/Company/Industry/Actions.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +8 -7
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Industry/Edit.js +10 -12
- package/dist/components/Company/Industry/Edit.js.map +1 -1
- package/dist/components/Company/Industry/IndustrySelect.js +6 -8
- package/dist/components/Company/Industry/IndustrySelect.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Actions.js +6 -7
- package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Form.js +4 -6
- package/dist/components/Company/Locations/LocationForm/Form.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/LocationForm.js +11 -14
- package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +5 -4
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/Actions.js +2 -3
- package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/LocationsList.js +9 -12
- package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +5 -4
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/Completed.js +5 -6
- package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/MissingRequirements.js +9 -10
- package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +2 -5
- package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +5 -4
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/PayScheduleForm.js +47 -51
- package/dist/components/Company/PaySchedule/PayScheduleForm.js.map +1 -1
- package/dist/components/Company/PaySchedule/payScheduleStateMachine.d.ts +0 -1
- package/dist/components/Company/PaySchedule/payScheduleStateMachine.js +26 -28
- package/dist/components/Company/PaySchedule/payScheduleStateMachine.js.map +1 -1
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/fields.js +5 -5
- package/dist/components/Company/StateTaxes/StateTaxes.d.ts +2 -1
- package/dist/components/Company/StateTaxes/StateTaxes.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesComponents.d.ts +2 -0
- package/dist/components/Company/StateTaxes/StateTaxesComponents.js +29 -16
- package/dist/components/Company/StateTaxes/StateTaxesComponents.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +2 -3
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/Form.d.ts +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/Form.js +21 -32
- package/dist/components/Company/StateTaxes/StateTaxesForm/Form.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +67 -75
- package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +5 -4
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +6 -7
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js +62 -47
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.d.ts +1 -0
- package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.js +26 -23
- package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.d.ts +1 -0
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +5 -4
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/TaxRateManagement/AddRateAction.d.ts +12 -0
- package/dist/components/Company/StateTaxes/TaxRateManagement/AddRateAction.js +36 -0
- package/dist/components/Company/StateTaxes/TaxRateManagement/AddRateAction.js.map +1 -0
- package/dist/components/Company/StateTaxes/TaxRateManagement/AddTaxRateDialog.d.ts +10 -0
- package/dist/components/Company/StateTaxes/TaxRateManagement/AddTaxRateDialog.js +110 -0
- package/dist/components/Company/StateTaxes/TaxRateManagement/AddTaxRateDialog.js.map +1 -0
- package/dist/components/Company/StateTaxes/TaxRateManagement/TaxRateHistorySection.d.ts +18 -0
- package/dist/components/Company/StateTaxes/TaxRateManagement/TaxRateHistorySection.js +55 -0
- package/dist/components/Company/StateTaxes/TaxRateManagement/TaxRateHistorySection.js.map +1 -0
- package/dist/components/Company/StateTaxes/TaxRateManagement/TaxRateManagement.d.ts +47 -0
- package/dist/components/Company/StateTaxes/TaxRateManagement/TaxRateManagement.js +108 -0
- package/dist/components/Company/StateTaxes/TaxRateManagement/TaxRateManagement.js.map +1 -0
- package/dist/components/Company/StateTaxes/TaxRateManagement/context.d.ts +25 -0
- package/dist/components/Company/StateTaxes/TaxRateManagement/context.js +22 -0
- package/dist/components/Company/StateTaxes/TaxRateManagement/context.js.map +1 -0
- package/dist/components/Company/StateTaxes/TaxRateManagement/index.d.ts +1 -0
- package/dist/components/Company/StateTaxes/TaxRateManagement/toHistoryRows.d.ts +29 -0
- package/dist/components/Company/StateTaxes/TaxRateManagement/toHistoryRows.js +34 -0
- package/dist/components/Company/StateTaxes/TaxRateManagement/toHistoryRows.js.map +1 -0
- package/dist/components/Company/StateTaxes/shared/RequirementFields.d.ts +17 -0
- package/dist/components/Company/StateTaxes/shared/RequirementFields.js +24 -0
- package/dist/components/Company/StateTaxes/shared/RequirementFields.js.map +1 -0
- package/dist/components/Company/StateTaxes/{StateTaxesForm → shared}/applicableIf.d.ts +1 -1
- package/dist/components/Company/StateTaxes/shared/applicableIf.js.map +1 -0
- package/dist/components/Company/StateTaxes/shared/applicableIf.test.d.ts +1 -0
- package/dist/components/Company/StateTaxes/shared/buildRequirementSchema.d.ts +19 -0
- package/dist/components/Company/StateTaxes/shared/buildRequirementSchema.js +38 -0
- package/dist/components/Company/StateTaxes/shared/buildRequirementSchema.js.map +1 -0
- package/dist/components/Company/StateTaxes/shared/requirementValue.d.ts +2 -0
- package/dist/components/Company/StateTaxes/shared/requirementValue.js +7 -0
- package/dist/components/Company/StateTaxes/shared/requirementValue.js.map +1 -0
- package/dist/components/Company/StateTaxes/shared/rhfKey.d.ts +23 -0
- package/dist/components/Company/StateTaxes/shared/rhfKey.js +13 -0
- package/dist/components/Company/StateTaxes/shared/rhfKey.js.map +1 -0
- package/dist/components/Company/StateTaxes/shared/rhfKey.test.d.ts +1 -0
- package/dist/components/Company/StateTaxes/stateTaxesStateMachine.d.ts +1 -0
- package/dist/components/Company/StateTaxes/stateTaxesStateMachine.js +33 -11
- package/dist/components/Company/StateTaxes/stateTaxesStateMachine.js.map +1 -1
- package/dist/components/Company/exports/companyOnboarding.d.ts +1 -0
- package/dist/components/Company/exports/companyOnboarding.js +12 -10
- package/dist/components/Company/exports/companyOnboarding.js.map +1 -1
- package/dist/components/Contractor/Address/Address.js +11 -12
- package/dist/components/Contractor/Address/Address.js.map +1 -1
- package/dist/components/Contractor/ContractorList/management/ManagementContractorList.d.ts +39 -0
- package/dist/components/Contractor/ContractorList/management/ManagementContractorList.js +90 -0
- package/dist/components/Contractor/ContractorList/management/ManagementContractorList.js.map +1 -0
- package/dist/components/Contractor/ContractorList/management/ManagementContractorListView.d.ts +22 -0
- package/dist/components/Contractor/ContractorList/management/ManagementContractorListView.js +247 -0
- package/dist/components/Contractor/ContractorList/management/ManagementContractorListView.js.map +1 -0
- package/dist/components/Contractor/ContractorList/{index.d.ts → onboarding/ContractorList.d.ts} +3 -3
- package/dist/components/Contractor/ContractorList/onboarding/ContractorList.js +51 -0
- package/dist/components/Contractor/ContractorList/onboarding/ContractorList.js.map +1 -0
- package/dist/components/Contractor/ContractorList/onboarding/ContractorListView.d.ts +16 -0
- package/dist/components/Contractor/ContractorList/onboarding/ContractorListView.js +113 -0
- package/dist/components/Contractor/ContractorList/onboarding/ContractorListView.js.map +1 -0
- package/dist/components/Contractor/ContractorList/shared/index.d.ts +1 -0
- package/dist/components/Contractor/ContractorList/shared/useContractorList.d.ts +87 -0
- package/dist/components/Contractor/ContractorList/shared/useContractorList.js +110 -0
- package/dist/components/Contractor/ContractorList/shared/useContractorList.js.map +1 -0
- package/dist/components/Contractor/Documents/DocumentSigner/stateMachine.d.ts +0 -1
- package/dist/components/Contractor/Documents/DocumentSigner/stateMachine.js +18 -20
- package/dist/components/Contractor/Documents/DocumentSigner/stateMachine.js.map +1 -1
- package/dist/components/Contractor/Documents/DocumentsList/DocumentsList.js +2 -3
- package/dist/components/Contractor/Documents/DocumentsList/DocumentsList.js.map +1 -1
- package/dist/components/Contractor/Documents/SignatureForm/SignatureForm.js +1 -1
- package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/fields.js +8 -8
- package/dist/components/Contractor/OnboardingFlow/OnboardingFlowComponents.js +1 -1
- package/dist/components/Contractor/OnboardingFlow/OnboardingFlowComponents.js.map +1 -1
- package/dist/components/Contractor/OnboardingSummary/OnboardingSummary.js +9 -10
- package/dist/components/Contractor/OnboardingSummary/OnboardingSummary.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.js +2 -3
- package/dist/components/Contractor/PaymentMethod/PaymentMethod.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/shared/useContractorBankAccountForm/fields.js +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js +162 -251
- package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentFormSchema.d.ts +2 -1
- package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentFormSchema.js +2 -2
- package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentFormSchema.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js +45 -44
- package/dist/components/Contractor/Payments/CreatePayment/EditContractorPaymentPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js +2 -3
- package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +2 -3
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/shared/usePaymentAmountsEditor.d.ts +32 -0
- package/dist/components/Contractor/Payments/shared/usePaymentAmountsEditor.js +107 -0
- package/dist/components/Contractor/Payments/shared/usePaymentAmountsEditor.js.map +1 -0
- package/dist/components/Contractor/Payments/shared/usePaymentAmountsEditor.test.d.ts +1 -0
- package/dist/components/Contractor/Profile/BusinessSelfOnboardingProfile.js +6 -7
- package/dist/components/Contractor/Profile/BusinessSelfOnboardingProfile.js.map +1 -1
- package/dist/components/Contractor/Profile/IndividualSelfOnboardingProfile.js +18 -19
- package/dist/components/Contractor/Profile/IndividualSelfOnboardingProfile.js.map +1 -1
- package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/fields.js +16 -16
- package/dist/components/Contractor/Submit/Submit.js +2 -3
- package/dist/components/Contractor/Submit/Submit.js.map +1 -1
- package/dist/components/Contractor/exports/contractorManagement.d.ts +1 -0
- package/dist/components/Contractor/exports/contractorManagement.js +12 -10
- package/dist/components/Contractor/exports/contractorManagement.js.map +1 -1
- package/dist/components/Contractor/exports/contractorOnboarding.d.ts +1 -1
- package/dist/components/Contractor/exports/contractorOnboarding.js +1 -1
- package/dist/components/Employee/Compensation/management/ManagementCompensationFormBody.js +32 -33
- package/dist/components/Employee/Compensation/management/ManagementCompensationFormBody.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/AddCompensationFormBody.js +2 -3
- package/dist/components/Employee/Compensation/shared/AddCompensationFormBody.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/useCompensationForm/fields.js +4 -4
- package/dist/components/Employee/Compensation/shared/useJobForm/fields.js +6 -6
- package/dist/components/Employee/Deductions/shared/DeductionsForm/ChildSupportFormView.js +6 -7
- package/dist/components/Employee/Deductions/shared/DeductionsForm/ChildSupportFormView.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/DeductionsForm/StandardDeductionForm.js +14 -15
- package/dist/components/Employee/Deductions/shared/DeductionsForm/StandardDeductionForm.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/fields.js +8 -8
- package/dist/components/Employee/Deductions/shared/useDeductionForm/fields.js +4 -4
- package/dist/components/Employee/Documents/management/DocumentManager.js +6 -7
- package/dist/components/Employee/Documents/management/DocumentManager.js.map +1 -1
- package/dist/components/Employee/Documents/management/DocumentsCard/DocumentsCard.js +6 -7
- package/dist/components/Employee/Documents/management/DocumentsCard/DocumentsCard.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/Actions.js +4 -5
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/DocumentList.js +10 -13
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/List.js +5 -6
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/List.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/List.module.scss.js +8 -0
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/List.module.scss.js.map +1 -0
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +5 -4
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibility.js +22 -21
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibility.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js +6 -6
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.js +5 -4
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/I9SignatureForm/I9SignatureForm.js +3 -4
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/I9SignatureForm/I9SignatureForm.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/EmployeeDocuments/EmployeeDocumentsPresentation.js +6 -7
- package/dist/components/Employee/Documents/onboarding/EmployeeDocuments/EmployeeDocumentsPresentation.js.map +1 -1
- package/dist/components/Employee/Documents/shared/SignatureForm/SignatureForm.js +11 -12
- package/dist/components/Employee/Documents/shared/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Employee/Documents/shared/useSignEmployeeForm/fields.js +1 -1
- package/dist/components/Employee/FederalTaxes/management/FederalTaxesCard/FederalTaxesCard.js +15 -16
- package/dist/components/Employee/FederalTaxes/management/FederalTaxesCard/FederalTaxesCard.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/management/FederalTaxesEditForm.js +6 -7
- package/dist/components/Employee/FederalTaxes/management/FederalTaxesEditForm.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/onboarding/FederalTaxes.js +11 -12
- package/dist/components/Employee/FederalTaxes/onboarding/FederalTaxes.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/shared/FederalTaxesView.js +1 -1
- package/dist/components/Employee/FederalTaxes/shared/useFederalTaxesForm/fields.js +4 -4
- package/dist/components/Employee/HomeAddress/management/HomeAddressCard/HomeAddressCard.js +7 -8
- package/dist/components/Employee/HomeAddress/management/HomeAddressCard/HomeAddressCard.js.map +1 -1
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +4 -4
- package/dist/components/Employee/PaymentMethod/management/PaymentMethodBankForm.js +29 -23
- package/dist/components/Employee/PaymentMethod/management/PaymentMethodBankForm.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/onboarding/BankForm.js +26 -20
- package/dist/components/Employee/PaymentMethod/onboarding/BankForm.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/onboarding/ListView.js +133 -99
- package/dist/components/Employee/PaymentMethod/onboarding/ListView.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/onboarding/ListView.module.scss.js +8 -0
- package/dist/components/Employee/PaymentMethod/onboarding/ListView.module.scss.js.map +1 -0
- package/dist/components/Employee/PaymentMethod/shared/BankFormBody/BankFormBody.d.ts +1 -1
- package/dist/components/Employee/PaymentMethod/shared/BankFormBody/BankFormBody.js +19 -20
- package/dist/components/Employee/PaymentMethod/shared/BankFormBody/BankFormBody.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/shared/SplitPaymentsFormBody/SplitPaymentsFormBody.js +92 -86
- package/dist/components/Employee/PaymentMethod/shared/SplitPaymentsFormBody/SplitPaymentsFormBody.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/shared/useBankForm/fields.js +1 -1
- package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/splitFieldFactory.js +4 -4
- package/dist/components/Employee/Paystubs/management/PaystubsCard/PaystubsCard.js +65 -64
- package/dist/components/Employee/Paystubs/management/PaystubsCard/PaystubsCard.js.map +1 -1
- package/dist/components/Employee/Profile/management/ProfileCard/ProfileCard.js +7 -8
- package/dist/components/Employee/Profile/management/ProfileCard/ProfileCard.js.map +1 -1
- package/dist/components/Employee/Profile/management/ProfileEditForm.js +7 -7
- package/dist/components/Employee/Profile/onboarding/AdminProfile.js +6 -6
- package/dist/components/Employee/Profile/onboarding/EmployeeProfile.js +6 -6
- package/dist/components/Employee/Profile/shared/useEmployeeDetailsForm/fields.js +8 -8
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/fields.js +5 -5
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/fields.js +4 -4
- package/dist/components/Employee/StateTaxes/management/StateTaxesCard/StateTaxesCard.js +11 -12
- package/dist/components/Employee/StateTaxes/management/StateTaxesCard/StateTaxesCard.js.map +1 -1
- package/dist/components/Employee/StateTaxes/management/StateTaxesEditForm.js +9 -10
- package/dist/components/Employee/StateTaxes/management/StateTaxesEditForm.js.map +1 -1
- package/dist/components/Employee/StateTaxes/onboarding/StateTaxes.js +6 -7
- package/dist/components/Employee/StateTaxes/onboarding/StateTaxes.js.map +1 -1
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fieldComponents.js +8 -8
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/useEmployeeStateTaxesForm.js +44 -45
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/useEmployeeStateTaxesForm.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.js +23 -22
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.js +27 -27
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminationFlow/TerminationFlowComponents.js +9 -10
- package/dist/components/Employee/Terminations/TerminationFlow/TerminationFlowComponents.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummaryPresentation.js +2 -3
- package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummaryPresentation.js.map +1 -1
- package/dist/components/Employee/WorkAddress/management/WorkAddressCard/WorkAddressCard.js +16 -17
- package/dist/components/Employee/WorkAddress/management/WorkAddressCard/WorkAddressCard.js.map +1 -1
- package/dist/components/Flow/Flow.js +1 -1
- package/dist/components/Flow/FlowHeader.js +3 -4
- package/dist/components/Flow/FlowHeader.js.map +1 -1
- package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js +8 -9
- package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js.map +1 -1
- package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js +7 -8
- package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +37 -37
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js.map +1 -1
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelectionPresentation.js +8 -9
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelectionPresentation.js.map +1 -1
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +7 -8
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js +10 -12
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js.map +1 -1
- package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js +0 -1
- package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js +7 -8
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistory.d.ts +3 -3
- package/dist/components/Payroll/PayrollHistory/PayrollHistory.js +54 -50
- package/dist/components/Payroll/PayrollHistory/PayrollHistory.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +80 -69
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollList.js +20 -18
- package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +138 -136
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.module.scss.js +10 -12
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.module.scss.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +4 -4
- package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js +2 -3
- package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js.map +1 -1
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js +2 -3
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js.map +1 -1
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js +1 -2
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js.map +1 -1
- package/dist/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.js +2 -3
- package/dist/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +4 -3
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetailPresentation.js +2 -3
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetailPresentation.js.map +1 -1
- package/dist/components/TimeOff/PolicySettings/PolicySettingsPresentation.js +4 -4
- package/dist/components/TimeOff/PolicyTypeSelector/PolicyTypeSelectorPresentation.js +4 -4
- package/dist/components/TimeOff/TimeOffFlow/TimeOffFlowComponents.js +34 -36
- package/dist/components/TimeOff/TimeOffFlow/TimeOffFlowComponents.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormPresentation.js +4 -4
- package/dist/components/TimeOff/shared/PolicyDetailLayout/PolicyDetailLayout.js +24 -25
- package/dist/components/TimeOff/shared/PolicyDetailLayout/PolicyDetailLayout.js.map +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.d.ts +6 -0
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +29 -28
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/contexts/LocaleProvider/useLocale.d.ts +1 -9
- package/dist/contexts/LocaleProvider/useLocale.js +5 -15
- package/dist/contexts/LocaleProvider/useLocale.js.map +1 -1
- package/dist/contexts/NonceProvider/index.d.ts +1 -0
- package/dist/contexts/NonceProvider/useNonce.d.ts +37 -0
- package/dist/contexts/NonceProvider/useNonce.js +7 -0
- package/dist/contexts/NonceProvider/useNonce.js.map +1 -0
- package/dist/contexts/ThemeProvider/ThemeProvider.js +25 -24
- package/dist/contexts/ThemeProvider/ThemeProvider.js.map +1 -1
- package/dist/contexts/index.d.ts +1 -0
- package/dist/hooks/useDateRangeFilter/useDateRangeFilter.d.ts +12 -7
- package/dist/hooks/useDateRangeFilter/useDateRangeFilter.js +25 -21
- package/dist/hooks/useDateRangeFilter/useDateRangeFilter.js.map +1 -1
- package/dist/i18n/I18n.js +1 -0
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Company.StateTaxes.json.js +6 -4
- package/dist/i18n/en/Company.StateTaxes.json.js.map +1 -1
- package/dist/i18n/en/Contractor.ContractorList.json.js +14 -12
- package/dist/i18n/en/Contractor.ContractorList.json.js.map +1 -1
- package/dist/i18n/en/Contractor.ManagementContractorList.json.js +60 -0
- package/dist/i18n/en/Contractor.ManagementContractorList.json.js.map +1 -0
- package/dist/i18n/en/Employee.Management.PaymentMethodBankForm.json.js +18 -16
- package/dist/i18n/en/Employee.Management.PaymentMethodBankForm.json.js.map +1 -1
- package/dist/i18n/en/Employee.Management.PaymentMethodSplitForm.json.js +2 -2
- package/dist/i18n/en/Employee.PaymentMethod.json.js +74 -72
- package/dist/i18n/en/Employee.PaymentMethod.json.js.map +1 -1
- package/dist/i18n/en/Employee.SplitPaymentsFormBody.json.js +2 -2
- package/dist/i18n/en/Payroll.PayrollHistory.json.js +8 -8
- package/dist/i18n/en/Payroll.PayrollList.json.js +23 -23
- package/dist/i18n/types.d.ts +193 -11
- package/dist/index.js +15 -13
- package/dist/index.js.map +1 -1
- package/dist/models/external.d.ts +4 -0
- package/dist/partner-hook-utils/form/SDKFormProvider.js +39 -24
- package/dist/partner-hook-utils/form/SDKFormProvider.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/CheckboxHookField.js +12 -15
- package/dist/partner-hook-utils/form/fields/CheckboxHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/NumberInputHookField.js +16 -19
- package/dist/partner-hook-utils/form/fields/NumberInputHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/RadioGroupHookField.js +13 -16
- package/dist/partner-hook-utils/form/fields/RadioGroupHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/SelectHookField.js +12 -15
- package/dist/partner-hook-utils/form/fields/SelectHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/SwitchHookField.js +18 -21
- package/dist/partner-hook-utils/form/fields/SwitchHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/TextInputHookField.js +9 -12
- package/dist/partner-hook-utils/form/fields/TextInputHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/preprocessors.d.ts +2 -2
- package/dist/partner-hook-utils/form/preprocessors.js +8 -7
- package/dist/partner-hook-utils/form/preprocessors.js.map +1 -1
- package/dist/partner-hook-utils/form/preprocessors.test.d.ts +1 -0
- package/dist/shared/constants.d.ts +12 -0
- package/dist/shared/constants.js +23 -17
- package/dist/shared/constants.js.map +1 -1
- package/dist/style.css +1 -1
- package/docs/guides/endpoint-inventory.json +61 -0
- package/package.json +16 -14
- package/dist/components/Company/StateTaxes/StateTaxesForm/applicableIf.js.map +0 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/rhfKey.d.ts +0 -4
- package/dist/components/Company/StateTaxes/StateTaxesForm/rhfKey.js +0 -5
- package/dist/components/Company/StateTaxes/StateTaxesForm/rhfKey.js.map +0 -1
- package/dist/components/Contractor/ContractorList/index.js +0 -141
- package/dist/components/Contractor/ContractorList/index.js.map +0 -1
- package/dist/components/Contractor/ContractorList/useContractorList.d.ts +0 -18
- package/dist/components/Contractor/ContractorList/useContractorList.js +0 -15
- package/dist/components/Contractor/ContractorList/useContractorList.js.map +0 -1
- /package/dist/components/Company/StateTaxes/{StateTaxesForm/applicableIf.test.d.ts → TaxRateManagement/toHistoryRows.test.d.ts} +0 -0
- /package/dist/components/Company/StateTaxes/{StateTaxesForm → shared}/applicableIf.js +0 -0
|
@@ -2,12 +2,11 @@ import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
|
2
2
|
import { useTranslation as m } from "react-i18next";
|
|
3
3
|
import { FlowBreadcrumbs as f } from "../Common/FlowBreadcrumbs/FlowBreadcrumbs.js";
|
|
4
4
|
import { Flex as l, FlexItem as a } from "../Common/Flex/Flex.js";
|
|
5
|
-
import { useComponentContext as u } from "../../contexts/ComponentAdapter/useComponentContext.js";
|
|
6
|
-
import "react";
|
|
7
5
|
import { useFlow as s } from "./useFlow.js";
|
|
8
6
|
import { componentEvents as b } from "../../shared/constants.js";
|
|
7
|
+
import { useComponentContext as u } from "../../contexts/ComponentAdapter/useComponentContext.js";
|
|
9
8
|
import h from "../../assets/icons/caret-left.svg.js";
|
|
10
|
-
function
|
|
9
|
+
function I() {
|
|
11
10
|
const { header: e, component: t } = s();
|
|
12
11
|
if (!e || !t) return null;
|
|
13
12
|
switch (e.type) {
|
|
@@ -88,6 +87,6 @@ function v({
|
|
|
88
87
|
] });
|
|
89
88
|
}
|
|
90
89
|
export {
|
|
91
|
-
|
|
90
|
+
I as FlowHeader
|
|
92
91
|
};
|
|
93
92
|
//# sourceMappingURL=FlowHeader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlowHeader.js","sources":["../../../src/components/Flow/FlowHeader.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { CustomTypeOptions } from 'i18next'\nimport { FlowBreadcrumbs } from '../Common/FlowBreadcrumbs/FlowBreadcrumbs'\nimport type { BreadcrumbTrail } from '../Common/FlowBreadcrumbs/FlowBreadcrumbsTypes'\nimport { Flex } from '../Common/Flex'\nimport { FlexItem } from '../Common'\nimport { useFlow } from './useFlow'\nimport { componentEvents, type EventType } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport CaretLeftIcon from '@/assets/icons/caret-left.svg?react'\n\n/**\n * Renders the chrome above the active flow component (back affordance, progress bar, breadcrumbs).\n *\n * @remarks\n * Reads the discriminated `header` value from {@link FlowContext} and dispatches to the matching\n * internal renderer:\n *\n * - `header.type === 'minimal'` — back button and optional CTA.\n * - `header.type === 'progress'` — step indicator with `currentStep` / `totalSteps`.\n * - `header.type === 'breadcrumbs'` — breadcrumb trail; renders nothing while\n * `currentBreadcrumbId` is absent so passive states (e.g. landing screens) don't reset the bar.\n *\n * When no `header` is configured, or there is no active `component` in context, nothing is\n * rendered. To add a new chrome variant: extend {@link FlowHeaderConfig}, add a renderer below,\n * and add a branch here.\n *\n * @returns A header element above the active flow component, or `null` when no header should show.\n * @internal\n */\nexport function FlowHeader() {\n const { header, component } = useFlow()\n\n if (!header || !component) return null\n\n switch (header.type) {\n case 'minimal':\n return <MinimalHeader back={header.back} cta={header.cta} />\n case 'progress':\n return (\n <ProgressHeader\n currentStep={header.currentStep}\n totalSteps={header.totalSteps}\n cta={header.cta}\n />\n )\n case 'breadcrumbs':\n // The breadcrumb trail is intentionally persisted across \"passive\"\n // states (e.g. landing screens) so that subsequent transitions can\n // pick up where they left off without rebuilding it. We render the\n // bar only when there's an active breadcrumb to show; otherwise\n // we treat the flow as \"no chrome\" for this state.\n if (!header.currentBreadcrumbId) return null\n return (\n <BreadcrumbsHeader\n currentBreadcrumbId={header.currentBreadcrumbId}\n breadcrumbs={header.breadcrumbs}\n cta={header.cta}\n />\n )\n }\n}\n\nfunction MinimalHeader({\n back,\n cta: Cta,\n}: {\n back?: {\n labelKey: string\n namespace: keyof CustomTypeOptions['resources']\n event: EventType\n }\n cta?: React.ComponentType\n}) {\n const { onEvent } = useFlow()\n const Components = useComponentContext()\n const { t } = useTranslation(back?.namespace)\n\n const label = back ? t(back.labelKey as never) : t('back')\n const event = back?.event ?? componentEvents.CANCEL\n\n return (\n <Flex flexDirection=\"row\" justifyContent=\"space-between\" alignItems=\"center\">\n <FlexItem>\n <Components.Button\n variant=\"secondary\"\n icon={<CaretLeftIcon aria-hidden=\"true\" />}\n onClick={() => {\n onEvent(event, undefined)\n }}\n >\n {label}\n </Components.Button>\n </FlexItem>\n {Cta && (\n <FlexItem>\n <Cta />\n </FlexItem>\n )}\n </Flex>\n )\n}\n\nfunction ProgressHeader({\n currentStep,\n totalSteps,\n cta: Cta,\n}: {\n currentStep: number\n totalSteps: number\n cta?: React.ComponentType\n}) {\n const Components = useComponentContext()\n const { t } = useTranslation()\n\n return (\n <Components.ProgressBar\n totalSteps={totalSteps}\n currentStep={currentStep}\n label={t('progressBarLabel', { totalSteps, currentStep })}\n cta={Cta}\n />\n )\n}\n\nfunction BreadcrumbsHeader({\n currentBreadcrumbId,\n breadcrumbs = {},\n cta: Cta,\n}: {\n currentBreadcrumbId?: string\n breadcrumbs?: BreadcrumbTrail\n cta?: React.ComponentType\n}) {\n const { onEvent } = useFlow()\n\n return (\n <Flex flexDirection=\"row\" justifyContent=\"space-between\" alignItems=\"center\">\n <FlexItem flexGrow={1}>\n <FlowBreadcrumbs\n breadcrumbs={currentBreadcrumbId ? (breadcrumbs[currentBreadcrumbId] ?? []) : []}\n currentBreadcrumbId={currentBreadcrumbId}\n onEvent={onEvent}\n />\n </FlexItem>\n <FlexItem>{Cta && <Cta />}</FlexItem>\n </Flex>\n )\n}\n"],"names":["FlowHeader","header","component","useFlow","MinimalHeader","jsx","ProgressHeader","BreadcrumbsHeader","back","Cta","onEvent","Components","useComponentContext","t","useTranslation","label","event","componentEvents","Flex","FlexItem","CaretLeftIcon","currentStep","totalSteps","currentBreadcrumbId","breadcrumbs","FlowBreadcrumbs"],"mappings":"
|
|
1
|
+
{"version":3,"file":"FlowHeader.js","sources":["../../../src/components/Flow/FlowHeader.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport type { CustomTypeOptions } from 'i18next'\nimport { FlowBreadcrumbs } from '../Common/FlowBreadcrumbs/FlowBreadcrumbs'\nimport type { BreadcrumbTrail } from '../Common/FlowBreadcrumbs/FlowBreadcrumbsTypes'\nimport { Flex } from '../Common/Flex'\nimport { FlexItem } from '../Common'\nimport { useFlow } from './useFlow'\nimport { componentEvents, type EventType } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport CaretLeftIcon from '@/assets/icons/caret-left.svg?react'\n\n/**\n * Renders the chrome above the active flow component (back affordance, progress bar, breadcrumbs).\n *\n * @remarks\n * Reads the discriminated `header` value from {@link FlowContext} and dispatches to the matching\n * internal renderer:\n *\n * - `header.type === 'minimal'` — back button and optional CTA.\n * - `header.type === 'progress'` — step indicator with `currentStep` / `totalSteps`.\n * - `header.type === 'breadcrumbs'` — breadcrumb trail; renders nothing while\n * `currentBreadcrumbId` is absent so passive states (e.g. landing screens) don't reset the bar.\n *\n * When no `header` is configured, or there is no active `component` in context, nothing is\n * rendered. To add a new chrome variant: extend {@link FlowHeaderConfig}, add a renderer below,\n * and add a branch here.\n *\n * @returns A header element above the active flow component, or `null` when no header should show.\n * @internal\n */\nexport function FlowHeader() {\n const { header, component } = useFlow()\n\n if (!header || !component) return null\n\n switch (header.type) {\n case 'minimal':\n return <MinimalHeader back={header.back} cta={header.cta} />\n case 'progress':\n return (\n <ProgressHeader\n currentStep={header.currentStep}\n totalSteps={header.totalSteps}\n cta={header.cta}\n />\n )\n case 'breadcrumbs':\n // The breadcrumb trail is intentionally persisted across \"passive\"\n // states (e.g. landing screens) so that subsequent transitions can\n // pick up where they left off without rebuilding it. We render the\n // bar only when there's an active breadcrumb to show; otherwise\n // we treat the flow as \"no chrome\" for this state.\n if (!header.currentBreadcrumbId) return null\n return (\n <BreadcrumbsHeader\n currentBreadcrumbId={header.currentBreadcrumbId}\n breadcrumbs={header.breadcrumbs}\n cta={header.cta}\n />\n )\n }\n}\n\nfunction MinimalHeader({\n back,\n cta: Cta,\n}: {\n back?: {\n labelKey: string\n namespace: keyof CustomTypeOptions['resources']\n event: EventType\n }\n cta?: React.ComponentType\n}) {\n const { onEvent } = useFlow()\n const Components = useComponentContext()\n const { t } = useTranslation(back?.namespace)\n\n const label = back ? t(back.labelKey as never) : t('back')\n const event = back?.event ?? componentEvents.CANCEL\n\n return (\n <Flex flexDirection=\"row\" justifyContent=\"space-between\" alignItems=\"center\">\n <FlexItem>\n <Components.Button\n variant=\"secondary\"\n icon={<CaretLeftIcon aria-hidden=\"true\" />}\n onClick={() => {\n onEvent(event, undefined)\n }}\n >\n {label}\n </Components.Button>\n </FlexItem>\n {Cta && (\n <FlexItem>\n <Cta />\n </FlexItem>\n )}\n </Flex>\n )\n}\n\nfunction ProgressHeader({\n currentStep,\n totalSteps,\n cta: Cta,\n}: {\n currentStep: number\n totalSteps: number\n cta?: React.ComponentType\n}) {\n const Components = useComponentContext()\n const { t } = useTranslation()\n\n return (\n <Components.ProgressBar\n totalSteps={totalSteps}\n currentStep={currentStep}\n label={t('progressBarLabel', { totalSteps, currentStep })}\n cta={Cta}\n />\n )\n}\n\nfunction BreadcrumbsHeader({\n currentBreadcrumbId,\n breadcrumbs = {},\n cta: Cta,\n}: {\n currentBreadcrumbId?: string\n breadcrumbs?: BreadcrumbTrail\n cta?: React.ComponentType\n}) {\n const { onEvent } = useFlow()\n\n return (\n <Flex flexDirection=\"row\" justifyContent=\"space-between\" alignItems=\"center\">\n <FlexItem flexGrow={1}>\n <FlowBreadcrumbs\n breadcrumbs={currentBreadcrumbId ? (breadcrumbs[currentBreadcrumbId] ?? []) : []}\n currentBreadcrumbId={currentBreadcrumbId}\n onEvent={onEvent}\n />\n </FlexItem>\n <FlexItem>{Cta && <Cta />}</FlexItem>\n </Flex>\n )\n}\n"],"names":["FlowHeader","header","component","useFlow","MinimalHeader","jsx","ProgressHeader","BreadcrumbsHeader","back","Cta","onEvent","Components","useComponentContext","t","useTranslation","label","event","componentEvents","Flex","FlexItem","CaretLeftIcon","currentStep","totalSteps","currentBreadcrumbId","breadcrumbs","FlowBreadcrumbs"],"mappings":";;;;;;;;AA8BO,SAASA,IAAa;AAC3B,QAAM,EAAE,QAAAC,GAAQ,WAAAC,EAAA,IAAcC,EAAA;AAE9B,MAAI,CAACF,KAAU,CAACC,EAAW,QAAO;AAElC,UAAQD,EAAO,MAAA;AAAA,IACb,KAAK;AACH,+BAAQG,GAAA,EAAc,MAAMH,EAAO,MAAM,KAAKA,EAAO,KAAK;AAAA,IAC5D,KAAK;AACH,aACE,gBAAAI;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,aAAaL,EAAO;AAAA,UACpB,YAAYA,EAAO;AAAA,UACnB,KAAKA,EAAO;AAAA,QAAA;AAAA,MAAA;AAAA,IAGlB,KAAK;AAMH,aAAKA,EAAO,sBAEV,gBAAAI;AAAA,QAACE;AAAA,QAAA;AAAA,UACC,qBAAqBN,EAAO;AAAA,UAC5B,aAAaA,EAAO;AAAA,UACpB,KAAKA,EAAO;AAAA,QAAA;AAAA,MAAA,IALwB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AAEpB,2BACGe,GAAA,EAAK,eAAc,OAAM,gBAAe,iBAAgB,YAAW,UAClE,UAAA;AAAA,IAAA,gBAAAb,EAACc,GAAA,EAAS,UAAU,GAClB,UAAA,gBAAAd;AAAA,MAACoB;AAAA,MAAA;AAAA,QACC,aAAaF,IAAuBC,EAAYD,CAAmB,KAAK,CAAA,IAAM,CAAA;AAAA,QAC9E,qBAAAA;AAAA,QACA,SAAAb;AAAA,MAAA;AAAA,IAAA,GAEJ;AAAA,IACA,gBAAAL,EAACc,GAAA,EAAU,UAAAV,KAAO,gBAAAJ,EAACI,KAAI,EAAA,CAAG;AAAA,EAAA,GAC5B;AAEJ;"}
|
package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js
CHANGED
|
@@ -13,10 +13,9 @@ import s from "./InformationRequestForm.module.scss.js";
|
|
|
13
13
|
import { BaseComponent as W } from "../../Base/Base.js";
|
|
14
14
|
import { useBase as j } from "../../Base/useBase.js";
|
|
15
15
|
import { Flex as E } from "../../Common/Flex/Flex.js";
|
|
16
|
-
import {
|
|
17
|
-
import "
|
|
18
|
-
import {
|
|
19
|
-
import { Form as V } from "../../Common/Form/Form.js";
|
|
16
|
+
import { FileInputField as H } from "../../Common/Fields/FileInputField/FileInputField.js";
|
|
17
|
+
import { Form as G } from "../../Common/Form/Form.js";
|
|
18
|
+
import { useComponentContext as V } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
20
19
|
import { useComponentDictionary as X, useI18n as Y } from "../../../i18n/I18n.js";
|
|
21
20
|
import { informationRequestEvents as $ } from "../../../shared/constants.js";
|
|
22
21
|
import "../../Flow/useFlow.js";
|
|
@@ -28,7 +27,7 @@ const K = "gusto-sdk-information-request-form", Z = ["image/jpeg", "image/png",
|
|
|
28
27
|
l.string(),
|
|
29
28
|
l.union([l.string().min(1), l.instanceof(File)])
|
|
30
29
|
);
|
|
31
|
-
function
|
|
30
|
+
function be(t) {
|
|
32
31
|
return /* @__PURE__ */ e(W, { ...t, children: /* @__PURE__ */ e(ae, { ...t, children: t.children }) });
|
|
33
32
|
}
|
|
34
33
|
const te = (t) => new Promise((r, h) => {
|
|
@@ -45,7 +44,7 @@ function ie(t) {
|
|
|
45
44
|
}
|
|
46
45
|
function ae({ companyId: t, requestId: r, dictionary: h }) {
|
|
47
46
|
X("InformationRequests.InformationRequestForm", h), Y("InformationRequests.InformationRequestForm");
|
|
48
|
-
const { t: o } = C("InformationRequests.InformationRequestForm"), { Alert: F, Heading: S, Text: a } =
|
|
47
|
+
const { t: o } = C("InformationRequests.InformationRequestForm"), { Alert: F, Heading: S, Text: a } = V(), { onEvent: x, baseSubmitHandler: N } = j(), { data: D } = z({
|
|
49
48
|
companyUuid: t
|
|
50
49
|
}), y = D.informationRequests?.find((n) => n.uuid === r), c = y?.requiredQuestions ?? [], U = y?.blockingPayroll ?? !1, b = re(c), g = ie(c), { mutateAsync: P } = B(), T = {}, R = [];
|
|
51
50
|
c.forEach((n) => {
|
|
@@ -113,7 +112,7 @@ function ae({ companyId: t, requestId: r, dictionary: h }) {
|
|
|
113
112
|
}
|
|
114
113
|
) }),
|
|
115
114
|
f && /* @__PURE__ */ e("div", { className: s.fileInputWrapper, children: /* @__PURE__ */ e(
|
|
116
|
-
|
|
115
|
+
H,
|
|
117
116
|
{
|
|
118
117
|
name: d,
|
|
119
118
|
label: o("fields.fileUpload.label"),
|
|
@@ -136,10 +135,10 @@ function ae({ companyId: t, requestId: r, dictionary: h }) {
|
|
|
136
135
|
return /* @__PURE__ */ e("div", { className: s.root, children: /* @__PURE__ */ p(E, { flexDirection: "column", gap: 16, children: [
|
|
137
136
|
/* @__PURE__ */ e(S, { as: "h2", children: o("title") }),
|
|
138
137
|
U && /* @__PURE__ */ e(F, { status: "error", label: o("blockingAlert.title"), disableScrollIntoView: !0, children: o("blockingAlert.description") }),
|
|
139
|
-
b ? O : /* @__PURE__ */ e(Q, { ...I, children: /* @__PURE__ */ e(
|
|
138
|
+
b ? O : /* @__PURE__ */ e(Q, { ...I, children: /* @__PURE__ */ e(G, { id: K, onSubmit: I.handleSubmit(_), children: /* @__PURE__ */ e(E, { flexDirection: "column", gap: 16, children: c.map(A) }) }) })
|
|
140
139
|
] }) });
|
|
141
140
|
}
|
|
142
141
|
export {
|
|
143
|
-
|
|
142
|
+
be as InformationRequestForm
|
|
144
143
|
};
|
|
145
144
|
//# sourceMappingURL=InformationRequestForm.js.map
|
package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InformationRequestForm.js","sources":["../../../../src/components/InformationRequests/InformationRequestForm/InformationRequestForm.tsx"],"sourcesContent":["import DOMPurify from 'dompurify'\nimport { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { z } from 'zod'\nimport { useIsMutating } from '@tanstack/react-query'\nimport { useInformationRequestsGetInformationRequestsSuspense } from '@gusto/embedded-api/react-query/informationRequestsGetInformationRequests'\nimport {\n useInformationRequestsSubmitMutation,\n mutationKeyInformationRequestsSubmit,\n} from '@gusto/embedded-api/react-query/informationRequestsSubmit'\nimport type { RequiredQuestions } from '@gusto/embedded-api/models/components/informationrequest'\nimport { ResponseType } from '@gusto/embedded-api/models/components/informationrequest'\nimport { ResponseType as SubmitResponseType } from '@gusto/embedded-api/models/operations/submitinformationrequest'\nimport type { InformationRequestsContextInterface } from '../InformationRequestsComponents'\nimport styles from './InformationRequestForm.module.scss'\nimport { BaseComponent, useBase, type BaseComponentInterface } from '@/components/Base'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport { Flex, TextInputField } from '@/components/Common'\nimport { FileInputField } from '@/components/Common/Fields/FileInputField'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { informationRequestEvents, type EventType } from '@/shared/constants'\nimport { useFlow } from '@/components/Flow/useFlow'\n\nconst INFORMATION_REQUEST_FORM_ID = 'gusto-sdk-information-request-form'\nconst ACCEPTED_FILE_TYPES = ['image/jpeg', 'image/png', 'application/pdf']\nconst dompurifyConfig = {\n ALLOWED_TAGS: ['a', 'b', 'strong'],\n ALLOWED_ATTR: ['target', 'href', 'rel'],\n}\n\n/* API does not enforce an upper limit, so set a reasonable character max for a single-line input. */\nconst MAX_TEXT_RESPONSE = 5000\n\nconst InformationRequestFormSchema = z.record(\n z.string(),\n z.union([z.string().min(1), z.instanceof(File)]),\n)\n\ntype InformationRequestFormValues = z.infer<typeof InformationRequestFormSchema>\n\n/**\n * Props for {@link InformationRequestForm}.\n *\n * @public\n */\nexport interface InformationRequestFormProps extends BaseComponentInterface<'InformationRequests.InformationRequestForm'> {\n /** The associated company identifier. */\n companyId: string\n /** The identifier of the information request to respond to. */\n requestId: string\n /** Event handler invoked when the form is submitted or cancelled. See the events table in {@link InformationRequestForm}. */\n onEvent: OnEventType<EventType, unknown>\n}\n\n/**\n * Dynamic response form for a single information request.\n *\n * Renders supported question types (text and document upload) based on the request's\n * `requiredQuestions` payload and submits responses to the Submit information request\n * endpoint. Use this component directly when you have built your own list or routing\n * surface and need to host the form — typically inside a modal or page you control.\n *\n * Requests with unsupported response types (e.g. `persona`-driven identity verification)\n * display a guidance message instead of the form; in those cases the user must complete\n * the request through your own integration with the underlying provider.\n *\n * Text inputs accept up to 5,000 characters. Document uploads are restricted to JPEG,\n * PNG, or PDF.\n *\n * @remarks\n * Events emitted via `onEvent`:\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `informationRequest/form/done` | Fired when the form is successfully submitted | The `informationRequest` field from the Submit information request response |\n * | `informationRequest/form/cancel` | Fired when the user cancels the form | — |\n *\n * @param props - See {@link InformationRequestFormProps}.\n * @returns The rendered information request response form.\n * @public\n */\nexport function InformationRequestForm(props: InformationRequestFormProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst convertFileToDataUrl = (file: File) => {\n return new Promise<string>((resolve, reject) => {\n const reader = new FileReader()\n reader.onload = () => {\n resolve(reader.result as string)\n }\n reader.onerror = reject\n reader.readAsDataURL(file)\n })\n}\n\nconst SUPPORTED_RESPONSE_TYPES: ResponseType[] = [ResponseType.Text, ResponseType.Document]\n\nfunction hasUnsupportedQuestionTypes(questions: RequiredQuestions[]) {\n return questions.some(question => !SUPPORTED_RESPONSE_TYPES.includes(question.responseType))\n}\n\nfunction hasPersonaQuestionType(questions: RequiredQuestions[]) {\n return questions.some(question => question.responseType === ResponseType.Persona)\n}\n\nfunction Root({ companyId, requestId, dictionary }: InformationRequestFormProps) {\n useComponentDictionary('InformationRequests.InformationRequestForm', dictionary)\n useI18n('InformationRequests.InformationRequestForm')\n const { t } = useTranslation('InformationRequests.InformationRequestForm')\n const { Alert, Heading, Text } = useComponentContext()\n const { onEvent, baseSubmitHandler } = useBase()\n\n const { data } = useInformationRequestsGetInformationRequestsSuspense({\n companyUuid: companyId,\n })\n\n const informationRequest = data.informationRequests?.find(req => req.uuid === requestId)\n const requiredQuestions = informationRequest?.requiredQuestions ?? []\n const isBlockingPayroll = informationRequest?.blockingPayroll ?? false\n const hasUnsupportedTypes = hasUnsupportedQuestionTypes(requiredQuestions)\n const hasPersonaType = hasPersonaQuestionType(requiredQuestions)\n\n const { mutateAsync: submitInformationRequest } = useInformationRequestsSubmitMutation()\n\n const defaultValues: Record<string, string | File | undefined> = {}\n const questionUuids: string[] = []\n\n requiredQuestions.forEach(question => {\n if (question.responseType === ResponseType.Text) {\n questionUuids.push(question.questionUuid)\n defaultValues[question.questionUuid] = ''\n } else if (question.responseType === ResponseType.Document) {\n questionUuids.push(question.questionUuid)\n defaultValues[question.questionUuid] = undefined\n }\n })\n\n const formMethods = useForm<InformationRequestFormValues>({\n resolver: zodResolver(InformationRequestFormSchema),\n defaultValues,\n })\n\n const onSubmit = async (formData: InformationRequestFormValues) => {\n await baseSubmitHandler(formData, async () => {\n const questionResponses = await Promise.all(\n questionUuids.map(async uuid => {\n const value = formData[uuid]\n\n if (typeof value === 'string') {\n return {\n questionUuid: uuid,\n responseType: SubmitResponseType.Text,\n textResponse: value,\n }\n }\n\n if (value instanceof File) {\n const fileResponse = await convertFileToDataUrl(value)\n return {\n questionUuid: uuid,\n responseType: SubmitResponseType.Document,\n fileResponse,\n fileName: value.name,\n }\n }\n\n return null\n }),\n )\n\n const validResponses = questionResponses.filter(response => response !== null)\n\n const response = await submitInformationRequest({\n request: {\n informationRequestUuid: requestId,\n requestBody: {\n requiredQuestions: validResponses,\n },\n },\n })\n\n onEvent(informationRequestEvents.INFORMATION_REQUEST_FORM_DONE, response.informationRequest)\n })\n }\n\n const renderQuestion = (question: RequiredQuestions) => {\n const fieldName = question.questionUuid\n const isDocumentType = question.responseType === ResponseType.Document\n const isTextType = question.responseType === ResponseType.Text\n\n return (\n <div key={fieldName} className={styles.questionCard}>\n <div className={styles.questionDescription}>\n <Text size=\"sm\" weight=\"medium\">\n {isDocumentType ? t('questionTypes.document') : t('questionTypes.answer')}\n </Text>\n <Text size=\"sm\" variant=\"supporting\">\n {/* SECURITY: XSS mitigated via DOMPurify with strict allowlist. Pattern matches TaxInputs.tsx */}\n <span\n dangerouslySetInnerHTML={{\n __html: DOMPurify.sanitize(question.questionText, dompurifyConfig),\n }}\n />\n </Text>\n </div>\n\n <hr className={styles.divider} />\n\n {isTextType && (\n <div className={styles.textInputWrapper}>\n <TextInputField\n name={fieldName}\n label={t('fields.textAnswer.label')}\n placeholder={t('fields.textAnswer.placeholder')}\n maxLength={MAX_TEXT_RESPONSE}\n isRequired\n errorMessage={t('validation.required')}\n />\n </div>\n )}\n\n {isDocumentType && (\n <div className={styles.fileInputWrapper}>\n <FileInputField\n name={fieldName}\n label={t('fields.fileUpload.label')}\n accept={ACCEPTED_FILE_TYPES}\n isRequired\n errorMessage={t('validation.required')}\n />\n </div>\n )}\n </div>\n )\n }\n\n const unsupportedPlaceholder = (\n <div className={styles.questionCard}>\n <div className={styles.questionDescription}>\n <Text weight=\"medium\">\n {t(hasPersonaType ? 'unsupported.persona.title' : 'unsupported.generic.title')}\n </Text>\n <Text>\n {t(\n hasPersonaType ? 'unsupported.persona.description' : 'unsupported.generic.description',\n )}\n </Text>\n </div>\n\n <hr className={styles.divider} />\n\n <div className={styles.contactSupport}>\n <Text variant=\"supporting\">{t('unsupported.contactSupport')}</Text>\n </div>\n </div>\n )\n\n return (\n <div className={styles.root}>\n <Flex flexDirection=\"column\" gap={16}>\n <Heading as=\"h2\">{t('title')}</Heading>\n\n {isBlockingPayroll && (\n <Alert status=\"error\" label={t('blockingAlert.title')} disableScrollIntoView>\n {t('blockingAlert.description')}\n </Alert>\n )}\n\n {hasUnsupportedTypes ? (\n unsupportedPlaceholder\n ) : (\n <FormProvider {...formMethods}>\n <Form id={INFORMATION_REQUEST_FORM_ID} onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={16}>\n {requiredQuestions.map(renderQuestion)}\n </Flex>\n </Form>\n </FormProvider>\n )}\n </Flex>\n </div>\n )\n}\n\n/** @internal */\nexport function Footer({ onEvent }: { onEvent: OnEventType<EventType, unknown> }) {\n useI18n('InformationRequests.InformationRequestForm')\n const { t } = useTranslation('InformationRequests.InformationRequestForm')\n const { Button } = useComponentContext()\n const { companyId, selectedRequestId } = useFlow<InformationRequestsContextInterface>()\n\n const { data } = useInformationRequestsGetInformationRequestsSuspense({\n companyUuid: companyId,\n })\n\n const informationRequest = data.informationRequests?.find(req => req.uuid === selectedRequestId)\n const requiredQuestions = informationRequest?.requiredQuestions ?? []\n const hasUnsupportedTypes = hasUnsupportedQuestionTypes(requiredQuestions)\n\n const isMutating = useIsMutating({\n mutationKey: mutationKeyInformationRequestsSubmit(),\n })\n const isPending = isMutating > 0\n\n const handleCancel = () => {\n onEvent(informationRequestEvents.INFORMATION_REQUEST_FORM_CANCEL)\n }\n\n if (hasUnsupportedTypes) {\n return (\n <Flex justifyContent=\"flex-end\" gap={12}>\n <Button variant=\"secondary\" onClick={handleCancel}>\n {t('cta.close')}\n </Button>\n </Flex>\n )\n }\n\n return (\n <Flex justifyContent=\"flex-end\" gap={12}>\n <Button variant=\"secondary\" onClick={handleCancel} isDisabled={isPending}>\n {t('cta.cancel')}\n </Button>\n <Button\n variant=\"primary\"\n type=\"submit\"\n form={INFORMATION_REQUEST_FORM_ID}\n isLoading={isPending}\n >\n {t('cta.submit')}\n </Button>\n </Flex>\n )\n}\n"],"names":["INFORMATION_REQUEST_FORM_ID","ACCEPTED_FILE_TYPES","dompurifyConfig","MAX_TEXT_RESPONSE","InformationRequestFormSchema","z","InformationRequestForm","props","jsx","BaseComponent","Root","convertFileToDataUrl","file","resolve","reject","reader","SUPPORTED_RESPONSE_TYPES","ResponseType","hasUnsupportedQuestionTypes","questions","question","hasPersonaQuestionType","companyId","requestId","dictionary","useComponentDictionary","useI18n","t","useTranslation","Alert","Heading","Text","useComponentContext","onEvent","baseSubmitHandler","useBase","data","useInformationRequestsGetInformationRequestsSuspense","informationRequest","req","requiredQuestions","isBlockingPayroll","hasUnsupportedTypes","hasPersonaType","submitInformationRequest","useInformationRequestsSubmitMutation","defaultValues","questionUuids","formMethods","useForm","zodResolver","onSubmit","formData","validResponses","uuid","value","SubmitResponseType","fileResponse","response","informationRequestEvents","renderQuestion","fieldName","isDocumentType","isTextType","jsxs","styles","DOMPurify","TextInputField","FileInputField","unsupportedPlaceholder","Flex","FormProvider","Form"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAMA,IAA8B,sCAC9BC,IAAsB,CAAC,cAAc,aAAa,iBAAiB,GACnEC,KAAkB;AAAA,EACtB,cAAc,CAAC,KAAK,KAAK,QAAQ;AAAA,EACjC,cAAc,CAAC,UAAU,QAAQ,KAAK;AACxC,GAGMC,KAAoB,KAEpBC,KAA+BC,EAAE;AAAA,EACrCA,EAAE,OAAA;AAAA,EACFA,EAAE,MAAM,CAACA,EAAE,OAAA,EAAS,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EAAK,eAAc,UAAS,KAAK,IAC/B,UAAA9B,EAAkB,IAAIoB,CAAc,EAAA,CACvC,EAAA,CACF,EAAA,CACF;AAAA,EAAA,EAAA,CAEJ,EAAA,CACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"InformationRequestForm.js","sources":["../../../../src/components/InformationRequests/InformationRequestForm/InformationRequestForm.tsx"],"sourcesContent":["import DOMPurify from 'dompurify'\nimport { useTranslation } from 'react-i18next'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { z } from 'zod'\nimport { useIsMutating } from '@tanstack/react-query'\nimport { useInformationRequestsGetInformationRequestsSuspense } from '@gusto/embedded-api/react-query/informationRequestsGetInformationRequests'\nimport {\n useInformationRequestsSubmitMutation,\n mutationKeyInformationRequestsSubmit,\n} from '@gusto/embedded-api/react-query/informationRequestsSubmit'\nimport type { RequiredQuestions } from '@gusto/embedded-api/models/components/informationrequest'\nimport { ResponseType } from '@gusto/embedded-api/models/components/informationrequest'\nimport { ResponseType as SubmitResponseType } from '@gusto/embedded-api/models/operations/submitinformationrequest'\nimport type { InformationRequestsContextInterface } from '../InformationRequestsComponents'\nimport styles from './InformationRequestForm.module.scss'\nimport { BaseComponent, useBase, type BaseComponentInterface } from '@/components/Base'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport { Flex, TextInputField } from '@/components/Common'\nimport { FileInputField } from '@/components/Common/Fields/FileInputField'\nimport { Form } from '@/components/Common/Form'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { informationRequestEvents, type EventType } from '@/shared/constants'\nimport { useFlow } from '@/components/Flow/useFlow'\n\nconst INFORMATION_REQUEST_FORM_ID = 'gusto-sdk-information-request-form'\nconst ACCEPTED_FILE_TYPES = ['image/jpeg', 'image/png', 'application/pdf']\nconst dompurifyConfig = {\n ALLOWED_TAGS: ['a', 'b', 'strong'],\n ALLOWED_ATTR: ['target', 'href', 'rel'],\n}\n\n/* API does not enforce an upper limit, so set a reasonable character max for a single-line input. */\nconst MAX_TEXT_RESPONSE = 5000\n\nconst InformationRequestFormSchema = z.record(\n z.string(),\n z.union([z.string().min(1), z.instanceof(File)]),\n)\n\ntype InformationRequestFormValues = z.infer<typeof InformationRequestFormSchema>\n\n/**\n * Props for {@link InformationRequestForm}.\n *\n * @public\n */\nexport interface InformationRequestFormProps extends BaseComponentInterface<'InformationRequests.InformationRequestForm'> {\n /** The associated company identifier. */\n companyId: string\n /** The identifier of the information request to respond to. */\n requestId: string\n /** Event handler invoked when the form is submitted or cancelled. See the events table in {@link InformationRequestForm}. */\n onEvent: OnEventType<EventType, unknown>\n}\n\n/**\n * Dynamic response form for a single information request.\n *\n * Renders supported question types (text and document upload) based on the request's\n * `requiredQuestions` payload and submits responses to the Submit information request\n * endpoint. Use this component directly when you have built your own list or routing\n * surface and need to host the form — typically inside a modal or page you control.\n *\n * Requests with unsupported response types (e.g. `persona`-driven identity verification)\n * display a guidance message instead of the form; in those cases the user must complete\n * the request through your own integration with the underlying provider.\n *\n * Text inputs accept up to 5,000 characters. Document uploads are restricted to JPEG,\n * PNG, or PDF.\n *\n * @remarks\n * Events emitted via `onEvent`:\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `informationRequest/form/done` | Fired when the form is successfully submitted | The `informationRequest` field from the Submit information request response |\n * | `informationRequest/form/cancel` | Fired when the user cancels the form | — |\n *\n * @param props - See {@link InformationRequestFormProps}.\n * @returns The rendered information request response form.\n * @public\n */\nexport function InformationRequestForm(props: InformationRequestFormProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst convertFileToDataUrl = (file: File) => {\n return new Promise<string>((resolve, reject) => {\n const reader = new FileReader()\n reader.onload = () => {\n resolve(reader.result as string)\n }\n reader.onerror = reject\n reader.readAsDataURL(file)\n })\n}\n\nconst SUPPORTED_RESPONSE_TYPES: ResponseType[] = [ResponseType.Text, ResponseType.Document]\n\nfunction hasUnsupportedQuestionTypes(questions: RequiredQuestions[]) {\n return questions.some(question => !SUPPORTED_RESPONSE_TYPES.includes(question.responseType))\n}\n\nfunction hasPersonaQuestionType(questions: RequiredQuestions[]) {\n return questions.some(question => question.responseType === ResponseType.Persona)\n}\n\nfunction Root({ companyId, requestId, dictionary }: InformationRequestFormProps) {\n useComponentDictionary('InformationRequests.InformationRequestForm', dictionary)\n useI18n('InformationRequests.InformationRequestForm')\n const { t } = useTranslation('InformationRequests.InformationRequestForm')\n const { Alert, Heading, Text } = useComponentContext()\n const { onEvent, baseSubmitHandler } = useBase()\n\n const { data } = useInformationRequestsGetInformationRequestsSuspense({\n companyUuid: companyId,\n })\n\n const informationRequest = data.informationRequests?.find(req => req.uuid === requestId)\n const requiredQuestions = informationRequest?.requiredQuestions ?? []\n const isBlockingPayroll = informationRequest?.blockingPayroll ?? false\n const hasUnsupportedTypes = hasUnsupportedQuestionTypes(requiredQuestions)\n const hasPersonaType = hasPersonaQuestionType(requiredQuestions)\n\n const { mutateAsync: submitInformationRequest } = useInformationRequestsSubmitMutation()\n\n const defaultValues: Record<string, string | File | undefined> = {}\n const questionUuids: string[] = []\n\n requiredQuestions.forEach(question => {\n if (question.responseType === ResponseType.Text) {\n questionUuids.push(question.questionUuid)\n defaultValues[question.questionUuid] = ''\n } else if (question.responseType === ResponseType.Document) {\n questionUuids.push(question.questionUuid)\n defaultValues[question.questionUuid] = undefined\n }\n })\n\n const formMethods = useForm<InformationRequestFormValues>({\n resolver: zodResolver(InformationRequestFormSchema),\n defaultValues,\n })\n\n const onSubmit = async (formData: InformationRequestFormValues) => {\n await baseSubmitHandler(formData, async () => {\n const questionResponses = await Promise.all(\n questionUuids.map(async uuid => {\n const value = formData[uuid]\n\n if (typeof value === 'string') {\n return {\n questionUuid: uuid,\n responseType: SubmitResponseType.Text,\n textResponse: value,\n }\n }\n\n if (value instanceof File) {\n const fileResponse = await convertFileToDataUrl(value)\n return {\n questionUuid: uuid,\n responseType: SubmitResponseType.Document,\n fileResponse,\n fileName: value.name,\n }\n }\n\n return null\n }),\n )\n\n const validResponses = questionResponses.filter(response => response !== null)\n\n const response = await submitInformationRequest({\n request: {\n informationRequestUuid: requestId,\n requestBody: {\n requiredQuestions: validResponses,\n },\n },\n })\n\n onEvent(informationRequestEvents.INFORMATION_REQUEST_FORM_DONE, response.informationRequest)\n })\n }\n\n const renderQuestion = (question: RequiredQuestions) => {\n const fieldName = question.questionUuid\n const isDocumentType = question.responseType === ResponseType.Document\n const isTextType = question.responseType === ResponseType.Text\n\n return (\n <div key={fieldName} className={styles.questionCard}>\n <div className={styles.questionDescription}>\n <Text size=\"sm\" weight=\"medium\">\n {isDocumentType ? t('questionTypes.document') : t('questionTypes.answer')}\n </Text>\n <Text size=\"sm\" variant=\"supporting\">\n {/* SECURITY: XSS mitigated via DOMPurify with strict allowlist. Pattern matches TaxInputs.tsx */}\n <span\n dangerouslySetInnerHTML={{\n __html: DOMPurify.sanitize(question.questionText, dompurifyConfig),\n }}\n />\n </Text>\n </div>\n\n <hr className={styles.divider} />\n\n {isTextType && (\n <div className={styles.textInputWrapper}>\n <TextInputField\n name={fieldName}\n label={t('fields.textAnswer.label')}\n placeholder={t('fields.textAnswer.placeholder')}\n maxLength={MAX_TEXT_RESPONSE}\n isRequired\n errorMessage={t('validation.required')}\n />\n </div>\n )}\n\n {isDocumentType && (\n <div className={styles.fileInputWrapper}>\n <FileInputField\n name={fieldName}\n label={t('fields.fileUpload.label')}\n accept={ACCEPTED_FILE_TYPES}\n isRequired\n errorMessage={t('validation.required')}\n />\n </div>\n )}\n </div>\n )\n }\n\n const unsupportedPlaceholder = (\n <div className={styles.questionCard}>\n <div className={styles.questionDescription}>\n <Text weight=\"medium\">\n {t(hasPersonaType ? 'unsupported.persona.title' : 'unsupported.generic.title')}\n </Text>\n <Text>\n {t(\n hasPersonaType ? 'unsupported.persona.description' : 'unsupported.generic.description',\n )}\n </Text>\n </div>\n\n <hr className={styles.divider} />\n\n <div className={styles.contactSupport}>\n <Text variant=\"supporting\">{t('unsupported.contactSupport')}</Text>\n </div>\n </div>\n )\n\n return (\n <div className={styles.root}>\n <Flex flexDirection=\"column\" gap={16}>\n <Heading as=\"h2\">{t('title')}</Heading>\n\n {isBlockingPayroll && (\n <Alert status=\"error\" label={t('blockingAlert.title')} disableScrollIntoView>\n {t('blockingAlert.description')}\n </Alert>\n )}\n\n {hasUnsupportedTypes ? (\n unsupportedPlaceholder\n ) : (\n <FormProvider {...formMethods}>\n <Form id={INFORMATION_REQUEST_FORM_ID} onSubmit={formMethods.handleSubmit(onSubmit)}>\n <Flex flexDirection=\"column\" gap={16}>\n {requiredQuestions.map(renderQuestion)}\n </Flex>\n </Form>\n </FormProvider>\n )}\n </Flex>\n </div>\n )\n}\n\n/** @internal */\nexport function Footer({ onEvent }: { onEvent: OnEventType<EventType, unknown> }) {\n useI18n('InformationRequests.InformationRequestForm')\n const { t } = useTranslation('InformationRequests.InformationRequestForm')\n const { Button } = useComponentContext()\n const { companyId, selectedRequestId } = useFlow<InformationRequestsContextInterface>()\n\n const { data } = useInformationRequestsGetInformationRequestsSuspense({\n companyUuid: companyId,\n })\n\n const informationRequest = data.informationRequests?.find(req => req.uuid === selectedRequestId)\n const requiredQuestions = informationRequest?.requiredQuestions ?? []\n const hasUnsupportedTypes = hasUnsupportedQuestionTypes(requiredQuestions)\n\n const isMutating = useIsMutating({\n mutationKey: mutationKeyInformationRequestsSubmit(),\n })\n const isPending = isMutating > 0\n\n const handleCancel = () => {\n onEvent(informationRequestEvents.INFORMATION_REQUEST_FORM_CANCEL)\n }\n\n if (hasUnsupportedTypes) {\n return (\n <Flex justifyContent=\"flex-end\" gap={12}>\n <Button variant=\"secondary\" onClick={handleCancel}>\n {t('cta.close')}\n </Button>\n </Flex>\n )\n }\n\n return (\n <Flex justifyContent=\"flex-end\" gap={12}>\n <Button variant=\"secondary\" onClick={handleCancel} isDisabled={isPending}>\n {t('cta.cancel')}\n </Button>\n <Button\n variant=\"primary\"\n type=\"submit\"\n form={INFORMATION_REQUEST_FORM_ID}\n isLoading={isPending}\n >\n {t('cta.submit')}\n </Button>\n </Flex>\n )\n}\n"],"names":["INFORMATION_REQUEST_FORM_ID","ACCEPTED_FILE_TYPES","dompurifyConfig","MAX_TEXT_RESPONSE","InformationRequestFormSchema","z","InformationRequestForm","props","jsx","BaseComponent","Root","convertFileToDataUrl","file","resolve","reject","reader","SUPPORTED_RESPONSE_TYPES","ResponseType","hasUnsupportedQuestionTypes","questions","question","hasPersonaQuestionType","companyId","requestId","dictionary","useComponentDictionary","useI18n","t","useTranslation","Alert","Heading","Text","useComponentContext","onEvent","baseSubmitHandler","useBase","data","useInformationRequestsGetInformationRequestsSuspense","informationRequest","req","requiredQuestions","isBlockingPayroll","hasUnsupportedTypes","hasPersonaType","submitInformationRequest","useInformationRequestsSubmitMutation","defaultValues","questionUuids","formMethods","useForm","zodResolver","onSubmit","formData","validResponses","uuid","value","SubmitResponseType","fileResponse","response","informationRequestEvents","renderQuestion","fieldName","isDocumentType","isTextType","jsxs","styles","DOMPurify","TextInputField","FileInputField","unsupportedPlaceholder","Flex","FormProvider","Form"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAMA,IAA8B,sCAC9BC,IAAsB,CAAC,cAAc,aAAa,iBAAiB,GACnEC,KAAkB;AAAA,EACtB,cAAc,CAAC,KAAK,KAAK,QAAQ;AAAA,EACjC,cAAc,CAAC,UAAU,QAAQ,KAAK;AACxC,GAGMC,KAAoB,KAEpBC,KAA+BC,EAAE;AAAA,EACrCA,EAAE,OAAA;AAAA,EACFA,EAAE,MAAM,CAACA,EAAE,OAAA,EAAS,IAAI,CAAC,GAAGA,EAAE,WAAW,IAAI,CAAC,CAAC;AACjD;AA8CO,SAASC,GAAuBC,GAAoC;AACzE,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,MAAM,GAAGH,GAAQ,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equestList.js
CHANGED
|
@@ -10,14 +10,13 @@ import { DataView as D } from "../../Common/DataView/DataView.js";
|
|
|
10
10
|
import { useDataView as k } from "../../Common/DataView/useDataView.js";
|
|
11
11
|
import { FlexItem as E, Flex as u } from "../../Common/Flex/Flex.js";
|
|
12
12
|
import { EmptyData as v } from "../../Common/EmptyData/EmptyData.js";
|
|
13
|
-
import "react";
|
|
14
13
|
import { informationRequestEvents as B } from "../../../shared/constants.js";
|
|
15
|
-
function
|
|
14
|
+
function J(o) {
|
|
16
15
|
return /* @__PURE__ */ n(w, { ...o, children: /* @__PURE__ */ n(C, { ...o, children: o.children }) });
|
|
17
16
|
}
|
|
18
17
|
function C({ companyId: o, dictionary: d, onEvent: f }) {
|
|
19
18
|
S("InformationRequests.InformationRequestList", d), T("InformationRequests.InformationRequestList");
|
|
20
|
-
const { t } = b("InformationRequests.InformationRequestList"), { Heading: y, Text:
|
|
19
|
+
const { t } = b("InformationRequests.InformationRequestList"), { Heading: y, Text: l, Button: R, Badge: m } = x(), { data: g } = P({
|
|
21
20
|
companyUuid: o
|
|
22
21
|
}), c = (g.informationRequests ?? []).filter(
|
|
23
22
|
(e) => e.status !== r.Approved
|
|
@@ -50,7 +49,7 @@ function C({ companyId: o, dictionary: d, onEvent: f }) {
|
|
|
50
49
|
{
|
|
51
50
|
key: "type",
|
|
52
51
|
title: t("columns.type"),
|
|
53
|
-
render: (e) => /* @__PURE__ */ n(E, { flexGrow: 1, children: /* @__PURE__ */ n(
|
|
52
|
+
render: (e) => /* @__PURE__ */ n(E, { flexGrow: 1, children: /* @__PURE__ */ n(l, { weight: "medium", children: h(e.type) }) })
|
|
54
53
|
},
|
|
55
54
|
{
|
|
56
55
|
key: "status",
|
|
@@ -58,8 +57,8 @@ function C({ companyId: o, dictionary: d, onEvent: f }) {
|
|
|
58
57
|
render: (e) => {
|
|
59
58
|
const s = q(e.status), p = e.blockingPayroll;
|
|
60
59
|
return !s && !p ? null : /* @__PURE__ */ a(u, { gap: 8, alignItems: "center", children: [
|
|
61
|
-
s && /* @__PURE__ */ n(
|
|
62
|
-
p && /* @__PURE__ */ n(
|
|
60
|
+
s && /* @__PURE__ */ n(m, { status: s.badgeStatus, children: s.label }),
|
|
61
|
+
p && /* @__PURE__ */ n(m, { status: "error", children: t("status.payrollBlocking") })
|
|
63
62
|
] });
|
|
64
63
|
}
|
|
65
64
|
}
|
|
@@ -80,12 +79,12 @@ function C({ companyId: o, dictionary: d, onEvent: f }) {
|
|
|
80
79
|
return /* @__PURE__ */ a(u, { flexDirection: "column", gap: 20, children: [
|
|
81
80
|
/* @__PURE__ */ a(u, { flexDirection: "column", gap: 2, children: [
|
|
82
81
|
/* @__PURE__ */ n(y, { as: "h2", styledAs: "h4", children: t("title") }),
|
|
83
|
-
c.length > 0 && /* @__PURE__ */ n(
|
|
82
|
+
c.length > 0 && /* @__PURE__ */ n(l, { children: t("description") })
|
|
84
83
|
] }),
|
|
85
84
|
/* @__PURE__ */ n(D, { ...I, label: t("title") })
|
|
86
85
|
] });
|
|
87
86
|
}
|
|
88
87
|
export {
|
|
89
|
-
|
|
88
|
+
J as InformationRequestList
|
|
90
89
|
};
|
|
91
90
|
//# sourceMappingURL=InformationRequestList.js.map
|
package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InformationRequestList.js","sources":["../../../../src/components/InformationRequests/InformationRequestList/InformationRequestList.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useInformationRequestsGetInformationRequestsSuspense } from '@gusto/embedded-api/react-query/informationRequestsGetInformationRequests'\nimport type { InformationRequest } from '@gusto/embedded-api/models/components/informationrequest'\nimport {\n InformationRequestStatus,\n InformationRequestType,\n} from '@gusto/embedded-api/models/components/informationrequest'\nimport { BaseComponent, type BaseComponentInterface } from '@/components/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { DataView } from '@/components/Common/DataView/DataView'\nimport { useDataView } from '@/components/Common/DataView/useDataView'\nimport { EmptyData, Flex, FlexItem } from '@/components/Common'\nimport { informationRequestEvents } from '@/shared/constants'\nimport type { BadgeProps } from '@/components/Common/UI/Badge/BadgeTypes'\n\n/**\n * Props for {@link InformationRequestList}.\n *\n * @public\n */\nexport interface InformationRequestListProps extends BaseComponentInterface<'InformationRequests.InformationRequestList'> {\n /** The associated company identifier. */\n companyId: string\n /** Event callback. See the events table on {@link InformationRequestList} for emitted events. */\n onEvent: BaseComponentInterface['onEvent']\n}\n\n/**\n * Displays the list of outstanding information requests for a company with a \"Respond\" CTA on each open request.\n *\n * @remarks\n * Renders status badges for each request and an extra \"Payroll blocking\" badge when the request is currently blocking payroll. Approved requests are filtered out of the list. Used as the top-level surface of `InformationRequests.InformationRequestsFlow`, but can be rendered directly when you want to host the response form yourself (e.g. in a custom modal or page).\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `informationRequest/respond` | Fired when the user clicks \"Respond\" on an open request | `{ requestId: string }` |\n *\n * @param props - See {@link InformationRequestListProps}.\n * @returns The rendered information request list.\n * @public\n */\nexport function InformationRequestList(props: InformationRequestListProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\ntype StatusMapping = {\n label: string\n badgeStatus: BadgeProps['status']\n} | null\n\nfunction Root({ companyId, dictionary, onEvent }: InformationRequestListProps) {\n useComponentDictionary('InformationRequests.InformationRequestList', dictionary)\n useI18n('InformationRequests.InformationRequestList')\n const { t } = useTranslation('InformationRequests.InformationRequestList')\n const { Heading, Text, Button, Badge } = useComponentContext()\n\n const { data } = useInformationRequestsGetInformationRequestsSuspense({\n companyUuid: companyId,\n })\n\n const informationRequests = data.informationRequests ?? []\n\n const visibleRequests = informationRequests.filter(\n request => request.status !== InformationRequestStatus.Approved,\n )\n\n const getTypeLabel = (type: InformationRequest['type']): string => {\n switch (type) {\n case InformationRequestType.CompanyOnboarding:\n return t('types.companyOnboarding')\n case InformationRequestType.AccountProtection:\n return t('types.accountProtection')\n case InformationRequestType.PaymentRequest:\n return t('types.paymentRequest')\n case InformationRequestType.PaymentError:\n return t('types.paymentError')\n default:\n return t('types.unknown')\n }\n }\n\n const getStatusMapping = (status: InformationRequest['status']): StatusMapping => {\n switch (status) {\n case InformationRequestStatus.PendingResponse:\n return { label: t('status.incomplete'), badgeStatus: 'info' }\n case InformationRequestStatus.PendingReview:\n return { label: t('status.underReview'), badgeStatus: 'warning' }\n default:\n return null\n }\n }\n\n const dataViewProps = useDataView({\n data: visibleRequests,\n emptyState: () => (\n <EmptyData title={t('emptyTableTitle')} description={t('emptyTableDescription')} />\n ),\n columns: [\n {\n key: 'type',\n title: t('columns.type'),\n render: request => (\n <FlexItem flexGrow={1}>\n <Text weight=\"medium\">{getTypeLabel(request.type)}</Text>\n </FlexItem>\n ),\n },\n {\n key: 'status',\n title: t('columns.status'),\n render: request => {\n const statusMapping = getStatusMapping(request.status)\n const showPayrollBlockingBadge = request.blockingPayroll\n\n if (!statusMapping && !showPayrollBlockingBadge) {\n return null\n }\n\n return (\n <Flex gap={8} alignItems=\"center\">\n {statusMapping && (\n <Badge status={statusMapping.badgeStatus}>{statusMapping.label}</Badge>\n )}\n {showPayrollBlockingBadge && (\n <Badge status=\"error\">{t('status.payrollBlocking')}</Badge>\n )}\n </Flex>\n )\n },\n },\n ],\n itemMenu: request => {\n const isPendingResponse = request.status === InformationRequestStatus.PendingResponse\n if (!isPendingResponse) {\n return null\n }\n return (\n <Button\n variant=\"secondary\"\n onClick={() => {\n onEvent(informationRequestEvents.INFORMATION_REQUEST_RESPOND, {\n requestId: request.uuid,\n })\n }}\n >\n {t('cta.respond')}\n </Button>\n )\n },\n })\n\n return (\n <Flex flexDirection=\"column\" gap={20}>\n <Flex flexDirection=\"column\" gap={2}>\n <Heading as=\"h2\" styledAs=\"h4\">\n {t('title')}\n </Heading>\n {visibleRequests.length > 0 && <Text>{t('description')}</Text>}\n </Flex>\n\n <DataView {...dataViewProps} label={t('title')} />\n </Flex>\n )\n}\n"],"names":["InformationRequestList","props","jsx","BaseComponent","Root","companyId","dictionary","onEvent","useComponentDictionary","useI18n","useTranslation","Heading","Text","Button","Badge","useComponentContext","data","useInformationRequestsGetInformationRequestsSuspense","visibleRequests","request","InformationRequestStatus","getTypeLabel","type","InformationRequestType","getStatusMapping","status","dataViewProps","useDataView","EmptyData","FlexItem","statusMapping","showPayrollBlockingBadge","jsxs","Flex","informationRequestEvents","DataView"],"mappings":"
|
|
1
|
+
{"version":3,"file":"InformationRequestList.js","sources":["../../../../src/components/InformationRequests/InformationRequestList/InformationRequestList.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useInformationRequestsGetInformationRequestsSuspense } from '@gusto/embedded-api/react-query/informationRequestsGetInformationRequests'\nimport type { InformationRequest } from '@gusto/embedded-api/models/components/informationrequest'\nimport {\n InformationRequestStatus,\n InformationRequestType,\n} from '@gusto/embedded-api/models/components/informationrequest'\nimport { BaseComponent, type BaseComponentInterface } from '@/components/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { DataView } from '@/components/Common/DataView/DataView'\nimport { useDataView } from '@/components/Common/DataView/useDataView'\nimport { EmptyData, Flex, FlexItem } from '@/components/Common'\nimport { informationRequestEvents } from '@/shared/constants'\nimport type { BadgeProps } from '@/components/Common/UI/Badge/BadgeTypes'\n\n/**\n * Props for {@link InformationRequestList}.\n *\n * @public\n */\nexport interface InformationRequestListProps extends BaseComponentInterface<'InformationRequests.InformationRequestList'> {\n /** The associated company identifier. */\n companyId: string\n /** Event callback. See the events table on {@link InformationRequestList} for emitted events. */\n onEvent: BaseComponentInterface['onEvent']\n}\n\n/**\n * Displays the list of outstanding information requests for a company with a \"Respond\" CTA on each open request.\n *\n * @remarks\n * Renders status badges for each request and an extra \"Payroll blocking\" badge when the request is currently blocking payroll. Approved requests are filtered out of the list. Used as the top-level surface of `InformationRequests.InformationRequestsFlow`, but can be rendered directly when you want to host the response form yourself (e.g. in a custom modal or page).\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `informationRequest/respond` | Fired when the user clicks \"Respond\" on an open request | `{ requestId: string }` |\n *\n * @param props - See {@link InformationRequestListProps}.\n * @returns The rendered information request list.\n * @public\n */\nexport function InformationRequestList(props: InformationRequestListProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\ntype StatusMapping = {\n label: string\n badgeStatus: BadgeProps['status']\n} | null\n\nfunction Root({ companyId, dictionary, onEvent }: InformationRequestListProps) {\n useComponentDictionary('InformationRequests.InformationRequestList', dictionary)\n useI18n('InformationRequests.InformationRequestList')\n const { t } = useTranslation('InformationRequests.InformationRequestList')\n const { Heading, Text, Button, Badge } = useComponentContext()\n\n const { data } = useInformationRequestsGetInformationRequestsSuspense({\n companyUuid: companyId,\n })\n\n const informationRequests = data.informationRequests ?? []\n\n const visibleRequests = informationRequests.filter(\n request => request.status !== InformationRequestStatus.Approved,\n )\n\n const getTypeLabel = (type: InformationRequest['type']): string => {\n switch (type) {\n case InformationRequestType.CompanyOnboarding:\n return t('types.companyOnboarding')\n case InformationRequestType.AccountProtection:\n return t('types.accountProtection')\n case InformationRequestType.PaymentRequest:\n return t('types.paymentRequest')\n case InformationRequestType.PaymentError:\n return t('types.paymentError')\n default:\n return t('types.unknown')\n }\n }\n\n const getStatusMapping = (status: InformationRequest['status']): StatusMapping => {\n switch (status) {\n case InformationRequestStatus.PendingResponse:\n return { label: t('status.incomplete'), badgeStatus: 'info' }\n case InformationRequestStatus.PendingReview:\n return { label: t('status.underReview'), badgeStatus: 'warning' }\n default:\n return null\n }\n }\n\n const dataViewProps = useDataView({\n data: visibleRequests,\n emptyState: () => (\n <EmptyData title={t('emptyTableTitle')} description={t('emptyTableDescription')} />\n ),\n columns: [\n {\n key: 'type',\n title: t('columns.type'),\n render: request => (\n <FlexItem flexGrow={1}>\n <Text weight=\"medium\">{getTypeLabel(request.type)}</Text>\n </FlexItem>\n ),\n },\n {\n key: 'status',\n title: t('columns.status'),\n render: request => {\n const statusMapping = getStatusMapping(request.status)\n const showPayrollBlockingBadge = request.blockingPayroll\n\n if (!statusMapping && !showPayrollBlockingBadge) {\n return null\n }\n\n return (\n <Flex gap={8} alignItems=\"center\">\n {statusMapping && (\n <Badge status={statusMapping.badgeStatus}>{statusMapping.label}</Badge>\n )}\n {showPayrollBlockingBadge && (\n <Badge status=\"error\">{t('status.payrollBlocking')}</Badge>\n )}\n </Flex>\n )\n },\n },\n ],\n itemMenu: request => {\n const isPendingResponse = request.status === InformationRequestStatus.PendingResponse\n if (!isPendingResponse) {\n return null\n }\n return (\n <Button\n variant=\"secondary\"\n onClick={() => {\n onEvent(informationRequestEvents.INFORMATION_REQUEST_RESPOND, {\n requestId: request.uuid,\n })\n }}\n >\n {t('cta.respond')}\n </Button>\n )\n },\n })\n\n return (\n <Flex flexDirection=\"column\" gap={20}>\n <Flex flexDirection=\"column\" gap={2}>\n <Heading as=\"h2\" styledAs=\"h4\">\n {t('title')}\n </Heading>\n {visibleRequests.length > 0 && <Text>{t('description')}</Text>}\n </Flex>\n\n <DataView {...dataViewProps} label={t('title')} />\n </Flex>\n )\n}\n"],"names":["InformationRequestList","props","jsx","BaseComponent","Root","companyId","dictionary","onEvent","useComponentDictionary","useI18n","useTranslation","Heading","Text","Button","Badge","useComponentContext","data","useInformationRequestsGetInformationRequestsSuspense","visibleRequests","request","InformationRequestStatus","getTypeLabel","type","InformationRequestType","getStatusMapping","status","dataViewProps","useDataView","EmptyData","FlexItem","statusMapping","showPayrollBlockingBadge","jsxs","Flex","informationRequestEvents","DataView"],"mappings":";;;;;;;;;;;;;AA2CO,SAASA,EAAuBC,GAAoC;AACzE,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAA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AAO,GACZ;AAAA,MACCO,EAAgB,SAAS,uBAAMN,GAAA,EAAM,UAAA,EAAE,aAAa,EAAA,CAAE;AAAA,IAAA,GACzD;AAAA,sBAECuB,GAAA,EAAU,GAAGT,GAAe,OAAO,EAAE,OAAO,EAAA,CAAG;AAAA,EAAA,GAClD;AAEJ;"}
|
package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as e, jsxs as m } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation as F, Trans as A } from "react-i18next";
|
|
3
3
|
import r from "zod";
|
|
4
|
-
import { useForm as _, FormProvider as
|
|
5
|
-
import { zodResolver as
|
|
6
|
-
import { useIsMutating as
|
|
4
|
+
import { useForm as _, FormProvider as T } from "react-hook-form";
|
|
5
|
+
import { zodResolver as E } from "@hookform/resolvers/zod";
|
|
6
|
+
import { useIsMutating as O } from "@tanstack/react-query";
|
|
7
7
|
import { useWireInRequestsSubmitMutation as U, mutationKeyWireInRequestsSubmit as j } from "@gusto/embedded-api/react-query/wireInRequestsSubmit";
|
|
8
8
|
import { useWireInRequestsGetSuspense as B } from "@gusto/embedded-api/react-query/wireInRequestsGet";
|
|
9
9
|
import { usePayrollsListSuspense as G } from "@gusto/embedded-api/react-query/payrollsList";
|
|
@@ -11,62 +11,62 @@ import d from "./ConfirmWireDetailsForm.module.scss.js";
|
|
|
11
11
|
import { Form as H } from "../../../Common/Form/Form.js";
|
|
12
12
|
import { BaseComponent as K } from "../../../Base/Base.js";
|
|
13
13
|
import { useBase as Y } from "../../../Base/useBase.js";
|
|
14
|
-
import { useComponentContext as
|
|
15
|
-
import { useComponentDictionary as z, useI18n as
|
|
14
|
+
import { useComponentContext as g } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
15
|
+
import { useComponentDictionary as z, useI18n as N } from "../../../../i18n/I18n.js";
|
|
16
16
|
import { Flex as p, FlexItem as f } from "../../../Common/Flex/Flex.js";
|
|
17
|
-
import { payrollWireEvents as
|
|
18
|
-
import "react";
|
|
17
|
+
import { payrollWireEvents as S } from "../../../../shared/constants.js";
|
|
19
18
|
import { TextAreaField as V } from "../../../Common/Fields/TextAreaField/TextAreaField.js";
|
|
20
19
|
import { useDateFormatter as J } from "../../../../hooks/useDateFormatter.js";
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
|
|
20
|
+
import { formatDateToStringDate as Q } from "../../../../helpers/dateFormatting.js";
|
|
21
|
+
import { NumberInputField as X } from "../../../Common/Fields/NumberInputField/NumberInputField.js";
|
|
22
|
+
import { DatePickerField as Z } from "../../../Common/Fields/DatePickerField/DatePickerField.js";
|
|
23
|
+
import { TextInputField as $ } from "../../../Common/Fields/TextInputField/TextInputField.js";
|
|
24
|
+
const ee = r.object({
|
|
25
25
|
amountSent: r.number().positive(),
|
|
26
26
|
dateSent: r.date(),
|
|
27
27
|
bankName: r.string().min(1),
|
|
28
28
|
additionalNotes: r.string().optional()
|
|
29
|
-
}),
|
|
29
|
+
}), C = "confirm-wire-details-form", te = (o) => ({
|
|
30
30
|
amountSent: String(o.amountSent),
|
|
31
|
-
dateSent: o.dateSent
|
|
31
|
+
dateSent: Q(o.dateSent) ?? "",
|
|
32
32
|
bankName: o.bankName,
|
|
33
33
|
additionalNotes: o.additionalNotes || void 0
|
|
34
34
|
});
|
|
35
|
-
function
|
|
36
|
-
return /* @__PURE__ */ e(K, { ...o, children: /* @__PURE__ */ e(
|
|
35
|
+
function oe(o) {
|
|
36
|
+
return /* @__PURE__ */ e(K, { ...o, children: /* @__PURE__ */ e(re, { ...o, children: o.children }) });
|
|
37
37
|
}
|
|
38
|
-
const
|
|
38
|
+
const re = ({
|
|
39
39
|
wireInId: o,
|
|
40
40
|
companyId: n,
|
|
41
41
|
dictionary: i,
|
|
42
42
|
modalContainerRef: y
|
|
43
43
|
}) => {
|
|
44
|
-
z("Payroll.ConfirmWireDetailsForm", i),
|
|
45
|
-
const { onEvent: a, baseSubmitHandler:
|
|
44
|
+
z("Payroll.ConfirmWireDetailsForm", i), N("Payroll.ConfirmWireDetailsForm");
|
|
45
|
+
const { onEvent: a, baseSubmitHandler: I } = Y(), { t } = F("Payroll.ConfirmWireDetailsForm"), { Heading: v, Text: b } = g(), R = J(), { data: P } = B({
|
|
46
46
|
wireInRequestUuid: o
|
|
47
47
|
}), q = P.wireInRequest, { data: W } = G({
|
|
48
48
|
companyId: n,
|
|
49
49
|
processed: !0
|
|
50
50
|
}), l = W.payrollList?.find(
|
|
51
51
|
(u) => u.payrollUuid === q?.paymentUuid
|
|
52
|
-
), s = l?.payPeriod, c = s?.startDate && s.endDate ? R.formatPayPeriodRange(s.startDate, s.endDate) : void 0,
|
|
53
|
-
resolver:
|
|
52
|
+
), s = l?.payPeriod, c = s?.startDate && s.endDate ? R.formatPayPeriodRange(s.startDate, s.endDate) : void 0, D = l ? R.formatShortWithYear(l.checkDate) : void 0, h = _({
|
|
53
|
+
resolver: E(ee),
|
|
54
54
|
defaultValues: {
|
|
55
55
|
bankName: ""
|
|
56
56
|
}
|
|
57
57
|
}), { mutateAsync: k } = U(), x = async (u) => {
|
|
58
|
-
await
|
|
59
|
-
const L =
|
|
58
|
+
await I(u, async (w) => {
|
|
59
|
+
const L = te(w), M = await k({
|
|
60
60
|
request: {
|
|
61
61
|
wireInRequestUuid: o,
|
|
62
62
|
wireInRequestUpdateRequestBody: L
|
|
63
63
|
}
|
|
64
64
|
});
|
|
65
|
-
a(
|
|
65
|
+
a(S.PAYROLL_WIRE_FORM_DONE, {
|
|
66
66
|
wireInRequest: M.wireInRequest,
|
|
67
67
|
confirmationAlert: {
|
|
68
68
|
title: c ? t("confirmationAlert.title", { payrollRange: c }) : t("confirmationAlert.emptyTitle"),
|
|
69
|
-
content:
|
|
69
|
+
content: D ? /* @__PURE__ */ e(b, { children: t("confirmationAlert.content", { checkDate: D }) }) : void 0
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
});
|
|
@@ -76,15 +76,15 @@ const oe = ({
|
|
|
76
76
|
/* @__PURE__ */ e(v, { as: "h2", children: /* @__PURE__ */ e(A, { i18nKey: "title", t, values: { payrollRange: c } }) }),
|
|
77
77
|
/* @__PURE__ */ e(b, { children: t("description") })
|
|
78
78
|
] }),
|
|
79
|
-
/* @__PURE__ */ e(
|
|
79
|
+
/* @__PURE__ */ e(T, { ...h, children: /* @__PURE__ */ e(
|
|
80
80
|
H,
|
|
81
81
|
{
|
|
82
|
-
id:
|
|
83
|
-
onSubmit:
|
|
82
|
+
id: C,
|
|
83
|
+
onSubmit: h.handleSubmit(x),
|
|
84
84
|
className: d.form,
|
|
85
85
|
children: /* @__PURE__ */ m(p, { flexDirection: "column", gap: 20, children: [
|
|
86
86
|
/* @__PURE__ */ e(
|
|
87
|
-
|
|
87
|
+
X,
|
|
88
88
|
{
|
|
89
89
|
name: "amountSent",
|
|
90
90
|
label: t("amountLabel"),
|
|
@@ -94,7 +94,7 @@ const oe = ({
|
|
|
94
94
|
}
|
|
95
95
|
),
|
|
96
96
|
/* @__PURE__ */ e(
|
|
97
|
-
|
|
97
|
+
Z,
|
|
98
98
|
{
|
|
99
99
|
name: "dateSent",
|
|
100
100
|
label: t("dateLabel"),
|
|
@@ -104,7 +104,7 @@ const oe = ({
|
|
|
104
104
|
}
|
|
105
105
|
),
|
|
106
106
|
/* @__PURE__ */ e(
|
|
107
|
-
|
|
107
|
+
$,
|
|
108
108
|
{
|
|
109
109
|
name: "bankName",
|
|
110
110
|
label: t("bankNameLabel"),
|
|
@@ -119,9 +119,9 @@ const oe = ({
|
|
|
119
119
|
}
|
|
120
120
|
) })
|
|
121
121
|
] });
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
const { t: n } = F("Payroll.ConfirmWireDetailsForm"), { Button: i } =
|
|
122
|
+
}, ne = ({ onEvent: o }) => {
|
|
123
|
+
N("Payroll.ConfirmWireDetailsForm");
|
|
124
|
+
const { t: n } = F("Payroll.ConfirmWireDetailsForm"), { Button: i } = g(), a = O({
|
|
125
125
|
mutationKey: j()
|
|
126
126
|
}) > 0;
|
|
127
127
|
return /* @__PURE__ */ m(p, { gap: 12, justifyContent: "space-evenly", children: [
|
|
@@ -130,7 +130,7 @@ const oe = ({
|
|
|
130
130
|
{
|
|
131
131
|
variant: "secondary",
|
|
132
132
|
onClick: () => {
|
|
133
|
-
o(
|
|
133
|
+
o(S.PAYROLL_WIRE_FORM_CANCEL);
|
|
134
134
|
},
|
|
135
135
|
isDisabled: a,
|
|
136
136
|
className: d.button,
|
|
@@ -142,7 +142,7 @@ const oe = ({
|
|
|
142
142
|
{
|
|
143
143
|
variant: "primary",
|
|
144
144
|
type: "submit",
|
|
145
|
-
form:
|
|
145
|
+
form: C,
|
|
146
146
|
isLoading: a,
|
|
147
147
|
className: d.button,
|
|
148
148
|
children: n("submitCta")
|
|
@@ -150,8 +150,8 @@ const oe = ({
|
|
|
150
150
|
) })
|
|
151
151
|
] });
|
|
152
152
|
};
|
|
153
|
-
|
|
153
|
+
oe.Footer = ne;
|
|
154
154
|
export {
|
|
155
|
-
|
|
155
|
+
oe as ConfirmWireDetailsForm
|
|
156
156
|
};
|
|
157
157
|
//# sourceMappingURL=ConfirmWireDetailsForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmWireDetailsForm.js","sources":["../../../../../src/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.tsx"],"sourcesContent":["import { Trans, useTranslation } from 'react-i18next'\nimport z from 'zod'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useIsMutating } from '@tanstack/react-query'\nimport {\n useWireInRequestsSubmitMutation,\n mutationKeyWireInRequestsSubmit,\n} from '@gusto/embedded-api/react-query/wireInRequestsSubmit'\nimport { useWireInRequestsGetSuspense } from '@gusto/embedded-api/react-query/wireInRequestsGet'\nimport type { PutWireInRequestsWireInRequestUuidRequest } from '@gusto/embedded-api/models/operations/putwireinrequestswireinrequestuuid'\nimport { usePayrollsListSuspense } from '@gusto/embedded-api/react-query/payrollsList'\nimport styles from './ConfirmWireDetailsForm.module.scss'\nimport { Form as HtmlForm } from '@/components/Common/Form'\nimport { BaseComponent, useBase, type BaseComponentInterface } from '@/components/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { Flex, FlexItem } from '@/components/Common/Flex/Flex'\nimport { payrollWireEvents, type EventType } from '@/shared/constants'\nimport { DatePickerField, NumberInputField, TextInputField } from '@/components/Common'\nimport { TextAreaField } from '@/components/Common/Fields/TextAreaField'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\n\ninterface ConfirmWireDetailsFormProps extends BaseComponentInterface<'Payroll.ConfirmWireDetailsForm'> {\n wireInId: string\n companyId: string\n modalContainerRef?: React.RefObject<HTMLDivElement | null>\n}\n\nconst ConfirmWireDetailsFormSchema = z.object({\n amountSent: z.number().positive(),\n dateSent: z.date(),\n bankName: z.string().min(1),\n additionalNotes: z.string().optional(),\n})\n\ntype ConfirmWireDetailsFormValues = z.infer<typeof ConfirmWireDetailsFormSchema>\n\nconst CONFIRM_WIRE_FORM_ID = 'confirm-wire-details-form'\n\nconst transformFormDataToPayload = (\n data: ConfirmWireDetailsFormValues,\n): PutWireInRequestsWireInRequestUuidRequest['wireInRequestUpdateRequestBody'] => {\n return {\n amountSent: String(data.amountSent),\n dateSent: data.dateSent.toISOString().split('T')[0] || '',\n bankName: data.bankName,\n additionalNotes: data.additionalNotes || undefined,\n }\n}\n\n/** @internal */\nexport function ConfirmWireDetailsForm(props: ConfirmWireDetailsFormProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst Root = ({\n wireInId,\n companyId,\n dictionary,\n modalContainerRef,\n}: ConfirmWireDetailsFormProps) => {\n useComponentDictionary('Payroll.ConfirmWireDetailsForm', dictionary)\n useI18n('Payroll.ConfirmWireDetailsForm')\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Payroll.ConfirmWireDetailsForm')\n const { Heading, Text } = useComponentContext()\n const dateFormatter = useDateFormatter()\n const { data } = useWireInRequestsGetSuspense({\n wireInRequestUuid: wireInId,\n })\n const wireInRequest = data.wireInRequest\n\n const { data: payrollsData } = usePayrollsListSuspense({\n companyId,\n processed: true,\n })\n\n const payrollData = payrollsData.payrollList?.find(\n payroll => payroll.payrollUuid === wireInRequest?.paymentUuid,\n )\n const payPeriod = payrollData?.payPeriod\n const payPeriodRange =\n payPeriod?.startDate && payPeriod.endDate\n ? dateFormatter.formatPayPeriodRange(payPeriod.startDate, payPeriod.endDate)\n : undefined\n\n const checkDate = payrollData\n ? dateFormatter.formatShortWithYear(payrollData.checkDate)\n : undefined\n\n const formHandlers = useForm<ConfirmWireDetailsFormValues>({\n resolver: zodResolver(ConfirmWireDetailsFormSchema),\n defaultValues: {\n bankName: '',\n },\n })\n\n const { mutateAsync: submitWireInRequest } = useWireInRequestsSubmitMutation()\n\n const onSubmit = async (data: ConfirmWireDetailsFormValues) => {\n await baseSubmitHandler(data, async innerData => {\n const payload = transformFormDataToPayload(innerData)\n const response = await submitWireInRequest({\n request: {\n wireInRequestUuid: wireInId,\n wireInRequestUpdateRequestBody: payload,\n },\n })\n onEvent(payrollWireEvents.PAYROLL_WIRE_FORM_DONE, {\n wireInRequest: response.wireInRequest,\n confirmationAlert: {\n title: payPeriodRange\n ? t('confirmationAlert.title', { payrollRange: payPeriodRange })\n : t('confirmationAlert.emptyTitle'),\n content: checkDate ? (\n <Text>{t('confirmationAlert.content', { checkDate })}</Text>\n ) : undefined,\n },\n })\n })\n }\n\n return (\n <Flex flexDirection=\"column\" gap={24}>\n <FlexItem>\n <Heading as=\"h2\">\n <Trans i18nKey=\"title\" t={t} values={{ payrollRange: payPeriodRange }} />\n </Heading>\n <Text>{t('description')}</Text>\n </FlexItem>\n\n <FormProvider {...formHandlers}>\n <HtmlForm\n id={CONFIRM_WIRE_FORM_ID}\n onSubmit={formHandlers.handleSubmit(onSubmit)}\n className={styles.form}\n >\n <Flex flexDirection=\"column\" gap={20}>\n <NumberInputField\n name=\"amountSent\"\n label={t('amountLabel')}\n isRequired\n format=\"currency\"\n errorMessage={t('validations.amount')}\n />\n <DatePickerField\n name=\"dateSent\"\n label={t('dateLabel')}\n isRequired\n errorMessage={t('validations.date')}\n portalContainer={modalContainerRef?.current || undefined}\n />\n <TextInputField\n name=\"bankName\"\n label={t('bankNameLabel')}\n isRequired\n description={t('bankNameDescription')}\n placeholder={t('bankNamePlaceholder')}\n errorMessage={t('validations.bankName')}\n />\n <TextAreaField name=\"additionalNotes\" label={t('notesLabel')} rows={3} />\n </Flex>\n </HtmlForm>\n </FormProvider>\n </Flex>\n )\n}\n\nconst Footer = ({ onEvent }: { onEvent: OnEventType<EventType, unknown> }) => {\n useI18n('Payroll.ConfirmWireDetailsForm')\n const { t } = useTranslation('Payroll.ConfirmWireDetailsForm')\n const { Button } = useComponentContext()\n const isMutating = useIsMutating({\n mutationKey: mutationKeyWireInRequestsSubmit(),\n })\n const isPending = isMutating > 0\n\n return (\n <Flex gap={12} justifyContent=\"space-evenly\">\n <FlexItem flexGrow={1}>\n <Button\n variant=\"secondary\"\n onClick={() => {\n onEvent(payrollWireEvents.PAYROLL_WIRE_FORM_CANCEL)\n }}\n isDisabled={isPending}\n className={styles.button}\n >\n {t('cancelCta')}\n </Button>\n </FlexItem>\n <FlexItem flexGrow={1}>\n <Button\n variant=\"primary\"\n type=\"submit\"\n form={CONFIRM_WIRE_FORM_ID}\n isLoading={isPending}\n className={styles.button}\n >\n {t('submitCta')}\n </Button>\n </FlexItem>\n </Flex>\n )\n}\nConfirmWireDetailsForm.Footer = Footer\n"],"names":["ConfirmWireDetailsFormSchema","z","CONFIRM_WIRE_FORM_ID","transformFormDataToPayload","data","ConfirmWireDetailsForm","props","jsx","BaseComponent","Root","wireInId","companyId","dictionary","modalContainerRef","useComponentDictionary","useI18n","onEvent","baseSubmitHandler","useBase","useTranslation","Heading","Text","useComponentContext","dateFormatter","useDateFormatter","useWireInRequestsGetSuspense","wireInRequest","payrollsData","usePayrollsListSuspense","payrollData","payroll","payPeriod","payPeriodRange","checkDate","formHandlers","useForm","zodResolver","submitWireInRequest","useWireInRequestsSubmitMutation","onSubmit","innerData","payload","response","payrollWireEvents","jsxs","Flex","FlexItem","Trans","FormProvider","HtmlForm","styles","NumberInputField","DatePickerField","TextInputField","TextAreaField","Footer","t","Button","isPending","useIsMutating","mutationKeyWireInRequestsSubmit"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAMA,IAA+BC,EAAE,OAAO;AAAA,EAC5C,YAAYA,EAAE,OAAA,EAAS,SAAA;AAAA,EACvB,UAAUA,EAAE,KAAA;AAAA,EACZ,UAAUA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC1B,iBAAiBA,EAAE,OAAA,EAAS,SAAA;AAC9B,CAAC,GAIKC,IAAuB,6BAEvBC,KAA6B,CACjCC,OAEO;AAAA,EACL,YAAY,OAAOA,EAAK,UAAU;AAAA,EAClC,UAAUA,EAAK,SAAS,YAAA,EAAc,MAAM,GAAG,EAAE,CAAC,KAAK;AAAA,EACvD,UAAUA,EAAK;AAAA,EACf,iBAAiBA,EAAK,mBAAmB;AAAA;AAKtC,SAASC,GAAuBC,GAAoC;AACzE,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,MAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,MAAMG,KAAO,CAAC;AAAA,EACZ,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,mBAAAC;AACF,MAAmC;AACjC,EAAAC,EAAuB,kCAAkCF,CAAU,GACnEG,EAAQ,gCAAgC;AACxC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","sources":["../../../../../src/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.tsx"],"sourcesContent":["import { Trans, useTranslation } from 'react-i18next'\nimport z from 'zod'\nimport { FormProvider, useForm } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { useIsMutating } from '@tanstack/react-query'\nimport {\n useWireInRequestsSubmitMutation,\n mutationKeyWireInRequestsSubmit,\n} from '@gusto/embedded-api/react-query/wireInRequestsSubmit'\nimport { useWireInRequestsGetSuspense } from '@gusto/embedded-api/react-query/wireInRequestsGet'\nimport type { PutWireInRequestsWireInRequestUuidRequest } from '@gusto/embedded-api/models/operations/putwireinrequestswireinrequestuuid'\nimport { usePayrollsListSuspense } from '@gusto/embedded-api/react-query/payrollsList'\nimport styles from './ConfirmWireDetailsForm.module.scss'\nimport { Form as HtmlForm } from '@/components/Common/Form'\nimport { BaseComponent, useBase, type BaseComponentInterface } from '@/components/Base'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { Flex, FlexItem } from '@/components/Common/Flex/Flex'\nimport { payrollWireEvents, type EventType } from '@/shared/constants'\nimport { DatePickerField, NumberInputField, TextInputField } from '@/components/Common'\nimport { TextAreaField } from '@/components/Common/Fields/TextAreaField'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport { formatDateToStringDate } from '@/helpers/dateFormatting'\n\ninterface ConfirmWireDetailsFormProps extends BaseComponentInterface<'Payroll.ConfirmWireDetailsForm'> {\n wireInId: string\n companyId: string\n modalContainerRef?: React.RefObject<HTMLDivElement | null>\n}\n\nconst ConfirmWireDetailsFormSchema = z.object({\n amountSent: z.number().positive(),\n dateSent: z.date(),\n bankName: z.string().min(1),\n additionalNotes: z.string().optional(),\n})\n\ntype ConfirmWireDetailsFormValues = z.infer<typeof ConfirmWireDetailsFormSchema>\n\nconst CONFIRM_WIRE_FORM_ID = 'confirm-wire-details-form'\n\nconst transformFormDataToPayload = (\n data: ConfirmWireDetailsFormValues,\n): PutWireInRequestsWireInRequestUuidRequest['wireInRequestUpdateRequestBody'] => {\n return {\n amountSent: String(data.amountSent),\n dateSent: formatDateToStringDate(data.dateSent) ?? '',\n bankName: data.bankName,\n additionalNotes: data.additionalNotes || undefined,\n }\n}\n\n/** @internal */\nexport function ConfirmWireDetailsForm(props: ConfirmWireDetailsFormProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nconst Root = ({\n wireInId,\n companyId,\n dictionary,\n modalContainerRef,\n}: ConfirmWireDetailsFormProps) => {\n useComponentDictionary('Payroll.ConfirmWireDetailsForm', dictionary)\n useI18n('Payroll.ConfirmWireDetailsForm')\n const { onEvent, baseSubmitHandler } = useBase()\n const { t } = useTranslation('Payroll.ConfirmWireDetailsForm')\n const { Heading, Text } = useComponentContext()\n const dateFormatter = useDateFormatter()\n const { data } = useWireInRequestsGetSuspense({\n wireInRequestUuid: wireInId,\n })\n const wireInRequest = data.wireInRequest\n\n const { data: payrollsData } = usePayrollsListSuspense({\n companyId,\n processed: true,\n })\n\n const payrollData = payrollsData.payrollList?.find(\n payroll => payroll.payrollUuid === wireInRequest?.paymentUuid,\n )\n const payPeriod = payrollData?.payPeriod\n const payPeriodRange =\n payPeriod?.startDate && payPeriod.endDate\n ? dateFormatter.formatPayPeriodRange(payPeriod.startDate, payPeriod.endDate)\n : undefined\n\n const checkDate = payrollData\n ? dateFormatter.formatShortWithYear(payrollData.checkDate)\n : undefined\n\n const formHandlers = useForm<ConfirmWireDetailsFormValues>({\n resolver: zodResolver(ConfirmWireDetailsFormSchema),\n defaultValues: {\n bankName: '',\n },\n })\n\n const { mutateAsync: submitWireInRequest } = useWireInRequestsSubmitMutation()\n\n const onSubmit = async (data: ConfirmWireDetailsFormValues) => {\n await baseSubmitHandler(data, async innerData => {\n const payload = transformFormDataToPayload(innerData)\n const response = await submitWireInRequest({\n request: {\n wireInRequestUuid: wireInId,\n wireInRequestUpdateRequestBody: payload,\n },\n })\n onEvent(payrollWireEvents.PAYROLL_WIRE_FORM_DONE, {\n wireInRequest: response.wireInRequest,\n confirmationAlert: {\n title: payPeriodRange\n ? t('confirmationAlert.title', { payrollRange: payPeriodRange })\n : t('confirmationAlert.emptyTitle'),\n content: checkDate ? (\n <Text>{t('confirmationAlert.content', { checkDate })}</Text>\n ) : undefined,\n },\n })\n })\n }\n\n return (\n <Flex flexDirection=\"column\" gap={24}>\n <FlexItem>\n <Heading as=\"h2\">\n <Trans i18nKey=\"title\" t={t} values={{ payrollRange: payPeriodRange }} />\n </Heading>\n <Text>{t('description')}</Text>\n </FlexItem>\n\n <FormProvider {...formHandlers}>\n <HtmlForm\n id={CONFIRM_WIRE_FORM_ID}\n onSubmit={formHandlers.handleSubmit(onSubmit)}\n className={styles.form}\n >\n <Flex flexDirection=\"column\" gap={20}>\n <NumberInputField\n name=\"amountSent\"\n label={t('amountLabel')}\n isRequired\n format=\"currency\"\n errorMessage={t('validations.amount')}\n />\n <DatePickerField\n name=\"dateSent\"\n label={t('dateLabel')}\n isRequired\n errorMessage={t('validations.date')}\n portalContainer={modalContainerRef?.current || undefined}\n />\n <TextInputField\n name=\"bankName\"\n label={t('bankNameLabel')}\n isRequired\n description={t('bankNameDescription')}\n placeholder={t('bankNamePlaceholder')}\n errorMessage={t('validations.bankName')}\n />\n <TextAreaField name=\"additionalNotes\" label={t('notesLabel')} rows={3} />\n </Flex>\n </HtmlForm>\n </FormProvider>\n </Flex>\n )\n}\n\nconst Footer = ({ onEvent }: { onEvent: OnEventType<EventType, unknown> }) => {\n useI18n('Payroll.ConfirmWireDetailsForm')\n const { t } = useTranslation('Payroll.ConfirmWireDetailsForm')\n const { Button } = useComponentContext()\n const isMutating = useIsMutating({\n mutationKey: mutationKeyWireInRequestsSubmit(),\n })\n const isPending = isMutating > 0\n\n return (\n <Flex gap={12} justifyContent=\"space-evenly\">\n <FlexItem flexGrow={1}>\n <Button\n variant=\"secondary\"\n onClick={() => {\n onEvent(payrollWireEvents.PAYROLL_WIRE_FORM_CANCEL)\n }}\n isDisabled={isPending}\n className={styles.button}\n >\n {t('cancelCta')}\n </Button>\n </FlexItem>\n <FlexItem flexGrow={1}>\n <Button\n variant=\"primary\"\n type=\"submit\"\n form={CONFIRM_WIRE_FORM_ID}\n isLoading={isPending}\n className={styles.button}\n >\n {t('submitCta')}\n </Button>\n </FlexItem>\n </Flex>\n )\n}\nConfirmWireDetailsForm.Footer = Footer\n"],"names":["ConfirmWireDetailsFormSchema","z","CONFIRM_WIRE_FORM_ID","transformFormDataToPayload","data","formatDateToStringDate","ConfirmWireDetailsForm","props","jsx","BaseComponent","Root","wireInId","companyId","dictionary","modalContainerRef","useComponentDictionary","useI18n","onEvent","baseSubmitHandler","useBase","useTranslation","Heading","Text","useComponentContext","dateFormatter","useDateFormatter","useWireInRequestsGetSuspense","wireInRequest","payrollsData","usePayrollsListSuspense","payrollData","payroll","payPeriod","payPeriodRange","checkDate","formHandlers","useForm","zodResolver","submitWireInRequest","useWireInRequestsSubmitMutation","onSubmit","innerData","payload","response","payrollWireEvents","jsxs","Flex","FlexItem","Trans","FormProvider","HtmlForm","styles","NumberInputField","DatePickerField","TextInputField","TextAreaField","Footer","t","Button","isPending","useIsMutating","mutationKeyWireInRequestsSubmit"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAMA,KAA+BC,EAAE,OAAO;AAAA,EAC5C,YAAYA,EAAE,OAAA,EAAS,SAAA;AAAA,EACvB,UAAUA,EAAE,KAAA;AAAA,EACZ,UAAUA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC1B,iBAAiBA,EAAE,OAAA,EAAS,SAAA;AAC9B,CAAC,GAIKC,IAAuB,6BAEvBC,KAA6B,CACjCC,OAEO;AAAA,EACL,YAAY,OAAOA,EAAK,UAAU;AAAA,EAClC,UAAUC,EAAuBD,EAAK,QAAQ,KAAK;AAAA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AO;AAAA,QAEjB,YAAE,WAAW;AAAA,MAAA;AAAA,IAAA,GAElB;AAAA,IACA,gBAAA3C,EAACuC,GAAA,EAAS,UAAU,GAClB,UAAA,gBAAAvC;AAAA,MAACkD;AAAA,MAAA;AAAA,QACC,SAAQ;AAAA,QACR,MAAK;AAAA,QACL,MAAMxD;AAAA,QACN,WAAWyD;AAAA,QACX,WAAWR,EAAO;AAAA,QAEjB,YAAE,WAAW;AAAA,MAAA;AAAA,IAAA,EAChB,CACF;AAAA,EAAA,GACF;AAEJ;AACA7C,GAAuB,SAASkD;"}
|
|
@@ -3,18 +3,17 @@ import { useTranslation as d } from "react-i18next";
|
|
|
3
3
|
import { Flex as o } from "../../../Common/Flex/Flex.js";
|
|
4
4
|
import { ActionsLayout as f } from "../../../Common/ActionsLayout/ActionsLayout.js";
|
|
5
5
|
import { useComponentContext as g } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
6
|
-
import "react";
|
|
7
6
|
import { useI18n as x } from "../../../../i18n/I18n.js";
|
|
8
|
-
function
|
|
9
|
-
payPeriodOptions:
|
|
10
|
-
selectedPeriodKey:
|
|
7
|
+
function L({
|
|
8
|
+
payPeriodOptions: n,
|
|
9
|
+
selectedPeriodKey: r,
|
|
11
10
|
onSelectPeriod: s,
|
|
12
11
|
onSubmit: c,
|
|
13
12
|
isPending: l
|
|
14
13
|
}) {
|
|
15
14
|
x("Payroll.Dismissal");
|
|
16
15
|
const { t: i } = d("Payroll.Dismissal"), { Heading: a, Text: m, Select: p, Button: u, Alert: h } = g();
|
|
17
|
-
return
|
|
16
|
+
return n.length === 0 ? /* @__PURE__ */ t(o, { flexDirection: "column", gap: 24, children: [
|
|
18
17
|
/* @__PURE__ */ e(o, { flexDirection: "column", gap: 4, children: /* @__PURE__ */ e(a, { as: "h2", children: i("pageTitle") }) }),
|
|
19
18
|
/* @__PURE__ */ e(h, { status: "info", label: i("emptyState") })
|
|
20
19
|
] }) : /* @__PURE__ */ t(o, { flexDirection: "column", gap: 24, children: [
|
|
@@ -26,8 +25,8 @@ function S({
|
|
|
26
25
|
p,
|
|
27
26
|
{
|
|
28
27
|
label: i("selectLabel"),
|
|
29
|
-
options:
|
|
30
|
-
value:
|
|
28
|
+
options: n,
|
|
29
|
+
value: r,
|
|
31
30
|
onChange: s,
|
|
32
31
|
placeholder: i("selectPlaceholder"),
|
|
33
32
|
isRequired: !0
|
|
@@ -39,13 +38,13 @@ function S({
|
|
|
39
38
|
variant: "primary",
|
|
40
39
|
onClick: c,
|
|
41
40
|
isLoading: l,
|
|
42
|
-
isDisabled: l ||
|
|
41
|
+
isDisabled: l || r === void 0,
|
|
43
42
|
children: i("continueCta")
|
|
44
43
|
}
|
|
45
44
|
) })
|
|
46
45
|
] });
|
|
47
46
|
}
|
|
48
47
|
export {
|
|
49
|
-
|
|
48
|
+
L as DismissalPayPeriodSelectionPresentation
|
|
50
49
|
};
|
|
51
50
|
//# sourceMappingURL=DismissalPayPeriodSelectionPresentation.js.map
|