@gusto/embedded-react-sdk 0.37.0-rc.2 → 0.37.0-rc.3
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/README.md +3 -0
- package/dist/components/Company/AssignSignatory/CreateSignatory/CreateSignatoryForm.js +11 -11
- package/dist/components/Company/PaySchedule/_parts/Edit.js +6 -6
- package/dist/components/Contractor/Profile/ContractorProfileForm.js +15 -15
- package/dist/components/Employee/DocumentSigner/EmploymentEligibility/EmploymentEligibilityPresentation.js +16 -16
- package/dist/components/Employee/Profile/PersonalDetailsInputs.js +1 -1
- package/dist/components/Employee/Terminations/TerminateEmployee/TerminateEmployeePresentation.js +10 -10
- package/dist/components/Payroll/ConfirmWireDetails/ConfirmWireDetailsForm/ConfirmWireDetailsForm.js +10 -10
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.js +44 -46
- package/dist/components/Payroll/Dismissal/DismissalPayPeriodSelection/DismissalPayPeriodSelection.js.map +1 -1
- package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js +25 -23
- package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js.map +1 -1
- package/dist/components/Payroll/OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +105 -106
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +54 -54
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.d.ts +2 -1
- package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.js +29 -27
- package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/index.d.ts +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.d.ts +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js +60 -60
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollExecutionFlowContextual.js +22 -20
- package/dist/components/Payroll/PayrollFlow/PayrollExecutionFlowContextual.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +143 -143
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
- package/dist/components/Payroll/TransitionCreation/TransitionCreationPresentation.js +10 -10
- package/dist/components/Payroll/helpers.d.ts +1 -0
- package/dist/components/Payroll/helpers.js +71 -69
- package/dist/components/Payroll/helpers.js.map +1 -1
- package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/compensationSchema.d.ts +4 -4
- package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/compensationSchema.js +86 -89
- package/dist/components/UNSTABLE_Hooks/hooks/useCompensationForm/compensationSchema.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollConfiguration.json.js +38 -34
- package/dist/i18n/en/Payroll.PayrollConfiguration.json.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollOverview.json.js +62 -58
- package/dist/i18n/en/Payroll.PayrollOverview.json.js.map +1 -1
- package/dist/types/i18next.d.ts +4 -0
- package/package.json +4 -4
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { jsx as r, jsxs as o, Fragment as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import { useTranslation as
|
|
4
|
-
import { useFormatEmployeePayRate as
|
|
5
|
-
import { PayrollCategory as
|
|
1
|
+
import { jsx as r, jsxs as o, Fragment as O } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as V } from "react";
|
|
3
|
+
import { useTranslation as _, Trans as z } from "react-i18next";
|
|
4
|
+
import { useFormatEmployeePayRate as K, getRegularHours as W, getOvertimeHours as X, formatHoursDisplay as H, getTotalPtoHours as q, getAdditionalEarnings as J, getReimbursements as Q, calculateGrossPay as Y } from "../helpers.js";
|
|
5
|
+
import { PayrollCategory as M } from "../payrollTypes.js";
|
|
6
6
|
import { PayrollBlockerAlerts as Z } from "../PayrollBlocker/components/PayrollBlockerAlerts.js";
|
|
7
7
|
import $ from "./PayrollConfigurationPresentation.module.scss.js";
|
|
8
8
|
import { useI18n as ee } from "../../../i18n/I18n.js";
|
|
9
|
-
import { Flex as u, FlexItem as
|
|
9
|
+
import { Flex as u, FlexItem as h } from "../../Common/Flex/Flex.js";
|
|
10
10
|
import { Grid as te } from "../../Common/Grid/Grid.js";
|
|
11
11
|
import { useComponentContext as re } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
12
12
|
import ne from "../../../assets/icons/pencil.svg.js";
|
|
13
13
|
import oe from "../../../assets/icons/x-circle.svg.js";
|
|
14
14
|
import ie from "../../../assets/icons/plus-circle.svg.js";
|
|
15
15
|
import le from "../../../assets/icons/coins-hand.svg.js";
|
|
16
|
-
import { formatNumberAsCurrency as
|
|
16
|
+
import { formatNumberAsCurrency as b, firstLastName as ae } from "../../../helpers/formattedStrings.js";
|
|
17
17
|
import { useDateFormatter as se } from "../../../hooks/useDateFormatter.js";
|
|
18
18
|
import me from "../../../hooks/useContainerBreakpoints/useContainerBreakpoints.js";
|
|
19
19
|
import { PayrollLoading as ce } from "../../Common/PayrollLoading/PayrollLoading.js";
|
|
@@ -23,26 +23,26 @@ const pe = (i, p) => i?.startDate && i.endDate ? p.formatPayPeriod(i.startDate,
|
|
|
23
23
|
employeeCompensations: i,
|
|
24
24
|
employeeDetails: p,
|
|
25
25
|
payPeriod: f,
|
|
26
|
-
paySchedule:
|
|
27
|
-
onEdit:
|
|
28
|
-
onToggleExclude:
|
|
29
|
-
onCalculatePayroll:
|
|
30
|
-
onViewBlockers:
|
|
31
|
-
payrollCategory:
|
|
26
|
+
paySchedule: w,
|
|
27
|
+
onEdit: E,
|
|
28
|
+
onToggleExclude: R,
|
|
29
|
+
onCalculatePayroll: D,
|
|
30
|
+
onViewBlockers: N,
|
|
31
|
+
payrollCategory: g = M.Regular,
|
|
32
32
|
alerts: C,
|
|
33
33
|
payrollAlert: m,
|
|
34
|
-
isPending:
|
|
34
|
+
isPending: y,
|
|
35
35
|
isCalculating: l,
|
|
36
36
|
payrollBlockers: P = [],
|
|
37
|
-
pagination:
|
|
38
|
-
withReimbursements:
|
|
37
|
+
pagination: U,
|
|
38
|
+
withReimbursements: F = !0,
|
|
39
39
|
isCalculateDisabled: x = !1,
|
|
40
|
-
grossUpEnabled:
|
|
41
|
-
onGrossUpSelect:
|
|
40
|
+
grossUpEnabled: B = !1,
|
|
41
|
+
onGrossUpSelect: j
|
|
42
42
|
}) => {
|
|
43
|
-
const { Button: k, Heading: T, Text: d, Badge:
|
|
43
|
+
const { Button: k, Heading: T, Text: d, Badge: G, Alert: I } = re();
|
|
44
44
|
ee("Payroll.PayrollConfiguration");
|
|
45
|
-
const { t } =
|
|
45
|
+
const { t } = _("Payroll.PayrollConfiguration"), S = se(), L = K(), v = V(null), a = me({ ref: v }).includes("small"), c = new Map(p.map((e) => [e.uuid, e])), A = (e) => {
|
|
46
46
|
const n = c.get(e);
|
|
47
47
|
return n ? ae({ first_name: n.firstName, last_name: n.lastName }) : null;
|
|
48
48
|
};
|
|
@@ -55,35 +55,35 @@ const pe = (i, p) => i?.startDate && i.endDate ? p.formatPayPeriod(i.startDate,
|
|
|
55
55
|
alignItems: a ? "center" : "stretch",
|
|
56
56
|
gap: a ? 0 : 16,
|
|
57
57
|
children: [
|
|
58
|
-
/* @__PURE__ */ o(
|
|
58
|
+
/* @__PURE__ */ o(h, { children: [
|
|
59
59
|
/* @__PURE__ */ r(T, { as: "h1", children: t("pageTitle") }),
|
|
60
60
|
f && /* @__PURE__ */ r(d, { variant: "supporting", children: /* @__PURE__ */ r(
|
|
61
|
-
|
|
61
|
+
z,
|
|
62
62
|
{
|
|
63
|
-
i18nKey: "description",
|
|
63
|
+
i18nKey: g === M.Dismissal ? "descriptionDismissal" : "description",
|
|
64
64
|
t,
|
|
65
65
|
components: { dateWrapper: /* @__PURE__ */ r(d, { weight: "bold", as: "span" }) },
|
|
66
66
|
values: {
|
|
67
|
-
...pe(f,
|
|
68
|
-
payrollType:
|
|
67
|
+
...pe(f, S),
|
|
68
|
+
payrollType: g
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
) })
|
|
72
72
|
] }),
|
|
73
|
-
/* @__PURE__ */ r(
|
|
73
|
+
/* @__PURE__ */ r(h, { flexGrow: 0, children: a ? /* @__PURE__ */ r(
|
|
74
74
|
k,
|
|
75
75
|
{
|
|
76
76
|
title: t("calculatePayrollTitle"),
|
|
77
|
-
onClick:
|
|
78
|
-
isDisabled: x ||
|
|
77
|
+
onClick: D,
|
|
78
|
+
isDisabled: x || y || l,
|
|
79
79
|
children: t(l ? "calculatingPayroll" : "calculatePayroll")
|
|
80
80
|
}
|
|
81
81
|
) : /* @__PURE__ */ r(u, { flexDirection: "column", justifyContent: "normal", alignItems: "stretch", gap: 12, children: /* @__PURE__ */ r(
|
|
82
82
|
k,
|
|
83
83
|
{
|
|
84
84
|
title: t("calculatePayrollTitle"),
|
|
85
|
-
onClick:
|
|
86
|
-
isDisabled: x ||
|
|
85
|
+
onClick: D,
|
|
86
|
+
isDisabled: x || y || l,
|
|
87
87
|
children: t(l ? "calculatingPayroll" : "calculatePayroll")
|
|
88
88
|
}
|
|
89
89
|
) }) })
|
|
@@ -91,25 +91,25 @@ const pe = (i, p) => i?.startDate && i.endDate ? p.formatPayPeriod(i.startDate,
|
|
|
91
91
|
}
|
|
92
92
|
),
|
|
93
93
|
(C || m) && /* @__PURE__ */ o(te, { gap: 16, gridTemplateColumns: "1fr", children: [
|
|
94
|
-
m && /* @__PURE__ */ r(
|
|
94
|
+
m && /* @__PURE__ */ r(I, { label: m.label, status: m.variant, children: m.content }),
|
|
95
95
|
C
|
|
96
96
|
] }),
|
|
97
|
-
|
|
97
|
+
y ? /* @__PURE__ */ r(
|
|
98
98
|
ce,
|
|
99
99
|
{
|
|
100
100
|
title: t(l ? "calculatingTitle" : "loadingTitle"),
|
|
101
101
|
description: t(l ? "calculatingDescription" : "loadingDescription")
|
|
102
102
|
}
|
|
103
|
-
) : /* @__PURE__ */ o(
|
|
103
|
+
) : /* @__PURE__ */ o(O, { children: [
|
|
104
104
|
P.length > 0 && /* @__PURE__ */ r(
|
|
105
105
|
Z,
|
|
106
106
|
{
|
|
107
107
|
blockers: P,
|
|
108
|
-
onViewBlockersClick:
|
|
108
|
+
onViewBlockersClick: N
|
|
109
109
|
}
|
|
110
110
|
),
|
|
111
111
|
/* @__PURE__ */ o(u, { flexDirection: "column", gap: 20, children: [
|
|
112
|
-
/* @__PURE__ */ o(
|
|
112
|
+
/* @__PURE__ */ o(h, { children: [
|
|
113
113
|
/* @__PURE__ */ r(T, { as: "h3", children: t("hoursAndEarningsTitle") }),
|
|
114
114
|
/* @__PURE__ */ r(d, { variant: "supporting", children: t("hoursAndEarningsDescription") })
|
|
115
115
|
] }),
|
|
@@ -121,55 +121,55 @@ const pe = (i, p) => i?.startDate && i.endDate ? p.formatPayPeriod(i.startDate,
|
|
|
121
121
|
{
|
|
122
122
|
title: t("tableColumns.employees"),
|
|
123
123
|
render: (e) => {
|
|
124
|
-
const n = c.get(e.employeeUuid || ""), s =
|
|
124
|
+
const n = c.get(e.employeeUuid || ""), s = L(n);
|
|
125
125
|
return /* @__PURE__ */ o(u, { flexDirection: "column", gap: 0, children: [
|
|
126
|
-
|
|
126
|
+
A(e.employeeUuid || ""),
|
|
127
127
|
s && /* @__PURE__ */ r(d, { size: "xs", variant: "supporting", children: s }),
|
|
128
|
-
e.excluded && /* @__PURE__ */ r(
|
|
128
|
+
e.excluded && /* @__PURE__ */ r(G, { status: "warning", children: t("skippedBadge") })
|
|
129
129
|
] });
|
|
130
130
|
}
|
|
131
131
|
},
|
|
132
132
|
{
|
|
133
133
|
title: t("tableColumns.hours"),
|
|
134
134
|
render: (e) => {
|
|
135
|
-
const n =
|
|
135
|
+
const n = W(e), s = X(e);
|
|
136
136
|
return H(n + s);
|
|
137
137
|
}
|
|
138
138
|
},
|
|
139
139
|
{
|
|
140
140
|
title: t("tableColumns.timeOff"),
|
|
141
141
|
render: (e) => {
|
|
142
|
-
const n =
|
|
142
|
+
const n = q(e);
|
|
143
143
|
return H(n);
|
|
144
144
|
}
|
|
145
145
|
},
|
|
146
146
|
{
|
|
147
147
|
title: t("tableColumns.additionalEarnings"),
|
|
148
148
|
render: (e) => {
|
|
149
|
-
const n =
|
|
150
|
-
return
|
|
149
|
+
const n = J(e);
|
|
150
|
+
return b(n);
|
|
151
151
|
}
|
|
152
152
|
},
|
|
153
|
-
...
|
|
153
|
+
...F ? [
|
|
154
154
|
{
|
|
155
155
|
title: t("tableColumns.reimbursements"),
|
|
156
156
|
render: (e) => {
|
|
157
|
-
const n =
|
|
158
|
-
return
|
|
157
|
+
const n = Q(e);
|
|
158
|
+
return b(n);
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
] : [],
|
|
162
162
|
{
|
|
163
163
|
title: t("tableColumns.totalPay"),
|
|
164
164
|
render: (e) => {
|
|
165
|
-
const n = c.get(e.employeeUuid || ""), s = n ?
|
|
165
|
+
const n = c.get(e.employeeUuid || ""), s = n ? Y(
|
|
166
166
|
e,
|
|
167
167
|
n,
|
|
168
168
|
f?.startDate,
|
|
169
|
-
|
|
170
|
-
|
|
169
|
+
w,
|
|
170
|
+
g
|
|
171
171
|
) : 0;
|
|
172
|
-
return
|
|
172
|
+
return b(s);
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
],
|
|
@@ -183,22 +183,22 @@ const pe = (i, p) => i?.startDate && i.endDate ? p.formatPayPeriod(i.startDate,
|
|
|
183
183
|
icon: /* @__PURE__ */ r(ne, { "aria-hidden": !0 }),
|
|
184
184
|
onClick: () => {
|
|
185
185
|
const n = c.get(e.employeeUuid || "");
|
|
186
|
-
n &&
|
|
186
|
+
n && E(n);
|
|
187
187
|
}
|
|
188
188
|
},
|
|
189
189
|
{
|
|
190
190
|
label: t(e.excluded ? "editMenu.unskip" : "editMenu.skip"),
|
|
191
191
|
icon: e.excluded ? /* @__PURE__ */ r(ie, { "aria-hidden": !0 }) : /* @__PURE__ */ r(oe, { "aria-hidden": !0 }),
|
|
192
192
|
onClick: () => {
|
|
193
|
-
c.get(e.employeeUuid || "") &&
|
|
193
|
+
c.get(e.employeeUuid || "") && R(e);
|
|
194
194
|
}
|
|
195
195
|
},
|
|
196
|
-
...
|
|
196
|
+
...B ? [
|
|
197
197
|
{
|
|
198
198
|
label: t("editMenu.setNetEarnings"),
|
|
199
199
|
icon: /* @__PURE__ */ r(le, { "aria-hidden": !0 }),
|
|
200
200
|
onClick: () => {
|
|
201
|
-
e.employeeUuid &&
|
|
201
|
+
e.employeeUuid && j?.(e.employeeUuid);
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
] : []
|
|
@@ -206,7 +206,7 @@ const pe = (i, p) => i?.startDate && i.endDate ? p.formatPayPeriod(i.startDate,
|
|
|
206
206
|
triggerLabel: t("editMenu.edit")
|
|
207
207
|
}
|
|
208
208
|
),
|
|
209
|
-
pagination:
|
|
209
|
+
pagination: U
|
|
210
210
|
}
|
|
211
211
|
)
|
|
212
212
|
] })
|
package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayrollConfigurationPresentation.js","sources":["../../../../src/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useRef } from 'react'\nimport type { EmployeeCompensations } from '@gusto/embedded-api/models/components/payroll'\nimport type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport type { PayrollPayPeriodType } from '@gusto/embedded-api/models/components/payrollpayperiodtype'\nimport type { PayScheduleObject } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport { Trans, useTranslation } from 'react-i18next'\nimport type { PayrollEmployeeCompensationsType } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype'\nimport {\n useFormatEmployeePayRate,\n getRegularHours,\n getOvertimeHours,\n getTotalPtoHours,\n getAdditionalEarnings,\n getReimbursements,\n formatHoursDisplay,\n calculateGrossPay,\n} from '../helpers'\nimport { PayrollCategory } from '../payrollTypes'\nimport type { ApiPayrollBlocker } from '../PayrollBlocker/payrollHelpers'\nimport { PayrollBlockerAlerts } from '../PayrollBlocker/components/PayrollBlockerAlerts'\nimport styles from './PayrollConfigurationPresentation.module.scss'\nimport { useI18n } from '@/i18n'\nimport { DataView, Flex, FlexItem, Grid, PayrollLoading } from '@/components/Common'\nimport type { PaginationControlProps } from '@/components/Common/PaginationControl/PaginationControlTypes'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport XCircle from '@/assets/icons/x-circle.svg?react'\nimport PlusCircle from '@/assets/icons/plus-circle.svg?react'\nimport CoinsHandSvg from '@/assets/icons/coins-hand.svg?react'\nimport { firstLastName, formatNumberAsCurrency } from '@/helpers/formattedStrings'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport useContainerBreakpoints from '@/hooks/useContainerBreakpoints/useContainerBreakpoints'\n\ninterface PayrollConfigurationPresentationProps {\n employeeCompensations: EmployeeCompensations[]\n employeeDetails: Employee[]\n payPeriod?: PayrollPayPeriodType\n paySchedule?: PayScheduleObject\n onCalculatePayroll: () => void\n onEdit: (employee: Employee) => void\n onToggleExclude: (employeeCompensation: PayrollEmployeeCompensationsType) => void\n onViewBlockers: () => void\n payrollCategory?: PayrollCategory\n alerts?: ReactNode\n payrollAlert?: {\n label: string\n content?: ReactNode\n variant: 'info' | 'warning'\n }\n isPending?: boolean\n isCalculating?: boolean\n payrollBlockers?: ApiPayrollBlocker[]\n pagination?: PaginationControlProps\n withReimbursements?: boolean\n isCalculateDisabled?: boolean\n grossUpEnabled?: boolean\n onGrossUpSelect?: (employeeUuid: string) => void\n}\n\nconst getPayrollConfigurationTitle = (\n payPeriod: PayrollPayPeriodType | undefined,\n dateFormatter: ReturnType<typeof useDateFormatter>,\n) => {\n if (payPeriod?.startDate && payPeriod.endDate) {\n return dateFormatter.formatPayPeriod(payPeriod.startDate, payPeriod.endDate)\n }\n return { startDate: '', endDate: '' }\n}\n\nexport const PayrollConfigurationPresentation = ({\n employeeCompensations,\n employeeDetails,\n payPeriod,\n paySchedule,\n onEdit,\n onToggleExclude,\n onCalculatePayroll,\n onViewBlockers,\n payrollCategory = PayrollCategory.Regular,\n alerts,\n payrollAlert,\n isPending,\n isCalculating,\n payrollBlockers = [],\n pagination,\n withReimbursements = true,\n isCalculateDisabled = false,\n grossUpEnabled = false,\n onGrossUpSelect,\n}: PayrollConfigurationPresentationProps) => {\n const { Button, Heading, Text, Badge, Alert } = useComponentContext()\n useI18n('Payroll.PayrollConfiguration')\n const { t } = useTranslation('Payroll.PayrollConfiguration')\n const dateFormatter = useDateFormatter()\n const formatEmployeePayRate = useFormatEmployeePayRate()\n const containerRef = useRef<HTMLDivElement>(null)\n const breakpoints = useContainerBreakpoints({ ref: containerRef })\n const isDesktop = breakpoints.includes('small')\n\n const employeeMap = new Map(employeeDetails.map(employee => [employee.uuid, employee]))\n\n const getEmployeeName = (employeeUuid: string) => {\n const employee = employeeMap.get(employeeUuid)\n return employee\n ? firstLastName({ first_name: employee.firstName, last_name: employee.lastName })\n : null\n }\n\n return (\n <div ref={containerRef} className={styles.container}>\n <Flex flexDirection=\"column\" gap={32}>\n <Flex\n flexDirection={isDesktop ? 'row' : 'column'}\n justifyContent={isDesktop ? 'space-between' : 'normal'}\n alignItems={isDesktop ? 'center' : 'stretch'}\n gap={isDesktop ? 0 : 16}\n >\n <FlexItem>\n <Heading as=\"h1\">{t('pageTitle')}</Heading>\n {payPeriod && (\n <Text variant=\"supporting\">\n <Trans\n i18nKey=\"description\"\n t={t}\n components={{ dateWrapper: <Text weight=\"bold\" as=\"span\" /> }}\n values={{\n ...getPayrollConfigurationTitle(payPeriod, dateFormatter),\n payrollType: payrollCategory,\n }}\n />\n </Text>\n )}\n </FlexItem>\n <FlexItem flexGrow={isDesktop ? 0 : 0}>\n {isDesktop ? (\n <Button\n title={t('calculatePayrollTitle')}\n onClick={onCalculatePayroll}\n isDisabled={isCalculateDisabled || isPending || isCalculating}\n >\n {isCalculating ? t('calculatingPayroll') : t('calculatePayroll')}\n </Button>\n ) : (\n <Flex flexDirection=\"column\" justifyContent=\"normal\" alignItems=\"stretch\" gap={12}>\n <Button\n title={t('calculatePayrollTitle')}\n onClick={onCalculatePayroll}\n isDisabled={isCalculateDisabled || isPending || isCalculating}\n >\n {isCalculating ? t('calculatingPayroll') : t('calculatePayroll')}\n </Button>\n </Flex>\n )}\n </FlexItem>\n </Flex>\n\n {(alerts || payrollAlert) && (\n <Grid gap={16} gridTemplateColumns=\"1fr\">\n {payrollAlert && (\n <Alert label={payrollAlert.label} status={payrollAlert.variant}>\n {payrollAlert.content}\n </Alert>\n )}\n {alerts}\n </Grid>\n )}\n\n {isPending ? (\n <PayrollLoading\n title={isCalculating ? t('calculatingTitle') : t('loadingTitle')}\n description={isCalculating ? t('calculatingDescription') : t('loadingDescription')}\n />\n ) : (\n <>\n {payrollBlockers.length > 0 && (\n <PayrollBlockerAlerts\n blockers={payrollBlockers}\n onViewBlockersClick={onViewBlockers}\n />\n )}\n <Flex flexDirection=\"column\" gap={20}>\n <FlexItem>\n <Heading as=\"h3\">{t('hoursAndEarningsTitle')}</Heading>\n <Text variant=\"supporting\">{t('hoursAndEarningsDescription')}</Text>\n </FlexItem>\n\n <DataView\n label={t('employeeCompensationsTitle')}\n columns={[\n {\n title: t('tableColumns.employees'),\n render: (item: EmployeeCompensations) => {\n const employee = employeeMap.get(item.employeeUuid || '')\n const payRateDisplay = formatEmployeePayRate(employee)\n return (\n <Flex flexDirection=\"column\" gap={0}>\n {getEmployeeName(item.employeeUuid || '')}\n {payRateDisplay && (\n <Text size=\"xs\" variant=\"supporting\">\n {payRateDisplay}\n </Text>\n )}\n {item.excluded && <Badge status=\"warning\">{t('skippedBadge')}</Badge>}\n </Flex>\n )\n },\n },\n {\n title: t('tableColumns.hours'),\n render: (item: EmployeeCompensations) => {\n const hours = getRegularHours(item)\n const overtimeHours = getOvertimeHours(item)\n return formatHoursDisplay(hours + overtimeHours)\n },\n },\n {\n title: t('tableColumns.timeOff'),\n render: (item: EmployeeCompensations) => {\n const ptoHours = getTotalPtoHours(item)\n return formatHoursDisplay(ptoHours)\n },\n },\n {\n title: t('tableColumns.additionalEarnings'),\n render: (item: EmployeeCompensations) => {\n const earnings = getAdditionalEarnings(item)\n return formatNumberAsCurrency(earnings)\n },\n },\n ...(withReimbursements\n ? [\n {\n title: t('tableColumns.reimbursements'),\n render: (item: EmployeeCompensations) => {\n const reimbursements = getReimbursements(item)\n return formatNumberAsCurrency(reimbursements)\n },\n },\n ]\n : []),\n {\n title: t('tableColumns.totalPay'),\n render: (item: PayrollEmployeeCompensationsType) => {\n const employee = employeeMap.get(item.employeeUuid || '')\n const calculatedGrossPay = employee\n ? calculateGrossPay(\n item,\n employee,\n payPeriod?.startDate,\n paySchedule,\n payrollCategory,\n )\n : 0\n return formatNumberAsCurrency(calculatedGrossPay)\n },\n },\n ]}\n data={employeeCompensations}\n itemMenu={(item: EmployeeCompensations) => (\n <HamburgerMenu\n items={[\n {\n label: t('editMenu.edit'),\n icon: <PencilSvg aria-hidden />,\n onClick: () => {\n const employee = employeeMap.get(item.employeeUuid || '')\n if (employee) {\n onEdit(employee)\n }\n },\n },\n {\n label: t(item.excluded ? 'editMenu.unskip' : 'editMenu.skip'),\n icon: item.excluded ? <PlusCircle aria-hidden /> : <XCircle aria-hidden />,\n onClick: () => {\n const employee = employeeMap.get(item.employeeUuid || '')\n if (employee) {\n onToggleExclude(item)\n }\n },\n },\n ...(grossUpEnabled\n ? [\n {\n label: t('editMenu.setNetEarnings'),\n icon: <CoinsHandSvg aria-hidden />,\n onClick: () => {\n if (item.employeeUuid) {\n onGrossUpSelect?.(item.employeeUuid)\n }\n },\n },\n ]\n : []),\n ]}\n triggerLabel={t('editMenu.edit')}\n />\n )}\n pagination={pagination}\n />\n </Flex>\n </>\n )}\n </Flex>\n </div>\n )\n}\n"],"names":["getPayrollConfigurationTitle","payPeriod","dateFormatter","PayrollConfigurationPresentation","employeeCompensations","employeeDetails","paySchedule","onEdit","onToggleExclude","onCalculatePayroll","onViewBlockers","payrollCategory","PayrollCategory","alerts","payrollAlert","isPending","isCalculating","payrollBlockers","pagination","withReimbursements","isCalculateDisabled","grossUpEnabled","onGrossUpSelect","Button","Heading","Text","Badge","Alert","useComponentContext","useI18n","useTranslation","useDateFormatter","formatEmployeePayRate","useFormatEmployeePayRate","containerRef","useRef","isDesktop","useContainerBreakpoints","employeeMap","employee","getEmployeeName","employeeUuid","firstLastName","jsx","styles","jsxs","Flex","FlexItem","Trans","Grid","PayrollLoading","Fragment","PayrollBlockerAlerts","DataView","item","payRateDisplay","hours","getRegularHours","overtimeHours","getOvertimeHours","formatHoursDisplay","ptoHours","getTotalPtoHours","earnings","getAdditionalEarnings","formatNumberAsCurrency","reimbursements","getReimbursements","calculatedGrossPay","calculateGrossPay","HamburgerMenu","PencilSvg","PlusCircle","XCircle","CoinsHandSvg"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA6DA,MAAMA,KAA+B,CACnCC,GACAC,MAEID,GAAW,aAAaA,EAAU,UAC7BC,EAAc,gBAAgBD,EAAU,WAAWA,EAAU,OAAO,IAEtE,EAAE,WAAW,IAAI,SAAS,GAAA,GAGtBE,KAAmC,CAAC;AAAA,EAC/C,uBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,WAAAJ;AAAA,EACA,aAAAK;AAAA,EACA,QAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,i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Ae;AAAA,oBACxB,MAAM,gBAAA3B,EAAC4B,IAAA,EAAU,eAAW,GAAA,CAAC;AAAA,oBAC7B,SAAS,MAAM;AACb,4BAAMhC,IAAWD,EAAY,IAAIgB,EAAK,gBAAgB,EAAE;AACxD,sBAAIf,KACFhC,EAAOgC,CAAQ;AAAA,oBAEnB;AAAA,kBAAA;AAAA,kBAEF;AAAA,oBACE,OAAO,EAAEe,EAAK,WAAW,oBAAoB,eAAe;AAAA,oBAC5D,MAAMA,EAAK,WAAW,gBAAAX,EAAC6B,IAAA,EAAW,eAAW,GAAA,CAAC,IAAK,gBAAA7B,EAAC8B,IAAA,EAAQ,eAAW,GAAA,CAAC;AAAA,oBACxE,SAAS,MAAM;AAEb,sBADiBnC,EAAY,IAAIgB,EAAK,gBAAgB,EAAE,KAEtD9C,EAAgB8C,CAAI;AAAA,oBAExB;AAAA,kBAAA;AAAA,kBAEF,GAAIjC,IACA;AAAA,oBACE;AAAA,sBACE,OAAO,EAAE,yBAAyB;AAAA,sBAClC,MAAM,gBAAAsB,EAAC+B,IAAA,EAAa,eAAW,GAAA,CAAC;AAAA,sBAChC,SAAS,MAAM;AACb,wBAAIpB,EAAK,gBACPhC,IAAkBgC,EAAK,YAAY;AAAA,sBAEvC;AAAA,oBAAA;AAAA,kBACF,IAEF,CAAA;AAAA,gBAAC;AAAA,gBAEP,cAAc,EAAE,eAAe;AAAA,cAAA;AAAA,YAAA;AAAA,YAGnC,YAAApC;AAAA,UAAA;AAAA,QAAA;AAAA,MACF,EAAA,CACF;AAAA,IAAA,EAAA,CACF;AAAA,EAAA,EAAA,CAEJ,EAAA,CACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"PayrollConfigurationPresentation.js","sources":["../../../../src/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport { useRef } from 'react'\nimport type { EmployeeCompensations } from '@gusto/embedded-api/models/components/payroll'\nimport type { Employee } from '@gusto/embedded-api/models/components/employee'\nimport type { PayrollPayPeriodType } from '@gusto/embedded-api/models/components/payrollpayperiodtype'\nimport type { PayScheduleObject } from '@gusto/embedded-api/models/components/payscheduleobject'\nimport { Trans, useTranslation } from 'react-i18next'\nimport type { PayrollEmployeeCompensationsType } from '@gusto/embedded-api/models/components/payrollemployeecompensationstype'\nimport {\n useFormatEmployeePayRate,\n getRegularHours,\n getOvertimeHours,\n getTotalPtoHours,\n getAdditionalEarnings,\n getReimbursements,\n formatHoursDisplay,\n calculateGrossPay,\n} from '../helpers'\nimport { PayrollCategory } from '../payrollTypes'\nimport type { ApiPayrollBlocker } from '../PayrollBlocker/payrollHelpers'\nimport { PayrollBlockerAlerts } from '../PayrollBlocker/components/PayrollBlockerAlerts'\nimport styles from './PayrollConfigurationPresentation.module.scss'\nimport { useI18n } from '@/i18n'\nimport { DataView, Flex, FlexItem, Grid, PayrollLoading } from '@/components/Common'\nimport type { PaginationControlProps } from '@/components/Common/PaginationControl/PaginationControlTypes'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { HamburgerMenu } from '@/components/Common/HamburgerMenu'\nimport PencilSvg from '@/assets/icons/pencil.svg?react'\nimport XCircle from '@/assets/icons/x-circle.svg?react'\nimport PlusCircle from '@/assets/icons/plus-circle.svg?react'\nimport CoinsHandSvg from '@/assets/icons/coins-hand.svg?react'\nimport { firstLastName, formatNumberAsCurrency } from '@/helpers/formattedStrings'\nimport { useDateFormatter } from '@/hooks/useDateFormatter'\nimport useContainerBreakpoints from '@/hooks/useContainerBreakpoints/useContainerBreakpoints'\n\ninterface PayrollConfigurationPresentationProps {\n employeeCompensations: EmployeeCompensations[]\n employeeDetails: Employee[]\n payPeriod?: PayrollPayPeriodType\n paySchedule?: PayScheduleObject\n onCalculatePayroll: () => void\n onEdit: (employee: Employee) => void\n onToggleExclude: (employeeCompensation: PayrollEmployeeCompensationsType) => void\n onViewBlockers: () => void\n payrollCategory?: PayrollCategory\n alerts?: ReactNode\n payrollAlert?: {\n label: string\n content?: ReactNode\n variant: 'info' | 'warning'\n }\n isPending?: boolean\n isCalculating?: boolean\n payrollBlockers?: ApiPayrollBlocker[]\n pagination?: PaginationControlProps\n withReimbursements?: boolean\n isCalculateDisabled?: boolean\n grossUpEnabled?: boolean\n onGrossUpSelect?: (employeeUuid: string) => void\n}\n\nconst getPayrollConfigurationTitle = (\n payPeriod: PayrollPayPeriodType | undefined,\n dateFormatter: ReturnType<typeof useDateFormatter>,\n) => {\n if (payPeriod?.startDate && payPeriod.endDate) {\n return dateFormatter.formatPayPeriod(payPeriod.startDate, payPeriod.endDate)\n }\n return { startDate: '', endDate: '' }\n}\n\nexport const PayrollConfigurationPresentation = ({\n employeeCompensations,\n employeeDetails,\n payPeriod,\n paySchedule,\n onEdit,\n onToggleExclude,\n onCalculatePayroll,\n onViewBlockers,\n payrollCategory = PayrollCategory.Regular,\n alerts,\n payrollAlert,\n isPending,\n isCalculating,\n payrollBlockers = [],\n pagination,\n withReimbursements = true,\n isCalculateDisabled = false,\n grossUpEnabled = false,\n onGrossUpSelect,\n}: PayrollConfigurationPresentationProps) => {\n const { Button, Heading, Text, Badge, Alert } = useComponentContext()\n useI18n('Payroll.PayrollConfiguration')\n const { t } = useTranslation('Payroll.PayrollConfiguration')\n const dateFormatter = useDateFormatter()\n const formatEmployeePayRate = useFormatEmployeePayRate()\n const containerRef = useRef<HTMLDivElement>(null)\n const breakpoints = useContainerBreakpoints({ ref: containerRef })\n const isDesktop = breakpoints.includes('small')\n\n const employeeMap = new Map(employeeDetails.map(employee => [employee.uuid, employee]))\n\n const getEmployeeName = (employeeUuid: string) => {\n const employee = employeeMap.get(employeeUuid)\n return employee\n ? firstLastName({ first_name: employee.firstName, last_name: employee.lastName })\n : null\n }\n\n return (\n <div ref={containerRef} className={styles.container}>\n <Flex flexDirection=\"column\" gap={32}>\n <Flex\n flexDirection={isDesktop ? 'row' : 'column'}\n justifyContent={isDesktop ? 'space-between' : 'normal'}\n alignItems={isDesktop ? 'center' : 'stretch'}\n gap={isDesktop ? 0 : 16}\n >\n <FlexItem>\n <Heading as=\"h1\">{t('pageTitle')}</Heading>\n {payPeriod && (\n <Text variant=\"supporting\">\n <Trans\n i18nKey={\n payrollCategory === PayrollCategory.Dismissal\n ? 'descriptionDismissal'\n : 'description'\n }\n t={t}\n components={{ dateWrapper: <Text weight=\"bold\" as=\"span\" /> }}\n values={{\n ...getPayrollConfigurationTitle(payPeriod, dateFormatter),\n payrollType: payrollCategory,\n }}\n />\n </Text>\n )}\n </FlexItem>\n <FlexItem flexGrow={isDesktop ? 0 : 0}>\n {isDesktop ? (\n <Button\n title={t('calculatePayrollTitle')}\n onClick={onCalculatePayroll}\n isDisabled={isCalculateDisabled || isPending || isCalculating}\n >\n {isCalculating ? t('calculatingPayroll') : t('calculatePayroll')}\n </Button>\n ) : (\n <Flex flexDirection=\"column\" justifyContent=\"normal\" alignItems=\"stretch\" gap={12}>\n <Button\n title={t('calculatePayrollTitle')}\n onClick={onCalculatePayroll}\n isDisabled={isCalculateDisabled || isPending || isCalculating}\n >\n {isCalculating ? t('calculatingPayroll') : t('calculatePayroll')}\n </Button>\n </Flex>\n )}\n </FlexItem>\n </Flex>\n\n {(alerts || payrollAlert) && (\n <Grid gap={16} gridTemplateColumns=\"1fr\">\n {payrollAlert && (\n <Alert label={payrollAlert.label} status={payrollAlert.variant}>\n {payrollAlert.content}\n </Alert>\n )}\n {alerts}\n </Grid>\n )}\n\n {isPending ? (\n <PayrollLoading\n title={isCalculating ? t('calculatingTitle') : t('loadingTitle')}\n description={isCalculating ? t('calculatingDescription') : t('loadingDescription')}\n />\n ) : (\n <>\n {payrollBlockers.length > 0 && (\n <PayrollBlockerAlerts\n blockers={payrollBlockers}\n onViewBlockersClick={onViewBlockers}\n />\n )}\n <Flex flexDirection=\"column\" gap={20}>\n <FlexItem>\n <Heading as=\"h3\">{t('hoursAndEarningsTitle')}</Heading>\n <Text variant=\"supporting\">{t('hoursAndEarningsDescription')}</Text>\n </FlexItem>\n\n <DataView\n label={t('employeeCompensationsTitle')}\n columns={[\n {\n title: t('tableColumns.employees'),\n render: (item: EmployeeCompensations) => {\n const employee = employeeMap.get(item.employeeUuid || '')\n const payRateDisplay = formatEmployeePayRate(employee)\n return (\n <Flex flexDirection=\"column\" gap={0}>\n {getEmployeeName(item.employeeUuid || '')}\n {payRateDisplay && (\n <Text size=\"xs\" variant=\"supporting\">\n {payRateDisplay}\n </Text>\n )}\n {item.excluded && <Badge status=\"warning\">{t('skippedBadge')}</Badge>}\n </Flex>\n )\n },\n },\n {\n title: t('tableColumns.hours'),\n render: (item: EmployeeCompensations) => {\n const hours = getRegularHours(item)\n const overtimeHours = getOvertimeHours(item)\n return formatHoursDisplay(hours + overtimeHours)\n },\n },\n {\n title: t('tableColumns.timeOff'),\n render: (item: EmployeeCompensations) => {\n const ptoHours = getTotalPtoHours(item)\n return formatHoursDisplay(ptoHours)\n },\n },\n {\n title: t('tableColumns.additionalEarnings'),\n render: (item: EmployeeCompensations) => {\n const earnings = getAdditionalEarnings(item)\n return formatNumberAsCurrency(earnings)\n },\n },\n ...(withReimbursements\n ? [\n {\n title: t('tableColumns.reimbursements'),\n render: (item: EmployeeCompensations) => {\n const reimbursements = getReimbursements(item)\n return formatNumberAsCurrency(reimbursements)\n },\n },\n ]\n : []),\n {\n title: t('tableColumns.totalPay'),\n render: (item: PayrollEmployeeCompensationsType) => {\n const employee = employeeMap.get(item.employeeUuid || '')\n const calculatedGrossPay = employee\n ? calculateGrossPay(\n item,\n employee,\n payPeriod?.startDate,\n paySchedule,\n payrollCategory,\n )\n : 0\n return formatNumberAsCurrency(calculatedGrossPay)\n },\n },\n ]}\n data={employeeCompensations}\n itemMenu={(item: EmployeeCompensations) => (\n <HamburgerMenu\n items={[\n {\n label: t('editMenu.edit'),\n icon: <PencilSvg aria-hidden />,\n onClick: () => {\n const employee = employeeMap.get(item.employeeUuid || '')\n if (employee) {\n onEdit(employee)\n }\n },\n },\n {\n label: t(item.excluded ? 'editMenu.unskip' : 'editMenu.skip'),\n icon: item.excluded ? <PlusCircle aria-hidden /> : <XCircle aria-hidden />,\n onClick: () => {\n const employee = employeeMap.get(item.employeeUuid || '')\n if (employee) {\n onToggleExclude(item)\n }\n },\n },\n ...(grossUpEnabled\n ? [\n {\n label: t('editMenu.setNetEarnings'),\n icon: <CoinsHandSvg aria-hidden />,\n onClick: () => {\n if (item.employeeUuid) {\n onGrossUpSelect?.(item.employeeUuid)\n }\n },\n },\n ]\n : []),\n ]}\n triggerLabel={t('editMenu.edit')}\n />\n )}\n pagination={pagination}\n />\n </Flex>\n </>\n )}\n </Flex>\n </div>\n )\n}\n"],"names":["getPayrollConfigurationTitle","payPeriod","dateFormatter","PayrollConfigurationPresentation","employeeCompensations","employeeDetails","paySchedule","onEdit","onToggleExclude","onCalculatePayroll","onViewBlockers","payrollCategory","PayrollCategory","alerts","payrollAlert","isPending","isCalculating","payrollBlockers","pagination","withReimbursements","isCalculateDisabled","grossUpEnabled","onGrossUpSelect","Button","Heading","Text","Badge","Alert","useComponentContext","useI18n","useTranslation","useDateFormatter","formatEmployeePayRate","useFormatEmployeePayRate","containerRef","useRef","isDesktop","useContainerBreakpoints","employeeMap","employee","getEmployeeName","employeeUuid","firstLastName","jsx","styles","jsxs","Flex","FlexItem","Trans","Grid","PayrollLoading","Fragment","PayrollBlockerAlerts","DataView","item","payRateDisplay","hours","getRegularHours","overtimeHours","getOvertimeHours","formatHoursDisplay","ptoHours","getTotalPtoHours","earnings","getAdditionalEarnings","formatNumberAsCurrency","reimbursements","getReimbursements","calculatedGrossPay","calculateGrossPay","HamburgerMenu","PencilSvg","PlusCircle","XCircle","CoinsHandSvg"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA6DA,MAAMA,KAA+B,CACnCC,GACAC,MAEID,GAAW,aAAaA,EAAU,UAC7BC,EAAc,gBAAgBD,EAAU,WAAWA,EAAU,OAAO,IAEtE,EAAE,WAAW,IAAI,SAAS,GAAA,GAGtBE,KAAmC,CAAC;AA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@ export interface PayrollExecutionFlowProps {
|
|
|
9
9
|
payrollId: string;
|
|
10
10
|
onEvent: OnEventType<EventType, unknown>;
|
|
11
11
|
initialPayPeriod?: PayrollPayPeriodType;
|
|
12
|
+
isDismissalPayroll?: boolean;
|
|
12
13
|
withReimbursements?: boolean;
|
|
13
14
|
ConfirmWireDetailsComponent?: ConfirmWireDetailsComponentType;
|
|
14
15
|
prefixBreadcrumbs?: FlowBreadcrumb[];
|
|
15
16
|
initialState?: PayrollExecutionInitialState;
|
|
16
17
|
}
|
|
17
|
-
export declare function PayrollExecutionFlow({ companyId, payrollId, onEvent, initialPayPeriod, withReimbursements, ConfirmWireDetailsComponent, prefixBreadcrumbs, initialState, }: PayrollExecutionFlowProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare function PayrollExecutionFlow({ companyId, payrollId, onEvent, initialPayPeriod, isDismissalPayroll: isDismissal, withReimbursements, ConfirmWireDetailsComponent, prefixBreadcrumbs, initialState, }: PayrollExecutionFlowProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,61 +1,62 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { createMachine as
|
|
1
|
+
import { jsx as P } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as x } from "react";
|
|
3
|
+
import { createMachine as y } from "robot3";
|
|
4
4
|
import { SaveAndExitCta as C, PayrollOverviewContextual as E, PayrollConfigurationContextual as M } from "../PayrollFlow/PayrollFlowComponents.js";
|
|
5
|
-
import { payrollExecutionMachine as
|
|
5
|
+
import { payrollExecutionMachine as g, getPayrollExecutionBreadcrumbsNodes as v } from "./payrollExecutionMachine.js";
|
|
6
6
|
import { Flow as B } from "../../Flow/Flow.js";
|
|
7
|
-
import { buildBreadcrumbs as
|
|
8
|
-
const
|
|
7
|
+
import { buildBreadcrumbs as A, updateBreadcrumbs as w } from "../../../helpers/breadcrumbHelpers.js";
|
|
8
|
+
const N = [], O = {
|
|
9
9
|
configuration: M,
|
|
10
10
|
overview: E
|
|
11
|
-
},
|
|
11
|
+
}, I = {
|
|
12
12
|
configuration: "Payroll.PayrollConfiguration",
|
|
13
13
|
overview: "Payroll.PayrollOverview"
|
|
14
14
|
};
|
|
15
|
-
function
|
|
15
|
+
function U({
|
|
16
16
|
companyId: t,
|
|
17
17
|
payrollId: a,
|
|
18
|
-
onEvent:
|
|
18
|
+
onEvent: l,
|
|
19
19
|
initialPayPeriod: o,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
isDismissalPayroll: c = !1,
|
|
21
|
+
withReimbursements: n = !0,
|
|
22
|
+
ConfirmWireDetailsComponent: u,
|
|
23
|
+
prefixBreadcrumbs: s = N,
|
|
23
24
|
initialState: r = "configuration"
|
|
24
25
|
}) {
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
Object.entries(
|
|
26
|
+
const m = x(() => {
|
|
27
|
+
const b = v(c), d = A(b), f = Object.fromEntries(
|
|
28
|
+
Object.entries(d).map(([e, i]) => [
|
|
28
29
|
e,
|
|
29
|
-
[...
|
|
30
|
+
[...s, ...i]
|
|
30
31
|
])
|
|
31
|
-
),
|
|
32
|
+
), p = w(
|
|
32
33
|
r,
|
|
33
34
|
{
|
|
34
|
-
breadcrumbs:
|
|
35
|
+
breadcrumbs: f
|
|
35
36
|
},
|
|
36
37
|
{
|
|
37
38
|
startDate: o?.startDate ?? "",
|
|
38
39
|
endDate: o?.endDate ?? ""
|
|
39
40
|
}
|
|
40
41
|
);
|
|
41
|
-
return
|
|
42
|
+
return y(
|
|
42
43
|
r,
|
|
43
|
-
|
|
44
|
+
g,
|
|
44
45
|
(e) => ({
|
|
45
46
|
...e,
|
|
46
|
-
...
|
|
47
|
-
component:
|
|
47
|
+
...p,
|
|
48
|
+
component: O[r],
|
|
48
49
|
companyId: t,
|
|
49
50
|
payrollUuid: a,
|
|
50
51
|
payPeriod: o,
|
|
51
52
|
progressBarType: "breadcrumbs",
|
|
52
53
|
currentBreadcrumbId: r,
|
|
53
|
-
withReimbursements:
|
|
54
|
-
ConfirmWireDetailsComponent:
|
|
54
|
+
withReimbursements: n,
|
|
55
|
+
ConfirmWireDetailsComponent: u,
|
|
55
56
|
progressBarCta: C,
|
|
56
57
|
ctaConfig: {
|
|
57
58
|
labelKey: "exitFlowCta",
|
|
58
|
-
namespace:
|
|
59
|
+
namespace: I[r]
|
|
59
60
|
}
|
|
60
61
|
})
|
|
61
62
|
);
|
|
@@ -65,11 +66,12 @@ function j({
|
|
|
65
66
|
c,
|
|
66
67
|
n,
|
|
67
68
|
u,
|
|
69
|
+
s,
|
|
68
70
|
r
|
|
69
71
|
]);
|
|
70
|
-
return /* @__PURE__ */
|
|
72
|
+
return /* @__PURE__ */ P(B, { machine: m, onEvent: l });
|
|
71
73
|
}
|
|
72
74
|
export {
|
|
73
|
-
|
|
75
|
+
U as PayrollExecutionFlow
|
|
74
76
|
};
|
|
75
77
|
//# sourceMappingURL=PayrollExecutionFlow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayrollExecutionFlow.js","sources":["../../../../src/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { createMachine } from 'robot3'\nimport type { PayrollPayPeriodType } from '@gusto/embedded-api/models/components/payrollpayperiodtype'\nimport type { ConfirmWireDetailsComponentType } from '../ConfirmWireDetails/ConfirmWireDetails'\nimport {\n PayrollConfigurationContextual,\n PayrollOverviewContextual,\n SaveAndExitCta,\n type PayrollFlowContextInterface,\n} from '../PayrollFlow/PayrollFlowComponents'\nimport {\n payrollExecutionMachine,\n
|
|
1
|
+
{"version":3,"file":"PayrollExecutionFlow.js","sources":["../../../../src/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.tsx"],"sourcesContent":["import { useMemo } from 'react'\nimport { createMachine } from 'robot3'\nimport type { PayrollPayPeriodType } from '@gusto/embedded-api/models/components/payrollpayperiodtype'\nimport type { ConfirmWireDetailsComponentType } from '../ConfirmWireDetails/ConfirmWireDetails'\nimport {\n PayrollConfigurationContextual,\n PayrollOverviewContextual,\n SaveAndExitCta,\n type PayrollFlowContextInterface,\n} from '../PayrollFlow/PayrollFlowComponents'\nimport {\n payrollExecutionMachine,\n getPayrollExecutionBreadcrumbsNodes,\n} from './payrollExecutionMachine'\nimport { Flow } from '@/components/Flow/Flow'\nimport type { FlowBreadcrumb } from '@/components/Common/FlowBreadcrumbs/FlowBreadcrumbsTypes'\nimport { buildBreadcrumbs, updateBreadcrumbs } from '@/helpers/breadcrumbHelpers'\nimport type { OnEventType } from '@/components/Base/useBase'\nimport type { EventType } from '@/shared/constants'\n\nconst EMPTY_BREADCRUMBS: FlowBreadcrumb[] = []\n\nexport type PayrollExecutionInitialState = 'configuration' | 'overview'\n\nexport interface PayrollExecutionFlowProps {\n companyId: string\n payrollId: string\n onEvent: OnEventType<EventType, unknown>\n initialPayPeriod?: PayrollPayPeriodType\n isDismissalPayroll?: boolean\n withReimbursements?: boolean\n ConfirmWireDetailsComponent?: ConfirmWireDetailsComponentType\n prefixBreadcrumbs?: FlowBreadcrumb[]\n initialState?: PayrollExecutionInitialState\n}\n\nconst INITIAL_COMPONENT_MAP = {\n configuration: PayrollConfigurationContextual,\n overview: PayrollOverviewContextual,\n} as const\n\nconst INITIAL_NAMESPACE_MAP = {\n configuration: 'Payroll.PayrollConfiguration' as const,\n overview: 'Payroll.PayrollOverview' as const,\n} as const\n\nexport function PayrollExecutionFlow({\n companyId,\n payrollId,\n onEvent,\n initialPayPeriod,\n isDismissalPayroll: isDismissal = false,\n withReimbursements = true,\n ConfirmWireDetailsComponent,\n prefixBreadcrumbs = EMPTY_BREADCRUMBS,\n initialState = 'configuration',\n}: PayrollExecutionFlowProps) {\n const executionFlowMachine = useMemo(() => {\n const breadcrumbNodes = getPayrollExecutionBreadcrumbsNodes(isDismissal)\n const baseBreadcrumbs = buildBreadcrumbs(breadcrumbNodes)\n const breadcrumbs = Object.fromEntries(\n Object.entries(baseBreadcrumbs).map(([stateKey, trail]) => [\n stateKey,\n [...prefixBreadcrumbs, ...trail],\n ]),\n )\n\n const initialBreadcrumbContext = updateBreadcrumbs(\n initialState,\n {\n breadcrumbs,\n } as PayrollFlowContextInterface,\n {\n startDate: initialPayPeriod?.startDate ?? '',\n endDate: initialPayPeriod?.endDate ?? '',\n },\n )\n\n return createMachine(\n initialState,\n payrollExecutionMachine,\n (initialContext: PayrollFlowContextInterface) => ({\n ...initialContext,\n ...initialBreadcrumbContext,\n component: INITIAL_COMPONENT_MAP[initialState],\n companyId,\n payrollUuid: payrollId,\n payPeriod: initialPayPeriod,\n progressBarType: 'breadcrumbs' as const,\n currentBreadcrumbId: initialState,\n withReimbursements,\n ConfirmWireDetailsComponent,\n progressBarCta: SaveAndExitCta,\n ctaConfig: {\n labelKey: 'exitFlowCta',\n namespace: INITIAL_NAMESPACE_MAP[initialState],\n },\n }),\n )\n }, [\n companyId,\n payrollId,\n isDismissal,\n withReimbursements,\n ConfirmWireDetailsComponent,\n prefixBreadcrumbs,\n initialState,\n ])\n\n return <Flow machine={executionFlowMachine} onEvent={onEvent} />\n}\n"],"names":["EMPTY_BREADCRUMBS","INITIAL_COMPONENT_MAP","PayrollConfigurationContextual","PayrollOverviewContextual","INITIAL_NAMESPACE_MAP","PayrollExecutionFlow","companyId","payrollId","onEvent","initialPayPeriod","isDismissal","withReimbursements","ConfirmWireDetailsComponent","prefixBreadcrumbs","initialState","executionFlowMachine","useMemo","breadcrumbNodes","getPayrollExecutionBreadcrumbsNodes","baseBreadcrumbs","buildBreadcrumbs","breadcrumbs","stateKey","trail","initialBreadcrumbContext","updateBreadcrumbs","createMachine","payrollExecutionMachine","initialContext","SaveAndExitCta","jsx","Flow"],"mappings":";;;;;;;AAoBA,MAAMA,IAAsC,CAAA,GAgBtCC,IAAwB;AAAA,EAC5B,eAAeC;AAAA,EACf,UAAUC;AACZ,GAEMC,IAAwB;AAAA,EAC5B,eAAe;AAAA,EACf,UAAU;AACZ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EAACC,GAAA,EAAK,SAAShB,GAAsB,SAAAP,EAAA,CAAkB;AAChE;"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import "./types/i18next.d.ts"
|
|
2
2
|
export { PayrollExecutionFlow, type PayrollExecutionFlowProps, type PayrollExecutionInitialState, } from './PayrollExecutionFlow';
|
|
3
|
-
export { payrollExecutionMachine,
|
|
3
|
+
export { payrollExecutionMachine, getPayrollExecutionBreadcrumbsNodes, } from './payrollExecutionMachine';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BreadcrumbNodes } from '../../Common/FlowBreadcrumbs/FlowBreadcrumbsTypes';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const getPayrollExecutionBreadcrumbsNodes: (isDismissal?: boolean) => BreadcrumbNodes;
|
|
3
3
|
export declare const payrollExecutionMachine: {
|
|
4
4
|
configuration: import('robot3').MachineState<any>;
|
|
5
5
|
overview: import('robot3').MachineState<any>;
|