@gusto/embedded-react-sdk 0.51.0 → 0.51.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/components/Base/useBaseSubmit.js +4 -4
- package/dist/components/Base/useBaseSubmit.js.map +1 -1
- package/dist/components/Common/DocumentList/DocumentList.d.ts +8 -1
- package/dist/components/Common/DocumentList/DocumentList.js +24 -21
- package/dist/components/Common/DocumentList/DocumentList.js.map +1 -1
- package/dist/components/Common/OnboardingStatusBadge/index.d.ts +2 -2
- package/dist/components/Common/OnboardingStatusBadge/index.js.map +1 -1
- package/dist/components/Common/TaxInputs/TaxInputs.d.ts +2 -2
- package/dist/components/Common/TaxInputs/TaxInputs.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js +5 -5
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.d.ts +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +9 -8
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js +3 -3
- package/dist/components/Company/AssignSignatory/InviteSignatory/InviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.d.ts +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +9 -8
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +11 -10
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccount.js +1 -1
- package/dist/components/Company/BankAccount/BankAccount.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountComponents.d.ts +1 -1
- package/dist/components/Company/BankAccount/BankAccountComponents.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/BankAccountForm.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +9 -8
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/BankAccountList.js +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/BankAccountList.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/context.d.ts +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/context.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/BankAccountVerify.js +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/BankAccountVerify.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js +2 -2
- package/dist/components/Company/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.d.ts +2 -2
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +9 -8
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentSigner.js +1 -1
- package/dist/components/Company/DocumentSigner/DocumentSigner.js.map +1 -1
- package/dist/components/Company/DocumentSigner/documentSignerStateMachine.d.ts +2 -2
- package/dist/components/Company/DocumentSigner/documentSignerStateMachine.js.map +1 -1
- package/dist/components/Company/DocumentSigner/shared/useSignCompanyForm/useSignCompanyForm.d.ts +1 -1
- package/dist/components/Company/DocumentSigner/shared/useSignCompanyForm/useSignCompanyForm.js +3 -3
- package/dist/components/Company/DocumentSigner/shared/useSignCompanyForm/useSignCompanyForm.js.map +1 -1
- package/dist/components/Company/FederalTaxes/FederalTaxes.js +2 -2
- package/dist/components/Company/FederalTaxes/FederalTaxes.js.map +1 -1
- package/dist/components/Company/FederalTaxes/Form.js +1 -1
- package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.d.ts +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +12 -11
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +12 -11
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Industry/Industry.js +2 -2
- package/dist/components/Company/Industry/Industry.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Actions.js +7 -7
- package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/LocationForm.js +46 -45
- package/dist/components/Company/Locations/LocationForm/LocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +9 -8
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/LocationsList.js +1 -1
- package/dist/components/Company/Locations/LocationsList/LocationsList.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.d.ts +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +9 -8
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +1 -1
- package/dist/components/Company/OnboardingOverview/OnboardingOverview.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.d.ts +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +9 -8
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/PaySchedule.js +1 -1
- package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
- package/dist/components/Company/PaySchedule/PayScheduleList.js +1 -1
- package/dist/components/Company/PaySchedule/PayScheduleList.js.map +1 -1
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.d.ts +2 -2
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.js +6 -6
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +3 -3
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +2 -2
- package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/applicableIf.d.ts +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/applicableIf.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.d.ts +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +9 -8
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.js +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/StateTaxesList.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.d.ts +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +9 -8
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Contractor/Address/shared/useContractorAddressForm/useContractorAddressForm.d.ts +2 -2
- package/dist/components/Contractor/Address/shared/useContractorAddressForm/useContractorAddressForm.js +3 -3
- package/dist/components/Contractor/Address/shared/useContractorAddressForm/useContractorAddressForm.js.map +1 -1
- package/dist/components/Contractor/ContractorList/index.js +1 -1
- package/dist/components/Contractor/ContractorList/index.js.map +1 -1
- package/dist/components/Contractor/ContractorList/useContractorList.d.ts +1 -1
- package/dist/components/Contractor/ContractorList/useContractorList.js +1 -1
- package/dist/components/Contractor/ContractorList/useContractorList.js.map +1 -1
- package/dist/components/Contractor/Documents/DocumentSigner/documentSignerStateMachine.d.ts +1 -1
- package/dist/components/Contractor/Documents/DocumentSigner/documentSignerStateMachine.js.map +1 -1
- package/dist/components/Contractor/Documents/DocumentsList/DocumentsList.d.ts +3 -1
- package/dist/components/Contractor/Documents/DocumentsList/DocumentsList.js +64 -51
- package/dist/components/Contractor/Documents/DocumentsList/DocumentsList.js.map +1 -1
- package/dist/components/Contractor/Documents/DocumentsList/useContractorDocumentsList/useContractorDocumentsList.d.ts +1 -1
- package/dist/components/Contractor/Documents/DocumentsList/useContractorDocumentsList/useContractorDocumentsList.js +1 -1
- package/dist/components/Contractor/Documents/DocumentsList/useContractorDocumentsList/useContractorDocumentsList.js.map +1 -1
- package/dist/components/Contractor/Documents/SignatureForm/SignatureForm.js +201 -161
- package/dist/components/Contractor/Documents/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/useContractorSignatureForm.d.ts +2 -2
- package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/useContractorSignatureForm.js +3 -3
- package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/useContractorSignatureForm.js.map +1 -1
- package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/w9Fields.d.ts +1 -1
- package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/w9Fields.js +55 -54
- package/dist/components/Contractor/Documents/SignatureForm/useContractorSignatureForm/w9Fields.js.map +1 -1
- package/dist/components/Contractor/Landing/Landing.js +2 -2
- package/dist/components/Contractor/Landing/Landing.js.map +1 -1
- package/dist/components/Contractor/NewHireReport/NewHireReport.js +2 -2
- package/dist/components/Contractor/NewHireReport/NewHireReport.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/shared/useContractorBankAccountForm/useContractorBankAccountForm.d.ts +1 -1
- package/dist/components/Contractor/PaymentMethod/shared/useContractorBankAccountForm/useContractorBankAccountForm.js +2 -2
- package/dist/components/Contractor/PaymentMethod/shared/useContractorBankAccountForm/useContractorBankAccountForm.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/shared/useContractorPaymentMethodForm/useContractorPaymentMethodForm.d.ts +1 -1
- package/dist/components/Contractor/PaymentMethod/shared/useContractorPaymentMethodForm/useContractorPaymentMethodForm.js +2 -2
- package/dist/components/Contractor/PaymentMethod/shared/useContractorPaymentMethodForm/useContractorPaymentMethodForm.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js +5 -5
- package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.d.ts +2 -2
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.d.ts +2 -2
- package/dist/components/Contractor/Payments/CreatePayment/FastAchSubmissionBlockerBanner.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/GenericBlocker.d.ts +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/GenericBlocker.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.d.ts +4 -4
- package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/helpers.d.ts +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/helpers.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.js +3 -3
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.d.ts +2 -2
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.js +4 -4
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.d.ts +3 -3
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummary.js +3 -3
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummary.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.d.ts +3 -3
- package/dist/components/Contractor/Payments/PaymentSummary/PaymentSummaryPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js +3 -3
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.d.ts +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -1
- package/dist/components/Contractor/Profile/SelfOnboardingContractorProfile.js +1 -1
- package/dist/components/Contractor/Profile/SelfOnboardingContractorProfile.js.map +1 -1
- package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/contractorDetailsSchema.js +1 -1
- package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/contractorDetailsSchema.js.map +1 -1
- package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/useContractorDetailsForm.d.ts +1 -1
- package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/useContractorDetailsForm.js +3 -3
- package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/useContractorDetailsForm.js.map +1 -1
- package/dist/components/Contractor/Submit/Submit.js +3 -3
- package/dist/components/Contractor/Submit/Submit.js.map +1 -1
- package/dist/components/Employee/Compensation/management/CompensationCard/CompensationCard.js +1 -1
- package/dist/components/Employee/Compensation/management/CompensationCard/CompensationCard.js.map +1 -1
- package/dist/components/Employee/Compensation/management/CompensationEditForm/CompensationEditForm.js +1 -1
- package/dist/components/Employee/Compensation/management/CompensationEditForm/CompensationEditForm.js.map +1 -1
- package/dist/components/Employee/Compensation/management/CompensationEditJobForm/CompensationEditJobForm.js +1 -1
- package/dist/components/Employee/Compensation/management/CompensationEditJobForm/CompensationEditJobForm.js.map +1 -1
- package/dist/components/Employee/Compensation/management/ManagementCompensationFormBody.js.map +1 -1
- package/dist/components/Employee/Compensation/onboarding/Compensation.d.ts +2 -2
- package/dist/components/Employee/Compensation/onboarding/Compensation.js +1 -1
- package/dist/components/Employee/Compensation/onboarding/Compensation.js.map +1 -1
- package/dist/components/Employee/Compensation/onboarding/CompensationFlowComponents.d.ts +2 -2
- package/dist/components/Employee/Compensation/onboarding/CompensationFlowComponents.js.map +1 -1
- package/dist/components/Employee/Compensation/onboarding/JobsList/JobsList.js +2 -2
- package/dist/components/Employee/Compensation/onboarding/JobsList/JobsList.js.map +1 -1
- package/dist/components/Employee/Compensation/onboarding/JobsList/JobsListPresentation.d.ts +1 -1
- package/dist/components/Employee/Compensation/onboarding/JobsList/JobsListPresentation.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/AddCompensationFormBody.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/derivePrimaryFlsaStatus.d.ts +1 -1
- package/dist/components/Employee/Compensation/shared/derivePrimaryFlsaStatus.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/getPendingCompensationChanges.d.ts +2 -2
- package/dist/components/Employee/Compensation/shared/getPendingCompensationChanges.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/useCompensationForm/fields.d.ts +3 -3
- package/dist/components/Employee/Compensation/shared/useCompensationForm/fields.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/useCompensationForm/useCompensationForm.d.ts +4 -4
- package/dist/components/Employee/Compensation/shared/useCompensationForm/useCompensationForm.js +7 -7
- package/dist/components/Employee/Compensation/shared/useCompensationForm/useCompensationForm.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/useCompensationManagement/useCompensationManagement.d.ts +1 -1
- package/dist/components/Employee/Compensation/shared/useCompensationManagement/useCompensationManagement.js +4 -4
- package/dist/components/Employee/Compensation/shared/useCompensationManagement/useCompensationManagement.js.map +1 -1
- package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.d.ts +3 -3
- package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.js +7 -7
- package/dist/components/Employee/Compensation/shared/useJobForm/useJobForm.js.map +1 -1
- package/dist/components/Employee/Dashboard/Dashboard.js +1 -1
- package/dist/components/Employee/Dashboard/Dashboard.js.map +1 -1
- package/dist/components/Employee/Dashboard/dashboardStateMachine.js.map +1 -1
- package/dist/components/Employee/Deductions/management/DeductionsCard/DeductionsCard.js.map +1 -1
- package/dist/components/Employee/Deductions/management/deductionsStateMachine.js.map +1 -1
- package/dist/components/Employee/Deductions/onboarding/DeductionsList/DeductionsList.d.ts +1 -1
- package/dist/components/Employee/Deductions/onboarding/DeductionsList/DeductionsList.js.map +1 -1
- package/dist/components/Employee/Deductions/onboarding/deductionsContextualComponents.d.ts +1 -1
- package/dist/components/Employee/Deductions/onboarding/deductionsContextualComponents.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/DeductionsForm/ChildSupportFormView.d.ts +1 -1
- package/dist/components/Employee/Deductions/shared/DeductionsForm/ChildSupportFormView.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/DeductionsForm/DeductionsForm.d.ts +1 -1
- package/dist/components/Employee/Deductions/shared/DeductionsForm/DeductionsForm.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/DeductionsForm/StandardDeductionForm.d.ts +1 -1
- package/dist/components/Employee/Deductions/shared/DeductionsForm/StandardDeductionForm.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/DeleteDeductionDialog.d.ts +1 -1
- package/dist/components/Employee/Deductions/shared/DeleteDeductionDialog.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/formatDeductionAmount.d.ts +1 -1
- package/dist/components/Employee/Deductions/shared/formatDeductionAmount.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/childSupportGarnishmentFormSchema.d.ts +1 -1
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/childSupportGarnishmentFormSchema.js +1 -1
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/childSupportGarnishmentFormSchema.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/fields.d.ts +1 -1
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/fields.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/useChildSupportGarnishmentForm.d.ts +2 -2
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/useChildSupportGarnishmentForm.js +5 -5
- package/dist/components/Employee/Deductions/shared/useChildSupportGarnishmentForm/useChildSupportGarnishmentForm.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/useDeductionForm/deductionFormSchema.js +1 -1
- package/dist/components/Employee/Deductions/shared/useDeductionForm/deductionFormSchema.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/useDeductionForm/fields.d.ts +1 -1
- package/dist/components/Employee/Deductions/shared/useDeductionForm/fields.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/useDeductionForm/useDeductionForm.d.ts +1 -1
- package/dist/components/Employee/Deductions/shared/useDeductionForm/useDeductionForm.js +3 -3
- package/dist/components/Employee/Deductions/shared/useDeductionForm/useDeductionForm.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/useDeductionsList.d.ts +1 -1
- package/dist/components/Employee/Deductions/shared/useDeductionsList.js +2 -2
- package/dist/components/Employee/Deductions/shared/useDeductionsList.js.map +1 -1
- package/dist/components/Employee/Deductions/shared/useDeleteDeduction.d.ts +1 -1
- package/dist/components/Employee/Deductions/shared/useDeleteDeduction.js.map +1 -1
- package/dist/components/Employee/Documents/management/DocumentManager.js +2 -2
- package/dist/components/Employee/Documents/management/DocumentManager.js.map +1 -1
- package/dist/components/Employee/Documents/management/DocumentsCard/DocumentsCard.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/DocumentList.js +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.d.ts +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +9 -8
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentSigner.js +2 -2
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentSigner.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibility.js +3 -3
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibility.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.js +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibilitySchema.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/I9SignatureForm/I9SignatureForm.js +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/I9SignatureForm/I9SignatureForm.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/documentSignerStateMachine.d.ts +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/documentSignerStateMachine.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/EmployeeDocuments/EmployeeDocuments.js +2 -2
- package/dist/components/Employee/Documents/onboarding/EmployeeDocuments/EmployeeDocuments.js.map +1 -1
- package/dist/components/Employee/Documents/shared/useDocumentsList/useDocumentsList.d.ts +1 -1
- package/dist/components/Employee/Documents/shared/useDocumentsList/useDocumentsList.js +1 -1
- package/dist/components/Employee/Documents/shared/useDocumentsList/useDocumentsList.js.map +1 -1
- package/dist/components/Employee/Documents/shared/useSignEmployeeForm/useSignEmployeeForm.d.ts +1 -1
- package/dist/components/Employee/Documents/shared/useSignEmployeeForm/useSignEmployeeForm.js +3 -3
- package/dist/components/Employee/Documents/shared/useSignEmployeeForm/useSignEmployeeForm.js.map +1 -1
- package/dist/components/Employee/EmployeeList/onboarding/EmployeeList.js.map +1 -1
- package/dist/components/Employee/EmployeeList/onboarding/EmployeeListView.d.ts +1 -1
- package/dist/components/Employee/EmployeeList/onboarding/EmployeeListView.js.map +1 -1
- package/dist/components/Employee/EmployeeList/shared/useEmployeeList.d.ts +3 -3
- package/dist/components/Employee/EmployeeList/shared/useEmployeeList.js +3 -3
- package/dist/components/Employee/EmployeeList/shared/useEmployeeList.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/shared/useFederalTaxesForm/federalTaxesSchema.js +1 -1
- package/dist/components/Employee/FederalTaxes/shared/useFederalTaxesForm/federalTaxesSchema.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/shared/useFederalTaxesForm/useFederalTaxesForm.d.ts +1 -1
- package/dist/components/Employee/FederalTaxes/shared/useFederalTaxesForm/useFederalTaxesForm.js +2 -2
- package/dist/components/Employee/FederalTaxes/shared/useFederalTaxesForm/useFederalTaxesForm.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/shared/useFederalTaxesSummary/useFederalTaxesSummary.d.ts +1 -1
- package/dist/components/Employee/FederalTaxes/shared/useFederalTaxesSummary/useFederalTaxesSummary.js +1 -1
- package/dist/components/Employee/FederalTaxes/shared/useFederalTaxesSummary/useFederalTaxesSummary.js.map +1 -1
- package/dist/components/Employee/HomeAddress/management/HomeAddressEditForm.js.map +1 -1
- package/dist/components/Employee/HomeAddress/management/HomeAddressView.d.ts +1 -1
- package/dist/components/Employee/HomeAddress/management/HomeAddressView.js.map +1 -1
- package/dist/components/Employee/HomeAddress/management/getPendingFutureHomeAddress.d.ts +1 -1
- package/dist/components/Employee/HomeAddress/management/getPendingFutureHomeAddress.js.map +1 -1
- package/dist/components/Employee/HomeAddress/management/useHomeAddressManagement.d.ts +1 -1
- package/dist/components/Employee/HomeAddress/management/useHomeAddressManagement.js +3 -3
- package/dist/components/Employee/HomeAddress/management/useHomeAddressManagement.js.map +1 -1
- package/dist/components/Employee/HomeAddress/shared/useHomeAddressSummary/useHomeAddressSummary.d.ts +1 -1
- package/dist/components/Employee/HomeAddress/shared/useHomeAddressSummary/useHomeAddressSummary.js +1 -1
- package/dist/components/Employee/HomeAddress/shared/useHomeAddressSummary/useHomeAddressSummary.js.map +1 -1
- package/dist/components/Employee/Landing/Landing.js +2 -2
- package/dist/components/Employee/Landing/Landing.js.map +1 -1
- package/dist/components/Employee/OnboardingExecutionFlow/OnboardingExecutionFlowComponents.d.ts +1 -1
- package/dist/components/Employee/OnboardingExecutionFlow/OnboardingExecutionFlowComponents.js.map +1 -1
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +2 -2
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/shared/BankFormBody/BankFormBody.d.ts +1 -1
- package/dist/components/Employee/PaymentMethod/shared/BankFormBody/BankFormBody.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/shared/SplitPaymentsFormBody/SplitPaymentsFormBody.d.ts +1 -1
- package/dist/components/Employee/PaymentMethod/shared/SplitPaymentsFormBody/SplitPaymentsFormBody.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/shared/useBankForm/useBankForm.d.ts +1 -1
- package/dist/components/Employee/PaymentMethod/shared/useBankForm/useBankForm.js +1 -1
- package/dist/components/Employee/PaymentMethod/shared/useBankForm/useBankForm.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/shared/usePaymentMethodForm/usePaymentMethodForm.d.ts +1 -1
- package/dist/components/Employee/PaymentMethod/shared/usePaymentMethodForm/usePaymentMethodForm.js +2 -2
- package/dist/components/Employee/PaymentMethod/shared/usePaymentMethodForm/usePaymentMethodForm.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/shared/usePaymentMethodList.d.ts +2 -2
- package/dist/components/Employee/PaymentMethod/shared/usePaymentMethodList.js +4 -4
- package/dist/components/Employee/PaymentMethod/shared/usePaymentMethodList.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/useSplitPaymentsForm.d.ts +2 -2
- package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/useSplitPaymentsForm.js +3 -3
- package/dist/components/Employee/PaymentMethod/shared/useSplitPaymentsForm/useSplitPaymentsForm.js.map +1 -1
- package/dist/components/Employee/Paystubs/shared/usePaystubsList/usePaystubsList.d.ts +1 -1
- package/dist/components/Employee/Paystubs/shared/usePaystubsList/usePaystubsList.js +3 -3
- package/dist/components/Employee/Paystubs/shared/usePaystubsList/usePaystubsList.js.map +1 -1
- package/dist/components/Employee/Profile/onboarding/AdminProfile.js.map +1 -1
- package/dist/components/Employee/Profile/onboarding/EmployeeProfile.js +1 -1
- package/dist/components/Employee/Profile/onboarding/EmployeeProfile.js.map +1 -1
- package/dist/components/Employee/Profile/shared/useEmployeeDetailsForm/useEmployeeDetailsForm.d.ts +1 -1
- package/dist/components/Employee/Profile/shared/useEmployeeDetailsForm/useEmployeeDetailsForm.js +5 -5
- package/dist/components/Employee/Profile/shared/useEmployeeDetailsForm/useEmployeeDetailsForm.js.map +1 -1
- package/dist/components/Employee/Profile/shared/useEmployeeProfileSummary/useEmployeeProfileSummary.d.ts +1 -1
- package/dist/components/Employee/Profile/shared/useEmployeeProfileSummary/useEmployeeProfileSummary.js +1 -1
- package/dist/components/Employee/Profile/shared/useEmployeeProfileSummary/useEmployeeProfileSummary.js.map +1 -1
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/useCurrentHomeAddressForm.js +1 -1
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/useCurrentHomeAddressForm.js.map +1 -1
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/useHomeAddressForm.d.ts +1 -1
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/useHomeAddressForm.js +4 -4
- package/dist/components/Employee/Profile/shared/useHomeAddressForm/useHomeAddressForm.js.map +1 -1
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/fields.d.ts +1 -1
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/fields.js.map +1 -1
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/useCurrentWorkAddressForm.js +1 -1
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/useCurrentWorkAddressForm.js.map +1 -1
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/useWorkAddressForm.d.ts +2 -2
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/useWorkAddressForm.js +5 -5
- package/dist/components/Employee/Profile/shared/useWorkAddressForm/useWorkAddressForm.js.map +1 -1
- package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingComponents.d.ts +1 -1
- package/dist/components/Employee/SelfOnboardingFlow/SelfOnboardingComponents.js.map +1 -1
- package/dist/components/Employee/StateTaxes/management/StateTaxesCard/StateTaxesCard.js.map +1 -1
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/__fixtures__/stateTaxesFixtures.d.ts +1 -1
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/__fixtures__/toWireFormat.d.ts +1 -1
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/employeeStateTaxesSchema.d.ts +1 -1
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/employeeStateTaxesSchema.js.map +1 -1
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fieldMapping.d.ts +1 -1
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fieldMapping.js.map +1 -1
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fields.d.ts +1 -1
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/fields.js.map +1 -1
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/useEmployeeStateTaxesForm.d.ts +1 -1
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/useEmployeeStateTaxesForm.js +2 -2
- package/dist/components/Employee/StateTaxes/shared/useEmployeeStateTaxesForm/useEmployeeStateTaxesForm.js.map +1 -1
- package/dist/components/Employee/StateTaxes/shared/useStateTaxesSummary/useStateTaxesSummary.d.ts +1 -1
- package/dist/components/Employee/StateTaxes/shared/useStateTaxesSummary/useStateTaxesSummary.js +1 -1
- package/dist/components/Employee/StateTaxes/shared/useStateTaxesSummary/useStateTaxesSummary.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.js +9 -9
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.d.ts +1 -1
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummary.js +4 -4
- package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummary.js.map +1 -1
- package/dist/components/Employee/WorkAddress/management/WorkAddressEditForm.js.map +1 -1
- package/dist/components/Employee/WorkAddress/management/WorkAddressView.d.ts +1 -1
- package/dist/components/Employee/WorkAddress/management/WorkAddressView.js.map +1 -1
- package/dist/components/Employee/WorkAddress/management/getPendingFutureWorkAddress.d.ts +2 -2
- package/dist/components/Employee/WorkAddress/management/getPendingFutureWorkAddress.js.map +1 -1
- package/dist/components/Employee/WorkAddress/management/useWorkAddressManagement.d.ts +1 -1
- package/dist/components/Employee/WorkAddress/management/useWorkAddressManagement.js +3 -3
- package/dist/components/Employee/WorkAddress/management/useWorkAddressManagement.js.map +1 -1
- package/dist/components/Employee/WorkAddress/shared/useEmployeeWorkAddressSummary/useEmployeeWorkAddressSummary.d.ts +1 -1
- package/dist/components/Employee/WorkAddress/shared/useEmployeeWorkAddressSummary/useEmployeeWorkAddressSummary.js +1 -1
- package/dist/components/Employee/WorkAddress/shared/useEmployeeWorkAddressSummary/useEmployeeWorkAddressSummary.js.map +1 -1
- package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js +4 -4
- package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js.map +1 -1
- package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js +2 -2
- package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.js +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.js +2 -2
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +3 -3
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/WireInstructions/WireInstructions.js +2 -2
- package/dist/components/Payroll/ConfirmWireDetails/WireInstructions/WireInstructions.js.map +1 -1
- package/dist/components/Payroll/Dismissal/DismissalFlowComponents.js +1 -1
- package/dist/components/Payroll/Dismissal/DismissalFlowComponents.js.map +1 -1
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.js +4 -4
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.js.map +1 -1
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +8 -7
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
- package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js +1 -1
- package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js +4 -4
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -1
- package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js +1 -1
- package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js.map +1 -1
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes.d.ts +1 -1
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes.js +1 -1
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +4 -4
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/payrollHelpers.js +2 -2
- package/dist/components/Payroll/PayrollBlocker/payrollHelpers.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +7 -7
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +5 -5
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.d.ts +4 -4
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +5 -5
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +3 -3
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.d.ts +4 -4
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.d.ts +2 -2
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.d.ts +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollExecutionFlowContextual.js +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollExecutionFlowContextual.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.d.ts +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/TransitionFlowContextual.js +2 -2
- package/dist/components/Payroll/PayrollFlow/TransitionFlowContextual.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistory.js +4 -4
- package/dist/components/Payroll/PayrollHistory/PayrollHistory.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.d.ts +2 -2
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js +2 -2
- package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollList.js +8 -8
- package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.d.ts +3 -3
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +7 -7
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.d.ts +4 -4
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.d.ts +2 -2
- package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/GenericBlocker.d.ts +1 -1
- package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/GenericBlocker.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceipts.js +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceipts.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.d.ts +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollStatusBadges/payrollStatusConfig.d.ts +1 -1
- package/dist/components/Payroll/PayrollStatusBadges/payrollStatusConfig.js +2 -2
- package/dist/components/Payroll/PayrollStatusBadges/payrollStatusConfig.js.map +1 -1
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js +1 -1
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js.map +1 -1
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js +2 -2
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js.map +1 -1
- package/dist/components/Payroll/Transition/TransitionFlowComponents.js +1 -1
- package/dist/components/Payroll/Transition/TransitionFlowComponents.js.map +1 -1
- package/dist/components/Payroll/TransitionCreation/TransitionCreation.js +4 -4
- package/dist/components/Payroll/TransitionCreation/TransitionCreation.js.map +1 -1
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.js +3 -3
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.js.map +1 -1
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.d.ts +1 -1
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.js.map +1 -1
- package/dist/components/Payroll/helpers.d.ts +6 -6
- package/dist/components/Payroll/helpers.js +1 -1
- package/dist/components/Payroll/helpers.js.map +1 -1
- package/dist/components/Payroll/payrollTypes.js +1 -1
- package/dist/components/Payroll/payrollTypes.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.d.ts +2 -2
- package/dist/components/Payroll/usePreparedPayrollData.js +16 -15
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/components/Payroll/useUnprocessedTransitionPayPeriods.d.ts +1 -1
- package/dist/components/Payroll/useUnprocessedTransitionPayPeriods.js +3 -3
- package/dist/components/Payroll/useUnprocessedTransitionPayPeriods.js.map +1 -1
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetail.js +3 -3
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetail.js.map +1 -1
- package/dist/components/TimeOff/HolidaySelectionForm/HolidaySelectionForm.js +3 -3
- package/dist/components/TimeOff/HolidaySelectionForm/HolidaySelectionForm.js.map +1 -1
- package/dist/components/TimeOff/PolicyList/PolicyList.js +6 -6
- package/dist/components/TimeOff/PolicyList/PolicyList.js.map +1 -1
- package/dist/components/TimeOff/PolicySettings/PolicySettings.js +30 -29
- package/dist/components/TimeOff/PolicySettings/PolicySettings.js.map +1 -1
- package/dist/components/TimeOff/PolicyTypeSelector/PolicyTypeSelector.js +1 -1
- package/dist/components/TimeOff/PolicyTypeSelector/PolicyTypeSelector.js.map +1 -1
- package/dist/components/TimeOff/TimeOffFlow/timeOffPolicyTypes.d.ts +1 -1
- package/dist/components/TimeOff/TimeOffFlow/timeOffPolicyTypes.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationForm.js +27 -26
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationForm.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday.js +2 -2
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentationTypes.d.ts +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.js +69 -68
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/useSelectEmployeesData.js +3 -3
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/useSelectEmployeesData.js.map +1 -1
- package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetail.js +67 -66
- package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetail.js.map +1 -1
- package/dist/contexts/ApiProvider/ApiProvider.js +3 -3
- package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -1
- package/dist/contexts/ApiProvider/apiVersion.d.ts +23 -0
- package/dist/contexts/ApiProvider/apiVersion.js +6 -0
- package/dist/contexts/ApiProvider/apiVersion.js.map +1 -0
- package/dist/contexts/ApiProvider/apiVersionHook.js +3 -2
- package/dist/contexts/ApiProvider/apiVersionHook.js.map +1 -1
- package/dist/contexts/ApiProvider/createSdkQueryClient.d.ts +1 -1
- package/dist/contexts/ApiProvider/createSdkQueryClient.js +7 -6
- package/dist/contexts/ApiProvider/createSdkQueryClient.js.map +1 -1
- package/dist/helpers/apiErrorToList.d.ts +1 -1
- package/dist/helpers/apiErrorToList.js.map +1 -1
- package/dist/helpers/formattedStrings.d.ts +2 -2
- package/dist/helpers/formattedStrings.js.map +1 -1
- package/dist/hooks/useCompanyPaymentSpeed.d.ts +1 -1
- package/dist/hooks/useCompanyPaymentSpeed.js +1 -1
- package/dist/hooks/useCompanyPaymentSpeed.js.map +1 -1
- package/dist/i18n/en/Contractor.DocumentsList.json.js +20 -16
- package/dist/i18n/en/Contractor.DocumentsList.json.js.map +1 -1
- package/dist/i18n/types.d.ts +4 -0
- package/dist/models/external.d.ts +204 -204
- package/dist/shared/constants.d.ts +1 -1
- package/dist/shared/constants.js +2 -2
- package/dist/shared/constants.js.map +1 -1
- package/dist/types/hooks.d.ts +1 -1
- package/dist/types/sdkError.js +3 -3
- package/dist/types/sdkError.js.map +1 -1
- package/docs/guides/endpoint-inventory.json +1201 -297
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolicyList.js","sources":["../../../../src/components/TimeOff/PolicyList/PolicyList.tsx"],"sourcesContent":["import { useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { useQueryClient } from '@tanstack/react-query'\nimport {\n useTimeOffPoliciesGetAllSuspense,\n invalidateAllTimeOffPoliciesGetAll,\n} from '@gusto/embedded-api-v-2026-02-01/react-query/timeOffPoliciesGetAll'\nimport { useTimeOffPoliciesDeactivateMutation } from '@gusto/embedded-api-v-2026-02-01/react-query/timeOffPoliciesDeactivate'\nimport { useEmployeesListSuspense } from '@gusto/embedded-api-v-2026-02-01/react-query/employeesList'\nimport {\n useHolidayPayPoliciesGet,\n invalidateAllHolidayPayPoliciesGet,\n} from '@gusto/embedded-api-v-2026-02-01/react-query/holidayPayPoliciesGet'\nimport { useHolidayPayPoliciesDeleteMutation } from '@gusto/embedded-api-v-2026-02-01/react-query/holidayPayPoliciesDelete'\nimport type { TimeOffPolicy } from '@gusto/embedded-api-v-2026-02-01/models/components/timeoffpolicy'\nimport { UnprocessableEntityError } from '@gusto/embedded-api-v-2026-02-01/models/errors/unprocessableentityerror'\nimport { PolicyListPresentation } from './PolicyListPresentation'\nimport type { PolicyListItem } from './PolicyListTypes'\nimport { isListedTimeOffPolicyType } from '@/components/TimeOff/TimeOffFlow/timeOffPolicyTypes'\nimport { BaseBoundaries, BaseLayout, type BaseComponentInterface } from '@/components/Base'\nimport { useBaseSubmit } from '@/components/Base/useBaseSubmit'\nimport { SDKInternalError } from '@/types/sdkError'\nimport { composeErrorHandler } from '@/partner-hook-utils/composeErrorHandler'\nimport { componentEvents } from '@/shared/constants'\nimport { useI18n } from '@/i18n'\n\n/**\n * Props for the {@link PolicyList} component.\n *\n * @public\n */\nexport interface PolicyListProps extends BaseComponentInterface<'Company.TimeOff.TimeOffPolicies'> {\n /** The associated company identifier. */\n companyId: string\n}\n\n/**\n * Displays all active time off policies (sick, vacation, and holiday) for a company.\n *\n * Each row shows the policy name and the enrolled-employee count. Incomplete policies surface a\n * finish-setup action. Sick and vacation policies are deactivated via the time-off policies API;\n * the holiday pay policy (if one exists) is merged into the same list and is deleted via the\n * holiday pay policy API. Both flows go through a confirmation dialog and show a success alert.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `timeOff/createPolicy` | The user clicked the create-policy action. | — |\n * | `timeOff/viewPolicy` | The user opened an existing policy or clicked finish-setup on an incomplete one. | `{ policyId: string, policyType: string }` |\n * | `timeOff/deletePolicy/done` | A policy was successfully deleted. | `{ policyId: string }` |\n *\n * @param props - {@link PolicyListProps}\n * @returns The rendered policy list.\n * @public\n */\nexport function PolicyList({ FallbackComponent, ...props }: PolicyListProps) {\n return (\n <BaseBoundaries\n componentName=\"Company.TimeOff.TimeOffPolicies\"\n FallbackComponent={FallbackComponent}\n >\n <Root {...props} />\n </BaseBoundaries>\n )\n}\n\nfunction Root({ companyId, onEvent }: PolicyListProps) {\n useI18n('Company.TimeOff.TimeOffPolicies')\n const { t } = useTranslation('Company.TimeOff.TimeOffPolicies')\n const queryClient = useQueryClient()\n\n const {\n baseSubmitHandler,\n error: submitError,\n setError: setSubmitError,\n } = useBaseSubmit('Company.TimeOff.TimeOffPolicies')\n\n const [deleteSuccessAlert, setDeleteSuccessAlert] = useState<string | null>(null)\n const [isDeletingPolicyId, setIsDeletingPolicyId] = useState<string | null>(null)\n\n const { data: policiesData } = useTimeOffPoliciesGetAllSuspense({\n companyUuid: companyId,\n })\n const timeOffPolicies = (policiesData.timeOffPolicies ?? []).filter(\n policy => policy.isActive && isListedTimeOffPolicyType(policy.policyType),\n )\n\n // Holiday pay policy is auxiliary to the main time-off list; never crash the\n // boundary on its failure. composeErrorHandler below surfaces the error as\n // an inline alert via BaseLayout when it isn't an expected 204/404.\n const holidayQuery = useHolidayPayPoliciesGet(\n { companyUuid: companyId },\n {\n throwOnError: () => false,\n },\n )\n const holidayPayPolicy = holidayQuery.data?.holidayPayPolicy\n\n const { data: employeesData } = useEmployeesListSuspense({\n companyId,\n terminated: false,\n })\n const totalActiveEmployees = employeesData.showEmployees?.length ?? 0\n\n const deactivatePolicyMutation = useTimeOffPoliciesDeactivateMutation()\n const deleteHolidayMutation = useHolidayPayPoliciesDeleteMutation()\n\n const errorHandling = composeErrorHandler([holidayQuery], { submitError, setSubmitError })\n const isPending = deactivatePolicyMutation.isPending || deleteHolidayMutation.isPending\n\n const getEnrolledDisplay = (enrolledCount: number) => {\n if (enrolledCount > 0 && enrolledCount === totalActiveEmployees) {\n return t('allEmployeesLabel')\n } else if (enrolledCount > 0) {\n return t('employeeCount', { count: enrolledCount })\n }\n return t('enrolledDash')\n }\n\n const policies: PolicyListItem[] = timeOffPolicies\n .map((policy: TimeOffPolicy) => ({\n uuid: policy.uuid,\n name: policy.name,\n policyType: policy.policyType,\n isComplete: policy.complete ?? false,\n enrolledDisplay: getEnrolledDisplay(policy.employees.length),\n }))\n .sort((a, b) => a.name.localeCompare(b.name))\n\n if (holidayPayPolicy) {\n policies.push({\n uuid: holidayPayPolicy.companyUuid,\n name: t('holidayPayPolicy'),\n policyType: 'holiday',\n isComplete: true,\n enrolledDisplay: getEnrolledDisplay(holidayPayPolicy.employees.length),\n isHoliday: true,\n })\n }\n\n const handleCreatePolicy = () => {\n onEvent(componentEvents.TIME_OFF_CREATE_POLICY)\n }\n\n const handleEditPolicy = (policy: PolicyListItem) => {\n onEvent(componentEvents.TIME_OFF_VIEW_POLICY, {\n policyId: policy.uuid,\n policyType: policy.policyType,\n })\n }\n\n const handleFinishSetup = (policy: PolicyListItem) => {\n onEvent(componentEvents.TIME_OFF_VIEW_POLICY, {\n policyId: policy.uuid,\n policyType: policy.policyType,\n })\n }\n\n const handleDeletePolicy = async (policy: PolicyListItem): Promise<boolean> => {\n let success = false\n setIsDeletingPolicyId(policy.uuid)\n await baseSubmitHandler({}, async () => {\n if (policy.isHoliday) {\n await deleteHolidayMutation.mutateAsync({\n request: { companyUuid: companyId },\n })\n await invalidateAllHolidayPayPoliciesGet(queryClient)\n setDeleteSuccessAlert(t('flash.holidayDeleted'))\n } else {\n try {\n await deactivatePolicyMutation.mutateAsync({\n request: { timeOffPolicyUuid: policy.uuid },\n })\n } catch (err) {\n if (err instanceof UnprocessableEntityError) {\n const hasPendingRequests = err.errors.some(\n e =>\n e.message?.toLowerCase().includes('pending') ||\n e.message?.toLowerCase().includes('approved'),\n )\n if (hasPendingRequests) {\n throw new SDKInternalError(\n t('errors.pendingRequestsBlockDeletion', { name: policy.name }),\n 'api_error',\n )\n }\n const messages = err.errors.map(e => e.message).filter(Boolean)\n throw new SDKInternalError(messages.join('. ') || t('errors.deleteFailed'), 'api_error')\n }\n throw err\n }\n await invalidateAllTimeOffPoliciesGetAll(queryClient)\n setDeleteSuccessAlert(t('flash.policyDeleted', { name: policy.name }))\n }\n onEvent(componentEvents.TIME_OFF_DELETE_POLICY_DONE, { policyId: policy.uuid })\n success = true\n })\n setIsDeletingPolicyId(null)\n return success\n }\n\n return (\n <BaseLayout error={errorHandling.errors}>\n <PolicyListPresentation\n policies={policies}\n onCreatePolicy={handleCreatePolicy}\n onEditPolicy={handleEditPolicy}\n onFinishSetup={handleFinishSetup}\n onDeletePolicy={handleDeletePolicy}\n deleteSuccessAlert={deleteSuccessAlert}\n onDismissDeleteAlert={() => {\n setDeleteSuccessAlert(null)\n }}\n isDeletingPolicyId={isDeletingPolicyId}\n isPending={isPending}\n />\n </BaseLayout>\n )\n}\n"],"names":["PolicyList","FallbackComponent","props","jsx","BaseBoundaries","Root","companyId","onEvent","useI18n","t","useTranslation","queryClient","useQueryClient","baseSubmitHandler","submitError","setSubmitError","useBaseSubmit","deleteSuccessAlert","setDeleteSuccessAlert","useState","isDeletingPolicyId","setIsDeletingPolicyId","policiesData","useTimeOffPoliciesGetAllSuspense","timeOffPolicies","policy","isListedTimeOffPolicyType","holidayQuery","useHolidayPayPoliciesGet","holidayPayPolicy","employeesData","useEmployeesListSuspense","totalActiveEmployees","deactivatePolicyMutation","useTimeOffPoliciesDeactivateMutation","deleteHolidayMutation","useHolidayPayPoliciesDeleteMutation","errorHandling","composeErrorHandler","isPending","getEnrolledDisplay","enrolledCount","policies","a","b","handleCreatePolicy","componentEvents","handleEditPolicy","handleFinishSetup","handleDeletePolicy","success","invalidateAllHolidayPayPoliciesGet","err","UnprocessableEntityError","e","SDKInternalError","messages","invalidateAllTimeOffPoliciesGetAll","BaseLayout","PolicyListPresentation"],"mappings":";;;;;;;;;;;;;;;;;;;AAuDO,SAASA,GAAW,EAAE,mBAAAC,GAAmB,GAAGC,KAA0B;AAC3E,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,eAAc;AAAA,MACd,mBAAAH;AAAA,MAEA,UAAA,gBAAAE,EAACE,GAAA,EAAM,GAAGH,EAAA,CAAO;AAAA,IAAA;AAAA,EAAA;AAGvB;AAEA,SAASG,EAAK,EAAE,WAAAC,GAAW,SAAAC,KAA4B;AACrD,EAAAC,EAAQ,iCAAiC;AACzC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,iCAAiC,GACxDC,IAAcC,EAAA,GAEd;AAAA,IACJ,mBAAAC;AAAA,IACA,OAAOC;AAAA,IACP,UAAUC;AAAA,EAAA,IACRC,EAAc,iCAAiC,GAE7C,CAACC,GAAoBC,CAAqB,IAAIC,EAAwB,IAAI,GAC1E,CAACC,GAAoBC,CA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OAAO,OAAO;AAC9D,kBAAM,IAAIC,EAAiBC,EAAS,KAAK,IAAI,KAAK/C,EAAE,qBAAqB,GAAG,WAAW;AAAA,UACzF;AACA,gBAAM2C;AAAA,QACR;AACA,cAAMK,EAAmC9C,CAAW,GACpDO,EAAsBT,EAAE,uBAAuB,EAAE,MAAMgB,EAAO,KAAA,CAAM,CAAC;AAAA,MACvE;AACA,MAAAlB,EAAQuC,EAAgB,6BAA6B,EAAE,UAAUrB,EAAO,MAAM,GAC9EyB,IAAU;AAAA,IACZ,CAAC,GACD7B,EAAsB,IAAI,GACnB6B;AAAA,EACT;AAEA,SACE,gBAAA/C,EAACuD,GAAA,EAAW,OAAOrB,EAAc,QAC/B,UAAA,gBAAAlC;AAAA,IAACwD;AAAA,IAAA;AAAA,MACC,UAAAjB;AAAA,MACA,gBAAgBG;AAAA,MAChB,cAAcE;AAAA,MACd,eAAeC;AAAA,MACf,gBAAgBC;AAAA,MAChB,oBAAAhC;AAAA,MACA,sBAAsB,MAAM;AAC1B,QAAAC,EAAsB,IAAI;AAAA,MAC5B;AAAA,MACA,oBAAAE;AAAA,MACA,WAAAmB;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"PolicyList.js","sources":["../../../../src/components/TimeOff/PolicyList/PolicyList.tsx"],"sourcesContent":["import { useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { useQueryClient } from '@tanstack/react-query'\nimport {\n useTimeOffPoliciesGetAllSuspense,\n invalidateAllTimeOffPoliciesGetAll,\n} from '@gusto/embedded-api/react-query/timeOffPoliciesGetAll'\nimport { useTimeOffPoliciesDeactivateMutation } from '@gusto/embedded-api/react-query/timeOffPoliciesDeactivate'\nimport { useEmployeesListSuspense } from '@gusto/embedded-api/react-query/employeesList'\nimport {\n useHolidayPayPoliciesGet,\n invalidateAllHolidayPayPoliciesGet,\n} from '@gusto/embedded-api/react-query/holidayPayPoliciesGet'\nimport { useHolidayPayPoliciesDeleteMutation } from '@gusto/embedded-api/react-query/holidayPayPoliciesDelete'\nimport type { TimeOffPolicy } from '@gusto/embedded-api/models/components/timeoffpolicy'\nimport { UnprocessableEntityError } from '@gusto/embedded-api/models/errors/unprocessableentityerror'\nimport { PolicyListPresentation } from './PolicyListPresentation'\nimport type { PolicyListItem } from './PolicyListTypes'\nimport { isListedTimeOffPolicyType } from '@/components/TimeOff/TimeOffFlow/timeOffPolicyTypes'\nimport { BaseBoundaries, BaseLayout, type BaseComponentInterface } from '@/components/Base'\nimport { useBaseSubmit } from '@/components/Base/useBaseSubmit'\nimport { SDKInternalError } from '@/types/sdkError'\nimport { composeErrorHandler } from '@/partner-hook-utils/composeErrorHandler'\nimport { componentEvents } from '@/shared/constants'\nimport { useI18n } from '@/i18n'\n\n/**\n * Props for the {@link PolicyList} component.\n *\n * @public\n */\nexport interface PolicyListProps extends BaseComponentInterface<'Company.TimeOff.TimeOffPolicies'> {\n /** The associated company identifier. */\n companyId: string\n}\n\n/**\n * Displays all active time off policies (sick, vacation, and holiday) for a company.\n *\n * Each row shows the policy name and the enrolled-employee count. Incomplete policies surface a\n * finish-setup action. Sick and vacation policies are deactivated via the time-off policies API;\n * the holiday pay policy (if one exists) is merged into the same list and is deleted via the\n * holiday pay policy API. Both flows go through a confirmation dialog and show a success alert.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `timeOff/createPolicy` | The user clicked the create-policy action. | — |\n * | `timeOff/viewPolicy` | The user opened an existing policy or clicked finish-setup on an incomplete one. | `{ policyId: string, policyType: string }` |\n * | `timeOff/deletePolicy/done` | A policy was successfully deleted. | `{ policyId: string }` |\n *\n * @param props - {@link PolicyListProps}\n * @returns The rendered policy list.\n * @public\n */\nexport function PolicyList({ FallbackComponent, ...props }: PolicyListProps) {\n return (\n <BaseBoundaries\n componentName=\"Company.TimeOff.TimeOffPolicies\"\n FallbackComponent={FallbackComponent}\n >\n <Root {...props} />\n </BaseBoundaries>\n )\n}\n\nfunction Root({ companyId, onEvent }: PolicyListProps) {\n useI18n('Company.TimeOff.TimeOffPolicies')\n const { t } = useTranslation('Company.TimeOff.TimeOffPolicies')\n const queryClient = useQueryClient()\n\n const {\n baseSubmitHandler,\n error: submitError,\n setError: setSubmitError,\n } = useBaseSubmit('Company.TimeOff.TimeOffPolicies')\n\n const [deleteSuccessAlert, setDeleteSuccessAlert] = useState<string | null>(null)\n const [isDeletingPolicyId, setIsDeletingPolicyId] = useState<string | null>(null)\n\n const { data: policiesData } = useTimeOffPoliciesGetAllSuspense({\n companyUuid: companyId,\n })\n const timeOffPolicies = (policiesData.timeOffPolicies ?? []).filter(\n policy => policy.isActive && isListedTimeOffPolicyType(policy.policyType),\n )\n\n // Holiday pay policy is auxiliary to the main time-off list; never crash the\n // boundary on its failure. composeErrorHandler below surfaces the error as\n // an inline alert via BaseLayout when it isn't an expected 204/404.\n const holidayQuery = useHolidayPayPoliciesGet(\n { companyUuid: companyId },\n {\n throwOnError: () => false,\n },\n )\n const holidayPayPolicy = holidayQuery.data?.holidayPayPolicy\n\n const { data: employeesData } = useEmployeesListSuspense({\n companyId,\n terminated: false,\n })\n const totalActiveEmployees = employeesData.showEmployees?.length ?? 0\n\n const deactivatePolicyMutation = useTimeOffPoliciesDeactivateMutation()\n const deleteHolidayMutation = useHolidayPayPoliciesDeleteMutation()\n\n const errorHandling = composeErrorHandler([holidayQuery], { submitError, setSubmitError })\n const isPending = deactivatePolicyMutation.isPending || deleteHolidayMutation.isPending\n\n const getEnrolledDisplay = (enrolledCount: number) => {\n if (enrolledCount > 0 && enrolledCount === totalActiveEmployees) {\n return t('allEmployeesLabel')\n } else if (enrolledCount > 0) {\n return t('employeeCount', { count: enrolledCount })\n }\n return t('enrolledDash')\n }\n\n const policies: PolicyListItem[] = timeOffPolicies\n .map((policy: TimeOffPolicy) => ({\n uuid: policy.uuid,\n name: policy.name,\n policyType: policy.policyType,\n isComplete: policy.complete ?? false,\n enrolledDisplay: getEnrolledDisplay(policy.employees.length),\n }))\n .sort((a, b) => a.name.localeCompare(b.name))\n\n if (holidayPayPolicy) {\n policies.push({\n uuid: holidayPayPolicy.companyUuid,\n name: t('holidayPayPolicy'),\n policyType: 'holiday',\n isComplete: true,\n enrolledDisplay: getEnrolledDisplay(holidayPayPolicy.employees.length),\n isHoliday: true,\n })\n }\n\n const handleCreatePolicy = () => {\n onEvent(componentEvents.TIME_OFF_CREATE_POLICY)\n }\n\n const handleEditPolicy = (policy: PolicyListItem) => {\n onEvent(componentEvents.TIME_OFF_VIEW_POLICY, {\n policyId: policy.uuid,\n policyType: policy.policyType,\n })\n }\n\n const handleFinishSetup = (policy: PolicyListItem) => {\n onEvent(componentEvents.TIME_OFF_VIEW_POLICY, {\n policyId: policy.uuid,\n policyType: policy.policyType,\n })\n }\n\n const handleDeletePolicy = async (policy: PolicyListItem): Promise<boolean> => {\n let success = false\n setIsDeletingPolicyId(policy.uuid)\n await baseSubmitHandler({}, async () => {\n if (policy.isHoliday) {\n await deleteHolidayMutation.mutateAsync({\n request: { companyUuid: companyId },\n })\n await invalidateAllHolidayPayPoliciesGet(queryClient)\n setDeleteSuccessAlert(t('flash.holidayDeleted'))\n } else {\n try {\n await deactivatePolicyMutation.mutateAsync({\n request: { timeOffPolicyUuid: policy.uuid },\n })\n } catch (err) {\n if (err instanceof UnprocessableEntityError) {\n const hasPendingRequests = err.errors.some(\n e =>\n e.message?.toLowerCase().includes('pending') ||\n e.message?.toLowerCase().includes('approved'),\n )\n if (hasPendingRequests) {\n throw new SDKInternalError(\n t('errors.pendingRequestsBlockDeletion', { name: policy.name }),\n 'api_error',\n )\n }\n const messages = err.errors.map(e => e.message).filter(Boolean)\n throw new SDKInternalError(messages.join('. ') || t('errors.deleteFailed'), 'api_error')\n }\n throw err\n }\n await invalidateAllTimeOffPoliciesGetAll(queryClient)\n setDeleteSuccessAlert(t('flash.policyDeleted', { name: policy.name }))\n }\n onEvent(componentEvents.TIME_OFF_DELETE_POLICY_DONE, { policyId: policy.uuid })\n success = true\n })\n setIsDeletingPolicyId(null)\n return success\n }\n\n return (\n <BaseLayout error={errorHandling.errors}>\n <PolicyListPresentation\n policies={policies}\n onCreatePolicy={handleCreatePolicy}\n onEditPolicy={handleEditPolicy}\n onFinishSetup={handleFinishSetup}\n onDeletePolicy={handleDeletePolicy}\n deleteSuccessAlert={deleteSuccessAlert}\n onDismissDeleteAlert={() => {\n setDeleteSuccessAlert(null)\n }}\n isDeletingPolicyId={isDeletingPolicyId}\n isPending={isPending}\n />\n </BaseLayout>\n )\n}\n"],"names":["PolicyList","FallbackComponent","props","jsx","BaseBoundaries","Root","companyId","onEvent","useI18n","t","useTranslation","queryClient","useQueryClient","baseSubmitHandler","submitError","setSubmitError","useBaseSubmit","deleteSuccessAlert","setDeleteSuccessAlert","useState","isDeletingPolicyId","setIsDeletingPolicyId","policiesData","useTimeOffPoliciesGetAllSuspense","timeOffPolicies","policy","isListedTimeOffPolicyType","holidayQuery","useHolidayPayPoliciesGet","holidayPayPolicy","employeesData","useEmployeesListSuspense","totalActiveEmployees","deactivatePolicyMutation","useTimeOffPoliciesDeactivateMutation","deleteHolidayMutation","useHolidayPayPoliciesDeleteMutation","errorHandling","composeErrorHandler","isPending","getEnrolledDisplay","enrolledCount","policies","a","b","handleCreatePolicy","componentEvents","handleEditPolicy","handleFinishSetup","handleDeletePolicy","success","invalidateAllHolidayPayPoliciesGet","err","UnprocessableEntityError","e","SDKInternalError","messages","invalidateAllTimeOffPoliciesGetAll","BaseLayout","PolicyListPresentation"],"mappings":";;;;;;;;;;;;;;;;;;;AAuDO,SAASA,GAAW,EAAE,mBAAAC,GAAmB,GAAGC,KAA0B;AAC3E,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,eAAc;AAAA,MACd,mBAAAH;AAAA,MAEA,UAAA,gBAAAE,EAACE,GAAA,EAAM,GAAGH,EAAA,CAAO;AAAA,IAAA;AAAA,EAAA;AAGvB;AAEA,SAASG,EAAK,EAAE,WAAAC,GAAW,SAAAC,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CAAAE,MACEA,EAAE,SAAS,YAAA,EAAc,SAAS,SAAS,KAC3CA,EAAE,SAAS,YAAA,EAAc,SAAS,UAAU;AAAA,YAAA;AAG9C,oBAAM,IAAIC;AAAA,gBACR9C,EAAE,uCAAuC,EAAE,MAAMgB,EAAO,MAAM;AAAA,gBAC9D;AAAA,cAAA;AAGJ,kBAAM+B,IAAWJ,EAAI,OAAO,IAAI,OAAKE,EAAE,OAAO,EAAE,OAAO,OAAO;AAC9D,kBAAM,IAAIC,EAAiBC,EAAS,KAAK,IAAI,KAAK/C,EAAE,qBAAqB,GAAG,WAAW;AAAA,UACzF;AACA,gBAAM2C;AAAA,QACR;AACA,cAAMK,EAAmC9C,CAAW,GACpDO,EAAsBT,EAAE,uBAAuB,EAAE,MAAMgB,EAAO,KAAA,CAAM,CAAC;AAAA,MACvE;AACA,MAAAlB,EAAQuC,EAAgB,6BAA6B,EAAE,UAAUrB,EAAO,MAAM,GAC9EyB,IAAU;AAAA,IACZ,CAAC,GACD7B,EAAsB,IAAI,GACnB6B;AAAA,EACT;AAEA,SACE,gBAAA/C,EAACuD,GAAA,EAAW,OAAOrB,EAAc,QAC/B,UAAA,gBAAAlC;AAAA,IAACwD;AAAA,IAAA;AAAA,MACC,UAAAjB;AAAA,MACA,gBAAgBG;AAAA,MAChB,cAAcE;AAAA,MACd,eAAeC;AAAA,MACf,gBAAgBC;AAAA,MAChB,oBAAAhC;AAAA,MACA,sBAAsB,MAAM;AAC1B,QAAAC,EAAsB,IAAI;AAAA,MAC5B;AAAA,MACA,oBAAAE;AAAA,MACA,WAAAmB;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;"}
|
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
import { jsx as u } from "react/jsx-runtime";
|
|
2
|
-
import { useTimeOffPoliciesGetSuspense as
|
|
3
|
-
import { useTimeOffPoliciesUpdateMutation as
|
|
4
|
-
import { UnprocessableEntityError as
|
|
5
|
-
import { useQueryClient as
|
|
6
|
-
import { useTranslation as
|
|
7
|
-
import { PolicySettingsPresentation as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
2
|
+
import { useTimeOffPoliciesGetSuspense as E } from "@gusto/embedded-api/react-query/timeOffPoliciesGet";
|
|
3
|
+
import { useTimeOffPoliciesUpdateMutation as g } from "@gusto/embedded-api/react-query/timeOffPoliciesUpdate";
|
|
4
|
+
import { UnprocessableEntityError as x } from "@gusto/embedded-api/models/errors/unprocessableentityerror";
|
|
5
|
+
import { useQueryClient as T } from "@tanstack/react-query";
|
|
6
|
+
import { useTranslation as M } from "react-i18next";
|
|
7
|
+
import { PolicySettingsPresentation as b } from "./PolicySettingsPresentation.js";
|
|
8
|
+
import { API_QUERY_NAMESPACE as C } from "../../../contexts/ApiProvider/apiVersion.js";
|
|
9
|
+
import { BaseComponent as v } from "../../Base/Base.js";
|
|
10
|
+
import { useBase as S } from "../../Base/useBase.js";
|
|
10
11
|
import { SDKInternalError as c } from "../../../types/sdkError.js";
|
|
11
12
|
import { componentEvents as s } from "../../../shared/constants.js";
|
|
12
13
|
import { useI18n as w } from "../../../i18n/I18n.js";
|
|
13
|
-
function
|
|
14
|
-
return /* @__PURE__ */ u(
|
|
14
|
+
function z(e) {
|
|
15
|
+
return /* @__PURE__ */ u(v, { ...e, children: /* @__PURE__ */ u(U, { ...e }) });
|
|
15
16
|
}
|
|
16
|
-
const
|
|
17
|
+
const A = [
|
|
17
18
|
"per_hour_worked",
|
|
18
19
|
"per_hour_worked_no_overtime",
|
|
19
20
|
"per_hour_paid",
|
|
20
21
|
"per_hour_paid_no_overtime"
|
|
21
22
|
], h = ["per_anniversary_year", "per_calendar_year"];
|
|
22
23
|
function L(e) {
|
|
23
|
-
return
|
|
24
|
+
return A.includes(e) ? "hours_worked" : h.includes(e) ? "fixed_all_at_once" : "fixed_per_pay_period";
|
|
24
25
|
}
|
|
25
|
-
function
|
|
26
|
+
function H(e) {
|
|
26
27
|
const r = {};
|
|
27
28
|
return e.maxAccrualHoursPerYear != null && (r.accrualMaximumEnabled = !0, r.accrualMaximum = Number(e.maxAccrualHoursPerYear)), e.maxHours != null && (r.balanceMaximumEnabled = !0, r.balanceMaximum = Number(e.maxHours)), e.carryoverLimitHours != null && (r.carryOverLimitEnabled = !0, r.carryOverLimit = Number(e.carryoverLimitHours)), e.accrualWaitingPeriodDays != null && e.accrualWaitingPeriodDays > 0 && (r.waitingPeriodEnabled = !0, r.waitingPeriod = e.accrualWaitingPeriodDays), e.paidOutOnTermination != null && (r.paidOutOnTermination = e.paidOutOnTermination), r;
|
|
28
29
|
}
|
|
29
|
-
function
|
|
30
|
-
const n =
|
|
30
|
+
function I(e, r, a) {
|
|
31
|
+
const n = a === "fixed_all_at_once";
|
|
31
32
|
return {
|
|
32
33
|
maxAccrualHoursPerYear: !n && e.accrualMaximumEnabled && e.accrualMaximum != null ? String(e.accrualMaximum) : null,
|
|
33
34
|
maxHours: e.balanceMaximumEnabled && e.balanceMaximum != null ? String(e.balanceMaximum) : null,
|
|
@@ -37,15 +38,15 @@ function H(e, r, o) {
|
|
|
37
38
|
version: r
|
|
38
39
|
};
|
|
39
40
|
}
|
|
40
|
-
function
|
|
41
|
+
function U({ policyId: e, mode: r }) {
|
|
41
42
|
w("Company.TimeOff.CreateTimeOffPolicy");
|
|
42
|
-
const { t:
|
|
43
|
+
const { t: a } = M("Company.TimeOff.CreateTimeOffPolicy"), { onEvent: n, baseSubmitHandler: f } = S(), d = T(), { data: _ } = E({
|
|
43
44
|
timeOffPolicyUuid: e
|
|
44
|
-
}), { mutateAsync: O, isPending: p } =
|
|
45
|
-
if (!
|
|
46
|
-
const m = L(
|
|
45
|
+
}), { mutateAsync: O, isPending: p } = g(), o = _.timeOffPolicy;
|
|
46
|
+
if (!o) throw new Error("Unexpected response: missing timeOffPolicy");
|
|
47
|
+
const m = L(o.accrualMethod), y = o.version ?? "";
|
|
47
48
|
return /* @__PURE__ */ u(
|
|
48
|
-
|
|
49
|
+
b,
|
|
49
50
|
{
|
|
50
51
|
accrualMethod: m,
|
|
51
52
|
onContinue: async (l) => {
|
|
@@ -54,22 +55,22 @@ function I({ policyId: e, mode: r }) {
|
|
|
54
55
|
const { timeOffPolicy: i } = await O({
|
|
55
56
|
request: {
|
|
56
57
|
timeOffPolicyUuid: e,
|
|
57
|
-
requestBody:
|
|
58
|
+
requestBody: I(l, y, m)
|
|
58
59
|
}
|
|
59
60
|
});
|
|
60
61
|
d.invalidateQueries({
|
|
61
|
-
queryKey: [
|
|
62
|
+
queryKey: [C, "timeOffPolicies", "get"]
|
|
62
63
|
}), n(s.TIME_OFF_POLICY_SETTINGS_DONE, i);
|
|
63
64
|
} catch (i) {
|
|
64
|
-
if (i instanceof
|
|
65
|
+
if (i instanceof x) {
|
|
65
66
|
if (i.errors.some((t) => t.message === "LIMIT_VIOLATION_MAX_HOURS"))
|
|
66
67
|
throw new c(
|
|
67
|
-
|
|
68
|
+
a("policySettings.errors.balanceExceedsMaximum"),
|
|
68
69
|
"api_error"
|
|
69
70
|
);
|
|
70
71
|
const P = [...new Set(i.errors.map((t) => t.message).filter(Boolean))];
|
|
71
72
|
throw new c(
|
|
72
|
-
|
|
73
|
+
a("errors.updatePolicySettingsFailed", {
|
|
73
74
|
details: P.join(". ")
|
|
74
75
|
}),
|
|
75
76
|
"api_error"
|
|
@@ -82,14 +83,14 @@ function I({ policyId: e, mode: r }) {
|
|
|
82
83
|
onBack: () => {
|
|
83
84
|
n(s.TIME_OFF_POLICY_SETTINGS_BACK);
|
|
84
85
|
},
|
|
85
|
-
defaultValues:
|
|
86
|
+
defaultValues: H(o),
|
|
86
87
|
mode: r,
|
|
87
|
-
editingPolicyName: r === "edit" ?
|
|
88
|
+
editingPolicyName: r === "edit" ? o.name : void 0,
|
|
88
89
|
isPending: p
|
|
89
90
|
}
|
|
90
91
|
);
|
|
91
92
|
}
|
|
92
93
|
export {
|
|
93
|
-
|
|
94
|
+
z as PolicySettings
|
|
94
95
|
};
|
|
95
96
|
//# sourceMappingURL=PolicySettings.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolicySettings.js","sources":["../../../../src/components/TimeOff/PolicySettings/PolicySettings.tsx"],"sourcesContent":["import { useTimeOffPoliciesGetSuspense } from '@gusto/embedded-api-v-2026-02-01/react-query/timeOffPoliciesGet'\nimport { useTimeOffPoliciesUpdateMutation } from '@gusto/embedded-api-v-2026-02-01/react-query/timeOffPoliciesUpdate'\nimport type { PutV1TimeOffPoliciesTimeOffPolicyUuidRequestBody } from '@gusto/embedded-api-v-2026-02-01/models/operations/putv1timeoffpoliciestimeoffpolicyuuid'\nimport type { TimeOffPolicy } from '@gusto/embedded-api-v-2026-02-01/models/components/timeoffpolicy'\nimport { UnprocessableEntityError } from '@gusto/embedded-api-v-2026-02-01/models/errors/unprocessableentityerror'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { useTranslation } from 'react-i18next'\nimport { PolicySettingsPresentation } from './PolicySettingsPresentation'\nimport type { PolicySettingsFormData, PolicySettingsAccrualMethod } from './PolicySettingsTypes'\nimport { BaseComponent, type BaseComponentInterface } from '@/components/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { SDKInternalError } from '@/types/sdkError'\nimport { componentEvents } from '@/shared/constants'\nimport { useI18n } from '@/i18n'\n\n/**\n * Props for {@link PolicySettings}.\n *\n * @public\n */\nexport interface PolicySettingsProps extends BaseComponentInterface<'Company.TimeOff.CreateTimeOffPolicy'> {\n /** UUID of the time off policy being configured. */\n policyId: string\n /** Whether the form is being used to create a new policy or edit an existing one. Defaults to create. */\n mode?: 'create' | 'edit'\n}\n\n/**\n * Configures additional policy limits and rules for a sick or vacation policy. This step is skipped for policies with unlimited accrual.\n *\n * @remarks\n * Fetches the time off policy, derives the accrual method category, and submits updates to the time off policies endpoint. Emits the following events:\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `timeOff/policySettings/done` | Fired when policy settings are saved | The updated `TimeOffPolicy` |\n * | `timeOff/policySettings/back` | Fired when the user navigates back | — |\n *\n * @param props - {@link PolicySettingsProps}\n * @returns The rendered policy settings form.\n * @public\n */\nexport function PolicySettings(props: PolicySettingsProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nconst HOURLY_ACCRUAL_METHODS = [\n 'per_hour_worked',\n 'per_hour_worked_no_overtime',\n 'per_hour_paid',\n 'per_hour_paid_no_overtime',\n]\n\nconst ALL_AT_ONCE_ACCRUAL_METHODS = ['per_anniversary_year', 'per_calendar_year']\n\nfunction deriveAccrualMethodCategory(apiAccrualMethod: string): PolicySettingsAccrualMethod {\n if (HOURLY_ACCRUAL_METHODS.includes(apiAccrualMethod)) return 'hours_worked'\n if (ALL_AT_ONCE_ACCRUAL_METHODS.includes(apiAccrualMethod)) return 'fixed_all_at_once'\n return 'fixed_per_pay_period'\n}\n\nfunction deriveDefaultValues(policy: TimeOffPolicy): Partial<PolicySettingsFormData> {\n const defaults: Partial<PolicySettingsFormData> = {}\n\n if (policy.maxAccrualHoursPerYear != null) {\n defaults.accrualMaximumEnabled = true\n defaults.accrualMaximum = Number(policy.maxAccrualHoursPerYear)\n }\n\n if (policy.maxHours != null) {\n defaults.balanceMaximumEnabled = true\n defaults.balanceMaximum = Number(policy.maxHours)\n }\n\n if (policy.carryoverLimitHours != null) {\n defaults.carryOverLimitEnabled = true\n defaults.carryOverLimit = Number(policy.carryoverLimitHours)\n }\n\n if (policy.accrualWaitingPeriodDays != null && policy.accrualWaitingPeriodDays > 0) {\n defaults.waitingPeriodEnabled = true\n defaults.waitingPeriod = policy.accrualWaitingPeriodDays\n }\n\n if (policy.paidOutOnTermination != null) {\n defaults.paidOutOnTermination = policy.paidOutOnTermination\n }\n\n return defaults\n}\n\nfunction buildUpdateRequestBody(\n data: PolicySettingsFormData,\n version: string,\n accrualCategory: PolicySettingsAccrualMethod,\n): PutV1TimeOffPoliciesTimeOffPolicyUuidRequestBody {\n const isAllAtOnce = accrualCategory === 'fixed_all_at_once'\n\n return {\n maxAccrualHoursPerYear:\n !isAllAtOnce && data.accrualMaximumEnabled && data.accrualMaximum != null\n ? String(data.accrualMaximum)\n : null,\n maxHours:\n data.balanceMaximumEnabled && data.balanceMaximum != null\n ? String(data.balanceMaximum)\n : null,\n carryoverLimitHours:\n data.carryOverLimitEnabled && data.carryOverLimit != null\n ? String(data.carryOverLimit)\n : null,\n accrualWaitingPeriodDays:\n !isAllAtOnce && data.waitingPeriodEnabled && data.waitingPeriod != null\n ? data.waitingPeriod\n : null,\n paidOutOnTermination: data.paidOutOnTermination,\n version,\n }\n}\n\nfunction Root({ policyId, mode }: PolicySettingsProps) {\n useI18n('Company.TimeOff.CreateTimeOffPolicy')\n const { t } = useTranslation('Company.TimeOff.CreateTimeOffPolicy')\n const { onEvent, baseSubmitHandler } = useBase()\n const queryClient = useQueryClient()\n\n const { data: policyResponse } = useTimeOffPoliciesGetSuspense({\n timeOffPolicyUuid: policyId,\n })\n\n const { mutateAsync: updateTimeOffPolicy, isPending } = useTimeOffPoliciesUpdateMutation()\n\n const policy = policyResponse.timeOffPolicy\n if (!policy) throw new Error('Unexpected response: missing timeOffPolicy')\n\n const accrualCategory = deriveAccrualMethodCategory(policy.accrualMethod)\n const version = policy.version ?? ''\n\n const handleContinue = async (data: PolicySettingsFormData) => {\n await baseSubmitHandler(data, async () => {\n try {\n const { timeOffPolicy } = await updateTimeOffPolicy({\n request: {\n timeOffPolicyUuid: policyId,\n requestBody: buildUpdateRequestBody(data, version, accrualCategory),\n },\n })\n\n void queryClient.invalidateQueries({\n queryKey: ['@gusto/embedded-api-v-2026-02-01', 'timeOffPolicies', 'get'],\n })\n onEvent(componentEvents.TIME_OFF_POLICY_SETTINGS_DONE, timeOffPolicy)\n } catch (err) {\n if (err instanceof UnprocessableEntityError) {\n if (err.errors.some(e => e.message === 'LIMIT_VIOLATION_MAX_HOURS')) {\n throw new SDKInternalError(\n t('policySettings.errors.balanceExceedsMaximum'),\n 'api_error',\n )\n }\n const uniqueMessages = [...new Set(err.errors.map(e => e.message).filter(Boolean))]\n throw new SDKInternalError(\n t('errors.updatePolicySettingsFailed', {\n details: uniqueMessages.join('. '),\n }),\n 'api_error',\n )\n }\n throw err\n }\n })\n }\n\n const handleBack = () => {\n onEvent(componentEvents.TIME_OFF_POLICY_SETTINGS_BACK)\n }\n\n return (\n <PolicySettingsPresentation\n accrualMethod={accrualCategory}\n onContinue={handleContinue}\n onBack={handleBack}\n defaultValues={deriveDefaultValues(policy)}\n mode={mode}\n editingPolicyName={mode === 'edit' ? policy.name : undefined}\n isPending={isPending}\n />\n )\n}\n"],"names":["PolicySettings","props","jsx","BaseComponent","Root","HOURLY_ACCRUAL_METHODS","ALL_AT_ONCE_ACCRUAL_METHODS","deriveAccrualMethodCategory","apiAccrualMethod","deriveDefaultValues","policy","defaults","buildUpdateRequestBody","data","version","accrualCategory","isAllAtOnce","policyId","mode","useI18n","t","useTranslation","onEvent","baseSubmitHandler","useBase","queryClient","useQueryClient","policyResponse","useTimeOffPoliciesGetSuspense","updateTimeOffPolicy","isPending","useTimeOffPoliciesUpdateMutation","PolicySettingsPresentation","timeOffPolicy","componentEvents","err","UnprocessableEntityError","e","SDKInternalError","uniqueMessages"],"mappings":";;;;;;;;;;;;AA2CO,SAASA,EAAeC,GAA4B;AACzD,SACE,gBAAAC,EAACC,KAAe,GAAGF,GACjB,4BAACG,GAAA,EAAM,GAAGH,GAAO,EAAA,CACnB;AAEJ;AAEA,MAAMI,IAAyB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAEMC,IAA8B,CAAC,wBAAwB,mBAAmB;AAEhF,SAASC,EAA4BC,GAAuD;AAC1F,SAAIH,EAAuB,SAASG,CAAgB,IAAU,iBAC1DF,EAA4B,SAASE,CAAgB,IAAU,sBAC5D;AACT;AAEA,SAASC,EAAoBC,GAAwD;AACnF,QAAMC,IAA4C,CAAA;AAElD,SAAID,EAAO,0BAA0B,SACnCC,EAAS,wBAAwB,IACjCA,EAAS,iBAAiB,OAAOD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AA,IAAA;AAAA,EAAA;AAGN;"}
|
|
1
|
+
{"version":3,"file":"PolicySettings.js","sources":["../../../../src/components/TimeOff/PolicySettings/PolicySettings.tsx"],"sourcesContent":["import { useTimeOffPoliciesGetSuspense } from '@gusto/embedded-api/react-query/timeOffPoliciesGet'\nimport { useTimeOffPoliciesUpdateMutation } from '@gusto/embedded-api/react-query/timeOffPoliciesUpdate'\nimport type { PutV1TimeOffPoliciesTimeOffPolicyUuidRequestBody } from '@gusto/embedded-api/models/operations/putv1timeoffpoliciestimeoffpolicyuuid'\nimport type { TimeOffPolicy } from '@gusto/embedded-api/models/components/timeoffpolicy'\nimport { UnprocessableEntityError } from '@gusto/embedded-api/models/errors/unprocessableentityerror'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { useTranslation } from 'react-i18next'\nimport { PolicySettingsPresentation } from './PolicySettingsPresentation'\nimport type { PolicySettingsFormData, PolicySettingsAccrualMethod } from './PolicySettingsTypes'\nimport { API_QUERY_NAMESPACE } from '@/contexts/ApiProvider/apiVersion'\nimport { BaseComponent, type BaseComponentInterface } from '@/components/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { SDKInternalError } from '@/types/sdkError'\nimport { componentEvents } from '@/shared/constants'\nimport { useI18n } from '@/i18n'\n\n/**\n * Props for {@link PolicySettings}.\n *\n * @public\n */\nexport interface PolicySettingsProps extends BaseComponentInterface<'Company.TimeOff.CreateTimeOffPolicy'> {\n /** UUID of the time off policy being configured. */\n policyId: string\n /** Whether the form is being used to create a new policy or edit an existing one. Defaults to create. */\n mode?: 'create' | 'edit'\n}\n\n/**\n * Configures additional policy limits and rules for a sick or vacation policy. This step is skipped for policies with unlimited accrual.\n *\n * @remarks\n * Fetches the time off policy, derives the accrual method category, and submits updates to the time off policies endpoint. Emits the following events:\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `timeOff/policySettings/done` | Fired when policy settings are saved | The updated `TimeOffPolicy` |\n * | `timeOff/policySettings/back` | Fired when the user navigates back | — |\n *\n * @param props - {@link PolicySettingsProps}\n * @returns The rendered policy settings form.\n * @public\n */\nexport function PolicySettings(props: PolicySettingsProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nconst HOURLY_ACCRUAL_METHODS = [\n 'per_hour_worked',\n 'per_hour_worked_no_overtime',\n 'per_hour_paid',\n 'per_hour_paid_no_overtime',\n]\n\nconst ALL_AT_ONCE_ACCRUAL_METHODS = ['per_anniversary_year', 'per_calendar_year']\n\nfunction deriveAccrualMethodCategory(apiAccrualMethod: string): PolicySettingsAccrualMethod {\n if (HOURLY_ACCRUAL_METHODS.includes(apiAccrualMethod)) return 'hours_worked'\n if (ALL_AT_ONCE_ACCRUAL_METHODS.includes(apiAccrualMethod)) return 'fixed_all_at_once'\n return 'fixed_per_pay_period'\n}\n\nfunction deriveDefaultValues(policy: TimeOffPolicy): Partial<PolicySettingsFormData> {\n const defaults: Partial<PolicySettingsFormData> = {}\n\n if (policy.maxAccrualHoursPerYear != null) {\n defaults.accrualMaximumEnabled = true\n defaults.accrualMaximum = Number(policy.maxAccrualHoursPerYear)\n }\n\n if (policy.maxHours != null) {\n defaults.balanceMaximumEnabled = true\n defaults.balanceMaximum = Number(policy.maxHours)\n }\n\n if (policy.carryoverLimitHours != null) {\n defaults.carryOverLimitEnabled = true\n defaults.carryOverLimit = Number(policy.carryoverLimitHours)\n }\n\n if (policy.accrualWaitingPeriodDays != null && policy.accrualWaitingPeriodDays > 0) {\n defaults.waitingPeriodEnabled = true\n defaults.waitingPeriod = policy.accrualWaitingPeriodDays\n }\n\n if (policy.paidOutOnTermination != null) {\n defaults.paidOutOnTermination = policy.paidOutOnTermination\n }\n\n return defaults\n}\n\nfunction buildUpdateRequestBody(\n data: PolicySettingsFormData,\n version: string,\n accrualCategory: PolicySettingsAccrualMethod,\n): PutV1TimeOffPoliciesTimeOffPolicyUuidRequestBody {\n const isAllAtOnce = accrualCategory === 'fixed_all_at_once'\n\n return {\n maxAccrualHoursPerYear:\n !isAllAtOnce && data.accrualMaximumEnabled && data.accrualMaximum != null\n ? String(data.accrualMaximum)\n : null,\n maxHours:\n data.balanceMaximumEnabled && data.balanceMaximum != null\n ? String(data.balanceMaximum)\n : null,\n carryoverLimitHours:\n data.carryOverLimitEnabled && data.carryOverLimit != null\n ? String(data.carryOverLimit)\n : null,\n accrualWaitingPeriodDays:\n !isAllAtOnce && data.waitingPeriodEnabled && data.waitingPeriod != null\n ? data.waitingPeriod\n : null,\n paidOutOnTermination: data.paidOutOnTermination,\n version,\n }\n}\n\nfunction Root({ policyId, mode }: PolicySettingsProps) {\n useI18n('Company.TimeOff.CreateTimeOffPolicy')\n const { t } = useTranslation('Company.TimeOff.CreateTimeOffPolicy')\n const { onEvent, baseSubmitHandler } = useBase()\n const queryClient = useQueryClient()\n\n const { data: policyResponse } = useTimeOffPoliciesGetSuspense({\n timeOffPolicyUuid: policyId,\n })\n\n const { mutateAsync: updateTimeOffPolicy, isPending } = useTimeOffPoliciesUpdateMutation()\n\n const policy = policyResponse.timeOffPolicy\n if (!policy) throw new Error('Unexpected response: missing timeOffPolicy')\n\n const accrualCategory = deriveAccrualMethodCategory(policy.accrualMethod)\n const version = policy.version ?? ''\n\n const handleContinue = async (data: PolicySettingsFormData) => {\n await baseSubmitHandler(data, async () => {\n try {\n const { timeOffPolicy } = await updateTimeOffPolicy({\n request: {\n timeOffPolicyUuid: policyId,\n requestBody: buildUpdateRequestBody(data, version, accrualCategory),\n },\n })\n\n void queryClient.invalidateQueries({\n queryKey: [API_QUERY_NAMESPACE, 'timeOffPolicies', 'get'],\n })\n onEvent(componentEvents.TIME_OFF_POLICY_SETTINGS_DONE, timeOffPolicy)\n } catch (err) {\n if (err instanceof UnprocessableEntityError) {\n if (err.errors.some(e => e.message === 'LIMIT_VIOLATION_MAX_HOURS')) {\n throw new SDKInternalError(\n t('policySettings.errors.balanceExceedsMaximum'),\n 'api_error',\n )\n }\n const uniqueMessages = [...new Set(err.errors.map(e => e.message).filter(Boolean))]\n throw new SDKInternalError(\n t('errors.updatePolicySettingsFailed', {\n details: uniqueMessages.join('. '),\n }),\n 'api_error',\n )\n }\n throw err\n }\n })\n }\n\n const handleBack = () => {\n onEvent(componentEvents.TIME_OFF_POLICY_SETTINGS_BACK)\n }\n\n return (\n <PolicySettingsPresentation\n accrualMethod={accrualCategory}\n onContinue={handleContinue}\n onBack={handleBack}\n defaultValues={deriveDefaultValues(policy)}\n mode={mode}\n editingPolicyName={mode === 'edit' ? policy.name : undefined}\n isPending={isPending}\n />\n )\n}\n"],"names":["PolicySettings","props","jsx","BaseComponent","Root","HOURLY_ACCRUAL_METHODS","ALL_AT_ONCE_ACCRUAL_METHODS","deriveAccrualMethodCategory","apiAccrualMethod","deriveDefaultValues","policy","defaults","buildUpdateRequestBody","data","version","accrualCategory","isAllAtOnce","policyId","mode","useI18n","t","useTranslation","onEvent","baseSubmitHandler","useBase","queryClient","useQueryClient","policyResponse","useTimeOffPoliciesGetSuspense","updateTimeOffPolicy","isPending","useTimeOffPoliciesUpdateMutation","PolicySettingsPresentation","timeOffPolicy","API_QUERY_NAMESPACE","componentEvents","err","UnprocessableEntityError","e","SDKInternalError","uniqueMessages"],"mappings":";;;;;;;;;;;;;AA4CO,SAASA,EAAeC,GAA4B;AACzD,SACE,gBAAAC,EAACC,KAAe,GAAGF,GACjB,4BAACG,GAAA,EAAM,GAAGH,GAAO,EAAA,CACnB;AAEJ;AAEA,MAAMI,IAAyB;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAEMC,IAA8B,CAAC,wBAAwB,mBAAmB;AAEhF,SAASC,EAA4BC,GAAuD;AAC1F,SAAIH,EAAuB,SAASG,CAAgB,IAAU,iBAC1DF,EAA4B,SAASE,CAAgB,IAAU,sBAC5D;AACT;AAEA,SAASC,EAAoBC,GAAwD;AACnF,QAAMC,IAA4C,CAAA;AAElD,SAAID,EAAO,0BAA0B,SACnCC,EAAS,wBAAwB,IACjCA,E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AA,MACnD,WAAAoB;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { useHolidayPayPoliciesGet as l } from "@gusto/embedded-api
|
|
2
|
+
import { useHolidayPayPoliciesGet as l } from "@gusto/embedded-api/react-query/holidayPayPoliciesGet";
|
|
3
3
|
import { PolicyTypeSelectorPresentation as c } from "./PolicyTypeSelectorPresentation.js";
|
|
4
4
|
import { BaseComponent as y } from "../../Base/Base.js";
|
|
5
5
|
import { useBase as m } from "../../Base/useBase.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolicyTypeSelector.js","sources":["../../../../src/components/TimeOff/PolicyTypeSelector/PolicyTypeSelector.tsx"],"sourcesContent":["import { useHolidayPayPoliciesGet } from '@gusto/embedded-api
|
|
1
|
+
{"version":3,"file":"PolicyTypeSelector.js","sources":["../../../../src/components/TimeOff/PolicyTypeSelector/PolicyTypeSelector.tsx"],"sourcesContent":["import { useHolidayPayPoliciesGet } from '@gusto/embedded-api/react-query/holidayPayPoliciesGet'\nimport { PolicyTypeSelectorPresentation } from './PolicyTypeSelectorPresentation'\nimport type { PolicyType } from './PolicyTypeSelectorTypes'\nimport { BaseComponent, type BaseComponentInterface } from '@/components/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { componentEvents } from '@/shared/constants'\n\n/**\n * Props for {@link PolicyTypeSelector}.\n *\n * @public\n */\nexport interface PolicyTypeSelectorProps extends BaseComponentInterface<'Company.TimeOff.SelectPolicyType'> {\n /** The associated company identifier. */\n companyId: string\n /** Pre-selected policy type rendered when the form mounts. */\n defaultPolicyType?: PolicyType\n}\n\n/**\n * Selection screen for choosing which kind of time-off policy to create — sick, vacation, or holiday.\n *\n * @remarks\n * The holiday option is omitted when the company already has a holiday pay policy, since a company\n * can only have one.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `timeOff/policyTypeSelected` | The user confirms a selection | `{ policyType: {@link PolicyType} }` |\n * | `CANCEL` | The user cancels | — |\n *\n * @param props - See {@link PolicyTypeSelectorProps}.\n * @returns The rendered policy type selection screen.\n * @public\n */\nexport function PolicyTypeSelector(props: PolicyTypeSelectorProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nfunction Root({ companyId, defaultPolicyType }: PolicyTypeSelectorProps) {\n const { onEvent } = useBase()\n\n const holidayQuery = useHolidayPayPoliciesGet({ companyUuid: companyId })\n const holidayPolicyExists = Boolean(holidayQuery.data?.holidayPayPolicy)\n\n const handleContinue = (policyType: PolicyType) => {\n onEvent(componentEvents.TIME_OFF_POLICY_TYPE_SELECTED, {\n policyType,\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.CANCEL)\n }\n\n return (\n <PolicyTypeSelectorPresentation\n onContinue={handleContinue}\n onCancel={handleCancel}\n defaultPolicyType={defaultPolicyType}\n holidayPolicyExists={holidayPolicyExists}\n />\n )\n}\n"],"names":["PolicyTypeSelector","props","jsx","BaseComponent","Root","companyId","defaultPolicyType","onEvent","useBase","holidayPolicyExists","useHolidayPayPoliciesGet","PolicyTypeSelectorPresentation","policyType","componentEvents"],"mappings":";;;;;;AAoCO,SAASA,EAAmBC,GAAgC;AACjE,SACE,gBAAAC,EAACC,KAAe,GAAGF,GACjB,4BAACG,GAAA,EAAM,GAAGH,GAAO,EAAA,CACnB;AAEJ;AAEA,SAASG,EAAK,EAAE,WAAAC,GAAW,mBAAAC,KAA8C;AACvE,QAAM,EAAE,SAAAC,EAAA,IAAYC,EAAA,GAGdC,IAAsB,EADPC,EAAyB,EAAE,aAAaL,GAAW,EACvB,MAAM;AAYvD,SACE,gBAAAH;AAAA,IAACS;AAAA,IAAA;AAAA,MACC,YAZmB,CAACC,MAA2B;AACjD,QAAAL,EAAQM,EAAgB,+BAA+B;AAAA,UACrD,YAAAD;AAAA,QAAA,CACD;AAAA,MACH;AAAA,MASI,UAPiB,MAAM;AACzB,QAAAL,EAAQM,EAAgB,MAAM;AAAA,MAChC;AAAA,MAMI,mBAAAP;AAAA,MACA,qBAAAG;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PolicyType } from '@gusto/embedded-api
|
|
1
|
+
import { PolicyType } from '@gusto/embedded-api/models/components/timeoffpolicy';
|
|
2
2
|
/**
|
|
3
3
|
* Time off policy types that can be created through the time off policy management workflow.
|
|
4
4
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeOffPolicyTypes.js","sources":["../../../../src/components/TimeOff/TimeOffFlow/timeOffPolicyTypes.ts"],"sourcesContent":["import type { PolicyType } from '@gusto/embedded-api
|
|
1
|
+
{"version":3,"file":"timeOffPolicyTypes.js","sources":["../../../../src/components/TimeOff/TimeOffFlow/timeOffPolicyTypes.ts"],"sourcesContent":["import type { PolicyType } from '@gusto/embedded-api/models/components/timeoffpolicy'\n\n/**\n * Time off policy types that can be created through the time off policy management workflow.\n *\n * @remarks\n * Only `sick` and `vacation` are creatable through the time off policy endpoint. Holiday policies are a separate concept managed through the holiday pay policy endpoint family.\n *\n * @public\n */\nexport type CreatableTimeOffPolicyType = Extract<PolicyType, 'sick' | 'vacation'>\n\n/** @internal */\nexport type TimeOffPolicyType = PolicyType | 'holiday'\n\nconst EDITABLE_TIME_OFF_POLICY_TYPES = ['sick', 'vacation', 'holiday'] as const\n\n/** @internal */\nexport type EditableTimeOffPolicyType = (typeof EDITABLE_TIME_OFF_POLICY_TYPES)[number]\n\n/** @internal */\nexport function isEditableTimeOffPolicyType(\n policyType: string | null | undefined,\n): policyType is EditableTimeOffPolicyType {\n return EDITABLE_TIME_OFF_POLICY_TYPES.includes(policyType as EditableTimeOffPolicyType)\n}\n\n// Subset of types the SDK surfaces from the time_off_policies endpoint.\n// Holiday lives on a separate endpoint and is merged into the list by the caller.\nconst LISTED_TIME_OFF_POLICY_TYPES = ['sick', 'vacation'] as const satisfies readonly PolicyType[]\n\n/** @internal */\nexport function isListedTimeOffPolicyType(\n policyType: PolicyType | null | undefined,\n): policyType is CreatableTimeOffPolicyType {\n return LISTED_TIME_OFF_POLICY_TYPES.includes(policyType as CreatableTimeOffPolicyType)\n}\n\n/** @internal */\nexport function assertCreatablePolicyType(\n policyType: TimeOffPolicyType,\n): asserts policyType is CreatableTimeOffPolicyType {\n if (policyType !== 'sick' && policyType !== 'vacation') {\n throw new Error(\n `Expected creatable time-off policy type ('sick' or 'vacation'), got '${policyType}'`,\n )\n }\n}\n"],"names":["EDITABLE_TIME_OFF_POLICY_TYPES","isEditableTimeOffPolicyType","policyType","LISTED_TIME_OFF_POLICY_TYPES","isListedTimeOffPolicyType","assertCreatablePolicyType"],"mappings":"AAeA,MAAMA,IAAiC,CAAC,QAAQ,YAAY,SAAS;AAM9D,SAASC,EACdC,GACyC;AACzC,SAAOF,EAA+B,SAASE,CAAuC;AACxF;AAIA,MAAMC,IAA+B,CAAC,QAAQ,UAAU;AAGjD,SAASC,EACdF,GAC0C;AAC1C,SAAOC,EAA6B,SAASD,CAAwC;AACvF;AAGO,SAASG,EACdH,GACkD;AAClD,MAAIA,MAAe,UAAUA,MAAe;AAC1C,UAAM,IAAI;AAAA,MACR,wEAAwEA,CAAU;AAAA,IAAA;AAGxF;"}
|
package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationForm.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { jsx as u } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback as m } from "react";
|
|
3
|
-
import { useTimeOffPoliciesCreateMutation as
|
|
4
|
-
import { useTimeOffPoliciesUpdateMutation as w } from "@gusto/embedded-api
|
|
5
|
-
import { useTimeOffPoliciesGetSuspense as
|
|
6
|
-
import { useQueryClient as
|
|
3
|
+
import { useTimeOffPoliciesCreateMutation as E } from "@gusto/embedded-api/react-query/timeOffPoliciesCreate";
|
|
4
|
+
import { useTimeOffPoliciesUpdateMutation as w } from "@gusto/embedded-api/react-query/timeOffPoliciesUpdate";
|
|
5
|
+
import { useTimeOffPoliciesGetSuspense as g } from "@gusto/embedded-api/react-query/timeOffPoliciesGet";
|
|
6
|
+
import { useQueryClient as b } from "@tanstack/react-query";
|
|
7
7
|
import { PolicyConfigurationFormPresentation as R } from "./PolicyConfigurationFormPresentation.js";
|
|
8
|
-
import {
|
|
8
|
+
import { API_QUERY_NAMESPACE as A } from "../../../../contexts/ApiProvider/apiVersion.js";
|
|
9
|
+
import { BaseComponent as S } from "../../../Base/Base.js";
|
|
9
10
|
import { useBase as v } from "../../../Base/useBase.js";
|
|
10
11
|
import { componentEvents as p } from "../../../../shared/constants.js";
|
|
11
12
|
import { formatMonthDay as M } from "../../../../helpers/dateFormatting.js";
|
|
12
|
-
function
|
|
13
|
-
return /* @__PURE__ */ u(
|
|
13
|
+
function X(e) {
|
|
14
|
+
return /* @__PURE__ */ u(S, { ...e, children: /* @__PURE__ */ u(q, { ...e }) });
|
|
14
15
|
}
|
|
15
|
-
function
|
|
16
|
+
function C(e) {
|
|
16
17
|
switch (e.accrualMethod) {
|
|
17
18
|
case "unlimited":
|
|
18
19
|
return "unlimited";
|
|
@@ -24,7 +25,7 @@ function D(e) {
|
|
|
24
25
|
return e.accrualMethodFixed === "per_pay_period" ? "per_pay_period" : e.resetDateType === "per_anniversary_year" ? "per_anniversary_year" : "per_calendar_year";
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
|
-
const
|
|
28
|
+
const T = [
|
|
28
29
|
"per_hour_paid",
|
|
29
30
|
"per_hour_paid_no_overtime",
|
|
30
31
|
"per_hour_worked",
|
|
@@ -32,14 +33,14 @@ const S = [
|
|
|
32
33
|
];
|
|
33
34
|
function k(e) {
|
|
34
35
|
const r = { name: e.name }, t = e.accrualMethod;
|
|
35
|
-
if (t === "unlimited" ? r.accrualMethod = "unlimited" :
|
|
36
|
+
if (t === "unlimited" ? r.accrualMethod = "unlimited" : T.includes(t) ? (r.accrualMethod = "per_hour_paid", r.allPaidHours = t === "per_hour_paid" || t === "per_hour_paid_no_overtime", r.includeOvertime = t === "per_hour_paid" || t === "per_hour_worked", e.accrualRate != null && (r.accrualRate = Number(e.accrualRate)), e.accrualRateUnit != null && (r.accrualRateUnit = Number(e.accrualRateUnit)), e.policyResetDate && (r.resetDateType = "per_calendar_year")) : (r.accrualMethod = "per_calendar_year", t === "per_pay_period" ? (r.accrualMethodFixed = "per_pay_period", r.resetDateType = e.policyResetDate ? "per_calendar_year" : "per_anniversary_year") : (r.accrualMethodFixed = "all_at_once", r.resetDateType = t === "per_anniversary_year" ? "per_anniversary_year" : "per_calendar_year"), e.accrualRate != null && (r.accrualRate = Number(e.accrualRate))), e.policyResetDate) {
|
|
36
37
|
const [a, n] = e.policyResetDate.split("-").map(Number);
|
|
37
38
|
a && (r.resetMonth = a), n && (r.resetDay = n);
|
|
38
39
|
}
|
|
39
40
|
return r;
|
|
40
41
|
}
|
|
41
|
-
function
|
|
42
|
-
const t =
|
|
42
|
+
function F(e, r) {
|
|
43
|
+
const t = C(e), a = { name: e.name, policyType: r, accrualMethod: t };
|
|
43
44
|
if (t === "unlimited")
|
|
44
45
|
return { ...a, complete: !0 };
|
|
45
46
|
const n = t === "per_hour_paid" || t === "per_hour_paid_no_overtime" || t === "per_hour_worked" || t === "per_hour_worked_no_overtime", o = e.resetDateType === "per_calendar_year" ? M(e.resetMonth, e.resetDay) : null;
|
|
@@ -57,8 +58,8 @@ function A(e, r) {
|
|
|
57
58
|
complete: !1
|
|
58
59
|
};
|
|
59
60
|
}
|
|
60
|
-
function
|
|
61
|
-
const a =
|
|
61
|
+
function N(e, r, t) {
|
|
62
|
+
const a = C(e), n = {
|
|
62
63
|
name: e.name,
|
|
63
64
|
policyType: r,
|
|
64
65
|
accrualMethod: a,
|
|
@@ -86,20 +87,20 @@ function F(e, r, t) {
|
|
|
86
87
|
}
|
|
87
88
|
function q({ companyId: e, policyType: r, defaultValues: t, policyId: a }) {
|
|
88
89
|
return a ? /* @__PURE__ */ u(
|
|
89
|
-
|
|
90
|
+
L,
|
|
90
91
|
{
|
|
91
92
|
companyId: e,
|
|
92
93
|
policyType: r,
|
|
93
94
|
policyId: a,
|
|
94
95
|
defaultValues: t
|
|
95
96
|
}
|
|
96
|
-
) : /* @__PURE__ */ u(
|
|
97
|
+
) : /* @__PURE__ */ u(H, { companyId: e, policyType: r, defaultValues: t });
|
|
97
98
|
}
|
|
98
|
-
function
|
|
99
|
-
const { onEvent: a, baseSubmitHandler: n } = v(), { mutateAsync: o, isPending: c } =
|
|
99
|
+
function H({ companyId: e, policyType: r, defaultValues: t }) {
|
|
100
|
+
const { onEvent: a, baseSubmitHandler: n } = v(), { mutateAsync: o, isPending: c } = E(), d = m(
|
|
100
101
|
async (s) => {
|
|
101
102
|
await n(s, async () => {
|
|
102
|
-
const i =
|
|
103
|
+
const i = F(s, r), _ = await o({
|
|
103
104
|
request: {
|
|
104
105
|
companyUuid: e,
|
|
105
106
|
timeOffPolicyRequest: i
|
|
@@ -125,22 +126,22 @@ function N({ companyId: e, policyType: r, defaultValues: t }) {
|
|
|
125
126
|
}
|
|
126
127
|
);
|
|
127
128
|
}
|
|
128
|
-
function
|
|
129
|
-
const { onEvent: n, baseSubmitHandler: o } = v(), c =
|
|
129
|
+
function L({ companyId: e, policyType: r, policyId: t, defaultValues: a }) {
|
|
130
|
+
const { onEvent: n, baseSubmitHandler: o } = v(), c = b(), { data: d } = g({
|
|
130
131
|
timeOffPolicyUuid: t
|
|
131
132
|
}), { mutateAsync: l, isPending: s } = w(), i = d.timeOffPolicy;
|
|
132
133
|
if (!i) throw new Error("Unexpected response: missing timeOffPolicy");
|
|
133
|
-
const _ = i.version ?? "", f = k(i),
|
|
134
|
+
const _ = i.version ?? "", f = k(i), D = { ...f, ...a }, P = i.complete ? f.accrualMethod === "unlimited" ? "unlimited" : "accrual_based" : void 0, O = m(
|
|
134
135
|
async (h) => {
|
|
135
136
|
await o(h, async () => {
|
|
136
|
-
const y =
|
|
137
|
+
const y = N(h, r, _);
|
|
137
138
|
await l({
|
|
138
139
|
request: {
|
|
139
140
|
timeOffPolicyUuid: t,
|
|
140
141
|
requestBody: y
|
|
141
142
|
}
|
|
142
143
|
}), c.invalidateQueries({
|
|
143
|
-
queryKey: [
|
|
144
|
+
queryKey: [A, "timeOffPolicies", "get"]
|
|
144
145
|
}), n(p.TIME_OFF_POLICY_DETAILS_DONE, {
|
|
145
146
|
policyId: t,
|
|
146
147
|
accrualMethod: y.accrualMethod
|
|
@@ -156,7 +157,7 @@ function H({ companyId: e, policyType: r, policyId: t, defaultValues: a }) {
|
|
|
156
157
|
{
|
|
157
158
|
onContinue: O,
|
|
158
159
|
onCancel: U,
|
|
159
|
-
defaultValues:
|
|
160
|
+
defaultValues: D,
|
|
160
161
|
editingPolicyName: i.name,
|
|
161
162
|
isPending: s,
|
|
162
163
|
lockedAccrualCategory: P
|
|
@@ -164,6 +165,6 @@ function H({ companyId: e, policyType: r, policyId: t, defaultValues: a }) {
|
|
|
164
165
|
);
|
|
165
166
|
}
|
|
166
167
|
export {
|
|
167
|
-
|
|
168
|
+
X as PolicyConfigurationForm
|
|
168
169
|
};
|
|
169
170
|
//# sourceMappingURL=PolicyConfigurationForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolicyConfigurationForm.js","sources":["../../../../../src/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationForm.tsx"],"sourcesContent":["import { useCallback } from 'react'\nimport { useTimeOffPoliciesCreateMutation } from '@gusto/embedded-api-v-2026-02-01/react-query/timeOffPoliciesCreate'\nimport { useTimeOffPoliciesUpdateMutation } from '@gusto/embedded-api-v-2026-02-01/react-query/timeOffPoliciesUpdate'\nimport { useTimeOffPoliciesGetSuspense } from '@gusto/embedded-api-v-2026-02-01/react-query/timeOffPoliciesGet'\nimport type { TimeOffPolicyRequest } from '@gusto/embedded-api-v-2026-02-01/models/components/timeoffpolicyrequest'\nimport type { TimeOffPolicy } from '@gusto/embedded-api-v-2026-02-01/models/components/timeoffpolicy'\nimport type { PutV1TimeOffPoliciesTimeOffPolicyUuidRequestBody } from '@gusto/embedded-api-v-2026-02-01/models/operations/putv1timeoffpoliciestimeoffpolicyuuid'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { PolicyConfigurationFormPresentation } from './PolicyConfigurationFormPresentation'\nimport type { PolicyConfigurationFormData } from './PolicyConfigurationFormTypes'\nimport { BaseComponent, type BaseComponentInterface } from '@/components/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { componentEvents } from '@/shared/constants'\nimport { formatMonthDay } from '@/helpers/dateFormatting'\n\n/**\n * Props for {@link PolicyConfigurationForm}.\n *\n * @public\n */\nexport interface PolicyConfigurationFormProps extends BaseComponentInterface<'Company.TimeOff.CreateTimeOffPolicy'> {\n /** Company that owns the policy being created or edited. */\n companyId: string\n /** Type of policy being configured. */\n policyType: 'sick' | 'vacation'\n /** When set, the form loads the existing policy and submits an update. */\n policyId?: string\n /** Pre-populated values to merge into the form's defaults. */\n defaultValues?: Partial<PolicyConfigurationFormData>\n}\n\n/**\n * Form for creating or editing the details of a sick or vacation time off policy — its name and accrual configuration.\n *\n * @remarks\n * Omit `policyId` to create a new policy; pass `policyId` to edit an existing\n * one. In edit mode, the form fetches the policy via Suspense and merges the\n * derived defaults with any `defaultValues` you supply (your overrides win).\n * When editing a policy whose configuration is already complete, the accrual\n * method selector is restricted to the matching category (unlimited vs.\n * accrual-based).\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `timeOff/policyDetails/done` | Fired after the policy is successfully created or updated | `{ policyId: string, accrualMethod: string }` |\n * | `CANCEL` | Fired when the user clicks the cancel button | — |\n *\n * @param props - See {@link PolicyConfigurationFormProps}.\n * @returns The rendered policy configuration form.\n * @public\n */\nexport function PolicyConfigurationForm(props: PolicyConfigurationFormProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nfunction resolveApiAccrualMethod(\n data: PolicyConfigurationFormData,\n): TimeOffPolicyRequest['accrualMethod'] {\n switch (data.accrualMethod) {\n case 'unlimited':\n return 'unlimited'\n\n case 'per_hour_paid': {\n const paid = data.allPaidHours ?? false\n const overtime = data.includeOvertime ?? false\n\n if (paid && overtime) return 'per_hour_paid'\n if (paid && !overtime) return 'per_hour_paid_no_overtime'\n if (!paid && overtime) return 'per_hour_worked'\n return 'per_hour_worked_no_overtime'\n }\n\n case 'per_calendar_year': {\n if (data.accrualMethodFixed === 'per_pay_period') return 'per_pay_period'\n\n return data.resetDateType === 'per_anniversary_year'\n ? 'per_anniversary_year'\n : 'per_calendar_year'\n }\n }\n}\n\nconst HOURLY_API_METHODS = [\n 'per_hour_paid',\n 'per_hour_paid_no_overtime',\n 'per_hour_worked',\n 'per_hour_worked_no_overtime',\n]\n\nfunction deriveFormDefaults(policy: TimeOffPolicy): Partial<PolicyConfigurationFormData> {\n const defaults: Partial<PolicyConfigurationFormData> = { name: policy.name }\n const apiMethod = policy.accrualMethod\n\n if (apiMethod === 'unlimited') {\n defaults.accrualMethod = 'unlimited'\n } else if (HOURLY_API_METHODS.includes(apiMethod)) {\n defaults.accrualMethod = 'per_hour_paid'\n defaults.allPaidHours =\n apiMethod === 'per_hour_paid' || apiMethod === 'per_hour_paid_no_overtime'\n defaults.includeOvertime = apiMethod === 'per_hour_paid' || apiMethod === 'per_hour_worked'\n\n if (policy.accrualRate != null) defaults.accrualRate = Number(policy.accrualRate)\n if (policy.accrualRateUnit != null) defaults.accrualRateUnit = Number(policy.accrualRateUnit)\n\n if (policy.policyResetDate) {\n defaults.resetDateType = 'per_calendar_year'\n }\n } else {\n defaults.accrualMethod = 'per_calendar_year'\n\n if (apiMethod === 'per_pay_period') {\n defaults.accrualMethodFixed = 'per_pay_period'\n defaults.resetDateType = policy.policyResetDate ? 'per_calendar_year' : 'per_anniversary_year'\n } else {\n defaults.accrualMethodFixed = 'all_at_once'\n defaults.resetDateType =\n apiMethod === 'per_anniversary_year' ? 'per_anniversary_year' : 'per_calendar_year'\n }\n\n if (policy.accrualRate != null) defaults.accrualRate = Number(policy.accrualRate)\n }\n\n if (policy.policyResetDate) {\n const [month, day] = policy.policyResetDate.split('-').map(Number)\n if (month) defaults.resetMonth = month\n if (day) defaults.resetDay = day\n }\n\n return defaults\n}\n\nfunction buildCreateRequestBody(\n data: PolicyConfigurationFormData,\n policyType: 'sick' | 'vacation',\n): TimeOffPolicyRequest {\n const accrualMethod = resolveApiAccrualMethod(data)\n\n const base: TimeOffPolicyRequest = { name: data.name, policyType, accrualMethod }\n\n if (accrualMethod === 'unlimited') {\n return { ...base, complete: true }\n }\n\n const isHourly =\n accrualMethod === 'per_hour_paid' ||\n accrualMethod === 'per_hour_paid_no_overtime' ||\n accrualMethod === 'per_hour_worked' ||\n accrualMethod === 'per_hour_worked_no_overtime'\n\n const policyResetDate =\n data.resetDateType === 'per_calendar_year'\n ? formatMonthDay(data.resetMonth, data.resetDay)\n : null\n\n if (isHourly) {\n return {\n ...base,\n accrualRate: data.accrualRate != null ? String(data.accrualRate) : undefined,\n accrualRateUnit: data.accrualRateUnit != null ? String(data.accrualRateUnit) : undefined,\n policyResetDate,\n complete: false,\n }\n }\n\n return {\n ...base,\n accrualRate: data.accrualRate != null ? String(data.accrualRate) : undefined,\n accrualRateUnit: null,\n policyResetDate,\n complete: false,\n }\n}\n\nfunction buildUpdateRequestBody(\n data: PolicyConfigurationFormData,\n policyType: 'sick' | 'vacation',\n version: string,\n): PutV1TimeOffPoliciesTimeOffPolicyUuidRequestBody {\n const accrualMethod = resolveApiAccrualMethod(data)\n\n const base: PutV1TimeOffPoliciesTimeOffPolicyUuidRequestBody = {\n name: data.name,\n policyType,\n accrualMethod,\n version,\n }\n\n if (accrualMethod === 'unlimited') {\n return {\n ...base,\n accrualRate: null,\n accrualRateUnit: null,\n policyResetDate: null,\n }\n }\n\n const isHourly =\n accrualMethod === 'per_hour_paid' ||\n accrualMethod === 'per_hour_paid_no_overtime' ||\n accrualMethod === 'per_hour_worked' ||\n accrualMethod === 'per_hour_worked_no_overtime'\n\n const policyResetDate =\n data.resetDateType === 'per_calendar_year'\n ? formatMonthDay(data.resetMonth, data.resetDay)\n : null\n\n if (isHourly) {\n return {\n ...base,\n accrualRate: data.accrualRate != null ? String(data.accrualRate) : undefined,\n accrualRateUnit: data.accrualRateUnit != null ? String(data.accrualRateUnit) : undefined,\n policyResetDate,\n }\n }\n\n return {\n ...base,\n accrualRate: data.accrualRate != null ? String(data.accrualRate) : undefined,\n accrualRateUnit: null,\n policyResetDate,\n }\n}\n\nfunction Root({ companyId, policyType, defaultValues, policyId }: PolicyConfigurationFormProps) {\n if (policyId) {\n return (\n <EditRoot\n companyId={companyId}\n policyType={policyType}\n policyId={policyId}\n defaultValues={defaultValues}\n />\n )\n }\n return <CreateRoot companyId={companyId} policyType={policyType} defaultValues={defaultValues} />\n}\n\ninterface CreateRootProps {\n companyId: string\n policyType: 'sick' | 'vacation'\n defaultValues?: Partial<PolicyConfigurationFormData>\n}\n\nfunction CreateRoot({ companyId, policyType, defaultValues }: CreateRootProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n\n const { mutateAsync: createTimeOffPolicy, isPending } = useTimeOffPoliciesCreateMutation()\n\n const handleContinue = useCallback(\n async (data: PolicyConfigurationFormData) => {\n await baseSubmitHandler(data, async () => {\n const requestBody = buildCreateRequestBody(data, policyType)\n\n const response = await createTimeOffPolicy({\n request: {\n companyUuid: companyId,\n timeOffPolicyRequest: requestBody,\n },\n })\n\n onEvent(componentEvents.TIME_OFF_POLICY_DETAILS_DONE, {\n policyId: response.timeOffPolicy!.uuid,\n accrualMethod: requestBody.accrualMethod,\n })\n })\n },\n [baseSubmitHandler, companyId, createTimeOffPolicy, onEvent, policyType],\n )\n\n const handleCancel = useCallback(() => {\n onEvent(componentEvents.CANCEL)\n }, [onEvent])\n\n return (\n <PolicyConfigurationFormPresentation\n onContinue={handleContinue}\n onCancel={handleCancel}\n defaultValues={defaultValues}\n isPending={isPending}\n />\n )\n}\n\ninterface EditRootProps {\n companyId: string\n policyType: 'sick' | 'vacation'\n policyId: string\n defaultValues?: Partial<PolicyConfigurationFormData>\n}\n\nfunction EditRoot({ companyId, policyType, policyId, defaultValues }: EditRootProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const queryClient = useQueryClient()\n\n const { data: policyResponse } = useTimeOffPoliciesGetSuspense({\n timeOffPolicyUuid: policyId,\n })\n\n const { mutateAsync: updateTimeOffPolicy, isPending } = useTimeOffPoliciesUpdateMutation()\n\n const policy = policyResponse.timeOffPolicy\n if (!policy) throw new Error('Unexpected response: missing timeOffPolicy')\n\n const version = policy.version ?? ''\n const fetchedDefaults = deriveFormDefaults(policy)\n const mergedDefaults = { ...fetchedDefaults, ...defaultValues }\n\n const lockedAccrualCategory = policy.complete\n ? fetchedDefaults.accrualMethod === 'unlimited'\n ? ('unlimited' as const)\n : ('accrual_based' as const)\n : undefined\n\n const handleContinue = useCallback(\n async (data: PolicyConfigurationFormData) => {\n await baseSubmitHandler(data, async () => {\n const requestBody = buildUpdateRequestBody(data, policyType, version)\n\n await updateTimeOffPolicy({\n request: {\n timeOffPolicyUuid: policyId,\n requestBody,\n },\n })\n\n void queryClient.invalidateQueries({\n queryKey: ['@gusto/embedded-api-v-2026-02-01', 'timeOffPolicies', 'get'],\n })\n\n onEvent(componentEvents.TIME_OFF_POLICY_DETAILS_DONE, {\n policyId,\n accrualMethod: requestBody.accrualMethod,\n })\n })\n },\n [baseSubmitHandler, policyId, policyType, version, updateTimeOffPolicy, queryClient, onEvent],\n )\n\n const handleCancel = useCallback(() => {\n onEvent(componentEvents.CANCEL)\n }, [onEvent])\n\n return (\n <PolicyConfigurationFormPresentation\n onContinue={handleContinue}\n onCancel={handleCancel}\n defaultValues={mergedDefaults}\n editingPolicyName={policy.name}\n isPending={isPending}\n lockedAccrualCategory={lockedAccrualCategory}\n />\n )\n}\n"],"names":["PolicyConfigurationForm","props","jsx","BaseComponent","Root","resolveApiAccrualMethod","data","paid","overtime","HOURLY_API_METHODS","deriveFormDefaults","policy","defaults","apiMethod","month","day","buildCreateRequestBody","policyType","accrualMethod","base","isHourly","policyResetDate","formatMonthDay","buildUpdateRequestBody","version","companyId","defaultValues","policyId","EditRoot","CreateRoot","onEvent","baseSubmitHandler","useBase","createTimeOffPolicy","isPending","useTimeOffPoliciesCreateMutation","handleContinue","useCallback","requestBody","response","componentEvents","handleCancel","PolicyConfigurationFormPresentation","queryClient","useQueryClient","policyResponse","useTimeOffPoliciesGetSuspense","updateTimeOffPolicy","useTimeOffPoliciesUpdateMutation","fetchedDefaults","mergedDefaults","lockedAccrualCategory"],"mappings":";;;;;;;;;;;AAoDO,SAASA,EAAwBC,GAAqC;AAC3E,SACE,gBAAAC,EAACC,KAAe,GAAGF,GACjB,4BAACG,GAAA,EAAM,GAAGH,GAAO,EAAA,CACnB;AAEJ;AAEA,SAASI,EACPC,GACuC;AACvC,UAAQA,EAAK,eAAA;AAAA,IACX,KAAK;AACH,aAAO;AAAA,IAET,KAAK,iBAAiB;AACpB,YAAMC,IAAOD,EAAK,gBAAgB,IAC5BE,IAAWF,EAAK,mBAAmB;AAEzC,aAAIC,KAAQC,IAAiB,kBACzBD,KAAQ,CAACC,IAAiB,8BAC1B,CAACD,KAAQC,IAAiB,oBACvB;AAAA,IACT;AAAA,IAEA,KAAK;AACH,aAAIF,EAAK,uBAAuB,mBAAyB,mBAElDA,EAAK,kBAAkB,yBAC1B,yBACA;AAAA,EACN;AAEJ;AAEA,MAAMG,IAAqB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,SAASC,EAAmBC,GAA6D;AACvF,QAAMC,IAAiD,EAAE,MAAMD,EAAO,KAAA,GAChEE,IAAYF,EAAO;AA+BzB,MA7BIE,MAAc,cAChBD,EAAS,gBAAgB,cAChBH,EAAmB,SAASI,CAAS,KAC9CD,EAAS,gBAAgB,iBACzBA,EAAS,eACPC,MAAc,mBAAmBA,M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AAM,4CAA4C;AAEzE,QAAMa,IAAUb,EAAO,WAAW,IAC5BsC,IAAkBvC,EAAmBC,CAAM,GAC3CuC,IAAiB,EAAE,GAAGD,GAAiB,GAAGvB,EAAA,GAE1CyB,IAAwBxC,EAAO,WACjCsC,EAAgB,kBAAkB,cAC/B,cACA,kBACH,QAEEb,IAAiBC;AAAA,IACrB,OAAO/B,MAAsC;AAC3C,YAAMyB,EAAkBzB,GAAM,YAAY;AACxC,cAAMgC,IAAcf,EAAuBjB,GAAMW,GAAYO,CAAO;AAEpE,cAAMuB,EAAoB;AAAA,UACxB,SAAS;AAAA,YACP,mBAAmBpB;AAAA,YACnB,aAAAW;AAAA,UAAA;AAAA,QACF,CACD,GAEIK,EAAY,kBAAkB;AAAA,UACjC,UAAU,CAAC,oCAAoC,mBAAmB,KAAK;AAAA,QAAA,CACxE,GAEDb,EAAQU,EAAgB,8BAA8B;AAAA,UACpD,UAAAb;AAAA,UACA,eAAeW,EAAY;AAAA,QAAA,CAC5B;AAAA,MACH,CAAC;AAAA,IACH;AAAA,IACA,CAACP,GAAmBJ,GAAUV,GAAYO,GAASuB,GAAqBJ,GAAab,CAAO;AAAA,EAAA,GAGxFW,IAAeJ,EAAY,MAAM;AACrC,IAAAP,EAAQU,EAAgB,MAAM;AAAA,EAChC,GAAG,CAACV,CAAO,CAAC;AAEZ,SACE,gBAAA5B;AAAA,IAACwC;AAAA,IAAA;AAAA,MACC,YAAYN;AAAA,MACZ,UAAUK;AAAA,MACV,eAAeS;AAAA,MACf,mBAAmBvC,EAAO;AAAA,MAC1B,WAAAuB;AAAA,MACA,uBAAAiB;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
1
|
+
{"version":3,"file":"PolicyConfigurationForm.js","sources":["../../../../../src/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationForm.tsx"],"sourcesContent":["import { useCallback } from 'react'\nimport { useTimeOffPoliciesCreateMutation } from '@gusto/embedded-api/react-query/timeOffPoliciesCreate'\nimport { useTimeOffPoliciesUpdateMutation } from '@gusto/embedded-api/react-query/timeOffPoliciesUpdate'\nimport { useTimeOffPoliciesGetSuspense } from '@gusto/embedded-api/react-query/timeOffPoliciesGet'\nimport type { TimeOffPolicyRequest } from '@gusto/embedded-api/models/components/timeoffpolicyrequest'\nimport type { TimeOffPolicy } from '@gusto/embedded-api/models/components/timeoffpolicy'\nimport type { PutV1TimeOffPoliciesTimeOffPolicyUuidRequestBody } from '@gusto/embedded-api/models/operations/putv1timeoffpoliciestimeoffpolicyuuid'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { PolicyConfigurationFormPresentation } from './PolicyConfigurationFormPresentation'\nimport type { PolicyConfigurationFormData } from './PolicyConfigurationFormTypes'\nimport { API_QUERY_NAMESPACE } from '@/contexts/ApiProvider/apiVersion'\nimport { BaseComponent, type BaseComponentInterface } from '@/components/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { componentEvents } from '@/shared/constants'\nimport { formatMonthDay } from '@/helpers/dateFormatting'\n\n/**\n * Props for {@link PolicyConfigurationForm}.\n *\n * @public\n */\nexport interface PolicyConfigurationFormProps extends BaseComponentInterface<'Company.TimeOff.CreateTimeOffPolicy'> {\n /** Company that owns the policy being created or edited. */\n companyId: string\n /** Type of policy being configured. */\n policyType: 'sick' | 'vacation'\n /** When set, the form loads the existing policy and submits an update. */\n policyId?: string\n /** Pre-populated values to merge into the form's defaults. */\n defaultValues?: Partial<PolicyConfigurationFormData>\n}\n\n/**\n * Form for creating or editing the details of a sick or vacation time off policy — its name and accrual configuration.\n *\n * @remarks\n * Omit `policyId` to create a new policy; pass `policyId` to edit an existing\n * one. In edit mode, the form fetches the policy via Suspense and merges the\n * derived defaults with any `defaultValues` you supply (your overrides win).\n * When editing a policy whose configuration is already complete, the accrual\n * method selector is restricted to the matching category (unlimited vs.\n * accrual-based).\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `timeOff/policyDetails/done` | Fired after the policy is successfully created or updated | `{ policyId: string, accrualMethod: string }` |\n * | `CANCEL` | Fired when the user clicks the cancel button | — |\n *\n * @param props - See {@link PolicyConfigurationFormProps}.\n * @returns The rendered policy configuration form.\n * @public\n */\nexport function PolicyConfigurationForm(props: PolicyConfigurationFormProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nfunction resolveApiAccrualMethod(\n data: PolicyConfigurationFormData,\n): TimeOffPolicyRequest['accrualMethod'] {\n switch (data.accrualMethod) {\n case 'unlimited':\n return 'unlimited'\n\n case 'per_hour_paid': {\n const paid = data.allPaidHours ?? false\n const overtime = data.includeOvertime ?? false\n\n if (paid && overtime) return 'per_hour_paid'\n if (paid && !overtime) return 'per_hour_paid_no_overtime'\n if (!paid && overtime) return 'per_hour_worked'\n return 'per_hour_worked_no_overtime'\n }\n\n case 'per_calendar_year': {\n if (data.accrualMethodFixed === 'per_pay_period') return 'per_pay_period'\n\n return data.resetDateType === 'per_anniversary_year'\n ? 'per_anniversary_year'\n : 'per_calendar_year'\n }\n }\n}\n\nconst HOURLY_API_METHODS = [\n 'per_hour_paid',\n 'per_hour_paid_no_overtime',\n 'per_hour_worked',\n 'per_hour_worked_no_overtime',\n]\n\nfunction deriveFormDefaults(policy: TimeOffPolicy): Partial<PolicyConfigurationFormData> {\n const defaults: Partial<PolicyConfigurationFormData> = { name: policy.name }\n const apiMethod = policy.accrualMethod\n\n if (apiMethod === 'unlimited') {\n defaults.accrualMethod = 'unlimited'\n } else if (HOURLY_API_METHODS.includes(apiMethod)) {\n defaults.accrualMethod = 'per_hour_paid'\n defaults.allPaidHours =\n apiMethod === 'per_hour_paid' || apiMethod === 'per_hour_paid_no_overtime'\n defaults.includeOvertime = apiMethod === 'per_hour_paid' || apiMethod === 'per_hour_worked'\n\n if (policy.accrualRate != null) defaults.accrualRate = Number(policy.accrualRate)\n if (policy.accrualRateUnit != null) defaults.accrualRateUnit = Number(policy.accrualRateUnit)\n\n if (policy.policyResetDate) {\n defaults.resetDateType = 'per_calendar_year'\n }\n } else {\n defaults.accrualMethod = 'per_calendar_year'\n\n if (apiMethod === 'per_pay_period') {\n defaults.accrualMethodFixed = 'per_pay_period'\n defaults.resetDateType = policy.policyResetDate ? 'per_calendar_year' : 'per_anniversary_year'\n } else {\n defaults.accrualMethodFixed = 'all_at_once'\n defaults.resetDateType =\n apiMethod === 'per_anniversary_year' ? 'per_anniversary_year' : 'per_calendar_year'\n }\n\n if (policy.accrualRate != null) defaults.accrualRate = Number(policy.accrualRate)\n }\n\n if (policy.policyResetDate) {\n const [month, day] = policy.policyResetDate.split('-').map(Number)\n if (month) defaults.resetMonth = month\n if (day) defaults.resetDay = day\n }\n\n return defaults\n}\n\nfunction buildCreateRequestBody(\n data: PolicyConfigurationFormData,\n policyType: 'sick' | 'vacation',\n): TimeOffPolicyRequest {\n const accrualMethod = resolveApiAccrualMethod(data)\n\n const base: TimeOffPolicyRequest = { name: data.name, policyType, accrualMethod }\n\n if (accrualMethod === 'unlimited') {\n return { ...base, complete: true }\n }\n\n const isHourly =\n accrualMethod === 'per_hour_paid' ||\n accrualMethod === 'per_hour_paid_no_overtime' ||\n accrualMethod === 'per_hour_worked' ||\n accrualMethod === 'per_hour_worked_no_overtime'\n\n const policyResetDate =\n data.resetDateType === 'per_calendar_year'\n ? formatMonthDay(data.resetMonth, data.resetDay)\n : null\n\n if (isHourly) {\n return {\n ...base,\n accrualRate: data.accrualRate != null ? String(data.accrualRate) : undefined,\n accrualRateUnit: data.accrualRateUnit != null ? String(data.accrualRateUnit) : undefined,\n policyResetDate,\n complete: false,\n }\n }\n\n return {\n ...base,\n accrualRate: data.accrualRate != null ? String(data.accrualRate) : undefined,\n accrualRateUnit: null,\n policyResetDate,\n complete: false,\n }\n}\n\nfunction buildUpdateRequestBody(\n data: PolicyConfigurationFormData,\n policyType: 'sick' | 'vacation',\n version: string,\n): PutV1TimeOffPoliciesTimeOffPolicyUuidRequestBody {\n const accrualMethod = resolveApiAccrualMethod(data)\n\n const base: PutV1TimeOffPoliciesTimeOffPolicyUuidRequestBody = {\n name: data.name,\n policyType,\n accrualMethod,\n version,\n }\n\n if (accrualMethod === 'unlimited') {\n return {\n ...base,\n accrualRate: null,\n accrualRateUnit: null,\n policyResetDate: null,\n }\n }\n\n const isHourly =\n accrualMethod === 'per_hour_paid' ||\n accrualMethod === 'per_hour_paid_no_overtime' ||\n accrualMethod === 'per_hour_worked' ||\n accrualMethod === 'per_hour_worked_no_overtime'\n\n const policyResetDate =\n data.resetDateType === 'per_calendar_year'\n ? formatMonthDay(data.resetMonth, data.resetDay)\n : null\n\n if (isHourly) {\n return {\n ...base,\n accrualRate: data.accrualRate != null ? String(data.accrualRate) : undefined,\n accrualRateUnit: data.accrualRateUnit != null ? String(data.accrualRateUnit) : undefined,\n policyResetDate,\n }\n }\n\n return {\n ...base,\n accrualRate: data.accrualRate != null ? String(data.accrualRate) : undefined,\n accrualRateUnit: null,\n policyResetDate,\n }\n}\n\nfunction Root({ companyId, policyType, defaultValues, policyId }: PolicyConfigurationFormProps) {\n if (policyId) {\n return (\n <EditRoot\n companyId={companyId}\n policyType={policyType}\n policyId={policyId}\n defaultValues={defaultValues}\n />\n )\n }\n return <CreateRoot companyId={companyId} policyType={policyType} defaultValues={defaultValues} />\n}\n\ninterface CreateRootProps {\n companyId: string\n policyType: 'sick' | 'vacation'\n defaultValues?: Partial<PolicyConfigurationFormData>\n}\n\nfunction CreateRoot({ companyId, policyType, defaultValues }: CreateRootProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n\n const { mutateAsync: createTimeOffPolicy, isPending } = useTimeOffPoliciesCreateMutation()\n\n const handleContinue = useCallback(\n async (data: PolicyConfigurationFormData) => {\n await baseSubmitHandler(data, async () => {\n const requestBody = buildCreateRequestBody(data, policyType)\n\n const response = await createTimeOffPolicy({\n request: {\n companyUuid: companyId,\n timeOffPolicyRequest: requestBody,\n },\n })\n\n onEvent(componentEvents.TIME_OFF_POLICY_DETAILS_DONE, {\n policyId: response.timeOffPolicy!.uuid,\n accrualMethod: requestBody.accrualMethod,\n })\n })\n },\n [baseSubmitHandler, companyId, createTimeOffPolicy, onEvent, policyType],\n )\n\n const handleCancel = useCallback(() => {\n onEvent(componentEvents.CANCEL)\n }, [onEvent])\n\n return (\n <PolicyConfigurationFormPresentation\n onContinue={handleContinue}\n onCancel={handleCancel}\n defaultValues={defaultValues}\n isPending={isPending}\n />\n )\n}\n\ninterface EditRootProps {\n companyId: string\n policyType: 'sick' | 'vacation'\n policyId: string\n defaultValues?: Partial<PolicyConfigurationFormData>\n}\n\nfunction EditRoot({ companyId, policyType, policyId, defaultValues }: EditRootProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const queryClient = useQueryClient()\n\n const { data: policyResponse } = useTimeOffPoliciesGetSuspense({\n timeOffPolicyUuid: policyId,\n })\n\n const { mutateAsync: updateTimeOffPolicy, isPending } = useTimeOffPoliciesUpdateMutation()\n\n const policy = policyResponse.timeOffPolicy\n if (!policy) throw new Error('Unexpected response: missing timeOffPolicy')\n\n const version = policy.version ?? ''\n const fetchedDefaults = deriveFormDefaults(policy)\n const mergedDefaults = { ...fetchedDefaults, ...defaultValues }\n\n const lockedAccrualCategory = policy.complete\n ? fetchedDefaults.accrualMethod === 'unlimited'\n ? ('unlimited' as const)\n : ('accrual_based' as const)\n : undefined\n\n const handleContinue = useCallback(\n async (data: PolicyConfigurationFormData) => {\n await baseSubmitHandler(data, async () => {\n const requestBody = buildUpdateRequestBody(data, policyType, version)\n\n await updateTimeOffPolicy({\n request: {\n timeOffPolicyUuid: policyId,\n requestBody,\n },\n })\n\n void queryClient.invalidateQueries({\n queryKey: [API_QUERY_NAMESPACE, 'timeOffPolicies', 'get'],\n })\n\n onEvent(componentEvents.TIME_OFF_POLICY_DETAILS_DONE, {\n policyId,\n accrualMethod: requestBody.accrualMethod,\n })\n })\n },\n [baseSubmitHandler, policyId, policyType, version, updateTimeOffPolicy, queryClient, onEvent],\n )\n\n const handleCancel = useCallback(() => {\n onEvent(componentEvents.CANCEL)\n }, [onEvent])\n\n return (\n <PolicyConfigurationFormPresentation\n onContinue={handleContinue}\n onCancel={handleCancel}\n defaultValues={mergedDefaults}\n editingPolicyName={policy.name}\n isPending={isPending}\n lockedAccrualCategory={lockedAccrualCategory}\n />\n )\n}\n"],"names":["PolicyConfigurationForm","props","jsx","BaseComponent","Root","resolveApiAccrualMethod","data","paid","overtime","HOURLY_API_METHODS","deriveFormDefaults","policy","defaults","apiMethod","month","day","buildCreateRequestBody","policyType","accrualMethod","base","isHourly","policyResetDate","formatMonthDay","buildUpdateRequestBody","version","companyId","defaultValues","policyId","EditRoot","CreateRoot","onEvent","baseSubmitHandler","useBase","createTimeOffPolicy","isPending","useTimeOffPoliciesCreateMutation","handleContinue","useCallback","requestBody","response","componentEvents","handleCancel","PolicyConfigurationFormPresentation","queryClient","useQueryClient","policyResponse","useTimeOffPoliciesGetSuspense","updateTimeOffPolicy","useTimeOffPoliciesUpdateMutation","fetchedDefaults","mergedDefaults","lockedAccrualCategory","API_QUERY_NAMESPACE"],"mappings":";;;;;;;;;;;;AAqDO,SAASA,EAAwBC,GAAqC;AAC3E,SACE,gBAAAC,EAACC,KAAe,GAAGF,GACjB,4BAACG,GAAA,EAAM,GAAGH,GAAO,EAAA,CACnB;AAEJ;AAEA,SAASI,EACPC,GACuC;AACvC,UAAQA,EAAK,eAAA;AAAA,IACX,KAAK;AACH,aAAO;AAAA,IAET,KAAK,iBAAiB;AACpB,YAAMC,IAAOD,EAAK,gBAAgB,IAC5BE,IAAWF,EAAK,mBAAmB;AAEzC,aAAIC,KAAQC,IAAiB,kBACzBD,KAAQ,CAACC,IAAiB,8BAC1B,CAACD,KAAQC,IAAiB,oBACvB;AAAA,IACT;AAAA,IAEA,KAAK;AACH,aAAIF,EAAK,uBAAuB,mBAAyB,mBAElDA,EAAK,kBAAkB,yBAC1B,yBACA;AAAA,EACN;AAEJ;AAEA,MAAMG,IAAqB;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,E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B;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback as p, useMemo as w } from "react";
|
|
3
3
|
import { useQueryClient as L } from "@tanstack/react-query";
|
|
4
|
-
import { useHolidayPayPoliciesAddEmployeesMutation as M } from "@gusto/embedded-api
|
|
5
|
-
import { queryKeyHolidayPayPoliciesGet as F, invalidateAllHolidayPayPoliciesGet as U, useHolidayPayPoliciesGetSuspense as Y } from "@gusto/embedded-api
|
|
4
|
+
import { useHolidayPayPoliciesAddEmployeesMutation as M } from "@gusto/embedded-api/react-query/holidayPayPoliciesAddEmployees";
|
|
5
|
+
import { queryKeyHolidayPayPoliciesGet as F, invalidateAllHolidayPayPoliciesGet as U, useHolidayPayPoliciesGetSuspense as Y } from "@gusto/embedded-api/react-query/holidayPayPoliciesGet";
|
|
6
6
|
import { SelectEmployeesPresentation as v } from "./SelectEmployeesPresentation.js";
|
|
7
7
|
import { useSelectEmployeesData as I } from "./useSelectEmployeesData.js";
|
|
8
8
|
import { useBase as q } from "../../../Base/useBase.js";
|
package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectEmployeesHoliday.js","sources":["../../../../../src/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday.tsx"],"sourcesContent":["import { useCallback, useMemo } from 'react'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { useHolidayPayPoliciesAddEmployeesMutation } from '@gusto/embedded-api
|
|
1
|
+
{"version":3,"file":"SelectEmployeesHoliday.js","sources":["../../../../../src/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday.tsx"],"sourcesContent":["import { useCallback, useMemo } from 'react'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { useHolidayPayPoliciesAddEmployeesMutation } from '@gusto/embedded-api/react-query/holidayPayPoliciesAddEmployees'\nimport {\n useHolidayPayPoliciesGetSuspense,\n queryKeyHolidayPayPoliciesGet,\n invalidateAllHolidayPayPoliciesGet,\n type HolidayPayPoliciesGetQueryData,\n} from '@gusto/embedded-api/react-query/holidayPayPoliciesGet'\nimport type { HolidayPayPolicy } from '@gusto/embedded-api/models/components/holidaypaypolicy'\nimport { SelectEmployeesPresentation } from './SelectEmployeesPresentation'\nimport { useSelectEmployeesData } from './useSelectEmployeesData'\nimport { useBase } from '@/components/Base/useBase'\nimport { componentEvents } from '@/shared/constants'\n\ninterface SelectEmployeesHolidayProps {\n companyId: string\n mode?: 'standalone' | 'wizard'\n}\n\n/** @internal */\nexport function SelectEmployeesHoliday(props: SelectEmployeesHolidayProps) {\n if (props.mode === 'wizard') {\n return <SelectEmployeesHolidayInner {...props} mode=\"wizard\" />\n }\n return <StandaloneLoader {...props} />\n}\n\nfunction StandaloneLoader(props: SelectEmployeesHolidayProps) {\n const { data: policyResponse } = useHolidayPayPoliciesGetSuspense({\n companyUuid: props.companyId,\n })\n const policy = policyResponse.holidayPayPolicy\n if (!policy) throw new Error('Unexpected response: missing holidayPayPolicy')\n\n const existingAssigneeUuids = useMemo(() => {\n const set = new Set<string>()\n for (const e of policy.employees) {\n if (e.uuid) set.add(e.uuid)\n }\n return set\n }, [policy.employees])\n\n return (\n <SelectEmployeesHolidayInner\n {...props}\n mode=\"standalone\"\n existingAssigneeUuids={existingAssigneeUuids}\n version={policy.version}\n />\n )\n}\n\ninterface InnerProps extends SelectEmployeesHolidayProps {\n existingAssigneeUuids?: Set<string>\n version?: string\n}\n\nfunction SelectEmployeesHolidayInner({\n companyId,\n mode = 'standalone',\n existingAssigneeUuids,\n version,\n}: InnerProps) {\n const { onEvent, baseSubmitHandler } = useBase()\n const queryClient = useQueryClient()\n const {\n filteredEmployees,\n selectedUuids,\n searchValue,\n pagination,\n isFetching,\n handleSelect,\n handleSelectAll,\n handleSearchChange,\n handleSearchClear,\n } = useSelectEmployeesData(companyId, existingAssigneeUuids)\n\n const { mutateAsync: addEmployees, isPending: isAddPending } =\n useHolidayPayPoliciesAddEmployeesMutation()\n\n const handleContinue = useCallback(async () => {\n const toAdd = [...selectedUuids]\n\n if (mode === 'wizard') {\n onEvent(componentEvents.TIME_OFF_HOLIDAY_ADD_EMPLOYEES_DONE, {\n employeeUuids: toAdd,\n })\n return\n }\n\n if (toAdd.length === 0) {\n onEvent(componentEvents.TIME_OFF_HOLIDAY_ADD_EMPLOYEES_DONE)\n return\n }\n\n await baseSubmitHandler({}, async () => {\n const response = await addEmployees({\n request: {\n companyUuid: companyId,\n requestBody: {\n version: version ?? '',\n employees: toAdd.map(uuid => ({ uuid })),\n },\n },\n })\n const latestPolicy: HolidayPayPolicy | undefined = response.holidayPayPolicy\n // Seed the GET cache from the mutation response so that the next mount\n // of HolidayPolicyDetail reads fresh data immediately. invalidateQueries\n // alone only refetches *active* subscriptions, but we navigate away\n // before the refetch can complete.\n if (latestPolicy) {\n queryClient.setQueryData<HolidayPayPoliciesGetQueryData>(\n queryKeyHolidayPayPoliciesGet(companyId, {}),\n prev =>\n prev\n ? { ...prev, holidayPayPolicy: latestPolicy }\n : (undefined as unknown as HolidayPayPoliciesGetQueryData),\n )\n }\n await invalidateAllHolidayPayPoliciesGet(queryClient)\n onEvent(componentEvents.TIME_OFF_HOLIDAY_ADD_EMPLOYEES_DONE, latestPolicy)\n })\n }, [\n mode,\n selectedUuids,\n baseSubmitHandler,\n addEmployees,\n companyId,\n version,\n queryClient,\n onEvent,\n ])\n\n const handleBack = useCallback(() => {\n onEvent(componentEvents.CANCEL)\n }, [onEvent])\n\n return (\n <SelectEmployeesPresentation\n employees={filteredEmployees}\n selectedUuids={selectedUuids}\n searchValue={searchValue}\n onSelect={handleSelect}\n onSelectAll={handleSelectAll}\n onSearchChange={handleSearchChange}\n onSearchClear={handleSearchClear}\n onBack={handleBack}\n onContinue={handleContinue}\n isHolidayPolicy\n pagination={pagination}\n isFetching={isFetching}\n isPending={isAddPending}\n />\n )\n}\n"],"names":["SelectEmployeesHoliday","props","jsx","SelectEmployeesHolidayInner","StandaloneLoader","policyResponse","useHolidayPayPoliciesGetSuspense","policy","existingAssigneeUuids","useMemo","set","e","companyId","mode","version","onEvent","baseSubmitHandler","useBase","queryClient","useQueryClient","filteredEmployees","selectedUuids","searchValue","pagination","isFetching","handleSelect","handleSelectAll","handleSearchChange","handleSearchClear","useSelectEmployeesData","addEmployees","isAddPending","useHolidayPayPoliciesAddEmployeesMutation","handleContinue","useCallback","toAdd","componentEvents","latestPolicy","uuid","queryKeyHolidayPayPoliciesGet","prev","invalidateAllHolidayPayPoliciesGet","handleBack","SelectEmployeesPresentation"],"mappings":";;;;;;;;;AAqBO,SAASA,EAAuBC,GAAoC;AACzE,SAAIA,EAAM,SAAS,WACV,gBAAAC,EAACC,GAAA,EAA6B,GAAGF,GAAO,MAAK,UAAS,IAExD,gBAAAC,EAACE,GAAA,EAAkB,GAAGH,EAAA,CAAO;AACtC;AAEA,SAASG,EAAiBH,GAAoC;AAC5D,QAAM,EAAE,MAAMI,EAAA,IAAmBC,EAAiC;AAAA,IAChE,aAAaL,EAAM;AAAA,EAAA,CACpB,GACKM,IAASF,EAAe;AAC9B,MAAI,CAACE,EAAQ,OAAM,IAAI,MAAM,+CAA+C;AAE5E,QAAMC,IAAwBC,EAAQ,MAAM;AAC1C,UAAMC,wBAAU,IAAA;AAChB,eAAWC,KAAKJ,EAAO;AACrB,MAAII,EAAE,QAAMD,EAAI,IAAIC,EAAE,IAAI;AAE5B,WAAOD;AAAA,EACT,GAAG,CAACH,EAAO,SAAS,CAAC;AAErB,SACE,gBAAAL;AAAA,IAACC;AAAA,IAAA;AAAA,MACE,GAAGF;AAAA,MACJ,MAAK;AAAA,MACL,uBAAAO;AAAA,MACA,SAASD,EAAO;AAAA,IAAA;AAAA,EAAA;AAGtB;AAOA,SAASJ,EAA4B;AAAA,EACnC,WAAAS;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,uBAAA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A,IACAI;AAAA,IACAH;AAAA,EAAA,CACD,GAEK2B,IAAaR,EAAY,MAAM;AACnC,IAAAnB,EAAQqB,EAAgB,MAAM;AAAA,EAChC,GAAG,CAACrB,CAAO,CAAC;AAEZ,SACE,gBAAAb;AAAA,IAACyC;AAAA,IAAA;AAAA,MACC,WAAWvB;AAAA,MACX,eAAAC;AAAA,MACA,aAAAC;AAAA,MACA,UAAUG;AAAA,MACV,aAAaC;AAAA,MACb,gBAAgBC;AAAA,MAChB,eAAeC;AAAA,MACf,QAAQc;AAAA,MACR,YAAYT;AAAA,MACZ,iBAAe;AAAA,MACf,YAAAV;AAAA,MACA,YAAAC;AAAA,MACA,WAAWO;AAAA,IAAA;AAAA,EAAA;AAGjB;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PaidTimeOff } from '@gusto/embedded-api
|
|
1
|
+
import { PaidTimeOff } from '@gusto/embedded-api/models/components/paidtimeoff';
|
|
2
2
|
import { PaginationControlProps } from '../../../Common/PaginationControl/PaginationControlTypes';
|
|
3
3
|
/** @internal */
|
|
4
4
|
export interface EmployeeItem {
|