@gusto/embedded-react-sdk 0.56.0 → 0.56.1
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 +16 -0
- package/dist/components/Payroll/OffCycle/OffCycleFlow.js.map +1 -1
- package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js +24 -18
- package/dist/components/Payroll/OffCycle/OffCycleFlowComponents.js.map +1 -1
- package/dist/components/Payroll/OffCycle/offCycleStateMachine.js +39 -21
- package/dist/components/Payroll/OffCycle/offCycleStateMachine.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js +85 -82
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreation.js.map +1 -1
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js +52 -51
- package/dist/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js +12 -12
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +40 -40
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +26 -25
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +13 -16
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +0 -1
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeHelpers.js +138 -110
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeHelpers.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/usePayrollEditEmployeeForm.js +149 -146
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/usePayrollEditEmployeeForm.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.js.map +1 -1
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js +4 -0
- package/dist/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/PayrollFlow.js.map +1 -1
- package/dist/components/Payroll/PayrollFlow/TransitionFlowContextual.js +22 -35
- package/dist/components/Payroll/PayrollFlow/TransitionFlowContextual.js.map +1 -1
- package/dist/components/Payroll/Transition/TransitionFlow.js +49 -36
- package/dist/components/Payroll/Transition/TransitionFlow.js.map +1 -1
- package/dist/components/Payroll/Transition/TransitionFlowComponents.js +24 -47
- package/dist/components/Payroll/Transition/TransitionFlowComponents.js.map +1 -1
- package/dist/components/Payroll/Transition/transitionStateMachine.js +35 -40
- package/dist/components/Payroll/Transition/transitionStateMachine.js.map +1 -1
- package/dist/components/Payroll/TransitionPayroll/TransitionPayroll.js +48 -0
- package/dist/components/Payroll/TransitionPayroll/TransitionPayroll.js.map +1 -0
- package/dist/components/Payroll/TransitionPayroll/TransitionPayrollComponents.js +35 -0
- package/dist/components/Payroll/TransitionPayroll/TransitionPayrollComponents.js.map +1 -0
- package/dist/components/Payroll/TransitionPayroll/transitionPayrollStateMachine.js +23 -0
- package/dist/components/Payroll/TransitionPayroll/transitionPayrollStateMachine.js.map +1 -0
- package/dist/components/Payroll/TransitionPayroll/useResolveTransitionPayroll.js +32 -0
- package/dist/components/Payroll/TransitionPayroll/useResolveTransitionPayroll.js.map +1 -0
- package/dist/components/Payroll/index.js +7 -5
- package/dist/components/Payroll/index.js.map +1 -1
- package/dist/i18n/I18n.js +9 -4
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollBlocker.json.js +10 -8
- package/dist/i18n/en/Payroll.PayrollBlocker.json.js.map +1 -1
- package/dist/i18n/es_US/Company.StateTaxes.json.js +1 -1
- package/dist/i18n/es_US/Contractor.ContractorList.json.js +14 -12
- package/dist/i18n/es_US/Contractor.ContractorList.json.js.map +1 -1
- package/dist/i18n/es_US/Contractor.Management.Compensation.json.js +4 -4
- package/dist/i18n/es_US/Contractor.Management.Profile.json.js +4 -4
- package/dist/i18n/es_US/Contractor.ManagementContractorList.json.js +40 -38
- package/dist/i18n/es_US/Contractor.ManagementContractorList.json.js.map +1 -1
- package/dist/i18n/es_US/Contractor.Payments.PaymentsList.json.js +18 -16
- package/dist/i18n/es_US/Contractor.Payments.PaymentsList.json.js.map +1 -1
- package/dist/i18n/es_US/Contractor.Profile.json.js +5 -5
- package/dist/i18n/es_US/Payroll.OffCycleCreation.json.js +11 -9
- package/dist/i18n/es_US/Payroll.OffCycleCreation.json.js.map +1 -1
- package/dist/i18n/es_US/Payroll.OffCyclePayPeriodDateForm.json.js +2 -2
- package/dist/i18n/es_US/Payroll.OffCycleTaxWithholding.json.js +6 -6
- package/dist/i18n/es_US/Payroll.PayrollConfiguration.json.js +15 -15
- package/dist/i18n/es_US/Payroll.PayrollEditEmployee.json.js +28 -26
- package/dist/i18n/es_US/Payroll.PayrollEditEmployee.json.js.map +1 -1
- package/dist/i18n/es_US/Payroll.PayrollOverview.json.js +40 -38
- package/dist/i18n/es_US/Payroll.PayrollOverview.json.js.map +1 -1
- package/dist/i18n/es_US/Payroll.PrintChecksBanner.json.js +14 -0
- package/dist/i18n/es_US/Payroll.PrintChecksBanner.json.js.map +1 -0
- package/dist/i18n/es_US/Payroll.PrintChecksFailure.json.js +12 -0
- package/dist/i18n/es_US/Payroll.PrintChecksFailure.json.js.map +1 -0
- package/dist/i18n/es_US/Payroll.PrintChecksForm.json.js +26 -0
- package/dist/i18n/es_US/Payroll.PrintChecksForm.json.js.map +1 -0
- package/dist/i18n/es_US/Payroll.PrintChecksSummary.json.js +14 -0
- package/dist/i18n/es_US/Payroll.PrintChecksSummary.json.js.map +1 -0
- package/dist/i18n/es_US/Payroll.UNSTABLE_PayrollEditEmployee.json.js +78 -0
- package/dist/i18n/es_US/Payroll.UNSTABLE_PayrollEditEmployee.json.js.map +1 -0
- package/dist/i18n/es_US/common.json.js +1 -1
- package/dist/package.json.js +1 -1
- package/dist/shared/constants.js +21 -20
- package/dist/shared/constants.js.map +1 -1
- package/dist/src/components/Payroll/OffCycle/OffCycleFlow.d.ts +2 -0
- package/dist/src/components/Payroll/OffCycle/OffCycleFlowComponents.d.ts +2 -0
- package/dist/src/components/Payroll/OffCycle/offCycleStateMachine.d.ts +1 -0
- package/dist/src/components/Payroll/OffCycleCreation/OffCycleCreation.d.ts +1 -0
- package/dist/src/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.d.ts +1 -1
- package/dist/src/components/Payroll/OffCycleCreation/OffCycleCreationTypes.d.ts +5 -0
- package/dist/src/components/Payroll/PayrollConfiguration/PayrollConfiguration.d.ts +1 -1
- package/dist/src/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeHelpers.d.ts +18 -0
- package/dist/src/components/Payroll/PayrollExecutionFlow/PayrollExecutionFlow.d.ts +1 -1
- package/dist/src/components/Payroll/PayrollExecutionFlow/payrollExecutionMachine.d.ts +8 -0
- package/dist/src/components/Payroll/PayrollFlow/PayrollFlow.d.ts +1 -1
- package/dist/src/components/Payroll/PayrollFlow/TransitionFlowContextual.d.ts +6 -1
- package/dist/src/components/Payroll/Transition/TransitionFlow.d.ts +17 -15
- package/dist/src/components/Payroll/Transition/TransitionFlowComponents.d.ts +21 -12
- package/dist/src/components/Payroll/Transition/transitionStateMachine.d.ts +25 -4
- package/dist/src/components/Payroll/TransitionPayroll/TransitionPayroll.d.ts +55 -0
- package/dist/src/components/Payroll/TransitionPayroll/TransitionPayrollComponents.d.ts +24 -0
- package/dist/src/components/Payroll/TransitionPayroll/TransitionPayrollTypes.d.ts +23 -0
- package/dist/src/components/Payroll/TransitionPayroll/index.d.ts +2 -0
- package/dist/src/components/Payroll/TransitionPayroll/transitionPayrollStateMachine.d.ts +15 -0
- package/dist/src/components/Payroll/TransitionPayroll/useResolveTransitionPayroll.d.ts +28 -0
- package/dist/src/components/Payroll/index.d.ts +2 -0
- package/dist/src/i18n/types.d.ts +6 -0
- package/dist/src/shared/constants.d.ts +2 -0
- package/docs/guides/endpoint-inventory.json +14 -19
- package/package.json +4 -4
|
@@ -1,38 +1,39 @@
|
|
|
1
1
|
import { jsxs as n, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { useFormContext as
|
|
4
|
-
import { useTranslation as c, Trans as
|
|
5
|
-
import { OffCyclePayPeriodDateFormPresentation as
|
|
6
|
-
import { PayrollBlockerAlerts as
|
|
7
|
-
import { WAGE_TYPE_CATEGORIES as
|
|
2
|
+
import { useMemo as R, useCallback as j } from "react";
|
|
3
|
+
import { useFormContext as I } from "react-hook-form";
|
|
4
|
+
import { useTranslation as c, Trans as L } from "react-i18next";
|
|
5
|
+
import { OffCyclePayPeriodDateFormPresentation as M } from "../OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation.js";
|
|
6
|
+
import { PayrollBlockerAlerts as V } from "../PayrollBlocker/components/PayrollBlockerAlerts.js";
|
|
7
|
+
import { WAGE_TYPE_CATEGORIES as $ } from "../OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes.js";
|
|
8
8
|
import s from "./OffCycleCreationPresentation.module.scss.js";
|
|
9
9
|
import { useI18n as p } from "../../../i18n/I18n.js";
|
|
10
|
-
import { useComponentContext as
|
|
10
|
+
import { useComponentContext as H } from "../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
11
11
|
import { Flex as o } from "../../Common/Flex/Flex.js";
|
|
12
|
-
import { OffCycleReasonSelectionPresentation as
|
|
13
|
-
import { MultiSelectComboBoxField as
|
|
14
|
-
import { RadioGroupField as
|
|
15
|
-
import { OffCycleTaxWithholdingTable as
|
|
16
|
-
import { OffCycleTaxWithholdingModal as
|
|
17
|
-
import { SwitchField as
|
|
18
|
-
function
|
|
12
|
+
import { OffCycleReasonSelectionPresentation as U } from "../OffCycleReasonSelection/OffCycleReasonSelectionPresentation.js";
|
|
13
|
+
import { MultiSelectComboBoxField as _ } from "../../Common/Fields/MultiSelectComboBoxField/MultiSelectComboBoxField.js";
|
|
14
|
+
import { RadioGroupField as K } from "../../Common/Fields/RadioGroupField/RadioGroupField.js";
|
|
15
|
+
import { OffCycleTaxWithholdingTable as Y } from "../OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTable.js";
|
|
16
|
+
import { OffCycleTaxWithholdingModal as q } from "../OffCycleTaxWithholdingModal/OffCycleTaxWithholdingModal.js";
|
|
17
|
+
import { SwitchField as z } from "../../Common/Fields/SwitchField/SwitchField.js";
|
|
18
|
+
function ue({
|
|
19
19
|
employees: x,
|
|
20
20
|
blockers: u,
|
|
21
|
+
onViewBlockersClick: D,
|
|
21
22
|
isPending: f,
|
|
22
|
-
minCheckDate:
|
|
23
|
-
minCheckOnlyDate:
|
|
24
|
-
maxDate:
|
|
25
|
-
minPayPeriodDate:
|
|
23
|
+
minCheckDate: T,
|
|
24
|
+
minCheckOnlyDate: b,
|
|
25
|
+
maxDate: P,
|
|
26
|
+
minPayPeriodDate: E,
|
|
26
27
|
taxWithholdingConfig: h,
|
|
27
|
-
isTaxWithholdingModalOpen:
|
|
28
|
-
onTaxWithholdingEditClick:
|
|
29
|
-
onTaxWithholdingModalDone:
|
|
30
|
-
onTaxWithholdingModalCancel:
|
|
31
|
-
className:
|
|
28
|
+
isTaxWithholdingModalOpen: O,
|
|
29
|
+
onTaxWithholdingEditClick: S,
|
|
30
|
+
onTaxWithholdingModalDone: v,
|
|
31
|
+
onTaxWithholdingModalCancel: A,
|
|
32
|
+
className: w
|
|
32
33
|
}) {
|
|
33
34
|
p("Payroll.OffCycleCreation"), p("Payroll.OffCycleDeductionsSetting"), p("Payroll.EmployeeSelection"), p("Payroll.OffCycleTaxWithholding");
|
|
34
|
-
const { t: i } = c("Payroll.OffCycleCreation"), { t } = c("Payroll.OffCycleDeductionsSetting"), { t: d } = c("Payroll.EmployeeSelection"), { t: r } = c("Payroll.OffCycleTaxWithholding"), { Heading: m, Text: a, Button:
|
|
35
|
-
() =>
|
|
35
|
+
const { t: i } = c("Payroll.OffCycleCreation"), { t } = c("Payroll.OffCycleDeductionsSetting"), { t: d } = c("Payroll.EmployeeSelection"), { t: r } = c("Payroll.OffCycleTaxWithholding"), { Heading: m, Text: a, Button: G } = H(), F = R(
|
|
36
|
+
() => $.map((l) => {
|
|
36
37
|
const C = {
|
|
37
38
|
category: l,
|
|
38
39
|
label: r(`wageTypeGroups.${l}.label`),
|
|
@@ -41,12 +42,12 @@ function me({
|
|
|
41
42
|
return (l === "regular" || l === "supplemental") && (C.description = r(`wageTypeGroups.${l}.description`)), C;
|
|
42
43
|
}),
|
|
43
44
|
[r]
|
|
44
|
-
), { setValue: y, watch:
|
|
45
|
+
), { setValue: y, watch: W } = I(), k = W("includeAllEmployees"), B = j(
|
|
45
46
|
(l) => {
|
|
46
47
|
l && y("selectedEmployeeUuids", []);
|
|
47
48
|
},
|
|
48
49
|
[y]
|
|
49
|
-
),
|
|
50
|
+
), N = [
|
|
50
51
|
{
|
|
51
52
|
value: !1,
|
|
52
53
|
label: t("options.include.label")
|
|
@@ -56,8 +57,8 @@ function me({
|
|
|
56
57
|
label: t("options.skip.label")
|
|
57
58
|
}
|
|
58
59
|
], g = u.length > 0;
|
|
59
|
-
return /* @__PURE__ */ n(o, { className:
|
|
60
|
-
g && /* @__PURE__ */ e(
|
|
60
|
+
return /* @__PURE__ */ n(o, { className: w, flexDirection: "column", gap: 32, children: [
|
|
61
|
+
g && /* @__PURE__ */ e(V, { blockers: u, onViewBlockersClick: D }),
|
|
61
62
|
/* @__PURE__ */ n(o, { flexDirection: "column", gap: 4, children: [
|
|
62
63
|
/* @__PURE__ */ e(m, { as: "h2", children: i("pageTitle") }),
|
|
63
64
|
/* @__PURE__ */ e(a, { variant: "supporting", children: i("pageDescription") })
|
|
@@ -68,30 +69,30 @@ function me({
|
|
|
68
69
|
/* @__PURE__ */ e(a, { variant: "supporting", children: i("payPeriodSectionDescription") })
|
|
69
70
|
] }),
|
|
70
71
|
/* @__PURE__ */ e(
|
|
71
|
-
|
|
72
|
+
M,
|
|
72
73
|
{
|
|
73
|
-
minCheckDate:
|
|
74
|
-
minCheckOnlyDate:
|
|
75
|
-
maxDate:
|
|
76
|
-
minPayPeriodDate:
|
|
74
|
+
minCheckDate: T,
|
|
75
|
+
minCheckOnlyDate: b,
|
|
76
|
+
maxDate: P,
|
|
77
|
+
minPayPeriodDate: E
|
|
77
78
|
}
|
|
78
79
|
)
|
|
79
80
|
] }),
|
|
80
81
|
/* @__PURE__ */ e("hr", { className: s.divider }),
|
|
81
|
-
/* @__PURE__ */ e(o, { flexDirection: "column", gap: 20, children: /* @__PURE__ */ e(
|
|
82
|
+
/* @__PURE__ */ e(o, { flexDirection: "column", gap: 20, children: /* @__PURE__ */ e(U, { name: "reason" }) }),
|
|
82
83
|
/* @__PURE__ */ e("hr", { className: s.divider }),
|
|
83
84
|
/* @__PURE__ */ n(o, { flexDirection: "column", gap: 12, children: [
|
|
84
85
|
/* @__PURE__ */ e(m, { as: "h3", children: d("sectionTitle") }),
|
|
85
86
|
/* @__PURE__ */ e(
|
|
86
|
-
|
|
87
|
+
z,
|
|
87
88
|
{
|
|
88
89
|
name: "includeAllEmployees",
|
|
89
90
|
label: i("includeAllEmployeesLabel"),
|
|
90
|
-
onChange:
|
|
91
|
+
onChange: B
|
|
91
92
|
}
|
|
92
93
|
),
|
|
93
|
-
!
|
|
94
|
-
|
|
94
|
+
!k && /* @__PURE__ */ e(
|
|
95
|
+
_,
|
|
95
96
|
{
|
|
96
97
|
name: "selectedEmployeeUuids",
|
|
97
98
|
label: d("sectionTitle"),
|
|
@@ -103,19 +104,19 @@ function me({
|
|
|
103
104
|
] }),
|
|
104
105
|
/* @__PURE__ */ e("hr", { className: s.divider }),
|
|
105
106
|
/* @__PURE__ */ e(o, { flexDirection: "column", gap: 20, children: /* @__PURE__ */ e(
|
|
106
|
-
|
|
107
|
+
K,
|
|
107
108
|
{
|
|
108
109
|
name: "skipRegularDeductions",
|
|
109
110
|
label: t("title"),
|
|
110
111
|
description: t("description"),
|
|
111
|
-
options:
|
|
112
|
+
options: N,
|
|
112
113
|
convertValueToString: (l) => String(l)
|
|
113
114
|
}
|
|
114
115
|
) }),
|
|
115
116
|
/* @__PURE__ */ e("hr", { className: s.divider }),
|
|
116
117
|
/* @__PURE__ */ n(o, { flexDirection: "column", gap: 12, children: [
|
|
117
118
|
/* @__PURE__ */ e(a, { variant: "supporting", children: /* @__PURE__ */ e(
|
|
118
|
-
|
|
119
|
+
L,
|
|
119
120
|
{
|
|
120
121
|
t: i,
|
|
121
122
|
i18nKey: "taxWithholdingDisclaimer",
|
|
@@ -123,27 +124,27 @@ function me({
|
|
|
123
124
|
}
|
|
124
125
|
) }),
|
|
125
126
|
/* @__PURE__ */ e(
|
|
126
|
-
|
|
127
|
+
Y,
|
|
127
128
|
{
|
|
128
|
-
wageTypeGroups:
|
|
129
|
+
wageTypeGroups: F,
|
|
129
130
|
config: h,
|
|
130
|
-
onEditClick:
|
|
131
|
+
onEditClick: S
|
|
131
132
|
}
|
|
132
133
|
),
|
|
133
|
-
|
|
134
|
-
|
|
134
|
+
O && /* @__PURE__ */ e(
|
|
135
|
+
q,
|
|
135
136
|
{
|
|
136
137
|
isOpen: !0,
|
|
137
138
|
defaultConfig: h,
|
|
138
|
-
onDone:
|
|
139
|
-
onCancel:
|
|
139
|
+
onDone: v,
|
|
140
|
+
onCancel: A
|
|
140
141
|
}
|
|
141
142
|
)
|
|
142
143
|
] }),
|
|
143
|
-
/* @__PURE__ */ e(o, { justifyContent: "flex-end", gap: 12, children: /* @__PURE__ */ e(
|
|
144
|
+
/* @__PURE__ */ e(o, { justifyContent: "flex-end", gap: 12, children: /* @__PURE__ */ e(G, { type: "submit", isLoading: f, isDisabled: f || g, children: i("continueCta") }) })
|
|
144
145
|
] });
|
|
145
146
|
}
|
|
146
147
|
export {
|
|
147
|
-
|
|
148
|
+
ue as OffCycleCreationPresentation
|
|
148
149
|
};
|
|
149
150
|
//# sourceMappingURL=OffCycleCreationPresentation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OffCycleCreationPresentation.js","sources":["../../../../src/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.tsx"],"sourcesContent":["import { useCallback, useMemo } from 'react'\nimport { useFormContext } from 'react-hook-form'\nimport { Trans, useTranslation } from 'react-i18next'\nimport { OffCycleReasonSelectionPresentation } from '../OffCycleReasonSelection'\nimport { OffCyclePayPeriodDateFormPresentation } from '../OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation'\nimport { OffCycleTaxWithholdingTable } from '../OffCycleTaxWithholdingTable'\nimport { OffCycleTaxWithholdingModal } from '../OffCycleTaxWithholdingModal'\nimport { PayrollBlockerAlerts } from '../PayrollBlocker/components/PayrollBlockerAlerts'\nimport {\n WAGE_TYPE_CATEGORIES,\n type WageTypeGroup,\n} from '../OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes'\nimport type {\n OffCycleCreationFormData,\n OffCycleCreationPresentationProps,\n} from './OffCycleCreationTypes'\nimport styles from './OffCycleCreationPresentation.module.scss'\nimport { useI18n } from '@/i18n'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Flex, RadioGroupField, SwitchField, MultiSelectComboBoxField } from '@/components/Common'\n\n/** @internal */\nexport function OffCycleCreationPresentation({\n employees,\n blockers,\n isPending,\n minCheckDate,\n minCheckOnlyDate,\n maxDate,\n minPayPeriodDate,\n taxWithholdingConfig,\n isTaxWithholdingModalOpen,\n onTaxWithholdingEditClick,\n onTaxWithholdingModalDone,\n onTaxWithholdingModalCancel,\n className,\n}: OffCycleCreationPresentationProps) {\n useI18n('Payroll.OffCycleCreation')\n useI18n('Payroll.OffCycleDeductionsSetting')\n useI18n('Payroll.EmployeeSelection')\n useI18n('Payroll.OffCycleTaxWithholding')\n const { t } = useTranslation('Payroll.OffCycleCreation')\n const { t: tDeductions } = useTranslation('Payroll.OffCycleDeductionsSetting')\n const { t: tEmployees } = useTranslation('Payroll.EmployeeSelection')\n const { t: tWithholding } = useTranslation('Payroll.OffCycleTaxWithholding')\n const { Heading, Text, Button } = useComponentContext()\n\n const wageTypeGroups: WageTypeGroup[] = useMemo(\n () =>\n WAGE_TYPE_CATEGORIES.map(category => {\n const group: WageTypeGroup = {\n category,\n label: tWithholding(`wageTypeGroups.${category}.label`),\n taxedAsDescription: tWithholding(`wageTypeGroups.${category}.taxedAsDescription`),\n }\n if (category === 'regular' || category === 'supplemental') {\n group.description = tWithholding(`wageTypeGroups.${category}.description`)\n }\n return group\n }),\n [tWithholding],\n )\n\n const { setValue, watch } = useFormContext<OffCycleCreationFormData>()\n const includeAllEmployees = watch('includeAllEmployees')\n\n const handleToggleIncludeAll = useCallback(\n (checked: boolean) => {\n if (checked) {\n setValue('selectedEmployeeUuids', [])\n }\n },\n [setValue],\n )\n\n const deductionsOptions = [\n {\n value: false,\n label: tDeductions('options.include.label'),\n },\n {\n value: true,\n label: tDeductions('options.skip.label'),\n },\n ]\n\n const hasBlockers = blockers.length > 0\n\n return (\n <Flex className={className} flexDirection=\"column\" gap={32}>\n {hasBlockers && <PayrollBlockerAlerts blockers={blockers} />}\n <Flex flexDirection=\"column\" gap={4}>\n <Heading as=\"h2\">{t('pageTitle')}</Heading>\n <Text variant=\"supporting\">{t('pageDescription')}</Text>\n </Flex>\n\n <Flex flexDirection=\"column\" gap={20}>\n <Flex flexDirection=\"column\" gap={4}>\n <Heading as=\"h3\">{t('payPeriodSectionTitle')}</Heading>\n <Text variant=\"supporting\">{t('payPeriodSectionDescription')}</Text>\n </Flex>\n <OffCyclePayPeriodDateFormPresentation\n minCheckDate={minCheckDate}\n minCheckOnlyDate={minCheckOnlyDate}\n maxDate={maxDate}\n minPayPeriodDate={minPayPeriodDate}\n />\n </Flex>\n\n <hr className={styles.divider} />\n\n <Flex flexDirection=\"column\" gap={20}>\n <OffCycleReasonSelectionPresentation name=\"reason\" />\n </Flex>\n\n <hr className={styles.divider} />\n\n <Flex flexDirection=\"column\" gap={12}>\n <Heading as=\"h3\">{tEmployees('sectionTitle')}</Heading>\n <SwitchField\n name=\"includeAllEmployees\"\n label={t('includeAllEmployeesLabel')}\n onChange={handleToggleIncludeAll}\n />\n {!includeAllEmployees && (\n <MultiSelectComboBoxField\n name=\"selectedEmployeeUuids\"\n label={tEmployees('sectionTitle')}\n shouldVisuallyHideLabel\n placeholder={tEmployees('searchPlaceholder')}\n options={employees}\n />\n )}\n </Flex>\n\n <hr className={styles.divider} />\n\n <Flex flexDirection=\"column\" gap={20}>\n <RadioGroupField<boolean>\n name=\"skipRegularDeductions\"\n label={tDeductions('title')}\n description={tDeductions('description')}\n options={deductionsOptions}\n convertValueToString={value => String(value)}\n />\n </Flex>\n\n <hr className={styles.divider} />\n\n <Flex flexDirection=\"column\" gap={12}>\n <Text variant=\"supporting\">\n <Trans\n t={t}\n i18nKey=\"taxWithholdingDisclaimer\"\n components={{ bold: <Text as=\"span\" weight=\"bold\" /> }}\n />\n </Text>\n <OffCycleTaxWithholdingTable\n wageTypeGroups={wageTypeGroups}\n config={taxWithholdingConfig}\n onEditClick={onTaxWithholdingEditClick}\n />\n {isTaxWithholdingModalOpen && (\n <OffCycleTaxWithholdingModal\n isOpen\n defaultConfig={taxWithholdingConfig}\n onDone={onTaxWithholdingModalDone}\n onCancel={onTaxWithholdingModalCancel}\n />\n )}\n </Flex>\n\n <Flex justifyContent=\"flex-end\" gap={12}>\n <Button type=\"submit\" isLoading={isPending} isDisabled={isPending || hasBlockers}>\n {t('continueCta')}\n </Button>\n </Flex>\n </Flex>\n )\n}\n"],"names":["OffCycleCreationPresentation","employees","blockers","isPending","minCheckDate","minCheckOnlyDate","maxDate","minPayPeriodDate","taxWithholdingConfig","isTaxWithholdingModalOpen","onTaxWithholdingEditClick","onTaxWithholdingModalDone","onTaxWithholdingModalCancel","className","useI18n","t","useTranslation","tDeductions","tEmployees","tWithholding","Heading","Text","Button","useComponentContext","wageTypeGroups","useMemo","WAGE_TYPE_CATEGORIES","category","group","setValue","watch","useFormContext","includeAllEmployees","handleToggleIncludeAll","useCallback","checked","deductionsOptions","hasBlockers","Flex","jsx","PayrollBlockerAlerts","jsxs","OffCyclePayPeriodDateFormPresentation","styles","OffCycleReasonSelectionPresentation","SwitchField","MultiSelectComboBoxField","RadioGroupField","value","Trans","OffCycleTaxWithholdingTable","OffCycleTaxWithholdingModal"],"mappings":";;;;;;;;;;;;;;;;;AAsBO,SAASA,GAA6B;AAAA,EAC3C,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,cAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,sBAAAC;AAAA,EACA,2BAAAC;AAAA,EACA,2BAAAC;AAAA,EACA,2BAAAC;AAAA,EACA,6BAAAC;AAAA,EACA,WAAAC;AACF,GAAsC;AACpC,EAAAC,EAAQ,0BAA0B,GAClCA,EAAQ,mCAAmC,GAC3CA,EAAQ,2BAA2B,GACnCA,EAAQ,gCAAgC;AACxC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,0BAA0B,GACjD,EAAEC,MAAmBD,EAAe,mCAAmC,GACvE,EAAE,GAAGE,MAAeF,EAAe,2BAA2B,GAC9D,EAAE,GAAGG,MAAiBH,EAAe,gCAAgC,GACrE,EAAE,SAAAI,GAAS,MAAAC,GAAM,QAAAC,EAAA,IAAWC,EAAA,GAE5BC,IAAkCC;AAAA,IACtC,MACEC,EAAqB,IAAI,CAAAC,MAAY;AACnC,YAAMC,IAAuB;AAAA,QAC3B,UAAAD;AAAA,QACA,OAAO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K;AAAA,QACL,OAAO9B,EAAY,OAAO;AAAA,QAC1B,aAAaA,EAAY,aAAa;AAAA,QACtC,SAASmB;AAAA,QACT,sBAAsB,CAAAY,MAAS,OAAOA,CAAK;AAAA,MAAA;AAAA,IAAA,GAE/C;AAAA,IAEA,gBAAAT,EAAC,MAAA,EAAG,WAAWI,EAAO,QAAA,CAAS;AAAA,IAE/B,gBAAAF,EAACH,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,MAAA,gBAAAC,EAAClB,GAAA,EAAK,SAAQ,cACZ,UAAA,gBAAAkB;AAAA,QAACU;AAAA,QAAA;AAAA,UACC,GAAAlC;AAAA,UACA,SAAQ;AAAA,UACR,YAAY,EAAE,MAAM,gBAAAwB,EAAClB,KAAK,IAAG,QAAO,QAAO,QAAO,EAAA;AAAA,QAAG;AAAA,MAAA,GAEzD;AAAA,MACA,gBAAAkB;AAAA,QAACW;AAAA,QAAA;AAAA,UACC,gBAAA1B;AAAA,UACA,QAAQhB;AAAA,UACR,aAAaE;AAAA,QAAA;AAAA,MAAA;AAAA,MAEdD,KACC,gBAAA8B;AAAA,QAACY;AAAA,QAAA;AAAA,UACC,QAAM;AAAA,UACN,eAAe3C;AAAA,UACf,QAAQG;AAAA,UACR,UAAUC;AAAA,QAAA;AAAA,MAAA;AAAA,IACZ,GAEJ;AAAA,sBAEC0B,GAAA,EAAK,gBAAe,YAAW,KAAK,IACnC,4BAAChB,GAAA,EAAO,MAAK,UAAS,WAAWnB,GAAW,YAAYA,KAAakC,GAClE,UAAAtB,EAAE,aAAa,GAClB,EAAA,CACF;AAAA,EAAA,GACF;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"OffCycleCreationPresentation.js","sources":["../../../../src/components/Payroll/OffCycleCreation/OffCycleCreationPresentation.tsx"],"sourcesContent":["import { useCallback, useMemo } from 'react'\nimport { useFormContext } from 'react-hook-form'\nimport { Trans, useTranslation } from 'react-i18next'\nimport { OffCycleReasonSelectionPresentation } from '../OffCycleReasonSelection'\nimport { OffCyclePayPeriodDateFormPresentation } from '../OffCyclePayPeriodDateForm/OffCyclePayPeriodDateFormPresentation'\nimport { OffCycleTaxWithholdingTable } from '../OffCycleTaxWithholdingTable'\nimport { OffCycleTaxWithholdingModal } from '../OffCycleTaxWithholdingModal'\nimport { PayrollBlockerAlerts } from '../PayrollBlocker/components/PayrollBlockerAlerts'\nimport {\n WAGE_TYPE_CATEGORIES,\n type WageTypeGroup,\n} from '../OffCycleTaxWithholdingTable/OffCycleTaxWithholdingTableTypes'\nimport type {\n OffCycleCreationFormData,\n OffCycleCreationPresentationProps,\n} from './OffCycleCreationTypes'\nimport styles from './OffCycleCreationPresentation.module.scss'\nimport { useI18n } from '@/i18n'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Flex, RadioGroupField, SwitchField, MultiSelectComboBoxField } from '@/components/Common'\n\n/** @internal */\nexport function OffCycleCreationPresentation({\n employees,\n blockers,\n onViewBlockersClick,\n isPending,\n minCheckDate,\n minCheckOnlyDate,\n maxDate,\n minPayPeriodDate,\n taxWithholdingConfig,\n isTaxWithholdingModalOpen,\n onTaxWithholdingEditClick,\n onTaxWithholdingModalDone,\n onTaxWithholdingModalCancel,\n className,\n}: OffCycleCreationPresentationProps) {\n useI18n('Payroll.OffCycleCreation')\n useI18n('Payroll.OffCycleDeductionsSetting')\n useI18n('Payroll.EmployeeSelection')\n useI18n('Payroll.OffCycleTaxWithholding')\n const { t } = useTranslation('Payroll.OffCycleCreation')\n const { t: tDeductions } = useTranslation('Payroll.OffCycleDeductionsSetting')\n const { t: tEmployees } = useTranslation('Payroll.EmployeeSelection')\n const { t: tWithholding } = useTranslation('Payroll.OffCycleTaxWithholding')\n const { Heading, Text, Button } = useComponentContext()\n\n const wageTypeGroups: WageTypeGroup[] = useMemo(\n () =>\n WAGE_TYPE_CATEGORIES.map(category => {\n const group: WageTypeGroup = {\n category,\n label: tWithholding(`wageTypeGroups.${category}.label`),\n taxedAsDescription: tWithholding(`wageTypeGroups.${category}.taxedAsDescription`),\n }\n if (category === 'regular' || category === 'supplemental') {\n group.description = tWithholding(`wageTypeGroups.${category}.description`)\n }\n return group\n }),\n [tWithholding],\n )\n\n const { setValue, watch } = useFormContext<OffCycleCreationFormData>()\n const includeAllEmployees = watch('includeAllEmployees')\n\n const handleToggleIncludeAll = useCallback(\n (checked: boolean) => {\n if (checked) {\n setValue('selectedEmployeeUuids', [])\n }\n },\n [setValue],\n )\n\n const deductionsOptions = [\n {\n value: false,\n label: tDeductions('options.include.label'),\n },\n {\n value: true,\n label: tDeductions('options.skip.label'),\n },\n ]\n\n const hasBlockers = blockers.length > 0\n\n return (\n <Flex className={className} flexDirection=\"column\" gap={32}>\n {hasBlockers && (\n <PayrollBlockerAlerts blockers={blockers} onViewBlockersClick={onViewBlockersClick} />\n )}\n <Flex flexDirection=\"column\" gap={4}>\n <Heading as=\"h2\">{t('pageTitle')}</Heading>\n <Text variant=\"supporting\">{t('pageDescription')}</Text>\n </Flex>\n\n <Flex flexDirection=\"column\" gap={20}>\n <Flex flexDirection=\"column\" gap={4}>\n <Heading as=\"h3\">{t('payPeriodSectionTitle')}</Heading>\n <Text variant=\"supporting\">{t('payPeriodSectionDescription')}</Text>\n </Flex>\n <OffCyclePayPeriodDateFormPresentation\n minCheckDate={minCheckDate}\n minCheckOnlyDate={minCheckOnlyDate}\n maxDate={maxDate}\n minPayPeriodDate={minPayPeriodDate}\n />\n </Flex>\n\n <hr className={styles.divider} />\n\n <Flex flexDirection=\"column\" gap={20}>\n <OffCycleReasonSelectionPresentation name=\"reason\" />\n </Flex>\n\n <hr className={styles.divider} />\n\n <Flex flexDirection=\"column\" gap={12}>\n <Heading as=\"h3\">{tEmployees('sectionTitle')}</Heading>\n <SwitchField\n name=\"includeAllEmployees\"\n label={t('includeAllEmployeesLabel')}\n onChange={handleToggleIncludeAll}\n />\n {!includeAllEmployees && (\n <MultiSelectComboBoxField\n name=\"selectedEmployeeUuids\"\n label={tEmployees('sectionTitle')}\n shouldVisuallyHideLabel\n placeholder={tEmployees('searchPlaceholder')}\n options={employees}\n />\n )}\n </Flex>\n\n <hr className={styles.divider} />\n\n <Flex flexDirection=\"column\" gap={20}>\n <RadioGroupField<boolean>\n name=\"skipRegularDeductions\"\n label={tDeductions('title')}\n description={tDeductions('description')}\n options={deductionsOptions}\n convertValueToString={value => String(value)}\n />\n </Flex>\n\n <hr className={styles.divider} />\n\n <Flex flexDirection=\"column\" gap={12}>\n <Text variant=\"supporting\">\n <Trans\n t={t}\n i18nKey=\"taxWithholdingDisclaimer\"\n components={{ bold: <Text as=\"span\" weight=\"bold\" /> }}\n />\n </Text>\n <OffCycleTaxWithholdingTable\n wageTypeGroups={wageTypeGroups}\n config={taxWithholdingConfig}\n onEditClick={onTaxWithholdingEditClick}\n />\n {isTaxWithholdingModalOpen && (\n <OffCycleTaxWithholdingModal\n isOpen\n defaultConfig={taxWithholdingConfig}\n onDone={onTaxWithholdingModalDone}\n onCancel={onTaxWithholdingModalCancel}\n />\n )}\n </Flex>\n\n <Flex justifyContent=\"flex-end\" gap={12}>\n <Button type=\"submit\" isLoading={isPending} isDisabled={isPending || hasBlockers}>\n {t('continueCta')}\n </Button>\n </Flex>\n </Flex>\n )\n}\n"],"names":["OffCycleCreationPresentation","employees","blockers","onViewBlockersClick","isPending","minCheckDate","minCheckOnlyDate","maxDate","minPayPeriodDate","taxWithholdingConfig","isTaxWithholdingModalOpen","onTaxWithholdingEditClick","onTaxWithholdingModalDone","onTaxWithholdingModalCancel","className","useI18n","t","useTranslation","tDeductions","tEmployees","tWithholding","Heading","Text","Button","useComponentContext","wageTypeGroups","useMemo","WAGE_TYPE_CATEGORIES","category","group","setValue","watch","useFormContext","includeAllEmployees","handleToggleIncludeAll","useCallback","checked","deductionsOptions","hasBlockers","Flex","jsx","PayrollBlockerAlerts","jsxs","OffCyclePayPeriodDateFormPresentation","styles","OffCycleReasonSelectionPresentation","SwitchField","MultiSelectComboBoxField","RadioGroupField","value","Trans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A,UACC,GAAAlC;AAAA,UACA,SAAQ;AAAA,UACR,YAAY,EAAE,MAAM,gBAAAwB,EAAClB,KAAK,IAAG,QAAO,QAAO,QAAO,EAAA;AAAA,QAAG;AAAA,MAAA,GAEzD;AAAA,MACA,gBAAAkB;AAAA,QAACW;AAAA,QAAA;AAAA,UACC,gBAAA1B;AAAA,UACA,QAAQhB;AAAA,UACR,aAAaE;AAAA,QAAA;AAAA,MAAA;AAAA,MAEdD,KACC,gBAAA8B;AAAA,QAACY;AAAA,QAAA;AAAA,UACC,QAAM;AAAA,UACN,eAAe3C;AAAA,UACf,QAAQG;AAAA,UACR,UAAUC;AAAA,QAAA;AAAA,MAAA;AAAA,IACZ,GAEJ;AAAA,sBAEC0B,GAAA,EAAK,gBAAe,YAAW,KAAK,IACnC,4BAAChB,GAAA,EAAO,MAAK,UAAS,WAAWnB,GAAW,YAAYA,KAAakC,GAClE,UAAAtB,EAAE,aAAa,GAClB,EAAA,CACF;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -1,48 +1,48 @@
|
|
|
1
1
|
import { jsx as e, jsxs as f } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation as A } from "react-i18next";
|
|
3
|
-
import { hasActionableBlockers as K, getBlockerTranslationKeys as P, isActionableBlocker as
|
|
4
|
-
import { useComponentContext as
|
|
3
|
+
import { hasActionableBlockers as K, getBlockerTranslationKeys as P, isActionableBlocker as C } from "../payrollHelpers.js";
|
|
4
|
+
import { useComponentContext as D } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
5
5
|
import { Flex as B } from "../../../Common/Flex/Flex.js";
|
|
6
6
|
import { useI18n as I } from "../../../../i18n/I18n.js";
|
|
7
7
|
function H({
|
|
8
|
-
blockers:
|
|
8
|
+
blockers: n,
|
|
9
9
|
onViewBlockersClick: i,
|
|
10
10
|
viewBlockersLabel: y,
|
|
11
11
|
className: a
|
|
12
12
|
}) {
|
|
13
13
|
I("Payroll.PayrollBlocker");
|
|
14
|
-
const { t } = A("Payroll.PayrollBlocker"), { Alert: d, Button: p, Text: u, UnorderedList: x } =
|
|
15
|
-
if (
|
|
14
|
+
const { t } = A("Payroll.PayrollBlocker"), { Alert: d, Button: p, Text: u, UnorderedList: x } = D();
|
|
15
|
+
if (n.length === 0)
|
|
16
16
|
return null;
|
|
17
|
-
const s =
|
|
17
|
+
const s = n.length > 1, h = !!i && (s || K(n)), m = n.map((r) => {
|
|
18
18
|
const c = P(r.key), T = t(c.titleKey, {
|
|
19
|
-
defaultValue: t("
|
|
19
|
+
defaultValue: t("genericBlockerTitle")
|
|
20
20
|
}), k = t(c.descriptionKey, {
|
|
21
21
|
defaultValue: r.message || t("defaultBlockerDescription")
|
|
22
|
-
}), v =
|
|
22
|
+
}), v = C(r.key) ? void 0 : t(c.helpTextKey, { defaultValue: t("defaultBlockerHelp") });
|
|
23
23
|
return {
|
|
24
24
|
...r,
|
|
25
25
|
title: T,
|
|
26
26
|
description: k,
|
|
27
27
|
helpText: v
|
|
28
28
|
};
|
|
29
|
-
}),
|
|
29
|
+
}), o = y || t(s ? "viewAllBlockers" : "viewBlocker"), l = m[0];
|
|
30
30
|
if (!s && l)
|
|
31
31
|
return /* @__PURE__ */ e(d, { status: "error", label: l.title, className: a, children: /* @__PURE__ */ f(B, { flexDirection: "column", gap: 8, children: [
|
|
32
32
|
/* @__PURE__ */ e(u, { children: l.description }),
|
|
33
33
|
l.helpText && l.helpText !== l.description && /* @__PURE__ */ e(u, { variant: "supporting", size: "sm", children: l.helpText }),
|
|
34
|
-
h && /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(p, { variant: "secondary", onClick: i, title:
|
|
34
|
+
h && /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(p, { variant: "secondary", onClick: i, title: o, children: o }) })
|
|
35
35
|
] }) });
|
|
36
36
|
const g = m.map((r) => r.title);
|
|
37
37
|
return /* @__PURE__ */ e(
|
|
38
38
|
d,
|
|
39
39
|
{
|
|
40
40
|
status: "error",
|
|
41
|
-
label: t("multipleIssuesTitle", { count:
|
|
41
|
+
label: t("multipleIssuesTitle", { count: n.length }),
|
|
42
42
|
className: a,
|
|
43
43
|
children: /* @__PURE__ */ f(B, { flexDirection: "column", gap: 16, children: [
|
|
44
44
|
/* @__PURE__ */ e(x, { items: g }),
|
|
45
|
-
h && /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(p, { variant: "secondary", onClick: i, title:
|
|
45
|
+
h && /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(p, { variant: "secondary", onClick: i, title: o, children: o }) })
|
|
46
46
|
] })
|
|
47
47
|
}
|
|
48
48
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayrollBlockerAlerts.js","sources":["../../../../../src/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport {\n type ApiPayrollBlocker,\n getBlockerTranslationKeys,\n hasActionableBlockers,\n isActionableBlocker,\n} from '../payrollHelpers'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Flex } from '@/components/Common'\nimport { useI18n } from '@/i18n'\n\ninterface PayrollBlockerAlertsProps {\n blockers: ApiPayrollBlocker[]\n className?: string\n onViewBlockersClick?: () => void\n viewBlockersLabel?: string\n}\n\n/**\n * @internal\n */\nexport function PayrollBlockerAlerts({\n blockers,\n onViewBlockersClick,\n viewBlockersLabel,\n className,\n}: PayrollBlockerAlertsProps) {\n useI18n('Payroll.PayrollBlocker')\n const { t } = useTranslation('Payroll.PayrollBlocker')\n const { Alert, Button, Text, UnorderedList } = useComponentContext()\n\n if (blockers.length === 0) {\n return null\n }\n\n const hasMultipleBlockers = blockers.length > 1\n const showViewBlockersCta =\n Boolean(onViewBlockersClick) && (hasMultipleBlockers || hasActionableBlockers(blockers))\n\n const enrichedBlockers = blockers.map(blocker => {\n const translationKeys = getBlockerTranslationKeys(blocker.key)\n\n const title = t(translationKeys.titleKey, {\n defaultValue: t('
|
|
1
|
+
{"version":3,"file":"PayrollBlockerAlerts.js","sources":["../../../../../src/components/Payroll/PayrollBlocker/components/PayrollBlockerAlerts.tsx"],"sourcesContent":["import { useTranslation } from 'react-i18next'\nimport {\n type ApiPayrollBlocker,\n getBlockerTranslationKeys,\n hasActionableBlockers,\n isActionableBlocker,\n} from '../payrollHelpers'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Flex } from '@/components/Common'\nimport { useI18n } from '@/i18n'\n\ninterface PayrollBlockerAlertsProps {\n blockers: ApiPayrollBlocker[]\n className?: string\n onViewBlockersClick?: () => void\n viewBlockersLabel?: string\n}\n\n/**\n * @internal\n */\nexport function PayrollBlockerAlerts({\n blockers,\n onViewBlockersClick,\n viewBlockersLabel,\n className,\n}: PayrollBlockerAlertsProps) {\n useI18n('Payroll.PayrollBlocker')\n const { t } = useTranslation('Payroll.PayrollBlocker')\n const { Alert, Button, Text, UnorderedList } = useComponentContext()\n\n if (blockers.length === 0) {\n return null\n }\n\n const hasMultipleBlockers = blockers.length > 1\n const showViewBlockersCta =\n Boolean(onViewBlockersClick) && (hasMultipleBlockers || hasActionableBlockers(blockers))\n\n const enrichedBlockers = blockers.map(blocker => {\n const translationKeys = getBlockerTranslationKeys(blocker.key)\n\n const title = t(translationKeys.titleKey, {\n defaultValue: t('genericBlockerTitle'),\n })\n const description = t(translationKeys.descriptionKey, {\n defaultValue: blocker.message || t('defaultBlockerDescription'),\n })\n const helpText = isActionableBlocker(blocker.key)\n ? undefined\n : t(translationKeys.helpTextKey, { defaultValue: t('defaultBlockerHelp') })\n\n return {\n ...blocker,\n title,\n description,\n helpText,\n }\n })\n\n const ctaLabel = viewBlockersLabel || t(hasMultipleBlockers ? 'viewAllBlockers' : 'viewBlocker')\n\n const singleBlocker = enrichedBlockers[0]\n\n if (!hasMultipleBlockers && singleBlocker) {\n return (\n <Alert status=\"error\" label={singleBlocker.title} className={className}>\n <Flex flexDirection=\"column\" gap={8}>\n <Text>{singleBlocker.description}</Text>\n {singleBlocker.helpText && singleBlocker.helpText !== singleBlocker.description && (\n <Text variant=\"supporting\" size=\"sm\">\n {singleBlocker.helpText}\n </Text>\n )}\n {showViewBlockersCta && (\n <div>\n <Button variant=\"secondary\" onClick={onViewBlockersClick} title={ctaLabel}>\n {ctaLabel}\n </Button>\n </div>\n )}\n </Flex>\n </Alert>\n )\n }\n\n const listItems = enrichedBlockers.map(blocker => blocker.title)\n\n return (\n <Alert\n status=\"error\"\n label={t('multipleIssuesTitle', { count: blockers.length })}\n className={className}\n >\n <Flex flexDirection=\"column\" gap={16}>\n <UnorderedList items={listItems} />\n {showViewBlockersCta && (\n <div>\n <Button variant=\"secondary\" onClick={onViewBlockersClick} title={ctaLabel}>\n {ctaLabel}\n </Button>\n </div>\n )}\n </Flex>\n </Alert>\n )\n}\n"],"names":["PayrollBlockerAlerts","blockers","onViewBlockersClick","viewBlockersLabel","className","useI18n","useTranslation","Alert","Button","Text","UnorderedList","useComponentContext","hasMultipleBlockers","showViewBlockersCta","hasActionableBlockers","enrichedBlockers","blocker","translationKeys","getBlockerTranslationKeys","title","description","helpText","isActionableBlocker","ctaLabel","singleBlocker","jsx","jsxs","Flex","listItems"],"mappings":";;;;;;AAqBO,SAASA,EAAqB;AAAA,EACnC,UAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,WAAAC;AACF,GAA8B;AAC5B,EAAAC,EAAQ,wBAAwB;AAChC,QAAM,EAAE,EAAA,IAAMC,EAAe,wBAAwB,GAC/C,EAAE,OAAAC,GAAO,QAAAC,GAAQ,MAAAC,GAAM,eAAAC,EAAA,IAAkBC,EAAA;AAE/C,MAAIV,EAAS,WAAW;AACtB,WAAO;AAGT,QAAMW,IAAsBX,EAAS,SAAS,GACxCY,IACJ,EAAQX,MAAyBU,KAAuBE,EAAsBb,CAAQ,IAElFc,IAAmBd,EAAS,IAAI,CAAAe,MAAW;AAC/C,UAAMC,IAAkBC,EAA0BF,EAAQ,GAAG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AEA,UAAA,gBAAAsB,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,QAAA,gBAAAF,EAACf,GAAA,EAAc,OAAOkB,EAAA,CAAW;AAAA,QAChCf,KACC,gBAAAY,EAAC,OAAA,EACC,UAAA,gBAAAA,EAACjB,GAAA,EAAO,SAAQ,aAAY,SAASN,GAAqB,OAAOqB,GAC9D,UAAAA,EAAA,CACH,EAAA,CACF;AAAA,MAAA,EAAA,CAEJ;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import { jsx as o, jsxs as m } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
3
|
-
import { useTranslation as
|
|
4
|
-
import
|
|
5
|
-
import { usePayrollsGetBlockersSuspense as
|
|
2
|
+
import { useState as N, useCallback as d } from "react";
|
|
3
|
+
import { useTranslation as O } from "react-i18next";
|
|
4
|
+
import C from "classnames";
|
|
5
|
+
import { usePayrollsGetBlockersSuspense as U } from "@gusto/embedded-api/react-query/payrollsGetBlockers";
|
|
6
6
|
import { useRecoveryCasesGetSuspense as V } from "@gusto/embedded-api/react-query/recoveryCasesGet";
|
|
7
|
-
import { useInformationRequestsGetInformationRequestsSuspense as
|
|
8
|
-
import { InformationRequestStatus as
|
|
9
|
-
import { getBlockerTranslationKeys as
|
|
10
|
-
import
|
|
11
|
-
import { useComponentContext as
|
|
12
|
-
import { FlexItem as
|
|
13
|
-
import { DataView as
|
|
14
|
-
import { useDataView as
|
|
15
|
-
import { useComponentDictionary as
|
|
16
|
-
import { RecoveryCases as
|
|
17
|
-
import { BaseComponent as
|
|
7
|
+
import { useInformationRequestsGetInformationRequestsSuspense as _ } from "@gusto/embedded-api/react-query/informationRequestsGetInformationRequests";
|
|
8
|
+
import { InformationRequestStatus as F } from "@gusto/embedded-api/models/components/informationrequest";
|
|
9
|
+
import { getBlockerTranslationKeys as K } from "../payrollHelpers.js";
|
|
10
|
+
import B from "./PayrollBlockerList.module.scss.js";
|
|
11
|
+
import { useComponentContext as G } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
12
|
+
import { FlexItem as M, Flex as a } from "../../../Common/Flex/Flex.js";
|
|
13
|
+
import { DataView as j } from "../../../Common/DataView/DataView.js";
|
|
14
|
+
import { useDataView as $ } from "../../../Common/DataView/useDataView.js";
|
|
15
|
+
import { useComponentDictionary as H, useI18n as Q } from "../../../../i18n/I18n.js";
|
|
16
|
+
import { RecoveryCases as Y } from "../../RecoveryCases/RecoveryCases.js";
|
|
17
|
+
import { BaseComponent as z } from "../../../Base/Base.js";
|
|
18
18
|
import "../../../Base/useBase.js";
|
|
19
|
-
import { recoveryCasesEvents as
|
|
20
|
-
import { InformationRequestsFlow as
|
|
21
|
-
function
|
|
22
|
-
return /* @__PURE__ */ o(
|
|
19
|
+
import { recoveryCasesEvents as J, informationRequestEvents as W } from "../../../../shared/constants.js";
|
|
20
|
+
import { InformationRequestsFlow as X } from "../../../InformationRequests/InformationRequests.js";
|
|
21
|
+
function De(s) {
|
|
22
|
+
return /* @__PURE__ */ o(z, { ...s, children: /* @__PURE__ */ o(Z, { ...s, children: s.children }) });
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
const { t: r } =
|
|
24
|
+
function Z({ className: s, companyId: n, dictionary: v, onEvent: u }) {
|
|
25
|
+
H("Payroll.PayrollBlocker", v), Q("Payroll.PayrollBlocker");
|
|
26
|
+
const { t: r } = O("Payroll.PayrollBlocker"), { Button: D, Text: i, Heading: b, Alert: g } = G(), [x, f] = N({
|
|
27
27
|
id: 0,
|
|
28
28
|
alerts: []
|
|
29
29
|
}), E = d((e) => {
|
|
@@ -38,36 +38,36 @@ function ee({ className: s, companyId: n, dictionary: B, onEvent: u }) {
|
|
|
38
38
|
}));
|
|
39
39
|
}, []), p = d(
|
|
40
40
|
(e, t) => {
|
|
41
|
-
e ===
|
|
41
|
+
e === J.RECOVERY_CASE_RESUBMIT_DONE && c("recoveryCaseResubmitted"), e === W.INFORMATION_REQUEST_FORM_DONE && c("informationRequestResponded"), u(e, t);
|
|
42
42
|
},
|
|
43
43
|
[u, c]
|
|
44
|
-
), { data: A } =
|
|
44
|
+
), { data: A } = U({
|
|
45
45
|
companyUuid: n
|
|
46
46
|
}), { data: S } = V({
|
|
47
47
|
companyUuid: n
|
|
48
|
-
}), { data: q } =
|
|
48
|
+
}), { data: q } = _({
|
|
49
49
|
companyUuid: n
|
|
50
50
|
}), y = (A.payrollBlockers ?? []).map((e) => {
|
|
51
|
-
const t = e.key, l =
|
|
52
|
-
defaultValue:
|
|
53
|
-
}),
|
|
51
|
+
const t = e.key, l = K(t), I = r(l.titleKey, {
|
|
52
|
+
defaultValue: r("genericBlockerTitle")
|
|
53
|
+
}), L = r(l.descriptionKey, {
|
|
54
54
|
defaultValue: e.message || r("defaultBlockerDescription")
|
|
55
55
|
});
|
|
56
56
|
return {
|
|
57
57
|
id: t,
|
|
58
58
|
title: I,
|
|
59
|
-
description:
|
|
59
|
+
description: L
|
|
60
60
|
};
|
|
61
|
-
}), P = S.recoveryCases ?? [],
|
|
61
|
+
}), P = S.recoveryCases ?? [], T = q.informationRequests ?? [], h = P.some(
|
|
62
62
|
(e) => e.status !== "recovered"
|
|
63
|
-
),
|
|
64
|
-
(e) => e.status !==
|
|
65
|
-
),
|
|
63
|
+
), k = T.some(
|
|
64
|
+
(e) => e.status !== F.Approved
|
|
65
|
+
), w = $({
|
|
66
66
|
data: y,
|
|
67
67
|
columns: [
|
|
68
68
|
{
|
|
69
69
|
title: r("blockerSectionLabel"),
|
|
70
|
-
render: (e) => /* @__PURE__ */ o(
|
|
70
|
+
render: (e) => /* @__PURE__ */ o(M, { flexGrow: 1, children: /* @__PURE__ */ m(a, { flexDirection: "column", gap: 8, children: [
|
|
71
71
|
/* @__PURE__ */ o(i, { weight: "semibold", children: e.title }),
|
|
72
72
|
/* @__PURE__ */ o(i, { variant: "supporting", children: e.description })
|
|
73
73
|
] }) })
|
|
@@ -81,7 +81,7 @@ function ee({ className: s, companyId: n, dictionary: B, onEvent: u }) {
|
|
|
81
81
|
}
|
|
82
82
|
]
|
|
83
83
|
}), R = y.length > 0;
|
|
84
|
-
return R || h ||
|
|
84
|
+
return R || h || k ? /* @__PURE__ */ o("div", { className: C(B.root, s), children: /* @__PURE__ */ m(a, { flexDirection: "column", gap: 32, children: [
|
|
85
85
|
x.alerts.map((e) => /* @__PURE__ */ o(
|
|
86
86
|
g,
|
|
87
87
|
{
|
|
@@ -96,13 +96,13 @@ function ee({ className: s, companyId: n, dictionary: B, onEvent: u }) {
|
|
|
96
96
|
)),
|
|
97
97
|
R && /* @__PURE__ */ m(a, { flexDirection: "column", gap: 20, children: [
|
|
98
98
|
/* @__PURE__ */ o(b, { as: "h2", styledAs: "h4", children: r("blockersListTitle") }),
|
|
99
|
-
/* @__PURE__ */ o(
|
|
99
|
+
/* @__PURE__ */ o(j, { ...w, label: r("blockersListTitle") })
|
|
100
100
|
] }),
|
|
101
|
-
h && /* @__PURE__ */ o(
|
|
102
|
-
|
|
103
|
-
] }) }) : /* @__PURE__ */ o("div", { className:
|
|
101
|
+
h && /* @__PURE__ */ o(Y, { companyId: n, onEvent: p }),
|
|
102
|
+
k && /* @__PURE__ */ o(X, { companyId: n, withAlert: !1, onEvent: p })
|
|
103
|
+
] }) }) : /* @__PURE__ */ o("div", { className: C(B.root, s), children: /* @__PURE__ */ o(i, { children: r("noBlockersMessage") }) });
|
|
104
104
|
}
|
|
105
105
|
export {
|
|
106
|
-
|
|
106
|
+
De as PayrollBlockerList
|
|
107
107
|
};
|
|
108
108
|
//# sourceMappingURL=PayrollBlockerList.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayrollBlockerList.js","sources":["../../../../../src/components/Payroll/PayrollBlocker/components/PayrollBlockerList.tsx"],"sourcesContent":["import { useState, useCallback } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport classNames from 'classnames'\nimport { usePayrollsGetBlockersSuspense } from '@gusto/embedded-api/react-query/payrollsGetBlockers'\nimport { useRecoveryCasesGetSuspense } from '@gusto/embedded-api/react-query/recoveryCasesGet'\nimport { useInformationRequestsGetInformationRequestsSuspense } from '@gusto/embedded-api/react-query/informationRequestsGetInformationRequests'\nimport { InformationRequestStatus } from '@gusto/embedded-api/models/components/informationrequest'\nimport { getBlockerTranslationKeys } from '../payrollHelpers'\nimport styles from './PayrollBlockerList.module.scss'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Flex, FlexItem } from '@/components/Common'\nimport { DataView } from '@/components/Common/DataView/DataView'\nimport { useDataView } from '@/components/Common/DataView/useDataView'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { RecoveryCases } from '@/components/Payroll/RecoveryCases'\nimport { InformationRequestsFlow } from '@/components/InformationRequests'\nimport { BaseComponent, type BaseComponentInterface } from '@/components/Base'\nimport { informationRequestEvents, recoveryCasesEvents, type EventType } from '@/shared/constants'\n\ntype ResponseAlertType = 'recoveryCaseResubmitted' | 'informationRequestResponded'\n\ninterface ResponseAlert {\n id: number\n type: ResponseAlertType\n}\n\ninterface ResponseAlertState {\n id: number\n alerts: ResponseAlert[]\n}\n\ninterface PayrollBlocker {\n id: string\n title: string\n description: string\n action?: {\n label: string\n onClick: () => void\n }\n}\n\n/**\n * Props for {@link PayrollBlockerList}.\n *\n * @public\n */\nexport interface PayrollBlockerListProps extends BaseComponentInterface<'Payroll.PayrollBlocker'> {\n /** The associated company identifier. */\n companyId: string\n}\n\n/**\n * Displays the list of blockers preventing payroll from being processed for a company.\n *\n * @remarks\n * Blockers indicate issues that must be resolved before a payroll can be calculated or\n * submitted, such as missing employee information, invalid tax setups, or incomplete\n * company configuration. The component also renders open recovery cases and outstanding\n * information requests for the company when present, and re-emits any events those\n * embedded surfaces fire through `onEvent`.\n *\n * @param props - {@link PayrollBlockerListProps}\n * @returns The rendered blocker list.\n * @public\n */\nexport function PayrollBlockerList(props: PayrollBlockerListProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ className, companyId, dictionary, onEvent }: PayrollBlockerListProps) {\n useComponentDictionary('Payroll.PayrollBlocker', dictionary)\n useI18n('Payroll.PayrollBlocker')\n const { t } = useTranslation('Payroll.PayrollBlocker')\n const { Button, Text, Heading, Alert } = useComponentContext()\n\n const [alertState, setAlertState] = useState<ResponseAlertState>({\n id: 0,\n alerts: [],\n })\n\n const handleDismissAlert = useCallback((alertId: number) => {\n setAlertState(prev => ({\n ...prev,\n alerts: prev.alerts.filter(alert => alert.id !== alertId),\n }))\n }, [])\n\n const addAlert = useCallback((alertType: ResponseAlertType) => {\n setAlertState(prev => ({\n id: prev.id + 1,\n alerts: [{ id: prev.id, type: alertType }, ...prev.alerts],\n }))\n }, [])\n\n const handleEvent = useCallback(\n (type: EventType, data?: unknown) => {\n if (type === recoveryCasesEvents.RECOVERY_CASE_RESUBMIT_DONE) {\n addAlert('recoveryCaseResubmitted')\n }\n\n if (type === informationRequestEvents.INFORMATION_REQUEST_FORM_DONE) {\n addAlert('informationRequestResponded')\n }\n\n onEvent(type, data)\n },\n [onEvent, addAlert],\n )\n\n const { data: blockersData } = usePayrollsGetBlockersSuspense({\n companyUuid: companyId,\n })\n\n const { data: recoveryCasesData } = useRecoveryCasesGetSuspense({\n companyUuid: companyId,\n })\n\n const { data: informationRequestsData } = useInformationRequestsGetInformationRequestsSuspense({\n companyUuid: companyId,\n })\n\n const payrollBlockerList = blockersData.payrollBlockers ?? []\n const blockers: PayrollBlocker[] = payrollBlockerList.map(blocker => {\n const blockerKey = blocker.key\n const translationKeys = getBlockerTranslationKeys(blockerKey)\n\n const title = t(translationKeys.titleKey, {\n defaultValue: blockerKey\n .replace(/_/g, ' ')\n .replace(/\\b\\w/g, (letter: string) => letter.toUpperCase()),\n })\n\n const description = t(translationKeys.descriptionKey, {\n defaultValue: blocker.message || t('defaultBlockerDescription'),\n })\n\n return {\n id: blockerKey,\n title,\n description,\n }\n })\n\n const recoveryCases = recoveryCasesData.recoveryCases ?? []\n const informationRequests = informationRequestsData.informationRequests ?? []\n\n const hasUnrecoveredCases = recoveryCases.some(\n recoveryCase => recoveryCase.status !== 'recovered',\n )\n\n const hasInformationRequests = informationRequests.some(\n request => request.status !== InformationRequestStatus.Approved,\n )\n\n const dataViewProps = useDataView({\n data: blockers,\n columns: [\n {\n title: t('blockerSectionLabel'),\n render: blocker => (\n <FlexItem flexGrow={1}>\n <Flex flexDirection=\"column\" gap={8}>\n <Text weight=\"semibold\">{blocker.title}</Text>\n <Text variant=\"supporting\">{blocker.description}</Text>\n </Flex>\n </FlexItem>\n ),\n },\n {\n title: '',\n render: blocker => {\n const action = blocker.action\n\n if (!action) {\n return null\n }\n\n return (\n <Flex justifyContent=\"flex-end\" alignItems=\"center\">\n <Button variant=\"secondary\" onClick={action.onClick} title={action.label}>\n {action.label}\n </Button>\n </Flex>\n )\n },\n },\n ],\n })\n\n const hasBlockers = blockers.length > 0\n const hasAnyContent = hasBlockers || hasUnrecoveredCases || hasInformationRequests\n\n if (!hasAnyContent) {\n return (\n <div className={classNames(styles.root, className)}>\n <Text>{t('noBlockersMessage')}</Text>\n </div>\n )\n }\n\n return (\n <div className={classNames(styles.root, className)}>\n <Flex flexDirection=\"column\" gap={32}>\n {alertState.alerts.map(alert => (\n <Alert\n key={alert.id}\n status=\"success\"\n label={t(`alerts.${alert.type}.title`)}\n onDismiss={() => {\n handleDismissAlert(alert.id)\n }}\n >\n <Text>{t(`alerts.${alert.type}.description`)}</Text>\n </Alert>\n ))}\n\n {hasBlockers && (\n <Flex flexDirection=\"column\" gap={20}>\n <Heading as=\"h2\" styledAs=\"h4\">\n {t('blockersListTitle')}\n </Heading>\n <DataView {...dataViewProps} label={t('blockersListTitle')} />\n </Flex>\n )}\n\n {hasUnrecoveredCases && <RecoveryCases companyId={companyId} onEvent={handleEvent} />}\n\n {hasInformationRequests && (\n <InformationRequestsFlow companyId={companyId} withAlert={false} onEvent={handleEvent} />\n )}\n </Flex>\n </div>\n )\n}\n"],"names":["PayrollBlockerList","props","jsx","BaseComponent","Root","className","companyId","dictionary","onEvent","useComponentDictionary","useI18n","t","useTranslation","Button","Text","Heading","Alert","useComponentContext","alertState","setAlertState","useState","handleDismissAlert","useCallback","alertId","prev","alert","addAlert","alertType","handleEvent","type","data","recoveryCasesEvents","informationRequestEvents","blockersData","usePayrollsGetBlockersSuspense","recoveryCasesData","useRecoveryCasesGetSuspense","informationRequestsData","useInformationRequestsGetInformationRequestsSuspense","blockers","blocker","blockerKey","translationKeys","getBlockerTranslationKeys","title","letter","description","recoveryCases","informationRequests","hasUnrecoveredCases","recoveryCase","hasInformationRequests","request","InformationRequestStatus","dataViewProps","useDataView","FlexItem","jsxs","Flex","action","hasBlockers","classNames","styles","DataView","RecoveryCases","InformationRequestsFlow"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiEO,SAASA,GAAmBC,GAAgC;AACjE,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,MAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,SAASG,GAAK,EAAE,WAAAC,GAAW,WAAAC,GAAW,YAAAC,GAAY,SAAAC,KAAoC;AACpF,EAAAC,EAAuB,0BAA0BF,CAAU,GAC3DG,EAAQ,wBAAwB;AAChC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,wBAAwB,GAC/C,EAAE,QAAAC,GAAQ,MAAAC,GAAM,SAAAC,GAAS,OAAAC,EAAA,IAAUC,EAAA,GAEnC,CAACC,GAAYC,CAAa,IAAIC,EAA6B;AAAA,IAC/D,IAAI;AAAA,IACJ,QAAQ,CAAA;AAAA,EAAC,CACV,GAEKC,IAAqBC,EAAY,CAACC,MAAoB;AAC1D,IAAAJ,EAAc,CAAAK,OAAS;AAAA,MACrB,GAAGA;AAAA,MACH,QAAQA,EAAK,OAAO,OAAO,CAAAC,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IAAI,CAAAO,MACrB,gBAAAvB;AAAA,MAACc;AAAA,MAAA;AAAA,QAEC,QAAO;AAAA,QACP,OAAOL,EAAE,UAAUc,EAAM,IAAI,QAAQ;AAAA,QACrC,WAAW,MAAM;AACf,UAAAJ,EAAmBI,EAAM,EAAE;AAAA,QAC7B;AAAA,QAEA,4BAACX,GAAA,EAAM,UAAAH,EAAE,UAAUc,EAAM,IAAI,cAAc,EAAA,CAAE;AAAA,MAAA;AAAA,MAPxCA,EAAM;AAAA,IAAA,CASd;AAAA,IAEAmC,KACC,gBAAAH,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,MAAA,gBAAAxD,EAACa,KAAQ,IAAG,MAAK,UAAS,MACvB,UAAAJ,EAAE,mBAAmB,GACxB;AAAA,wBACCoD,GAAA,EAAU,GAAGT,GAAe,OAAO3C,EAAE,mBAAmB,EAAA,CAAG;AAAA,IAAA,GAC9D;AAAA,IAGDsC,KAAuB,gBAAA/C,EAAC8D,GAAA,EAAc,WAAA1D,GAAsB,SAASsB,GAAa;AAAA,IAElFuB,KACC,gBAAAjD,EAAC+D,GAAA,EAAwB,WAAA3D,GAAsB,WAAW,IAAO,SAASsB,EAAA,CAAa;AAAA,EAAA,EAAA,CAE3F,EAAA,CACF,IArCE,gBAAA1B,EAAC,OAAA,EAAI,WAAW2D,EAAWC,EAAO,MAAMzD,CAAS,GAC/C,UAAA,gBAAAH,EAACY,GAAA,EAAM,UAAAH,EAAE,mBAAmB,GAAE,GAChC;AAqCN;"}
|
|
1
|
+
{"version":3,"file":"PayrollBlockerList.js","sources":["../../../../../src/components/Payroll/PayrollBlocker/components/PayrollBlockerList.tsx"],"sourcesContent":["import { useState, useCallback } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport classNames from 'classnames'\nimport { usePayrollsGetBlockersSuspense } from '@gusto/embedded-api/react-query/payrollsGetBlockers'\nimport { useRecoveryCasesGetSuspense } from '@gusto/embedded-api/react-query/recoveryCasesGet'\nimport { useInformationRequestsGetInformationRequestsSuspense } from '@gusto/embedded-api/react-query/informationRequestsGetInformationRequests'\nimport { InformationRequestStatus } from '@gusto/embedded-api/models/components/informationrequest'\nimport { getBlockerTranslationKeys } from '../payrollHelpers'\nimport styles from './PayrollBlockerList.module.scss'\nimport { useComponentContext } from '@/contexts/ComponentAdapter/useComponentContext'\nimport { Flex, FlexItem } from '@/components/Common'\nimport { DataView } from '@/components/Common/DataView/DataView'\nimport { useDataView } from '@/components/Common/DataView/useDataView'\nimport { useComponentDictionary, useI18n } from '@/i18n'\nimport { RecoveryCases } from '@/components/Payroll/RecoveryCases'\nimport { InformationRequestsFlow } from '@/components/InformationRequests'\nimport { BaseComponent, type BaseComponentInterface } from '@/components/Base'\nimport { informationRequestEvents, recoveryCasesEvents, type EventType } from '@/shared/constants'\n\ntype ResponseAlertType = 'recoveryCaseResubmitted' | 'informationRequestResponded'\n\ninterface ResponseAlert {\n id: number\n type: ResponseAlertType\n}\n\ninterface ResponseAlertState {\n id: number\n alerts: ResponseAlert[]\n}\n\ninterface PayrollBlocker {\n id: string\n title: string\n description: string\n action?: {\n label: string\n onClick: () => void\n }\n}\n\n/**\n * Props for {@link PayrollBlockerList}.\n *\n * @public\n */\nexport interface PayrollBlockerListProps extends BaseComponentInterface<'Payroll.PayrollBlocker'> {\n /** The associated company identifier. */\n companyId: string\n}\n\n/**\n * Displays the list of blockers preventing payroll from being processed for a company.\n *\n * @remarks\n * Blockers indicate issues that must be resolved before a payroll can be calculated or\n * submitted, such as missing employee information, invalid tax setups, or incomplete\n * company configuration. The component also renders open recovery cases and outstanding\n * information requests for the company when present, and re-emits any events those\n * embedded surfaces fire through `onEvent`.\n *\n * @param props - {@link PayrollBlockerListProps}\n * @returns The rendered blocker list.\n * @public\n */\nexport function PayrollBlockerList(props: PayrollBlockerListProps) {\n return (\n <BaseComponent {...props}>\n <Root {...props}>{props.children}</Root>\n </BaseComponent>\n )\n}\n\nfunction Root({ className, companyId, dictionary, onEvent }: PayrollBlockerListProps) {\n useComponentDictionary('Payroll.PayrollBlocker', dictionary)\n useI18n('Payroll.PayrollBlocker')\n const { t } = useTranslation('Payroll.PayrollBlocker')\n const { Button, Text, Heading, Alert } = useComponentContext()\n\n const [alertState, setAlertState] = useState<ResponseAlertState>({\n id: 0,\n alerts: [],\n })\n\n const handleDismissAlert = useCallback((alertId: number) => {\n setAlertState(prev => ({\n ...prev,\n alerts: prev.alerts.filter(alert => alert.id !== alertId),\n }))\n }, [])\n\n const addAlert = useCallback((alertType: ResponseAlertType) => {\n setAlertState(prev => ({\n id: prev.id + 1,\n alerts: [{ id: prev.id, type: alertType }, ...prev.alerts],\n }))\n }, [])\n\n const handleEvent = useCallback(\n (type: EventType, data?: unknown) => {\n if (type === recoveryCasesEvents.RECOVERY_CASE_RESUBMIT_DONE) {\n addAlert('recoveryCaseResubmitted')\n }\n\n if (type === informationRequestEvents.INFORMATION_REQUEST_FORM_DONE) {\n addAlert('informationRequestResponded')\n }\n\n onEvent(type, data)\n },\n [onEvent, addAlert],\n )\n\n const { data: blockersData } = usePayrollsGetBlockersSuspense({\n companyUuid: companyId,\n })\n\n const { data: recoveryCasesData } = useRecoveryCasesGetSuspense({\n companyUuid: companyId,\n })\n\n const { data: informationRequestsData } = useInformationRequestsGetInformationRequestsSuspense({\n companyUuid: companyId,\n })\n\n const payrollBlockerList = blockersData.payrollBlockers ?? []\n const blockers: PayrollBlocker[] = payrollBlockerList.map(blocker => {\n const blockerKey = blocker.key\n const translationKeys = getBlockerTranslationKeys(blockerKey)\n\n const title = t(translationKeys.titleKey, {\n defaultValue: t('genericBlockerTitle'),\n })\n\n const description = t(translationKeys.descriptionKey, {\n defaultValue: blocker.message || t('defaultBlockerDescription'),\n })\n\n return {\n id: blockerKey,\n title,\n description,\n }\n })\n\n const recoveryCases = recoveryCasesData.recoveryCases ?? []\n const informationRequests = informationRequestsData.informationRequests ?? []\n\n const hasUnrecoveredCases = recoveryCases.some(\n recoveryCase => recoveryCase.status !== 'recovered',\n )\n\n const hasInformationRequests = informationRequests.some(\n request => request.status !== InformationRequestStatus.Approved,\n )\n\n const dataViewProps = useDataView({\n data: blockers,\n columns: [\n {\n title: t('blockerSectionLabel'),\n render: blocker => (\n <FlexItem flexGrow={1}>\n <Flex flexDirection=\"column\" gap={8}>\n <Text weight=\"semibold\">{blocker.title}</Text>\n <Text variant=\"supporting\">{blocker.description}</Text>\n </Flex>\n </FlexItem>\n ),\n },\n {\n title: '',\n render: blocker => {\n const action = blocker.action\n\n if (!action) {\n return null\n }\n\n return (\n <Flex justifyContent=\"flex-end\" alignItems=\"center\">\n <Button variant=\"secondary\" onClick={action.onClick} title={action.label}>\n {action.label}\n </Button>\n </Flex>\n )\n },\n },\n ],\n })\n\n const hasBlockers = blockers.length > 0\n const hasAnyContent = hasBlockers || hasUnrecoveredCases || hasInformationRequests\n\n if (!hasAnyContent) {\n return (\n <div className={classNames(styles.root, className)}>\n <Text>{t('noBlockersMessage')}</Text>\n </div>\n )\n }\n\n return (\n <div className={classNames(styles.root, className)}>\n <Flex flexDirection=\"column\" gap={32}>\n {alertState.alerts.map(alert => (\n <Alert\n key={alert.id}\n status=\"success\"\n label={t(`alerts.${alert.type}.title`)}\n onDismiss={() => {\n handleDismissAlert(alert.id)\n }}\n >\n <Text>{t(`alerts.${alert.type}.description`)}</Text>\n </Alert>\n ))}\n\n {hasBlockers && (\n <Flex flexDirection=\"column\" gap={20}>\n <Heading as=\"h2\" styledAs=\"h4\">\n {t('blockersListTitle')}\n </Heading>\n <DataView {...dataViewProps} label={t('blockersListTitle')} />\n </Flex>\n )}\n\n {hasUnrecoveredCases && <RecoveryCases companyId={companyId} onEvent={handleEvent} />}\n\n {hasInformationRequests && (\n <InformationRequestsFlow companyId={companyId} withAlert={false} onEvent={handleEvent} />\n )}\n </Flex>\n </div>\n )\n}\n"],"names":["PayrollBlockerList","props","jsx","BaseComponent","Root","className","companyId","dictionary","onEvent","useComponentDictionary","useI18n","t","useTranslation","Button","Text","Heading","Alert","useComponentContext","alertState","setAlertState","useState","handleDismissAlert","useCallback","alertId","prev","alert","addAlert","alertType","handleEvent","type","data","recoveryCasesEvents","informationRequestEvents","blockersData","usePayrollsGetBlockersSuspense","recoveryCasesData","useRecoveryCasesGetSuspense","informationRequestsData","useInformationRequestsGetInformationRequestsSuspense","blockers","blocker","blockerKey","translationKeys","getBlockerTranslationKeys","title","description","recoveryCases","informationRequests","hasUnrecoveredCases","recoveryCase","hasInformationRequests","request","InformationRequestStatus","dataViewProps","useDataView","FlexItem","jsxs","Flex","action","hasBlockers","classNames","styles","DataView","RecoveryCases","InformationRequestsFlow"],"mappings":";;;;;;;;;;;;;;;;;;;;AAiEO,SAASA,GAAmBC,GAAgC;AACjE,SACE,gBAAAC,EAACC,GAAA,EAAe,GAAGF,GACjB,UAAA,gBAAAC,EAACE,KAAM,GAAGH,GAAQ,UAAAA,EAAM,SAAA,CAAS,EAAA,CACnC;AAEJ;AAEA,SAASG,EAAK,EAAE,WAAAC,GAAW,WAAAC,GAAW,YAAAC,GAAY,SAAAC,KAAoC;AACpF,EAAAC,EAAuB,0BAA0BF,CAAU,GAC3DG,EAAQ,wBAAwB;AAChC,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAe,wBAAwB,GAC/C,EAAE,QAAAC,GAAQ,MAAAC,GAAM,SAAAC,GAAS,OAAAC,EAAA,IAAUC,EAAA,GAEnC,CAACC,GAAYC,CAAa,IAAIC,EAA6B;AAAA,IAC/D,IAAI;AAAA,IACJ,QAAQ,CAAA;AAAA,EAAC,CACV,GAEKC,IAAqBC,EAAY,CAACC,MAAoB;AAC1D,IAAAJ,EAAc,CAAAK,OAAS;AAAA,MACrB,GAAGA;AAAA,MACH,QAAQA,EAAK,OAAO,OAAO,CAAAC,MAASA,EAAM,OAAOF,CAAO;AAAA,IAAA,EACxD;AAAA,EACJ,GAAG,CAAA,CAAE,GAECG,IAAWJ,EAAY,CAACK,MAAiC;AAC7D,IAAAR,EAAc,CAAAK,OAAS;AAAA,MAC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