@gusto/embedded-react-sdk 0.55.7 → 0.55.8
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/FadeIn/FadeIn.module.scss.js +4 -4
- package/dist/components/Common/FieldCaption/FieldCaption.js +22 -18
- package/dist/components/Common/FieldCaption/FieldCaption.js.map +1 -1
- package/dist/components/Common/Flex/Flex.js +17 -15
- package/dist/components/Common/Flex/Flex.js.map +1 -1
- package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/components/Common/UI/FileInput/FileInput.js +1 -1
- package/dist/components/Common/UI/Heading/Heading.module.scss.js +7 -7
- package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +5 -4
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +5 -4
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +7 -6
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +5 -4
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +5 -4
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +27 -27
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +10 -9
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +8 -7
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +5 -4
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +5 -4
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +5 -4
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/PaySchedule.js +45 -30
- package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
- package/dist/components/Company/PaySchedule/PayScheduleComponents.js +12 -11
- package/dist/components/Company/PaySchedule/PayScheduleComponents.js.map +1 -1
- package/dist/components/Company/PaySchedule/PayScheduleForm.js +72 -55
- package/dist/components/Company/PaySchedule/PayScheduleForm.js.map +1 -1
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/fields.js +24 -20
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/fields.js.map +1 -1
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/payScheduleSchema.js +33 -29
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/payScheduleSchema.js.map +1 -1
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.js +131 -115
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +5 -4
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +5 -4
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/TaxRateManagement/context.js +5 -4
- package/dist/components/Company/StateTaxes/TaxRateManagement/context.js.map +1 -1
- package/dist/components/Contractor/ContractorList/management/ManagementContractorList.js +31 -29
- package/dist/components/Contractor/ContractorList/management/ManagementContractorList.js.map +1 -1
- package/dist/components/Contractor/ContractorList/management/ManagementContractorListView.js +110 -109
- package/dist/components/Contractor/ContractorList/management/ManagementContractorListView.js.map +1 -1
- package/dist/components/Contractor/ContractorList/onboarding/ContractorList.js +21 -19
- package/dist/components/Contractor/ContractorList/onboarding/ContractorList.js.map +1 -1
- package/dist/components/Contractor/ContractorList/onboarding/ContractorListView.js +56 -55
- package/dist/components/Contractor/ContractorList/onboarding/ContractorListView.js.map +1 -1
- package/dist/components/Contractor/Dashboard/Dashboard.js +34 -33
- package/dist/components/Contractor/Dashboard/Dashboard.js.map +1 -1
- package/dist/components/Contractor/Payments/CreateHistoricalPayment/CreateHistoricalPayment.js +117 -115
- package/dist/components/Contractor/Payments/CreateHistoricalPayment/CreateHistoricalPayment.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js +77 -75
- package/dist/components/Contractor/Payments/CreatePayment/CreatePayment.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js +44 -43
- package/dist/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js +40 -39
- package/dist/components/Contractor/Payments/CreatePayment/PreviewPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/HistoricalPaymentSummary/HistoricalPaymentSummary.js +35 -29
- package/dist/components/Contractor/Payments/HistoricalPaymentSummary/HistoricalPaymentSummary.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.js +21 -20
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistory.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js +41 -40
- package/dist/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.js +21 -20
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatement.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js +33 -32
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js +80 -78
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsList.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js +44 -43
- package/dist/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.js.map +1 -1
- package/dist/components/Contractor/Submit/Submit.js +113 -105
- package/dist/components/Contractor/Submit/Submit.js.map +1 -1
- package/dist/components/Contractor/Submit/SubmitDone.js +11 -11
- package/dist/components/Contractor/Submit/SubmitDone.js.map +1 -1
- package/dist/components/Employee/Compensation/management/CompensationAddJobForm/CompensationAddJobForm.js +20 -18
- package/dist/components/Employee/Compensation/management/CompensationAddJobForm/CompensationAddJobForm.js.map +1 -1
- package/dist/components/Employee/Compensation/management/CompensationEditForm/CompensationEditForm.js +18 -15
- package/dist/components/Employee/Compensation/management/CompensationEditForm/CompensationEditForm.js.map +1 -1
- package/dist/components/Employee/Dashboard/Dashboard.js +33 -32
- package/dist/components/Employee/Dashboard/Dashboard.js.map +1 -1
- package/dist/components/Employee/Deductions/management/DeductionsEditForm/DeductionsEditForm.js +21 -19
- package/dist/components/Employee/Deductions/management/DeductionsEditForm/DeductionsEditForm.js.map +1 -1
- package/dist/components/Employee/Documents/management/DocumentManager.js +34 -26
- package/dist/components/Employee/Documents/management/DocumentManager.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +5 -4
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibility.js +30 -29
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibility.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js +54 -53
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/EmployeeDocuments/EmployeeDocuments.js +29 -28
- package/dist/components/Employee/Documents/onboarding/EmployeeDocuments/EmployeeDocuments.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/EmployeeDocuments/EmployeeDocumentsPresentation.js +16 -15
- package/dist/components/Employee/Documents/onboarding/EmployeeDocuments/EmployeeDocumentsPresentation.js.map +1 -1
- package/dist/components/Employee/EmployeeList/management/ManagementEmployeeList.js +27 -25
- package/dist/components/Employee/EmployeeList/management/ManagementEmployeeList.js.map +1 -1
- package/dist/components/Employee/EmployeeList/management/ManagementEmployeeListView.js +89 -80
- package/dist/components/Employee/EmployeeList/management/ManagementEmployeeListView.js.map +1 -1
- package/dist/components/Employee/EmployeeList/onboarding/EmployeeList.js +22 -20
- package/dist/components/Employee/EmployeeList/onboarding/EmployeeList.js.map +1 -1
- package/dist/components/Employee/EmployeeList/onboarding/EmployeeListView.js +25 -24
- package/dist/components/Employee/EmployeeList/onboarding/EmployeeListView.js.map +1 -1
- package/dist/components/Employee/EmployeeList/shared/useEmployeeList.js +1 -1
- package/dist/components/Employee/EmployeeList/shared/useEmployeeList.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/shared/FederalTaxesView.js +1 -1
- package/dist/components/Employee/HomeAddress/management/HomeAddressEditForm.js +19 -17
- package/dist/components/Employee/HomeAddress/management/HomeAddressEditForm.js.map +1 -1
- package/dist/components/Employee/HomeAddress/management/HomeAddressView.js +80 -79
- package/dist/components/Employee/HomeAddress/management/HomeAddressView.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/management/PaymentMethodBankForm.js +4 -4
- package/dist/components/Employee/PaymentMethod/onboarding/BankForm.js +4 -4
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.js +40 -39
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployee.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.js +34 -33
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummary.js +43 -41
- package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummary.js.map +1 -1
- package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummaryPresentation.js +22 -21
- package/dist/components/Employee/Terminations/TerminationSummary/TerminationSummaryPresentation.js.map +1 -1
- package/dist/components/Employee/WorkAddress/management/WorkAddressEditForm.js +19 -17
- package/dist/components/Employee/WorkAddress/management/WorkAddressEditForm.js.map +1 -1
- package/dist/components/Employee/WorkAddress/management/WorkAddressView.js +120 -116
- package/dist/components/Employee/WorkAddress/management/WorkAddressView.js.map +1 -1
- package/dist/components/Flow/Flow.js +1 -1
- package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js +29 -29
- package/dist/components/InformationRequests/InformationRequestList/InformationRequestList.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.js +37 -36
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetails.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.js +37 -36
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsBanner/ConfirmWireDetailsBanner.js.map +1 -1
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.js +35 -28
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.js.map +1 -1
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelectionPresentation.js +27 -26
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelectionPresentation.js.map +1 -1
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +2 -3
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js +52 -51
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js +34 -33
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js.map +1 -1
- package/dist/components/Payroll/OffCycleDeductionsSetting/OffCycleDeductionsSetting.js +23 -21
- package/dist/components/Payroll/OffCycleDeductionsSetting/OffCycleDeductionsSetting.js.map +1 -1
- package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelection.js +26 -19
- package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelection.js.map +1 -1
- package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js +14 -12
- package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +112 -109
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +67 -65
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +43 -41
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +225 -223
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields.js +78 -75
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeHelpers.js +27 -27
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeHelpers.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeSchema.js +19 -19
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeSchema.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/usePayrollEditEmployeeForm.js +51 -48
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/usePayrollEditEmployeeForm.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistory.js +58 -48
- package/dist/components/Payroll/PayrollHistory/PayrollHistory.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +58 -57
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js +83 -69
- package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollList.js +62 -60
- package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +119 -117
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +101 -99
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +120 -110
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceipts.js +20 -14
- package/dist/components/Payroll/PayrollReceipts/PayrollReceipts.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +39 -38
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
- package/dist/components/Payroll/PrintChecks/PrintChecksBanner/PrintChecksBanner.js +24 -17
- package/dist/components/Payroll/PrintChecks/PrintChecksBanner/PrintChecksBanner.js.map +1 -1
- package/dist/components/Payroll/PrintChecks/PrintChecksFailure/PrintChecksFailure.js +17 -17
- package/dist/components/Payroll/PrintChecks/PrintChecksFailure/PrintChecksFailure.js.map +1 -1
- package/dist/components/Payroll/PrintChecks/PrintChecksForm/PrintChecksForm.js +88 -80
- package/dist/components/Payroll/PrintChecks/PrintChecksForm/PrintChecksForm.js.map +1 -1
- package/dist/components/Payroll/PrintChecks/PrintChecksSummary/PrintChecksSummary.js +26 -26
- package/dist/components/Payroll/PrintChecks/PrintChecksSummary/PrintChecksSummary.js.map +1 -1
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js +32 -32
- package/dist/components/Payroll/RecoveryCases/RecoveryCasesResubmit/RecoveryCasesResubmit.js.map +1 -1
- package/dist/components/Payroll/TransitionCreation/TransitionCreation.js +50 -48
- package/dist/components/Payroll/TransitionCreation/TransitionCreation.js.map +1 -1
- package/dist/components/Payroll/TransitionCreation/TransitionCreationPresentation.js +34 -33
- package/dist/components/Payroll/TransitionCreation/TransitionCreationPresentation.js.map +1 -1
- package/dist/components/Payroll/TransitionCreation/TransitionCreationTypes.js.map +1 -1
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.js +28 -24
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.js.map +1 -1
- package/dist/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.js +255 -228
- package/dist/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.js.map +1 -1
- package/dist/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.module.scss.js +8 -4
- package/dist/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.module.scss.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +4 -3
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/components/TimeOff/AddEmployeesHoliday/AddEmployeesHoliday.js +5 -5
- package/dist/components/TimeOff/AddEmployeesHoliday/AddEmployeesHoliday.js.map +1 -1
- package/dist/components/TimeOff/AddEmployeesToPolicy/AddEmployeesToPolicy.js +8 -7
- package/dist/components/TimeOff/AddEmployeesToPolicy/AddEmployeesToPolicy.js.map +1 -1
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetail.js +51 -50
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetail.js.map +1 -1
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetailPresentation.js +20 -18
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetailPresentation.js.map +1 -1
- package/dist/components/TimeOff/HolidaySelectionForm/HolidaySelectionForm.js +51 -49
- package/dist/components/TimeOff/HolidaySelectionForm/HolidaySelectionForm.js.map +1 -1
- package/dist/components/TimeOff/HolidaySelectionForm/HolidaySelectionFormPresentation.js +20 -20
- package/dist/components/TimeOff/HolidaySelectionForm/HolidaySelectionFormPresentation.js.map +1 -1
- package/dist/components/TimeOff/PolicyList/PolicyList.js +50 -49
- package/dist/components/TimeOff/PolicyList/PolicyList.js.map +1 -1
- package/dist/components/TimeOff/PolicyList/PolicyListPresentation.js +34 -33
- package/dist/components/TimeOff/PolicyList/PolicyListPresentation.js.map +1 -1
- package/dist/components/TimeOff/PolicySettings/PolicySettings.js +46 -45
- package/dist/components/TimeOff/PolicySettings/PolicySettings.js.map +1 -1
- package/dist/components/TimeOff/PolicySettings/PolicySettingsPresentation.js +152 -143
- package/dist/components/TimeOff/PolicySettings/PolicySettingsPresentation.js.map +1 -1
- package/dist/components/TimeOff/PolicyTypeSelector/PolicyTypeSelector.js +14 -13
- package/dist/components/TimeOff/PolicyTypeSelector/PolicyTypeSelector.js.map +1 -1
- package/dist/components/TimeOff/PolicyTypeSelector/PolicyTypeSelectorPresentation.js +44 -35
- package/dist/components/TimeOff/PolicyTypeSelector/PolicyTypeSelectorPresentation.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationForm.js +88 -71
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationForm.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormPresentation.js +164 -155
- package/dist/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormPresentation.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday.js +57 -55
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.js +25 -24
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.js.map +1 -1
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.js +94 -92
- package/dist/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.js.map +1 -1
- package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetail.js +156 -155
- package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetail.js.map +1 -1
- package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetailPresentation.js +21 -19
- package/dist/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetailPresentation.js.map +1 -1
- package/dist/components/TimeOff/shared/PolicyDetailLayout/PolicyDetailLayout.js +28 -26
- package/dist/components/TimeOff/shared/PolicyDetailLayout/PolicyDetailLayout.js.map +1 -1
- package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
- package/dist/contexts/UnstableFeaturesProvider/useUnstableFeature.js.map +1 -1
- package/dist/i18n/en/Company.PaySchedule.json.js +22 -20
- package/dist/i18n/en/Company.PaySchedule.json.js.map +1 -1
- package/dist/i18n/en/Payroll.UNSTABLE_PayrollEditEmployee.json.js +62 -58
- package/dist/i18n/en/Payroll.UNSTABLE_PayrollEditEmployee.json.js.map +1 -1
- package/dist/package.json.js +1 -1
- package/dist/src/components/Common/FieldCaption/FieldCaption.d.ts +2 -16
- package/dist/src/components/Common/FieldCaption/FieldCaptionTypes.d.ts +22 -0
- package/dist/src/components/Common/FieldCaption/index.d.ts +1 -0
- package/dist/src/components/Common/Flex/Flex.d.ts +3 -1
- package/dist/src/components/Company/PaySchedule/PaySchedule.d.ts +10 -2
- package/dist/src/components/Company/PaySchedule/PayScheduleComponents.d.ts +1 -0
- package/dist/src/components/Company/PaySchedule/shared/usePayScheduleForm/fields.d.ts +9 -1
- package/dist/src/components/Company/PaySchedule/shared/usePayScheduleForm/index.d.ts +2 -2
- package/dist/src/components/Company/PaySchedule/shared/usePayScheduleForm/payScheduleSchema.d.ts +21 -5
- package/dist/src/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.d.ts +21 -3
- package/dist/src/components/Contractor/ContractorList/management/ManagementContractorListView.d.ts +3 -1
- package/dist/src/components/Contractor/ContractorList/onboarding/ContractorListView.d.ts +3 -1
- package/dist/src/components/Contractor/Payments/CreatePayment/CreatePaymentPresentation.d.ts +3 -1
- package/dist/src/components/Contractor/Payments/CreatePayment/PreviewPresentation.d.ts +3 -1
- package/dist/src/components/Contractor/Payments/PaymentHistory/PaymentHistoryPresentation.d.ts +3 -1
- package/dist/src/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.d.ts +3 -1
- package/dist/src/components/Contractor/Payments/PaymentsList/PaymentsListPresentation.d.ts +3 -1
- package/dist/src/components/Contractor/Submit/SubmitDone.d.ts +3 -1
- package/dist/src/components/Employee/Compensation/management/CompensationEditForm/CompensationEditForm.d.ts +1 -1
- package/dist/src/components/Employee/Documents/onboarding/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.d.ts +3 -1
- package/dist/src/components/Employee/Documents/onboarding/EmployeeDocuments/EmployeeDocumentsPresentation.d.ts +3 -1
- package/dist/src/components/Employee/EmployeeList/management/ManagementEmployeeListView.d.ts +3 -1
- package/dist/src/components/Employee/EmployeeList/onboarding/EmployeeListView.d.ts +3 -1
- package/dist/src/components/Employee/EmployeeList/shared/useEmployeeList.d.ts +4 -0
- package/dist/src/components/Employee/HomeAddress/management/HomeAddressView.d.ts +3 -1
- package/dist/src/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.d.ts +3 -1
- package/dist/src/components/Employee/Terminations/TerminationSummary/TerminationSummaryPresentation.d.ts +3 -1
- package/dist/src/components/Employee/WorkAddress/management/WorkAddressView.d.ts +3 -1
- package/dist/src/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelectionPresentation.d.ts +3 -1
- package/dist/src/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.d.ts +1 -1
- package/dist/src/components/Payroll/OffCycleCreation/OffCycleCreationTypes.d.ts +2 -0
- package/dist/src/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.d.ts +3 -1
- package/dist/src/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +3 -1
- package/dist/src/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.d.ts +3 -1
- package/dist/src/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields.d.ts +9 -9
- package/dist/src/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeHelpers.d.ts +2 -2
- package/dist/src/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeSchema.d.ts +4 -4
- package/dist/src/components/Payroll/PayrollHistory/PayrollHistoryPresentation.d.ts +3 -1
- package/dist/src/components/Payroll/PayrollList/PayrollListPresentation.d.ts +3 -1
- package/dist/src/components/Payroll/PayrollOverview/PayrollOverviewPresentation.d.ts +2 -1
- package/dist/src/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.d.ts +2 -1
- package/dist/src/components/Payroll/TransitionCreation/TransitionCreationPresentation.d.ts +1 -1
- package/dist/src/components/Payroll/TransitionCreation/TransitionCreationTypes.d.ts +2 -0
- package/dist/src/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.d.ts +3 -1
- package/dist/src/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.d.ts +1 -1
- package/dist/src/components/TimeOff/AddEmployeesHoliday/AddEmployeesHoliday.d.ts +1 -1
- package/dist/src/components/TimeOff/AddEmployeesToPolicy/AddEmployeesToPolicy.d.ts +1 -1
- package/dist/src/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetailPresentation.d.ts +1 -1
- package/dist/src/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetailTypes.d.ts +2 -0
- package/dist/src/components/TimeOff/HolidaySelectionForm/HolidaySelectionFormTypes.d.ts +2 -0
- package/dist/src/components/TimeOff/PolicyList/PolicyListPresentation.d.ts +1 -1
- package/dist/src/components/TimeOff/PolicyList/PolicyListTypes.d.ts +2 -0
- package/dist/src/components/TimeOff/PolicySettings/PolicySettingsPresentation.d.ts +1 -1
- package/dist/src/components/TimeOff/PolicySettings/PolicySettingsTypes.d.ts +2 -0
- package/dist/src/components/TimeOff/PolicyTypeSelector/PolicyTypeSelectorPresentation.d.ts +1 -1
- package/dist/src/components/TimeOff/PolicyTypeSelector/PolicyTypeSelectorTypes.d.ts +2 -0
- package/dist/src/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormPresentation.d.ts +1 -1
- package/dist/src/components/TimeOff/TimeOffManagement/PolicyConfigurationForm/PolicyConfigurationFormTypes.d.ts +2 -0
- package/dist/src/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesHoliday.d.ts +2 -0
- package/dist/src/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentation.d.ts +1 -1
- package/dist/src/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesPresentationTypes.d.ts +2 -0
- package/dist/src/components/TimeOff/TimeOffManagement/SelectEmployees/SelectEmployeesTimeOff.d.ts +2 -0
- package/dist/src/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetailPresentation.d.ts +1 -1
- package/dist/src/components/TimeOff/TimeOffPolicyDetail/TimeOffPolicyDetailTypes.d.ts +3 -0
- package/dist/src/components/TimeOff/shared/PolicyDetailLayout/PolicyDetailLayout.d.ts +1 -1
- package/dist/src/components/TimeOff/shared/PolicyDetailLayout/PolicyDetailLayoutTypes.d.ts +2 -0
- package/dist/src/contexts/ComponentAdapter/componentAdapterTypes.d.ts +1 -0
- package/dist/src/contexts/ComponentAdapter/useComponentContext.d.ts +4 -1
- package/dist/src/contexts/UnstableFeaturesProvider/useUnstableFeature.d.ts +4 -1
- package/dist/src/i18n/types.d.ts +28 -2
- package/dist/src/index.d.ts +1 -1
- package/dist/src/models/external.d.ts +1 -0
- package/dist/style.css +1 -1
- package/package.json +16 -15
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo as
|
|
2
|
+
import { useMemo as T } from "react";
|
|
3
3
|
import { useTranslation as n } from "react-i18next";
|
|
4
4
|
import { useI18n as l } from "../../../i18n/I18n.js";
|
|
5
|
-
import { PolicyDetailLayout as
|
|
6
|
-
import { useDataView as
|
|
7
|
-
import { DataView as
|
|
8
|
-
const
|
|
9
|
-
function
|
|
5
|
+
import { PolicyDetailLayout as O } from "../shared/PolicyDetailLayout/PolicyDetailLayout.js";
|
|
6
|
+
import { useDataView as P } from "../../Common/DataView/useDataView.js";
|
|
7
|
+
import { DataView as v } from "../../Common/DataView/DataView.js";
|
|
8
|
+
const x = "holidays";
|
|
9
|
+
function _({
|
|
10
10
|
title: t,
|
|
11
11
|
subtitle: e,
|
|
12
12
|
onBack: a,
|
|
@@ -19,12 +19,13 @@ function A({
|
|
|
19
19
|
onAddEmployee: f,
|
|
20
20
|
removeDialog: b,
|
|
21
21
|
successAlert: c,
|
|
22
|
-
onDismissAlert: p
|
|
22
|
+
onDismissAlert: p,
|
|
23
|
+
className: u
|
|
23
24
|
}) {
|
|
24
25
|
l("Company.TimeOff.HolidayPolicy");
|
|
25
|
-
const { t:
|
|
26
|
+
const { t: H } = n("Company.TimeOff.HolidayPolicy"), D = /* @__PURE__ */ r(C, { holidays: s });
|
|
26
27
|
return /* @__PURE__ */ r(
|
|
27
|
-
|
|
28
|
+
O,
|
|
28
29
|
{
|
|
29
30
|
title: t,
|
|
30
31
|
subtitle: e,
|
|
@@ -32,9 +33,9 @@ function A({
|
|
|
32
33
|
backLabel: i,
|
|
33
34
|
actions: o,
|
|
34
35
|
firstTab: {
|
|
35
|
-
id:
|
|
36
|
-
label:
|
|
37
|
-
content:
|
|
36
|
+
id: x,
|
|
37
|
+
label: H("tabs.holidays"),
|
|
38
|
+
content: D
|
|
38
39
|
},
|
|
39
40
|
selectedTabId: m,
|
|
40
41
|
onTabChange: y,
|
|
@@ -42,13 +43,14 @@ function A({
|
|
|
42
43
|
onAddEmployee: f,
|
|
43
44
|
removeDialog: b,
|
|
44
45
|
successAlert: c,
|
|
45
|
-
onDismissAlert: p
|
|
46
|
+
onDismissAlert: p,
|
|
47
|
+
className: u
|
|
46
48
|
}
|
|
47
49
|
);
|
|
48
50
|
}
|
|
49
|
-
function
|
|
51
|
+
function C({ holidays: t }) {
|
|
50
52
|
l("Company.TimeOff.HolidayPolicy");
|
|
51
|
-
const { t: e } = n("Company.TimeOff.HolidayPolicy"), a =
|
|
53
|
+
const { t: e } = n("Company.TimeOff.HolidayPolicy"), a = T(
|
|
52
54
|
() => [
|
|
53
55
|
{
|
|
54
56
|
key: "name",
|
|
@@ -67,13 +69,13 @@ function x({ holidays: t }) {
|
|
|
67
69
|
}
|
|
68
70
|
],
|
|
69
71
|
[e]
|
|
70
|
-
), i =
|
|
72
|
+
), i = P({
|
|
71
73
|
data: t,
|
|
72
74
|
columns: a
|
|
73
75
|
});
|
|
74
|
-
return /* @__PURE__ */ r(
|
|
76
|
+
return /* @__PURE__ */ r(v, { label: e("tableLabel"), ...i });
|
|
75
77
|
}
|
|
76
78
|
export {
|
|
77
|
-
|
|
79
|
+
_ as HolidayPolicyDetailPresentation
|
|
78
80
|
};
|
|
79
81
|
//# sourceMappingURL=HolidayPolicyDetailPresentation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HolidayPolicyDetailPresentation.js","sources":["../../../../src/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetailPresentation.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport type { HolidayItem } from '../HolidaySelectionForm/HolidaySelectionFormTypes'\nimport { PolicyDetailLayout } from '../shared/PolicyDetailLayout'\nimport type { HolidayPolicyDetailPresentationProps } from './HolidayPolicyDetailTypes'\nimport { DataView, useDataView } from '@/components/Common'\nimport { useI18n } from '@/i18n'\n\nconst HOLIDAYS_TAB_ID = 'holidays'\n\n/** @internal */\nexport function HolidayPolicyDetailPresentation({\n title,\n subtitle,\n onBack,\n backLabel,\n actions,\n holidays,\n selectedTabId,\n onTabChange,\n employees,\n onAddEmployee,\n removeDialog,\n successAlert,\n onDismissAlert,\n}: HolidayPolicyDetailPresentationProps) {\n useI18n('Company.TimeOff.HolidayPolicy')\n const { t } = useTranslation('Company.TimeOff.HolidayPolicy')\n\n const holidaysTabContent = <HolidaysTab holidays={holidays} />\n\n return (\n <PolicyDetailLayout\n title={title}\n subtitle={subtitle}\n onBack={onBack}\n backLabel={backLabel}\n actions={actions}\n firstTab={{\n id: HOLIDAYS_TAB_ID,\n label: t('tabs.holidays'),\n content: holidaysTabContent,\n }}\n selectedTabId={selectedTabId}\n onTabChange={onTabChange}\n employees={employees}\n onAddEmployee={onAddEmployee}\n removeDialog={removeDialog}\n successAlert={successAlert}\n onDismissAlert={onDismissAlert}\n />\n )\n}\n\nfunction HolidaysTab({ holidays }: { holidays: HolidayItem[] }) {\n useI18n('Company.TimeOff.HolidayPolicy')\n const { t } = useTranslation('Company.TimeOff.HolidayPolicy')\n\n const columns = useMemo(\n () => [\n {\n key: 'name' as keyof HolidayItem,\n title: t('tableHeaders.holidayName'),\n render: (item: HolidayItem) => item.name,\n },\n {\n key: 'observedDate' as keyof HolidayItem,\n title: t('tableHeaders.observedDate'),\n render: (item: HolidayItem) => item.observedDate,\n },\n {\n key: 'nextObservation' as keyof HolidayItem,\n title: t('tableHeaders.nextObservation'),\n render: (item: HolidayItem) => item.nextObservation,\n },\n ],\n [t],\n )\n\n const dataViewProps = useDataView<HolidayItem>({\n data: holidays,\n columns,\n })\n\n return <DataView label={t('tableLabel')} {...dataViewProps} />\n}\n"],"names":["HOLIDAYS_TAB_ID","HolidayPolicyDetailPresentation","title","subtitle","onBack","backLabel","actions","holidays","selectedTabId","onTabChange","employees","onAddEmployee","removeDialog","successAlert","onDismissAlert","useI18n","t","useTranslation","holidaysTabContent","jsx","HolidaysTab","PolicyDetailLayout","columns","useMemo","item","dataViewProps","useDataView","DataView"],"mappings":";;;;;;;AAQA,MAAMA,IAAkB;AAGjB,SAASC,EAAgC;AAAA,EAC9C,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,eAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,gBAAAC;AACF,GAAyC;AACvC,EAAAC,EAAQ,+BAA+B;AACvC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,+BAA+B,GAEtDC,IAAqB,gBAAAC,EAACC,GAAA,EAAY,
|
|
1
|
+
{"version":3,"file":"HolidayPolicyDetailPresentation.js","sources":["../../../../src/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetailPresentation.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport type { HolidayItem } from '../HolidaySelectionForm/HolidaySelectionFormTypes'\nimport { PolicyDetailLayout } from '../shared/PolicyDetailLayout'\nimport type { HolidayPolicyDetailPresentationProps } from './HolidayPolicyDetailTypes'\nimport { DataView, useDataView } from '@/components/Common'\nimport { useI18n } from '@/i18n'\n\nconst HOLIDAYS_TAB_ID = 'holidays'\n\n/** @internal */\nexport function HolidayPolicyDetailPresentation({\n title,\n subtitle,\n onBack,\n backLabel,\n actions,\n holidays,\n selectedTabId,\n onTabChange,\n employees,\n onAddEmployee,\n removeDialog,\n successAlert,\n onDismissAlert,\n className,\n}: HolidayPolicyDetailPresentationProps) {\n useI18n('Company.TimeOff.HolidayPolicy')\n const { t } = useTranslation('Company.TimeOff.HolidayPolicy')\n\n const holidaysTabContent = <HolidaysTab holidays={holidays} />\n\n return (\n <PolicyDetailLayout\n title={title}\n subtitle={subtitle}\n onBack={onBack}\n backLabel={backLabel}\n actions={actions}\n firstTab={{\n id: HOLIDAYS_TAB_ID,\n label: t('tabs.holidays'),\n content: holidaysTabContent,\n }}\n selectedTabId={selectedTabId}\n onTabChange={onTabChange}\n employees={employees}\n onAddEmployee={onAddEmployee}\n removeDialog={removeDialog}\n successAlert={successAlert}\n onDismissAlert={onDismissAlert}\n className={className}\n />\n )\n}\n\nfunction HolidaysTab({ holidays }: { holidays: HolidayItem[] }) {\n useI18n('Company.TimeOff.HolidayPolicy')\n const { t } = useTranslation('Company.TimeOff.HolidayPolicy')\n\n const columns = useMemo(\n () => [\n {\n key: 'name' as keyof HolidayItem,\n title: t('tableHeaders.holidayName'),\n render: (item: HolidayItem) => item.name,\n },\n {\n key: 'observedDate' as keyof HolidayItem,\n title: t('tableHeaders.observedDate'),\n render: (item: HolidayItem) => item.observedDate,\n },\n {\n key: 'nextObservation' as keyof HolidayItem,\n title: t('tableHeaders.nextObservation'),\n render: (item: HolidayItem) => item.nextObservation,\n },\n ],\n [t],\n )\n\n const dataViewProps = useDataView<HolidayItem>({\n data: holidays,\n columns,\n })\n\n return <DataView label={t('tableLabel')} {...dataViewProps} />\n}\n"],"names":["HOLIDAYS_TAB_ID","HolidayPolicyDetailPresentation","title","subtitle","onBack","backLabel","actions","holidays","selectedTabId","onTabChange","employees","onAddEmployee","removeDialog","successAlert","onDismissAlert","className","useI18n","t","useTranslation","holidaysTabContent","jsx","HolidaysTab","PolicyDetailLayout","columns","useMemo","item","dataViewProps","useDataView","DataView"],"mappings":";;;;;;;AAQA,MAAMA,IAAkB;AAGjB,SAASC,EAAgC;AAAA,EAC9C,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,eAAAC;AAAA,EACA,aAAAC;AAAA,EACA,WAAAC;AAAA,EACA,eAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,WAAAC;AACF,GAAyC;AACvC,EAAAC,EAAQ,+BAA+B;AACvC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,+BAA+B,GAEtDC,IAAqB,gBAAAC,EAACC,GAAA,EAAY,UAAAd,EAAA,CAAoB;AAE5D,SACE,gBAAAa;AAAA,IAACE;AAAA,IAAA;AAAA,MACC,OAAApB;AAAA,MACA,UAAAC;AAAA,MACA,QAAAC;AAAA,MACA,WAAAC;AAAA,MACA,SAAAC;AAAA,MACA,UAAU;AAAA,QACR,IAAIN;AAAA,QACJ,OAAOiB,EAAE,eAAe;AAAA,QACxB,SAASE;AAAA,MAAA;AAAA,MAEX,eAAAX;AAAA,MACA,aAAAC;AAAA,MACA,WAAAC;AAAA,MACA,eAAAC;AAAA,MACA,cAAAC;AAAA,MACA,cAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,WAAAC;AAAA,IAAA;AAAA,EAAA;AAGN;AAEA,SAASM,EAAY,EAAE,UAAAd,KAAyC;AAC9D,EAAAS,EAAQ,+BAA+B;AACvC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,+BAA+B,GAEtDK,IAAUC;AAAA,IACd,MAAM;AAAA,MACJ;AAAA,QACE,KAAK;AAAA,QACL,OAAOP,EAAE,0BAA0B;AAAA,QACnC,QAAQ,CAACQ,MAAsBA,EAAK;AAAA,MAAA;AAAA,MAEtC;AAAA,QACE,KAAK;AAAA,QACL,OAAOR,EAAE,2BAA2B;AAAA,QACpC,QAAQ,CAACQ,MAAsBA,EAAK;AAAA,MAAA;AAAA,MAEtC;AAAA,QACE,KAAK;AAAA,QACL,OAAOR,EAAE,8BAA8B;AAAA,QACvC,QAAQ,CAACQ,MAAsBA,EAAK;AAAA,MAAA;AAAA,IACtC;AAAA,IAEF,CAACR,CAAC;AAAA,EAAA,GAGES,IAAgBC,EAAyB;AAAA,IAC7C,MAAMpB;AAAA,IACN,SAAAgB;AAAA,EAAA,CACD;AAED,2BAAQK,GAAA,EAAS,OAAOX,EAAE,YAAY,GAAI,GAAGS,GAAe;AAC9D;"}
|
|
@@ -1,99 +1,100 @@
|
|
|
1
1
|
import { jsx as u } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo as C, useCallback as r, useState as b } from "react";
|
|
3
|
-
import { useTranslation as
|
|
4
|
-
import { useQueryClient as
|
|
3
|
+
import { useTranslation as O } from "react-i18next";
|
|
4
|
+
import { useQueryClient as _ } from "@tanstack/react-query";
|
|
5
5
|
import { useHolidayPayPoliciesCreateMutation as k } from "@gusto/embedded-api/react-query/holidayPayPoliciesCreate";
|
|
6
|
-
import { useHolidayPayPoliciesGetSuspense as
|
|
7
|
-
import { useHolidayPayPoliciesUpdateMutation as
|
|
8
|
-
import { getDefaultHolidayItems as
|
|
6
|
+
import { useHolidayPayPoliciesGetSuspense as x, invalidateAllHolidayPayPoliciesGet as w, queryKeyHolidayPayPoliciesGet as M } from "@gusto/embedded-api/react-query/holidayPayPoliciesGet";
|
|
7
|
+
import { useHolidayPayPoliciesUpdateMutation as R } from "@gusto/embedded-api/react-query/holidayPayPoliciesUpdate";
|
|
8
|
+
import { getDefaultHolidayItems as N, FEDERAL_HOLIDAY_KEYS as T, buildFederalHolidaysPayload as U } from "../shared/holidayHelpers.js";
|
|
9
9
|
import { HolidaySelectionFormPresentation as v } from "./HolidaySelectionFormPresentation.js";
|
|
10
|
-
import { BaseComponent as
|
|
10
|
+
import { BaseComponent as Y } from "../../Base/Base.js";
|
|
11
11
|
import { useBase as D } from "../../Base/useBase.js";
|
|
12
12
|
import { componentEvents as S } from "../../../shared/constants.js";
|
|
13
13
|
import { useI18n as I } from "../../../i18n/I18n.js";
|
|
14
14
|
import { useLocale as L } from "../../../contexts/LocaleProvider/useLocale.js";
|
|
15
|
-
function
|
|
16
|
-
return /* @__PURE__ */ u(
|
|
15
|
+
function le(e) {
|
|
16
|
+
return /* @__PURE__ */ u(Y, { ...e, children: e.mode === "edit" ? /* @__PURE__ */ u(K, { companyId: e.companyId, className: e.className }) : /* @__PURE__ */ u(G, { companyId: e.companyId, className: e.className }) });
|
|
17
17
|
}
|
|
18
18
|
function g(e) {
|
|
19
|
-
const [
|
|
20
|
-
|
|
21
|
-
const t = new Set(
|
|
22
|
-
return
|
|
19
|
+
const [s, n] = b(e), o = r((a, i) => {
|
|
20
|
+
n((d) => {
|
|
21
|
+
const t = new Set(d);
|
|
22
|
+
return i ? t.add(a.uuid) : t.delete(a.uuid), t;
|
|
23
23
|
});
|
|
24
|
-
}, []),
|
|
25
|
-
|
|
26
|
-
const t = new Set(
|
|
27
|
-
for (const
|
|
28
|
-
|
|
24
|
+
}, []), c = r((a, i) => {
|
|
25
|
+
n((d) => {
|
|
26
|
+
const t = new Set(d);
|
|
27
|
+
for (const l of i)
|
|
28
|
+
a ? t.add(l.uuid) : t.delete(l.uuid);
|
|
29
29
|
return t;
|
|
30
30
|
});
|
|
31
31
|
}, []);
|
|
32
|
-
return { selectedUuids:
|
|
32
|
+
return { selectedUuids: s, handleSelectionChange: o, handleSelectAll: c };
|
|
33
33
|
}
|
|
34
|
-
function F(e,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
(
|
|
34
|
+
function F(e, s, n) {
|
|
35
|
+
n && e.setQueryData(
|
|
36
|
+
M(s, {}),
|
|
37
|
+
(o) => o ? { ...o, holidayPayPolicy: n } : void 0
|
|
38
38
|
);
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function G({ companyId: e, className: s }) {
|
|
41
41
|
I("Company.TimeOff.HolidayPolicy");
|
|
42
|
-
const { t:
|
|
43
|
-
await
|
|
42
|
+
const { t: n } = O("Company.TimeOff.HolidayPolicy"), { onEvent: o, baseSubmitHandler: c } = D(), { locale: a } = L(), i = _(), d = C(() => N(n, void 0, a), [n, a]), t = C(() => new Set(T), []), { selectedUuids: l, handleSelectionChange: H, handleSelectAll: y } = g(t), { mutateAsync: m, isPending: h } = k(), f = r(async () => {
|
|
43
|
+
await c({}, async () => {
|
|
44
44
|
const p = await m({
|
|
45
45
|
request: {
|
|
46
46
|
companyUuid: e,
|
|
47
47
|
holidayPayPolicyRequest: {
|
|
48
|
-
federalHolidays: U(
|
|
48
|
+
federalHolidays: U(l)
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
|
-
F(
|
|
52
|
+
F(i, e, p.holidayPayPolicy), await w(i), o(S.TIME_OFF_HOLIDAY_SELECTION_DONE);
|
|
53
53
|
});
|
|
54
|
-
}, [
|
|
54
|
+
}, [c, m, e, l, i, o]), E = r(() => {
|
|
55
55
|
o(S.CANCEL);
|
|
56
56
|
}, [o]);
|
|
57
57
|
return /* @__PURE__ */ u(
|
|
58
58
|
v,
|
|
59
59
|
{
|
|
60
|
-
holidays:
|
|
61
|
-
selectedHolidayUuids:
|
|
62
|
-
onSelectionChange:
|
|
60
|
+
holidays: d,
|
|
61
|
+
selectedHolidayUuids: l,
|
|
62
|
+
onSelectionChange: H,
|
|
63
63
|
onSelectAll: y,
|
|
64
64
|
onContinue: f,
|
|
65
|
-
onBack:
|
|
66
|
-
isPending:
|
|
65
|
+
onBack: E,
|
|
66
|
+
isPending: h,
|
|
67
|
+
className: s
|
|
67
68
|
}
|
|
68
69
|
);
|
|
69
70
|
}
|
|
70
|
-
function
|
|
71
|
+
function K({ companyId: e, className: s }) {
|
|
71
72
|
I("Company.TimeOff.HolidayPolicy");
|
|
72
|
-
const { t:
|
|
73
|
-
const P = /* @__PURE__ */ new Set(), B =
|
|
74
|
-
for (const
|
|
75
|
-
B[
|
|
73
|
+
const { t: n } = O("Company.TimeOff.HolidayPolicy"), { onEvent: o, baseSubmitHandler: c } = D(), { locale: a } = L(), i = _(), { data: d } = x({ companyUuid: e }), t = d.holidayPayPolicy, l = C(() => N(n, void 0, a), [n, a]), H = C(() => {
|
|
74
|
+
const P = /* @__PURE__ */ new Set(), B = t.federalHolidays;
|
|
75
|
+
for (const A of T)
|
|
76
|
+
B[A]?.selected === !0 && P.add(A);
|
|
76
77
|
return P;
|
|
77
|
-
}, [
|
|
78
|
-
await
|
|
78
|
+
}, [t.federalHolidays]), { selectedUuids: y, handleSelectionChange: m, handleSelectAll: h } = g(H), { mutateAsync: f, isPending: E } = R(), p = r(async () => {
|
|
79
|
+
await c({}, async () => {
|
|
79
80
|
const P = await f({
|
|
80
81
|
request: {
|
|
81
82
|
companyUuid: e,
|
|
82
83
|
requestBody: {
|
|
83
|
-
version:
|
|
84
|
+
version: t.version,
|
|
84
85
|
federalHolidays: U(y)
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
88
|
});
|
|
88
|
-
F(
|
|
89
|
+
F(i, e, P.holidayPayPolicy), await w(i), o(S.TIME_OFF_HOLIDAY_SELECTION_EDIT_DONE);
|
|
89
90
|
});
|
|
90
91
|
}, [
|
|
91
|
-
|
|
92
|
+
c,
|
|
92
93
|
f,
|
|
93
94
|
e,
|
|
94
|
-
|
|
95
|
+
t.version,
|
|
95
96
|
y,
|
|
96
|
-
|
|
97
|
+
i,
|
|
97
98
|
o
|
|
98
99
|
]), q = r(() => {
|
|
99
100
|
o(S.CANCEL);
|
|
@@ -101,17 +102,18 @@ function G({ companyId: e }) {
|
|
|
101
102
|
return /* @__PURE__ */ u(
|
|
102
103
|
v,
|
|
103
104
|
{
|
|
104
|
-
holidays:
|
|
105
|
+
holidays: l,
|
|
105
106
|
selectedHolidayUuids: y,
|
|
106
107
|
onSelectionChange: m,
|
|
107
|
-
onSelectAll:
|
|
108
|
+
onSelectAll: h,
|
|
108
109
|
onContinue: p,
|
|
109
110
|
onBack: q,
|
|
110
|
-
isPending:
|
|
111
|
+
isPending: E,
|
|
112
|
+
className: s
|
|
111
113
|
}
|
|
112
114
|
);
|
|
113
115
|
}
|
|
114
116
|
export {
|
|
115
|
-
|
|
117
|
+
le as HolidaySelectionForm
|
|
116
118
|
};
|
|
117
119
|
//# sourceMappingURL=HolidaySelectionForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HolidaySelectionForm.js","sources":["../../../../src/components/TimeOff/HolidaySelectionForm/HolidaySelectionForm.tsx"],"sourcesContent":["import { useCallback, useMemo, useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { useHolidayPayPoliciesCreateMutation } from '@gusto/embedded-api/react-query/holidayPayPoliciesCreate'\nimport {\n useHolidayPayPoliciesGetSuspense,\n queryKeyHolidayPayPoliciesGet,\n invalidateAllHolidayPayPoliciesGet,\n type HolidayPayPoliciesGetQueryData,\n} from '@gusto/embedded-api/react-query/holidayPayPoliciesGet'\nimport { useHolidayPayPoliciesUpdateMutation } from '@gusto/embedded-api/react-query/holidayPayPoliciesUpdate'\nimport type { HolidayPayPolicy } from '@gusto/embedded-api/models/components/holidaypaypolicy'\nimport {\n getDefaultHolidayItems,\n buildFederalHolidaysPayload,\n FEDERAL_HOLIDAY_KEYS,\n} from '../shared/holidayHelpers'\nimport { HolidaySelectionFormPresentation } from './HolidaySelectionFormPresentation'\nimport type { HolidayItem } from './HolidaySelectionFormTypes'\nimport { BaseComponent, type BaseComponentInterface } from '@/components/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { componentEvents } from '@/shared/constants'\nimport { useI18n } from '@/i18n'\nimport { useLocale } from '@/contexts/LocaleProvider/useLocale'\n\n/**\n * Props for {@link HolidaySelectionForm}.\n *\n * @public\n */\nexport interface HolidaySelectionFormProps extends BaseComponentInterface<'Company.TimeOff.HolidayPolicy'> {\n /** The associated company identifier. */\n companyId: string\n /** Whether to create a new holiday policy or edit the existing one. Defaults to `'create'`. */\n mode?: 'create' | 'edit'\n}\n\n/**\n * Lets a user select which US federal holidays are observed by the company's holiday pay policy.\n *\n * In `'create'` mode, submitting creates a new holiday pay policy. In `'edit'` mode, the form\n * is pre-populated with the existing policy's selections and submitting updates it. All 11 US\n * federal holidays are shown with their observed and next-observation dates; in create mode they\n * are all selected by default.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `timeOff/holidaySelection/done` | Holidays were saved in create mode | — |\n * | `timeOff/holidaySelection/editDone` | Holidays were saved in edit mode | — |\n * | `CANCEL` | The user backed out of the form | — |\n *\n * @param props - See {@link HolidaySelectionFormProps}.\n * @returns The rendered holiday selection form.\n * @public\n */\nexport function HolidaySelectionForm(props: HolidaySelectionFormProps) {\n return (\n <BaseComponent {...props}>\n {props.mode === 'edit' ? (\n <EditRoot companyId={props.companyId} />\n ) : (\n <CreateRoot companyId={props.companyId} />\n )}\n </BaseComponent>\n )\n}\n\ninterface RootProps {\n companyId: string\n}\n\nfunction useHolidaySelection(initialKeys: Set<string>) {\n const [selectedUuids, setSelectedUuids] = useState(initialKeys)\n\n const handleSelectionChange = useCallback((item: HolidayItem, selected: boolean) => {\n setSelectedUuids(prev => {\n const next = new Set(prev)\n if (selected) {\n next.add(item.uuid)\n } else {\n next.delete(item.uuid)\n }\n return next\n })\n }, [])\n\n const handleSelectAll = useCallback((selected: boolean, visibleItems: HolidayItem[]) => {\n setSelectedUuids(prev => {\n const next = new Set(prev)\n for (const item of visibleItems) {\n if (selected) next.add(item.uuid)\n else next.delete(item.uuid)\n }\n return next\n })\n }, [])\n\n return { selectedUuids, handleSelectionChange, handleSelectAll }\n}\n\nfunction seedPolicyCache(\n queryClient: ReturnType<typeof useQueryClient>,\n companyId: string,\n policy: HolidayPayPolicy | undefined,\n) {\n if (!policy) return\n queryClient.setQueryData<HolidayPayPoliciesGetQueryData>(\n queryKeyHolidayPayPoliciesGet(companyId, {}),\n prev =>\n prev\n ? { ...prev, holidayPayPolicy: policy }\n : (undefined as unknown as HolidayPayPoliciesGetQueryData),\n )\n}\n\nfunction CreateRoot({ companyId }: RootProps) {\n useI18n('Company.TimeOff.HolidayPolicy')\n const { t } = useTranslation('Company.TimeOff.HolidayPolicy')\n const { onEvent, baseSubmitHandler } = useBase()\n const { locale } = useLocale()\n const queryClient = useQueryClient()\n\n const holidays = useMemo(() => getDefaultHolidayItems(t, undefined, locale), [t, locale])\n const allKeys = useMemo(() => new Set(FEDERAL_HOLIDAY_KEYS), [])\n const { selectedUuids, handleSelectionChange, handleSelectAll } = useHolidaySelection(allKeys)\n\n const { mutateAsync: createPolicy, isPending } = useHolidayPayPoliciesCreateMutation()\n\n const handleContinue = useCallback(async () => {\n await baseSubmitHandler({}, async () => {\n const response = await createPolicy({\n request: {\n companyUuid: companyId,\n holidayPayPolicyRequest: {\n federalHolidays: buildFederalHolidaysPayload(selectedUuids),\n },\n },\n })\n // Seed the GET cache so the next mount of SelectEmployeesHoliday's\n // StandaloneLoader (in addEmployeesHoliday state) reads the freshly\n // created policy instead of a stale `{ holidayPayPolicy: undefined }`\n // left over from PolicyList's pre-create GET.\n seedPolicyCache(queryClient, companyId, response.holidayPayPolicy)\n await invalidateAllHolidayPayPoliciesGet(queryClient)\n onEvent(componentEvents.TIME_OFF_HOLIDAY_SELECTION_DONE)\n })\n }, [baseSubmitHandler, createPolicy, companyId, selectedUuids, queryClient, onEvent])\n\n const handleBack = useCallback(() => {\n onEvent(componentEvents.CANCEL)\n }, [onEvent])\n\n return (\n <HolidaySelectionFormPresentation\n holidays={holidays}\n selectedHolidayUuids={selectedUuids}\n onSelectionChange={handleSelectionChange}\n onSelectAll={handleSelectAll}\n onContinue={handleContinue}\n onBack={handleBack}\n isPending={isPending}\n />\n )\n}\n\nfunction EditRoot({ companyId }: RootProps) {\n useI18n('Company.TimeOff.HolidayPolicy')\n const { t } = useTranslation('Company.TimeOff.HolidayPolicy')\n const { onEvent, baseSubmitHandler } = useBase()\n const { locale } = useLocale()\n const queryClient = useQueryClient()\n\n const { data } = useHolidayPayPoliciesGetSuspense({ companyUuid: companyId })\n const policy = data.holidayPayPolicy!\n\n const holidays = useMemo(() => getDefaultHolidayItems(t, undefined, locale), [t, locale])\n\n const initialSelected = useMemo(() => {\n const next = new Set<string>()\n const federal = policy.federalHolidays\n for (const key of FEDERAL_HOLIDAY_KEYS) {\n const entry = federal[key as keyof typeof federal]\n if (entry?.selected === true) {\n next.add(key)\n }\n }\n return next\n }, [policy.federalHolidays])\n\n const { selectedUuids, handleSelectionChange, handleSelectAll } =\n useHolidaySelection(initialSelected)\n\n const { mutateAsync: updatePolicy, isPending } = useHolidayPayPoliciesUpdateMutation()\n\n const handleContinue = useCallback(async () => {\n await baseSubmitHandler({}, async () => {\n const response = await updatePolicy({\n request: {\n companyUuid: companyId,\n requestBody: {\n version: policy.version!,\n federalHolidays: buildFederalHolidaysPayload(selectedUuids),\n },\n },\n })\n seedPolicyCache(queryClient, companyId, response.holidayPayPolicy)\n await invalidateAllHolidayPayPoliciesGet(queryClient)\n onEvent(componentEvents.TIME_OFF_HOLIDAY_SELECTION_EDIT_DONE)\n })\n }, [\n baseSubmitHandler,\n updatePolicy,\n companyId,\n policy.version,\n selectedUuids,\n queryClient,\n onEvent,\n ])\n\n const handleBack = useCallback(() => {\n onEvent(componentEvents.CANCEL)\n }, [onEvent])\n\n return (\n <HolidaySelectionFormPresentation\n holidays={holidays}\n selectedHolidayUuids={selectedUuids}\n onSelectionChange={handleSelectionChange}\n onSelectAll={handleSelectAll}\n onContinue={handleContinue}\n onBack={handleBack}\n isPending={isPending}\n />\n )\n}\n"],"names":["HolidaySelectionForm","props","BaseComponent","jsx","EditRoot","CreateRoot","useHolidaySelection","initialKeys","selectedUuids","setSelectedUuids","useState","handleSelectionChange","useCallback","item","selected","prev","next","handleSelectAll","visibleItems","seedPolicyCache","queryClient","companyId","policy","queryKeyHolidayPayPoliciesGet","useI18n","t","useTranslation","onEvent","baseSubmitHandler","useBase","locale","useLocale","useQueryClient","holidays","useMemo","getDefaultHolidayItems","allKeys","FEDERAL_HOLIDAY_KEYS","createPolicy","isPending","useHolidayPayPoliciesCreateMutation","handleContinue","response","buildFederalHolidaysPayload","invalidateAllHolidayPayPoliciesGet","componentEvents","handleBack","HolidaySelectionFormPresentation","data","useHolidayPayPoliciesGetSuspense","initialSelected","federal","key","updatePolicy","useHolidayPayPoliciesUpdateMutation"],"mappings":";;;;;;;;;;;;;;AAwDO,SAASA,GAAqBC,GAAkC;AACrE,2BACGC,GAAA,EAAe,GAAGD,GAChB,UAAAA,EAAM,SAAS,SACd,gBAAAE,EAACC,GAAA,EAAS,WAAWH,EAAM,WAAW,IAEtC,gBAAAE,EAACE,KAAW,WAAWJ,EAAM,WAAW,GAE5C;AAEJ;AAMA,SAASK,EAAoBC,GAA0B;AACrD,QAAM,CAACC,GAAeC,CAAgB,IAAIC,EAASH,CAAW,GAExDI,IAAwBC,EAAY,CAACC,GAAmBC,MAAsB;AAClF,IAAAL,EAAiB,CAAAM,MAAQ;AACvB,YAAMC,IAAO,IAAI,IAAID,CAAI;AACzB,aAAID,IACFE,EAAK,IAAIH,EAAK,IAAI,IAElBG,EAAK,OAAOH,EAAK,IAAI,GAEhBG;AAAA,IACT,CAAC;AAAA,EACH,GAAG,CAAA,CAAE,GAECC,IAAkBL,EAAY,CAACE,GAAmBI,MAAgC;AACtF,IAAAT,EAAiB,CAAAM,MAAQ;AACvB,YAAMC,IAAO,IAAI,IAAID,CAAI;AACzB,iBAAWF,KAAQK;AACjB,QAAIJ,IAAUE,EAAK,IAAIH,EAAK,IAAI,IA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AMW,EAAa;AAAA,QAClC,SAAS;AAAA,UACP,aAAahC;AAAA,UACb,aAAa;AAAA,YACX,SAASC,EAAO;AAAA,YAChB,iBAAiBqB,EAA4BnC,CAAa;AAAA,UAAA;AAAA,QAC5D;AAAA,MACF,CACD;AACD,MAAAW,EAAgBC,GAAaC,GAAWqB,EAAS,gBAAgB,GACjE,MAAME,EAAmCxB,CAAW,GACpDO,EAAQkB,EAAgB,oCAAoC;AAAA,IAC9D,CAAC;AAAA,EACH,GAAG;AAAA,IACDjB;AAAA,IACAyB;AAAA,IACAhC;AAAA,IACAC,EAAO;AAAA,IACPd;AAAA,IACAY;AAAA,IACAO;AAAA,EAAA,CACD,GAEKmB,IAAalC,EAAY,MAAM;AACnC,IAAAe,EAAQkB,EAAgB,MAAM;AAAA,EAChC,GAAG,CAAClB,CAAO,CAAC;AAEZ,SACE,gBAAAxB;AAAA,IAAC4C;AAAA,IAAA;AAAA,MACC,UAAAd;AAAA,MACA,sBAAsBzB;AAAA,MACtB,mBAAmBG;AAAA,MACnB,aAAaM;AAAA,MACb,YAAYwB;AAAA,MACZ,QAAQK;AAAA,MACR,WAAAP;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
1
|
+
{"version":3,"file":"HolidaySelectionForm.js","sources":["../../../../src/components/TimeOff/HolidaySelectionForm/HolidaySelectionForm.tsx"],"sourcesContent":["import { useCallback, useMemo, useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { useQueryClient } from '@tanstack/react-query'\nimport { useHolidayPayPoliciesCreateMutation } from '@gusto/embedded-api/react-query/holidayPayPoliciesCreate'\nimport {\n useHolidayPayPoliciesGetSuspense,\n queryKeyHolidayPayPoliciesGet,\n invalidateAllHolidayPayPoliciesGet,\n type HolidayPayPoliciesGetQueryData,\n} from '@gusto/embedded-api/react-query/holidayPayPoliciesGet'\nimport { useHolidayPayPoliciesUpdateMutation } from '@gusto/embedded-api/react-query/holidayPayPoliciesUpdate'\nimport type { HolidayPayPolicy } from '@gusto/embedded-api/models/components/holidaypaypolicy'\nimport {\n getDefaultHolidayItems,\n buildFederalHolidaysPayload,\n FEDERAL_HOLIDAY_KEYS,\n} from '../shared/holidayHelpers'\nimport { HolidaySelectionFormPresentation } from './HolidaySelectionFormPresentation'\nimport type { HolidayItem } from './HolidaySelectionFormTypes'\nimport { BaseComponent, type BaseComponentInterface } from '@/components/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { componentEvents } from '@/shared/constants'\nimport { useI18n } from '@/i18n'\nimport { useLocale } from '@/contexts/LocaleProvider/useLocale'\n\n/**\n * Props for {@link HolidaySelectionForm}.\n *\n * @public\n */\nexport interface HolidaySelectionFormProps extends BaseComponentInterface<'Company.TimeOff.HolidayPolicy'> {\n /** The associated company identifier. */\n companyId: string\n /** Whether to create a new holiday policy or edit the existing one. Defaults to `'create'`. */\n mode?: 'create' | 'edit'\n}\n\n/**\n * Lets a user select which US federal holidays are observed by the company's holiday pay policy.\n *\n * In `'create'` mode, submitting creates a new holiday pay policy. In `'edit'` mode, the form\n * is pre-populated with the existing policy's selections and submitting updates it. All 11 US\n * federal holidays are shown with their observed and next-observation dates; in create mode they\n * are all selected by default.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `timeOff/holidaySelection/done` | Holidays were saved in create mode | — |\n * | `timeOff/holidaySelection/editDone` | Holidays were saved in edit mode | — |\n * | `CANCEL` | The user backed out of the form | — |\n *\n * @param props - See {@link HolidaySelectionFormProps}.\n * @returns The rendered holiday selection form.\n * @public\n */\nexport function HolidaySelectionForm(props: HolidaySelectionFormProps) {\n return (\n <BaseComponent {...props}>\n {props.mode === 'edit' ? (\n <EditRoot companyId={props.companyId} className={props.className} />\n ) : (\n <CreateRoot companyId={props.companyId} className={props.className} />\n )}\n </BaseComponent>\n )\n}\n\ninterface RootProps {\n companyId: string\n /** CSS class name applied to the root element. */\n className?: string\n}\n\nfunction useHolidaySelection(initialKeys: Set<string>) {\n const [selectedUuids, setSelectedUuids] = useState(initialKeys)\n\n const handleSelectionChange = useCallback((item: HolidayItem, selected: boolean) => {\n setSelectedUuids(prev => {\n const next = new Set(prev)\n if (selected) {\n next.add(item.uuid)\n } else {\n next.delete(item.uuid)\n }\n return next\n })\n }, [])\n\n const handleSelectAll = useCallback((selected: boolean, visibleItems: HolidayItem[]) => {\n setSelectedUuids(prev => {\n const next = new Set(prev)\n for (const item of visibleItems) {\n if (selected) next.add(item.uuid)\n else next.delete(item.uuid)\n }\n return next\n })\n }, [])\n\n return { selectedUuids, handleSelectionChange, handleSelectAll }\n}\n\nfunction seedPolicyCache(\n queryClient: ReturnType<typeof useQueryClient>,\n companyId: string,\n policy: HolidayPayPolicy | undefined,\n) {\n if (!policy) return\n queryClient.setQueryData<HolidayPayPoliciesGetQueryData>(\n queryKeyHolidayPayPoliciesGet(companyId, {}),\n prev =>\n prev\n ? { ...prev, holidayPayPolicy: policy }\n : (undefined as unknown as HolidayPayPoliciesGetQueryData),\n )\n}\n\nfunction CreateRoot({ companyId, className }: RootProps) {\n useI18n('Company.TimeOff.HolidayPolicy')\n const { t } = useTranslation('Company.TimeOff.HolidayPolicy')\n const { onEvent, baseSubmitHandler } = useBase()\n const { locale } = useLocale()\n const queryClient = useQueryClient()\n\n const holidays = useMemo(() => getDefaultHolidayItems(t, undefined, locale), [t, locale])\n const allKeys = useMemo(() => new Set(FEDERAL_HOLIDAY_KEYS), [])\n const { selectedUuids, handleSelectionChange, handleSelectAll } = useHolidaySelection(allKeys)\n\n const { mutateAsync: createPolicy, isPending } = useHolidayPayPoliciesCreateMutation()\n\n const handleContinue = useCallback(async () => {\n await baseSubmitHandler({}, async () => {\n const response = await createPolicy({\n request: {\n companyUuid: companyId,\n holidayPayPolicyRequest: {\n federalHolidays: buildFederalHolidaysPayload(selectedUuids),\n },\n },\n })\n // Seed the GET cache so the next mount of SelectEmployeesHoliday's\n // StandaloneLoader (in addEmployeesHoliday state) reads the freshly\n // created policy instead of a stale `{ holidayPayPolicy: undefined }`\n // left over from PolicyList's pre-create GET.\n seedPolicyCache(queryClient, companyId, response.holidayPayPolicy)\n await invalidateAllHolidayPayPoliciesGet(queryClient)\n onEvent(componentEvents.TIME_OFF_HOLIDAY_SELECTION_DONE)\n })\n }, [baseSubmitHandler, createPolicy, companyId, selectedUuids, queryClient, onEvent])\n\n const handleBack = useCallback(() => {\n onEvent(componentEvents.CANCEL)\n }, [onEvent])\n\n return (\n <HolidaySelectionFormPresentation\n holidays={holidays}\n selectedHolidayUuids={selectedUuids}\n onSelectionChange={handleSelectionChange}\n onSelectAll={handleSelectAll}\n onContinue={handleContinue}\n onBack={handleBack}\n isPending={isPending}\n className={className}\n />\n )\n}\n\nfunction EditRoot({ companyId, className }: RootProps) {\n useI18n('Company.TimeOff.HolidayPolicy')\n const { t } = useTranslation('Company.TimeOff.HolidayPolicy')\n const { onEvent, baseSubmitHandler } = useBase()\n const { locale } = useLocale()\n const queryClient = useQueryClient()\n\n const { data } = useHolidayPayPoliciesGetSuspense({ companyUuid: companyId })\n const policy = data.holidayPayPolicy!\n\n const holidays = useMemo(() => getDefaultHolidayItems(t, undefined, locale), [t, locale])\n\n const initialSelected = useMemo(() => {\n const next = new Set<string>()\n const federal = policy.federalHolidays\n for (const key of FEDERAL_HOLIDAY_KEYS) {\n const entry = federal[key as keyof typeof federal]\n if (entry?.selected === true) {\n next.add(key)\n }\n }\n return next\n }, [policy.federalHolidays])\n\n const { selectedUuids, handleSelectionChange, handleSelectAll } =\n useHolidaySelection(initialSelected)\n\n const { mutateAsync: updatePolicy, isPending } = useHolidayPayPoliciesUpdateMutation()\n\n const handleContinue = useCallback(async () => {\n await baseSubmitHandler({}, async () => {\n const response = await updatePolicy({\n request: {\n companyUuid: companyId,\n requestBody: {\n version: policy.version!,\n federalHolidays: buildFederalHolidaysPayload(selectedUuids),\n },\n },\n })\n seedPolicyCache(queryClient, companyId, response.holidayPayPolicy)\n await invalidateAllHolidayPayPoliciesGet(queryClient)\n onEvent(componentEvents.TIME_OFF_HOLIDAY_SELECTION_EDIT_DONE)\n })\n }, [\n baseSubmitHandler,\n updatePolicy,\n companyId,\n policy.version,\n selectedUuids,\n queryClient,\n onEvent,\n ])\n\n const handleBack = useCallback(() => {\n onEvent(componentEvents.CANCEL)\n }, [onEvent])\n\n return (\n <HolidaySelectionFormPresentation\n holidays={holidays}\n selectedHolidayUuids={selectedUuids}\n onSelectionChange={handleSelectionChange}\n onSelectAll={handleSelectAll}\n onContinue={handleContinue}\n onBack={handleBack}\n isPending={isPending}\n className={className}\n />\n )\n}\n"],"names":["HolidaySelectionForm","props","jsx","BaseComponent","EditRoot","CreateRoot","useHolidaySelection","initialKeys","selectedUuids","setSelectedUuids","useState","handleSelectionChange","useCallback","item","selected","prev","next","handleSelectAll","visibleItems","seedPolicyCache","queryClient","companyId","policy","queryKeyHolidayPayPoliciesGet","className","useI18n","t","useTranslation","onEvent","baseSubmitHandler","useBase","locale","useLocale","useQueryClient","holidays","useMemo","getDefaultHolidayItems","allKeys","FEDERAL_HOLIDAY_KEYS","createPolicy","isPending","useHolidayPayPoliciesCreateMutation","handleContinue","response","buildFederalHolidaysPayload","invalidateAllHolidayPayPoliciesGet","componentEvents","handleBack","HolidaySelectionFormPresentation","data","useHolidayPayPoliciesGetSuspense","initialSelected","federal","key","updatePolicy","useHolidayPayPoliciesUpdateMutation"],"mappings":";;;;;;;;;;;;;;AAwDO,SAASA,GAAqBC,GAAkC;AACrE,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GAChB,UAAAA,EAAM,SAAS,SACd,gBAAAC,EAACE,GAAA,EAAS,WAAWH,EAAM,WAAW,WAAWA,EAAM,UAAA,CAAW,IAElE,gBAAAC,EAACG,GAAA,EAAW,WAAWJ,EAAM,WAAW,WAAWA,EAAM,UAAA,CAAW,EAAA,CAExE;AAEJ;AAQA,SAASK,EAAoBC,GAA0B;AACrD,QAAM,CAACC,GAAeC,CAAgB,IAAIC,EAASH,CAAW,GAExDI,IAAwBC,EAAY,CAACC,GAAmBC,MAAs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
1
|
import { jsxs as a, jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { useTranslation as
|
|
2
|
+
import { useMemo as b } from "react";
|
|
3
|
+
import { useTranslation as h } from "react-i18next";
|
|
4
4
|
import { Flex as r } from "../../Common/Flex/Flex.js";
|
|
5
|
-
import { ActionsLayout as
|
|
6
|
-
import { useComponentContext as
|
|
7
|
-
import { useI18n as
|
|
8
|
-
import { useDataView as
|
|
9
|
-
import { DataView as
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
const { t } =
|
|
5
|
+
import { ActionsLayout as x } from "../../Common/ActionsLayout/ActionsLayout.js";
|
|
6
|
+
import { useComponentContext as v } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
7
|
+
import { useI18n as C } from "../../../i18n/I18n.js";
|
|
8
|
+
import { useDataView as g } from "../../Common/DataView/useDataView.js";
|
|
9
|
+
import { DataView as D } from "../../Common/DataView/DataView.js";
|
|
10
|
+
function A(e) {
|
|
11
|
+
C("Company.TimeOff.HolidayPolicy");
|
|
12
|
+
const { t } = h("Company.TimeOff.HolidayPolicy"), { Heading: s, Text: c, Button: l } = v(), { holidays: d, className: m } = e, o = e.mode === "view", u = b(
|
|
13
13
|
() => [
|
|
14
14
|
{
|
|
15
15
|
key: "name",
|
|
@@ -28,29 +28,29 @@ function V(e) {
|
|
|
28
28
|
}
|
|
29
29
|
],
|
|
30
30
|
[t]
|
|
31
|
-
),
|
|
31
|
+
), f = o ? {} : {
|
|
32
32
|
selectionMode: "multiple",
|
|
33
33
|
onSelect: e.onSelectionChange,
|
|
34
34
|
onSelectAll: e.onSelectAll,
|
|
35
35
|
getIsItemSelected: (i) => e.selectedHolidayUuids.has(i.uuid)
|
|
36
|
-
},
|
|
36
|
+
}, y = g({
|
|
37
37
|
data: d,
|
|
38
|
-
columns:
|
|
39
|
-
...
|
|
38
|
+
columns: u,
|
|
39
|
+
...f
|
|
40
40
|
});
|
|
41
|
-
return /* @__PURE__ */ a(r, { flexDirection: "column", gap: 32, children: [
|
|
41
|
+
return /* @__PURE__ */ a(r, { className: m, flexDirection: "column", gap: 32, children: [
|
|
42
42
|
!o && /* @__PURE__ */ a(r, { flexDirection: "column", gap: 4, children: [
|
|
43
|
-
/* @__PURE__ */ n(
|
|
44
|
-
/* @__PURE__ */ n(
|
|
43
|
+
/* @__PURE__ */ n(s, { as: "h2", children: t("title") }),
|
|
44
|
+
/* @__PURE__ */ n(c, { variant: "supporting", children: t("description") })
|
|
45
45
|
] }),
|
|
46
|
-
/* @__PURE__ */ n(
|
|
47
|
-
!o && /* @__PURE__ */ a(
|
|
46
|
+
/* @__PURE__ */ n(D, { label: t("tableLabel"), ...y }),
|
|
47
|
+
!o && /* @__PURE__ */ a(x, { children: [
|
|
48
48
|
/* @__PURE__ */ n(l, { variant: "secondary", onClick: e.onBack, isDisabled: e.isPending, children: t("backCta") }),
|
|
49
49
|
/* @__PURE__ */ n(l, { variant: "primary", onClick: e.onContinue, isLoading: e.isPending, children: t("continueCta") })
|
|
50
50
|
] })
|
|
51
51
|
] });
|
|
52
52
|
}
|
|
53
53
|
export {
|
|
54
|
-
|
|
54
|
+
A as HolidaySelectionFormPresentation
|
|
55
55
|
};
|
|
56
56
|
//# sourceMappingURL=HolidaySelectionFormPresentation.js.map
|
package/dist/components/TimeOff/HolidaySelectionForm/HolidaySelectionFormPresentation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HolidaySelectionFormPresentation.js","sources":["../../../../src/components/TimeOff/HolidaySelectionForm/HolidaySelectionFormPresentation.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport type {\n HolidayItem,\n HolidaySelectionFormPresentationProps,\n} from './HolidaySelectionFormTypes'\nimport { DataView, Flex, ActionsLayout, useDataView } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\n\n/** @internal */\nexport function HolidaySelectionFormPresentation(props: HolidaySelectionFormPresentationProps) {\n useI18n('Company.TimeOff.HolidayPolicy')\n const { t } = useTranslation('Company.TimeOff.HolidayPolicy')\n const { Heading, Text, Button } = useComponentContext()\n\n const { holidays } = props\n const isViewMode = props.mode === 'view'\n\n const columns = useMemo(\n () => [\n {\n key: 'name' as keyof HolidayItem,\n title: t('tableHeaders.holidayName'),\n render: (item: HolidayItem) => item.name,\n },\n {\n key: 'observedDate' as keyof HolidayItem,\n title: t('tableHeaders.observedDate'),\n render: (item: HolidayItem) => item.observedDate,\n },\n {\n key: 'nextObservation' as keyof HolidayItem,\n title: t('tableHeaders.nextObservation'),\n render: (item: HolidayItem) => item.nextObservation,\n },\n ],\n [t],\n )\n\n const selectionProps = !isViewMode\n ? {\n selectionMode: 'multiple' as const,\n onSelect: props.onSelectionChange,\n onSelectAll: props.onSelectAll,\n getIsItemSelected: (item: HolidayItem) => props.selectedHolidayUuids.has(item.uuid),\n }\n : {}\n\n const dataViewProps = useDataView<HolidayItem>({\n data: holidays,\n columns,\n ...selectionProps,\n })\n\n return (\n <Flex flexDirection=\"column\" gap={32}>\n {!isViewMode && (\n <Flex flexDirection=\"column\" gap={4}>\n <Heading as=\"h2\">{t('title')}</Heading>\n <Text variant=\"supporting\">{t('description')}</Text>\n </Flex>\n )}\n\n <DataView label={t('tableLabel')} {...dataViewProps} />\n\n {!isViewMode && (\n <ActionsLayout>\n <Button variant=\"secondary\" onClick={props.onBack} isDisabled={props.isPending}>\n {t('backCta')}\n </Button>\n <Button variant=\"primary\" onClick={props.onContinue} isLoading={props.isPending}>\n {t('continueCta')}\n </Button>\n </ActionsLayout>\n )}\n </Flex>\n )\n}\n"],"names":["HolidaySelectionFormPresentation","props","useI18n","useTranslation","Heading","Text","Button","useComponentContext","holidays","isViewMode","columns","useMemo","item","selectionProps","dataViewProps","useDataView","
|
|
1
|
+
{"version":3,"file":"HolidaySelectionFormPresentation.js","sources":["../../../../src/components/TimeOff/HolidaySelectionForm/HolidaySelectionFormPresentation.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport type {\n HolidayItem,\n HolidaySelectionFormPresentationProps,\n} from './HolidaySelectionFormTypes'\nimport { DataView, Flex, ActionsLayout, useDataView } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { useI18n } from '@/i18n'\n\n/** @internal */\nexport function HolidaySelectionFormPresentation(props: HolidaySelectionFormPresentationProps) {\n useI18n('Company.TimeOff.HolidayPolicy')\n const { t } = useTranslation('Company.TimeOff.HolidayPolicy')\n const { Heading, Text, Button } = useComponentContext()\n\n const { holidays, className } = props\n const isViewMode = props.mode === 'view'\n\n const columns = useMemo(\n () => [\n {\n key: 'name' as keyof HolidayItem,\n title: t('tableHeaders.holidayName'),\n render: (item: HolidayItem) => item.name,\n },\n {\n key: 'observedDate' as keyof HolidayItem,\n title: t('tableHeaders.observedDate'),\n render: (item: HolidayItem) => item.observedDate,\n },\n {\n key: 'nextObservation' as keyof HolidayItem,\n title: t('tableHeaders.nextObservation'),\n render: (item: HolidayItem) => item.nextObservation,\n },\n ],\n [t],\n )\n\n const selectionProps = !isViewMode\n ? {\n selectionMode: 'multiple' as const,\n onSelect: props.onSelectionChange,\n onSelectAll: props.onSelectAll,\n getIsItemSelected: (item: HolidayItem) => props.selectedHolidayUuids.has(item.uuid),\n }\n : {}\n\n const dataViewProps = useDataView<HolidayItem>({\n data: holidays,\n columns,\n ...selectionProps,\n })\n\n return (\n <Flex className={className} flexDirection=\"column\" gap={32}>\n {!isViewMode && (\n <Flex flexDirection=\"column\" gap={4}>\n <Heading as=\"h2\">{t('title')}</Heading>\n <Text variant=\"supporting\">{t('description')}</Text>\n </Flex>\n )}\n\n <DataView label={t('tableLabel')} {...dataViewProps} />\n\n {!isViewMode && (\n <ActionsLayout>\n <Button variant=\"secondary\" onClick={props.onBack} isDisabled={props.isPending}>\n {t('backCta')}\n </Button>\n <Button variant=\"primary\" onClick={props.onContinue} isLoading={props.isPending}>\n {t('continueCta')}\n </Button>\n </ActionsLayout>\n )}\n </Flex>\n )\n}\n"],"names":["HolidaySelectionFormPresentation","props","useI18n","useTranslation","Heading","Text","Button","useComponentContext","holidays","className","isViewMode","columns","useMemo","item","selectionProps","dataViewProps","useDataView","Flex","jsxs","jsx","DataView","ActionsLayout"],"mappings":";;;;;;;;;AAWO,SAASA,EAAiCC,GAA8C;AAC7F,EAAAC,EAAQ,+BAA+B;AACvC,QAAM,EAAE,EAAA,IAAMC,EAAe,+BAA+B,GACtD,EAAE,SAAAC,GAAS,MAAAC,GAAM,QAAAC,EAAA,IAAWC,EAAA,GAE5B,EAAE,UAAAC,GAAU,WAAAC,EAAA,IAAcR,GAC1BS,IAAaT,EAAM,SAAS,QAE5BU,IAAUC;AAAA,IACd,MAAM;AAAA,MACJ;AAAA,QACE,KAAK;AAAA,QACL,OAAO,EAAE,0BAA0B;AAAA,QACnC,QAAQ,CAACC,MAAsBA,EAAK;AAAA,MAAA;AAAA,MAEtC;AAAA,QACE,KAAK;AAAA,QACL,OAAO,EAAE,2BAA2B;AAAA,QACpC,QAAQ,CAACA,MAAsBA,EAAK;AAAA,MAAA;AAAA,MAEtC;AAAA,QACE,KAAK;AAAA,QACL,OAAO,EAAE,8BAA8B;AAAA,QACvC,QAAQ,CAACA,MAAsBA,EAAK;AAAA,MAAA;AAAA,IACtC;AAAA,IAEF,CAAC,CAAC;AAAA,EAAA,GAGEC,IAAkBJ,IAOpB,CAAA,IANA;AAAA,IACE,eAAe;AAAA,IACf,UAAUT,EAAM;AAAA,IAChB,aAAaA,EAAM;AAAA,IACnB,mBAAmB,CAACY,MAAsBZ,EAAM,qBAAqB,IAAIY,EAAK,IAAI;AAAA,EAAA,GAIlFE,IAAgBC,EAAyB;AAAA,IAC7C,MAAMR;AAAA,IACN,SAAAG;AAAA,IACA,GAAGG;AAAA,EAAA,CACJ;AAED,2BACGG,GAAA,EAAK,WAAAR,GAAsB,eAAc,UAAS,KAAK,IACrD,UAAA;AAAA,IAAA,CAACC,KACA,gBAAAQ,EAACD,GAAA,EAAK,eAAc,UAAS,KAAK,GAChC,UAAA;AAAA,MAAA,gBAAAE,EAACf,GAAA,EAAQ,IAAG,MAAM,UAAA,EAAE,OAAO,GAAE;AAAA,wBAC5BC,GAAA,EAAK,SAAQ,cAAc,UAAA,EAAE,aAAa,EAAA,CAAE;AAAA,IAAA,GAC/C;AAAA,sBAGDe,GAAA,EAAS,OAAO,EAAE,YAAY,GAAI,GAAGL,GAAe;AAAA,IAEpD,CAACL,KACA,gBAAAQ,EAACG,GAAA,EACC,UAAA;AAAA,MAAA,gBAAAF,EAACb,GAAA,EAAO,SAAQ,aAAY,SAASL,EAAM,QAAQ,YAAYA,EAAM,WAClE,UAAA,EAAE,SAAS,EAAA,CACd;AAAA,MACA,gBAAAkB,EAACb,GAAA,EAAO,SAAQ,WAAU,SAASL,EAAM,YAAY,WAAWA,EAAM,WACnE,UAAA,EAAE,aAAa,EAAA,CAClB;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,GAEJ;AAEJ;"}
|
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
2
|
import { useState as E } from "react";
|
|
3
|
-
import { useTranslation as
|
|
4
|
-
import { useQueryClient as
|
|
5
|
-
import { useTimeOffPoliciesGetAllSuspense as
|
|
6
|
-
import { useTimeOffPoliciesDeactivateMutation as
|
|
7
|
-
import { useEmployeesListSuspense as
|
|
8
|
-
import { useHolidayPayPoliciesGet as
|
|
9
|
-
import { useHolidayPayPoliciesDeleteMutation as
|
|
10
|
-
import { UnprocessableEntityError as
|
|
11
|
-
import { PolicyListPresentation as
|
|
12
|
-
import { isListedTimeOffPolicyType as
|
|
13
|
-
import { BaseBoundaries as
|
|
3
|
+
import { useTranslation as R } from "react-i18next";
|
|
4
|
+
import { useQueryClient as G } from "@tanstack/react-query";
|
|
5
|
+
import { useTimeOffPoliciesGetAllSuspense as Y, invalidateAllTimeOffPoliciesGetAll as j } from "@gusto/embedded-api/react-query/timeOffPoliciesGetAll";
|
|
6
|
+
import { useTimeOffPoliciesDeactivateMutation as x } from "@gusto/embedded-api/react-query/timeOffPoliciesDeactivate";
|
|
7
|
+
import { useEmployeesListSuspense as N } from "@gusto/embedded-api/react-query/employeesList";
|
|
8
|
+
import { useHolidayPayPoliciesGet as Q, invalidateAllHolidayPayPoliciesGet as V } from "@gusto/embedded-api/react-query/holidayPayPoliciesGet";
|
|
9
|
+
import { useHolidayPayPoliciesDeleteMutation as W } from "@gusto/embedded-api/react-query/holidayPayPoliciesDelete";
|
|
10
|
+
import { UnprocessableEntityError as k } from "@gusto/embedded-api/models/errors/unprocessableentityerror";
|
|
11
|
+
import { PolicyListPresentation as K } from "./PolicyListPresentation.js";
|
|
12
|
+
import { isListedTimeOffPolicyType as z } from "../TimeOffFlow/timeOffPolicyTypes.js";
|
|
13
|
+
import { BaseBoundaries as J, BaseLayout as X } from "../../Base/Base.js";
|
|
14
14
|
import "../../Base/useBase.js";
|
|
15
|
-
import { useBaseSubmit as
|
|
15
|
+
import { useBaseSubmit as Z } from "../../Base/useBaseSubmit.js";
|
|
16
16
|
import { SDKInternalError as O } from "../../../types/sdkError.js";
|
|
17
|
-
import { composeErrorHandler as
|
|
17
|
+
import { composeErrorHandler as $ } from "../../../partner-hook-utils/composeErrorHandler.js";
|
|
18
18
|
import { componentEvents as a } from "../../../shared/constants.js";
|
|
19
|
-
import { useI18n as
|
|
20
|
-
function
|
|
19
|
+
import { useI18n as ee } from "../../../i18n/I18n.js";
|
|
20
|
+
function ge({ FallbackComponent: t, LoaderComponent: o, ...m }) {
|
|
21
21
|
return /* @__PURE__ */ n(
|
|
22
|
-
|
|
22
|
+
J,
|
|
23
23
|
{
|
|
24
24
|
componentName: "Company.TimeOff.TimeOffPolicies",
|
|
25
25
|
FallbackComponent: t,
|
|
26
26
|
LoaderComponent: o,
|
|
27
|
-
children: /* @__PURE__ */ n(
|
|
27
|
+
children: /* @__PURE__ */ n(ie, { LoaderComponent: o, ...m })
|
|
28
28
|
}
|
|
29
29
|
);
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
|
|
33
|
-
const { t: i } =
|
|
34
|
-
baseSubmitHandler:
|
|
35
|
-
error:
|
|
36
|
-
setError:
|
|
37
|
-
} =
|
|
31
|
+
function ie({ companyId: t, onEvent: o, LoaderComponent: m, className: D }) {
|
|
32
|
+
ee("Company.TimeOff.TimeOffPolicies");
|
|
33
|
+
const { t: i } = R("Company.TimeOff.TimeOffPolicies"), y = G(), {
|
|
34
|
+
baseSubmitHandler: g,
|
|
35
|
+
error: C,
|
|
36
|
+
setError: I
|
|
37
|
+
} = Z("Company.TimeOff.TimeOffPolicies"), [_, c] = E(null), [w, p] = E(null), { data: A } = Y({
|
|
38
38
|
companyUuid: t
|
|
39
|
-
}),
|
|
40
|
-
(e) => e.isActive &&
|
|
41
|
-
), f =
|
|
39
|
+
}), L = (A.timeOffPolicies ?? []).filter(
|
|
40
|
+
(e) => e.isActive && z(e.policyType)
|
|
41
|
+
), f = Q(
|
|
42
42
|
{ companyUuid: t },
|
|
43
43
|
{
|
|
44
44
|
throwOnError: () => !1
|
|
45
45
|
}
|
|
46
|
-
), u = f.data?.holidayPayPolicy, { data:
|
|
46
|
+
), u = f.data?.holidayPayPolicy, { data: F } = N({
|
|
47
47
|
companyId: t,
|
|
48
48
|
terminated: !1
|
|
49
|
-
}),
|
|
49
|
+
}), S = F.showEmployees?.length ?? 0, d = x(), P = W(), H = $([f], { submitError: C, setSubmitError: I }), M = d.isPending || P.isPending, h = (e) => e > 0 && e === S ? i("allEmployeesLabel") : e > 0 ? i("employeeCount", { count: e }) : i("enrolledDash"), T = L.map((e) => ({
|
|
50
50
|
uuid: e.uuid,
|
|
51
51
|
name: e.name,
|
|
52
52
|
policyType: e.policyType,
|
|
@@ -61,32 +61,32 @@ function ee({ companyId: t, onEvent: o, LoaderComponent: m }) {
|
|
|
61
61
|
enrolledDisplay: h(u.employees.length),
|
|
62
62
|
isHoliday: !0
|
|
63
63
|
});
|
|
64
|
-
const
|
|
64
|
+
const b = () => {
|
|
65
65
|
o(a.TIME_OFF_CREATE_POLICY);
|
|
66
|
-
},
|
|
66
|
+
}, q = (e) => {
|
|
67
67
|
o(a.TIME_OFF_VIEW_POLICY, {
|
|
68
68
|
policyId: e.uuid,
|
|
69
69
|
policyType: e.policyType
|
|
70
70
|
});
|
|
71
|
-
},
|
|
71
|
+
}, B = (e) => {
|
|
72
72
|
o(a.TIME_OFF_VIEW_POLICY, {
|
|
73
73
|
policyId: e.uuid,
|
|
74
74
|
policyType: e.policyType
|
|
75
75
|
});
|
|
76
|
-
},
|
|
76
|
+
}, U = async (e) => {
|
|
77
77
|
let s = !1;
|
|
78
|
-
return p(e.uuid), await
|
|
78
|
+
return p(e.uuid), await g({}, async () => {
|
|
79
79
|
if (e.isHoliday)
|
|
80
80
|
await P.mutateAsync({
|
|
81
81
|
request: { companyUuid: t }
|
|
82
|
-
}), await
|
|
82
|
+
}), await V(y), c(i("flash.holidayDeleted"));
|
|
83
83
|
else {
|
|
84
84
|
try {
|
|
85
85
|
await d.mutateAsync({
|
|
86
86
|
request: { timeOffPolicyUuid: e.uuid }
|
|
87
87
|
});
|
|
88
88
|
} catch (r) {
|
|
89
|
-
if (r instanceof
|
|
89
|
+
if (r instanceof k) {
|
|
90
90
|
if (r.errors.some(
|
|
91
91
|
(l) => l.message?.toLowerCase().includes("pending") || l.message?.toLowerCase().includes("approved")
|
|
92
92
|
))
|
|
@@ -94,34 +94,35 @@ function ee({ companyId: t, onEvent: o, LoaderComponent: m }) {
|
|
|
94
94
|
i("errors.pendingRequestsBlockDeletion", { name: e.name }),
|
|
95
95
|
"api_error"
|
|
96
96
|
);
|
|
97
|
-
const
|
|
98
|
-
throw new O(
|
|
97
|
+
const v = r.errors.map((l) => l.message).filter(Boolean);
|
|
98
|
+
throw new O(v.join(". ") || i("errors.deleteFailed"), "api_error");
|
|
99
99
|
}
|
|
100
100
|
throw r;
|
|
101
101
|
}
|
|
102
|
-
await
|
|
102
|
+
await j(y), c(i("flash.policyDeleted", { name: e.name }));
|
|
103
103
|
}
|
|
104
104
|
o(a.TIME_OFF_DELETE_POLICY_DONE, { policyId: e.uuid }), s = !0;
|
|
105
105
|
}), p(null), s;
|
|
106
106
|
};
|
|
107
|
-
return /* @__PURE__ */ n(
|
|
108
|
-
|
|
107
|
+
return /* @__PURE__ */ n(X, { error: H.errors, LoaderComponent: m, children: /* @__PURE__ */ n(
|
|
108
|
+
K,
|
|
109
109
|
{
|
|
110
110
|
policies: T,
|
|
111
|
-
onCreatePolicy:
|
|
112
|
-
onEditPolicy:
|
|
113
|
-
onFinishSetup:
|
|
114
|
-
onDeletePolicy:
|
|
115
|
-
deleteSuccessAlert:
|
|
111
|
+
onCreatePolicy: b,
|
|
112
|
+
onEditPolicy: q,
|
|
113
|
+
onFinishSetup: B,
|
|
114
|
+
onDeletePolicy: U,
|
|
115
|
+
deleteSuccessAlert: _,
|
|
116
116
|
onDismissDeleteAlert: () => {
|
|
117
117
|
c(null);
|
|
118
118
|
},
|
|
119
|
-
isDeletingPolicyId:
|
|
120
|
-
isPending:
|
|
119
|
+
isDeletingPolicyId: w,
|
|
120
|
+
isPending: M,
|
|
121
|
+
className: D
|
|
121
122
|
}
|
|
122
123
|
) });
|
|
123
124
|
}
|
|
124
125
|
export {
|
|
125
|
-
|
|
126
|
+
ge as PolicyList
|
|
126
127
|
};
|
|
127
128
|
//# sourceMappingURL=PolicyList.js.map
|