@gusto/embedded-react-sdk 0.57.3 → 0.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +88 -0
- package/dist/components/Common/DataView/DataCards/DataCards.js +98 -66
- package/dist/components/Common/DataView/DataCards/DataCards.js.map +1 -1
- package/dist/components/Common/DataView/DataCards/DataCards.module.scss.js +11 -9
- package/dist/components/Common/DataView/DataCards/DataCards.module.scss.js.map +1 -1
- package/dist/components/Common/DataView/DataTable/DataTable.js +86 -75
- package/dist/components/Common/DataView/DataTable/DataTable.js.map +1 -1
- package/dist/components/Common/DataView/DataView.js.map +1 -1
- package/dist/components/Common/DataView/getSortControls.js +22 -0
- package/dist/components/Common/DataView/getSortControls.js.map +1 -0
- package/dist/components/Common/DataView/useDataView.js +30 -24
- package/dist/components/Common/DataView/useDataView.js.map +1 -1
- package/dist/components/Common/UI/Table/Table.js +65 -25
- package/dist/components/Common/UI/Table/Table.js.map +1 -1
- package/dist/components/Common/UI/Table/Table.module.scss.js +8 -4
- package/dist/components/Common/UI/Table/Table.module.scss.js.map +1 -1
- package/dist/components/Common/UI/Table/TableTypes.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +3 -4
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +3 -4
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +5 -6
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +3 -4
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +3 -4
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +5 -6
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +6 -7
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +3 -4
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +3 -4
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +3 -4
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/PaySchedule.js +30 -45
- package/dist/components/Company/PaySchedule/PaySchedule.js.map +1 -1
- package/dist/components/Company/PaySchedule/PayScheduleComponents.js +11 -12
- package/dist/components/Company/PaySchedule/PayScheduleComponents.js.map +1 -1
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/fields.js.map +1 -1
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/payScheduleSchema.js.map +1 -1
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.js +78 -83
- package/dist/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +3 -4
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +3 -4
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/TaxRateManagement/context.js +3 -4
- package/dist/components/Company/StateTaxes/TaxRateManagement/context.js.map +1 -1
- package/dist/components/Contractor/Compensation/management/CompensationEditForm.js +45 -54
- package/dist/components/Contractor/Compensation/management/CompensationEditForm.js.map +1 -1
- package/dist/components/Contractor/Compensation/shared/useContractorPayForm/contractorPaySchema.js +17 -22
- package/dist/components/Contractor/Compensation/shared/useContractorPayForm/contractorPaySchema.js.map +1 -1
- package/dist/components/Contractor/ContractorList/management/ManagementContractorList.js +1 -0
- package/dist/components/Contractor/ContractorList/management/ManagementContractorList.js.map +1 -1
- package/dist/components/Contractor/ContractorList/management/ManagementContractorListView.js +122 -113
- package/dist/components/Contractor/ContractorList/management/ManagementContractorListView.js.map +1 -1
- package/dist/components/Contractor/ContractorList/shared/useContractorList.js +63 -54
- package/dist/components/Contractor/ContractorList/shared/useContractorList.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/onboarding/PaymentMethod.js +39 -48
- package/dist/components/Contractor/PaymentMethod/onboarding/PaymentMethod.js.map +1 -1
- package/dist/components/Contractor/Profile/onboarding/ContractorProfile.js +76 -69
- package/dist/components/Contractor/Profile/onboarding/ContractorProfile.js.map +1 -1
- package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/contractorDetailsSchema.js +27 -29
- package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/contractorDetailsSchema.js.map +1 -1
- package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/useContractorDetailsForm.js +14 -12
- package/dist/components/Contractor/Profile/shared/useContractorDetailsForm/useContractorDetailsForm.js.map +1 -1
- package/dist/components/Contractor/shared/hourlyRate.js +14 -0
- package/dist/components/Contractor/shared/hourlyRate.js.map +1 -0
- package/dist/components/Employee/Compensation/management/CompensationCard/CompensationCard.js +63 -63
- package/dist/components/Employee/Compensation/management/CompensationCard/CompensationCard.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +3 -4
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/onboarding/ListView.js +65 -74
- package/dist/components/Employee/PaymentMethod/onboarding/ListView.js.map +1 -1
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.js +16 -16
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.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 +84 -82
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -1
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/getDefaultWithholdingPayPeriod.js +8 -0
- package/dist/components/Payroll/OffCycleTaxWithholdingTable/getDefaultWithholdingPayPeriod.js.map +1 -0
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +91 -88
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +16 -16
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +146 -134
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.module.scss.js +14 -12
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.module.scss.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +34 -33
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields.js +49 -48
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js +0 -4
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollFlow.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js +51 -38
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js +121 -102
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollLanding/PayrollLanding.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollList.js +79 -74
- package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +92 -83
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +23 -27
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
- package/dist/components/Payroll/PrintChecks/PrintChecksForm/PrintChecksForm.js +82 -75
- package/dist/components/Payroll/PrintChecks/PrintChecksForm/PrintChecksForm.js.map +1 -1
- package/dist/components/Payroll/RropPayrollEditEmployee/RropPayrollEditEmployee.js +416 -0
- package/dist/components/Payroll/RropPayrollEditEmployee/RropPayrollEditEmployee.js.map +1 -0
- package/dist/components/Payroll/{UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.module.scss.js → RropPayrollEditEmployee/RropPayrollEditEmployee.module.scss.js} +1 -1
- package/dist/components/Payroll/RropPayrollEditEmployee/RropPayrollEditEmployee.module.scss.js.map +1 -0
- package/dist/components/Payroll/TransitionConfiguration/TransitionConfiguration.js +97 -0
- package/dist/components/Payroll/TransitionConfiguration/TransitionConfiguration.js.map +1 -0
- package/dist/components/Payroll/TransitionConfiguration/TransitionConfigurationPresentation.js +106 -0
- package/dist/components/Payroll/TransitionConfiguration/TransitionConfigurationPresentation.js.map +1 -0
- package/dist/components/Payroll/{TransitionCreation/TransitionCreationPresentation.module.scss.js → TransitionConfiguration/TransitionConfigurationPresentation.module.scss.js} +1 -1
- package/dist/components/Payroll/TransitionConfiguration/TransitionConfigurationPresentation.module.scss.js.map +1 -0
- package/dist/components/Payroll/TransitionConfiguration/TransitionConfigurationTypes.js +10 -0
- package/dist/components/Payroll/TransitionConfiguration/TransitionConfigurationTypes.js.map +1 -0
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.js +86 -64
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.js.map +1 -1
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.js +126 -77
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.js.map +1 -1
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.module.scss.js +8 -0
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.module.scss.js.map +1 -0
- package/dist/components/Payroll/index.js +16 -20
- package/dist/components/Payroll/index.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +2 -3
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/components/Payroll/useUnprocessedTransitionPayPeriods.js +11 -14
- package/dist/components/Payroll/useUnprocessedTransitionPayPeriods.js.map +1 -1
- package/dist/contexts/ApiProvider/ApiProvider.js +18 -17
- package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -1
- package/dist/contexts/ApiProvider/payScheduleCustomNameHook.js +31 -0
- package/dist/contexts/ApiProvider/payScheduleCustomNameHook.js.map +1 -0
- package/dist/contexts/FeaturesProvider/FeaturesProvider.js +14 -0
- package/dist/contexts/FeaturesProvider/FeaturesProvider.js.map +1 -0
- package/dist/contexts/FeaturesProvider/useFeature.js +7 -0
- package/dist/contexts/FeaturesProvider/useFeature.js.map +1 -0
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +32 -30
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/contexts/UnstableFeaturesProvider/useUnstableFeature.js.map +1 -1
- package/dist/i18n/I18n.js +2 -3
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Contractor.Profile.json.js +1 -1
- package/dist/i18n/en/Payroll.PayrollEditEmployee.json.js +29 -23
- package/dist/i18n/en/Payroll.PayrollEditEmployee.json.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollLanding.json.js +1 -1
- package/dist/i18n/en/{Payroll.UNSTABLE_PayrollEditEmployee.json.js → Payroll.RropPayrollEditEmployee.json.js} +42 -38
- package/dist/i18n/en/Payroll.RropPayrollEditEmployee.json.js.map +1 -0
- package/dist/i18n/en/Payroll.TransitionConfiguration.json.js +28 -0
- package/dist/i18n/en/Payroll.TransitionConfiguration.json.js.map +1 -0
- package/dist/i18n/en/Payroll.TransitionPayrollAlert.json.js +16 -12
- package/dist/i18n/en/Payroll.TransitionPayrollAlert.json.js.map +1 -1
- package/dist/i18n/en/common.json.js +1 -1
- package/dist/package.json.js +1 -1
- package/dist/partner-hook-utils/form/composeSubmitHandler.js +55 -48
- package/dist/partner-hook-utils/form/composeSubmitHandler.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/RadioGroupHookField.js +31 -29
- package/dist/partner-hook-utils/form/fields/RadioGroupHookField.js.map +1 -1
- package/dist/shared/constants.js +2 -1
- package/dist/shared/constants.js.map +1 -1
- package/dist/src/components/Common/DataView/DataCards/DataCards.d.ts +3 -1
- package/dist/src/components/Common/DataView/DataTable/DataTable.d.ts +3 -1
- package/dist/src/components/Common/DataView/DataView.d.ts +2 -0
- package/dist/src/components/Common/DataView/getSortControls.d.ts +24 -0
- package/dist/src/components/Common/DataView/useDataView.d.ts +22 -1
- package/dist/src/components/Common/UI/Table/TableTypes.d.ts +71 -2
- package/dist/src/components/Company/PaySchedule/PaySchedule.d.ts +1 -9
- package/dist/src/components/Company/PaySchedule/PayScheduleComponents.d.ts +0 -1
- package/dist/src/components/Company/PaySchedule/shared/usePayScheduleForm/fields.d.ts +1 -1
- package/dist/src/components/Company/PaySchedule/shared/usePayScheduleForm/payScheduleSchema.d.ts +1 -1
- package/dist/src/components/Company/PaySchedule/shared/usePayScheduleForm/usePayScheduleForm.d.ts +3 -14
- package/dist/src/components/Contractor/ContractorList/management/ManagementContractorListView.d.ts +2 -2
- package/dist/src/components/Contractor/ContractorList/shared/index.d.ts +1 -1
- package/dist/src/components/Contractor/ContractorList/shared/useContractorList.d.ts +38 -0
- package/dist/src/components/Contractor/shared/hourlyRate.d.ts +23 -0
- package/dist/src/components/Payroll/OffCycleTaxWithholdingTable/getDefaultWithholdingPayPeriod.d.ts +9 -0
- package/dist/src/components/Payroll/PayrollEditEmployee/TimeOffField.d.ts +3 -1
- package/dist/src/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields.d.ts +2 -0
- package/dist/src/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.d.ts +8 -6
- package/dist/src/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.d.ts +0 -8
- package/dist/src/components/Payroll/PayrollFlow/PayrollFlow.d.ts +5 -3
- package/dist/src/components/Payroll/PayrollFlow/PayrollFlowComponents.d.ts +2 -3
- package/dist/src/components/Payroll/PayrollFlow/payrollStateMachine.d.ts +1 -1
- package/dist/src/components/Payroll/PayrollLanding/PayrollLanding.d.ts +18 -5
- package/dist/src/components/Payroll/PayrollList/PayrollList.d.ts +11 -5
- package/dist/src/components/Payroll/{UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.d.ts → RropPayrollEditEmployee/RropPayrollEditEmployee.d.ts} +9 -5
- package/dist/src/components/Payroll/TransitionConfiguration/TransitionConfiguration.d.ts +55 -0
- package/dist/src/components/Payroll/TransitionConfiguration/TransitionConfigurationPresentation.d.ts +9 -0
- package/dist/src/components/Payroll/TransitionConfiguration/TransitionConfigurationTypes.d.ts +52 -0
- package/dist/src/components/Payroll/TransitionConfiguration/index.d.ts +2 -0
- package/dist/src/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.d.ts +5 -2
- package/dist/src/components/Payroll/index.d.ts +2 -6
- package/dist/src/contexts/ApiProvider/payScheduleCustomNameHook.d.ts +14 -0
- package/dist/src/contexts/ApiProvider/payScheduleCustomNameHook.test.d.ts +1 -0
- package/dist/src/contexts/ComponentAdapter/componentAdapterTypes.d.ts +1 -1
- package/dist/src/contexts/FeaturesProvider/FeaturesProvider.d.ts +21 -0
- package/dist/src/contexts/FeaturesProvider/useFeature.d.ts +53 -0
- package/dist/src/contexts/GustoProvider/GustoProviderCustomUIAdapter.d.ts +3 -0
- package/dist/src/contexts/UnstableFeaturesProvider/useUnstableFeature.d.ts +38 -10
- package/dist/src/contexts/index.d.ts +1 -0
- package/dist/src/i18n/en/common.json.d.ts +5 -1
- package/dist/src/i18n/types.d.ts +113 -66
- package/dist/src/partner-hook-utils/form/fields/RadioGroupHookField.d.ts +9 -7
- package/dist/src/shared/constants.d.ts +4 -2
- package/dist/src/test-utils/renderWithProviders.d.ts +2 -0
- package/dist/style.css +1 -1
- package/docs/guides/endpoint-inventory.json +24 -27
- package/package.json +15 -14
- package/dist/components/Payroll/PayrollFlow/TransitionFlowContextual.js +0 -29
- package/dist/components/Payroll/PayrollFlow/TransitionFlowContextual.js.map +0 -1
- package/dist/components/Payroll/Transition/TransitionFlow.js +0 -60
- package/dist/components/Payroll/Transition/TransitionFlow.js.map +0 -1
- package/dist/components/Payroll/Transition/TransitionFlowComponents.js +0 -31
- package/dist/components/Payroll/Transition/TransitionFlowComponents.js.map +0 -1
- package/dist/components/Payroll/Transition/transitionStateMachine.js +0 -49
- package/dist/components/Payroll/Transition/transitionStateMachine.js.map +0 -1
- package/dist/components/Payroll/TransitionCreation/TransitionCreation.js +0 -100
- package/dist/components/Payroll/TransitionCreation/TransitionCreation.js.map +0 -1
- package/dist/components/Payroll/TransitionCreation/TransitionCreationPresentation.js +0 -110
- package/dist/components/Payroll/TransitionCreation/TransitionCreationPresentation.js.map +0 -1
- package/dist/components/Payroll/TransitionCreation/TransitionCreationPresentation.module.scss.js.map +0 -1
- package/dist/components/Payroll/TransitionCreation/TransitionCreationTypes.js +0 -21
- package/dist/components/Payroll/TransitionCreation/TransitionCreationTypes.js.map +0 -1
- package/dist/components/Payroll/TransitionPayroll/TransitionPayroll.js +0 -48
- package/dist/components/Payroll/TransitionPayroll/TransitionPayroll.js.map +0 -1
- package/dist/components/Payroll/TransitionPayroll/TransitionPayrollComponents.js +0 -35
- package/dist/components/Payroll/TransitionPayroll/TransitionPayrollComponents.js.map +0 -1
- package/dist/components/Payroll/TransitionPayroll/transitionPayrollStateMachine.js +0 -23
- package/dist/components/Payroll/TransitionPayroll/transitionPayrollStateMachine.js.map +0 -1
- package/dist/components/Payroll/TransitionPayroll/useResolveTransitionPayroll.js +0 -29
- package/dist/components/Payroll/TransitionPayroll/useResolveTransitionPayroll.js.map +0 -1
- package/dist/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.js +0 -411
- package/dist/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.js.map +0 -1
- package/dist/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.module.scss.js.map +0 -1
- package/dist/i18n/en/Payroll.Transition.json.js +0 -8
- package/dist/i18n/en/Payroll.Transition.json.js.map +0 -1
- package/dist/i18n/en/Payroll.TransitionCreation.json.js +0 -26
- package/dist/i18n/en/Payroll.TransitionCreation.json.js.map +0 -1
- package/dist/i18n/en/Payroll.UNSTABLE_PayrollEditEmployee.json.js.map +0 -1
- package/dist/src/components/Payroll/PayrollFlow/TransitionFlowContextual.d.ts +0 -7
- package/dist/src/components/Payroll/Transition/TransitionFlow.d.ts +0 -55
- package/dist/src/components/Payroll/Transition/TransitionFlowComponents.d.ts +0 -52
- package/dist/src/components/Payroll/Transition/index.d.ts +0 -2
- package/dist/src/components/Payroll/Transition/transitionStateMachine.d.ts +0 -29
- package/dist/src/components/Payroll/TransitionCreation/TransitionCreation.d.ts +0 -22
- package/dist/src/components/Payroll/TransitionCreation/TransitionCreationPresentation.d.ts +0 -9
- package/dist/src/components/Payroll/TransitionCreation/TransitionCreationTypes.d.ts +0 -57
- package/dist/src/components/Payroll/TransitionCreation/index.d.ts +0 -2
- package/dist/src/components/Payroll/TransitionPayroll/TransitionPayroll.d.ts +0 -55
- package/dist/src/components/Payroll/TransitionPayroll/TransitionPayrollComponents.d.ts +0 -24
- package/dist/src/components/Payroll/TransitionPayroll/TransitionPayrollTypes.d.ts +0 -23
- package/dist/src/components/Payroll/TransitionPayroll/index.d.ts +0 -2
- package/dist/src/components/Payroll/TransitionPayroll/transitionPayrollStateMachine.d.ts +0 -15
- package/dist/src/components/Payroll/TransitionPayroll/useResolveTransitionPayroll.d.ts +0 -28
- /package/dist/src/components/{Payroll/Transition/transitionStateMachine.test.d.ts → Common/DataView/getSortControls.test.d.ts} +0 -0
package/dist/components/Employee/Compensation/management/CompensationCard/CompensationCard.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompensationCard.js","sources":["../../../../../../src/components/Employee/Compensation/management/CompensationCard/CompensationCard.tsx"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { useJobsAndCompensationsDeleteMutation } from '@gusto/embedded-api/react-query/jobsAndCompensationsDelete'\nimport type { Job } from '@gusto/embedded-api/models/components/job'\nimport {\n useCompensationManagement,\n type UseCompensationManagementReady,\n} from '../../shared/useCompensationManagement'\nimport type { PendingCompensationChange } from '../../shared/getPendingCompensationChanges'\nimport { usePendingChangeDetailRenderer } from '../../shared/usePendingChangeDetailRenderer'\nimport { PendingChangesReviewModal } from '../../shared/PendingChangesReviewModal'\nimport styles from './CompensationCard.module.scss'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { DataView, useDataView, EmptyData, Loading, VisuallyHidden } from '@/components/Common'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport { BaseBoundaries, BaseLayout } from '@/components/Base/Base'\nimport { formatDateLongWithYear, formatDateToStringDate } from '@/helpers/dateFormatting'\nimport { useFormatCompensationRate } from '@/helpers/formattedStrings'\nimport { useI18n } from '@/i18n'\nimport { componentEvents, FlsaStatus, type EventType } from '@/shared/constants'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport type { LoaderComponentType } from '@/components/Base'\nimport PlusCircleIcon from '@/assets/icons/plus-circle.svg?react'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\n\nfunction parseJobRate(rate: Job['rate']): number | null {\n if (rate === undefined) return null\n const numericRate = parseFloat(rate)\n return Number.isFinite(numericRate) ? numericRate : null\n}\n\n/**\n * Props for {@link CompensationCard}.\n *\n * @public\n */\nexport interface CompensationCardProps {\n /** The associated employee identifier. */\n employeeId: string\n /** Callback invoked when the card emits an event. See the events table on {@link CompensationCard} for the available event types and payloads. */\n onEvent: OnEventType<EventType, unknown>\n /** Custom loading indicator rendered while this component's async data is fetching. Overrides the indicator configured on `GustoProvider` for this instance only. */\n LoaderComponent?: LoaderComponentType\n}\n\n/**\n * Standalone \"Compensation\" management card that displays an employee's current jobs and compensation, surfaces pending future-dated changes, and exposes edit, add, and delete affordances.\n *\n * @remarks\n * The card owns its own data fetch, the pending-change alerts and review modal, and the delete-job confirm dialog. It does not render the compensation edit or add-job forms — instead, it emits a distinct request event for each action, and the consumer routes those to {@link CompensationEditForm}, {@link CompensationAddJobForm}, or {@link CompensationAddAnotherJobForm} and renders any post-save success alerts. {@link Compensation} bundles the card, the three form surfaces, and the swap and alert wiring as a single drop-in; reach for the card directly only when that orchestration is the wrong fit (for example, when a form needs to render in a modal or drawer, or when the swap is driven by a router).\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `employee/management/compensation/card/editRequested` | Fired when an \"Edit\" CTA is clicked for a job | `{ employeeId: string, jobId: string }` |\n * | `employee/management/compensation/card/addRequested` | Fired when the \"Add job\" CTA is clicked from the empty state | `{ employeeId: string }` |\n * | `employee/management/compensation/card/addAnotherRequested` | Fired when the \"Add another job\" CTA is clicked | `{ employeeId: string }` |\n * | `employee/management/compensation/card/jobDeleted` | Fired after a non-primary job is deleted via the card's confirm dialog | `{ employeeId: string, jobId: string }` |\n * | `employee/management/compensation/card/changeCancelled` | Fired after a scheduled future-dated change is cancelled from the card | `{ employeeId: string, compensationId: string }` |\n *\n * @param props - See {@link CompensationCardProps}.\n * @returns The rendered compensation card.\n * @public\n * @group Block components\n */\nexport function CompensationCard({ LoaderComponent, ...props }: CompensationCardProps) {\n return (\n <BaseBoundaries\n componentName=\"Employee.Management.Compensation\"\n LoaderComponent={LoaderComponent}\n >\n <CompensationCardContent LoaderComponent={LoaderComponent} {...props} />\n </BaseBoundaries>\n )\n}\n\nfunction CompensationCardContent({ employeeId, onEvent, LoaderComponent }: CompensationCardProps) {\n useI18n('Employee.Management.Compensation')\n const { t } = useTranslation('Employee.Management.Compensation')\n const Components = useComponentContext()\n\n const compensation = useCompensationManagement({ employeeId })\n\n if (compensation.isLoading) {\n return (\n <BaseLayout error={compensation.errorHandling.errors} LoaderComponent={LoaderComponent}>\n <Components.Box header={<Components.BoxHeader title={t('card.title')} />}>\n <Loading />\n </Components.Box>\n </BaseLayout>\n )\n }\n\n return (\n <CompensationCardReady\n employeeId={employeeId}\n onEvent={onEvent}\n compensation={compensation}\n LoaderComponent={LoaderComponent}\n />\n )\n}\n\ninterface CompensationCardReadyProps extends CompensationCardProps {\n compensation: UseCompensationManagementReady\n}\n\nfunction CompensationCardReady({\n employeeId,\n onEvent,\n compensation,\n LoaderComponent,\n}: CompensationCardReadyProps) {\n const { t } = useTranslation('Employee.Management.Compensation')\n const Components = useComponentContext()\n const formatCompensationRate = useFormatCompensationRate()\n\n const { jobs, primaryFlsaStatus, pendingChanges, hasMultipleJobs, employeeFirstName } =\n compensation.data\n const { cancellingCompensationUuid } = compensation.status\n\n const handleCancelChange = useCallback(\n async (pendingChange: PendingCompensationChange) => {\n const result = await compensation.actions.cancelPendingChange(pendingChange)\n if (result) {\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_CARD_CHANGE_CANCELLED, {\n employeeId,\n compensationId: pendingChange.compensationUuid,\n })\n }\n },\n [compensation, onEvent, employeeId],\n )\n\n const [pendingDeleteJob, setPendingDeleteJob] = useState<{\n uuid: string\n title: string\n } | null>(null)\n\n const { mutateAsync: deleteEmployeeJob, isPending: isDeletingJob } =\n useJobsAndCompensationsDeleteMutation()\n\n const handleConfirmDeleteJob = async () => {\n if (!pendingDeleteJob) return\n const jobId = pendingDeleteJob.uuid\n await deleteEmployeeJob({ request: { jobId } })\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_CARD_JOB_DELETED, {\n employeeId,\n jobId,\n })\n setPendingDeleteJob(null)\n }\n\n const singleJob = jobs.length === 1 ? jobs[0]! : undefined\n // Block adding a secondary if the primary already has a future-dated\n // compensation that isn't Nonexempt — that comp will delete secondary jobs\n // at its effective date, matching the gws-flows guard on the new-job action.\n const localTodayISO = formatDateToStringDate(new Date()) ?? ''\n const primaryJob = jobs.find(j => j.primary)\n const hasFutureNonNonexemptComp =\n primaryJob?.compensations?.some(\n c =>\n c.effectiveDate !== undefined &&\n c.effectiveDate > localTodayISO &&\n c.flsaStatus !== FlsaStatus.NONEXEMPT,\n ) ?? false\n const canAddAnotherJob =\n jobs.length >= 1 && primaryFlsaStatus === FlsaStatus.NONEXEMPT && !hasFutureNonNonexemptComp\n const singleJobNumericRate = singleJob ? parseJobRate(singleJob.rate) : null\n const singleJobCurrentComp = singleJob?.compensations?.find(\n c => c.uuid === singleJob.currentCompensationUuid,\n )\n const emptyPlaceholder = <span aria-label={t('card.listEmptyPlaceholder')}>–</span>\n const singleJobPaymentTypeLabel = singleJob?.paymentUnit\n ? singleJob.paymentUnit === 'Hour'\n ? t('card.types.hourly')\n : singleJob.paymentUnit === 'Salary' || singleJob.paymentUnit === 'Year'\n ? t('card.types.salary')\n : singleJob.paymentUnit\n : null\n\n const [isReviewOpen, setIsReviewOpen] = useState(false)\n const renderDetail = usePendingChangeDetailRenderer(employeeFirstName)\n\n // Split pending changes: \"new job\" (job hasn't started yet, no current comp)\n // vs \"update\" (existing comp with a scheduled future change).\n const newJobPendingChanges = pendingChanges.filter(c => c.isNewJob)\n const updatePendingChanges = pendingChanges.filter(c => !c.isNewJob)\n\n useEffect(() => {\n if (updatePendingChanges.length === 0) {\n setIsReviewOpen(false)\n }\n }, [updatePendingChanges.length])\n\n const pendingNewJobUuids = new Set(newJobPendingChanges.map(c => c.jobUuid))\n const singleJobIsPendingNew = singleJob ? pendingNewJobUuids.has(singleJob.uuid) : false\n const hasAnyPendingNewJobs = pendingNewJobUuids.size > 0\n\n // Jobs with a future-dated comp stacked on a current comp (\"pending update\").\n // Editing while one is queued would stack another future comp on top —\n // hide Edit until the existing pending change is cancelled or goes into effect.\n const pendingUpdateJobUuids = new Set(updatePendingChanges.map(c => c.jobUuid))\n const singleJobHasPendingUpdate = singleJob ? pendingUpdateJobUuids.has(singleJob.uuid) : false\n\n const hasPendingUpdates = updatePendingChanges.length > 0\n const showSummaryAlert = hasMultipleJobs && updatePendingChanges.length > 1\n const showInlineAlert = hasPendingUpdates && !showSummaryAlert\n const nextChange = updatePendingChanges[0]\n\n const handleEdit = (job: Job) => {\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_CARD_EDIT_REQUESTED, {\n employeeId,\n jobId: job.uuid,\n })\n }\n const handleAddJob = () => {\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_CARD_ADD_REQUESTED, { employeeId })\n }\n const handleAddAnotherJob = () => {\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_CARD_ADD_ANOTHER_REQUESTED, {\n employeeId,\n })\n }\n\n const jobsColumns = [\n {\n key: 'jobTitle',\n title: t('card.columns.jobTitle'),\n render: (job: Job) => {\n // Title lives on compensation in the API — `job.title` is a\n // denormalized snapshot that can lag behind comp-level edits on\n // pending jobs, so read from the comp pointed to by\n // `currentCompensationUuid`.\n const currentComp = job.compensations?.find(c => c.uuid === job.currentCompensationUuid)\n const numericRate = parseJobRate(job.rate)\n return (\n <>\n {currentComp?.title || '-'}\n {numericRate !== null && job.paymentUnit ? (\n <Components.Text variant=\"supporting\" size=\"sm\">\n {formatCompensationRate(numericRate, job.paymentUnit)}\n </Components.Text>\n ) : null}\n </>\n )\n },\n },\n {\n key: 'payType',\n title: t('card.columns.payType'),\n render: (job: Job) => {\n const flsaStatus = job.compensations?.find(\n comp => comp.uuid === job.currentCompensationUuid,\n )?.flsaStatus\n return flsaStatus !== undefined ? t(`flsaStatusLabels.${flsaStatus}`) : '-'\n },\n },\n {\n key: 'effectiveDate',\n title: t('card.columns.effectiveDate'),\n render: (job: Job) => {\n const currentComp = job.compensations?.find(c => c.uuid === job.currentCompensationUuid)\n return currentComp?.effectiveDate ? formatDateLongWithYear(currentComp.effectiveDate) : '-'\n },\n },\n ...(hasAnyPendingNewJobs\n ? [\n {\n key: 'status',\n title: <VisuallyHidden>{t('card.columns.status')}</VisuallyHidden>,\n render: (job: Job) =>\n pendingNewJobUuids.has(job.uuid) ? (\n <Components.Badge status=\"warning\">{t('card.pendingStatus')}</Components.Badge>\n ) : null,\n },\n ]\n : []),\n ]\n\n const jobsDataView = useDataView({\n data: jobs,\n columns: jobsColumns,\n itemMenu: (job: Job) => {\n const jobHasPendingUpdate = pendingUpdateJobUuids.has(job.uuid)\n const items = [\n ...(jobHasPendingUpdate\n ? []\n : [\n {\n label: t('card.editJobCta'),\n icon: <PencilSvg aria-hidden />,\n onClick: () => {\n handleEdit(job)\n },\n },\n ]),\n ...(!job.primary\n ? [\n {\n label: t('card.deleteJobCta'),\n icon: <TrashCanSvg aria-hidden />,\n onClick: () => {\n const currentComp = job.compensations?.find(\n c => c.uuid === job.currentCompensationUuid,\n )\n setPendingDeleteJob({ uuid: job.uuid, title: currentComp?.title ?? '' })\n },\n },\n ]\n : []),\n ]\n if (items.length === 0) return null\n return (\n <HamburgerMenu\n triggerLabel={t('card.hamburgerTitle')}\n isLoading={isDeletingJob}\n items={items}\n />\n )\n },\n })\n\n return (\n <BaseLayout error={compensation.errorHandling.errors} LoaderComponent={LoaderComponent}>\n <Components.Box\n withPadding={!hasMultipleJobs}\n header={\n <Components.BoxHeader\n title={t('card.title')}\n action={\n hasMultipleJobs ? null : singleJob ? (\n singleJobHasPendingUpdate ? null : (\n <Components.Button\n variant=\"secondary\"\n onClick={() => {\n handleEdit(singleJob)\n }}\n >\n {t('card.editCta')}\n </Components.Button>\n )\n ) : (\n <Components.Button\n variant=\"secondary\"\n onClick={handleAddJob}\n icon={<PlusCircleIcon />}\n >\n {t('card.addJobCta')}\n </Components.Button>\n )\n }\n />\n }\n footer={\n canAddAnotherJob ? (\n <Components.Button\n variant=\"secondary\"\n onClick={handleAddAnotherJob}\n icon={<PlusCircleIcon />}\n >\n {t('card.addAnotherJobCta')}\n </Components.Button>\n ) : undefined\n }\n >\n <Flex flexDirection=\"column\" gap={16}>\n {hasPendingUpdates && (\n <div\n className={[styles.alertWrapper, hasMultipleJobs && styles.alertWrapperPadded]\n .filter(Boolean)\n .join(' ')}\n >\n <Flex flexDirection=\"column\" gap={16}>\n {showInlineAlert && nextChange && (\n <Components.Alert\n status=\"warning\"\n disableScrollIntoView\n label={\n hasMultipleJobs\n ? t('card.pendingChange.alertLabelWithJob', {\n jobTitle: nextChange.jobTitle,\n date: formatDateLongWithYear(nextChange.effectiveDate),\n })\n : t('card.pendingChange.alertLabel', {\n date: formatDateLongWithYear(nextChange.effectiveDate),\n })\n }\n >\n <Flex flexDirection=\"column\" gap={12}>\n <Components.UnorderedList\n items={nextChange.details.map(detail => renderDetail(detail))}\n />\n <div>\n <Components.Button\n variant=\"secondary\"\n isLoading={cancellingCompensationUuid === nextChange.compensationUuid}\n onClick={() => {\n void handleCancelChange(nextChange)\n }}\n >\n {t('card.pendingChange.cancelCta')}\n </Components.Button>\n </div>\n </Flex>\n </Components.Alert>\n )}\n {showSummaryAlert && (\n <Components.Alert\n status=\"warning\"\n disableScrollIntoView\n label={t('card.pendingChange.summaryLabel', {\n name: employeeFirstName ?? '',\n })}\n action={\n <Components.Button\n variant=\"secondary\"\n onClick={() => {\n setIsReviewOpen(true)\n }}\n >\n {t('card.pendingChange.reviewCta')}\n </Components.Button>\n }\n />\n )}\n </Flex>\n </div>\n )}\n {hasMultipleJobs ? (\n <DataView label={t('card.tableLabel')} isWithinBox {...jobsDataView} />\n ) : singleJob ? (\n <Components.DescriptionList\n items={[\n {\n term: t('card.jobTitle'),\n description: singleJob.title || emptyPlaceholder,\n },\n {\n term: t('card.type'),\n description: singleJobPaymentTypeLabel || emptyPlaceholder,\n },\n {\n term: t('card.wage'),\n description:\n singleJobNumericRate !== null && singleJob.paymentUnit\n ? formatCompensationRate(singleJobNumericRate, singleJob.paymentUnit)\n : emptyPlaceholder,\n },\n {\n term: t('card.effectiveDate'),\n description: singleJobCurrentComp?.effectiveDate\n ? formatDateLongWithYear(singleJobCurrentComp.effectiveDate)\n : emptyPlaceholder,\n },\n ...(singleJobIsPendingNew\n ? [\n {\n term: t('card.columns.status'),\n description: (\n <Components.Badge status=\"warning\">\n {t('card.pendingStatus')}\n </Components.Badge>\n ),\n },\n ]\n : []),\n ]}\n />\n ) : (\n <EmptyData\n title={t('card.emptyState.title')}\n description={t('card.emptyState.description')}\n />\n )}\n </Flex>\n </Components.Box>\n\n <PendingChangesReviewModal\n isOpen={isReviewOpen}\n pendingChanges={updatePendingChanges}\n employeeFirstName={employeeFirstName}\n cancellingCompensationUuid={cancellingCompensationUuid}\n onClose={() => {\n setIsReviewOpen(false)\n }}\n onCancelChange={change => {\n void handleCancelChange(change)\n }}\n />\n\n <Components.Dialog\n isOpen={pendingDeleteJob !== null}\n onClose={() => {\n setPendingDeleteJob(null)\n }}\n onPrimaryActionClick={() => {\n void handleConfirmDeleteJob()\n }}\n isPrimaryActionLoading={isDeletingJob}\n isDestructive\n title={t('card.deleteJobDialog.title')}\n primaryActionLabel={t('card.deleteJobDialog.confirmCta')}\n closeActionLabel={t('card.deleteJobDialog.cancelCta')}\n >\n {pendingDeleteJob\n ? t('card.deleteJobDialog.description', {\n jobTitle: pendingDeleteJob.title,\n })\n : null}\n </Components.Dialog>\n </BaseLayout>\n )\n}\n"],"names":["parseJobRate","rate","numericRate","CompensationCard","LoaderComponent","props","jsx","BaseBoundaries","CompensationCardContent","employeeId","onEvent","useI18n","t","useTranslation","Components","useComponentContext","compensation","useCompensationManagement","BaseLayout","Loading","CompensationCardReady","formatCompensationRate","useFormatCompensationRate","jobs","primaryFlsaStatus","pendingChanges","hasMultipleJobs","employeeFirstName","cancellingCompensationUuid","handleCancelChange","useCallback","pendingChange","componentEvents","pendingDeleteJob","setPendingDeleteJob","useState","deleteEmployeeJob","isDeletingJob","useJobsAndCompensationsDeleteMutation","handleConfirmDeleteJob","jobId","singleJob","localTodayISO","formatDateToStringDate","hasFutureNonNonexemptComp","j","c","FlsaStatus","canAddAnotherJob","singleJobNumericRate","singleJobCurrentComp","emptyPlaceholder","singleJobPaymentTypeLabel","isReviewOpen","setIsReviewOpen","renderDetail","usePendingChangeDetailRenderer","newJobPendingChanges","updatePendingChanges","useEffect","pendingNewJobUuids","singleJobIsPendingNew","hasAnyPendingNewJobs","pendingUpdateJobUuids","singleJobHasPendingUpdate","hasPendingUpdates","showSummaryAlert","showInlineAlert","nextChange","handleEdit","job","handleAddJob","handleAddAnotherJob","jobsColumns","currentComp","jsxs","Fragment","flsaStatus","comp","formatDateLongWithYear","VisuallyHidden","jobsDataView","useDataView","items","PencilSvg","TrashCanSvg","HamburgerMenu","PlusCircleIcon","Flex","styles","detail","DataView","EmptyData","PendingChangesReviewModal","change"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA2BA,SAASA,EAAaC,GAAkC;AACtD,MAAIA,MAAS,OAAW,QAAO;AAC/B,QAAMC,IAAc,WAAWD,CAAI;AACnC,SAAO,OAAO,SAASC,CAAW,IAAIA,IAAc;A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UAAKK,EAAA;AAAA,QACP;AAAA,QACA,wBAAwBF;AAAA,QACxB,eAAa;AAAA,QACb,OAAO,EAAE,4BAA4B;AAAA,QACrC,oBAAoB,EAAE,iCAAiC;AAAA,QACvD,kBAAkB,EAAE,gCAAgC;AAAA,QAEnD,UAAAJ,IACG,EAAE,oCAAoC;AAAA,UACpC,UAAUA,EAAiB;AAAA,QAAA,CAC5B,IACD;AAAA,MAAA;AAAA,IAAA;AAAA,EACN,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"CompensationCard.js","sources":["../../../../../../src/components/Employee/Compensation/management/CompensationCard/CompensationCard.tsx"],"sourcesContent":["import { useCallback, useEffect, useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { useJobsAndCompensationsDeleteMutation } from '@gusto/embedded-api/react-query/jobsAndCompensationsDelete'\nimport type { Job } from '@gusto/embedded-api/models/components/job'\nimport {\n useCompensationManagement,\n type UseCompensationManagementReady,\n} from '../../shared/useCompensationManagement'\nimport type { PendingCompensationChange } from '../../shared/getPendingCompensationChanges'\nimport { usePendingChangeDetailRenderer } from '../../shared/usePendingChangeDetailRenderer'\nimport { PendingChangesReviewModal } from '../../shared/PendingChangesReviewModal'\nimport styles from './CompensationCard.module.scss'\nimport { Flex } from '@/components/Common/Flex/Flex'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { DataView, useDataView, EmptyData, Loading, VisuallyHidden } from '@/components/Common'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport { BaseBoundaries, BaseLayout } from '@/components/Base/Base'\nimport { formatDateLongWithYear, formatDateToStringDate } from '@/helpers/dateFormatting'\nimport { useFormatCompensationRate } from '@/helpers/formattedStrings'\nimport { useI18n } from '@/i18n'\nimport { componentEvents, FlsaStatus, type EventType } from '@/shared/constants'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport type { LoaderComponentType } from '@/components/Base'\nimport PlusCircleIcon from '@/assets/icons/plus-circle.svg?react'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\n\nfunction parseJobRate(rate: Job['rate']): number | null {\n if (rate === undefined) return null\n const numericRate = parseFloat(rate)\n return Number.isFinite(numericRate) ? numericRate : null\n}\n\n/**\n * Props for {@link CompensationCard}.\n *\n * @public\n */\nexport interface CompensationCardProps {\n /** The associated employee identifier. */\n employeeId: string\n /** Callback invoked when the card emits an event. See the events table on {@link CompensationCard} for the available event types and payloads. */\n onEvent: OnEventType<EventType, unknown>\n /** Custom loading indicator rendered while this component's async data is fetching. Overrides the indicator configured on `GustoProvider` for this instance only. */\n LoaderComponent?: LoaderComponentType\n}\n\n/**\n * Standalone \"Compensation\" management card that displays an employee's current jobs and compensation, surfaces pending future-dated changes, and exposes edit, add, and delete affordances.\n *\n * @remarks\n * The card owns its own data fetch, the pending-change alerts and review modal, and the delete-job confirm dialog. It does not render the compensation edit or add-job forms — instead, it emits a distinct request event for each action, and the consumer routes those to {@link CompensationEditForm}, {@link CompensationAddJobForm}, or {@link CompensationAddAnotherJobForm} and renders any post-save success alerts. {@link Compensation} bundles the card, the three form surfaces, and the swap and alert wiring as a single drop-in; reach for the card directly only when that orchestration is the wrong fit (for example, when a form needs to render in a modal or drawer, or when the swap is driven by a router).\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `employee/management/compensation/card/editRequested` | Fired when an \"Edit\" CTA is clicked for a job | `{ employeeId: string, jobId: string }` |\n * | `employee/management/compensation/card/addRequested` | Fired when the \"Add job\" CTA is clicked from the empty state | `{ employeeId: string }` |\n * | `employee/management/compensation/card/addAnotherRequested` | Fired when the \"Add another job\" CTA is clicked | `{ employeeId: string }` |\n * | `employee/management/compensation/card/jobDeleted` | Fired after a non-primary job is deleted via the card's confirm dialog | `{ employeeId: string, jobId: string }` |\n * | `employee/management/compensation/card/changeCancelled` | Fired after a scheduled future-dated change is cancelled from the card | `{ employeeId: string, compensationId: string }` |\n *\n * @param props - See {@link CompensationCardProps}.\n * @returns The rendered compensation card.\n * @public\n * @group Block components\n */\nexport function CompensationCard({ LoaderComponent, ...props }: CompensationCardProps) {\n return (\n <BaseBoundaries\n componentName=\"Employee.Management.Compensation\"\n LoaderComponent={LoaderComponent}\n >\n <CompensationCardContent LoaderComponent={LoaderComponent} {...props} />\n </BaseBoundaries>\n )\n}\n\nfunction CompensationCardContent({ employeeId, onEvent, LoaderComponent }: CompensationCardProps) {\n useI18n('Employee.Management.Compensation')\n const { t } = useTranslation('Employee.Management.Compensation')\n const Components = useComponentContext()\n\n const compensation = useCompensationManagement({ employeeId })\n\n if (compensation.isLoading) {\n return (\n <BaseLayout error={compensation.errorHandling.errors} LoaderComponent={LoaderComponent}>\n <Components.Box header={<Components.BoxHeader title={t('card.title')} />}>\n <Loading />\n </Components.Box>\n </BaseLayout>\n )\n }\n\n return (\n <CompensationCardReady\n employeeId={employeeId}\n onEvent={onEvent}\n compensation={compensation}\n LoaderComponent={LoaderComponent}\n />\n )\n}\n\ninterface CompensationCardReadyProps extends CompensationCardProps {\n compensation: UseCompensationManagementReady\n}\n\nfunction CompensationCardReady({\n employeeId,\n onEvent,\n compensation,\n LoaderComponent,\n}: CompensationCardReadyProps) {\n const { t } = useTranslation('Employee.Management.Compensation')\n const Components = useComponentContext()\n const formatCompensationRate = useFormatCompensationRate()\n\n const { jobs, primaryFlsaStatus, pendingChanges, hasMultipleJobs, employeeFirstName } =\n compensation.data\n const { cancellingCompensationUuid } = compensation.status\n\n const handleCancelChange = useCallback(\n async (pendingChange: PendingCompensationChange) => {\n const result = await compensation.actions.cancelPendingChange(pendingChange)\n if (result) {\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_CARD_CHANGE_CANCELLED, {\n employeeId,\n compensationId: pendingChange.compensationUuid,\n })\n }\n },\n [compensation, onEvent, employeeId],\n )\n\n const [pendingDeleteJob, setPendingDeleteJob] = useState<{\n uuid: string\n title: string\n } | null>(null)\n\n const { mutateAsync: deleteEmployeeJob, isPending: isDeletingJob } =\n useJobsAndCompensationsDeleteMutation()\n\n const handleConfirmDeleteJob = async () => {\n if (!pendingDeleteJob) return\n const jobId = pendingDeleteJob.uuid\n await deleteEmployeeJob({ request: { jobId } })\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_CARD_JOB_DELETED, {\n employeeId,\n jobId,\n })\n setPendingDeleteJob(null)\n }\n\n const singleJob = jobs.length === 1 ? jobs[0]! : undefined\n // Block adding a secondary if the primary already has a future-dated\n // compensation that isn't Nonexempt — that comp will delete secondary jobs\n // at its effective date, matching the gws-flows guard on the new-job action.\n const localTodayISO = formatDateToStringDate(new Date()) ?? ''\n const primaryJob = jobs.find(j => j.primary)\n const hasFutureNonNonexemptComp =\n primaryJob?.compensations?.some(\n c =>\n c.effectiveDate !== undefined &&\n c.effectiveDate > localTodayISO &&\n c.flsaStatus !== FlsaStatus.NONEXEMPT,\n ) ?? false\n const canAddAnotherJob =\n jobs.length >= 1 && primaryFlsaStatus === FlsaStatus.NONEXEMPT && !hasFutureNonNonexemptComp\n const singleJobNumericRate = singleJob ? parseJobRate(singleJob.rate) : null\n const singleJobCurrentComp = singleJob?.compensations?.find(\n c => c.uuid === singleJob.currentCompensationUuid,\n )\n const emptyPlaceholder = <span aria-label={t('card.listEmptyPlaceholder')}>–</span>\n const singleJobPaymentTypeLabel = singleJobCurrentComp?.flsaStatus\n ? t(`flsaStatusLabels.${singleJobCurrentComp.flsaStatus}`)\n : null\n\n const [isReviewOpen, setIsReviewOpen] = useState(false)\n const renderDetail = usePendingChangeDetailRenderer(employeeFirstName)\n\n // Split pending changes: \"new job\" (job hasn't started yet, no current comp)\n // vs \"update\" (existing comp with a scheduled future change).\n const newJobPendingChanges = pendingChanges.filter(c => c.isNewJob)\n const updatePendingChanges = pendingChanges.filter(c => !c.isNewJob)\n\n useEffect(() => {\n if (updatePendingChanges.length === 0) {\n setIsReviewOpen(false)\n }\n }, [updatePendingChanges.length])\n\n const pendingNewJobUuids = new Set(newJobPendingChanges.map(c => c.jobUuid))\n const singleJobIsPendingNew = singleJob ? pendingNewJobUuids.has(singleJob.uuid) : false\n const hasAnyPendingNewJobs = pendingNewJobUuids.size > 0\n\n // Jobs with a future-dated comp stacked on a current comp (\"pending update\").\n // Editing while one is queued would stack another future comp on top —\n // hide Edit until the existing pending change is cancelled or goes into effect.\n const pendingUpdateJobUuids = new Set(updatePendingChanges.map(c => c.jobUuid))\n const singleJobHasPendingUpdate = singleJob ? pendingUpdateJobUuids.has(singleJob.uuid) : false\n\n const hasPendingUpdates = updatePendingChanges.length > 0\n const showSummaryAlert = hasMultipleJobs && updatePendingChanges.length > 1\n const showInlineAlert = hasPendingUpdates && !showSummaryAlert\n const nextChange = updatePendingChanges[0]\n\n const handleEdit = (job: Job) => {\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_CARD_EDIT_REQUESTED, {\n employeeId,\n jobId: job.uuid,\n })\n }\n const handleAddJob = () => {\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_CARD_ADD_REQUESTED, { employeeId })\n }\n const handleAddAnotherJob = () => {\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_COMPENSATION_CARD_ADD_ANOTHER_REQUESTED, {\n employeeId,\n })\n }\n\n const jobsColumns = [\n {\n key: 'jobTitle',\n title: t('card.columns.jobTitle'),\n render: (job: Job) => {\n // Title lives on compensation in the API — `job.title` is a\n // denormalized snapshot that can lag behind comp-level edits on\n // pending jobs, so read from the comp pointed to by\n // `currentCompensationUuid`.\n const currentComp = job.compensations?.find(c => c.uuid === job.currentCompensationUuid)\n const numericRate = parseJobRate(job.rate)\n return (\n <>\n {currentComp?.title || '-'}\n {numericRate !== null && job.paymentUnit ? (\n <Components.Text variant=\"supporting\" size=\"sm\">\n {formatCompensationRate(numericRate, job.paymentUnit)}\n </Components.Text>\n ) : null}\n </>\n )\n },\n },\n {\n key: 'payType',\n title: t('card.columns.payType'),\n render: (job: Job) => {\n const flsaStatus = job.compensations?.find(\n comp => comp.uuid === job.currentCompensationUuid,\n )?.flsaStatus\n return flsaStatus !== undefined ? t(`flsaStatusLabels.${flsaStatus}`) : '-'\n },\n },\n {\n key: 'effectiveDate',\n title: t('card.columns.effectiveDate'),\n render: (job: Job) => {\n const currentComp = job.compensations?.find(c => c.uuid === job.currentCompensationUuid)\n return currentComp?.effectiveDate ? formatDateLongWithYear(currentComp.effectiveDate) : '-'\n },\n },\n ...(hasAnyPendingNewJobs\n ? [\n {\n key: 'status',\n title: <VisuallyHidden>{t('card.columns.status')}</VisuallyHidden>,\n render: (job: Job) =>\n pendingNewJobUuids.has(job.uuid) ? (\n <Components.Badge status=\"warning\">{t('card.pendingStatus')}</Components.Badge>\n ) : null,\n },\n ]\n : []),\n ]\n\n const jobsDataView = useDataView({\n data: jobs,\n columns: jobsColumns,\n itemMenu: (job: Job) => {\n const jobHasPendingUpdate = pendingUpdateJobUuids.has(job.uuid)\n const items = [\n ...(jobHasPendingUpdate\n ? []\n : [\n {\n label: t('card.editJobCta'),\n icon: <PencilSvg aria-hidden />,\n onClick: () => {\n handleEdit(job)\n },\n },\n ]),\n ...(!job.primary\n ? [\n {\n label: t('card.deleteJobCta'),\n icon: <TrashCanSvg aria-hidden />,\n onClick: () => {\n const currentComp = job.compensations?.find(\n c => c.uuid === job.currentCompensationUuid,\n )\n setPendingDeleteJob({ uuid: job.uuid, title: currentComp?.title ?? '' })\n },\n },\n ]\n : []),\n ]\n if (items.length === 0) return null\n return (\n <HamburgerMenu\n triggerLabel={t('card.hamburgerTitle')}\n isLoading={isDeletingJob}\n items={items}\n />\n )\n },\n })\n\n return (\n <BaseLayout error={compensation.errorHandling.errors} LoaderComponent={LoaderComponent}>\n <Components.Box\n withPadding={!hasMultipleJobs}\n header={\n <Components.BoxHeader\n title={t('card.title')}\n action={\n hasMultipleJobs ? null : singleJob ? (\n singleJobHasPendingUpdate ? null : (\n <Components.Button\n variant=\"secondary\"\n onClick={() => {\n handleEdit(singleJob)\n }}\n >\n {t('card.editCta')}\n </Components.Button>\n )\n ) : (\n <Components.Button\n variant=\"secondary\"\n onClick={handleAddJob}\n icon={<PlusCircleIcon />}\n >\n {t('card.addJobCta')}\n </Components.Button>\n )\n }\n />\n }\n footer={\n canAddAnotherJob ? (\n <Components.Button\n variant=\"secondary\"\n onClick={handleAddAnotherJob}\n icon={<PlusCircleIcon />}\n >\n {t('card.addAnotherJobCta')}\n </Components.Button>\n ) : undefined\n }\n >\n <Flex flexDirection=\"column\" gap={16}>\n {hasPendingUpdates && (\n <div\n className={[styles.alertWrapper, hasMultipleJobs && styles.alertWrapperPadded]\n .filter(Boolean)\n .join(' ')}\n >\n <Flex flexDirection=\"column\" gap={16}>\n {showInlineAlert && nextChange && (\n <Components.Alert\n status=\"warning\"\n disableScrollIntoView\n label={\n hasMultipleJobs\n ? t('card.pendingChange.alertLabelWithJob', {\n jobTitle: nextChange.jobTitle,\n date: formatDateLongWithYear(nextChange.effectiveDate),\n })\n : t('card.pendingChange.alertLabel', {\n date: formatDateLongWithYear(nextChange.effectiveDate),\n })\n }\n >\n <Flex flexDirection=\"column\" gap={12}>\n <Components.UnorderedList\n items={nextChange.details.map(detail => renderDetail(detail))}\n />\n <div>\n <Components.Button\n variant=\"secondary\"\n isLoading={cancellingCompensationUuid === nextChange.compensationUuid}\n onClick={() => {\n void handleCancelChange(nextChange)\n }}\n >\n {t('card.pendingChange.cancelCta')}\n </Components.Button>\n </div>\n </Flex>\n </Components.Alert>\n )}\n {showSummaryAlert && (\n <Components.Alert\n status=\"warning\"\n disableScrollIntoView\n label={t('card.pendingChange.summaryLabel', {\n name: employeeFirstName ?? '',\n })}\n action={\n <Components.Button\n variant=\"secondary\"\n onClick={() => {\n setIsReviewOpen(true)\n }}\n >\n {t('card.pendingChange.reviewCta')}\n </Components.Button>\n }\n />\n )}\n </Flex>\n </div>\n )}\n {hasMultipleJobs ? (\n <DataView label={t('card.tableLabel')} isWithinBox {...jobsDataView} />\n ) : singleJob ? (\n <Components.DescriptionList\n items={[\n {\n term: t('card.jobTitle'),\n description: singleJob.title || emptyPlaceholder,\n },\n {\n term: t('card.type'),\n description: singleJobPaymentTypeLabel || emptyPlaceholder,\n },\n {\n term: t('card.wage'),\n description:\n singleJobNumericRate !== null && singleJob.paymentUnit\n ? formatCompensationRate(singleJobNumericRate, singleJob.paymentUnit)\n : emptyPlaceholder,\n },\n {\n term: t('card.effectiveDate'),\n description: singleJobCurrentComp?.effectiveDate\n ? formatDateLongWithYear(singleJobCurrentComp.effectiveDate)\n : emptyPlaceholder,\n },\n ...(singleJobIsPendingNew\n ? [\n {\n term: t('card.columns.status'),\n description: (\n <Components.Badge status=\"warning\">\n {t('card.pendingStatus')}\n </Components.Badge>\n ),\n },\n ]\n : []),\n ]}\n />\n ) : (\n <EmptyData\n title={t('card.emptyState.title')}\n description={t('card.emptyState.description')}\n />\n )}\n </Flex>\n </Components.Box>\n\n <PendingChangesReviewModal\n isOpen={isReviewOpen}\n pendingChanges={updatePendingChanges}\n employeeFirstName={employeeFirstName}\n cancellingCompensationUuid={cancellingCompensationUuid}\n onClose={() => {\n setIsReviewOpen(false)\n }}\n onCancelChange={change => {\n void handleCancelChange(change)\n }}\n />\n\n <Components.Dialog\n isOpen={pendingDeleteJob !== null}\n onClose={() => {\n setPendingDeleteJob(null)\n }}\n onPrimaryActionClick={() => {\n void handleConfirmDeleteJob()\n }}\n isPrimaryActionLoading={isDeletingJob}\n isDestructive\n title={t('card.deleteJobDialog.title')}\n primaryActionLabel={t('card.deleteJobDialog.confirmCta')}\n closeActionLabel={t('card.deleteJobDialog.cancelCta')}\n >\n {pendingDeleteJob\n ? t('card.deleteJobDialog.description', {\n jobTitle: pendingDeleteJob.title,\n })\n : null}\n </Components.Dialog>\n </BaseLayout>\n )\n}\n"],"names":["parseJobRate","rate","numericRate","CompensationCard","LoaderComponent","props","jsx","BaseBoundaries","CompensationCardContent","employeeId","onEvent","useI18n","t","useTranslation","Components","useComponentContext","compensation","useCompensationManagement","BaseLayout","Loading","CompensationCardReady","formatCompensationRate","useFormatCompensationRate","jobs","primaryFlsaStatus","pendingChanges","hasMultipleJobs","employeeFirstName","cancellingCompensationUuid","handleCancelChange","useCallback","pendingChange","componentEvents","pendingDeleteJob","setPendingDeleteJob","useState","deleteEmployeeJob","isDeletingJob","useJobsAndCompensationsDeleteMutation","handleConfirmDeleteJob","jobId","singleJob","localTodayISO","formatDateToStringDate","hasFutureNonNonexemptComp","j","c","FlsaStatus","canAddAnotherJob","singleJobNumericRate","singleJobCurrentComp","emptyPlaceholder","singleJobPaymentTypeLabel","isReviewOpen","setIsReviewOpen","renderDetail","usePendingChangeDetailRenderer","newJobPendingChanges","updatePendingChanges","useEffect","pendingNewJobUuids","singleJobIsPendingNew","hasAnyPendingNewJobs","pendingUpdateJobUuids","singleJobHasPendingUpdate","hasPendingUpdates","showSummaryAlert","showInlineAlert","nextChange","handleEdit","job","handleAddJob","handleAddAnotherJob","jobsColumns","currentComp","jsxs","Fragment","flsaStatus","comp","formatDateLongWithYear","VisuallyHidden","jobsDataView","useDataView","items","PencilSvg","TrashCanSvg","HamburgerMenu","PlusCircleIcon","Flex","styles","detail","DataView","EmptyData","PendingChangesReviewModal","change"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA2BA,SAASA,EAAaC,GAAkC;AACtD,MAAIA,MAAS,OAAW,QAAO;AAC/B,QAAMC,IAAc,WAAWD,CAAI;AACnC,SAAO,OAAO,SAASC,CAAW,IAAIA,IAAc;AACtD;AAoCO,SAASC,GAAiB,EAAE,iBAAAC,GAAiB,GAAGC,KAAgC;AACrF,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,eAAc;AAAA,MACd,iBAAAH;AAAA,MAEA,UAAA,gBAAAE,EAACE,IAAA,EAAwB,iBAAAJ,GAAmC,GAAGC,EAAA,CAAO;AAAA,IAAA;AAAA,EAAA;AAG5E;AAEA,SAASG,GAAwB,EAAE,YAAAC,GAAY,SAAAC,GAAS,iBAA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 import "@gusto/embedded-api/models/errors/unprocessableentityerror";
|
|
|
11
11
|
import "@gusto/embedded-api/models/errors/httpclienterrors";
|
|
12
12
|
import "../../../../../../shared/constants.js";
|
|
13
13
|
import "../../../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
14
|
-
import "../../../../../../contexts/LoadingIndicatorProvider/useLoadingIndicator.js";
|
|
15
14
|
import { createCompoundContext as t } from "../../../../../Base/createCompoundContext.js";
|
|
16
|
-
const [
|
|
15
|
+
const [d, a] = t("DocumentListContext");
|
|
17
16
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
a as DocumentListProvider,
|
|
18
|
+
d as useDocumentList
|
|
20
19
|
};
|
|
21
20
|
//# sourceMappingURL=useDocumentList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDocumentList.js","sources":["../../../../../../../src/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.ts"],"sourcesContent":["import type { Form } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype DocumentListContextType = {\n employeeForms: Form[]\n hasSignedAllForms: boolean\n handleContinue: () => void\n handleRequestFormToSign: (form: Form) => void\n documentListError: Error | null\n formToSign?: Form\n}\n\nconst [useDocumentList, DocumentListProvider] =\n createCompoundContext<DocumentListContextType>('DocumentListContext')\nexport { useDocumentList, DocumentListProvider }\n"],"names":["useDocumentList","DocumentListProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useDocumentList.js","sources":["../../../../../../../src/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.ts"],"sourcesContent":["import type { Form } from '@gusto/embedded-api/models/components/form'\nimport { createCompoundContext } from '@/components/Base'\n\ntype DocumentListContextType = {\n employeeForms: Form[]\n hasSignedAllForms: boolean\n handleContinue: () => void\n handleRequestFormToSign: (form: Form) => void\n documentListError: Error | null\n formToSign?: Form\n}\n\nconst [useDocumentList, DocumentListProvider] =\n createCompoundContext<DocumentListContextType>('DocumentListContext')\nexport { useDocumentList, DocumentListProvider }\n"],"names":["useDocumentList","DocumentListProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;AAYA,MAAM,CAACA,GAAiBC,CAAoB,IAC1CC,EAA+C,qBAAqB;"}
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
import { jsx as e, jsxs as p, Fragment as
|
|
1
|
+
import { jsx as e, jsxs as p, Fragment as H } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation as V } from "react-i18next";
|
|
3
|
-
import { useWatch as
|
|
3
|
+
import { useWatch as v } from "react-hook-form";
|
|
4
4
|
import { usePaymentMethodList as U } from "../shared/usePaymentMethodList.js";
|
|
5
5
|
import { usePaymentMethodForm as K } from "../shared/usePaymentMethodForm/usePaymentMethodForm.js";
|
|
6
|
-
import { useDeleteBankAccount as
|
|
7
|
-
import { DeleteBankAccountDialog as
|
|
8
|
-
import { useOnboardingBankFormDictionary as
|
|
6
|
+
import { useDeleteBankAccount as R } from "../shared/useDeleteBankAccount.js";
|
|
7
|
+
import { DeleteBankAccountDialog as j } from "../shared/DeleteBankAccountDialog.js";
|
|
8
|
+
import { useOnboardingBankFormDictionary as I } from "./useFormDictionary.js";
|
|
9
9
|
import y from "./ListView.module.scss.js";
|
|
10
|
-
import { Flex as
|
|
11
|
-
import { ActionsLayout as
|
|
10
|
+
import { Flex as W } from "../../../Common/Flex/Flex.js";
|
|
11
|
+
import { ActionsLayout as C } from "../../../Common/ActionsLayout/ActionsLayout.js";
|
|
12
12
|
import { HamburgerMenu as q } from "../../../Common/HamburgerMenu/HamburgerMenu.js";
|
|
13
13
|
import { BaseLayout as k } from "../../../Base/Base.js";
|
|
14
14
|
import { SDKFormProvider as z } from "../../../../partner-hook-utils/form/SDKFormProvider.js";
|
|
15
|
-
import { composeErrorHandler as
|
|
16
|
-
import { useComponentContext as
|
|
17
|
-
import { centsToDollars as
|
|
18
|
-
import
|
|
19
|
-
import { componentEvents as
|
|
20
|
-
import
|
|
21
|
-
import { BankFormBody as
|
|
22
|
-
import { useDataView as
|
|
23
|
-
import { DataView as
|
|
24
|
-
function
|
|
25
|
-
const n = U({ employeeId:
|
|
26
|
-
return n.isLoading ||
|
|
27
|
-
|
|
15
|
+
import { composeErrorHandler as G } from "../../../../partner-hook-utils/composeErrorHandler.js";
|
|
16
|
+
import { useComponentContext as J } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
17
|
+
import { centsToDollars as Q } from "../../../../helpers/currencyHelpers.js";
|
|
18
|
+
import X from "../../../../hooks/useNumberFormatter.js";
|
|
19
|
+
import { componentEvents as a, SPLIT_BY as Z, PAYMENT_METHODS as l } from "../../../../shared/constants.js";
|
|
20
|
+
import $ from "../../../../assets/icons/trashcan.svg.js";
|
|
21
|
+
import { BankFormBody as tt } from "../shared/BankFormBody/BankFormBody.js";
|
|
22
|
+
import { useDataView as et } from "../../../Common/DataView/useDataView.js";
|
|
23
|
+
import { DataView as ot } from "../../../Common/DataView/DataView.js";
|
|
24
|
+
function Pt({ employeeId: u, isAdmin: f, onEvent: i, LoaderComponent: r }) {
|
|
25
|
+
const n = U({ employeeId: u }), m = K({ employeeId: u }), D = G([n, m]);
|
|
26
|
+
return n.isLoading || m.isLoading ? /* @__PURE__ */ e(k, { isLoading: !0, error: D.errors, LoaderComponent: r }) : /* @__PURE__ */ e(
|
|
27
|
+
nt,
|
|
28
28
|
{
|
|
29
|
-
employeeId:
|
|
29
|
+
employeeId: u,
|
|
30
30
|
isAdmin: f,
|
|
31
31
|
onEvent: i,
|
|
32
32
|
paymentMethodList: n,
|
|
33
|
-
paymentMethodForm:
|
|
33
|
+
paymentMethodForm: m,
|
|
34
34
|
errorHandling: D,
|
|
35
|
-
LoaderComponent:
|
|
35
|
+
LoaderComponent: r
|
|
36
36
|
}
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
employeeId:
|
|
39
|
+
function nt({
|
|
40
|
+
employeeId: u,
|
|
41
41
|
isAdmin: f,
|
|
42
42
|
onEvent: i,
|
|
43
|
-
paymentMethodList:
|
|
43
|
+
paymentMethodList: r,
|
|
44
44
|
paymentMethodForm: n,
|
|
45
|
-
errorHandling:
|
|
45
|
+
errorHandling: m,
|
|
46
46
|
LoaderComponent: D
|
|
47
47
|
}) {
|
|
48
|
-
const { paymentMethod: A, bankAccounts:
|
|
48
|
+
const { paymentMethod: A, bankAccounts: c } = r.data, { deletePendingBankAccountUuid: B } = r.status, { t } = V("Employee.PaymentMethod"), s = J(), L = X(A.splitBy === "Amount" ? "currency" : "percent"), T = I(), { Fields: P } = n.form, h = v({
|
|
49
49
|
control: n.form.hookFormInternals.formMethods.control,
|
|
50
50
|
name: "type"
|
|
51
51
|
}), {
|
|
52
52
|
pendingDeleteAccount: g,
|
|
53
53
|
setPendingDeleteAccount: E,
|
|
54
|
-
deletedAccountNumber:
|
|
54
|
+
deletedAccountNumber: b,
|
|
55
55
|
setDeletedAccountNumber: N,
|
|
56
56
|
handleConfirmDelete: _
|
|
57
|
-
} =
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
}), { ...M } =
|
|
61
|
-
data:
|
|
57
|
+
} = R(async (o) => {
|
|
58
|
+
const d = await r.actions.onDelete(o);
|
|
59
|
+
d && i(a.EMPLOYEE_BANK_ACCOUNT_DELETED, d.data);
|
|
60
|
+
}), { ...M } = et({
|
|
61
|
+
data: c,
|
|
62
62
|
columns: [
|
|
63
63
|
{ key: "name", title: t("nicknameColumn") },
|
|
64
64
|
{ key: "routingNumber", title: t("routingNumberColumn") },
|
|
@@ -68,8 +68,8 @@ function it({
|
|
|
68
68
|
title: t("allocationColumn"),
|
|
69
69
|
justify: "end",
|
|
70
70
|
render: (o) => {
|
|
71
|
-
const
|
|
72
|
-
return L(
|
|
71
|
+
const d = A.splits?.find((x) => x.uuid === o.uuid)?.splitAmount ?? 0, F = A.splitBy === Z.amount ? Q(d) ?? 0 : d;
|
|
72
|
+
return L(F);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
],
|
|
@@ -85,66 +85,57 @@ function it({
|
|
|
85
85
|
hiddenAccountNumber: o.hiddenAccountNumber
|
|
86
86
|
});
|
|
87
87
|
},
|
|
88
|
-
icon: /* @__PURE__ */ e(
|
|
88
|
+
icon: /* @__PURE__ */ e($, { "aria-hidden": !0 })
|
|
89
89
|
}
|
|
90
90
|
],
|
|
91
91
|
triggerLabel: t("hamburgerTitle")
|
|
92
92
|
}
|
|
93
93
|
)
|
|
94
|
-
}), O = (
|
|
95
|
-
c.RadioGroup,
|
|
96
|
-
{
|
|
97
|
-
...o,
|
|
98
|
-
options: o.options.map((r) => ({
|
|
99
|
-
...r,
|
|
100
|
-
description: r.value === u.directDeposit ? t(f ? "directDepositDescription" : "directDepositDescriptionSelf") : t(f ? "checkDescription" : "checkDescriptionSelf")
|
|
101
|
-
}))
|
|
102
|
-
}
|
|
103
|
-
), w = async () => {
|
|
94
|
+
}), O = async () => {
|
|
104
95
|
const o = await n.actions.onSubmit();
|
|
105
|
-
o && (i(
|
|
106
|
-
},
|
|
107
|
-
|
|
108
|
-
|
|
96
|
+
o && (i(a.EMPLOYEE_PAYMENT_METHOD_UPDATED, o.data), i(a.EMPLOYEE_PAYMENT_METHOD_DONE));
|
|
97
|
+
}, w = h === l.directDeposit && c.length === 0, S = h === l.check || c.length > 0, Y = h === l.directDeposit && c.length > 0 ? /* @__PURE__ */ p(C, { children: [
|
|
98
|
+
c.length > 1 && /* @__PURE__ */ e(
|
|
99
|
+
s.Button,
|
|
109
100
|
{
|
|
110
101
|
variant: "secondary",
|
|
111
102
|
type: "button",
|
|
112
103
|
onClick: () => {
|
|
113
|
-
i(
|
|
104
|
+
i(a.EMPLOYEE_SPLIT_PAYMENT);
|
|
114
105
|
},
|
|
115
106
|
children: t("splitCta")
|
|
116
107
|
}
|
|
117
108
|
),
|
|
118
109
|
/* @__PURE__ */ e(
|
|
119
|
-
|
|
110
|
+
s.Button,
|
|
120
111
|
{
|
|
121
112
|
variant: "secondary",
|
|
122
113
|
type: "button",
|
|
123
114
|
onClick: () => {
|
|
124
|
-
i(
|
|
115
|
+
i(a.EMPLOYEE_BANK_ACCOUNT_CREATE);
|
|
125
116
|
},
|
|
126
117
|
children: t("addAnotherCta")
|
|
127
118
|
}
|
|
128
119
|
)
|
|
129
120
|
] }) : void 0;
|
|
130
|
-
return /* @__PURE__ */ p(
|
|
131
|
-
/* @__PURE__ */ e(k, { error:
|
|
132
|
-
|
|
133
|
-
|
|
121
|
+
return /* @__PURE__ */ p(H, { children: [
|
|
122
|
+
/* @__PURE__ */ e(k, { error: m.errors, LoaderComponent: D, children: /* @__PURE__ */ p(z, { formHookResult: n, children: [
|
|
123
|
+
b !== null && /* @__PURE__ */ e(
|
|
124
|
+
s.Alert,
|
|
134
125
|
{
|
|
135
126
|
status: "success",
|
|
136
|
-
label: t("deleteBankAccountSuccessAlert", { account:
|
|
127
|
+
label: t("deleteBankAccountSuccessAlert", { account: b }),
|
|
137
128
|
onDismiss: () => {
|
|
138
129
|
N(null);
|
|
139
130
|
},
|
|
140
131
|
disableScrollIntoView: !0
|
|
141
132
|
}
|
|
142
133
|
),
|
|
143
|
-
/* @__PURE__ */ p(
|
|
134
|
+
/* @__PURE__ */ p(W, { flexDirection: "column", gap: 20, children: [
|
|
144
135
|
/* @__PURE__ */ p(
|
|
145
|
-
|
|
136
|
+
s.FormBox,
|
|
146
137
|
{
|
|
147
|
-
header: /* @__PURE__ */ e(
|
|
138
|
+
header: /* @__PURE__ */ e(s.FormBoxHeader, { title: t("title") }),
|
|
148
139
|
withPadding: !1,
|
|
149
140
|
footer: Y,
|
|
150
141
|
children: [
|
|
@@ -152,31 +143,31 @@ function it({
|
|
|
152
143
|
P.Type,
|
|
153
144
|
{
|
|
154
145
|
label: t("paymentFieldsetLegend"),
|
|
155
|
-
getOptionLabel: (o) => o ===
|
|
156
|
-
|
|
146
|
+
getOptionLabel: (o) => o === l.directDeposit ? t("directDepositLabel") : t("checkLabel"),
|
|
147
|
+
getOptionDescription: (o) => o === l.directDeposit ? t(f ? "directDepositDescription" : "directDepositDescriptionSelf") : t(f ? "checkDescription" : "checkDescriptionSelf")
|
|
157
148
|
}
|
|
158
149
|
) }),
|
|
159
|
-
h ===
|
|
160
|
-
|
|
161
|
-
|
|
150
|
+
h === l.directDeposit && c.length > 0 && /* @__PURE__ */ e(ot, { isWithinBox: !0, label: t("bankAccountsListLabel"), ...M }),
|
|
151
|
+
w && /* @__PURE__ */ e("div", { className: y.section, children: /* @__PURE__ */ e(
|
|
152
|
+
tt,
|
|
162
153
|
{
|
|
163
|
-
employeeId:
|
|
154
|
+
employeeId: u,
|
|
164
155
|
dictionary: T,
|
|
165
156
|
onSaved: (o) => {
|
|
166
|
-
i(
|
|
157
|
+
i(a.EMPLOYEE_BANK_ACCOUNT_CREATED, o);
|
|
167
158
|
}
|
|
168
159
|
}
|
|
169
160
|
) })
|
|
170
161
|
]
|
|
171
162
|
}
|
|
172
163
|
),
|
|
173
|
-
S && /* @__PURE__ */ e(
|
|
174
|
-
|
|
164
|
+
S && /* @__PURE__ */ e(C, { children: /* @__PURE__ */ e(
|
|
165
|
+
s.Button,
|
|
175
166
|
{
|
|
176
167
|
type: "button",
|
|
177
168
|
isLoading: n.status.isPending,
|
|
178
169
|
onClick: () => {
|
|
179
|
-
|
|
170
|
+
O();
|
|
180
171
|
},
|
|
181
172
|
children: t("submitCta")
|
|
182
173
|
}
|
|
@@ -184,7 +175,7 @@ function it({
|
|
|
184
175
|
] })
|
|
185
176
|
] }) }),
|
|
186
177
|
/* @__PURE__ */ e(
|
|
187
|
-
|
|
178
|
+
j,
|
|
188
179
|
{
|
|
189
180
|
pendingDeleteAccount: g,
|
|
190
181
|
isPrimaryActionLoading: B === g?.uuid,
|
|
@@ -205,6 +196,6 @@ function it({
|
|
|
205
196
|
] });
|
|
206
197
|
}
|
|
207
198
|
export {
|
|
208
|
-
|
|
199
|
+
Pt as ListView
|
|
209
200
|
};
|
|
210
201
|
//# sourceMappingURL=ListView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListView.js","sources":["../../../../../src/components/Employee/PaymentMethod/onboarding/ListView.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useWatch } from 'react-hook-form'\nimport {\n usePaymentMethodList,\n type UsePaymentMethodListReady,\n} from '../shared/usePaymentMethodList'\nimport {\n usePaymentMethodForm,\n type PaymentMethodType,\n type UsePaymentMethodFormReady,\n} from '../shared/usePaymentMethodForm'\nimport { useDeleteBankAccount } from '../shared/useDeleteBankAccount'\nimport { DeleteBankAccountDialog } from '../shared/DeleteBankAccountDialog'\nimport { BankFormBody } from '../shared/BankFormBody'\nimport { useOnboardingBankFormDictionary } from './useFormDictionary'\nimport styles from './ListView.module.scss'\nimport { ActionsLayout, DataView, useDataView } from '@/components/Common'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport { BaseLayout } from '@/components/Base/Base'\nimport { SDKFormProvider } from '@/partner-hook-utils/form/SDKFormProvider'\nimport { composeErrorHandler } from '@/partner-hook-utils/composeErrorHandler'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { centsToDollars } from '@/helpers/currencyHelpers'\nimport useNumberFormatter from '@/hooks/useNumberFormatter'\nimport { componentEvents, PAYMENT_METHODS, SPLIT_BY, type EventType } from '@/shared/constants'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport type { LoaderComponentType } from '@/components/Base'\nimport type { RadioGroupProps } from '@/components/Common/UI/RadioGroup/RadioGroupTypes'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\nimport { Flex } from '@/components/Common/Flex/Flex'\n\ninterface ListViewProps {\n employeeId: string\n isAdmin: boolean\n onEvent: OnEventType<EventType, unknown>\n LoaderComponent?: LoaderComponentType\n}\n\n/** @internal */\nexport function ListView({ employeeId, isAdmin, onEvent, LoaderComponent }: ListViewProps) {\n const paymentMethodList = usePaymentMethodList({ employeeId })\n const paymentMethodForm = usePaymentMethodForm({ employeeId })\n\n const errorHandling = composeErrorHandler([paymentMethodList, paymentMethodForm])\n\n if (paymentMethodList.isLoading || paymentMethodForm.isLoading) {\n return <BaseLayout isLoading error={errorHandling.errors} LoaderComponent={LoaderComponent} />\n }\n\n return (\n <ListViewReady\n employeeId={employeeId}\n isAdmin={isAdmin}\n onEvent={onEvent}\n paymentMethodList={paymentMethodList}\n paymentMethodForm={paymentMethodForm}\n errorHandling={errorHandling}\n LoaderComponent={LoaderComponent}\n />\n )\n}\n\ninterface ListViewReadyProps extends ListViewProps {\n paymentMethodList: UsePaymentMethodListReady\n paymentMethodForm: UsePaymentMethodFormReady\n errorHandling: ReturnType<typeof composeErrorHandler>\n}\n\nfunction ListViewReady({\n employeeId,\n isAdmin,\n onEvent,\n paymentMethodList,\n paymentMethodForm,\n errorHandling,\n LoaderComponent,\n}: ListViewReadyProps) {\n const { paymentMethod, bankAccounts } = paymentMethodList.data\n const { deletePendingBankAccountUuid } = paymentMethodList.status\n const { t } = useTranslation('Employee.PaymentMethod')\n const Components = useComponentContext()\n const format = useNumberFormatter(paymentMethod.splitBy === 'Amount' ? 'currency' : 'percent')\n const dictionary = useOnboardingBankFormDictionary()\n\n const { Fields } = paymentMethodForm.form\n const watchedType = useWatch({\n control: paymentMethodForm.form.hookFormInternals.formMethods.control,\n name: 'type',\n })\n\n const {\n pendingDeleteAccount,\n setPendingDeleteAccount,\n deletedAccountNumber,\n setDeletedAccountNumber,\n handleConfirmDelete,\n } = useDeleteBankAccount(async uuid => {\n const result = await paymentMethodList.actions.onDelete(uuid)\n if (result) {\n onEvent(componentEvents.EMPLOYEE_BANK_ACCOUNT_DELETED, result.data)\n }\n })\n\n const { ...dataViewProps } = useDataView({\n data: bankAccounts,\n columns: [\n { key: 'name', title: t('nicknameColumn') },\n { key: 'routingNumber', title: t('routingNumberColumn') },\n { key: 'accountType', title: t('accountTypeColumn') },\n {\n key: 'splitAmount',\n title: t('allocationColumn'),\n justify: 'end',\n render: bankAccount => {\n const splitAmount =\n paymentMethod.splits?.find(split => split.uuid === bankAccount.uuid)?.splitAmount ?? 0\n const displayValue =\n paymentMethod.splitBy === SPLIT_BY.amount\n ? (centsToDollars(splitAmount) ?? 0)\n : splitAmount\n return format(displayValue)\n },\n },\n ],\n itemMenu: bankAccount => (\n <HamburgerMenu\n items={[\n {\n label: t('deleteBankAccountCta'),\n onClick: () => {\n setPendingDeleteAccount({\n uuid: bankAccount.uuid,\n hiddenAccountNumber: bankAccount.hiddenAccountNumber,\n })\n },\n icon: <TrashCanSvg aria-hidden />,\n },\n ]}\n triggerLabel={t('hamburgerTitle')}\n />\n ),\n })\n\n const TypeFieldComponent = (props: RadioGroupProps) => (\n <Components.RadioGroup\n {...props}\n options={props.options.map(option => ({\n ...option,\n description:\n option.value === PAYMENT_METHODS.directDeposit\n ? isAdmin\n ? t('directDepositDescription')\n : t('directDepositDescriptionSelf')\n : isAdmin\n ? t('checkDescription')\n : t('checkDescriptionSelf'),\n }))}\n />\n )\n\n const handleContinue = async () => {\n const result = await paymentMethodForm.actions.onSubmit()\n if (result) {\n onEvent(componentEvents.EMPLOYEE_PAYMENT_METHOD_UPDATED, result.data)\n onEvent(componentEvents.EMPLOYEE_PAYMENT_METHOD_DONE)\n }\n }\n\n const showInlineBankForm =\n watchedType === PAYMENT_METHODS.directDeposit && bankAccounts.length === 0\n const showContinue = watchedType === PAYMENT_METHODS.check || bankAccounts.length > 0\n\n const footer =\n watchedType === PAYMENT_METHODS.directDeposit && bankAccounts.length > 0 ? (\n <ActionsLayout>\n {bankAccounts.length > 1 && (\n <Components.Button\n variant=\"secondary\"\n type=\"button\"\n onClick={() => {\n onEvent(componentEvents.EMPLOYEE_SPLIT_PAYMENT)\n }}\n >\n {t('splitCta')}\n </Components.Button>\n )}\n <Components.Button\n variant=\"secondary\"\n type=\"button\"\n onClick={() => {\n onEvent(componentEvents.EMPLOYEE_BANK_ACCOUNT_CREATE)\n }}\n >\n {t('addAnotherCta')}\n </Components.Button>\n </ActionsLayout>\n ) : undefined\n\n return (\n <>\n <BaseLayout error={errorHandling.errors} LoaderComponent={LoaderComponent}>\n <SDKFormProvider formHookResult={paymentMethodForm}>\n {deletedAccountNumber !== null && (\n <Components.Alert\n status=\"success\"\n label={t('deleteBankAccountSuccessAlert', { account: deletedAccountNumber })}\n onDismiss={() => {\n setDeletedAccountNumber(null)\n }}\n disableScrollIntoView\n />\n )}\n <Flex flexDirection=\"column\" gap={20}>\n <Components.FormBox\n header={<Components.FormBoxHeader title={t('title')} />}\n withPadding={false}\n footer={footer}\n >\n <div className={styles.section}>\n <Fields.Type\n label={t('paymentFieldsetLegend')}\n getOptionLabel={(value: PaymentMethodType) =>\n value === PAYMENT_METHODS.directDeposit\n ? t('directDepositLabel')\n : t('checkLabel')\n }\n FieldComponent={TypeFieldComponent}\n />\n </div>\n {watchedType === PAYMENT_METHODS.directDeposit && bankAccounts.length > 0 && (\n <DataView isWithinBox label={t('bankAccountsListLabel')} {...dataViewProps} />\n )}\n {showInlineBankForm && (\n <div className={styles.section}>\n <BankFormBody\n employeeId={employeeId}\n dictionary={dictionary}\n onSaved={data => {\n onEvent(componentEvents.EMPLOYEE_BANK_ACCOUNT_CREATED, data)\n }}\n />\n </div>\n )}\n </Components.FormBox>\n {showContinue && (\n <ActionsLayout>\n <Components.Button\n type=\"button\"\n isLoading={paymentMethodForm.status.isPending}\n onClick={() => {\n void handleContinue()\n }}\n >\n {t('submitCta')}\n </Components.Button>\n </ActionsLayout>\n )}\n </Flex>\n </SDKFormProvider>\n </BaseLayout>\n <DeleteBankAccountDialog\n pendingDeleteAccount={pendingDeleteAccount}\n isPrimaryActionLoading={deletePendingBankAccountUuid === pendingDeleteAccount?.uuid}\n onClose={() => {\n setPendingDeleteAccount(null)\n }}\n onConfirm={() => {\n void handleConfirmDelete()\n }}\n title={t('deleteBankAccountDialog.title')}\n description={t('deleteBankAccountDialog.description', {\n account: pendingDeleteAccount?.hiddenAccountNumber ?? '',\n })}\n confirmLabel={t('deleteBankAccountDialog.confirmCta')}\n cancelLabel={t('deleteBankAccountDialog.cancelCta')}\n />\n </>\n )\n}\n"],"names":["ListView","employeeId","isAdmin","onEvent","LoaderComponent","paymentMethodList","usePaymentMethodList","paymentMethodForm","usePaymentMethodForm","errorHandling","composeErrorHandler","BaseLayout","jsx","ListViewReady","paymentMethod","bankAccounts","deletePendingBankAccountUuid","useTranslation","Components","useComponentContext","format","useNumberFormatter","dictionary","useOnboardingBankFormDictionary","Fields","watchedType","useWatch","pendingDeleteAccount","setPendingDeleteAccount","deletedAccountNumber","setDeletedAccountNumber","handleConfirmDelete","useDeleteBankAccount","uuid","result","componentEvents","dataViewProps","useDataView","bankAccount","splitAmount","split","displayValue","SPLIT_BY","centsToDollars","HamburgerMenu","TrashCanSvg","TypeFieldComponent","props","option","PAYMENT_METHODS","handleContinue","showInlineBankForm","showContinue","footer","ActionsLayout","jsxs","Fragment","SDKFormProvider","Flex","styles","value","DataView","BankFormBody","data","DeleteBankAccountDialog"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuCO,SAASA,GAAS,EAAE,YAAAC,GAAY,SAAAC,GAAS,SAAAC,GAAS,iBAAAC,KAAkC;AACzF,QAAMC,IAAoBC,EAAqB,EAAE,YAAAL,GAAY,GACvDM,IAAoBC,EAAqB,EAAE,YAAAP,GAAY,GAEvDQ,IAAgBC,EAAoB,CAACL,GAAmBE,CAAiB,CAAC;AAEhF,SAAIF,EAAkB,aAAaE,EAAkB,8BAC3CI,GAAA,EAAW,WAAS,IAAC,OAAOF,EAAc,QAAQ,iBAAAL,GAAkC,IAI5F,gBAAAQ;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,YAAAZ;AAAA,MACA,SAAAC;AAAA,MACA,SAAAC;AAAA,MACA,mBAAAE;AAAA,MACA,mBAAAE;AAAA,MACA,eAAAE;AAAA,MACA,iBAAAL;AAAA,IAAA;AAAA,EAAA;AAGN;AAQA,SAASS,GAAc;AAAA,EACrB,YAAAZ;AAAA,EACA,SAAAC;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AAA,QACD,cAAc,EAAE,oCAAoC;AAAA,QACpD,aAAa,EAAE,mCAAmC;AAAA,MAAA;AAAA,IAAA;AAAA,EACpD,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"ListView.js","sources":["../../../../../src/components/Employee/PaymentMethod/onboarding/ListView.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { useWatch } from 'react-hook-form'\nimport {\n usePaymentMethodList,\n type UsePaymentMethodListReady,\n} from '../shared/usePaymentMethodList'\nimport {\n usePaymentMethodForm,\n type PaymentMethodType,\n type UsePaymentMethodFormReady,\n} from '../shared/usePaymentMethodForm'\nimport { useDeleteBankAccount } from '../shared/useDeleteBankAccount'\nimport { DeleteBankAccountDialog } from '../shared/DeleteBankAccountDialog'\nimport { BankFormBody } from '../shared/BankFormBody'\nimport { useOnboardingBankFormDictionary } from './useFormDictionary'\nimport styles from './ListView.module.scss'\nimport { ActionsLayout, DataView, useDataView } from '@/components/Common'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport { BaseLayout } from '@/components/Base/Base'\nimport { SDKFormProvider } from '@/partner-hook-utils/form/SDKFormProvider'\nimport { composeErrorHandler } from '@/partner-hook-utils/composeErrorHandler'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { centsToDollars } from '@/helpers/currencyHelpers'\nimport useNumberFormatter from '@/hooks/useNumberFormatter'\nimport { componentEvents, PAYMENT_METHODS, SPLIT_BY, type EventType } from '@/shared/constants'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport type { LoaderComponentType } from '@/components/Base'\nimport TrashCanSvg from '@/assets/icons/trashcan.svg?react'\nimport { Flex } from '@/components/Common/Flex/Flex'\n\ninterface ListViewProps {\n employeeId: string\n isAdmin: boolean\n onEvent: OnEventType<EventType, unknown>\n LoaderComponent?: LoaderComponentType\n}\n\n/** @internal */\nexport function ListView({ employeeId, isAdmin, onEvent, LoaderComponent }: ListViewProps) {\n const paymentMethodList = usePaymentMethodList({ employeeId })\n const paymentMethodForm = usePaymentMethodForm({ employeeId })\n\n const errorHandling = composeErrorHandler([paymentMethodList, paymentMethodForm])\n\n if (paymentMethodList.isLoading || paymentMethodForm.isLoading) {\n return <BaseLayout isLoading error={errorHandling.errors} LoaderComponent={LoaderComponent} />\n }\n\n return (\n <ListViewReady\n employeeId={employeeId}\n isAdmin={isAdmin}\n onEvent={onEvent}\n paymentMethodList={paymentMethodList}\n paymentMethodForm={paymentMethodForm}\n errorHandling={errorHandling}\n LoaderComponent={LoaderComponent}\n />\n )\n}\n\ninterface ListViewReadyProps extends ListViewProps {\n paymentMethodList: UsePaymentMethodListReady\n paymentMethodForm: UsePaymentMethodFormReady\n errorHandling: ReturnType<typeof composeErrorHandler>\n}\n\nfunction ListViewReady({\n employeeId,\n isAdmin,\n onEvent,\n paymentMethodList,\n paymentMethodForm,\n errorHandling,\n LoaderComponent,\n}: ListViewReadyProps) {\n const { paymentMethod, bankAccounts } = paymentMethodList.data\n const { deletePendingBankAccountUuid } = paymentMethodList.status\n const { t } = useTranslation('Employee.PaymentMethod')\n const Components = useComponentContext()\n const format = useNumberFormatter(paymentMethod.splitBy === 'Amount' ? 'currency' : 'percent')\n const dictionary = useOnboardingBankFormDictionary()\n\n const { Fields } = paymentMethodForm.form\n const watchedType = useWatch({\n control: paymentMethodForm.form.hookFormInternals.formMethods.control,\n name: 'type',\n })\n\n const {\n pendingDeleteAccount,\n setPendingDeleteAccount,\n deletedAccountNumber,\n setDeletedAccountNumber,\n handleConfirmDelete,\n } = useDeleteBankAccount(async uuid => {\n const result = await paymentMethodList.actions.onDelete(uuid)\n if (result) {\n onEvent(componentEvents.EMPLOYEE_BANK_ACCOUNT_DELETED, result.data)\n }\n })\n\n const { ...dataViewProps } = useDataView({\n data: bankAccounts,\n columns: [\n { key: 'name', title: t('nicknameColumn') },\n { key: 'routingNumber', title: t('routingNumberColumn') },\n { key: 'accountType', title: t('accountTypeColumn') },\n {\n key: 'splitAmount',\n title: t('allocationColumn'),\n justify: 'end',\n render: bankAccount => {\n const splitAmount =\n paymentMethod.splits?.find(split => split.uuid === bankAccount.uuid)?.splitAmount ?? 0\n const displayValue =\n paymentMethod.splitBy === SPLIT_BY.amount\n ? (centsToDollars(splitAmount) ?? 0)\n : splitAmount\n return format(displayValue)\n },\n },\n ],\n itemMenu: bankAccount => (\n <HamburgerMenu\n items={[\n {\n label: t('deleteBankAccountCta'),\n onClick: () => {\n setPendingDeleteAccount({\n uuid: bankAccount.uuid,\n hiddenAccountNumber: bankAccount.hiddenAccountNumber,\n })\n },\n icon: <TrashCanSvg aria-hidden />,\n },\n ]}\n triggerLabel={t('hamburgerTitle')}\n />\n ),\n })\n\n const handleContinue = async () => {\n const result = await paymentMethodForm.actions.onSubmit()\n if (result) {\n onEvent(componentEvents.EMPLOYEE_PAYMENT_METHOD_UPDATED, result.data)\n onEvent(componentEvents.EMPLOYEE_PAYMENT_METHOD_DONE)\n }\n }\n\n const showInlineBankForm =\n watchedType === PAYMENT_METHODS.directDeposit && bankAccounts.length === 0\n const showContinue = watchedType === PAYMENT_METHODS.check || bankAccounts.length > 0\n\n const footer =\n watchedType === PAYMENT_METHODS.directDeposit && bankAccounts.length > 0 ? (\n <ActionsLayout>\n {bankAccounts.length > 1 && (\n <Components.Button\n variant=\"secondary\"\n type=\"button\"\n onClick={() => {\n onEvent(componentEvents.EMPLOYEE_SPLIT_PAYMENT)\n }}\n >\n {t('splitCta')}\n </Components.Button>\n )}\n <Components.Button\n variant=\"secondary\"\n type=\"button\"\n onClick={() => {\n onEvent(componentEvents.EMPLOYEE_BANK_ACCOUNT_CREATE)\n }}\n >\n {t('addAnotherCta')}\n </Components.Button>\n </ActionsLayout>\n ) : undefined\n\n return (\n <>\n <BaseLayout error={errorHandling.errors} LoaderComponent={LoaderComponent}>\n <SDKFormProvider formHookResult={paymentMethodForm}>\n {deletedAccountNumber !== null && (\n <Components.Alert\n status=\"success\"\n label={t('deleteBankAccountSuccessAlert', { account: deletedAccountNumber })}\n onDismiss={() => {\n setDeletedAccountNumber(null)\n }}\n disableScrollIntoView\n />\n )}\n <Flex flexDirection=\"column\" gap={20}>\n <Components.FormBox\n header={<Components.FormBoxHeader title={t('title')} />}\n withPadding={false}\n footer={footer}\n >\n <div className={styles.section}>\n <Fields.Type\n label={t('paymentFieldsetLegend')}\n getOptionLabel={(value: PaymentMethodType) =>\n value === PAYMENT_METHODS.directDeposit\n ? t('directDepositLabel')\n : t('checkLabel')\n }\n getOptionDescription={(value: PaymentMethodType) =>\n value === PAYMENT_METHODS.directDeposit\n ? isAdmin\n ? t('directDepositDescription')\n : t('directDepositDescriptionSelf')\n : isAdmin\n ? t('checkDescription')\n : t('checkDescriptionSelf')\n }\n />\n </div>\n {watchedType === PAYMENT_METHODS.directDeposit && bankAccounts.length > 0 && (\n <DataView isWithinBox label={t('bankAccountsListLabel')} {...dataViewProps} />\n )}\n {showInlineBankForm && (\n <div className={styles.section}>\n <BankFormBody\n employeeId={employeeId}\n dictionary={dictionary}\n onSaved={data => {\n onEvent(componentEvents.EMPLOYEE_BANK_ACCOUNT_CREATED, data)\n }}\n />\n </div>\n )}\n </Components.FormBox>\n {showContinue && (\n <ActionsLayout>\n <Components.Button\n type=\"button\"\n isLoading={paymentMethodForm.status.isPending}\n onClick={() => {\n void handleContinue()\n }}\n >\n {t('submitCta')}\n </Components.Button>\n </ActionsLayout>\n )}\n </Flex>\n </SDKFormProvider>\n </BaseLayout>\n <DeleteBankAccountDialog\n pendingDeleteAccount={pendingDeleteAccount}\n isPrimaryActionLoading={deletePendingBankAccountUuid === pendingDeleteAccount?.uuid}\n onClose={() => {\n setPendingDeleteAccount(null)\n }}\n onConfirm={() => {\n void handleConfirmDelete()\n }}\n title={t('deleteBankAccountDialog.title')}\n description={t('deleteBankAccountDialog.description', {\n account: pendingDeleteAccount?.hiddenAccountNumber ?? '',\n })}\n confirmLabel={t('deleteBankAccountDialog.confirmCta')}\n cancelLabel={t('deleteBankAccountDialog.cancelCta')}\n />\n </>\n )\n}\n"],"names":["ListView","employeeId","isAdmin","onEvent","LoaderComponent","paymentMethodList","usePaymentMethodList","paymentMethodForm","usePaymentMethodForm","errorHandling","composeErrorHandler","BaseLayout","jsx","ListViewReady","paymentMethod","bankAccounts","deletePendingBankAccountUuid","useTranslation","Components","useComponentContext","format","useNumberFormatter","dictionary","useOnboardingBankFormDictionary","Fields","watchedType","useWatch","pendingDeleteAccount","setPendingDeleteAccount","deletedAccountNumber","setDeletedAccountNumber","handleConfirmDelete","useDeleteBankAccount","uuid","result","componentEvents","dataViewProps","useDataView","bankAccount","splitAmount","split","displayValue","SPLIT_BY","centsToDollars","HamburgerMenu","TrashCanSvg","handleContinue","showInlineBankForm","PAYMENT_METHODS","showContinue","footer","ActionsLayout","jsxs","Fragment","SDKFormProvider","Flex","styles","value","DataView","BankFormBody","data","DeleteBankAccountDialog"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsCO,SAASA,GAAS,EAAE,YAAAC,GAAY,SAAAC,GAAS,SAAAC,GAAS,iBAAAC,KAAkC;AACzF,QAAMC,IAAoBC,EAAqB,EAAE,YAAAL,GAAY,GACvDM,IAAoBC,EAAqB,EAAE,YAAAP,GAAY,GAEvDQ,IAAgBC,EAAoB,CAACL,GAAmBE,CAAiB,CAAC;AAEhF,SAAIF,EAAkB,aAAaE,EAAkB,8BAC3CI,GAAA,EAAW,WAAS,IAAC,OAAOF,EAAc,QAAQ,iBAAAL,GAAkC,IAI5F,gBAAAQ;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,YAAAZ;AAAA,MACA,SAAAC;AAAA,MACA,SAAAC;AAAA,MACA,mBAAAE;AAAA,MACA,mBAAAE;AAAA,MACA,eAAAE;AAAA,MACA,iBAAAL;AAAA,IAAA;AAAA,EAAA;AAGN;AAQA,SAASS,GAAc;AAAA,EACrB,YAAAZ;AAAA,EACA,SAAAC;AAAA,EACA,SAAAC;AAAA,EACA,mBAAAE;AAAA,EACA,mBAAAE;AAAA,EACA,eAAAE;AAAA,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KACC,gBAAAnC,EAAC,OAAA,EAAI,WAAW4C,EAAO,SACrB,UAAA,gBAAA5C;AAAA,gBAAC+C;AAAA,gBAAA;AAAA,kBACC,YAAA1D;AAAA,kBACA,YAAAqB;AAAA,kBACA,SAAS,CAAAsC,MAAQ;AACf,oBAAAzD,EAAQgC,EAAgB,+BAA+ByB,CAAI;AAAA,kBAC7D;AAAA,gBAAA;AAAA,cAAA,EACF,CACF;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,QAGHX,uBACEE,GAAA,EACC,UAAA,gBAAAvC;AAAA,UAACM,EAAW;AAAA,UAAX;AAAA,YACC,MAAK;AAAA,YACL,WAAWX,EAAkB,OAAO;AAAA,YACpC,SAAS,MAAM;AACb,cAAKuC,EAAA;AAAA,YACP;AAAA,YAEC,YAAE,WAAW;AAAA,UAAA;AAAA,QAAA,EAChB,CACF;AAAA,MAAA,EAAA,CAEJ;AAAA,IAAA,EAAA,CACF,EAAA,CACF;AAAA,IACA,gBAAAlC;AAAA,MAACiD;AAAA,MAAA;AAAA,QACC,sBAAAlC;AAAA,QACA,wBAAwBX,MAAiCW,GAAsB;AAAA,QAC/E,SAAS,MAAM;AACb,UAAAC,EAAwB,IAAI;AAAA,QAC9B;AAAA,QACA,WAAW,MAAM;AACf,UAAKG,EAAA;AAAA,QACP;AAAA,QACA,OAAO,EAAE,+BAA+B;AAAA,QACxC,aAAa,EAAE,uCAAuC;AAAA,UACpD,SAASJ,GAAsB,uBAAuB;AAAA,QAAA,CACvD;AAAA,QACD,cAAc,EAAE,oCAAoC;AAAA,QACpD,aAAa,EAAE,mCAAmC;AAAA,MAAA;AAAA,IAAA;AAAA,EACpD,GACF;AAEJ;"}
|
package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.js
CHANGED
|
@@ -2,20 +2,20 @@ import { jsx as d } from "react/jsx-runtime";
|
|
|
2
2
|
import { useEffect as O, useMemo as y, useState as b } from "react";
|
|
3
3
|
import { usePaySchedulesGetUnprocessedTerminationPeriodsSuspense as g } from "@gusto/embedded-api/react-query/paySchedulesGetUnprocessedTerminationPeriods";
|
|
4
4
|
import { usePayrollsCreateOffCycleMutation as T } from "@gusto/embedded-api/react-query/payrollsCreateOffCycle";
|
|
5
|
-
import { OffCycleReason as
|
|
5
|
+
import { OffCycleReason as $ } from "@gusto/embedded-api/models/operations/postv1companiescompanyidpayrolls";
|
|
6
6
|
import { RFCDate as D } from "@gusto/embedded-api/types/rfcdate";
|
|
7
|
-
import { useTranslation as
|
|
8
|
-
import { DismissalPayPeriodSelectionPresentation as
|
|
9
|
-
import { BaseComponent as
|
|
7
|
+
import { useTranslation as K } from "react-i18next";
|
|
8
|
+
import { DismissalPayPeriodSelectionPresentation as L } from "./DismissalPayPeriodSelectionPresentation.js";
|
|
9
|
+
import { BaseComponent as M } from "../../../Base/Base.js";
|
|
10
10
|
import { useBase as q } from "../../../Base/useBase.js";
|
|
11
11
|
import { componentEvents as p } from "../../../../shared/constants.js";
|
|
12
12
|
import { SDKInternalError as u } from "../../../../types/sdkError.js";
|
|
13
13
|
import { useComponentDictionary as x, useI18n as N } from "../../../../i18n/I18n.js";
|
|
14
14
|
import { formatPayPeriodRange as Y } from "../../../../helpers/dateFormatting.js";
|
|
15
15
|
function te(t) {
|
|
16
|
-
return /* @__PURE__ */ d(
|
|
16
|
+
return /* @__PURE__ */ d(M, { ...t, children: /* @__PURE__ */ d(j, { ...t }) });
|
|
17
17
|
}
|
|
18
|
-
const S = (t) => `${t.startDate}__${t.endDate}`;
|
|
18
|
+
const S = (t) => `${t.employeeUuid}__${t.startDate}__${t.endDate}`;
|
|
19
19
|
function j({
|
|
20
20
|
companyId: t,
|
|
21
21
|
employeeId: r,
|
|
@@ -24,7 +24,7 @@ function j({
|
|
|
24
24
|
className: C
|
|
25
25
|
}) {
|
|
26
26
|
x("Payroll.Dismissal", E), N("Payroll.Dismissal");
|
|
27
|
-
const { t: i } =
|
|
27
|
+
const { t: i } = K("Payroll.Dismissal"), { onEvent: l, baseSubmitHandler: U } = q(), { data: f } = g({ companyId: t }), { mutateAsync: w, isPending: _ } = T(), v = !!n && !!r;
|
|
28
28
|
O(() => {
|
|
29
29
|
n && r && l(p.DISMISSAL_PAY_PERIOD_SELECTED, { payrollUuid: n });
|
|
30
30
|
}, [n, r, l]);
|
|
@@ -36,19 +36,19 @@ function j({
|
|
|
36
36
|
value: S(e),
|
|
37
37
|
label: a
|
|
38
38
|
};
|
|
39
|
-
}), [m]),
|
|
40
|
-
await
|
|
39
|
+
}), [m]), h = c.length === 1 ? c[0].value : void 0, [s, B] = b(h), R = async () => {
|
|
40
|
+
await U({ selectedPeriodKey: s }, async () => {
|
|
41
41
|
if (s === void 0)
|
|
42
42
|
throw new u(i("errors.noPayPeriodSelected"));
|
|
43
43
|
const e = m.find((A) => S(A) === s);
|
|
44
44
|
if (!e)
|
|
45
45
|
throw new u(i("errors.invalidPayPeriod"));
|
|
46
|
-
const o = r ?? e.employeeUuid, a = await
|
|
46
|
+
const o = r ?? e.employeeUuid, a = await w({
|
|
47
47
|
request: {
|
|
48
48
|
companyId: t,
|
|
49
49
|
requestBody: {
|
|
50
50
|
offCycle: !0,
|
|
51
|
-
offCycleReason:
|
|
51
|
+
offCycleReason: $.DismissedEmployee,
|
|
52
52
|
startDate: new D(e.startDate),
|
|
53
53
|
endDate: new D(e.endDate),
|
|
54
54
|
employeeUuids: [o]
|
|
@@ -60,14 +60,14 @@ function j({
|
|
|
60
60
|
l(p.DISMISSAL_PAY_PERIOD_SELECTED, { payrollUuid: P });
|
|
61
61
|
});
|
|
62
62
|
};
|
|
63
|
-
return
|
|
64
|
-
|
|
63
|
+
return v ? null : /* @__PURE__ */ d(
|
|
64
|
+
L,
|
|
65
65
|
{
|
|
66
66
|
payPeriodOptions: c,
|
|
67
67
|
selectedPeriodKey: s,
|
|
68
|
-
onSelectPeriod:
|
|
69
|
-
onSubmit:
|
|
70
|
-
isPending:
|
|
68
|
+
onSelectPeriod: B,
|
|
69
|
+
onSubmit: R,
|
|
70
|
+
isPending: _,
|
|
71
71
|
className: C
|
|
72
72
|
}
|
|
73
73
|
);
|