@gusto/embedded-react-sdk 0.16.0 → 0.17.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/EmptyData/EmptyData.js +10 -10
- package/dist/components/Common/EmptyData/EmptyData.js.map +1 -1
- package/dist/components/Common/EmptyData/EmptyData.module.scss.js +5 -3
- package/dist/components/Common/EmptyData/EmptyData.module.scss.js.map +1 -1
- package/dist/components/Common/FieldDescription/FieldDescription.module.scss.js +1 -1
- package/dist/components/Common/FlowBreadcrumbs/FlowBreadcrumbs.js +21 -19
- package/dist/components/Common/FlowBreadcrumbs/FlowBreadcrumbs.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureForm.js +4 -3
- package/dist/components/Common/SignatureForm/SignatureForm.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormActions.js +8 -7
- package/dist/components/Common/SignatureForm/SignatureFormActions.js.map +1 -1
- package/dist/components/Common/SignatureForm/SignatureFormFields.js +9 -8
- package/dist/components/Common/SignatureForm/SignatureFormFields.js.map +1 -1
- package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +32 -18
- package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js.map +1 -1
- package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.module.scss.js +12 -12
- package/dist/components/Common/UI/Breadcrumbs/BreadcrumbsTypes.d.ts +14 -0
- package/dist/components/Common/UI/Breadcrumbs/BreadcrumbsTypes.js +8 -0
- package/dist/components/Common/UI/Breadcrumbs/BreadcrumbsTypes.js.map +1 -0
- package/dist/components/Common/UI/DescriptionList/DescriptionList.d.ts +2 -0
- package/dist/components/Common/UI/DescriptionList/DescriptionList.js +16 -0
- package/dist/components/Common/UI/DescriptionList/DescriptionList.js.map +1 -0
- package/dist/components/Common/UI/DescriptionList/DescriptionList.module.scss.js +10 -0
- package/dist/components/Common/UI/DescriptionList/DescriptionList.module.scss.js.map +1 -0
- package/dist/components/Common/UI/DescriptionList/DescriptionListTypes.d.ts +10 -0
- package/dist/components/Common/UI/DescriptionList/DescriptionListTypes.js +5 -0
- package/dist/components/Common/UI/DescriptionList/DescriptionListTypes.js.map +1 -0
- package/dist/components/Common/UI/DescriptionList/index.d.ts +3 -0
- package/dist/components/Company/AssignSignatory/AssignSignatory.js +1 -1
- 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/CreateSignatory.js +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/InviteSignatory.js +1 -1
- package/dist/components/Company/BankAccount/BankAccountForm/Actions.js +6 -6
- package/dist/components/Company/BankAccount/BankAccountForm/Form.js +9 -8
- package/dist/components/Company/BankAccount/BankAccountForm/Form.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/AccountView.js +22 -17
- package/dist/components/Company/BankAccount/BankAccountList/AccountView.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js +9 -8
- package/dist/components/Company/BankAccount/BankAccountList/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js +8 -7
- package/dist/components/Company/BankAccount/BankAccountVerify/Actions.js.map +1 -1
- package/dist/components/Company/BankAccount/BankAccountVerify/Form.js +5 -4
- package/dist/components/Company/BankAccount/BankAccountVerify/Form.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/DocumentList.js +1 -1
- package/dist/components/Company/DocumentSigner/SignatureForm/SignatureForm.js +1 -1
- package/dist/components/Company/FederalTaxes/Actions.js +6 -5
- package/dist/components/Company/FederalTaxes/Actions.js.map +1 -1
- package/dist/components/Company/FederalTaxes/FederalTaxes.js +1 -1
- package/dist/components/Company/FederalTaxes/Form.js +3 -2
- package/dist/components/Company/FederalTaxes/Form.js.map +1 -1
- package/dist/components/Company/Industry/Actions.js +3 -2
- package/dist/components/Company/Industry/Actions.js.map +1 -1
- package/dist/components/Company/Industry/Edit.js +5 -4
- 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/LocationForm.js +2 -2
- package/dist/components/Company/Locations/LocationsList/Actions.js +7 -6
- 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/LocationsList.js +1 -1
- package/dist/components/Company/OnboardingOverview/Completed.js +11 -10
- package/dist/components/Company/OnboardingOverview/Completed.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/MissingRequirements.js +7 -6
- package/dist/components/Company/OnboardingOverview/MissingRequirements.js.map +1 -1
- package/dist/components/Company/OnboardingOverview/OnboardingOverview.js +1 -1
- package/dist/components/Company/PaySchedule/PaySchedule.js +2 -2
- package/dist/components/Company/PaySchedule/_parts/Actions.js +10 -9
- package/dist/components/Company/PaySchedule/_parts/Actions.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/Head.js +7 -6
- package/dist/components/Company/PaySchedule/_parts/Head.js.map +1 -1
- package/dist/components/Company/PaySchedule/_parts/List.js +12 -11
- package/dist/components/Company/PaySchedule/_parts/List.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/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/Contractor/Address/Address.js +2 -2
- package/dist/components/Contractor/ContractorList/index.js +17 -17
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js +5 -4
- package/dist/components/Contractor/PaymentMethod/BankAccountForm.js.map +1 -1
- package/dist/components/Contractor/Submit/Submit.js +1 -1
- package/dist/components/Employee/Compensation/Actions.js +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 +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/CustomDeductionForm.js +1 -1
- package/dist/components/Employee/Deductions/DeductionsForm/DeductionsForm.js +1 -1
- package/dist/components/Employee/Deductions/DeductionsList/DeductionsList.js +1 -1
- package/dist/components/Employee/Deductions/IncludeDeductionsForm/IncludeDeductionsForm.js +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js +7 -6
- package/dist/components/Employee/DocumentSigner/DocumentList/Actions.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/DocumentList.js +1 -1
- package/dist/components/Employee/DocumentSigner/DocumentList/List.js +3 -2
- package/dist/components/Employee/DocumentSigner/DocumentList/List.js.map +1 -1
- package/dist/components/Employee/DocumentSigner/SignatureForm/SignatureForm.js +1 -1
- package/dist/components/Employee/EmployeeList/Actions.js +3 -2
- package/dist/components/Employee/EmployeeList/Actions.js.map +1 -1
- package/dist/components/Employee/EmployeeList/EmployeeList.js +4 -3
- package/dist/components/Employee/EmployeeList/EmployeeList.js.map +1 -1
- package/dist/components/Employee/EmployeeList/Head.js +6 -5
- package/dist/components/Employee/EmployeeList/Head.js.map +1 -1
- package/dist/components/Employee/EmployeeList/List.js +10 -10
- package/dist/components/Employee/FederalTaxes/Actions.js +7 -6
- package/dist/components/Employee/FederalTaxes/Actions.js.map +1 -1
- package/dist/components/Employee/FederalTaxes/FederalForm.js +11 -10
- package/dist/components/Employee/FederalTaxes/FederalForm.js.map +1 -1
- package/dist/components/Employee/Landing/Landing.js +8 -8
- package/dist/components/Employee/OnboardingSummary/OnboardingSummary.js +7 -7
- package/dist/components/Employee/PaymentMethod/Actions.js +6 -5
- package/dist/components/Employee/PaymentMethod/Actions.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/BankAccountsList.js +9 -8
- package/dist/components/Employee/PaymentMethod/BankAccountsList.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/PaymentMethod.d.ts +1 -0
- package/dist/components/Employee/PaymentMethod/PaymentMethod.js +79 -78
- package/dist/components/Employee/PaymentMethod/PaymentMethod.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js +11 -11
- package/dist/components/Employee/PaymentMethod/PaymentTypeForm.js.map +1 -1
- package/dist/components/Employee/PaymentMethod/Split.js +1 -1
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.d.ts +1 -0
- package/dist/components/Employee/PaymentMethod/usePaymentMethod.js.map +1 -1
- package/dist/components/Employee/Profile/Actions.js +7 -6
- package/dist/components/Employee/Profile/Actions.js.map +1 -1
- package/dist/components/Employee/StateTaxes/Actions.js +8 -7
- package/dist/components/Employee/StateTaxes/Actions.js.map +1 -1
- package/dist/components/Employee/Taxes/Actions.js +9 -8
- package/dist/components/Employee/Taxes/Actions.js.map +1 -1
- package/dist/components/Employee/Taxes/FederalForm.js +9 -8
- package/dist/components/Employee/Taxes/FederalForm.js.map +1 -1
- package/dist/components/Flow/Flow.js +11 -10
- package/dist/components/Flow/Flow.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js +3 -2
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +7 -6
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +88 -77
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.d.ts +5 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +88 -84
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +3 -2
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +3 -2
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js +3 -2
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +34 -34
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js +3 -2
- package/dist/components/Payroll/PayrollReceipts/PayrollReceiptsPresentation.js.map +1 -1
- package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js +29 -27
- package/dist/contexts/ComponentAdapter/adapters/defaultComponentAdapter.js.map +1 -1
- package/dist/contexts/ComponentAdapter/componentAdapterTypes.d.ts +1 -0
- package/dist/contexts/ComponentAdapter/useComponentContext.d.ts +2 -0
- package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js +3 -2
- package/dist/contexts/GustoProvider/GustoProviderCustomUIAdapter.js.map +1 -1
- package/dist/helpers/dateFormatting.d.ts +4 -0
- package/dist/helpers/dateFormatting.js +30 -14
- package/dist/helpers/dateFormatting.js.map +1 -1
- package/dist/i18n/en/Employee.PaymentMethod.json.js +70 -66
- package/dist/i18n/en/Employee.PaymentMethod.json.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollConfiguration.json.js +17 -17
- package/dist/i18n/en/Payroll.PayrollOverview.json.js +1 -1
- package/dist/style.css +1 -1
- package/dist/types/i18next.d.ts +4 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FederalForm.js","sources":["../../../../src/components/Employee/Taxes/FederalForm.tsx"],"sourcesContent":["import { Trans, useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { NumberInputField, RadioGroupField, SelectField } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport const FederalFormSchema = z.object({\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 w4DataType: z.enum(['pre_2020_w4', 'rev_2020_w4']),\n})\n\nexport type FederalFormInputs = z.input<typeof FederalFormSchema>\nexport type FederalFormPayload = z.output<typeof FederalFormSchema>\n\nexport function FederalForm() {\n const { t } = useTranslation('Employee.Taxes')\n const Components = useComponentContext()\n\n const filingStatusCategories = [\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('federalFillingStatusPlaceholder')}\n options={filingStatusCategories}\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 irs_link: <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 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"],"names":["FederalFormSchema","z","FederalForm","t","useTranslation","Components","useComponentContext","filingStatusCategories","jsxs","Fragment","jsx","SelectField","RadioGroupField","Trans","NumberInputField"],"mappings":"
|
|
1
|
+
{"version":3,"file":"FederalForm.js","sources":["../../../../src/components/Employee/Taxes/FederalForm.tsx"],"sourcesContent":["import { Trans, useTranslation } from 'react-i18next'\nimport { z } from 'zod'\nimport { NumberInputField, RadioGroupField, SelectField } from '@/components/Common'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\nexport const FederalFormSchema = z.object({\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 w4DataType: z.enum(['pre_2020_w4', 'rev_2020_w4']),\n})\n\nexport type FederalFormInputs = z.input<typeof FederalFormSchema>\nexport type FederalFormPayload = z.output<typeof FederalFormSchema>\n\nexport function FederalForm() {\n const { t } = useTranslation('Employee.Taxes')\n const Components = useComponentContext()\n\n const filingStatusCategories = [\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('federalFillingStatusPlaceholder')}\n options={filingStatusCategories}\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 irs_link: <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 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"],"names":["FederalFormSchema","z","FederalForm","t","useTranslation","Components","useComponentContext","filingStatusCategories","jsxs","Fragment","jsx","SelectField","RadioGroupField","Trans","NumberInputField"],"mappings":";;;;;;;;;AAKO,MAAMA,IAAoBC,EAAE,OAAO;AAAA,EACxC,cAAcA,EAAE,SAAS,IAAI,CAAC;AAAA,EAC9B,SAASA,EAAE,SAAS,IAAI,CAAC;AAAA,E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AA,QAAA,GAEJ;AAAA,QAEF,SAAS;AAAA,UACP,EAAE,OAAO,QAAQ,OAAOF,EAAE,gBAAgB,EAAA;AAAA,UAC1C,EAAE,OAAO,SAAS,OAAOA,EAAE,eAAe,EAAA;AAAA,QAAE;AAAA,MAC9C;AAAA,IAAA;AAAA,IAEF,gBAAAO;AAAA,MAACI;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,YAAU;AAAA,QACV,OAAOX,EAAE,6BAA6B;AAAA,QACtC,cAAcA,EAAE,iBAAiB;AAAA,MAAA;AAAA,IAAA;AAAA,IAEnC,gBAAAO;AAAA,MAACI;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,YAAU;AAAA,QACV,OAAOX,EAAE,aAAa;AAAA,QACtB,QAAO;AAAA,QACP,KAAK;AAAA,QACL,cAAcA,EAAE,iBAAiB;AAAA,MAAA;AAAA,IAAA;AAAA,IAEnC,gBAAAO;AAAA,MAACI;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,YAAU;AAAA,QACV,OAAOX,EAAE,YAAY;AAAA,QACrB,QAAO;AAAA,QACP,KAAK;AAAA,QACL,cAAcA,EAAE,iBAAiB;AAAA,MAAA;AAAA,IAAA;AAAA,IAEnC,gBAAAO;AAAA,MAACI;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,YAAU;AAAA,QACV,OAAOX,EAAE,kBAAkB;AAAA,QAC3B,QAAO;AAAA,QACP,KAAK;AAAA,QACL,cAAcA,EAAE,iBAAiB;AAAA,MAAA;AAAA,IAAA;AAAA,EACnC,GACF;AAEJ;"}
|
|
@@ -4,22 +4,23 @@ import { useTranslation as C } from "react-i18next";
|
|
|
4
4
|
import { FlowBreadcrumbs as v } from "../Common/FlowBreadcrumbs/FlowBreadcrumbs.js";
|
|
5
5
|
import { Flex as l, FlexItem as u } from "../Common/Flex/Flex.js";
|
|
6
6
|
import "classnames";
|
|
7
|
+
import "../../shared/constants.js";
|
|
7
8
|
import { FlowContext as w } from "./useFlow.js";
|
|
8
9
|
import { useComponentContext as F } from "../../contexts/ComponentAdapter/useComponentContext.js";
|
|
9
|
-
const
|
|
10
|
-
const f = F(), { t: b } = C(), [r, g,
|
|
11
|
-
onEvent:
|
|
10
|
+
const L = ({ onEvent: d, machine: x }) => {
|
|
11
|
+
const f = F(), { t: b } = C(), [r, g, i] = B(x, {
|
|
12
|
+
onEvent: a,
|
|
12
13
|
component: null,
|
|
13
14
|
progressBarCta: null
|
|
14
15
|
}), {
|
|
15
|
-
progressBarType:
|
|
16
|
+
progressBarType: m = null,
|
|
16
17
|
totalSteps: o = null,
|
|
17
18
|
currentStep: t = null,
|
|
18
19
|
currentBreadcrumbId: n,
|
|
19
20
|
breadcrumbs: h = {}
|
|
20
21
|
} = r.context;
|
|
21
|
-
function
|
|
22
|
-
|
|
22
|
+
function a(s, c) {
|
|
23
|
+
i.child ? i.child.send({ type: s, payload: c }) : g({ type: s, payload: c }), d(s, c);
|
|
23
24
|
}
|
|
24
25
|
return /* @__PURE__ */ e(l, { children: /* @__PURE__ */ e(
|
|
25
26
|
w.Provider,
|
|
@@ -28,7 +29,7 @@ const G = ({ onEvent: d, machine: x }) => {
|
|
|
28
29
|
...r.context
|
|
29
30
|
},
|
|
30
31
|
children: /* @__PURE__ */ p(l, { flexDirection: "column", gap: 32, children: [
|
|
31
|
-
|
|
32
|
+
m === "progress" && t && o && /* @__PURE__ */ e(
|
|
32
33
|
f.ProgressBar,
|
|
33
34
|
{
|
|
34
35
|
totalSteps: o,
|
|
@@ -37,13 +38,13 @@ const G = ({ onEvent: d, machine: x }) => {
|
|
|
37
38
|
cta: r.context.progressBarCta
|
|
38
39
|
}
|
|
39
40
|
),
|
|
40
|
-
|
|
41
|
+
m === "breadcrumbs" && /* @__PURE__ */ p(l, { flexDirection: "row", justifyContent: "space-between", alignItems: "center", children: [
|
|
41
42
|
/* @__PURE__ */ e(u, { flexGrow: 1, children: /* @__PURE__ */ e(
|
|
42
43
|
v,
|
|
43
44
|
{
|
|
44
45
|
breadcrumbs: n ? h[n] ?? [] : [],
|
|
45
46
|
currentBreadcrumbId: n,
|
|
46
|
-
onEvent:
|
|
47
|
+
onEvent: a
|
|
47
48
|
}
|
|
48
49
|
) }),
|
|
49
50
|
/* @__PURE__ */ e(u, { children: r.context.progressBarCta && /* @__PURE__ */ e(r.context.progressBarCta, {}) })
|
|
@@ -54,6 +55,6 @@ const G = ({ onEvent: d, machine: x }) => {
|
|
|
54
55
|
) });
|
|
55
56
|
};
|
|
56
57
|
export {
|
|
57
|
-
|
|
58
|
+
L as Flow
|
|
58
59
|
};
|
|
59
60
|
//# sourceMappingURL=Flow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Flow.js","sources":["../../../src/components/Flow/Flow.tsx"],"sourcesContent":["import { useMachine } from 'react-robot'\nimport { type Machine } from 'robot3'\nimport { useTranslation } from 'react-i18next'\nimport type { OnEventType } from '../Base/useBase'\nimport { FlowBreadcrumbs } from '../Common/FlowBreadcrumbs/FlowBreadcrumbs'\nimport { Flex } from '../Common/Flex'\nimport { FlexItem } from '../Common'\nimport type { FlowContextInterface } from './useFlow'\nimport { FlowContext } from './useFlow'\nimport { type EventType } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\ntype FlowProps = {\n machine: Machine<object, FlowContextInterface>\n onEvent: OnEventType<EventType, unknown>\n}\n\nexport const Flow = ({ onEvent, machine }: FlowProps) => {\n const Components = useComponentContext()\n const { t } = useTranslation()\n const [current, send, service] = useMachine(machine, {\n onEvent: handleEvent,\n component: null,\n progressBarCta: null,\n })\n\n const {\n progressBarType = null,\n totalSteps = null,\n currentStep = null,\n currentBreadcrumbId,\n breadcrumbs = {},\n } = current.context\n\n function handleEvent(type: EventType, data: unknown): void {\n //When dealing with nested state machine, correct machine needs to recieve an event\n if (service.child) {\n //@ts-expect-error: not sure why 'type' type is incorrectly derived here\n service.child.send({ type: type, payload: data })\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n send({ type: type, payload: data })\n }\n // Pass event upstream - onEvent can be optional on Flow component\n onEvent(type, data)\n }\n\n return (\n <Flex>\n <FlowContext.Provider\n value={{\n ...current.context,\n }}\n >\n <Flex flexDirection=\"column\" gap={32}>\n {progressBarType === 'progress' && currentStep && totalSteps && (\n <Components.ProgressBar\n totalSteps={totalSteps}\n currentStep={currentStep}\n label={t('progressBarLabel', { totalSteps, currentStep })}\n cta={current.context.progressBarCta}\n />\n )}\n {progressBarType === 'breadcrumbs' && (\n <Flex flexDirection=\"row\" justifyContent=\"space-between\" alignItems=\"center\">\n <FlexItem flexGrow={1}>\n <FlowBreadcrumbs\n breadcrumbs={currentBreadcrumbId ? (breadcrumbs[currentBreadcrumbId] ?? []) : []}\n currentBreadcrumbId={currentBreadcrumbId}\n onEvent={handleEvent}\n />\n </FlexItem>\n <FlexItem>\n {current.context.progressBarCta && <current.context.progressBarCta />}\n </FlexItem>\n </Flex>\n )}\n {current.context.component && <current.context.component />}\n </Flex>\n </FlowContext.Provider>\n </Flex>\n )\n}\n"],"names":["Flow","onEvent","machine","Components","useComponentContext","t","useTranslation","current","send","service","useMachine","handleEvent","progressBarType","totalSteps","currentStep","currentBreadcrumbId","breadcrumbs","type","data","Flex","jsx","FlowContext","jsxs","FlexItem","FlowBreadcrumbs"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Flow.js","sources":["../../../src/components/Flow/Flow.tsx"],"sourcesContent":["import { useMachine } from 'react-robot'\nimport { type Machine } from 'robot3'\nimport { useTranslation } from 'react-i18next'\nimport type { OnEventType } from '../Base/useBase'\nimport { FlowBreadcrumbs } from '../Common/FlowBreadcrumbs/FlowBreadcrumbs'\nimport { Flex } from '../Common/Flex'\nimport { FlexItem } from '../Common'\nimport type { FlowContextInterface } from './useFlow'\nimport { FlowContext } from './useFlow'\nimport { type EventType } from '@/shared/constants'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\n\ntype FlowProps = {\n machine: Machine<object, FlowContextInterface>\n onEvent: OnEventType<EventType, unknown>\n}\n\nexport const Flow = ({ onEvent, machine }: FlowProps) => {\n const Components = useComponentContext()\n const { t } = useTranslation()\n const [current, send, service] = useMachine(machine, {\n onEvent: handleEvent,\n component: null,\n progressBarCta: null,\n })\n\n const {\n progressBarType = null,\n totalSteps = null,\n currentStep = null,\n currentBreadcrumbId,\n breadcrumbs = {},\n } = current.context\n\n function handleEvent(type: EventType, data: unknown): void {\n //When dealing with nested state machine, correct machine needs to recieve an event\n if (service.child) {\n //@ts-expect-error: not sure why 'type' type is incorrectly derived here\n service.child.send({ type: type, payload: data })\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n send({ type: type, payload: data })\n }\n // Pass event upstream - onEvent can be optional on Flow component\n onEvent(type, data)\n }\n\n return (\n <Flex>\n <FlowContext.Provider\n value={{\n ...current.context,\n }}\n >\n <Flex flexDirection=\"column\" gap={32}>\n {progressBarType === 'progress' && currentStep && totalSteps && (\n <Components.ProgressBar\n totalSteps={totalSteps}\n currentStep={currentStep}\n label={t('progressBarLabel', { totalSteps, currentStep })}\n cta={current.context.progressBarCta}\n />\n )}\n {progressBarType === 'breadcrumbs' && (\n <Flex flexDirection=\"row\" justifyContent=\"space-between\" alignItems=\"center\">\n <FlexItem flexGrow={1}>\n <FlowBreadcrumbs\n breadcrumbs={currentBreadcrumbId ? (breadcrumbs[currentBreadcrumbId] ?? []) : []}\n currentBreadcrumbId={currentBreadcrumbId}\n onEvent={handleEvent}\n />\n </FlexItem>\n <FlexItem>\n {current.context.progressBarCta && <current.context.progressBarCta />}\n </FlexItem>\n </Flex>\n )}\n {current.context.component && <current.context.component />}\n </Flex>\n </FlowContext.Provider>\n </Flex>\n )\n}\n"],"names":["Flow","onEvent","machine","Components","useComponentContext","t","useTranslation","current","send","service","useMachine","handleEvent","progressBarType","totalSteps","currentStep","currentBreadcrumbId","breadcrumbs","type","data","Flex","jsx","FlowContext","jsxs","FlexItem","FlowBreadcrum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AA,gBAAAH;AAAA,YAACI;AAAA,YAAA;AAAA,cACC,aAAaT,IAAuBC,EAAYD,CAAmB,KAAK,CAAA,IAAM,CAAA;AAAA,cAC9E,qBAAAA;AAAA,cACA,SAASJ;AAAA,YAAA;AAAA,UAAA,GAEb;AAAA,UACA,gBAAAS,EAACG,GAAA,EACE,UAAAhB,EAAQ,QAAQ,oCAAmBA,EAAQ,QAAQ,gBAAhB,CAAA,CAA+B,EAAA,CACrE;AAAA,QAAA,GACF;AAAA,QAEDA,EAAQ,QAAQ,+BAAcA,EAAQ,QAAQ,WAAhB,CAAA,CAA0B;AAAA,MAAA,EAAA,CAC3D;AAAA,IAAA;AAAA,EAAA,GAEJ;AAEJ;"}
|
|
@@ -4,8 +4,9 @@ import { getBlockerTranslationKeys as v } from "../payrollHelpers.js";
|
|
|
4
4
|
import { useComponentContext as A } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
5
5
|
import { Flex as m } from "../../../Common/Flex/Flex.js";
|
|
6
6
|
import "classnames";
|
|
7
|
+
import "../../../../shared/constants.js";
|
|
7
8
|
import { useI18n as C } from "../../../../i18n/I18n.js";
|
|
8
|
-
function
|
|
9
|
+
function F({
|
|
9
10
|
blockers: o,
|
|
10
11
|
onMultipleViewClick: i,
|
|
11
12
|
multipleViewLabel: h,
|
|
@@ -48,6 +49,6 @@ function z({
|
|
|
48
49
|
);
|
|
49
50
|
}
|
|
50
51
|
export {
|
|
51
|
-
|
|
52
|
+
F as PayrollBlockerAlerts
|
|
52
53
|
};
|
|
53
54
|
//# sourceMappingURL=PayrollBlockerAlerts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayrollBlockerAlerts.js","sources":["../../../../../src/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { type ApiPayrollBlocker, getBlockerTranslationKeys } from '../payrollHelpers'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Flex } from '@/components/Common'\nimport { useI18n } from '@/i18n'\n\ninterface PayrollBlockerAlertsProps {\n blockers: ApiPayrollBlocker[]\n className?: string\n onMultipleViewClick?: () => void\n multipleViewLabel?: string\n}\n\n/**\n * PayrollBlockerAlerts - Alert-style component for inline blocker display\n * Shows single blocker as alert, or multiple blockers as summary with \"Review\" button\n * Returns null for empty blocker arrays\n */\nexport function PayrollBlockerAlerts({\n blockers,\n onMultipleViewClick,\n multipleViewLabel,\n className,\n}: PayrollBlockerAlertsProps) {\n useI18n('Payroll.PayrollBlocker')\n const { t } = useTranslation('Payroll.PayrollBlocker')\n const { Alert, Button, Text, UnorderedList } = useComponentContext()\n\n // Return null for empty blockers array\n if (blockers.length === 0) {\n return null\n }\n\n const hasMultipleBlockers = blockers.length > 1\n\n const enrichedBlockers = blockers.map(blocker => {\n const translationKeys = getBlockerTranslationKeys(blocker.key)\n\n const title = t(translationKeys.titleKey, {\n defaultValue: blocker.key.replace(/_/g, ' ').replace(/\\b\\w/g, l => l.toUpperCase()),\n })\n const description = t(translationKeys.descriptionKey, {\n defaultValue: blocker.message || t('defaultBlockerDescription'),\n })\n const helpText = t(translationKeys.helpTextKey, { defaultValue: t('defaultBlockerHelpText') })\n\n return {\n ...blocker,\n title,\n description,\n helpText,\n }\n })\n\n const singleBlocker = enrichedBlockers[0]\n\n if (!hasMultipleBlockers && singleBlocker) {\n return (\n <Alert status=\"error\" label={singleBlocker.title} className={className}>\n <Flex flexDirection=\"column\" gap={8}>\n <Text>{singleBlocker.description}</Text>\n {singleBlocker.helpText && singleBlocker.helpText !== singleBlocker.description && (\n <Text variant=\"supporting\" size=\"sm\">\n {singleBlocker.helpText}\n </Text>\n )}\n </Flex>\n </Alert>\n )\n }\n\n const listItems = enrichedBlockers.map(blocker => blocker.title)\n const defaultMultipleLabel = multipleViewLabel || t('viewAllBlockers')\n\n return (\n <Alert\n status=\"error\"\n label={t('multipleIssuesTitle', { count: blockers.length })}\n className={className}\n >\n <Flex flexDirection=\"column\" gap={16}>\n <UnorderedList items={listItems} />\n {onMultipleViewClick && (\n <div>\n <Button variant=\"secondary\" onClick={onMultipleViewClick} title={defaultMultipleLabel}>\n {defaultMultipleLabel}\n </Button>\n </div>\n )}\n </Flex>\n </Alert>\n )\n}\n"],"names":["PayrollBlockerAlerts","blockers","onMultipleViewClick","multipleViewLabel","className","useI18n","t","useTranslation","Alert","Button","Text","UnorderedList","useComponentContext","hasMultipleBlockers","enrichedBlockers","blocker","translationKeys","getBlockerTranslationKeys","title","l","description","helpText","singleBlocker","jsx","jsxs","Flex","listItems","defaultMultipleLabel"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PayrollBlockerAlerts.js","sources":["../../../../../src/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport { type ApiPayrollBlocker, getBlockerTranslationKeys } from '../payrollHelpers'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Flex } from '@/components/Common'\nimport { useI18n } from '@/i18n'\n\ninterface PayrollBlockerAlertsProps {\n blockers: ApiPayrollBlocker[]\n className?: string\n onMultipleViewClick?: () => void\n multipleViewLabel?: string\n}\n\n/**\n * PayrollBlockerAlerts - Alert-style component for inline blocker display\n * Shows single blocker as alert, or multiple blockers as summary with \"Review\" button\n * Returns null for empty blocker arrays\n */\nexport function PayrollBlockerAlerts({\n blockers,\n onMultipleViewClick,\n multipleViewLabel,\n className,\n}: PayrollBlockerAlertsProps) {\n useI18n('Payroll.PayrollBlocker')\n const { t } = useTranslation('Payroll.PayrollBlocker')\n const { Alert, Button, Text, UnorderedList } = useComponentContext()\n\n // Return null for empty blockers array\n if (blockers.length === 0) {\n return null\n }\n\n const hasMultipleBlockers = blockers.length > 1\n\n const enrichedBlockers = blockers.map(blocker => {\n const translationKeys = getBlockerTranslationKeys(blocker.key)\n\n const title = t(translationKeys.titleKey, {\n defaultValue: blocker.key.replace(/_/g, ' ').replace(/\\b\\w/g, l => l.toUpperCase()),\n })\n const description = t(translationKeys.descriptionKey, {\n defaultValue: blocker.message || t('defaultBlockerDescription'),\n })\n const helpText = t(translationKeys.helpTextKey, { defaultValue: t('defaultBlockerHelpText') })\n\n return {\n ...blocker,\n title,\n description,\n helpText,\n }\n })\n\n const singleBlocker = enrichedBlockers[0]\n\n if (!hasMultipleBlockers && singleBlocker) {\n return (\n <Alert status=\"error\" label={singleBlocker.title} className={className}>\n <Flex flexDirection=\"column\" gap={8}>\n <Text>{singleBlocker.description}</Text>\n {singleBlocker.helpText && singleBlocker.helpText !== singleBlocker.description && (\n <Text variant=\"supporting\" size=\"sm\">\n {singleBlocker.helpText}\n </Text>\n )}\n </Flex>\n </Alert>\n )\n }\n\n const listItems = enrichedBlockers.map(blocker => blocker.title)\n const defaultMultipleLabel = multipleViewLabel || t('viewAllBlockers')\n\n return (\n <Alert\n status=\"error\"\n label={t('multipleIssuesTitle', { count: blockers.length })}\n className={className}\n >\n <Flex flexDirection=\"column\" gap={16}>\n <UnorderedList items={listItems} />\n {onMultipleViewClick && (\n <div>\n <Button variant=\"secondary\" onClick={onMultipleViewClick} title={defaultMultipleLabel}>\n {defaultMultipleLabel}\n </Button>\n </div>\n )}\n </Flex>\n </Alert>\n )\n}\n"],"names":["PayrollBlockerAlerts","blockers","onMultipleViewClick","multipleViewLabel","className","useI18n","t","useTranslation","Alert","Button","Text","UnorderedList","useComponentContext","hasMultipleBlockers","enrichedBlockers","blocker","translationKeys","getBlockerTranslationKeys","title","l","description","helpText","singleBlocker","jsx","jsxs","Flex","listItems","defaultMultipleLabel"],"mappings":";;;;;;;;AAkBO,SAASA,EAAqB;AAAA,EACnC,UAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,WAAAC;AACF,GAA8B;AAC5B,EAAAC,EAAQ,wBAAwB;AAChC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,wBAAwB,GAC/C,EAAE,OAAAC,GAAO,QAAAC,G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QAAO;AAAA,MACP,OAAOF,EAAE,uBAAuB,EAAE,OAAOL,EAAS,QAAQ;AAAA,MAC1D,WAAAG;AAAA,MAEA,UAAA,gBAAAoB,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,QAAA,gBAAAF,EAACZ,GAAA,EAAc,OAAOe,EAAA,CAAW;AAAA,QAChCxB,KACC,gBAAAqB,EAAC,OAAA,EACC,UAAA,gBAAAA,EAACd,GAAA,EAAO,SAAQ,aAAY,SAASP,GAAqB,OAAOyB,GAC9D,UAAAA,EAAA,CACH,EAAA,CACF;AAAA,MAAA,EAAA,CAEJ;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { jsx as e, jsxs as a } from "react/jsx-runtime";
|
|
2
|
-
import { useTranslation as
|
|
3
|
-
import
|
|
2
|
+
import { useTranslation as p } from "react-i18next";
|
|
3
|
+
import f from "classnames";
|
|
4
4
|
import u from "./PayrollBlockerList.module.scss.js";
|
|
5
5
|
import { useComponentContext as h } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
6
6
|
import { FlexItem as x, Flex as o } from "../../../Common/Flex/Flex.js";
|
|
7
|
+
import "../../../../shared/constants.js";
|
|
7
8
|
import { DataView as y } from "../../../Common/DataView/DataView.js";
|
|
8
9
|
import { useDataView as g } from "../../../Common/DataView/useDataView.js";
|
|
9
10
|
import { useI18n as b } from "../../../../i18n/I18n.js";
|
|
10
|
-
function
|
|
11
|
+
function I({ blockers: i, className: s }) {
|
|
11
12
|
b("Payroll.PayrollBlocker");
|
|
12
|
-
const { t: l } =
|
|
13
|
+
const { t: l } = p("Payroll.PayrollBlocker"), { Button: c, Text: n, Heading: m } = h(), d = g({
|
|
13
14
|
data: i,
|
|
14
15
|
columns: [
|
|
15
16
|
{
|
|
@@ -28,12 +29,12 @@ function v({ blockers: i, className: s }) {
|
|
|
28
29
|
}
|
|
29
30
|
]
|
|
30
31
|
});
|
|
31
|
-
return i.length === 0 ? null : /* @__PURE__ */ e("div", { className:
|
|
32
|
+
return i.length === 0 ? null : /* @__PURE__ */ e("div", { className: f(u.root, s), children: /* @__PURE__ */ a(o, { flexDirection: "column", gap: 24, children: [
|
|
32
33
|
/* @__PURE__ */ e(m, { as: "h2", styledAs: "h4", children: l("blockersListTitle") }),
|
|
33
34
|
/* @__PURE__ */ e(y, { ...d, label: l("blockersListTitle") })
|
|
34
35
|
] }) });
|
|
35
36
|
}
|
|
36
37
|
export {
|
|
37
|
-
|
|
38
|
+
I as PayrollBlockerList
|
|
38
39
|
};
|
|
39
40
|
//# sourceMappingURL=PayrollBlockerList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayrollBlockerList.js","sources":["../../../../../src/components/Payroll/PayrollBlocker/components/PayrollBlockerList.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport classNames from 'classnames'\nimport styles from './PayrollBlockerList.module.scss'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Flex, FlexItem } from '@/components/Common'\nimport { DataView } from '@/components/Common/DataView/DataView'\nimport { useDataView } from '@/components/Common/DataView/useDataView'\nimport { useI18n } from '@/i18n'\n\nexport interface PayrollBlocker {\n id: string\n title: string\n description: string\n action?: {\n label: string\n onClick: () => void\n }\n}\n\ninterface PayrollBlockerListProps {\n blockers: PayrollBlocker[]\n className?: string\n}\n\n/**\n * PayrollBlockerList - DataView-based component displaying payroll blockers\n * Shows each blocker with individual resolution buttons\n */\nexport function PayrollBlockerList({ blockers, className }: PayrollBlockerListProps) {\n useI18n('Payroll.PayrollBlocker')\n const { t } = useTranslation('Payroll.PayrollBlocker')\n const { Button, Text, Heading } = useComponentContext()\n\n const dataViewProps = useDataView({\n data: blockers,\n columns: [\n {\n title: t('blockerSectionLabel'),\n render: blocker => (\n <FlexItem flexGrow={1}>\n <Flex flexDirection=\"column\" gap={8}>\n <Text weight=\"semibold\">{blocker.title}</Text>\n <Text variant=\"supporting\">{blocker.description}</Text>\n </Flex>\n </FlexItem>\n ),\n },\n {\n title: '',\n render: blocker => {\n // For presentational purposes, just show the primary action if it exists\n const action = blocker.action\n\n if (!action) {\n return null\n }\n\n return (\n <Flex justifyContent=\"flex-end\" alignItems=\"center\">\n <Button variant=\"secondary\" onClick={action.onClick} title={action.label}>\n {action.label}\n </Button>\n </Flex>\n )\n },\n },\n ],\n })\n\n if (blockers.length === 0) {\n return null\n }\n\n return (\n <div className={classNames(styles.root, className)}>\n <Flex flexDirection=\"column\" gap={24}>\n <Heading as=\"h2\" styledAs=\"h4\">\n {t('blockersListTitle')}\n </Heading>\n\n <DataView {...dataViewProps} label={t('blockersListTitle')} />\n </Flex>\n </div>\n )\n}\n"],"names":["PayrollBlockerList","blockers","className","useI18n","t","useTranslation","Button","Text","Heading","useComponentContext","dataViewProps","useDataView","blocker","jsx","FlexItem","jsxs","Flex","action","classNames","styles","DataView"],"mappings":"
|
|
1
|
+
{"version":3,"file":"PayrollBlockerList.js","sources":["../../../../../src/components/Payroll/PayrollBlocker/components/PayrollBlockerList.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport classNames from 'classnames'\nimport styles from './PayrollBlockerList.module.scss'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Flex, FlexItem } from '@/components/Common'\nimport { DataView } from '@/components/Common/DataView/DataView'\nimport { useDataView } from '@/components/Common/DataView/useDataView'\nimport { useI18n } from '@/i18n'\n\nexport interface PayrollBlocker {\n id: string\n title: string\n description: string\n action?: {\n label: string\n onClick: () => void\n }\n}\n\ninterface PayrollBlockerListProps {\n blockers: PayrollBlocker[]\n className?: string\n}\n\n/**\n * PayrollBlockerList - DataView-based component displaying payroll blockers\n * Shows each blocker with individual resolution buttons\n */\nexport function PayrollBlockerList({ blockers, className }: PayrollBlockerListProps) {\n useI18n('Payroll.PayrollBlocker')\n const { t } = useTranslation('Payroll.PayrollBlocker')\n const { Button, Text, Heading } = useComponentContext()\n\n const dataViewProps = useDataView({\n data: blockers,\n columns: [\n {\n title: t('blockerSectionLabel'),\n render: blocker => (\n <FlexItem flexGrow={1}>\n <Flex flexDirection=\"column\" gap={8}>\n <Text weight=\"semibold\">{blocker.title}</Text>\n <Text variant=\"supporting\">{blocker.description}</Text>\n </Flex>\n </FlexItem>\n ),\n },\n {\n title: '',\n render: blocker => {\n // For presentational purposes, just show the primary action if it exists\n const action = blocker.action\n\n if (!action) {\n return null\n }\n\n return (\n <Flex justifyContent=\"flex-end\" alignItems=\"center\">\n <Button variant=\"secondary\" onClick={action.onClick} title={action.label}>\n {action.label}\n </Button>\n </Flex>\n )\n },\n },\n ],\n })\n\n if (blockers.length === 0) {\n return null\n }\n\n return (\n <div className={classNames(styles.root, className)}>\n <Flex flexDirection=\"column\" gap={24}>\n <Heading as=\"h2\" styledAs=\"h4\">\n {t('blockersListTitle')}\n </Heading>\n\n <DataView {...dataViewProps} label={t('blockersListTitle')} />\n </Flex>\n </div>\n )\n}\n"],"names":["PayrollBlockerList","blockers","className","useI18n","t","useTranslation","Button","Text","Heading","useComponentContext","dataViewProps","useDataView","blocker","jsx","FlexItem","jsxs","Flex","action","classNames","styles","DataView"],"mappings":";;;;;;;;;;AA4BO,SAASA,EAAmB,EAAE,UAAAC,GAAU,WAAAC,KAAsC;AACnF,EAAAC,EAAQ,wBAAwB;AAChC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,wBAAwB,GAC/C,EAAE,QAAAC,GAAQ,MAAAC,GAAM,SAAAC,EAAA,IAAYC,EAAA,GAE5BC,IAAgBC,EAAY;AAAA,IAChC,MAAMV;AAAA,IACN,SAAS;AAAA,MACP;AAAA,QACE,OAAOG,EAAE,qBAAqB;AAAA,QAC9B,QAAQ,CAAAQ,MACN,gBAAAC,EAACC,GAAA,EAAS,UAAU,GAClB,UAAA,gBAAAC,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,GAChC,UAAA;AAAA,UAAA,gBAAAH,EAACN,GAAA,EAAK,QAAO,YAAY,UAAAK,EAAQ,OAAM;AAAA,UACvC,gBAAAC,EAACN,GAAA,EAAK,SAAQ,cAAc,YAAQ,YAAA,CAAY;AAAA,QAAA,EAAA,CAClD,EAAA,CACF;AAAA,MAAA;AAAA,MAGJ;AAAA,QACE,OAAO;AAAA,QACP,QAAQ,CAAAK,MAAW;AAEjB,gBAAMK,IAASL,EAAQ;AAEvB,iBAAKK,sBAKFD,GAAA,EAAK,gBAAe,YAAW,YAAW,UACzC,4BAACV,GAAA,EAAO,SAAQ,aAAY,SAASW,EAAO,SAAS,OAAOA,EAAO,OAChE,UAAAA,EAAO,OACV,EAAA,CACF,IARO;AAAA,QAUX;AAAA,MAAA;AAAA,IACF;AAAA,EACF,CACD;AAED,SAAIhB,EAAS,WAAW,IACf,OAIP,gBAAAY,EAAC,OAAA,EAAI,WAAWK,EAAWC,EAAO,MAAMjB,CAAS,GAC/C,UAAA,gBAAAa,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,IAAA,gBAAAH,EAACL,KAAQ,IAAG,MAAK,UAAS,MACvB,UAAAJ,EAAE,mBAAmB,GACxB;AAAA,sBAECgB,GAAA,EAAU,GAAGV,GAAe,OAAON,EAAE,mBAAmB,EAAA,CAAG;AAAA,EAAA,EAAA,CAC9D,EAAA,CACF;AAEJ;"}
|
|
@@ -1,90 +1,92 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { useEmployeesListSuspense as
|
|
4
|
-
import { usePayrollsGetSuspense as
|
|
5
|
-
import { usePayrollsCalculateMutation as
|
|
6
|
-
import { PayrollProcessingRequestStatus as
|
|
7
|
-
import { useTranslation as
|
|
8
|
-
import { usePayrollsUpdateMutation as
|
|
9
|
-
import { usePreparedPayrollData as
|
|
10
|
-
import { payrollSubmitHandler as
|
|
11
|
-
import { PayrollConfigurationPresentation as
|
|
12
|
-
import { BaseComponent as
|
|
13
|
-
import { componentEvents as
|
|
14
|
-
import { useComponentDictionary as
|
|
15
|
-
import { useBase as
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { jsx as g } from "react/jsx-runtime";
|
|
2
|
+
import { useState as p, useMemo as W, useEffect as G } from "react";
|
|
3
|
+
import { useEmployeesListSuspense as K } from "@gusto/embedded-api/react-query/employeesList";
|
|
4
|
+
import { usePayrollsGetSuspense as j } from "@gusto/embedded-api/react-query/payrollsGet";
|
|
5
|
+
import { usePayrollsCalculateMutation as v } from "@gusto/embedded-api/react-query/payrollsCalculate";
|
|
6
|
+
import { PayrollProcessingRequestStatus as f } from "@gusto/embedded-api/models/components/payrollprocessingrequest";
|
|
7
|
+
import { useTranslation as z } from "react-i18next";
|
|
8
|
+
import { usePayrollsUpdateMutation as J } from "@gusto/embedded-api/react-query/payrollsUpdate";
|
|
9
|
+
import { usePreparedPayrollData as Q } from "../usePreparedPayrollData.js";
|
|
10
|
+
import { payrollSubmitHandler as X } from "../PayrollBlocker/payrollHelpers.js";
|
|
11
|
+
import { PayrollConfigurationPresentation as Z } from "./PayrollConfigurationPresentation.js";
|
|
12
|
+
import { BaseComponent as $ } from "../../Base/Base.js";
|
|
13
|
+
import { componentEvents as l } from "../../../shared/constants.js";
|
|
14
|
+
import { useComponentDictionary as ee, useI18n as ae } from "../../../i18n/I18n.js";
|
|
15
|
+
import { useBase as te } from "../../Base/useBase.js";
|
|
16
|
+
import { formatDateTimeWithTimezone as oe, formatDateNamedWeekdayShortPlusDate as se } from "../../../helpers/dateFormatting.js";
|
|
17
|
+
import { useLocale as le } from "../../../contexts/LocaleProvider/useLocale.js";
|
|
18
|
+
const re = (a) => a?.status === f.Calculating, ne = (a) => a?.status === f.CalculateSuccess;
|
|
19
|
+
function xe(a) {
|
|
20
|
+
return /* @__PURE__ */ g($, { ...a, children: /* @__PURE__ */ g(ie, { ...a, children: a.children }) });
|
|
19
21
|
}
|
|
20
|
-
const
|
|
21
|
-
onEvent:
|
|
22
|
+
const ie = ({
|
|
23
|
+
onEvent: a,
|
|
22
24
|
companyId: r,
|
|
23
|
-
payrollId:
|
|
24
|
-
dictionary:
|
|
25
|
-
alerts:
|
|
25
|
+
payrollId: o,
|
|
26
|
+
dictionary: D,
|
|
27
|
+
alerts: E
|
|
26
28
|
}) => {
|
|
27
|
-
|
|
28
|
-
const { t:
|
|
29
|
+
ee("Payroll.PayrollConfiguration", D), ae("Payroll.PayrollConfiguration");
|
|
30
|
+
const { t: i } = z("Payroll.PayrollConfiguration"), { baseSubmitHandler: h } = te(), { locale: L } = le(), R = 10, [C, c] = p(1), [S, _] = p(R), [s, u] = p(!1), [w, P] = p([]), { data: m, isFetching: N } = K({
|
|
29
31
|
companyId: r,
|
|
30
|
-
payrollUuid:
|
|
32
|
+
payrollUuid: o,
|
|
31
33
|
// get back list of employees to specific payroll
|
|
32
|
-
per:
|
|
34
|
+
per: S,
|
|
33
35
|
page: C,
|
|
34
36
|
sortBy: "name"
|
|
35
37
|
// sort alphanumeric by employee last_names
|
|
36
|
-
}),
|
|
38
|
+
}), A = W(() => m.showEmployees?.map((e) => e.uuid) || [], [m.showEmployees]), y = Number(m.httpMeta.response.headers.get("x-total-pages") ?? 1), U = {
|
|
37
39
|
currentPage: C,
|
|
38
40
|
handleFirstPage: () => {
|
|
39
|
-
|
|
41
|
+
c(1);
|
|
40
42
|
},
|
|
41
43
|
handlePreviousPage: () => {
|
|
42
|
-
|
|
44
|
+
c((e) => Math.max(e - 1, 1));
|
|
43
45
|
},
|
|
44
46
|
handleNextPage: () => {
|
|
45
|
-
|
|
47
|
+
c((e) => Math.min(e + 1, y));
|
|
46
48
|
},
|
|
47
49
|
handleLastPage: () => {
|
|
48
|
-
|
|
50
|
+
c(y);
|
|
49
51
|
},
|
|
50
52
|
handleItemsPerPageChange: (e) => {
|
|
51
53
|
_(e);
|
|
52
54
|
},
|
|
53
|
-
totalPages:
|
|
54
|
-
isFetching:
|
|
55
|
-
itemsPerPage:
|
|
56
|
-
}, { data:
|
|
55
|
+
totalPages: y,
|
|
56
|
+
isFetching: N,
|
|
57
|
+
itemsPerPage: S
|
|
58
|
+
}, { data: t } = j(
|
|
57
59
|
{
|
|
58
60
|
companyId: r,
|
|
59
|
-
payrollId:
|
|
61
|
+
payrollId: o,
|
|
60
62
|
include: ["taxes", "benefits", "deductions"]
|
|
61
63
|
},
|
|
62
64
|
{ refetchInterval: s ? 5e3 : !1 }
|
|
63
|
-
), { mutateAsync: O } =
|
|
64
|
-
preparedPayroll:
|
|
65
|
-
paySchedule:
|
|
65
|
+
), { mutateAsync: O } = v(), { mutateAsync: x, isPending: Y } = J(), {
|
|
66
|
+
preparedPayroll: d,
|
|
67
|
+
paySchedule: b,
|
|
66
68
|
isLoading: B,
|
|
67
|
-
handlePreparePayroll:
|
|
68
|
-
} =
|
|
69
|
+
handlePreparePayroll: k
|
|
70
|
+
} = Q({
|
|
69
71
|
companyId: r,
|
|
70
|
-
payrollId:
|
|
71
|
-
employeeUuids:
|
|
72
|
+
payrollId: o,
|
|
73
|
+
employeeUuids: A,
|
|
72
74
|
sortBy: "last_name"
|
|
73
75
|
// sort alphanumeric by employee last_names to match employees GET
|
|
74
76
|
}), q = async () => {
|
|
75
77
|
P([]), await h({}, async () => {
|
|
76
|
-
const e = await
|
|
78
|
+
const e = await X(async () => {
|
|
77
79
|
await O({
|
|
78
80
|
request: {
|
|
79
81
|
companyId: r,
|
|
80
|
-
payrollId:
|
|
82
|
+
payrollId: o
|
|
81
83
|
}
|
|
82
|
-
}),
|
|
84
|
+
}), u(!0);
|
|
83
85
|
});
|
|
84
86
|
!e.success && e.blockers.length > 0 && P(e.blockers);
|
|
85
87
|
});
|
|
86
88
|
}, F = (e) => {
|
|
87
|
-
|
|
89
|
+
a(l.RUN_PAYROLL_EMPLOYEE_EDIT, {
|
|
88
90
|
employeeId: e.uuid,
|
|
89
91
|
firstName: e.firstName,
|
|
90
92
|
lastName: e.lastName
|
|
@@ -96,14 +98,14 @@ const se = ({
|
|
|
96
98
|
...n,
|
|
97
99
|
...e && e !== "Historical" ? { paymentMethod: e } : {},
|
|
98
100
|
memo: n.memo || void 0
|
|
99
|
-
}),
|
|
100
|
-
|
|
101
|
+
}), T = async (e) => {
|
|
102
|
+
a(l.RUN_PAYROLL_EMPLOYEE_SKIP, {
|
|
101
103
|
employeeId: e.employeeUuid
|
|
102
104
|
}), await h({}, async () => {
|
|
103
|
-
const n = M(e),
|
|
105
|
+
const n = M(e), V = await x({
|
|
104
106
|
request: {
|
|
105
107
|
companyId: r,
|
|
106
|
-
payrollId:
|
|
108
|
+
payrollId: o,
|
|
107
109
|
payrollUpdate: {
|
|
108
110
|
employeeCompensations: [
|
|
109
111
|
{ ...n, excluded: !n.excluded }
|
|
@@ -111,46 +113,55 @@ const se = ({
|
|
|
111
113
|
}
|
|
112
114
|
}
|
|
113
115
|
});
|
|
114
|
-
|
|
115
|
-
payrollPrepared:
|
|
116
|
-
}), await
|
|
116
|
+
a(l.RUN_PAYROLL_EMPLOYEE_SAVED, {
|
|
117
|
+
payrollPrepared: V.payrollPrepared
|
|
118
|
+
}), await k();
|
|
117
119
|
});
|
|
118
120
|
}, I = () => {
|
|
119
|
-
|
|
121
|
+
a(l.RUN_PAYROLL_BLOCKERS_VIEW_ALL);
|
|
120
122
|
};
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
payrollId:
|
|
124
|
-
alert: { type: "success", title:
|
|
125
|
-
}), P([]),
|
|
123
|
+
G(() => {
|
|
124
|
+
re(t.payrollShow?.processingRequest) && !s && u(!0), s && ne(t.payrollShow?.processingRequest) && (a(l.RUN_PAYROLL_CALCULATED, {
|
|
125
|
+
payrollId: o,
|
|
126
|
+
alert: { type: "success", title: i("alerts.progressSaved") }
|
|
127
|
+
}), P([]), u(!1)), s && t.payrollShow?.processingRequest?.status === f.ProcessingFailed && (a(l.RUN_PAYROLL_PROCESSING_FAILED), u(!1));
|
|
126
128
|
}, [
|
|
127
|
-
|
|
129
|
+
t.payrollShow?.processingRequest,
|
|
128
130
|
s,
|
|
129
|
-
t,
|
|
130
|
-
f,
|
|
131
131
|
a,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
132
|
+
i,
|
|
133
|
+
o,
|
|
134
|
+
t.payrollShow?.calculatedAt
|
|
135
|
+
]);
|
|
136
|
+
const H = t.payrollShow ? {
|
|
137
|
+
label: i("alerts.directDepositDeadline", {
|
|
138
|
+
payDate: se(t.payrollShow.checkDate, L),
|
|
139
|
+
...oe(t.payrollShow.payrollDeadline, L)
|
|
140
|
+
}),
|
|
141
|
+
content: i("alerts.directDepositDeadlineText")
|
|
142
|
+
} : void 0;
|
|
143
|
+
return /* @__PURE__ */ g(
|
|
144
|
+
Z,
|
|
135
145
|
{
|
|
136
146
|
onCalculatePayroll: q,
|
|
137
147
|
onEdit: F,
|
|
138
|
-
onToggleExclude:
|
|
148
|
+
onToggleExclude: T,
|
|
139
149
|
onViewBlockers: I,
|
|
140
|
-
employeeCompensations:
|
|
141
|
-
employeeDetails:
|
|
142
|
-
payPeriod:
|
|
143
|
-
paySchedule:
|
|
144
|
-
isOffCycle:
|
|
145
|
-
alerts:
|
|
146
|
-
|
|
150
|
+
employeeCompensations: d?.employeeCompensations || [],
|
|
151
|
+
employeeDetails: m.showEmployees || [],
|
|
152
|
+
payPeriod: d?.payPeriod,
|
|
153
|
+
paySchedule: b,
|
|
154
|
+
isOffCycle: d?.offCycle,
|
|
155
|
+
alerts: E,
|
|
156
|
+
payrollDeadlineNotice: H,
|
|
157
|
+
isPending: s || B || Y,
|
|
147
158
|
payrollBlockers: w,
|
|
148
159
|
pagination: U
|
|
149
160
|
}
|
|
150
161
|
);
|
|
151
162
|
};
|
|
152
163
|
export {
|
|
153
|
-
|
|
154
|
-
|
|
164
|
+
xe as PayrollConfiguration,
|
|
165
|
+
ie as Root
|
|
155
166
|
};
|
|
156
167
|
//# sourceMappingURL=PayrollConfiguration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayrollConfiguration.js","sources":["../../../../src/components/Payroll/PayrollConfiguration/PayrollConfiguration.tsx"],"sourcesContent":["import { useEffect, useMemo, useState, type ReactNode } from 'react'\nimport { useEmployeesListSuspense } from '@gusto/embedded-api/react-query/employeesList'\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 { usePreparedPayrollData } from '../usePreparedPayrollData'\nimport { payrollSubmitHandler, type ApiPayrollBlocker } from '../PayrollBlocker/payrollHelpers'\nimport { PayrollConfigurationPresentation } from './PayrollConfigurationPresentation'\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 type { PaginationItemsPerPage } from '@/components/Common/PaginationControl/PaginationControlTypes'\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}\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}: PayrollConfigurationProps) => {\n useComponentDictionary('Payroll.PayrollConfiguration', dictionary)\n useI18n('Payroll.PayrollConfiguration')\n const { t } = useTranslation('Payroll.PayrollConfiguration')\n const { baseSubmitHandler } = useBase()\n const defaultItemsPerPage = 10\n\n const [currentPage, setCurrentPage] = useState(1)\n const [itemsPerPage, setItemsPerPage] = useState<PaginationItemsPerPage>(defaultItemsPerPage)\n const [isPolling, setIsPolling] = useState(false)\n const [payrollBlockers, setPayrollBlockers] = useState<ApiPayrollBlocker[]>([])\n\n const { data: employeeData, isFetching: isFetchingEmployeeData } = useEmployeesListSuspense({\n companyId,\n payrollUuid: payrollId, // get back list of employees to specific payroll\n per: itemsPerPage,\n page: currentPage,\n sortBy: 'name', // sort alphanumeric by employee last_names\n })\n\n // get list of employee uuids to filter into prepare endpoint to get back employee_compensation data\n const employeeUuids = useMemo(() => {\n return employeeData.showEmployees?.map(e => e.uuid) || []\n }, [employeeData.showEmployees])\n\n const totalPages = Number(employeeData.httpMeta.response.headers.get('x-total-pages') ?? 1)\n\n const handleItemsPerPageChange = (newCount: PaginationItemsPerPage) => {\n setItemsPerPage(newCount)\n }\n const handleFirstPage = () => {\n setCurrentPage(1)\n }\n const handlePreviousPage = () => {\n setCurrentPage(prevPage => Math.max(prevPage - 1, 1))\n }\n const handleNextPage = () => {\n setCurrentPage(prevPage => Math.min(prevPage + 1, totalPages))\n }\n const handleLastPage = () => {\n setCurrentPage(totalPages)\n }\n\n const pagination = {\n currentPage,\n handleFirstPage,\n handlePreviousPage,\n handleNextPage,\n handleLastPage,\n handleItemsPerPageChange,\n totalPages,\n isFetching: isFetchingEmployeeData,\n itemsPerPage,\n }\n\n const { data: payrollData } = usePayrollsGetSuspense(\n {\n companyId,\n payrollId,\n include: ['taxes', 'benefits', 'deductions'],\n },\n { refetchInterval: isPolling ? 5_000 : false },\n )\n\n const { mutateAsync: calculatePayroll } = usePayrollsCalculateMutation()\n\n const { mutateAsync: updatePayroll, isPending: isUpdatingPayroll } = usePayrollsUpdateMutation()\n\n const {\n preparedPayroll,\n paySchedule,\n isLoading: isPrepareLoading,\n handlePreparePayroll,\n } = usePreparedPayrollData({\n companyId,\n payrollId,\n employeeUuids,\n sortBy: 'last_name', // sort alphanumeric by employee last_names to match employees GET\n })\n\n const onCalculatePayroll = async () => {\n // Clear any existing blockers before attempting calculation\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 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 const transformEmployeeCompensation = ({\n paymentMethod,\n ...compensation\n }: PayrollEmployeeCompensationsType): PayrollUpdateEmployeeCompensations => {\n return {\n ...compensation,\n ...(paymentMethod && paymentMethod !== 'Historical' ? { paymentMethod } : {}),\n memo: compensation.memo || undefined,\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 // Refresh preparedPayroll to get updated data\n await handlePreparePayroll()\n })\n }\n\n const onViewBlockers = () => {\n onEvent(componentEvents.RUN_PAYROLL_BLOCKERS_VIEW_ALL)\n }\n\n useEffect(() => {\n // Start polling when payroll is calculating and not already polling\n if (isCalculating(payrollData.payrollShow?.processingRequest) && !isPolling) {\n setIsPolling(true)\n }\n // Stop polling and emit event when payroll is calculated successfully\n if (isPolling && isCalculated(payrollData.payrollShow?.processingRequest)) {\n onEvent(componentEvents.RUN_PAYROLL_CALCULATED, {\n payrollId,\n alert: { type: 'success', title: t('alerts.progressSaved') },\n })\n // Clear blockers on successful calculation\n setPayrollBlockers([])\n setIsPolling(false)\n }\n // If we are polling and payroll is in failed state, stop polling, and emit failure event\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 }, [\n payrollData.payrollShow?.processingRequest,\n isPolling,\n onEvent,\n t,\n payrollId,\n payrollData.payrollShow?.calculatedAt,\n ])\n\n return (\n <PayrollConfigurationPresentation\n onCalculatePayroll={onCalculatePayroll}\n onEdit={onEdit}\n onToggleExclude={onToggleExclude}\n onViewBlockers={onViewBlockers}\n employeeCompensations={preparedPayroll?.employeeCompensations || []}\n employeeDetails={employeeData.showEmployees || []}\n payPeriod={preparedPayroll?.payPeriod}\n paySchedule={paySchedule}\n isOffCycle={preparedPayroll?.offCycle}\n alerts={alerts}\n isPending={isPolling || isPrepareLoading || isUpdatingPayroll}\n payrollBlockers={payrollBlockers}\n pagination={pagination}\n />\n )\n}\n"],"names":["isCalculating","processingRequest","PayrollProcessingRequestStatus","isCalculated","PayrollConfiguration","props","jsx","BaseComponent","Root","onEvent","companyId","payrollId","dictionary","alerts","useComponentDictionary","useI18n","t","useTranslation","baseSubmitHandler","useBase","defaultItemsPerPage","currentPage","setCurrentPage","useState","itemsPerPage","setItemsPerPage","isPolling","setIsPolling","payrollBlockers","setPayrollBlockers","employeeData","isFetchingEmployeeData","useEmployeesListSuspense","employeeUuids","useMemo","totalPages","pagination","prevPage","newCount","payrollData","usePayrollsGetSuspense","calculatePayroll","usePayrollsCalculateMutation","updatePayroll","isUpdatingPayroll","usePayrollsUpdateMutation","preparedPayroll","paySchedule","isPrepareLoading","handlePreparePayroll","usePreparedPayrollData","onCalculatePayroll","result","payrollSubmitHandler","onEdit","employee","componentEvents","transformEmployeeCompensation","paymentMethod","compensation","onToggleExclude","employeeCompensation","transformedCompensation","onViewBlockers","useEffect","PayrollConfigurationPresentation"],"mappings":";;;;;;;;;;;;;;;AAqBA,MAAMA,KAAgB,CAACC,MACrBA,GAAmB,WAAWC,EAA+B,aACzDC,KAAe,CAACF,MACpBA,GAAmB,WAAWC,EAA+B;AAQxD,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;AACF,MAAiC;AAC/B,EAAAC,EAAuB,gCAAgCF,CAAU,GACjEG,EAAQ,8BAA8B;AACtC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,8BAA8B,GACrD,EAAE,mBAAAC,EAAA,IAAsBC,GAAA,GACxBC,IAAsB,IAEtB,CAACC,GAAaC,CAAc,IAAIC,EAAS,CAAC,GAC1C,CAACC,GAAcC,CAAe,IAAIF,EAAiCH,CAAmB,GACtF,CAACM,GAAWC,CAAY,IAAIJ,EAAS,EAAK,GAC1C,CAACK,GAAiBC,CAAkB,IAAIN,EAA8B,CAAA,CAAE,GAExE,EAAE,MAAMO,GAAc,YAAYC,EAAA,IAA2BC,EAAyB;AAAA,IAC1F,WAAAtB;AAAA,IACA,aAAaC;AAAA;AAAA,IACb,KAAKa;A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ration/PayrollConfiguration.tsx"],"sourcesContent":["import { useEffect, useMemo, useState, type ReactNode } from 'react'\nimport { useEmployeesListSuspense } from '@gusto/embedded-api/react-query/employeesList'\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 { usePreparedPayrollData } from '../usePreparedPayrollData'\nimport { payrollSubmitHandler, type ApiPayrollBlocker } from '../PayrollBlocker/payrollHelpers'\nimport { PayrollConfigurationPresentation } from './PayrollConfigurationPresentation'\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 type { PaginationItemsPerPage } from '@/components/Common/PaginationControl/PaginationControlTypes'\nimport {\n formatDateNamedWeekdayShortPlusDate,\n formatDateTimeWithTimezone,\n} from '@/helpers/dateFormatting'\nimport { useLocale } from '@/contexts/LocaleProvider'\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}\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}: PayrollConfigurationProps) => {\n useComponentDictionary('Payroll.PayrollConfiguration', dictionary)\n useI18n('Payroll.PayrollConfiguration')\n const { t } = useTranslation('Payroll.PayrollConfiguration')\n const { baseSubmitHandler } = useBase()\n const { locale } = useLocale()\n const defaultItemsPerPage = 10\n\n const [currentPage, setCurrentPage] = useState(1)\n const [itemsPerPage, setItemsPerPage] = useState<PaginationItemsPerPage>(defaultItemsPerPage)\n const [isPolling, setIsPolling] = useState(false)\n const [payrollBlockers, setPayrollBlockers] = useState<ApiPayrollBlocker[]>([])\n\n const { data: employeeData, isFetching: isFetchingEmployeeData } = useEmployeesListSuspense({\n companyId,\n payrollUuid: payrollId, // get back list of employees to specific payroll\n per: itemsPerPage,\n page: currentPage,\n sortBy: 'name', // sort alphanumeric by employee last_names\n })\n\n // get list of employee uuids to filter into prepare endpoint to get back employee_compensation data\n const employeeUuids = useMemo(() => {\n return employeeData.showEmployees?.map(e => e.uuid) || []\n }, [employeeData.showEmployees])\n\n const totalPages = Number(employeeData.httpMeta.response.headers.get('x-total-pages') ?? 1)\n\n const handleItemsPerPageChange = (newCount: PaginationItemsPerPage) => {\n setItemsPerPage(newCount)\n }\n const handleFirstPage = () => {\n setCurrentPage(1)\n }\n const handlePreviousPage = () => {\n setCurrentPage(prevPage => Math.max(prevPage - 1, 1))\n }\n const handleNextPage = () => {\n setCurrentPage(prevPage => Math.min(prevPage + 1, totalPages))\n }\n const handleLastPage = () => {\n setCurrentPage(totalPages)\n }\n\n const pagination = {\n currentPage,\n handleFirstPage,\n handlePreviousPage,\n handleNextPage,\n handleLastPage,\n handleItemsPerPageChange,\n totalPages,\n isFetching: isFetchingEmployeeData,\n itemsPerPage,\n }\n\n const { data: payrollData } = usePayrollsGetSuspense(\n {\n companyId,\n payrollId,\n include: ['taxes', 'benefits', 'deductions'],\n },\n { refetchInterval: isPolling ? 5_000 : false },\n )\n\n const { mutateAsync: calculatePayroll } = usePayrollsCalculateMutation()\n\n const { mutateAsync: updatePayroll, isPending: isUpdatingPayroll } = usePayrollsUpdateMutation()\n\n const {\n preparedPayroll,\n paySchedule,\n isLoading: isPrepareLoading,\n handlePreparePayroll,\n } = usePreparedPayrollData({\n companyId,\n payrollId,\n employeeUuids,\n sortBy: 'last_name', // sort alphanumeric by employee last_names to match employees GET\n })\n\n const onCalculatePayroll = async () => {\n // Clear any existing blockers before attempting calculation\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 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 const transformEmployeeCompensation = ({\n paymentMethod,\n ...compensation\n }: PayrollEmployeeCompensationsType): PayrollUpdateEmployeeCompensations => {\n return {\n ...compensation,\n ...(paymentMethod && paymentMethod !== 'Historical' ? { paymentMethod } : {}),\n memo: compensation.memo || undefined,\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 // Refresh preparedPayroll to get updated data\n await handlePreparePayroll()\n })\n }\n\n const onViewBlockers = () => {\n onEvent(componentEvents.RUN_PAYROLL_BLOCKERS_VIEW_ALL)\n }\n\n useEffect(() => {\n // Start polling when payroll is calculating and not already polling\n if (isCalculating(payrollData.payrollShow?.processingRequest) && !isPolling) {\n setIsPolling(true)\n }\n // Stop polling and emit event when payroll is calculated successfully\n if (isPolling && isCalculated(payrollData.payrollShow?.processingRequest)) {\n onEvent(componentEvents.RUN_PAYROLL_CALCULATED, {\n payrollId,\n alert: { type: 'success', title: t('alerts.progressSaved') },\n })\n // Clear blockers on successful calculation\n setPayrollBlockers([])\n setIsPolling(false)\n }\n // If we are polling and payroll is in failed state, stop polling, and emit failure event\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 }, [\n payrollData.payrollShow?.processingRequest,\n isPolling,\n onEvent,\n t,\n payrollId,\n payrollData.payrollShow?.calculatedAt,\n ])\n\n const payrollDeadlineNotice = payrollData.payrollShow\n ? {\n label: t('alerts.directDepositDeadline', {\n payDate: formatDateNamedWeekdayShortPlusDate(payrollData.payrollShow.checkDate, locale),\n ...formatDateTimeWithTimezone(payrollData.payrollShow.payrollDeadline, locale),\n }),\n content: t('alerts.directDepositDeadlineText'),\n }\n : undefined\n\n return (\n <PayrollConfigurationPresentation\n onCalculatePayroll={onCalculatePayroll}\n onEdit={onEdit}\n onToggleExclude={onToggleExclude}\n onViewBlockers={onViewBlockers}\n employeeCompensations={preparedPayroll?.employeeCompensations || []}\n employeeDetails={employeeData.showEmployees || []}\n payPeriod={preparedPayroll?.payPeriod}\n paySchedule={paySchedule}\n isOffCycle={preparedPayroll?.offCycle}\n alerts={alerts}\n payrollDeadlineNotice={payrollDeadlineNotice}\n isPending={isPolling || isPrepareLoading || isUpdatingPayroll}\n payrollBlockers={payrollBlockers}\n pagination={pagination}\n />\n )\n}\n"],"names":["isCalculating","processingRequest","PayrollProcessingRequestStatus","isCalculated","PayrollConfiguration","props","jsx","BaseComponent","Root","onEvent","companyId","payrollId","dictionary","alerts","useComponentDictionary","useI18n","t","useTranslation","baseSubmitHandler","useBase","locale","useLocale","defaultItemsPerPage","currentPage","setCurrentPage","useState","itemsPerPage","setItemsPerPage","isPolling","setIsPolling","payrollBlockers","setPayrollBlockers","employeeData","isFetchingEmployeeData","useEmployeesListSuspense","employeeUuids","useMemo","totalPages","pagination","prevPage","newCount","payrollData","usePayrollsGetSuspense","calculatePayroll","usePayrollsCalculateMutation","updatePayroll","isUpdatingPayroll","usePayrollsUpdateMutation","preparedPayroll","paySchedule","isPrepareLoading","handlePreparePayroll","usePreparedPayrollData","onCalculatePayroll","result","payrollSubmitHandler","onEdit","employee","componentEvents","transformEmployeeCompensation","paymentMethod","compensation","onToggleExclude","employeeCompensation","transformedCompensation","onViewBlockers","useEffect","payrollDeadlineNotice","formatDateNamedWeekdayShortPlusDate","formatDateTimeWithTimezone","PayrollConfigurationPresentation"],"mappings":";;;;;;;;;;;;;;;;;AA0BA,MAAMA,KAAgB,CAACC,MACrBA,GAAmB,WAAWC,EAA+B,aACzDC,KAAe,CAACF,MACpBA,GAAmB,WAAWC,EAA+B;AAQxD,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;AACF,MAAiC;AAC/B,EAAAC,GAAuB,gCAAgCF,CAAU,GACjEG,GAAQ,8BAA8B;AACtC,QAAM,EAA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,IACE,OAAOzB,EAAE,gCAAgC;AAAA,MACvC,SAASoD,GAAoC3B,EAAY,YAAY,WAAWrB,CAAM;AAAA,MACtF,GAAGiD,GAA2B5B,EAAY,YAAY,iBAAiBrB,CAAM;AAAA,IAAA,CAC9E;AAAA,IACD,SAASJ,EAAE,kCAAkC;AAAA,EAAA,IAE/C;AAEJ,SACE,gBAAAV;AAAA,IAACgE;AAAA,IAAA;AAAA,MACC,oBAAAjB;AAAA,MACA,QAAAG;AAAA,MACA,iBAAAM;AAAA,MACA,gBAAAG;AAAA,MACA,uBAAuBjB,GAAiB,yBAAyB,CAAA;AAAA,MACjE,iBAAiBhB,EAAa,iBAAiB,CAAA;AAAA,MAC/C,WAAWgB,GAAiB;AAAA,MAC5B,aAAAC;AAAA,MACA,YAAYD,GAAiB;AAAA,MAC7B,QAAAnC;AAAA,MACA,uBAAAsD;AAAA,MACA,WAAWvC,KAAasB,KAAoBJ;AAAA,MAC5C,iBAAAhB;AAAA,MACA,YAAAQ;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -17,9 +17,13 @@ interface PayrollConfigurationPresentationProps {
|
|
|
17
17
|
onViewBlockers: () => void;
|
|
18
18
|
isOffCycle?: boolean;
|
|
19
19
|
alerts?: ReactNode;
|
|
20
|
+
payrollDeadlineNotice?: {
|
|
21
|
+
label: string;
|
|
22
|
+
content?: ReactNode;
|
|
23
|
+
};
|
|
20
24
|
isPending?: boolean;
|
|
21
25
|
payrollBlockers?: ApiPayrollBlocker[];
|
|
22
26
|
pagination?: PaginationControlProps;
|
|
23
27
|
}
|
|
24
|
-
export declare const PayrollConfigurationPresentation: ({ employeeCompensations, employeeDetails, payPeriod, paySchedule, onEdit, onToggleExclude, onCalculatePayroll, onViewBlockers, isOffCycle, alerts, isPending, payrollBlockers, pagination, }: PayrollConfigurationPresentationProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare const PayrollConfigurationPresentation: ({ employeeCompensations, employeeDetails, payPeriod, paySchedule, onEdit, onToggleExclude, onCalculatePayroll, onViewBlockers, isOffCycle, alerts, payrollDeadlineNotice, isPending, payrollBlockers, pagination, }: PayrollConfigurationPresentationProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
29
|
export {};
|