@gusto/embedded-react-sdk 0.56.4 → 0.56.6
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 +25 -0
- package/dist/components/Common/DocumentEmbed/DocumentEmbed.js +18 -0
- package/dist/components/Common/DocumentEmbed/DocumentEmbed.js.map +1 -0
- package/dist/components/Common/DocumentViewer/DocumentViewer.js +35 -29
- package/dist/components/Common/DocumentViewer/DocumentViewer.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/useInviteSignatory.js +4 -3
- package/dist/components/Company/AssignSignatory/InviteSignatory/useInviteSignatory.js.map +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/context.js +4 -3
- package/dist/components/Company/BankAccount/BankAccountForm/context.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/FederalTaxes/useFederalTaxes.js +6 -5
- package/dist/components/Company/FederalTaxes/useFederalTaxes.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/Locations/LocationForm/useLocationForm.js +4 -3
- package/dist/components/Company/Locations/LocationForm/useLocationForm.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/management/AutoPilotDialog/AutoPilotDialog.js +39 -0
- package/dist/components/Company/PaySchedule/management/AutoPilotDialog/AutoPilotDialog.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/AutoPilotDialog/AutoPilotDialogPresentation.js +54 -0
- package/dist/components/Company/PaySchedule/management/AutoPilotDialog/AutoPilotDialogPresentation.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/AutoPilotDialog/useAutoPilotDialog.js +56 -0
- package/dist/components/Company/PaySchedule/management/AutoPilotDialog/useAutoPilotDialog.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/PaySchedule.js +54 -39
- package/dist/components/Company/PaySchedule/management/PaySchedule.js.map +1 -1
- package/dist/components/Company/PaySchedule/management/PayScheduleManagementComponents.js +48 -32
- package/dist/components/Company/PaySchedule/management/PayScheduleManagementComponents.js.map +1 -1
- package/dist/components/Company/PaySchedule/management/PayScheduleOverview.js +8 -8
- package/dist/components/Company/PaySchedule/management/PayScheduleOverview.js.map +1 -1
- package/dist/components/Company/PaySchedule/management/payScheduleManagementStateMachine.js +74 -32
- package/dist/components/Company/PaySchedule/management/payScheduleManagementStateMachine.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/context.js +4 -3
- package/dist/components/Company/StateTaxes/StateTaxesList/context.js.map +1 -1
- package/dist/components/Company/StateTaxes/TaxRateManagement/context.js +4 -3
- package/dist/components/Company/StateTaxes/TaxRateManagement/context.js.map +1 -1
- package/dist/components/Contractor/ContractorList/management/ManagementContractorList.js +64 -61
- package/dist/components/Contractor/ContractorList/management/ManagementContractorList.js.map +1 -1
- package/dist/components/Contractor/ContractorList/management/ManagementContractorListView.js +133 -134
- package/dist/components/Contractor/ContractorList/management/ManagementContractorListView.js.map +1 -1
- package/dist/components/Contractor/ContractorListFlow/ContractorListFlow.js.map +1 -1
- package/dist/components/Contractor/ContractorListFlow/ContractorListFlowComponents.js +22 -9
- package/dist/components/Contractor/ContractorListFlow/ContractorListFlowComponents.js.map +1 -1
- package/dist/components/Contractor/ContractorListFlow/contractorListStateMachine.js +51 -20
- package/dist/components/Contractor/ContractorListFlow/contractorListStateMachine.js.map +1 -1
- package/dist/components/Contractor/Dismissal/Dismissal.js +77 -0
- package/dist/components/Contractor/Dismissal/Dismissal.js.map +1 -0
- package/dist/components/Contractor/Dismissal/DismissalPresentation.js +57 -0
- package/dist/components/Contractor/Dismissal/DismissalPresentation.js.map +1 -0
- package/dist/components/Contractor/Dismissal/useDismissal/useDismissal.js +44 -0
- package/dist/components/Contractor/Dismissal/useDismissal/useDismissal.js.map +1 -0
- package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js +17 -14
- package/dist/components/Contractor/Payments/PaymentFlow/paymentStateMachine.js.map +1 -1
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js +45 -41
- package/dist/components/Contractor/Payments/PaymentStatement/PaymentStatementPresentation.js.map +1 -1
- package/dist/components/Contractor/exports/contractorManagement.js +56 -54
- package/dist/components/Contractor/exports/contractorManagement.js.map +1 -1
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js +4 -3
- package/dist/components/Employee/Documents/onboarding/DocumentSigner/DocumentList/useDocumentList.js.map +1 -1
- package/dist/components/Employee/EmployeeListFlow/EmployeeListFlow.js +27 -16
- package/dist/components/Employee/EmployeeListFlow/EmployeeListFlow.js.map +1 -1
- package/dist/components/Employee/EmployeeListFlow/EmployeeListFlowComponents.js +25 -17
- package/dist/components/Employee/EmployeeListFlow/EmployeeListFlowComponents.js.map +1 -1
- package/dist/components/Payroll/ConfirmWireDetails/confirmWireDetailsStateMachine.js +6 -5
- package/dist/components/Payroll/ConfirmWireDetails/confirmWireDetailsStateMachine.js.map +1 -1
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +3 -2
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +201 -196
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields.js +55 -52
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeSchema.js +38 -29
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeSchema.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js +63 -62
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js +25 -18
- package/dist/components/Payroll/PayrollFlow/payrollStateMachine.js.map +1 -1
- package/dist/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.js +72 -68
- package/dist/components/Payroll/UNSTABLE_PayrollEditEmployee/UNSTABLE_PayrollEditEmployee.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +3 -2
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/contexts/ComponentAdapter/useComponentContext.js.map +1 -1
- package/dist/i18n/I18n.js +2 -0
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Company.Management.AutoPilotDialog.json.js +22 -0
- package/dist/i18n/en/Company.Management.AutoPilotDialog.json.js.map +1 -0
- package/dist/i18n/en/Contractor.Dismissal.json.js +20 -0
- package/dist/i18n/en/Contractor.Dismissal.json.js.map +1 -0
- package/dist/i18n/en/Contractor.Payments.PaymentStatement.json.js +2 -2
- package/dist/i18n/en/Payroll.PayrollEditEmployee.json.js +38 -38
- package/dist/i18n/en/Payroll.UNSTABLE_PayrollEditEmployee.json.js +31 -31
- package/dist/i18n/en/common.json.js +37 -35
- package/dist/i18n/en/common.json.js.map +1 -1
- package/dist/package.json.js +1 -1
- package/dist/shared/constants.js +19 -15
- package/dist/shared/constants.js.map +1 -1
- package/dist/src/components/Common/DocumentEmbed/DocumentEmbed.d.ts +3 -0
- package/dist/src/components/Common/DocumentEmbed/DocumentEmbedTypes.d.ts +25 -0
- package/dist/src/components/Common/DocumentEmbed/index.d.ts +2 -0
- package/dist/src/components/Company/PaySchedule/management/AutoPilotDialog/AutoPilotDialog.d.ts +11 -0
- package/dist/src/components/Company/PaySchedule/management/AutoPilotDialog/AutoPilotDialogPresentation.d.ts +17 -0
- package/dist/src/components/Company/PaySchedule/management/AutoPilotDialog/index.d.ts +1 -0
- package/dist/src/components/Company/PaySchedule/management/AutoPilotDialog/useAutoPilotDialog.d.ts +22 -0
- package/dist/src/components/Company/PaySchedule/management/PaySchedule.d.ts +17 -1
- package/dist/src/components/Company/PaySchedule/management/PayScheduleManagementComponents.d.ts +2 -0
- package/dist/src/components/Company/PaySchedule/management/index.d.ts +1 -1
- package/dist/src/components/Company/exports/companyManagement.d.ts +1 -1
- package/dist/src/components/Contractor/ContractorList/management/ManagementContractorList.d.ts +2 -0
- package/dist/src/components/Contractor/ContractorList/management/ManagementContractorListView.d.ts +3 -1
- package/dist/src/components/Contractor/ContractorListFlow/ContractorListFlow.d.ts +6 -4
- package/dist/src/components/Contractor/ContractorListFlow/ContractorListFlowComponents.d.ts +2 -0
- package/dist/src/components/Contractor/ContractorListFlow/contractorListStateMachine.d.ts +1 -0
- package/dist/src/components/Contractor/ContractorListFlow/contractorListStateMachine.test.d.ts +1 -0
- package/dist/src/components/Contractor/Dismissal/Dismissal.d.ts +45 -0
- package/dist/src/components/Contractor/Dismissal/DismissalPresentation.d.ts +17 -0
- package/dist/src/components/Contractor/Dismissal/useDismissal/useDismissal.d.ts +41 -0
- package/dist/src/components/Contractor/Dismissal/useDismissal/useDismissal.test.d.ts +1 -0
- package/dist/src/components/Contractor/exports/contractorManagement.d.ts +1 -0
- package/dist/src/components/Employee/EmployeeListFlow/EmployeeListFlow.d.ts +1 -1
- package/dist/src/components/Employee/EmployeeListFlow/EmployeeListFlowComponents.d.ts +6 -0
- package/dist/src/components/Payroll/ConfirmWireDetails/confirmWireDetailsStateMachine.test.d.ts +1 -0
- package/dist/src/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeSchema.d.ts +19 -0
- package/dist/src/contexts/ComponentAdapter/componentAdapterTypes.d.ts +1 -0
- package/dist/src/contexts/ComponentAdapter/useComponentContext.d.ts +5 -2
- package/dist/src/i18n/en/common.json.d.ts +3 -0
- package/dist/src/i18n/types.d.ts +128 -0
- package/dist/src/shared/constants.d.ts +8 -0
- package/docs/guides/endpoint-inventory.json +30 -1
- package/package.json +1 -1
|
@@ -1,41 +1,48 @@
|
|
|
1
1
|
import { z as e } from "zod";
|
|
2
|
-
import { PayrollUpdatePaymentMethod as
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
], I =
|
|
2
|
+
import { PayrollUpdatePaymentMethod as E } from "@gusto/embedded-api/models/components/payrollupdate";
|
|
3
|
+
const N = [
|
|
4
|
+
E.DirectDeposit,
|
|
5
|
+
E.Check
|
|
6
|
+
], I = N.map((r) => ({ value: r, label: r })), n = {
|
|
7
7
|
NEGATIVE_AMOUNT: "NEGATIVE_AMOUNT",
|
|
8
|
+
MAX_HOURS: "MAX_HOURS",
|
|
8
9
|
REIMBURSEMENT_AMOUNT: "REIMBURSEMENT_AMOUNT",
|
|
10
|
+
MAX_REIMBURSEMENT_AMOUNT: "MAX_REIMBURSEMENT_AMOUNT",
|
|
9
11
|
REQUIRED_WORKWEEK: "REQUIRED_WORKWEEK"
|
|
10
|
-
},
|
|
11
|
-
message:
|
|
12
|
-
}),
|
|
12
|
+
}, R = /^\d+(\.\d+)?$/, t = e.string().refine((r) => r === "" || R.test(r), {
|
|
13
|
+
message: n.NEGATIVE_AMOUNT
|
|
14
|
+
}), A = 99999, U = t.refine(
|
|
15
|
+
(r) => r === "" || Number(r) <= A,
|
|
16
|
+
{ message: n.MAX_HOURS }
|
|
17
|
+
), O = e.object({
|
|
13
18
|
uuid: e.string().nullable().optional(),
|
|
14
19
|
description: e.string(),
|
|
15
20
|
amount: e.string(),
|
|
16
21
|
recurring: e.boolean().optional()
|
|
17
|
-
}),
|
|
22
|
+
}), T = 1e6, p = e.object({
|
|
18
23
|
description: e.string(),
|
|
19
24
|
amount: e.string().refine((r) => parseFloat(r) > 0, {
|
|
20
|
-
message:
|
|
25
|
+
message: n.REIMBURSEMENT_AMOUNT
|
|
26
|
+
}).refine((r) => parseFloat(r) <= T, {
|
|
27
|
+
message: n.MAX_REIMBURSEMENT_AMOUNT
|
|
21
28
|
})
|
|
22
29
|
});
|
|
23
|
-
function
|
|
24
|
-
for (const [
|
|
25
|
-
for (const [
|
|
26
|
-
const
|
|
27
|
-
if (!(
|
|
28
|
-
for (const [
|
|
29
|
-
|
|
30
|
+
function c(r, o, a) {
|
|
31
|
+
for (const [m, M] of Object.entries(o))
|
|
32
|
+
for (const [d, u] of Object.entries(M)) {
|
|
33
|
+
const s = Object.entries(u);
|
|
34
|
+
if (!(s.length <= 1 || !s.some(([, i]) => i !== "")))
|
|
35
|
+
for (const [i, g] of s)
|
|
36
|
+
g === "" && r.addIssue({
|
|
30
37
|
code: e.ZodIssueCode.custom,
|
|
31
|
-
message:
|
|
32
|
-
path: [
|
|
38
|
+
message: n.REQUIRED_WORKWEEK,
|
|
39
|
+
path: [a, m, d, i]
|
|
33
40
|
});
|
|
34
41
|
}
|
|
35
42
|
}
|
|
36
|
-
function
|
|
43
|
+
function S() {
|
|
37
44
|
return e.object({
|
|
38
|
-
hours: e.record(e.string(), e.record(e.string(), e.record(e.string(),
|
|
45
|
+
hours: e.record(e.string(), e.record(e.string(), e.record(e.string(), U))),
|
|
39
46
|
overtimeIncludedEarnings: e.record(
|
|
40
47
|
e.string(),
|
|
41
48
|
e.record(e.string(), e.record(e.string(), t))
|
|
@@ -43,21 +50,23 @@ function A() {
|
|
|
43
50
|
overtimeExcludedEarnings: e.record(e.string(), e.record(e.string(), t)),
|
|
44
51
|
timeOff: e.record(e.string(), t),
|
|
45
52
|
finalPayout: e.record(e.string(), t),
|
|
46
|
-
reimbursements: e.array(
|
|
53
|
+
reimbursements: e.array(O),
|
|
47
54
|
// Binding shape only — the draft is validated against `reimbursementDraftSchema`
|
|
48
55
|
// at save time, not by the main resolver, so a half-filled draft never blocks
|
|
49
56
|
// the payroll submit.
|
|
50
57
|
reimbursementDraft: e.object({ description: e.string(), amount: e.string() }),
|
|
51
|
-
paymentMethod: e.enum(
|
|
52
|
-
}).superRefine((r,
|
|
53
|
-
|
|
58
|
+
paymentMethod: e.enum(E).optional()
|
|
59
|
+
}).superRefine((r, o) => {
|
|
60
|
+
c(o, r.hours, "hours"), c(o, r.overtimeIncludedEarnings, "overtimeIncludedEarnings");
|
|
54
61
|
});
|
|
55
62
|
}
|
|
56
63
|
export {
|
|
64
|
+
A as MAX_HOURS,
|
|
65
|
+
T as MAX_REIMBURSEMENT_AMOUNT,
|
|
57
66
|
I as PAYMENT_METHOD_OPTIONS,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
67
|
+
N as PAYMENT_METHOD_VALUES,
|
|
68
|
+
n as PayrollEditEmployeeErrorCodes,
|
|
69
|
+
S as createPayrollEditEmployeeSchema,
|
|
70
|
+
p as reimbursementDraftSchema
|
|
62
71
|
};
|
|
63
72
|
//# sourceMappingURL=payrollEditEmployeeSchema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payrollEditEmployeeSchema.js","sources":["../../../../../../src/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeSchema.ts"],"sourcesContent":["import { z } from 'zod'\nimport { PayrollUpdatePaymentMethod } from '@gusto/embedded-api/models/components/payrollupdate'\n\n/**\n * Payment-method option values, in display order. The hook publishes these on\n * `fieldsMetadata.paymentMethod` via `withOptions`; the UI supplies the\n * translated labels through `getOptionLabel`.\n *\n * @internal\n */\nexport const PAYMENT_METHOD_VALUES = [\n PayrollUpdatePaymentMethod.DirectDeposit,\n PayrollUpdatePaymentMethod.Check,\n] as const\n\n/** @internal */\nexport const PAYMENT_METHOD_OPTIONS = PAYMENT_METHOD_VALUES.map(value => ({ value, label: value }))\n\n/**\n * Validation error codes produced by the payroll edit-employee schema.\n *\n * @public\n */\nexport const PayrollEditEmployeeErrorCodes = {\n NEGATIVE_AMOUNT: 'NEGATIVE_AMOUNT',\n REIMBURSEMENT_AMOUNT: 'REIMBURSEMENT_AMOUNT',\n REQUIRED_WORKWEEK: 'REQUIRED_WORKWEEK',\n} as const\n\n/**\n * Union of validation error codes emitted by the payroll edit-employee schema.\n *\n * @public\n */\nexport type PayrollEditEmployeeErrorCode =\n (typeof PayrollEditEmployeeErrorCodes)[keyof typeof PayrollEditEmployeeErrorCodes]\n\n// A plain, non-negative decimal: one or more digits with an optional fractional\n// part. Deliberately strict — `parseFloat` would accept \"5ea\" (→ 5), \"Infinity\",\n// and \"1e3\", any of which would silently corrupt the amount downstream.\nconst NON_NEGATIVE = /^\\d+(\\.\\d+)?$/\n\n// Hours and amounts are entered as strings. Blank is allowed (it means \"not\n// provided\" — see the submit rule), but any provided value must be a valid,\n// non-negative number.\nconst nonNegativeAmount = z.string().refine(value => value === '' || NON_NEGATIVE.test(value), {\n message: PayrollEditEmployeeErrorCodes.NEGATIVE_AMOUNT,\n})\n\n// Committed reimbursement rows are presentational passthrough: they hold data\n// that was already validated when its draft was saved (or came from the server),\n// so the amount is a plain string here. All reimbursement validation lives in\n// `reimbursementDraftSchema` below, mirroring the legacy editor.\nconst reimbursementSchema = z.object({\n uuid: z.string().nullable().optional(),\n description: z.string(),\n amount: z.string(),\n recurring: z.boolean().optional(),\n})\n\n/**\n * The single reimbursement validation schema: the \"add reimbursement\" draft row.\n * Amount must be a number greater than zero, matching the legacy editor's\n * inline validation. The hook validates the draft against this before committing\n * it to the presentational `reimbursements` list.\n *\n * @internal\n */\nexport const reimbursementDraftSchema = z.object({\n description: z.string(),\n amount: z.string().refine(value => parseFloat(value) > 0, {\n message: PayrollEditEmployeeErrorCodes.REIMBURSEMENT_AMOUNT,\n }),\n})\n\n// A \"row\" is one job+name line's week map (`{ [workweekStart]: amount }`). A\n// collapsed (non-split) row always has exactly one key, so `entries.length <= 1`\n// makes this a no-op for collapsed rows — only a split row (multiple workweek\n// keys) can be \"partial.\" See the module-level remarks on {@link createPayrollEditEmployeeSchema}.\nfunction addRequiredWorkweekIssues(\n ctx: z.RefinementCtx,\n section: Record<string, Record<string, Record<string, string>>>,\n sectionKey: 'hours' | 'overtimeIncludedEarnings',\n): void {\n for (const [jobUuid, names] of Object.entries(section)) {\n for (const [name, weekMap] of Object.entries(names)) {\n const entries = Object.entries(weekMap)\n if (entries.length <= 1) continue\n const hasAnyValue = entries.some(([, value]) => value !== '')\n if (!hasAnyValue) continue\n for (const [workweekStart, value] of entries) {\n if (value === '') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: PayrollEditEmployeeErrorCodes.REQUIRED_WORKWEEK,\n path: [sectionKey, jobUuid, name, workweekStart],\n })\n }\n }\n }\n }\n}\n\n/**\n * Builds the Zod schema for the payroll edit-employee form.\n *\n * @remarks\n * Overtime-affecting values are keyed by workweek internally: hours and\n * additional earnings are job-then-name-then-workweekStart records, so the\n * single-workweek (or not-yet-split) case is just the degenerate one-key form\n * of the multi-workweek shape. Non-overtime earnings (`overtimeExcludedEarnings`) are flat\n * job-then-name-to-amount records with no per-workweek breakdown, since they do\n * not feed the blended rate. Time off and final payout are keyed by\n * compensation name. This keeps one schema and one submit path.\n *\n * A `superRefine` enforces per-row completeness on `hours` and\n * `overtimeIncludedEarnings`: once any workweek cell in a job+name row is filled, every\n * other cell in that row must be filled too, surfaced per empty cell as\n * {@link PayrollEditEmployeeErrorCodes.REQUIRED_WORKWEEK}. A row with nothing\n * filled is left alone (still submittable as untouched). This needs no\n * workweek/split context passed in — it's purely structural on whatever keys a\n * row happens to have, which is why a collapsed row (always exactly one key)\n * can never trigger it.\n *\n * @returns The Zod schema validating {@link PayrollEditEmployeeFormData}.\n * @internal\n */\nexport function createPayrollEditEmployeeSchema() {\n return z\n .object({\n hours: z.record(z.string(), z.record(z.string(), z.record(z.string(), nonNegativeAmount))),\n overtimeIncludedEarnings: z.record(\n z.string(),\n z.record(z.string(), z.record(z.string(), nonNegativeAmount)),\n ),\n overtimeExcludedEarnings: z.record(z.string(), z.record(z.string(), nonNegativeAmount)),\n timeOff: z.record(z.string(), nonNegativeAmount),\n finalPayout: z.record(z.string(), nonNegativeAmount),\n reimbursements: z.array(reimbursementSchema),\n // Binding shape only — the draft is validated against `reimbursementDraftSchema`\n // at save time, not by the main resolver, so a half-filled draft never blocks\n // the payroll submit.\n reimbursementDraft: z.object({ description: z.string(), amount: z.string() }),\n paymentMethod: z.enum(PayrollUpdatePaymentMethod).optional(),\n })\n .superRefine((data, ctx) => {\n addRequiredWorkweekIssues(ctx, data.hours, 'hours')\n addRequiredWorkweekIssues(ctx, data.overtimeIncludedEarnings, 'overtimeIncludedEarnings')\n })\n}\n\n/**\n * Shape of the values managed by the payroll edit-employee form.\n *\n * @public\n */\nexport type PayrollEditEmployeeFormData = z.infer<\n ReturnType<typeof createPayrollEditEmployeeSchema>\n>\n\n/**\n * Validated values produced by the payroll edit-employee form on submit.\n *\n * @internal\n */\nexport type PayrollEditEmployeeFormOutputs = PayrollEditEmployeeFormData\n\n/**\n * A single reimbursement row in {@link PayrollEditEmployeeFormData}.\n *\n * @public\n */\nexport type ReimbursementFormEntry = PayrollEditEmployeeFormData['reimbursements'][number]\n"],"names":["PAYMENT_METHOD_VALUES","PayrollUpdatePaymentMethod","PAYMENT_METHOD_OPTIONS","value","PayrollEditEmployeeErrorCodes","NON_NEGATIVE","nonNegativeAmount","z","reimbursementSchema","reimbursementDraftSchema","addRequiredWorkweekIssues","ctx","section","sectionKey","jobUuid","names","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,YACrB,SAASH,EAA8B;AAAA,YACvC,MAAM,CAACS,GAAYC,GAASE,GAAMG,CAAa;AAAA,UAAA,CAChD;AAAA,IAGP;AAEJ;AA0BO,SAASC,IAAkC;AAChD,SAAOb,EACJ,OAAO;AAAA,IACN,OAAOA,EAAE,OAAOA,EAAE,OAAA,GAAUA,EAAE,OAAOA,EAAE,OAAA,GAAUA,EAAE,OAAOA,EAAE,UAAUD,CAAiB,CAAC,CAAC;AAAA,IACzF,0BAA0BC,EAAE;AAAA,MAC1BA,EAAE,OAAA;AAAA,MACFA,EAAE,OAAOA,EAAE,OAAA,GAAUA,EAAE,OAAOA,EAAE,OAAA,GAAUD,CAAiB,CAAC;AAAA,IAAA;AAAA,IAE9D,0BAA0BC,EAAE,OAAOA,EAAE,OAAA,GAAUA,EAAE,OAAOA,EAAE,OAAA,GAAUD,CAAiB,CAAC;AAAA,IACtF,SAASC,EAAE,OAAOA,EAAE,OAAA,GAAUD,CAAiB;AAAA,IAC/C,aAAaC,EAAE,OAAOA,EAAE,OAAA,GAAUD,CAAiB;AAAA,IACnD,gBAAgBC,EAAE,MAAMC,CAAmB;AAAA;AAAA;AAAA;AAAA,IAI3C,oBAAoBD,EAAE,OAAO,EAAE,aAAaA,EAAE,OAAA,GAAU,QAAQA,EAAE,OAAA,EAAO,CAAG;AAAA,IAC5E,eAAeA,EAAE,KAAKN,CAA0B,EAAE,SAAA;AAAA,EAAS,CAC5D,EACA,YAAY,CAACoB,GAAMV,MAAQ;AAC1B,IAAAD,EAA0BC,GAAKU,EAAK,OAAO,OAAO,GAClDX,EAA0BC,GAAKU,EAAK,0BAA0B,0BAA0B;AAAA,EAC1F,CAAC;AACL;"}
|
|
1
|
+
{"version":3,"file":"payrollEditEmployeeSchema.js","sources":["../../../../../../src/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeSchema.ts"],"sourcesContent":["import { z } from 'zod'\nimport { PayrollUpdatePaymentMethod } from '@gusto/embedded-api/models/components/payrollupdate'\n\n/**\n * Payment-method option values, in display order. The hook publishes these on\n * `fieldsMetadata.paymentMethod` via `withOptions`; the UI supplies the\n * translated labels through `getOptionLabel`.\n *\n * @internal\n */\nexport const PAYMENT_METHOD_VALUES = [\n PayrollUpdatePaymentMethod.DirectDeposit,\n PayrollUpdatePaymentMethod.Check,\n] as const\n\n/** @internal */\nexport const PAYMENT_METHOD_OPTIONS = PAYMENT_METHOD_VALUES.map(value => ({ value, label: value }))\n\n/**\n * Validation error codes produced by the payroll edit-employee schema.\n *\n * @public\n */\nexport const PayrollEditEmployeeErrorCodes = {\n NEGATIVE_AMOUNT: 'NEGATIVE_AMOUNT',\n MAX_HOURS: 'MAX_HOURS',\n REIMBURSEMENT_AMOUNT: 'REIMBURSEMENT_AMOUNT',\n MAX_REIMBURSEMENT_AMOUNT: 'MAX_REIMBURSEMENT_AMOUNT',\n REQUIRED_WORKWEEK: 'REQUIRED_WORKWEEK',\n} as const\n\n/**\n * Union of validation error codes emitted by the payroll edit-employee schema.\n *\n * @public\n */\nexport type PayrollEditEmployeeErrorCode =\n (typeof PayrollEditEmployeeErrorCodes)[keyof typeof PayrollEditEmployeeErrorCodes]\n\n// A plain, non-negative decimal: one or more digits with an optional fractional\n// part. Deliberately strict — `parseFloat` would accept \"5ea\" (→ 5), \"Infinity\",\n// and \"1e3\", any of which would silently corrupt the amount downstream.\nconst NON_NEGATIVE = /^\\d+(\\.\\d+)?$/\n\n// Hours and amounts are entered as strings. Blank is allowed (it means \"not\n// provided\" — see the submit rule), but any provided value must be a valid,\n// non-negative number.\nconst nonNegativeAmount = z.string().refine(value => value === '' || NON_NEGATIVE.test(value), {\n message: PayrollEditEmployeeErrorCodes.NEGATIVE_AMOUNT,\n})\n\n/**\n * Mirrors the server's fixed hours cap (`draft_payrolls`' `MAX_HOURS`) so an\n * over-limit value is caught inline instead of round-tripping to a 422. Also\n * applied as the hours fields' native `max` so the stepper can't reach it.\n *\n * @public\n */\nexport const MAX_HOURS = 99_999\n\nconst nonNegativeHours = nonNegativeAmount.refine(\n value => value === '' || Number(value) <= MAX_HOURS,\n { message: PayrollEditEmployeeErrorCodes.MAX_HOURS },\n)\n\n// Committed reimbursement rows are presentational passthrough: they hold data\n// that was already validated when its draft was saved (or came from the server),\n// so the amount is a plain string here. All reimbursement validation lives in\n// `reimbursementDraftSchema` below, mirroring the legacy editor.\nconst reimbursementSchema = z.object({\n uuid: z.string().nullable().optional(),\n description: z.string(),\n amount: z.string(),\n recurring: z.boolean().optional(),\n})\n\n/**\n * Mirrors the server's fixed reimbursement cap (`payroll_core_data`'s\n * `Reimbursements::MAX_AMOUNT`) so an over-limit value is caught inline\n * instead of round-tripping to a 422. Also applied as the amount field's\n * native `max` so the stepper can't reach it.\n *\n * @public\n */\nexport const MAX_REIMBURSEMENT_AMOUNT = 1_000_000\n\n/**\n * The single reimbursement validation schema: the \"add reimbursement\" draft row.\n * Amount must be a number greater than zero, matching the legacy editor's\n * inline validation. The hook validates the draft against this before committing\n * it to the presentational `reimbursements` list.\n *\n * @internal\n */\nexport const reimbursementDraftSchema = z.object({\n description: z.string(),\n amount: z\n .string()\n .refine(value => parseFloat(value) > 0, {\n message: PayrollEditEmployeeErrorCodes.REIMBURSEMENT_AMOUNT,\n })\n .refine(value => parseFloat(value) <= MAX_REIMBURSEMENT_AMOUNT, {\n message: PayrollEditEmployeeErrorCodes.MAX_REIMBURSEMENT_AMOUNT,\n }),\n})\n\n// A \"row\" is one job+name line's week map (`{ [workweekStart]: amount }`). A\n// collapsed (non-split) row always has exactly one key, so `entries.length <= 1`\n// makes this a no-op for collapsed rows — only a split row (multiple workweek\n// keys) can be \"partial.\" See the module-level remarks on {@link createPayrollEditEmployeeSchema}.\nfunction addRequiredWorkweekIssues(\n ctx: z.RefinementCtx,\n section: Record<string, Record<string, Record<string, string>>>,\n sectionKey: 'hours' | 'overtimeIncludedEarnings',\n): void {\n for (const [jobUuid, names] of Object.entries(section)) {\n for (const [name, weekMap] of Object.entries(names)) {\n const entries = Object.entries(weekMap)\n if (entries.length <= 1) continue\n const hasAnyValue = entries.some(([, value]) => value !== '')\n if (!hasAnyValue) continue\n for (const [workweekStart, value] of entries) {\n if (value === '') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: PayrollEditEmployeeErrorCodes.REQUIRED_WORKWEEK,\n path: [sectionKey, jobUuid, name, workweekStart],\n })\n }\n }\n }\n }\n}\n\n/**\n * Builds the Zod schema for the payroll edit-employee form.\n *\n * @remarks\n * Overtime-affecting values are keyed by workweek internally: hours and\n * additional earnings are job-then-name-then-workweekStart records, so the\n * single-workweek (or not-yet-split) case is just the degenerate one-key form\n * of the multi-workweek shape. Non-overtime earnings (`overtimeExcludedEarnings`) are flat\n * job-then-name-to-amount records with no per-workweek breakdown, since they do\n * not feed the blended rate. Time off and final payout are keyed by\n * compensation name. This keeps one schema and one submit path.\n *\n * A `superRefine` enforces per-row completeness on `hours` and\n * `overtimeIncludedEarnings`: once any workweek cell in a job+name row is filled, every\n * other cell in that row must be filled too, surfaced per empty cell as\n * {@link PayrollEditEmployeeErrorCodes.REQUIRED_WORKWEEK}. A row with nothing\n * filled is left alone (still submittable as untouched). This needs no\n * workweek/split context passed in — it's purely structural on whatever keys a\n * row happens to have, which is why a collapsed row (always exactly one key)\n * can never trigger it.\n *\n * @returns The Zod schema validating {@link PayrollEditEmployeeFormData}.\n * @internal\n */\nexport function createPayrollEditEmployeeSchema() {\n return z\n .object({\n hours: z.record(z.string(), z.record(z.string(), z.record(z.string(), nonNegativeHours))),\n overtimeIncludedEarnings: z.record(\n z.string(),\n z.record(z.string(), z.record(z.string(), nonNegativeAmount)),\n ),\n overtimeExcludedEarnings: z.record(z.string(), z.record(z.string(), nonNegativeAmount)),\n timeOff: z.record(z.string(), nonNegativeAmount),\n finalPayout: z.record(z.string(), nonNegativeAmount),\n reimbursements: z.array(reimbursementSchema),\n // Binding shape only — the draft is validated against `reimbursementDraftSchema`\n // at save time, not by the main resolver, so a half-filled draft never blocks\n // the payroll submit.\n reimbursementDraft: z.object({ description: z.string(), amount: z.string() }),\n paymentMethod: z.enum(PayrollUpdatePaymentMethod).optional(),\n })\n .superRefine((data, ctx) => {\n addRequiredWorkweekIssues(ctx, data.hours, 'hours')\n addRequiredWorkweekIssues(ctx, data.overtimeIncludedEarnings, 'overtimeIncludedEarnings')\n })\n}\n\n/**\n * Shape of the values managed by the payroll edit-employee form.\n *\n * @public\n */\nexport type PayrollEditEmployeeFormData = z.infer<\n ReturnType<typeof createPayrollEditEmployeeSchema>\n>\n\n/**\n * Validated values produced by the payroll edit-employee form on submit.\n *\n * @internal\n */\nexport type PayrollEditEmployeeFormOutputs = PayrollEditEmployeeFormData\n\n/**\n * A single reimbursement row in {@link PayrollEditEmployeeFormData}.\n *\n * @public\n */\nexport type ReimbursementFormEntry = PayrollEditEmployeeFormData['reimbursements'][number]\n"],"names":["PAYMENT_METHOD_VALUES","PayrollUpdatePaymentMethod","PAYMENT_METHOD_OPTIONS","value","PayrollEditEmployeeErrorCodes","NON_NEGATIVE","nonNegativeAmount","z","MAX_HOURS","nonNegativeHours","reimbursementSchema","MAX_REIMBURSEMENT_AMOUNT","reimbursementDraftSchema","addRequiredWorkweekIssues","ctx","section","sectionKey","jobUuid","names","name","weekMap","entries","workweekStart","createPayrollEditEmployeeSchema","data"],"mappings":";;AAUO,MAAMA,IAAwB;AAAA,EACnCC,EAA2B;AAAA,EAC3BA,EAA2B;AAC7B,GAGaC,IAAyBF,EAAsB,IAAI,CAAAG,OAAU,EAAE,OAAAA,GAAO,OAAOA,IAAQ,GAOrFC,IAAgC;AAAA,EAC3C,iBAAiB;AAAA,EACjB,WAAW;AAAA,EACX,sBAAsB;AAAA,EACtB,0BAA0B;AAAA,EAC1B,mBAAmB;AACrB,GAaMC,IAAe,iBAKfC,IAAoBC,EAAE,OAAA,EAAS,OAAO,CAAAJ,MAASA,MAAU,MAAME,EAAa,KAAKF,CAAK,GAAG;AAAA,EAC7F,SAASC,EAA8B;AACzC,CAAC,GASYI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A,EAAE,OAAA,GAAUA,EAAE,OAAOA,EAAE,OAAA,GAAUA,EAAE,OAAOA,EAAE,UAAUE,CAAgB,CAAC,CAAC;AAAA,IACxF,0BAA0BF,EAAE;AAAA,MAC1BA,EAAE,OAAA;AAAA,MACFA,EAAE,OAAOA,EAAE,OAAA,GAAUA,EAAE,OAAOA,EAAE,OAAA,GAAUD,CAAiB,CAAC;AAAA,IAAA;AAAA,IAE9D,0BAA0BC,EAAE,OAAOA,EAAE,OAAA,GAAUA,EAAE,OAAOA,EAAE,OAAA,GAAUD,CAAiB,CAAC;AAAA,IACtF,SAASC,EAAE,OAAOA,EAAE,OAAA,GAAUD,CAAiB;AAAA,IAC/C,aAAaC,EAAE,OAAOA,EAAE,OAAA,GAAUD,CAAiB;AAAA,IACnD,gBAAgBC,EAAE,MAAMG,CAAmB;AAAA;AAAA;AAAA;AAAA,IAI3C,oBAAoBH,EAAE,OAAO,EAAE,aAAaA,EAAE,OAAA,GAAU,QAAQA,EAAE,OAAA,EAAO,CAAG;AAAA,IAC5E,eAAeA,EAAE,KAAKN,CAA0B,EAAE,SAAA;AAAA,EAAS,CAC5D,EACA,YAAY,CAACuB,GAAMV,MAAQ;AAC1B,IAAAD,EAA0BC,GAAKU,EAAK,OAAO,OAAO,GAClDX,EAA0BC,GAAKU,EAAK,0BAA0B,0BAA0B;AAAA,EAC1F,CAAC;AACL;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { state as
|
|
2
|
-
import { PayrollOverviewContextual as c, PayrollConfigurationContextual as
|
|
1
|
+
import { state as d, transition as t, reduce as r, guard as m } from "robot3";
|
|
2
|
+
import { PayrollOverviewContextual as c, PayrollConfigurationContextual as s, PayrollReceiptsContextual as P, PayrollEditEmployeeContextual as u, PayrollBlockerContextual as b } from "../PayrollFlow/PayrollFlowComponents.js";
|
|
3
3
|
import { componentEvents as i } from "../../../shared/constants.js";
|
|
4
|
-
import { updateBreadcrumbs as l, patchBreadcrumbsHeader as p, hideBreadcrumb as
|
|
5
|
-
import { createBreadcrumbNavigateTransition as
|
|
6
|
-
const
|
|
4
|
+
import { updateBreadcrumbs as l, patchBreadcrumbsHeader as p, hideBreadcrumb as f } from "../../../helpers/breadcrumbHelpers.js";
|
|
5
|
+
import { createBreadcrumbNavigateTransition as v } from "../../Common/FlowBreadcrumbs/breadcrumbTransitionHelpers.js";
|
|
6
|
+
const n = v(), I = (e = !1) => ({
|
|
7
7
|
configuration: {
|
|
8
8
|
parent: null,
|
|
9
9
|
item: {
|
|
@@ -15,7 +15,7 @@ const s = L(), B = (e = !1) => ({
|
|
|
15
15
|
startDate: o.payPeriod?.startDate ?? "",
|
|
16
16
|
endDate: o.payPeriod?.endDate ?? ""
|
|
17
17
|
}),
|
|
18
|
-
component:
|
|
18
|
+
component: s,
|
|
19
19
|
alerts: void 0
|
|
20
20
|
}))
|
|
21
21
|
}
|
|
@@ -60,10 +60,10 @@ const s = L(), B = (e = !1) => ({
|
|
|
60
60
|
namespace: "Payroll.PayrollBlocker"
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
}),
|
|
63
|
+
}), g = t(
|
|
64
64
|
i.RUN_PAYROLL_CALCULATED,
|
|
65
65
|
"overview",
|
|
66
|
-
|
|
66
|
+
r(
|
|
67
67
|
(e, a) => ({
|
|
68
68
|
...l("overview", e, {
|
|
69
69
|
startDate: a.payload.payPeriod?.startDate ?? "",
|
|
@@ -71,20 +71,17 @@ const s = L(), B = (e = !1) => ({
|
|
|
71
71
|
}),
|
|
72
72
|
component: c,
|
|
73
73
|
payPeriod: a.payload.payPeriod ?? e.payPeriod,
|
|
74
|
-
alerts: a.payload.alert ? [
|
|
75
|
-
...(e.alerts ?? []).filter((o) => o.alertKey !== "progressSaved"),
|
|
76
|
-
{ ...a.payload.alert, alertKey: "progressSaved" }
|
|
77
|
-
] : e.alerts,
|
|
74
|
+
alerts: a.payload.alert ? [{ ...a.payload.alert, alertKey: "progressSaved" }] : void 0,
|
|
78
75
|
ctaConfig: {
|
|
79
76
|
labelKey: "exitFlowCta",
|
|
80
77
|
namespace: "Payroll.PayrollOverview"
|
|
81
78
|
}
|
|
82
79
|
})
|
|
83
80
|
)
|
|
84
|
-
),
|
|
81
|
+
), L = t(
|
|
85
82
|
i.RUN_PAYROLL_ALREADY_PROCESSED,
|
|
86
83
|
"overview",
|
|
87
|
-
|
|
84
|
+
r(
|
|
88
85
|
(e, a) => {
|
|
89
86
|
const o = a.payload.payPeriod ?? e.payPeriod;
|
|
90
87
|
return {
|
|
@@ -94,10 +91,7 @@ const s = L(), B = (e = !1) => ({
|
|
|
94
91
|
}),
|
|
95
92
|
component: c,
|
|
96
93
|
payPeriod: o,
|
|
97
|
-
alerts: a.payload.alert ? [
|
|
98
|
-
...(e.alerts ?? []).filter((m) => m.alertKey !== "alreadyProcessed"),
|
|
99
|
-
{ ...a.payload.alert, alertKey: "alreadyProcessed" }
|
|
100
|
-
] : e.alerts,
|
|
94
|
+
alerts: a.payload.alert ? [{ ...a.payload.alert, alertKey: "alreadyProcessed" }] : void 0,
|
|
101
95
|
ctaConfig: {
|
|
102
96
|
labelKey: "exitFlowCta",
|
|
103
97
|
namespace: "Payroll.PayrollOverview"
|
|
@@ -105,10 +99,10 @@ const s = L(), B = (e = !1) => ({
|
|
|
105
99
|
};
|
|
106
100
|
}
|
|
107
101
|
)
|
|
108
|
-
),
|
|
102
|
+
), D = t(
|
|
109
103
|
i.RUN_PAYROLL_EMPLOYEE_EDIT,
|
|
110
104
|
"editEmployee",
|
|
111
|
-
|
|
105
|
+
r(
|
|
112
106
|
(e, a) => ({
|
|
113
107
|
...l("editEmployee", e, {
|
|
114
108
|
firstName: a.payload.firstName,
|
|
@@ -116,64 +110,67 @@ const s = L(), B = (e = !1) => ({
|
|
|
116
110
|
startDate: e.payPeriod?.startDate ?? "",
|
|
117
111
|
endDate: e.payPeriod?.endDate ?? ""
|
|
118
112
|
}),
|
|
119
|
-
component:
|
|
113
|
+
component: u,
|
|
120
114
|
employeeId: a.payload.employeeId,
|
|
121
115
|
firstName: a.payload.firstName,
|
|
122
116
|
lastName: a.payload.lastName,
|
|
117
|
+
alerts: void 0,
|
|
123
118
|
ctaConfig: null
|
|
124
119
|
})
|
|
125
120
|
)
|
|
126
|
-
),
|
|
121
|
+
), E = t(
|
|
127
122
|
i.RUN_PAYROLL_BLOCKERS_VIEW_ALL,
|
|
128
123
|
"blockers",
|
|
129
|
-
|
|
124
|
+
r((e) => ({
|
|
130
125
|
...l("blockers", e),
|
|
131
|
-
component:
|
|
126
|
+
component: b,
|
|
127
|
+
alerts: void 0
|
|
132
128
|
}))
|
|
133
|
-
), y = (e) => !e.hasPayrollSubmissionStarted,
|
|
129
|
+
), y = (e) => !e.hasPayrollSubmissionStarted, C = t(
|
|
134
130
|
i.RUN_PAYROLL_EDIT,
|
|
135
131
|
"configuration",
|
|
136
|
-
|
|
137
|
-
|
|
132
|
+
m(y),
|
|
133
|
+
r((e) => ({
|
|
138
134
|
...l("configuration", e, {
|
|
139
135
|
startDate: e.payPeriod?.startDate ?? "",
|
|
140
136
|
endDate: e.payPeriod?.endDate ?? ""
|
|
141
137
|
}),
|
|
142
|
-
component:
|
|
138
|
+
component: s,
|
|
143
139
|
alerts: void 0,
|
|
144
140
|
ctaConfig: {
|
|
145
141
|
labelKey: "exitFlowCta",
|
|
146
142
|
namespace: "Payroll.PayrollConfiguration"
|
|
147
143
|
}
|
|
148
144
|
}))
|
|
149
|
-
),
|
|
145
|
+
), N = t(
|
|
150
146
|
i.RUN_PAYROLL_SUBMITTING,
|
|
151
147
|
"overview",
|
|
152
|
-
|
|
153
|
-
...
|
|
148
|
+
r((e) => ({
|
|
149
|
+
...f("configuration", e),
|
|
154
150
|
hasPayrollSubmissionStarted: !0
|
|
155
151
|
}))
|
|
156
|
-
),
|
|
152
|
+
), R = t(
|
|
157
153
|
i.RUN_PAYROLL_RECEIPT_GET,
|
|
158
154
|
"receipts",
|
|
159
|
-
|
|
155
|
+
r((e) => ({
|
|
160
156
|
...l("receipts", e, {
|
|
161
157
|
startDate: e.payPeriod?.startDate ?? "",
|
|
162
158
|
endDate: e.payPeriod?.endDate ?? ""
|
|
163
159
|
}),
|
|
164
|
-
component:
|
|
160
|
+
component: P,
|
|
165
161
|
alerts: void 0,
|
|
166
162
|
ctaConfig: {
|
|
167
163
|
labelKey: "exitFlowCta",
|
|
168
164
|
namespace: "Payroll.PayrollReceipts"
|
|
169
165
|
}
|
|
170
166
|
}))
|
|
171
|
-
),
|
|
167
|
+
), _ = t(
|
|
172
168
|
i.RUN_PAYROLL_EMPLOYEE_SAVED,
|
|
173
169
|
"configuration",
|
|
174
|
-
|
|
170
|
+
r((e) => ({
|
|
175
171
|
...p(e, { currentBreadcrumbId: "configuration" }),
|
|
176
|
-
component:
|
|
172
|
+
component: s,
|
|
173
|
+
alerts: void 0,
|
|
177
174
|
employeeId: void 0,
|
|
178
175
|
firstName: void 0,
|
|
179
176
|
lastName: void 0,
|
|
@@ -182,12 +179,13 @@ const s = L(), B = (e = !1) => ({
|
|
|
182
179
|
namespace: "Payroll.PayrollConfiguration"
|
|
183
180
|
}
|
|
184
181
|
}))
|
|
185
|
-
),
|
|
182
|
+
), w = t(
|
|
186
183
|
i.RUN_PAYROLL_EMPLOYEE_CANCELLED,
|
|
187
184
|
"configuration",
|
|
188
|
-
|
|
185
|
+
r((e) => ({
|
|
189
186
|
...p(e, { currentBreadcrumbId: "configuration" }),
|
|
190
|
-
component:
|
|
187
|
+
component: s,
|
|
188
|
+
alerts: void 0,
|
|
191
189
|
employeeId: void 0,
|
|
192
190
|
firstName: void 0,
|
|
193
191
|
lastName: void 0,
|
|
@@ -196,34 +194,37 @@ const s = L(), B = (e = !1) => ({
|
|
|
196
194
|
namespace: "Payroll.PayrollConfiguration"
|
|
197
195
|
}
|
|
198
196
|
}))
|
|
199
|
-
),
|
|
200
|
-
configuration:
|
|
201
|
-
|
|
202
|
-
|
|
197
|
+
), B = {
|
|
198
|
+
configuration: d(
|
|
199
|
+
n("configuration"),
|
|
200
|
+
g,
|
|
201
|
+
L,
|
|
203
202
|
D,
|
|
204
|
-
E
|
|
205
|
-
C
|
|
203
|
+
E
|
|
206
204
|
),
|
|
207
|
-
overview:
|
|
208
|
-
|
|
209
|
-
R,
|
|
205
|
+
overview: d(
|
|
206
|
+
n("configuration", y),
|
|
210
207
|
N,
|
|
211
|
-
|
|
208
|
+
C,
|
|
209
|
+
R
|
|
210
|
+
),
|
|
211
|
+
editEmployee: d(
|
|
212
|
+
n("configuration"),
|
|
213
|
+
_,
|
|
214
|
+
w
|
|
212
215
|
),
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
O
|
|
216
|
+
receipts: d(
|
|
217
|
+
n("configuration"),
|
|
218
|
+
n("overview")
|
|
217
219
|
),
|
|
218
|
-
|
|
219
|
-
blockers: n(s("configuration"))
|
|
220
|
+
blockers: d(n("configuration"))
|
|
220
221
|
};
|
|
221
222
|
export {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
223
|
+
L as alreadyProcessedTransition,
|
|
224
|
+
E as blockersViewAllTransition,
|
|
225
|
+
g as calculatedTransition,
|
|
226
|
+
D as employeeEditTransition,
|
|
227
|
+
I as getPayrollExecutionBreadcrumbsNodes,
|
|
228
|
+
B as payrollExecutionMachine
|
|
228
229
|
};
|
|
229
230
|
//# sourceMappingURL=payrollExecutionMachine.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payrollExecutionMachine.js","sources":["../../../../src/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.ts"],"sourcesContent":["import { transition, reduce, state, guard } from 'robot3'\nimport type { PayrollPayPeriodType } from '@gusto/embedded-api/models/components/payrollpayperiodtype'\nimport type { PayrollFlowAlert } from '../PayrollFlow/PayrollFlowComponents'\nimport {\n PayrollConfigurationContextual,\n PayrollOverviewContextual,\n PayrollEditEmployeeContextual,\n PayrollReceiptsContextual,\n PayrollBlockerContextual,\n type PayrollFlowContextInterface,\n} from '../PayrollFlow/PayrollFlowComponents'\nimport { componentEvents } from '@/shared/constants'\nimport type { MachineEventType, MachineTransition } from '@/types/Helpers'\nimport {\n hideBreadcrumb,\n patchBreadcrumbsHeader,\n updateBreadcrumbs,\n} from '@/helpers/breadcrumbHelpers'\nimport type {\n BreadcrumbNode,\n BreadcrumbNodes,\n} from '@/components/Common/FlowBreadcrumbs/FlowBreadcrumbsTypes'\nimport { createBreadcrumbNavigateTransition } from '@/components/Common/FlowBreadcrumbs/breadcrumbTransitionHelpers'\n\ntype PayrollEventPayloads = {\n [componentEvents.RUN_PAYROLL_EMPLOYEE_EDIT]: {\n payrollId: string\n employeeId: string\n firstName: string\n lastName: string\n }\n [componentEvents.RUN_PAYROLL_CALCULATED]: {\n payrollUuid: string\n alert?: PayrollFlowAlert\n payPeriod?: PayrollPayPeriodType\n }\n [componentEvents.RUN_PAYROLL_ALREADY_PROCESSED]: {\n payrollId: string\n alert?: PayrollFlowAlert\n payPeriod?: PayrollPayPeriodType\n }\n [componentEvents.BREADCRUMB_NAVIGATE]: {\n key: string\n onNavigate: (ctx: PayrollFlowContextInterface) => PayrollFlowContextInterface\n }\n [componentEvents.RUN_PAYROLL_BLOCKERS_VIEW_ALL]: undefined\n [componentEvents.RUN_PAYROLL_EDIT]: undefined\n}\n\nconst breadcrumbNavigateTransition =\n createBreadcrumbNavigateTransition<PayrollFlowContextInterface>()\n\ntype BreadcrumbNodeKeys = 'configuration' | 'overview' | 'editEmployee' | 'receipts' | 'blockers'\n\n/** @internal */\nexport const getPayrollExecutionBreadcrumbsNodes = (\n isDismissal: boolean = false,\n): BreadcrumbNodes => {\n const configLabel = isDismissal ? 'breadcrumbLabelDismissal' : 'breadcrumbLabel'\n\n return {\n configuration: {\n parent: null,\n item: {\n id: 'configuration',\n label: configLabel,\n namespace: 'Payroll.PayrollConfiguration',\n onNavigate: ((ctx: PayrollFlowContextInterface) => ({\n ...updateBreadcrumbs('configuration', ctx, {\n startDate: ctx.payPeriod?.startDate ?? '',\n endDate: ctx.payPeriod?.endDate ?? '',\n }),\n component: PayrollConfigurationContextual,\n alerts: undefined,\n })) as (context: unknown) => unknown,\n },\n },\n overview: {\n parent: 'configuration',\n item: {\n id: 'overview',\n label: 'breadcrumbLabel',\n namespace: 'Payroll.PayrollOverview',\n onNavigate: ((ctx: PayrollFlowContextInterface) => ({\n ...updateBreadcrumbs('overview', ctx, {\n startDate: ctx.payPeriod?.startDate ?? '',\n endDate: ctx.payPeriod?.endDate ?? '',\n }),\n component: PayrollOverviewContextual,\n alerts: undefined,\n })) as (context: unknown) => unknown,\n },\n },\n editEmployee: {\n parent: 'configuration',\n item: {\n id: 'editEmployee',\n label: 'breadcrumbLabel',\n namespace: 'Payroll.PayrollEditEmployee',\n },\n },\n receipts: {\n parent: 'overview',\n item: {\n id: 'receipts',\n label: 'breadcrumbLabel',\n namespace: 'Payroll.PayrollReceipts',\n },\n },\n blockers: {\n parent: 'configuration',\n item: {\n id: 'blockers',\n label: 'breadcrumbLabel',\n namespace: 'Payroll.PayrollBlocker',\n },\n },\n } satisfies Record<BreadcrumbNodeKeys, BreadcrumbNode>\n}\n\n/** @internal */\nexport const calculatedTransition = transition(\n componentEvents.RUN_PAYROLL_CALCULATED,\n 'overview',\n reduce(\n (\n ctx: PayrollFlowContextInterface,\n ev: MachineEventType<PayrollEventPayloads, typeof componentEvents.RUN_PAYROLL_CALCULATED>,\n ): PayrollFlowContextInterface => {\n return {\n ...updateBreadcrumbs('overview', ctx, {\n startDate: ev.payload.payPeriod?.startDate ?? '',\n endDate: ev.payload.payPeriod?.endDate ?? '',\n }),\n component: PayrollOverviewContextual,\n payPeriod: ev.payload.payPeriod ?? ctx.payPeriod,\n alerts: ev.payload.alert\n ? [\n ...(ctx.alerts ?? []).filter(a => a.alertKey !== 'progressSaved'),\n { ...ev.payload.alert, alertKey: 'progressSaved' as const },\n ]\n : ctx.alerts,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: 'Payroll.PayrollOverview',\n },\n }\n },\n ),\n)\n\n/** @internal */\nexport const alreadyProcessedTransition = transition(\n componentEvents.RUN_PAYROLL_ALREADY_PROCESSED,\n 'overview',\n reduce(\n (\n ctx: PayrollFlowContextInterface,\n ev: MachineEventType<\n PayrollEventPayloads,\n typeof componentEvents.RUN_PAYROLL_ALREADY_PROCESSED\n >,\n ): PayrollFlowContextInterface => {\n const payPeriod = ev.payload.payPeriod ?? ctx.payPeriod\n return {\n ...updateBreadcrumbs('overview', ctx, {\n startDate: payPeriod?.startDate ?? '',\n endDate: payPeriod?.endDate ?? '',\n }),\n component: PayrollOverviewContextual,\n payPeriod,\n alerts: ev.payload.alert\n ? [\n ...(ctx.alerts ?? []).filter(a => a.alertKey !== 'alreadyProcessed'),\n { ...ev.payload.alert, alertKey: 'alreadyProcessed' as const },\n ]\n : ctx.alerts,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: 'Payroll.PayrollOverview',\n },\n }\n },\n ),\n)\n\n/** @internal */\nexport const employeeEditTransition = transition(\n componentEvents.RUN_PAYROLL_EMPLOYEE_EDIT,\n 'editEmployee',\n reduce(\n (\n ctx: PayrollFlowContextInterface,\n ev: MachineEventType<PayrollEventPayloads, typeof componentEvents.RUN_PAYROLL_EMPLOYEE_EDIT>,\n ): PayrollFlowContextInterface => {\n return {\n ...updateBreadcrumbs('editEmployee', ctx, {\n firstName: ev.payload.firstName,\n lastName: ev.payload.lastName,\n startDate: ctx.payPeriod?.startDate ?? '',\n endDate: ctx.payPeriod?.endDate ?? '',\n }),\n component: PayrollEditEmployeeContextual,\n employeeId: ev.payload.employeeId,\n firstName: ev.payload.firstName,\n lastName: ev.payload.lastName,\n ctaConfig: null,\n }\n },\n ),\n)\n\n/** @internal */\nexport const blockersViewAllTransition = transition(\n componentEvents.RUN_PAYROLL_BLOCKERS_VIEW_ALL,\n 'blockers',\n reduce((ctx: PayrollFlowContextInterface): PayrollFlowContextInterface => {\n return {\n ...updateBreadcrumbs('blockers', ctx),\n component: PayrollBlockerContextual,\n }\n }),\n)\n\nconst notSubmitted = (ctx: PayrollFlowContextInterface) => !ctx.hasPayrollSubmissionStarted\n\nconst editPayrollTransition = transition(\n componentEvents.RUN_PAYROLL_EDIT,\n 'configuration',\n guard(notSubmitted),\n reduce((ctx: PayrollFlowContextInterface): PayrollFlowContextInterface => {\n return {\n ...updateBreadcrumbs('configuration', ctx, {\n startDate: ctx.payPeriod?.startDate ?? '',\n endDate: ctx.payPeriod?.endDate ?? '',\n }),\n component: PayrollConfigurationContextual,\n alerts: undefined,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: 'Payroll.PayrollConfiguration',\n },\n }\n }),\n)\n\nconst payrollSubmittingTransition = transition(\n componentEvents.RUN_PAYROLL_SUBMITTING,\n 'overview',\n reduce((ctx: PayrollFlowContextInterface): PayrollFlowContextInterface => ({\n ...hideBreadcrumb('configuration', ctx),\n hasPayrollSubmissionStarted: true,\n })),\n)\n\nconst receiptGetTransition = transition(\n componentEvents.RUN_PAYROLL_RECEIPT_GET,\n 'receipts',\n reduce((ctx: PayrollFlowContextInterface): PayrollFlowContextInterface => ({\n ...updateBreadcrumbs('receipts', ctx, {\n startDate: ctx.payPeriod?.startDate ?? '',\n endDate: ctx.payPeriod?.endDate ?? '',\n }),\n component: PayrollReceiptsContextual,\n alerts: undefined,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: 'Payroll.PayrollReceipts',\n },\n })),\n)\n\nconst employeeSavedTransition = transition(\n componentEvents.RUN_PAYROLL_EMPLOYEE_SAVED,\n 'configuration',\n reduce((ctx: PayrollFlowContextInterface): PayrollFlowContextInterface => ({\n ...patchBreadcrumbsHeader(ctx, { currentBreadcrumbId: 'configuration' }),\n component: PayrollConfigurationContextual,\n employeeId: undefined,\n firstName: undefined,\n lastName: undefined,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: 'Payroll.PayrollConfiguration',\n },\n })),\n)\n\nconst employeeCancelledTransition = transition(\n componentEvents.RUN_PAYROLL_EMPLOYEE_CANCELLED,\n 'configuration',\n reduce((ctx: PayrollFlowContextInterface): PayrollFlowContextInterface => ({\n ...patchBreadcrumbsHeader(ctx, { currentBreadcrumbId: 'configuration' }),\n component: PayrollConfigurationContextual,\n employeeId: undefined,\n firstName: undefined,\n lastName: undefined,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: 'Payroll.PayrollConfiguration',\n },\n })),\n)\n\n/** @internal */\nexport const payrollExecutionMachine = {\n configuration: state<MachineTransition>(\n breadcrumbNavigateTransition('configuration'),\n calculatedTransition,\n alreadyProcessedTransition,\n employeeEditTransition,\n blockersViewAllTransition,\n ),\n overview: state<MachineTransition>(\n breadcrumbNavigateTransition('configuration', notSubmitted),\n payrollSubmittingTransition,\n editPayrollTransition,\n receiptGetTransition,\n ),\n editEmployee: state<MachineTransition>(\n breadcrumbNavigateTransition('configuration'),\n employeeSavedTransition,\n employeeCancelledTransition,\n ),\n receipts: state<MachineTransition>(breadcrumbNavigateTransition('configuration')),\n blockers: state<MachineTransition>(breadcrumbNavigateTransition('configuration')),\n}\n"],"names":["breadcrumbNavigateTransition","createBreadcrumbNavigateTransition","getPayrollExecutionBreadcrumbsNodes","isDismissal","ctx","updateBreadcrumbs","PayrollConfigurationContextual","PayrollOverviewContextual","calculatedTransition","transition","componentEvents","reduce","ev","a","alreadyProcessedTransition","payPeriod","employeeEditTransition","PayrollEditEmployeeContextual","blockersViewAllTransition","PayrollBlockerContextual","notSubmitted","editPayrollTransition","guard","payrollSubmittingTransition","hideBreadcrumb","receiptGetTransition","PayrollReceiptsContextual","employeeSavedTransition","patchBreadcrumbsHeader","employeeCancelledTransition","payrollExecutionMachine","state"],"mappings":";;;;;AAiDA,MAAMA,IACJC,EAAA,GAKWC,IAAsC,CACjDC,IAAuB,QAIhB;AAAA,EACL,eAAe;AAAA,IACb,QAAQ;AAAA,IACR,MAAM;AAAA,MACJ,IAAI;AAAA,MACJ,OAPcA,IAAc,6BAA6B;AAA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ACJ,GAEMC,IAA0BlB;AAAA,EAC9BC,EAAgB;AAAA,EAChB;AAAA,EACAC,EAAO,CAACP,OAAmE;AAAA,IACzE,GAAGwB,EAAuBxB,GAAK,EAAE,qBAAqB,iBAAiB;AAAA,IACvE,WAAWE;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,UAAU;AAAA,IACV,WAAW;AAAA,MACT,UAAU;AAAA,MACV,WAAW;AAAA,IAAA;AAAA,EACb,EACA;AACJ,GAEMuB,IAA8BpB;AAAA,EAClCC,EAAgB;AAAA,EAChB;AAAA,EACAC,EAAO,CAACP,OAAmE;AAAA,IACzE,GAAGwB,EAAuBxB,GAAK,EAAE,qBAAqB,iBAAiB;AAAA,IACvE,WAAWE;AAAA,IACX,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,UAAU;AAAA,IACV,WAAW;AAAA,MACT,UAAU;AAAA,MACV,WAAW;AAAA,IAAA;AAAA,EACb,EACA;AACJ,GAGawB,IAA0B;AAAA,EACrC,eAAeC;AAAA,IACb/B,EAA6B,eAAe;AAAA,IAC5CQ;AAAA,IACAM;AAAA,IACAE;AAAA,IACAE;AAAA,EAAA;AAAA,EAEF,UAAUa;AAAA,IACR/B,EAA6B,iBAAiBoB,CAAY;AAAA,IAC1DG;AAAA,IACAF;AAAA,IACAI;AAAA,EAAA;AAAA,EAEF,cAAcM;AAAA,IACZ/B,EAA6B,eAAe;AAAA,IAC5C2B;AAAA,IACAE;AAAA,EAAA;AAAA,EAEF,UAAUE,EAAyB/B,EAA6B,eAAe,CAAC;AAAA,EAChF,UAAU+B,EAAyB/B,EAA6B,eAAe,CAAC;AAClF;"}
|
|
1
|
+
{"version":3,"file":"payrollExecutionMachine.js","sources":["../../../../src/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.ts"],"sourcesContent":["import { transition, reduce, state, guard } from 'robot3'\nimport type { PayrollPayPeriodType } from '@gusto/embedded-api/models/components/payrollpayperiodtype'\nimport type { PayrollFlowAlert } from '../PayrollFlow/PayrollFlowComponents'\nimport {\n PayrollConfigurationContextual,\n PayrollOverviewContextual,\n PayrollEditEmployeeContextual,\n PayrollReceiptsContextual,\n PayrollBlockerContextual,\n type PayrollFlowContextInterface,\n} from '../PayrollFlow/PayrollFlowComponents'\nimport { componentEvents } from '@/shared/constants'\nimport type { MachineEventType, MachineTransition } from '@/types/Helpers'\nimport {\n hideBreadcrumb,\n patchBreadcrumbsHeader,\n updateBreadcrumbs,\n} from '@/helpers/breadcrumbHelpers'\nimport type {\n BreadcrumbNode,\n BreadcrumbNodes,\n} from '@/components/Common/FlowBreadcrumbs/FlowBreadcrumbsTypes'\nimport { createBreadcrumbNavigateTransition } from '@/components/Common/FlowBreadcrumbs/breadcrumbTransitionHelpers'\n\ntype PayrollEventPayloads = {\n [componentEvents.RUN_PAYROLL_EMPLOYEE_EDIT]: {\n payrollId: string\n employeeId: string\n firstName: string\n lastName: string\n }\n [componentEvents.RUN_PAYROLL_CALCULATED]: {\n payrollUuid: string\n alert?: PayrollFlowAlert\n payPeriod?: PayrollPayPeriodType\n }\n [componentEvents.RUN_PAYROLL_ALREADY_PROCESSED]: {\n payrollId: string\n alert?: PayrollFlowAlert\n payPeriod?: PayrollPayPeriodType\n }\n [componentEvents.BREADCRUMB_NAVIGATE]: {\n key: string\n onNavigate: (ctx: PayrollFlowContextInterface) => PayrollFlowContextInterface\n }\n [componentEvents.RUN_PAYROLL_BLOCKERS_VIEW_ALL]: undefined\n [componentEvents.RUN_PAYROLL_EDIT]: undefined\n}\n\nconst breadcrumbNavigateTransition =\n createBreadcrumbNavigateTransition<PayrollFlowContextInterface>()\n\ntype BreadcrumbNodeKeys = 'configuration' | 'overview' | 'editEmployee' | 'receipts' | 'blockers'\n\n/** @internal */\nexport const getPayrollExecutionBreadcrumbsNodes = (\n isDismissal: boolean = false,\n): BreadcrumbNodes => {\n const configLabel = isDismissal ? 'breadcrumbLabelDismissal' : 'breadcrumbLabel'\n\n return {\n configuration: {\n parent: null,\n item: {\n id: 'configuration',\n label: configLabel,\n namespace: 'Payroll.PayrollConfiguration',\n onNavigate: ((ctx: PayrollFlowContextInterface) => ({\n ...updateBreadcrumbs('configuration', ctx, {\n startDate: ctx.payPeriod?.startDate ?? '',\n endDate: ctx.payPeriod?.endDate ?? '',\n }),\n component: PayrollConfigurationContextual,\n alerts: undefined,\n })) as (context: unknown) => unknown,\n },\n },\n overview: {\n parent: 'configuration',\n item: {\n id: 'overview',\n label: 'breadcrumbLabel',\n namespace: 'Payroll.PayrollOverview',\n onNavigate: ((ctx: PayrollFlowContextInterface) => ({\n ...updateBreadcrumbs('overview', ctx, {\n startDate: ctx.payPeriod?.startDate ?? '',\n endDate: ctx.payPeriod?.endDate ?? '',\n }),\n component: PayrollOverviewContextual,\n alerts: undefined,\n })) as (context: unknown) => unknown,\n },\n },\n editEmployee: {\n parent: 'configuration',\n item: {\n id: 'editEmployee',\n label: 'breadcrumbLabel',\n namespace: 'Payroll.PayrollEditEmployee',\n },\n },\n receipts: {\n parent: 'overview',\n item: {\n id: 'receipts',\n label: 'breadcrumbLabel',\n namespace: 'Payroll.PayrollReceipts',\n },\n },\n blockers: {\n parent: 'configuration',\n item: {\n id: 'blockers',\n label: 'breadcrumbLabel',\n namespace: 'Payroll.PayrollBlocker',\n },\n },\n } satisfies Record<BreadcrumbNodeKeys, BreadcrumbNode>\n}\n\n/** @internal */\nexport const calculatedTransition = transition(\n componentEvents.RUN_PAYROLL_CALCULATED,\n 'overview',\n reduce(\n (\n ctx: PayrollFlowContextInterface,\n ev: MachineEventType<PayrollEventPayloads, typeof componentEvents.RUN_PAYROLL_CALCULATED>,\n ): PayrollFlowContextInterface => {\n return {\n ...updateBreadcrumbs('overview', ctx, {\n startDate: ev.payload.payPeriod?.startDate ?? '',\n endDate: ev.payload.payPeriod?.endDate ?? '',\n }),\n component: PayrollOverviewContextual,\n payPeriod: ev.payload.payPeriod ?? ctx.payPeriod,\n alerts: ev.payload.alert\n ? [{ ...ev.payload.alert, alertKey: 'progressSaved' as const }]\n : undefined,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: 'Payroll.PayrollOverview',\n },\n }\n },\n ),\n)\n\n/** @internal */\nexport const alreadyProcessedTransition = transition(\n componentEvents.RUN_PAYROLL_ALREADY_PROCESSED,\n 'overview',\n reduce(\n (\n ctx: PayrollFlowContextInterface,\n ev: MachineEventType<\n PayrollEventPayloads,\n typeof componentEvents.RUN_PAYROLL_ALREADY_PROCESSED\n >,\n ): PayrollFlowContextInterface => {\n const payPeriod = ev.payload.payPeriod ?? ctx.payPeriod\n return {\n ...updateBreadcrumbs('overview', ctx, {\n startDate: payPeriod?.startDate ?? '',\n endDate: payPeriod?.endDate ?? '',\n }),\n component: PayrollOverviewContextual,\n payPeriod,\n alerts: ev.payload.alert\n ? [{ ...ev.payload.alert, alertKey: 'alreadyProcessed' as const }]\n : undefined,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: 'Payroll.PayrollOverview',\n },\n }\n },\n ),\n)\n\n/** @internal */\nexport const employeeEditTransition = transition(\n componentEvents.RUN_PAYROLL_EMPLOYEE_EDIT,\n 'editEmployee',\n reduce(\n (\n ctx: PayrollFlowContextInterface,\n ev: MachineEventType<PayrollEventPayloads, typeof componentEvents.RUN_PAYROLL_EMPLOYEE_EDIT>,\n ): PayrollFlowContextInterface => {\n return {\n ...updateBreadcrumbs('editEmployee', ctx, {\n firstName: ev.payload.firstName,\n lastName: ev.payload.lastName,\n startDate: ctx.payPeriod?.startDate ?? '',\n endDate: ctx.payPeriod?.endDate ?? '',\n }),\n component: PayrollEditEmployeeContextual,\n employeeId: ev.payload.employeeId,\n firstName: ev.payload.firstName,\n lastName: ev.payload.lastName,\n alerts: undefined,\n ctaConfig: null,\n }\n },\n ),\n)\n\n/** @internal */\nexport const blockersViewAllTransition = transition(\n componentEvents.RUN_PAYROLL_BLOCKERS_VIEW_ALL,\n 'blockers',\n reduce((ctx: PayrollFlowContextInterface): PayrollFlowContextInterface => {\n return {\n ...updateBreadcrumbs('blockers', ctx),\n component: PayrollBlockerContextual,\n alerts: undefined,\n }\n }),\n)\n\nconst notSubmitted = (ctx: PayrollFlowContextInterface) => !ctx.hasPayrollSubmissionStarted\n\nconst editPayrollTransition = transition(\n componentEvents.RUN_PAYROLL_EDIT,\n 'configuration',\n guard(notSubmitted),\n reduce((ctx: PayrollFlowContextInterface): PayrollFlowContextInterface => {\n return {\n ...updateBreadcrumbs('configuration', ctx, {\n startDate: ctx.payPeriod?.startDate ?? '',\n endDate: ctx.payPeriod?.endDate ?? '',\n }),\n component: PayrollConfigurationContextual,\n alerts: undefined,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: 'Payroll.PayrollConfiguration',\n },\n }\n }),\n)\n\nconst payrollSubmittingTransition = transition(\n componentEvents.RUN_PAYROLL_SUBMITTING,\n 'overview',\n reduce((ctx: PayrollFlowContextInterface): PayrollFlowContextInterface => ({\n ...hideBreadcrumb('configuration', ctx),\n hasPayrollSubmissionStarted: true,\n })),\n)\n\nconst receiptGetTransition = transition(\n componentEvents.RUN_PAYROLL_RECEIPT_GET,\n 'receipts',\n reduce((ctx: PayrollFlowContextInterface): PayrollFlowContextInterface => ({\n ...updateBreadcrumbs('receipts', ctx, {\n startDate: ctx.payPeriod?.startDate ?? '',\n endDate: ctx.payPeriod?.endDate ?? '',\n }),\n component: PayrollReceiptsContextual,\n alerts: undefined,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: 'Payroll.PayrollReceipts',\n },\n })),\n)\n\nconst employeeSavedTransition = transition(\n componentEvents.RUN_PAYROLL_EMPLOYEE_SAVED,\n 'configuration',\n reduce((ctx: PayrollFlowContextInterface): PayrollFlowContextInterface => ({\n ...patchBreadcrumbsHeader(ctx, { currentBreadcrumbId: 'configuration' }),\n component: PayrollConfigurationContextual,\n alerts: undefined,\n employeeId: undefined,\n firstName: undefined,\n lastName: undefined,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: 'Payroll.PayrollConfiguration',\n },\n })),\n)\n\nconst employeeCancelledTransition = transition(\n componentEvents.RUN_PAYROLL_EMPLOYEE_CANCELLED,\n 'configuration',\n reduce((ctx: PayrollFlowContextInterface): PayrollFlowContextInterface => ({\n ...patchBreadcrumbsHeader(ctx, { currentBreadcrumbId: 'configuration' }),\n component: PayrollConfigurationContextual,\n alerts: undefined,\n employeeId: undefined,\n firstName: undefined,\n lastName: undefined,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: 'Payroll.PayrollConfiguration',\n },\n })),\n)\n\n/** @internal */\nexport const payrollExecutionMachine = {\n configuration: state<MachineTransition>(\n breadcrumbNavigateTransition('configuration'),\n calculatedTransition,\n alreadyProcessedTransition,\n employeeEditTransition,\n blockersViewAllTransition,\n ),\n overview: state<MachineTransition>(\n breadcrumbNavigateTransition('configuration', notSubmitted),\n payrollSubmittingTransition,\n editPayrollTransition,\n receiptGetTransition,\n ),\n editEmployee: state<MachineTransition>(\n breadcrumbNavigateTransition('configuration'),\n employeeSavedTransition,\n employeeCancelledTransition,\n ),\n receipts: state<MachineTransition>(\n breadcrumbNavigateTransition('configuration'),\n breadcrumbNavigateTransition('overview'),\n ),\n blockers: state<MachineTransition>(breadcrumbNavigateTransition('configuration')),\n}\n"],"names":["breadcrumbNavigateTransition","createBreadcrumbNavigateTransition","getPayrollExecutionBreadcrumbsNodes","isDismissal","ctx","updateBreadcrumbs","PayrollConfigurationContextual","PayrollOverviewContextual","calculatedTransition","transition","componentEvents","reduce","ev","alreadyProcessedTransition","payPeriod","employeeEditTransition","PayrollEditEmployeeContextual","blockersViewAllTransition","PayrollBlockerContextual","notSubmitted","editPayrollTransition","guard","payrollSubmittingTransition","hideBreadcrumb","receiptGetTransition","PayrollReceiptsContextual","employeeSavedTransition","patchBreadcrumbsHeader","employeeCancelledTransition","payrollExecutionMachine","state"],"mappings":";;;;;AAiDA,MAAMA,IACJC,EAAA,GAKWC,IAAsC,CACjDC,IAAuB,QAIhB;AAAA,EACL,eAAe;AAAA,IACb,Q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P,OAAmE;AAAA,IACzE,GAAGuB,EAAuBvB,GAAK,EAAE,qBAAqB,iBAAiB;AAAA,IACvE,WAAWE;AAAA,IACX,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,UAAU;AAAA,IACV,WAAW;AAAA,MACT,UAAU;AAAA,MACV,WAAW;AAAA,IAAA;AAAA,EACb,EACA;AACJ,GAEMsB,IAA8BnB;AAAA,EAClCC,EAAgB;AAAA,EAChB;AAAA,EACAC,EAAO,CAACP,OAAmE;AAAA,IACzE,GAAGuB,EAAuBvB,GAAK,EAAE,qBAAqB,iBAAiB;AAAA,IACvE,WAAWE;AAAA,IACX,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,UAAU;AAAA,IACV,WAAW;AAAA,MACT,UAAU;AAAA,MACV,WAAW;AAAA,IAAA;AAAA,EACb,EACA;AACJ,GAGauB,IAA0B;AAAA,EACrC,eAAeC;AAAA,IACb9B,EAA6B,eAAe;AAAA,IAC5CQ;AAAA,IACAK;AAAA,IACAE;AAAA,IACAE;AAAA,EAAA;AAAA,EAEF,UAAUa;AAAA,IACR9B,EAA6B,iBAAiBmB,CAAY;AAAA,IAC1DG;AAAA,IACAF;AAAA,IACAI;AAAA,EAAA;AAAA,EAEF,cAAcM;AAAA,IACZ9B,EAA6B,eAAe;AAAA,IAC5C0B;AAAA,IACAE;AAAA,EAAA;AAAA,EAEF,UAAUE;AAAA,IACR9B,EAA6B,eAAe;AAAA,IAC5CA,EAA6B,UAAU;AAAA,EAAA;AAAA,EAEzC,UAAU8B,EAAyB9B,EAA6B,eAAe,CAAC;AAClF;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { state as
|
|
2
|
-
import { PayrollReceiptsContextual as
|
|
1
|
+
import { state as r, transition as t, reduce as o, guard as v } from "robot3";
|
|
2
|
+
import { PayrollReceiptsContextual as L, PayrollBlockerContextual as R, PayrollLandingContextual as b, PayrollOverviewContextual as C } from "./PayrollFlowComponents.js";
|
|
3
3
|
import { PayrollExecutionFlowContextual as g } from "./PayrollExecutionFlowContextual.js";
|
|
4
4
|
import { TransitionFlowContextual as _ } from "./TransitionFlowContextual.js";
|
|
5
5
|
import { OffCycleFlowContextual as E } from "./OffCycleFlowContextual.js";
|
|
@@ -16,6 +16,7 @@ const I = {
|
|
|
16
16
|
onNavigate: ((e) => ({
|
|
17
17
|
...c(e, { currentBreadcrumbId: void 0 }),
|
|
18
18
|
component: b,
|
|
19
|
+
alerts: void 0,
|
|
19
20
|
payrollUuid: void 0,
|
|
20
21
|
executionInitialState: void 0
|
|
21
22
|
}))
|
|
@@ -50,6 +51,7 @@ function y(e) {
|
|
|
50
51
|
return {
|
|
51
52
|
...c(e, { currentBreadcrumbId: void 0 }),
|
|
52
53
|
component: b,
|
|
54
|
+
alerts: void 0,
|
|
53
55
|
payrollUuid: void 0,
|
|
54
56
|
payPeriod: void 0,
|
|
55
57
|
executionInitialState: void 0
|
|
@@ -59,6 +61,7 @@ function P(e, a, i) {
|
|
|
59
61
|
return {
|
|
60
62
|
...e,
|
|
61
63
|
component: g,
|
|
64
|
+
alerts: void 0,
|
|
62
65
|
payrollUuid: a.payload.payrollUuid,
|
|
63
66
|
showPayrollCancelledAlert: !1,
|
|
64
67
|
executionInitialState: i
|
|
@@ -67,11 +70,11 @@ function P(e, a, i) {
|
|
|
67
70
|
const u = t(
|
|
68
71
|
l.BREADCRUMB_NAVIGATE,
|
|
69
72
|
"landing",
|
|
70
|
-
|
|
73
|
+
v(
|
|
71
74
|
(e, a) => a.payload.key === "landing"
|
|
72
75
|
),
|
|
73
76
|
o(y)
|
|
74
|
-
),
|
|
77
|
+
), n = t(
|
|
75
78
|
l.PAYROLL_EXIT_FLOW,
|
|
76
79
|
"landing",
|
|
77
80
|
o(y)
|
|
@@ -94,6 +97,7 @@ const u = t(
|
|
|
94
97
|
endDate: i?.endDate ?? ""
|
|
95
98
|
}),
|
|
96
99
|
component: C,
|
|
100
|
+
alerts: void 0,
|
|
97
101
|
payrollUuid: a.payload.payrollUuid ?? e.payrollUuid,
|
|
98
102
|
payPeriod: i,
|
|
99
103
|
executionInitialState: void 0,
|
|
@@ -105,7 +109,7 @@ const u = t(
|
|
|
105
109
|
}
|
|
106
110
|
)
|
|
107
111
|
), B = {
|
|
108
|
-
landing:
|
|
112
|
+
landing: r(
|
|
109
113
|
t(
|
|
110
114
|
l.RUN_PAYROLL_SELECTED,
|
|
111
115
|
"execution",
|
|
@@ -125,7 +129,8 @@ const u = t(
|
|
|
125
129
|
"blockers",
|
|
126
130
|
o((e) => ({
|
|
127
131
|
...m("blockers", e),
|
|
128
|
-
component:
|
|
132
|
+
component: R,
|
|
133
|
+
alerts: void 0,
|
|
129
134
|
showPayrollCancelledAlert: !1,
|
|
130
135
|
ctaConfig: {
|
|
131
136
|
labelKey: "exitFlowCta",
|
|
@@ -148,6 +153,7 @@ const u = t(
|
|
|
148
153
|
(e, a) => ({
|
|
149
154
|
...c(e, { currentBreadcrumbId: void 0 }),
|
|
150
155
|
component: _,
|
|
156
|
+
alerts: void 0,
|
|
151
157
|
transitionStartDate: a.payload.startDate,
|
|
152
158
|
transitionEndDate: a.payload.endDate,
|
|
153
159
|
transitionPayScheduleUuid: a.payload.payScheduleUuid,
|
|
@@ -161,18 +167,19 @@ const u = t(
|
|
|
161
167
|
o((e) => ({
|
|
162
168
|
...c(e, { currentBreadcrumbId: void 0 }),
|
|
163
169
|
component: E,
|
|
170
|
+
alerts: void 0,
|
|
164
171
|
showPayrollCancelledAlert: !1
|
|
165
172
|
}))
|
|
166
173
|
)
|
|
167
174
|
),
|
|
168
|
-
execution:
|
|
175
|
+
execution: r(
|
|
169
176
|
u,
|
|
170
|
-
|
|
177
|
+
n,
|
|
171
178
|
d,
|
|
172
179
|
p
|
|
173
180
|
),
|
|
174
|
-
blockers:
|
|
175
|
-
submittedOverview:
|
|
181
|
+
blockers: r(s("landing"), n),
|
|
182
|
+
submittedOverview: r(
|
|
176
183
|
s("landing"),
|
|
177
184
|
t(
|
|
178
185
|
l.RUN_PAYROLL_RECEIPT_GET,
|
|
@@ -182,7 +189,7 @@ const u = t(
|
|
|
182
189
|
startDate: e.payPeriod?.startDate ?? "",
|
|
183
190
|
endDate: e.payPeriod?.endDate ?? ""
|
|
184
191
|
}),
|
|
185
|
-
component:
|
|
192
|
+
component: L,
|
|
186
193
|
alerts: void 0,
|
|
187
194
|
ctaConfig: {
|
|
188
195
|
labelKey: "exitFlowCta",
|
|
@@ -191,21 +198,21 @@ const u = t(
|
|
|
191
198
|
}))
|
|
192
199
|
),
|
|
193
200
|
d,
|
|
194
|
-
|
|
201
|
+
n
|
|
195
202
|
),
|
|
196
|
-
submittedReceipts:
|
|
203
|
+
submittedReceipts: r(
|
|
197
204
|
s("landing"),
|
|
198
|
-
|
|
205
|
+
n
|
|
199
206
|
),
|
|
200
|
-
transition:
|
|
207
|
+
transition: r(
|
|
201
208
|
u,
|
|
202
|
-
|
|
209
|
+
n,
|
|
203
210
|
d,
|
|
204
211
|
p
|
|
205
212
|
),
|
|
206
|
-
offCycle:
|
|
213
|
+
offCycle: r(
|
|
207
214
|
u,
|
|
208
|
-
|
|
215
|
+
n,
|
|
209
216
|
d,
|
|
210
217
|
p
|
|
211
218
|
)
|