@gusto/embedded-react-sdk 0.29.0 → 0.30.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 +19 -0
- package/dist/components/Common/SignatureForm/SignatureFormActions.js +3 -2
- package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormFields.js +7 -6
- package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
- package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/components/Common/UI/FileInput/FileInput.js +1 -1
- package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js +3 -2
- package/dist/components/Company/AssignSignatory/AssignSignatorySelection.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js +3 -2
- package/dist/components/Company/AssignSignatory/CreateSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js +4 -3
- package/dist/components/Company/AssignSignatory/CreateSignatory/useCreateSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js +3 -2
- package/dist/components/Company/AssignSignatory/InviteSignatory/Actions.js.map +1 -1
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js +4 -3
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +1 -1
- package/dist/components/Company/AssignSignatory/TitleSelect.js +1 -1
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js +6 -5
- package/dist/components/Company/AssignSignatory/useAssignSignatory.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +6 -6
- package/dist/components/Company/BankAccount/BankAccountForm/context.js +4 -3
- package/dist/components/Company/BankAccount/BankAccountForm/context.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js +3 -2
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +7 -6
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js +3 -2
- package/dist/components/Company/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js +4 -3
- package/dist/components/Company/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js +4 -3
- package/dist/components/Company/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Company/FederalTaxes/Actions.js +7 -6
- package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js +9 -8
- package/dist/components/Company/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Company/Industry/Actions.js +8 -7
- package/dist/components/Company/Industry/Actions.js.map +1 -1
- package/dist/components/Company/Industry/Context.js +7 -6
- package/dist/components/Company/Industry/Context.js.map +1 -1
- package/dist/components/Company/Industry/Edit.js +3 -2
- package/dist/components/Company/Industry/Edit.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/Actions.js +7 -6
- package/dist/components/Company/Locations/LocationForm/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js +4 -3
- package/dist/components/Company/Locations/LocationForm/useLocationForm.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/Actions.js +3 -2
- package/dist/components/Company/Locations/LocationsList/Actions.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/List.js +7 -6
- package/dist/components/Company/Locations/LocationsList/List.js.map +1 -1
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js +4 -3
- package/dist/components/Company/Locations/LocationsList/useLocationsList.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/context.js +4 -3
- package/dist/components/Company/OnboardingOverview/context.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Actions.js +3 -2
- package/dist/components/Company/PaySchedule/_parts/Actions.js.map +1 -1
- package/dist/components/Company/PaySchedule/usePaySchedule.js +6 -5
- package/dist/components/Company/PaySchedule/usePaySchedule.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js +3 -2
- package/dist/components/Company/StateTaxes/StateTaxesForm/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js +4 -3
- package/dist/components/Company/StateTaxes/StateTaxesForm/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js +3 -2
- package/dist/components/Company/StateTaxes/StateTaxesList/Actions.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js +3 -2
- package/dist/components/Company/StateTaxes/StateTaxesList/List.js.map +1 -1
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js +4 -3
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Contractor/Address/Form.js +4 -4
- package/dist/components/Contractor/Address/useAddress.js +6 -5
- package/dist/components/Contractor/Address/useAddress.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +11 -10
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -1
- package/dist/components/Contractor/PaymentMethod/PaymentTypeForm.js +1 -1
- package/dist/components/Contractor/Profile/ContractorProfileForm.js +11 -11
- package/dist/components/Employee/Compensation/Actions.js +1 -1
- package/dist/components/Employee/Compensation/Edit.js +20 -16
- package/dist/components/Employee/Compensation/Edit.js.map +1 -1
- package/dist/components/Employee/Compensation/List.js +23 -22
- package/dist/components/Employee/Compensation/List.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js +3 -2
- package/dist/components/Employee/Deductions/DeductionsForm/ChildSupportForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +3 -2
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js.map +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js +3 -2
- package/dist/components/Employee/Deductions/DeductionsForm/GarnishmentForm.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +3 -2
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js +4 -3
- package/dist/components/Employee/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js +4 -3
- package/dist/components/Employee/DocumentSigner/SignatureForm/useSignatureForm.js.map +1 -1
- package/dist/components/Employee/EmployeeList/Actions.js +7 -6
- package/dist/components/Employee/EmployeeList/Actions.js.map +1 -1
- package/dist/components/Employee/EmployeeList/List.js +12 -12
- package/dist/components/Employee/EmployeeList/useEmployeeList.js +4 -3
- package/dist/components/Employee/EmployeeList/useEmployeeList.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/Actions.js +6 -5
- package/dist/components/Employee/FederalTaxes/Actions.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/FederalForm.js +5 -4
- package/dist/components/Employee/FederalTaxes/FederalForm.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js +4 -3
- package/dist/components/Employee/FederalTaxes/useFederalTaxes.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/Actions.js +6 -5
- package/dist/components/Employee/PaymentMethod/Actions.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountEdit.js +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountsList.js +6 -6
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +1 -1
- package/dist/components/Employee/PaymentMethod/Split.js +1 -1
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js +6 -5
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/Actions.js +6 -5
- package/dist/components/Employee/Profile/Actions.js.map +1 -1
- package/dist/components/Employee/Profile/AdminPersonalDetails.js +5 -4
- package/dist/components/Employee/Profile/AdminPersonalDetails.js.map +1 -1
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js +9 -8
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js.map +1 -1
- package/dist/components/Employee/Profile/useProfile.js +4 -3
- package/dist/components/Employee/Profile/useProfile.js.map +1 -1
- package/dist/components/Employee/StateTaxes/Actions.js +6 -5
- package/dist/components/Employee/StateTaxes/Actions.js.map +1 -1
- package/dist/components/Employee/StateTaxes/useStateTaxes.js +4 -3
- package/dist/components/Employee/StateTaxes/useStateTaxes.js.map +1 -1
- package/dist/components/Employee/Taxes/Actions.js +7 -6
- package/dist/components/Employee/Taxes/Actions.js.map +1 -1
- package/dist/components/Employee/Taxes/FederalForm.js +7 -6
- package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
- package/dist/components/Employee/Taxes/useTaxes.js +4 -3
- package/dist/components/Employee/Taxes/useTaxes.js.map +1 -1
- package/dist/components/Payroll/PayPeriodDateForm/PayPeriodDateFormPresentation.js +11 -10
- package/dist/components/Payroll/PayPeriodDateForm/PayPeriodDateFormPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +4 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.d.ts +17 -0
- package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.js +75 -0
- package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.js.map +1 -0
- package/dist/components/Payroll/PayrollExecutionFlow/index.d.ts +3 -0
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.d.ts +9 -0
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js +198 -0
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js.map +1 -0
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.test.d.ts +1 -0
- package/dist/components/Payroll/PayrollFlow/PayrollExecutionFlowContextual.d.ts +1 -0
- package/dist/components/Payroll/PayrollFlow/PayrollExecutionFlowContextual.js +49 -0
- package/dist/components/Payroll/PayrollFlow/PayrollExecutionFlowContextual.js.map +1 -0
- package/dist/components/Payroll/PayrollFlow/PayrollFlow.js +17 -13
- package/dist/components/Payroll/PayrollFlow/PayrollFlow.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.d.ts +1 -0
- package/dist/components/Payroll/PayrollFlow/PayrollFlowComponents.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.d.ts +3 -6
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js +115 -300
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.test.d.ts +1 -0
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +15 -13
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
- package/dist/components/Payroll/index.d.ts +1 -0
- package/dist/components/Payroll/index.js +14 -12
- package/dist/components/Payroll/index.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +6 -5
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +4 -2
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/helpers/formattedStrings.js +12 -11
- package/dist/helpers/formattedStrings.js.map +1 -1
- package/package.json +6 -4
|
@@ -2,6 +2,7 @@ import { jsx as i, jsxs as n, Fragment as a } from "react/jsx-runtime";
|
|
|
2
2
|
import { useTranslation as o, Trans as u } from "react-i18next";
|
|
3
3
|
import { useFormContext as m } from "react-hook-form";
|
|
4
4
|
import { z as t } from "zod";
|
|
5
|
+
import "../../../shared/constants.js";
|
|
5
6
|
import "classnames";
|
|
6
7
|
import { useComponentContext as f } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
7
8
|
import "react";
|
|
@@ -9,7 +10,7 @@ import { SelectField as s } from "../../Common/Fields/SelectField/SelectField.js
|
|
|
9
10
|
import { RadioGroupField as g } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
10
11
|
import { NumberInputField as l } from "../../Common/Fields/NumberInputField/NumberInputField.js";
|
|
11
12
|
import { TextInputField as c } from "../../Common/Fields/TextInputField/TextInputField.js";
|
|
12
|
-
const
|
|
13
|
+
const p = t.object({
|
|
13
14
|
w4DataType: t.literal("rev_2020_w4"),
|
|
14
15
|
filingStatus: t.string().min(1),
|
|
15
16
|
twoJobs: t.string().min(1),
|
|
@@ -17,13 +18,13 @@ const h = t.object({
|
|
|
17
18
|
otherIncome: t.number().transform(String),
|
|
18
19
|
deductions: t.number().transform(String),
|
|
19
20
|
extraWithholding: t.number().transform(String)
|
|
20
|
-
}),
|
|
21
|
+
}), h = t.object({
|
|
21
22
|
w4DataType: t.literal("pre_2020_w4"),
|
|
22
23
|
filingStatus: t.string().min(1),
|
|
23
24
|
federalWithholdingAllowance: t.number().int(),
|
|
24
25
|
additionalWithholding: t.string()
|
|
25
|
-
}),
|
|
26
|
-
function
|
|
26
|
+
}), H = t.discriminatedUnion("w4DataType", [p, h]);
|
|
27
|
+
function A() {
|
|
27
28
|
const { watch: e } = m();
|
|
28
29
|
return e("w4DataType") === "rev_2020_w4" ? /* @__PURE__ */ i(b, {}) : /* @__PURE__ */ i(S, {});
|
|
29
30
|
}
|
|
@@ -159,7 +160,7 @@ function S() {
|
|
|
159
160
|
] });
|
|
160
161
|
}
|
|
161
162
|
export {
|
|
162
|
-
|
|
163
|
-
|
|
163
|
+
A as FederalForm,
|
|
164
|
+
H as FederalFormSchema
|
|
164
165
|
};
|
|
165
166
|
//# sourceMappingURL=FederalForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FederalForm.js","sources":["../../../../src/components/Employee/Taxes/FederalForm.tsx"],"sourcesContent":["import { Trans, useTranslation } from 'react-i18next'\nimport { useFormContext } from 'react-hook-form'\nimport { z } from 'zod'\nimport { NumberInputField, RadioGroupField, SelectField, TextInputField } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nconst Rev2020Schema = z.object({\n w4DataType: z.literal('rev_2020_w4'),\n filingStatus: z.string().min(1),\n twoJobs: z.string().min(1),\n dependentsAmount: z.number().transform(String),\n otherIncome: z.number().transform(String),\n deductions: z.number().transform(String),\n extraWithholding: z.number().transform(String),\n})\n\nconst Pre2020Schema = z.object({\n w4DataType: z.literal('pre_2020_w4'),\n filingStatus: z.string().min(1),\n federalWithholdingAllowance: z.number().int(),\n additionalWithholding: z.string(),\n})\n\nexport const FederalFormSchema = z.discriminatedUnion('w4DataType', [Rev2020Schema, Pre2020Schema])\n\nexport type FederalFormInputs = z.input<typeof FederalFormSchema>\nexport type FederalFormPayload = z.output<typeof FederalFormSchema>\n\nexport function FederalForm() {\n const { watch } = useFormContext<FederalFormInputs>()\n const w4DataType = watch('w4DataType')\n\n if (w4DataType === 'rev_2020_w4') {\n return <Rev2020Form />\n }\n\n return <Pre2020Form />\n}\n\nfunction Rev2020Form() {\n const { t } = useTranslation('Employee.Taxes')\n const Components = useComponentContext()\n\n const filingStatusOptions = [\n { value: 'Single', label: t('filingStatusSingle') },\n { value: 'Married', label: t('filingStatusMarried') },\n { value: 'Head of Household', label: t('filingStatusHeadOfHousehold') },\n { value: 'Exempt from withholding', label: t('filingStatusExemptFromWithholding') },\n ]\n\n return (\n <>\n <SelectField\n name=\"filingStatus\"\n label={t('federalFilingStatus1c')}\n placeholder={t('federalFilingStatusPlaceholder')}\n options={filingStatusOptions}\n isRequired\n errorMessage={t('validations.federalFilingStatus')}\n />\n <RadioGroupField\n name=\"twoJobs\"\n isRequired\n label={t('multipleJobs2c')}\n errorMessage={t('validations.federalTwoJobs')}\n description={\n <Components.Text>\n <Trans\n i18nKey={'includesSpouseExplanation'}\n t={t}\n components={{\n IrsLink: <Components.Link />,\n }}\n />\n </Components.Text>\n }\n options={[\n { value: 'true', label: t('twoJobYesLabel') },\n { value: 'false', label: t('twoJobNoLabel') },\n ]}\n />\n <NumberInputField\n name=\"dependentsAmount\"\n isRequired\n label={t('dependentsTotalIfApplicable')}\n format=\"currency\"\n min={0}\n errorMessage={t('fieldIsRequired')}\n />\n <NumberInputField\n name=\"otherIncome\"\n isRequired\n label={t('otherIncome')}\n format=\"currency\"\n min={0}\n errorMessage={t('fieldIsRequired')}\n />\n <NumberInputField\n name=\"deductions\"\n isRequired\n label={t('deductions')}\n format=\"currency\"\n min={0}\n errorMessage={t('fieldIsRequired')}\n />\n <NumberInputField\n name=\"extraWithholding\"\n isRequired\n label={t('extraWithholding')}\n format=\"currency\"\n min={0}\n errorMessage={t('fieldIsRequired')}\n />\n </>\n )\n}\n\nfunction Pre2020Form() {\n const { t } = useTranslation('Employee.Taxes')\n\n const filingStatusOptions = [\n { value: 'Single', label: t('filingStatusSingle') },\n { value: 'Married', label: t('filingStatusMarried') },\n { value: 'Head of Household', label: t('filingStatusHeadOfHousehold') },\n { value: 'Exempt from withholding', label: t('filingStatusExemptFromWithholding') },\n { value: 'Married, but withhold as Single', label: t('filingStatusMarriedWithholdAsSingle') },\n ]\n\n return (\n <>\n <NumberInputField\n name=\"federalWithholdingAllowance\"\n isRequired\n label={t('federalWithholdingAllowance')}\n min={0}\n maximumFractionDigits={0}\n errorMessage={t('fieldIsRequired')}\n />\n <SelectField\n name=\"filingStatus\"\n label={t('filingStatus')}\n placeholder={t('federalFilingStatusPlaceholder')}\n description={t('selectWithholdingDescription')}\n options={filingStatusOptions}\n isRequired\n errorMessage={t('validations.federalFilingStatus')}\n />\n <TextInputField\n name=\"additionalWithholding\"\n label={t('additionalWithholding')}\n type=\"number\"\n errorMessage={t('fieldIsRequired')}\n />\n </>\n )\n}\n"],"names":["Rev2020Schema","z","Pre2020Schema","FederalFormSchema","FederalForm","watch","useFormContext","Rev2020Form","Pre2020Form","t","useTranslation","Components","useComponentContext","filingStatusOptions","jsxs","Fragment","jsx","SelectField","RadioGroupField","Trans","NumberInputField","TextInputField"],"mappings":"
|
|
1
|
+
{"version":3,"file":"FederalForm.js","sources":["../../../../src/components/Employee/Taxes/FederalForm.tsx"],"sourcesContent":["import { Trans, useTranslation } from 'react-i18next'\nimport { useFormContext } from 'react-hook-form'\nimport { z } from 'zod'\nimport { NumberInputField, RadioGroupField, SelectField, TextInputField } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nconst Rev2020Schema = z.object({\n w4DataType: z.literal('rev_2020_w4'),\n filingStatus: z.string().min(1),\n twoJobs: z.string().min(1),\n dependentsAmount: z.number().transform(String),\n otherIncome: z.number().transform(String),\n deductions: z.number().transform(String),\n extraWithholding: z.number().transform(String),\n})\n\nconst Pre2020Schema = z.object({\n w4DataType: z.literal('pre_2020_w4'),\n filingStatus: z.string().min(1),\n federalWithholdingAllowance: z.number().int(),\n additionalWithholding: z.string(),\n})\n\nexport const FederalFormSchema = z.discriminatedUnion('w4DataType', [Rev2020Schema, Pre2020Schema])\n\nexport type FederalFormInputs = z.input<typeof FederalFormSchema>\nexport type FederalFormPayload = z.output<typeof FederalFormSchema>\n\nexport function FederalForm() {\n const { watch } = useFormContext<FederalFormInputs>()\n const w4DataType = watch('w4DataType')\n\n if (w4DataType === 'rev_2020_w4') {\n return <Rev2020Form />\n }\n\n return <Pre2020Form />\n}\n\nfunction Rev2020Form() {\n const { t } = useTranslation('Employee.Taxes')\n const Components = useComponentContext()\n\n const filingStatusOptions = [\n { value: 'Single', label: t('filingStatusSingle') },\n { value: 'Married', label: t('filingStatusMarried') },\n { value: 'Head of Household', label: t('filingStatusHeadOfHousehold') },\n { value: 'Exempt from withholding', label: t('filingStatusExemptFromWithholding') },\n ]\n\n return (\n <>\n <SelectField\n name=\"filingStatus\"\n label={t('federalFilingStatus1c')}\n placeholder={t('federalFilingStatusPlaceholder')}\n options={filingStatusOptions}\n isRequired\n errorMessage={t('validations.federalFilingStatus')}\n />\n <RadioGroupField\n name=\"twoJobs\"\n isRequired\n label={t('multipleJobs2c')}\n errorMessage={t('validations.federalTwoJobs')}\n description={\n <Components.Text>\n <Trans\n i18nKey={'includesSpouseExplanation'}\n t={t}\n components={{\n IrsLink: <Components.Link />,\n }}\n />\n </Components.Text>\n }\n options={[\n { value: 'true', label: t('twoJobYesLabel') },\n { value: 'false', label: t('twoJobNoLabel') },\n ]}\n />\n <NumberInputField\n name=\"dependentsAmount\"\n isRequired\n label={t('dependentsTotalIfApplicable')}\n format=\"currency\"\n min={0}\n errorMessage={t('fieldIsRequired')}\n />\n <NumberInputField\n name=\"otherIncome\"\n isRequired\n label={t('otherIncome')}\n format=\"currency\"\n min={0}\n errorMessage={t('fieldIsRequired')}\n />\n <NumberInputField\n name=\"deductions\"\n isRequired\n label={t('deductions')}\n format=\"currency\"\n min={0}\n errorMessage={t('fieldIsRequired')}\n />\n <NumberInputField\n name=\"extraWithholding\"\n isRequired\n label={t('extraWithholding')}\n format=\"currency\"\n min={0}\n errorMessage={t('fieldIsRequired')}\n />\n </>\n )\n}\n\nfunction Pre2020Form() {\n const { t } = useTranslation('Employee.Taxes')\n\n const filingStatusOptions = [\n { value: 'Single', label: t('filingStatusSingle') },\n { value: 'Married', label: t('filingStatusMarried') },\n { value: 'Head of Household', label: t('filingStatusHeadOfHousehold') },\n { value: 'Exempt from withholding', label: t('filingStatusExemptFromWithholding') },\n { value: 'Married, but withhold as Single', label: t('filingStatusMarriedWithholdAsSingle') },\n ]\n\n return (\n <>\n <NumberInputField\n name=\"federalWithholdingAllowance\"\n isRequired\n label={t('federalWithholdingAllowance')}\n min={0}\n maximumFractionDigits={0}\n errorMessage={t('fieldIsRequired')}\n />\n <SelectField\n name=\"filingStatus\"\n label={t('filingStatus')}\n placeholder={t('federalFilingStatusPlaceholder')}\n description={t('selectWithholdingDescription')}\n options={filingStatusOptions}\n isRequired\n errorMessage={t('validations.federalFilingStatus')}\n />\n <TextInputField\n name=\"additionalWithholding\"\n label={t('additionalWithholding')}\n type=\"number\"\n errorMessage={t('fieldIsRequired')}\n />\n </>\n )\n}\n"],"names":["Rev2020Schema","z","Pre2020Schema","FederalFormSchema","FederalForm","watch","useFormContext","Rev2020Form","Pre2020Form","t","useTranslation","Components","useComponentContext","filingStatusOptions","jsxs","Fragment","jsx","SelectField","RadioGroupField","Trans","NumberInputField","TextInputField"],"mappings":";;;;;;;;;;;;AAMA,MAAMA,IAAgBC,EAAE,OAAO;AAAA,EAC7B,YAAYA,EAAE,QAAQ,aAAa;AAAA,EACnC,cAAcA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC9B,SAASA,EAAE,SAAS,IAAI,CAAC;AAAA,EACzB,kBAAkBA,EAAE,SAAS,UAAU,MAAM;AAAA,EAC7C,aAAaA,EAAE,SAAS,UAAU,MAAM;AAAA,EACxC,YAAYA,EAAE,SAAS,UAAU,MAAM;AAAA,EACvC,kBAAkBA,EAAE,OAAA,EAAS,UAAU,MAAM;AAC/C,CAAC,GAEKC,IAAgBD,EAAE,OAAO;AAAA,EAC7B,YAAYA,EAAE,QAAQ,aAAa;AAAA,EACnC,cAAcA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC9B,6BAA6BA,EAAE,OAAA,EAAS,IAAA;AAAA,EACxC,uBAAuBA,EAAE,OAAA;AAC3B,CAAC,GAEYE,IAAoBF,EAAE,mBAAmB,cAAc,CAACD,GAAeE,CAAa,CAAC;AAK3F,SAASE,IAAc;AAC5B,QAAM,EAAE,OAAAC,EAAA,IAAUC,EAAA;AAGlB,SAFmBD,EAAM,YAAY,MAElB,kCACTE,GAAA,EAAY,sBAGdC,GAAA,EAAY;AACtB;AAEA,SAASD,IAAc;AACrB,QAAM,EAAE,GAAAE,EAAA,IAAMC,EAAe,gBAAgB,GACvCC,IAAaC,EAAA,GAEbC,IAAsB;AA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C,KAAK;AAAA,QACL,uBAAuB;AAAA,QACvB,cAAcA,EAAE,iBAAiB;AAAA,MAAA;AAAA,IAAA;AAAA,IAEnC,gBAAAO;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOR,EAAE,cAAc;AAAA,QACvB,aAAaA,EAAE,gCAAgC;AAAA,QAC/C,aAAaA,EAAE,8BAA8B;AAAA,QAC7C,SAASI;AAAA,QACT,YAAU;AAAA,QACV,cAAcJ,EAAE,iCAAiC;AAAA,MAAA;AAAA,IAAA;AAAA,IAEnD,gBAAAO;AAAA,MAACK;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,OAAOZ,EAAE,uBAAuB;AAAA,QAChC,MAAK;AAAA,QACL,cAAcA,EAAE,iBAAiB;AAAA,MAAA;AAAA,IAAA;AAAA,EACnC,GACF;AAEJ;"}
|
|
@@ -10,10 +10,11 @@ import "../../../shared/constants.js";
|
|
|
10
10
|
import "classnames";
|
|
11
11
|
import "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
12
12
|
import "dompurify";
|
|
13
|
+
import "../../../contexts/LocaleProvider/useLocale.js";
|
|
13
14
|
import { createCompoundContext as o } from "../../Base/createCompoundContext.js";
|
|
14
|
-
const [
|
|
15
|
+
const [u, f] = o("TaxesContext");
|
|
15
16
|
export {
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
f as TaxesProvider,
|
|
18
|
+
u as useTaxes
|
|
18
19
|
};
|
|
19
20
|
//# sourceMappingURL=useTaxes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTaxes.js","sources":["../../../../src/components/Employee/Taxes/useTaxes.ts"],"sourcesContent":["import type { EmployeeStateTaxesList } from '@gusto/embedded-api/models/components/employeestatetaxeslist'\nimport { createCompoundContext } from '@/components/Base'\n\ntype TaxesContextType = {\n employeeStateTaxes: EmployeeStateTaxesList[]\n isPending: boolean\n isAdmin: boolean\n}\n\nconst [useTaxes, TaxesProvider] = createCompoundContext<TaxesContextType>('TaxesContext')\nexport { useTaxes, TaxesProvider }\n"],"names":["useTaxes","TaxesProvider","createCompoundContext"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useTaxes.js","sources":["../../../../src/components/Employee/Taxes/useTaxes.ts"],"sourcesContent":["import type { EmployeeStateTaxesList } from '@gusto/embedded-api/models/components/employeestatetaxeslist'\nimport { createCompoundContext } from '@/components/Base'\n\ntype TaxesContextType = {\n employeeStateTaxes: EmployeeStateTaxesList[]\n isPending: boolean\n isAdmin: boolean\n}\n\nconst [useTaxes, TaxesProvider] = createCompoundContext<TaxesContextType>('TaxesContext')\nexport { useTaxes, TaxesProvider }\n"],"names":["useTaxes","TaxesProvider","createCompoundContext"],"mappings":";;;;;;;;;;;;;;AASA,MAAM,CAACA,GAAUC,CAAa,IAAIC,EAAwC,cAAc;"}
|
|
@@ -4,19 +4,20 @@ import { useTranslation as f } from "react-i18next";
|
|
|
4
4
|
import a from "./PayPeriodDateFormPresentation.module.scss.js";
|
|
5
5
|
import { useI18n as y } from "../../../i18n/I18n.js";
|
|
6
6
|
import { useComponentContext as P } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
7
|
+
import "../../../shared/constants.js";
|
|
7
8
|
import "classnames";
|
|
8
9
|
import "react";
|
|
9
10
|
import { CheckboxField as k } from "../../Common/Fields/CheckboxField/CheckboxField.js";
|
|
10
11
|
import { DatePickerField as r } from "../../Common/Fields/DatePickerField/DatePickerField.js";
|
|
11
|
-
function
|
|
12
|
-
isCheckOnly:
|
|
12
|
+
function j({
|
|
13
|
+
isCheckOnly: o,
|
|
13
14
|
onCheckOnlyChange: l,
|
|
14
15
|
isPending: c
|
|
15
16
|
}) {
|
|
16
|
-
const { Heading: d, Text: m, Button:
|
|
17
|
+
const { Heading: d, Text: m, Button: p } = P();
|
|
17
18
|
y("Payroll.PayPeriodDateForm");
|
|
18
|
-
const { t: e } = f("Payroll.PayPeriodDateForm"), { setValue:
|
|
19
|
-
l(s), s && (
|
|
19
|
+
const { t: e } = f("Payroll.PayPeriodDateForm"), { setValue: n } = D(), h = b({ name: "startDate" }), u = (s) => {
|
|
20
|
+
l(s), s && (n("startDate", null), n("endDate", null));
|
|
20
21
|
};
|
|
21
22
|
return /* @__PURE__ */ i("div", { className: a.root, children: [
|
|
22
23
|
/* @__PURE__ */ i("div", { className: a.sectionHeader, children: [
|
|
@@ -24,7 +25,7 @@ function T({
|
|
|
24
25
|
/* @__PURE__ */ t(m, { variant: "supporting", children: e("description") })
|
|
25
26
|
] }),
|
|
26
27
|
/* @__PURE__ */ i("div", { className: a.formSection, children: [
|
|
27
|
-
!
|
|
28
|
+
!o && /* @__PURE__ */ i("div", { className: a.dateFields, children: [
|
|
28
29
|
/* @__PURE__ */ t(r, { name: "startDate", label: e("startDateLabel"), isRequired: !0 }),
|
|
29
30
|
/* @__PURE__ */ t(
|
|
30
31
|
r,
|
|
@@ -32,7 +33,7 @@ function T({
|
|
|
32
33
|
name: "endDate",
|
|
33
34
|
label: e("endDateLabel"),
|
|
34
35
|
isRequired: !0,
|
|
35
|
-
isDisabled: !
|
|
36
|
+
isDisabled: !h
|
|
36
37
|
}
|
|
37
38
|
)
|
|
38
39
|
] }),
|
|
@@ -41,7 +42,7 @@ function T({
|
|
|
41
42
|
{
|
|
42
43
|
name: "checkDate",
|
|
43
44
|
label: e("checkDateLabel"),
|
|
44
|
-
description:
|
|
45
|
+
description: o ? void 0 : e("checkDateDescription"),
|
|
45
46
|
isRequired: !0
|
|
46
47
|
}
|
|
47
48
|
) }),
|
|
@@ -55,10 +56,10 @@ function T({
|
|
|
55
56
|
}
|
|
56
57
|
)
|
|
57
58
|
] }),
|
|
58
|
-
/* @__PURE__ */ t("div", { className: a.actions, children: /* @__PURE__ */ t(
|
|
59
|
+
/* @__PURE__ */ t("div", { className: a.actions, children: /* @__PURE__ */ t(p, { type: "submit", isDisabled: c, children: e("continueButton") }) })
|
|
59
60
|
] });
|
|
60
61
|
}
|
|
61
62
|
export {
|
|
62
|
-
|
|
63
|
+
j as PayPeriodDateFormPresentation
|
|
63
64
|
};
|
|
64
65
|
//# sourceMappingURL=PayPeriodDateFormPresentation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayPeriodDateFormPresentation.js","sources":["../../../../src/components/Payroll/PayPeriodDateForm/PayPeriodDateFormPresentation.tsx"],"sourcesContent":["import { useFormContext, useWatch } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport styles from './PayPeriodDateFormPresentation.module.scss'\nimport type {\n PayPeriodDateFormData,\n PayPeriodDateFormPresentationProps,\n} from './PayPeriodDateFormTypes'\nimport { useI18n } from '@/i18n'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { CheckboxField, DatePickerField } from '@/components/Common'\n\nexport function PayPeriodDateFormPresentation({\n isCheckOnly,\n onCheckOnlyChange,\n isPending,\n}: Omit<PayPeriodDateFormPresentationProps, 'payrollType' | 'minCheckDate'>) {\n const { Heading, Text, Button } = useComponentContext()\n useI18n('Payroll.PayPeriodDateForm')\n const { t } = useTranslation('Payroll.PayPeriodDateForm')\n const { setValue } = useFormContext<PayPeriodDateFormData>()\n\n const startDate = useWatch<PayPeriodDateFormData, 'startDate'>({ name: 'startDate' })\n\n const handleCheckOnlyChange = (checked: boolean) => {\n onCheckOnlyChange(checked)\n if (checked) {\n setValue('startDate', null)\n setValue('endDate', null)\n }\n }\n\n return (\n <div className={styles.root}>\n <div className={styles.sectionHeader}>\n <Heading as=\"h2\">{t('pageTitle')}</Heading>\n <Text variant=\"supporting\">{t('description')}</Text>\n </div>\n\n <div className={styles.formSection}>\n {!isCheckOnly && (\n <div className={styles.dateFields}>\n <DatePickerField name=\"startDate\" label={t('startDateLabel')} isRequired />\n <DatePickerField\n name=\"endDate\"\n label={t('endDateLabel')}\n isRequired\n isDisabled={!startDate}\n />\n </div>\n )}\n\n <div className={styles.checkDateField}>\n <DatePickerField\n name=\"checkDate\"\n label={t('checkDateLabel')}\n description={isCheckOnly ? undefined : t('checkDateDescription')}\n isRequired\n />\n </div>\n\n <CheckboxField\n name=\"isCheckOnly\"\n label={t('checkOnlyLabel')}\n description={t('checkOnlyDescription')}\n onChange={handleCheckOnlyChange}\n />\n </div>\n\n <div className={styles.actions}>\n <Button type=\"submit\" isDisabled={isPending}>\n {t('continueButton')}\n </Button>\n </div>\n </div>\n )\n}\n"],"names":["PayPeriodDateFormPresentation","isCheckOnly","onCheckOnlyChange","isPending","Heading","Text","Button","useComponentContext","useI18n","t","useTranslation","setValue","useFormContext","startDate","useWatch","handleCheckOnlyChange","checked","jsxs","styles","jsx","DatePickerField","CheckboxField"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PayPeriodDateFormPresentation.js","sources":["../../../../src/components/Payroll/PayPeriodDateForm/PayPeriodDateFormPresentation.tsx"],"sourcesContent":["import { useFormContext, useWatch } from 'react-hook-form'\nimport { useTranslation } from 'react-i18next'\nimport styles from './PayPeriodDateFormPresentation.module.scss'\nimport type {\n PayPeriodDateFormData,\n PayPeriodDateFormPresentationProps,\n} from './PayPeriodDateFormTypes'\nimport { useI18n } from '@/i18n'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { CheckboxField, DatePickerField } from '@/components/Common'\n\nexport function PayPeriodDateFormPresentation({\n isCheckOnly,\n onCheckOnlyChange,\n isPending,\n}: Omit<PayPeriodDateFormPresentationProps, 'payrollType' | 'minCheckDate'>) {\n const { Heading, Text, Button } = useComponentContext()\n useI18n('Payroll.PayPeriodDateForm')\n const { t } = useTranslation('Payroll.PayPeriodDateForm')\n const { setValue } = useFormContext<PayPeriodDateFormData>()\n\n const startDate = useWatch<PayPeriodDateFormData, 'startDate'>({ name: 'startDate' })\n\n const handleCheckOnlyChange = (checked: boolean) => {\n onCheckOnlyChange(checked)\n if (checked) {\n setValue('startDate', null)\n setValue('endDate', null)\n }\n }\n\n return (\n <div className={styles.root}>\n <div className={styles.sectionHeader}>\n <Heading as=\"h2\">{t('pageTitle')}</Heading>\n <Text variant=\"supporting\">{t('description')}</Text>\n </div>\n\n <div className={styles.formSection}>\n {!isCheckOnly && (\n <div className={styles.dateFields}>\n <DatePickerField name=\"startDate\" label={t('startDateLabel')} isRequired />\n <DatePickerField\n name=\"endDate\"\n label={t('endDateLabel')}\n isRequired\n isDisabled={!startDate}\n />\n </div>\n )}\n\n <div className={styles.checkDateField}>\n <DatePickerField\n name=\"checkDate\"\n label={t('checkDateLabel')}\n description={isCheckOnly ? undefined : t('checkDateDescription')}\n isRequired\n />\n </div>\n\n <CheckboxField\n name=\"isCheckOnly\"\n label={t('checkOnlyLabel')}\n description={t('checkOnlyDescription')}\n onChange={handleCheckOnlyChange}\n />\n </div>\n\n <div className={styles.actions}>\n <Button type=\"submit\" isDisabled={isPending}>\n {t('continueButton')}\n </Button>\n </div>\n </div>\n )\n}\n"],"names":["PayPeriodDateFormPresentation","isCheckOnly","onCheckOnlyChange","isPending","Heading","Text","Button","useComponentContext","useI18n","t","useTranslation","setValue","useFormContext","startDate","useWatch","handleCheckOnlyChange","checked","jsxs","styles","jsx","DatePickerField","CheckboxField"],"mappings":";;;;;;;;;;;AAWO,SAASA,EAA8B;AAAA,EAC5C,aAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,WAAAC;AACF,GAA6E;AAC3E,QAAM,EAAE,SAAAC,GAAS,MAAAC,GAAM,QAAAC,EAAA,IAAWC,EAAA;AAClC,EAAAC,EAAQ,2BAA2B;AACnC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,2BAA2B,GAClD,EAAE,UAAAC,EAAA,IAAaC,EAAA,GAEfC,IAAYC,EAA6C,EAAE,MAAM,aAAa,GAE9EC,IAAwB,CAACC,MAAqB;AAClD,IAAAd,EAAkBc,CAAO,GACrBA,MACFL,EAAS,aAAa,IAAI,GAC1BA,EAAS,WAAW,IAAI;AAAA,EAE5B;AAEA,SACE,gBAAAM,EAAC,OAAA,EAAI,WAAWC,EAAO,MACrB,UAAA;AAAA,I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ACF;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayrollConfiguration.js","sources":["../../../../src/components/Payroll/PayrollConfiguration/PayrollConfiguration.tsx"],"sourcesContent":["import { useEffect, useState, type ReactNode } from 'react'\nimport { usePayrollsGetSuspense } from '@gusto/embedded-api/react-query/payrollsGet'\nimport { usePayrollsCalculateMutation } from '@gusto/embedded-api/react-query/payrollsCalculate'\nimport type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport type { PayrollProcessingRequest } from '@gusto/embedded-api/models/components/payrollprocessingrequest'\nimport { PayrollProcessingRequestStatus } from '@gusto/embedded-api/models/components/payrollprocessingrequest'\nimport { useTranslation } from 'react-i18next'\nimport { usePayrollsUpdateMutation } from '@gusto/embedded-api/react-query/payrollsUpdate'\nimport type { PayrollEmployeeCompensationsType } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype'\nimport type { PayrollUpdateEmployeeCompensations } from '@gusto/embedded-api/models/components/payrollupdate'\nimport { usePayrollsGetBlockersSuspense } from '@gusto/embedded-api/react-query/payrollsGetBlockers'\nimport { payrollSubmitHandler, type ApiPayrollBlocker } from '../PayrollBlocker/payrollHelpers'\nimport { PayrollConfigurationPresentation } from './PayrollConfigurationPresentation'\nimport { usePayrollConfigurationData } from './usePayrollConfigurationData'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { useBase } from '@/components/Base'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\n\nconst isCalculating = (processingRequest?: PayrollProcessingRequest | null) =>\n processingRequest?.status === PayrollProcessingRequestStatus.Calculating\nconst isCalculated = (processingRequest?: PayrollProcessingRequest | null) =>\n processingRequest?.status === PayrollProcessingRequestStatus.CalculateSuccess\n\ninterface PayrollConfigurationProps extends BaseComponentInterface<'Payroll.PayrollConfiguration'> {\n companyId: string\n payrollId: string\n alerts?: ReactNode\n withReimbursements?: boolean\n}\n\nexport function PayrollConfiguration(props: PayrollConfigurationProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nexport const Root = ({\n onEvent,\n companyId,\n payrollId,\n dictionary,\n alerts,\n withReimbursements = true,\n}: PayrollConfigurationProps) => {\n useComponentDictionary('Payroll.PayrollConfiguration', dictionary)\n useI18n('Payroll.PayrollConfiguration')\n const { t } = useTranslation('Payroll.PayrollConfiguration')\n const { baseSubmitHandler } = useBase()\n const dateFormatter = useDateFormatter()\n\n const [isPolling, setIsPolling] = useState(false)\n\n const {\n employeeDetails,\n employeeCompensations,\n paySchedule,\n payPeriod,\n isOffCycle,\n pagination,\n isLoading,\n refetch,\n } = usePayrollConfigurationData({ companyId, payrollId })\n\n const { data: payrollData } = usePayrollsGetSuspense(\n {\n companyId,\n payrollId,\n include: ['taxes', 'benefits', 'deductions', 'payroll_status_meta'],\n },\n { refetchInterval: isPolling ? 5_000 : false },\n )\n\n const { mutateAsync: calculatePayroll, isPending: isCalculatingPayroll } =\n usePayrollsCalculateMutation()\n\n const { mutateAsync: updatePayroll, isPending: isUpdatingPayroll } = usePayrollsUpdateMutation()\n\n const { data: blockersData } = usePayrollsGetBlockersSuspense({\n companyUuid: companyId,\n })\n\n const payrollBlockerList = blockersData.payrollBlockerList ?? []\n\n const blockersFromApi: ApiPayrollBlocker[] = payrollBlockerList.map(blocker => ({\n key: blocker.key ?? 'unknown',\n message: blocker.message,\n }))\n\n const [payrollBlockers, setPayrollBlockers] = useState<ApiPayrollBlocker[]>(blockersFromApi)\n\n const onCalculatePayroll = async () => {\n setPayrollBlockers([])\n\n await baseSubmitHandler({}, async () => {\n const result = await payrollSubmitHandler(async () => {\n await calculatePayroll({\n request: {\n companyId,\n payrollId,\n },\n })\n setIsPolling(true)\n })\n\n if (!result.success && result.blockers.length > 0) {\n setPayrollBlockers(result.blockers)\n }\n })\n }\n\n const onEdit = (employee: Employee) => {\n onEvent(componentEvents.RUN_PAYROLL_EMPLOYEE_EDIT, {\n employeeId: employee.uuid,\n firstName: employee.firstName,\n lastName: employee.lastName,\n })\n }\n\n const transformEmployeeCompensation = ({\n paymentMethod,\n reimbursements,\n ...compensation\n }: PayrollEmployeeCompensationsType): PayrollUpdateEmployeeCompensations => {\n return {\n ...compensation,\n ...(paymentMethod && paymentMethod !== 'Historical' ? { paymentMethod } : {}),\n memo: compensation.memo || undefined,\n }\n }\n\n const onToggleExclude = async (employeeCompensation: PayrollEmployeeCompensationsType) => {\n onEvent(componentEvents.RUN_PAYROLL_EMPLOYEE_SKIP, {\n employeeId: employeeCompensation.employeeUuid,\n })\n await baseSubmitHandler({}, async () => {\n const transformedCompensation = transformEmployeeCompensation(employeeCompensation)\n const result = await updatePayroll({\n request: {\n companyId,\n payrollId,\n payrollUpdate: {\n employeeCompensations: [\n { ...transformedCompensation, excluded: !transformedCompensation.excluded },\n ],\n },\n },\n })\n onEvent(componentEvents.RUN_PAYROLL_EMPLOYEE_SAVED, {\n payrollPrepared: result.payrollPrepared,\n })\n await refetch()\n })\n }\n\n const onViewBlockers = () => {\n onEvent(componentEvents.RUN_PAYROLL_BLOCKERS_VIEW_ALL)\n }\n\n useEffect(() => {\n if (isCalculating(payrollData.payrollShow?.processingRequest) && !isPolling) {\n setIsPolling(true)\n }\n if (isPolling && isCalculated(payrollData.payrollShow?.processingRequest)) {\n onEvent(componentEvents.RUN_PAYROLL_CALCULATED, {\n payrollId,\n alert: { type: 'success', title: t('alerts.progressSaved') },\n payPeriod: payrollData.payrollShow?.payPeriod,\n })\n setPayrollBlockers([])\n setIsPolling(false)\n }\n if (\n isPolling &&\n payrollData.payrollShow?.processingRequest?.status ===\n PayrollProcessingRequestStatus.ProcessingFailed\n ) {\n onEvent(componentEvents.RUN_PAYROLL_PROCESSING_FAILED)\n setIsPolling(false)\n }\n }, [payrollData.payrollShow?.processingRequest, isPolling, onEvent, t, payrollId])\n\n const payrollAlert =\n payrollData.payrollShow?.payrollStatusMeta?.payrollLate &&\n payrollData.payrollShow.payrollStatusMeta.initialCheckDate &&\n payrollData.payrollShow.payrollStatusMeta.expectedDebitTime &&\n payrollData.payrollShow.payrollStatusMeta.expectedCheckDate\n ? {\n label: t('alerts.payrollLate', {\n initialCheckDate: dateFormatter.formatShortWithWeekday(\n payrollData.payrollShow.payrollStatusMeta.initialCheckDate,\n ),\n }),\n content: t('alerts.payrollLateText', {\n ...dateFormatter.formatWithTime(\n payrollData.payrollShow.payrollStatusMeta.expectedDebitTime,\n ),\n newCheckDate: dateFormatter.formatShortWithWeekday(\n payrollData.payrollShow.payrollStatusMeta.expectedCheckDate,\n ),\n }),\n variant: 'warning' as const,\n }\n : payrollData.payrollShow\n ? {\n label: t('alerts.directDepositDeadline', {\n payDate: dateFormatter.formatShortWithWeekday(payrollData.payrollShow.checkDate),\n ...dateFormatter.formatWithTime(payrollData.payrollShow.payrollDeadline),\n }),\n content: t('alerts.directDepositDeadlineText'),\n variant: 'info' as const,\n }\n : undefined\n\n return (\n <PayrollConfigurationPresentation\n onCalculatePayroll={onCalculatePayroll}\n isCalculateDisabled={blockersFromApi.length > 0}\n onEdit={onEdit}\n onToggleExclude={onToggleExclude}\n onViewBlockers={onViewBlockers}\n employeeCompensations={employeeCompensations}\n employeeDetails={employeeDetails}\n payPeriod={payPeriod}\n paySchedule={paySchedule}\n isOffCycle={isOffCycle}\n alerts={alerts}\n payrollAlert={payrollAlert}\n isPending={isPolling || isLoading || isUpdatingPayroll || isCalculatingPayroll}\n isCalculating={isCalculatingPayroll || isPolling}\n payrollBlockers={payrollBlockers}\n pagination={pagination}\n withReimbursements={withReimbursements}\n />\n )\n}\n"],"names":["isCalculating","processingRequest","PayrollProcessingRequestStatus","isCalculated","PayrollConfiguration","props","jsx","BaseComponent","Root","onEvent","companyId","payrollId","dictionary","alerts","withReimbursements","useComponentDictionary","useI18n","t","useTranslation","baseSubmitHandler","useBase","dateFormatter","useDateFormatter","isPolling","setIsPolling","useState","employeeDetails","employeeCompensations","paySchedule","payPeriod","isOffCycle","pagination","isLoading","refetch","usePayrollConfigurationData","payrollData","usePayrollsGetSuspense","calculatePayroll","isCalculatingPayroll","usePayrollsCalculateMutation","updatePayroll","isUpdatingPayroll","usePayrollsUpdateMutation","blockersData","usePayrollsGetBlockersSuspense","blockersFromApi","blocker","payrollBlockers","setPayrollBlockers","onCalculatePayroll","result","payrollSubmitHandler","onEdit","employee","componentEvents","transformEmployeeCompensation","paymentMethod","reimbursements","compensation","onToggleExclude","employeeCompensation","transformedCompensation","onViewBlockers","useEffect","payrollAlert","PayrollConfigurationPresentation"],"mappings":";;;;;;;;;;;;;;;;AAqBA,MAAMA,KAAgB,CAACC,MACrBA,GAAmB,WAAWC,EAA+B,aACzDC,KAAe,CAACF,MACpBA,GAAmB,WAAWC,EAA+B;AASxD,SAASE,GAAqBC,GAA2D;AAC9F,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,MAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEO,MAAMG,KAAO,CAAC;AAAA,EACnB,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,QAAAC;AAAA,EACA,oBAAAC,IAAqB;AACvB,MAAiC;AAC/B,EAAAC,EAAuB,gCAAgCH,CAAU,GACjEI,EAAQ,8BAA8B;AACtC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,8BAA8B,GACrD,EAAE,mBAAAC,EAAA,IAAsBC,EAAA,GACxBC,IAAgBC,GAAA,GAEhB,CAACC,GAAWC,CAAY,IAAIC,EAAS,EAAK,GAE1C;AAAA,IACJ,iBAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC;AAAA,IACA,YAAAC;AAAA,IACA,YAAAC;AAAA,IACA,WAAAC;AAAA,IACA,SAAAC;AAAA,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C,iBAAAwB;AAAA,MACA,YAAAhB;AAAA,MACA,oBAAAjB;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
1
|
+
{"version":3,"file":"PayrollConfiguration.js","sources":["../../../../src/components/Payroll/PayrollConfiguration/PayrollConfiguration.tsx"],"sourcesContent":["import { useEffect, useState, type ReactNode } from 'react'\nimport { usePayrollsGetSuspense } from '@gusto/embedded-api/react-query/payrollsGet'\nimport { usePayrollsCalculateMutation } from '@gusto/embedded-api/react-query/payrollsCalculate'\nimport type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport type { PayrollProcessingRequest } from '@gusto/embedded-api/models/components/payrollprocessingrequest'\nimport { PayrollProcessingRequestStatus } from '@gusto/embedded-api/models/components/payrollprocessingrequest'\nimport { useTranslation } from 'react-i18next'\nimport { usePayrollsUpdateMutation } from '@gusto/embedded-api/react-query/payrollsUpdate'\nimport type { PayrollEmployeeCompensationsType } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype'\nimport type { PayrollUpdateEmployeeCompensations } from '@gusto/embedded-api/models/components/payrollupdate'\nimport { usePayrollsGetBlockersSuspense } from '@gusto/embedded-api/react-query/payrollsGetBlockers'\nimport { payrollSubmitHandler, type ApiPayrollBlocker } from '../PayrollBlocker/payrollHelpers'\nimport { PayrollConfigurationPresentation } from './PayrollConfigurationPresentation'\nimport { usePayrollConfigurationData } from './usePayrollConfigurationData'\nimport type { BaseComponentInterface } from '@/components/Base/Base'\nimport { BaseComponent } from '@/components/Base/Base'\nimport { componentEvents } from '@/shared/constants'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { useBase } from '@/components/Base'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\n\nconst isCalculating = (processingRequest?: PayrollProcessingRequest | null) =>\n processingRequest?.status === PayrollProcessingRequestStatus.Calculating\nconst isCalculated = (processingRequest?: PayrollProcessingRequest | null) =>\n processingRequest?.status === PayrollProcessingRequestStatus.CalculateSuccess\n\ninterface PayrollConfigurationProps extends BaseComponentInterface<'Payroll.PayrollConfiguration'> {\n companyId: string\n payrollId: string\n alerts?: ReactNode\n withReimbursements?: boolean\n}\n\nexport function PayrollConfiguration(props: PayrollConfigurationProps & BaseComponentInterface) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nexport const Root = ({\n onEvent,\n companyId,\n payrollId,\n dictionary,\n alerts,\n withReimbursements = true,\n}: PayrollConfigurationProps) => {\n useComponentDictionary('Payroll.PayrollConfiguration', dictionary)\n useI18n('Payroll.PayrollConfiguration')\n const { t } = useTranslation('Payroll.PayrollConfiguration')\n const { baseSubmitHandler } = useBase()\n const dateFormatter = useDateFormatter()\n\n const [isPolling, setIsPolling] = useState(false)\n\n const {\n employeeDetails,\n employeeCompensations,\n paySchedule,\n payPeriod,\n isOffCycle,\n pagination,\n isLoading,\n refetch,\n } = usePayrollConfigurationData({\n companyId,\n payrollId,\n })\n\n const { data: payrollData } = usePayrollsGetSuspense(\n {\n companyId,\n payrollId,\n include: ['taxes', 'benefits', 'deductions', 'payroll_status_meta'],\n },\n { refetchInterval: isPolling ? 5_000 : false },\n )\n\n const { mutateAsync: calculatePayroll, isPending: isCalculatingPayroll } =\n usePayrollsCalculateMutation()\n\n const { mutateAsync: updatePayroll, isPending: isUpdatingPayroll } = usePayrollsUpdateMutation()\n\n const { data: blockersData } = usePayrollsGetBlockersSuspense({\n companyUuid: companyId,\n })\n\n const payrollBlockerList = blockersData.payrollBlockerList ?? []\n\n const blockersFromApi: ApiPayrollBlocker[] = payrollBlockerList.map(blocker => ({\n key: blocker.key ?? 'unknown',\n message: blocker.message,\n }))\n\n const [payrollBlockers, setPayrollBlockers] = useState<ApiPayrollBlocker[]>(blockersFromApi)\n\n const onCalculatePayroll = async () => {\n setPayrollBlockers([])\n\n await baseSubmitHandler({}, async () => {\n const result = await payrollSubmitHandler(async () => {\n await calculatePayroll({\n request: {\n companyId,\n payrollId,\n },\n })\n setIsPolling(true)\n })\n\n if (!result.success && result.blockers.length > 0) {\n setPayrollBlockers(result.blockers)\n }\n })\n }\n\n const onEdit = (employee: Employee) => {\n onEvent(componentEvents.RUN_PAYROLL_EMPLOYEE_EDIT, {\n employeeId: employee.uuid,\n firstName: employee.firstName,\n lastName: employee.lastName,\n })\n }\n\n const transformEmployeeCompensation = ({\n paymentMethod,\n reimbursements,\n ...compensation\n }: PayrollEmployeeCompensationsType): PayrollUpdateEmployeeCompensations => {\n return {\n ...compensation,\n ...(paymentMethod && paymentMethod !== 'Historical' ? { paymentMethod } : {}),\n memo: compensation.memo || undefined,\n }\n }\n\n const onToggleExclude = async (employeeCompensation: PayrollEmployeeCompensationsType) => {\n onEvent(componentEvents.RUN_PAYROLL_EMPLOYEE_SKIP, {\n employeeId: employeeCompensation.employeeUuid,\n })\n await baseSubmitHandler({}, async () => {\n const transformedCompensation = transformEmployeeCompensation(employeeCompensation)\n const result = await updatePayroll({\n request: {\n companyId,\n payrollId,\n payrollUpdate: {\n employeeCompensations: [\n { ...transformedCompensation, excluded: !transformedCompensation.excluded },\n ],\n },\n },\n })\n onEvent(componentEvents.RUN_PAYROLL_EMPLOYEE_SAVED, {\n payrollPrepared: result.payrollPrepared,\n })\n await refetch()\n })\n }\n\n const onViewBlockers = () => {\n onEvent(componentEvents.RUN_PAYROLL_BLOCKERS_VIEW_ALL)\n }\n\n useEffect(() => {\n if (isCalculating(payrollData.payrollShow?.processingRequest) && !isPolling) {\n setIsPolling(true)\n }\n if (isPolling && isCalculated(payrollData.payrollShow?.processingRequest)) {\n onEvent(componentEvents.RUN_PAYROLL_CALCULATED, {\n payrollId,\n alert: { type: 'success', title: t('alerts.progressSaved') },\n payPeriod: payrollData.payrollShow?.payPeriod,\n })\n setPayrollBlockers([])\n setIsPolling(false)\n }\n if (\n isPolling &&\n payrollData.payrollShow?.processingRequest?.status ===\n PayrollProcessingRequestStatus.ProcessingFailed\n ) {\n onEvent(componentEvents.RUN_PAYROLL_PROCESSING_FAILED)\n setIsPolling(false)\n }\n }, [payrollData.payrollShow?.processingRequest, isPolling, onEvent, t, payrollId])\n\n const payrollAlert =\n payrollData.payrollShow?.payrollStatusMeta?.payrollLate &&\n payrollData.payrollShow.payrollStatusMeta.initialCheckDate &&\n payrollData.payrollShow.payrollStatusMeta.expectedDebitTime &&\n payrollData.payrollShow.payrollStatusMeta.expectedCheckDate\n ? {\n label: t('alerts.payrollLate', {\n initialCheckDate: dateFormatter.formatShortWithWeekday(\n payrollData.payrollShow.payrollStatusMeta.initialCheckDate,\n ),\n }),\n content: t('alerts.payrollLateText', {\n ...dateFormatter.formatWithTime(\n payrollData.payrollShow.payrollStatusMeta.expectedDebitTime,\n ),\n newCheckDate: dateFormatter.formatShortWithWeekday(\n payrollData.payrollShow.payrollStatusMeta.expectedCheckDate,\n ),\n }),\n variant: 'warning' as const,\n }\n : payrollData.payrollShow\n ? {\n label: t('alerts.directDepositDeadline', {\n payDate: dateFormatter.formatShortWithWeekday(payrollData.payrollShow.checkDate),\n ...dateFormatter.formatWithTime(payrollData.payrollShow.payrollDeadline),\n }),\n content: t('alerts.directDepositDeadlineText'),\n variant: 'info' as const,\n }\n : undefined\n\n return (\n <PayrollConfigurationPresentation\n onCalculatePayroll={onCalculatePayroll}\n isCalculateDisabled={blockersFromApi.length > 0}\n onEdit={onEdit}\n onToggleExclude={onToggleExclude}\n onViewBlockers={onViewBlockers}\n employeeCompensations={employeeCompensations}\n employeeDetails={employeeDetails}\n payPeriod={payPeriod}\n paySchedule={paySchedule}\n isOffCycle={isOffCycle}\n alerts={alerts}\n payrollAlert={payrollAlert}\n isPending={isPolling || isLoading || isUpdatingPayroll || isCalculatingPayroll}\n isCalculating={isCalculatingPayroll || isPolling}\n payrollBlockers={payrollBlockers}\n pagination={pagination}\n withReimbursements={withReimbursements}\n />\n )\n}\n"],"names":["isCalculating","processingRequest","PayrollProcessingRequestStatus","isCalculated","PayrollConfiguration","props","jsx","BaseComponent","Root","onEvent","companyId","payrollId","dictionary","alerts","withReimbursements","useComponentDictionary","useI18n","t","useTranslation","baseSubmitHandler","useBase","dateFormatter","useDateFormatter","isPolling","setIsPolling","useState","employeeDetails","employeeCompensations","paySchedule","payPeriod","isOffCycle","pagination","isLoading","refetch","usePayrollConfigurationData","payrollData","usePayrollsGetSuspense","calculatePayroll","isCalculatingPayroll","usePayrollsCalculateMutation","updatePayroll","isUpdatingPayroll","usePayrollsUpdateMutation","blockersData","usePayrollsGetBlockersSuspense","blockersFromApi","blocker","payrollBlockers","setPayrollBlockers","onCalculatePayroll","result","payrollSubmitHandler","onEdit","employee","componentEvents","transformEmployeeCompensation","paymentMethod","reimbursements","compensation","onToggleExclude","employeeCompensation","transformedCompensation","onViewBlockers","useEffect","payrollAlert","PayrollConfigurationPresentation"],"mappings":";;;;;;;;;;;;;;;;AAqBA,MAAMA,KAAgB,CAACC,MACrBA,GAAmB,WAAWC,EAA+B,aACzDC,KAAe,CAACF,MACpBA,GAAmB,WAAWC,EAA+B;AASxD,SAASE,GAAqBC,GAA2D;AAC9F,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,MAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEO,MAAMG,KAAO,CAAC;AAAA,EACnB,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,QAAAC;AAAA,EACA,oBAAAC,IAAqB;AACvB,MAAiC;AAC/B,EAAAC,EAAuB,gCAAgCH,CAAU,GACjEI,EAAQ,8BAA8B;AACtC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,8BAA8B,GACrD,EAAE,mBAAAC,EAAA,IAAsBC,EAAA,GACxBC,IAAgBC,GAAA,GAEhB,CAACC,GAAWC,CAAY,IAAIC,EAAS,EAAK,GAE1C;AAAA,IACJ,iBAAAC;AAAA,IACA,uBAAAC;AAAA,IACA,aAAAC;AAAA,IACA,WAAAC;AAAA,IACA,YAAAC;AAA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AAA,MACA,WAAWzC,KAAaS,KAAaS,KAAqBH;AAAA,MAC1D,eAAeA,KAAwBf;AAAA,MACvC,iBAAAwB;AAAA,MACA,YAAAhB;AAAA,MACA,oBAAAjB;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PayrollPayPeriodType } from '@gusto/embedded-api/models/components/payrollpayperiodtype';
|
|
2
|
+
import { ConfirmWireDetailsComponentType } from '../ConfirmWireDetails/ConfirmWireDetails';
|
|
3
|
+
import { FlowBreadcrumb } from '../../Common/FlowBreadcrumbs/FlowBreadcrumbsTypes';
|
|
4
|
+
import { OnEventType } from '../../Base/useBase';
|
|
5
|
+
import { EventType } from '../../../shared/constants';
|
|
6
|
+
export type PayrollExecutionInitialState = 'configuration' | 'overview';
|
|
7
|
+
export interface PayrollExecutionFlowProps {
|
|
8
|
+
companyId: string;
|
|
9
|
+
payrollId: string;
|
|
10
|
+
onEvent: OnEventType<EventType, unknown>;
|
|
11
|
+
initialPayPeriod?: PayrollPayPeriodType;
|
|
12
|
+
withReimbursements?: boolean;
|
|
13
|
+
ConfirmWireDetailsComponent?: ConfirmWireDetailsComponentType;
|
|
14
|
+
prefixBreadcrumbs?: FlowBreadcrumb[];
|
|
15
|
+
initialState?: PayrollExecutionInitialState;
|
|
16
|
+
}
|
|
17
|
+
export declare function PayrollExecutionFlow({ companyId, payrollId, onEvent, initialPayPeriod, withReimbursements, ConfirmWireDetailsComponent, prefixBreadcrumbs, initialState, }: PayrollExecutionFlowProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as i } from "react";
|
|
3
|
+
import { createMachine as x } from "robot3";
|
|
4
|
+
import { SaveAndExitCta as C, PayrollOverviewContextual as E, PayrollConfigurationContextual as M } from "../PayrollFlow/PayrollFlowComponents.js";
|
|
5
|
+
import { payrollExecutionMachine as v, payrollExecutionBreadcrumbsNodes as y } from "./payrollExecutionMachine.js";
|
|
6
|
+
import { Flow as B } from "../../Flow/Flow.js";
|
|
7
|
+
import { buildBreadcrumbs as P, updateBreadcrumbs as g } from "../../../helpers/breadcrumbHelpers.js";
|
|
8
|
+
const A = [], w = {
|
|
9
|
+
configuration: M,
|
|
10
|
+
overview: E
|
|
11
|
+
}, N = {
|
|
12
|
+
configuration: "Payroll.PayrollConfiguration",
|
|
13
|
+
overview: "Payroll.PayrollOverview"
|
|
14
|
+
};
|
|
15
|
+
function j({
|
|
16
|
+
companyId: t,
|
|
17
|
+
payrollId: a,
|
|
18
|
+
onEvent: m,
|
|
19
|
+
initialPayPeriod: o,
|
|
20
|
+
withReimbursements: c = !0,
|
|
21
|
+
ConfirmWireDetailsComponent: n,
|
|
22
|
+
prefixBreadcrumbs: u = A,
|
|
23
|
+
initialState: r = "configuration"
|
|
24
|
+
}) {
|
|
25
|
+
const s = i(() => {
|
|
26
|
+
const l = P(y), p = Object.fromEntries(
|
|
27
|
+
Object.entries(l).map(([e, f]) => [
|
|
28
|
+
e,
|
|
29
|
+
[...u, ...f]
|
|
30
|
+
])
|
|
31
|
+
), b = g(
|
|
32
|
+
r,
|
|
33
|
+
{
|
|
34
|
+
breadcrumbs: p
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
startDate: o?.startDate ?? "",
|
|
38
|
+
endDate: o?.endDate ?? ""
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
return x(
|
|
42
|
+
r,
|
|
43
|
+
v,
|
|
44
|
+
(e) => ({
|
|
45
|
+
...e,
|
|
46
|
+
...b,
|
|
47
|
+
component: w[r],
|
|
48
|
+
companyId: t,
|
|
49
|
+
payrollUuid: a,
|
|
50
|
+
payPeriod: o,
|
|
51
|
+
progressBarType: "breadcrumbs",
|
|
52
|
+
currentBreadcrumbId: r,
|
|
53
|
+
withReimbursements: c,
|
|
54
|
+
ConfirmWireDetailsComponent: n,
|
|
55
|
+
progressBarCta: C,
|
|
56
|
+
ctaConfig: {
|
|
57
|
+
labelKey: "exitFlowCta",
|
|
58
|
+
namespace: N[r]
|
|
59
|
+
}
|
|
60
|
+
})
|
|
61
|
+
);
|
|
62
|
+
}, [
|
|
63
|
+
t,
|
|
64
|
+
a,
|
|
65
|
+
c,
|
|
66
|
+
n,
|
|
67
|
+
u,
|
|
68
|
+
r
|
|
69
|
+
]);
|
|
70
|
+
return /* @__PURE__ */ d(B, { machine: s, onEvent: m });
|
|
71
|
+
}
|
|
72
|
+
export {
|
|
73
|
+
j as PayrollExecutionFlow
|
|
74
|
+
};
|
|
75
|
+
//# sourceMappingURL=PayrollExecutionFlow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PayrollExecutionFlow.js","sources":["../../../../src/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { createMachine } from 'robot3'\nimport type { PayrollPayPeriodType } from '@gusto/embedded-api/models/components/payrollpayperiodtype'\nimport type { ConfirmWireDetailsComponentType } from '../ConfirmWireDetails/ConfirmWireDetails'\nimport {\n PayrollConfigurationContextual,\n PayrollOverviewContextual,\n SaveAndExitCta,\n type PayrollFlowContextInterface,\n} from '../PayrollFlow/PayrollFlowComponents'\nimport {\n payrollExecutionMachine,\n payrollExecutionBreadcrumbsNodes,\n} from './payrollExecutionMachine'\nimport { Flow } from '@/components/Flow/Flow'\nimport type { FlowBreadcrumb } from '@/components/Common/FlowBreadcrumbs/FlowBreadcrumbsTypes'\nimport { buildBreadcrumbs, updateBreadcrumbs } from '@/helpers/breadcrumbHelpers'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport type { EventType } from '@/shared/constants'\n\nconst EMPTY_BREADCRUMBS: FlowBreadcrumb[] = []\n\nexport type PayrollExecutionInitialState = 'configuration' | 'overview'\n\nexport interface PayrollExecutionFlowProps {\n companyId: string\n payrollId: string\n onEvent: OnEventType<EventType, unknown>\n initialPayPeriod?: PayrollPayPeriodType\n withReimbursements?: boolean\n ConfirmWireDetailsComponent?: ConfirmWireDetailsComponentType\n prefixBreadcrumbs?: FlowBreadcrumb[]\n initialState?: PayrollExecutionInitialState\n}\n\nconst INITIAL_COMPONENT_MAP = {\n configuration: PayrollConfigurationContextual,\n overview: PayrollOverviewContextual,\n} as const\n\nconst INITIAL_NAMESPACE_MAP = {\n configuration: 'Payroll.PayrollConfiguration' as const,\n overview: 'Payroll.PayrollOverview' as const,\n} as const\n\nexport function PayrollExecutionFlow({\n companyId,\n payrollId,\n onEvent,\n initialPayPeriod,\n withReimbursements = true,\n ConfirmWireDetailsComponent,\n prefixBreadcrumbs = EMPTY_BREADCRUMBS,\n initialState = 'configuration',\n}: PayrollExecutionFlowProps) {\n const executionFlowMachine = useMemo(() => {\n const baseBreadcrumbs = buildBreadcrumbs(payrollExecutionBreadcrumbsNodes)\n const breadcrumbs = Object.fromEntries(\n Object.entries(baseBreadcrumbs).map(([stateKey, trail]) => [\n stateKey,\n [...prefixBreadcrumbs, ...trail],\n ]),\n )\n\n const initialBreadcrumbContext = updateBreadcrumbs(\n initialState,\n {\n breadcrumbs,\n } as PayrollFlowContextInterface,\n {\n startDate: initialPayPeriod?.startDate ?? '',\n endDate: initialPayPeriod?.endDate ?? '',\n },\n )\n\n return createMachine(\n initialState,\n payrollExecutionMachine,\n (initialContext: PayrollFlowContextInterface) => ({\n ...initialContext,\n ...initialBreadcrumbContext,\n component: INITIAL_COMPONENT_MAP[initialState],\n companyId,\n payrollUuid: payrollId,\n payPeriod: initialPayPeriod,\n progressBarType: 'breadcrumbs' as const,\n currentBreadcrumbId: initialState,\n withReimbursements,\n ConfirmWireDetailsComponent,\n progressBarCta: SaveAndExitCta,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: INITIAL_NAMESPACE_MAP[initialState],\n },\n }),\n )\n }, [\n companyId,\n payrollId,\n withReimbursements,\n ConfirmWireDetailsComponent,\n prefixBreadcrumbs,\n initialState,\n ])\n\n return <Flow machine={executionFlowMachine} onEvent={onEvent} />\n}\n"],"names":["EMPTY_BREADCRUMBS","INITIAL_COMPONENT_MAP","PayrollConfigurationContextual","PayrollOverviewContextual","INITIAL_NAMESPACE_MAP","PayrollExecutionFlow","companyId","payrollId","onEvent","initialPayPeriod","withReimbursements","ConfirmWireDetailsComponent","prefixBreadcrumbs","initialState","executionFlowMachine","useMemo","baseBreadcrumbs","buildBreadcrumbs","payrollExecutionBreadcrumbsNodes","breadcrumbs","stateKey","trail","initialBreadcrumbContext","updateBreadcrumbs","createMachine","payrollExecutionMachine","initialContext","SaveAndExitCta","jsx","Flow"],"mappings":";;;;;;;AAoBA,MAAMA,IAAsC,CAAA,GAetCC,IAAwB;AAAA,EAC5B,eAAeC;AAAA,EACf,UAAUC;AACZ,GAEMC,IAAwB;AAAA,EAC5B,eAAe;AAAA,EACf,UAAU;AACZ;AAEO,SAASC,EAAqB;AAAA,EACnC,WAAAC;AAAA,EACA,WAAAC;AAAA,EACA,SAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,oBAAAC,IAAqB;AAAA,EACrB,6BAAAC;AAAA,EACA,mBAAAC,IAAoBZ;AAAA,EACpB,cAAAa,IAAe;AACjB,GAA8B;AAC5B,QAAMC,IAAuBC,EAAQ,MAAM;AACzC,UAAMC,IAAkBC,EAAiBC,CAAgC,GACnEC,IAAc,OAAO;AAAA,MACzB,OAAO,QAAQH,CAAe,EAAE,IAAI,CAAC,CAACI,GAAUC,CAAK,MAAM;AAAA,QACzDD;AAAA,QACA,CAAC,GAAGR,GAAmB,GAAGS,CAAK;AAAA,MAAA,CAChC;AAAA,IAAA,GAGGC,IAA2BC;AAAA,MAC/BV;AAAA,MACA;AAAA,QACE,aAAAM;AAAA,MAAA;AAAA,MAEF;AAAA,QACE,WAAWV,GAAkB,aAAa;AAAA,QAC1C,SAASA,GAAkB,WAAW;AAAA,MAAA;AAAA,IACxC;AAGF,WAAOe;AAAA,MACLX;AAAA,MACAY;AAAA,MACA,CAACC,OAAiD;AAAA,QAChD,GAAGA;AAAA,QACH,GAAGJ;AAAA,QACH,WAAWrB,EAAsBY,CAAY;AAAA,QAC7C,WAAAP;AAAA,QACA,aAAaC;AAAA,QACb,WAAWE;AAAA,QACX,iBAAiB;AAAA,QACjB,qBAAqBI;AAAA,QACrB,oBAAAH;AAAA,QACA,6BAAAC;AAAA,QACA,gBAAgBgB;AAAA,QAChB,WAAW;AAAA,UACT,UAAU;AAAA,UACV,WAAWvB,EAAsBS,CAAY;AAAA,QAAA;AAAA,MAC/C;AAAA,IACF;AAAA,EAEJ,GAAG;AAAA,IACDP;AAAA,IACAC;AAAA,IACAG;AAAA,IACAC;AAAA,IACAC;AAAA,IACAC;AAAA,EAAA,CACD;AAED,SAAO,gBAAAe,EAACC,GAAA,EAAK,SAASf,GAAsB,SAAAN,EAAA,CAAkB;AAChE;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BreadcrumbNodes } from '../../Common/FlowBreadcrumbs/FlowBreadcrumbsTypes';
|
|
2
|
+
export declare const payrollExecutionBreadcrumbsNodes: BreadcrumbNodes;
|
|
3
|
+
export declare const payrollExecutionMachine: {
|
|
4
|
+
configuration: import('robot3').MachineState<any>;
|
|
5
|
+
overview: import('robot3').MachineState<any>;
|
|
6
|
+
editEmployee: import('robot3').MachineState<any>;
|
|
7
|
+
receipts: import('robot3').MachineState<any>;
|
|
8
|
+
blockers: import('robot3').MachineState<any>;
|
|
9
|
+
};
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { state as n, transition as r, reduce as t } from "robot3";
|
|
2
|
+
import { PayrollOverviewContextual as p, PayrollConfigurationContextual as d, PayrollReceiptsContextual as s, PayrollEditEmployeeContextual as c, PayrollBlockerContextual as m } from "../PayrollFlow/PayrollFlowComponents.js";
|
|
3
|
+
import { componentEvents as i } from "../../../shared/constants.js";
|
|
4
|
+
import { updateBreadcrumbs as o } from "../../../helpers/breadcrumbHelpers.js";
|
|
5
|
+
import { createBreadcrumbNavigateTransition as y } from "../../Common/FlowBreadcrumbs/breadcrumbTransitionHelpers.js";
|
|
6
|
+
const l = y(), R = {
|
|
7
|
+
configuration: {
|
|
8
|
+
parent: null,
|
|
9
|
+
item: {
|
|
10
|
+
id: "configuration",
|
|
11
|
+
label: "breadcrumbLabel",
|
|
12
|
+
namespace: "Payroll.PayrollConfiguration",
|
|
13
|
+
onNavigate: ((e) => ({
|
|
14
|
+
...o("configuration", e, {
|
|
15
|
+
startDate: e.payPeriod?.startDate ?? "",
|
|
16
|
+
endDate: e.payPeriod?.endDate ?? ""
|
|
17
|
+
}),
|
|
18
|
+
component: d,
|
|
19
|
+
alerts: void 0
|
|
20
|
+
}))
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
overview: {
|
|
24
|
+
parent: "configuration",
|
|
25
|
+
item: {
|
|
26
|
+
id: "overview",
|
|
27
|
+
label: "breadcrumbLabel",
|
|
28
|
+
namespace: "Payroll.PayrollOverview",
|
|
29
|
+
onNavigate: ((e) => ({
|
|
30
|
+
...o("overview", e, {
|
|
31
|
+
startDate: e.payPeriod?.startDate ?? "",
|
|
32
|
+
endDate: e.payPeriod?.endDate ?? ""
|
|
33
|
+
}),
|
|
34
|
+
component: p,
|
|
35
|
+
alerts: void 0
|
|
36
|
+
}))
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
editEmployee: {
|
|
40
|
+
parent: "configuration",
|
|
41
|
+
item: {
|
|
42
|
+
id: "editEmployee",
|
|
43
|
+
label: "breadcrumbLabel",
|
|
44
|
+
namespace: "Payroll.PayrollEditEmployee"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
receipts: {
|
|
48
|
+
parent: "overview",
|
|
49
|
+
item: {
|
|
50
|
+
id: "receipts",
|
|
51
|
+
label: "breadcrumbLabel",
|
|
52
|
+
namespace: "Payroll.PayrollReceipts"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
blockers: {
|
|
56
|
+
parent: "configuration",
|
|
57
|
+
item: {
|
|
58
|
+
id: "blockers",
|
|
59
|
+
label: "breadcrumbLabel",
|
|
60
|
+
namespace: "Payroll.PayrollBlocker"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}, u = r(
|
|
64
|
+
i.RUN_PAYROLL_CALCULATED,
|
|
65
|
+
"overview",
|
|
66
|
+
t(
|
|
67
|
+
(e, a) => ({
|
|
68
|
+
...o("overview", e, {
|
|
69
|
+
startDate: a.payload.payPeriod?.startDate ?? "",
|
|
70
|
+
endDate: a.payload.payPeriod?.endDate ?? ""
|
|
71
|
+
}),
|
|
72
|
+
component: p,
|
|
73
|
+
payPeriod: a.payload.payPeriod ?? e.payPeriod,
|
|
74
|
+
alerts: a.payload.alert ? [...e.alerts ?? [], a.payload.alert] : e.alerts,
|
|
75
|
+
ctaConfig: {
|
|
76
|
+
labelKey: "exitFlowCta",
|
|
77
|
+
namespace: "Payroll.PayrollOverview"
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
)
|
|
81
|
+
), P = r(
|
|
82
|
+
i.RUN_PAYROLL_EMPLOYEE_EDIT,
|
|
83
|
+
"editEmployee",
|
|
84
|
+
t(
|
|
85
|
+
(e, a) => ({
|
|
86
|
+
...o("editEmployee", e, {
|
|
87
|
+
firstName: a.payload.firstName,
|
|
88
|
+
lastName: a.payload.lastName,
|
|
89
|
+
startDate: e.payPeriod?.startDate ?? "",
|
|
90
|
+
endDate: e.payPeriod?.endDate ?? ""
|
|
91
|
+
}),
|
|
92
|
+
progressBarType: "breadcrumbs",
|
|
93
|
+
component: c,
|
|
94
|
+
employeeId: a.payload.employeeId,
|
|
95
|
+
firstName: a.payload.firstName,
|
|
96
|
+
lastName: a.payload.lastName,
|
|
97
|
+
ctaConfig: null
|
|
98
|
+
})
|
|
99
|
+
)
|
|
100
|
+
), b = r(
|
|
101
|
+
i.RUN_PAYROLL_BLOCKERS_VIEW_ALL,
|
|
102
|
+
"blockers",
|
|
103
|
+
t((e) => ({
|
|
104
|
+
...o("blockers", e),
|
|
105
|
+
component: m
|
|
106
|
+
}))
|
|
107
|
+
), f = r(
|
|
108
|
+
i.RUN_PAYROLL_EDIT,
|
|
109
|
+
"configuration",
|
|
110
|
+
t((e) => ({
|
|
111
|
+
...o("configuration", e, {
|
|
112
|
+
startDate: e.payPeriod?.startDate ?? "",
|
|
113
|
+
endDate: e.payPeriod?.endDate ?? ""
|
|
114
|
+
}),
|
|
115
|
+
component: d,
|
|
116
|
+
alerts: void 0,
|
|
117
|
+
ctaConfig: {
|
|
118
|
+
labelKey: "exitFlowCta",
|
|
119
|
+
namespace: "Payroll.PayrollConfiguration"
|
|
120
|
+
}
|
|
121
|
+
}))
|
|
122
|
+
), g = r(
|
|
123
|
+
i.RUN_PAYROLL_RECEIPT_GET,
|
|
124
|
+
"receipts",
|
|
125
|
+
t(
|
|
126
|
+
(e) => ({
|
|
127
|
+
...o("receipts", e, {
|
|
128
|
+
startDate: e.payPeriod?.startDate ?? "",
|
|
129
|
+
endDate: e.payPeriod?.endDate ?? ""
|
|
130
|
+
}),
|
|
131
|
+
component: s,
|
|
132
|
+
progressBarType: "breadcrumbs",
|
|
133
|
+
alerts: void 0,
|
|
134
|
+
ctaConfig: {
|
|
135
|
+
labelKey: "exitFlowCta",
|
|
136
|
+
namespace: "Payroll.PayrollReceipts"
|
|
137
|
+
}
|
|
138
|
+
})
|
|
139
|
+
)
|
|
140
|
+
), E = r(
|
|
141
|
+
i.RUN_PAYROLL_EMPLOYEE_SAVED,
|
|
142
|
+
"configuration",
|
|
143
|
+
t(
|
|
144
|
+
(e) => ({
|
|
145
|
+
...e,
|
|
146
|
+
currentBreadcrumbId: "configuration",
|
|
147
|
+
component: d,
|
|
148
|
+
employeeId: void 0,
|
|
149
|
+
firstName: void 0,
|
|
150
|
+
lastName: void 0,
|
|
151
|
+
ctaConfig: {
|
|
152
|
+
labelKey: "exitFlowCta",
|
|
153
|
+
namespace: "Payroll.PayrollConfiguration"
|
|
154
|
+
}
|
|
155
|
+
})
|
|
156
|
+
)
|
|
157
|
+
), D = r(
|
|
158
|
+
i.RUN_PAYROLL_EMPLOYEE_CANCELLED,
|
|
159
|
+
"configuration",
|
|
160
|
+
t(
|
|
161
|
+
(e) => ({
|
|
162
|
+
...e,
|
|
163
|
+
currentBreadcrumbId: "configuration",
|
|
164
|
+
component: d,
|
|
165
|
+
employeeId: void 0,
|
|
166
|
+
firstName: void 0,
|
|
167
|
+
lastName: void 0,
|
|
168
|
+
ctaConfig: {
|
|
169
|
+
labelKey: "exitFlowCta",
|
|
170
|
+
namespace: "Payroll.PayrollConfiguration"
|
|
171
|
+
}
|
|
172
|
+
})
|
|
173
|
+
)
|
|
174
|
+
), w = {
|
|
175
|
+
configuration: n(
|
|
176
|
+
l("configuration"),
|
|
177
|
+
u,
|
|
178
|
+
P,
|
|
179
|
+
b
|
|
180
|
+
),
|
|
181
|
+
overview: n(
|
|
182
|
+
l("configuration"),
|
|
183
|
+
f,
|
|
184
|
+
g
|
|
185
|
+
),
|
|
186
|
+
editEmployee: n(
|
|
187
|
+
l("configuration"),
|
|
188
|
+
E,
|
|
189
|
+
D
|
|
190
|
+
),
|
|
191
|
+
receipts: n(l("configuration")),
|
|
192
|
+
blockers: n(l("configuration"))
|
|
193
|
+
};
|
|
194
|
+
export {
|
|
195
|
+
R as payrollExecutionBreadcrumbsNodes,
|
|
196
|
+
w as payrollExecutionMachine
|
|
197
|
+
};
|
|
198
|
+
//# sourceMappingURL=payrollExecutionMachine.js.map
|