@gusto/embedded-react-sdk 0.48.1 → 0.48.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 +23 -0
- package/dist/components/Common/DocumentList/DocumentList.js +12 -12
- package/dist/components/Common/DocumentList/DocumentList.js.map +1 -1
- package/dist/components/Common/DocumentList/DocumentList.module.scss.js +3 -5
- package/dist/components/Common/DocumentList/DocumentList.module.scss.js.map +1 -1
- package/dist/components/Common/HorizontalFieldLayout/HorizontalFieldLayoutTypes.d.ts +1 -0
- package/dist/components/Common/PaginationControl/PaginationControlTypes.d.ts +7 -3
- package/dist/components/Common/PayrollLoading/PayrollLoadingTypes.d.ts +1 -0
- package/dist/components/Common/UI/Alert/AlertTypes.d.ts +1 -0
- package/dist/components/Common/UI/Alert/AlertTypes.js.map +1 -1
- package/dist/components/Common/UI/Badge/BadgeTypes.d.ts +1 -0
- package/dist/components/Common/UI/Badge/BadgeTypes.js.map +1 -1
- package/dist/components/Common/UI/Banner/BannerTypes.d.ts +1 -0
- package/dist/components/Common/UI/Banner/BannerTypes.js.map +1 -1
- package/dist/components/Common/UI/Box/BoxTypes.d.ts +1 -0
- package/dist/components/Common/UI/BoxHeader/BoxHeaderTypes.d.ts +1 -0
- package/dist/components/Common/UI/BoxHeader/BoxHeaderTypes.js.map +1 -1
- package/dist/components/Common/UI/Breadcrumbs/BreadcrumbsTypes.d.ts +2 -0
- package/dist/components/Common/UI/Breadcrumbs/BreadcrumbsTypes.js.map +1 -1
- package/dist/components/Common/UI/Button/ButtonTypes.d.ts +4 -2
- package/dist/components/Common/UI/Button/ButtonTypes.js.map +1 -1
- package/dist/components/Common/UI/CalendarPreview/CalendarPreviewTypes.d.ts +3 -2
- package/dist/components/Common/UI/Card/CardTypes.d.ts +1 -0
- package/dist/components/Common/UI/Checkbox/CheckboxTypes.d.ts +1 -0
- package/dist/components/Common/UI/Checkbox/CheckboxTypes.js.map +1 -1
- package/dist/components/Common/UI/CheckboxGroup/CheckboxGroupTypes.d.ts +2 -0
- package/dist/components/Common/UI/CheckboxGroup/CheckboxGroupTypes.js.map +1 -1
- package/dist/components/Common/UI/ComboBox/ComboBoxTypes.d.ts +2 -0
- package/dist/components/Common/UI/DatePicker/DatePickerTypes.d.ts +1 -0
- package/dist/components/Common/UI/DateRangePicker/DateRangePickerTypes.d.ts +2 -0
- package/dist/components/Common/UI/DescriptionList/DescriptionListTypes.d.ts +2 -0
- package/dist/components/Common/UI/DescriptionList/DescriptionListTypes.js.map +1 -1
- package/dist/components/Common/UI/Dialog/DialogTypes.d.ts +1 -0
- package/dist/components/Common/UI/Dialog/DialogTypes.js.map +1 -1
- package/dist/components/Common/UI/FileInput/FileInputTypes.d.ts +1 -0
- package/dist/components/Common/UI/FileInput/FileInputTypes.js.map +1 -1
- package/dist/components/Common/UI/Heading/HeadingTypes.d.ts +1 -0
- package/dist/components/Common/UI/Link/LinkTypes.d.ts +4 -3
- package/dist/components/Common/UI/List/ListTypes.d.ts +13 -4
- package/dist/components/Common/UI/LoadingSpinner/LoadingSpinnerTypes.d.ts +1 -0
- package/dist/components/Common/UI/LoadingSpinner/LoadingSpinnerTypes.js.map +1 -1
- package/dist/components/Common/UI/Menu/MenuTypes.d.ts +2 -0
- package/dist/components/Common/UI/Menu/MenuTypes.js.map +1 -1
- package/dist/components/Common/UI/Modal/ModalTypes.d.ts +1 -0
- package/dist/components/Common/UI/Modal/ModalTypes.js.map +1 -1
- package/dist/components/Common/UI/MultiSelectComboBox/MultiSelectComboBoxTypes.d.ts +2 -0
- package/dist/components/Common/UI/NumberInput/NumberInputTypes.d.ts +1 -0
- package/dist/components/Common/UI/ProgressBar/ProgressBarTypes.d.ts +1 -0
- package/dist/components/Common/UI/Radio/RadioTypes.d.ts +1 -0
- package/dist/components/Common/UI/Radio/RadioTypes.js.map +1 -1
- package/dist/components/Common/UI/RadioGroup/RadioGroupTypes.d.ts +2 -0
- package/dist/components/Common/UI/RadioGroup/RadioGroupTypes.js.map +1 -1
- package/dist/components/Common/UI/Select/SelectTypes.d.ts +2 -0
- package/dist/components/Common/UI/Switch/SwitchTypes.d.ts +1 -0
- package/dist/components/Common/UI/Switch/SwitchTypes.js.map +1 -1
- package/dist/components/Common/UI/Table/TableTypes.d.ts +3 -0
- package/dist/components/Common/UI/Table/TableTypes.js.map +1 -1
- package/dist/components/Common/UI/Tabs/TabsTypes.d.ts +2 -0
- package/dist/components/Common/UI/Text/TextTypes.d.ts +1 -0
- package/dist/components/Common/UI/Text/TextTypes.js.map +1 -1
- package/dist/components/Common/UI/TextArea/TextAreaTypes.d.ts +1 -0
- package/dist/components/Common/UI/TextArea/TextAreaTypes.js.map +1 -1
- package/dist/components/Common/UI/TextInput/TextInputTypes.d.ts +1 -0
- package/dist/components/Common/UI/TextInput/TextInputTypes.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +13 -13
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +18 -3
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +18 -3
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +20 -5
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccount.js +7 -6
- package/dist/components/Company/BankAccount/BankAccount.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +18 -3
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +18 -3
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentSigner.js +3 -2
- package/dist/components/Company/DocumentSigner/DocumentSigner.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +27 -12
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +21 -6
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +18 -3
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +18 -3
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +19 -4
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/PayScheduleForm.js +3 -2
- package/dist/components/Company/PaySchedule/PayScheduleForm.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +18 -3
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +18 -3
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Contractor/Address/useAddress.js +20 -5
- package/dist/components/Contractor/Address/useAddress.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.js +3 -2
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js +3 -2
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js.map +1 -1
- package/dist/components/Contractor/Profile/ContractorProfileForm.js +13 -13
- package/dist/components/Contractor/Profile/useContractorProfile.js +29 -21
- package/dist/components/Contractor/Profile/useContractorProfile.js.map +1 -1
- package/dist/components/Employee/Compensation/management/Compensation.js +3 -2
- package/dist/components/Employee/Compensation/management/Compensation.js.map +1 -1
- package/dist/components/Employee/Compensation/management/CompensationAddAnotherJobForm/CompensationAddAnotherJobForm.js +9 -8
- package/dist/components/Employee/Compensation/management/CompensationAddAnotherJobForm/CompensationAddAnotherJobForm.js.map +1 -1
- package/dist/components/Employee/Compensation/management/CompensationAddJobForm/CompensationAddJobForm.js +3 -2
- package/dist/components/Employee/Compensation/management/CompensationAddJobForm/CompensationAddJobForm.js.map +1 -1
- package/dist/components/Employee/Compensation/management/CompensationEditForm/CompensationEditForm.js +3 -2
- package/dist/components/Employee/Compensation/management/CompensationEditForm/CompensationEditForm.js.map +1 -1
- package/dist/components/Employee/Compensation/management/CompensationEditJobForm/CompensationEditJobForm.js +3 -2
- package/dist/components/Employee/Compensation/management/CompensationEditJobForm/CompensationEditJobForm.js.map +1 -1
- package/dist/components/Employee/Compensation/management/CompensationEditPendingJobForm/CompensationEditPendingJobForm.js +3 -2
- package/dist/components/Employee/Compensation/management/CompensationEditPendingJobForm/CompensationEditPendingJobForm.js.map +1 -1
- package/dist/components/Employee/Compensation/onboarding/Compensation.js +3 -2
- package/dist/components/Employee/Compensation/onboarding/Compensation.js.map +1 -1
- package/dist/components/Employee/Compensation/onboarding/EditCompensation/EditCompensation.js +3 -2
- package/dist/components/Employee/Compensation/onboarding/EditCompensation/EditCompensation.js.map +1 -1
- package/dist/components/Employee/Deductions/management/Deductions.js +3 -2
- package/dist/components/Employee/Deductions/management/Deductions.js.map +1 -1
- package/dist/components/Employee/Deductions/management/DeductionsEditForm/DeductionsEditForm.js +3 -2
- package/dist/components/Employee/Deductions/management/DeductionsEditForm/DeductionsEditForm.js.map +1 -1
- package/dist/components/Employee/Documents/management/Documents.js +3 -2
- package/dist/components/Employee/Documents/management/Documents.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/DocumentList.d.ts +25 -5
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/DocumentList.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/index.d.ts +3 -0
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +18 -3
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentSigner.js +12 -11
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentSigner.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js +16 -16
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/I9SignatureForm/I9SignatureForm.d.ts +28 -5
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/I9SignatureForm/I9SignatureForm.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/I9SignatureForm/index.d.ts +3 -0
- package/dist/components/Employee/Documents/shared/SignatureForm/SignatureForm.d.ts +26 -5
- package/dist/components/Employee/Documents/shared/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Employee/Documents/shared/SignatureForm/index.d.ts +3 -0
- package/dist/components/Employee/FederalTaxes/management/FederalTaxes.js +10 -9
- package/dist/components/Employee/FederalTaxes/management/FederalTaxes.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/management/FederalTaxesEditForm.js +3 -2
- package/dist/components/Employee/FederalTaxes/management/FederalTaxesEditForm.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/onboarding/FederalTaxes.js +9 -8
- package/dist/components/Employee/FederalTaxes/onboarding/FederalTaxes.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/shared/FederalTaxesView.js +14 -13
- package/dist/components/Employee/FederalTaxes/shared/FederalTaxesView.js.map +1 -1
- package/dist/components/Employee/HomeAddress/management/HomeAddress.js +3 -2
- package/dist/components/Employee/HomeAddress/management/HomeAddress.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/management/PaymentMethod.js +7 -6
- package/dist/components/Employee/PaymentMethod/management/PaymentMethod.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/onboarding/PaymentMethod.js +7 -6
- package/dist/components/Employee/PaymentMethod/onboarding/PaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/management/Profile.js +12 -11
- package/dist/components/Employee/Profile/management/Profile.js.map +1 -1
- package/dist/components/Employee/Profile/management/ProfileEditForm.js +13 -12
- package/dist/components/Employee/Profile/management/ProfileEditForm.js.map +1 -1
- package/dist/components/Employee/Profile/onboarding/AdminProfile.js +11 -10
- package/dist/components/Employee/Profile/onboarding/AdminProfile.js.map +1 -1
- package/dist/components/Employee/Profile/onboarding/EmployeeProfile.js +3 -2
- package/dist/components/Employee/Profile/onboarding/EmployeeProfile.js.map +1 -1
- package/dist/components/Employee/Profile/onboarding/Profile.js +12 -11
- package/dist/components/Employee/Profile/onboarding/Profile.js.map +1 -1
- package/dist/components/Employee/StateTaxes/management/StateTaxes.js +10 -9
- package/dist/components/Employee/StateTaxes/management/StateTaxes.js.map +1 -1
- package/dist/components/Employee/StateTaxes/management/StateTaxesEditForm.js +7 -6
- package/dist/components/Employee/StateTaxes/management/StateTaxesEditForm.js.map +1 -1
- package/dist/components/Employee/StateTaxes/onboarding/StateTaxes.js +3 -2
- package/dist/components/Employee/StateTaxes/onboarding/StateTaxes.js.map +1 -1
- package/dist/components/Employee/StateTaxes/shared/EmployeeStateTaxesView.js +3 -2
- package/dist/components/Employee/StateTaxes/shared/EmployeeStateTaxesView.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.js +10 -10
- package/dist/components/Employee/WorkAddress/management/WorkAddress.js +7 -6
- package/dist/components/Employee/WorkAddress/management/WorkAddress.js.map +1 -1
- package/dist/components/Employee/exports/employeeOnboarding.d.ts +3 -0
- package/dist/components/Employee/exports/employeeOnboarding.js +28 -22
- package/dist/components/Employee/exports/employeeOnboarding.js.map +1 -1
- package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.d.ts +36 -2
- package/dist/components/InformationRequests/InformationRequestForm/InformationRequestForm.js.map +1 -1
- package/dist/components/InformationRequests/InformationRequestForm/index.d.ts +1 -1
- package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.d.ts +22 -2
- package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js +8 -7
- package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js.map +1 -1
- package/dist/components/InformationRequests/InformationRequestList/index.d.ts +1 -1
- package/dist/components/InformationRequests/InformationRequests.d.ts +29 -2
- package/dist/components/InformationRequests/InformationRequests.js +8 -7
- package/dist/components/InformationRequests/InformationRequests.js.map +1 -1
- package/dist/components/InformationRequests/InformationRequestsComponents.d.ts +2 -0
- package/dist/components/InformationRequests/InformationRequestsComponents.js.map +1 -1
- package/dist/components/InformationRequests/index.d.ts +3 -3
- package/dist/components/InformationRequests/informationRequestsStateMachine.d.ts +2 -0
- package/dist/components/InformationRequests/informationRequestsStateMachine.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.d.ts +36 -3
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.js +22 -17
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.d.ts +1 -0
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.js +3 -2
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsComponents.d.ts +14 -0
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsComponents.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.d.ts +1 -8
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +9 -10
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/WireInstructions/WireInstructions.d.ts +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/WireInstructions/WireInstructions.js +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/WireInstructions/WireInstructions.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/confirmWireDetailsStateMachine.d.ts +11 -0
- package/dist/components/Payroll/ConfirmWireDetails/confirmWireDetailsStateMachine.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/index.d.ts +1 -2
- package/dist/components/Payroll/ConfirmWireDetails/types.d.ts +23 -0
- package/dist/components/Payroll/Dismissal/DismissalFlow.d.ts +18 -0
- package/dist/components/Payroll/Dismissal/DismissalFlow.js.map +1 -1
- package/dist/components/Payroll/Dismissal/DismissalFlowComponents.d.ts +15 -0
- package/dist/components/Payroll/Dismissal/DismissalFlowComponents.js.map +1 -1
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.d.ts +24 -0
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.js.map +1 -1
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelectionPresentation.d.ts +7 -0
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelectionPresentation.js.map +1 -1
- package/dist/components/Payroll/Dismissal/dismissalStateMachine.d.ts +2 -0
- package/dist/components/Payroll/Dismissal/dismissalStateMachine.js.map +1 -1
- package/dist/components/Payroll/Dismissal/index.d.ts +1 -1
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.d.ts +1 -0
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +33 -25
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
- package/dist/components/Payroll/GrossUpModal/GrossUpModalTypes.d.ts +5 -0
- package/dist/components/Payroll/GrossUpModal/index.d.ts +0 -1
- package/dist/components/Payroll/OffCycle/OffCycleFlow.d.ts +31 -0
- package/dist/components/Payroll/OffCycle/OffCycleFlow.js.map +1 -1
- package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.d.ts +20 -0
- package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js.map +1 -1
- package/dist/components/Payroll/OffCycle/offCycleStateMachine.d.ts +2 -0
- package/dist/components/Payroll/OffCycle/offCycleStateMachine.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.d.ts +20 -0
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.d.ts +1 -0
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationTypes.d.ts +24 -0
- package/dist/components/Payroll/OffCycleCreation/index.d.ts +1 -1
- package/dist/components/Payroll/OffCycleDeductionsSetting/OffCycleDeductionsSetting.d.ts +16 -0
- package/dist/components/Payroll/OffCycleDeductionsSetting/OffCycleDeductionsSetting.js.map +1 -1
- package/dist/components/Payroll/OffCycleDeductionsSetting/types.d.ts +13 -0
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.d.ts +1 -0
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js +1 -1
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js.map +1 -1
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes.d.ts +18 -1
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes.js.map +1 -1
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/useOffCyclePayPeriodDateValidation.d.ts +1 -1
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/useOffCyclePayPeriodDateValidation.js +0 -1
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/useOffCyclePayPeriodDateValidation.js.map +1 -1
- package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelection.d.ts +15 -0
- package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelection.js.map +1 -1
- package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.d.ts +1 -0
- package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js.map +1 -1
- package/dist/components/Payroll/OffCycleReasonSelection/types.d.ts +43 -0
- package/dist/components/Payroll/OffCycleReasonSelection/types.js.map +1 -1
- package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.d.ts +1 -0
- package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js.map +1 -1
- package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModalTypes.d.ts +5 -1
- package/dist/components/Payroll/OffCycleTaxWithholdingModal/index.d.ts +0 -1
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTable.d.ts +1 -0
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTable.js.map +1 -1
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes.d.ts +14 -0
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes.js.map +1 -1
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/index.d.ts +0 -2
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.d.ts +3 -0
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.d.ts +19 -5
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +3 -2
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/index.d.ts +0 -1
- package/dist/components/Payroll/PayrollBlocker/payrollHelpers.d.ts +17 -11
- package/dist/components/Payroll/PayrollBlocker/payrollHelpers.js +0 -2
- package/dist/components/Payroll/PayrollBlocker/payrollHelpers.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.d.ts +31 -3
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +1 -2
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +1 -0
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/grossUpHelpers.d.ts +2 -0
- package/dist/components/Payroll/PayrollConfiguration/grossUpHelpers.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.d.ts +2 -0
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.d.ts +42 -3
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +1 -2
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.d.ts +3 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +0 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.d.ts +8 -6
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +0 -1
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.d.ts +65 -0
- package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/index.d.ts +0 -1
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.d.ts +2 -0
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/OffCycleFlowContextual.d.ts +1 -0
- package/dist/components/Payroll/PayrollFlow/OffCycleFlowContextual.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollExecutionFlowContextual.d.ts +1 -0
- package/dist/components/Payroll/PayrollFlow/PayrollExecutionFlowContextual.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollFlow.d.ts +38 -0
- package/dist/components/Payroll/PayrollFlow/PayrollFlow.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.d.ts +27 -0
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/TransitionFlowContextual.d.ts +1 -0
- package/dist/components/Payroll/PayrollFlow/TransitionFlowContextual.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.d.ts +2 -0
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistory.d.ts +25 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistory.js +1 -2
- package/dist/components/Payroll/PayrollHistory/PayrollHistory.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.d.ts +1 -0
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollLanding/PayrollLanding.d.ts +33 -4
- package/dist/components/Payroll/PayrollLanding/PayrollLanding.js +1 -2
- package/dist/components/Payroll/PayrollLanding/PayrollLanding.js.map +1 -1
- package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.d.ts +19 -0
- package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js.map +1 -1
- package/dist/components/Payroll/PayrollLanding/payrollLandingStateMachine.d.ts +2 -0
- package/dist/components/Payroll/PayrollLanding/payrollLandingStateMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollList.d.ts +32 -13
- package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.d.ts +1 -0
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +65 -68
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollList/types.d.ts +1 -0
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.d.ts +39 -3
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +1 -2
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.d.ts +1 -0
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewTypes.d.ts +1 -0
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewTypes.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.d.ts +1 -0
- package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/FastAchSubmissionBlockerBanner.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/GenericBlocker.d.ts +1 -0
- package/dist/components/Payroll/PayrollOverview/SubmissionBlockers/GenericBlocker.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceipts.d.ts +26 -3
- package/dist/components/Payroll/PayrollReceipts/PayrollReceipts.js +8 -12
- package/dist/components/Payroll/PayrollReceipts/PayrollReceipts.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.d.ts +1 -0
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollStatusBadges/PayrollStatusBadges.d.ts +1 -0
- package/dist/components/Payroll/PayrollStatusBadges/PayrollStatusBadges.js.map +1 -1
- package/dist/components/Payroll/PayrollStatusBadges/index.d.ts +0 -2
- package/dist/components/Payroll/PayrollStatusBadges/payrollStatusConfig.d.ts +26 -0
- package/dist/components/Payroll/PayrollStatusBadges/payrollStatusConfig.js.map +1 -1
- package/dist/components/Payroll/PayrollStatusBadges/usePayrollStatusBadges.d.ts +2 -0
- package/dist/components/Payroll/PayrollStatusBadges/usePayrollStatusBadges.js.map +1 -1
- package/dist/components/Payroll/RecoveryCases/RecoveryCases.d.ts +21 -1
- package/dist/components/Payroll/RecoveryCases/RecoveryCases.js +7 -6
- package/dist/components/Payroll/RecoveryCases/RecoveryCases.js.map +1 -1
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesComponents.d.ts +5 -0
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesComponents.js.map +1 -1
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.d.ts +1 -0
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js +3 -2
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesList/RecoveryCasesList.js.map +1 -1
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.d.ts +1 -0
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js.map +1 -1
- package/dist/components/Payroll/RecoveryCases/index.d.ts +0 -1
- package/dist/components/Payroll/RecoveryCases/recoveryCasesStateMachine.d.ts +5 -0
- package/dist/components/Payroll/RecoveryCases/recoveryCasesStateMachine.js.map +1 -1
- package/dist/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.d.ts +5 -0
- package/dist/components/Payroll/RecoveryCases/useRecoveryCaseErrorCode.js.map +1 -1
- package/dist/components/Payroll/Transition/TransitionFlow.d.ts +21 -0
- package/dist/components/Payroll/Transition/TransitionFlow.js.map +1 -1
- package/dist/components/Payroll/Transition/TransitionFlowComponents.d.ts +23 -0
- package/dist/components/Payroll/Transition/TransitionFlowComponents.js.map +1 -1
- package/dist/components/Payroll/Transition/transitionStateMachine.d.ts +2 -0
- package/dist/components/Payroll/Transition/transitionStateMachine.js.map +1 -1
- package/dist/components/Payroll/TransitionCreation/TransitionCreation.d.ts +20 -0
- package/dist/components/Payroll/TransitionCreation/TransitionCreation.js.map +1 -1
- package/dist/components/Payroll/TransitionCreation/TransitionCreationPresentation.d.ts +7 -0
- package/dist/components/Payroll/TransitionCreation/TransitionCreationPresentation.js +10 -10
- package/dist/components/Payroll/TransitionCreation/TransitionCreationPresentation.js.map +1 -1
- package/dist/components/Payroll/TransitionCreation/TransitionCreationTypes.d.ts +27 -0
- package/dist/components/Payroll/TransitionCreation/TransitionCreationTypes.js.map +1 -1
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.d.ts +1 -0
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.js.map +1 -1
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.d.ts +5 -0
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.js.map +1 -1
- package/dist/components/Payroll/helpers.d.ts +157 -26
- package/dist/components/Payroll/helpers.js +0 -1
- package/dist/components/Payroll/helpers.js.map +1 -1
- package/dist/components/Payroll/index.d.ts +11 -2
- package/dist/components/Payroll/payrollTypes.d.ts +24 -0
- package/dist/components/Payroll/payrollTypes.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.d.ts +12 -0
- package/dist/components/Payroll/usePreparedPayrollData.js +34 -22
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/components/Payroll/useUnprocessedTransitionPayPeriods.d.ts +7 -0
- package/dist/components/Payroll/useUnprocessedTransitionPayPeriods.js.map +1 -1
- package/dist/components/TimeOff/AddEmployeesHoliday/AddEmployeesHoliday.d.ts +19 -0
- package/dist/components/TimeOff/AddEmployeesHoliday/AddEmployeesHoliday.js +3 -2
- package/dist/components/TimeOff/AddEmployeesHoliday/AddEmployeesHoliday.js.map +1 -1
- package/dist/components/TimeOff/AddEmployeesToPolicy/AddEmployeesToPolicy.d.ts +44 -0
- package/dist/components/TimeOff/AddEmployeesToPolicy/AddEmployeesToPolicy.js +3 -2
- package/dist/components/TimeOff/AddEmployeesToPolicy/AddEmployeesToPolicy.js.map +1 -1
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetail.d.ts +4 -0
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetail.js.map +1 -1
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetailPresentation.d.ts +1 -0
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetailPresentation.js.map +1 -1
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetailTypes.d.ts +28 -2
- package/dist/components/TimeOff/HolidayPolicyDetail/index.d.ts +0 -2
- package/dist/components/TimeOff/HolidaySelectionForm/HolidaySelectionForm.d.ts +26 -0
- package/dist/components/TimeOff/HolidaySelectionForm/HolidaySelectionForm.js.map +1 -1
- package/dist/components/TimeOff/HolidaySelectionForm/HolidaySelectionFormPresentation.d.ts +1 -0
- package/dist/components/TimeOff/HolidaySelectionForm/HolidaySelectionFormPresentation.js.map +1 -1
- package/dist/components/TimeOff/HolidaySelectionForm/HolidaySelectionFormTypes.d.ts +10 -0
- package/dist/components/TimeOff/PolicyList/PolicyList.d.ts +25 -0
- package/dist/components/TimeOff/PolicyList/PolicyList.js +3 -2
- package/dist/components/TimeOff/PolicyList/PolicyList.js.map +1 -1
- package/dist/components/TimeOff/PolicyList/PolicyListPresentation.d.ts +1 -0
- package/dist/components/TimeOff/PolicyList/PolicyListPresentation.js.map +1 -1
- package/dist/components/TimeOff/PolicyList/PolicyListTypes.d.ts +17 -0
- package/dist/components/TimeOff/PolicySettings/PolicySettings.d.ts +22 -0
- package/dist/components/TimeOff/PolicySettings/PolicySettings.js.map +1 -1
- package/dist/components/TimeOff/PolicySettings/PolicySettingsPresentation.d.ts +14 -0
- package/dist/components/TimeOff/PolicySettings/PolicySettingsPresentation.js.map +1 -1
- package/dist/components/TimeOff/PolicySettings/PolicySettingsTypes.d.ts +31 -0
- package/dist/components/TimeOff/PolicyTypeSelector/PolicyTypeSelector.d.ts +23 -0
- package/dist/components/TimeOff/PolicyTypeSelector/PolicyTypeSelector.js.map +1 -1
- package/dist/components/TimeOff/PolicyTypeSelector/PolicyTypeSelectorPresentation.d.ts +1 -0
- package/dist/components/TimeOff/PolicyTypeSelector/PolicyTypeSelectorPresentation.js.map +1 -1
- package/dist/components/TimeOff/PolicyTypeSelector/PolicyTypeSelectorTypes.d.ts +10 -0
- package/dist/components/TimeOff/TimeOffFlow/TimeOffFlow.d.ts +42 -0
- package/dist/components/TimeOff/TimeOffFlow/TimeOffFlow.js.map +1 -1
- package/dist/components/TimeOff/TimeOffFlow/TimeOffFlowComponents.d.ts +26 -0
- package/dist/components/TimeOff/TimeOffFlow/TimeOffFlowComponents.js.map +1 -1
- package/dist/components/TimeOff/TimeOffFlow/timeOffPolicyTypes.d.ts +15 -2
- package/dist/components/TimeOff/TimeOffFlow/timeOffPolicyTypes.js +1 -6
- package/dist/components/TimeOff/TimeOffFlow/timeOffPolicyTypes.js.map +1 -1
- package/dist/components/TimeOff/TimeOffFlow/timeOffStateMachine.d.ts +1 -0
- package/dist/components/TimeOff/TimeOffFlow/timeOffStateMachine.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationForm.d.ts +29 -0
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationForm.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormPresentation.d.ts +1 -0
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormPresentation.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormTypes.d.ts +59 -1
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/index.d.ts +0 -3
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday.d.ts +1 -0
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.d.ts +1 -0
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.js +43 -42
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentationTypes.d.ts +2 -0
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.d.ts +1 -0
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/useSelectEmployeesData.d.ts +3 -0
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/useSelectEmployeesData.js.map +1 -1
- package/dist/components/TimeOff/TimeOffPolicyDetail/EditEmployeeBalanceModal.d.ts +9 -0
- package/dist/components/TimeOff/TimeOffPolicyDetail/EditEmployeeBalanceModal.js.map +1 -1
- package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetail.d.ts +25 -0
- package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetail.js.map +1 -1
- package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetailPresentation.d.ts +14 -0
- package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetailPresentation.js.map +1 -1
- package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetailTypes.d.ts +97 -6
- package/dist/components/TimeOff/TimeOffPolicyDetail/index.d.ts +1 -5
- package/dist/components/TimeOff/ViewHolidayEmployees/ViewHolidayEmployees.d.ts +23 -0
- package/dist/components/TimeOff/ViewHolidayEmployees/ViewHolidayEmployees.js.map +1 -1
- package/dist/components/TimeOff/ViewHolidayPolicyDetails/ViewHolidayPolicyDetails.d.ts +22 -0
- package/dist/components/TimeOff/ViewHolidayPolicyDetails/ViewHolidayPolicyDetails.js.map +1 -1
- package/dist/components/TimeOff/ViewHolidaySchedule/ViewHolidaySchedule.d.ts +22 -0
- package/dist/components/TimeOff/ViewHolidaySchedule/ViewHolidaySchedule.js.map +1 -1
- package/dist/components/TimeOff/index.d.ts +8 -2
- package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.d.ts +1 -0
- package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.js +48 -49
- package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.js.map +1 -1
- package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTableTypes.d.ts +66 -0
- package/dist/components/TimeOff/shared/PolicyDetailLayout/PolicyDetailLayout.d.ts +1 -0
- package/dist/components/TimeOff/shared/PolicyDetailLayout/PolicyDetailLayout.js.map +1 -1
- package/dist/components/TimeOff/shared/PolicyDetailLayout/PolicyDetailLayoutTypes.d.ts +28 -0
- package/dist/components/TimeOff/shared/PolicyDetailLayout/index.d.ts +0 -1
- package/dist/components/TimeOff/shared/holidayHelpers.d.ts +5 -0
- package/dist/components/TimeOff/shared/holidayHelpers.js.map +1 -1
- package/dist/contexts/ComponentAdapter/componentAdapterTypes.d.ts +4 -4
- package/dist/contexts/ComponentAdapter/createComponentsWithDefaults.d.ts +39 -39
- package/dist/contexts/ComponentAdapter/createComponentsWithDefaults.js.map +1 -1
- package/dist/contexts/ComponentAdapter/useComponentContext.d.ts +42 -42
- package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +206 -205
- package/dist/partner-hook-utils/form/fields/DatePickerHookField.js +1 -1
- package/dist/shared/constants.d.ts +12 -1
- package/dist/shared/constants.js.map +1 -1
- package/docs/reference/endpoint-inventory.json +55 -0
- package/package.json +6 -5
- package/dist/assets/icons/feature-icon-check.svg.js +0 -10
- package/dist/assets/icons/feature-icon-check.svg.js.map +0 -1
- package/dist/components/Payroll/PayrollEditEmployee/index.d.ts +0 -4
- package/dist/components/Payroll/PayrollFlow/index.d.ts +0 -3
- package/dist/components/TimeOff/TimeOffFlow/index.d.ts +0 -3
- package/dist/components/TimeOff/shared/EmployeeTable/index.d.ts +0 -4
|
@@ -1,7 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A single federal holiday row shown in the holiday selection table.
|
|
3
|
+
*
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
1
6
|
export interface HolidayItem {
|
|
7
|
+
/** Stable identifier for the holiday (the federal holiday key). */
|
|
2
8
|
uuid: string;
|
|
9
|
+
/** Localized display name of the holiday. */
|
|
3
10
|
name: string;
|
|
11
|
+
/** Localized text describing when the holiday is observed. */
|
|
4
12
|
observedDate: string;
|
|
13
|
+
/** Localized date string for the next time this holiday will be observed. */
|
|
5
14
|
nextObservation: string;
|
|
6
15
|
}
|
|
7
16
|
interface HolidaySelectionFormBaseProps {
|
|
@@ -24,5 +33,6 @@ interface HolidaySelectionFormViewModeProps extends HolidaySelectionFormBaseProp
|
|
|
24
33
|
onContinue?: never;
|
|
25
34
|
onBack?: never;
|
|
26
35
|
}
|
|
36
|
+
/** @internal */
|
|
27
37
|
export type HolidaySelectionFormPresentationProps = HolidaySelectionFormSelectModeProps | HolidaySelectionFormViewModeProps;
|
|
28
38
|
export {};
|
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
import { BaseComponentInterface } from '../../Base';
|
|
2
|
+
/**
|
|
3
|
+
* Props for the {@link PolicyList} component.
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
2
7
|
export interface PolicyListProps extends BaseComponentInterface<'Company.TimeOff.TimeOffPolicies'> {
|
|
8
|
+
/** The associated company identifier. */
|
|
3
9
|
companyId: string;
|
|
4
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Displays all active time off policies (sick, vacation, and holiday) for a company.
|
|
13
|
+
*
|
|
14
|
+
* Each row shows the policy name and the enrolled-employee count. Incomplete policies surface a
|
|
15
|
+
* finish-setup action. Sick and vacation policies are deactivated via the time-off policies API;
|
|
16
|
+
* the holiday pay policy (if one exists) is merged into the same list and is deleted via the
|
|
17
|
+
* holiday pay policy API. Both flows go through a confirmation dialog and show a success alert.
|
|
18
|
+
*
|
|
19
|
+
* @remarks
|
|
20
|
+
* | Event | Description | Data |
|
|
21
|
+
* | ----- | ----------- | ---- |
|
|
22
|
+
* | `timeOff/createPolicy` | The user clicked the create-policy action. | — |
|
|
23
|
+
* | `timeOff/viewPolicy` | The user opened an existing policy or clicked finish-setup on an incomplete one. | `{ policyId: string, policyType: string }` |
|
|
24
|
+
* | `timeOff/deletePolicy/done` | A policy was successfully deleted. | `{ policyId: string }` |
|
|
25
|
+
*
|
|
26
|
+
* @param props - {@link PolicyListProps}
|
|
27
|
+
* @returns The rendered policy list.
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
5
30
|
export declare function PolicyList({ FallbackComponent, ...props }: PolicyListProps): import("react").JSX.Element;
|
|
@@ -11,12 +11,13 @@ import { UnprocessableEntityError as V } from "@gusto/embedded-api-v-2025-11-15/
|
|
|
11
11
|
import { PolicyListPresentation as W } from "./PolicyListPresentation.js";
|
|
12
12
|
import { isListedTimeOffPolicyType as k } from "../TimeOffFlow/timeOffPolicyTypes.js";
|
|
13
13
|
import { BaseBoundaries as K, BaseLayout as z } from "../../Base/Base.js";
|
|
14
|
+
import "../../Base/useBase.js";
|
|
14
15
|
import { useBaseSubmit as J } from "../../Base/useBaseSubmit.js";
|
|
15
16
|
import { SDKInternalError as E } from "../../../types/sdkError.js";
|
|
16
17
|
import { composeErrorHandler as X } from "../../../partner-hook-utils/composeErrorHandler.js";
|
|
17
18
|
import { componentEvents as a } from "../../../shared/constants.js";
|
|
18
19
|
import { useI18n as Z } from "../../../i18n/I18n.js";
|
|
19
|
-
function
|
|
20
|
+
function Oe({ FallbackComponent: o, ...t }) {
|
|
20
21
|
return /* @__PURE__ */ n(
|
|
21
22
|
K,
|
|
22
23
|
{
|
|
@@ -120,6 +121,6 @@ function $({ companyId: o, onEvent: t }) {
|
|
|
120
121
|
) });
|
|
121
122
|
}
|
|
122
123
|
export {
|
|
123
|
-
|
|
124
|
+
Oe as PolicyList
|
|
124
125
|
};
|
|
125
126
|
//# sourceMappingURL=PolicyList.js.map
|
|
@@ -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-2025-11-15/react-query/timeOffPoliciesGetAll'\nimport { useTimeOffPoliciesDeactivateMutation } from '@gusto/embedded-api-v-2025-11-15/react-query/timeOffPoliciesDeactivate'\nimport { useEmployeesListSuspense } from '@gusto/embedded-api-v-2025-11-15/react-query/employeesList'\nimport {\n useHolidayPayPoliciesGet,\n invalidateAllHolidayPayPoliciesGet,\n} from '@gusto/embedded-api-v-2025-11-15/react-query/holidayPayPoliciesGet'\nimport { useHolidayPayPoliciesDeleteMutation } from '@gusto/embedded-api-v-2025-11-15/react-query/holidayPayPoliciesDelete'\nimport type { TimeOffPolicy } from '@gusto/embedded-api-v-2025-11-15/models/components/timeoffpolicy'\nimport { UnprocessableEntityError } from '@gusto/embedded-api-v-2025-11-15/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\nexport interface PolicyListProps extends BaseComponentInterface<'Company.TimeOff.TimeOffPolicies'> {\n companyId: string\n}\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","PolicyListPresent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AAI;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-v-2025-11-15/react-query/timeOffPoliciesGetAll'\nimport { useTimeOffPoliciesDeactivateMutation } from '@gusto/embedded-api-v-2025-11-15/react-query/timeOffPoliciesDeactivate'\nimport { useEmployeesListSuspense } from '@gusto/embedded-api-v-2025-11-15/react-query/employeesList'\nimport {\n useHolidayPayPoliciesGet,\n invalidateAllHolidayPayPoliciesGet,\n} from '@gusto/embedded-api-v-2025-11-15/react-query/holidayPayPoliciesGet'\nimport { useHolidayPayPoliciesDeleteMutation } from '@gusto/embedded-api-v-2025-11-15/react-query/holidayPayPoliciesDelete'\nimport type { TimeOffPolicy } from '@gusto/embedded-api-v-2025-11-15/models/components/timeoffpolicy'\nimport { UnprocessableEntityError } from '@gusto/embedded-api-v-2025-11-15/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 * @remarks\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,CAAqB,IAAIF,EAAwB,IAAI,GAE1E,EAAE,MAAMG,EAAA,IAAiBC,EAAiC;AAAA,IAC9D,aAAajB;AAAA,EAAA,CACd,GACKkB,KAAmBF,EAAa,mBAAmB,CAAA,GAAI;AAAA,IAC3D,CAAAG,MAAUA,EAAO,YAAYC,EAA0BD,EAAO,UAAU;AAAA,EAAA,GAMpEE,IAAeC;AAAA,IACnB,EAAE,aAAatB,EAAA;AAAA,IACf;AAAA,MACE,cA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,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,2 +1,3 @@
|
|
|
1
1
|
import { PolicyListPresentationProps } from './PolicyListTypes';
|
|
2
|
+
/** @internal */
|
|
2
3
|
export declare function PolicyListPresentation({ policies, onCreatePolicy, onEditPolicy, onFinishSetup, onDeletePolicy, deleteSuccessAlert, onDismissDeleteAlert, isDeletingPolicyId, isPending, }: PolicyListPresentationProps): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolicyListPresentation.js","sources":["../../../../src/components/TimeOff/PolicyList/PolicyListPresentation.tsx"],"sourcesContent":["import { useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport type { PolicyListPresentationProps, PolicyListItem } from './PolicyListTypes'\nimport styles from './PolicyListPresentation.module.scss'\nimport {\n DataView,\n Flex,\n EmptyData,\n ActionsLayout,\n HamburgerMenu,\n useDataView,\n} from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { isEditableTimeOffPolicyType } from '@/components/TimeOff/TimeOffFlow/timeOffPolicyTypes'\n\nexport function PolicyListPresentation({\n policies,\n onCreatePolicy,\n onEditPolicy,\n onFinishSetup,\n onDeletePolicy,\n deleteSuccessAlert,\n onDismissDeleteAlert,\n isDeletingPolicyId,\n isPending,\n}: PolicyListPresentationProps) {\n const { Button, Heading, Alert, Dialog } = useComponentContext()\n useI18n('Company.TimeOff.TimeOffPolicies')\n const { t } = useTranslation('Company.TimeOff.TimeOffPolicies')\n\n const [deletePolicyDialogState, setDeletePolicyDialogState] = useState<{\n isOpen: boolean\n policy: PolicyListItem | null\n }>({\n isOpen: false,\n policy: null,\n })\n\n const handleOpenDeleteDialog = (policy: PolicyListItem) => {\n setDeletePolicyDialogState({ isOpen: true, policy })\n }\n\n const handleCloseDeleteDialog = () => {\n setDeletePolicyDialogState({ isOpen: false, policy: null })\n }\n\n const handleConfirmDelete = async () => {\n if (deletePolicyDialogState.policy) {\n await onDeletePolicy(deletePolicyDialogState.policy)\n handleCloseDeleteDialog()\n }\n }\n\n const { ...dataViewProps } = useDataView({\n data: policies,\n columns: [\n {\n title: t('tableHeaders.name'),\n render: (policy: PolicyListItem) => policy.name,\n },\n {\n title: t('tableHeaders.enrolled'),\n render: (policy: PolicyListItem) => policy.enrolledDisplay,\n },\n ],\n itemMenu: (policy: PolicyListItem) => {\n const isDeleting = isDeletingPolicyId === policy.uuid\n const isEditable = isEditableTimeOffPolicyType(policy.policyType)\n\n const menuItems = isEditable\n ? [\n {\n label: t('actions.viewPolicy'),\n onClick: () => {\n onEditPolicy(policy)\n },\n },\n {\n label: t('actions.deletePolicy'),\n onClick: () => {\n handleOpenDeleteDialog(policy)\n },\n },\n ]\n : [\n {\n label: t('actions.viewPolicy'),\n onClick: () => {\n onEditPolicy(policy)\n },\n },\n ]\n\n return (\n <div className={styles.actionsCell}>\n {isEditable && !policy.isComplete && (\n <Button\n variant=\"secondary\"\n onClick={() => {\n onFinishSetup(policy)\n }}\n >\n {t('finishSetupCta')}\n </Button>\n )}\n <HamburgerMenu\n isLoading={isDeleting}\n triggerLabel={t('actions.menuTrigger', { name: policy.name })}\n menuLabel={t('actions.menuFor', { name: policy.name })}\n items={menuItems}\n />\n </div>\n )\n },\n emptyState: () => (\n <EmptyData title={t('emptyState.heading')} description={t('emptyState.body')}>\n <ActionsLayout justifyContent=\"center\">\n <Button variant=\"secondary\" onClick={onCreatePolicy}>\n {t('createPolicyCta')}\n </Button>\n </ActionsLayout>\n </EmptyData>\n ),\n })\n\n return (\n <Flex flexDirection=\"column\" gap={16}>\n {deleteSuccessAlert && (\n <Alert status=\"success\" label={deleteSuccessAlert} onDismiss={onDismissDeleteAlert} />\n )}\n\n <Flex\n flexDirection={{ base: 'column', medium: 'row' }}\n justifyContent=\"space-between\"\n alignItems=\"flex-start\"\n gap={{ base: 12, medium: 24 }}\n >\n <Heading as=\"h2\">{t('pageTitle')}</Heading>\n <Button variant=\"primary\" onClick={onCreatePolicy}>\n {t('createPolicyCta')}\n </Button>\n </Flex>\n\n <DataView label={t('tableLabel')} {...dataViewProps} />\n\n <Dialog\n isOpen={deletePolicyDialogState.isOpen}\n onClose={handleCloseDeleteDialog}\n onPrimaryActionClick={handleConfirmDelete}\n isPrimaryActionLoading={isPending}\n isDestructive\n title={\n deletePolicyDialogState.policy?.isHoliday\n ? t('deleteHolidayDialog.title')\n : t('deletePolicyDialog.title', {\n name: deletePolicyDialogState.policy?.name ?? '',\n })\n }\n primaryActionLabel={t('deletePolicyDialog.confirmCta')}\n closeActionLabel={t('deletePolicyDialog.cancelCta')}\n >\n {deletePolicyDialogState.policy?.isHoliday\n ? t('deleteHolidayDialog.description')\n : t('deletePolicyDialog.description', {\n name: deletePolicyDialogState.policy?.name ?? '',\n })}\n </Dialog>\n </Flex>\n )\n}\n"],"names":["PolicyListPresentation","policies","onCreatePolicy","onEditPolicy","onFinishSetup","onDeletePolicy","deleteSuccessAlert","onDismissDeleteAlert","isDeletingPolicyId","isPending","Button","Heading","Alert","Dialog","useComponentContext","useI18n","t","useTranslation","deletePolicyDialogState","setDeletePolicyDialogState","useState","handleOpenDeleteDialog","policy","handleCloseDeleteDialog","handleConfirmDelete","dataViewProps","useDataView","isDeleting","isEditable","isEditableTimeOffPolicyType","menuItems","jsxs","styles","jsx","HamburgerMenu","EmptyData","ActionsLayout","Flex","DataView"],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"PolicyListPresentation.js","sources":["../../../../src/components/TimeOff/PolicyList/PolicyListPresentation.tsx"],"sourcesContent":["import { useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport type { PolicyListPresentationProps, PolicyListItem } from './PolicyListTypes'\nimport styles from './PolicyListPresentation.module.scss'\nimport {\n DataView,\n Flex,\n EmptyData,\n ActionsLayout,\n HamburgerMenu,\n useDataView,\n} from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\nimport { isEditableTimeOffPolicyType } from '@/components/TimeOff/TimeOffFlow/timeOffPolicyTypes'\n\n/** @internal */\nexport function PolicyListPresentation({\n policies,\n onCreatePolicy,\n onEditPolicy,\n onFinishSetup,\n onDeletePolicy,\n deleteSuccessAlert,\n onDismissDeleteAlert,\n isDeletingPolicyId,\n isPending,\n}: PolicyListPresentationProps) {\n const { Button, Heading, Alert, Dialog } = useComponentContext()\n useI18n('Company.TimeOff.TimeOffPolicies')\n const { t } = useTranslation('Company.TimeOff.TimeOffPolicies')\n\n const [deletePolicyDialogState, setDeletePolicyDialogState] = useState<{\n isOpen: boolean\n policy: PolicyListItem | null\n }>({\n isOpen: false,\n policy: null,\n })\n\n const handleOpenDeleteDialog = (policy: PolicyListItem) => {\n setDeletePolicyDialogState({ isOpen: true, policy })\n }\n\n const handleCloseDeleteDialog = () => {\n setDeletePolicyDialogState({ isOpen: false, policy: null })\n }\n\n const handleConfirmDelete = async () => {\n if (deletePolicyDialogState.policy) {\n await onDeletePolicy(deletePolicyDialogState.policy)\n handleCloseDeleteDialog()\n }\n }\n\n const { ...dataViewProps } = useDataView({\n data: policies,\n columns: [\n {\n title: t('tableHeaders.name'),\n render: (policy: PolicyListItem) => policy.name,\n },\n {\n title: t('tableHeaders.enrolled'),\n render: (policy: PolicyListItem) => policy.enrolledDisplay,\n },\n ],\n itemMenu: (policy: PolicyListItem) => {\n const isDeleting = isDeletingPolicyId === policy.uuid\n const isEditable = isEditableTimeOffPolicyType(policy.policyType)\n\n const menuItems = isEditable\n ? [\n {\n label: t('actions.viewPolicy'),\n onClick: () => {\n onEditPolicy(policy)\n },\n },\n {\n label: t('actions.deletePolicy'),\n onClick: () => {\n handleOpenDeleteDialog(policy)\n },\n },\n ]\n : [\n {\n label: t('actions.viewPolicy'),\n onClick: () => {\n onEditPolicy(policy)\n },\n },\n ]\n\n return (\n <div className={styles.actionsCell}>\n {isEditable && !policy.isComplete && (\n <Button\n variant=\"secondary\"\n onClick={() => {\n onFinishSetup(policy)\n }}\n >\n {t('finishSetupCta')}\n </Button>\n )}\n <HamburgerMenu\n isLoading={isDeleting}\n triggerLabel={t('actions.menuTrigger', { name: policy.name })}\n menuLabel={t('actions.menuFor', { name: policy.name })}\n items={menuItems}\n />\n </div>\n )\n },\n emptyState: () => (\n <EmptyData title={t('emptyState.heading')} description={t('emptyState.body')}>\n <ActionsLayout justifyContent=\"center\">\n <Button variant=\"secondary\" onClick={onCreatePolicy}>\n {t('createPolicyCta')}\n </Button>\n </ActionsLayout>\n </EmptyData>\n ),\n })\n\n return (\n <Flex flexDirection=\"column\" gap={16}>\n {deleteSuccessAlert && (\n <Alert status=\"success\" label={deleteSuccessAlert} onDismiss={onDismissDeleteAlert} />\n )}\n\n <Flex\n flexDirection={{ base: 'column', medium: 'row' }}\n justifyContent=\"space-between\"\n alignItems=\"flex-start\"\n gap={{ base: 12, medium: 24 }}\n >\n <Heading as=\"h2\">{t('pageTitle')}</Heading>\n <Button variant=\"primary\" onClick={onCreatePolicy}>\n {t('createPolicyCta')}\n </Button>\n </Flex>\n\n <DataView label={t('tableLabel')} {...dataViewProps} />\n\n <Dialog\n isOpen={deletePolicyDialogState.isOpen}\n onClose={handleCloseDeleteDialog}\n onPrimaryActionClick={handleConfirmDelete}\n isPrimaryActionLoading={isPending}\n isDestructive\n title={\n deletePolicyDialogState.policy?.isHoliday\n ? t('deleteHolidayDialog.title')\n : t('deletePolicyDialog.title', {\n name: deletePolicyDialogState.policy?.name ?? '',\n })\n }\n primaryActionLabel={t('deletePolicyDialog.confirmCta')}\n closeActionLabel={t('deletePolicyDialog.cancelCta')}\n >\n {deletePolicyDialogState.policy?.isHoliday\n ? t('deleteHolidayDialog.description')\n : t('deletePolicyDialog.description', {\n name: deletePolicyDialogState.policy?.name ?? '',\n })}\n </Dialog>\n </Flex>\n )\n}\n"],"names":["PolicyListPresentation","policies","onCreatePolicy","onEditPolicy","onFinishSetup","onDeletePolicy","deleteSuccessAlert","onDismissDeleteAlert","isDeletingPolicyId","isPending","Button","Heading","Alert","Dialog","useComponentContext","useI18n","t","useTranslation","deletePolicyDialogState","setDeletePolicyDialogState","useState","handleOpenDeleteDialog","policy","handleCloseDeleteDialog","handleConfirmDelete","dataViewProps","useDataView","isDeleting","isEditable","isEditableTimeOffPolicyType","menuItems","jsxs","styles","jsx","HamburgerMenu","EmptyData","ActionsLayout","Flex","DataView"],"mappings":";;;;;;;;;;;;;AAiBO,SAASA,EAAuB;AAAA,EACrC,UAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,eAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,sBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,WAAAC;AACF,GAAgC;AAC9B,QAAM,EAAE,QAAAC,GAAQ,SAAAC,GAAS,OAAAC,GAAO,QAAAC,EAAA,IAAWC,EAAA;AAC3C,EAAAC,EAAQ,iCAAiC;AACzC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,iCAAiC,GAExD,CAACC,GAAyBC,CAA0B,IAAIC,EAG3D;AAAA,IACD,QAAQ;AAAA,IACR,QAAQ;AAAA,EAAA,CACT,GAEKC,IAAyB,CAACC,MAA2B;AACzD,IAAAH,EAA2B,EAAE,QAAQ,IAAM,QAAAG,EAAA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A,QACC,QAAQK,EAAwB;AAAA,QAChC,SAASK;AAAA,QACT,sBAAsBC;AAAA,QACtB,wBAAwBf;AAAA,QACxB,eAAa;AAAA,QACb,OACES,EAAwB,QAAQ,YAC5BF,EAAE,2BAA2B,IAC7BA,EAAE,4BAA4B;AAAA,UAC5B,MAAME,EAAwB,QAAQ,QAAQ;AAAA,QAAA,CAC/C;AAAA,QAEP,oBAAoBF,EAAE,+BAA+B;AAAA,QACrD,kBAAkBA,EAAE,8BAA8B;AAAA,QAEjD,YAAwB,QAAQ,YAC7BA,EAAE,iCAAiC,IACnCA,EAAE,kCAAkC;AAAA,UAClC,MAAME,EAAwB,QAAQ,QAAQ;AAAA,QAAA,CAC/C;AAAA,MAAA;AAAA,IAAA;AAAA,EACP,GACF;AAEJ;"}
|
|
@@ -1,19 +1,36 @@
|
|
|
1
|
+
/** @internal */
|
|
1
2
|
export interface PolicyListItem {
|
|
3
|
+
/** Stable identifier for the policy row (time-off policy UUID, or company UUID for the merged holiday entry). */
|
|
2
4
|
uuid: string;
|
|
5
|
+
/** Display name of the policy. */
|
|
3
6
|
name: string;
|
|
7
|
+
/** Policy type string from the time-off API (e.g. sick, vacation), or `'holiday'` for the merged holiday entry. */
|
|
4
8
|
policyType: string;
|
|
9
|
+
/** Whether the policy has finished setup. Incomplete entries show a finish-setup action. */
|
|
5
10
|
isComplete: boolean;
|
|
11
|
+
/** Pre-formatted enrolled-employees label (e.g. "All employees", "3 employees", or a dash). */
|
|
6
12
|
enrolledDisplay: string;
|
|
13
|
+
/** True for the merged holiday pay policy entry; controls the delete-confirmation copy. */
|
|
7
14
|
isHoliday?: boolean;
|
|
8
15
|
}
|
|
16
|
+
/** @internal */
|
|
9
17
|
export interface PolicyListPresentationProps {
|
|
18
|
+
/** The list of policies to render, including the optional merged holiday entry. */
|
|
10
19
|
policies: PolicyListItem[];
|
|
20
|
+
/** Invoked when the user clicks the create-policy action. */
|
|
11
21
|
onCreatePolicy: () => void;
|
|
22
|
+
/** Invoked when the user opens an existing policy from the row menu. */
|
|
12
23
|
onEditPolicy: (policy: PolicyListItem) => void;
|
|
24
|
+
/** Invoked when the user clicks the finish-setup action on an incomplete policy. */
|
|
13
25
|
onFinishSetup: (policy: PolicyListItem) => void;
|
|
26
|
+
/** Invoked when the user confirms deletion; resolves to true on success so the dialog can close. */
|
|
14
27
|
onDeletePolicy: (policy: PolicyListItem) => Promise<boolean>;
|
|
28
|
+
/** Optional success message rendered as a dismissible alert after a delete. */
|
|
15
29
|
deleteSuccessAlert?: string | null;
|
|
30
|
+
/** Invoked when the user dismisses the delete success alert. */
|
|
16
31
|
onDismissDeleteAlert?: () => void;
|
|
32
|
+
/** UUID of the policy currently being deleted; used to show a per-row loading state. */
|
|
17
33
|
isDeletingPolicyId?: string | null;
|
|
34
|
+
/** True while any mutation is in flight; drives the dialog confirm button's loading state. */
|
|
18
35
|
isPending?: boolean;
|
|
19
36
|
}
|
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
import { BaseComponentInterface } from '../../Base';
|
|
2
|
+
/**
|
|
3
|
+
* Props for {@link PolicySettings}.
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
2
7
|
export interface PolicySettingsProps extends BaseComponentInterface {
|
|
8
|
+
/** UUID of the time off policy being configured. */
|
|
3
9
|
policyId: string;
|
|
10
|
+
/** Whether the form is being used to create a new policy or edit an existing one. Defaults to create. */
|
|
4
11
|
mode?: 'create' | 'edit';
|
|
5
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* Configures additional policy limits and rules for a sick or vacation policy. This step is skipped for policies with unlimited accrual.
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* Fetches the time off policy, derives the accrual method category, and submits updates to the time off policies endpoint. Emits the following events:
|
|
18
|
+
*
|
|
19
|
+
* | Event | Description | Data |
|
|
20
|
+
* | ----- | ----------- | ---- |
|
|
21
|
+
* | `timeOff/policySettings/done` | Fired when policy settings are saved | The updated `TimeOffPolicy` |
|
|
22
|
+
* | `timeOff/policySettings/back` | Fired when the user navigates back | — |
|
|
23
|
+
*
|
|
24
|
+
* @param props - {@link PolicySettingsProps}
|
|
25
|
+
* @returns The rendered policy settings form.
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
6
28
|
export declare function PolicySettings(props: PolicySettingsProps): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolicySettings.js","sources":["../../../../src/components/TimeOff/PolicySettings/PolicySettings.tsx"],"sourcesContent":["import { useTimeOffPoliciesGetSuspense } from '@gusto/embedded-api-v-2025-11-15/react-query/timeOffPoliciesGet'\nimport { useTimeOffPoliciesUpdateMutation } from '@gusto/embedded-api-v-2025-11-15/react-query/timeOffPoliciesUpdate'\nimport type { PutV1TimeOffPoliciesTimeOffPolicyUuidRequestBody } from '@gusto/embedded-api-v-2025-11-15/models/operations/putv1timeoffpoliciestimeoffpolicyuuid'\nimport type { TimeOffPolicy } from '@gusto/embedded-api-v-2025-11-15/models/components/timeoffpolicy'\nimport { UnprocessableEntityError } from '@gusto/embedded-api-v-2025-11-15/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\nexport interface PolicySettingsProps extends BaseComponentInterface {\n policyId: string\n mode?: 'create' | 'edit'\n}\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-2025-11-15', '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":";;;;;;;;;;;;AAoBO,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,EAAO,sBAAsB,IAG5DA,EAAO,YAAY,SACrBC,EAAS,wBAAwB,IACjCA,EAAS,iBAAiB,OAAOD,EAAO,QAAQ,IAG9CA,EAAO,uBAAuB,SAChCC,EAAS,wBAAwB,IACjCA,EAAS,iBAAiB,OAAOD,EAAO,mBAAmB,IAGzDA,EAAO,4BAA4B,QAAQA,EAAO,2BAA2B,M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ACF,kBAAM,EAAE,eAAAoB,MAAkB,MAAMJ,EAAoB;AAAA,cAClD,SAAS;AAAA,gBACP,mBAAmBZ;AAAA,gBACnB,aAAaL,EAAuBC,GAAMC,GAASC,CAAe;AAAA,cAAA;AAAA,YACpE,CACD;AAED,YAAKU,EAAY,kBAAkB;AAAA,cACjC,UAAU,CAAC,oCAAoC,mBAAmB,KAAK;AAAA,YAAA,CACxE,GACDH,EAAQY,EAAgB,+BAA+BD,CAAa;AAAA,UACtE,SAASE,GAAK;AACZ,gBAAIA,aAAeC,GAA0B;AAC3C,kBAAID,EAAI,OAAO,KAAK,OAAKE,EAAE,YAAY,2BAA2B;AAChE,sBAAM,IAAIC;AAAA,kBACRlB,EAAE,6CAA6C;AAAA,kBAC/C;AAAA,gBAAA;AAGJ,oBAAMmB,IAAiB,CAAC,GAAG,IAAI,IAAIJ,EAAI,OAAO,IAAI,CAAAE,MAAKA,EAAE,OAAO,EAAE,OAAO,OAAO,CAAC,CAAC;AAClF,oBAAM,IAAIC;AAAA,gBACRlB,EAAE,qCAAqC;AAAA,kBACrC,SAASmB,EAAe,KAAK,IAAI;AAAA,gBAAA,CAClC;AAAA,gBACD;AAAA,cAAA;AAAA,YAEJ;AACA,kBAAMJ;AAAA,UACR;AAAA,QACF,CAAC;AAAA,MACH;AAAA,MAUI,QARe,MAAM;AACvB,QAAAb,EAAQY,EAAgB,6BAA6B;AAAA,MACvD;AAAA,MAOI,eAAezB,EAAoBC,CAAM;AAAA,MACzC,MAAAQ;AAAA,MACA,mBAAmBA,MAAS,SAASR,EAAO,OAAO;AAAA,MACnD,WAAAoB;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
1
|
+
{"version":3,"file":"PolicySettings.js","sources":["../../../../src/components/TimeOff/PolicySettings/PolicySettings.tsx"],"sourcesContent":["import { useTimeOffPoliciesGetSuspense } from '@gusto/embedded-api-v-2025-11-15/react-query/timeOffPoliciesGet'\nimport { useTimeOffPoliciesUpdateMutation } from '@gusto/embedded-api-v-2025-11-15/react-query/timeOffPoliciesUpdate'\nimport type { PutV1TimeOffPoliciesTimeOffPolicyUuidRequestBody } from '@gusto/embedded-api-v-2025-11-15/models/operations/putv1timeoffpoliciestimeoffpolicyuuid'\nimport type { TimeOffPolicy } from '@gusto/embedded-api-v-2025-11-15/models/components/timeoffpolicy'\nimport { UnprocessableEntityError } from '@gusto/embedded-api-v-2025-11-15/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 {\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 * | 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-2025-11-15', '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":";;;;;;;;;;;;AA0CO,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,EAAO,sBAAsB,IAG5DA,EAAO,YAAY,SACrBC,EAAS,wBAAwB,IACjCA,EAAS,iBAAiB,OAAOD,EAAO,QAAQ,IAG9CA,EAAO,uBAAuB,SAChCC,EAAS,wBAAwB,IACjCA,EAAS,iBAAiB,OAAOD,EAAO,mBAAmB,IAGzDA,EAAO,4BAA4B,QAAQA,EAAO,2BAA2B,MAC/EC,EAAS,uBAAuB,IA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,MAAkB,MAAMJ,EAAoB;AAAA,cAClD,SAAS;AAAA,gBACP,mBAAmBZ;AAAA,gBACnB,aAAaL,EAAuBC,GAAMC,GAASC,CAAe;AAAA,cAAA;AAAA,YACpE,CACD;AAED,YAAKU,EAAY,kBAAkB;AAAA,cACjC,UAAU,CAAC,oCAAoC,mBAAmB,KAAK;AAAA,YAAA,CACxE,GACDH,EAAQY,EAAgB,+BAA+BD,CAAa;AAAA,UACtE,SAASE,GAAK;AACZ,gBAAIA,aAAeC,GAA0B;AAC3C,kBAAID,EAAI,OAAO,KAAK,OAAKE,EAAE,YAAY,2BAA2B;AAChE,sBAAM,IAAIC;AAAA,kBACRlB,EAAE,6CAA6C;AAAA,kBAC/C;AAAA,gBAAA;AAGJ,oBAAMmB,IAAiB,CAAC,GAAG,IAAI,IAAIJ,EAAI,OAAO,IAAI,CAAAE,MAAKA,EAAE,OAAO,EAAE,OAAO,OAAO,CAAC,CAAC;AAClF,oBAAM,IAAIC;AAAA,gBACRlB,EAAE,qCAAqC;AAAA,kBACrC,SAASmB,EAAe,KAAK,IAAI;AAAA,gBAAA,CAClC;AAAA,gBACD;AAAA,cAAA;AAAA,YAEJ;AACA,kBAAMJ;AAAA,UACR;AAAA,QACF,CAAC;AAAA,MACH;AAAA,MAUI,QARe,MAAM;AACvB,QAAAb,EAAQY,EAAgB,6BAA6B;AAAA,MACvD;AAAA,MAOI,eAAezB,EAAoBC,CAAM;AAAA,MACzC,MAAAQ;AAAA,MACA,mBAAmBA,MAAS,SAASR,EAAO,OAAO;AAAA,MACnD,WAAAoB;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1,2 +1,16 @@
|
|
|
1
1
|
import { PolicySettingsPresentationProps } from './PolicySettingsTypes';
|
|
2
|
+
/**
|
|
3
|
+
* Presentation-only form for configuring time off policy limits and rules.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Use this component when you need to render the policy settings form without the data-fetching container — provide the `accrualMethod` and handle submission yourself. For the data-connected version, use {@link PolicySettings}.
|
|
7
|
+
*
|
|
8
|
+
* The fields shown depend on `accrualMethod`:
|
|
9
|
+
* - Accrual maximum and waiting period are shown for `'hours_worked'` and `'fixed_per_pay_period'`
|
|
10
|
+
* - Balance maximum, carry-over limit, and paid-out-on-termination are always shown
|
|
11
|
+
*
|
|
12
|
+
* @param props - {@link PolicySettingsPresentationProps}
|
|
13
|
+
* @returns The rendered policy settings form.
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
2
16
|
export declare function PolicySettingsPresentation({ accrualMethod, onContinue, onBack, defaultValues, mode, editingPolicyName, isPending, }: PolicySettingsPresentationProps): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolicySettingsPresentation.js","sources":["../../../../src/components/TimeOff/PolicySettings/PolicySettingsPresentation.tsx"],"sourcesContent":["import { useId } from 'react'\nimport { FormProvider, useForm, useWatch } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport type { PolicySettingsFormData, PolicySettingsPresentationProps } from './PolicySettingsTypes'\nimport styles from './PolicySettings.module.scss'\nimport { Flex, ActionsLayout, NumberInputField, SwitchField } from '@/components/Common'\nimport { Form as HtmlForm } from '@/components/Common/Form'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\n\nconst PolicySettingsSchema = z.object({\n accrualMaximumEnabled: z.boolean(),\n accrualMaximum: z.number().optional(),\n balanceMaximumEnabled: z.boolean(),\n balanceMaximum: z.number().optional(),\n carryOverLimitEnabled: z.boolean(),\n carryOverLimit: z.number().optional(),\n waitingPeriodEnabled: z.boolean(),\n waitingPeriod: z.number().int().optional(),\n paidOutOnTermination: z.boolean(),\n})\n\nexport function PolicySettingsPresentation({\n accrualMethod,\n onContinue,\n onBack,\n defaultValues,\n mode,\n editingPolicyName,\n isPending = false,\n}: PolicySettingsPresentationProps) {\n useI18n('Company.TimeOff.CreateTimeOffPolicy')\n const { t } = useTranslation('Company.TimeOff.CreateTimeOffPolicy')\n const { Heading, Button } = useComponentContext()\n const headingId = useId()\n\n const accrualMaxInputId = useId()\n const balanceMaxInputId = useId()\n const carryOverInputId = useId()\n const waitingPeriodInputId = useId()\n\n const formMethods = useForm<PolicySettingsFormData>({\n resolver: zodResolver(PolicySettingsSchema),\n defaultValues: {\n accrualMaximumEnabled: false,\n balanceMaximumEnabled: false,\n carryOverLimitEnabled: false,\n waitingPeriodEnabled: false,\n paidOutOnTermination: false,\n ...defaultValues,\n },\n })\n\n const { control } = formMethods\n const accrualMaximumEnabled = useWatch({ control, name: 'accrualMaximumEnabled' })\n const balanceMaximumEnabled = useWatch({ control, name: 'balanceMaximumEnabled' })\n const carryOverLimitEnabled = useWatch({ control, name: 'carryOverLimitEnabled' })\n const waitingPeriodEnabled = useWatch({ control, name: 'waitingPeriodEnabled' })\n\n const isHoursWorked = accrualMethod === 'hours_worked'\n const isFixedPerPayPeriod = accrualMethod === 'fixed_per_pay_period'\n const showAccrualMaximum = isHoursWorked || isFixedPerPayPeriod\n const showWaitingPeriod = isHoursWorked || isFixedPerPayPeriod\n\n const handleSubmit = (data: PolicySettingsFormData) => {\n onContinue(data)\n }\n\n return (\n <FormProvider {...formMethods}>\n <HtmlForm aria-labelledby={headingId} onSubmit={formMethods.handleSubmit(handleSubmit)}>\n <div className={styles.policySettings}>\n <Flex flexDirection=\"column\" gap={32}>\n <Heading as=\"h2\" id={headingId}>\n {mode === 'edit' && editingPolicyName\n ? t('policySettings.editTitle', { name: editingPolicyName })\n : t('policySettings.createTitle')}\n </Heading>\n\n <Flex flexDirection=\"column\" gap={20}>\n {showAccrualMaximum && (\n <>\n <div className={styles.settingRow}>\n <NumberInputField\n className={styles.settingField}\n id={accrualMaxInputId}\n name=\"accrualMaximum\"\n label={t('policySettings.accrualMaximumLabel')}\n description={t('policySettings.accrualMaximumHint')}\n adornmentEnd={t('policySettings.hoursUnit')}\n placeholder={t('policySettings.numberOfHoursPlaceholder')}\n isDisabled={!accrualMaximumEnabled}\n min={0}\n max={20000}\n />\n <div className={styles.toggleCell}>\n <SwitchField\n name=\"accrualMaximumEnabled\"\n label={t('policySettings.accrualMaximumLabel')}\n shouldVisuallyHideLabel\n aria-controls={accrualMaxInputId}\n />\n </div>\n </div>\n\n <hr className={styles.divider} />\n </>\n )}\n\n <div className={styles.settingRow}>\n <NumberInputField\n className={styles.settingField}\n id={balanceMaxInputId}\n name=\"balanceMaximum\"\n label={t('policySettings.balanceMaximumLabel')}\n description={t('policySettings.balanceMaximumHint')}\n adornmentEnd={t('policySettings.hoursUnit')}\n placeholder={t('policySettings.numberOfHoursPlaceholder')}\n isDisabled={!balanceMaximumEnabled}\n min={0}\n max={20000}\n />\n <div className={styles.toggleCell}>\n <SwitchField\n name=\"balanceMaximumEnabled\"\n label={t('policySettings.balanceMaximumLabel')}\n shouldVisuallyHideLabel\n aria-controls={balanceMaxInputId}\n />\n </div>\n </div>\n\n <hr className={styles.divider} />\n\n <div className={styles.settingRow}>\n <NumberInputField\n className={styles.settingField}\n id={carryOverInputId}\n name=\"carryOverLimit\"\n label={t('policySettings.carryOverLimitLabel')}\n description={t('policySettings.carryOverLimitHint')}\n adornmentEnd={t('policySettings.hoursUnit')}\n placeholder={t('policySettings.numberOfHoursPlaceholder')}\n isDisabled={!carryOverLimitEnabled}\n min={0}\n max={20000}\n />\n <div className={styles.toggleCell}>\n <SwitchField\n name=\"carryOverLimitEnabled\"\n label={t('policySettings.carryOverLimitLabel')}\n shouldVisuallyHideLabel\n aria-controls={carryOverInputId}\n />\n </div>\n </div>\n\n <hr className={styles.divider} />\n\n {showWaitingPeriod && (\n <>\n <div className={styles.settingRow}>\n <NumberInputField\n className={styles.settingField}\n id={waitingPeriodInputId}\n name=\"waitingPeriod\"\n label={t('policySettings.waitingPeriodLabel')}\n description={t('policySettings.waitingPeriodHint')}\n adornmentEnd={t('policySettings.daysUnit')}\n placeholder={t('policySettings.numberOfDaysPlaceholder')}\n isDisabled={!waitingPeriodEnabled}\n min={0}\n max={20000}\n maximumFractionDigits={0}\n errorMessage={t('policySettings.errors.waitingPeriodMustBeWholeNumber')}\n />\n <div className={styles.toggleCell}>\n <SwitchField\n name=\"waitingPeriodEnabled\"\n label={t('policySettings.waitingPeriodLabel')}\n shouldVisuallyHideLabel\n aria-controls={waitingPeriodInputId}\n />\n </div>\n </div>\n\n <hr className={styles.divider} />\n </>\n )}\n\n <SwitchField\n name=\"paidOutOnTermination\"\n label={t('policySettings.paidOutOnTerminationLabel')}\n description={t('policySettings.paidOutOnTerminationHint')}\n />\n\n <hr className={styles.divider} />\n\n <ActionsLayout>\n <Button variant=\"secondary\" onClick={onBack} isDisabled={isPending}>\n {t('backCta')}\n </Button>\n <Button variant=\"primary\" type=\"submit\" isLoading={isPending}>\n {t('policySettings.continueCta')}\n </Button>\n </ActionsLayout>\n </Flex>\n </Flex>\n </div>\n </HtmlForm>\n </FormProvider>\n )\n}\n"],"names":["PolicySettingsSchema","z","PolicySettingsPresentation","accrualMethod","onContinue","onBack","defaultValues","mode","editingPolicyName","isPending","useI18n","t","useTranslation","Heading","Button","useComponentContext","headingId","useId","accrualMaxInputId","balanceMaxInputId","carryOverInputId","waitingPeriodInputId","formMethods","useForm","zodResolver","control","accrualMaximumEnabled","useWatch","balanceMaximumEnabled","carryOverLimitEnabled","waitingPeriodEnabled","isHoursWorked","isFixedPerPayPeriod","showAccrualMaximum","showWaitingPeriod","handleSubmit","data","jsx","FormProvider","HtmlForm","styles","Flex","jsxs","Fragment","NumberInputField","SwitchField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;AAYA,MAAMA,IAAuBC,EAAE,OAAO;AAAA,EACpC,uBAAuBA,EAAE,QAAA;AAAA,EACzB,gBAAgBA,EAAE,OAAA,EAAS,SAAA;AAAA,EAC3B,uBAAuBA,EAAE,QAAA;AAAA,EACzB,gBAAgBA,EAAE,OAAA,EAAS,SAAA;AAAA,EAC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AA,EACC,UAAA;AAAA,QAAA,gBAAAT,EAACvB,GAAA,EAAO,SAAQ,aAAY,SAAST,GAAQ,YAAYI,GACtD,UAAAE,EAAE,SAAS,EAAA,CACd;AAAA,QACA,gBAAA0B,EAACvB,GAAA,EAAO,SAAQ,WAAU,MAAK,UAAS,WAAWL,GAChD,UAAAE,EAAE,4BAA4B,EAAA,CACjC;AAAA,MAAA,EAAA,CACF;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"PolicySettingsPresentation.js","sources":["../../../../src/components/TimeOff/PolicySettings/PolicySettingsPresentation.tsx"],"sourcesContent":["import { useId } from 'react'\nimport { FormProvider, useForm, useWatch } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport type { PolicySettingsFormData, PolicySettingsPresentationProps } from './PolicySettingsTypes'\nimport styles from './PolicySettings.module.scss'\nimport { Flex, ActionsLayout, NumberInputField, SwitchField } from '@/components/Common'\nimport { Form as HtmlForm } from '@/components/Common/Form'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\n\nconst PolicySettingsSchema = z.object({\n accrualMaximumEnabled: z.boolean(),\n accrualMaximum: z.number().optional(),\n balanceMaximumEnabled: z.boolean(),\n balanceMaximum: z.number().optional(),\n carryOverLimitEnabled: z.boolean(),\n carryOverLimit: z.number().optional(),\n waitingPeriodEnabled: z.boolean(),\n waitingPeriod: z.number().int().optional(),\n paidOutOnTermination: z.boolean(),\n})\n\n/**\n * Presentation-only form for configuring time off policy limits and rules.\n *\n * @remarks\n * Use this component when you need to render the policy settings form without the data-fetching container — provide the `accrualMethod` and handle submission yourself. For the data-connected version, use {@link PolicySettings}.\n *\n * The fields shown depend on `accrualMethod`:\n * - Accrual maximum and waiting period are shown for `'hours_worked'` and `'fixed_per_pay_period'`\n * - Balance maximum, carry-over limit, and paid-out-on-termination are always shown\n *\n * @param props - {@link PolicySettingsPresentationProps}\n * @returns The rendered policy settings form.\n * @public\n */\nexport function PolicySettingsPresentation({\n accrualMethod,\n onContinue,\n onBack,\n defaultValues,\n mode,\n editingPolicyName,\n isPending = false,\n}: PolicySettingsPresentationProps) {\n useI18n('Company.TimeOff.CreateTimeOffPolicy')\n const { t } = useTranslation('Company.TimeOff.CreateTimeOffPolicy')\n const { Heading, Button } = useComponentContext()\n const headingId = useId()\n\n const accrualMaxInputId = useId()\n const balanceMaxInputId = useId()\n const carryOverInputId = useId()\n const waitingPeriodInputId = useId()\n\n const formMethods = useForm<PolicySettingsFormData>({\n resolver: zodResolver(PolicySettingsSchema),\n defaultValues: {\n accrualMaximumEnabled: false,\n balanceMaximumEnabled: false,\n carryOverLimitEnabled: false,\n waitingPeriodEnabled: false,\n paidOutOnTermination: false,\n ...defaultValues,\n },\n })\n\n const { control } = formMethods\n const accrualMaximumEnabled = useWatch({ control, name: 'accrualMaximumEnabled' })\n const balanceMaximumEnabled = useWatch({ control, name: 'balanceMaximumEnabled' })\n const carryOverLimitEnabled = useWatch({ control, name: 'carryOverLimitEnabled' })\n const waitingPeriodEnabled = useWatch({ control, name: 'waitingPeriodEnabled' })\n\n const isHoursWorked = accrualMethod === 'hours_worked'\n const isFixedPerPayPeriod = accrualMethod === 'fixed_per_pay_period'\n const showAccrualMaximum = isHoursWorked || isFixedPerPayPeriod\n const showWaitingPeriod = isHoursWorked || isFixedPerPayPeriod\n\n const handleSubmit = (data: PolicySettingsFormData) => {\n onContinue(data)\n }\n\n return (\n <FormProvider {...formMethods}>\n <HtmlForm aria-labelledby={headingId} onSubmit={formMethods.handleSubmit(handleSubmit)}>\n <div className={styles.policySettings}>\n <Flex flexDirection=\"column\" gap={32}>\n <Heading as=\"h2\" id={headingId}>\n {mode === 'edit' && editingPolicyName\n ? t('policySettings.editTitle', { name: editingPolicyName })\n : t('policySettings.createTitle')}\n </Heading>\n\n <Flex flexDirection=\"column\" gap={20}>\n {showAccrualMaximum && (\n <>\n <div className={styles.settingRow}>\n <NumberInputField\n className={styles.settingField}\n id={accrualMaxInputId}\n name=\"accrualMaximum\"\n label={t('policySettings.accrualMaximumLabel')}\n description={t('policySettings.accrualMaximumHint')}\n adornmentEnd={t('policySettings.hoursUnit')}\n placeholder={t('policySettings.numberOfHoursPlaceholder')}\n isDisabled={!accrualMaximumEnabled}\n min={0}\n max={20000}\n />\n <div className={styles.toggleCell}>\n <SwitchField\n name=\"accrualMaximumEnabled\"\n label={t('policySettings.accrualMaximumLabel')}\n shouldVisuallyHideLabel\n aria-controls={accrualMaxInputId}\n />\n </div>\n </div>\n\n <hr className={styles.divider} />\n </>\n )}\n\n <div className={styles.settingRow}>\n <NumberInputField\n className={styles.settingField}\n id={balanceMaxInputId}\n name=\"balanceMaximum\"\n label={t('policySettings.balanceMaximumLabel')}\n description={t('policySettings.balanceMaximumHint')}\n adornmentEnd={t('policySettings.hoursUnit')}\n placeholder={t('policySettings.numberOfHoursPlaceholder')}\n isDisabled={!balanceMaximumEnabled}\n min={0}\n max={20000}\n />\n <div className={styles.toggleCell}>\n <SwitchField\n name=\"balanceMaximumEnabled\"\n label={t('policySettings.balanceMaximumLabel')}\n shouldVisuallyHideLabel\n aria-controls={balanceMaxInputId}\n />\n </div>\n </div>\n\n <hr className={styles.divider} />\n\n <div className={styles.settingRow}>\n <NumberInputField\n className={styles.settingField}\n id={carryOverInputId}\n name=\"carryOverLimit\"\n label={t('policySettings.carryOverLimitLabel')}\n description={t('policySettings.carryOverLimitHint')}\n adornmentEnd={t('policySettings.hoursUnit')}\n placeholder={t('policySettings.numberOfHoursPlaceholder')}\n isDisabled={!carryOverLimitEnabled}\n min={0}\n max={20000}\n />\n <div className={styles.toggleCell}>\n <SwitchField\n name=\"carryOverLimitEnabled\"\n label={t('policySettings.carryOverLimitLabel')}\n shouldVisuallyHideLabel\n aria-controls={carryOverInputId}\n />\n </div>\n </div>\n\n <hr className={styles.divider} />\n\n {showWaitingPeriod && (\n <>\n <div className={styles.settingRow}>\n <NumberInputField\n className={styles.settingField}\n id={waitingPeriodInputId}\n name=\"waitingPeriod\"\n label={t('policySettings.waitingPeriodLabel')}\n description={t('policySettings.waitingPeriodHint')}\n adornmentEnd={t('policySettings.daysUnit')}\n placeholder={t('policySettings.numberOfDaysPlaceholder')}\n isDisabled={!waitingPeriodEnabled}\n min={0}\n max={20000}\n maximumFractionDigits={0}\n errorMessage={t('policySettings.errors.waitingPeriodMustBeWholeNumber')}\n />\n <div className={styles.toggleCell}>\n <SwitchField\n name=\"waitingPeriodEnabled\"\n label={t('policySettings.waitingPeriodLabel')}\n shouldVisuallyHideLabel\n aria-controls={waitingPeriodInputId}\n />\n </div>\n </div>\n\n <hr className={styles.divider} />\n </>\n )}\n\n <SwitchField\n name=\"paidOutOnTermination\"\n label={t('policySettings.paidOutOnTerminationLabel')}\n description={t('policySettings.paidOutOnTerminationHint')}\n />\n\n <hr className={styles.divider} />\n\n <ActionsLayout>\n <Button variant=\"secondary\" onClick={onBack} isDisabled={isPending}>\n {t('backCta')}\n </Button>\n <Button variant=\"primary\" type=\"submit\" isLoading={isPending}>\n {t('policySettings.continueCta')}\n </Button>\n </ActionsLayout>\n </Flex>\n </Flex>\n </div>\n </HtmlForm>\n </FormProvider>\n )\n}\n"],"names":["PolicySettingsSchema","z","PolicySettingsPresentation","accrualMethod","onContinue","onBack","defaultValues","mode","editingPolicyName","isPending","useI18n","t","useTranslation","Heading","Button","useComponentContext","headingId","useId","accrualMaxInputId","balanceMaxInputId","carryOverInputId","waitingPeriodInputId","formMethods","useForm","zodResolver","control","accrualMaximumEnabled","useWatch","balanceMaximumEnabled","carryOverLimitEnabled","waitingPeriodEnabled","isHoursWorked","isFixedPerPayPeriod","showAccrualMaximum","showWaitingPeriod","handleSubmit","data","jsx","FormProvider","HtmlForm","styles","Flex","jsxs","Fragment","NumberInputField","SwitchField","ActionsLayout"],"mappings":";;;;;;;;;;;;;;AAYA,M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AAA;AAAA,UACC,MAAK;AAAA,UACL,OAAOlC,EAAE,0CAA0C;AAAA,UACnD,aAAaA,EAAE,yCAAyC;AAAA,QAAA;AAAA,MAAA;AAAA,MAG1D,gBAAA0B,EAAC,MAAA,EAAG,WAAWG,EAAO,QAAA,CAAS;AAAA,wBAE9BM,GAAA,EACC,UAAA;AAAA,QAAA,gBAAAT,EAACvB,GAAA,EAAO,SAAQ,aAAY,SAAST,GAAQ,YAAYI,GACtD,UAAAE,EAAE,SAAS,EAAA,CACd;AAAA,QACA,gBAAA0B,EAACvB,GAAA,EAAO,SAAQ,WAAU,MAAK,UAAS,WAAWL,GAChD,UAAAE,EAAE,4BAA4B,EAAA,CACjC;AAAA,MAAA,EAAA,CACF;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GACF,EAAA,CACF,GACF,GACF;AAEJ;"}
|
|
@@ -1,21 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Accrual method category for a time off policy. Determines which settings fields are shown.
|
|
3
|
+
*
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
1
6
|
export type PolicySettingsAccrualMethod = 'hours_worked' | 'fixed_per_pay_period' | 'fixed_all_at_once';
|
|
7
|
+
/**
|
|
8
|
+
* Form values captured by the policy settings form.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
2
12
|
export interface PolicySettingsFormData {
|
|
13
|
+
/** Whether an annual accrual cap is enabled. */
|
|
3
14
|
accrualMaximumEnabled: boolean;
|
|
15
|
+
/** Maximum hours that can accrue per year when {@link PolicySettingsFormData.accrualMaximumEnabled} is true. */
|
|
4
16
|
accrualMaximum?: number;
|
|
17
|
+
/** Whether a total balance cap is enabled. */
|
|
5
18
|
balanceMaximumEnabled: boolean;
|
|
19
|
+
/** Maximum hours an employee can hold in their balance at any time when {@link PolicySettingsFormData.balanceMaximumEnabled} is true. */
|
|
6
20
|
balanceMaximum?: number;
|
|
21
|
+
/** Whether a carry-over limit is enabled. */
|
|
7
22
|
carryOverLimitEnabled: boolean;
|
|
23
|
+
/** Maximum hours that carry over when the policy resets when {@link PolicySettingsFormData.carryOverLimitEnabled} is true. */
|
|
8
24
|
carryOverLimit?: number;
|
|
25
|
+
/** Whether a waiting period is enabled. */
|
|
9
26
|
waitingPeriodEnabled: boolean;
|
|
27
|
+
/** Number of days a new employee must wait before accrual begins when {@link PolicySettingsFormData.waitingPeriodEnabled} is true. */
|
|
10
28
|
waitingPeriod?: number;
|
|
29
|
+
/** Whether accrued balance is paid out when an employee is terminated. */
|
|
11
30
|
paidOutOnTermination: boolean;
|
|
12
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Props for {@link PolicySettingsPresentation}.
|
|
34
|
+
*
|
|
35
|
+
* @public
|
|
36
|
+
*/
|
|
13
37
|
export interface PolicySettingsPresentationProps {
|
|
38
|
+
/** Accrual method category of the policy. Controls which fields are shown. */
|
|
14
39
|
accrualMethod: PolicySettingsAccrualMethod;
|
|
40
|
+
/** Called with the form values when the user submits. */
|
|
15
41
|
onContinue: (data: PolicySettingsFormData) => void;
|
|
42
|
+
/** Called when the user navigates back. */
|
|
16
43
|
onBack: () => void;
|
|
44
|
+
/** Optional default values to prefill the form. */
|
|
17
45
|
defaultValues?: Partial<PolicySettingsFormData>;
|
|
46
|
+
/** Whether the form is being used to create a new policy or edit an existing one. Defaults to create. */
|
|
18
47
|
mode?: 'create' | 'edit';
|
|
48
|
+
/** Name of the policy being edited. Shown in the heading when `mode` is `'edit'`. */
|
|
19
49
|
editingPolicyName?: string;
|
|
50
|
+
/** Whether a submit is in flight. Disables the back button and shows a loading state on the continue button. */
|
|
20
51
|
isPending?: boolean;
|
|
21
52
|
}
|
|
@@ -1,7 +1,30 @@
|
|
|
1
1
|
import { PolicyType } from './PolicyTypeSelectorTypes';
|
|
2
2
|
import { BaseComponentInterface } from '../../Base';
|
|
3
|
+
/**
|
|
4
|
+
* Props for {@link PolicyTypeSelector}.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
3
8
|
export interface PolicyTypeSelectorProps extends BaseComponentInterface<'Company.TimeOff.SelectPolicyType'> {
|
|
9
|
+
/** The associated company identifier. */
|
|
4
10
|
companyId: string;
|
|
11
|
+
/** Pre-selected policy type rendered when the form mounts. */
|
|
5
12
|
defaultPolicyType?: PolicyType;
|
|
6
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Selection screen for choosing which kind of time-off policy to create — sick, vacation, or holiday.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
* The holiday option is omitted when the company already has a holiday pay policy, since a company
|
|
19
|
+
* can only have one.
|
|
20
|
+
*
|
|
21
|
+
* | Event | Description | Data |
|
|
22
|
+
* | ----- | ----------- | ---- |
|
|
23
|
+
* | `timeOff/policyTypeSelected` | The user confirms a selection | `{ policyType: {@link PolicyType} }` |
|
|
24
|
+
* | `CANCEL` | The user cancels | — |
|
|
25
|
+
*
|
|
26
|
+
* @param props - See {@link PolicyTypeSelectorProps}.
|
|
27
|
+
* @returns The rendered policy type selection screen.
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
7
30
|
export declare function PolicyTypeSelector(props: PolicyTypeSelectorProps): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolicyTypeSelector.js","sources":["../../../../src/components/TimeOff/PolicyTypeSelector/PolicyTypeSelector.tsx"],"sourcesContent":["import { useHolidayPayPoliciesGet } from '@gusto/embedded-api-v-2025-11-15/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\nexport interface PolicyTypeSelectorProps extends BaseComponentInterface<'Company.TimeOff.SelectPolicyType'> {\n companyId: string\n defaultPolicyType?: PolicyType\n}\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":";;;;;;
|
|
1
|
+
{"version":3,"file":"PolicyTypeSelector.js","sources":["../../../../src/components/TimeOff/PolicyTypeSelector/PolicyTypeSelector.tsx"],"sourcesContent":["import { useHolidayPayPoliciesGet } from '@gusto/embedded-api-v-2025-11-15/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 * | 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":";;;;;;AAmCO,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,2 +1,3 @@
|
|
|
1
1
|
import { PolicyTypeSelectorPresentationProps } from './PolicyTypeSelectorTypes';
|
|
2
|
+
/** @internal */
|
|
2
3
|
export declare function PolicyTypeSelectorPresentation({ onContinue, onCancel, defaultPolicyType, holidayPolicyExists, }: PolicyTypeSelectorPresentationProps): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PolicyTypeSelectorPresentation.js","sources":["../../../../src/components/TimeOff/PolicyTypeSelector/PolicyTypeSelectorPresentation.tsx"],"sourcesContent":["import { useId, useMemo } from 'react'\nimport { FormProvider, useForm, useWatch } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport type { PolicyType, PolicyTypeSelectorPresentationProps } from './PolicyTypeSelectorTypes'\nimport { Flex, ActionsLayout, RadioGroupField } from '@/components/Common'\nimport { Form as HtmlForm } from '@/components/Common/Form'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\n\ninterface PolicyTypeSelectorFormData {\n policyType: PolicyType\n}\n\nexport function PolicyTypeSelectorPresentation({\n onContinue,\n onCancel,\n defaultPolicyType,\n holidayPolicyExists = false,\n}: PolicyTypeSelectorPresentationProps) {\n useI18n('Company.TimeOff.SelectPolicyType')\n const { t } = useTranslation('Company.TimeOff.SelectPolicyType')\n const { Heading, Text, Button } = useComponentContext()\n const headingId = useId()\n\n const formMethods = useForm<PolicyTypeSelectorFormData>({\n defaultValues: {\n policyType: defaultPolicyType as PolicyType,\n },\n })\n\n const selectedPolicyType = useWatch({ control: formMethods.control, name: 'policyType' })\n\n const policyTypeOptions = useMemo(() => {\n const options: Array<{ value: PolicyType; label: string; description: string }> = []\n if (!holidayPolicyExists) {\n options.push({\n value: 'holiday',\n label: t('holidayLabel'),\n description: t('holidayHint'),\n })\n }\n options.push(\n {\n value: 'vacation',\n label: t('timeOffLabel'),\n description: t('timeOffHint'),\n },\n {\n value: 'sick',\n label: t('sickLeaveLabel'),\n description: t('sickLeaveHint'),\n },\n )\n return options\n }, [t, holidayPolicyExists])\n\n const handleSubmit = (data: PolicyTypeSelectorFormData) => {\n onContinue(data.policyType)\n }\n\n return (\n <FormProvider {...formMethods}>\n <HtmlForm aria-labelledby={headingId} onSubmit={formMethods.handleSubmit(handleSubmit)}>\n <Flex flexDirection=\"column\" gap={24}>\n <Flex flexDirection=\"column\" gap={4}>\n <Heading as=\"h2\" id={headingId}>\n {t('title')}\n </Heading>\n <Text variant=\"supporting\">{t('policyTypeHint')}</Text>\n </Flex>\n\n <RadioGroupField<PolicyType>\n name=\"policyType\"\n label={t('policyTypeLabel')}\n options={policyTypeOptions}\n isRequired\n errorMessage={t('validations.policyTypeRequired')}\n />\n\n <ActionsLayout>\n <Button variant=\"secondary\" onClick={onCancel}>\n {t('cancelCta')}\n </Button>\n <Button variant=\"primary\" type=\"submit\" isDisabled={!selectedPolicyType}>\n {t('continueCta')}\n </Button>\n </ActionsLayout>\n </Flex>\n </HtmlForm>\n </FormProvider>\n )\n}\n"],"names":["PolicyTypeSelectorPresentation","onContinue","onCancel","defaultPolicyType","holidayPolicyExists","useI18n","t","useTranslation","Heading","Text","Button","useComponentContext","headingId","useId","formMethods","useForm","selectedPolicyType","useWatch","policyTypeOptions","useMemo","options","handleSubmit","data","FormProvider","jsx","HtmlForm","jsxs","Flex","RadioGroupField","ActionsLayout"],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"PolicyTypeSelectorPresentation.js","sources":["../../../../src/components/TimeOff/PolicyTypeSelector/PolicyTypeSelectorPresentation.tsx"],"sourcesContent":["import { useId, useMemo } from 'react'\nimport { FormProvider, useForm, useWatch } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport type { PolicyType, PolicyTypeSelectorPresentationProps } from './PolicyTypeSelectorTypes'\nimport { Flex, ActionsLayout, RadioGroupField } from '@/components/Common'\nimport { Form as HtmlForm } from '@/components/Common/Form'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\n\ninterface PolicyTypeSelectorFormData {\n policyType: PolicyType\n}\n\n/** @internal */\nexport function PolicyTypeSelectorPresentation({\n onContinue,\n onCancel,\n defaultPolicyType,\n holidayPolicyExists = false,\n}: PolicyTypeSelectorPresentationProps) {\n useI18n('Company.TimeOff.SelectPolicyType')\n const { t } = useTranslation('Company.TimeOff.SelectPolicyType')\n const { Heading, Text, Button } = useComponentContext()\n const headingId = useId()\n\n const formMethods = useForm<PolicyTypeSelectorFormData>({\n defaultValues: {\n policyType: defaultPolicyType as PolicyType,\n },\n })\n\n const selectedPolicyType = useWatch({ control: formMethods.control, name: 'policyType' })\n\n const policyTypeOptions = useMemo(() => {\n const options: Array<{ value: PolicyType; label: string; description: string }> = []\n if (!holidayPolicyExists) {\n options.push({\n value: 'holiday',\n label: t('holidayLabel'),\n description: t('holidayHint'),\n })\n }\n options.push(\n {\n value: 'vacation',\n label: t('timeOffLabel'),\n description: t('timeOffHint'),\n },\n {\n value: 'sick',\n label: t('sickLeaveLabel'),\n description: t('sickLeaveHint'),\n },\n )\n return options\n }, [t, holidayPolicyExists])\n\n const handleSubmit = (data: PolicyTypeSelectorFormData) => {\n onContinue(data.policyType)\n }\n\n return (\n <FormProvider {...formMethods}>\n <HtmlForm aria-labelledby={headingId} onSubmit={formMethods.handleSubmit(handleSubmit)}>\n <Flex flexDirection=\"column\" gap={24}>\n <Flex flexDirection=\"column\" gap={4}>\n <Heading as=\"h2\" id={headingId}>\n {t('title')}\n </Heading>\n <Text variant=\"supporting\">{t('policyTypeHint')}</Text>\n </Flex>\n\n <RadioGroupField<PolicyType>\n name=\"policyType\"\n label={t('policyTypeLabel')}\n options={policyTypeOptions}\n isRequired\n errorMessage={t('validations.policyTypeRequired')}\n />\n\n <ActionsLayout>\n <Button variant=\"secondary\" onClick={onCancel}>\n {t('cancelCta')}\n </Button>\n <Button variant=\"primary\" type=\"submit\" isDisabled={!selectedPolicyType}>\n {t('continueCta')}\n </Button>\n </ActionsLayout>\n </Flex>\n </HtmlForm>\n </FormProvider>\n )\n}\n"],"names":["PolicyTypeSelectorPresentation","onContinue","onCancel","defaultPolicyType","holidayPolicyExists","useI18n","t","useTranslation","Heading","Text","Button","useComponentContext","headingId","useId","formMethods","useForm","selectedPolicyType","useWatch","policyTypeOptions","useMemo","options","handleSubmit","data","FormProvider","jsx","HtmlForm","jsxs","Flex","RadioGroupField","ActionsLayout"],"mappings":";;;;;;;;;;AAcO,SAASA,EAA+B;AAAA,EAC7C,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,qBAAAC,IAAsB;AACxB,GAAwC;AACtC,EAAAC,EAAQ,kCAAkC;AAC1C,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,kCAAkC,GACzD,EAAE,SAAAC,GAAS,MAAAC,GAAM,QAAAC,EAAA,IAAWC,EAAA,GAC5BC,IAAYC,EAAA,GAEZC,IAAcC,EAAoC;AAAA,IACtD,eAAe;AAAA,MACb,YAAYZ;AAAA,IAAA;AAAA,EACd,CACD,GAEKa,IAAqBC,EAAS,EAAE,SAASH,EAAY,SAAS,MAAM,cAAc,GAElFI,IAAoBC,EAAQ,MAAM;AACtC,UAAMC,IAA4E,CAAA;AAClF,WAAKhB,KACHgB,EAAQ,KAAK;AAAA,MACX,OAAO;AAAA,MACP,OAAOd,EAAE,cAAc;AAAA,MACvB,aAAaA,EAAE,aAAa;AAAA,IAAA,CAC7B,GAEHc,EAAQ;AAAA,MACN;AAAA,QACE,OAAO;AAAA,QACP,OAAOd,EAAE,cAAc;AAAA,QACvB,aAAaA,EAAE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of time-off policy a company can configure.
|
|
3
|
+
*
|
|
4
|
+
* @public
|
|
5
|
+
*/
|
|
1
6
|
export type PolicyType = 'sick' | 'vacation' | 'holiday';
|
|
7
|
+
/** @internal */
|
|
2
8
|
export interface PolicyTypeSelectorPresentationProps {
|
|
9
|
+
/** Called with the chosen policy type when the user confirms the selection. */
|
|
3
10
|
onContinue: (policyType: PolicyType) => void;
|
|
11
|
+
/** Called when the user cancels the selection. */
|
|
4
12
|
onCancel: () => void;
|
|
13
|
+
/** Pre-selected policy type rendered when the form mounts. */
|
|
5
14
|
defaultPolicyType?: PolicyType;
|
|
15
|
+
/** When true, the holiday option is omitted because the company already has a holiday pay policy. */
|
|
6
16
|
holidayPolicyExists?: boolean;
|
|
7
17
|
}
|