@gusto/embedded-react-sdk 0.57.1 → 0.57.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/components/Base/Base.js +2 -3
- package/dist/components/Base/Base.js.map +1 -1
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +6 -8
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +8 -10
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +3 -6
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +6 -8
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +3 -6
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/TitleSelect.js +10 -11
- package/dist/components/Company/AssignSignatory/TitleSelect.js.map +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +5 -8
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +8 -9
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +3 -6
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js +10 -12
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +11 -13
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +5 -7
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +3 -6
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/FederalTaxes/Actions.js +7 -9
- package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +8 -11
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Actions.js +5 -7
- package/dist/components/Company/Industry/Actions.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +6 -9
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Industry/Edit.js +10 -12
- package/dist/components/Company/Industry/Edit.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Actions.js +8 -10
- package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +3 -6
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/Actions.js +6 -8
- package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/List.js +11 -13
- package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +3 -6
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +3 -6
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/PayScheduleForm.js +66 -62
- package/dist/components/Company/PaySchedule/PayScheduleForm.js.map +1 -1
- package/dist/components/Company/PaySchedule/PayScheduleForm.module.scss.js +2 -2
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignmentComponents.js +80 -68
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignmentComponents.js.map +1 -1
- package/dist/components/Company/PaySchedule/management/PayScheduleCompensationOverviewPresentation.js +11 -13
- package/dist/components/Company/PaySchedule/management/PayScheduleCompensationOverviewPresentation.js.map +1 -1
- package/dist/components/Company/PaySchedule/management/PayScheduleManagementComponents.js +49 -44
- package/dist/components/Company/PaySchedule/management/PayScheduleManagementComponents.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +5 -7
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +3 -6
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +6 -8
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +3 -6
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/TaxRateManagement/context.js +3 -6
- package/dist/components/Company/StateTaxes/TaxRateManagement/context.js.map +1 -1
- package/dist/components/Contractor/Compensation/management/CompensationCard/CompensationCard.js +16 -17
- package/dist/components/Contractor/Compensation/management/CompensationCard/CompensationCard.js.map +1 -1
- package/dist/components/Contractor/Documents/management/DocumentsCard/DocumentsCard.js +8 -9
- package/dist/components/Contractor/Documents/management/DocumentsCard/DocumentsCard.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/shared/ContractorBankAccountFormBody/ContractorBankAccountFormBody.js +6 -8
- package/dist/components/Contractor/PaymentMethod/shared/ContractorBankAccountFormBody/ContractorBankAccountFormBody.js.map +1 -1
- package/dist/components/Contractor/Profile/management/ProfileCard/ProfileCard.js +26 -27
- package/dist/components/Contractor/Profile/management/ProfileCard/ProfileCard.js.map +1 -1
- package/dist/components/Contractor/Profile/management/ProfileEditForm.js +11 -11
- package/dist/components/Employee/Deductions/management/DeductionsCard/DeductionsCard.js +12 -13
- package/dist/components/Employee/Deductions/management/DeductionsCard/DeductionsCard.js.map +1 -1
- package/dist/components/Employee/Documents/management/DocumentsCard/DocumentsCard.js +12 -13
- package/dist/components/Employee/Documents/management/DocumentsCard/DocumentsCard.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/Actions.js +6 -8
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +3 -6
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/management/FederalTaxesEditForm.js +3 -4
- package/dist/components/Employee/FederalTaxes/management/FederalTaxesEditForm.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/onboarding/FederalTaxes.js +3 -4
- package/dist/components/Employee/FederalTaxes/onboarding/FederalTaxes.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/shared/BankFormBody/BankFormBody.js +22 -24
- package/dist/components/Employee/PaymentMethod/shared/BankFormBody/BankFormBody.js.map +1 -1
- package/dist/components/Employee/Paystubs/management/PaystubsCard/PaystubsCard.js +8 -9
- package/dist/components/Employee/Paystubs/management/PaystubsCard/PaystubsCard.js.map +1 -1
- package/dist/components/Employee/Profile/management/ProfileCard/ProfileCard.js +14 -15
- package/dist/components/Employee/Profile/management/ProfileCard/ProfileCard.js.map +1 -1
- package/dist/components/Employee/Profile/management/ProfileEditForm.js +1 -1
- package/dist/components/Employee/Profile/onboarding/EmployeeProfile.js +1 -1
- package/dist/components/Employee/StateTaxes/management/StateTaxesEditForm.js +7 -8
- package/dist/components/Employee/StateTaxes/management/StateTaxesEditForm.js.map +1 -1
- package/dist/components/Employee/StateTaxes/onboarding/StateTaxes.js +7 -8
- package/dist/components/Employee/StateTaxes/onboarding/StateTaxes.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js +56 -54
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -1
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js +14 -16
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js.map +1 -1
- package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js +6 -8
- package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js.map +1 -1
- package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js +9 -11
- package/dist/components/Payroll/OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +74 -88
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +44 -46
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
- package/dist/components/Payroll/TransitionCreation/TransitionCreation.js +63 -61
- package/dist/components/Payroll/TransitionCreation/TransitionCreation.js.map +1 -1
- package/dist/components/Payroll/TransitionPayroll/useResolveTransitionPayroll.js +14 -13
- package/dist/components/Payroll/TransitionPayroll/useResolveTransitionPayroll.js.map +1 -1
- package/dist/components/Payroll/helpers.js +52 -48
- package/dist/components/Payroll/helpers.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +13 -16
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/components/Payroll/useUnprocessedTransitionPayPeriods.js +2 -2
- package/dist/components/Payroll/useUnprocessedTransitionPayPeriods.js.map +1 -1
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetailPresentation.js +2 -4
- package/dist/components/TimeOff/HolidayPolicyDetail/HolidayPolicyDetailPresentation.js.map +1 -1
- package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.js +6 -8
- package/dist/components/TimeOff/shared/EmployeeTable/EmployeeTable.js.map +1 -1
- package/dist/components/TimeOff/shared/PolicyDetailLayout/PolicyDetailLayout.js +28 -30
- package/dist/components/TimeOff/shared/PolicyDetailLayout/PolicyDetailLayout.js.map +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +2 -4
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/helpers/dateFormatting.js +47 -40
- package/dist/helpers/dateFormatting.js.map +1 -1
- package/dist/i18n/en/Company.Management.PaySchedule.json.js +20 -18
- package/dist/i18n/en/Company.Management.PaySchedule.json.js.map +1 -1
- package/dist/i18n/en/Company.Management.PayScheduleAssignment.json.js +6 -4
- package/dist/i18n/en/Company.Management.PayScheduleAssignment.json.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollHistory.json.js +5 -5
- package/dist/i18n/en/Payroll.PayrollOverview.json.js +1 -1
- package/dist/package.json.js +1 -1
- package/dist/partner-hook-utils/form/fields/CheckboxHookField.js +8 -10
- package/dist/partner-hook-utils/form/fields/CheckboxHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/NumberInputHookField.js +12 -14
- package/dist/partner-hook-utils/form/fields/NumberInputHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/RadioGroupHookField.js +13 -15
- package/dist/partner-hook-utils/form/fields/RadioGroupHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/SelectHookField.js +10 -12
- package/dist/partner-hook-utils/form/fields/SelectHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/SwitchHookField.js +14 -16
- package/dist/partner-hook-utils/form/fields/SwitchHookField.js.map +1 -1
- package/dist/partner-hook-utils/form/fields/TextInputHookField.js +8 -10
- package/dist/partner-hook-utils/form/fields/TextInputHookField.js.map +1 -1
- package/dist/src/components/Company/PaySchedule/PayScheduleForm.d.ts +6 -0
- package/dist/src/components/Payroll/helpers.d.ts +20 -0
- package/dist/src/helpers/dateFormatting.d.ts +13 -0
- package/dist/src/i18n/types.d.ts +14 -2
- package/dist/style.css +1 -1
- package/package.json +7 -7
|
@@ -6,12 +6,12 @@ import { useEmployeeDetailsForm as h } from "../shared/useEmployeeDetailsForm/us
|
|
|
6
6
|
import v from "./Profile.module.scss.js";
|
|
7
7
|
import { BaseBoundaries as L, BaseLayout as c } from "../../../Base/Base.js";
|
|
8
8
|
import "../../../Base/useBase.js";
|
|
9
|
-
import { componentEvents as E } from "../../../../shared/constants.js";
|
|
10
9
|
import { Grid as A } from "../../../Common/Grid/Grid.js";
|
|
11
10
|
import { ActionsLayout as R } from "../../../Common/ActionsLayout/ActionsLayout.js";
|
|
12
11
|
import { Form as y } from "../../../Common/Form/Form.js";
|
|
13
12
|
import { SDKFormProvider as P } from "../../../../partner-hook-utils/form/SDKFormProvider.js";
|
|
14
13
|
import { useI18n as F, useComponentDictionary as S } from "../../../../i18n/I18n.js";
|
|
14
|
+
import { componentEvents as E } from "../../../../shared/constants.js";
|
|
15
15
|
import { useComponentContext as _ } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
16
16
|
function J({
|
|
17
17
|
FallbackComponent: t,
|
|
@@ -10,12 +10,12 @@ import { SDKFormProvider as L } from "../../../../partner-hook-utils/form/SDKFor
|
|
|
10
10
|
import { composeSubmitHandler as z } from "../../../../partner-hook-utils/form/composeSubmitHandler.js";
|
|
11
11
|
import { composeErrorHandler as S } from "../../../../partner-hook-utils/composeErrorHandler.js";
|
|
12
12
|
import { Grid as A } from "../../../Common/Grid/Grid.js";
|
|
13
|
-
import { componentEvents as p } from "../../../../shared/constants.js";
|
|
14
13
|
import { ActionsLayout as B } from "../../../Common/ActionsLayout/ActionsLayout.js";
|
|
15
14
|
import { Form as Y } from "../../../Common/Form/Form.js";
|
|
16
15
|
import { BaseLayout as N } from "../../../Base/Base.js";
|
|
17
16
|
import "../../../Base/useBase.js";
|
|
18
17
|
import { useI18n as H, useComponentDictionary as W } from "../../../../i18n/I18n.js";
|
|
18
|
+
import { componentEvents as p } from "../../../../shared/constants.js";
|
|
19
19
|
import { useComponentContext as Z } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
20
20
|
import { getStreet as j, getCityStateZip as q } from "../../../../helpers/formattedStrings.js";
|
|
21
21
|
const G = {
|
|
@@ -4,13 +4,12 @@ import { EmployeeStateTaxesView as x } from "../shared/EmployeeStateTaxesView.js
|
|
|
4
4
|
import { useManagementStateTaxesViewDictionary as y } from "./useViewDictionary.js";
|
|
5
5
|
import { BaseBoundaries as d, BaseLayout as f } from "../../../Base/Base.js";
|
|
6
6
|
import "../../../Base/useBase.js";
|
|
7
|
-
import "classnames";
|
|
8
|
-
import { componentEvents as E } from "../../../../shared/constants.js";
|
|
9
7
|
import { ActionsLayout as g } from "../../../Common/ActionsLayout/ActionsLayout.js";
|
|
10
8
|
import { useI18n as A, useComponentDictionary as M } from "../../../../i18n/I18n.js";
|
|
9
|
+
import { componentEvents as E } from "../../../../shared/constants.js";
|
|
11
10
|
import { useComponentContext as _ } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
12
11
|
import { useEmployeeStateTaxesForm as C } from "../shared/useEmployeeStateTaxesForm/useEmployeeStateTaxesForm.js";
|
|
13
|
-
function
|
|
12
|
+
function I({
|
|
14
13
|
FallbackComponent: a,
|
|
15
14
|
LoaderComponent: o,
|
|
16
15
|
...n
|
|
@@ -33,7 +32,7 @@ function L({
|
|
|
33
32
|
LoaderComponent: i
|
|
34
33
|
}) {
|
|
35
34
|
A("Employee.Management.StateTaxes"), M("Employee.Management.StateTaxes", n);
|
|
36
|
-
const { t: s } = S("Employee.Management.StateTaxes"), m = _(), e = C({ employeeId: a }),
|
|
35
|
+
const { t: s } = S("Employee.Management.StateTaxes"), m = _(), e = C({ employeeId: a }), u = y();
|
|
37
36
|
if (e.isLoading)
|
|
38
37
|
return /* @__PURE__ */ t(
|
|
39
38
|
f,
|
|
@@ -43,7 +42,7 @@ function L({
|
|
|
43
42
|
LoaderComponent: i
|
|
44
43
|
}
|
|
45
44
|
);
|
|
46
|
-
const
|
|
45
|
+
const p = async () => {
|
|
47
46
|
const c = await e.actions.onSubmit();
|
|
48
47
|
c && r(E.EMPLOYEE_MANAGEMENT_STATE_TAXES_UPDATED, {
|
|
49
48
|
employeeStateTaxesList: c.data
|
|
@@ -55,18 +54,18 @@ function L({
|
|
|
55
54
|
x,
|
|
56
55
|
{
|
|
57
56
|
stateTaxes: e,
|
|
58
|
-
onSubmit:
|
|
57
|
+
onSubmit: p,
|
|
59
58
|
actions: /* @__PURE__ */ l(g, { children: [
|
|
60
59
|
/* @__PURE__ */ t(m.Button, { variant: "secondary", onClick: T, children: s("cancelCta") }),
|
|
61
60
|
/* @__PURE__ */ t(m.Button, { type: "submit", isLoading: e.status.isPending, children: s("saveCta") })
|
|
62
61
|
] }),
|
|
63
62
|
className: o,
|
|
64
|
-
dictionary:
|
|
63
|
+
dictionary: u,
|
|
65
64
|
LoaderComponent: i
|
|
66
65
|
}
|
|
67
66
|
);
|
|
68
67
|
}
|
|
69
68
|
export {
|
|
70
|
-
|
|
69
|
+
I as StateTaxesEditForm
|
|
71
70
|
};
|
|
72
71
|
//# sourceMappingURL=StateTaxesEditForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StateTaxesEditForm.js","sources":["../../../../../src/components/Employee/StateTaxes/management/StateTaxesEditForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { EmployeeStateTaxesView, useEmployeeStateTaxesForm } from '../shared'\nimport { useManagementStateTaxesViewDictionary } from './useViewDictionary'\nimport { BaseBoundaries, BaseLayout, type BaseComponentInterface } from '@/components/Base'\nimport { ActionsLayout } from '@/components/Common'\nimport { useI18n, useComponentDictionary } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\n/**\n * Props for {@link StateTaxesEditForm}.\n *\n * @public\n */\nexport interface StateTaxesEditFormProps extends BaseComponentInterface<'Employee.Management.StateTaxes'> {\n /** The associated employee identifier. */\n employeeId: string\n}\n\n/**\n * Standalone edit screen for the state-tax management flow. Renders the shared\n * state-tax form against the `Employee.Management.StateTaxes` namespace and\n * emits scoped management events on submit and cancel, so partner copy\n * overrides on the management namespace do not leak into the onboarding flow.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `employee/management/stateTaxes/updated` | Form was submitted successfully | `{ employeeStateTaxesList: EmployeeStateTaxesList[] }` |\n * | `employee/management/stateTaxes/editCancelled` | Cancel button was clicked | — |\n *\n * @param props - The component props.\n * @public\n */\nexport function StateTaxesEditForm({\n FallbackComponent,\n LoaderComponent,\n ...props\n}: StateTaxesEditFormProps) {\n return (\n <BaseBoundaries\n componentName=\"Employee.Management.StateTaxes\"\n FallbackComponent={FallbackComponent}\n LoaderComponent={LoaderComponent}\n >\n <StateTaxesEditFormRoot LoaderComponent={LoaderComponent} {...props} />\n </BaseBoundaries>\n )\n}\n\nfunction StateTaxesEditFormRoot({\n employeeId,\n className,\n dictionary,\n onEvent,\n LoaderComponent,\n}: StateTaxesEditFormProps) {\n useI18n('Employee.Management.StateTaxes')\n useComponentDictionary('Employee.Management.StateTaxes', dictionary)\n const { t } = useTranslation('Employee.Management.StateTaxes')\n const Components = useComponentContext()\n\n const stateTaxes = useEmployeeStateTaxesForm({ employeeId })\n const managementStateTaxesDictionary = useManagementStateTaxesViewDictionary()\n\n if (stateTaxes.isLoading) {\n return (\n <BaseLayout\n isLoading\n error={stateTaxes.errorHandling.errors}\n LoaderComponent={LoaderComponent}\n />\n )\n }\n\n const handleSubmit = async () => {\n const result = await stateTaxes.actions.onSubmit()\n if (!result) return\n\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_STATE_TAXES_UPDATED, {\n employeeStateTaxesList: result.data,\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_STATE_TAXES_EDIT_CANCELLED)\n }\n\n return (\n <EmployeeStateTaxesView\n stateTaxes={stateTaxes}\n onSubmit={handleSubmit}\n actions={\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={stateTaxes.status.isPending}>\n {t('saveCta')}\n </Components.Button>\n </ActionsLayout>\n }\n className={className}\n dictionary={managementStateTaxesDictionary}\n LoaderComponent={LoaderComponent}\n />\n )\n}\n"],"names":["StateTaxesEditForm","FallbackComponent","LoaderComponent","props","jsx","BaseBoundaries","StateTaxesEditFormRoot","employeeId","className","dictionary","onEvent","useI18n","useComponentDictionary","t","useTranslation","Components","useComponentContext","stateTaxes","useEmployeeStateTaxesForm","managementStateTaxesDictionary","useManagementStateTaxesViewDictionary","BaseLayout","handleSubmit","result","componentEvents","handleCancel","EmployeeStateTaxesView","ActionsLayout"],"mappings":"
|
|
1
|
+
{"version":3,"file":"StateTaxesEditForm.js","sources":["../../../../../src/components/Employee/StateTaxes/management/StateTaxesEditForm.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { EmployeeStateTaxesView, useEmployeeStateTaxesForm } from '../shared'\nimport { useManagementStateTaxesViewDictionary } from './useViewDictionary'\nimport { BaseBoundaries, BaseLayout, type BaseComponentInterface } from '@/components/Base'\nimport { ActionsLayout } from '@/components/Common'\nimport { useI18n, useComponentDictionary } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\n/**\n * Props for {@link StateTaxesEditForm}.\n *\n * @public\n */\nexport interface StateTaxesEditFormProps extends BaseComponentInterface<'Employee.Management.StateTaxes'> {\n /** The associated employee identifier. */\n employeeId: string\n}\n\n/**\n * Standalone edit screen for the state-tax management flow. Renders the shared\n * state-tax form against the `Employee.Management.StateTaxes` namespace and\n * emits scoped management events on submit and cancel, so partner copy\n * overrides on the management namespace do not leak into the onboarding flow.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `employee/management/stateTaxes/updated` | Form was submitted successfully | `{ employeeStateTaxesList: EmployeeStateTaxesList[] }` |\n * | `employee/management/stateTaxes/editCancelled` | Cancel button was clicked | — |\n *\n * @param props - The component props.\n * @public\n */\nexport function StateTaxesEditForm({\n FallbackComponent,\n LoaderComponent,\n ...props\n}: StateTaxesEditFormProps) {\n return (\n <BaseBoundaries\n componentName=\"Employee.Management.StateTaxes\"\n FallbackComponent={FallbackComponent}\n LoaderComponent={LoaderComponent}\n >\n <StateTaxesEditFormRoot LoaderComponent={LoaderComponent} {...props} />\n </BaseBoundaries>\n )\n}\n\nfunction StateTaxesEditFormRoot({\n employeeId,\n className,\n dictionary,\n onEvent,\n LoaderComponent,\n}: StateTaxesEditFormProps) {\n useI18n('Employee.Management.StateTaxes')\n useComponentDictionary('Employee.Management.StateTaxes', dictionary)\n const { t } = useTranslation('Employee.Management.StateTaxes')\n const Components = useComponentContext()\n\n const stateTaxes = useEmployeeStateTaxesForm({ employeeId })\n const managementStateTaxesDictionary = useManagementStateTaxesViewDictionary()\n\n if (stateTaxes.isLoading) {\n return (\n <BaseLayout\n isLoading\n error={stateTaxes.errorHandling.errors}\n LoaderComponent={LoaderComponent}\n />\n )\n }\n\n const handleSubmit = async () => {\n const result = await stateTaxes.actions.onSubmit()\n if (!result) return\n\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_STATE_TAXES_UPDATED, {\n employeeStateTaxesList: result.data,\n })\n }\n\n const handleCancel = () => {\n onEvent(componentEvents.EMPLOYEE_MANAGEMENT_STATE_TAXES_EDIT_CANCELLED)\n }\n\n return (\n <EmployeeStateTaxesView\n stateTaxes={stateTaxes}\n onSubmit={handleSubmit}\n actions={\n <ActionsLayout>\n <Components.Button variant=\"secondary\" onClick={handleCancel}>\n {t('cancelCta')}\n </Components.Button>\n <Components.Button type=\"submit\" isLoading={stateTaxes.status.isPending}>\n {t('saveCta')}\n </Components.Button>\n </ActionsLayout>\n }\n className={className}\n dictionary={managementStateTaxesDictionary}\n LoaderComponent={LoaderComponent}\n />\n )\n}\n"],"names":["StateTaxesEditForm","FallbackComponent","LoaderComponent","props","jsx","BaseBoundaries","StateTaxesEditFormRoot","employeeId","className","dictionary","onEvent","useI18n","useComponentDictionary","t","useTranslation","Components","useComponentContext","stateTaxes","useEmployeeStateTaxesForm","managementStateTaxesDictionary","useManagementStateTaxesViewDictionary","BaseLayout","handleSubmit","result","componentEvents","handleCancel","EmployeeStateTaxesView","ActionsLayout"],"mappings":";;;;;;;;;;;AAkCO,SAASA,EAAmB;AAAA,EACjC,mBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,GAAGC;AACL,GAA4B;AAC1B,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,eAAc;AAAA,MACd,mBAAAJ;AAAA,MACA,iBAAAC;AAAA,MAEA,UAAA,gBAAAE,EAACE,GAAA,EAAuB,iBAAAJ,GAAmC,GAAGC,EAAA,CAAO;AAAA,IAAA;AAAA,EAAA;AAG3E;AAEA,SAASG,EAAuB;AAAA,EAC9B,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,SAAAC;AAAA,EACA,iBAAAR;AACF,GAA4B;AAC1B,EAAAS,EAAQ,gCAAgC,GACxCC,EAAuB,kCAAkCH,CAAU;AACnE,QAAM,EAAE,GAAAI,EAAA,IAAMC,EAAe,gCAAgC,GACvDC,IAAaC,EAAA,GAEbC,IAAaC,EAA0B,EAAE,YAAAX,GAAY,GACrDY,IAAiCC,EAAA;AAEvC,MAAIH,EAAW;AACb,WACE,gBAAAb;AAAA,MAACiB;AAAA,MAAA;AAAA,QACC,WAAS;AAAA,QACT,OAAOJ,EAAW,cAAc;AAAA,QAChC,iBAAAf;AAAA,MAAA;AAAA,IAAA;AAKN,QAAMoB,IAAe,YAAY;AAC/B,UAAMC,IAAS,MAAMN,EAAW,QAAQ,SAAA;AACxC,IAAKM,KAELb,EAAQc,EAAgB,yCAAyC;AAAA,MAC/D,wBAAwBD,EAAO;AAAA,IAAA,CAChC;AAAA,EACH,GAEME,IAAe,MAAM;AACzB,IAAAf,EAAQc,EAAgB,8CAA8C;AAAA,EACxE;AAEA,SACE,gBAAApB;AAAA,IAACsB;AAAA,IAAA;AAAA,MACC,YAAAT;AAAA,MACA,UAAUK;AAAA,MACV,2BACGK,GAAA,EACC,UAAA;AAAA,QAAA,gBAAAvB,EAACW,EAAW,QAAX,EAAkB,SAAQ,aAAY,SAASU,GAC7C,UAAAZ,EAAE,WAAW,EAAA,CAChB;AAAA,QACA,gBAAAT,EAACW,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWE,EAAW,OAAO,WAC3D,UAAAJ,EAAE,SAAS,EAAA,CACd;AAAA,MAAA,GACF;AAAA,MAEF,WAAAL;AAAA,MACA,YAAYW;AAAA,MACZ,iBAAAjB;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { useTranslation as
|
|
2
|
+
import { useTranslation as p } from "react-i18next";
|
|
3
3
|
import { EmployeeStateTaxesView as T } from "../shared/EmployeeStateTaxesView.js";
|
|
4
4
|
import { useOnboardingStateTaxesViewDictionary as S } from "./useViewDictionary.js";
|
|
5
5
|
import { BaseBoundaries as E, BaseLayout as f } from "../../../Base/Base.js";
|
|
6
6
|
import "../../../Base/useBase.js";
|
|
7
|
-
import "classnames";
|
|
8
|
-
import { componentEvents as m } from "../../../../shared/constants.js";
|
|
9
7
|
import { ActionsLayout as l } from "../../../Common/ActionsLayout/ActionsLayout.js";
|
|
10
8
|
import { useI18n as x, useComponentDictionary as y } from "../../../../i18n/I18n.js";
|
|
9
|
+
import { componentEvents as m } from "../../../../shared/constants.js";
|
|
11
10
|
import { useComponentContext as d } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
12
11
|
import { useEmployeeStateTaxesForm as b } from "../shared/useEmployeeStateTaxesForm/useEmployeeStateTaxesForm.js";
|
|
13
|
-
function
|
|
12
|
+
function X({ FallbackComponent: o, LoaderComponent: e, ...n }) {
|
|
14
13
|
return /* @__PURE__ */ t(
|
|
15
14
|
E,
|
|
16
15
|
{
|
|
@@ -30,7 +29,7 @@ function g({
|
|
|
30
29
|
LoaderComponent: a
|
|
31
30
|
}) {
|
|
32
31
|
x("Employee.StateTaxes"), y("Employee.StateTaxes", n);
|
|
33
|
-
const i = b({ employeeId: o, isAdmin: u }),
|
|
32
|
+
const i = b({ employeeId: o, isAdmin: u }), c = S();
|
|
34
33
|
return i.isLoading ? /* @__PURE__ */ t(
|
|
35
34
|
f,
|
|
36
35
|
{
|
|
@@ -50,16 +49,16 @@ function g({
|
|
|
50
49
|
},
|
|
51
50
|
actions: /* @__PURE__ */ t(A, { isPending: i.status.isPending }),
|
|
52
51
|
className: e,
|
|
53
|
-
dictionary:
|
|
52
|
+
dictionary: c,
|
|
54
53
|
LoaderComponent: a
|
|
55
54
|
}
|
|
56
55
|
);
|
|
57
56
|
}
|
|
58
57
|
function A({ isPending: o }) {
|
|
59
|
-
const { t: e } =
|
|
58
|
+
const { t: e } = p("Employee.StateTaxes"), n = d();
|
|
60
59
|
return /* @__PURE__ */ t(l, { children: /* @__PURE__ */ t(n.Button, { type: "submit", isLoading: o, children: e("submitCta") }) });
|
|
61
60
|
}
|
|
62
61
|
export {
|
|
63
|
-
|
|
62
|
+
X as StateTaxes
|
|
64
63
|
};
|
|
65
64
|
//# sourceMappingURL=StateTaxes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StateTaxes.js","sources":["../../../../../src/components/Employee/StateTaxes/onboarding/StateTaxes.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { EmployeeStateTaxesView, useEmployeeStateTaxesForm } from '../shared'\nimport { useOnboardingStateTaxesViewDictionary } from './useViewDictionary'\nimport { BaseBoundaries, BaseLayout, type BaseComponentInterface } from '@/components/Base'\nimport { ActionsLayout } from '@/components/Common'\nimport { useI18n, useComponentDictionary } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\n/**\n * Props for {@link StateTaxes}.\n *\n * @public\n */\nexport interface StateTaxesProps extends BaseComponentInterface<'Employee.StateTaxes'> {\n /** The associated employee identifier. */\n employeeId: string\n /** Render admin-only questions and submit them. Defaults to `false`. */\n isAdmin?: boolean\n}\n\n/**\n * Onboarding step that collects an employee's per-state tax withholding\n * answers. The set of fields is driven by the API response for each state\n * on record.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `employee/stateTaxes/updated` | Form was submitted successfully | `{ employeeStateTaxesList: EmployeeStateTaxesList[] }` |\n * | `employee/stateTaxes/done` | Onboarding step has finished — emitted immediately after `updated` | — |\n *\n * @param props - The component props.\n * @public\n */\nexport function StateTaxes({ FallbackComponent, LoaderComponent, ...props }: StateTaxesProps) {\n return (\n <BaseBoundaries\n componentName=\"Employee.StateTaxes\"\n FallbackComponent={FallbackComponent}\n LoaderComponent={LoaderComponent}\n >\n <StateTaxesRoot LoaderComponent={LoaderComponent} {...props} />\n </BaseBoundaries>\n )\n}\n\nfunction StateTaxesRoot({\n employeeId,\n className,\n dictionary,\n onEvent,\n isAdmin = false,\n LoaderComponent,\n}: StateTaxesProps) {\n useI18n('Employee.StateTaxes')\n useComponentDictionary('Employee.StateTaxes', dictionary)\n\n const stateTaxes = useEmployeeStateTaxesForm({ employeeId, isAdmin })\n const onboardingStateTaxesDictionary = useOnboardingStateTaxesViewDictionary()\n\n if (stateTaxes.isLoading) {\n return (\n <BaseLayout\n isLoading\n error={stateTaxes.errorHandling.errors}\n LoaderComponent={LoaderComponent}\n />\n )\n }\n\n const handleSubmit = async () => {\n const result = await stateTaxes.actions.onSubmit()\n if (!result) return\n\n onEvent(componentEvents.EMPLOYEE_STATE_TAXES_UPDATED, {\n employeeStateTaxesList: result.data,\n })\n onEvent(componentEvents.EMPLOYEE_STATE_TAXES_DONE)\n }\n\n return (\n <EmployeeStateTaxesView\n stateTaxes={stateTaxes}\n onSubmit={handleSubmit}\n actions={<ContinueAction isPending={stateTaxes.status.isPending} />}\n className={className}\n dictionary={onboardingStateTaxesDictionary}\n LoaderComponent={LoaderComponent}\n />\n )\n}\n\nfunction ContinueAction({ isPending }: { isPending: boolean }) {\n const { t } = useTranslation('Employee.StateTaxes')\n const Components = useComponentContext()\n\n return (\n <ActionsLayout>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('submitCta')}\n </Components.Button>\n </ActionsLayout>\n )\n}\n"],"names":["StateTaxes","FallbackComponent","LoaderComponent","props","jsx","BaseBoundaries","StateTaxesRoot","employeeId","className","dictionary","onEvent","isAdmin","useI18n","useComponentDictionary","stateTaxes","useEmployeeStateTaxesForm","onboardingStateTaxesDictionary","useOnboardingStateTaxesViewDictionary","BaseLayout","EmployeeStateTaxesView","result","componentEvents","ContinueAction","isPending","t","useTranslation","Components","useComponentContext","ActionsLayout"],"mappings":"
|
|
1
|
+
{"version":3,"file":"StateTaxes.js","sources":["../../../../../src/components/Employee/StateTaxes/onboarding/StateTaxes.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { EmployeeStateTaxesView, useEmployeeStateTaxesForm } from '../shared'\nimport { useOnboardingStateTaxesViewDictionary } from './useViewDictionary'\nimport { BaseBoundaries, BaseLayout, type BaseComponentInterface } from '@/components/Base'\nimport { ActionsLayout } from '@/components/Common'\nimport { useI18n, useComponentDictionary } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\n/**\n * Props for {@link StateTaxes}.\n *\n * @public\n */\nexport interface StateTaxesProps extends BaseComponentInterface<'Employee.StateTaxes'> {\n /** The associated employee identifier. */\n employeeId: string\n /** Render admin-only questions and submit them. Defaults to `false`. */\n isAdmin?: boolean\n}\n\n/**\n * Onboarding step that collects an employee's per-state tax withholding\n * answers. The set of fields is driven by the API response for each state\n * on record.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `employee/stateTaxes/updated` | Form was submitted successfully | `{ employeeStateTaxesList: EmployeeStateTaxesList[] }` |\n * | `employee/stateTaxes/done` | Onboarding step has finished — emitted immediately after `updated` | — |\n *\n * @param props - The component props.\n * @public\n */\nexport function StateTaxes({ FallbackComponent, LoaderComponent, ...props }: StateTaxesProps) {\n return (\n <BaseBoundaries\n componentName=\"Employee.StateTaxes\"\n FallbackComponent={FallbackComponent}\n LoaderComponent={LoaderComponent}\n >\n <StateTaxesRoot LoaderComponent={LoaderComponent} {...props} />\n </BaseBoundaries>\n )\n}\n\nfunction StateTaxesRoot({\n employeeId,\n className,\n dictionary,\n onEvent,\n isAdmin = false,\n LoaderComponent,\n}: StateTaxesProps) {\n useI18n('Employee.StateTaxes')\n useComponentDictionary('Employee.StateTaxes', dictionary)\n\n const stateTaxes = useEmployeeStateTaxesForm({ employeeId, isAdmin })\n const onboardingStateTaxesDictionary = useOnboardingStateTaxesViewDictionary()\n\n if (stateTaxes.isLoading) {\n return (\n <BaseLayout\n isLoading\n error={stateTaxes.errorHandling.errors}\n LoaderComponent={LoaderComponent}\n />\n )\n }\n\n const handleSubmit = async () => {\n const result = await stateTaxes.actions.onSubmit()\n if (!result) return\n\n onEvent(componentEvents.EMPLOYEE_STATE_TAXES_UPDATED, {\n employeeStateTaxesList: result.data,\n })\n onEvent(componentEvents.EMPLOYEE_STATE_TAXES_DONE)\n }\n\n return (\n <EmployeeStateTaxesView\n stateTaxes={stateTaxes}\n onSubmit={handleSubmit}\n actions={<ContinueAction isPending={stateTaxes.status.isPending} />}\n className={className}\n dictionary={onboardingStateTaxesDictionary}\n LoaderComponent={LoaderComponent}\n />\n )\n}\n\nfunction ContinueAction({ isPending }: { isPending: boolean }) {\n const { t } = useTranslation('Employee.StateTaxes')\n const Components = useComponentContext()\n\n return (\n <ActionsLayout>\n <Components.Button type=\"submit\" isLoading={isPending}>\n {t('submitCta')}\n </Components.Button>\n </ActionsLayout>\n )\n}\n"],"names":["StateTaxes","FallbackComponent","LoaderComponent","props","jsx","BaseBoundaries","StateTaxesRoot","employeeId","className","dictionary","onEvent","isAdmin","useI18n","useComponentDictionary","stateTaxes","useEmployeeStateTaxesForm","onboardingStateTaxesDictionary","useOnboardingStateTaxesViewDictionary","BaseLayout","EmployeeStateTaxesView","result","componentEvents","ContinueAction","isPending","t","useTranslation","Components","useComponentContext","ActionsLayout"],"mappings":";;;;;;;;;;;AAmCO,SAASA,EAAW,EAAE,mBAAAC,GAAmB,iBAAAC,GAAiB,GAAGC,KAA0B;AAC5F,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,eAAc;AAAA,MACd,mBAAAJ;AAAA,MACA,iBAAAC;AAAA,MAEA,UAAA,gBAAAE,EAACE,GAAA,EAAe,iBAAAJ,GAAmC,GAAGC,EAAA,CAAO;AAAA,IAAA;AAAA,EAAA;AAGnE;AAEA,SAASG,EAAe;AAAA,EACtB,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,SAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,iBAAAT;AACF,GAAoB;AAClB,EAAAU,EAAQ,qBAAqB,GAC7BC,EAAuB,uBAAuBJ,CAAU;AAExD,QAAMK,IAAaC,EAA0B,EAAE,YAAAR,GAAY,SAAAI,GAAS,GAC9DK,IAAiCC,EAAA;AAEvC,SAAIH,EAAW,YAEX,gBAAAV;AAAA,IAACc;AAAA,IAAA;AAAA,MACC,WAAS;AAAA,MACT,OAAOJ,EAAW,cAAc;AAAA,MAChC,iBAAAZ;AAAA,IAAA;AAAA,EAAA,IAgBJ,gBAAAE;AAAA,IAACe;AAAA,IAAA;AAAA,MACC,YAAAL;AAAA,MACA,UAbiB,YAAY;AAC/B,cAAMM,IAAS,MAAMN,EAAW,QAAQ,SAAA;AACxC,QAAKM,MAELV,EAAQW,EAAgB,8BAA8B;AAAA,UACpD,wBAAwBD,EAAO;AAAA,QAAA,CAChC,GACDV,EAAQW,EAAgB,yBAAyB;AAAA,MACnD;AAAA,MAMI,SAAS,gBAAAjB,EAACkB,GAAA,EAAe,WAAWR,EAAW,OAAO,WAAW;AAAA,MACjE,WAAAN;AAAA,MACA,YAAYQ;AAAA,MACZ,iBAAAd;AAAA,IAAA;AAAA,EAAA;AAGN;AAEA,SAASoB,EAAe,EAAE,WAAAC,KAAqC;AAC7D,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,qBAAqB,GAC5CC,IAAaC,EAAA;AAEnB,SACE,gBAAAvB,EAACwB,GAAA,EACC,UAAA,gBAAAxB,EAACsB,EAAW,QAAX,EAAkB,MAAK,UAAS,WAAWH,GACzC,UAAAC,EAAE,WAAW,GAChB,GACF;AAEJ;"}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { jsx as c } from "react/jsx-runtime";
|
|
2
|
-
import { useState as F, useCallback as
|
|
2
|
+
import { useState as F, useCallback as f, useMemo as J, useEffect as Z } from "react";
|
|
3
3
|
import { useForm as Q, FormProvider as X } from "react-hook-form";
|
|
4
4
|
import { zodResolver as $ } from "@hookform/resolvers/zod";
|
|
5
|
-
import { z as
|
|
5
|
+
import { z as s } from "zod";
|
|
6
6
|
import { useTranslation as W } from "react-i18next";
|
|
7
7
|
import { usePayrollsCreateOffCycleMutation as ee } from "@gusto/embedded-api/react-query/payrollsCreateOffCycle";
|
|
8
8
|
import { usePayrollsGetBlockersSuspense as oe } from "@gusto/embedded-api/react-query/payrollsGetBlockers";
|
|
9
9
|
import { WithholdingPayPeriod as te, OffCycleReason as A } from "@gusto/embedded-api/models/operations/postv1companiescompanyidpayrolls";
|
|
10
|
-
import { RFCDate as E } from "@gusto/embedded-api/types/rfcdate";
|
|
11
10
|
import { useEmployeesListSuspense as ne } from "@gusto/embedded-api/react-query/employeesList";
|
|
12
|
-
import { createOffCyclePayPeriodDateFormSchema as
|
|
13
|
-
import { useOffCyclePayPeriodDateValidation as
|
|
11
|
+
import { createOffCyclePayPeriodDateFormSchema as le } from "../OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes.js";
|
|
12
|
+
import { useOffCyclePayPeriodDateValidation as se } from "../OffCyclePayPeriodDateForm/useOffCyclePayPeriodDateValidation.js";
|
|
14
13
|
import { OffCycleCreationPresentation as ie } from "./OffCycleCreationPresentation.js";
|
|
15
14
|
import { useCompanyPaymentSpeed as re } from "../../../hooks/useCompanyPaymentSpeed.js";
|
|
16
15
|
import { BaseComponent as ae } from "../../Base/Base.js";
|
|
@@ -19,28 +18,29 @@ import { useComponentDictionary as me, useI18n as a } from "../../../i18n/I18n.j
|
|
|
19
18
|
import { componentEvents as T } from "../../../shared/constants.js";
|
|
20
19
|
import { SDKInternalError as de } from "../../../types/sdkError.js";
|
|
21
20
|
import { Form as ue } from "../../Common/Form/Form.js";
|
|
22
|
-
import {
|
|
23
|
-
|
|
21
|
+
import { toRFCDate as E } from "../../../helpers/dateFormatting.js";
|
|
22
|
+
import { OFF_CYCLE_REASON_DEFAULTS as y } from "../OffCycleReasonSelection/types.js";
|
|
23
|
+
const fe = {
|
|
24
24
|
bonus: A.Bonus,
|
|
25
25
|
correction: A.Correction
|
|
26
26
|
};
|
|
27
27
|
function Ne(m) {
|
|
28
|
-
return /* @__PURE__ */ c(ae, { ...m, children: /* @__PURE__ */ c(
|
|
28
|
+
return /* @__PURE__ */ c(ae, { ...m, children: /* @__PURE__ */ c(ye, { ...m }) });
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function ye({ dictionary: m, companyId: d, payrollType: p = "bonus", className: U }) {
|
|
31
31
|
me("Payroll.OffCycleCreation", m), a("Payroll.OffCycleCreation"), a("Payroll.OffCycleReasonSelection"), a("Payroll.OffCyclePayPeriodDateForm"), a("Payroll.OffCycleDeductionsSetting"), a("Payroll.EmployeeSelection");
|
|
32
|
-
const { t: v } = W("Payroll.OffCyclePayPeriodDateForm"), { t: O } = W("Payroll.OffCycleCreation"), { onEvent:
|
|
32
|
+
const { t: v } = W("Payroll.OffCyclePayPeriodDateForm"), { t: O } = W("Payroll.OffCycleCreation"), { onEvent: h, baseSubmitHandler: L } = ce(), { paymentSpeedDays: k } = re(d), { minCheckDate: R, maxDate: _, minPayPeriodDate: B, today: S } = se(k), { mutateAsync: N, isPending: M } = ee(), [C, b] = F({
|
|
33
33
|
withholdingPayPeriod: te.EveryOtherWeek,
|
|
34
|
-
withholdingRate:
|
|
35
|
-
}), [V,
|
|
36
|
-
|
|
37
|
-
}, []), I =
|
|
38
|
-
|
|
39
|
-
}, []), Y =
|
|
40
|
-
|
|
41
|
-
}, []), q =
|
|
42
|
-
|
|
43
|
-
}, [
|
|
34
|
+
withholdingRate: y[p].withholdingType
|
|
35
|
+
}), [V, g] = F(!1), j = f(() => {
|
|
36
|
+
g(!0);
|
|
37
|
+
}, []), I = f((e) => {
|
|
38
|
+
b(e), g(!1);
|
|
39
|
+
}, []), Y = f(() => {
|
|
40
|
+
g(!1);
|
|
41
|
+
}, []), q = f(() => {
|
|
42
|
+
h(T.OFF_CYCLE_BLOCKERS_VIEW_ALL);
|
|
43
|
+
}, [h]), { data: w } = ne({
|
|
44
44
|
companyId: d,
|
|
45
45
|
onboardedActive: !0
|
|
46
46
|
}), { data: z } = oe({
|
|
@@ -48,85 +48,87 @@ function fe({ dictionary: m, companyId: d, payrollType: h = "bonus", className:
|
|
|
48
48
|
}), K = (z.payrollBlockers ?? []).map((e) => ({
|
|
49
49
|
key: e.key,
|
|
50
50
|
message: e.message
|
|
51
|
-
})), x = J(() => [...
|
|
51
|
+
})), x = J(() => [...w.showEmployees ?? []].sort((o, t) => {
|
|
52
52
|
const n = o.lastName.localeCompare(t.lastName);
|
|
53
53
|
return n !== 0 ? n : o.firstName.localeCompare(t.firstName);
|
|
54
54
|
}).map((o) => {
|
|
55
|
-
const t = [o.firstName, o.lastName].filter(Boolean).join(" "), n = o.jobs?.find((
|
|
55
|
+
const t = [o.firstName, o.lastName].filter(Boolean).join(" "), n = o.jobs?.find((i) => i.primary) ?? o.jobs?.[0];
|
|
56
56
|
return {
|
|
57
57
|
label: t,
|
|
58
58
|
value: o.uuid,
|
|
59
59
|
description: n?.title || void 0
|
|
60
60
|
};
|
|
61
|
-
}), [
|
|
61
|
+
}), [w]), G = (e, o) => (
|
|
62
62
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
63
63
|
v(e, o)
|
|
64
|
-
),
|
|
64
|
+
), r = Q({
|
|
65
65
|
resolver: (e, o, t) => {
|
|
66
|
-
const n = e.isCheckOnly,
|
|
66
|
+
const n = e.isCheckOnly, i = le(
|
|
67
67
|
G,
|
|
68
|
-
n ?
|
|
68
|
+
n ? S : R,
|
|
69
69
|
k
|
|
70
|
-
),
|
|
71
|
-
reason:
|
|
72
|
-
skipRegularDeductions:
|
|
73
|
-
includeAllEmployees:
|
|
74
|
-
selectedEmployeeUuids:
|
|
75
|
-
}).and(
|
|
76
|
-
!
|
|
77
|
-
code:
|
|
70
|
+
), D = s.object({
|
|
71
|
+
reason: s.enum(["bonus", "correction"]),
|
|
72
|
+
skipRegularDeductions: s.boolean(),
|
|
73
|
+
includeAllEmployees: s.boolean(),
|
|
74
|
+
selectedEmployeeUuids: s.array(s.string())
|
|
75
|
+
}).and(i).superRefine((l, u) => {
|
|
76
|
+
!l.includeAllEmployees && l.selectedEmployeeUuids.length === 0 && u.addIssue({
|
|
77
|
+
code: s.ZodIssueCode.custom,
|
|
78
78
|
path: ["selectedEmployeeUuids"],
|
|
79
79
|
message: O("errors.noEmployeesSelected")
|
|
80
80
|
});
|
|
81
81
|
});
|
|
82
|
-
return $(
|
|
82
|
+
return $(D)(e, o, t);
|
|
83
83
|
},
|
|
84
84
|
defaultValues: {
|
|
85
|
-
reason:
|
|
85
|
+
reason: p,
|
|
86
86
|
isCheckOnly: !1,
|
|
87
87
|
startDate: null,
|
|
88
88
|
endDate: null,
|
|
89
89
|
checkDate: null,
|
|
90
|
-
skipRegularDeductions:
|
|
90
|
+
skipRegularDeductions: y[p].skipDeductions,
|
|
91
91
|
includeAllEmployees: !1,
|
|
92
92
|
selectedEmployeeUuids: []
|
|
93
93
|
}
|
|
94
|
-
}),
|
|
94
|
+
}), P = r.watch("reason");
|
|
95
95
|
Z(() => {
|
|
96
|
-
|
|
96
|
+
r.setValue(
|
|
97
97
|
"skipRegularDeductions",
|
|
98
|
-
|
|
99
|
-
),
|
|
98
|
+
y[P].skipDeductions
|
|
99
|
+
), b((e) => ({
|
|
100
100
|
...e,
|
|
101
|
-
withholdingRate:
|
|
101
|
+
withholdingRate: y[P].withholdingType
|
|
102
102
|
}));
|
|
103
|
-
}, [
|
|
103
|
+
}, [P, r]);
|
|
104
104
|
const H = async (e) => {
|
|
105
|
-
const
|
|
105
|
+
const { reason: o, checkDate: t, startDate: n, endDate: i } = e;
|
|
106
|
+
if (!t || !n || !i) return;
|
|
107
|
+
const D = e.includeAllEmployees ? x.map((l) => l.value) : e.selectedEmployeeUuids.length > 0 ? e.selectedEmployeeUuids : void 0;
|
|
106
108
|
await L(e, async () => {
|
|
107
|
-
const
|
|
109
|
+
const l = await N({
|
|
108
110
|
request: {
|
|
109
111
|
companyId: d,
|
|
110
112
|
requestBody: {
|
|
111
113
|
offCycle: !0,
|
|
112
|
-
offCycleReason:
|
|
113
|
-
startDate:
|
|
114
|
-
endDate:
|
|
115
|
-
checkDate:
|
|
114
|
+
offCycleReason: fe[o],
|
|
115
|
+
startDate: E(n),
|
|
116
|
+
endDate: E(i),
|
|
117
|
+
checkDate: E(t),
|
|
116
118
|
skipRegularDeductions: e.skipRegularDeductions,
|
|
117
119
|
isCheckOnlyPayroll: e.isCheckOnly,
|
|
118
|
-
employeeUuids:
|
|
120
|
+
employeeUuids: D,
|
|
119
121
|
withholdingPayPeriod: C.withholdingPayPeriod,
|
|
120
122
|
fixedWithholdingRate: C.withholdingRate === "supplemental"
|
|
121
123
|
}
|
|
122
124
|
}
|
|
123
|
-
}), u =
|
|
125
|
+
}), u = l.payrollUnprocessed?.payrollUuid ?? l.payrollUnprocessed?.uuid;
|
|
124
126
|
if (!u)
|
|
125
127
|
throw new de(O("errors.missingPayrollId"));
|
|
126
|
-
|
|
128
|
+
h(T.OFF_CYCLE_CREATED, { payrollUuid: u });
|
|
127
129
|
});
|
|
128
130
|
};
|
|
129
|
-
return /* @__PURE__ */ c(X, { ...
|
|
131
|
+
return /* @__PURE__ */ c(X, { ...r, children: /* @__PURE__ */ c(ue, { onSubmit: r.handleSubmit(H), children: /* @__PURE__ */ c(
|
|
130
132
|
ie,
|
|
131
133
|
{
|
|
132
134
|
employees: x,
|
|
@@ -134,7 +136,7 @@ function fe({ dictionary: m, companyId: d, payrollType: h = "bonus", className:
|
|
|
134
136
|
onViewBlockersClick: q,
|
|
135
137
|
isPending: M,
|
|
136
138
|
minCheckDate: R,
|
|
137
|
-
minCheckOnlyDate:
|
|
139
|
+
minCheckOnlyDate: S,
|
|
138
140
|
maxDate: _,
|
|
139
141
|
minPayPeriodDate: B,
|
|
140
142
|
taxWithholdingConfig: C,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OffCycleCreation.js","sources":["../../../../src/components/Payroll/OffCycleCreation/OffCycleCreation.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useState } from 'react'\nimport { FormProvider, useForm, type Resolver } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { z } from 'zod'\nimport { useTranslation } from 'react-i18next'\nimport { usePayrollsCreateOffCycleMutation } from '@gusto/embedded-api/react-query/payrollsCreateOffCycle'\nimport { usePayrollsGetBlockersSuspense } from '@gusto/embedded-api/react-query/payrollsGetBlockers'\nimport {\n OffCycleReason as ApiOffCycleReason,\n WithholdingPayPeriod,\n} from '@gusto/embedded-api/models/operations/postv1companiescompanyidpayrolls'\nimport { RFCDate } from '@gusto/embedded-api/types/rfcdate'\nimport { useEmployeesListSuspense } from '@gusto/embedded-api/react-query/employeesList'\nimport { OFF_CYCLE_REASON_DEFAULTS, type OffCycleReason } from '../OffCycleReasonSelection'\nimport type { ApiPayrollBlocker } from '../PayrollBlocker/payrollHelpers'\nimport { createOffCyclePayPeriodDateFormSchema } from '../OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes'\nimport { useOffCyclePayPeriodDateValidation } from '../OffCyclePayPeriodDateForm/useOffCyclePayPeriodDateValidation'\nimport type { OffCycleTaxWithholdingConfig } from '../OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes'\nimport type { OffCycleCreationFormData, OffCycleCreationProps } from './OffCycleCreationTypes'\nimport { OffCycleCreationPresentation } from './OffCycleCreationPresentation'\nimport { useCompanyPaymentSpeed } from '@/hooks/useCompanyPaymentSpeed'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { SDKInternalError } from '@/types/sdkError'\nimport { Form } from '@/components/Common/Form'\nimport type { MultiSelectComboBoxOption } from '@/components/Common/UI/MultiSelectComboBox/MultiSelectComboBoxTypes'\n\nconst LOCAL_TO_API_REASON: Record<OffCycleReason, ApiOffCycleReason> = {\n bonus: ApiOffCycleReason.Bonus,\n correction: ApiOffCycleReason.Correction,\n}\n\n/**\n * Creation form for off-cycle (bonus or correction) payrolls.\n *\n * Walks the user through configuring pay period dates, selecting a reason, choosing\n * employees, and setting deduction and tax withholding preferences, then submits the\n * resulting payroll for execution.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `offCycle/created` | The off-cycle payroll has been created | `{ payrollUuid: string }` |\n * | `offCycle/blockers/viewAll` | The user chose to view the company's payroll blockers from the blocker alert | none |\n *\n * Changing the reason updates the deduction and withholding defaults — `'bonus'` skips\n * regular deductions and uses the supplemental withholding rate; `'correction'` includes\n * regular deductions and uses the regular rate.\n *\n * @param props - {@link OffCycleCreationProps} plus base component props.\n * @returns The off-cycle payroll creation form.\n * @public\n */\nexport function OffCycleCreation(props: OffCycleCreationProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nfunction Root({ dictionary, companyId, payrollType = 'bonus', className }: OffCycleCreationProps) {\n useComponentDictionary('Payroll.OffCycleCreation', dictionary)\n useI18n('Payroll.OffCycleCreation')\n useI18n('Payroll.OffCycleReasonSelection')\n useI18n('Payroll.OffCyclePayPeriodDateForm')\n useI18n('Payroll.OffCycleDeductionsSetting')\n useI18n('Payroll.EmployeeSelection')\n\n const { t } = useTranslation('Payroll.OffCyclePayPeriodDateForm')\n const { t: tCreation } = useTranslation('Payroll.OffCycleCreation')\n const { onEvent, baseSubmitHandler } = useBase()\n\n const { paymentSpeedDays } = useCompanyPaymentSpeed(companyId)\n\n const { minCheckDate, maxDate, minPayPeriodDate, today } =\n useOffCyclePayPeriodDateValidation(paymentSpeedDays)\n const { mutateAsync: createOffCyclePayroll, isPending } = usePayrollsCreateOffCycleMutation()\n\n const [taxWithholdingConfig, setTaxWithholdingConfig] = useState<OffCycleTaxWithholdingConfig>({\n withholdingPayPeriod: WithholdingPayPeriod.EveryOtherWeek,\n withholdingRate: OFF_CYCLE_REASON_DEFAULTS[payrollType].withholdingType,\n })\n const [isTaxWithholdingModalOpen, setIsTaxWithholdingModalOpen] = useState(false)\n\n const handleTaxWithholdingEditClick = useCallback(() => {\n setIsTaxWithholdingModalOpen(true)\n }, [])\n\n const handleTaxWithholdingModalDone = useCallback((config: OffCycleTaxWithholdingConfig) => {\n setTaxWithholdingConfig(config)\n setIsTaxWithholdingModalOpen(false)\n }, [])\n\n const handleTaxWithholdingModalCancel = useCallback(() => {\n setIsTaxWithholdingModalOpen(false)\n }, [])\n\n const handleViewBlockers = useCallback(() => {\n onEvent(componentEvents.OFF_CYCLE_BLOCKERS_VIEW_ALL)\n }, [onEvent])\n\n const { data: employeesData } = useEmployeesListSuspense({\n companyId,\n onboardedActive: true,\n })\n\n const { data: blockersData } = usePayrollsGetBlockersSuspense({\n companyUuid: companyId,\n })\n\n const blockers: ApiPayrollBlocker[] = (blockersData.payrollBlockers ?? []).map(blocker => ({\n key: blocker.key,\n message: blocker.message,\n }))\n\n const employees: MultiSelectComboBoxOption[] = useMemo(() => {\n const employeeList = employeesData.showEmployees ?? []\n return [...employeeList]\n .sort((a, b) => {\n const lastNameComparison = a.lastName.localeCompare(b.lastName)\n if (lastNameComparison !== 0) return lastNameComparison\n return a.firstName.localeCompare(b.firstName)\n })\n .map(employee => {\n const fullName = [employee.firstName, employee.lastName].filter(Boolean).join(' ')\n const primaryJob = employee.jobs?.find(job => job.primary) ?? employee.jobs?.[0]\n return {\n label: fullName,\n value: employee.uuid,\n description: primaryJob?.title || undefined,\n }\n })\n }, [employeesData])\n\n const translateValidation = (key: string, options?: Record<string, unknown>): string =>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n t(key as any, options as any) as string\n\n const dynamicResolver: Resolver<OffCycleCreationFormData> = (values, context, options) => {\n const isCheckOnly = values.isCheckOnly\n\n const dateSchema = createOffCyclePayPeriodDateFormSchema(\n translateValidation,\n isCheckOnly ? today : minCheckDate,\n paymentSpeedDays,\n )\n const schema = z\n .object({\n reason: z.enum(['bonus', 'correction']),\n skipRegularDeductions: z.boolean(),\n includeAllEmployees: z.boolean(),\n selectedEmployeeUuids: z.array(z.string()),\n })\n .and(dateSchema)\n .superRefine((data, ctx) => {\n if (!data.includeAllEmployees && data.selectedEmployeeUuids.length === 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['selectedEmployeeUuids'],\n message: tCreation('errors.noEmployeesSelected'),\n })\n }\n })\n\n return zodResolver(schema)(values, context, options)\n }\n\n const methods = useForm<OffCycleCreationFormData>({\n resolver: dynamicResolver,\n defaultValues: {\n reason: payrollType,\n isCheckOnly: false,\n startDate: null,\n endDate: null,\n checkDate: null,\n skipRegularDeductions: OFF_CYCLE_REASON_DEFAULTS[payrollType].skipDeductions,\n includeAllEmployees: false,\n selectedEmployeeUuids: [],\n },\n })\n\n const watchedReason = methods.watch('reason')\n\n useEffect(() => {\n methods.setValue(\n 'skipRegularDeductions',\n OFF_CYCLE_REASON_DEFAULTS[watchedReason].skipDeductions,\n )\n setTaxWithholdingConfig(prev => ({\n ...prev,\n withholdingRate: OFF_CYCLE_REASON_DEFAULTS[watchedReason].withholdingType,\n }))\n }, [watchedReason, methods])\n\n const onSubmit = async (data: OffCycleCreationFormData) => {\n const reason = data.reason\n const checkDate = data.checkDate!\n const startDate = data.startDate!\n const endDate = data.endDate!\n const employeeUuids = data.includeAllEmployees\n ? employees.map(e => e.value)\n : data.selectedEmployeeUuids.length > 0\n ? data.selectedEmployeeUuids\n : undefined\n\n await baseSubmitHandler(data, async () => {\n const response = await createOffCyclePayroll({\n request: {\n companyId,\n requestBody: {\n offCycle: true,\n offCycleReason: LOCAL_TO_API_REASON[reason],\n startDate: new RFCDate(startDate),\n endDate: new RFCDate(endDate),\n checkDate: new RFCDate(checkDate),\n skipRegularDeductions: data.skipRegularDeductions,\n isCheckOnlyPayroll: data.isCheckOnly,\n employeeUuids,\n withholdingPayPeriod: taxWithholdingConfig.withholdingPayPeriod,\n fixedWithholdingRate: taxWithholdingConfig.withholdingRate === 'supplemental',\n },\n },\n })\n\n const payrollUuid =\n response.payrollUnprocessed?.payrollUuid ?? response.payrollUnprocessed?.uuid\n\n if (!payrollUuid) {\n throw new SDKInternalError(tCreation('errors.missingPayrollId'))\n }\n\n onEvent(componentEvents.OFF_CYCLE_CREATED, { payrollUuid })\n })\n }\n\n return (\n <FormProvider {...methods}>\n <Form onSubmit={methods.handleSubmit(onSubmit)}>\n <OffCycleCreationPresentation\n employees={employees}\n blockers={blockers}\n onViewBlockersClick={handleViewBlockers}\n isPending={isPending}\n minCheckDate={minCheckDate}\n minCheckOnlyDate={today}\n maxDate={maxDate}\n minPayPeriodDate={minPayPeriodDate}\n taxWithholdingConfig={taxWithholdingConfig}\n isTaxWithholdingModalOpen={isTaxWithholdingModalOpen}\n onTaxWithholdingEditClick={handleTaxWithholdingEditClick}\n onTaxWithholdingModalDone={handleTaxWithholdingModalDone}\n onTaxWithholdingModalCancel={handleTaxWithholdingModalCancel}\n className={className}\n />\n </Form>\n </FormProvider>\n )\n}\n"],"names":["LOCAL_TO_API_REASON","ApiOffCycleReason","OffCycleCreation","props","jsx","BaseComponent","Root","dictionary","companyId","payrollType","className","useComponentDictionary","useI18n","t","useTranslation","tCreation","onEvent","baseSubmitHandler","useBase","paymentSpeedDays","useCompanyPaymentSpeed","minCheckDate","maxDate","minPayPeriodDate","today","useOffCyclePayPeriodDateValidation","createOffCyclePayroll","isPending","usePayrollsCreateOffCycleMutation","taxWithholdingConfig","setTaxWithholdingConfig","useState","WithholdingPayPeriod","OFF_CYCLE_REASON_DEFAULTS","isTaxWithholdingModalOpen","setIsTaxWithholdingModalOpen","handleTaxWithholdingEditClick","useCallback","handleTaxWithholdingModalDone","config","handleTaxWithholdingModalCancel","handleViewBlockers","componentEvents","employeesData","useEmployeesListSuspense","blockersData","usePayrollsGetBlockersSuspense","blockers","blocker","employees","useMemo","a","b","lastNameComparison","employee","fullName","primaryJob","job","translateValidation","key","options","methods","useForm","values","context","isCheckOnly","dateSchema","createOffCyclePayPeriodDateFormSchema","schema","z","data","ctx","zodResolver","watchedReason","useEffect","prev","onSubmit","reason","checkDate","startDate","endDate","employeeUuids","e","response","RFCDate","payrollUuid","SDKInternalError","FormProvider","Form","OffCycleCreationPresentation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAMA,KAAiE;AAAA,EACrE,OAAOC,EAAkB;AAAA,EACzB,YAAYA,EAAkB;AAChC;AAuBO,SAASC,GAAiBC,GAA8B;AAC7D,SACE,gBAAAC,EAACC,MAAe,GAAGF,GACjB,4BAACG,IAAA,EAAM,GAAGH,GAAO,EAAA,CACnB;AAEJ;AAEA,SAASG,GAAK,EAAE,YAAAC,GAAY,WAAAC,GAAW,aAAAC,IAAc,SAAS,WAAAC,KAAoC;AAChG,EAAAC,GAAuB,4BAA4BJ,CAAU,GAC7DK,EAAQ,0BAA0B,GAClCA,EAAQ,iCAA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QJ,CAAO;AAAA,YAC5B,WAAW,IAAII,EAAQN,CAAS;AAAA,YAChC,uBAAuBR,EAAK;AAAA,YAC5B,oBAAoBA,EAAK;AAAA,YACzB,eAAAW;AAAA,YACA,sBAAsBpD,EAAqB;AAAA,YAC3C,sBAAsBA,EAAqB,oBAAoB;AAAA,UAAA;AAAA,QACjE;AAAA,MACF,CACD,GAEKwD,IACJF,EAAS,oBAAoB,eAAeA,EAAS,oBAAoB;AAE3E,UAAI,CAACE;AACH,cAAM,IAAIC,GAAiBvE,EAAU,yBAAyB,CAAC;AAGjE,MAAAC,EAAQ0B,EAAgB,mBAAmB,EAAE,aAAA2C,EAAA,CAAa;AAAA,IAC5D,CAAC;AAAA,EACH;AAEA,SACE,gBAAAjF,EAACmF,GAAA,EAAc,GAAG1B,GAChB,UAAA,gBAAAzD,EAACoF,MAAK,UAAU3B,EAAQ,aAAae,CAAQ,GAC3C,UAAA,gBAAAxE;AAAA,IAACqF;AAAA,IAAA;AAAA,MACC,WAAAxC;AAAA,MACA,UAAAF;AAAA,MACA,qBAAqBN;AAAA,MACrB,WAAAd;AAAA,MACA,cAAAN;AAAA,MACA,kBAAkBG;AAAA,MAClB,SAAAF;AAAA,MACA,kBAAAC;AAAA,MACA,sBAAAM;AAAA,MACA,2BAAAK;AAAA,MACA,2BAA2BE;AAAA,MAC3B,2BAA2BE;AAAA,MAC3B,6BAA6BE;AAAA,MAC7B,WAAA9B;AAAA,IAAA;AAAA,EAAA,GAEJ,EAAA,CACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"OffCycleCreation.js","sources":["../../../../src/components/Payroll/OffCycleCreation/OffCycleCreation.tsx"],"sourcesContent":["import { useCallback, useEffect, useMemo, useState } from 'react'\nimport { FormProvider, useForm, type Resolver } from 'react-hook-form'\nimport { zodResolver } from '@hookform/resolvers/zod'\nimport { z } from 'zod'\nimport { useTranslation } from 'react-i18next'\nimport { usePayrollsCreateOffCycleMutation } from '@gusto/embedded-api/react-query/payrollsCreateOffCycle'\nimport { usePayrollsGetBlockersSuspense } from '@gusto/embedded-api/react-query/payrollsGetBlockers'\nimport {\n OffCycleReason as ApiOffCycleReason,\n WithholdingPayPeriod,\n} from '@gusto/embedded-api/models/operations/postv1companiescompanyidpayrolls'\nimport { useEmployeesListSuspense } from '@gusto/embedded-api/react-query/employeesList'\nimport { OFF_CYCLE_REASON_DEFAULTS, type OffCycleReason } from '../OffCycleReasonSelection'\nimport type { ApiPayrollBlocker } from '../PayrollBlocker/payrollHelpers'\nimport { createOffCyclePayPeriodDateFormSchema } from '../OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormTypes'\nimport { useOffCyclePayPeriodDateValidation } from '../OffCyclePayPeriodDateForm/useOffCyclePayPeriodDateValidation'\nimport type { OffCycleTaxWithholdingConfig } from '../OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes'\nimport type { OffCycleCreationFormData, OffCycleCreationProps } from './OffCycleCreationTypes'\nimport { OffCycleCreationPresentation } from './OffCycleCreationPresentation'\nimport { useCompanyPaymentSpeed } from '@/hooks/useCompanyPaymentSpeed'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { useBase } from '@/components/Base/useBase'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { componentEvents } from '@/shared/constants'\nimport { SDKInternalError } from '@/types/sdkError'\nimport { Form } from '@/components/Common/Form'\nimport { toRFCDate } from '@/helpers/dateFormatting'\nimport type { MultiSelectComboBoxOption } from '@/components/Common/UI/MultiSelectComboBox/MultiSelectComboBoxTypes'\n\nconst LOCAL_TO_API_REASON: Record<OffCycleReason, ApiOffCycleReason> = {\n bonus: ApiOffCycleReason.Bonus,\n correction: ApiOffCycleReason.Correction,\n}\n\n/**\n * Creation form for off-cycle (bonus or correction) payrolls.\n *\n * Walks the user through configuring pay period dates, selecting a reason, choosing\n * employees, and setting deduction and tax withholding preferences, then submits the\n * resulting payroll for execution.\n *\n * @events\n * | Event | Description | Data |\n * | ----- | ----------- | ---- |\n * | `offCycle/created` | The off-cycle payroll has been created | `{ payrollUuid: string }` |\n * | `offCycle/blockers/viewAll` | The user chose to view the company's payroll blockers from the blocker alert | none |\n *\n * Changing the reason updates the deduction and withholding defaults — `'bonus'` skips\n * regular deductions and uses the supplemental withholding rate; `'correction'` includes\n * regular deductions and uses the regular rate.\n *\n * @param props - {@link OffCycleCreationProps} plus base component props.\n * @returns The off-cycle payroll creation form.\n * @public\n */\nexport function OffCycleCreation(props: OffCycleCreationProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props} />\n </BaseComponent>\n )\n}\n\nfunction Root({ dictionary, companyId, payrollType = 'bonus', className }: OffCycleCreationProps) {\n useComponentDictionary('Payroll.OffCycleCreation', dictionary)\n useI18n('Payroll.OffCycleCreation')\n useI18n('Payroll.OffCycleReasonSelection')\n useI18n('Payroll.OffCyclePayPeriodDateForm')\n useI18n('Payroll.OffCycleDeductionsSetting')\n useI18n('Payroll.EmployeeSelection')\n\n const { t } = useTranslation('Payroll.OffCyclePayPeriodDateForm')\n const { t: tCreation } = useTranslation('Payroll.OffCycleCreation')\n const { onEvent, baseSubmitHandler } = useBase()\n\n const { paymentSpeedDays } = useCompanyPaymentSpeed(companyId)\n\n const { minCheckDate, maxDate, minPayPeriodDate, today } =\n useOffCyclePayPeriodDateValidation(paymentSpeedDays)\n const { mutateAsync: createOffCyclePayroll, isPending } = usePayrollsCreateOffCycleMutation()\n\n const [taxWithholdingConfig, setTaxWithholdingConfig] = useState<OffCycleTaxWithholdingConfig>({\n withholdingPayPeriod: WithholdingPayPeriod.EveryOtherWeek,\n withholdingRate: OFF_CYCLE_REASON_DEFAULTS[payrollType].withholdingType,\n })\n const [isTaxWithholdingModalOpen, setIsTaxWithholdingModalOpen] = useState(false)\n\n const handleTaxWithholdingEditClick = useCallback(() => {\n setIsTaxWithholdingModalOpen(true)\n }, [])\n\n const handleTaxWithholdingModalDone = useCallback((config: OffCycleTaxWithholdingConfig) => {\n setTaxWithholdingConfig(config)\n setIsTaxWithholdingModalOpen(false)\n }, [])\n\n const handleTaxWithholdingModalCancel = useCallback(() => {\n setIsTaxWithholdingModalOpen(false)\n }, [])\n\n const handleViewBlockers = useCallback(() => {\n onEvent(componentEvents.OFF_CYCLE_BLOCKERS_VIEW_ALL)\n }, [onEvent])\n\n const { data: employeesData } = useEmployeesListSuspense({\n companyId,\n onboardedActive: true,\n })\n\n const { data: blockersData } = usePayrollsGetBlockersSuspense({\n companyUuid: companyId,\n })\n\n const blockers: ApiPayrollBlocker[] = (blockersData.payrollBlockers ?? []).map(blocker => ({\n key: blocker.key,\n message: blocker.message,\n }))\n\n const employees: MultiSelectComboBoxOption[] = useMemo(() => {\n const employeeList = employeesData.showEmployees ?? []\n return [...employeeList]\n .sort((a, b) => {\n const lastNameComparison = a.lastName.localeCompare(b.lastName)\n if (lastNameComparison !== 0) return lastNameComparison\n return a.firstName.localeCompare(b.firstName)\n })\n .map(employee => {\n const fullName = [employee.firstName, employee.lastName].filter(Boolean).join(' ')\n const primaryJob = employee.jobs?.find(job => job.primary) ?? employee.jobs?.[0]\n return {\n label: fullName,\n value: employee.uuid,\n description: primaryJob?.title || undefined,\n }\n })\n }, [employeesData])\n\n const translateValidation = (key: string, options?: Record<string, unknown>): string =>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n t(key as any, options as any) as string\n\n const dynamicResolver: Resolver<OffCycleCreationFormData> = (values, context, options) => {\n const isCheckOnly = values.isCheckOnly\n\n const dateSchema = createOffCyclePayPeriodDateFormSchema(\n translateValidation,\n isCheckOnly ? today : minCheckDate,\n paymentSpeedDays,\n )\n const schema = z\n .object({\n reason: z.enum(['bonus', 'correction']),\n skipRegularDeductions: z.boolean(),\n includeAllEmployees: z.boolean(),\n selectedEmployeeUuids: z.array(z.string()),\n })\n .and(dateSchema)\n .superRefine((data, ctx) => {\n if (!data.includeAllEmployees && data.selectedEmployeeUuids.length === 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n path: ['selectedEmployeeUuids'],\n message: tCreation('errors.noEmployeesSelected'),\n })\n }\n })\n\n return zodResolver(schema)(values, context, options)\n }\n\n const methods = useForm<OffCycleCreationFormData>({\n resolver: dynamicResolver,\n defaultValues: {\n reason: payrollType,\n isCheckOnly: false,\n startDate: null,\n endDate: null,\n checkDate: null,\n skipRegularDeductions: OFF_CYCLE_REASON_DEFAULTS[payrollType].skipDeductions,\n includeAllEmployees: false,\n selectedEmployeeUuids: [],\n },\n })\n\n const watchedReason = methods.watch('reason')\n\n useEffect(() => {\n methods.setValue(\n 'skipRegularDeductions',\n OFF_CYCLE_REASON_DEFAULTS[watchedReason].skipDeductions,\n )\n setTaxWithholdingConfig(prev => ({\n ...prev,\n withholdingRate: OFF_CYCLE_REASON_DEFAULTS[watchedReason].withholdingType,\n }))\n }, [watchedReason, methods])\n\n const onSubmit = async (data: OffCycleCreationFormData) => {\n const { reason, checkDate, startDate, endDate } = data\n if (!checkDate || !startDate || !endDate) return\n const employeeUuids = data.includeAllEmployees\n ? employees.map(e => e.value)\n : data.selectedEmployeeUuids.length > 0\n ? data.selectedEmployeeUuids\n : undefined\n\n await baseSubmitHandler(data, async () => {\n const response = await createOffCyclePayroll({\n request: {\n companyId,\n requestBody: {\n offCycle: true,\n offCycleReason: LOCAL_TO_API_REASON[reason],\n startDate: toRFCDate(startDate),\n endDate: toRFCDate(endDate),\n checkDate: toRFCDate(checkDate),\n skipRegularDeductions: data.skipRegularDeductions,\n isCheckOnlyPayroll: data.isCheckOnly,\n employeeUuids,\n withholdingPayPeriod: taxWithholdingConfig.withholdingPayPeriod,\n fixedWithholdingRate: taxWithholdingConfig.withholdingRate === 'supplemental',\n },\n },\n })\n\n const payrollUuid =\n response.payrollUnprocessed?.payrollUuid ?? response.payrollUnprocessed?.uuid\n\n if (!payrollUuid) {\n throw new SDKInternalError(tCreation('errors.missingPayrollId'))\n }\n\n onEvent(componentEvents.OFF_CYCLE_CREATED, { payrollUuid })\n })\n }\n\n return (\n <FormProvider {...methods}>\n <Form onSubmit={methods.handleSubmit(onSubmit)}>\n <OffCycleCreationPresentation\n employees={employees}\n blockers={blockers}\n onViewBlockersClick={handleViewBlockers}\n isPending={isPending}\n minCheckDate={minCheckDate}\n minCheckOnlyDate={today}\n maxDate={maxDate}\n minPayPeriodDate={minPayPeriodDate}\n taxWithholdingConfig={taxWithholdingConfig}\n isTaxWithholdingModalOpen={isTaxWithholdingModalOpen}\n onTaxWithholdingEditClick={handleTaxWithholdingEditClick}\n onTaxWithholdingModalDone={handleTaxWithholdingModalDone}\n onTaxWithholdingModalCancel={handleTaxWithholdingModalCancel}\n className={className}\n />\n </Form>\n </FormProvider>\n )\n}\n"],"names":["LOCAL_TO_API_REASON","ApiOffCycleReason","OffCycleCreation","props","jsx","BaseComponent","Root","dictionary","companyId","payrollType","className","useComponentDictionary","useI18n","t","useTranslation","tCreation","onEvent","baseSubmitHandler","useBase","paymentSpeedDays","useCompanyPaymentSpeed","minCheckDate","maxDate","minPayPeriodDate","today","useOffCyclePayPeriodDateValidation","createOffCyclePayroll","isPending","usePayrollsCreateOffCycleMutation","taxWithholdingConfig","setTaxWithholdingConfig","useState","WithholdingPayPeriod","OFF_CYCLE_REASON_DEFAULTS","isTaxWithholdingModalOpen","setIsTaxWithholdingModalOpen","handleTaxWithholdingEditClick","useCallback","handleTaxWithholdingModalDone","config","handleTaxWithholdingModalCancel","handleViewBlockers","componentEvents","employeesData","useEmployeesListSuspense","blockersData","usePayrollsGetBlockersSuspense","blockers","blocker","employees","useMemo","a","b","lastNameComparison","employee","fullName","primaryJob","job","translateValidation","key","options","methods","useForm","values","context","isCheckOnly","dateSchema","createOffCyclePayPeriodDateFormSchema","schema","z","data","ctx","zodResolver","watchedReason","useEffect","prev","onSubmit","reason","checkDate","startDate","endDate","employeeUuids","e","response","toRFCDate","payrollUuid","SDKInternalError","FormProvider","Form","OffCycleCreationPresentation"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAMA,KAAiE;AAAA,EACrE,OAAOC,EAAkB;AAAA,EACzB,Y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IAAA;AAAA,EAAA,GAEJ,EAAA,CACF;AAEJ;"}
|
package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js
CHANGED
|
@@ -1,45 +1,43 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as o, jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import { useFormContext as d, useWatch as h } from "react-hook-form";
|
|
3
3
|
import { useTranslation as D } from "react-i18next";
|
|
4
4
|
import r from "./OffCyclePayPeriodDateFormPresentation.module.scss.js";
|
|
5
5
|
import { useI18n as f } from "../../../i18n/I18n.js";
|
|
6
|
-
import "
|
|
7
|
-
import "
|
|
8
|
-
|
|
9
|
-
import { DatePickerField as o } from "../../Common/Fields/DatePickerField/DatePickerField.js";
|
|
10
|
-
function v({
|
|
6
|
+
import { CheckboxField as y } from "../../Common/Fields/CheckboxField/CheckboxField.js";
|
|
7
|
+
import { DatePickerField as a } from "../../Common/Fields/DatePickerField/DatePickerField.js";
|
|
8
|
+
function L({
|
|
11
9
|
minCheckDate: l,
|
|
12
10
|
minCheckOnlyDate: n,
|
|
13
11
|
maxDate: i,
|
|
14
|
-
minPayPeriodDate:
|
|
12
|
+
minPayPeriodDate: c
|
|
15
13
|
}) {
|
|
16
14
|
f("Payroll.OffCyclePayPeriodDateForm");
|
|
17
15
|
const { t: e } = D("Payroll.OffCyclePayPeriodDateForm"), { control: s } = d(), m = h({ control: s, name: "isCheckOnly" }) ? n : l;
|
|
18
|
-
return /* @__PURE__ */
|
|
19
|
-
/* @__PURE__ */
|
|
16
|
+
return /* @__PURE__ */ o("div", { className: r.root, children: [
|
|
17
|
+
/* @__PURE__ */ o("div", { className: r.dateFields, children: [
|
|
20
18
|
/* @__PURE__ */ t(
|
|
21
|
-
|
|
19
|
+
a,
|
|
22
20
|
{
|
|
23
21
|
name: "startDate",
|
|
24
22
|
label: e("startDateLabel"),
|
|
25
23
|
isRequired: !0,
|
|
26
|
-
minDate:
|
|
24
|
+
minDate: c,
|
|
27
25
|
maxDate: i
|
|
28
26
|
}
|
|
29
27
|
),
|
|
30
28
|
/* @__PURE__ */ t(
|
|
31
|
-
|
|
29
|
+
a,
|
|
32
30
|
{
|
|
33
31
|
name: "endDate",
|
|
34
32
|
label: e("endDateLabel"),
|
|
35
33
|
isRequired: !0,
|
|
36
|
-
minDate:
|
|
34
|
+
minDate: c,
|
|
37
35
|
maxDate: i
|
|
38
36
|
}
|
|
39
37
|
)
|
|
40
38
|
] }),
|
|
41
39
|
/* @__PURE__ */ t("div", { className: r.checkDateField, children: /* @__PURE__ */ t(
|
|
42
|
-
|
|
40
|
+
a,
|
|
43
41
|
{
|
|
44
42
|
name: "checkDate",
|
|
45
43
|
label: e("checkDateLabel"),
|
|
@@ -50,7 +48,7 @@ function v({
|
|
|
50
48
|
}
|
|
51
49
|
) }),
|
|
52
50
|
/* @__PURE__ */ t(
|
|
53
|
-
|
|
51
|
+
y,
|
|
54
52
|
{
|
|
55
53
|
name: "isCheckOnly",
|
|
56
54
|
label: e("checkOnlyLabel"),
|
|
@@ -60,6 +58,6 @@ function v({
|
|
|
60
58
|
] });
|
|
61
59
|
}
|
|
62
60
|
export {
|
|
63
|
-
|
|
61
|
+
L as OffCyclePayPeriodDateFormPresentation
|
|
64
62
|
};
|
|
65
63
|
//# sourceMappingURL=OffCyclePayPeriodDateFormPresentation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OffCyclePayPeriodDateFormPresentation.js","sources":["../../../../src/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.tsx"],"sourcesContent":["import { useFormContext, useWatch } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport type { OffCyclePayPeriodDateFormData } from './OffCyclePayPeriodDateFormTypes'\nimport styles from './OffCyclePayPeriodDateFormPresentation.module.scss'\nimport { useI18n } from '@/i18n'\nimport { CheckboxField, DatePickerField } from '@/components/Common'\n\n/** @internal */\nexport interface OffCyclePayPeriodDateFormPresentationProps {\n /** Earliest selectable payment date for direct deposit (today plus the ACH lead time). */\n minCheckDate: Date\n /** Earliest selectable payment date when the payroll is check-only (today). */\n minCheckOnlyDate: Date\n /** Latest selectable date for start date, end date, and payment date (1 year from today). */\n maxDate: Date\n /** Earliest selectable start/end date for the pay period (1 year before today). */\n minPayPeriodDate: Date\n}\n\n/** @internal */\nexport function OffCyclePayPeriodDateFormPresentation({\n minCheckDate,\n minCheckOnlyDate,\n maxDate,\n minPayPeriodDate,\n}: OffCyclePayPeriodDateFormPresentationProps) {\n useI18n('Payroll.OffCyclePayPeriodDateForm')\n const { t } = useTranslation('Payroll.OffCyclePayPeriodDateForm')\n\n const { control } = useFormContext<OffCyclePayPeriodDateFormData>()\n const isCheckOnly = useWatch({ control, name: 'isCheckOnly' })\n\n // Mirrors the resolver's own `isCheckOnly ? today : minCheckDate` so the picker and the\n // validation agree. Without a minDate the rule existed only as a submit-time error, and\n // legacy gws-flows disables invalid dates in the picker (SDK-1274). Checking \"check-only\"\n // has to widen the bound back to today, live.\n const checkDateMinimum = isCheckOnly ? minCheckOnlyDate : minCheckDate\n\n return (\n <div className={styles.root}>\n <div className={styles.dateFields}>\n <DatePickerField\n name=\"startDate\"\n label={t('startDateLabel')}\n isRequired\n minDate={minPayPeriodDate}\n maxDate={maxDate}\n />\n <DatePickerField\n name=\"endDate\"\n label={t('endDateLabel')}\n isRequired\n minDate={minPayPeriodDate}\n maxDate={maxDate}\n />\n </div>\n\n <div className={styles.checkDateField}>\n <DatePickerField\n name=\"checkDate\"\n label={t('checkDateLabel')}\n description={t('checkDateDescription')}\n isRequired\n minDate={checkDateMinimum}\n maxDate={maxDate}\n />\n </div>\n\n <CheckboxField\n name=\"isCheckOnly\"\n label={t('checkOnlyLabel')}\n description={t('checkOnlyDescription')}\n />\n </div>\n )\n}\n"],"names":["OffCyclePayPeriodDateFormPresentation","minCheckDate","minCheckOnlyDate","maxDate","minPayPeriodDate","useI18n","t","useTranslation","control","useFormContext","checkDateMinimum","useWatch","jsxs","styles","jsx","DatePickerField","CheckboxField"],"mappings":"
|
|
1
|
+
{"version":3,"file":"OffCyclePayPeriodDateFormPresentation.js","sources":["../../../../src/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.tsx"],"sourcesContent":["import { useFormContext, useWatch } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport type { OffCyclePayPeriodDateFormData } from './OffCyclePayPeriodDateFormTypes'\nimport styles from './OffCyclePayPeriodDateFormPresentation.module.scss'\nimport { useI18n } from '@/i18n'\nimport { CheckboxField, DatePickerField } from '@/components/Common'\n\n/** @internal */\nexport interface OffCyclePayPeriodDateFormPresentationProps {\n /** Earliest selectable payment date for direct deposit (today plus the ACH lead time). */\n minCheckDate: Date\n /** Earliest selectable payment date when the payroll is check-only (today). */\n minCheckOnlyDate: Date\n /** Latest selectable date for start date, end date, and payment date (1 year from today). */\n maxDate: Date\n /** Earliest selectable start/end date for the pay period (1 year before today). */\n minPayPeriodDate: Date\n}\n\n/** @internal */\nexport function OffCyclePayPeriodDateFormPresentation({\n minCheckDate,\n minCheckOnlyDate,\n maxDate,\n minPayPeriodDate,\n}: OffCyclePayPeriodDateFormPresentationProps) {\n useI18n('Payroll.OffCyclePayPeriodDateForm')\n const { t } = useTranslation('Payroll.OffCyclePayPeriodDateForm')\n\n const { control } = useFormContext<OffCyclePayPeriodDateFormData>()\n const isCheckOnly = useWatch({ control, name: 'isCheckOnly' })\n\n // Mirrors the resolver's own `isCheckOnly ? today : minCheckDate` so the picker and the\n // validation agree. Without a minDate the rule existed only as a submit-time error, and\n // legacy gws-flows disables invalid dates in the picker (SDK-1274). Checking \"check-only\"\n // has to widen the bound back to today, live.\n const checkDateMinimum = isCheckOnly ? minCheckOnlyDate : minCheckDate\n\n return (\n <div className={styles.root}>\n <div className={styles.dateFields}>\n <DatePickerField\n name=\"startDate\"\n label={t('startDateLabel')}\n isRequired\n minDate={minPayPeriodDate}\n maxDate={maxDate}\n />\n <DatePickerField\n name=\"endDate\"\n label={t('endDateLabel')}\n isRequired\n minDate={minPayPeriodDate}\n maxDate={maxDate}\n />\n </div>\n\n <div className={styles.checkDateField}>\n <DatePickerField\n name=\"checkDate\"\n label={t('checkDateLabel')}\n description={t('checkDateDescription')}\n isRequired\n minDate={checkDateMinimum}\n maxDate={maxDate}\n />\n </div>\n\n <CheckboxField\n name=\"isCheckOnly\"\n label={t('checkOnlyLabel')}\n description={t('checkOnlyDescription')}\n />\n </div>\n )\n}\n"],"names":["OffCyclePayPeriodDateFormPresentation","minCheckDate","minCheckOnlyDate","maxDate","minPayPeriodDate","useI18n","t","useTranslation","control","useFormContext","checkDateMinimum","useWatch","jsxs","styles","jsx","DatePickerField","CheckboxField"],"mappings":";;;;;;;AAoBO,SAASA,EAAsC;AAAA,EACpD,cAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,kBAAAC;AACF,GAA+C;AAC7C,EAAAC,EAAQ,mCAAmC;AAC3C,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,mCAAmC,GAE1D,EAAE,SAAAC,EAAA,IAAYC,EAAA,GAOdC,IANcC,EAAS,EAAE,SAAAH,GAAS,MAAM,eAAe,IAMtBN,IAAmBD;AAE1D,SACE,gBAAAW,EAAC,OAAA,EAAI,WAAWC,EAAO,MACrB,UAAA;AAAA,IAAA,gBAAAD,EAAC,OAAA,EAAI,WAAWC,EAAO,YACrB,UAAA;AAAA,MAAA,gBAAAC;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,OAAOT,EAAE,gBAAgB;AAAA,UACzB,YAAU;AAAA,UACV,SAASF;AAAA,UACT,SAAAD;AAAA,QAAA;AAAA,MAAA;AAAA,MAEF,gBAAAW;AAAA,QAACC;AAAA,QAAA;AAAA,UACC,MAAK;AAAA,UACL,OAAOT,EAAE,cAAc;AAAA,UACvB,YAAU;AAAA,UACV,SAASF;AAAA,UACT,SAAAD;AAAA,QAAA;AAAA,MAAA;AAAA,IACF,GACF;AAAA,IAEA,gBAAAW,EAAC,OAAA,EAAI,WAAWD,EAAO,gBACrB,UAAA,gBAAAC;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOT,EAAE,gBAAgB;AAAA,QACzB,aAAaA,EAAE,sBAAsB;AAAA,QACrC,YAAU;AAAA,QACV,SAASI;AAAA,QACT,SAAAP;AAAA,MAAA;AAAA,IAAA,GAEJ;AAAA,IAEA,gBAAAW;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOV,EAAE,gBAAgB;AAAA,QACzB,aAAaA,EAAE,sBAAsB;AAAA,MAAA;AAAA,IAAA;AAAA,EACvC,GACF;AAEJ;"}
|
package/dist/components/Payroll/OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo as s } from "react";
|
|
3
3
|
import { useTranslation as l } from "react-i18next";
|
|
4
|
-
import "classnames";
|
|
5
|
-
import "../../../shared/constants.js";
|
|
6
4
|
import { RadioGroupField as c } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
7
|
-
function
|
|
5
|
+
function m({
|
|
8
6
|
name: e,
|
|
9
7
|
onChange: i,
|
|
10
8
|
className: t
|
|
11
9
|
}) {
|
|
12
|
-
const { t: o } = l("Payroll.OffCycleReasonSelection"),
|
|
10
|
+
const { t: o } = l("Payroll.OffCycleReasonSelection"), n = s(
|
|
13
11
|
() => [
|
|
14
12
|
{
|
|
15
13
|
value: "correction",
|
|
@@ -24,12 +22,12 @@ function d({
|
|
|
24
22
|
],
|
|
25
23
|
[o]
|
|
26
24
|
);
|
|
27
|
-
return /* @__PURE__ */
|
|
25
|
+
return /* @__PURE__ */ r(
|
|
28
26
|
c,
|
|
29
27
|
{
|
|
30
28
|
name: e,
|
|
31
29
|
label: o("title"),
|
|
32
|
-
options:
|
|
30
|
+
options: n,
|
|
33
31
|
isRequired: !0,
|
|
34
32
|
onChange: i,
|
|
35
33
|
className: t
|
|
@@ -37,6 +35,6 @@ function d({
|
|
|
37
35
|
);
|
|
38
36
|
}
|
|
39
37
|
export {
|
|
40
|
-
|
|
38
|
+
m as OffCycleReasonSelectionPresentation
|
|
41
39
|
};
|
|
42
40
|
//# sourceMappingURL=OffCycleReasonSelectionPresentation.js.map
|