@gusto/embedded-react-sdk 0.56.2 → 0.56.4
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 +31 -0
- package/dist/components/Common/FieldCaption/FieldCaption.js +19 -22
- package/dist/components/Common/FieldCaption/FieldCaption.js.map +1 -1
- package/dist/components/Common/FieldCaption/FieldCaption.module.scss.js +6 -6
- package/dist/components/Common/PaginationControl/PaginationControl.js +66 -62
- package/dist/components/Common/PaginationControl/PaginationControl.js.map +1 -1
- package/dist/components/Common/UI/Breadcrumbs/Breadcrumbs.js +1 -1
- package/dist/components/Common/UI/FileInput/FileInput.js +1 -1
- package/dist/components/Common/UI/ProgressBar/ProgressBar.js +4 -4
- package/dist/components/Company/PaySchedule/management/PaySchedule.js +60 -0
- package/dist/components/Company/PaySchedule/management/PaySchedule.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentReviewStepPresentation.js +67 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentReviewStepPresentation.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentScheduleStepPresentation.js +59 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentScheduleStepPresentation.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentTypeStepPresentation.js +57 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentTypeStepPresentation.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignment.js +46 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignment.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignmentComponents.js +101 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignmentComponents.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/payScheduleAssignmentStateMachine.js +81 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/payScheduleAssignmentStateMachine.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/stripNullAssignmentPreviewFields.js +18 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleAssignment/stripNullAssignmentPreviewFields.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleManagementComponents.js +56 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleManagementComponents.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleOverview.js +34 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleOverview.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleOverviewPresentation.js +77 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleOverviewPresentation.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleOverviewPresentation.module.scss.js +10 -0
- package/dist/components/Company/PaySchedule/management/PayScheduleOverviewPresentation.module.scss.js.map +1 -0
- package/dist/components/Company/PaySchedule/management/payScheduleManagementStateMachine.js +66 -0
- package/dist/components/Company/PaySchedule/management/payScheduleManagementStateMachine.js.map +1 -0
- package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js +75 -57
- package/dist/components/Company/StateTaxes/StateTaxesForm/StateTaxesForm.js.map +1 -1
- package/dist/components/Company/StateTaxes/shared/requirementSetError.js +15 -0
- package/dist/components/Company/StateTaxes/shared/requirementSetError.js.map +1 -0
- package/dist/components/Company/exports/companyManagement.js +7 -0
- package/dist/components/Company/exports/companyManagement.js.map +1 -0
- package/dist/components/Employee/FederalTaxes/shared/FederalTaxesView.js +1 -1
- package/dist/components/Employee/PaymentMethod/management/PaymentMethodBankForm.js +4 -4
- package/dist/components/Employee/PaymentMethod/onboarding/BankForm.js +4 -4
- package/dist/components/Flow/Flow.js +1 -1
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js +28 -28
- package/dist/components/Payroll/GrossUpModal/GrossUpModal.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js +51 -58
- package/dist/components/Payroll/PayrollBlocker/components/PayrollBlockerList.js.map +1 -1
- package/dist/components/Payroll/PayrollBlocker/payrollHelpers.js +12 -7
- package/dist/components/Payroll/PayrollBlocker/payrollHelpers.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js +87 -85
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfiguration.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js +1 -1
- package/dist/components/Payroll/PayrollConfiguration/PayrollConfigurationPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js +55 -54
- package/dist/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js +66 -62
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployee.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js +129 -125
- package/dist/components/Payroll/PayrollEditEmployee/PayrollEditEmployeePresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js +30 -27
- package/dist/components/Payroll/PayrollEditEmployee/TimeOffField.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields.js +41 -30
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/fields.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeHelpers.js.map +1 -1
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/usePayrollEditEmployeeForm.js +159 -152
- package/dist/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/usePayrollEditEmployeeForm.js.map +1 -1
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js +61 -59
- package/dist/components/Payroll/PayrollHistory/PayrollHistoryPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js +32 -31
- package/dist/components/Payroll/PayrollLanding/PayrollLandingFlowComponents.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollList.js +16 -16
- package/dist/components/Payroll/PayrollList/PayrollList.js.map +1 -1
- package/dist/components/Payroll/PayrollList/PayrollListPresentation.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js +61 -61
- package/dist/components/Payroll/PayrollOverview/PayrollOverview.js.map +1 -1
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js +192 -193
- package/dist/components/Payroll/PayrollOverview/PayrollOverviewPresentation.js.map +1 -1
- package/dist/components/Payroll/Transition/TransitionFlow.js +27 -22
- package/dist/components/Payroll/Transition/TransitionFlow.js.map +1 -1
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.js +55 -53
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.js.map +1 -1
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.js +44 -41
- package/dist/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.js.map +1 -1
- package/dist/components/Payroll/helpers.js +72 -67
- package/dist/components/Payroll/helpers.js.map +1 -1
- package/dist/components/Payroll/usePreparedPayrollData.js +34 -25
- package/dist/components/Payroll/usePreparedPayrollData.js.map +1 -1
- package/dist/contexts/ApiProvider/ApiProvider.js +23 -22
- package/dist/contexts/ApiProvider/ApiProvider.js.map +1 -1
- package/dist/contexts/ApiProvider/informationRequestEnumHook.js +30 -0
- package/dist/contexts/ApiProvider/informationRequestEnumHook.js.map +1 -0
- package/dist/contexts/UnstableFeaturesProvider/useUnstableFeature.js.map +1 -1
- package/dist/helpers/dateFormatting.js.map +1 -1
- package/dist/helpers/formattedStrings.js +9 -8
- package/dist/helpers/formattedStrings.js.map +1 -1
- package/dist/i18n/I18n.js +2 -0
- package/dist/i18n/I18n.js.map +1 -1
- package/dist/i18n/en/Company.Management.PaySchedule.json.js +24 -0
- package/dist/i18n/en/Company.Management.PaySchedule.json.js.map +1 -0
- package/dist/i18n/en/Company.Management.PayScheduleAssignment.json.js +18 -0
- package/dist/i18n/en/Company.Management.PayScheduleAssignment.json.js.map +1 -0
- package/dist/i18n/en/Company.StateTaxes.json.js +1 -1
- package/dist/i18n/en/Payroll.GrossUpModal.json.js +12 -14
- package/dist/i18n/en/Payroll.GrossUpModal.json.js.map +1 -1
- package/dist/i18n/en/Payroll.PayrollOverview.json.js +1 -1
- package/dist/i18n/en/common.json.js +36 -38
- package/dist/i18n/en/common.json.js.map +1 -1
- package/dist/index.js +137 -135
- package/dist/index.js.map +1 -1
- package/dist/package.json.js +1 -1
- package/dist/shared/constants.js +39 -31
- package/dist/shared/constants.js.map +1 -1
- package/dist/src/components/Company/PaySchedule/management/PaySchedule.d.ts +24 -0
- package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentReviewStepPresentation.d.ts +10 -0
- package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentScheduleStepPresentation.d.ts +11 -0
- package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/AssignmentTypeStepPresentation.d.ts +9 -0
- package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignment.d.ts +35 -0
- package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/PayScheduleAssignmentComponents.d.ts +29 -0
- package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/index.d.ts +1 -0
- package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/payScheduleAssignmentStateMachine.d.ts +7 -0
- package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/stripNullAssignmentPreviewFields.d.ts +12 -0
- package/dist/src/components/Company/PaySchedule/management/PayScheduleAssignment/usePayScheduleAssignment.d.ts +9 -0
- package/dist/src/components/Company/PaySchedule/management/PayScheduleManagementComponents.d.ts +20 -0
- package/dist/src/components/Company/PaySchedule/management/PayScheduleOverview.d.ts +11 -0
- package/dist/src/components/Company/PaySchedule/management/PayScheduleOverviewPresentation.d.ts +18 -0
- package/dist/src/components/Company/PaySchedule/management/index.d.ts +1 -0
- package/dist/src/components/Company/PaySchedule/management/payScheduleManagementStateMachine.d.ts +12 -0
- package/dist/src/components/Company/StateTaxes/shared/requirementSetError.d.ts +18 -0
- package/dist/src/components/Company/StateTaxes/shared/requirementSetError.test.d.ts +1 -0
- package/dist/src/components/Company/exports/companyManagement.d.ts +2 -0
- package/dist/src/components/Payroll/PayrollBlocker/payrollHelpers.d.ts +12 -0
- package/dist/src/components/Payroll/PayrollConfiguration/usePayrollConfigurationData.d.ts +6 -1
- package/dist/src/components/Payroll/PayrollEditEmployee/shared/usePayrollEditEmployeeForm/payrollEditEmployeeHelpers.d.ts +2 -2
- package/dist/src/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlert.d.ts +6 -1
- package/dist/src/components/Payroll/TransitionPayrollAlert/TransitionPayrollAlertPresentation.d.ts +7 -1
- package/dist/src/components/Payroll/helpers.d.ts +34 -0
- package/dist/src/components/Payroll/usePreparedPayrollData.d.ts +6 -1
- package/dist/src/components/index.d.ts +12 -0
- package/dist/src/contexts/ApiProvider/informationRequestEnumHook.d.ts +14 -0
- package/dist/src/contexts/ApiProvider/informationRequestEnumHook.test.d.ts +1 -0
- package/dist/src/contexts/UnstableFeaturesProvider/useUnstableFeature.d.ts +2 -0
- package/dist/src/helpers/dateFormatting.d.ts +2 -2
- package/dist/src/helpers/formattedStrings.d.ts +15 -0
- package/dist/src/i18n/en/common.json.d.ts +0 -1
- package/dist/src/i18n/types.d.ts +96 -6
- package/dist/src/models/external.d.ts +12 -0
- package/dist/src/shared/constants.d.ts +16 -0
- package/dist/style.css +1 -1
- package/dist/types/sdkError.js +32 -21
- package/dist/types/sdkError.js.map +1 -1
- package/docs/guides/endpoint-inventory.json +59 -10
- package/package.json +7 -7
|
@@ -1,108 +1,101 @@
|
|
|
1
|
-
import { jsx as o, jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { useTranslation as
|
|
1
|
+
import { jsx as o, jsxs as d } from "react/jsx-runtime";
|
|
2
|
+
import { useState as I, useCallback as u } from "react";
|
|
3
|
+
import { useTranslation as S } from "react-i18next";
|
|
4
4
|
import C from "classnames";
|
|
5
|
-
import { usePayrollsGetBlockersSuspense as
|
|
6
|
-
import {
|
|
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";
|
|
5
|
+
import { usePayrollsGetBlockersSuspense as v } from "@gusto/embedded-api/react-query/payrollsGetBlockers";
|
|
6
|
+
import { PENDING_RECOVERY_CASE_BLOCKER_KEY as K, PENDING_INFORMATION_REQUEST_BLOCKER_KEY as w, getBlockerTranslationKeys as L } from "../payrollHelpers.js";
|
|
10
7
|
import B from "./PayrollBlockerList.module.scss.js";
|
|
11
|
-
import { useComponentContext as
|
|
12
|
-
import { FlexItem as
|
|
13
|
-
import { DataView as
|
|
14
|
-
import { useDataView as
|
|
15
|
-
import { useComponentDictionary as
|
|
8
|
+
import { useComponentContext as V } from "../../../../contexts/ComponentAdapter/useComponentContext.js";
|
|
9
|
+
import { FlexItem as F, Flex as i } from "../../../Common/Flex/Flex.js";
|
|
10
|
+
import { DataView as M } from "../../../Common/DataView/DataView.js";
|
|
11
|
+
import { useDataView as q } from "../../../Common/DataView/useDataView.js";
|
|
12
|
+
import { useComponentDictionary as G, useI18n as U } from "../../../../i18n/I18n.js";
|
|
16
13
|
import { RecoveryCases as Y } from "../../RecoveryCases/RecoveryCases.js";
|
|
17
|
-
import { BaseComponent as
|
|
14
|
+
import { BaseComponent as j } from "../../../Base/Base.js";
|
|
18
15
|
import "../../../Base/useBase.js";
|
|
19
|
-
import { recoveryCasesEvents as
|
|
20
|
-
import { InformationRequestsFlow as
|
|
21
|
-
function
|
|
22
|
-
return /* @__PURE__ */ o(
|
|
16
|
+
import { recoveryCasesEvents as Q, informationRequestEvents as $ } from "../../../../shared/constants.js";
|
|
17
|
+
import { InformationRequestsFlow as H } from "../../../InformationRequests/InformationRequests.js";
|
|
18
|
+
function pe(l) {
|
|
19
|
+
return /* @__PURE__ */ o(j, { ...l, children: /* @__PURE__ */ o(z, { ...l, children: l.children }) });
|
|
23
20
|
}
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
const { t: r } =
|
|
21
|
+
function z({ className: l, companyId: a, dictionary: D, onEvent: f }) {
|
|
22
|
+
G("Payroll.PayrollBlocker", D), U("Payroll.PayrollBlocker");
|
|
23
|
+
const { t: r } = S("Payroll.PayrollBlocker"), { Button: _, Text: n, Heading: b, Alert: g } = V(), [x, p] = I({
|
|
27
24
|
id: 0,
|
|
28
25
|
alerts: []
|
|
29
|
-
}),
|
|
30
|
-
|
|
26
|
+
}), A = u((e) => {
|
|
27
|
+
p((t) => ({
|
|
31
28
|
...t,
|
|
32
|
-
alerts: t.alerts.filter((
|
|
29
|
+
alerts: t.alerts.filter((s) => s.id !== e)
|
|
33
30
|
}));
|
|
34
|
-
}, []), c =
|
|
35
|
-
|
|
31
|
+
}, []), c = u((e) => {
|
|
32
|
+
p((t) => ({
|
|
36
33
|
id: t.id + 1,
|
|
37
34
|
alerts: [{ id: t.id, type: e }, ...t.alerts]
|
|
38
35
|
}));
|
|
39
|
-
}, []),
|
|
36
|
+
}, []), h = u(
|
|
40
37
|
(e, t) => {
|
|
41
|
-
e ===
|
|
38
|
+
e === Q.RECOVERY_CASE_RESUBMIT_DONE && c("recoveryCaseResubmitted"), e === $.INFORMATION_REQUEST_FORM_DONE && c("informationRequestResponded"), f(e, t);
|
|
42
39
|
},
|
|
43
|
-
[
|
|
44
|
-
), { data:
|
|
45
|
-
companyUuid:
|
|
46
|
-
}),
|
|
47
|
-
|
|
48
|
-
}), { data: q } = _({
|
|
49
|
-
companyUuid: n
|
|
50
|
-
}), y = (A.payrollBlockers ?? []).map((e) => {
|
|
51
|
-
const t = e.key, l = K(t), I = r(l.titleKey, {
|
|
40
|
+
[f, c]
|
|
41
|
+
), { data: N } = v({
|
|
42
|
+
companyUuid: a
|
|
43
|
+
}), m = N.payrollBlockers ?? [], y = m.map((e) => {
|
|
44
|
+
const t = e.key, s = L(t), P = r(s.titleKey, {
|
|
52
45
|
defaultValue: r("genericBlockerTitle")
|
|
53
|
-
}),
|
|
46
|
+
}), T = r(s.descriptionKey, {
|
|
54
47
|
defaultValue: e.message || r("defaultBlockerDescription")
|
|
55
48
|
});
|
|
56
49
|
return {
|
|
57
50
|
id: t,
|
|
58
|
-
title:
|
|
59
|
-
description:
|
|
51
|
+
title: P,
|
|
52
|
+
description: T
|
|
60
53
|
};
|
|
61
|
-
}),
|
|
62
|
-
(e) => e.
|
|
63
|
-
),
|
|
64
|
-
(e) => e.
|
|
65
|
-
),
|
|
54
|
+
}), k = m.some(
|
|
55
|
+
(e) => e.key === K
|
|
56
|
+
), E = m.some(
|
|
57
|
+
(e) => e.key === w
|
|
58
|
+
), O = q({
|
|
66
59
|
data: y,
|
|
67
60
|
columns: [
|
|
68
61
|
{
|
|
69
62
|
title: r("blockerSectionLabel"),
|
|
70
|
-
render: (e) => /* @__PURE__ */ o(
|
|
71
|
-
/* @__PURE__ */ o(
|
|
72
|
-
/* @__PURE__ */ o(
|
|
63
|
+
render: (e) => /* @__PURE__ */ o(F, { flexGrow: 1, children: /* @__PURE__ */ d(i, { flexDirection: "column", gap: 8, children: [
|
|
64
|
+
/* @__PURE__ */ o(n, { weight: "semibold", children: e.title }),
|
|
65
|
+
/* @__PURE__ */ o(n, { variant: "supporting", children: e.description })
|
|
73
66
|
] }) })
|
|
74
67
|
},
|
|
75
68
|
{
|
|
76
69
|
title: "",
|
|
77
70
|
render: (e) => {
|
|
78
71
|
const t = e.action;
|
|
79
|
-
return t ? /* @__PURE__ */ o(
|
|
72
|
+
return t ? /* @__PURE__ */ o(i, { justifyContent: "flex-end", alignItems: "center", children: /* @__PURE__ */ o(_, { variant: "secondary", onClick: t.onClick, title: t.label, children: t.label }) }) : null;
|
|
80
73
|
}
|
|
81
74
|
}
|
|
82
75
|
]
|
|
83
76
|
}), R = y.length > 0;
|
|
84
|
-
return R ||
|
|
77
|
+
return R || k || E ? /* @__PURE__ */ o("div", { className: C(B.root, l), children: /* @__PURE__ */ d(i, { flexDirection: "column", gap: 32, children: [
|
|
85
78
|
x.alerts.map((e) => /* @__PURE__ */ o(
|
|
86
79
|
g,
|
|
87
80
|
{
|
|
88
81
|
status: "success",
|
|
89
82
|
label: r(`alerts.${e.type}.title`),
|
|
90
83
|
onDismiss: () => {
|
|
91
|
-
|
|
84
|
+
A(e.id);
|
|
92
85
|
},
|
|
93
|
-
children: /* @__PURE__ */ o(
|
|
86
|
+
children: /* @__PURE__ */ o(n, { children: r(`alerts.${e.type}.description`) })
|
|
94
87
|
},
|
|
95
88
|
e.id
|
|
96
89
|
)),
|
|
97
|
-
R && /* @__PURE__ */
|
|
90
|
+
R && /* @__PURE__ */ d(i, { flexDirection: "column", gap: 20, children: [
|
|
98
91
|
/* @__PURE__ */ o(b, { as: "h2", styledAs: "h4", children: r("blockersListTitle") }),
|
|
99
|
-
/* @__PURE__ */ o(
|
|
92
|
+
/* @__PURE__ */ o(M, { ...O, label: r("blockersListTitle") })
|
|
100
93
|
] }),
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
] }) }) : /* @__PURE__ */ o("div", { className: C(B.root,
|
|
94
|
+
k && /* @__PURE__ */ o(Y, { companyId: a, onEvent: h }),
|
|
95
|
+
E && /* @__PURE__ */ o(H, { companyId: a, withAlert: !1, onEvent: h })
|
|
96
|
+
] }) }) : /* @__PURE__ */ o("div", { className: C(B.root, l), children: /* @__PURE__ */ o(n, { children: r("noBlockersMessage") }) });
|
|
104
97
|
}
|
|
105
98
|
export {
|
|
106
|
-
|
|
99
|
+
pe as PayrollBlockerList
|
|
107
100
|
};
|
|
108
101
|
//# 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: 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,GAA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/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 {\n getBlockerTranslationKeys,\n PENDING_INFORMATION_REQUEST_BLOCKER_KEY,\n PENDING_RECOVERY_CASE_BLOCKER_KEY,\n} 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 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 // Gate the recovery-cases and information-requests surfaces on the backend's own blocker keys\n // rather than eagerly fetching each one here. Those surfaces self-fetch inside their own error\n // boundaries, so probing them from this parent both duplicated the request and, when the flow's\n // token wasn't scoped for that endpoint (e.g. recovery cases in the dismissal flow), threw and\n // took down the entire blocker screen -- including an otherwise-viewable RFI (SDK-1347).\n const hasRecoveryCaseBlocker = payrollBlockerList.some(\n blocker => blocker.key === PENDING_RECOVERY_CASE_BLOCKER_KEY,\n )\n const hasInformationRequestBlocker = payrollBlockerList.some(\n blocker => blocker.key === PENDING_INFORMATION_REQUEST_BLOCKER_KEY,\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 || hasRecoveryCaseBlocker || hasInformationRequestBlocker\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 {hasRecoveryCaseBlocker && <RecoveryCases companyId={companyId} onEvent={handleEvent} />}\n\n {hasInformationRequestBlocker && (\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","payrollBlockerList","blockers","blocker","blockerKey","translationKeys","getBlockerTranslationKeys","title","description","hasRecoveryCaseBlocker","PENDING_RECOVERY_CASE_BLOCKER_KEY","hasInformationRequestBlocker","PENDING_INFORMATION_REQUEST_BLOCKER_KEY","dataViewProps","useDataView","FlexItem","jsxs","Flex","action","hasBlockers","classNames","styles","DataView","RecoveryCases","InformationRequestsFlow"],"mappings":";;;;;;;;;;;;;;;;;AAkEO,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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Ac,EAAA,CAAE;AAAA,MAAA;AAAA,MAPxCA,EAAM;AAAA,IAAA,CASd;AAAA,IAEA4B,KACC,gBAAAH,EAACC,GAAA,EAAK,eAAc,UAAS,KAAK,IAChC,UAAA;AAAA,MAAA,gBAAAjD,EAACa,KAAQ,IAAG,MAAK,UAAS,MACvB,UAAAJ,EAAE,mBAAmB,GACxB;AAAA,wBACC6C,GAAA,EAAU,GAAGT,GAAe,OAAOpC,EAAE,mBAAmB,EAAA,CAAG;AAAA,IAAA,GAC9D;AAAA,IAGDgC,KAA0B,gBAAAzC,EAACuD,GAAA,EAAc,WAAAnD,GAAsB,SAASsB,GAAa;AAAA,IAErFiB,KACC,gBAAA3C,EAACwD,GAAA,EAAwB,WAAApD,GAAsB,WAAW,IAAO,SAASsB,EAAA,CAAa;AAAA,EAAA,EAAA,CAE3F,EAAA,CACF,IArCE,gBAAA1B,EAAC,OAAA,EAAI,WAAWoD,EAAWC,EAAO,MAAMlD,CAAS,GAC/C,UAAA,gBAAAH,EAACY,GAAA,EAAM,UAAAH,EAAE,mBAAmB,GAAE,GAChC;AAqCN;"}
|
|
@@ -12,7 +12,7 @@ function a(e) {
|
|
|
12
12
|
function i(e) {
|
|
13
13
|
return l(e) ? !e.errors || e.errors.length === 0 ? [] : e.errors.map((r) => ({ key: t(r.metadata) ? r.metadata.key : r.errorKey || "unknown", message: r.message })) : a(e) ? e.errors.filter((r) => r.category === "payroll_blocker").map((r) => ({ key: t(r.metadata) ? r.metadata.key : r.errorKey || "unknown", message: r.message })) : [];
|
|
14
14
|
}
|
|
15
|
-
const y = (e) => e instanceof s ? !0 : e instanceof n ? e.errors.some((o) => o.category === "payroll_blocker") : !1,
|
|
15
|
+
const y = (e) => e instanceof s ? !0 : e instanceof n ? e.errors.some((o) => o.category === "payroll_blocker") : !1, m = async (e) => {
|
|
16
16
|
try {
|
|
17
17
|
return await e(), { success: !0, blockers: [] };
|
|
18
18
|
} catch (o) {
|
|
@@ -20,8 +20,11 @@ const y = (e) => e instanceof s ? !0 : e instanceof n ? e.errors.some((o) => o.c
|
|
|
20
20
|
return { success: !1, blockers: i(o) };
|
|
21
21
|
throw o;
|
|
22
22
|
}
|
|
23
|
-
}, u =
|
|
24
|
-
|
|
23
|
+
}, u = "pending_information_request", k = "pending_recovery_case", f = [
|
|
24
|
+
u,
|
|
25
|
+
k
|
|
26
|
+
], b = (e) => f.includes(e), _ = (e) => e.some((o) => b(o.key));
|
|
27
|
+
function K(e) {
|
|
25
28
|
return {
|
|
26
29
|
titleKey: `blockers.${e}.title`,
|
|
27
30
|
descriptionKey: `blockers.${e}.description`,
|
|
@@ -30,10 +33,12 @@ function g(e) {
|
|
|
30
33
|
};
|
|
31
34
|
}
|
|
32
35
|
export {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
u as PENDING_INFORMATION_REQUEST_BLOCKER_KEY,
|
|
37
|
+
k as PENDING_RECOVERY_CASE_BLOCKER_KEY,
|
|
38
|
+
K as getBlockerTranslationKeys,
|
|
39
|
+
_ as hasActionableBlockers,
|
|
40
|
+
b as isActionableBlocker,
|
|
36
41
|
i as parsePayrollBlockersFromError,
|
|
37
|
-
|
|
42
|
+
m as payrollSubmitHandler
|
|
38
43
|
};
|
|
39
44
|
//# sourceMappingURL=payrollHelpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payrollHelpers.js","sources":["../../../../src/components/Payroll/PayrollBlocker/payrollHelpers.ts"],"sourcesContent":["import { PayrollBlockersError } from '@gusto/embedded-api/models/errors/payrollblockerserror'\nimport { UnprocessableEntityError } from '@gusto/embedded-api/models/errors/unprocessableentityerror'\n\nfunction hasMetadataKey(metadata: unknown): metadata is { key: string } {\n return (\n typeof metadata === 'object' &&\n metadata !== null &&\n 'key' in metadata &&\n typeof (metadata as { key: unknown }).key === 'string'\n )\n}\n\n/**\n * A single payroll blocker entry: an issue that must be resolved before a payroll can be\n * calculated or submitted (for example, missing employee information, invalid tax setups,\n * or incomplete company configuration).\n *\n * @public\n */\nexport interface ApiPayrollBlocker {\n /** Stable identifier for the blocker type, used to look up display copy and behavior. */\n key: string\n /** Human-readable message describing the blocker, when provided by the API. */\n message?: string\n}\n\nfunction isPayrollBlockersError(error: unknown): error is PayrollBlockersError {\n return error instanceof PayrollBlockersError\n}\n\nfunction isUnprocessableEntityWithPayrollBlockers(\n error: unknown,\n): error is UnprocessableEntityError {\n return (\n error instanceof UnprocessableEntityError &&\n error.errors.some(err => err.category === 'payroll_blocker')\n )\n}\n\n/** @internal */\nexport function parsePayrollBlockersFromError(error: unknown): ApiPayrollBlocker[] {\n // Handle PayrollBlockersError (dedicated blocker error type)\n if (isPayrollBlockersError(error)) {\n if (!error.errors || error.errors.length === 0) {\n return []\n }\n\n const blockers = error.errors.map(err => {\n const key = hasMetadataKey(err.metadata) ? err.metadata.key : err.errorKey || 'unknown'\n\n return { key, message: err.message }\n })\n\n return blockers\n }\n\n // Handle UnprocessableEntityError with payroll_blocker category (e.g. contractor payment preview, payroll calculate)\n if (isUnprocessableEntityWithPayrollBlockers(error)) {\n const blockers = error.errors\n .filter(err => err.category === 'payroll_blocker')\n .map(err => {\n const key = hasMetadataKey(err.metadata) ? err.metadata.key : err.errorKey || 'unknown'\n\n return { key, message: err.message }\n })\n\n return blockers\n }\n\n return []\n}\n\ntype PayrollBlockerError = PayrollBlockersError | UnprocessableEntityError\n\nconst hasPayrollBlockers = (error: unknown): error is PayrollBlockerError => {\n if (error instanceof PayrollBlockersError) {\n return true\n }\n if (error instanceof UnprocessableEntityError) {\n return error.errors.some(err => err.category === 'payroll_blocker')\n }\n return false\n}\n\n/** @internal */\nexport interface PayrollSubmitResult {\n /** Whether the wrapped payroll operation completed without payroll blockers. */\n success: boolean\n /** Blockers parsed from the caught error; empty when `success` is `true`. */\n blockers: ApiPayrollBlocker[]\n}\n\n/** @internal */\nexport const payrollSubmitHandler = async (\n payrollHandler: () => Promise<void>,\n): Promise<PayrollSubmitResult> => {\n try {\n await payrollHandler()\n return { success: true, blockers: [] }\n } catch (error: unknown) {\n if (hasPayrollBlockers(error)) {\n const blockers = parsePayrollBlockersFromError(error)\n return { success: false, blockers }\n }\n\n // For non-payroll errors, re-throw\n throw error\n }\n}\n\
|
|
1
|
+
{"version":3,"file":"payrollHelpers.js","sources":["../../../../src/components/Payroll/PayrollBlocker/payrollHelpers.ts"],"sourcesContent":["import { PayrollBlockersError } from '@gusto/embedded-api/models/errors/payrollblockerserror'\nimport { UnprocessableEntityError } from '@gusto/embedded-api/models/errors/unprocessableentityerror'\n\nfunction hasMetadataKey(metadata: unknown): metadata is { key: string } {\n return (\n typeof metadata === 'object' &&\n metadata !== null &&\n 'key' in metadata &&\n typeof (metadata as { key: unknown }).key === 'string'\n )\n}\n\n/**\n * A single payroll blocker entry: an issue that must be resolved before a payroll can be\n * calculated or submitted (for example, missing employee information, invalid tax setups,\n * or incomplete company configuration).\n *\n * @public\n */\nexport interface ApiPayrollBlocker {\n /** Stable identifier for the blocker type, used to look up display copy and behavior. */\n key: string\n /** Human-readable message describing the blocker, when provided by the API. */\n message?: string\n}\n\nfunction isPayrollBlockersError(error: unknown): error is PayrollBlockersError {\n return error instanceof PayrollBlockersError\n}\n\nfunction isUnprocessableEntityWithPayrollBlockers(\n error: unknown,\n): error is UnprocessableEntityError {\n return (\n error instanceof UnprocessableEntityError &&\n error.errors.some(err => err.category === 'payroll_blocker')\n )\n}\n\n/** @internal */\nexport function parsePayrollBlockersFromError(error: unknown): ApiPayrollBlocker[] {\n // Handle PayrollBlockersError (dedicated blocker error type)\n if (isPayrollBlockersError(error)) {\n if (!error.errors || error.errors.length === 0) {\n return []\n }\n\n const blockers = error.errors.map(err => {\n const key = hasMetadataKey(err.metadata) ? err.metadata.key : err.errorKey || 'unknown'\n\n return { key, message: err.message }\n })\n\n return blockers\n }\n\n // Handle UnprocessableEntityError with payroll_blocker category (e.g. contractor payment preview, payroll calculate)\n if (isUnprocessableEntityWithPayrollBlockers(error)) {\n const blockers = error.errors\n .filter(err => err.category === 'payroll_blocker')\n .map(err => {\n const key = hasMetadataKey(err.metadata) ? err.metadata.key : err.errorKey || 'unknown'\n\n return { key, message: err.message }\n })\n\n return blockers\n }\n\n return []\n}\n\ntype PayrollBlockerError = PayrollBlockersError | UnprocessableEntityError\n\nconst hasPayrollBlockers = (error: unknown): error is PayrollBlockerError => {\n if (error instanceof PayrollBlockersError) {\n return true\n }\n if (error instanceof UnprocessableEntityError) {\n return error.errors.some(err => err.category === 'payroll_blocker')\n }\n return false\n}\n\n/** @internal */\nexport interface PayrollSubmitResult {\n /** Whether the wrapped payroll operation completed without payroll blockers. */\n success: boolean\n /** Blockers parsed from the caught error; empty when `success` is `true`. */\n blockers: ApiPayrollBlocker[]\n}\n\n/** @internal */\nexport const payrollSubmitHandler = async (\n payrollHandler: () => Promise<void>,\n): Promise<PayrollSubmitResult> => {\n try {\n await payrollHandler()\n return { success: true, blockers: [] }\n } catch (error: unknown) {\n if (hasPayrollBlockers(error)) {\n const blockers = parsePayrollBlockersFromError(error)\n return { success: false, blockers }\n }\n\n // For non-payroll errors, re-throw\n throw error\n }\n}\n\n/**\n * Blocker key the backend returns when a company has an outstanding information request.\n *\n * @internal\n */\nexport const PENDING_INFORMATION_REQUEST_BLOCKER_KEY = 'pending_information_request'\n/**\n * Blocker key the backend returns when a company has an open recovery case.\n *\n * @internal\n */\nexport const PENDING_RECOVERY_CASE_BLOCKER_KEY = 'pending_recovery_case'\n\nconst ACTIONABLE_BLOCKER_KEYS = [\n PENDING_INFORMATION_REQUEST_BLOCKER_KEY,\n PENDING_RECOVERY_CASE_BLOCKER_KEY,\n] as const\n\n/** @internal */\nexport const isActionableBlocker = (key: string) =>\n ACTIONABLE_BLOCKER_KEYS.includes(key as (typeof ACTIONABLE_BLOCKER_KEYS)[number])\n\n/** @internal */\nexport const hasActionableBlockers = (blockers: ApiPayrollBlocker[]) =>\n blockers.some(b => isActionableBlocker(b.key))\n\n/** @internal */\nexport function getBlockerTranslationKeys(key: string) {\n return {\n titleKey: `blockers.${key}.title`,\n descriptionKey: `blockers.${key}.description`,\n helpTextKey: `blockers.${key}.help`,\n defaultActionKey: `blockers.${key}.defaultAction`,\n }\n}\n"],"names":["hasMetadataKey","metadata","isPayrollBlockersError","error","PayrollBlockersError","isUnprocessableEntityWithPayrollBlockers","UnprocessableEntityError","err","parsePayrollBlockersFromError","hasPayrollBlockers","payrollSubmitHandler","payrollHandler","PENDING_INFORMATION_REQUEST_BLOCKER_KEY","PENDING_RECOVERY_CASE_BLOCKER_KEY","ACTIONABLE_BLOCKER_KEYS","isActionableBlocker","key","hasActionableBlockers","blockers","b","getBlockerTranslationKeys"],"mappings":";;AAGA,SAASA,EAAeC,GAAgD;AACtE,SACE,OAAOA,KAAa,YACpBA,MAAa,QACb,SAASA,KACT,OAAQA,EAA8B,OAAQ;AAElD;AAgBA,SAASC,EAAuBC,GAA+C;AAC7E,SAAOA,aAAiBC;AAC1B;AAEA,SAASC,EACPF,GACmC;AACnC,SACEA,aAAiBG,KACjBH,EAAM,OAAO,KAAK,CAAAI,MAAOA,EAAI,aAAa,iBAAiB;AAE/D;AAGO,SAASC,EAA8BL,GAAqC;AAEjF,SAAID,EAAuBC,CAAK,IAC1B,CAACA,EAAM,UAAUA,EAAM,OAAO,WAAW,IACpC,CAAA,IAGQA,EAAM,OAAO,IAAI,CAAAI,OAGzB,EAAE,KAFGP,EAAeO,EAAI,QAAQ,IAAIA,EAAI,SAAS,MAAMA,EAAI,YAAY,WAEhE,SAASA,EAAI,QAAA,EAC5B,IAMCF,EAAyCF,CAAK,IAC/BA,EAAM,OACpB,OAAO,CAAAI,MAAOA,EAAI,aAAa,iBAAiB,EAChD,IAAI,CAAAA,OAGI,EAAE,KAFGP,EAAeO,EAAI,QAAQ,IAAIA,EAAI,SAAS,MAAMA,EAAI,YAAY,WAEhE,SAASA,EAAI,QAAA,EAC5B,IAKE,CAAA;AACT;AAIA,MAAME,IAAqB,CAACN,MACtBA,aAAiBC,IACZ,KAELD,aAAiBG,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